In ColumnHideShowLayer, the implementation of {save,load}State() is as follows:
@Override
public void saveState(String prefix, Properties properties) {
if (hiddenColumnIndexes.size() > 0) {
StringBuilder strBuilder = new StringBuilder();
for (Integer index : hiddenColumnIndexes) {
strBuilder.append(index);
strBuilder.append(',');
}
properties.setProperty(prefix + PERSISTENCE_KEY_HIDDEN_COLUMN_INDEXES, strBuilder.toString());
}
super.saveState(prefix, properties);
}
@Override
public void loadState(String prefix, Properties properties) {
String property = properties.getProperty(prefix + PERSISTENCE_KEY_HIDDEN_COLUMN_INDEXES);
if (property != null) {
hiddenColumnIndexes.clear();
StringTokenizer tok = new StringTokenizer(property, ","); //$NON-NLS-1$
while (tok.hasMoreTokens()) {
String index = tok.nextToken();
hiddenColumnIndexes.add(Integer.valueOf(index));
}
}
super.loadState(prefix, properties);
}
This has the effect of not saying anything about the visibility of columns unless at least one is hidden. I am finding this unfortunate, because I am implementing tabs along the bottom (like in Excel) for swapping between configurations. It works beautifully for most things, but not column visibility.
Actually, the sort settings have the same issue. If there is no sort, no property is written out regarding sorts.
It's as though when saving the state of a grid with no hidden or sorted columns, it is saying, "I don't know whether any columns were hidden or sorted, go with what you currently have". I think it would be better for it to say -- via empty properties -- "I can affirm that when this was saved, there were no hidden or sorted columns".