Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Suggestion regarding ColumnHideShowLayer.saveState()
Suggestion regarding ColumnHideShowLayer.saveState() [message #1016545] Wed, 06 March 2013 20:47 Go to next message
Patrick Rusk is currently offline Patrick RuskFriend
Messages: 35
Registered: June 2012
Member
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".
Re: Suggestion regarding ColumnHideShowLayer.saveState() [message #1016553 is a reply to message #1016545] Wed, 06 March 2013 21:18 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=396925
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402471
https://bugs.eclipse.org/bugs/show_bug.cgi?id=379917
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390943
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402014

https://bugs.eclipse.org/bugs/show_bug.cgi?id=397036
Previous Topic:want two TreeCheckBoxPainters in a single cell
Next Topic:Implementing IUniqueIndexLayer by a CompositeLayer
Goto Forum:
  


Current Time: Mon Dec 22 20:55:20 GMT 2014

Powered by FUDForum. Page generated in 0.01755 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software