Revision 38eaa3c8
Added by Patrick Plitzner over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java | ||
---|---|---|
17 | 17 |
import org.eclipse.swt.widgets.Display; |
18 | 18 |
import org.eclipse.ui.forms.IFormPart; |
19 | 19 |
import org.eclipse.ui.forms.ManagedForm; |
20 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
|
21 |
import org.eclipse.ui.forms.events.IExpansionListener; |
|
22 | 20 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
23 |
import org.eclipse.ui.forms.widgets.Section; |
|
24 | 21 |
|
25 | 22 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
26 | 23 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
27 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
|
28 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
29 | 24 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
30 | 25 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
31 | 26 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
... | ... | |
177 | 172 |
formFactory.removePropertyChangeListener(sectionPart); |
178 | 173 |
} |
179 | 174 |
|
180 |
protected void addPart(AbstractFormSection<?> section, boolean isDefaultExpanded){
|
|
175 |
protected void addPart(AbstractFormSection<?> section){ |
|
181 | 176 |
CdmSectionPart<?> sectionPart = new CdmSectionPart<>(section); |
182 | 177 |
managedForm.addPart(sectionPart); |
183 | 178 |
formFactory.addPropertyChangeListener(sectionPart); |
184 |
PreferencesUtil.getPreferenceStore().setDefault(section.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName(), isDefaultExpanded); |
|
185 |
section.setExpanded(PreferencesUtil.getPreferenceStore().getBoolean(section.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName())); |
|
186 |
section.addExpansionListener(new ExpandListener(section)); |
|
187 | 179 |
} |
188 | 180 |
|
189 | 181 |
@Override |
... | ... | |
191 | 183 |
return viewPart.getConversationHolder(); |
192 | 184 |
} |
193 | 185 |
|
194 |
/** {@inheritDoc} */ |
|
195 |
@Override |
|
196 |
public void update(CdmDataChangeMap changeEvents) {} |
|
197 |
|
|
198 |
private class ExpandListener implements IExpansionListener{ |
|
199 |
|
|
200 |
private Section section; |
|
201 |
|
|
202 |
public ExpandListener(Section section) { |
|
203 |
super(); |
|
204 |
this.section = section; |
|
205 |
} |
|
206 |
|
|
207 |
@Override |
|
208 |
public void expansionStateChanging(ExpansionEvent e) { |
|
209 |
} |
|
210 |
|
|
211 |
@Override |
|
212 |
public void expansionStateChanged(ExpansionEvent e) { |
|
213 |
PreferencesUtil.getPreferenceStore().setValue(section.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName(), e.getState()); |
|
214 |
} |
|
215 |
|
|
216 |
} |
|
217 |
|
|
218 | 186 |
} |
Also available in: Unified diff
fix #6059 Save expand state for details view, supplemental view
including sub sections