From a6b8fe6608f728768d98b7be3992eb171c614194 Mon Sep 17 00:00:00 2001 From: "n.hoffmann" Date: Tue, 29 Mar 2011 13:44:52 +0000 Subject: [PATCH] Fixes #2312 --- .gitattributes | 2 + .../taxeditor/ui/forms/CdmFormFactory.java | 2181 ++++++++++------- .../key/PolytomousKeyDetailElement.java | 23 +- .../ui/section/key/TaxonomicScopeSection.java | 115 + .../occurrence/NamedAreaDetailElement.java | 74 +- .../ui/section/taxon/TaxonDetailElement.java | 85 + .../taxeditor/view/detail/DetailsViewer.java | 661 ++--- 7 files changed, 1956 insertions(+), 1185 deletions(-) create mode 100644 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/TaxonomicScopeSection.java create mode 100644 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonDetailElement.java diff --git a/.gitattributes b/.gitattributes index 29dda1270..f2bc369a8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1000,6 +1000,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailSection.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/ScopeRestrictionSection.java -text +eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/TaxonomicScopeSection.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AbstractTypeDesignationElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java -text @@ -1080,6 +1081,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/tax eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/ParsingMessagesSection.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailSection.java -text +eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/GroupsByUserDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/GroupsByUserDetailSection.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailElement.java -text diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java index 763683062..508296ce5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java @@ -42,7 +42,6 @@ import org.joda.time.Partial; import org.springframework.security.core.GrantedAuthority; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; -import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.agent.Institution; import eu.etaxonomy.cdm.model.agent.Person; @@ -186,6 +185,7 @@ import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection; import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailElement; 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.AuthorshipDetailElement; import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailElement; @@ -250,6 +250,7 @@ import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement; import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection; import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailElement; import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection; +import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonDetailElement; import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement; import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection; import eu.etaxonomy.taxeditor.ui.section.user.UserDetailElement; @@ -306,42 +307,50 @@ import eu.etaxonomy.taxeditor.ui.term.StateComboElement; import eu.etaxonomy.taxeditor.ui.term.StatisticalMeasureComboElement; /** - *

CdmFormFactory class.

- * + *

+ * CdmFormFactory class. + *

+ * * @author n.hoffmann * @created Feb 24, 2010 * @version 1.0 */ -public class CdmFormFactory extends FormToolkit{ - +public class CdmFormFactory extends FormToolkit { + private BoldFontHolder2 boldFontHolder2; private MouseListener selectionMouseHandler; private FocusListener selectionFocusHandler; - - private Set selectionListenerList = new HashSet(); - - private List propertyChangeListeners = new ArrayList(); - - private int orientation = Window.getDefaultOrientation(); + + private final Set selectionListenerList = new HashSet(); + + private final List propertyChangeListeners = new ArrayList(); + + private final int orientation = Window.getDefaultOrientation(); private ISelectionProvider selectionProvider; - + /** - *

LAYOUT

- * + *

+ * LAYOUT + *

+ * * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object. */ - public static final TableWrapLayout LAYOUT(){ + public static final TableWrapLayout LAYOUT() { return LAYOUT(1, false); } - + /** - *

LAYOUT

- * - * @param columns a int. - * @param equalWidth a boolean. + *

+ * LAYOUT + *

+ * + * @param columns + * a int. + * @param equalWidth + * a boolean. * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object. */ - public static final TableWrapLayout LAYOUT(int columns, boolean equalWidth){ + public static final TableWrapLayout LAYOUT(int columns, boolean equalWidth) { TableWrapLayout layout = new TableWrapLayout(); layout.topMargin = 0; layout.rightMargin = 0; @@ -353,124 +362,151 @@ public class CdmFormFactory extends FormToolkit{ layout.horizontalSpacing = 0; return layout; } - + /** - *

FILL

- * + *

+ * FILL + *

+ * * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object. */ - public static final TableWrapData FILL(){ + public static final TableWrapData FILL() { return FILL(1, 1); } - + /** - *

FILL

- * - * @param horizontalSpan a int. - * @param verticalSpan a int. + *

+ * FILL + *

+ * + * @param horizontalSpan + * a int. + * @param verticalSpan + * a int. * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object. */ - public static final TableWrapData FILL(int horizontalSpan, int verticalSpan){ - TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB); + public static final TableWrapData FILL(int horizontalSpan, int verticalSpan) { + TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, + TableWrapData.FILL_GRAB); layoutData.colspan = horizontalSpan; layoutData.rowspan = verticalSpan; return layoutData; } - + /** - *

LEFT

- * + *

+ * LEFT + *

+ * * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object. */ - public static final TableWrapData LEFT(){ + public static final TableWrapData LEFT() { return new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP); } - + /** - *

RIGHT

- * + *

+ * RIGHT + *

+ * * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object. */ - public static final TableWrapData RIGHT(){ + public static final TableWrapData RIGHT() { return new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP); } - + /** - *

FILL_HORIZONTALLY

- * + *

+ * FILL_HORIZONTALLY + *

+ * * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object. */ - public static final TableWrapData FILL_HORIZONTALLY(){ + public static final TableWrapData FILL_HORIZONTALLY() { return FILL_HORIZONTALLY(1, 1); } - + /** - *

FILL_HORIZONTALLY

- * - * @param horizontalSpan a int. - * @param verticalSpan a int. + *

+ * FILL_HORIZONTALLY + *

+ * + * @param horizontalSpan + * a int. + * @param verticalSpan + * a int. * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object. */ - public static final TableWrapData FILL_HORIZONTALLY(int horizontalSpan, int verticalSpan){ - TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP); + public static final TableWrapData FILL_HORIZONTALLY(int horizontalSpan, + int verticalSpan) { + TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, + TableWrapData.TOP); layoutData.colspan = horizontalSpan; layoutData.rowspan = verticalSpan; return layoutData; } - + /** Constant EMPTY_SELECTION */ public static ISelection EMPTY_SELECTION = new ISelection() { + @Override public boolean isEmpty() { return true; } }; - - private class SelectionMouseHandler extends MouseAdapter{ + + private class SelectionMouseHandler extends MouseAdapter { @Override public void mouseDown(MouseEvent e) { notifySelectionListeners(e); } } - - private class SelectionFocusHandler extends FocusAdapter{ + + private class SelectionFocusHandler extends FocusAdapter { @Override public void focusGained(FocusEvent e) { notifySelectionListeners(e); } } - - private void notifySelectionListeners(TypedEvent e){ + + private void notifySelectionListeners(TypedEvent e) { Event event = new Event(); event.widget = e.widget; SelectionEvent selectionEvent = new SelectionEvent(event); - - for(Object listener : selectionListenerList){ + + for (Object listener : selectionListenerList) { ((SelectionListener) listener).widgetSelected(selectionEvent); } } - + /** - *

Constructor for CdmFormFactory.

- * - * @param display a {@link org.eclipse.swt.widgets.Display} object. - * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object. + *

+ * Constructor for CdmFormFactory. + *

+ * + * @param display + * a {@link org.eclipse.swt.widgets.Display} object. + * @param selectionProvider + * a {@link org.eclipse.jface.viewers.ISelectionProvider} object. */ public CdmFormFactory(Display display, ISelectionProvider selectionProvider) { super(display); this.selectionProvider = selectionProvider; init(); } - + /** - *

Constructor for CdmFormFactory.

- * - * @param display a {@link org.eclipse.swt.widgets.Display} object. + *

+ * Constructor for CdmFormFactory. + *

+ * + * @param display + * a {@link org.eclipse.swt.widgets.Display} object. */ - public CdmFormFactory(Display display){ + public CdmFormFactory(Display display) { super(display); init(); } - + /** * */ @@ -479,35 +515,49 @@ public class CdmFormFactory extends FormToolkit{ selectionMouseHandler = new SelectionMouseHandler(); selectionFocusHandler = new SelectionFocusHandler(); } - + /** * 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.forms.IEntityElement} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} object. + * + * @param entityElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement} + * object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} + * object. */ - public SelectionArbitrator createSelectionArbitrator(IEntityElement entityElement){ - SelectionArbitrator selectionArbitrator = new SelectionArbitrator(entityElement); + public SelectionArbitrator createSelectionArbitrator( + IEntityElement entityElement) { + SelectionArbitrator selectionArbitrator = new SelectionArbitrator( + entityElement); selectionArbitrator.addSelectionProvider(selectionProvider); selectionProvider.addSelectionChangedListener(selectionArbitrator); addSelectionListener(selectionArbitrator); return selectionArbitrator; } - + /** - *

destroySelectionArbitrator

- * - * @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} object. + *

+ * destroySelectionArbitrator + *

+ * + * @param selectionArbitrator + * a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} + * object. */ - public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator){ + public void destroySelectionArbitrator( + SelectionArbitrator selectionArbitrator) { removeSelectionListener(selectionArbitrator); - if(selectionProvider != null){ - selectionProvider.removeSelectionChangedListener(selectionArbitrator); - }else{ - StoreUtil.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null); + if (selectionProvider != null) { + selectionProvider + .removeSelectionChangedListener(selectionArbitrator); + } else { + StoreUtil + .error(this.getClass(), + "Tried to destroy a selection listener from this factories listeners but was null", + null); } } @@ -517,140 +567,191 @@ public class CdmFormFactory extends FormToolkit{ composite.addMouseListener(selectionMouseHandler); super.adapt(composite); } - + /** - *

adapt

- * - * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement} object. + *

+ * adapt + *

+ * + * @param formElement + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement} + * object. */ - public void adapt(AbstractCdmFormElement formElement){ + public void adapt(AbstractCdmFormElement formElement) { formElement.setPropertyChangeListeners(propertyChangeListeners); } - + /** {@inheritDoc} */ @Override public void adapt(Control control, boolean trackFocus, boolean trackKeyboard) { - if(trackFocus){ + if (trackFocus) { control.addFocusListener(selectionFocusHandler); } super.adapt(control, trackFocus, trackKeyboard); } - + /** - *

destroyElement

- * - * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. + *

+ * destroyElement + *

+ * + * @param formElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. */ - public void destroyElement(ICdmFormElement formElement){ + public void destroyElement(ICdmFormElement formElement) { // return if element was not initialized - if(formElement == null){ + if (formElement == null) { return; } // destroy selection arbitrator, if any - if(formElement instanceof ISelectableElement){ - destroySelectionArbitrator(((ISelectableElement) formElement).getSelectionArbitrator()); + if (formElement instanceof ISelectableElement) { + destroySelectionArbitrator(((ISelectableElement) formElement) + .getSelectionArbitrator()); } // remove this element form its parents list of elements -// ICdmFormElement parentElement = formElement.getParentElement(); -// if(parentElement != null){ -// parentElement.removeElement(formElement); -// } + // ICdmFormElement parentElement = formElement.getParentElement(); + // if(parentElement != null){ + // parentElement.removeElement(formElement); + // } // call destroy on child elements recursively - for(ICdmFormElement childElement : formElement.getElements()){ + for (ICdmFormElement childElement : formElement.getElements()) { destroyElement(childElement); } // dispose of the controls - for(Control control : formElement.getControls()){ - // we added the layoutComposite of the parental element as the layout composite to this formElement + for (Control control : formElement.getControls()) { + // we added the layoutComposite of the parental element as the + // layout composite to this formElement // but we do not want to destroy it. - if(control.equals(formElement.getLayoutComposite())){ + if (control.equals(formElement.getLayoutComposite())) { continue; - }else{ + } else { control.dispose(); control = null; } } } - - + /** - *

createEmptyCell

- * - * @param parent a {@link org.eclipse.swt.widgets.Composite} object. + *

+ * createEmptyCell + *

+ * + * @param parent + * a {@link org.eclipse.swt.widgets.Composite} object. * @return a {@link org.eclipse.swt.widgets.Label} object. */ - public Label createEmptyCell(Composite parent){ + public Label createEmptyCell(Composite parent) { return this.createLabel(parent, null); } - + /** - *

createMultilineTextWithLabel

- * - * @param labelString a {@link java.lang.String} object. - * @param textHeight a int. - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object. + *

+ * createMultilineTextWithLabel + *

+ * + * @param labelString + * a {@link java.lang.String} object. + * @param textHeight + * a int. + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} + * object. */ - public TextWithLabelElement createMultilineTextWithLabel(ICdmFormElement parentElement, String labelString, int textHeight, int style){ - TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, style); + public TextWithLabelElement createMultilineTextWithLabel( + ICdmFormElement parentElement, String labelString, int textHeight, + int style) { + TextWithLabelElement element = new TextWithLabelElement(this, + parentElement, labelString, "", textHeight, style); adapt(element); parentElement.addElement(element); return element; } - /** - *

createMultiLanguageTextElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param multilanguageText a {@link java.util.Map} object. - * @param textHeight a int. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement} object. + *

+ * createMultiLanguageTextElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param multilanguageText + * a {@link java.util.Map} object. + * @param textHeight + * a int. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement} + * object. */ public MultilanguageTextElement createMultiLanguageTextElement( - ICdmFormElement parentElement, String labelString, Map multilanguageText, int textHeight, + ICdmFormElement parentElement, String labelString, + Map multilanguageText, int textHeight, int style) { - MultilanguageTextElement element = new MultilanguageTextElement(this, parentElement, labelString, multilanguageText, textHeight, style); + MultilanguageTextElement element = new MultilanguageTextElement(this, + parentElement, labelString, multilanguageText, textHeight, + style); adapt(element); parentElement.addElement(element); return element; } - - public KeyStatementElement createKeyStatementElement(ICdmFormElement parentElement, String labelString, - KeyStatement keyStatement, int textHeight, int style){ - KeyStatementElement element = new KeyStatementElement(this, parentElement, labelString, keyStatement, textHeight, style); + + public KeyStatementElement createKeyStatementElement( + ICdmFormElement parentElement, String labelString, + KeyStatement keyStatement, int textHeight, int style) { + KeyStatementElement element = new KeyStatementElement(this, + parentElement, labelString, keyStatement, textHeight, style); adapt(element); parentElement.addElement(element); return element; } - - + /** - *

createTextWithLabelElement

- * - * @param labelString a {@link java.lang.String} object. - * @param initialText a {@link java.lang.String} object. - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object. + *

+ * createTextWithLabelElement + *

+ * + * @param labelString + * a {@link java.lang.String} object. + * @param initialText + * a {@link java.lang.String} object. + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} + * object. */ - public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString, String initialText, int style){ - TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, style); + public TextWithLabelElement createTextWithLabelElement( + ICdmFormElement parentElement, String labelString, + String initialText, int style) { + TextWithLabelElement element = new TextWithLabelElement(this, + parentElement, labelString, initialText, null, style); adapt(element); parentElement.addElement(element); return element; } - - public UriWithLabelElement createUriWithLabelElement(ICdmFormElement parentElement, String labelString, URI initialUri, int style){ - UriWithLabelElement element = new UriWithLabelElement(this, parentElement, labelString, initialUri, null, style); + + public UriWithLabelElement createUriWithLabelElement( + ICdmFormElement parentElement, String labelString, URI initialUri, + int style) { + UriWithLabelElement element = new UriWithLabelElement(this, + parentElement, labelString, initialUri, null, style); adapt(element); parentElement.addElement(element); return element; } - + /** * @param element * @param string @@ -659,13 +760,15 @@ public class CdmFormFactory extends FormToolkit{ * @return */ public OpenUrlSelectorElement createOpenUrlSelectorElement( - ICdmFormElement parentElement, String labelString, IOpenUrlEnabled openUrlEnabled, int style) { - OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, parentElement, labelString, openUrlEnabled, style); + ICdmFormElement parentElement, String labelString, + IOpenUrlEnabled openUrlEnabled, int style) { + OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, + parentElement, labelString, openUrlEnabled, style); adapt(element); parentElement.addElement(element); return element; } - + /** * * @param parentElement @@ -675,390 +778,505 @@ public class CdmFormFactory extends FormToolkit{ * @param style * @return */ - public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString, - ConversationHolder conversation, User user, int style){ - EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation); + public EditPasswordElement createEditPasswordElement( + ICdmFormElement parentElement, String labelString, + ConversationHolder conversation, User user, int style) { + EditPasswordElement element = new EditPasswordElement(this, + parentElement, labelString, user, conversation); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createIntegerTextWithLabelElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param initialInteger a {@link java.lang.Integer} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} object. + *

+ * createIntegerTextWithLabelElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param initialInteger + * a {@link java.lang.Integer} object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} + * object. */ - public NumberWithLabelElement createIntegerTextWithLabelElement(ICdmFormElement parentElement, String labelString, Integer initialInteger, int style){ - NumberWithLabelElement element = new NumberWithLabelElement(this, parentElement, labelString, initialInteger, style); + public NumberWithLabelElement createIntegerTextWithLabelElement( + ICdmFormElement parentElement, String labelString, + Integer initialInteger, int style) { + NumberWithLabelElement element = new NumberWithLabelElement(this, + parentElement, labelString, initialInteger, style); adapt(element); parentElement.addElement(element); return element; } - /** - *

createFloatTextWithLabelElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param initialFloat a float. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} object. + *

+ * createFloatTextWithLabelElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param initialFloat + * a float. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} + * object. */ public NumberWithLabelElement createFloatTextWithLabelElement( - ICdmFormElement parentElement, String labelString, float initialFloat, - int style) { - NumberWithLabelElement element = new NumberWithLabelElement(this, parentElement, labelString, initialFloat, style); + ICdmFormElement parentElement, String labelString, + float initialFloat, int style) { + NumberWithLabelElement element = new NumberWithLabelElement(this, + parentElement, labelString, initialFloat, style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createLanguageStringWithLabelElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} object. + *

+ * createLanguageStringWithLabelElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param languageString + * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} + * object. */ - public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement, String labelString, LanguageString languageString, int style){ - LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString, languageString, style); + public LanguageStringWithLabelElement createLanguageStringWithLabelElement( + ICdmFormElement parentElement, String labelString, + LanguageString languageString, int style) { + LanguageStringWithLabelElement element = new LanguageStringWithLabelElement( + this, parentElement, labelString, languageString, style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createLanguageStringWithLabelElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object. - * @param height a int. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} object. + *

+ * createLanguageStringWithLabelElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param languageString + * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object. + * @param height + * a int. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} + * object. */ - public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement, String labelString, LanguageString languageString, int height, int style){ - LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString, languageString, height, style); + public LanguageStringWithLabelElement createLanguageStringWithLabelElement( + ICdmFormElement parentElement, String labelString, + LanguageString languageString, int height, int style) { + LanguageStringWithLabelElement element = new LanguageStringWithLabelElement( + this, parentElement, labelString, languageString, height, style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createTextElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param initialText a {@link java.lang.String} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object. + *

+ * createTextElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param initialText + * a {@link java.lang.String} object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} + * object. */ - public TextWithLabelElement createTextElement(ICdmFormElement parentElement, String initialText, int style){ - TextWithLabelElement element = new TextWithLabelElement(this, parentElement, null, initialText, null, style); + public TextWithLabelElement createTextElement( + ICdmFormElement parentElement, String initialText, int style) { + TextWithLabelElement element = new TextWithLabelElement(this, + parentElement, null, initialText, null, style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createKeyValueViewerElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param keyHeading a {@link java.lang.String} object. - * @param valueHeading a {@link java.lang.String} object. - * @param map a {@link java.util.Map} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement} object. + *

+ * createKeyValueViewerElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param keyHeading + * a {@link java.lang.String} object. + * @param valueHeading + * a {@link java.lang.String} object. + * @param map + * a {@link java.util.Map} object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement} + * object. */ - public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading, String valueHeading, Map map){ - KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map); + public KeyValueViewerElement createKeyValueViewerElement( + ICdmFormElement parentElement, String keyHeading, + String valueHeading, Map map) { + KeyValueViewerElement element = new KeyValueViewerElement(this, + parentElement, keyHeading, valueHeading, map); adapt(element); parentElement.addElement(element); return element; } - - - public static enum TermComboType{ - EXTENSIONTYPE, - LANGUAGE, - MARKERTYPE, - NOMENCLATURALSTATUSTYPE, - RANK, - RIGHTSTYPE, - NAMERELATIONSHIP, - NAMEDAREATYPE, - PRESENCEABSENCESTATUS, - ANNOTATIONTYPE, - NAMETYPEDESIGNATIONSTATUS, - SPECIMENTYPEDESIGNATIONSTATUS, - SEX, - STAGE, - PRESERVATION_METHOD, - MEASUREMENT_UNIT, - STATE, - MODIFIER, - STATISTICAL_MEASURE, - SCOPE, - EMPTY, - DETERMINATION_MODIFIER, - REFERENCE_SYSTEM - } - + + public static enum TermComboType { + EXTENSIONTYPE, LANGUAGE, MARKERTYPE, NOMENCLATURALSTATUSTYPE, RANK, RIGHTSTYPE, NAMERELATIONSHIP, NAMEDAREATYPE, PRESENCEABSENCESTATUS, ANNOTATIONTYPE, NAMETYPEDESIGNATIONSTATUS, SPECIMENTYPEDESIGNATIONSTATUS, SEX, STAGE, PRESERVATION_METHOD, MEASUREMENT_UNIT, STATE, MODIFIER, STATISTICAL_MEASURE, SCOPE, EMPTY, DETERMINATION_MODIFIER, REFERENCE_SYSTEM + } + /** - *

createTermComboElement

- * - * @param termComboType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType} object. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement} object. + *

+ * createTermComboElement + *

+ * + * @param termComboType + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param selection + * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} + * object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement} + * object. */ - public AbstractTermComboElement createTermComboElement(TermComboType termComboType, ICdmFormElement parentElement, String labelString, DefinedTermBase selection, int style){ + public AbstractTermComboElement createTermComboElement( + TermComboType termComboType, ICdmFormElement parentElement, + String labelString, DefinedTermBase selection, int style) { AbstractTermComboElement element = null; - - switch(termComboType){ + + switch (termComboType) { case EMPTY: - element = new EmptyComboElement(this, parentElement, labelString, style); + element = new EmptyComboElement(this, + parentElement, labelString, style); break; case EXTENSIONTYPE: - element = new ExtensionTypeComboElement(this, parentElement, labelString, (ExtensionType) selection, style); + element = new ExtensionTypeComboElement(this, parentElement, + labelString, (ExtensionType) selection, style); break; case LANGUAGE: - element = new LanguageComboElement(this, parentElement, labelString, (Language) selection, style); + element = new LanguageComboElement(this, parentElement, + labelString, (Language) selection, style); break; case MARKERTYPE: - element = new MarkerTypeComboElement(this, parentElement, labelString, (MarkerType) selection, style); + element = new MarkerTypeComboElement(this, parentElement, + labelString, (MarkerType) selection, style); break; case NOMENCLATURALSTATUSTYPE: - element = new NomenclaturalStatusTypeComboElement(this, parentElement, labelString, (NomenclaturalStatusType) selection, style); + element = new NomenclaturalStatusTypeComboElement(this, + parentElement, labelString, + (NomenclaturalStatusType) selection, style); break; case RANK: - element = new RankComboElement(this, parentElement, labelString, (Rank) selection, style); + element = new RankComboElement(this, parentElement, labelString, + (Rank) selection, style); break; case RIGHTSTYPE: - element = new RightsTypeComboElement(this, parentElement, labelString, (RightsTerm) selection, style); + element = new RightsTypeComboElement(this, parentElement, + labelString, (RightsTerm) selection, style); break; case NAMERELATIONSHIP: - element = new NameRelationshipTypeComboElement(this, parentElement, labelString, (NameRelationshipType) selection, style); + element = new NameRelationshipTypeComboElement(this, parentElement, + labelString, (NameRelationshipType) selection, style); break; case NAMEDAREATYPE: - element = new NamedAreaTypeComboElement(this, parentElement, labelString, (NamedAreaType) selection, style); + element = new NamedAreaTypeComboElement(this, parentElement, + labelString, (NamedAreaType) selection, style); break; case ANNOTATIONTYPE: - element = new AnnotationTypeComboElement(this, parentElement, labelString, (AnnotationType) selection, style); + element = new AnnotationTypeComboElement(this, parentElement, + labelString, (AnnotationType) selection, style); break; case PRESENCEABSENCESTATUS: - element = new PresenceAbsenceTermComboElement(this, parentElement, labelString, (PresenceAbsenceTermBase) selection, style); + element = new PresenceAbsenceTermComboElement(this, parentElement, + labelString, (PresenceAbsenceTermBase) selection, style); break; case NAMETYPEDESIGNATIONSTATUS: - element = new NameTypeDesignationStatusComboElement(this, parentElement, labelString, (NameTypeDesignationStatus) selection, style); + element = new NameTypeDesignationStatusComboElement(this, + parentElement, labelString, + (NameTypeDesignationStatus) selection, style); break; case SPECIMENTYPEDESIGNATIONSTATUS: - element = new SpecimenTypeDesignationStatusComboElement(this, parentElement, labelString, (SpecimenTypeDesignationStatus) selection, style); + element = new SpecimenTypeDesignationStatusComboElement(this, + parentElement, labelString, + (SpecimenTypeDesignationStatus) selection, style); break; case SEX: - element = new SexComboElement(this, parentElement, labelString, (Sex) selection, style); + element = new SexComboElement(this, parentElement, labelString, + (Sex) selection, style); break; case STAGE: - element = new StageComboElement(this, parentElement, labelString, (Stage) selection, style); + element = new StageComboElement(this, parentElement, labelString, + (Stage) selection, style); break; case PRESERVATION_METHOD: - element = new PreservationMethodComboElement(this, parentElement, labelString, (PreservationMethod) selection, style); + element = new PreservationMethodComboElement(this, parentElement, + labelString, (PreservationMethod) selection, style); break; case MEASUREMENT_UNIT: - element = new MeasurementUnitComboElement(this, parentElement, labelString, (MeasurementUnit) selection, style); + element = new MeasurementUnitComboElement(this, parentElement, + labelString, (MeasurementUnit) selection, style); break; case STATE: - element = new StateComboElement(this, parentElement, labelString, (State) selection, style); + element = new StateComboElement(this, parentElement, labelString, + (State) selection, style); break; case SCOPE: - element = new ScopeComboElement(this, parentElement, labelString, (Scope) selection, style); + element = new ScopeComboElement(this, parentElement, labelString, + (Scope) selection, style); break; case MODIFIER: - element = new ModifierComboElement(this, parentElement, labelString, (Modifier) selection, style); + element = new ModifierComboElement(this, parentElement, + labelString, (Modifier) selection, style); break; case STATISTICAL_MEASURE: - element = new StatisticalMeasureComboElement(this, parentElement, labelString, (StatisticalMeasure) selection, style); + element = new StatisticalMeasureComboElement(this, parentElement, + labelString, (StatisticalMeasure) selection, style); break; case DETERMINATION_MODIFIER: - element = new DeterminationModifierComboElement(this, parentElement, labelString, (DeterminationModifier) selection, style); + element = new DeterminationModifierComboElement(this, + parentElement, labelString, + (DeterminationModifier) selection, style); break; case REFERENCE_SYSTEM: - element = new ReferenceSystemComboElement(this, parentElement, labelString, (ReferenceSystem) selection, style); + element = new ReferenceSystemComboElement(this, parentElement, + labelString, (ReferenceSystem) selection, style); break; } - + adapt(element); parentElement.addElement(element); return element; } - - public static enum EnumComboType{ - REFERENCETYPE, - NOMENCLATURALCODE + + public static enum EnumComboType { + REFERENCETYPE, NOMENCLATURALCODE } - + /** - *

createEnumComboElement

- * - * @param enumComboType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType} object. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement} object. + *

+ * createEnumComboElement + *

+ * + * @param enumComboType + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement} + * object. */ - public AbstractEnumComboElement createEnumComboElement(EnumComboType enumComboType, ICdmFormElement parentElement, int style){ + public AbstractEnumComboElement createEnumComboElement( + EnumComboType enumComboType, ICdmFormElement parentElement, + int style) { AbstractEnumComboElement element = null; - switch(enumComboType){ + switch (enumComboType) { case REFERENCETYPE: - element = new ReferenceTypeComboElement(this, parentElement, "Reference Type", null, style); + element = new ReferenceTypeComboElement(this, parentElement, + "Reference Type", null, style); break; case NOMENCLATURALCODE: - element = new NomenclaturalCodeComboElement(this, parentElement, "Nomenclatural Code", null, style); + element = new NomenclaturalCodeComboElement(this, parentElement, + "Nomenclatural Code", null, style); break; } adapt(element); parentElement.addElement(element); return element; - } - + } + /** - *

createBrowserElement

- * - * @param imageUri a {@link java.net.URI} object. - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. + *

+ * createBrowserElement + *

+ * + * @param imageUri + * a {@link java.net.URI} object. + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object. */ - public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style){ - BrowserElement element = new BrowserElement(this, parentElement, imageUri, style); + public BrowserElement createBrowserElement(ICdmFormElement parentElement, + URI imageUri, int style) { + BrowserElement element = new BrowserElement(this, parentElement, + imageUri, style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createImageElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param imageUri a {@link java.net.URI} object. - * @param style a int. + *

+ * createImageElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param imageUri + * a {@link java.net.URI} object. + * @param style + * a int. * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object. */ - public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) { - ImageElement element = new ImageElement(this, parentElement, imageUri, style); + public ImageElement createImageElement(ICdmFormElement parentElement, + URI imageUri, int style) { + ImageElement element = new ImageElement(this, parentElement, imageUri, + style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createTextActionElement

- * - * @param labelString a {@link java.lang.String} object. - * @param initialText a {@link java.lang.String} object. - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param buttonLabel a {@link java.lang.String} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement} object. + *

+ * createTextActionElement + *

+ * + * @param labelString + * a {@link java.lang.String} object. + * @param initialText + * a {@link java.lang.String} object. + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param buttonLabel + * a {@link java.lang.String} object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement} + * object. */ - public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString, String buttonLabel, String initialText, int style){ - TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText, style); + public TextActionElement createTextActionElement( + ICdmFormElement parentElement, String labelString, + String buttonLabel, String initialText, int style) { + TextActionElement element = new TextActionElement(this, parentElement, + labelString, buttonLabel, initialText, style); adapt(element); parentElement.addElement(element); return element; } - + /** - * + * * @author n.hoffmann * @created Mar 5, 2010 * @version 1.0 */ - public static enum SelectionType{ - AGENT, - INSTITUTION, - NAME, - REFERENCE, - TAXON_BASE, - TAXON, - SYNONYM, - TEAM, - AUTHOR_TEAM, - PERSON, - DERIVED_UNIT, - FIELD_OBSERVATION, - FEATURE_TREE, - CLASSIFICATION, - TAXON_NODE, - COLLECTION, - FEATURE, - POLYTOMOUS_KEY, - POLYTOMOUS_KEY_NODE, - USER, - GROUP - } - + public static enum SelectionType { + AGENT, INSTITUTION, NAME, REFERENCE, TAXON_BASE, TAXON, SYNONYM, TEAM, AUTHOR_TEAM, PERSON, DERIVED_UNIT, FIELD_OBSERVATION, FEATURE_TREE, CLASSIFICATION, TAXON_NODE, COLLECTION, FEATURE, POLYTOMOUS_KEY, POLYTOMOUS_KEY_NODE, USER, GROUP + } + /** - *

createCheckbox

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param label a {@link java.lang.String} object. - * @param initialState a boolean. - * @param style a int. + *

+ * createCheckbox + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param label + * a {@link java.lang.String} object. + * @param initialState + * a boolean. + * @param style + * a int. * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object. */ - public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, boolean initialState, int style) { - CheckboxElement element = new CheckboxElement(this, parentElement, label, initialState, style | orientation); + public CheckboxElement createCheckbox(ICdmFormElement parentElement, + String label, boolean initialState, int style) { + CheckboxElement element = new CheckboxElement(this, parentElement, + label, initialState, style | orientation); adapt(element); parentElement.addElement(element); return element; } - - /** * Creates a section as a part of the form. - * + * * @return the section widget - * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object. + * @param section + * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} + * object. */ public Section adapt(AbstractFormSection section) { section.setMenu(section.getLayoutComposite().getMenu()); adapt(section, true, true); - + // handle focus and property change events for cdm use section.addFocusListener(selectionFocusHandler); section.setPropertyChangeListeners(propertyChangeListeners); - + if (section.getToggle() != null) { - section.getToggle().setHoverDecorationColor(getColors() - .getColor(IFormColors.TB_TOGGLE_HOVER)); - section.getToggle().setDecorationColor(getColors() - .getColor(IFormColors.TB_TOGGLE)); + section.getToggle().setHoverDecorationColor( + getColors().getColor(IFormColors.TB_TOGGLE_HOVER)); + section.getToggle().setDecorationColor( + getColors().getColor(IFormColors.TB_TOGGLE)); } - - section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont())); + + section.setFont(boldFontHolder2.getBoldFont(section + .getLayoutComposite().getFont())); if ((section.getStyle() & Section.TITLE_BAR) != 0 || (section.getStyle() & Section.SHORT_TITLE_BAR) != 0) { getColors().initializeSectionToolBarColors(); - section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG)); - section.setTitleBarBorderColor(getColors() - .getColor(IFormColors.TB_BORDER)); + section.setTitleBarBackground(getColors().getColor( + IFormColors.TB_BG)); + section.setTitleBarBorderColor(getColors().getColor( + IFormColors.TB_BORDER)); } // call setTitleBarForeground regardless as it also sets the label color - section.setTitleBarForeground(getColors() - .getColor(IFormColors.TB_TOGGLE)); + section.setTitleBarForeground(getColors().getColor( + IFormColors.TB_TOGGLE)); return section; } - + private class BoldFontHolder2 { private Font normalFont; @@ -1078,389 +1296,521 @@ public class CdmFormFactory extends FormToolkit{ dispose(); } if (boldFont == null) { - boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(), - normalFont); + boldFont = FormFonts.getInstance().getBoldFont( + getColors().getDisplay(), normalFont); } } public void dispose() { if (boldFont != null) { - FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay()); + FormFonts.getInstance().markFinished(boldFont, + getColors().getDisplay()); boldFont = null; } } } - + /** - *

createToggleableTextField

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param initialText a {@link java.lang.String} object. - * @param initialState a boolean. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement} object. + *

+ * createToggleableTextField + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param initialText + * a {@link java.lang.String} object. + * @param initialState + * a boolean. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement} + * object. */ - public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, - String labelString, String initialText, boolean initialState, int style) { - ToggleableTextElement element = new ToggleableTextElement(this, parentElement, - labelString, initialText, initialState, style | orientation); + public ToggleableTextElement createToggleableTextField( + ICdmFormElement parentElement, String labelString, + String initialText, boolean initialState, int style) { + ToggleableTextElement element = new ToggleableTextElement(this, + parentElement, labelString, initialText, initialState, style + | orientation); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createTimePeriodElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement} object. + *

+ * createTimePeriodElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param timePeriod + * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement} + * object. */ public TimePeriodElement createTimePeriodElement( - ICdmFormElement parentElement, String labelString, TimePeriod timePeriod, int style) { - TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style); + ICdmFormElement parentElement, String labelString, + TimePeriod timePeriod, int style) { + TimePeriodElement element = new TimePeriodElement(this, parentElement, + labelString, timePeriod, style); adapt(element); parentElement.addElement(element); return element; } - /** - *

createPointElement

- * - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param point a {@link eu.etaxonomy.cdm.model.location.Point} object. + *

+ * createPointElement + *

+ * + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param point + * a {@link eu.etaxonomy.cdm.model.location.Point} object. * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object. */ public PointElement createPointElement(ICdmFormElement parentElement, Point point, int style) { - PointElement element = new PointElement(this, parentElement, point, style); + PointElement element = new PointElement(this, parentElement, point, + style); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createDateDetailSection

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection} object. + *

+ * createDateDetailSection + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection} + * object. */ - public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style){ - DateDetailSection section = new DateDetailSection(this, parentElement, style); + public DateDetailSection createDateDetailSection( + ICdmFormElement parentElement, int style) { + DateDetailSection section = new DateDetailSection(this, parentElement, + style); parentElement.addElement(section); adapt(section); return section; } - + /** - *

createPartialElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. - * @param partial a {@link org.joda.time.Partial} object. - * @param style a int. + *

+ * createPartialElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param partial + * a {@link org.joda.time.Partial} object. + * @param style + * a int. * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object. */ - public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial, int style){ - PartialElement element = new PartialElement(this, parentElement, labelString, style); + public PartialElement createPartialElement(ICdmFormElement parentElement, + String labelString, Partial partial, int style) { + PartialElement element = new PartialElement(this, parentElement, + labelString, style); adapt(element); parentElement.addElement(element); return element; } /** - *

addSelectionListener

- * - * @param listener a {@link org.eclipse.swt.events.SelectionListener} object. + *

+ * addSelectionListener + *

+ * + * @param listener + * a {@link org.eclipse.swt.events.SelectionListener} object. */ - public void addSelectionListener(SelectionListener listener){ + public void addSelectionListener(SelectionListener listener) { selectionListenerList.add(listener); } - + /** - *

removeSelectionListener

- * - * @param listener a {@link org.eclipse.swt.events.SelectionListener} object. + *

+ * removeSelectionListener + *

+ * + * @param listener + * a {@link org.eclipse.swt.events.SelectionListener} object. */ - public void removeSelectionListener(SelectionListener listener){ - if(listener == null){ - StoreUtil.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null); - }else{ + public void removeSelectionListener(SelectionListener listener) { + if (listener == null) { + StoreUtil + .error(this.getClass(), + "Tried to remove a selection listener from this factories listeners but was null", + null); + } else { selectionListenerList.remove(listener); } } - + /** - *

addPropertyChangeListener

- * - * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object. + *

+ * addPropertyChangeListener + *

+ * + * @param listener + * a {@link org.eclipse.jface.util.IPropertyChangeListener} + * object. */ public void addPropertyChangeListener(IPropertyChangeListener listener) { propertyChangeListeners.add(0, listener); } - + /** - *

removePropertyChangeListener

- * - * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object. + *

+ * removePropertyChangeListener + *

+ * + * @param listener + * a {@link org.eclipse.jface.util.IPropertyChangeListener} + * object. */ - public void removePropertyChangeListener(IPropertyChangeListener listener){ + public void removePropertyChangeListener(IPropertyChangeListener listener) { propertyChangeListeners.remove(listener); } - - /** - *

createHorizontalSeparator

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param style a int. + *

+ * createHorizontalSeparator + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param style + * a int. * @return a {@link org.eclipse.swt.widgets.Label} object. */ - public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) { - Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style); + public Label createHorizontalSeparator(ICdmFormElement parentElement, + int style) { + Label separator = this.createSeparator( + parentElement.getLayoutComposite(), SWT.HORIZONTAL | style); separator.setLayoutData(FILL_HORIZONTALLY()); return separator; } - + /** - *

createVersionElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement} object. + *

+ * createVersionElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param entity + * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} + * object. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement} + * object. */ - public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, - int style) { - VersionElement element = new VersionElement(this, parentElement, entity, style); + public VersionElement createVersionElement(ICdmFormElement parentElement, + VersionableEntity entity, int style) { + VersionElement element = new VersionElement(this, parentElement, + entity, style); adapt(element); parentElement.addElement(element); return element; } /** - *

createVersionSection

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection} object. + *

+ * createVersionSection + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection} + * object. */ - public VersionSection createVersionSection(ICdmFormElement parentElement, int style) { + public VersionSection createVersionSection(ICdmFormElement parentElement, + int style) { VersionSection section = new VersionSection(this, parentElement, style); parentElement.addElement(section); adapt(section); return section; } - + /** - *

createEmptyElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. + *

+ * createEmptyElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object. */ public EmptyElement createEmptyElement(ICdmFormElement parentElement) { - EmptyElement element = new EmptyElement(this, parentElement, null, SWT.NULL); + EmptyElement element = new EmptyElement(this, parentElement, null, + SWT.NULL); adapt(element); parentElement.addElement(element); return element; } - + /** - *

createHeadlineSection

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection} object. + *

+ * createHeadlineSection + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection} + * object. */ public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) { - HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL); + HeadlineSection section = new HeadlineSection(this, parentElement, + SWT.NULL); parentElement.addElement(section); adapt(section); return section; } - /** - *

createParsingMessageElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement} object. + *

+ * createParsingMessageElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param parserProblem + * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} + * object. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement} + * object. */ public ParsingMessageElement createParsingMessageElement( - ICdmFormElement parentElement, ParserProblem parserProblem, int style) { - ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style); + ICdmFormElement parentElement, ParserProblem parserProblem, + int style) { + ParsingMessageElement element = new ParsingMessageElement(this, + parentElement, parserProblem, style); adapt(element); parentElement.addElement(element); return element; } - // SIMPLIFY - + /** * */ - public static enum DetailType{ - NONVIRALNAME, - SCIENTIFICNAME, - REFERENCEBASE, - NOMENCLATURALREFERENCE, - TAXONBASE, - AUTHORSHIP, - TEAM, - PERSON, - DESCRIPTION, - DESCRIPTIONELEMENT, - PARSINGMESSAGE, - NAMERELATIONSHIP, - TEAMORPERSONBASE, - MEDIA, - FIELD_OBSERVATION, - DERIVED_UNIT_FACADE, - GATHERING_EVENT, - DERIVED_UNIT, NATURAL_LANGUAGE, - FEATURE_DISTRIBUTION, - CLASSIFICATION, - TAXON_NODE, - COLLECTION, - POLYTOMOUS_KEY, - POLYTOMOUS_KEY_NODE, - INSTITUTION, - DERIVED_UNIT_GENERAL, - HYBRID, - USER, - GROUP - } - + public static enum DetailType { + NONVIRALNAME, SCIENTIFICNAME, REFERENCEBASE, NOMENCLATURALREFERENCE, TAXONBASE, AUTHORSHIP, TEAM, PERSON, DESCRIPTION, DESCRIPTIONELEMENT, PARSINGMESSAGE, NAMERELATIONSHIP, TEAMORPERSONBASE, MEDIA, FIELD_OBSERVATION, DERIVED_UNIT_FACADE, GATHERING_EVENT, DERIVED_UNIT, NATURAL_LANGUAGE, FEATURE_DISTRIBUTION, CLASSIFICATION, TAXON_NODE, COLLECTION, POLYTOMOUS_KEY, POLYTOMOUS_KEY_NODE, INSTITUTION, DERIVED_UNIT_GENERAL, HYBRID, USER, GROUP + } + /** - *

createCdmDetailSection

- * - * @param detailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} object. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object. - * @param style a int. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object. + *

+ * createCdmDetailSection + *

+ * + * @param detailType + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param selectionProvider + * a {@link org.eclipse.jface.viewers.ISelectionProvider} object. + * @param style + * a int. + * @param conversation + * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} + * object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} + * object. */ - public AbstractFormSection createCdmDetailSection(DetailType detailType, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + public AbstractFormSection createCdmDetailSection(DetailType detailType, + ConversationHolder conversation, ICdmFormElement parentElement, + ISelectionProvider selectionProvider, int style) { AbstractFormSection section = null; - - switch(detailType){ + + switch (detailType) { case SCIENTIFICNAME: - section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new NameDetailSection(this, conversation, parentElement, + selectionProvider, style); break; case REFERENCEBASE: - section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new ReferenceDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case NOMENCLATURALREFERENCE: - section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new NomenclaturalReferenceDetailSection(this, + conversation, parentElement, selectionProvider, style); break; case TAXONBASE: - section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new TaxonBaseDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case AUTHORSHIP: - section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new AuthorshipDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case TEAMORPERSONBASE: - section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new TeamOrPersonBaseDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case TEAM: - section = new TeamDetailSection(this, conversation, parentElement, null, style); + section = new TeamDetailSection(this, conversation, parentElement, + null, style); break; case PERSON: - section = new PersonDetailSection(this, conversation, parentElement, null, style); + section = new PersonDetailSection(this, conversation, + parentElement, null, style); break; case DESCRIPTION: - section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new DescriptionDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case DESCRIPTIONELEMENT: - section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new DescriptionElementDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case PARSINGMESSAGE: - section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style); + section = new ParsingMessagesSection(this, conversation, + parentElement, selectionProvider, style); break; case NONVIRALNAME: - section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new NonViralNameDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case MEDIA: - section = new eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection(this, conversation, parentElement, selectionProvider, style); + section = new eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection( + this, conversation, parentElement, selectionProvider, style); break; case DERIVED_UNIT_FACADE: - section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new DerivedUnitFacadeDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case FIELD_OBSERVATION: - section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new FieldObservationDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case GATHERING_EVENT: - section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new GatheringEventDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case DERIVED_UNIT: - section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new DerivedUnitBaseDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case NATURAL_LANGUAGE: - section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style); + section = new NaturalLanguageSection(this, conversation, + parentElement, selectionProvider, style); break; case FEATURE_DISTRIBUTION: - section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new FeatureDistributionDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case CLASSIFICATION: - section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new ClassificationDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case TAXON_NODE: - section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new TaxonNodeDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case POLYTOMOUS_KEY: - section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new PolytomousKeyDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case POLYTOMOUS_KEY_NODE: - section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new PolytomousKeyNodeDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case INSTITUTION: - section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new InstitutionDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case DERIVED_UNIT_GENERAL: - section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new GeneralDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case HYBRID: - section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new HybridDetailSection(this, conversation, + parentElement, selectionProvider, style); break; case USER: - section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new UserDetailSection(this, conversation, parentElement, + selectionProvider, style); break; case GROUP: - section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style); + section = new GroupDetailSection(this, conversation, parentElement, + selectionProvider, style); break; } - - if(section == null){ - throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet."); + + if (section == null) { + throw new RuntimeException( + "You tried to create a cdm detail section that is not implemented yet."); } - + parentElement.addElement(section); adapt(section); return section; } - + /** - *

createCdmDetailElement

- * - * @param detailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} object. - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} object. + *

+ * createCdmDetailElement + *

+ * + * @param detailType + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} + * object. + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} + * object. */ - public AbstractCdmDetailElement createCdmDetailElement(DetailType detailType, ICdmFormElement parentElement, int style){ + public AbstractCdmDetailElement createCdmDetailElement( + DetailType detailType, ICdmFormElement parentElement, int style) { AbstractCdmDetailElement element = null; - - switch(detailType){ + + switch (detailType) { case SCIENTIFICNAME: element = new NameDetailElement(this, parentElement, style); break; @@ -1468,7 +1818,8 @@ public class CdmFormFactory extends FormToolkit{ element = new ReferenceDetailElement(this, parentElement, style); break; case NOMENCLATURALREFERENCE: - element = new NomenclaturalReferenceDetailElement(this, parentElement, style); + element = new NomenclaturalReferenceDetailElement(this, + parentElement, style); break; case TAXONBASE: element = new TaxonBaseDetailElement(this, parentElement, style); @@ -1486,7 +1837,8 @@ public class CdmFormFactory extends FormToolkit{ element = new DescriptionDetailElement(this, parentElement, style); break; case DESCRIPTIONELEMENT: - element = new DescriptionElementDetailElement(this, parentElement, style); + element = new DescriptionElementDetailElement(this, parentElement, + style); break; case NONVIRALNAME: element = new NonViralNameDetailElement(this, parentElement); @@ -1540,393 +1892,495 @@ public class CdmFormFactory extends FormToolkit{ element = new GroupDetailElement(this, parentElement); break; } - - if(element == null){ - StoreUtil.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType, null); + + if (element == null) { + StoreUtil + .error(this.getClass(), + "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + + detailType, null); } - + adapt(element); parentElement.addElement(element); return element; } - + /** * * @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 - } - + 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 + } + /** - *

createEntityDetailSection

- * - * @param entityDetailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType} object. - * @param style a int. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object. + *

+ * createEntityDetailSection + *

+ * + * @param entityDetailType + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType} + * object. + * @param style + * a int. + * @param conversation + * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @return a {@link eu.etaxonomy.taxeditor.ui.forms.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){ + + switch (entityDetailType) { case TEAM: - section = new TeamDetailSection(this, conversation, parentElement, null, style); + section = new TeamDetailSection(this, conversation, parentElement, + null, style); break; case TEAMMEMBER: - section = new TeamMemberSection(this, conversation, parentElement, style); + section = new TeamMemberSection(this, conversation, parentElement, + style); break; case ANNOTATION: - section = new AnnotationSection(this, conversation, parentElement, style); + section = new AnnotationSection(this, conversation, parentElement, + style); break; case CREDIT: - section = new CreditSection(this, conversation, parentElement, style); + section = new CreditSection(this, conversation, parentElement, + style); break; case DESCRIPTIONELEMENTSOURCE: - section = new DescriptionElementSourceSection(this, conversation, parentElement, style); + section = new DescriptionElementSourceSection(this, conversation, + parentElement, style); break; case EXTENSION: - section = new ExtensionSection(this, conversation, parentElement, style); + section = new ExtensionSection(this, conversation, parentElement, + style); break; case MARKER: - section = new MarkerSection(this, conversation, parentElement, style); + section = new MarkerSection(this, conversation, parentElement, + style); break; case MEDIA: section = new MediaSection(this, conversation, parentElement, style); break; case DESCRIPTIONELEMENTMEDIA: - section = new DescriptionElementMediaSection(this, conversation, parentElement, style); + section = new DescriptionElementMediaSection(this, conversation, + parentElement, style); break; case MEDIAREPRESENTATION: - section = new MediaRepresentationSection(this, conversation, parentElement, style); + section = new MediaRepresentationSection(this, conversation, + parentElement, style); break; case MEDIAREPRESENTATIONPART: - section = new MediaRepresentationPartSection(this, conversation, parentElement, style); + section = new MediaRepresentationPartSection(this, conversation, + parentElement, style); break; case MODIFIER: - section = new ModifierSection(this, conversation, parentElement, style); + section = new ModifierSection(this, conversation, parentElement, + style); break; case NOMENCLATURALSTATUS: - section = new NomenclaturalStatusSection(this, conversation, parentElement, style); + section = new NomenclaturalStatusSection(this, conversation, + parentElement, style); break; case NAME_RELATIONSHIP: - section = new NameRelationshipDetailSection(this, conversation, parentElement, style); + section = new NameRelationshipDetailSection(this, conversation, + parentElement, style); break; case PROTOLOG: - section = new ProtologueSection(this, conversation, parentElement, style); + section = new ProtologueSection(this, conversation, parentElement, + style); break; case RIGHTS: - section = new RightsSection(this, conversation, parentElement, style); + section = new RightsSection(this, conversation, parentElement, + style); break; case SOURCE: - section = new SourceSection(this, conversation, parentElement, style); + section = new SourceSection(this, conversation, parentElement, + style); break; case SCOPE: section = new ScopeSection(this, conversation, parentElement, style); break; case DESCRIPTIONSOURCE: - section = new DescriptionSourceSection(this, conversation, parentElement, style); + section = new DescriptionSourceSection(this, conversation, + parentElement, style); break; case TYPEDESIGNATION: - section = new TypeDesignationSection(this, conversation, parentElement, style); + section = new TypeDesignationSection(this, conversation, + parentElement, style); break; case STATE_DATA: - section = new StateDataSection(this, conversation, parentElement, style); + section = new StateDataSection(this, conversation, parentElement, + style); break; case STATISTICAL_MEASUREMENT_VALUE: - section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style); + section = new StatisticalMeasurementValueSection(this, + conversation, parentElement, style); break; case DESCRIBED_SPECIMEN: - section = new DescribedSpecimenSection(this, conversation, parentElement, style); + section = new DescribedSpecimenSection(this, conversation, + parentElement, style); break; case COLLECTING_AREA: - section = new CollectingAreasDetailSection(this, conversation, parentElement, style); + section = new CollectingAreasDetailSection(this, conversation, + parentElement, style); break; case DETERMINATION_EVENT: - section = new DeterminationEventDetailSection(this, conversation, parentElement, style); + section = new DeterminationEventDetailSection(this, conversation, + parentElement, style); break; case SPECIMEN_COLLECTION: - section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style); + section = new SpecimenCollectionDetailSection(this, conversation, + parentElement, style); break; case IDENTIFIABLE_SOURCE_COLLECTION: - section = new SourceCollectionDetailSection(this, conversation, parentElement, style); + section = new SourceCollectionDetailSection(this, conversation, + parentElement, style); break; case GEOGRAPHICAL_SCOPE: - section = new GeographicalScopeDetailSection(this, conversation, parentElement, style); + section = new GeographicalScopeDetailSection(this, conversation, + parentElement, style); break; case SCOPE_RESTRICTION: - section = new ScopeRestrictionSection(this, conversation, parentElement, style); + section = new ScopeRestrictionSection(this, conversation, + parentElement, style); break; case MEMBER: - section = new MemberDetailSection(this, conversation, parentElement, style); + section = new MemberDetailSection(this, conversation, + parentElement, style); break; case GRANTED_AUTHORITY: - section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style); + section = new GrantedAuthorityDetailSection(this, conversation, + parentElement, style); break; case GROUPS_BY_USER: - section = new GroupsByUserDetailSection(this, conversation, parentElement, style); + section = new GroupsByUserDetailSection(this, conversation, + parentElement, style); + break; + case TAXONOMIC_SCOPE: + section = new TaxonomicScopeSection(this, conversation, + parentElement, style); break; } parentElement.addElement(section); adapt(section); return section; } - + /** - *

createEntityCollectionElement

- * - * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object. - * @param style a int. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object. - * @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object. - * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement} object. + *

+ * createEntityCollectionElement + *

+ * + * @param removeListener + * a {@link org.eclipse.swt.events.SelectionListener} object. + * @param style + * a int. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} + * object. + * @param versionableEntity + * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} + * object. + * @param backgroundColor + * a {@link org.eclipse.swt.graphics.Color} object. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement} + * object. */ - public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement, Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style){ + public AbstractEntityCollectionElement createEntityCollectionElement( + AbstractFormSection parentElement, Object versionableEntity, + SelectionListener removeListener, Color backgroundColor, int style) { AbstractEntityCollectionElement element = null; - + Object entity = HibernateProxyHelper.deproxy(versionableEntity); - - if(entity instanceof Annotation){ - element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style); - } - else if(entity instanceof Person){ - element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style); - } - else if(entity instanceof Credit){ - element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style); - } - else if(entity instanceof Extension){ - element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style); - } - else if(entity instanceof Marker){ - element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style); - } - else if(entity instanceof Media){ - element = new MediaElement(this, parentElement, (Media) entity, removeListener, style); - } - else if(entity instanceof MediaRepresentation){ - element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener, style); - } - else if(entity instanceof ImageFile){ - element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style); - } - else if(entity instanceof NomenclaturalStatus){ - element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener, style); - } - else if(entity instanceof Rights){ - element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style); - } - else if(entity instanceof DescriptionElementSource){ - element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity, removeListener, style); - } - else if(entity instanceof IdentifiableSource){ - element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener, style); - } - else if(entity instanceof Scope){ - element = new ScopeElement(this, parentElement, (Scope) entity, removeListener, style); - } - else if(entity instanceof Modifier){ - element = new ModifierElement(this, parentElement, (Modifier) entity, removeListener, style); - } - else if(entity instanceof Reference){ - element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style); - } - else if(entity instanceof NameTypeDesignation){ - element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener, style); - } - else if(entity instanceof NameRelationship){ - element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener, style); - } - else if(entity instanceof SpecimenTypeDesignation){ - element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity, removeListener, style); - } - else if(entity instanceof StateData){ - element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style); - } - else if(entity instanceof StatisticalMeasurementValue){ - element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity, removeListener, style); - } - else if(entity instanceof DerivedUnit){ - element = new DerivedUnitElement(this, parentElement, (DerivedUnit) entity, removeListener, style); - } - else if(entity instanceof NamedArea){ - element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style); - } - else if(entity instanceof DeterminationEvent){ - element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style); - } - else if(entity instanceof Specimen){ - element = new SpecimenCollectionDetailElement(this, parentElement, (Specimen) entity, removeListener, style); - } - else if(entity instanceof User){ - element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style); - } - else if(entity instanceof GrantedAuthority){ - element = new GrantedAuthorityDetailElement(this, parentElement, (GrantedAuthority) entity, removeListener, style); - } - else if(entity instanceof Group){ - element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style); - } - else if(entity instanceof DescriptionElementBase){ - // this is the special case for protologs, maybe we can do this differently when API improves + + if (entity instanceof Annotation) { + element = new AnnotationElement(this, parentElement, + (Annotation) entity, removeListener, style); + } else if (entity instanceof Person) { + element = new TeamMemberElement(this, parentElement, + (Person) entity, removeListener, style); + } else if (entity instanceof Credit) { + element = new CreditElement(this, parentElement, (Credit) entity, + removeListener, style); + } else if (entity instanceof Extension) { + element = new ExtensionElement(this, parentElement, + (Extension) entity, removeListener, style); + } else if (entity instanceof Marker) { + element = new MarkerElement(this, parentElement, (Marker) entity, + removeListener, style); + } else if (entity instanceof Media) { + element = new MediaElement(this, parentElement, (Media) entity, + removeListener, style); + } else if (entity instanceof MediaRepresentation) { + element = new MediaRepresentationElement(this, parentElement, + (MediaRepresentation) entity, removeListener, style); + } else if (entity instanceof ImageFile) { + element = new ImageFileElement(this, parentElement, + (ImageFile) entity, removeListener, style); + } else if (entity instanceof NomenclaturalStatus) { + element = new NomenclaturalStatusElement(this, parentElement, + (NomenclaturalStatus) entity, removeListener, style); + } else if (entity instanceof Rights) { + element = new RightsElement(this, parentElement, (Rights) entity, + removeListener, style); + } else if (entity instanceof DescriptionElementSource) { + element = new DescriptionElementSourceElement(this, parentElement, + (DescriptionElementSource) entity, removeListener, style); + } else if (entity instanceof IdentifiableSource) { + element = new IdentifiableSourceElement(this, parentElement, + (IdentifiableSource) entity, removeListener, style); + } else if (entity instanceof Scope) { + element = new ScopeElement(this, parentElement, (Scope) entity, + removeListener, style); + } else if (entity instanceof Modifier) { + element = new ModifierElement(this, parentElement, + (Modifier) entity, removeListener, style); + } else if (entity instanceof Reference) { + element = new DescriptionSourceElement(this, parentElement, + (Reference) entity, removeListener, style); + } else if (entity instanceof NameTypeDesignation) { + element = new NameTypeDesignationElement(this, parentElement, + (NameTypeDesignation) entity, removeListener, style); + } else if (entity instanceof NameRelationship) { + element = new NameRelationshipDetailElement(this, parentElement, + (NameRelationship) entity, removeListener, style); + } else if (entity instanceof SpecimenTypeDesignation) { + element = new SpecimenTypeDesignationElement(this, parentElement, + (SpecimenTypeDesignation) entity, removeListener, style); + } else if (entity instanceof StateData) { + element = new StateDataElement(this, parentElement, + (StateData) entity, removeListener, style); + } else if (entity instanceof StatisticalMeasurementValue) { + element = new StatisticalMeasurementValueElement(this, + parentElement, (StatisticalMeasurementValue) entity, + removeListener, style); + } else if (entity instanceof DerivedUnit) { + element = new DerivedUnitElement(this, parentElement, + (DerivedUnit) entity, removeListener, style); + } else if (entity instanceof NamedArea) { + element = new NamedAreaDetailElement(this, parentElement, + (NamedArea) entity, removeListener, style); + } else if (entity instanceof DeterminationEvent) { + element = new DeterminationEventDetailElement(this, parentElement, + (DeterminationEvent) entity, removeListener, style); + } else if (entity instanceof Specimen) { + element = new SpecimenCollectionDetailElement(this, parentElement, + (Specimen) entity, removeListener, style); + } else if (entity instanceof User) { + element = new MemberDetailElement(this, parentElement, + (User) entity, removeListener, style); + } else if (entity instanceof GrantedAuthority) { + element = new GrantedAuthorityDetailElement(this, parentElement, + (GrantedAuthority) entity, removeListener, style); + } else if (entity instanceof Group) { + element = new GroupsByUserDetailElement(this, parentElement, + (Group) entity, removeListener, style); + } else if (entity instanceof Taxon) { + element = new TaxonDetailElement(this, parentElement, + (Taxon) entity, removeListener, style); + } else if (entity instanceof DescriptionElementBase) { + // this is the special case for protologs, maybe we can do this + // differently when API improves DescriptionElementBase descriptionElement = (DescriptionElementBase) entity; - if(descriptionElement.getFeature().equals(Feature.PROTOLOGUE())){ - element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style); + if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) { + element = new ProtologueElement(this, parentElement, + descriptionElement, removeListener, style); } } - - if(element == null){ - StoreUtil.errorDialog("No element for entity", this, "Could not generate element for entity. " + - "Looks like the case is not handled already. Check implementation. Entity: " + entity, null); + + if (element == null) { + StoreUtil + .errorDialog( + "No element for entity", + this, + "Could not generate element for entity. " + + "Looks like the case is not handled already. Check implementation. Entity: " + + entity, null); } - - if(backgroundColor != null && !backgroundColor.isDisposed()){ + + if (backgroundColor != null && !backgroundColor.isDisposed()) { element.setBackgroundColor(backgroundColor); } - + adapt(element); parentElement.addElement(element); return element; } - + /** - *

createSelectionElement

- * - * @param selectionType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType} object. - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param labelString a {@link java.lang.String} object. + *

+ * createSelectionElement + *

+ * * @param selectionType - * @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object. - * @param style a int. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @return a {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement} object. + * a + * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param selectionType + * @param selection + * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} + * object. + * @param style + * a int. + * @param conversation + * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} + * object. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement} + * object. */ - public AbstractSelectionElement createSelectionElement(SelectionType selectionType, ConversationHolder conversation, ICdmFormElement parentElement, String labelString, ICdmBase selection, int style){ + public AbstractSelectionElement createSelectionElement( + SelectionType selectionType, ConversationHolder conversation, + ICdmFormElement parentElement, String labelString, + ICdmBase selection, int style) { AbstractSelectionElement element = null; - - IAnnotatableEntity entity = (IAnnotatableEntity) HibernateProxyHelper.deproxy(selection); - + + IAnnotatableEntity entity = (IAnnotatableEntity) HibernateProxyHelper + .deproxy(selection); + switch (selectionType) { case AGENT: - element = new AgentSelectionElement(this, conversation, parentElement, labelString, (TeamOrPersonBase) entity, style); + element = new AgentSelectionElement(this, conversation, + parentElement, labelString, (TeamOrPersonBase) entity, + style); break; case PERSON: - element = new PersonSelectionElement(this, conversation, parentElement, labelString, (Person) entity, style); + element = new PersonSelectionElement(this, conversation, + parentElement, labelString, (Person) entity, style); break; case TEAM: - element = new TeamSelectionElement(this, conversation, parentElement, labelString, (Team) entity, style); + element = new TeamSelectionElement(this, conversation, + parentElement, labelString, (Team) entity, style); break; case AUTHOR_TEAM: - element = new NomenclaturalAuthorTeamSelectionElement(this, conversation, parentElement, labelString, (Team) entity, style); + element = new NomenclaturalAuthorTeamSelectionElement(this, + conversation, parentElement, labelString, (Team) entity, + style); break; case INSTITUTION: - element = new InstitutionSelectionElement(this, conversation, parentElement, labelString, (Institution) entity, style); + element = new InstitutionSelectionElement(this, conversation, + parentElement, labelString, (Institution) entity, style); break; case NAME: - element = new NameSelectionElement(this, conversation, parentElement, labelString, (TaxonNameBase) entity, style); + element = new NameSelectionElement(this, conversation, + parentElement, labelString, (TaxonNameBase) entity, style); break; case REFERENCE: - element = new ReferenceSelectionElement(this, conversation, parentElement, labelString, (Reference) entity, style); + element = new ReferenceSelectionElement(this, conversation, + parentElement, labelString, (Reference) entity, style); break; case TAXON_BASE: - element = new TaxonBaseSelectionElement(this, conversation, parentElement, labelString, (TaxonBase) entity, style); + element = new TaxonBaseSelectionElement(this, conversation, + parentElement, labelString, (TaxonBase) entity, style); break; case TAXON: - element = new TaxonSelectionElement(this, conversation, parentElement, labelString, (Taxon) entity, style); + element = new TaxonSelectionElement(this, conversation, + parentElement, labelString, (Taxon) entity, style); break; case SYNONYM: - element = new SynonymSelectionElement(this, conversation, parentElement, labelString, (Synonym) entity, style); + element = new SynonymSelectionElement(this, conversation, + parentElement, labelString, (Synonym) entity, style); break; case DERIVED_UNIT: - element = new DerivedUnitBaseSelectionElement(this, conversation, parentElement, labelString, (DerivedUnitBase) entity, style); + element = new DerivedUnitBaseSelectionElement(this, conversation, + parentElement, labelString, (DerivedUnitBase) entity, style); break; case FIELD_OBSERVATION: - element = new FieldObservationSelectionElement(this, conversation, parentElement, labelString, (FieldObservation) entity, style); + element = new FieldObservationSelectionElement(this, conversation, + parentElement, labelString, (FieldObservation) entity, + style); break; case FEATURE_TREE: - element = new FeatureTreeSelectionElement(this, conversation, parentElement, labelString, (FeatureTree) entity, style); + element = new FeatureTreeSelectionElement(this, conversation, + parentElement, labelString, (FeatureTree) entity, style); break; case CLASSIFICATION: - element = new ClassificationSelectionElement(this, conversation, parentElement, labelString, (Classification) entity, style); + element = new ClassificationSelectionElement(this, conversation, + parentElement, labelString, (Classification) entity, style); break; case TAXON_NODE: - element = new TaxonNodeSelectionElement(this, conversation, parentElement, labelString, (TaxonNode) entity, style); + element = new TaxonNodeSelectionElement(this, conversation, + parentElement, labelString, (TaxonNode) entity, style); break; case COLLECTION: - element = new CollectionSelectionElement(this, conversation, parentElement, labelString, (Collection) entity, style); + element = new CollectionSelectionElement(this, conversation, + parentElement, labelString, (Collection) entity, style); break; case FEATURE: - element = new FeatureSelectionElement(this, conversation, parentElement, labelString, (Feature) entity, style); + element = new FeatureSelectionElement(this, conversation, + parentElement, labelString, (Feature) entity, style); break; case POLYTOMOUS_KEY: - element = new PolytomousKeySelectionElement(this, conversation, parentElement, labelString, (PolytomousKey) entity, style); + element = new PolytomousKeySelectionElement(this, conversation, + parentElement, labelString, (PolytomousKey) entity, style); break; case POLYTOMOUS_KEY_NODE: - element = new PolytomousKeyNodeSelectionElement(this, conversation, parentElement, labelString, (PolytomousKeyNode) entity, style); + element = new PolytomousKeyNodeSelectionElement(this, conversation, + parentElement, labelString, (PolytomousKeyNode) entity, + style); break; case USER: - element = new UserSelectionElement(this, conversation, parentElement, labelString, (User) entity, style); + element = new UserSelectionElement(this, conversation, + parentElement, labelString, (User) entity, style); break; case GROUP: - element = new GroupSelectionElement(this, conversation, parentElement, labelString, (Group) entity, style); + element = new GroupSelectionElement(this, conversation, + parentElement, labelString, (Group) entity, style); break; default: - new RuntimeException("There is no selection composite for the desired selection type."); + new RuntimeException( + "There is no selection composite for the desired selection type."); break; } - + adapt(element); parentElement.addElement(element); return element; } - + /** - *

createNamedAreaSelectionElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @param labelString a {@link java.lang.String} object. - * @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement} object. + *

+ * createNamedAreaSelectionElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param conversation + * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param selection + * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement} + * object. */ - public NamedAreaSelectionElement createNamedAreaSelectionElement(ICdmFormElement parentElement, ConversationHolder conversation, String labelString, NamedArea selection, int style){ - NamedAreaSelectionElement element = new NamedAreaSelectionElement(this, conversation, parentElement, labelString, selection, style); + public NamedAreaSelectionElement createNamedAreaSelectionElement( + ICdmFormElement parentElement, ConversationHolder conversation, + String labelString, NamedArea selection, int style) { + NamedAreaSelectionElement element = new NamedAreaSelectionElement(this, + conversation, parentElement, labelString, selection, style); adapt(element); parentElement.addElement(element); return element; @@ -1941,8 +2395,10 @@ public class CdmFormFactory extends FormToolkit{ } /** - *

Getter for the field selectionProvider.

- * + *

+ * Getter for the field selectionProvider. + *

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

createDetailedDescriptionDetailElement

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. - * @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object. - * @param style a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement} object. + *

+ * createDetailedDescriptionDetailElement + *

+ * + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} + * object. + * @param entity + * a + * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} + * object. + * @param style + * a int. + * @return a + * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement} + * object. */ public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement( - ICdmFormElement parentElement, DescriptionElementBase entity, int style) { + ICdmFormElement parentElement, DescriptionElementBase entity, + int style) { AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null; - - - if(entity instanceof CategoricalData){ - detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement, (CategoricalData) entity, style); - } - else if(entity instanceof CommonTaxonName){ - detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity, style); - } - else if(entity instanceof Distribution){ - detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity, style); - } - else if(entity instanceof IndividualsAssociation){ - detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement, (IndividualsAssociation) entity, style); - } - else if(entity instanceof QuantitativeData){ - detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement, (QuantitativeData) entity, style); - } - else if(entity instanceof TaxonInteraction){ - detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement, (TaxonInteraction) entity, style); - } - else if(entity instanceof TextData){ - detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style); - } - else{ - throw new IllegalStateException("There is no interface for the given description element"); + + if (entity instanceof CategoricalData) { + detailedDescriptionElement = new CategoricalDataDetailElement(this, + parentElement, (CategoricalData) entity, style); + } else if (entity instanceof CommonTaxonName) { + detailedDescriptionElement = new CommonNameDetailElement(this, + parentElement, (CommonTaxonName) entity, style); + } else if (entity instanceof Distribution) { + detailedDescriptionElement = new DistributionDetailElement(this, + parentElement, (Distribution) entity, style); + } else if (entity instanceof IndividualsAssociation) { + detailedDescriptionElement = new IndividualsAssociationDetailElement( + this, parentElement, (IndividualsAssociation) entity, style); + } else if (entity instanceof QuantitativeData) { + detailedDescriptionElement = new QuantitativeDataDetailElement( + this, parentElement, (QuantitativeData) entity, style); + } else if (entity instanceof TaxonInteraction) { + detailedDescriptionElement = new TaxonInteractionDetailElement( + this, parentElement, (TaxonInteraction) entity, style); + } else if (entity instanceof TextData) { + detailedDescriptionElement = new TextDataDetailElement(this, + parentElement, (TextData) entity, style); + } else { + throw new IllegalStateException( + "There is no interface for the given description element"); } adapt(detailedDescriptionElement); parentElement.addElement(detailedDescriptionElement); return detailedDescriptionElement; - + } - /** * Creates a styled text as a part of the form. - * + * * @param parent * the text parent * @param value @@ -2005,12 +2471,13 @@ public class CdmFormFactory extends FormToolkit{ * @return the text widget */ public StyledText createStyledText(Composite parent, String value, int style) { - StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation()); + StyledText text = new StyledText(parent, getBorderStyle() | style + | getOrientation()); if (value != null) text.setText(value); text.setForeground(getColors().getForeground()); text.setBackground(getColors().getBackground()); -// text.addFocusListener(visibilityHandler); + // text.addFocusListener(visibilityHandler); return text; } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java index 633fc7cdc..ffcf4f6fe 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java @@ -13,9 +13,10 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; /** * @author n.hoffmann - * + * */ -public class PolytomousKeyDetailElement extends AbstractCdmDetailElement { +public class PolytomousKeyDetailElement extends + AbstractCdmDetailElement { public PolytomousKeyDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) { @@ -23,23 +24,25 @@ public class PolytomousKeyDetailElement extends AbstractCdmDetailElement { + + /** + * @param formFactory + * @param conversation + * @param parentElement + * @param title + * @param style + */ + public TaxonomicScopeSection(CdmFormFactory formFactory, + ConversationHolder conversation, ICdmFormElement parentElement, + int style) { + super(formFactory, conversation, parentElement, "Taxonomic Scope", + style); + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection# + * getCollection(java.lang.Object) + */ + @Override + public Collection getCollection(PolytomousKey entity) { + return entity.getTaxonomicScope(); + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection# + * createNewElement() + */ + @Override + public Taxon createNewElement() { + Taxon selection = TaxonBaseSelectionDialog.selectTaxon(getShell(), + getConversationHolder()); + + return selection; + } + + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement + * (java.lang.Object) + */ + @Override + public void addElement(Taxon element) { + getEntity().addTaxonomicScope(element); + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection# + * removeElement(java.lang.Object) + */ + @Override + public void removeElement(Taxon element) { + getEntity().removeTaxonomicScope(element); + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection# + * getEmptyString() + */ + @Override + public String getEmptyString() { + return "No taxonomic scope yet."; + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection# + * getTooltipString() + */ + @Override + protected String getTooltipString() { + return "Add a taxon to the scope of this key"; + } + +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/NamedAreaDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/NamedAreaDetailElement.java index 1310c32f1..6af90afd8 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/NamedAreaDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/NamedAreaDetailElement.java @@ -1,12 +1,12 @@ // $Id$ /** -* Copyright (C) 2007 EDIT -* 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. -*/ + * Copyright (C) 2007 EDIT + * 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.ui.section.occurrence; @@ -20,8 +20,10 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement; import eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement; /** - *

CollectingAreasDetailElement class.

- * + *

+ * CollectingAreasDetailElement class. + *

+ * * @author n.hoffmann * @created Oct 14, 2010 * @version 1.0 @@ -30,15 +32,24 @@ public class NamedAreaDetailElement extends AbstractEntityCollectionElement { private NamedAreaSelectionElement selection_namedArea; - + /** - *

Constructor for CollectingAreasDetailElement.

- * - * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object. - * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object. - * @param entity a {@link eu.etaxonomy.cdm.model.location.NamedArea} object. - * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object. - * @param style a int. + *

+ * Constructor for CollectingAreasDetailElement. + *

+ * + * @param formFactory + * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} + * object. + * @param section + * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} + * object. + * @param entity + * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object. + * @param removeListener + * a {@link org.eclipse.swt.events.SelectionListener} object. + * @param style + * a int. */ public NamedAreaDetailElement(CdmFormFactory formFactory, AbstractFormSection section, NamedArea entity, @@ -46,8 +57,12 @@ public class NamedAreaDetailElement extends super(formFactory, section, entity, removeListener, null, style); } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity(java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity + * (java.lang.Object) */ /** {@inheritDoc} */ @Override @@ -55,22 +70,31 @@ public class NamedAreaDetailElement extends selection_namedArea.setEntity(entity); } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int) + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls + * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int) */ /** {@inheritDoc} */ @Override public void createControls(ICdmFormElement element, int style) { - selection_namedArea = formFactory.createNamedAreaSelectionElement(element, getConversationHolder(), "Area", null, style); + selection_namedArea = formFactory.createNamedAreaSelectionElement( + element, getConversationHolder(), "Area", null, style); } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent + * (java.lang.Object) */ /** {@inheritDoc} */ @Override public void handleEvent(Object eventSource) { - if(eventSource == selection_namedArea){ + if (eventSource == selection_namedArea) { setEntity(selection_namedArea.getSelection()); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonDetailElement.java new file mode 100644 index 000000000..bf78a7835 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonDetailElement.java @@ -0,0 +1,85 @@ +// $Id$ +/** + * Copyright (C) 2007 EDIT + * 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.ui.section.taxon; + +import org.eclipse.swt.events.SelectionListener; + +import eu.etaxonomy.cdm.model.taxon.Taxon; +import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection; +import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory; +import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType; +import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement; +import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement; + +/** + * @author n.hoffmann + * @created Mar 29, 2011 + * @version 1.0 + */ +public class TaxonDetailElement extends AbstractEntityCollectionElement { + + private TaxonSelectionElement selection_taxon; + + /** + * @param formFactory + * @param section + * @param entity + * @param removeListener + * @param backgroundColor + * @param style + */ + public TaxonDetailElement(CdmFormFactory formFactory, + AbstractFormSection section, Taxon entity, + SelectionListener removeListener, int style) { + super(formFactory, section, entity, removeListener, null, style); + } + + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity + * (java.lang.Object) + */ + @Override + public void setEntity(Taxon entity) { + selection_taxon.setEntity(entity); + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement# + * createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int) + */ + @Override + public void createControls(ICdmFormElement element, int style) { + selection_taxon = (TaxonSelectionElement) formFactory + .createSelectionElement(SelectionType.TAXON, + getConversationHolder(), element, "Taxon", null, style); + } + + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent + * (java.lang.Object) + */ + @Override + public void handleEvent(Object eventSource) { + if (eventSource == selection_taxon) { + setEntity(selection_taxon.getSelection()); + } + } + +} 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 73835c646..2374dc377 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 @@ -1,12 +1,12 @@ // $Id$ /** -* Copyright (C) 2007 EDIT -* 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. -*/ + * Copyright (C) 2007 EDIT + * 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.detail; @@ -58,6 +58,7 @@ 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.HybridDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection; @@ -78,186 +79,186 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer; import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; /** - *

DetailsViewer class.

- * + *

+ * DetailsViewer class. + *

+ * * @author n.hoffmann * @created Feb 12, 2010 * @version 1.0 */ public class DetailsViewer extends AbstractCdmDataViewer { - private enum VIEW_PART{ - TAXON, - NAME, - REFEERENCE, - TEAM, - PERSON, - DESCRIPTION, - DESCRIPTION_ELEMENT, - EMPTY, - IMAGE_GALLERY, - MEDIA, - TEAM_OR_PERSON_BASE, - DERIVED_UNIT, - FEATURE_DISTRIBUTION, - POLYTOMOUS_KEY, - POLYTOMOUS_KEY_NODE, - USER, - GROUP + private enum VIEW_PART { + TAXON, NAME, REFEERENCE, TEAM, PERSON, DESCRIPTION, DESCRIPTION_ELEMENT, EMPTY, IMAGE_GALLERY, MEDIA, TEAM_OR_PERSON_BASE, DERIVED_UNIT, FEATURE_DISTRIBUTION, POLYTOMOUS_KEY, POLYTOMOUS_KEY_NODE, USER, GROUP } - + private VIEW_PART currentViewPart; private ISelection selection; - + /** - *

Constructor for DetailsViewer.

- * - * @param parent a {@link org.eclipse.swt.widgets.Composite} object. - * @param viewPart a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart} object. + *

+ * Constructor for DetailsViewer. + *

+ * + * @param parent + * a {@link org.eclipse.swt.widgets.Composite} object. + * @param viewPart + * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart} + * object. */ public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) { super(parent, viewPart); } - + // START HACK TO MAKE THE DERIVED UNIT FACADE WORKING - // since we are getting implementations of DerivedUnitBase from the bulk editor - // and not derived unit base objects, - - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java.lang.Object) + // since we are getting implementations of DerivedUnitBase from the bulk + // editor + // and not derived unit base objects, + + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java + * .lang.Object) */ @Override public void setInput(Object input) { - if(input instanceof DerivedUnitBase){ + 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); } } super.setInput(input); } - + @Override - protected void markViewPartDirty(){ - if(getInput() instanceof DerivedUnitFacade){ - getViewPart().changed(((DerivedUnitFacade) getInput()).innerDerivedUnit()); + protected void markViewPartDirty() { + if (getInput() instanceof DerivedUnitFacade) { + getViewPart().changed( + ((DerivedUnitFacade) getInput()).innerDerivedUnit()); } - + super.markViewPartDirty(); } - + // END HACK TO MAKE THE DERIVED UNIT FACADE WORKING - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jface.viewers.Viewer#refresh() */ /** {@inheritDoc} */ @Override - protected void showParts() { - if(getInput() instanceof TaxonBase){ - if(currentViewPart != VIEW_PART.TAXON){ + protected void showParts() { + if (getInput() instanceof TaxonBase) { + if (currentViewPart != VIEW_PART.TAXON) { createTaxonSections(rootElement); currentViewPart = VIEW_PART.TAXON; - + // preserve a pointer to the AbstractNameComposite -// MultiPageTaxonEditor editor = EditorUtil.getActiveMultiPageTaxonEditor(); -// if(editor != null){ -// TaxonNameEditor page = (TaxonNameEditor) editor.getPage(Page.NAME); -// for(AbstractGroupedContainer container : page.getGroupedContainers()){ -// if(container.getData() == getInput()){ -// sourceContainer = container; -// } -// } -// } - } - }else if(getInput() instanceof NonViralName){ - if(currentViewPart != VIEW_PART.NAME){ + // MultiPageTaxonEditor editor = + // EditorUtil.getActiveMultiPageTaxonEditor(); + // if(editor != null){ + // TaxonNameEditor page = (TaxonNameEditor) + // editor.getPage(Page.NAME); + // for(AbstractGroupedContainer container : + // page.getGroupedContainers()){ + // if(container.getData() == getInput()){ + // sourceContainer = container; + // } + // } + // } + } + } else if (getInput() instanceof NonViralName) { + if (currentViewPart != VIEW_PART.NAME) { createNameSections(rootElement); currentViewPart = VIEW_PART.NAME; } - }else if(getInput() instanceof Reference){ - if(currentViewPart != VIEW_PART.REFEERENCE){ + } else if (getInput() instanceof Reference) { + if (currentViewPart != VIEW_PART.REFEERENCE) { createReferenceSections(rootElement); currentViewPart = VIEW_PART.REFEERENCE; } - }else if(getInput() instanceof Team){ - if(currentViewPart != VIEW_PART.TEAM){ + } else if (getInput() instanceof Team) { + if (currentViewPart != VIEW_PART.TEAM) { createTeamDetailSection(rootElement); currentViewPart = VIEW_PART.TEAM; } - }else if(getInput() instanceof Person){ - if(currentViewPart != VIEW_PART.PERSON){ + } else if (getInput() instanceof Person) { + if (currentViewPart != VIEW_PART.PERSON) { createPersonDetailSection(rootElement); currentViewPart = VIEW_PART.PERSON; } - }else if(getInput() instanceof TeamOrPersonBase){ + } else if (getInput() instanceof TeamOrPersonBase) { // fallback - if(currentViewPart != VIEW_PART.TEAM_OR_PERSON_BASE){ + if (currentViewPart != VIEW_PART.TEAM_OR_PERSON_BASE) { createTeamOrPersonBaseDetailSection(rootElement); currentViewPart = VIEW_PART.TEAM_OR_PERSON_BASE; } - }else if(getInput() instanceof DescriptionBase){ - if(((DescriptionBase) getInput()).isImageGallery()){ - if(currentViewPart != VIEW_PART.IMAGE_GALLERY){ + } else if (getInput() instanceof DescriptionBase) { + if (((DescriptionBase) getInput()).isImageGallery()) { + if (currentViewPart != VIEW_PART.IMAGE_GALLERY) { createImageGallerySection(rootElement); currentViewPart = VIEW_PART.IMAGE_GALLERY; } - }else{ - if(currentViewPart != VIEW_PART.DESCRIPTION){ + } else { + if (currentViewPart != VIEW_PART.DESCRIPTION) { createDescriptionSection(rootElement); currentViewPart = VIEW_PART.DESCRIPTION; } } - }else if(getInput() instanceof DescriptionElementBase){ - if(currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT){ + } else if (getInput() instanceof DescriptionElementBase) { + if (currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT) { createDescriptionElementSection(rootElement); currentViewPart = VIEW_PART.DESCRIPTION_ELEMENT; } - }else if(getInput() instanceof Media){ - if(currentViewPart != VIEW_PART.MEDIA){ + } else if (getInput() instanceof Media) { + if (currentViewPart != VIEW_PART.MEDIA) { createMediaElementSection(rootElement); currentViewPart = VIEW_PART.MEDIA; } - }else if(getInput() instanceof DerivedUnitFacade){ - if(currentViewPart != VIEW_PART.DERIVED_UNIT){ + } else if (getInput() instanceof DerivedUnitFacade) { + if (currentViewPart != VIEW_PART.DERIVED_UNIT) { createDerivedUnitBaseElementSection(rootElement); currentViewPart = VIEW_PART.DERIVED_UNIT; - } - }else if(getInput() instanceof FeatureNodeContainer) { - if(currentViewPart != VIEW_PART.FEATURE_DISTRIBUTION){ + } + } else if (getInput() instanceof FeatureNodeContainer) { + if (currentViewPart != VIEW_PART.FEATURE_DISTRIBUTION) { createFeatureDistributionSection(rootElement); currentViewPart = VIEW_PART.FEATURE_DISTRIBUTION; } - }else if(getInput() instanceof PolytomousKey) { - if(currentViewPart != VIEW_PART.POLYTOMOUS_KEY){ + } else if (getInput() instanceof PolytomousKey) { + if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY) { createPolytomousKeySection(rootElement); currentViewPart = VIEW_PART.POLYTOMOUS_KEY; } - }else if(getInput() instanceof PolytomousKeyNode) { - if(currentViewPart != VIEW_PART.POLYTOMOUS_KEY_NODE){ + } else if (getInput() instanceof PolytomousKeyNode) { + if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY_NODE) { createPolytomousKeyNodeSection(rootElement); currentViewPart = VIEW_PART.POLYTOMOUS_KEY_NODE; } - } - else if(getInput() instanceof User){ - if(currentViewPart != VIEW_PART.USER){ + } else if (getInput() instanceof User) { + if (currentViewPart != VIEW_PART.USER) { createUserSection(rootElement); currentViewPart = VIEW_PART.USER; } - } - else if(getInput() instanceof Group){ - if(currentViewPart != VIEW_PART.GROUP){ + } else if (getInput() instanceof Group) { + if (currentViewPart != VIEW_PART.GROUP) { createGroupSection(rootElement); currentViewPart = VIEW_PART.GROUP; } - } - else{ + } else { destroySections(); currentViewPart = VIEW_PART.EMPTY; } - + layout(); } @@ -266,20 +267,28 @@ public class DetailsViewer extends AbstractCdmDataViewer { */ private void createGroupSection(RootElement parent) { destroySections(); - - GroupDetailSection groupDetailSection = (GroupDetailSection) - formFactory.createCdmDetailSection(DetailType.GROUP, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - MemberDetailSection memberDetailSection = (MemberDetailSection) - formFactory.createEntityDetailSection(EntityDetailType.MEMBER, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED); - GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) - formFactory.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED); - + + GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory + .createCdmDetailSection(DetailType.GROUP, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory + .createEntityDetailSection(EntityDetailType.MEMBER, + getConversationHolder(), parent, Section.TWISTIE + | Section.EXPANDED); + GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory + .createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY, + getConversationHolder(), parent, Section.TWISTIE + | Section.EXPANDED); + addPart(groupDetailSection); addPart(memberDetailSection); addPart(grantedAuthorityDetailSection); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jface.viewers.Viewer#getSelection() */ /** {@inheritDoc} */ @@ -287,175 +296,210 @@ public class DetailsViewer extends AbstractCdmDataViewer { public ISelection getSelection() { return selection; } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers.ISelection, boolean) + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers + * .ISelection, boolean) */ /** {@inheritDoc} */ @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); } - - + private void createTaxonSections(RootElement parent) { destroySections(); - - TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) - formFactory.createCdmDetailSection(DetailType.TAXONBASE, getConversationHolder(), parent, this, Section.TWISTIE); - + + TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory + .createCdmDetailSection(DetailType.TAXONBASE, + getConversationHolder(), parent, this, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) - formFactory.createCdmDetailSection(DetailType.NONVIRALNAME, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + + NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory + .createCdmDetailSection(DetailType.NONVIRALNAME, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) - formFactory.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, getConversationHolder(), parent, this, Section.TWISTIE); - + + NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory + .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, + getConversationHolder(), parent, this, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) - formFactory.createEntityDetailSection(EntityDetailType.NOMENCLATURALSTATUS, getConversationHolder(), parent, Section.TWISTIE); - + + NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory + .createEntityDetailSection( + EntityDetailType.NOMENCLATURALSTATUS, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ProtologueSection protologSection = (ProtologueSection) - formFactory.createEntityDetailSection(EntityDetailType.PROTOLOG, getConversationHolder(), parent, Section.TWISTIE); - + + ProtologueSection protologSection = (ProtologueSection) formFactory + .createEntityDetailSection(EntityDetailType.PROTOLOG, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - TypeDesignationSection typeDesignationSection = (TypeDesignationSection) - formFactory.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, getConversationHolder(), parent, Section.TWISTIE); - + + TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory + .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) - formFactory.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, getConversationHolder(), parent, Section.TWISTIE); - + + NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory + .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - HybridDetailSection hybridDetailSection = (HybridDetailSection) - formFactory.createCdmDetailSection(DetailType.HYBRID, getConversationHolder(), parent, this, Section.TWISTIE); - + + HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory + .createCdmDetailSection(DetailType.HYBRID, + getConversationHolder(), parent, this, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) - formFactory.createCdmDetailSection(DetailType.PARSINGMESSAGE, getConversationHolder(), parent, this, Section.EXPANDED); - - - - addPart(taxonBaseDetailSection); - addPart(nonViralNameSection); + + ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory + .createCdmDetailSection(DetailType.PARSINGMESSAGE, + getConversationHolder(), parent, this, Section.EXPANDED); + + addPart(taxonBaseDetailSection); + addPart(nonViralNameSection); addPart(nomenclaturalStatusSection); - addPart(protologSection); + addPart(protologSection); addPart(referenceDetailSection); addPart(typeDesignationSection); addPart(nameRelationshipSection); addPart(hybridDetailSection); addPart(parsingMessagesSection); } - + private void createNameSections(RootElement parent) { destroySections(); - NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) - formFactory.createCdmDetailSection(DetailType.NONVIRALNAME, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory + .createCdmDetailSection(DetailType.NONVIRALNAME, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) - formFactory.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, getConversationHolder(), parent, this, Section.TWISTIE); - + + NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory + .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, + getConversationHolder(), parent, this, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) - formFactory.createEntityDetailSection(EntityDetailType.NOMENCLATURALSTATUS, getConversationHolder(), parent, Section.TWISTIE); - + + NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory + .createEntityDetailSection( + EntityDetailType.NOMENCLATURALSTATUS, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ProtologueSection protologSection = (ProtologueSection) - formFactory.createEntityDetailSection(EntityDetailType.PROTOLOG, getConversationHolder(), parent, Section.TWISTIE); - + + ProtologueSection protologSection = (ProtologueSection) formFactory + .createEntityDetailSection(EntityDetailType.PROTOLOG, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - TypeDesignationSection typeDesignationSection = (TypeDesignationSection) - formFactory.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, getConversationHolder(), parent, Section.TWISTIE); - + + TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory + .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) - formFactory.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, getConversationHolder(), parent, Section.TWISTIE); - + + NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory + .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - HybridDetailSection hybridDetailSection = (HybridDetailSection) - formFactory.createCdmDetailSection(DetailType.HYBRID, getConversationHolder(), parent, this, Section.TWISTIE); - + + HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory + .createCdmDetailSection(DetailType.HYBRID, + getConversationHolder(), parent, this, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - addPart(nonViralNameSection); + + addPart(nonViralNameSection); addPart(nomenclaturalStatusSection); - addPart(protologSection); + addPart(protologSection); addPart(referenceDetailSection); addPart(typeDesignationSection); addPart(nameRelationshipSection); addPart(hybridDetailSection); } - + private void createReferenceSections(RootElement parent) { destroySections(); - - ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) - formFactory.createCdmDetailSection(DetailType.REFERENCEBASE, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + + ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory + .createCdmDetailSection(DetailType.REFERENCEBASE, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + addPart(referenceDetailSection); } - + private void createTeamOrPersonBaseDetailSection(RootElement parent) { destroySections(); - TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) - formFactory.createCdmDetailSection(DetailType.TEAMORPERSONBASE, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory + .createCdmDetailSection(DetailType.TEAMORPERSONBASE, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + addPart(teamOrPersonBaseDetailSection); } - - private void createTeamDetailSection(RootElement parent){ + + private void createTeamDetailSection(RootElement parent) { destroySections(); - TeamDetailSection teamDetailSection = (TeamDetailSection) - formFactory.createCdmDetailSection(DetailType.TEAM, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory + .createCdmDetailSection(DetailType.TEAM, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + addPart(teamDetailSection); } - private void createPersonDetailSection(RootElement parent) { destroySections(); - PersonDetailSection personDetailSection = (PersonDetailSection) - formFactory.createCdmDetailSection(DetailType.PERSON, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); + PersonDetailSection personDetailSection = (PersonDetailSection) formFactory + .createCdmDetailSection(DetailType.PERSON, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); addPart(personDetailSection); } - + private void createDescriptionElementSection(RootElement parent) { destroySections(); - - DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) - formFactory.createCdmDetailSection(DetailType.DESCRIPTIONELEMENT, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); + + DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory + .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) - formFactory.createEntityDetailSection(EntityDetailType.DESCRIPTIONELEMENTSOURCE, getConversationHolder(), parent, Section.TWISTIE); - + + DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory + .createEntityDetailSection( + EntityDetailType.DESCRIPTIONELEMENTSOURCE, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) - formFactory.createEntityDetailSection(EntityDetailType.DESCRIPTIONELEMENTMEDIA, getConversationHolder(), parent, Section.TWISTIE); - + + DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory + .createEntityDetailSection( + EntityDetailType.DESCRIPTIONELEMENTMEDIA, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - + addPart(descriptionElementDetailSection); addPart(descriptionElementSourceSection); addPart(descriptionElementMediaSection); @@ -463,139 +507,170 @@ public class DetailsViewer extends AbstractCdmDataViewer { private void createDescriptionSection(RootElement parent) { destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) - formFactory.createCdmDetailSection(DetailType.DESCRIPTION, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory + .createCdmDetailSection(DetailType.DESCRIPTION, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) - formFactory.createCdmDetailSection(DetailType.NATURAL_LANGUAGE, getConversationHolder(), parent, this,Section.TWISTIE | Section.EXPANDED); - + + NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory + .createCdmDetailSection(DetailType.NATURAL_LANGUAGE, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) - formFactory.createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN, getConversationHolder(), parent, Section.TWISTIE); - + + DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory + .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) - formFactory.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, getConversationHolder(), parent, Section.TWISTIE); - + + DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory + .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ScopeSection scopeSection = (ScopeSection) - formFactory.createEntityDetailSection(EntityDetailType.SCOPE, getConversationHolder(), parent, Section.TWISTIE); - + + ScopeSection scopeSection = (ScopeSection) formFactory + .createEntityDetailSection(EntityDetailType.SCOPE, + getConversationHolder(), parent, Section.TWISTIE); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); - + addPart(descriptionDetailSection); addPart(naturalLanguageSection); addPart(describedSpecimenSection); addPart(descriptionSourceSection); addPart(scopeSection); } - /** * @param rootElement */ private void createImageGallerySection(RootElement parent) { destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) - formFactory.createCdmDetailSection(DetailType.DESCRIPTION, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - - addPart(descriptionDetailSection); + DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory + .createCdmDetailSection(DetailType.DESCRIPTION, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + + addPart(descriptionDetailSection); } - private void createMediaElementSection(RootElement parent) { destroySections(); - MediaDetailsSection mediaDetailSection = (MediaDetailsSection) - formFactory.createCdmDetailSection(DetailType.MEDIA, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory + .createCdmDetailSection(DetailType.MEDIA, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + addPart(mediaDetailSection); } - - private void createDerivedUnitBaseElementSection(RootElement parent){ + + private void createDerivedUnitBaseElementSection(RootElement parent) { destroySections(); - - GeneralDetailSection generalDetailSection = (GeneralDetailSection) - formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + + GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory + .createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + 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, Section.TWISTIE); + 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, Section.TWISTIE); + 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, Section.TWISTIE); + addPart(generalDetailSection); addPart(gatheringEventDetailSection); addPart(fieldObservationDetailSection); addPart(derivedUnitBaseDetailSection); } - + /** * @param rootElement */ private void createFeatureDistributionSection(RootElement parent) { destroySections(); - - FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) - formFactory.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + + FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory + .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + addPart(featureDistributionSection); } - - private void createPolytomousKeySection(RootElement parent) { destroySections(); - - PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) - formFactory.createCdmDetailSection(DetailType.POLYTOMOUS_KEY, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); + + 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); - + + 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); - + + 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); } private void createPolytomousKeyNodeSection(RootElement parent) { destroySections(); - - PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) - formFactory.createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - + + PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory + .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + addPart(polytomousKeyNodeDetailSection); } - + private void createUserSection(RootElement parent) { destroySections(); - - UserDetailSection userDetailSection = (UserDetailSection) - formFactory.createCdmDetailSection(DetailType.USER, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED); - - GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) - formFactory.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED); - + + UserDetailSection userDetailSection = (UserDetailSection) formFactory + .createCdmDetailSection(DetailType.USER, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + + GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory + .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, + getConversationHolder(), parent, Section.TWISTIE + | Section.EXPANDED); + addPart(userDetailSection); addPart(groupByUserDetailSection); } -- 2.34.1