From: Patric Plitzner Date: Mon, 12 Aug 2013 13:02:42 +0000 (+0000) Subject: merged trunk into branch X-Git-Tag: 3.6.0~960^2~5 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/b0ce5b17b712e4e9091569026109fbe972c49e38 merged trunk into branch --- diff --git a/.gitattributes b/.gitattributes index b9d3beb96..f736df09c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -148,22 +148,6 @@ eu.etaxonomy.taxeditor.cdmlib/lib/batik-transcoder-1.7.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/batik-util-1.7.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/batik-xml-1.7.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/c3p0-0.9.2.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-commons-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-tests.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT-sources.jar -text -eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/cglib-nodep-2.2.2.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/com.springsource.org.aopalliance-1.0.0.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/com.springsource.org.apache.commons.logging-1.1.1.jar -text @@ -211,6 +195,7 @@ eu.etaxonomy.taxeditor.cdmlib/lib/hsqldb-1.8.0.10.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/httpclient-4.2.3.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/httpcore-4.2.4.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/icu4j-2.6.1.jar -text +eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/itextpdf-5.4.0.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/jackson-core-asl-1.8.8.jar -text @@ -256,6 +241,8 @@ eu.etaxonomy.taxeditor.cdmlib/lib/odfdom-0.8.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/odfdom-java-0.8.7.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/ognl-2.6.9.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/opencsv-2.3.jar -text +eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar -text +eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/org.osgi.core-1.0.0.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/org.springframework.aop-3.2.2.RELEASE.jar -text eu.etaxonomy.taxeditor.cdmlib/lib/org.springframework.aspects-3.2.2.RELEASE.jar -text @@ -1298,6 +1285,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/Roo eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/SelectionArbitrator.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextActionElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java -text +eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement2.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TimePeriodElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java -text @@ -1341,8 +1329,8 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/cla eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailSection.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java -text +eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferenceEntityDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferencedEntityDetailSection.java -text -eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/RefereneEntityDetailElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DerivedUnitElement.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescribedSpecimenSection.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java -text diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-commons-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-commons-3.2.0-SNAPSHOT.jar deleted file mode 100644 index 99c6fb152..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-commons-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index 2e8747c30..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT.jar deleted file mode 100644 index c63585174..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index 0f0454892..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT.jar deleted file mode 100644 index 0dd1865e1..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index c3171e8a7..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT.jar deleted file mode 100644 index a55b4fcb9..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index a1bd69068..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-tests.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-tests.jar deleted file mode 100644 index b621f4d48..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-tests.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT.jar deleted file mode 100644 index 9922c6c38..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index 49a497473..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT.jar deleted file mode 100644 index a8a30c3e7..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index 768828c54..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT.jar deleted file mode 100644 index 7d804d9a3..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT-sources.jar deleted file mode 100644 index cad99d74e..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT-sources.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT.jar deleted file mode 100644 index 28bfcaed9..000000000 Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT.jar and /dev/null differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar new file mode 100755 index 000000000..2ec64a81a Binary files /dev/null and b/eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar new file mode 100644 index 000000000..4cf488ee3 Binary files /dev/null and b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar differ diff --git a/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar new file mode 100644 index 000000000..f131a431c Binary files /dev/null and b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar differ diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java index 669c354dc..207b5d2f0 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -32,6 +32,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.DataChangeBridge; import eu.etaxonomy.taxeditor.model.IDataChangeBehavior; import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; @@ -39,10 +40,10 @@ import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; /** - * + * * Generates the tabbed editor with TaxonNameEditor on top and tabs * for "Descriptions", "Concepts", "Geography", etc. - * + * * @author p.ciardelli * @author n.hoffmann * @created 15.05.2008 @@ -83,7 +84,7 @@ public class MultiPageTaxonEditor extends FormEditor implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.editor.FormEditor#addPages() */ /** {@inheritDoc} */ @@ -107,7 +108,7 @@ public class MultiPageTaxonEditor extends FormEditor implements // EditorUtil.showPropertySheet(); } catch (PartInitException e) { - EditorUtil.error(getClass(), e); + AbstractUtility.error(getClass(), e); } } @@ -121,41 +122,34 @@ public class MultiPageTaxonEditor extends FormEditor implements } monitor.worked(1); - for (IEditorPart editorPage : getPages()) { - if (editorPage instanceof TaxonNameEditor) { - if (((TaxonNameEditor) editorPage).checkForEmptyNames()) { - MessageDialog - .openWarning( - EditorUtil.getShell(), - "No Name Specified", - "An attempt was made to save a taxon or synonym with " - + "an empty name. Operation was cancelled."); - return; - } - } - - editorPage.doSave(monitor); - monitor.worked(1); - } + for (IEditorPart editorPage : getPages()) { + if (editorPage instanceof TaxonNameEditor) { + if (((TaxonNameEditor) editorPage).checkForEmptyNames()) { + MessageDialog.openWarning(AbstractUtility.getShell(), "No Name Specified", + "An attempt was made to save a taxon or synonym with " + + "an empty name. Operation was cancelled."); + return; + } + } + + editorPage.doSave(monitor); + monitor.worked(1); + } // commit the conversation and start a new transaction immediately conversation.commit(true); monitor.worked(1); - this.setDirty(false); - monitor.worked(1); - } catch (Exception e) { - setFocus(); - EditorUtil - .errorDialog( - "An error occurred while saving", - getClass(), - "An error occurred while saving the editor. Please close and reopen the taxon again.", - e); - disableEditor(true); - } finally { - monitor.done(); - } + this.setDirty(false); + monitor.worked(1); + } catch (Exception e) { + setFocus(); + AbstractUtility.errorDialog("An error occurred while saving", getClass(), + "An error occurred while saving the editor. Please close and reopen the taxon again.", e); + disableEditor(true); + } finally { + monitor.done(); + } } private void disableEditor(boolean isOnError) { @@ -163,7 +157,7 @@ public class MultiPageTaxonEditor extends FormEditor implements if(isOnError){ editorPage.setOnError(); }else { - editorPage.setDisabled(); + editorPage.setDisabled(); } } conversation.unregisterForDataStoreChanges(this); @@ -178,23 +172,24 @@ public class MultiPageTaxonEditor extends FormEditor implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.part.MultiPageEditorPart#isDirty() */ /** *

* isDirty *

- * + * * @return a boolean. */ - public boolean isDirty() { + @Override + public boolean isDirty() { return dirty; } /* * (non-Javadoc) - * + * * @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged() */ /** {@inheritDoc} */ @@ -206,7 +201,7 @@ public class MultiPageTaxonEditor extends FormEditor implements /** * {@inheritDoc} - * + * * Checks whether nested editors are calling * firePropertyChange(PROP_DIRTY) to signal an edit has taken * place before passing property change along to @@ -214,10 +209,11 @@ public class MultiPageTaxonEditor extends FormEditor implements */ /* * (non-Javadoc) - * + * * @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int) */ - protected void handlePropertyChange(int propertyId) { + @Override + protected void handlePropertyChange(int propertyId) { if (propertyId == PROP_DIRTY) { setDirty(true); } @@ -240,9 +236,10 @@ public class MultiPageTaxonEditor extends FormEditor implements public void init(IEditorSite site, IEditorInput input) throws PartInitException { - if (!(input instanceof TaxonEditorInput)) - throw new PartInitException( + if (!(input instanceof TaxonEditorInput)) { + throw new PartInitException( "Invalid Input: Must be TaxonEditorInput"); + } this.input = (TaxonEditorInput) input; @@ -289,29 +286,29 @@ public class MultiPageTaxonEditor extends FormEditor implements setPartName(partName); } - /** - * {@inheritDoc} - * - * Editor pages call this in their postOperation to notify the - * MultiPageTaxonEditor of unsaved changes - */ - public void changed(Object element) { - // setDirty(true); - dirty = true; - super.editorDirtyStateChanged(); - if (element instanceof TaxonBase) { - TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME); - AbstractGroupedContainer container = page - .getContainer((TaxonBase) element); - if (container != null) { - container.refresh(); - } - } - } + /** + * {@inheritDoc} + * + * Editor pages call this in their postOperation to notify the + * MultiPageTaxonEditor of unsaved changes + */ + @Override + public void changed(Object element) { + // setDirty(true); + dirty = true; + super.editorDirtyStateChanged(); + if (element instanceof TaxonBase) { + TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME); + AbstractGroupedContainer container = page.getContainer((TaxonBase) element); + if (container != null) { + container.refresh(); + } + } + } /** * The accepted taxon that is the input for this editor - * + * * @return the accepted taxon */ public Taxon getTaxon() { @@ -320,7 +317,7 @@ public class MultiPageTaxonEditor extends FormEditor implements /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder * () @@ -329,11 +326,12 @@ public class MultiPageTaxonEditor extends FormEditor implements *

* getConversationHolder *

- * + * * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} * object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { return conversation; } @@ -341,7 +339,7 @@ public class MultiPageTaxonEditor extends FormEditor implements *

* setConversationHolder *

- * + * * @param conversation * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} * object. @@ -354,7 +352,7 @@ public class MultiPageTaxonEditor extends FormEditor implements *

* Getter for the field undoContext. *

- * + * * @return a {@link org.eclipse.core.commands.operations.IUndoContext} * object. */ @@ -366,7 +364,7 @@ public class MultiPageTaxonEditor extends FormEditor implements *

* Setter for the field undoContext. *

- * + * * @param undoContext * a {@link org.eclipse.core.commands.operations.IUndoContext} * object. @@ -385,53 +383,50 @@ public class MultiPageTaxonEditor extends FormEditor implements getActiveEditor().setFocus(); } - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu - * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) - */ - /** {@inheritDoc} */ - public void update(CdmDataChangeMap events) { - if (dataChangeBehavior == null) { - dataChangeBehavior = new MultiPageTaxonEditorDataChangeBehaviour( - this); - } - - DataChangeBridge.handleDataChange(events, dataChangeBehavior); - } - - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation - * () - */ - /** {@inheritDoc} */ - public boolean postOperation(CdmBase objectAffectedByOperation) { - setDirty(true); - - for (IEditorPart editor : this.getPages()) { - if (editor instanceof IPostOperationEnabled) { - ((IPostOperationEnabled) editor) - .postOperation(objectAffectedByOperation); - } else { - EditorUtil.warn(getClass(), - "postOperation not enabled for editor " + editor); - } - } - EditorUtil - .warn(getClass(), - "postOperation called on MultiPageTaxonEditor. Can you make it more specific?"); - - return false; - } + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu + * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) + */ + /** {@inheritDoc} */ + @Override + public void update(CdmDataChangeMap events) { + if (dataChangeBehavior == null) { + dataChangeBehavior = new MultiPageTaxonEditorDataChangeBehaviour(this); + } + + DataChangeBridge.handleDataChange(events, dataChangeBehavior); + } + + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation + * () + */ + /** {@inheritDoc} */ + @Override + public boolean postOperation(CdmBase objectAffectedByOperation) { + setDirty(true); + + for (IEditorPart editor : this.getPages()) { + if (editor instanceof IPostOperationEnabled) { + ((IPostOperationEnabled) editor).postOperation(objectAffectedByOperation); + } else { + AbstractUtility.warn(getClass(), "postOperation not enabled for editor " + editor); + } + } + AbstractUtility.warn(getClass(), "postOperation called on MultiPageTaxonEditor. Can you make it more specific?"); + + return false; + } /** * Returns an IEditorPart implementation by type - * + * * @param page * the page type * @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage} @@ -449,7 +444,7 @@ public class MultiPageTaxonEditor extends FormEditor implements /** * Return a list of AbstractTaxonEditors registered with this * MultiPageTaxonEditor. - * + * * @return a {@link java.util.List} object. */ public List getPages() { @@ -463,7 +458,7 @@ public class MultiPageTaxonEditor extends FormEditor implements /** * Refreshes a certain page of the MultipageTaxonEditor - * + * * @param page * a {@link eu.etaxonomy.taxeditor.editor.Page} object. * @return a boolean. @@ -475,7 +470,7 @@ public class MultiPageTaxonEditor extends FormEditor implements /** * Refreshes a certain page of the MultipageTaxonEditor and sets focus to * that page - * + * * @param page * a {@link eu.etaxonomy.taxeditor.editor.Page} object. * @param focus @@ -491,46 +486,42 @@ public class MultiPageTaxonEditor extends FormEditor implements *

* onComplete *

- * + * * @return a boolean. */ - public boolean onComplete() { + @Override + public boolean onComplete() { return false; } - /** - * Reloads the data for this - */ - public void reload() { - if (isDirty()) { - EditorUtil - .warningDialog( - "Editor has unsaved data", - getClass(), - "This editor can not be " - + "refreshed because it contains unsaved data. Refreshing " - + "this editor would discard the changes. Please save this editor, " - + "close and reopen it manually in order to get the latest content"); - } else { - TaxonEditorInput input = (TaxonEditorInput) getEditorInput(); - - UUID uuid = input.getTaxonNode().getUuid(); - - conversation.clear(); - - try { - TaxonEditorInput newInput = TaxonEditorInput.NewInstance(uuid); - setInput(newInput); - for (IMultiPageTaxonEditorPage editorPart : getPages()) { - editorPart.redraw(); - } - } catch (Exception e) { - EditorUtil.errorDialog("Error refreshing editor", getClass(), - "Could not refresh this editor", e); - } - } - } - + /** + * Reloads the data for this + */ + public void reload() { + if (isDirty()) { + AbstractUtility.warningDialog("Editor has unsaved data", getClass(), "This editor can not be " + + "refreshed because it contains unsaved data. Refreshing " + + "this editor would discard the changes. Please save this editor, " + + "close and reopen it manually in order to get the latest content"); + } else { + TaxonEditorInput input = (TaxonEditorInput) getEditorInput(); + + UUID uuid = input.getTaxonNode().getUuid(); + + conversation.clear(); + + try { + TaxonEditorInput newInput = TaxonEditorInput.NewInstance(uuid); + setInput(newInput); + for (IMultiPageTaxonEditorPage editorPart : getPages()) { + editorPart.redraw(); + } + } catch (Exception e) { + AbstractUtility.errorDialog("Error refreshing editor", getClass(), "Could not refresh this editor", e); + } + } + } + @Override public String toString() { return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput()); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java index 16fa9b076..403a6b25c 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2011 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -19,58 +19,56 @@ import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragList import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer; import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart; -import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; -import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; /** - * The Class create a speific Use View to keep the taxonomic view clean - * @author a.theys + * The Class create a specific Use View to keep the taxonomic view clean + * @author a.theys * @created mar 13, 2012 * @version 1.0 */ -public class UsesViewPart extends DescriptiveViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData { +public class UsesViewPart extends DescriptiveViewPart { /** Constant ID="eu.etaxonomy.taxeditor.editor.view.uses" */ public static final String ID = "eu.etaxonomy.taxeditor.editor.view.uses"; /** {@inheritDoc} */ @Override public void createViewer(Composite parent) { - + viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); viewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache)); viewer.setLabelProvider(new UsesLabelProvider()); viewer.setAutoExpandLevel(2); - - - + + + Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener( this)); viewer.addDropSupport(dndOperations, transfers, new DescriptionElementDropAdapter(viewer)); - + // Propagate selection from viewer getSite().setSelectionProvider(viewer); - - showAllElementsAction = new ToggleDescriptionAction(false); + + showAllElementsAction = new ToggleDescriptionAction(false); hideAllElementsAction = new ToggleDescriptionAction(true); - + // Add context menu to tree createMenu(); - + createToolbar(); } - + /** {@inheritDoc} */ @Override public boolean postOperation(CdmBase objectAffectedByOperation) { viewer.refresh(); return super.postOperation(objectAffectedByOperation); } - + } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java index 5925be91e..9fdb66b7a 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -37,7 +37,6 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.editor.EditorUtil; -import eu.etaxonomy.taxeditor.editor.OpenEditorConfiguration; import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; import eu.etaxonomy.taxeditor.model.AbstractUtility; @@ -53,36 +52,36 @@ import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; */ public class NavigationUtil extends AbstractUtility{ private static IUndoContext defaultUndoContext; - + /** *

executeEditHandler

*/ public static void executeEditHandler(){ String commandId = "eu.etaxonomy.taxeditor.navigation.command.editSelection"; - - IHandlerService handlerService = (IHandlerService) NavigationUtil.getService(IHandlerService.class); + + IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class); try { handlerService.executeCommand(commandId, null); } catch (ExecutionException e) { - NavigationUtil.error(NavigationUtil.class, e); + AbstractUtility.error(NavigationUtil.class, e); } catch (NotDefinedException e) { - NavigationUtil.error(NavigationUtil.class, e); + AbstractUtility.error(NavigationUtil.class, e); } catch (NotEnabledException e) { - NavigationUtil.error(NavigationUtil.class, e); + AbstractUtility.error(NavigationUtil.class, e); } catch (NotHandledException e) { - NavigationUtil.error(NavigationUtil.class, e); + AbstractUtility.error(NavigationUtil.class, e); } } - + /** *

openEditor

* * @param selectedObject a {@link eu.etaxonomy.cdm.model.common.CdmBase} object. */ public static void openEditor(ICdmBase selectedObject){ - UUID entityUuid = selectedObject.getUuid(); - try { + UUID entityUuid = selectedObject.getUuid(); + try { if(selectedObject instanceof TaxonNode){ EditorUtil.openTaxonNode(entityUuid); }else if(selectedObject instanceof TaxonBase){ @@ -96,12 +95,12 @@ public class NavigationUtil extends AbstractUtility{ warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject); } } catch (PartInitException e) { - NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e); + AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e); } catch (Exception e) { - EditorUtil.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage()); + AbstractUtility.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage()); } } - + public static void openEditor(Object selectedObject){ if (selectedObject instanceof UuidAndTitleCache){ Class type = ((UuidAndTitleCache) selectedObject).getType(); @@ -109,16 +108,16 @@ public class NavigationUtil extends AbstractUtility{ try { EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid()); } catch (PartInitException e) { - NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e); + AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e); } } }else if(selectedObject instanceof ICdmBase){ - openEditor((ICdmBase) selectedObject); + openEditor((ICdmBase) selectedObject); }else{ - NavigationUtil.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject)); + AbstractUtility.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject)); } } - + /** *

openEmpty

* @@ -128,10 +127,10 @@ public class NavigationUtil extends AbstractUtility{ try { EditorUtil.openEmpty(parentNodeUuid); } catch (PartInitException e) { - NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e); + AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e); } } - + /** *

getShell

* @@ -150,7 +149,7 @@ public class NavigationUtil extends AbstractUtility{ return TaxeditorNavigationPlugin.getDefault().getWorkbench(). getActiveWorkbenchWindow(); } - + /** *

getWorkbenchUndoContext

* @@ -169,10 +168,10 @@ public class NavigationUtil extends AbstractUtility{ public static IUndoContext getUndoContext() { // FIXME this has to be more specific. Every widget has to have its own undo context // return IOperationHistory.GLOBAL_UNDO_CONTEXT; - - // Plug-ins that wish their operations to be undoable from workbench views - // such as the Navigator or Package Explorer should assign the workbench - // undo context to their operations. + + // Plug-ins that wish their operations to be undoable from workbench views + // such as the Navigator or Package Explorer should assign the workbench + // undo context to their operations. if (defaultUndoContext == null) { defaultUndoContext = new UndoContext(); } @@ -186,9 +185,9 @@ public class NavigationUtil extends AbstractUtility{ * @return a boolean. */ public static boolean isDirty(TaxonNode taxonNode){ - + for (IEditorReference reference : getActivePage().getEditorReferences()) { - + try { if (reference.getEditorInput() instanceof TaxonEditorInput) { TaxonEditorInput editorInput = (TaxonEditorInput) reference.getEditorInput(); @@ -197,10 +196,10 @@ public class NavigationUtil extends AbstractUtility{ } } } catch (PartInitException e) { - NavigationUtil.error(NavigationUtil.class, e.getMessage(), e); + AbstractUtility.error(NavigationUtil.class, e.getMessage(), e); throw new RuntimeException(e); } - + } return false; } @@ -214,7 +213,8 @@ public class NavigationUtil extends AbstractUtility{ public static void selectInNavigator(final Object element, final Object parentElement) { Display.getDefault().asyncExec(new Runnable(){ - public void run() { + @Override + public void run() { TaxonNavigator navigator = showNavigator(); if (navigator != null) { @@ -223,11 +223,11 @@ public class NavigationUtil extends AbstractUtility{ if (parentElement != null) { viewer.setExpandedState(parentElement, true); } - viewer.setSelection(new StructuredSelection((TaxonNode) element)); + viewer.setSelection(new StructuredSelection(element)); } } } - + }); } @@ -239,18 +239,18 @@ public class NavigationUtil extends AbstractUtility{ public static void openSearch(Object selection) { if(selection instanceof Taxon){ Taxon taxon = (Taxon) selection; - + handleOpeningOfMultipleTaxonNodes(taxon.getTaxonNodes()); - + }else if(selection instanceof Synonym){ Synonym synonym = (Synonym) selection; - + handleOpeningOfMultipleTaxa(synonym.getAcceptedTaxa()); - + }else{ warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment."); } - + } private static void handleOpeningOfMultipleTaxa(Set acceptedTaxa) { @@ -271,7 +271,7 @@ public class NavigationUtil extends AbstractUtility{ */ private static void handleOpeningOfMultipleTaxonNodes( Set taxonNodes) { - + if(taxonNodes.size() == 1){ openEditor(taxonNodes.iterator().next()); }else if(taxonNodes.size() > 1){ diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java index 7b9adddc4..94aeb170b 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -18,8 +18,6 @@ import java.util.Observer; import java.util.Set; import java.util.UUID; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -27,8 +25,6 @@ import org.eclipse.jface.viewers.TreePath; import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewSite; import org.eclipse.ui.PartInitException; -import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.navigator.CommonNavigator; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; @@ -45,7 +41,7 @@ import eu.etaxonomy.taxeditor.store.LoginManager; /** * Taxonomic tree implementation using Common Navigator Framework. - * + * * @author p.ciardelli * @author n.hoffmann * @created 02.06.2009 @@ -60,12 +56,6 @@ public class TaxonNavigator extends CommonNavigator implements */ public static final String ID = "eu.etaxonomy.taxeditor.navigation.navigator"; //$NON-NLS-1$ - /** - * Constant - * OPEN_COMMAND_ID="eu.etaxonomy.taxeditor.navigation.comma"{trunked} - */ - public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.navigation.command.editSelection"; - private static final String TREE_PATH = "treepath"; private static final String TREE_PATHS = "treepaths"; @@ -78,7 +68,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.navigator.CommonNavigator#getInitialInput() */ /** {@inheritDoc} */ @@ -120,7 +110,7 @@ public class TaxonNavigator extends CommonNavigator implements */ public void refresh() { if(getConversationHolder() != null){ - getConversationHolder().bind(); + getConversationHolder().bind(); } getCommonViewer().refresh(); } @@ -136,7 +126,7 @@ public class TaxonNavigator extends CommonNavigator implements *

* restore *

- * + * * @param memento * a {@link org.eclipse.ui.IMemento} object. * @param monitor @@ -203,8 +193,9 @@ public class TaxonNavigator extends CommonNavigator implements List pathList = new ArrayList(); - if (string.length() == 0) - return null; + if (string.length() == 0) { + return null; + } for (String uuid : string.split(" ")) { CdmBase cdmBaseObject = CdmStore.getService( @@ -216,8 +207,9 @@ public class TaxonNavigator extends CommonNavigator implements IClassificationService.class).load( UUID.fromString(uuid)); - if (cdmBaseObject == null) - return null; + if (cdmBaseObject == null) { + return null; + } } pathList.add(cdmBaseObject); } @@ -234,7 +226,7 @@ public class TaxonNavigator extends CommonNavigator implements *

* saveTreeState *

- * + * * @param memento * a {@link org.eclipse.ui.IMemento} object. * @param progressMonitor @@ -274,7 +266,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder * () @@ -283,7 +275,7 @@ public class TaxonNavigator extends CommonNavigator implements *

* getConversationHolder *

- * + * * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} * object. */ @@ -294,7 +286,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update * (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) @@ -320,7 +312,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.part.WorkbenchPart#dispose() */ /** {@inheritDoc} */ @@ -335,7 +327,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.navigator.CommonNavigator#setFocus() */ /** {@inheritDoc} */ @@ -350,7 +342,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation * (eu.etaxonomy.cdm.model.common.CdmBase) @@ -366,7 +358,7 @@ public class TaxonNavigator extends CommonNavigator implements *

* save *

- * + * * @param memento * a {@link org.eclipse.ui.IMemento} object. * @param monitor @@ -383,26 +375,7 @@ public class TaxonNavigator extends CommonNavigator implements /** {@inheritDoc} */ @Override protected void handleDoubleClick(DoubleClickEvent anEvent) { - - ICommandService commandService = (ICommandService) getSite() - .getService(ICommandService.class); - - Command command = commandService.getCommand(OPEN_COMMAND_ID); - if (command.isEnabled()) { - IHandlerService handlerService = (IHandlerService) getSite() - .getService(IHandlerService.class); - try { - handlerService.executeCommand(OPEN_COMMAND_ID, null); - } catch (NotDefinedException e) { - throw new RuntimeException("Could not find open command: " - + OPEN_COMMAND_ID); - } catch (Exception e) { - NavigationUtil - .error(getClass(), - "An exception occured while trying to open a selection", - e); - } - } + NavigationUtil.executeEditHandler(); // If the double click is passed up to the super-class it will // expand/collapse trees. // We do not want that @@ -413,7 +386,7 @@ public class TaxonNavigator extends CommonNavigator implements *

* onComplete *

- * + * * @return a boolean. */ @Override @@ -423,7 +396,7 @@ public class TaxonNavigator extends CommonNavigator implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean) */ /** {@inheritDoc} */ @@ -450,6 +423,6 @@ public class TaxonNavigator extends CommonNavigator implements if(o instanceof LoginManager){ refresh(); } - + } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java index 4415ee1d1..917f5f40d 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java @@ -2,9 +2,9 @@ package eu.etaxonomy.taxeditor.navigation.navigator.handler; // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -41,47 +41,49 @@ public class EditHandler extends AbstractHandler implements IHandler{ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ /** {@inheritDoc} */ - public Object execute(ExecutionEvent event) throws ExecutionException { - + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection selection = HandlerUtil.getCurrentSelection(event); - + if(selection instanceof StructuredSelection){ final StructuredSelection structuredSelection = (StructuredSelection) selection; - + if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){ Classification classification = (Classification) structuredSelection.getFirstElement(); - + NewClassificationWizard classificationWizard = new NewClassificationWizard(); classificationWizard.init(null, null); classificationWizard.setEntity(classification); WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard); dialog.open(); - + } else{ Job job = new Job("Opening editor") { - + @Override protected IStatus run(IProgressMonitor monitor) { for(final Object selectedObject : structuredSelection.toArray()){ - + Display.getDefault().asyncExec(new Runnable(){ - - public void run() { + + @Override + public void run() { NavigationUtil.openEditor(selectedObject); } - + }); } return Status.OK_STATUS; } }; - + job.schedule(); } } - + return null; } } diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java index d5984d1c5..905e4b847 100644 --- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java +++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -41,6 +41,7 @@ import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator; import eu.etaxonomy.cdm.model.common.UuidAndTitleCache; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; import eu.etaxonomy.taxeditor.model.IContextListener; import eu.etaxonomy.taxeditor.navigation.NavigationUtil; @@ -56,9 +57,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * @version 1.0 */ public class SearchResultView extends ViewPart implements IConversationEnabled{ - + private static Object[] EMPTY = new Object[0]; - + private class ContextListener extends ContextListenerAdapter{ /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor) @@ -66,12 +67,12 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ @Override public void contextStop(IMemento memento, IProgressMonitor monitor) { monitor.subTask("Getting rid of search results"); - NavigationUtil.hideView(SearchResultView.this); + AbstractUtility.hideView(SearchResultView.this); } } - + /** Constant ID="eu.etaxonomy.taxeditor.navigation.searc"{trunked} */ - public static final String ID = + public static final String ID = "eu.etaxonomy.taxeditor.navigation.search.searchResultView"; //$NON-NLS-1$ private TableViewer resultViewer; @@ -85,42 +86,43 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ private Text status; private SearchJob searchJob; - + private IContextListener contextListener; - + /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ /** {@inheritDoc} */ @Override public void createPartControl(Composite parent) { - + conversation = CdmStore.createConversation(); contextListener = new ContextListener(); CdmStore.getContextManager().addContextListener(contextListener); - + GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; - + parent.setLayout(layout); - + Composite infoComposite = createInfoComposite(parent); infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - + resultViewer = new TableViewer(parent, SWT.NONE); resultViewer.setContentProvider(new ArrayContentProvider()); resultViewer.setLabelProvider(new SearchResultLabelProvider()); resultViewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { + @Override + public void doubleClick(DoubleClickEvent event) { NavigationUtil.executeEditHandler(); } }); - + resultViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - + getSite().setSelectionProvider(resultViewer); - + // register context menu MenuManager menuMgr = new MenuManager(); menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); @@ -128,39 +130,39 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ Control control = resultViewer.getControl(); Menu menu = menuMgr.createContextMenu(control); - control.setMenu(menu); + control.setMenu(menu); } - + private Composite createInfoComposite(Composite parent){ Composite composite = new Composite(parent, SWT.NULL); - + composite.setLayout(new GridLayout(2, false)); - + Label searchStringLabel = new Label(composite, SWT.NULL); searchStringLabel.setText("Search String:"); - + searchString = new Text(composite, SWT.NULL); searchString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); searchString.setEditable(false); // searchString.setText(" "); - + Label configurationDescriptionLabel = new Label(composite, SWT.NULL); configurationDescriptionLabel.setText("Search for:"); - + configurationLabel = new Text(composite, SWT.WRAP); configurationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); configurationLabel.setEditable(false); - + Label statusLabel = new Label(composite, SWT.NULL); statusLabel.setText("Status:"); - + status = new Text(composite, SWT.NULL); status.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); status.setEditable(false); - + return composite; } - + /** *

performSearch

* @@ -168,20 +170,23 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ */ public void performSearch(IFindTaxaAndNamesConfigurator configurator){ setPartName("Search: '" + configurator.getTitleSearchString() + "'"); - + searchString.setText(configurator.getTitleSearchString()); - + List includedEntities = new ArrayList(); - if(configurator.isDoTaxa()) - includedEntities.add(SearchOption.TAXON.getLabel()); - if(configurator.isDoSynonyms()) - includedEntities.add(SearchOption.SYNONYM.getLabel()); - if(configurator.isDoNamesWithoutTaxa()) - includedEntities.add(SearchOption.NAME.getLabel()); + if(configurator.isDoTaxa()) { + includedEntities.add(SearchOption.TAXON.getLabel()); + } + if(configurator.isDoSynonyms()) { + includedEntities.add(SearchOption.SYNONYM.getLabel()); + } + if(configurator.isDoNamesWithoutTaxa()) { + includedEntities.add(SearchOption.NAME.getLabel()); + } if(configurator.isDoTaxaByCommonNames()){ includedEntities.add(SearchOption.COMMON_NAME.getLabel()); } - + String includedEntitiesString = ""; for (int i = 0; i < includedEntities.size(); i++){ includedEntitiesString += includedEntities.get(i); @@ -189,16 +194,16 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ includedEntitiesString += ", "; } } - + configurationLabel.setText(includedEntitiesString); - + status.setText("Searching..."); - + searchJob = new SearchJob(Display.getCurrent(), configurator); searchJob.schedule(); - + } - + /** *

displaySearchResult

* @@ -206,10 +211,10 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ */ protected void displaySearchResult(List> result) { if(result.size() > 0){ - resultViewer.setInput(result); + resultViewer.setInput(result); status.setText(result.size() + " entities found"); }else{ - resultViewer.setInput(EMPTY); + resultViewer.setInput(EMPTY); status.setText("Search returned no results"); } } @@ -234,7 +239,8 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ * * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { return this.conversation; } @@ -242,11 +248,12 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) */ /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) { + @Override + public void update(CdmDataChangeMap changeEvents) { // TODO Auto-generated method stub - + } - + /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#dispose() */ @@ -255,23 +262,24 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ public void dispose() { super.dispose(); conversation.close(); - if(searchJob != null) - searchJob.cancel(); + if(searchJob != null) { + searchJob.cancel(); + } CdmStore.getContextManager().removeContextListener(contextListener); } - + /** - * + * * @author n.hoffmann * @created Feb 2, 2010 * @version 1.0 */ class SearchJob extends Job{ - private IFindTaxaAndNamesConfigurator configurator; - - private Display display; - + private final IFindTaxaAndNamesConfigurator configurator; + + private final Display display; + /** * @param name */ @@ -288,19 +296,21 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("", 100); monitor.worked(20); - + final List> searchResult = CdmStore.getSearchManager().findTaxaAndNames(configurator); monitor.worked(40); - + if(! monitor.isCanceled()){ display.asyncExec(new Runnable() { - public void run() { + @Override + public void run() { displaySearchResult(searchResult); } }); }else{ display.asyncExec(new Runnable() { - public void run() { + @Override + public void run() { status.setText("Cancelled"); } }); @@ -308,6 +318,6 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ monitor.done(); return Status.OK_STATUS; } - - } + + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java index 7738eed49..c4248413c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java @@ -1,16 +1,13 @@ /** - * + * */ package eu.etaxonomy.taxeditor.newWizard; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement; @@ -27,12 +24,12 @@ public class PolytomousKeyWizardPage extends AbstractCdmEntityWizardPageAbstract AbstractCdmFormElement class.

@@ -24,22 +24,22 @@ import eu.etaxonomy.taxeditor.store.StoreUtil; * @author n.hoffmann * @version $Id: $ */ -public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, ICdmFormElement { +public abstract class AbstractCdmFormElement implements ICdmFormElement { protected CdmFormFactory formFactory; private List propertyChangeListeners; private Composite layoutComposite; - - private Set controls = new HashSet(); - - private Set elements = new HashSet(); + + private final Set controls = new HashSet(); + + private final Set elements = new HashSet(); private ICdmFormElement parentElement; private Color persistentBackgroundColor; - - + + /** *

Constructor for AbstractCdmFormElement.

* @@ -50,7 +50,7 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, this.layoutComposite = layoutComposite; this.formFactory = formFactory; } - + /** *

Constructor for AbstractCdmFormElement.

* @@ -62,7 +62,7 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, this.parentElement = formElement; // addControl(layoutComposite); } - + /** *

Getter for the field formFactory.

* @@ -71,23 +71,24 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, public CdmFormFactory getFormFactory() { return formFactory; } - + /** * Delegates the focus to this elements main input control */ public void setFocus(){ - // Override in subclasses where needed + // Override in subclasses where needed } - + /** * Returns all Controls that are managed by this element * * @return a {@link java.util.Set} object. */ - public Set getControls(){ + @Override + public Set getControls(){ return controls; } - + /** * adds the control to the set of controls that are managed by this element * @@ -96,7 +97,7 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, protected void addControl(Control child){ controls.add(child); } - + /** *

removeControl

* @@ -105,30 +106,33 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, protected void removeControl(Control child){ controls.remove(child); } - + /** *

Getter for the field elements.

* * @return a {@link java.util.Set} object. */ - public Set getElements(){ + @Override + public Set getElements(){ return elements; } - + /** *

Getter for the field parentElement.

* * @return a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. */ - public ICdmFormElement getParentElement(){ + @Override + public ICdmFormElement getParentElement(){ return parentElement; } - + /** {@inheritDoc} */ - public void addElement(ICdmFormElement element){ + @Override + public void addElement(ICdmFormElement element){ elements.add(element); } - + /** *

removeElement

* @@ -137,15 +141,16 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, protected void removeElement(ICdmFormElement element){ elements.remove(element); } - + /** *

removeElements

*/ - public void removeElements(){ + @Override + public void removeElements(){ for(ICdmFormElement childElement : getElements()){ // recursion childElement.removeElements(); - + // unregister selection arbitrator if(childElement instanceof ISelectableElement){ SelectionArbitrator selectionArbitrator = ((ISelectableElement) childElement).getSelectionArbitrator(); @@ -153,19 +158,17 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, formFactory.destroySelectionArbitrator(selectionArbitrator); } } - + // unregister from property changes - if(childElement instanceof IPropertyChangeListener){ - formFactory.removePropertyChangeListener((IPropertyChangeListener) childElement); - } - + formFactory.removePropertyChangeListener(childElement); + // dispose of the controls removeControls(childElement); } removeControls(this); elements.clear(); } - + private void removeControls(ICdmFormElement element){ if(element instanceof Section){ ((Section) element).dispose(); @@ -183,16 +186,17 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, } } } - + /** *

Getter for the field layoutComposite.

* * @return a {@link org.eclipse.swt.widgets.Composite} object. */ - public Composite getLayoutComposite() { + @Override + public Composite getLayoutComposite() { return layoutComposite; } - + /** *

Setter for the field layoutComposite.

* @@ -201,7 +205,7 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, public void setLayoutComposite(Composite layoutComposite){ this.layoutComposite = layoutComposite; } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#getPropertyChangeListeners() */ @@ -210,18 +214,20 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, * * @return a {@link java.util.Set} object. */ - public List getPropertyChangeListeners() { + @Override + public List getPropertyChangeListeners() { return propertyChangeListeners; } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#setPropertyChangeListeners(org.eclipse.core.runtime.ListenerList) */ /** {@inheritDoc} */ - public void setPropertyChangeListeners(List propertyChangeListeners){ + @Override + public void setPropertyChangeListeners(List propertyChangeListeners){ this.propertyChangeListeners = propertyChangeListeners; } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent() */ @@ -229,7 +235,8 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#firePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) */ /** {@inheritDoc} */ - public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { + @Override + public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { Assert.isNotNull(propertyChangeListeners, "Property change listeners are not present"); try{ @@ -237,34 +244,34 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, ((IPropertyChangeListener)listener).propertyChange(event); } }catch(ConcurrentModificationException e){ - // There are two cases that produce a CME. + // There are two cases that produce a CME. // Described here: http://dev.e-taxonomy.eu/trac/ticket/2363#comment:2 // and here: http://dev.e-taxonomy.eu/trac/ticket/2438 // Ignoring the CME because nothing bad is happening - StoreUtil.warn(getClass(), "ConcurrentModificationException. Can be ignored."); + AbstractUtility.warn(getClass(), "ConcurrentModificationException. Can be ignored."); } } - + /** * Fires a {@link CdmPropertyChangeEvent} with the given object as source. - * + * * @param object the object on which the property changed */ public void firePropertyChangeEvent(Object object){ firePropertyChangeEvent(object, null); } - + /** * Fires a {@link CdmPropertyChangeEvent} with the given object as source also containing the * originating event - * + * * @param object the object on which the property changed * @param originatingEvent the originating event */ public void firePropertyChangeEvent(Object object, PropertyChangeEvent originatingEvent){ firePropertyChangeEvent(new CdmPropertyChangeEvent(object, originatingEvent)); } - + /** * {@inheritDoc} @@ -275,12 +282,14 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, * Implementations should also check for null PropertyChangeEvents and return immediately in that case. * @see eu.etaxonomy.taxeditor.ui.element.ICdmFormElement#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ - public void propertyChange(PropertyChangeEvent event) { + @Override + public void propertyChange(PropertyChangeEvent event) { // implement in subclasses } - + /** {@inheritDoc} */ - public boolean containsFormElement(ICdmFormElement formElement){ + @Override + public boolean containsFormElement(ICdmFormElement formElement){ if(formElement == this){ return true; }else{ @@ -293,7 +302,7 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, return false; } } - + /* * (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.ICdmFormElement#refresh() @@ -301,10 +310,11 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, /** *

refresh

*/ - public void refresh() { - // empty default implementation + @Override + public void refresh() { + // empty default implementation } - + /** {@inheritDoc} */ @Override @@ -313,19 +323,19 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter, element.setBackground(color); } } - + @Override public void setPersistentBackground(Color color) { persistentBackgroundColor = color; setBackground(color); } - + @Override public Color getPersistentBackground() { return persistentBackgroundColor; } - + public Color getColor(String colorId){ - return StoreUtil.getColor(colorId); + return AbstractUtility.getColor(colorId); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java index b245498e9..cece9928b 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.element; @@ -33,27 +33,31 @@ import org.eclipse.ui.forms.widgets.ToggleHyperlink; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; -import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.model.AbstractUtility; /** *

- * Abstract AbstractFormSection class. + * Abstract super class for a {@link Section} GUI element that visualizes a CDM + * entity, manages a conversation and listens to selections *

- * + * + * @param A CDM entity which should be visualized by this section. + * * @author n.hoffmann * @created Feb 22, 2010 * @version 1.0 * @param */ +//TODO shouldn't ENTITY be bound with super class ICdmBase for example (AbstractFormSection)? public abstract class AbstractFormSection extends Section implements - ISelectionChangedListener, ICdmFormElement, IEntityElement, + ISelectionChangedListener, IEntityElement, IConversationEnabled { private ISelectionProvider selectionProvider; private ENTITY entity; - private Set elements = new HashSet(); + private final Set elements = new HashSet(); protected CdmFormFactory formFactory; @@ -67,7 +71,7 @@ public abstract class AbstractFormSection extends Section implements *

* Constructor for AbstractFormSection. *

- * + * * @param conversation * TODO * @param style @@ -81,8 +85,7 @@ public abstract class AbstractFormSection extends Section implements * @param * a ENTITY object. */ - protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, - int style) { + protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) { super(parentElement.getLayoutComposite(), style); this.parentElement = parentElement; @@ -103,45 +106,45 @@ public abstract class AbstractFormSection extends Section implements this.setClient(client); } - /** - *

- * Constructor for AbstractFormSection. - *

- * - * @param formFactory - * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} - * object. - * @param conversation - * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} - * object. - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @param selectionProvider - * a {@link org.eclipse.jface.viewers.ISelectionProvider} object. - * @param style - * a int. - */ - protected AbstractFormSection(CdmFormFactory formFactory, - ICdmFormElement parentElement, - ISelectionProvider selectionProvider, int style) { - this(formFactory, parentElement, style); - this.selectionProvider = selectionProvider; - } + /** + *

+ * Constructor for AbstractFormSection. + *

+ * + * @param formFactory + * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} + * object. + * @param conversation + * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} + * object. + * @param selectionProvider + * a {@link org.eclipse.jface.viewers.ISelectionProvider} object. + * @param style + * a int. + */ + protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { + this(formFactory, parentElement, style); + this.selectionProvider = selectionProvider; + } /** *

* Getter for the field propertyChangeListeners. *

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

* Setter for the field entity. *

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

* Getter for the field entity. *

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

* getToggle *

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

* getSection *

- * + * * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} * object. */ @@ -199,29 +203,28 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent * () */ /** {@inheritDoc} */ - public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { - Assert.isNotNull(propertyChangeListeners, - "No property change listeners."); - try { - for (Object listener : propertyChangeListeners) { - ((IPropertyChangeListener) listener).propertyChange(event); - } - } catch (ConcurrentModificationException e) { - StoreUtil.warn(getClass(), - "ConcurrentModificationException while handling PropertyChangeEvents." - + " It seems like this is not critical"); - } + @Override + public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { + Assert.isNotNull(propertyChangeListeners, "No property change listeners."); + try { + for (Object listener : propertyChangeListeners) { + ((IPropertyChangeListener) listener).propertyChange(event); + } + } catch (ConcurrentModificationException e) { + AbstractUtility.warn(getClass(), "ConcurrentModificationException while handling PropertyChangeEvents." + + " It seems like this is not critical"); + } } /** * Fires a {@link CdmPropertyChangeEvent} with the given object as source. - * + * * @param object * the object on which the property changed */ @@ -232,7 +235,7 @@ public abstract class AbstractFormSection extends Section implements /** * Fires a {@link CdmPropertyChangeEvent} with the given object as source * also containing the originating event - * + * * @param object * the object on which the property changed * @param originatingEvent @@ -246,7 +249,7 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see org.eclipse.swt.widgets.Composite#setFocus() */ /** {@inheritDoc} */ @@ -257,19 +260,20 @@ public abstract class AbstractFormSection extends Section implements /* * (non-Javadoc) - * + * * @see * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse * .jface.util.PropertyChangeEvent) */ /** {@inheritDoc} */ - public void propertyChange(PropertyChangeEvent event) { + @Override + public void propertyChange(PropertyChangeEvent event) { firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event)); } /* * (non-Javadoc) - * + * * @see * org.eclipse.swt.widgets.Control#setBackground(org.eclipse.swt.graphics * .Color) @@ -283,42 +287,41 @@ public abstract class AbstractFormSection extends Section implements getLayoutComposite().setBackground(color); super.setBackground(color); } - + @Override public void setPersistentBackground(Color color) { persistentBackgroundColor = color; setBackground(color); } - + @Override public Color getPersistentBackground() { return persistentBackgroundColor; } - + /** *

* widgetSelected *

- * + * * @param e * a {@link org.eclipse.swt.events.SelectionEvent} object. */ public void widgetSelected(SelectionEvent e) { - Widget widget = e.widget; - - if (widget instanceof Control) { - Control control = (Control) widget; - if (checkControlAncestryForWidget(control)) { - if (getEntity() != null) { - IStructuredSelection selection = new StructuredSelection( - getEntity()); - if (selectionProvider != null) { - selectionProvider.setSelection(selection); - } - } - } - } + Widget widget = e.widget; + + if (widget instanceof Control) { + Control control = (Control) widget; + if (checkControlAncestryForWidget(control)) { + if (getEntity() != null) { + IStructuredSelection selection = new StructuredSelection(getEntity()); + if (selectionProvider != null) { + selectionProvider.setSelection(selection); + } + } + } + } } private boolean checkControlAncestryForWidget(Control control) { @@ -335,7 +338,8 @@ public abstract class AbstractFormSection extends Section implements } /** {@inheritDoc} */ - public void setSelected(boolean selected) { + @Override + public void setSelected(boolean selected) { if (selected) { setBackground(Display.getCurrent().getSystemColor( SWT.COLOR_LIST_SELECTION)); @@ -345,7 +349,8 @@ public abstract class AbstractFormSection extends Section implements } /** {@inheritDoc} */ - public void selectionChanged(SelectionChangedEvent event) { + @Override + public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() == CdmFormFactory.EMPTY_SELECTION) { return; } @@ -365,7 +370,7 @@ public abstract class AbstractFormSection extends Section implements *

* addSelectionListener *

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

* removeSelectionListener *

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

* removeElement *

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

*/ - public void removeElements() { + @Override + public void removeElements() { for (ICdmFormElement childElement : getElements()) { // recursion childElement.removeElements(); @@ -416,8 +423,7 @@ public abstract class AbstractFormSection extends Section implements // unregister selection arbitrator if (childElement instanceof ISelectableElement) { ISelectableElement selectableElement = (ISelectableElement) childElement; - if (selectableElement != null - && selectableElement.getSelectionArbitrator() != null) { + if (selectableElement.getSelectionArbitrator() != null) { formFactory.destroySelectionArbitrator(selectableElement .getSelectionArbitrator()); } @@ -447,10 +453,11 @@ public abstract class AbstractFormSection extends Section implements *

* Getter for the field parentElement. *

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

* Getter for the field elements. *

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

* getControls *

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

* getLayoutComposite *

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

* Getter for the field formFactory. *

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

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

* getConversationHolder *

- * + * * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} * object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { if(getParentElement() instanceof RootElement || getParentElement() == null){ - - IEditorPart activeEditor = StoreUtil.getActiveEditor(); + + IEditorPart activeEditor = AbstractUtility.getActiveEditor(); if(activeEditor instanceof IConversationEnabled){ - ConversationHolder conversation = ((IConversationEnabled) StoreUtil.getActiveEditor()).getConversationHolder(); + ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder(); return conversation; } }else if(getParentElement() instanceof IConversationEnabled){ return ((IConversationEnabled) getParentElement()).getConversationHolder(); } - StoreUtil.errorDialog("Could not get conversation for AbstractFormSection", - getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't", + AbstractUtility.errorDialog("Could not get conversation for AbstractFormSection", + getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't", new IllegalArgumentException()); return null; - + } /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) { + @Override + public void update(CdmDataChangeMap changeEvents) { } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java index 125151046..533b43b02 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java @@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.forms.IFormColors; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.internal.forms.widgets.FormFonts; @@ -95,7 +96,7 @@ import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.strategy.parser.ParserProblem; -import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType; @@ -119,8 +120,8 @@ import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElem import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection; import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement; import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection; +import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement; import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection; -import eu.etaxonomy.taxeditor.ui.section.common.RefereneEntityDetailElement; import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement; import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement; @@ -132,6 +133,7 @@ import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceEle import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceElement; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection; +import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection; import eu.etaxonomy.taxeditor.ui.section.description.ModifierElement; import eu.etaxonomy.taxeditor.ui.section.description.ModifierSection; import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageDetailElement; @@ -269,7 +271,7 @@ public class CdmFormFactory extends FormToolkit { private MouseListener selectionMouseHandler; private FocusListener selectionFocusHandler; - private final Set selectionListenerList = new HashSet(); + private final Set selectionListenerList = new HashSet(); private final List propertyChangeListeners = new ArrayList(); @@ -315,8 +317,8 @@ public class CdmFormFactory extends FormToolkit { event.widget = e.widget; SelectionEvent selectionEvent = new SelectionEvent(event); - for (Object listener : selectionListenerList) { - ((SelectionListener) listener).widgetSelected(selectionEvent); + for (SelectionListener listener : selectionListenerList) { + listener.widgetSelected(selectionEvent); } } @@ -370,10 +372,8 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.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); @@ -386,20 +386,17 @@ public class CdmFormFactory extends FormToolkit { *

* * @param selectionArbitrator - * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} + * a + * {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} * object. */ - public void destroySelectionArbitrator( - SelectionArbitrator selectionArbitrator) { + public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator) { removeSelectionListener(selectionArbitrator); if (selectionProvider != null) { - selectionProvider - .removeSelectionChangedListener(selectionArbitrator); + selectionProvider.removeSelectionChangedListener(selectionArbitrator); } else { - StoreUtil - .error(this.getClass(), - "Tried to destroy a selection listener from this factories listeners but was null", - null); + AbstractUtility.error(this.getClass(), + "Tried to destroy a selection listener from this factories listeners but was null", null); } } @@ -412,7 +409,8 @@ public class CdmFormFactory extends FormToolkit { /** *

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

* * @param formElement @@ -449,8 +447,7 @@ public class CdmFormFactory extends FormToolkit { } // destroy selection arbitrator, if any if (formElement instanceof ISelectableElement) { - destroySelectionArbitrator(((ISelectableElement) formElement) - .getSelectionArbitrator()); + destroySelectionArbitrator(((ISelectableElement) formElement).getSelectionArbitrator()); } // remove this element form its parents list of elements // ICdmFormElement parentElement = formElement.getParentElement(); @@ -505,11 +502,9 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -535,23 +530,19 @@ public class CdmFormFactory extends FormToolkit { * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement} * object. */ - public MultilanguageTextElement createMultiLanguageTextElement( - ICdmFormElement parentElement, String labelString, - Map multilanguageText, int textHeight, - int style) { - MultilanguageTextElement element = new MultilanguageTextElement(this, - parentElement, labelString, multilanguageText, textHeight, - style); + public MultilanguageTextElement createMultiLanguageTextElement(ICdmFormElement parentElement, String labelString, + Map multilanguageText, int textHeight, int 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, + public KeyStatementElement createKeyStatementElement(ICdmFormElement parentElement, String labelString, KeyStatement keyStatement, int textHeight, int style) { - KeyStatementElement element = new KeyStatementElement(this, - parentElement, labelString, keyStatement, textHeight, style); + KeyStatementElement element = new KeyStatementElement(this, parentElement, labelString, keyStatement, + textHeight, style); adapt(element); parentElement.addElement(element); return element; @@ -574,21 +565,18 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} * object. */ - public TextWithLabelElement createTextWithLabelElement( - ICdmFormElement parentElement, String labelString, + public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString, String initialText, int style) { - TextWithLabelElement element = new TextWithLabelElement(this, - parentElement, labelString, initialText, null, 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; @@ -601,11 +589,10 @@ public class CdmFormFactory extends FormToolkit { * @param style * @return */ - public OpenUrlSelectorElement createOpenUrlSelectorElement( - ICdmFormElement parentElement, String labelString, + public OpenUrlSelectorElement createOpenUrlSelectorElement(ICdmFormElement parentElement, String labelString, IOpenUrlEnabled openUrlEnabled, int style) { - OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, - parentElement, labelString, openUrlEnabled, style); + OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, parentElement, labelString, openUrlEnabled, + style); adapt(element); parentElement.addElement(element); return element; @@ -620,11 +607,9 @@ public class CdmFormFactory extends FormToolkit { * @param style * @return */ - public EditPasswordElement createEditPasswordElement( - ICdmFormElement parentElement, String labelString, + public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString, ConversationHolder conversation, User user, int style) { - EditPasswordElement element = new EditPasswordElement(this, - parentElement, labelString, user, conversation); + EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation); adapt(element); parentElement.addElement(element); return element; @@ -644,7 +629,8 @@ public class CdmFormFactory extends FormToolkit { * a {@link java.lang.Integer} object. * @param style * a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement} + * @return a + * {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement} * object. */ public NumberWithLabelElement createNumberTextWithLabelElement( @@ -676,11 +662,10 @@ public class CdmFormFactory extends FormToolkit { * {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -706,11 +691,10 @@ public class CdmFormFactory extends FormToolkit { * {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -731,10 +715,8 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -757,11 +739,9 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement} * object. */ - public KeyValueViewerElement createKeyValueViewerElement( - ICdmFormElement parentElement, String keyHeading, + public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading, String valueHeading, Map map) { - KeyValueViewerElement element = new KeyValueViewerElement(this, - parentElement, keyHeading, valueHeading, map); + KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map); adapt(element); parentElement.addElement(element); return element; @@ -790,10 +770,10 @@ public class CdmFormFactory extends FormToolkit { * object. */ - public TermComboElement createTermComboElement( - Class termComboType, ICdmFormElement parentElement, - String labelString, T selection, int style) { - TermComboElement element = new TermComboElement(this, parentElement, termComboType, labelString, selection, style); + public TermComboElement createTermComboElement(Class termComboType, + ICdmFormElement parentElement, String labelString, T selection, int style) { + TermComboElement element = new TermComboElement(this, parentElement, termComboType, labelString, + selection, style); adapt(element); parentElement.addElement(element); return element; @@ -872,12 +852,11 @@ public class CdmFormFactory extends FormToolkit { * @param parentElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object. + * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -897,10 +876,8 @@ public class CdmFormFactory extends FormToolkit { * a int. * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -925,11 +902,10 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement} * object. */ - public TextActionElement createTextActionElement( - ICdmFormElement parentElement, String labelString, + public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString, String buttonLabel, String initialText, int style) { - TextActionElement element = new TextActionElement(this, parentElement, - labelString, buttonLabel, initialText, style); + TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText, + style); adapt(element); parentElement.addElement(element); return element; @@ -949,12 +925,11 @@ public class CdmFormFactory extends FormToolkit { * a boolean. * @param style * a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object. + * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -965,7 +940,8 @@ public class CdmFormFactory extends FormToolkit { * * @return the section widget * @param section - * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} + * a + * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} * object. */ public Section adapt(AbstractFormSection section) { @@ -977,26 +953,20 @@ public class CdmFormFactory extends FormToolkit { 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) { + if ((section.getStyle() & ExpandableComposite.TITLE_BAR) != 0 + || (section.getStyle() & ExpandableComposite.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; } @@ -1019,15 +989,13 @@ 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; } } @@ -1052,12 +1020,10 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement} * object. */ - public ToggleableTextElement createToggleableTextField( - ICdmFormElement parentElement, String labelString, + public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, String labelString, String initialText, boolean initialState, int style) { - ToggleableTextElement element = new ToggleableTextElement(this, - parentElement, labelString, initialText, initialState, style - | orientation); + ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText, + initialState, style | orientation); adapt(element); parentElement.addElement(element); return element; @@ -1080,11 +1046,9 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement} * object. */ - public TimePeriodElement createTimePeriodElement( - ICdmFormElement parentElement, String labelString, + public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString, TimePeriod timePeriod, int style) { - TimePeriodElement element = new TimePeriodElement(this, parentElement, - labelString, timePeriod, style); + TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style); adapt(element); parentElement.addElement(element); return element; @@ -1138,10 +1102,8 @@ public class CdmFormFactory extends FormToolkit { * a {@link eu.etaxonomy.cdm.model.location.Point} object. * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object. */ - public PointElement createPointElement(ICdmFormElement parentElement, - Point point, int style) { - PointElement element = new PointElement(this, parentElement, point, - style); + public PointElement createPointElement(ICdmFormElement parentElement, Point point, int style) { + PointElement element = new PointElement(this, parentElement, point, style); adapt(element); parentElement.addElement(element); return element; @@ -1160,10 +1122,8 @@ public class CdmFormFactory extends FormToolkit { * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -1203,12 +1163,12 @@ public class CdmFormFactory extends FormToolkit { * a {@link org.joda.time.Partial} object. * @param style * a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object. + * @return a {@link eu.etaxonomy.taxeditor.ui.element.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; @@ -1236,10 +1196,8 @@ public class CdmFormFactory extends FormToolkit { */ 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); + AbstractUtility.error(this.getClass(), + "Tried to remove a selection listener from this factories listeners but was null", null); } else { selectionListenerList.remove(listener); } @@ -1286,10 +1244,8 @@ public class CdmFormFactory extends FormToolkit { * 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(LayoutConstants.FILL_HORIZONTALLY()); return separator; } @@ -1311,10 +1267,8 @@ public class CdmFormFactory extends FormToolkit { * {@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; @@ -1326,10 +1280,8 @@ public class CdmFormFactory extends FormToolkit { * @param style * @return */ - public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, - CdmBase entity, int style) { - CdmBaseElement element = new CdmBaseElement(this, parentElement, - entity, style); + public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) { + CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style); adapt(element); parentElement.addElement(element); return element; @@ -1350,8 +1302,7 @@ public class CdmFormFactory extends FormToolkit { * {@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); @@ -1381,8 +1332,7 @@ public class CdmFormFactory extends FormToolkit { * @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; @@ -1401,8 +1351,7 @@ public class CdmFormFactory extends FormToolkit { * 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; @@ -1425,68 +1374,20 @@ public class CdmFormFactory extends FormToolkit { * {@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); + public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement, + ParserProblem parserProblem, int style) { + ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style); adapt(element); parentElement.addElement(element); return element; } - // SIMPLIFY + public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation, + ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { - /** - * - */ - public static enum DetailType { - AUTHORSHIP, - CLASSIFICATION, - COLLECTION, - DERIVED_UNIT, - DERIVED_UNIT_FACADE, - DERIVED_UNIT_GENERAL, - DESCRIPTION, - DESCRIPTIONELEMENT, - DETERMINATION, - FEATURE_DISTRIBUTION, - FIELD_OBSERVATION, - GATHERING_EVENT, - GRANTEDAUTHORITY, - GROUP, - HYBRID, - INSTITUTION, - MEDIA, - NAMED_AREA, - NAMED_AREA_LEVEL, - NAMERELATIONSHIP, - NATURAL_LANGUAGE, - NOMENCLATURALREFERENCE, - NONVIRALNAME, - PARSINGMESSAGE, - PERSON, - POLYTOMOUS_KEY, - POLYTOMOUS_KEY_NODE, - REFERENCEBASE, - REFERENCED_ENTITY, - SCIENTIFICNAME, - TAXON_NODE, - TAXON_RELATIONSHIP, - TAXONBASE, - TEAM, - TEAMORPERSONBASE, - TERM_VOCABULARY, - USE_RECORD, - USER - } + AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement, + selectionProvider, style); - public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, - ConversationHolder conversation, ICdmFormElement parentElement, - ISelectionProvider selectionProvider, int style) { - - AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement, selectionProvider, style); - parentElement.addElement(section); adapt(section); return section; @@ -1499,15 +1400,12 @@ public class CdmFormFactory extends FormToolkit { * @param style * @return */ - public AbstractCdmDetailElement createDefinedTermDetailElement( - Class definedTermClass, AbstractCdmDetailSection parentElement, - int style) { + public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass, AbstractCdmDetailSection parentElement, int style) { AbstractCdmDetailElement element = null; if (NamedArea.class.isAssignableFrom(definedTermClass)){ element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement); - } - else { + } else { element = new DefinedTermDetailElement(this, parentElement); } @@ -1516,534 +1414,648 @@ public class CdmFormFactory extends FormToolkit { return element; } - /** - *

- * createCdmDetailSection - *

- * - * @param detailType - * a - * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType} - * object. - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.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.element.AbstractFormSection} - * object. - */ - public AbstractFormSection createCdmDetailSection(DetailType detailType, - ConversationHolder conversation, ICdmFormElement parentElement, - ISelectionProvider selectionProvider, int style) { - AbstractFormSection section = null; - - switch (detailType) { - case SCIENTIFICNAME: - section = new NameDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case REFERENCEBASE: - section = new ReferenceDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case NOMENCLATURALREFERENCE: - section = new NomenclaturalReferenceDetailSection(this, - conversation, parentElement, selectionProvider, style); - break; - case TAXONBASE: - section = new TaxonBaseDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case AUTHORSHIP: - section = new AuthorshipDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case TEAMORPERSONBASE: - section = new TeamOrPersonBaseDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case TEAM: - section = new TeamDetailSection(this, conversation, parentElement, - null, style); - break; - case PERSON: - section = new PersonDetailSection(this, conversation, - parentElement, null, style); - break; - case DESCRIPTION: - section = new DescriptionDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case DESCRIPTIONELEMENT: - section = new DescriptionElementDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case PARSINGMESSAGE: - section = new ParsingMessagesSection(this, conversation, - parentElement, selectionProvider, style); - break; - case NONVIRALNAME: - 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); - break; - case DERIVED_UNIT_FACADE: - section = new DerivedUnitFacadeDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case FIELD_OBSERVATION: - section = new FieldObservationDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case GATHERING_EVENT: - section = new GatheringEventDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case DERIVED_UNIT: - section = new DerivedUnitBaseDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case NATURAL_LANGUAGE: - section = new NaturalLanguageSection(this, conversation, - parentElement, selectionProvider, style); - break; - case FEATURE_DISTRIBUTION: - section = new FeatureDistributionDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case CLASSIFICATION: - section = new ClassificationDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case TAXON_NODE: - section = new TaxonNodeDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case POLYTOMOUS_KEY: - section = new PolytomousKeyDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case POLYTOMOUS_KEY_NODE: - section = new PolytomousKeyNodeDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case INSTITUTION: - section = new InstitutionDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case DERIVED_UNIT_GENERAL: - section = new GeneralDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case HYBRID: - section = new HybridDetailSection(this, conversation, - parentElement, selectionProvider, style); - break; - case USER: - section = new UserDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case GROUP: - section = new GroupDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case DETERMINATION: - section = new DeterminationDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case TAXON_RELATIONSHIP: - section = new TaxonRelationshipDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case REFERENCED_ENTITY: - section = new ReferencedEntityDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case TERM_VOCABULARY: - section = new TermVocabularyDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case NAMED_AREA: - section = new NamedAreaDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; - case USE_RECORD: - section = new UseRecordDetailSection(this, conversation, parentElement, - selectionProvider, style); - break; + + //--------DetailSections--------- + public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DerivedUnitFacadeDetailSection createDerivedUnitFacadeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + DerivedUnitFacadeDetailSection section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public FieldObservationDetailSection createFieldObservationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GeneralDetailSection createGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + + public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; } - - if (section == null) { - throw new RuntimeException( - "You tried to create a cdm detail section that is not implemented yet."); + public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ + FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style); + addAndAdaptSection(parentElement, section); + return section; } + private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection section) { parentElement.addElement(section); adapt(section); - return section; } + //--------DetailElements------------ + + public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){ + UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public DefinedTermDetailElement createNamedAreaLevelElement(ICdmFormElement parentElement){ + DefinedTermDetailElement element = new DefinedTermDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){ + eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){ + TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){ + ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){ + TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){ + GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){ + GroupDetailElement element = new GroupDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){ + UserDetailElement element = new UserDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){ + HybridDetailElement element = new HybridDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){ + InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){ + PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){ + PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){ + CollectionDetailElement element = new CollectionDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement){ + TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){ + ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){ + FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){ + NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public DerivedUnitFacadeDetailElement createDerivedUnitFacadeDetailElement(ICdmFormElement parentElement){ + DerivedUnitFacadeDetailElement element = new DerivedUnitFacadeDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){ + NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){ + DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){ + DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){ + PersonDetailElement element = new PersonDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style){ + TeamDetailElement element = new TeamDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){ + AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){ + TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){ + NameDetailElement element = new NameDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){ + ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } + + public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){ + NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style); + addAndAdaptElement(parentElement, element); + return element; + } - /** - *

- * createCdmDetailElement - *

- * - * @param detailType - * a - * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType} - * object. - * @param style - * a int. - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @return a - * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} - * object. - */ - public AbstractCdmDetailElement createCdmDetailElement( - DetailType detailType, ICdmFormElement parentElement, int style) { - AbstractCdmDetailElement element = null; - - switch (detailType) { - case SCIENTIFICNAME: - element = new NameDetailElement(this, parentElement, style); - break; - case REFERENCEBASE: - element = new ReferenceDetailElement(this, parentElement, style); - break; - case NOMENCLATURALREFERENCE: - element = new NomenclaturalReferenceDetailElement(this, - parentElement, style); - break; - case TAXONBASE: - element = new TaxonBaseDetailElement(this, parentElement, style); - break; - case AUTHORSHIP: - element = new AuthorshipDetailElement(this, parentElement, style); - break; - case TEAM: - element = new TeamDetailElement(this, parentElement, style); - break; - case PERSON: - element = new PersonDetailElement(this, parentElement, style); - break; - case DESCRIPTION: - element = new DescriptionDetailElement(this, parentElement, style); - break; - case DESCRIPTIONELEMENT: - element = new DescriptionElementDetailElement(this, parentElement, - style); - break; - case NONVIRALNAME: - element = new NonViralNameDetailElement(this, parentElement); - break; - case DERIVED_UNIT_FACADE: - element = new DerivedUnitFacadeDetailElement(this, parentElement); - break; - case FIELD_OBSERVATION: - element = new FieldObservationDetailElement(this, parentElement); - break; - case GATHERING_EVENT: - element = new GatheringEventDetailElement(this, parentElement); - break; - case DERIVED_UNIT: - element = new DerivedUnitBaseDetailElement(this, parentElement); - break; - case NATURAL_LANGUAGE: - element = new NaturalLanguageDetailElement(this, parentElement); - break; - case FEATURE_DISTRIBUTION: - element = new FeatureDistributionDetailElement(this, parentElement); - break; - case CLASSIFICATION: - element = new ClassificationDetailElement(this, parentElement); - break; - case TAXON_NODE: - element = new TaxonNodeDetailElement(this, parentElement); - break; - case COLLECTION: - element = new CollectionDetailElement(this, parentElement); - break; - case POLYTOMOUS_KEY: - element = new PolytomousKeyDetailElement(this, parentElement); - break; - case POLYTOMOUS_KEY_NODE: - element = new PolytomousKeyNodeDetailElement(this, parentElement); - break; - case INSTITUTION: - element = new InstitutionDetailElement(this, parentElement); - break; - case DERIVED_UNIT_GENERAL: - element = new GeneralDetailElement(this, parentElement); - break; - case HYBRID: - element = new HybridDetailElement(this, parentElement); - break; - case USER: - element = new UserDetailElement(this, parentElement); - break; - case GROUP: - element = new GroupDetailElement(this, parentElement); - break; - case GRANTEDAUTHORITY: - element = new GrantedAuthorityDetailElement(this, parentElement); - break; - case DETERMINATION: - element = new DeterminationDetailElement(this, parentElement); - break; - case TAXON_RELATIONSHIP: - element = new TaxonRelationshipDetailElement(this, parentElement); - break; - case REFERENCED_ENTITY: - element = new RefereneEntityDetailElement(this, parentElement); - break; - case TERM_VOCABULARY: - element = new TermVocabularyDetailElement(this, parentElement); - break; - case NAMED_AREA: - element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement); - break; - case NAMED_AREA_LEVEL: - element = new DefinedTermDetailElement(this, parentElement); - break; - case USE_RECORD: - //element = new UseRecordDetailElement(this, parentElement, style); - element = new UseRecordDetailElement(this, parentElement); - break; + public GeneralDetailElement createGeneralDetailElement(ICdmFormElement parentElement){ + GeneralDetailElement element = new GeneralDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; + } + + public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) { + GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; } - 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); + public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) { + FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; } - adapt(element); - parentElement.addElement(element); + public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) { + DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement); + addAndAdaptElement(parentElement, 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, - TAXONOMIC_SCOPE, - DETERMINATION_CURRENT, - DETERMINATION_HISTORY + public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) { + DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement); + addAndAdaptElement(parentElement, element); + return element; } /** - *

- * createEntityDetailSection - *

- * - * @param entityDetailType - * a - * {@link eu.etaxonomy.taxeditor.ui.element.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.element.ICdmFormElement} - * object. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} - * object. + * @param element */ - public AbstractFormSection createEntityDetailSection( - EntityDetailType entityDetailType, ConversationHolder conversation, - ICdmFormElement parentElement, int style) { - AbstractFormSection section = null; - - switch (entityDetailType) { - case TEAM: - section = new TeamDetailSection(this, conversation, parentElement, - null, style); - break; - case TEAMMEMBER: - section = new TeamMemberSection(this, conversation, parentElement, - style); - break; - case ANNOTATION: - section = new AnnotationSection(this, conversation, parentElement, - style); - break; - case CREDIT: - section = new CreditSection(this, conversation, parentElement, - style); - break; - case DESCRIPTIONELEMENTSOURCE: - section = new DescriptionElementSourceSection(this, conversation, - parentElement, style); - break; - case EXTENSION: - section = new ExtensionSection(this, conversation, parentElement, - style); - break; - case MARKER: - 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); - break; - case MEDIAREPRESENTATION: - section = new MediaRepresentationSection(this, conversation, - parentElement, style); - break; - case MEDIAREPRESENTATIONPART: - section = new MediaRepresentationPartSection(this, conversation, - parentElement, style); - break; - case MODIFIER: - section = new ModifierSection(this, conversation, parentElement, - style); - break; - case NOMENCLATURALSTATUS: - section = new NomenclaturalStatusSection(this, conversation, - parentElement, style); - break; - case NAME_RELATIONSHIP: - section = new NameRelationshipDetailSection(this, conversation, - parentElement, style); - break; - case PROTOLOG: - section = new ProtologueSection(this, conversation, parentElement, - style); - break; - case RIGHTS: - section = new RightsSection(this, conversation, parentElement, - style); - break; - case SOURCE: - 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); - break; - case TYPEDESIGNATION: - section = new TypeDesignationSection(this, conversation, - parentElement, style); - break; - case STATE_DATA: - section = new StateDataSection(this, conversation, parentElement, - style); - break; - case STATISTICAL_MEASUREMENT_VALUE: - section = new StatisticalMeasurementValueSection(this, - conversation, parentElement, style); - break; - case DESCRIBED_SPECIMEN: - section = new DescribedSpecimenSection(this, conversation, - parentElement, style); - break; - case COLLECTING_AREA: - section = new CollectingAreasDetailSection(this, conversation, - parentElement, style); - break; - case DETERMINATION_CURRENT: - section = new CurrentDeterminationDetailSection(this, conversation, - parentElement, style); - break; - case DETERMINATION_HISTORY: - section = new DeterminationHistoryDetailSection(this, conversation, - parentElement, style); - break; - case SPECIMEN_COLLECTION: - section = new SpecimenCollectionDetailSection(this, conversation, - parentElement, style); - break; - case IDENTIFIABLE_SOURCE_COLLECTION: - section = new SourceCollectionDetailSection(this, conversation, - parentElement, style); - break; - case GEOGRAPHICAL_SCOPE: - section = new GeographicalScopeDetailSection(this, conversation, - parentElement, style); - break; - case SCOPE_RESTRICTION: - section = new ScopeRestrictionSection(this, conversation, - parentElement, style); - break; - case MEMBER: - section = new MemberDetailSection(this, conversation, - parentElement, style); - break; - case GRANTED_AUTHORITY: - section = new GrantedAuthorityDetailSection(this, conversation, - parentElement, style); - break; - case GROUPS_BY_USER: - section = new GroupsByUserDetailSection(this, conversation, - parentElement, style); - break; - case TAXONOMIC_SCOPE: - section = new TaxonomicScopeSection(this, conversation, - parentElement, style); - break; + private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement element) { + adapt(element); + parentElement.addElement(element); + } + + //--------EntityCollectionSection---------- + public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + CreditSection section = new CreditSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + MarkerSection section = new MarkerSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + MediaSection section = new MediaSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + ModifierSection section = new ModifierSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + RightsSection section = new RightsSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + SourceSection section = new SourceSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + ScopeSection section = new ScopeSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + StateDataSection section = new StateDataSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GeographicalScopeDetailSection createGeographicalScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + GeographicalScopeDetailSection section = new GeographicalScopeDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; + } + + public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); + return section; } - parentElement.addElement(section); - adapt(section); + + public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){ + TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style); + addAndAdaptSection(parentElement, section); return section; } @@ -2057,7 +2069,8 @@ public class CdmFormFactory extends FormToolkit { * @param style * a int. * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} + * a + * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} * object. * @param versionableEntity * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} @@ -2068,52 +2081,43 @@ public class CdmFormFactory extends FormToolkit { * {@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); + element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style); } else if (entity instanceof Person) { - element = new TeamMemberElement(this, parentElement, - (Person) entity, removeListener, style); + element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style); } else if (entity instanceof Credit) { - element = new CreditElement(this, parentElement, (Credit) entity, - removeListener, style); + element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style); } else if (entity instanceof Extension) { - element = new ExtensionElement(this, parentElement, - (Extension) entity, removeListener, style); + element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style); } else if (entity instanceof Marker) { - element = new MarkerElement(this, parentElement, (Marker) entity, - removeListener, style); + element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style); } else if (entity instanceof Media) { - element = new MediaElement(this, parentElement, (Media) entity, - removeListener, style); + element = new MediaElement(this, parentElement, (Media) entity, removeListener, style); } else if (entity instanceof MediaRepresentation) { - element = new MediaRepresentationElement(this, parentElement, - (MediaRepresentation) entity, removeListener, style); + element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener, + style); } else if (entity instanceof ImageFile) { - element = new ImageFileElement(this, parentElement, - (ImageFile) entity, removeListener, style); + element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style); } else if (entity instanceof MediaRepresentationPart){ - element = new MediaRepresentationPartElement(this, parentElement, - (MediaRepresentationPart) entity, removeListener, style); + element = new MediaRepresentationPartElement(this, parentElement, (MediaRepresentationPart) entity, + removeListener, style); } else if (entity instanceof NomenclaturalStatus) { - element = new NomenclaturalStatusElement(this, parentElement, - (NomenclaturalStatus) entity, removeListener, style); + element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener, + style); } else if (entity instanceof Rights) { - element = new RightsElement(this, parentElement, (Rights) entity, + 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 DescriptionElementSource) { - element = new DescriptionElementSourceElement(this, parentElement, - (DescriptionElementSource) entity, removeListener, style); } else if (entity instanceof IdentifiableSource) { - element = new IdentifiableSourceElement(this, parentElement, - (IdentifiableSource) entity, removeListener, style); + element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener, + style); } else if (entity instanceof DefinedTerm) { switch(((DefinedTerm)entity).getTermType()) { case Scope: @@ -2137,23 +2141,20 @@ public class CdmFormFactory extends FormToolkit { } } else if (entity instanceof Reference) { - element = new DescriptionSourceElement(this, parentElement, - (Reference) entity, removeListener, style); + element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style); } else if (entity instanceof NameTypeDesignation) { - element = new NameTypeDesignationElement(this, parentElement, - (NameTypeDesignation) entity, removeListener, style); + element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener, + style); } else if (entity instanceof NameRelationship) { - element = new NameRelationshipDetailElement(this, parentElement, - (NameRelationship) entity, removeListener, style); + element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener, + style); } else if (entity instanceof SpecimenTypeDesignation) { - element = new SpecimenTypeDesignationElement(this, parentElement, - (SpecimenTypeDesignation) entity, removeListener, style); + element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity, + removeListener, style); } else if (entity instanceof StateData) { - element = new StateDataElement(this, parentElement, - (StateData) entity, removeListener, style); + element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style); } else if (entity instanceof StatisticalMeasurementValue) { - element = new StatisticalMeasurementValueElement(this, - parentElement, (StatisticalMeasurementValue) entity, + element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity, removeListener, style); } else if (entity instanceof DerivedUnit) { switch(((DerivedUnit)entity).getRecordBasis()) { @@ -2175,45 +2176,36 @@ public class CdmFormFactory extends FormToolkit { } } else if (entity instanceof NamedArea) { - element = new NamedAreaDetailElement(this, parentElement, - (NamedArea) entity, removeListener, style); + element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style); } else if (entity instanceof DeterminationEvent) { - element = new DeterminationEventDetailElement(this, parentElement, - (DeterminationEvent) entity, removeListener, style); + element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, + removeListener, style); } else if (entity instanceof User) { - element = new MemberDetailElement(this, parentElement, - (User) entity, removeListener, style); + element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style); } else if (entity instanceof GrantedAuthority) { - element = new GrantedAuthorityCollectionElement(this, parentElement, - (GrantedAuthorityImpl) entity, removeListener, style); + element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity, + removeListener, style); } else if (entity instanceof Group) { - element = new GroupsByUserDetailElement(this, parentElement, - (Group) entity, removeListener, style); + element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style); } else if (entity instanceof Taxon) { - element = new TaxonDetailElement(this, parentElement, - (Taxon) entity, removeListener, style); + 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); + 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: " + AbstractUtility.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()) { + else if (backgroundColor != null && !backgroundColor.isDisposed()) { element.setPersistentBackground(backgroundColor); } @@ -2229,16 +2221,20 @@ public class CdmFormFactory extends FormToolkit { *

* Selection elements not handled by this method: *

    - *
  • {@link TaxonNodeSelectionElement} see {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
  • - *
  • {@link NomenclaturalAuthorTeamSelectionElement} see {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
  • + *
  • {@link TaxonNodeSelectionElement} see + * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)} + *
  • + *
  • {@link NomenclaturalAuthorTeamSelectionElement} see + * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)} + *
  • *
*

* * @param clazz - * a {@link Class} object of the type that you want the selection element to handle + * a {@link Class} object of the type that you want the selection + * element to handle * @param parentElement - * a {@link ICdmFormElement} - * object. + * a {@link ICdmFormElement} object. * @param labelString * a {@link String} object. * @param selectionType @@ -2248,35 +2244,32 @@ public class CdmFormFactory extends FormToolkit { * a int. * @param conversation * a {@link ConversationHolder} object. - * @return a - * {@link EntitySelectionElement} - * object. + * @return a {@link EntitySelectionElement} object. */ - public EntitySelectionElement createSelectionElement( - Class clazz, ConversationHolder conversation, - ICdmFormElement parentElement, String labelString, - T selection, int mode, int style) { - EntitySelectionElement element = new EntitySelectionElement(this, conversation, parentElement, clazz, labelString, selection, mode, style); + public EntitySelectionElement createSelectionElement(Class clazz, + ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode, + int style) { + EntitySelectionElement element = new EntitySelectionElement(this, conversation, parentElement, clazz, + labelString, selection, mode, style); adapt(element); parentElement.addElement(element); return element; } - public TaxonNodeSelectionElement createTaxonNodeSelectionElement( - ConversationHolder conversation, - ICdmFormElement parentElement, String labelString, - TaxonNode selection, int mode, int style) { - TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement, labelString, selection, mode, style); + public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation, + ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) { + TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement, + labelString, selection, mode, style); adapt(element); parentElement.addElement(element); return element; } public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement( - ConversationHolder conversation, - ICdmFormElement parentElement, String labelString, - Team selection, int mode, int style) { - NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this, conversation, parentElement, labelString, selection, mode, style); + ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection, + int mode, int style) { + NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this, + conversation, parentElement, labelString, selection, mode, style); adapt(element); parentElement.addElement(element); return element; @@ -2321,34 +2314,31 @@ public class CdmFormFactory extends FormToolkit { * 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); + detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement, + (CategoricalData) entity, style); } else if (entity instanceof CommonTaxonName) { - detailedDescriptionElement = new CommonNameDetailElement(this, - parentElement, (CommonTaxonName) entity, style); + detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity, + style); } else if (entity instanceof Distribution) { - detailedDescriptionElement = new DistributionDetailElement(this, - parentElement, (Distribution) entity, style); + detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity, + style); } else if (entity instanceof IndividualsAssociation) { - detailedDescriptionElement = new IndividualsAssociationDetailElement( - this, parentElement, (IndividualsAssociation) entity, style); + detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement, + (IndividualsAssociation) entity, style); } else if (entity instanceof QuantitativeData) { - detailedDescriptionElement = new QuantitativeDataDetailElement( - this, parentElement, (QuantitativeData) entity, style); + detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement, + (QuantitativeData) entity, style); } else if (entity instanceof TaxonInteraction) { - detailedDescriptionElement = new TaxonInteractionDetailElement( - this, parentElement, (TaxonInteraction) entity, style); + detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement, + (TaxonInteraction) entity, style); } else if (entity instanceof TextData) { - detailedDescriptionElement = new TextDataDetailElement(this, - parentElement, (TextData) entity, style); + detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style); } else { - throw new IllegalStateException( - "There is no interface for the given description element"); + throw new IllegalStateException("There is no interface for the given description element"); } adapt(detailedDescriptionElement); parentElement.addElement(detailedDescriptionElement); @@ -2368,10 +2358,10 @@ 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()); - if (value != null) + 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); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java index 33263074f..878788b31 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.element; @@ -22,201 +22,200 @@ import eu.etaxonomy.taxeditor.preference.Resources; *

* TextWithLabelElement class. *

- * + * * @author n.hoffmann * @version $Id: $ */ -public class TextWithLabelElement extends AbstractCdmFormElement implements - ModifyListener, IEnableableFormElement, ISelectable { - - protected Text text; - private Label label; - - /** Constant MAX_HEIGHT=0 */ - public static final int MAX_HEIGHT = 0; - /** Constant SINGLE=-1 */ - public static final int SINGLE = -1; - - /** - *

- * Constructor for TextWithLabelElement. - *

- * - * @param formFactory - * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} - * object. - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @param labelString - * a {@link java.lang.String} object. - * @param initialText - * a {@link java.lang.String} object. - * @param textHeight - * a {@link java.lang.Integer} object. - * @param style - * a int. - */ - protected TextWithLabelElement(CdmFormFactory formFactory, - ICdmFormElement parentElement, String labelString, - String initialText, Integer textHeight, int style) { - super(formFactory, parentElement); - - if (labelString != null) { - label = formFactory.createLabel(getLayoutComposite(), - CdmUtils.Nz(labelString), SWT.NULL); - addControl(label); - label.setLayoutData(LayoutConstants.LEFT()); - } - - int scrollStyle = textHeight == null ? SWT.NULL - : (SWT.V_SCROLL | SWT.MULTI); - - int combinedStyle = style | SWT.BORDER | scrollStyle; - - //SWT.PASSWORD does not work when SWT.WRAP is set. - if(style != SWT.PASSWORD){ - combinedStyle = combinedStyle | SWT.WRAP; - } - - text = formFactory.createText(getLayoutComposite(), "", combinedStyle); - - addControl(text); - - // text.setWO - - if (textHeight == null) { - text.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.character == SWT.CR) { - // Don't accept carriage returns as input when in single - // line mode - e.doit = false; - } else if (e.character == SWT.TAB) { - // traverse is not working for wrapped text widgets so - // we reintroduce it here - e.doit = false; - TextWithLabelElement.this.text - .traverse(SWT.TRAVERSE_TAB_NEXT); - } - } - }); - } - - TableWrapData layoutData = LayoutConstants.FILL(); - if (textHeight != null && textHeight > 0) { - (layoutData).heightHint = textHeight; - } - - text.setLayoutData(layoutData); - - text.addModifyListener(this); - - setText(initialText); - } - - /** - * Get the text of this composites text composite - * - * @return a {@link java.lang.String} object. - */ - public String getText() { - return text.getText(); - } - - /** - * Set the text of this composites text composite - * - * @param string - * a {@link java.lang.String} object. - */ - public void setText(String string) { - Listener[] listeners = text.getListeners(SWT.Modify); - - for (Listener listener : listeners) { - text.removeListener(SWT.Modify, listener); - } - - text.setText(CdmUtils.Nz(string)); - - for (Listener listener : listeners) { - text.addListener(SWT.Modify, listener); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events - * .ModifyEvent) - */ - /** {@inheritDoc} */ - public void modifyText(ModifyEvent e) { - firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)); - } - - /** {@inheritDoc} */ - public void setEnabled(boolean enabled) { - text.setEnabled(enabled); - String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT - : Resources.COLOR_TEXT_DISABLED; - text.setForeground(getColor(symbolicName)); - } - - /** {@inheritDoc} */ - public void setIrrelevant(boolean irrelevant) { - String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT - : Resources.COLOR_COMPOSITE_BACKGROUND; - - Color color = getColor(colorId); - text.setBackground(color); - } - - /** {@inheritDoc} */ - @Override - public void setBackground(Color color) { - if (label != null) - label.setBackground(color); - } - - @Override - public void setSelected(boolean selected) { - setBackground(selected ? SELECTED : getPersistentBackground()); - } - - /* - * (non-Javadoc) - * - * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus() - */ - /** {@inheritDoc} */ - @Override - public void setFocus() { - text.setFocus(); - } - - /** - *

- * getMainControl - *

- * - * @return a {@link org.eclipse.swt.widgets.Control} object. - */ - public Control getMainControl() { - return text; - } - - /** - *

- * setTextLimit - *

- * - * @param limit - * a int. - */ - public void setTextLimit(int limit) { - text.setTextLimit(limit); - } +public class TextWithLabelElement extends AbstractCdmFormElement implements ModifyListener, IEnableableFormElement, + ISelectable { + + protected Text text; + private Label label; + + /** Constant MAX_HEIGHT=0 */ + public static final int MAX_HEIGHT = 0; + /** Constant SINGLE=-1 */ + public static final int SINGLE = -1; + + /** + *

+ * Constructor for TextWithLabelElement. + *

+ * + * @param formFactory + * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param initialText + * a {@link java.lang.String} object. + * @param textHeight + * a {@link java.lang.Integer} object. + * @param style + * a int. + * @wbp.parser.entryPoint + */ + protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, + String initialText, Integer textHeight, int style) { + super(formFactory, parentElement); + + if (labelString != null) { + label = formFactory.createLabel(getLayoutComposite(), CdmUtils.Nz(labelString), SWT.NULL); + addControl(label); + label.setLayoutData(LayoutConstants.LEFT()); + } + + int scrollStyle = textHeight == null ? SWT.NULL : (SWT.V_SCROLL | SWT.MULTI); + + int combinedStyle = style | SWT.BORDER | scrollStyle; + + // SWT.PASSWORD does not work when SWT.WRAP is set. + if (style != SWT.PASSWORD) { + combinedStyle = combinedStyle | SWT.WRAP; + } + + text = formFactory.createText(getLayoutComposite(), "", combinedStyle); + + addControl(text); + + // text.setWO + + if (textHeight == null) { + text.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.character == SWT.CR) { + // Don't accept carriage returns as input when in single + // line mode + e.doit = false; + } else if (e.character == SWT.TAB) { + // traverse is not working for wrapped text widgets so + // we reintroduce it here + e.doit = false; + TextWithLabelElement.this.text.traverse(SWT.TRAVERSE_TAB_NEXT); + } + } + }); + } + + TableWrapData layoutData = LayoutConstants.FILL(); + if (textHeight != null && textHeight > 0) { + (layoutData).heightHint = textHeight; + } + + text.setLayoutData(layoutData); + + text.addModifyListener(this); + + setText(initialText); + } + + /** + * Get the text of this composites text composite + * + * @return a {@link java.lang.String} object. + */ + public String getText() { + return text.getText(); + } + + /** + * Set the text of this composites text composite + * + * @param string + * a {@link java.lang.String} object. + */ + public void setText(String string) { + Listener[] listeners = text.getListeners(SWT.Modify); + + for (Listener listener : listeners) { + text.removeListener(SWT.Modify, listener); + } + + text.setText(CdmUtils.Nz(string)); + + for (Listener listener : listeners) { + text.addListener(SWT.Modify, listener); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events + * .ModifyEvent) + */ + /** {@inheritDoc} */ + @Override + public void modifyText(ModifyEvent e) { + firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)); + } + + /** {@inheritDoc} */ + @Override + public void setEnabled(boolean enabled) { + text.setEnabled(enabled); + String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED; + text.setForeground(getColor(symbolicName)); + } + + /** {@inheritDoc} */ + @Override + public void setIrrelevant(boolean irrelevant) { + String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND; + + Color color = getColor(colorId); + text.setBackground(color); + } + + /** {@inheritDoc} */ + @Override + public void setBackground(Color color) { + if (label != null) { + label.setBackground(color); + } + } + + @Override + public void setSelected(boolean selected) { + setBackground(selected ? SELECTED : getPersistentBackground()); + } + + /* + * (non-Javadoc) + * + * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus() + */ + /** {@inheritDoc} */ + @Override + public void setFocus() { + text.setFocus(); + } + + /** + *

+ * getMainControl + *

+ * + * @return a {@link org.eclipse.swt.widgets.Control} object. + */ + public Control getMainControl() { + return text; + } + + /** + *

+ * setTextLimit + *

+ * + * @param limit + * a int. + */ + public void setTextLimit(int limit) { + text.setTextLimit(limit); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement2.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement2.java new file mode 100644 index 000000000..8837628b1 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement2.java @@ -0,0 +1,35 @@ +// $Id$ +/** +* Copyright (C) 2013 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.element; + +import org.eclipse.swt.widgets.Composite; + +/** + * @author pplitzner + * @date 11.06.2013 + * + */ +public class TextWithLabelElement2 extends Composite { + + /** + * Create the composite. + * @param parent + * @param style + */ + public TextWithLabelElement2(Composite parent, int style) { + super(parent, style); + + } + + @Override + protected void checkSubclass() { + // Disable the check that prevents subclassing of SWT components + } +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java index ff6292ab6..4704d2b24 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -21,27 +21,24 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; -import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; import eu.etaxonomy.taxeditor.ui.element.IEntityElement; -import eu.etaxonomy.taxeditor.ui.element.ISelectable; /** *

* Abstract AbstractCdmDetailElement class. *

- * + * * @author n.hoffmann * @created Feb 26, 2010 * @version 1.0 */ -public abstract class AbstractCdmDetailElement extends - AbstractCdmFormElement implements IEntityElement, - IEnableableFormElement, IConversationEnabled, ISelectable { +public abstract class AbstractCdmDetailElement extends AbstractCdmFormElement implements IEntityElement, IEnableableFormElement, IConversationEnabled { private T entity; @@ -51,7 +48,7 @@ public abstract class AbstractCdmDetailElement extends *

* Constructor for AbstractCdmDetailElement. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -63,14 +60,14 @@ public abstract class AbstractCdmDetailElement extends */ public AbstractCdmDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) { - super(formFactory, (ICdmFormElement) formElement); + super(formFactory, formElement); // register as property change listener formFactory.addPropertyChangeListener(this); } /** * Sets the entity and updates controls - * + * * @param entity * a T object. */ @@ -81,17 +78,18 @@ public abstract class AbstractCdmDetailElement extends /* * (non-Javadoc) - * + * * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity() */ /** *

* Getter for the field entity. *

- * + * * @return a T object. */ - public T getEntity() { + @Override + public T getEntity() { return entity; } @@ -106,12 +104,13 @@ public abstract class AbstractCdmDetailElement extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.forms.ISelectableComposite#setSelected(boolean) */ /** {@inheritDoc} */ - public void setSelected(boolean selected) { + @Override + public void setSelected(boolean selected) { Composite section = getLayoutComposite().getParent(); section.setBackground(selected ? SELECTED : getPersistentBackground()); } @@ -119,7 +118,7 @@ public abstract class AbstractCdmDetailElement extends /** * Sets all field to the given enablement state except the objects in * collection except - * + * * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#setEnabled(boolean) * @param enabled * a boolean. @@ -143,7 +142,7 @@ public abstract class AbstractCdmDetailElement extends *

* Setter for the field irrelevant. *

- * + * * @param irrelevant * a boolean. * @param except @@ -168,19 +167,21 @@ public abstract class AbstractCdmDetailElement extends } /** {@inheritDoc} */ - public void setEnabled(boolean enabled) { + @Override + public void setEnabled(boolean enabled) { setEnabled(enabled, null); } /** {@inheritDoc} */ - public void setIrrelevant(boolean irrelevant) { + @Override + public void setIrrelevant(boolean irrelevant) { this.irrelevant = irrelevant; setIrrelevant(irrelevant, null); } /** * Create all content elements - * + * * @param formElement * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} * object. @@ -246,7 +247,7 @@ public abstract class AbstractCdmDetailElement extends /** * Gets called when the source of the event is a child widget of this * widget. - * + * * @param eventSource * a {@link java.lang.Object} object. */ @@ -256,7 +257,7 @@ public abstract class AbstractCdmDetailElement extends *

* handleException *

- * + * * @param event * a * {@link eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent} @@ -264,14 +265,14 @@ public abstract class AbstractCdmDetailElement extends */ public void handleException(CdmPropertyChangeEvent event) { // override this in subclasses if you want to deal with the error - StoreUtil.error(event.getSource().getClass(), event.getException()); + AbstractUtility.error(event.getSource().getClass(), event.getException()); } /** *

* isIrrelevant *

- * + * * @return a boolean. */ public boolean isIrrelevant() { @@ -282,11 +283,12 @@ public abstract class AbstractCdmDetailElement extends *

* getConversationHolder *

- * + * * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} * object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { if (getParentElement() instanceof IConversationEnabled) { return ((IConversationEnabled) getParentElement()) .getConversationHolder(); @@ -296,6 +298,7 @@ public abstract class AbstractCdmDetailElement extends } /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) { + @Override + public void update(CdmDataChangeMap changeEvents) { } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java index 0d013aa17..ee222adad 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -17,7 +17,7 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.forms.events.ExpansionEvent; import org.eclipse.ui.forms.events.IExpansionListener; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import org.eclipse.ui.forms.widgets.TableWrapLayout; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; @@ -27,28 +27,25 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; import eu.etaxonomy.taxeditor.ui.element.ISelectableElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; /** - *

- * Abstract AbstractCdmDetailSection class. - *

- * + * This class visualizes an CDM entity of type ENTITY. + * + * @param A CDM entity which should be visualized by this section. + * * @author n.hoffmann * @created Feb 26, 2010 * @version 1.0 */ -public abstract class AbstractCdmDetailSection extends - AbstractFormSection implements IEnableableFormElement, - IExpansionListener { +public abstract class AbstractCdmDetailSection extends AbstractFormSection implements IEnableableFormElement, IExpansionListener { - protected AbstractCdmDetailElement detailElement; + private AbstractCdmDetailElement detailElement; /** *

* Constructor for AbstractCdmDetailSection. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -68,27 +65,26 @@ public abstract class AbstractCdmDetailSection extends public AbstractCdmDetailSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { - super(formFactory, parentElement, selectionProvider, - Section.CLIENT_INDENT | style); - - setText(getHeading()); + this(formFactory, null, conversation, parentElement, selectionProvider, style); + } - addExpansionListener(this); - createControls(this, SWT.NULL); - } - public AbstractCdmDetailSection(CdmFormFactory formFactory, Class clazz, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { super(formFactory, parentElement, selectionProvider, - Section.CLIENT_INDENT | style); - - setText(getHeading()); + ExpandableComposite.CLIENT_INDENT | style); - addExpansionListener(this); + setText(getHeading()); - createControlsByType(this, clazz, SWT.NULL); + addExpansionListener(this); + + if(clazz==null){ + createControls(this, style); + } + else{ + createControlsByType(this, clazz, SWT.NULL); + } } /** @@ -96,9 +92,18 @@ public abstract class AbstractCdmDetailSection extends * @param definedTermClass * @param null1 */ - protected void createControlsByType( - AbstractCdmDetailSection abstractCdmDetailSection, - Class entityClass, int style) { + protected void createControlsByType(AbstractCdmDetailSection formElement, Class entityClass, int style) { + TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout(); + layout.topMargin = 10; + layout.numColumns = 2; + + getLayoutComposite().setLayout(layout); + if(entityClass==null){ + detailElement = createCdmDetailElement(formElement, style); + } + else{ + detailElement = createCdmDetailElementByType(formElement, entityClass, style); + } } @@ -106,7 +111,7 @@ public abstract class AbstractCdmDetailSection extends *

* createControls *

- * + * * @param formElement * a * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection} @@ -114,34 +119,21 @@ public abstract class AbstractCdmDetailSection extends * @param style * a int. */ - protected void createControls(AbstractCdmDetailSection formElement, - int style) { - TableWrapLayout layout = (TableWrapLayout) getLayoutComposite() - .getLayout(); - layout.topMargin = 10; - layout.numColumns = 2; - - getLayoutComposite().setLayout(layout); - detailElement = formFactory.createCdmDetailElement(getDetailType(), - formElement, style); + protected void createControls(AbstractCdmDetailSection formElement, int style) { + createControlsByType(formElement, null, style); } - /** - *

- * getDetailType - *

- * - * @return a - * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType} - * object. - */ - protected abstract DetailType getDetailType(); + protected abstract AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style); + + protected AbstractCdmDetailElement createCdmDetailElementByType(AbstractCdmDetailSection parentElement, Class entityClass, int style){ + return createCdmDetailElement(parentElement, style); + } /** *

* getHeading *

- * + * * @return the heading for this section */ public abstract String getHeading(); @@ -161,7 +153,7 @@ public abstract class AbstractCdmDetailSection extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground * (org.eclipse.swt.graphics.Color) @@ -179,7 +171,7 @@ public abstract class AbstractCdmDetailSection extends *

* setEntity *

- * + * * @param entity * a ENTITY object. */ @@ -228,19 +220,22 @@ public abstract class AbstractCdmDetailSection extends } /** {@inheritDoc} */ - public void setIrrelevant(boolean irrelevant) { + @Override + public void setIrrelevant(boolean irrelevant) { if (detailElement != null) { detailElement.setIrrelevant(irrelevant); } } /** {@inheritDoc} */ - public void expansionStateChanging(ExpansionEvent e) { + @Override + public void expansionStateChanging(ExpansionEvent e) { // logger.warn("Expansion State Changing"); } /** {@inheritDoc} */ - public void expansionStateChanged(ExpansionEvent e) { + @Override + public void expansionStateChanged(ExpansionEvent e) { // logger.warn("Expansion State Changed"); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java index 1a9f43ee5..ecc7c9107 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java @@ -1,11 +1,12 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section; import java.util.Collection; import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; @@ -19,37 +20,42 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.forms.events.ExpansionEvent; import org.eclipse.ui.forms.events.IExpansionListener; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.common.CdmUtils; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.ImageResources; import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.preference.Resources; -import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; /** - *

Abstract AbstractEntityCollectionSection class.

+ * This class visualizes an CDM entity of type ENTITY and additionally provides the functionality to add + * other elements of type ELEMENT to them. + * + * @param A CDM entity which should be visualized by this section. + * @param An element that can be added (multiple times) to this entity. * * @author n.hoffmann * @version $Id: $ */ + public abstract class AbstractEntityCollectionSection extends AbstractFormSection implements IExpansionListener{ - + protected Composite container; - + private Label label_empty; private String title; - + /** *

Constructor for AbstractEntityCollectionSection.

* - * @param conversation + * @param conversation * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. * @param style a int. * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. @@ -58,18 +64,18 @@ public abstract class AbstractEntityCollectionSection extends A * @param a ELEMENT object. */ public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) { - super(formFactory, parentElement, Section.CLIENT_INDENT | style); + super(formFactory, parentElement, ExpandableComposite.CLIENT_INDENT | style); this.title = title; this.setText(getTitleString()); showToolbar(); - + addExpansionListener(this); } - + protected Control createToolbar() { ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); - - Action addAction = new Action("add", Action.AS_PUSH_BUTTON){ + + Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){ /* (non-Javadoc) * @see org.eclipse.jface.action.Action#run() */ @@ -78,34 +84,35 @@ public abstract class AbstractEntityCollectionSection extends A ELEMENT element = createNewElement(); if(element != null){ addElement(element); - if(! getSection().isExpanded()) - getSection().setExpanded(true); + if(! getSection().isExpanded()) { + getSection().setExpanded(true); + } internalUpdateSection(true); } } }; addAction.setImageDescriptor(new ImageDescriptor() { - + @Override public ImageData getImageData() { return ImageResources.getImage(ImageResources.ADD_ICON).getImageData(); } }); addAction.setToolTipText(getTooltipString()); - + toolBarManager.add(addAction); - + return toolBarManager.createControl(this); } - + public void showToolbar(){ setTextClient(createToolbar()); } - + public void removeToolbar(){ setTextClient(null); } - + /** *

setEntity

* @@ -119,8 +126,8 @@ public abstract class AbstractEntityCollectionSection extends A } setSectionTitle(); layout(); - }; - + } + /** * Sets the title for the section. Adds a "+" sign if the collection is not empty for this section. * Override in subclasses if you want to have a different behaviour. @@ -132,7 +139,7 @@ public abstract class AbstractEntityCollectionSection extends A this.setText(getTitleString()); } } - + /** * Removes all content from the container */ @@ -143,7 +150,7 @@ public abstract class AbstractEntityCollectionSection extends A } removeElements(); } - + /** * Call this method after dynamically changing the client area. * If the options changed is set to true, will also fire a state changed @@ -153,57 +160,59 @@ public abstract class AbstractEntityCollectionSection extends A */ protected void internalUpdateSection(boolean changed){ destroyDynamicContent(); - if(isExpanded() || expandSectionWhenContentAvailable()) - renderContent(isExpanded()); - if(changed) - firePropertyChangeEvent(this); + if(isExpanded() || expandSectionWhenContentAvailable()) { + renderContent(isExpanded()); + } + if(changed) { + firePropertyChangeEvent(this); + } } /** - * Create the elements to be shown in this seciton client area + * Create the elements to be shown in this section client area */ private void renderContent(boolean forceExpansion) { Collection elements = getCollection(getEntity()); - + if(elements == null || elements.isEmpty()){ createEmptyContent(); }else{ createDynamicContents(elements); forceExpansion = true; } - + this.setExpanded(forceExpansion); - + reflow(); } - + /** *

createEmptyContent

*/ protected void createEmptyContent(){ label_empty = formFactory.createLabel(getLayoutComposite(), getEmptyString()); } - + /** * Creates the widgets for the collection * * @param elements a {@link java.util.Collection} object. */ protected void createDynamicContents(Collection elements) - { + { int i = 0; for(final ELEMENT element : elements){ SelectionAdapter removeListener = new SelectionAdapter(){ @Override public void widgetSelected(SelectionEvent e) { - removeElement(element); + removeElement(element); internalUpdateSection(true); } }; boolean modulo = i++%2 == 0; String colorResource = modulo ? Resources.COLOR_LIST_EVEN : Resources.COLOR_LIST_ODD; - createElementComposite(element, removeListener, StoreUtil.getColor(colorResource)); + createElementComposite(element, removeListener, AbstractUtility.getColor(colorResource)); } } @@ -217,7 +226,7 @@ public abstract class AbstractEntityCollectionSection extends A protected void createElementComposite(ELEMENT element, SelectionListener removeListener, Color backgroundColor){ formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground(org.eclipse.swt.graphics.Color) */ @@ -238,7 +247,7 @@ public abstract class AbstractEntityCollectionSection extends A public String getTitleString() { return CdmUtils.Nz(title); } - + /** *

setTitleString

* @@ -249,25 +258,27 @@ public abstract class AbstractEntityCollectionSection extends A setSectionTitle(); layout(); } - + /** {@inheritDoc} */ - public void expansionStateChanging(ExpansionEvent e) { + @Override + public void expansionStateChanging(ExpansionEvent e) { // logger.warn("Expansion State Changing"); } - + /** {@inheritDoc} */ - public void expansionStateChanged(ExpansionEvent e) { + @Override + public void expansionStateChanged(ExpansionEvent e) { if(isExpanded()){ renderContent(isExpanded()); }else{ destroyDynamicContent(); } } - + private boolean expandSectionWhenContentAvailable(){ return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE); } - + /** * Get the specific collection of this entity * @@ -275,39 +286,39 @@ public abstract class AbstractEntityCollectionSection extends A * @return a {@link java.util.Collection} object. */ public abstract Collection getCollection(ENTITY entity); - + /** * Create a new Element for this collection * * @return a ELEMENT object. */ public abstract ELEMENT createNewElement(); - + /** * Add an element to the entities collection * * @param element a ELEMENT object. */ public abstract void addElement(ELEMENT element); - + /** * Remove an element from the entities collection * * @param element a ELEMENT object. */ public abstract void removeElement(ELEMENT element); - + /** * String to display when the collection is empty * * @return a {@link java.lang.String} object. */ public abstract String getEmptyString(); - + /** *

getTooltipString

* * @return String to display when hovering the add button */ - protected abstract String getTooltipString(); + protected abstract String getTooltipString(); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionDetailSection.java index bf510748c..11e4a2d99 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.agent.Institution; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -40,19 +40,19 @@ public class InstitutionDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createInstitutionDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionWizardPage.java index 0c0656b63..5f4933cba 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.agent; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.agent.Institution; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -38,19 +35,17 @@ public class InstitutionWizardPage extends super(formFactory, conversation, entity); } - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement - * (eu.etaxonomy.taxeditor.forms.ICdmFormElement) - */ - @Override - public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) { - InstitutionDetailElement detailElement = (InstitutionDetailElement) formFactory - .createCdmDetailElement(DetailType.INSTITUTION, rootElement, - SWT.NULL); - detailElement.setEntity(entity); - return detailElement; - } + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement + * (eu.etaxonomy.taxeditor.forms.ICdmFormElement) + */ + @Override + public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) { + InstitutionDetailElement detailElement = formFactory.createInstitutionDetailElement(rootElement); + detailElement.setEntity(entity); + return detailElement; + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailSection.java index 77e6277e6..7821e7a02 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.agent.Person; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -44,13 +44,15 @@ public class PersonDetailSection extends AbstractCdmDetailSection{ /** {@inheritDoc} */ @Override - protected DetailType getDetailType() { - return DetailType.PERSON; + public String getHeading() { + return "Person"; } - /** {@inheritDoc} */ + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ @Override - public String getHeading() { - return "Person"; + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createPersonDetailElement(parentElement, style); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonWizardPage.java index 75fecc337..51ab6ad03 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonWizardPage.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -17,7 +17,6 @@ import eu.etaxonomy.cdm.model.agent.Person; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; /** @@ -41,15 +40,15 @@ public class PersonWizardPage extends AbstractCdmEntityWizardPage { super(formFactory, conversation, entity); setTitle("Person"); } - - + + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.CdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement) */ /** {@inheritDoc} */ @Override public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) { - PersonDetailElement personElement = (PersonDetailElement) formFactory.createCdmDetailElement(DetailType.PERSON, rootElement, SWT.NULL); + PersonDetailElement personElement = formFactory.createPersonDetailElement(rootElement, SWT.NULL); personElement.setEntity(entity); return personElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamDetailElement.java index 2462dd3c9..f338bc217 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -12,7 +12,7 @@ package eu.etaxonomy.taxeditor.ui.section.agent; import java.util.Arrays; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.agent.Team; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; @@ -20,14 +20,13 @@ import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; /** *

* TeamDetailElement class. *

- * + * * @author n.hoffmann * @created Apr 26, 2010 * @version 1.0 @@ -42,7 +41,7 @@ public class TeamDetailElement extends AbstractIdentifiableEntityDetailElement * Constructor for TeamDetailElement. *

- * + * * @param cdmFormFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -58,23 +57,14 @@ public class TeamDetailElement extends AbstractIdentifiableEntityDetailElement{ /** {@inheritDoc} */ @Override - protected DetailType getDetailType() { - return DetailType.TEAM; + public String getHeading() { + return "Team"; } - /** {@inheritDoc} */ + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ @Override - public String getHeading() { - return "Team"; + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createTeamDetailElement(parentElement, style); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamOrPersonBaseDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamOrPersonBaseDetailSection.java index 77808b23d..578d220b2 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamOrPersonBaseDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamOrPersonBaseDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,9 +16,10 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.agent.Person; import eu.etaxonomy.cdm.model.agent.Team; import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -43,12 +44,6 @@ public class TeamOrPersonBaseDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + AbstractUtility.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for TeamOrPersonBaseDetailSection", null); + //TODO DetailElement missing?? + return null; + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamWizardPage.java index bbabd642a..9016f92c6 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamWizardPage.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -17,14 +17,13 @@ import eu.etaxonomy.cdm.model.agent.Team; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; /** *

* TeamWizardPage class. *

- * + * * @author n.hoffmann * @created Jun 1, 2010 * @version 1.0 @@ -35,7 +34,7 @@ public class TeamWizardPage extends AbstractCdmEntityWizardPage { *

* Constructor for TeamWizardPage. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -55,8 +54,7 @@ public class TeamWizardPage extends AbstractCdmEntityWizardPage { @Override public AbstractCdmDetailElement createElement( ICdmFormElement rootElement) { - TeamDetailElement teamElement = (TeamDetailElement) formFactory - .createCdmDetailElement(DetailType.TEAM, rootElement, SWT.NULL); + TeamDetailElement teamElement = formFactory.createTeamDetailElement(rootElement, SWT.NULL); teamElement.setEntity(entity); return teamElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailSection.java index c3e67fe2e..83eb7ee15 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -27,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class ClassificationDetailSection extends AbstractCdmDetailSection { - + /** *

Constructor for ClassificationDetailSection.

* @@ -42,7 +42,7 @@ public class ClassificationDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createClassificationDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationWizardPage.java index 0f4718268..292916ba5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationWizardPage.java @@ -1,29 +1,26 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.classification; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; /** *

* ClassificationWizardPage class. *

- * + * * @author n.hoffmann * @created 23.06.2009 * @version 1.0 @@ -35,7 +32,7 @@ public class ClassificationWizardPage extends *

* Constructor for ClassificationWizardPage. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -49,24 +46,22 @@ public class ClassificationWizardPage extends ConversationHolder conversation, Classification entity) { super(formFactory, conversation, entity); setTitle("Classification"); - - } - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement - * (eu.etaxonomy.taxeditor.forms.ICdmFormElement) - */ - /** {@inheritDoc} */ - @Override - public ClassificationDetailElement createElement(ICdmFormElement rootElement) { - ClassificationDetailElement detailElement = (ClassificationDetailElement) formFactory - .createCdmDetailElement(DetailType.CLASSIFICATION, rootElement, - SWT.NULL); - detailElement.setEntity(getEntity()); - return detailElement; } - + + /* + * (non-Javadoc) + * + * @see + * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement + * (eu.etaxonomy.taxeditor.forms.ICdmFormElement) + */ + /** {@inheritDoc} */ + @Override + public ClassificationDetailElement createElement(ICdmFormElement rootElement) { + ClassificationDetailElement detailElement = formFactory.createClassificationDetailElement(rootElement); + detailElement.setEntity(getEntity()); + return detailElement; + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailSection.java index 1460d9330..0508372da 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -27,16 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class TaxonNodeDetailSection extends AbstractCdmDetailSection { - - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getDetailType() - */ - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return null; - } - + /** *

Constructor for TaxonNodeDetailSection.

* @@ -60,4 +51,13 @@ public class TaxonNodeDetailSection extends AbstractCdmDetailSection public String getHeading() { return null; } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + //FIXME generic + return formFactory.createTaxonNodeDetailElement(parentElement); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java index 4db6c49fc..4f261d545 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.ui.section.classification; import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.taxon.ITreeNode; @@ -19,13 +18,12 @@ import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; /** *

* TaxonNodeWizardPage class. *

- * + * * @author n.hoffmann * @created Sep 15, 2009 * @version 1.0 @@ -36,7 +34,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage *

* Constructor for TaxonNodeWizardPage. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -54,7 +52,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement * (eu.etaxonomy.taxeditor.forms.ICdmFormElement) @@ -63,9 +61,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage @Override public TaxonNodeDetailElement createElement(ICdmFormElement rootElement) { - TaxonNodeDetailElement detailElement = (TaxonNodeDetailElement) formFactory - .createCdmDetailElement(DetailType.TAXON_NODE, rootElement, - SWT.NULL); + TaxonNodeDetailElement detailElement = formFactory.createTaxonNodeDetailElement(rootElement); detailElement.setEntity(entity); formFactory.addPropertyChangeListener(this); return detailElement; @@ -75,7 +71,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage *

* openInEditor *

- * + * * @return a boolean. */ public boolean openInEditor() { @@ -84,7 +80,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage /* * (non-Javadoc) - * + * * @see * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse * .jface.util.PropertyChangeEvent) @@ -98,7 +94,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage } /** - * + * */ @Override protected void checkComplete() { @@ -119,7 +115,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage *

* Getter for the field parentTreeNode. *

- * + * * @return a {@link eu.etaxonomy.cdm.model.taxon.ITreeNode} object. */ public ITreeNode getParentTreeNode() { @@ -133,7 +129,7 @@ public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage /* * (non-Javadoc) - * + * * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#dispose() */ /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/RefereneEntityDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferenceEntityDetailElement.java similarity index 91% rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/RefereneEntityDetailElement.java rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferenceEntityDetailElement.java index 69b1e1a42..8649289c4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/RefereneEntityDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferenceEntityDetailElement.java @@ -22,12 +22,12 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; * @date Dec 1, 2011 * */ -public class RefereneEntityDetailElement extends AbstractCdmDetailElement{ +public class ReferenceEntityDetailElement extends AbstractCdmDetailElement{ private EntitySelectionElement selection_reference; private TextWithLabelElement text_referenceDetail; - public RefereneEntityDetailElement(CdmFormFactory formFactory, + public ReferenceEntityDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) { super(formFactory, formElement); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferencedEntityDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferencedEntityDetailSection.java index f0ade829c..d9825324d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferencedEntityDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferencedEntityDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,7 +15,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.ReferencedEntityBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -31,15 +31,17 @@ public class ReferencedEntityDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createReferenceEntityDetailElement(parentElement); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java index 569ebb9b7..5cf40dc83 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,8 +15,8 @@ import org.eclipse.jface.viewers.ISelectionProvider; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -40,18 +40,20 @@ public class DescriptionDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createDescriptionDetailElement(parentElement, style); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java index 8f43590dd..2fe958839 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -22,8 +22,8 @@ import eu.etaxonomy.cdm.model.description.TextData; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType; @@ -36,7 +36,7 @@ import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescription */ public class DescriptionElementDetailSection extends AbstractCdmDetailSection { - + /** *

Constructor for DescriptionElementDetailSection.

* @@ -50,19 +50,20 @@ public class DescriptionElementDetailSection extends ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { super(cdmFormFactory, conversation, parentElement, selectionProvider, style); } - - - protected Control createToolbar() { + + + @Override + protected Control createToolbar() { if(! hasSpecificElement()){ return null; } - + ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); - + final String destinationString = (getEntity() instanceof TextData) ? "the specific element" : "free text"; - - final String label = "Change to " + destinationString; - + + final String label = "Change to " + destinationString; + Action addAction = new Action("Change Type", Action.AS_PUSH_BUTTON) { /* (non-Javadoc) * @see org.eclipse.jface.action.Action#run() @@ -73,52 +74,54 @@ public class DescriptionElementDetailSection extends + destinationString + "? Current data will be lost."); if (confirmed) { // FIXME - ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label, + ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label, getEntity(), StoreUtil.getDetailsView(), StoreUtil.getUndoContext()); StoreUtil.executeOperation(operation); } } }; - // TODO enable this once a proper icon has been found + // TODO enable this once a proper icon has been found // addAction.setImageDescriptor(new ImageDescriptor() { -// +// // @Override // public ImageData getImageData() { // return ImageResources.getImage(ImageResources.ADD_ICON).getImageData(); // } // }); addAction.setToolTipText(label); - + toolBarManager.add(addAction); - + return toolBarManager.createControl(this); } - + /** {@inheritDoc} */ @Override public String getHeading() { return "Description Element"; } - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return DetailType.DESCRIPTIONELEMENT; - } - /** {@inheritDoc} */ @Override protected void setSectionTitle() { this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage())); setTextClient(createToolbar()); } - + private boolean hasSpecificElement(){ - return getEntity().getFeature().isSupportsCategoricalData() + return getEntity().getFeature().isSupportsCategoricalData() || getEntity().getFeature().isSupportsCommonTaxonName() || getEntity().getFeature().isSupportsDistribution() || getEntity().getFeature().isSupportsIndividualAssociation() || getEntity().getFeature().isSupportsQuantitativeData() || getEntity().getFeature().isSupportsTaxonInteraction(); } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createDescriptionElementDetailElement(parentElement, style); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java index f82b59c3c..04a0171b1 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -17,8 +17,8 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.media.MediaElement; @@ -47,16 +47,7 @@ public class MediaDetailsSection extends AbstractCdmDetailSection { ISelectionProvider selectionProvider, int style) { super(formFactory, conversation, parentElement, selectionProvider, style); } - - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getDetailType() - */ - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return null; - } - + /** {@inheritDoc} */ @Override protected void createControls(AbstractCdmDetailSection formElement, @@ -64,18 +55,19 @@ public class MediaDetailsSection extends AbstractCdmDetailSection { TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout(); layout.topMargin = 10; layout.numColumns = 2; - + getLayoutComposite().setLayout(layout); - - + + } - + /** *

setEntity

* * @param entity a {@link eu.etaxonomy.cdm.model.media.Media} object. */ - public void setEntity(Media entity) { + @Override + public void setEntity(Media entity) { if(element_media != null){ this.removeElements(); } @@ -94,4 +86,12 @@ public class MediaDetailsSection extends AbstractCdmDetailSection { public String getHeading() { return "Image"; } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return null; + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageSection.java index e073f7e3a..ee928e4e3 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,8 +15,8 @@ import org.eclipse.jface.viewers.ISelectionProvider; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -27,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class NaturalLanguageSection extends AbstractCdmDetailSection { - + /** *

Constructor for NaturalLanguageSection.

* @@ -42,22 +42,21 @@ public class NaturalLanguageSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createNaturalLanguageDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StateDataElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StateDataElement.java index f87cf6f88..94ceb4e99 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StateDataElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StateDataElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -11,7 +11,7 @@ package eu.etaxonomy.taxeditor.ui.section.description; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.common.LanguageString; import eu.etaxonomy.cdm.model.description.State; @@ -23,7 +23,6 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement; /** @@ -34,7 +33,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement; * @version 1.0 */ public class StateDataElement extends AbstractEntityCollectionElement { - + private TermComboElement combo_state; private ModifierSection section_modifiers; private TextWithLabelElement text_modifyingText; @@ -53,22 +52,23 @@ public class StateDataElement extends AbstractEntityCollectionElement SelectionListener removeListener, int style) { super(formFactory, section, entity, removeListener, null, style); } - + /** {@inheritDoc} */ @Override public void setEntity(StateData entity) { this.entity = entity; combo_state.setSelection(entity.getState()); section_modifiers.setEntity(entity); - if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null) - text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText()); + if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null) { + text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText()); + } } /** {@inheritDoc} */ @Override public void createControls(ICdmFormElement element, int style) { combo_state = formFactory.createTermComboElement(State.class, element, "State", null, style); - section_modifiers = (ModifierSection) formFactory.createEntityDetailSection(EntityDetailType.MODIFIER, getConversationHolder(), element, Section.TWISTIE); + section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, ExpandableComposite.TWISTIE); section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); text_modifyingText = formFactory.createTextWithLabelElement(element, "Modifying Text", null, style); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StatisticalMeasurementValueElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StatisticalMeasurementValueElement.java index 714a8a034..012b60180 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StatisticalMeasurementValueElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StatisticalMeasurementValueElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -11,7 +11,7 @@ package eu.etaxonomy.taxeditor.ui.section.description; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.description.StatisticalMeasure; import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue; @@ -21,7 +21,6 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement; /** @@ -33,7 +32,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement; */ public class StatisticalMeasurementValueElement extends AbstractEntityCollectionElement { - + private NumberWithLabelElement number_value; private TermComboElement combo_type; private ModifierSection section_modifiers; @@ -52,7 +51,7 @@ public class StatisticalMeasurementValueElement extends SelectionListener removeListener, int style) { super(formFactory, section, entity, removeListener, null, style); } - + /** {@inheritDoc} */ @Override public void setEntity(StatisticalMeasurementValue entity) { @@ -67,7 +66,7 @@ public class StatisticalMeasurementValueElement extends public void createControls(ICdmFormElement element, int style) { number_value = formFactory.createNumberTextWithLabelElement(element, "Value", 0, style); combo_type = formFactory.createTermComboElement(StatisticalMeasure.class, element, "Statistical Measure", null, style); - section_modifiers = (ModifierSection) formFactory.createEntityDetailSection(EntityDetailType.MODIFIER, getConversationHolder(), element, Section.TWISTIE); + section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, ExpandableComposite.TWISTIE); section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/CategoricalDataDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/CategoricalDataDetailElement.java index 8a65b46b5..9f6ceb849 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/CategoricalDataDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/CategoricalDataDetailElement.java @@ -1,15 +1,14 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.description.detail; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.description.CategoricalData; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection; @@ -23,7 +22,7 @@ public class CategoricalDataDetailElement extends AbstractDetailedDescriptionDet private CheckboxElement checkbox_orderRelevant; private StateDataSection section_stateData; - + /** *

Constructor for CategoricalDataDetailElement.

* @@ -42,11 +41,11 @@ public class CategoricalDataDetailElement extends AbstractDetailedDescriptionDet protected void createControls(ICdmFormElement formElement, CategoricalData entity, int style) { checkbox_orderRelevant = formFactory.createCheckbox(formElement, "Order Relevant", entity.getOrderRelevant(), style); - section_stateData = (StateDataSection) formFactory.createEntityDetailSection(EntityDetailType.STATE_DATA, getConversationHolder(), formElement, Section.TWISTIE | Section.EXPANDED); + section_stateData = formFactory.createStateDataSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); section_stateData.setEntity(entity); section_stateData.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); } - + /** {@inheritDoc} */ @Override public void setEntity(CategoricalData entity) { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/QuantitativeDataDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/QuantitativeDataDetailElement.java index 11cbe80cf..1315a206d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/QuantitativeDataDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/QuantitativeDataDetailElement.java @@ -1,16 +1,15 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.description.detail; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.description.MeasurementUnit; import eu.etaxonomy.cdm.model.description.QuantitativeData; import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection; @@ -25,7 +24,7 @@ public class QuantitativeDataDetailElement extends private TermComboElement combo_mesaurementUnit; private StatisticalMeasurementValueSection section_statisticalMeasurementValues; - + /** *

Constructor for QuantitativeDataDetailElement.

* @@ -44,11 +43,11 @@ public class QuantitativeDataDetailElement extends protected void createControls(ICdmFormElement formElement, QuantitativeData entity, int style) { combo_mesaurementUnit = formFactory.createTermComboElement(MeasurementUnit.class, formElement, "Measurement Unit", entity.getUnit(), style); - section_statisticalMeasurementValues = (StatisticalMeasurementValueSection) formFactory.createEntityDetailSection(EntityDetailType.STATISTICAL_MEASUREMENT_VALUE, getConversationHolder(), formElement, Section.TWISTIE | Section.EXPANDED); + section_statisticalMeasurementValues = formFactory.createStatisticalMeasurementValueSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); section_statisticalMeasurementValues.setEntity(entity); section_statisticalMeasurementValues.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object) */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailSection.java index 84aeb25ec..456fc997f 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.Feature; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -27,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class FeatureDistributionDetailSection extends AbstractCdmDetailSection { - + /** *

Constructor for FeatureDistributionDetailSection.

* @@ -42,22 +42,22 @@ public class FeatureDistributionDetailSection extends AbstractCdmDetailSection parentElement, int style) { + //FIXME generic + return formFactory.createFeatureDistributionDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailWizardPage.java index 47d911def..3fd5b3887 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityDetailWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.grantedAuthority; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; /** @@ -34,7 +31,7 @@ public class GrantedAuthorityDetailWizardPage extends AbstractCdmEntityWizardPag @Override public AbstractCdmDetailElement createElement( ICdmFormElement rootElement) { - GrantedAuthorityDetailElement authorityElement = (GrantedAuthorityDetailElement) formFactory.createCdmDetailElement(DetailType.GRANTEDAUTHORITY, rootElement, SWT.NULL); + GrantedAuthorityDetailElement authorityElement = formFactory.createGrantedAuthorityDetailElement(rootElement); authorityElement.setEntity(getEntity()); return authorityElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java index 9d66d8208..e5543bd34 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -40,19 +40,19 @@ public class GroupDetailSection extends AbstractCdmDetailSection { } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() */ @Override - protected DetailType getDetailType() { - return DetailType.GROUP; + public String getHeading() { + return "Group " + (getEntity() != null ? getEntity().getName() : ""); } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) */ @Override - public String getHeading() { - return "Group " + (getEntity() != null ? getEntity().getName() : ""); + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createGroupDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java index 35a6292a3..15c4f4910 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java @@ -1,23 +1,20 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.group; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; /** @@ -44,7 +41,7 @@ public class GroupDetailWizardPage extends AbstractCdmEntityWizardPage{ @Override public AbstractCdmDetailElement createElement( ICdmFormElement rootElement) { - GroupDetailElement groupElement = (GroupDetailElement) formFactory.createCdmDetailElement(DetailType.GROUP, rootElement, SWT.NULL); + GroupDetailElement groupElement = formFactory.createGroupDetailElement(rootElement); return groupElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailSection.java index 390de78b7..68a5db7d8 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailSection.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.key; @@ -9,7 +9,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.PolytomousKey; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -25,19 +25,19 @@ public class PolytomousKeyDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createPolytomousKeyDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailSection.java index fdfa64709..65c4d636c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailSection.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.key; @@ -9,7 +9,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -23,21 +23,21 @@ public class PolytomousKeyNodeDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createPolytomousKeyNodeDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaElement.java index 1d49eae84..299bd27b4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaElement.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.media; @@ -13,7 +13,6 @@ import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; @@ -25,7 +24,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; *

* MediaElement class. *

- * + * * @author n.hoffmann * @created Nov 17, 2009 * @version 1.0 @@ -41,7 +40,7 @@ public class MediaElement extends AbstractEntityCollectionElement { *

* Constructor for MediaElement. *

- * + * * @param formElement * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} * object. @@ -63,28 +62,19 @@ public class MediaElement extends AbstractEntityCollectionElement { /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite * #createControls(org.eclipse.swt.widgets.Composite, int) */ /** {@inheritDoc} */ - @Override - public void createControls(ICdmFormElement element, int style) { - text_title = formFactory.createLanguageStringWithLabelElement(element, - "Title", null, style); - selection_artist = formFactory - .createSelectionElement(AgentBase.class, - getConversationHolder(), element, "Artist", null, - EntitySelectionElement.ALL, style); - text_description = formFactory.createLanguageStringWithLabelElement( - element, "Description", null, 100, style); - section_mediaRepresentation = (MediaRepresentationSection) formFactory - .createEntityDetailSection( - EntityDetailType.MEDIAREPRESENTATION, - getConversationHolder(), element, style); - section_mediaRepresentation.setLayoutData(LayoutConstants - .FILL_HORIZONTALLY(2, 1)); + @Override + public void createControls(ICdmFormElement element, int style) { + text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style); + selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style); + text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, style); + section_mediaRepresentation = formFactory.createMediaRepresentationSection(getConversationHolder(), element, style); + section_mediaRepresentation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); } /** {@inheritDoc} */ @@ -110,7 +100,7 @@ public class MediaElement extends AbstractEntityCollectionElement { /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent * (java.lang.Object) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java index 0bff02bf3..ae2bbb7ba 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -24,7 +24,6 @@ import eu.etaxonomy.cdm.model.media.MediaRepresentationPart; import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; @@ -58,7 +57,7 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement< int style) { super(cdmFormFactory, section, element, removeListener, null, style); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int) */ @@ -67,7 +66,7 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement< public void createControls(ICdmFormElement element, int style) { text_mimeType = formFactory.createTextWithLabelElement(element, "Mime Type", null, style); text_suffix = formFactory.createTextWithLabelElement(element, "Suffix", null, style); - section_mediaRepresentationPart = (MediaRepresentationPartSection) formFactory.createEntityDetailSection(EntityDetailType.MEDIAREPRESENTATIONPART, getConversationHolder(), element, style); + section_mediaRepresentationPart = formFactory.createMediaRepresentationPartSection(getConversationHolder(), element, style); section_mediaRepresentationPart.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); } @@ -79,7 +78,7 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement< text_mimeType.setText(element.getMimeType()); text_suffix.setText(element.getSuffix()); } - + /* * (non-Javadoc) * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object) @@ -94,15 +93,15 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement< getEntity().setSuffix(text_suffix.getText()); } // FIXME HACK automatically set the mime type to the first mediaRepresentationPart's mimetype - else if(eventSource == section_mediaRepresentationPart){ + else if(eventSource == section_mediaRepresentationPart){ firePropertyChangeEvent(this); - + Collection imageFileElements = section_mediaRepresentationPart.getCollection(section_mediaRepresentationPart.getEntity()); - + if(! imageFileElements.iterator().hasNext()){ - return; + return; } - + MediaRepresentationPart mediaRepresentationPart = imageFileElements.iterator().next(); if(mediaRepresentationPart == null || !(mediaRepresentationPart instanceof ImageFile)){ return; @@ -118,7 +117,7 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement< String mimeType = imageInfo.getMimeType(); text_mimeType.setText(mimeType); getEntity().setMimeType(mimeType); - text_suffix.setText(imageInfo.getSuffix()); + text_suffix.setText(imageInfo.getSuffix()); getEntity().setSuffix(imageInfo.getSuffix()); } catch (IOException e) { StoreUtil.error(getClass(), e); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java index 7fba074cd..66c071ced 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -18,7 +18,7 @@ import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -46,7 +46,7 @@ public class AuthorshipDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createAuthorshipDetailElement(parentElement, style); + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/HybridDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/HybridDetailSection.java index 77fb8fe00..ae1812feb 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/HybridDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/HybridDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -19,7 +19,7 @@ import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -46,7 +46,7 @@ public class HybridDetailSection extends AbstractCdmDetailSection super(formFactory, conversation, parentElement, selectionProvider, style); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.section.ITaxonBaseDetailSection#setTaxonBase(eu.etaxonomy.cdm.model.taxon.TaxonBase) */ @@ -65,14 +65,6 @@ public class HybridDetailSection extends AbstractCdmDetailSection return taxonBase; } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getDetailType() - */ - @Override - protected DetailType getDetailType() { - return DetailType.HYBRID; - } - /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading() */ @@ -88,5 +80,14 @@ public class HybridDetailSection extends AbstractCdmDetailSection protected void setSectionTitle() { setText(getHeading()); } - + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + //FIXME generic + return formFactory.createHybridDetailElement(parentElement); + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailSection.java index 1b18a4562..32315ed8d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -18,7 +18,7 @@ import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -48,7 +48,8 @@ public class NameDetailSection extends AbstractCdmDetailSection im } /** {@inheritDoc} */ - public void setTaxonBase(TaxonBase entity) { + @Override + public void setTaxonBase(TaxonBase entity) { this.taxonBase = entity; NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName()); setEntity(name); @@ -60,19 +61,13 @@ public class NameDetailSection extends AbstractCdmDetailSection im return "Scientific Name"; } - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return DetailType.SCIENTIFICNAME; - } - /** {@inheritDoc} */ @Override protected void setSectionTitle() { if(!isDisposed()){ String title = ""; if(getEntity() != null && (getEntity() instanceof NonViralName)){ - title = ": " + ((NonViralName) getEntity()).getNameCache(); + title = ": " + getEntity().getNameCache(); } this.setText(getHeading() + title); } @@ -85,5 +80,12 @@ public class NameDetailSection extends AbstractCdmDetailSection im public TaxonBase getTaxonBase() { return taxonBase; } - + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createNameDetailElement(parentElement, style); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java index 55662b2d5..d4e17a472 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -12,14 +12,13 @@ package eu.etaxonomy.taxeditor.ui.section.name; import java.util.Arrays; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.name.NomenclaturalCode; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; @@ -28,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement *

* NonViralNameDetailElement class. *

- * + * * @author n.hoffmann * @created May 20, 2010 * @version 1.0 @@ -45,7 +44,7 @@ public class NonViralNameDetailElement extends *

* Constructor for NonViralNameDetailElement. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -60,7 +59,7 @@ public class NonViralNameDetailElement extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls * (eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement, @@ -68,39 +67,27 @@ public class NonViralNameDetailElement extends */ /** {@inheritDoc} */ @Override - protected void createControls(ICdmFormElement formElement, - final NonViralName entity, int style) { - - toggleable_cache = formFactory.createToggleableTextField(formElement, - "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() - || entity.isProtectedFullTitleCache(), style); - - combo_nomenclaturalCode = formFactory - .createEnumComboElement(NomenclaturalCode.class, - formElement, style); - combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode()); - - section_name = (NameDetailSection) formFactory.createCdmDetailSection( - DetailType.SCIENTIFICNAME, getConversationHolder(), - formElement, null, Section.TWISTIE | Section.EXPANDED); - section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); - addControl(section_name); - addElement(section_name); - section_author = (AuthorshipDetailSection) formFactory - .createCdmDetailSection(DetailType.AUTHORSHIP, - getConversationHolder(), formElement, null, - Section.TWISTIE | Section.EXPANDED); - section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); - addControl(section_author); - addElement(section_author); - - section_hybrid = (HybridDetailSection) formFactory.createCdmDetailSection(DetailType.HYBRID, - getConversationHolder(), formElement, null, - Section.TWISTIE); - section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); - addControl(section_hybrid); - addElement(section_hybrid); - } + protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) { + + toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style); + + combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style); + combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode()); + + section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); + section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); + addControl(section_name); + addElement(section_name); + section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); + section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); + addControl(section_author); + addElement(section_author); + + section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE); + section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); + addControl(section_hybrid); + addElement(section_hybrid); + } /** {@inheritDoc} */ @Override @@ -144,7 +131,7 @@ public class NonViralNameDetailElement extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java * .lang.Object) @@ -159,8 +146,9 @@ public class NonViralNameDetailElement extends // initiating the free text name editor getEntity().setProtectedFullTitleCache(false); } else if (eventSource == section_name || eventSource == section_author) { - if (getParentElement() instanceof AbstractCdmDetailSection) - ((AbstractCdmDetailSection) getParentElement()).updateTitle(); + if (getParentElement() instanceof AbstractCdmDetailSection) { + ((AbstractCdmDetailSection) getParentElement()).updateTitle(); + } if (!toggleable_cache.getState()) { toggleable_cache.setText(getEntity().getTitleCache()); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java index 6657d7a74..654a025e4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.ui.section.name; import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.swt.SWT; @@ -20,11 +21,11 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.cdm.model.taxon.TaxonBase; -import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -53,20 +54,21 @@ public class NonViralNameDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createNonViralNameDetailElement(parentElement); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameWizardPage.java index 4603f031d..de04f7c59 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.name; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.name.NonViralName; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -43,15 +40,15 @@ public class NonViralNameWizardPage extends AbstractCdmEntityWizardPage createElement(ICdmFormElement rootElement) { - nameElement = (NonViralNameDetailElement) formFactory.createCdmDetailElement(DetailType.NONVIRALNAME, rootElement, SWT.NULL); + nameElement = formFactory.createNonViralNameDetailElement(rootElement); nameElement.setEntity(entity); return nameElement; } - + /** {@inheritDoc} */ @Override public void dispose() { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionWizardPage.java index 9c9574b31..ba24188ba 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.occurrence.Collection; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -49,14 +46,14 @@ public class CollectionWizardPage extends AbstractCdmEntityWizardPage createElement(ICdmFormElement rootElement) { - CollectionDetailElement collectionDetailElement = (CollectionDetailElement) formFactory.createCdmDetailElement(DetailType.COLLECTION, rootElement, SWT.NULL); + CollectionDetailElement collectionDetailElement = formFactory.createCollectionDetailElement(rootElement); collectionDetailElement.setEntity(entity); return collectionDetailElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java index f95ae13cb..204ab8822 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java @@ -10,7 +10,7 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.MethodNotSupportedByDerivedUnitTypeException; @@ -18,12 +18,11 @@ import eu.etaxonomy.cdm.model.name.NomenclaturalCode; import eu.etaxonomy.cdm.model.name.TaxonNameBase; import eu.etaxonomy.cdm.model.occurrence.PreservationMethod; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.store.CdmStore; -import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; @@ -78,41 +77,30 @@ public class DerivedUnitBaseDetailElement extends /** {@inheritDoc} */ @Override - protected void createControls(ICdmFormElement formElement, - DerivedUnitFacade entity, int style) { + protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) { // Disable for now // text_derivedUnitDefinitions = // formFactory.createTextWithLabelElement(formElement, // "Specimen Definition", // facade.getDerivedUnitDefinition(CdmStore.getDefaultLanguage()), // style); - text_barcode = formFactory.createTextWithLabelElement(formElement, - "Barcode", entity.getBarcode(), style); - text_catalogNumber = formFactory - .createTextWithLabelElement(formElement, "Catalog Number", - entity.getCatalogNumber(), style); + text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style); + text_catalogNumber = formFactory.createTextWithLabelElement(formElement, "Catalog Number", entity.getCatalogNumber(), style); try { - combo_preservationMethod = formFactory.createTermComboElement(PreservationMethod.class, - formElement, "Preservation Method", - entity.getPreservationMethod(), style); + combo_preservationMethod = formFactory.createTermComboElement(PreservationMethod.class, formElement, "Preservation Method", entity.getPreservationMethod(), style); } catch (MethodNotSupportedByDerivedUnitTypeException e) { // we ignore this - StoreUtil.info(e.getMessage()); + AbstractUtility.info(e.getMessage()); } - selection_storedUnder = formFactory - .createSelectionElement(TaxonNameBase.class, - getConversationHolder(), formElement, "Stored Under", - entity.getStoredUnder(), EntitySelectionElement.ALL, - style); + selection_storedUnder = formFactory.createSelectionElement(TaxonNameBase.class, getConversationHolder(), formElement, "Stored Under", entity.getStoredUnder(), EntitySelectionElement.ALL, style); try { - text_exsicatum = formFactory.createTextWithLabelElement( - formElement, "Exsiccatum", entity.getExsiccatum(), style); + text_exsicatum = formFactory.createTextWithLabelElement(formElement, "Exsiccatum", entity.getExsiccatum(), style); } catch (MethodNotSupportedByDerivedUnitTypeException e) { // we ignore this - StoreUtil.info(e.getMessage()); + AbstractUtility.info(e.getMessage()); } // section_duplicates = (SpecimenCollectionDetailSection) formFactory @@ -123,10 +111,7 @@ public class DerivedUnitBaseDetailElement extends // .setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); // section_duplicates.setEntity(entity); - section_source = (SourceCollectionDetailSection) formFactory - .createEntityDetailSection( - EntityDetailType.IDENTIFIABLE_SOURCE_COLLECTION, - getConversationHolder(), formElement, Section.TWISTIE); + section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); section_source.setEntity(entity); } @@ -147,7 +132,7 @@ public class DerivedUnitBaseDetailElement extends getEntity().setPreservationMethod( combo_preservationMethod.getSelection()); } catch (MethodNotSupportedByDerivedUnitTypeException e) { - StoreUtil + AbstractUtility .errorDialog( "MethodNotSupportedByDerivedUnitTypeException", this, @@ -160,7 +145,7 @@ public class DerivedUnitBaseDetailElement extends try { getEntity().setExsiccatum(text_exsicatum.getText()); } catch (Exception e) { - StoreUtil.error(this.getClass(), e); + AbstractUtility.error(this.getClass(), e); } } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailSection.java index 931596b94..4f7448432 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -27,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class DerivedUnitBaseDetailSection extends AbstractCdmDetailSection implements IDerivedUnitFacadeDetailSection{ - + /** *

Constructor for DerivedUnitBaseDetailSection.

* @@ -42,22 +42,21 @@ public class DerivedUnitBaseDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createDerivedUnitBaseDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java index 3524daad5..69b53eb65 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -46,14 +43,14 @@ public class DerivedUnitBaseWizardPage extends AbstractCdmEntityWizardPage createElement(ICdmFormElement rootElement) { - DerivedUnitBaseDetailElement detailElement = (DerivedUnitBaseDetailElement) formFactory.createCdmDetailElement(DetailType.DERIVED_UNIT, rootElement, SWT.NULL); - detailElement.setEntity(getEntity()); + DerivedUnitBaseDetailElement detailElement = formFactory.createDerivedUnitBaseDetailElement(rootElement); + detailElement.setEntity(getEntity()); return detailElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java index dc63ae2e4..501f929d2 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java @@ -1,25 +1,24 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeConfigurator; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; -import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; @@ -32,10 +31,10 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElement { - + private DerivedUnitFacade facade; - private DerivedUnitFacadeConfigurator configurator; + private final DerivedUnitFacadeConfigurator configurator; private GeneralDetailSection section_general; private GatheringEventDetailSection section_gatheringEvent; @@ -55,24 +54,24 @@ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElementGetter for the field facade.

* @@ -113,28 +112,28 @@ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElement { - + /** *

Constructor for DerivedUnitFacadeDetailSection.

* @@ -42,16 +42,18 @@ public class DerivedUnitFacadeDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createDerivedUnitFacadeDetailElement(parentElement); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java index 7fdfd02f1..ea4d184a0 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java @@ -1,21 +1,20 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -27,9 +26,9 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; public class DeterminationDetailElement extends AbstractCdmDetailElement { private CurrentDeterminationDetailSection section_currentDetermination; - + private DeterminationHistoryDetailSection section_determinationHistory; - + /** * @param formFactory * @param formElement @@ -45,21 +44,15 @@ public class DeterminationDetailElement extends AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createDeterminationDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java index 647dc069c..2ed246cd2 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -29,7 +29,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; * @version 1.0 */ public class FieldObservationDetailElement extends AbstractCdmDetailElement { - + private TextWithLabelElement text_ecology; private TextWithLabelElement text_plantDescription; @@ -43,7 +43,7 @@ public class FieldObservationDetailElement extends AbstractCdmDetailElement combo_sex; private TermComboElement combo_lifeStage; - + /** *

Constructor for FieldObservationDetailElement.

* @@ -54,7 +54,7 @@ public class FieldObservationDetailElement extends AbstractCdmDetailElement implements IDerivedUnitFacadeDetailSection{ - + /** *

Constructor for FieldObservationDetailSection.

* @@ -42,16 +42,18 @@ public class FieldObservationDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createFieldObservationDetailElement(parentElement); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationWizardPage.java index 803e71355..5228bdc9e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -46,13 +43,13 @@ public class FieldObservationWizardPage extends AbstractCdmEntityWizardPage createElement(ICdmFormElement rootElement) { - FieldObservationDetailElement detailElement = (FieldObservationDetailElement) formFactory.createCdmDetailElement(DetailType.FIELD_OBSERVATION, rootElement, SWT.NONE); + FieldObservationDetailElement detailElement = formFactory.createFieldObservationDetailElement(rootElement); detailElement.setEntity(getEntity()); return detailElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java index caa6840e2..ec26283ec 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java @@ -1,22 +1,21 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.preference.Resources; -import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; @@ -29,7 +28,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; *

* GatheringEventDetailElement class. *

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

* Constructor for GatheringEventDetailElement. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -76,16 +75,11 @@ public class GatheringEventDetailElement extends // collectingArea - text_collectingMethod = formFactory.createTextWithLabelElement( - formElement, "Collecting Method", entity.getCollectingMethod(), - style); + text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style); // exactLocation - text_gatheringEventDescription = formFactory - .createTextWithLabelElement(formElement, - "Gathering Event Description", - entity.getGatheringEventDescription(), style); + text_gatheringEventDescription = formFactory.createTextWithLabelElement(formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style); element_elevation = formFactory.createGatheringEventUnitElement( formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style); @@ -96,11 +90,8 @@ public class GatheringEventDetailElement extends element_distToWater = formFactory.createGatheringEventUnitElement( formElement, "Dist. To Water : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style); - section_collectingAreas = (CollectingAreasDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.COLLECTING_AREA, - getConversationHolder(), formElement, Section.TWISTIE); - section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY( - 2, 1)); + section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); + section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); section_collectingAreas.setEntity(entity); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailSection.java index 9673eaa0c..44c86337c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -27,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; * @version 1.0 */ public class GatheringEventDetailSection extends AbstractCdmDetailSection implements IDerivedUnitFacadeDetailSection{ - + /** *

Constructor for GatheringEventDetailSection.

* @@ -42,23 +42,22 @@ public class GatheringEventDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createGatheringEventDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java index 54dd833b1..bcfd178d4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -46,13 +43,13 @@ public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage createElement(ICdmFormElement rootElement) { - GatheringEventDetailElement detailElement = (GatheringEventDetailElement) formFactory.createCdmDetailElement(DetailType.GATHERING_EVENT, rootElement, SWT.NULL); + GatheringEventDetailElement detailElement = formFactory.createGatheringEventDetailElement(rootElement); detailElement.setEntity(getEntity()); return detailElement; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java index 30d76a4cf..a5e8583a8 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT - * European Distributed Institute of Taxonomy + * European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu - * + * * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -62,7 +62,7 @@ public class GeneralDetailElement extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int) @@ -82,7 +82,7 @@ public class GeneralDetailElement extends entity.getCountry(), EntitySelectionElement.NOTHING, style); languageText_locality = formFactory .createLanguageStringWithLabelElement(formElement, "Locality", - entity.getLocality(), style); + entity.getLocality(), style); element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style); element_date = formFactory.createTimePeriodElement(formElement, "Date", @@ -102,12 +102,12 @@ public class GeneralDetailElement extends text_accessionNumber = formFactory.createTextWithLabelElement( formElement, "Accession Number", entity.getAccessionNumber(), style); - + } /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java * .lang.Object) @@ -132,7 +132,8 @@ public class GeneralDetailElement extends getEntity().setCollector(selection_collector.getSelection()); } else if (eventSource == text_collectingNumber) { getEntity().setFieldNumber(text_collectingNumber.getText()); - } else if (eventSource == selection_collection) { + } + else if (eventSource == selection_collection) { getEntity().setCollection(selection_collection.getSelection()); } else if (eventSource == text_accessionNumber) { getEntity().setAccessionNumber(text_accessionNumber.getText()); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java index 10c56b57c..d2b3e7276 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -41,19 +41,19 @@ public class GeneralDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createGeneralDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java index 9b1224a0d..700686948 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java @@ -1,22 +1,19 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.occurrence; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -45,13 +42,13 @@ public class GeneralWizardPage extends AbstractCdmEntityWizardPage createElement(ICdmFormElement rootElement) { - GeneralDetailElement detailElement = (GeneralDetailElement) formFactory.createCdmDetailElement(DetailType.DERIVED_UNIT_GENERAL, rootElement, SWT.NULL); + GeneralDetailElement detailElement = formFactory.createGeneralDetailElement(rootElement); detailElement.setEntity(getEntity()); checkComplete(); return detailElement; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java index d9a824f9c..33cd1e7b9 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -19,7 +19,7 @@ import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -48,12 +48,6 @@ public class NomenclaturalReferenceDetailSection extends ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { super(cdmFormFactory, conversation, parentElement, selectionProvider, style); } - - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return DetailType.NOMENCLATURALREFERENCE; - } /** {@inheritDoc} */ @Override @@ -62,12 +56,13 @@ public class NomenclaturalReferenceDetailSection extends } /** {@inheritDoc} */ - public void setTaxonBase(TaxonBase entity) { + @Override + public void setTaxonBase(TaxonBase entity) { this.taxonBase = entity; TaxonNameBase name = (TaxonNameBase) HibernateProxyHelper.deproxy(entity.getName()); setEntity(name); } - + /** {@inheritDoc} */ @Override protected void setSectionTitle() { @@ -76,7 +71,7 @@ public class NomenclaturalReferenceDetailSection extends INomenclaturalReference reference = getEntity().getNomenclaturalReference(); String nomenclaturalCitation = reference.getNomenclaturalCitation(getEntity().getNomenclaturalMicroReference()); title = ": " + nomenclaturalCitation; - } + } this.setText(getHeading() + title); } @@ -87,4 +82,12 @@ public class NomenclaturalReferenceDetailSection extends public TaxonBase getTaxonBase() { return taxonBase; } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createNomenclaturalReferenceDetailElement(parentElement, style); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java index c04bad78f..ec35e1d91 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -20,7 +20,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -32,7 +32,7 @@ import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; * @version 1.0 */ public class ReferenceDetailSection extends AbstractCdmDetailSection implements ITaxonBaseDetailSection{ - + private TaxonBase taxonBase; /** @@ -54,12 +54,13 @@ public class ReferenceDetailSection extends AbstractCdmDetailSection * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#setTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase) */ /** {@inheritDoc} */ - public void setTaxonBase(TaxonBase entity) { + @Override + public void setTaxonBase(TaxonBase entity) { this.taxonBase = entity; NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName()); - + Reference reference = (Reference) HibernateProxyHelper.deproxy(name.getNomenclaturalReference()); - + setEntity(reference); } @@ -73,12 +74,6 @@ public class ReferenceDetailSection extends AbstractCdmDetailSection return "Reference"; } - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return DetailType.REFERENCEBASE; - } - /** {@inheritDoc} */ @Override public void refresh() { @@ -93,5 +88,13 @@ public class ReferenceDetailSection extends AbstractCdmDetailSection public TaxonBase getTaxonBase() { return taxonBase; } - + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createReferenceDetailElement(parentElement, style); + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java index bfd30b9e7..a8bdfe4d0 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,7 +16,6 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.reference.Reference; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler; @@ -42,14 +41,15 @@ public class ReferenceWizardPage extends AbstractCdmEntityWizardPage super(formFactory, conversation, entity); setTitle("Reference"); } - - /* + + /* * (non-Javadoc) * @see eu.etaxonomy.taxeditor.forms.CdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement) */ /** {@inheritDoc} */ - public AbstractCdmDetailElement createElement(ICdmFormElement rootElement){ - ReferenceDetailElement referenceElement = (ReferenceDetailElement) formFactory.createCdmDetailElement(DetailType.REFERENCEBASE, rootElement, SWT.NULL); + @Override + public AbstractCdmDetailElement createElement(ICdmFormElement rootElement){ + ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL); referenceElement.addExceptionHandler(this); referenceElement.setEntity(entity); return referenceElement; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/ParsingMessagesSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/ParsingMessagesSection.java index af0d316cf..bf989c41c 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/ParsingMessagesSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/ParsingMessagesSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -21,7 +21,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.strategy.parser.ParserProblem; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -39,7 +39,7 @@ public class ParsingMessagesSection extends AbstractCdmDetailSectionHEADING_PROBLEM="The name has problems." */ public static final String HEADING_PROBLEM = "The name has problems."; private TaxonBase taxonBase; - + /** *

Constructor for ParsingMessagesSection.

* @@ -53,15 +53,16 @@ public class ParsingMessagesSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + //no detail element + return null; + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailSection.java index 8ba2e3449..e0a5d92eb 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -17,7 +17,7 @@ import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; @@ -50,9 +50,10 @@ public class TaxonBaseDetailSection extends AbstractCdmDetailSection * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#setTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase) */ /** {@inheritDoc} */ - public void setTaxonBase(TaxonBase entity) { + @Override + public void setTaxonBase(TaxonBase entity) { this.taxonBase = entity; - TaxonBase taxonBase = (TaxonBase) HibernateProxyHelper.deproxy(entity); + TaxonBase taxonBase = (TaxonBase) HibernateProxyHelper.deproxy(entity); setEntity(taxonBase); } @@ -62,12 +63,6 @@ public class TaxonBaseDetailSection extends AbstractCdmDetailSection return getEntity() != null ? getEntity().getClass().getSimpleName() : "TaxonBase"; } - /** {@inheritDoc} */ - @Override - protected DetailType getDetailType() { - return DetailType.TAXONBASE; - } - /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase) */ @@ -76,4 +71,12 @@ public class TaxonBaseDetailSection extends AbstractCdmDetailSection return taxonBase; } + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createTaxonBaseDetailElement(parentElement, style); + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailSection.java index 262a9eb57..c787ad00d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,7 +15,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -32,13 +32,16 @@ public class TaxonRelationshipDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createTaxonRelationshipDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailSection.java index e1010d885..a80b492c0 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailSection.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.user; @@ -12,7 +12,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -37,19 +37,18 @@ public class UserDetailSection extends AbstractCdmDetailSection { } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getDetailType() + * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading() */ @Override - protected DetailType getDetailType() { - return DetailType.USER; + public String getHeading() { + return "User " + (getEntity() != null ? getEntity().getUsername() : ""); } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) */ @Override - public String getHeading() { - return "User " + (getEntity() != null ? getEntity().getUsername() : ""); + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createUserDetailElement(parentElement); } - } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailWizardPage.java index 3c82fbe95..972b92dc6 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailWizardPage.java @@ -1,15 +1,12 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.section.user; -import org.eclipse.swt.SWT; - import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; @@ -30,11 +27,11 @@ public class UserDetailWizardPage extends AbstractCdmEntityWizardPage { */ @Override public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) { - UserDetailElement userElement = (UserDetailElement) formFactory.createCdmDetailElement(DetailType.USER, rootElement, SWT.NULL); + UserDetailElement userElement = formFactory.createUserDetailElement(rootElement); userElement.setEntity(getEntity()); return userElement; } - + @Override protected void checkComplete() { boolean hasUsername = getEntity().getUsername() != null; diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailSection.java index 953928966..01b8ce6e5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailSection.java @@ -1,8 +1,8 @@ /** * Copyright (C) 2011 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -14,20 +14,20 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** * UseRecordDetailSection Class - * @author a.theys + * @author a.theys * @created mar 13, 2012 * @version 1.0 */ public class UseRecordDetailSection extends AbstractCdmDetailSection { - + /**Constructor for class UseRecordDetailSection - * + * * @param cdmFormFactory * @param conversation * @param parentElement @@ -38,23 +38,26 @@ public class UseRecordDetailSection extends AbstractCdmDetailSection parentElement, int style) { + return formFactory.createUseRecordDetailElement(parentElement); + } + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailSection.java index 1e3b307c8..b7e482e60 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailSection.java @@ -1,22 +1,21 @@ // $Id$ /** * Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.ui.section.vocabulary; import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.ui.forms.widgets.TableWrapLayout; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.DefinedTermBase; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -28,7 +27,7 @@ public class DefinedTermDetailSection extends Abstrac /** * @param formFactory - * @param definedTermClass + * @param definedTermClass * @param conversation * @param parentElement * @param selectionProvider @@ -41,33 +40,28 @@ public class DefinedTermDetailSection extends Abstrac } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() */ @Override - protected DetailType getDetailType() { - return null; + public String getHeading() { + return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : ""); } - - @Override - protected void createControlsByType( - AbstractCdmDetailSection abstractCdmDetailSection, - Class clazz, int style) { - TableWrapLayout layout = (TableWrapLayout) getLayoutComposite() - .getLayout(); - layout.topMargin = 10; - layout.numColumns = 2; - getLayoutComposite().setLayout(layout); - detailElement = formFactory.createDefinedTermDetailElement(clazz, - abstractCdmDetailSection, style); + //FIXME clean up create element methods + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElementByType(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, java.lang.Class, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElementByType(AbstractCdmDetailSection parentElement, Class entityClass, int style) { + return formFactory.createDefinedTermDetailElement(entityClass, parentElement, style); } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) */ @Override - public String getHeading() { - return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : ""); + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return null; } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java index c8242850f..86082a690 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,7 +15,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.location.NamedArea; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -40,21 +40,20 @@ public class NamedAreaDetailSection extends AbstractCdmDetailSection } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() */ @Override - protected DetailType getDetailType() { - - return DetailType.NAMED_AREA; + public String getHeading() { + + return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : ""); } /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) */ @Override - public String getHeading() { - - return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : ""); + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createNamedAreaDetailElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java index cf6394ef7..69daf2ba7 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,7 +15,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.location.NamedAreaLevel; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -37,20 +37,19 @@ public class NamedAreaLevelDetailSection extends AbstractCdmDetailSection createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createNamedAreaLevelElement(parentElement); } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java index 18f10bf67..767ffb8fe 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -15,7 +15,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.model.common.TermVocabulary; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; /** @@ -40,24 +40,15 @@ public class TermVocabularyDetailSection extends // TODO Auto-generated constructor stub } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType() - */ - @Override - protected DetailType getDetailType() { - - return DetailType.TERM_VOCABULARY; - } - /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading() */ @Override public String getHeading() { - + return "Vocabulary: "+ (getEntity() != null ? getEntity().getLabel() : ""); } - + /* (non-Javadoc) * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#setSectionTitle() */ @@ -65,4 +56,12 @@ public class TermVocabularyDetailSection extends protected void setSectionTitle() { setText(getHeading()); } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) + */ + @Override + protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + return formFactory.createTermVocabularyDetailElement(parentElement); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java index 2a019c07d..57cb79885 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java @@ -1,16 +1,15 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.view; -import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Composite; @@ -36,23 +35,24 @@ import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart; * @created Feb 9, 2010 * @version 1.0 */ -public abstract class AbstractCdmDataViewer extends Viewer implements ISelectionProvider, IConversationEnabled{ - +public abstract class AbstractCdmDataViewer extends Viewer implements IConversationEnabled{ + protected ManagedForm managedForm; protected CdmFormFactory formFactory; protected ScrolledForm scrolledForm; - - private Composite body; - + + private final Composite body; + protected RootElement rootElement; + //TODO: create a super class for this? private Object input; - private AbstractCdmViewPart viewPart; + private final AbstractCdmViewPart viewPart; + - /** *

Constructor for AbstractCdmDataViewer.

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

createFormFactory

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

layout

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

showParts

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

destroySections

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

setFocus

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

reflow

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

removePart

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

addPart

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

getConversationHolder

* * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { return viewPart.getConversationHolder(); } - + /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) {} + @Override + public void update(CdmDataChangeMap changeEvents) {} } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java index 1c4c3e82d..8d1f9ad9d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.view; @@ -7,14 +7,14 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorPart; import eu.etaxonomy.taxeditor.editor.ISecuredEditor; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; -import eu.etaxonomy.taxeditor.store.StoreUtil; /** *

* Abstract AbstractCdmEditorViewPart class. *

- * + * * @author n.hoffmann * @created Sep 21, 2010 * @version 1.0 @@ -23,7 +23,7 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart { /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createPartControl(org * .eclipse.swt.widgets.Composite) @@ -31,47 +31,42 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart { /** {@inheritDoc} */ @Override public void createPartControl(Composite parent) { - super.createPartControl(parent); - } /** *

* getEditor *

- * + * * @return the currently active editor */ public IEditorPart getEditor() { - return StoreUtil.getActiveEditor(); + return AbstractUtility.getActiveEditor(); } - + /** {@inheritDoc} */ @Override public void setFocus() { super.setFocus(); - - if(getEditor() != null && ISecuredEditor.class.isAssignableFrom(getEditor().getClass())){ + + if(getEditor() != null && ISecuredEditor.class.isAssignableFrom(getEditor().getClass())){ boolean doEnable = ((ISecuredEditor)getEditor()).permissionsSatisfied(); setEnabled(doEnable); } - } + } - /** {@inheritDoc} */ - @Override - public void changed(Object object) { - if (part instanceof AbstractCdmViewPart) { - ((AbstractCdmViewPart) part).changed(object); - } else { - IEditorPart editor = getEditor(); - if (editor != null - && editor instanceof IDirtyMarkableSelectionProvider) { - - ((IDirtyMarkableSelectionProvider) editor).changed(object); - - } - } - } + /** {@inheritDoc} */ + @Override + public void changed(Object object) { + if (part instanceof AbstractCdmViewPart) { + ((AbstractCdmViewPart) part).changed(object); + } else { + IEditorPart editor = getEditor(); + if (editor != null && editor instanceof IDirtyMarkableSelectionProvider) { + ((IDirtyMarkableSelectionProvider) editor).changed(object); + } + } + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java index 5535d297e..4d20a88ed 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -28,9 +28,9 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; -import eu.etaxonomy.taxeditor.store.StoreUtil; /** *

Abstract AbstractCdmViewPart class.

@@ -40,40 +40,41 @@ import eu.etaxonomy.taxeditor.store.StoreUtil; * @version 1.0 */ public abstract class AbstractCdmViewPart extends ViewPart implements ISelectionListener, IPostOperationEnabled, IConversationEnabled, IDirtyMarkableSelectionProvider{ - + protected ISelectionService selectionService; public static IStructuredSelection EMPTY_SELECTION = new StructuredSelection(); - + protected IWorkbenchPart part; - + private PageBook pageBook; private Label emptySelectionLabel; private Composite viewerComposite; - + /** {@inheritDoc} */ @Override public void createPartControl(Composite parent) { selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addSelectionListener(this); - + pageBook = new PageBook(parent, SWT.NULL); - createViewerComposite(pageBook); + //create viewerComposite + viewerComposite = new SashForm(pageBook, SWT.HORIZONTAL); createViewer(viewerComposite); - + // Page 2: Nothing selected emptySelectionLabel = new Label(pageBook, SWT.TOP + SWT.LEFT + SWT.WRAP); - + setInitialSelection(); } - + /** - * + * */ private void setInitialSelection() { - selectionChanged(StoreUtil.getActivePart(), getInitialSelection()); + selectionChanged(AbstractUtility.getActivePart(), getInitialSelection()); } /** @@ -84,18 +85,18 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection protected ISelection getInitialSelection() { return selectionService.getSelection(); } - + private void createViewerComposite(Composite parent) { viewerComposite = new SashForm(parent, SWT.HORIZONTAL); } - + /** *

showEmptyPage

*/ public void showEmptyPage(){ pageBook.showPage(emptySelectionLabel); } - + /** *

showViewer

* @@ -103,15 +104,15 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection * @param selection a {@link org.eclipse.jface.viewers.ISelection} object. */ public void showViewer(IWorkbenchPart part, IStructuredSelection selection){ - this.part = part; - + this.part = part; + Object element = selection.getFirstElement(); - + getViewer().setInput(element); - + showViewer(); } - + /** *

getViewer

* @@ -125,53 +126,59 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection public void showViewer(){ pageBook.showPage(viewerComposite); } - + public void setEnabled(boolean enabled){ pageBook.setEnabled(enabled); } - + /** {@inheritDoc} */ @Override public void setFocus() { if(getConversationHolder() != null){ getConversationHolder().bind(); - } - getViewer().getControl().setFocus(); + } + getViewer().getControl().setFocus(); } - + /** *

createViewer

* * @param parent a {@link org.eclipse.swt.widgets.Composite} object. */ public abstract void createViewer(Composite parent); - + /** {@inheritDoc} */ - public boolean postOperation(CdmBase objectAffectedByOperation) { + @Override + public boolean postOperation(CdmBase objectAffectedByOperation) { changed(objectAffectedByOperation); return true; } - + /** {@inheritDoc} */ - public abstract void changed(Object object); - + @Override + public abstract void changed(Object object); + /** *

getConversationHolder

* * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { - if(part != null) - return ((IConversationEnabled) part).getConversationHolder(); - + @Override + public ConversationHolder getConversationHolder() { + if(part != null) { + //FIXME what if part is not an IConversationEnabled? ClassCastException? + return ((IConversationEnabled) part).getConversationHolder(); + } + return null; } - + /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) { - + @Override + public void update(CdmDataChangeMap changeEvents) { + } - + /** {@inheritDoc} */ @Override public void dispose() { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java index 5d884ed61..3ef1c37e7 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -19,11 +19,11 @@ import org.eclipse.ui.IWorkbenchPart; import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.description.Feature; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; +import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; -import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart; -import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; /** *

DetailsViewPart class.

@@ -33,7 +33,7 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; * @version 1.0 */ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartContentHasSupplementalData{ - + /** Constant ID="eu.etaxonomy.taxeditor.editor.forms.det"{trunked} */ public static String ID = "eu.etaxonomy.taxeditor.view.detail"; @@ -43,35 +43,36 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC @Override public void createViewer(Composite parent) { //selectionService.addPostSelectionListener(this); - + viewer = new DetailsViewer(parent, this); getSite().setSelectionProvider(viewer); } /** {@inheritDoc} */ - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if(StoreUtil.getActiveEditor() == null){ + @Override + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + if(AbstractUtility.getActiveEditor() == null){ showEmptyPage(); return; } - + if(part == this){ return; } - + if(!(selection instanceof IStructuredSelection)){ return; } - + IStructuredSelection structuredSelection = (IStructuredSelection) selection; - - if((part instanceof IEditorPart) || (part instanceof AbstractCdmViewPart)) { + + if((part instanceof IEditorPart) || (part instanceof IPartContentHasDetails)) { if(structuredSelection.size() != 1){ showEmptyPage(); return; } - - // do not show details for feature nodes TODO really? + + // do not show details for feature nodes TODO really? if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){ // do show the map for distributions Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature(); @@ -80,30 +81,30 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC return; } } - + showViewer(part, structuredSelection); }else{ - showEmptyPage(); - } + showEmptyPage(); + } } - + /** {@inheritDoc} */ @Override public boolean postOperation(CdmBase objectAffectedByOperation) { - + viewer.setInput(objectAffectedByOperation); - + return super.postOperation(objectAffectedByOperation); } - - + + /** {@inheritDoc} */ @Override public Viewer getViewer() { return viewer; } - + /** {@inheritDoc} */ @Override public void dispose() { @@ -116,7 +117,8 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC * * @return a boolean. */ - public boolean onComplete() { + @Override + public boolean onComplete() { return true; } } 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 2a13d51ae..813e6b782 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 @@ -17,7 +17,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; @@ -44,14 +44,12 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.taxeditor.editor.UsageTermCollection; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.store.CdmStore; -import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.element.RootElement; import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection; import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection; @@ -70,10 +68,8 @@ import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSectio import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection; import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection; import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection; -import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection; import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection; import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection; -import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection; import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection; import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection; @@ -98,10 +94,12 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer; import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; /** - *

- * DetailsViewer class. - *

* + * The DetailsViewer handles the content of the details view ( + * {@link DetailsViewPart}).
+ * Depending on the type of the selected element the section of the details view + * are created. + * * @author n.hoffmann * @created Feb 12, 2010 * @version 1.0 @@ -144,7 +142,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { input = DerivedUnitFacade.NewInstance((DerivedUnit) input, PreferencesUtil.getDerivedUnitConfigurator()); } catch (DerivedUnitFacadeNotSupportedException e) { - StoreUtil.error(getClass(), e); + AbstractUtility.error(getClass(), e); } } super.setInput(input); @@ -153,8 +151,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { @Override protected void markViewPartDirty() { if (getInput() instanceof DerivedUnitFacade) { - getViewPart().changed( - ((DerivedUnitFacade) getInput()).innerDerivedUnit()); + getViewPart().changed(((DerivedUnitFacade) getInput()).innerDerivedUnit()); } super.markViewPartDirty(); @@ -174,34 +171,36 @@ public class DetailsViewer extends AbstractCdmDataViewer { // Too much type checking to decide which detail view to display. // Need to build in a mechanism where navigators / editors are 'aware' // of the corresponding detail viewer. - if (getInput() instanceof TaxonBase) { + Object input = getInput(); + if (input instanceof TaxonBase) { createTaxonSections(rootElement); - } else if (getInput() instanceof NonViralName) { + } else if (input instanceof NonViralName) { createNameSections(rootElement); - } else if (getInput() instanceof Reference) { + } else if (input instanceof Reference) { createReferenceSections(rootElement); - } else if (getInput() instanceof Team) { + } else if (input instanceof Team) { createTeamDetailSection(rootElement); - } else if (getInput() instanceof Person) { + } else if (input instanceof Person) { createPersonDetailSection(rootElement); - } else if (getInput() instanceof TeamOrPersonBase) { + } else if (input instanceof TeamOrPersonBase) { createTeamOrPersonBaseDetailSection(rootElement); - } else if (getInput() instanceof DescriptionBase) { - Set descriptionMarkers = ((DescriptionBase) getInput()).getMarkers(); - MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType); + } else if (input instanceof DescriptionBase) { + Set descriptionMarkers = ((DescriptionBase) input).getMarkers(); + MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find( + UsageTermCollection.uuidUseMarkerType); Boolean isUseDescription = false; for (Marker marker : descriptionMarkers) { if (marker.getMarkerType().equals(useMarkertype)) { isUseDescription = true; } } - if (((DescriptionBase) getInput()).isImageGallery()) { + if (((DescriptionBase) input).isImageGallery()) { createImageGallerySection(rootElement); } else if (isUseDescription) { @@ -210,9 +209,10 @@ public class DetailsViewer extends AbstractCdmDataViewer { createDescriptionSection(rootElement); } - } else if (getInput() instanceof DescriptionElementBase) { - Set descriptionMarkers = ((DescriptionElementBase) getInput()).getInDescription().getMarkers(); - MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType); + } else if (input instanceof DescriptionElementBase) { + Set descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers(); + MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find( + UsageTermCollection.uuidUseMarkerType); Boolean isUseDescription = false; for (Marker marker : descriptionMarkers) { if (marker.getMarkerType().equals(useMarkertype)) { @@ -220,42 +220,35 @@ public class DetailsViewer extends AbstractCdmDataViewer { } } - if (isUseDescription == true && getInput() instanceof CategoricalData ) { + if (isUseDescription == true && input instanceof CategoricalData) { createUseRecordSection(rootElement); - } - else { + } else { createDescriptionElementSection(rootElement); } - } else if (getInput() instanceof Media) { + } else if (input instanceof Media) { createMediaElementSection(rootElement); - } else if (getInput() instanceof DerivedUnitFacade) { + } else if (input instanceof DerivedUnitFacade) { createDerivedUnitBaseElementSection(rootElement); - } else if (getInput() instanceof FeatureNodeContainer) { + } else if (input instanceof FeatureNodeContainer) { createFeatureDistributionSection(rootElement); - } else if (getInput() instanceof PolytomousKey) { + } else if (input instanceof PolytomousKey) { //createPolytomousKeySection(rootElement); - } else if ((getInput() instanceof PolytomousKeyNode) - || (getInput() instanceof PolytomousKeyRelationship)) { + } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) { createPolytomousKeyNodeSection(rootElement); - - } else if (getInput() instanceof User) { + } else if (input instanceof User) { createUserSection(rootElement); - - } else if (getInput() instanceof Group) { + } else if (input instanceof Group) { createGroupSection(rootElement); - - } else if (getInput() instanceof TaxonRelationship) { + } else if (input instanceof TaxonRelationship) { createTaxonRelationshipSection(rootElement); - - } else if (getInput() instanceof TermVocabulary) { + } else if (input instanceof TermVocabulary) { createTermVocabularySection(rootElement); - - } else if (getInput() instanceof DefinedTermBase) { + } else if (input instanceof DefinedTermBase) { createDefinedTermSection(rootElement); } else { destroySections(); @@ -270,18 +263,9 @@ 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 = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED); + MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); + GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(groupDetailSection); addPart(memberDetailSection); @@ -310,65 +294,48 @@ public class DetailsViewer extends AbstractCdmDataViewer { @Override public void setSelection(ISelection selection, boolean reveal) { this.selection = selection; - SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent( - this, selection); + SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection); fireSelectionChanged(selectionChangedEvent); } /** * createTaxonSections(RootElement parent) + * * @param parent */ private void createTaxonSections(RootElement parent) { destroySections(); - TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory - .createCdmDetailSection(DetailType.TAXONBASE, - getConversationHolder(), parent, this, Section.TWISTIE); + TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory - .createCdmDetailSection(DetailType.NONVIRALNAME, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE + | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory - .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, - getConversationHolder(), parent, this, Section.TWISTIE); + NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory - .createEntityDetailSection( - EntityDetailType.NOMENCLATURALSTATUS, - getConversationHolder(), parent, Section.TWISTIE); + NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - ProtologueSection protologSection = (ProtologueSection) formFactory - .createEntityDetailSection(EntityDetailType.PROTOLOG, - getConversationHolder(), parent, Section.TWISTIE); + ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory - .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, - getConversationHolder(), parent, Section.TWISTIE); + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, - getConversationHolder(), parent, Section.TWISTIE); + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory - .createCdmDetailSection(DetailType.PARSINGMESSAGE, - getConversationHolder(), parent, this, Section.EXPANDED); + ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED); addPart(taxonBaseDetailSection); addPart(nonViralNameSection); @@ -382,45 +349,32 @@ public class DetailsViewer extends AbstractCdmDataViewer { /** * createNameSections + * * @param parent */ private void createNameSections(RootElement parent) { destroySections(); - NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory - .createCdmDetailSection(DetailType.NONVIRALNAME, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory - .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, - getConversationHolder(), parent, this, Section.TWISTIE); + NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory - .createEntityDetailSection( - EntityDetailType.NOMENCLATURALSTATUS, - getConversationHolder(), parent, Section.TWISTIE); + NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - ProtologueSection protologSection = (ProtologueSection) formFactory - .createEntityDetailSection(EntityDetailType.PROTOLOG, - getConversationHolder(), parent, Section.TWISTIE); + ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory - .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, - getConversationHolder(), parent, Section.TWISTIE); + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, - getConversationHolder(), parent, Section.TWISTIE); + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -434,85 +388,69 @@ public class DetailsViewer extends AbstractCdmDataViewer { /** * createReferenceSections + * * @param parent */ private void createReferenceSections(RootElement parent) { destroySections(); - ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory - .createCdmDetailSection(DetailType.REFERENCEBASE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(referenceDetailSection); } /** * createTeamOrPersonBaseDetailSection + * * @param parent */ private void createTeamOrPersonBaseDetailSection(RootElement parent) { destroySections(); - TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory - .createCdmDetailSection(DetailType.TEAMORPERSONBASE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(teamOrPersonBaseDetailSection); } /** * createTeamDetailSection + * * @param parent */ private void createTeamDetailSection(RootElement parent) { destroySections(); - TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory - .createCdmDetailSection(DetailType.TEAM, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(teamDetailSection); } /** * createPersonDetailSection + * * @param parent */ private void createPersonDetailSection(RootElement parent) { destroySections(); - PersonDetailSection personDetailSection = (PersonDetailSection) formFactory - .createCdmDetailSection(DetailType.PERSON, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(personDetailSection); } /** * createDescriptionElementSection + * * @param parent */ private void createDescriptionElementSection(RootElement parent) { destroySections(); - DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory - .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory - .createEntityDetailSection( - EntityDetailType.DESCRIPTIONELEMENTSOURCE, - getConversationHolder(), parent, Section.TWISTIE); + DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory - .createEntityDetailSection( - EntityDetailType.DESCRIPTIONELEMENTMEDIA, - getConversationHolder(), parent, Section.TWISTIE); + DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -523,27 +461,20 @@ public class DetailsViewer extends AbstractCdmDataViewer { /** * createDescriptionSection + * * @param parent */ private void createDescriptionSection(RootElement parent) { destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory - .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory - .createCdmDetailSection(DetailType.NATURAL_LANGUAGE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory - .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN, - getConversationHolder(), parent, Section.TWISTIE); + DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -553,9 +484,7 @@ public class DetailsViewer extends AbstractCdmDataViewer { // // formFactory.createHorizontalSeparator(parent, SWT.BORDER); - ScopeSection scopeSection = (ScopeSection) formFactory - .createEntityDetailSection(EntityDetailType.SCOPE, - getConversationHolder(), parent, Section.TWISTIE); + ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -568,21 +497,16 @@ public class DetailsViewer extends AbstractCdmDataViewer { /** * Creates the use Description section + * * @param parent */ private void createUseDescriptionSection(RootElement parent) { destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory - .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory - .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, - getConversationHolder(), parent, Section.TWISTIE - | Section.EXPANDED); + DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -597,64 +521,49 @@ public class DetailsViewer extends AbstractCdmDataViewer { */ private void createImageGallerySection(RootElement parent) { destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory - .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(descriptionDetailSection); } /** * createMediaElementSection + * * @param parent */ private void createMediaElementSection(RootElement parent) { destroySections(); - MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory - .createCdmDetailSection(DetailType.MEDIA, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(mediaDetailSection); } /** * createDerivedUnitBaseElementSection + * * @param parent */ private void createDerivedUnitBaseElementSection(RootElement parent) { destroySections(); - GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory - .createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory - .createCdmDetailSection(DetailType.GATHERING_EVENT, - getConversationHolder(), parent, this, Section.TWISTIE); + GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory - .createCdmDetailSection(DetailType.FIELD_OBSERVATION, - getConversationHolder(), parent, this, Section.TWISTIE); + FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFieldObservationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory - .createCdmDetailSection(DetailType.DERIVED_UNIT, - getConversationHolder(), parent, this, Section.TWISTIE); + DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory - .createCdmDetailSection(DetailType.DETERMINATION, - getConversationHolder(), parent, this, Section.TWISTIE); + DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); addPart(generalDetailSection); addPart(gatheringEventDetailSection); @@ -670,102 +579,44 @@ public class DetailsViewer extends AbstractCdmDataViewer { private void createFeatureDistributionSection(RootElement parent) { destroySections(); - FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory - .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(featureDistributionSection); } - private void createPolytomousKeySection(RootElement parent) { - destroySections(); - - PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory - .createCdmDetailSection(DetailType.POLYTOMOUS_KEY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory - .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory - .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE, - getConversationHolder(), parent, Section.TWISTIE); - - addPart(polytomousKeyDetailSection); - addPart(geographicalScopeDetailSection); - addPart(scopeRestrictionSection); - addPart(taxonomicScopeSection); - } - /** * createPolytomousKeyNodeSection + * * @param parent */ private void createPolytomousKeyNodeSection(RootElement parent) { destroySections(); - PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory - .createCdmDetailSection(DetailType.POLYTOMOUS_KEY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.COMPACT); + PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory - .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); -// formFactory.createHorizontalSeparator(parent, SWT.BORDER); -// -// GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory -// .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE, -// getConversationHolder(), parent, Section.TWISTIE | Section.COMPACT); -// -// formFactory.createHorizontalSeparator(parent, SWT.BORDER); -// -// ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory -// .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION, -// getConversationHolder(), parent, Section.TWISTIE | Section.COMPACT); -// formFactory.createHorizontalSeparator(parent, SWT.BORDER); - TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory - .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE, - getConversationHolder(), parent, Section.TWISTIE | Section.COMPACT); + TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT); addPart(polytomousKeyDetailSection); addPart(polytomousKeyNodeDetailSection); -// addPart(geographicalScopeDetailSection); -// addPart(scopeRestrictionSection); addPart(taxonomicScopeSection); } /** * create the UseRecordSection + * * @param parent */ private void createUseRecordSection(RootElement parent) { destroySections(); - UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory - .createCdmDetailSection(DetailType.USE_RECORD, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -776,20 +627,15 @@ public class DetailsViewer extends AbstractCdmDataViewer { /** * createUserSection + * * @param parent */ private void createUserSection(RootElement parent) { destroySections(); - UserDetailSection userDetailSection = (UserDetailSection) formFactory - .createCdmDetailSection(DetailType.USER, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); - GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, - getConversationHolder(), parent, Section.TWISTIE - | Section.EXPANDED); + GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(userDetailSection); addPart(groupByUserDetailSection); @@ -797,20 +643,15 @@ public class DetailsViewer extends AbstractCdmDataViewer { /** * createTaxonRelationshipSection + * * @param parent */ private void createTaxonRelationshipSection(RootElement parent) { destroySections(); - TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory - .createCdmDetailSection(DetailType.TAXON_RELATIONSHIP, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); - ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory - .createCdmDetailSection(DetailType.REFERENCED_ENTITY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(taxonRelationshipDetailSection); addPart(referencedEntityBaseDetailSection); } @@ -821,24 +662,37 @@ public class DetailsViewer extends AbstractCdmDataViewer { private void createTermVocabularySection(RootElement parent) { destroySections(); - TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory - .createCdmDetailSection(DetailType.TERM_VOCABULARY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(termVocabularyDetailSection); } /** * createDefinedTermSection + * * @param parent */ private void createDefinedTermSection(RootElement parent) { destroySections(); - AbstractFormSection definedTermDetailSection = formFactory - .createDefinedTermDetailSection(getInput().getClass(), - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); + AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); addPart(definedTermDetailSection); } + + private void createFODetailsView(RootElement parent) { + destroySections(); + + GeneralDetailSection generalDetailSection = formFactory.createFOSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFODetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); + + addPart(generalDetailSection); + addPart(gatheringEventDetailSection); + addPart(fieldObservationDetailSection); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java index 28ad2a86c..18e07cb06 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -20,11 +20,10 @@ import org.eclipse.ui.part.EditorPart; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; +import eu.etaxonomy.taxeditor.model.AbstractUtility; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; -import eu.etaxonomy.taxeditor.store.StoreUtil; +import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart; -import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; -import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart; /** @@ -40,7 +39,7 @@ public class SupplementalDataViewPart extends AbstractCdmEditorViewPart { public static final String ID = "eu.etaxonomy.taxeditor.view.supplementalData"; private SupplementalDataViewer viewer; - + /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ @@ -52,36 +51,42 @@ public class SupplementalDataViewPart extends AbstractCdmEditorViewPart { /** {@inheritDoc} */ - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if(StoreUtil.getActiveEditor() == null){ + @Override + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + if(AbstractUtility.getActiveEditor() == null){ showEmptyPage(); return; } - - if(((part instanceof EditorPart) || (part instanceof AbstractCdmViewPart)) && selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + if(!(selection instanceof IStructuredSelection)){ + return; + } + + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + if((part instanceof EditorPart || part instanceof IPartContentHasSupplementalData)) { if(structuredSelection.size() != 1){ showEmptyPage(); return; } - + // do not show supplemental data for feature nodes if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){ showEmptyPage(); return; } - if(structuredSelection.getFirstElement() instanceof DerivedUnitFacade){ + else if(structuredSelection.getFirstElement() instanceof DerivedUnitFacade){ return; } - if(structuredSelection.getFirstElement() instanceof PolytomousKeyNode){ + else if(structuredSelection.getFirstElement() instanceof PolytomousKeyNode){ structuredSelection = new StructuredSelection(((PolytomousKeyNode)structuredSelection.getFirstElement()).getKey()); } showViewer(part, structuredSelection); }else{ - showEmptyPage(); + showEmptyPage(); } } - + /** {@inheritDoc} */ @Override public void dispose() { @@ -101,10 +106,11 @@ public class SupplementalDataViewPart extends AbstractCdmEditorViewPart { * * @return a boolean. */ - public boolean onComplete() { + @Override + public boolean onComplete() { // TODO Auto-generated method stub return false; } - - + + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java index 36a2d9b31..f48949c18 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -16,18 +16,17 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.forms.widgets.ExpandableComposite; import eu.etaxonomy.cdm.model.common.AnnotatableEntity; -import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.common.IdentifiableEntity; import eu.etaxonomy.cdm.model.common.VersionableEntity; import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity; import eu.etaxonomy.taxeditor.model.IElementHasDetails; +import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.RootElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; import eu.etaxonomy.taxeditor.ui.section.media.MediaSection; import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection; import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection; @@ -53,7 +52,7 @@ public class SupplementalDataViewer extends AbstractCdmDataViewer implements ISe private boolean showDebug; - + /** *

Constructor for SupplementalDataViewer.

* @@ -89,22 +88,22 @@ public class SupplementalDataViewer extends AbstractCdmDataViewer implements ISe /** {@inheritDoc} */ @Override protected void showParts() { - - showDebug = PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.SHOW_DEBUG_INFORMATION); - + + showDebug = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_DEBUG_INFORMATION); + Object input; - + if(getInput() instanceof IElementHasDetails){ input = ((IElementHasDetails) getInput()).getData(); }else{ input = getInput(); } - + destroySections(); //1. Headline createHeadlineSection(rootElement); //2. Annotatable entitiy - if(input instanceof AnnotatableEntity){ + if(input instanceof AnnotatableEntity){ createAnnotationSections(rootElement); } //3. Identifiable entity @@ -113,17 +112,17 @@ public class SupplementalDataViewer extends AbstractCdmDataViewer implements ISe } //4. Identifiable media entity if(input instanceof IdentifiableMediaEntity){ - createIdentifiableMediaSections(rootElement); + createIdentifiableMediaSections(rootElement); } //5. Versionable if(input instanceof VersionableEntity){ createVersionSection(rootElement); - } + } //6. CdmBase if(showDebug){ createCdmBaseSection(rootElement); } - + layout(); } @@ -133,86 +132,80 @@ public class SupplementalDataViewer extends AbstractCdmDataViewer implements ISe HeadlineSection headlineSection = formFactory.createHeadlineSection(parent); addPart(headlineSection); } - - private void createAnnotationSections(RootElement parent){ - AnnotationSection annotationSection = (AnnotationSection) - formFactory.createEntityDetailSection(EntityDetailType.ANNOTATION, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - MarkerSection markerSection = (MarkerSection) - formFactory.createEntityDetailSection(EntityDetailType.MARKER, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - addPart(annotationSection); - addPart(markerSection); - } - private void createIdentifiableSections(RootElement parent){ - CreditSection creditSection = (CreditSection) - formFactory.createEntityDetailSection(EntityDetailType.CREDIT, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ExtensionSection extensionSection = (ExtensionSection) - formFactory.createEntityDetailSection(EntityDetailType.EXTENSION, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - RightsSection rightsSection = (RightsSection) - formFactory.createEntityDetailSection(EntityDetailType.RIGHTS, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - SourceSection sourceSection = (SourceSection) - formFactory.createEntityDetailSection(EntityDetailType.SOURCE, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - addPart(creditSection); - addPart(extensionSection); - addPart(rightsSection); - addPart(sourceSection); - - } - - private void createIdentifiableMediaSections(RootElement parent){ - MediaSection mediaSection = (MediaSection) - formFactory.createEntityDetailSection(EntityDetailType.MEDIA, getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - addPart(mediaSection); + private void createAnnotationSections(RootElement parent) { + AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + MarkerSection markerSection = formFactory.createMarkerSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + addPart(annotationSection); + addPart(markerSection); + } + + private void createIdentifiableSections(RootElement parent) { + CreditSection creditSection = formFactory.createCreditSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + ExtensionSection extensionSection = formFactory.createExtensionSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + SourceSection sourceSection = formFactory.createSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + addPart(creditSection); + addPart(extensionSection); + addPart(rightsSection); + addPart(sourceSection); + } - - private void createVersionSection(RootElement parent){ - VersionSection versionSection = formFactory.createVersionSection(parent, Section.NO_TITLE | Section.EXPANDED); + + private void createIdentifiableMediaSections(RootElement parent) { + MediaSection mediaSection = formFactory.createMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + addPart(mediaSection); + } + + private void createVersionSection(RootElement parent){ + VersionSection versionSection = formFactory.createVersionSection(parent, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED); addPart(versionSection); } - + /** * @param rootElement */ private void createCdmBaseSection(RootElement parent) { - - CdmBaseSection cdmBaseSection = formFactory.createCdmBaseSection(parent, Section.NO_TITLE | Section.EXPANDED); + + CdmBaseSection cdmBaseSection = formFactory.createCdmBaseSection(parent, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED); addPart(cdmBaseSection); } - + /* * (non-Javadoc) * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ /** {@inheritDoc} */ - public void selectionChanged(SelectionChangedEvent event) { + @Override + public void selectionChanged(SelectionChangedEvent event) { if(event.getSource() instanceof DetailsViewer){ if(event.getSelection() == CdmFormFactory.EMPTY_SELECTION){ setInput(null); return; } - - IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); setInput(selection.getFirstElement()); } }