From 6a9dd32f15a4b59e7badc8b1c83cba2ea704042d Mon Sep 17 00:00:00 2001 From: Patric Plitzner Date: Mon, 27 May 2013 11:57:22 +0000 Subject: [PATCH] - formatted code - fixed warnings --- .../ui/element/AbstractFormSection.java | 121 +++--- .../taxeditor/ui/element/CdmFormFactory.java | 309 ++++++++-------- .../DerivedUnitFacadeDetailElement.java | 33 +- .../FieldObservationDetailElement.java | 35 +- .../GatheringEventDetailElement.java | 86 ++--- .../occurrence/GeneralDetailElement.java | 42 +-- .../taxeditor/view/AbstractCdmDataViewer.java | 98 ++--- .../taxeditor/view/detail/DetailsViewer.java | 346 +++++++----------- 8 files changed, 504 insertions(+), 566 deletions(-) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java index b245498e9..0ebb93641 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.element; @@ -39,7 +39,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil; *

* Abstract AbstractFormSection class. *

- * + * * @author n.hoffmann * @created Feb 22, 2010 * @version 1.0 @@ -53,7 +53,7 @@ public abstract class AbstractFormSection extends Section implements private ENTITY entity; - private Set elements = new HashSet(); + private final Set elements = new HashSet(); protected CdmFormFactory formFactory; @@ -67,7 +67,7 @@ public abstract class AbstractFormSection extends Section implements *

* Constructor for AbstractFormSection. *

- * + * * @param conversation * TODO * @param style @@ -107,7 +107,7 @@ public abstract class AbstractFormSection extends Section implements *

* Constructor for AbstractFormSection. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -133,15 +133,17 @@ public abstract class AbstractFormSection extends Section implements *

* Getter for the field propertyChangeListeners. *

- * + * * @return a {@link java.util.Set} object. */ - public List getPropertyChangeListeners() { + @Override + public List getPropertyChangeListeners() { return propertyChangeListeners; } /** {@inheritDoc} */ - public void setPropertyChangeListeners( + @Override + public void setPropertyChangeListeners( List propertyChangeListeners) { this.propertyChangeListeners = propertyChangeListeners; } @@ -150,7 +152,7 @@ public abstract class AbstractFormSection extends Section implements *

* Setter for the field entity. *

- * + * * @param entity * a ENTITY object. */ @@ -160,17 +162,18 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity() */ /** *

* Getter for the field entity. *

- * + * * @return a ENTITY object. */ - public ENTITY getEntity() { + @Override + public ENTITY getEntity() { return entity; } @@ -178,7 +181,7 @@ public abstract class AbstractFormSection extends Section implements *

* getToggle *

- * + * * @return a {@link org.eclipse.ui.forms.widgets.ToggleHyperlink} object. */ public ToggleHyperlink getToggle() { @@ -189,7 +192,7 @@ public abstract class AbstractFormSection extends Section implements *

* getSection *

- * + * * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} * object. */ @@ -199,13 +202,14 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent * () */ /** {@inheritDoc} */ - public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { + @Override + public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { Assert.isNotNull(propertyChangeListeners, "No property change listeners."); try { @@ -221,7 +225,7 @@ public abstract class AbstractFormSection extends Section implements /** * Fires a {@link CdmPropertyChangeEvent} with the given object as source. - * + * * @param object * the object on which the property changed */ @@ -232,7 +236,7 @@ public abstract class AbstractFormSection extends Section implements /** * Fires a {@link CdmPropertyChangeEvent} with the given object as source * also containing the originating event - * + * * @param object * the object on which the property changed * @param originatingEvent @@ -246,7 +250,7 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see org.eclipse.swt.widgets.Composite#setFocus() */ /** {@inheritDoc} */ @@ -257,19 +261,20 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse * .jface.util.PropertyChangeEvent) */ /** {@inheritDoc} */ - public void propertyChange(PropertyChangeEvent event) { + @Override + public void propertyChange(PropertyChangeEvent event) { firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event)); } /* * (non-Javadoc) - * + * * @see * org.eclipse.swt.widgets.Control#setBackground(org.eclipse.swt.graphics * .Color) @@ -283,24 +288,24 @@ public abstract class AbstractFormSection extends Section implements getLayoutComposite().setBackground(color); super.setBackground(color); } - + @Override public void setPersistentBackground(Color color) { persistentBackgroundColor = color; setBackground(color); } - + @Override public Color getPersistentBackground() { return persistentBackgroundColor; } - + /** *

* widgetSelected *

- * + * * @param e * a {@link org.eclipse.swt.events.SelectionEvent} object. */ @@ -335,7 +340,8 @@ public abstract class AbstractFormSection extends Section implements } /** {@inheritDoc} */ - public void setSelected(boolean selected) { + @Override + public void setSelected(boolean selected) { if (selected) { setBackground(Display.getCurrent().getSystemColor( SWT.COLOR_LIST_SELECTION)); @@ -345,7 +351,8 @@ public abstract class AbstractFormSection extends Section implements } /** {@inheritDoc} */ - public void selectionChanged(SelectionChangedEvent event) { + @Override + public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() == CdmFormFactory.EMPTY_SELECTION) { return; } @@ -365,7 +372,7 @@ public abstract class AbstractFormSection extends Section implements *

* addSelectionListener *

- * + * * @param listener * a {@link org.eclipse.swt.events.SelectionListener} object. */ @@ -377,7 +384,7 @@ public abstract class AbstractFormSection extends Section implements *

* removeSelectionListener *

- * + * * @param listener * a {@link org.eclipse.swt.events.SelectionListener} object. */ @@ -386,7 +393,8 @@ public abstract class AbstractFormSection extends Section implements } /** {@inheritDoc} */ - public void addElement(ICdmFormElement element) { + @Override + public void addElement(ICdmFormElement element) { elements.add(element); } @@ -394,7 +402,7 @@ public abstract class AbstractFormSection extends Section implements *

* removeElement *

- * + * * @param element * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -408,7 +416,8 @@ public abstract class AbstractFormSection extends Section implements * removeElements *

*/ - public void removeElements() { + @Override + public void removeElements() { for (ICdmFormElement childElement : getElements()) { // recursion childElement.removeElements(); @@ -447,10 +456,11 @@ public abstract class AbstractFormSection extends Section implements *

* Getter for the field parentElement. *

- * + * * @return a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. */ - public ICdmFormElement getParentElement() { + @Override + public ICdmFormElement getParentElement() { return parentElement; } @@ -458,10 +468,11 @@ public abstract class AbstractFormSection extends Section implements *

* Getter for the field elements. *

- * + * * @return a {@link java.util.Set} object. */ - public Set getElements() { + @Override + public Set getElements() { return elements; } @@ -469,10 +480,11 @@ public abstract class AbstractFormSection extends Section implements *

* getControls *

- * + * * @return a {@link java.util.Set} object. */ - public Set getControls() { + @Override + public Set getControls() { Set controls = new HashSet(); for (Control control : getChildren()) { @@ -493,15 +505,17 @@ public abstract class AbstractFormSection extends Section implements *

* getLayoutComposite *

- * + * * @return a {@link org.eclipse.swt.widgets.Composite} object. */ - public Composite getLayoutComposite() { + @Override + public Composite getLayoutComposite() { return (Composite) getClient(); } /** {@inheritDoc} */ - public boolean containsFormElement(ICdmFormElement formElement) { + @Override + public boolean containsFormElement(ICdmFormElement formElement) { if (formElement == this) { return true; } else { @@ -519,7 +533,7 @@ public abstract class AbstractFormSection extends Section implements *

* Getter for the field formFactory. *

- * + * * @return a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. */ public CdmFormFactory getFormFactory() { @@ -528,7 +542,7 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see eu.etaxonomy.taxeditor.forms.ICdmFormElement#refresh() */ /** @@ -536,7 +550,8 @@ public abstract class AbstractFormSection extends Section implements * refresh *

*/ - public void refresh() { + @Override + public void refresh() { // empty default implementation } @@ -545,13 +560,14 @@ public abstract class AbstractFormSection extends Section implements *

* getConversationHolder *

- * + * * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} * object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { if(getParentElement() instanceof RootElement || getParentElement() == null){ - + IEditorPart activeEditor = StoreUtil.getActiveEditor(); if(activeEditor instanceof IConversationEnabled){ ConversationHolder conversation = ((IConversationEnabled) StoreUtil.getActiveEditor()).getConversationHolder(); @@ -560,15 +576,16 @@ public abstract class AbstractFormSection extends Section implements }else if(getParentElement() instanceof IConversationEnabled){ return ((IConversationEnabled) getParentElement()).getConversationHolder(); } - StoreUtil.errorDialog("Could not get conversation for AbstractFormSection", - getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't", + StoreUtil.errorDialog("Could not get conversation for AbstractFormSection", + getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't", new IllegalArgumentException()); return null; - + } /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) { + @Override + public void update(CdmDataChangeMap changeEvents) { } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java index 068c03b9e..9460de11c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.element; @@ -255,7 +255,7 @@ import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement; *

* CdmFormFactory class. *

- * + * * @author n.hoffmann * @created Feb 24, 2010 * @version 1.0 @@ -280,9 +280,9 @@ public class CdmFormFactory extends FormToolkit { return true; } }; - + /** - * + * * @author n.hoffmann * @date Jan 25, 2010 * @@ -295,7 +295,7 @@ public class CdmFormFactory extends FormToolkit { } /** - * + * * @author n.hoffmann * @date Jan 25, 2010 * @@ -321,7 +321,7 @@ public class CdmFormFactory extends FormToolkit { *

* Constructor for CdmFormFactory. *

- * + * * @param display * a {@link org.eclipse.swt.widgets.Display} object. * @param selectionProvider @@ -337,7 +337,7 @@ public class CdmFormFactory extends FormToolkit { *

* Constructor for CdmFormFactory. *

- * + * * @param display * a {@link org.eclipse.swt.widgets.Display} object. */ @@ -347,7 +347,7 @@ public class CdmFormFactory extends FormToolkit { } /** - * + * */ private void init() { boldFontHolder2 = new BoldFontHolder2(); @@ -357,10 +357,10 @@ public class CdmFormFactory extends FormToolkit { /** * Creates an instance initialized with the correct selectionProvider - * + * * Make sure to remove the instance when the entityComposite disposes via * destroySelectionArbitrator(..) - * + * * @param entityElement * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement} * object. @@ -381,7 +381,7 @@ public class CdmFormFactory extends FormToolkit { *

* destroySelectionArbitrator *

- * + * * @param selectionArbitrator * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} * object. @@ -409,9 +409,10 @@ public class CdmFormFactory extends FormToolkit { /** *

- * adapt + * Adapts the {@link AbstractCdmFormElement}:
+ * - sets the {@link IPropertyChangeListener}s handled by this class *

- * + * * @param formElement * a * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement} @@ -434,7 +435,7 @@ public class CdmFormFactory extends FormToolkit { *

* destroyElement *

- * + * * @param formElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -476,7 +477,7 @@ public class CdmFormFactory extends FormToolkit { *

* createEmptyCell *

- * + * * @param parent * a {@link org.eclipse.swt.widgets.Composite} object. * @return a {@link org.eclipse.swt.widgets.Label} object. @@ -489,7 +490,7 @@ public class CdmFormFactory extends FormToolkit { *

* createMultilineTextWithLabel *

- * + * * @param labelString * a {@link java.lang.String} object. * @param textHeight @@ -516,7 +517,7 @@ public class CdmFormFactory extends FormToolkit { *

* createMultiLanguageTextElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -558,7 +559,7 @@ public class CdmFormFactory extends FormToolkit { *

* createTextWithLabelElement *

- * + * * @param labelString * a {@link java.lang.String} object. * @param initialText @@ -609,7 +610,7 @@ public class CdmFormFactory extends FormToolkit { } /** - * + * * @param parentElement * @param labelString * @param conversationEnabled @@ -631,7 +632,7 @@ public class CdmFormFactory extends FormToolkit { *

* createIntegerTextWithLabelElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -658,7 +659,7 @@ public class CdmFormFactory extends FormToolkit { *

* createFloatTextWithLabelElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -685,7 +686,7 @@ public class CdmFormFactory extends FormToolkit { *

* createLanguageStringWithLabelElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -713,7 +714,7 @@ public class CdmFormFactory extends FormToolkit { *

* createLanguageStringWithLabelElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -743,7 +744,7 @@ public class CdmFormFactory extends FormToolkit { *

* createTextElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -767,7 +768,7 @@ public class CdmFormFactory extends FormToolkit { *

* createKeyValueViewerElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -794,7 +795,7 @@ public class CdmFormFactory extends FormToolkit { *

* createTermComboElement *

- * + * * @param termComboType * a * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType} @@ -812,7 +813,7 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement} * object. */ - + public TermComboElement createTermComboElement( Class termComboType, ICdmFormElement parentElement, String labelString, T selection, int style) { @@ -826,7 +827,7 @@ public class CdmFormFactory extends FormToolkit { *

* createEnumComboElement *

- * + * * @param enumComboType * a * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType} @@ -852,7 +853,7 @@ public class CdmFormFactory extends FormToolkit { *

* createBrowserElement *

- * + * * @param imageUri * a {@link java.net.URI} object. * @param style @@ -875,7 +876,7 @@ public class CdmFormFactory extends FormToolkit { *

* createImageElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -898,7 +899,7 @@ public class CdmFormFactory extends FormToolkit { *

* createTextActionElement *

- * + * * @param labelString * a {@link java.lang.String} object. * @param initialText @@ -927,7 +928,7 @@ public class CdmFormFactory extends FormToolkit { *

* createCheckbox *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -950,7 +951,7 @@ public class CdmFormFactory extends FormToolkit { /** * Creates a section as a part of the form. - * + * * @return the section widget * @param section * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} @@ -1025,7 +1026,7 @@ public class CdmFormFactory extends FormToolkit { *

* createToggleableTextField *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1055,7 +1056,7 @@ public class CdmFormFactory extends FormToolkit { *

* createTimePeriodElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1082,7 +1083,7 @@ public class CdmFormFactory extends FormToolkit { *

* createPointElement *

- * + * * @param style * a int. * @param parentElement @@ -1105,7 +1106,7 @@ public class CdmFormFactory extends FormToolkit { *

* createDateDetailSection *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1127,7 +1128,7 @@ public class CdmFormFactory extends FormToolkit { *

* createPartialElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1152,7 +1153,7 @@ public class CdmFormFactory extends FormToolkit { *

* addSelectionListener *

- * + * * @param listener * a {@link org.eclipse.swt.events.SelectionListener} object. */ @@ -1164,7 +1165,7 @@ public class CdmFormFactory extends FormToolkit { *

* removeSelectionListener *

- * + * * @param listener * a {@link org.eclipse.swt.events.SelectionListener} object. */ @@ -1183,7 +1184,7 @@ public class CdmFormFactory extends FormToolkit { *

* addPropertyChangeListener *

- * + * * @param listener * a {@link org.eclipse.jface.util.IPropertyChangeListener} * object. @@ -1199,7 +1200,7 @@ public class CdmFormFactory extends FormToolkit { *

* removePropertyChangeListener *

- * + * * @param listener * a {@link org.eclipse.jface.util.IPropertyChangeListener} * object. @@ -1212,7 +1213,7 @@ public class CdmFormFactory extends FormToolkit { *

* createHorizontalSeparator *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1232,7 +1233,7 @@ public class CdmFormFactory extends FormToolkit { *

* createVersionElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1253,7 +1254,7 @@ public class CdmFormFactory extends FormToolkit { parentElement.addElement(element); return element; } - + /** * @param cdmBaseSection * @param object @@ -1274,7 +1275,7 @@ public class CdmFormFactory extends FormToolkit { *

* createVersionSection *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1291,7 +1292,7 @@ public class CdmFormFactory extends FormToolkit { adapt(section); return section; } - + /** * @param parent * @param i @@ -1308,7 +1309,7 @@ public class CdmFormFactory extends FormToolkit { *

* createEmptyElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1326,7 +1327,7 @@ public class CdmFormFactory extends FormToolkit { *

* createHeadlineSection *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1346,7 +1347,7 @@ public class CdmFormFactory extends FormToolkit { *

* createParsingMessageElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -1372,61 +1373,61 @@ public class CdmFormFactory extends FormToolkit { // SIMPLIFY /** - * + * */ public static enum DetailType { - AUTHORSHIP, - CLASSIFICATION, - COLLECTION, - DERIVED_UNIT, - DERIVED_UNIT_FACADE, - DERIVED_UNIT_GENERAL, - DESCRIPTION, - DESCRIPTIONELEMENT, - DETERMINATION, - FEATURE_DISTRIBUTION, - FIELD_OBSERVATION, - GATHERING_EVENT, + AUTHORSHIP, + CLASSIFICATION, + COLLECTION, + DERIVED_UNIT, + DERIVED_UNIT_FACADE, + DERIVED_UNIT_GENERAL, + DESCRIPTION, + DESCRIPTIONELEMENT, + DETERMINATION, + FEATURE_DISTRIBUTION, + FIELD_OBSERVATION, + GATHERING_EVENT, GRANTEDAUTHORITY, - GROUP, - HYBRID, - INSTITUTION, - MEDIA, - NAMED_AREA, - NAMED_AREA_LEVEL, - NAMERELATIONSHIP, - NATURAL_LANGUAGE, - NOMENCLATURALREFERENCE, - NONVIRALNAME, - PARSINGMESSAGE, - PERSON, - POLYTOMOUS_KEY, - POLYTOMOUS_KEY_NODE, - REFERENCEBASE, - REFERENCED_ENTITY, - SCIENTIFICNAME, - TAXON_NODE, - TAXON_RELATIONSHIP, - TAXONBASE, - TEAM, - TEAMORPERSONBASE, + GROUP, + HYBRID, + INSTITUTION, + MEDIA, + NAMED_AREA, + NAMED_AREA_LEVEL, + NAMERELATIONSHIP, + NATURAL_LANGUAGE, + NOMENCLATURALREFERENCE, + NONVIRALNAME, + PARSINGMESSAGE, + PERSON, + POLYTOMOUS_KEY, + POLYTOMOUS_KEY_NODE, + REFERENCEBASE, + REFERENCED_ENTITY, + SCIENTIFICNAME, + TAXON_NODE, + TAXON_RELATIONSHIP, + TAXONBASE, + TEAM, + TEAMORPERSONBASE, TERM_VOCABULARY, USE_RECORD, USER } - + public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { - + AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement, selectionProvider, style); - + parentElement.addElement(section); adapt(section); return section; - + } - + /** * @param definedTermClass * @param formElement @@ -1437,14 +1438,14 @@ public class CdmFormFactory extends FormToolkit { Class definedTermClass, AbstractCdmDetailSection parentElement, int style) { AbstractCdmDetailElement element = null; - + if (NamedArea.class.isAssignableFrom(definedTermClass)){ element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement); } else { element = new DefinedTermDetailElement(this, parentElement); } - + adapt(element); parentElement.addElement(element); return element; @@ -1454,7 +1455,7 @@ public class CdmFormFactory extends FormToolkit { *

* createCdmDetailSection *

- * + * * @param detailType * a * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType} @@ -1595,19 +1596,19 @@ public class CdmFormFactory extends FormToolkit { selectionProvider, style); break; case TAXON_RELATIONSHIP: - section = new TaxonRelationshipDetailSection(this, conversation, parentElement, + section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style); break; case REFERENCED_ENTITY: - section = new ReferencedEntityDetailSection(this, conversation, parentElement, + section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style); break; case TERM_VOCABULARY: - section = new TermVocabularyDetailSection(this, conversation, parentElement, + section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style); break; case NAMED_AREA: - section = new NamedAreaDetailSection(this, conversation, parentElement, + section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style); break; case USE_RECORD: @@ -1615,7 +1616,7 @@ public class CdmFormFactory extends FormToolkit { selectionProvider, style); break; } - + if (section == null) { throw new RuntimeException( @@ -1627,13 +1628,13 @@ public class CdmFormFactory extends FormToolkit { return section; } - - + + /** *

* createCdmDetailElement *

- * + * * @param detailType * a * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType} @@ -1772,46 +1773,46 @@ public class CdmFormFactory extends FormToolkit { } /** - * + * * @author n.hoffmann * @created Mar 5, 2010 * @version 1.0 */ public static enum EntityDetailType { - TEAM, - TEAMMEMBER, - ANNOTATION, - CREDIT, - DESCRIPTIONELEMENTSOURCE, - EXTENSION, - MARKER, - MEDIA, - DESCRIPTIONELEMENTMEDIA, - MEDIAREPRESENTATION, - MEDIAREPRESENTATIONPART, - MODIFIER, - NOMENCLATURALSTATUS, - NAME_RELATIONSHIP, - PROTOLOG, - RIGHTS, - SOURCE, - SCOPE, - DESCRIPTIONSOURCE, - TYPEDESIGNATION, - STATE_DATA, - STATISTICAL_MEASUREMENT_VALUE, - DESCRIBED_SPECIMEN, - COLLECTING_AREA, - DETERMINATION_EVENT, - SPECIMEN_COLLECTION, - IDENTIFIABLE_SOURCE_COLLECTION, - GEOGRAPHICAL_SCOPE, - SCOPE_RESTRICTION, - MEMBER, - GRANTED_AUTHORITY, - GROUPS_BY_USER, - TAXONOMIC_SCOPE, - DETERMINATION_CURRENT, + TEAM, + TEAMMEMBER, + ANNOTATION, + CREDIT, + DESCRIPTIONELEMENTSOURCE, + EXTENSION, + MARKER, + MEDIA, + DESCRIPTIONELEMENTMEDIA, + MEDIAREPRESENTATION, + MEDIAREPRESENTATIONPART, + MODIFIER, + NOMENCLATURALSTATUS, + NAME_RELATIONSHIP, + PROTOLOG, + RIGHTS, + SOURCE, + SCOPE, + DESCRIPTIONSOURCE, + TYPEDESIGNATION, + STATE_DATA, + STATISTICAL_MEASUREMENT_VALUE, + DESCRIBED_SPECIMEN, + COLLECTING_AREA, + DETERMINATION_EVENT, + SPECIMEN_COLLECTION, + IDENTIFIABLE_SOURCE_COLLECTION, + GEOGRAPHICAL_SCOPE, + SCOPE_RESTRICTION, + MEMBER, + GRANTED_AUTHORITY, + GROUPS_BY_USER, + TAXONOMIC_SCOPE, + DETERMINATION_CURRENT, DETERMINATION_HISTORY } @@ -1819,7 +1820,7 @@ public class CdmFormFactory extends FormToolkit { *

* createEntityDetailSection *

- * + * * @param entityDetailType * a * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType} @@ -1835,13 +1836,12 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} * object. */ - public AbstractFormSection createEntityDetailSection( - EntityDetailType entityDetailType, ConversationHolder conversation, - ICdmFormElement parentElement, int style) { + public AbstractFormSection createEntityDetailSection(EntityDetailType entityDetailType, ConversationHolder conversation, ICdmFormElement parentElement, int style) { AbstractFormSection section = null; switch (entityDetailType) { case TEAM: + //TODO this is not an AbstractEntityCollectionSection section = new TeamDetailSection(this, conversation, parentElement, null, style); break; @@ -1985,7 +1985,7 @@ public class CdmFormFactory extends FormToolkit { *

* createEntityCollectionElement *

- * + * * @param removeListener * a {@link org.eclipse.swt.events.SelectionListener} object. * @param style @@ -2034,8 +2034,8 @@ public class CdmFormFactory extends FormToolkit { element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style); } else if (entity instanceof MediaRepresentationPart){ - element = new MediaRepresentationPartElement(this, parentElement, - (MediaRepresentationPart) entity, removeListener, style); + element = new MediaRepresentationPartElement(this, parentElement, + (MediaRepresentationPart) entity, removeListener, style); } else if (entity instanceof NomenclaturalStatus) { element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener, style); @@ -2136,9 +2136,9 @@ public class CdmFormFactory extends FormToolkit { *
    *
  • {@link TaxonNodeSelectionElement} see {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
  • *
  • {@link NomenclaturalAuthorTeamSelectionElement} see {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
  • - *
+ * *

- * + * * @param clazz * a {@link Class} object of the type that you want the selection element to handle * @param parentElement @@ -2166,7 +2166,7 @@ public class CdmFormFactory extends FormToolkit { parentElement.addElement(element); return element; } - + public TaxonNodeSelectionElement createTaxonNodeSelectionElement( ConversationHolder conversation, ICdmFormElement parentElement, String labelString, @@ -2176,7 +2176,7 @@ public class CdmFormFactory extends FormToolkit { parentElement.addElement(element); return element; } - + public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement( ConversationHolder conversation, ICdmFormElement parentElement, String labelString, @@ -2186,8 +2186,8 @@ public class CdmFormFactory extends FormToolkit { parentElement.addElement(element); return element; } - - + + /** {@inheritDoc} */ public LabelElement createLabel(ICdmFormElement parentElement, String text) { LabelElement labelElement = new LabelElement(this, parentElement, text); @@ -2200,7 +2200,7 @@ public class CdmFormFactory extends FormToolkit { *

* Getter for the field selectionProvider. *

- * + * * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object. */ public ISelectionProvider getSelectionProvider() { @@ -2211,7 +2211,7 @@ public class CdmFormFactory extends FormToolkit { *

* createDetailedDescriptionDetailElement *

- * + * * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -2263,7 +2263,7 @@ public class CdmFormFactory extends FormToolkit { /** * Creates a styled text as a part of the form. - * + * * @param parent * the text parent * @param value @@ -2275,8 +2275,9 @@ public class CdmFormFactory extends FormToolkit { public StyledText createStyledText(Composite parent, String value, int style) { StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation()); - if (value != null) - text.setText(value); + if (value != null) { + text.setText(value); + } text.setForeground(getColors().getForeground()); text.setBackground(getColors().getBackground()); // text.addFocusListener(visibilityHandler); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java index 937ee2113..3997d2af3 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -32,7 +32,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElement { - + private DerivedUnitFacade facade; private DerivedUnitFacadeConfigurator configurator; @@ -55,24 +55,24 @@ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElementGetter for the field facade.

* @@ -113,27 +113,27 @@ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElement { - + private TextWithLabelElement text_ecology; private TextWithLabelElement text_plantDescription; @@ -40,10 +37,10 @@ public class FieldObservationDetailElement extends AbstractCdmDetailElement combo_sex; +// private TermComboElement combo_sex; +// +// private TermComboElement combo_lifeStage; - private TermComboElement combo_lifeStage; - /** *

Constructor for FieldObservationDetailElement.

* @@ -54,7 +51,7 @@ public class FieldObservationDetailElement extends AbstractCdmDetailElement * GatheringEventDetailElement class. *

- * + * * @author n.hoffmann * @created Jun 24, 2010 * @version 1.0 @@ -55,7 +55,7 @@ public class GatheringEventDetailElement extends *

* Constructor for GatheringEventDetailElement. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -68,49 +68,33 @@ public class GatheringEventDetailElement extends super(formFactory, formElement); } - /** {@inheritDoc} */ - @Override - protected void createControls(ICdmFormElement formElement, - DerivedUnitFacade entity, int style) { - // collectingArea - number_absoluteElevationError = formFactory - .createIntegerTextWithLabelElement(formElement, - "Elevation Error", entity.getAbsoluteElevationError(), - style); - number_absoluteElevationMinimum = formFactory - .createIntegerTextWithLabelElement(formElement, - "Elevation Minimum (m)", - entity.getAbsoluteElevationMinimum(), style); - number_absoluteElevationMaximum = formFactory - .createIntegerTextWithLabelElement(formElement, - "Elevation Maximum (m)", - entity.getAbsoluteElevationMaximum(), style); - - text_collectingMethod = formFactory.createTextWithLabelElement( - formElement, "Collecting Method", entity.getCollectingMethod(), - style); - - number_distanceToGround = formFactory - .createIntegerTextWithLabelElement(formElement, - "Distance To Ground (m)", entity.getDistanceToGround(), - style); - number_distanceToWaterSurface = formFactory - .createIntegerTextWithLabelElement(formElement, - "Distance To Water Surface (m)", - entity.getDistanceToWaterSurface(), style); - // exactLocation - text_gatheringEventDescription = formFactory - .createTextWithLabelElement(formElement, - "Gathering Event Description", - entity.getGatheringEventDescription(), style); - - section_collectingAreas = (CollectingAreasDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.COLLECTING_AREA, - getConversationHolder(), formElement, Section.TWISTIE); - section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY( - 2, 1)); - section_collectingAreas.setEntity(entity); - } + /** {@inheritDoc} */ + @Override + protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) { + // collectingArea + number_absoluteElevationError = formFactory.createIntegerTextWithLabelElement( + formElement, "Elevation Error", entity.getAbsoluteElevationError(), style); + number_absoluteElevationMinimum = formFactory.createIntegerTextWithLabelElement( + formElement, "Elevation Minimum (m)", entity.getAbsoluteElevationMinimum(), style); + number_absoluteElevationMaximum = formFactory.createIntegerTextWithLabelElement( + formElement, "Elevation Maximum (m)", entity.getAbsoluteElevationMaximum(), style); + + text_collectingMethod = formFactory.createTextWithLabelElement( + formElement, "Collecting Method", entity.getCollectingMethod(), style); + + number_distanceToGround = formFactory.createIntegerTextWithLabelElement( + formElement, "Distance To Ground (m)", entity.getDistanceToGround(), style); + number_distanceToWaterSurface = formFactory.createIntegerTextWithLabelElement( + formElement, "Distance To Water Surface (m)", entity.getDistanceToWaterSurface(), style); + // exactLocation + text_gatheringEventDescription = formFactory.createTextWithLabelElement( + formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style); + + section_collectingAreas = (CollectingAreasDetailSection) formFactory.createEntityDetailSection( + EntityDetailType.COLLECTING_AREA, getConversationHolder(), formElement, ExpandableComposite.TWISTIE); + section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); + section_collectingAreas.setEntity(entity); + } /** {@inheritDoc} */ @Override @@ -128,7 +112,7 @@ public class GatheringEventDetailElement extends } catch (IllegalArgumentException e) { number_absoluteElevationMinimum .setBackground(getColor(Resources.COLOR_PARSE_ERROR)); - StoreUtil.warn(getClass(), e.getLocalizedMessage()); + AbstractUtility.warn(getClass(), e.getLocalizedMessage()); } } else if (eventSource == number_absoluteElevationMaximum) { try { @@ -140,7 +124,7 @@ public class GatheringEventDetailElement extends } catch (IllegalArgumentException e) { number_absoluteElevationMaximum .setBackground(getColor(Resources.COLOR_PARSE_ERROR)); - StoreUtil.warn(getClass(), e.getLocalizedMessage()); + AbstractUtility.warn(getClass(), e.getLocalizedMessage()); } } else if (eventSource == text_collectingMethod) { getEntity().setCollectingMethod(text_collectingMethod.getText()); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java index 30f43dd00..8ad652623 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -14,7 +14,6 @@ import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.model.agent.AgentBase; import eu.etaxonomy.cdm.model.common.LanguageString; import eu.etaxonomy.cdm.model.location.NamedArea; -import eu.etaxonomy.cdm.model.occurrence.Collection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement; @@ -43,8 +42,8 @@ public class GeneralDetailElement extends private TimePeriodElement element_date; private EntitySelectionElement selection_collector; private TextWithLabelElement text_collectingNumber; - private EntitySelectionElement selection_collection; - private TextWithLabelElement text_accessionNumber; +// private EntitySelectionElement selection_collection; +// private TextWithLabelElement text_accessionNumber; /** * @param formFactory @@ -57,7 +56,7 @@ public class GeneralDetailElement extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int) @@ -74,7 +73,7 @@ public class GeneralDetailElement extends entity.getCountry(), EntitySelectionElement.NOTHING, style); languageText_locality = formFactory .createLanguageStringWithLabelElement(formElement, "Locality", - entity.getLocality(), style); + entity.getLocality(), style); element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style); number_elevation = formFactory.createIntegerTextWithLabelElement( @@ -89,20 +88,20 @@ public class GeneralDetailElement extends style); text_collectingNumber = formFactory.createTextWithLabelElement(formElement, "Collecting number", entity.getFieldNumber(), style); - selection_collection = formFactory - .createSelectionElement(Collection.class, - getConversationHolder(), formElement, "Collection", - entity.getCollection(), - EntitySelectionElement.ALL, style); - text_accessionNumber = formFactory.createTextWithLabelElement( - formElement, "Accession Number", entity.getAccessionNumber(), - style); - +// selection_collection = formFactory +// .createSelectionElement(Collection.class, +// getConversationHolder(), formElement, "Collection", +// entity.getCollection(), +// EntitySelectionElement.ALL, style); +// text_accessionNumber = formFactory.createTextWithLabelElement( +// formElement, "Accession Number", entity.getAccessionNumber(), +// style); + } /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java * .lang.Object) @@ -127,11 +126,12 @@ public class GeneralDetailElement extends getEntity().setCollector(selection_collector.getSelection()); } else if (eventSource == text_collectingNumber) { getEntity().setFieldNumber(text_collectingNumber.getText()); - } else if (eventSource == selection_collection) { - getEntity().setCollection(selection_collection.getSelection()); - } else if (eventSource == text_accessionNumber) { - getEntity().setAccessionNumber(text_accessionNumber.getText()); } +// else if (eventSource == selection_collection) { +// getEntity().setCollection(selection_collection.getSelection()); +// } else if (eventSource == text_accessionNumber) { +// getEntity().setAccessionNumber(text_accessionNumber.getText()); +// } if (eventSource != toggleableText_titleCache) { toggleableText_titleCache.setText(getEntity().getTitleCache()); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java index 2a019c07d..57cb79885 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java @@ -1,16 +1,15 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.view; -import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Composite; @@ -36,23 +35,24 @@ import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart; * @created Feb 9, 2010 * @version 1.0 */ -public abstract class AbstractCdmDataViewer extends Viewer implements ISelectionProvider, IConversationEnabled{ - +public abstract class AbstractCdmDataViewer extends Viewer implements IConversationEnabled{ + protected ManagedForm managedForm; protected CdmFormFactory formFactory; protected ScrolledForm scrolledForm; - - private Composite body; - + + private final Composite body; + protected RootElement rootElement; + //TODO: create a super class for this? private Object input; - private AbstractCdmViewPart viewPart; + private final AbstractCdmViewPart viewPart; + - /** *

Constructor for AbstractCdmDataViewer.

* @@ -61,9 +61,9 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection */ public AbstractCdmDataViewer(Composite parent, AbstractCdmViewPart viewPart) { this.viewPart = viewPart; - + managedForm = new ManagedForm(parent){ - + /* (non-Javadoc) * @see org.eclipse.ui.forms.ManagedForm#dirtyStateChanged() */ @@ -72,18 +72,18 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection markViewPartDirty(); } }; - + createFormFactory(); - + scrolledForm = managedForm.getForm(); - + body = scrolledForm.getBody(); - + body.setLayout(LayoutConstants.LAYOUT()); - + rootElement = new RootElement(formFactory, body); } - + /** *

createFormFactory

*/ @@ -98,8 +98,8 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection protected void markViewPartDirty(){ viewPart.changed(input); } - - + + /** * @return */ @@ -116,22 +116,22 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection for(Control child : body.getChildren()){ return child; } - + return body; } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object) */ /** {@inheritDoc} */ @Override public void setInput(Object input) { - this.input = input; + this.input = input; // reset selection setSelection(new StructuredSelection(input)); refresh(); } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.Viewer#getInput() */ @@ -140,7 +140,7 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection public Object getInput() { return input; } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.Viewer#refresh() */ @@ -148,51 +148,51 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection @Override public void refresh() { showParts(); - + managedForm.setInput(input); - + managedForm.refresh(); - + managedForm.reflow(true); } - + /** *

layout

*/ public void layout(){ body.layout(); } - + /** *

showParts

*/ protected abstract void showParts(); - - + + /** *

destroySections

*/ - protected void destroySections() { + protected void destroySections() { for (IFormPart formPart : managedForm.getParts()){ removePart((CdmSectionPart) formPart); - } - + } + managedForm.setInput(null); - + formFactory.destroyElement(rootElement); - + createFormFactory(); - + rootElement = new RootElement(formFactory, body); - + for(Control control : body.getChildren()){ control.dispose(); control = null; } } - - + + /** *

setFocus

*/ @@ -205,14 +205,14 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection break; } } - + /** *

reflow

*/ public void reflow(){ managedForm.reflow(true); } - + /** *

removePart

* @@ -222,7 +222,7 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection managedForm.removePart(sectionPart); formFactory.removePropertyChangeListener(sectionPart); } - + /** *

addPart

* @@ -233,17 +233,19 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection managedForm.addPart(sectionPart); formFactory.addPropertyChangeListener(sectionPart); } - + /** *

getConversationHolder

* * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { return viewPart.getConversationHolder(); } - + /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) {} + @Override + public void update(CdmDataChangeMap changeEvents) {} } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java index ac6c878be..169895ef5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java @@ -2,9 +2,9 @@ // $Id$ /** * Copyright (C) 2011 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -17,7 +17,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; @@ -39,16 +39,17 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase; +import eu.etaxonomy.cdm.model.occurrence.FieldObservation; +import eu.etaxonomy.cdm.model.occurrence.Specimen; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; - import eu.etaxonomy.taxeditor.editor.UsageTermCollection; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.store.CdmStore; -import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; @@ -70,10 +71,8 @@ import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSectio import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection; import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection; import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection; -import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection; import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection; import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection; -import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection; import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection; import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection; @@ -101,7 +100,7 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; *

* DetailsViewer class. *

- * + * * @author n.hoffmann * @created Feb 12, 2010 * @version 1.0 @@ -114,7 +113,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { *

* Constructor for DetailsViewer. *

- * + * * @param parent * a {@link org.eclipse.swt.widgets.Composite} object. * @param viewPart @@ -132,7 +131,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java * .lang.Object) @@ -141,10 +140,9 @@ public class DetailsViewer extends AbstractCdmDataViewer { public void setInput(Object input) { if (input instanceof DerivedUnitBase) { try { - input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input, - PreferencesUtil.getDerivedUnitConfigurator()); + input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input, PreferencesUtil.getDerivedUnitConfigurator()); } catch (DerivedUnitFacadeNotSupportedException e) { - StoreUtil.error(getClass(), e); + AbstractUtility.error(getClass(), e); } } super.setInput(input); @@ -164,7 +162,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.Viewer#refresh() */ /** {@inheritDoc} */ @@ -174,26 +172,27 @@ public class DetailsViewer extends AbstractCdmDataViewer { // Too much type checking to decide which detail view to display. // Need to build in a mechanism where navigators / editors are 'aware' // of the corresponding detail viewer. - if (getInput() instanceof TaxonBase) { + Object input = getInput(); + if (input instanceof TaxonBase) { createTaxonSections(rootElement); - } else if (getInput() instanceof NonViralName) { + } else if (input instanceof NonViralName) { createNameSections(rootElement); - } else if (getInput() instanceof Reference) { + } else if (input instanceof Reference) { createReferenceSections(rootElement); - } else if (getInput() instanceof Team) { + } else if (input instanceof Team) { createTeamDetailSection(rootElement); - } else if (getInput() instanceof Person) { + } else if (input instanceof Person) { createPersonDetailSection(rootElement); - } else if (getInput() instanceof TeamOrPersonBase) { + } else if (input instanceof TeamOrPersonBase) { createTeamOrPersonBaseDetailSection(rootElement); - } else if (getInput() instanceof DescriptionBase) { - Set descriptionMarkers = ((DescriptionBase) getInput()).getMarkers(); + } else if (input instanceof DescriptionBase) { + Set descriptionMarkers = ((DescriptionBase) input).getMarkers(); MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType); Boolean isUseDescription = false; for (Marker marker : descriptionMarkers) { @@ -201,17 +200,17 @@ public class DetailsViewer extends AbstractCdmDataViewer { isUseDescription = true; } } - if (((DescriptionBase) getInput()).isImageGallery()) { + if (((DescriptionBase) input).isImageGallery()) { createImageGallerySection(rootElement); - } else if (isUseDescription) { + } else if (isUseDescription) { createUseDescriptionSection(rootElement); } else { createDescriptionSection(rootElement); } - } else if (getInput() instanceof DescriptionElementBase) { - Set descriptionMarkers = ((DescriptionElementBase) getInput()).getInDescription().getMarkers(); + } else if (input instanceof DescriptionElementBase) { + Set descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers(); MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType); Boolean isUseDescription = false; for (Marker marker : descriptionMarkers) { @@ -219,43 +218,38 @@ public class DetailsViewer extends AbstractCdmDataViewer { isUseDescription = true; } } - - if (isUseDescription == true && getInput() instanceof CategoricalData ) { + + if (isUseDescription == true && input instanceof CategoricalData ) { createUseRecordSection(rootElement); } else { createDescriptionElementSection(rootElement); } - } else if (getInput() instanceof Media) { + } else if (input instanceof Media) { createMediaElementSection(rootElement); - } else if (getInput() instanceof DerivedUnitFacade) { + } else if (input instanceof DerivedUnitFacade) { createDerivedUnitBaseElementSection(rootElement); - } else if (getInput() instanceof FeatureNodeContainer) { + } else if (input instanceof FeatureNodeContainer) { createFeatureDistributionSection(rootElement); - } else if (getInput() instanceof PolytomousKey) { + } else if (input instanceof PolytomousKey) { //createPolytomousKeySection(rootElement); - } else if ((getInput() instanceof PolytomousKeyNode) - || (getInput() instanceof PolytomousKeyRelationship)) { + } else if ((input instanceof PolytomousKeyNode) + || (input instanceof PolytomousKeyRelationship)) { createPolytomousKeyNodeSection(rootElement); - - } else if (getInput() instanceof User) { + } else if (input instanceof User) { createUserSection(rootElement); - - } else if (getInput() instanceof Group) { + } else if (input instanceof Group) { createGroupSection(rootElement); - - } else if (getInput() instanceof TaxonRelationship) { + } else if (input instanceof TaxonRelationship) { createTaxonRelationshipSection(rootElement); - - } else if (getInput() instanceof TermVocabulary) { + } else if (input instanceof TermVocabulary) { createTermVocabularySection(rootElement); - - } else if (getInput() instanceof DefinedTermBase) { + } else if (input instanceof DefinedTermBase) { createDefinedTermSection(rootElement); } else { destroySections(); @@ -263,7 +257,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { layout(); } - + /** * @param rootElement */ @@ -272,16 +266,16 @@ public class DetailsViewer extends AbstractCdmDataViewer { GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory .createCdmDetailSection(DetailType.GROUP, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory .createEntityDetailSection(EntityDetailType.MEMBER, - getConversationHolder(), parent, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory .createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY, - getConversationHolder(), parent, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(groupDetailSection); addPart(memberDetailSection); @@ -290,7 +284,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.Viewer#getSelection() */ /** {@inheritDoc} */ @@ -301,7 +295,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { /* * (non-Javadoc) - * + * * @see * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers * .ISelection, boolean) @@ -310,8 +304,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { @Override public void setSelection(ISelection selection, boolean reveal) { this.selection = selection; - SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent( - this, selection); + SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection); fireSelectionChanged(selectionChangedEvent); } @@ -324,51 +317,51 @@ public class DetailsViewer extends AbstractCdmDataViewer { TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory .createCdmDetailSection(DetailType.TAXONBASE, - getConversationHolder(), parent, this, Section.TWISTIE); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory .createCdmDetailSection(DetailType.NONVIRALNAME, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, - getConversationHolder(), parent, this, Section.TWISTIE); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory .createEntityDetailSection( EntityDetailType.NOMENCLATURALSTATUS, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); ProtologueSection protologSection = (ProtologueSection) formFactory .createEntityDetailSection(EntityDetailType.PROTOLOG, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory .createCdmDetailSection(DetailType.PARSINGMESSAGE, - getConversationHolder(), parent, this, Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.EXPANDED); addPart(taxonBaseDetailSection); addPart(nonViralNameSection); @@ -388,39 +381,39 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory .createCdmDetailSection(DetailType.NONVIRALNAME, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, - getConversationHolder(), parent, this, Section.TWISTIE); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory .createEntityDetailSection( EntityDetailType.NOMENCLATURALSTATUS, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); ProtologueSection protologSection = (ProtologueSection) formFactory .createEntityDetailSection(EntityDetailType.PROTOLOG, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -441,8 +434,8 @@ public class DetailsViewer extends AbstractCdmDataViewer { ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory .createCdmDetailSection(DetailType.REFERENCEBASE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(referenceDetailSection); } @@ -455,8 +448,8 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory .createCdmDetailSection(DetailType.TEAMORPERSONBASE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(teamOrPersonBaseDetailSection); } @@ -469,12 +462,12 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory .createCdmDetailSection(DetailType.TEAM, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(teamDetailSection); } - + /** * createPersonDetailSection * @param parent @@ -483,8 +476,8 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); PersonDetailSection personDetailSection = (PersonDetailSection) formFactory .createCdmDetailSection(DetailType.PERSON, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(personDetailSection); } @@ -497,22 +490,22 @@ public class DetailsViewer extends AbstractCdmDataViewer { DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory .createEntityDetailSection( EntityDetailType.DESCRIPTIONELEMENTSOURCE, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory .createEntityDetailSection( EntityDetailType.DESCRIPTIONELEMENTMEDIA, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -529,33 +522,33 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory .createCdmDetailSection(DetailType.NATURAL_LANGUAGE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); ScopeSection scopeSection = (ScopeSection) formFactory .createEntityDetailSection(EntityDetailType.SCOPE, - getConversationHolder(), parent, Section.TWISTIE); + getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -565,7 +558,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { addPart(descriptionSourceSection); addPart(scopeSection); } - + /** * Creates the use Description section * @param parent @@ -574,21 +567,21 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, - getConversationHolder(), parent, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(descriptionDetailSection); addPart(descriptionSourceSection); - + } @@ -599,12 +592,12 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(descriptionDetailSection); } - + /** * createMediaElementSection * @param parent @@ -614,8 +607,8 @@ public class DetailsViewer extends AbstractCdmDataViewer { destroySections(); MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory .createCdmDetailSection(DetailType.MEDIA, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(mediaDetailSection); } @@ -624,45 +617,34 @@ public class DetailsViewer extends AbstractCdmDataViewer { * createDerivedUnitBaseElementSection * @param parent */ - private void createDerivedUnitBaseElementSection(RootElement parent) { - destroySections(); - - GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory - .createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + private void createDerivedUnitBaseElementSection(RootElement parent) { + destroySections(); + + GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory - .createCdmDetailSection(DetailType.GATHERING_EVENT, - getConversationHolder(), parent, this, Section.TWISTIE); + GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory.createCdmDetailSection(DetailType.GATHERING_EVENT, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory - .createCdmDetailSection(DetailType.FIELD_OBSERVATION, - getConversationHolder(), parent, this, Section.TWISTIE); + FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory.createCdmDetailSection(DetailType.FIELD_OBSERVATION, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory - .createCdmDetailSection(DetailType.DERIVED_UNIT, - getConversationHolder(), parent, this, Section.TWISTIE); + DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory - .createCdmDetailSection(DetailType.DETERMINATION, - getConversationHolder(), parent, this, Section.TWISTIE); + DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory.createCdmDetailSection(DetailType.DETERMINATION, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); - addPart(generalDetailSection); - addPart(gatheringEventDetailSection); - addPart(fieldObservationDetailSection); - addPart(derivedUnitBaseDetailSection); - addPart(determinationDetailSection); + addPart(generalDetailSection); + addPart(gatheringEventDetailSection); + addPart(fieldObservationDetailSection); + addPart(derivedUnitBaseDetailSection); + addPart(determinationDetailSection); - } + } /** * @param rootElement @@ -672,44 +654,12 @@ public class DetailsViewer extends AbstractCdmDataViewer { FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(featureDistributionSection); } - private void createPolytomousKeySection(RootElement parent) { - destroySections(); - - PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory - .createCdmDetailSection(DetailType.POLYTOMOUS_KEY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory - .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory - .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE, - getConversationHolder(), parent, Section.TWISTIE); - - addPart(polytomousKeyDetailSection); - addPart(geographicalScopeDetailSection); - addPart(scopeRestrictionSection); - addPart(taxonomicScopeSection); - } - /** * createPolytomousKeyNodeSection * @param parent @@ -719,42 +669,28 @@ public class DetailsViewer extends AbstractCdmDataViewer { PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory .createCdmDetailSection(DetailType.POLYTOMOUS_KEY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.COMPACT); - + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.COMPACT); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - + PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - -// formFactory.createHorizontalSeparator(parent, SWT.BORDER); -// -// GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory -// .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE, -// getConversationHolder(), parent, Section.TWISTIE | Section.COMPACT); -// -// formFactory.createHorizontalSeparator(parent, SWT.BORDER); -// -// ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory -// .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION, -// getConversationHolder(), parent, Section.TWISTIE | Section.COMPACT); -// + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE, - getConversationHolder(), parent, Section.TWISTIE | Section.COMPACT); + getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT); addPart(polytomousKeyDetailSection); addPart(polytomousKeyNodeDetailSection); -// addPart(geographicalScopeDetailSection); -// addPart(scopeRestrictionSection); addPart(taxonomicScopeSection); } - + /** * create the UseRecordSection * @param parent @@ -764,14 +700,14 @@ public class DetailsViewer extends AbstractCdmDataViewer { UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory .createCdmDetailSection(DetailType.USE_RECORD, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - + addPart(descriptionUseRecordSection); - - + + } /** @@ -783,13 +719,13 @@ public class DetailsViewer extends AbstractCdmDataViewer { UserDetailSection userDetailSection = (UserDetailSection) formFactory .createCdmDetailSection(DetailType.USER, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, - getConversationHolder(), parent, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(userDetailSection); addPart(groupByUserDetailSection); @@ -804,13 +740,13 @@ public class DetailsViewer extends AbstractCdmDataViewer { TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory .createCdmDetailSection(DetailType.TAXON_RELATIONSHIP, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory .createCdmDetailSection(DetailType.REFERENCED_ENTITY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(taxonRelationshipDetailSection); addPart(referencedEntityBaseDetailSection); } @@ -823,8 +759,8 @@ public class DetailsViewer extends AbstractCdmDataViewer { TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory .createCdmDetailSection(DetailType.TERM_VOCABULARY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(termVocabularyDetailSection); } @@ -837,8 +773,8 @@ public class DetailsViewer extends AbstractCdmDataViewer { AbstractFormSection definedTermDetailSection = formFactory .createDefinedTermDetailSection(getInput().getClass(), - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); addPart(definedTermDetailSection); } } -- 2.34.1