Project

General

Profile

« Previous | Next » 

Revision 5a073138

Added by Patrick Plitzner over 7 years ago

ref #6059 Save expand state for supplemental data view

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
18 18
import org.eclipse.jface.viewers.TreeNode;
19 19
import org.eclipse.swt.SWT;
20 20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.ui.forms.events.ExpansionEvent;
22
import org.eclipse.ui.forms.events.IExpansionListener;
23 21
import org.eclipse.ui.forms.widgets.ExpandableComposite;
24
import org.eclipse.ui.forms.widgets.Section;
25 22

  
26 23
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
27 24
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
......
330 327

  
331 328
        EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
332 329

  
333
        addPart(emptySection);
330
        addPart(emptySection, false);
334 331
    }
335 332

  
336 333
    private void createGroupSection(RootElement parent) {
......
782 779
        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
783 780
        addPart(definedTermDetailSection, true);
784 781
    }
785
    
786
	protected void addPart(AbstractFormSection section, boolean isDefaultExpanded){
787
		super.addPart(section);
788
		PreferencesUtil.getPreferenceStore().setDefault(section.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName(), isDefaultExpanded);
789
		section.setExpanded(PreferencesUtil.getPreferenceStore().getBoolean(section.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName()));
790
		section.addExpansionListener(new ExpandListener(section));
791
	}
792
    
793
    private class ExpandListener implements IExpansionListener{
794
    	
795
    	private Section section;
796
    	
797
		public ExpandListener(Section section) {
798
			super();
799
			this.section = section;
800
		}
801

  
802
		@Override
803
		public void expansionStateChanging(ExpansionEvent e) {
804
		}
805

  
806
		@Override
807
		public void expansionStateChanged(ExpansionEvent e) {
808
			PreferencesUtil.getPreferenceStore().setValue(section.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName(), e.getState());
809
		}
810
    	
811
    }
812 782

  
813 783
}

Also available in: Unified diff