eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsContentProvider.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportEditor.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportEditorLineDisplayStrategy.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportSpecimenEditorInput.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/wizard/SpecimenSearchWizard.java -text
+eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/wizard/SpecimenSearchWizardPage.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/test/java/eu/etaxonomy/taxeditor/bulkeditor/Application.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/test/java/eu/etaxonomy/taxeditor/bulkeditor/ApplicationActionBarAdvisor.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/test/java/eu/etaxonomy/taxeditor/bulkeditor/ApplicationWorkbenchAdvisor.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/internal/TaxeditorStorePlugin.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/ComboDefinedTermController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/EntityCollectionElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/EntitySelectionField.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/EntitySelectionFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/LanguageTextFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/NamedAreaFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/NumberFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/PointField.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/PointFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/TextFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/ToggleableTextField.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/ToggleableTextFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/compatibility/ICdmFormElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/compatibility/IEntitySelectionElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationDetailsElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationDetailsElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationDetailsSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationDetailsView.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventDetailsElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventDetailsElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/DerivedUnitDetailsElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/DerivedUnitDetailsElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/DerivedUnitDetailsSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenDetailsElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenDetailsElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenDetailsSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/specimenSearch/SpecimenSearchComposite.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/specimenSearch/SpecimenSearchController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/specimenSearch/SpecimenSearchResultsComposite.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/specimenSearch/SpecimenSearchResultsController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CheckboxElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/GatheringEventUnitElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ICdmFormElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/IEnableableFormElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/IEntityElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/IErrorIntolerableElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractIdentifiableEntityDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/EmptyElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/ICdmDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/ITaxonBaseDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/InstitutionDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitDetailsWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailsWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationGeneralWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailsWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/IDerivedUnitFacadeDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/NamedAreaDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SourceCollectionDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenDetailsWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenGeneralWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/org/eclipse/wb/swt/ResourceManager.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/org/eclipse/wb/swt/SWTResourceManager.java -text
eu.etaxonomy.taxeditor.store/src/main/resources/eu/etaxonomy/cdm/editorApplicationContext.xml -text
eu.etaxonomy.taxeditor.store/src/main/resources/log4j.properties -text
eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/NameProtectTitleCacheTest.java -text
Bundle-Version: 3.3.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
-Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,eu.etaxonomy.taxeditor.annotatedlineeditor.handler,eu.etaxonomy.taxeditor.bulkeditor,eu.etaxonomy.taxeditor.bulkeditor.command,eu.etaxonomy.taxeditor.bulkeditor.handler,eu.etaxonomy.taxeditor.bulkeditor.input,eu.etaxonomy.taxeditor.bulkeditor.internal,eu.etaxonomy.taxeditor.bulkeditor.referencingobjects
+Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
+ eu.etaxonomy.taxeditor.annotatedlineeditor.handler,
+ eu.etaxonomy.taxeditor.bulkeditor,
+ eu.etaxonomy.taxeditor.bulkeditor.command,
+ eu.etaxonomy.taxeditor.bulkeditor.handler,
+ eu.etaxonomy.taxeditor.bulkeditor.input,
+ eu.etaxonomy.taxeditor.bulkeditor.internal,
+ eu.etaxonomy.taxeditor.bulkeditor.referencingobjects,
+ eu.etaxonomy.taxeditor.dataimport,
+ eu.etaxonomy.taxeditor.dataimport.wizard
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.editors,
id="nameeditor.editor"\r
name="Name Editor">\r
</editor>\r
+ <editor\r
+ class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
+ default="false"\r
+ id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
+ name="Data Import Editor">\r
+ </editor>\r
</extension>\r
<extension\r
point="org.eclipse.ui.menus">\r
id="bulkeditor.menus.openmenu"\r
label="Bulk Editor">\r
</menu>\r
+ <menu\r
+ label="Search Specimen">\r
+ </menu>\r
</menuContribution>\r
<menuContribution\r
locationURI="menu:bulkeditor.menus.openmenu">\r
style="push">\r
</command>\r
</menuContribution>\r
+ <menuContribution\r
+ allPopups="false"\r
+ locationURI="popup:eu.etaxonomy.taxeditor.editor.view.media">\r
+ <command\r
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
+ label="Add Derived Unit Media"\r
+ style="push">\r
+ </command>\r
+ <command\r
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
+ label="Add Field Object Media"\r
+ style="push">\r
+ </command>\r
+ </menuContribution>\r
</extension>\r
<extension\r
point="org.eclipse.ui.commands">\r
id="bulkeditor.commands.removemergecandidate"\r
name="Remove as Candidate for Group Merge">\r
</command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"\r
+ id="taxeditor-bulkeditor.command.setMarkerFlag"\r
+ name="Set Marker Flag">\r
+ </command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddDerivedUnitMediaHandler"\r
+ id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
+ name="Add Derived Unit Media">\r
+ </command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddFieldObjectMediaHandler"\r
+ id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
+ name="Add Field Object Media">\r
+ </command>\r
<!--command\r
defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"\r
id="eu.etaxonomy.taxeditor.bulkeditor.command.new"\r
type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
</propertyTester>\r
</extension>\r
- <extension\r
- point="org.eclipse.ui.commands">\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"\r
- id="taxeditor-bulkeditor.command.setMarkerFlag"\r
- name="Set Marker Flag">\r
- </command>\r
- </extension>\r
<extension\r
point="org.eclipse.ui.handlers">\r
<handler\r
name="Bulk Editor">\r
</page>\r
</extension>\r
- <extension\r
- point="org.eclipse.ui.menus">\r
- <menuContribution\r
- allPopups="false"\r
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.media">\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
- label="Add Derived Unit Media"\r
- style="push">\r
- </command>\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
- label="Add Field Object Media"\r
- style="push">\r
- </command>\r
- </menuContribution>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.commands">\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddDerivedUnitMediaHandler"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
- name="Add Derived Unit Media">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AddFieldObjectMediaHandler"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
- name="Add Field Object Media">\r
- </command>\r
- </extension>\r
<extension\r
point="org.eclipse.core.expressions.propertyTesters">\r
<propertyTester\r
id="eu.etaxonomy.taxeditor.view.detail">\r
</showInPart>\r
</perspectiveExtension>\r
+ </extension>\r
+ <extension\r
+ point="org.eclipse.ui.importWizards">\r
+ <wizard\r
+ category="eu.etaxonomy.taxeditor.import.category.cdm"\r
+ class="eu.etaxonomy.taxeditor.dataimport.wizard.SpecimenSearchWizard"\r
+ id="eu.etaxonomy.taxeditor.dataimport.wizard.SpecimenSearchWizard"\r
+ name="Query BioCASE">\r
+ </wizard>\r
</extension>
<!-- start set marker -->\r
\r
// $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.
*/
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.AbstractDocumentProvider;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.dataimport.DataImportSpecimenEditorInput;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
private LineAnnotationModel annotationModel;
private IEntityCreator<?> entityCreator;
-
+
private ILineDisplayStrategy lineDisplayStrategy;
private IEditorInput input;
-
+
/**
* <p>Constructor for AnnotatedLineDocumentProvider.</p>
*
public AnnotatedLineDocumentProvider(IEditorInput input){
this.input = input;
}
-
+
/** {@inheritDoc} */
@Override
public IAnnotationModel getAnnotationModel(Object element) {
if (element == input) {
-
+
// Create model as necessary
if (annotationModel == null) {
annotationModel = new LineAnnotationModel(getLineDisplayStrategy(element));
}
return annotationModel;
}
-
+
return null;
}
-
+
/** {@inheritDoc} */
@Override
protected IAnnotationModel createAnnotationModel(Object element)
public IDocument getDocument(Object element) {
return document;
}
-
+
/** {@inheritDoc} */
@Override
protected IDocument createDocument(Object element) throws CoreException {
-
+
if (element instanceof IEditorInput) {
IEditorInput input = (IEditorInput) element;
document = new Document("");
// IAnnotationModel model = getAnnotationModel(element);
-
+
List<?> entityList = getEntityList(element);
-
+
if(entityList != null){
for (Object entity : entityList) {
try {
createAnnotatedLine(input, entity);
} catch (BadLocationException e) {
- BulkEditorUtil.error(getClass(), "Problems creating annotated line: ", e);
+ AbstractUtility.error(getClass(), "Problems creating annotated line: ", e);
}
- }
+ }
}
-
+
return document;
}
return null;
* @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
*/
protected LineAnnotation createAnnotatedLine(Object element, Object entity) throws BadLocationException {
-
+
Document document = (Document) getDocument(element);
ILineDisplayStrategy lineDisplayStrategy = getLineDisplayStrategy(element);
-
+
LineAnnotation annotation = new LineAnnotation(entity, lineDisplayStrategy);
-
+
// Is document zero length, or is last char in document line delimiter?
int docLength = document.getLength();
boolean useDelimiter = false;
if (useDelimiter) {
document.replace(docLength, 0, document.getDefaultLineDelimiter());
}
-
+
String text;
if (lineDisplayStrategy.isEntityCacheEmpty(entity)) {
text = lineDisplayStrategy.getEmptyCacheMessage(entity);
text += lineDisplayStrategy.getSupplementalText(entity);
docLength = document.getLength();
document.replace(docLength, 0, text);
-
+
Position position = new Position(docLength, text.length());
-
+
IAnnotationModel model = getAnnotationModel(element);
if(model != null){
model.addAnnotation(annotation, position);
}
-
-// lineDisplayStrategy.addDisplayListener(entity,
+
+// lineDisplayStrategy.addDisplayListener(entity,
// new EntityListenerImpl((LineAnnotation) annotation, element));
-//
+//
return annotation;
}
-
-
+
+
/**
* <p>updateLineFromAnnotation</p>
*
* @param annotation a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
*/
public void updateLineFromAnnotation(LineAnnotation annotation) {
-
+
IAnnotationModel model = getAnnotationModel(input);
IDocument document = getDocument(input);
ILineDisplayStrategy lineDisplay = getLineDisplayStrategy(input);
-
+
Object entity = annotation.getEntity();
String text = "";
if (getLineDisplayStrategy(input).isEntityCacheEmpty(entity)) {
text = lineDisplay.getEmptyCacheMessage(entity);
} else {
text = lineDisplay.getText(entity);
- }
+ }
text += lineDisplay.getSupplementalText(entity);
-
+
try {
if (model.getPosition(annotation) == null) {
return;
}
- int offset = model.getPosition(annotation).getOffset();
+ int offset = model.getPosition(annotation).getOffset();
int line = document.getLineOfOffset(offset);
int lineLength = document.getLineLength(document.getLineOfOffset(offset));
if (document.getLineDelimiter(line) != null) {
}
document.replace(offset, lineLength, text);
} catch (BadLocationException e) {
- BulkEditorUtil.error(getClass(), "Problem updating annotated line: " ,e);
+ AbstractUtility.error(getClass(), "Problem updating annotated line: " ,e);
}
}
-
+
/**
- * @param element
+ * @param element
* @return
*/
private List<?> getEntityList(Object element) {
if (element instanceof AbstractBulkEditorInput) {
return ((AbstractBulkEditorInput)element).getModel();
}
+ else if(element instanceof DataImportSpecimenEditorInput){
+ return ((DataImportSpecimenEditorInput) element).getResults();
+ }
return null;
}
protected void doSaveDocument(IProgressMonitor monitor, Object element,
IDocument document, boolean overwrite) throws CoreException {
if (element instanceof AbstractBulkEditorInput) {
-
+
IEntityPersistenceService persistenceService = (AbstractBulkEditorInput) element;
-
+
// Get new containers from annotation model
LineAnnotationModel model = (LineAnnotationModel) getAnnotationModel(element);
Iterator iterator = model.getAnnotationIterator();
continue;
}
if (annotation.isMarkedAsMerged()) {
- persistenceService.merge(annotation.getEntity(), annotation.getMergeTarget()); // merge
+ persistenceService.merge(annotation.getEntity(), annotation.getMergeTarget()); // merge
} else {
// TODO clarify w AM whether this needs to be executed on merged objects
//persistenceService.delete(annotation.getEntity()); // delete
protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
return null;
}
-
+
/** {@inheritDoc} */
@Override
public boolean isModifiable(Object element) {
return true;
}
-
+
/** {@inheritDoc} */
@Override
public boolean isReadOnly(Object element) {
// enables copy & paste
return false;
}
-
+
/**
* <p>Getter for the field <code>entityCreator</code>.</p>
*
ILineDisplayStrategy lineDisplayStrategy, Object element) {
if (element instanceof IEditorInput) {
this.lineDisplayStrategy = lineDisplayStrategy;
- }
+ }
}
-
+
/**
* <p>Getter for the field <code>lineDisplayStrategy</code>.</p>
*
}
return null;
}
-
+
/**
* <p>removeAnnotatedLine</p>
*
LineAnnotation annotation = (LineAnnotation) annotationModel.getAnnotation(entity);
removeAnnotatedLine(annotation);
}
-
+
/**
* <p>removeAnnotatedLine</p>
*
LineAnnotation annotation = (LineAnnotation) annotationModel.getAnnotationAtLine(lineno, document);
removeAnnotatedLine(annotation);
}
-
+
/**
* <p>removeAnnotatedLine</p>
*
if (annotation != null) {
Document document = (Document) getDocument(input);
LineAnnotationModel model = (LineAnnotationModel) getAnnotationModel(input);
-
+
Position position = model.getPosition(annotation);
int offset = position.getOffset();
int length = position.getLength();
-
+
Object entity = annotation.getEntity();
annotation.markAsDeleted();
model.removeAnnotation(annotation);
-
+
// Immediately followed by a delimiter?
int annotationEnd = offset + length;
try {
length += 2;
}
} catch (BadLocationException e1) {
- BulkEditorUtil.error(getClass(), "Problems removing annotated line", e1);
+ AbstractUtility.error(getClass(), "Problems removing annotated line", e1);
}
-
+
try {
document.replace(offset, length, "");
} catch (BadLocationException e) {
- BulkEditorUtil.error(getClass(), "Problems removing annotated line", e);
+ AbstractUtility.error(getClass(), "Problems removing annotated line", e);
}
- }
+ }
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractDocumentProvider#changed(java.lang.Object)
*/
// $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.bulkeditor;
-import java.util.Iterator;
-
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.jface.util.IPropertyChangeListener;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
public static final String ID = "bulkeditor.editor";
private boolean isInitialFocus = true;
-
+
private BulkEditorSearch searchBar = null;
-
+
private IPropertyChangeListener markerPreferenceListener;
/**
@Override
protected void initializeEditor() {
super.initializeEditor();
-
+
/**
* see AbstractTextEditor javadoc for explanation of context menu ids
*/
setEditorContextMenuId("#BulkEditorContext");
// setEntityCreatorService(new BulkEditorEntityCreatorService());
-
+
setLineDisplayStrategy(new BulkEditorLineDisplay(this));
-
+
setSourceViewerConfiguration(new BulkEditorViewerConfiguration(lineDisplayStrategy));
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.ListEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
*/
/** {@inheritDoc} */
- protected ISourceViewer createSourceViewer(Composite parent,
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler, int styles) {
ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
- if (((AbstractBulkEditorInput) getEditorInput()).isMergingEnabled()) {
+ if (getEditorInput().isMergingEnabled()) {
addToggleMergeCandidateListener(ruler.getControl());
}
return viewer;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.AnnotatedLineEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
-
+
if (!(input instanceof AbstractBulkEditorInput)) {
throw new PartInitException("Invalid Input: Must be BulkEditorInput");
}
-
+
super.init(site, input);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite)
*/
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
-
+
parent.setLayout(new GridLayout());
-
+
Composite layoutComposite = new Composite(parent, SWT.NONE);
layoutComposite.setLayout(new GridLayout());
GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
layoutComposite.setLayoutData(gridData);
-
+
// layoutComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
-
-
+
+
searchBar = new BulkEditorSearch(this, layoutComposite, SWT.NONE);
// layoutComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
-
+
super.createPartControl(parent);
-
+
// Set viewer composite to fill grid. Unfortunately it is private and we have to do a little hack here.
for (Control control : parent.getChildren()) {
- if (control instanceof Composite &&
+ if (control instanceof Composite &&
!(control.equals(layoutComposite))) {
control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.editors.text.TextEditor#dispose()
*/
public void setFocus() {
searchBar.setFocus();
- // TODO find a better place to put this - this dialog should be shown after initial contents of
+ // TODO find a better place to put this - this dialog should be shown after initial contents of
// Editor are displayed
if (isInitialFocus) {
displayWarningDialog();
isInitialFocus = false;
}
}
-
+
/**
- *
+ *
*/
private void displayWarningDialog() {
IPreferenceStore prefs = PreferencesUtil.getPreferenceStore();
- if (!prefs.getBoolean(PreferencesUtil.HIDE_BULKEDITOR_INFO)) {
+ if (!prefs.getBoolean(IPreferenceKeys.HIDE_BULKEDITOR_INFO)) {
String msg = "The Bulk Editor allows you to edit objects used to reference other objects, such as names, references, and authors.\n\n" +
"Any changes you make to an object in the Bulk Editor will be displayed wherever the object is used.\n\n" +
"For instance, a reference may be displayed with both a name and a descriptive element. If the reference name is changed here, the display of both the name and the descriptive element will be affected.";
MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm
- (getSite().getShell(), "Bulk Editor", msg, "Do not show this message again",
- false, null, PreferencesUtil.HIDE_BULKEDITOR_INFO);
- if (dialog.getReturnCode() == Window.OK) {
- prefs.setValue(PreferencesUtil.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
+ (getSite().getShell(), "Bulk Editor", msg, "Do not show this message again",
+ false, null, IPreferenceKeys.HIDE_BULKEDITOR_INFO);
+ if (dialog.getReturnCode() == Window.OK) {
+ prefs.setValue(IPreferenceKeys.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
}
}
}
-
+
/**
* @param control
*/
* @param line a int.
*/
public void toggleMergeCandidateAnnotation(int line) {
-
+
IDocument document = getSourceViewer().getDocument();
- LineAnnotationModel model =
+ LineAnnotationModel model =
(LineAnnotationModel) getSourceViewer().getAnnotationModel();
-
+
if(model != null){
Annotation annotation = model.getAnnotationAtLine(line, document);
-
+
if (annotation != null) {
if (annotation.getType().equals(IBulkEditorConstants.TYPE_MERGE_CANDIDATE)) {
model.changeAnnotationType(
}
}
}
-
+
/** {@inheritDoc} */
- public void changed(Object object) {
+ @Override
+ public void changed(Object object) {
// this.dirty = dirty;
AnnotatedLineDocumentProvider p = (AnnotatedLineDocumentProvider) getDocumentProvider();
p.changed(object);
// firePropertyChange(PROP_DIRTY);
}
-
+
/* (non-Javadoc)
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
/** {@inheritDoc} */
public void performSearch(BulkEditorQuery query) {
if (query != null) {
-
+
// TODO check if dirty, prompt save
if (isDirty()) {
- boolean proceed = MessageDialog.openQuestion(getEditorSite().getShell(),
+ boolean proceed = MessageDialog.openQuestion(getEditorSite().getShell(),
"Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
if (proceed) {
doSave(null);
return;
}
}
-
+
getEditorInput().performSearch(query);
-
+
refresh();
-
+
selectFirstItem();
-
+
getSourceViewer().getTextWidget().setFocus();
}
}
-
+
private void selectFirstItem() {
- ITextSelection selection = new TextSelection(0, 0);
+ ITextSelection selection = new TextSelection(0, 0);
getSelectionProvider().setSelection(selection);
}
/**
- *
+ *
*/
public void refresh() {
if(getDocumentProvider().getAnnotationModel(getEditorInput()) != null){
((AnnotationModel) getDocumentProvider().getAnnotationModel(getEditorInput())).removeAllAnnotations();
}
-
+
setInput(getEditorInput());
}
-
+
/** {@inheritDoc} */
@Override
public AbstractBulkEditorInput getEditorInput() {
return (AbstractBulkEditorInput) super.getEditorInput();
}
-
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
+
+ @Override
+ protected void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
menu.remove(ITextEditorActionConstants.SHIFT_RIGHT);
menu.remove(ITextEditorActionConstants.SHIFT_LEFT);
// $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.
*/
* @version 1.0
*/
public class BulkEditorLineDisplay implements ILineDisplayStrategy {
-
+
private BulkEditor editor;
/**
* @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getIcon(java.lang.Object)
*/
/** {@inheritDoc} */
- public Image getIcon(Object entity) {
+ @Override
+ public Image getIcon(Object entity) {
return null;
}
* @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getIndent(java.lang.Object)
*/
/** {@inheritDoc} */
- public int getIndent(Object entity) {
+ @Override
+ public int getIndent(Object entity) {
return 0;
}
* @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getText(java.lang.Object)
*/
/** {@inheritDoc} */
- public String getText(Object entity) {
+ @Override
+ public String getText(Object entity) {
return editor.getEditorInput().getText((ICdmBase) entity);
}
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getSupplementalText(java.lang.Object)
*/
/** {@inheritDoc} */
- public String getSupplementalText(Object entity) {
-
+ @Override
+ public String getSupplementalText(Object entity) {
+
String supplementalText = "";
-
+
AbstractBulkEditorInput input = editor.getEditorInput();
String typeText = input.getTypeText(entity);
-
+
supplementalText += StringUtils.isBlank(typeText) ? "" : String.format(" [%s]", typeText);
-
+
if (entity instanceof IAnnotatableEntity) {
IAnnotatableEntity annotatableEntity = (IAnnotatableEntity) HibernateProxyHelper.deproxy(entity);
Map<MarkerType, Boolean> editMarkerTypePreferences = PreferencesUtil.getEditMarkerTypePreferences();
-
+
String markerText = "";
List<String> markers = new ArrayList<String>();
for (Marker marker : annotatableEntity.getMarkers()) {
if (! markers.isEmpty()) {
markerText = StringUtils.join(markers, ", ");
}
-
+
supplementalText += StringUtils.isBlank(markerText) ? "" : String.format(" [%s]", markerText);
}
-
+
return supplementalText;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#setText(java.lang.String, java.lang.Object)
*/
/** {@inheritDoc} */
- public void setText(String text, Object entity) {
+ @Override
+ public void setText(String text, Object entity) {
if (entity instanceof Reference) {
- ((Reference) entity).setTitleCache(text);
+ ((Reference) entity).setTitleCache(text);
}
}
* @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getHoverText(java.lang.Object)
*/
/** {@inheritDoc} */
- public String getHoverText(Object entity) {
+ @Override
+ public String getHoverText(Object entity) {
return null;
}
* @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#setStatusMessage(java.lang.String, java.lang.Object)
*/
/** {@inheritDoc} */
- public void setStatusMessage(final String text, Object entity) {
-
+ @Override
+ public void setStatusMessage(final String text, Object entity) {
+
// Calling from the synchronized method ListEditorReconcilingStrategy#doReconcile
// without its own thread causes an invalid thread access exception
// see http://wiki.eclipse.org/FAQ_Why_do_I_get_an_invalid_thread_access_exception%3F
new Thread(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
Display.getDefault().asyncExec(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
IStatusLineManager statusLineManager = editor.getEditorSite().getActionBars().getStatusLineManager();
statusLineManager.setMessage(text);
}
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getEmptyText(java.lang.Object)
*/
/** {@inheritDoc} */
- public String getEmptyCacheMessage(Object entity) {
+ @Override
+ public String getEmptyCacheMessage(Object entity) {
if (entity instanceof Reference) {
return "No reference title cache";
}
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#isEntityCacheEmpty(java.lang.Object)
*/
/** {@inheritDoc} */
- public boolean isEntityCacheEmpty(Object entity) {
+ @Override
+ public boolean isEntityCacheEmpty(Object entity) {
if (entity instanceof Reference) {
String text = ((Reference) entity).getTitleCache();
return (text == null || text.equals(""));
}
if (entity instanceof TaxonNameBase) {
- String text = ((TaxonNameBase) entity).getTitleCache();
+ String text = ((TaxonNameBase) entity).getTitleCache();
return (text == null || text.equals(""));
}
if (entity instanceof AgentBase) {
- String text = ((AgentBase) entity).getTitleCache();
+ String text = ((AgentBase) entity).getTitleCache();
return (text == null || text.equals(""));
}
return false;
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#addDisplayListener(java.lang.Object)
*/
/** {@inheritDoc} */
- public void addDisplayListener(Object entity, EntityListener listener) {
- /* Note: all non-field specific listeners require that corresponding property sheets
+ @Override
+ public void addDisplayListener(Object entity, EntityListener listener) {
+ /* Note: all non-field specific listeners require that corresponding property sheets
* contain the following:
- *
- *
+ *
+ *
* public void setPropertyValue(Object id, Object value) {
* ...
* reference.firePropertyChange(new PropertyChangeEvent(reference, "", null, null));
* }
- *
+ *
*/
if (entity instanceof CdmBase) {
((CdmBase) entity).addPropertyChangeListener(listener);
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getFont(java.lang.Object)
*/
/** {@inheritDoc} */
- public Font getFont(Object entity) {
+ @Override
+ public Font getFont(Object entity) {
return null;
}
}
// $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.
*/
public class DynamicNewObjectMenu extends CompoundContributionItem {
private static final Logger logger = Logger
.getLogger(DynamicNewObjectMenu.class);
-
+
private IHandlerService handlerService = (IHandlerService) BulkEditorUtil.getService(IHandlerService.class);
private Map<Object, String> classLabelPairs;
/* (non-Javadoc)
/** {@inheritDoc} */
@Override
protected IContributionItem[] getContributionItems() {
-
+
classLabelPairs = getClassLabelPairs();
-
+
return new IContributionItem[] {
new ContributionItem() {
- public void fill(Menu menu, int index){
+ @Override
+ public void fill(Menu menu, int index){
for(final Object key : classLabelPairs.keySet()){
createMenuItem(menu, key);
- }
+ }
}
}
};
menuItem.setText(classLabelPairs.get(key));
menuItem.addSelectionListener(new SelectionListener(){
- public void widgetDefaultSelected(SelectionEvent e) {}
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {}
- public void widgetSelected(SelectionEvent ev) {
+ @Override
+ public void widgetSelected(SelectionEvent ev) {
Event event = new Event();
event.data = key;
event.text = classLabelPairs.get(key);
logger.error("Error executing command", e);
throw new RuntimeException("Error executing command", e);
}
- }
+ }
});
//FIXME:3.3MC Need corresponding Details Viewer section for FieldUnit
menuItem.setEnabled(false);
}
}
-
+
/**
* Get class label pairs from Annotated Line Editor's entity creator.
* @return
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor != null){
IEditorInput input = editor.getEditorInput();
-
+
if(input instanceof AbstractBulkEditorInput){
IEntityCreator<?> entityCreator = ((AbstractBulkEditorInput) input).getEntityCreator();
return entityCreator.getKeyLabelPairs();
}
}
-
+
return null;
- }
+ }
}
// $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.
*/
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
+import eu.etaxonomy.taxeditor.dataimport.DataImportEditor;
/**
* <p>
* OpenBulkEditorContributionItem class.
* </p>
- *
+ *
* @author p.ciardelli
* @created 19.08.2009
* @version 1.0
*/
public class OpenBulkEditorContributionItem extends CompoundContributionItem {
- /**
- * <p>
- * Constructor for OpenBulkEditorContributionItem.
- * </p>
- */
- public OpenBulkEditorContributionItem() {
- }
+ /**
+ * <p>
+ * Constructor for OpenBulkEditorContributionItem.
+ * </p>
+ */
+ public OpenBulkEditorContributionItem() {
+ }
- /**
- * <p>
- * Constructor for OpenBulkEditorContributionItem.
- * </p>
- *
- * @param id
- * a {@link java.lang.String} object.
- */
- public OpenBulkEditorContributionItem(String id) {
- super(id);
- }
+ /**
+ * <p>
+ * Constructor for OpenBulkEditorContributionItem.
+ * </p>
+ *
+ * @param id
+ * a {@link java.lang.String} object.
+ */
+ public OpenBulkEditorContributionItem(String id) {
+ super(id);
+ }
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
- */
- /** {@inheritDoc} */
- @Override
- protected IContributionItem[] getContributionItems() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected IContributionItem[] getContributionItems() {
- List<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
+ List<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
- contributionItems.add(BulkEditorInputType.AGENT.createContributionItem());
- contributionItems.add(BulkEditorInputType.REFERENCE.createContributionItem());
- contributionItems.add(new Separator("test"));
- contributionItems.add(BulkEditorInputType.NAME.createContributionItem());
- contributionItems.add(BulkEditorInputType.NAME_RELATIONSHIP.createContributionItem());
- contributionItems.add(new Separator("test"));
- contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem());
- contributionItems.add(new Separator("test"));
- contributionItems.add(BulkEditorInputType.USER.createContributionItem());
- contributionItems.add(BulkEditorInputType.GROUP.createContributionItem());
+ contributionItems.add(BulkEditorInputType.AGENT.createContributionItem());
+ contributionItems.add(BulkEditorInputType.REFERENCE.createContributionItem());
+ String groupName = "test";
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.NAME.createContributionItem());
+ contributionItems.add(BulkEditorInputType.NAME_RELATIONSHIP.createContributionItem());
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem());
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.USER.createContributionItem());
+ contributionItems.add(BulkEditorInputType.GROUP.createContributionItem());
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(createContributionItem("Search Specimen", DataImportEditor.ID));
- return contributionItems
- .toArray(new IContributionItem[contributionItems.size()]);
- }
+ return contributionItems.toArray(new IContributionItem[contributionItems.size()]);
+ }
- /**
- * @param key
- * @param object
- * @return
- */
- private IContributionItem createContributionItem(String label,
- String inputType) {
- CommandContributionItemParameter parameter = new CommandContributionItemParameter(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null,
- IBulkEditorConstants.DYNAMIC_OPEN_MENU_ID, SWT.NONE);
+ /**
+ * @param key
+ * @param object
+ * @return
+ */
+ private IContributionItem createContributionItem(String label, String inputType) {
+ CommandContributionItemParameter parameter = new CommandContributionItemParameter(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null, IBulkEditorConstants.DYNAMIC_OPEN_MENU_ID, SWT.NONE);
- parameter.label = label;
+ parameter.label = label;
- Map parameters = new HashMap();
- parameters.put(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID, inputType);
- parameter.parameters = parameters;
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID, inputType);
+ parameter.parameters = parameters;
- return new CommandContributionItem(parameter);
- }
+ return new CommandContributionItem(parameter);
+ }
}
// $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.
*/
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.strategy.merge.IMergable;
import eu.etaxonomy.cdm.strategy.merge.MergeException;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.CdmBaseSortProvider;
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.TitleCacheComparator;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEditorInput, IEntityPersistenceService<T> {
/**
- *
+ *
*/
private static final long serialVersionUID = 416414530232743735L;
private UUID entityUuid;
private List<T> model;
-
+
private IEntityCreator<T> entityCreator;
-
+
/**
* <p>NewInstance</p>
*
static public AbstractBulkEditorInput NewInstance(BulkEditorInputType inputType) {
return BulkEditorInputType.getInput(inputType);
}
-
+
/**
* <p>NewInstance</p>
*
* @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
*/
public static AbstractBulkEditorInput NewInstance(IdentifiableEntity entity) {
-
-
+
+
BulkEditorInputType inputType = BulkEditorInputType.getByType(entity.getClass());
-
+
AbstractBulkEditorInput editorInput = NewInstance(inputType);
-
+
editorInput.setEntityUuid(entity.getUuid());
-
+
return editorInput;
}
-
+
/**
* <p>listEntities</p>
*
* @return a {@link java.util.List} object.
*/
protected abstract List<T> listEntities(IIdentifiableEntityServiceConfigurator configurator);
-
+
/**
* <p>loadEntity</p>
*
private void setEntityUuid(UUID entityUuid){
this.entityUuid = entityUuid;
}
-
+
/**
* <p>Getter for the field <code>entityUuid</code>.</p>
*
return entityUuid;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#exists()
*/
*
* @return a boolean.
*/
- public boolean exists() {
+ @Override
+ public boolean exists() {
// TODO Auto-generated method stub
return false;
}
*
* @return a {@link org.eclipse.jface.resource.ImageDescriptor} object.
*/
- public ImageDescriptor getImageDescriptor() {
+ @Override
+ public ImageDescriptor getImageDescriptor() {
// TODO Auto-generated method stub
return null;
}
*
* @return a {@link org.eclipse.ui.IPersistableElement} object.
*/
- public IPersistableElement getPersistable() {
+ @Override
+ public IPersistableElement getPersistable() {
return null;
}
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
/** {@inheritDoc} */
- @SuppressWarnings("unchecked")
+ @Override
+ @SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
return null;
}
* @param bulkEditorQuery a {@link eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorQuery} object.
*/
public void performSearch(final BulkEditorQuery bulkEditorQuery) {
-
+
List<T> entityList = new ArrayList<T>();
-
+
if(getEntityUuid() != null){
-
+
T entity = loadEntity(getEntityUuid());
entityList.add(entity);
model = entityList;
}
else if(bulkEditorQuery != null){
-
- String queryString = bulkEditorQuery.getSearchString();
+
IIdentifiableEntityServiceConfigurator configurator = bulkEditorQuery.getSearchConfigurator();
Comparator queryComparator = (bulkEditorQuery.getComparator() != null) ? bulkEditorQuery.getComparator() : new TitleCacheComparator();
-
+
entityList = listEntities(configurator);
-
- Collections.sort(entityList, queryComparator);
-
+
+ Collections.sort(entityList, queryComparator);
+
}
-
+
model = entityList;
}
-
+
/**
* <p>isMergingEnabled</p>
*
public boolean isMarkerTypeEditingEnabled(MarkerType markerType) {
return false;
}
-
+
/*
* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#merge(eu.etaxonomy.cdm.model.common.IdentifiableEntity, eu.etaxonomy.cdm.model.common.IdentifiableEntity)
*/
/** {@inheritDoc} */
- public boolean merge(T entity, T mergeTarget) {
+ @Override
+ public boolean merge(T entity, T mergeTarget) {
if (entity instanceof IMergable) {
try {
CdmStore.getService(ICommonService.class).merge((IMergable)mergeTarget, (IMergable)entity, null);
} catch (MergeException e) {
- BulkEditorUtil.error(getClass(), e);
+ AbstractUtility.error(getClass(), e);
}
}
return true;
- };
-
+ }
+
/*
* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#create(eu.etaxonomy.cdm.model.common.IdentifiableEntity)
*/
/** {@inheritDoc} */
- public boolean create(T entity) {
- return save(entity);
- };
-
+ @Override
+ public boolean create(T entity) {
+ return save(entity);
+ }
+
public IEntityCreator<T> getEntityCreator(){
if(entityCreator == null){
entityCreator = createEntityCreator();
*/
public List<IBulkEditorSortProvider<T>> getSortProviders(){
List<IBulkEditorSortProvider<T>> sortProviders = new ArrayList<IBulkEditorSortProvider<T>>();
-
+
sortProviders.add(new CdmBaseSortProvider<T>());
-
+
return sortProviders;
}
* @return
*/
public String getTypeText(Object entity){
- return entity.getClass().getSimpleName();
+ return ((SpecimenOrObservationBase) entity).getRecordBasis().toString();
}
/**
public String getText(T entity) {
if(entity instanceof IdentifiableEntity){
IdentifiableEntity identifiableEntity = (IdentifiableEntity) HibernateProxyHelper.deproxy(entity);
-
+
return identifiableEntity.getTitleCache();
}
-
+
return "No text. Implement in subclass";
}
-
+
/**
* @return
*/
// $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.
*/
* @version 1.0
*/
public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObservationBase> {
-
+
/**
- *
+ *
*/
private static final long serialVersionUID = 1014860873939989973L;
public static final String ID = "bulkeditor.input.occurrence";
private static OccurrenceEditorInput instance;
-
+
/**
* <p>Getter for the field <code>instance</code>.</p>
*
}
return instance;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
*/
/** {@inheritDoc} */
@Override
protected SpecimenOrObservationBase loadEntity(UUID entityUuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return CdmStore.getService(IOccurrenceService.class).load(entityUuid, propertyPaths);
}
*
* @return a {@link java.lang.String} object.
*/
- public String getName() {
+ @Override
+ public String getName() {
return BulkEditorInputType.OCCURRENCE.label;
}
*
* @return a {@link java.lang.String} object.
*/
- public String getToolTipText() {
+ @Override
+ public String getToolTipText() {
return getName();
}
-
+
/**
* <p>getId</p>
*
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
*/
/** {@inheritDoc} */
- public boolean delete(SpecimenOrObservationBase entity) {
+ @Override
+ public boolean delete(SpecimenOrObservationBase entity) {
return CdmStore.getService(IOccurrenceService.class).delete(entity) != null;
}
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
*/
/** {@inheritDoc} */
- public boolean save(SpecimenOrObservationBase entity) {
+ @Override
+ public boolean save(SpecimenOrObservationBase entity) {
return CdmStore.getService(IOccurrenceService.class).save(entity) != null;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
@Override
public List<IBulkEditorSortProvider<SpecimenOrObservationBase>> getSortProviders() {
List<IBulkEditorSortProvider<SpecimenOrObservationBase>> sortProviders = super.getSortProviders();
-
+
sortProviders.add(0, new IdentifiableEntitySortProvider<SpecimenOrObservationBase>());
-
+
return sortProviders;
}
}
--- /dev/null
+// $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.dataimport;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor;
+
+/**
+ * @author pplitzner
+ * @date 20.09.2013
+ *
+ */
+public class DataImportEditor extends AnnotatedLineEditor {
+
+ /** Constant <code>ID="bulkeditor.input.nameRelationship"</code> */
+ public static final String ID = "eu.etaxonomy.taxeditor.dataimport.DataImportEditor";
+
+ /**
+ * Constructs a new DataImportEditor with a new {@link ConversationHolder}
+ */
+ public DataImportEditor() {
+ super(null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected void initializeEditor() {
+ super.initializeEditor();
+ setLineDisplayStrategy(new DataImportEditorLineDisplayStrategy());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ super.doSetInput(input);
+ setPartName(input.getName());
+ setTitleToolTip(input.getName());
+ }
+
+}
--- /dev/null
+// $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.dataimport;
+
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.EntityListener;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
+
+/**
+ * @author pplitzner
+ * @date 20.09.2013
+ *
+ */
+public class DataImportEditorLineDisplayStrategy implements ILineDisplayStrategy {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getIndent(java.lang.Object)
+ */
+ @Override
+ public int getIndent(Object entity) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getIcon(java.lang.Object)
+ */
+ @Override
+ public Image getIcon(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getFont(java.lang.Object)
+ */
+ @Override
+ public Font getFont(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object entity) {
+ return ((SpecimenOrObservationBase)entity).getTitleCache();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getSupplementalText(java.lang.Object)
+ */
+ @Override
+ public String getSupplementalText(Object entity) {
+ return "";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getEmptyCacheMessage(java.lang.Object)
+ */
+ @Override
+ public String getEmptyCacheMessage(Object entity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#setText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setText(String text, Object entity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#getHoverText(java.lang.Object)
+ */
+ @Override
+ public String getHoverText(Object entity) {
+ return ((SpecimenOrObservationBase)entity).getTitleCache();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#setStatusMessage(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setStatusMessage(String text, Object entity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#isEntityCacheEmpty(java.lang.Object)
+ */
+ @Override
+ public boolean isEntityCacheEmpty(Object entity) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy#addDisplayListener(java.lang.Object, eu.etaxonomy.taxeditor.annotatedlineeditor.EntityListener)
+ */
+ @Override
+ public void addDisplayListener(Object entity, EntityListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+// $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.dataimport;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.apache.http.client.ClientProtocolException;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
+import eu.etaxonomy.cdm.ext.biocase.BioCaseQueryServiceWrapper;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206Import;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+
+/**
+ * @author pplitzner
+ * @date 20.09.2013
+ *
+ */
+public class DataImportSpecimenEditorInput implements IEditorInput {
+
+ private static Logger logger = Logger.getLogger(DataImportSpecimenEditorInput.class);
+
+ private List<SpecimenOrObservationBase> results;
+ private BioCaseQuery query;
+
+ /**
+ * @param results
+ */
+ public DataImportSpecimenEditorInput(BioCaseQuery query) {
+ this.query = query;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ @Override
+ public boolean exists() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ @Override
+ public String getName() {
+ return query.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ @Override
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return query.toString();
+ }
+
+ /**
+ * @return the results
+ */
+ public List<SpecimenOrObservationBase> getResults() {
+ String errorMessage = "Could not execute query " + query;
+ try {
+ InputStream resultStream = new BioCaseQueryServiceWrapper().query(query);
+ Abcd206Import abcd206Import = new Abcd206Import();
+ } catch (ClientProtocolException e) {
+ logger.error(errorMessage, e);
+ } catch (IOException e) {
+ logger.error(errorMessage, e);
+ } catch (URISyntaxException e) {
+ logger.error(errorMessage, e);
+ }
+ return new BioCaseQueryServiceWrapper().dummyData();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((query == null) ? 0 : query.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DataImportSpecimenEditorInput other = (DataImportSpecimenEditorInput) obj;
+ if (query == null) {
+ if (other.query != null) {
+ return false;
+ }
+ } else if (!query.equals(other.query)) {
+ return false;
+ }
+ if (results == null) {
+ if (other.results != null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
--- /dev/null
+// $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.dataimport.wizard;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
+import eu.etaxonomy.taxeditor.dataimport.DataImportEditor;
+import eu.etaxonomy.taxeditor.dataimport.DataImportSpecimenEditorInput;
+
+/**
+ * @author pplitzner
+ * @date 11.09.2013
+ *
+ */
+public class SpecimenSearchWizard extends Wizard implements IImportWizard {
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(SpecimenSearchWizard.class);
+
+ private BioCaseQuery query;
+
+ /**
+ * Creates a new SpecimenSearchWizard
+ */
+ public SpecimenSearchWizard() {
+ //default constructor needed for RCP extension points
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ try {
+ DataImportSpecimenEditorInput input = new DataImportSpecimenEditorInput(query);
+ input.getToolTipText();
+ page.openEditor(input, DataImportEditor.ID, true);
+ } catch ( PartInitException e ) {
+ //Put your exception handler here if you wish to
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ addPage(new SpecimenSearchWizardPage("Specimen Search"));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ query = new BioCaseQuery();
+ }
+
+ /**
+ * @return the query
+ */
+ public BioCaseQuery getQuery() {
+ return query;
+ }
+
+}
--- /dev/null
+// $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.dataimport.wizard;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.taxeditor.ui.campanula.specimenSearch.SpecimenSearchController;
+
+/**
+ * @author pplitzner
+ * @date 12.09.2013
+ *
+ */
+public class SpecimenSearchWizardPage extends WizardPage{
+
+ /**
+ * @param pageName
+ */
+ protected SpecimenSearchWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ setControl(new SpecimenSearchController(parent).getComposite());
+ }
+
+}
<classpathentry exported="true" kind="lib" path="lib/solr-core-3.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/solr-solrj-3.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-aop-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/spring-beans-3.2.2.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-beans-3.2.2.RELEASE.jar" sourcepath="/home/pplitzner/.m2/repository/org/springframework/org.springframework.beans/3.2.2.RELEASE/org.springframework.beans-3.2.2.RELEASE-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-context-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-context-support-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-core-3.2.2.RELEASE.jar"/>
eu.etaxonomy.cdm.database.update.v25_30,
eu.etaxonomy.cdm.database.update.v30_31,
eu.etaxonomy.cdm.ext.bci,
+ eu.etaxonomy.cdm.ext.biocase,
eu.etaxonomy.cdm.ext.common,
eu.etaxonomy.cdm.ext.dc,
eu.etaxonomy.cdm.ext.geo,
org.apache.commons.lang;uses:="org.apache.commons.lang.exception",
org.apache.fop.apps,
org.apache.http,
+ org.apache.http.client,
org.apache.log4j;uses:="org.apache.log4j.helpers,org.apache.log4j.or,org.apache.log4j.spi",
org.apache.log4j.chainsaw;
uses:="org.apache.log4j,
lib/yjp-controller-api-redist-9.0.8.jar,
lib/google-api-translate-java-0.92.jar,
lib/odfdom-0.8.jar,
- lib/h2mig_pagestore_addon.jar
+ lib/h2mig_pagestore_addon.jar,
+ lib/cdmlib-commons-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-commons-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-ext-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-ext-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-io-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-io-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-model-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-model-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-persistence-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-persistence-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-print-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-print-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-remote-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-remote-3.2.4-SNAPSHOT.jar,
+ lib/cdmlib-services-3.2.4-SNAPSHOT-sources.jar,
+ lib/cdmlib-services-3.2.4-SNAPSHOT.jar
lib/yjp-controller-api-redist-9.0.8.jar,\\r
lib/google-api-translate-java-0.92.jar,\\r
lib/odfdom-0.8.jar,\\r
- lib/h2mig_pagestore_addon.jar\r
+ lib/h2mig_pagestore_addon.jar,\\r
+ lib/cdmlib-commons-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-commons-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-ext-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-ext-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-io-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-io-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-model-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-model-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-persistence-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-persistence-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-print-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-print-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-remote-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-remote-3.2.4-SNAPSHOT.jar,\\r
+ lib/cdmlib-services-3.2.4-SNAPSHOT-sources.jar,\\r
+ lib/cdmlib-services-3.2.4-SNAPSHOT.jar\r
\r
eu.etaxonomy.taxeditor.store.internal,
eu.etaxonomy.taxeditor.store.operations,
eu.etaxonomy.taxeditor.ui.bar,
+ eu.etaxonomy.taxeditor.ui.campanula.specimenSearch,
eu.etaxonomy.taxeditor.ui.combo,
eu.etaxonomy.taxeditor.ui.dialog,
eu.etaxonomy.taxeditor.ui.dialog.selection,
// $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.
*/
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.common.OriginalSourceType;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.OriginalSourceTypeSelectionDialog;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.SpecimenOrObservationTypeSelectionDialog;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitDetailsWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailsWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationGeneralWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailsWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenDetailsWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenGeneralWizardPage;
/**
* <p>NewDerivedUnitBaseWizard class.</p>
* @created Jun 16, 2010
* @version 1.0
*/
-public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<DerivedUnit> {
+public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase<?>> {
private SpecimenOrObservationType specOrObsType = null;
-
+
public NewDerivedUnitBaseWizard() {
- super();
+ super();
}
-
+
public NewDerivedUnitBaseWizard(SpecimenOrObservationType specOrObsType) {
super();
this.specOrObsType = specOrObsType;
}
/** {@inheritDoc} */
@Override
- public void addPages() {
- addPage(new GeneralWizardPage(formFactory, getConversationHolder(), getFacade()));
- addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), getFacade()));
- addPage(new FieldObservationWizardPage(formFactory, getConversationHolder(), getFacade()));
- addPage(new DerivedUnitBaseWizardPage(formFactory, getConversationHolder(), getFacade()));
-
- }
-
- /**
- * @return
- */
- private DerivedUnitFacade getFacade() {
- try {
- if(getEntity() != null) {
- return DerivedUnitFacade.NewInstance(getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
- }
- } catch (DerivedUnitFacadeNotSupportedException e) {
- // w should never get here
- throw new IllegalStateException();
- }
- return null;
- }
+ public void addPages() {
+ DerivedUnitFacade derivedUnitFacade = null;
+ try {
+ if (getEntity() != null) {
+ if(getEntity() instanceof FieldUnit){
+ derivedUnitFacade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit)getEntity());
+
+ addPage(new FieldObservationGeneralWizardPage(formFactory, getConversationHolder(), derivedUnitFacade));
+ addPage(new GatheringEventDetailsWizardPage(formFactory, getConversationHolder(), derivedUnitFacade));
+ addPage(new FieldObservationDetailsWizardPage(formFactory, getConversationHolder(), derivedUnitFacade));
+ }
+ else if(getEntity() instanceof DerivedUnit){
+ derivedUnitFacade = DerivedUnitFacade.NewInstance((DerivedUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
+
+ addPage(new SpecimenGeneralWizardPage(formFactory, getConversationHolder(), derivedUnitFacade));
+ addPage(new SpecimenDetailsWizardPage(formFactory, getConversationHolder(), derivedUnitFacade));
+ addPage(new DerivedUnitDetailsWizardPage(formFactory, getConversationHolder(), derivedUnitFacade));
+ }
+ }
+ } catch (DerivedUnitFacadeNotSupportedException e) {
+ // we should never get here
+ throw new IllegalStateException();
+ }
+
+ }
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
*/
/** {@inheritDoc} */
@Override
- protected DerivedUnit createNewEntity() {
+ protected SpecimenOrObservationBase<?> createNewEntity() {
if(specOrObsType == null) {
return DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
- } else {
- if(SpecimenOrObservationType.Media.equals(specOrObsType) ||
- ((((SpecimenOrObservationType)specOrObsType).getKindOf() != null) &&
- ((SpecimenOrObservationType)specOrObsType).getKindOf().equals(SpecimenOrObservationType.Media))) {
+ } else {
+ if(SpecimenOrObservationType.Media.equals(specOrObsType) ||
+ ((specOrObsType.getKindOf() != null) &&
+ specOrObsType.getKindOf().equals(SpecimenOrObservationType.Media))) {
return MediaSpecimen.NewInstance(SpecimenOrObservationType.Media);
+ } else if(specOrObsType == SpecimenOrObservationType.FieldUnit){
+ return FieldUnit.NewInstance();
} else {
- return DerivedUnit.NewInstance((SpecimenOrObservationType)specOrObsType);
- }
+ return DerivedUnit.NewInstance(specOrObsType);
+ }
}
}
protected String getEntityName() {
return "Specimen";
}
-
-
+
+
}
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
--- /dev/null
+// $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.campanula.basicFields;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Listener;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.store.TermManager;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+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.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectable;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class ComboDefinedTermController<T extends DefinedTermBase> extends AbstractCdmFormElement implements SelectionListener, DisposeListener, IEnableableFormElement, ISelectable {
+
+ private static final int DEFAULT_VISIBLE_ITEMS = 10;
+
+ private T selection;
+
+ private T emptyElement;
+ private static String EMPTY_ELEMENT_LABEL = "";
+
+// protected Label label;
+ private Combo combo;
+
+ private ArrayList<T> terms;
+
+ private Comparator<T> termComparator;
+
+ private Class<T> termClass;
+
+ private List<T> customPreferredTerms;
+
+ /**
+ * <p>
+ * Constructor for AbstractTermComboElement.
+ * </p>
+ *
+ * @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.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param selection
+ * a T object.
+ * @param visibleItems
+ * a int.
+ * @param <T>
+ * a T object.
+ */
+ public ComboDefinedTermController(Combo combo, CdmFormFactory formFactory, ICdmFormElement parentElement, Class<T> termClass, T selection, int style) {
+ super(formFactory, parentElement);
+
+ this.termClass = termClass;
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+// if (labelString != null) {
+// label = formFactory.createLabel(getLayoutComposite(), labelString);
+// addControl(label);
+// }
+
+ // create combo
+ this.combo = combo;//new Combo(getLayoutComposite(), SWT.BORDER | SWT.READ_ONLY);
+ addControl(combo);
+// combo.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+ combo.setVisibleItemCount(DEFAULT_VISIBLE_ITEMS);
+
+ populateTerms(getPreferredTerms());
+
+ combo.addSelectionListener(this);
+ combo.addDisposeListener(this);
+ PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
+
+ if (selection != null) {
+ setSelection(selection);
+ }
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>selection</code>.
+ * </p>
+ *
+ * @return a T object.
+ */
+ public T getSelection() {
+ return selection;
+ }
+
+ /**
+ * <p>
+ * Sets the selection of the combo to the given T object.
+ * </p>
+ * <p>
+ * Passing <code>null</code> to this method will set the selection to the
+ * empty element and effectively clear the selection
+ * </p>
+ *
+ * @param selection
+ * a T object or <code>null</code> to clear the selection
+ */
+ public void setSelection(T selection) {
+ this.selection = selection;
+
+ this.selection = selection;
+
+ Listener[] listeners = combo.getListeners(SWT.Selection);
+
+ for (Listener listener : listeners) {
+ combo.removeListener(SWT.Selection, listener);
+ }
+ int selectedIndex;
+ if (selection == null) {
+ // set selection to the emptyElement
+ selectedIndex = 0;
+ } else {
+ selectedIndex = terms.indexOf(selection);
+ if (selectedIndex == -1) {
+ createTermNotInPreferredTerms(selection);
+ selectedIndex = terms.indexOf(selection);
+ }
+ }
+ combo.select(selectedIndex);
+
+ for (Listener listener : listeners) {
+ combo.addListener(SWT.Selection, listener);
+ }
+ }
+
+ /**
+ * Fills the combo with elements and sets up the convenience functions for
+ * selection index
+ *
+ * @param preferredTerms
+ */
+ private void populateTerms(List<T> preferredTerms) {
+
+ combo.removeAll();
+
+ terms = new ArrayList<T>();
+
+ int i = 1;
+ int index = 0;
+
+ // Add an empty element for when nothing was selected yet
+ combo.add(EMPTY_ELEMENT_LABEL);
+ terms.add(emptyElement);
+
+ if (termComparator != null) {
+ Collections.sort(preferredTerms, termComparator);
+ }
+ for (T term : preferredTerms) {
+ String label = getLabel(term);
+ if (label == null) {
+ if (term.getTitleCache() != null) {
+ label = term.getTitleCache();
+ StoreUtil.warn(getClass(), "Term does not have a representation: " + term + ", " + term.getUuid());
+ } else {
+ label = "Unknown";
+ StoreUtil.warn(getClass(), "Representation Label and TitleCache empty for term: " + term + ", " + term.getUuid());
+ }
+
+ }
+
+ combo.add(label);
+ terms.add(term);
+
+ i++;
+ if (selection != null) {
+ if (selection.equals(term)) {
+ index = i;
+ }
+ }
+ }
+
+ if (selection != null && index == 0) {
+ createTermNotInPreferredTerms(selection);
+ }
+
+ combo.select(index);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setEnabled(boolean enabled) {
+ combo.setEnabled(enabled);
+ }
+
+ /**
+ * <p>
+ * preferredTerms
+ * </p>
+ *
+ * @return a {@link java.util.List} object.
+ */
+ protected List<T> getPreferredTerms() {
+ if (customPreferredTerms != null) {
+ return customPreferredTerms;
+ }
+ return getTermManager().getPreferredTerms(termClass);
+ }
+
+ /**
+ * May be overridden by derived classes if the desired label string does not
+ * reside in term.getLabel();
+ *
+ * @param term
+ * a T object.
+ * @return a {@link java.lang.String} object.
+ */
+ protected String getLabel(T term) {
+ return term.getLabel(CdmStore.getDefaultLanguage());
+ }
+
+ /**
+ *
+ *
+ * @param term
+ */
+ private void createTermNotInPreferredTerms(T term) {
+ List<T> preferredTerms = getPreferredTerms();
+
+ preferredTerms.add(term);
+
+ populateTerms(preferredTerms);
+ }
+
+ /**
+ * <p>
+ * addSelectionListener
+ * </p>
+ *
+ * @param listener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public void addSelectionListener(SelectionListener listener) {
+ combo.addSelectionListener(listener);
+ }
+
+ /**
+ * <p>
+ * removeSelectionListener
+ * </p>
+ *
+ * @param listener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public void removeSelectionListener(SelectionListener listener) {
+ combo.removeSelectionListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
+ * .events.SelectionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selection = terms.get(combo.getSelectionIndex());
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.beans.PropertyChangeListener#propertyChange(java.beans.
+ * PropertyChangeEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+ if (event != null && PreferencesUtil.PREFERRED_TERMS_CHANGE.equals(event.getProperty())) {
+ populateTerms(getPreferredTerms());
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setSelected(boolean selected) {
+ setBackground(selected ? SELECTED : getPersistentBackground());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ PreferencesUtil.getPreferenceStore().removePropertyChangeListener(this);
+ }
+
+ // not used
+ /** {@inheritDoc} */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setIrrelevant(boolean irrelevant) {
+ String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND;
+
+ Color color = StoreUtil.getColor(colorId);
+ combo.setBackground(color);
+ }
+
+// /** {@inheritDoc} */
+// @Override
+// public void setBackground(Color color) {
+// if (label != null)
+// label.setBackground(color);
+// }
+
+ /**
+*
+*/
+ protected TermManager getTermManager() {
+ return CdmStore.getTermManager();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getVisibleItemCount() {
+ return combo.getVisibleItemCount();
+ }
+
+ /**
+ *
+ * @param count
+ */
+ public void setVisibleItemCount(int count) {
+ combo.setVisibleItemCount(count);
+ }
+
+ /**
+ * <p>
+ * A {@link List} of term objects may be passed to this combo box. In this
+ * case, the default behaviour of displaying the preferred terms for the T
+ * type will be overridden and the combo will only display the given terms.
+ * Also, any previous selection will be reseted.
+ * </p>
+ *
+ * <p>
+ * To return to the default of displaying the preferred terms, simply pass
+ * <code>null</code>.
+ * </p>
+ *
+ * @param terms
+ * a {@link List} of T objects or <code>null</code> for default
+ * preferred terms
+ */
+ public void setTerms(List<T> terms) {
+ setSelection(null);
+ customPreferredTerms = terms;
+ populateTerms(customPreferredTerms);
+ }
+}
\ No newline at end of file
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.wb.swt.ResourceManager;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class EntityCollectionElement extends ExpandableComposite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public EntityCollectionElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ setExpanded(true);
+
+ ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.RIGHT);
+ setTextClient(toolBar);
+
+ Label label = formToolkit.createLabel(this, "", SWT.NONE);
+ setClient(label);
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+
+ Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+// ELEMENT element = createNewElement();
+// if(element != null){
+// addElement(element);
+// if(! getSection().isExpanded()) {
+// getSection().setExpanded(true);
+// }
+// internalUpdateSection(true);
+// }
+ }
+ };
+ addAction.setImageDescriptor(ResourceManager.getPluginImageDescriptor("eu.etaxonomy.taxeditor.store", "icons/add_no_bg2.gif"));
+// addAction.setToolTipText(getTooltipString());
+
+ toolBarManager.add(addAction);
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.ResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 13.08.2013
+ *
+ */
+public class EntitySelectionField extends Composite {
+ private FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Label text;
+ private Button button_selection;
+ private Button button_edit;
+ private Button button_remove;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public EntitySelectionField(Composite parent, int style) {
+ super(parent, style);
+ setBackgroundMode(SWT.INHERIT_DEFAULT);
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.verticalSpacing = 0;
+ tableWrapLayout.topMargin = 0;
+ tableWrapLayout.rightMargin = 0;
+ tableWrapLayout.numColumns = 4;
+ tableWrapLayout.leftMargin = 0;
+ tableWrapLayout.horizontalSpacing = 0;
+ tableWrapLayout.bottomMargin = 0;
+ setLayout(tableWrapLayout);
+ }
+
+ text = formToolkit.createLabel(this, "", SWT.WRAP);
+ TableWrapData twd_text = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1);
+ twd_text.align = TableWrapData.LEFT;
+ text.setLayoutData(twd_text);
+
+ button_selection = formToolkit.createButton(this, "", SWT.NONE);
+ button_selection.setToolTipText("Browse existing");
+ button_selection.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif"));
+
+ button_edit = formToolkit.createButton(this, "", SWT.NONE);
+ button_edit.setToolTipText("Edit");
+ button_edit.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/text.gif"));
+
+ button_remove = formToolkit.createButton(this, "", SWT.NONE);
+ button_remove.setToolTipText("Remove");
+ button_remove.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+ public Label getText() {
+ return text;
+ }
+ public Button getButton_selection() {
+ return button_selection;
+ }
+ public Button getButton_edit() {
+ return button_edit;
+ }
+ public Button getButton_remove() {
+ return button_remove;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#setEnabled(boolean)
+ */
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ text.setEnabled(enabled);
+ button_selection.setEnabled(enabled);
+ button_edit.setEnabled(enabled);
+ button_remove.setEnabled(enabled);
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.springframework.security.core.GrantedAuthority;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.IEntitySelectionElement;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
+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.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
+import eu.etaxonomy.taxeditor.ui.selection.EditFromSelectionWizard;
+
+/**
+ * @author pplitzner
+ * @date 13.08.2013
+ *
+ */
+public class EntitySelectionFieldController<T extends ICdmBase> extends AbstractCdmFormElement implements IEntitySelectionElement<T>{
+
+ /**
+ * Bitmask for configuring functionality of selection element
+ */
+ public static final int NOTHING = 0; // 000
+ public static final int EDITABLE = 1 << 0; // 001
+ public static final int DELETABLE = 1 << 1; // 010
+ public static final int SELECTABLE = 1 << 2; // 100
+ public static final int ALL = EDITABLE | DELETABLE | SELECTABLE; // 111
+
+ protected T entity;
+
+ //TODO also control "label" with this class?
+// protected Label label;
+ protected Label text;
+ protected Button button_selection;
+
+ private SelectionArbitrator selectionArbitrator;
+
+ protected Button button_edit;
+
+// private final String labelString;
+
+ private Composite selectableComposite;
+
+ private Button button_remove;
+
+ private final boolean isEditable;
+
+ private final boolean isDeletable;
+
+ private final ConversationHolder conversation;
+ private Class<T> clazz;
+
+ /**
+ * <p>
+ * Constructor for AbstractSelectionElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param conversation
+ * TODO
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param entity
+ * a T object.
+ * @param isEditable
+ * a boolean.
+ * @param isSelectable
+ * a boolean.
+ * @param isDeletable
+ * a boolean.
+ * @param style
+ * a int.
+ * @param <T>
+ * a T object.
+ */
+ public EntitySelectionFieldController(EntitySelectionField entitySelectionField, CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, T entity, int mode) {
+ super(formFactory, parentElement);
+
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+
+ this.isEditable = (mode & EDITABLE) == EDITABLE;
+ this.isDeletable = (mode & DELETABLE) == DELETABLE;
+ boolean isSelectable = (mode & SELECTABLE) == SELECTABLE;
+
+// this.labelString = labelString;
+
+ this.conversation = conversation;
+
+ if (isSelectable && formFactory.getSelectionProvider() != null) {
+ selectionArbitrator = formFactory.createSelectionArbitrator(this);
+ }
+
+ createControls(entitySelectionField);
+
+ setEntity(entity);
+ }
+
+ public EntitySelectionFieldController(EntitySelectionField entitySelectionField, CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz, T entity, int mode) {
+ this(entitySelectionField, formFactory, conversation, parentElement, entity, mode);
+ this.clazz = clazz;
+ }
+
+ private void createControls(EntitySelectionField entitySelectionField) {
+
+// label = formFactory.createLabel(getLayoutComposite(), labelString, SWT.NULL);
+//
+// addControl(label);
+
+ selectableComposite = entitySelectionField;
+
+ int columns = 2;
+ if (isEditable) {
+ columns += 1;
+ }
+ if (isDeletable) {
+ columns += 1;
+ }
+
+ selectableComposite.setLayout(LayoutConstants.LAYOUT(columns, false));
+ selectableComposite.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+
+ addControl(selectableComposite);
+
+ text = entitySelectionField.getText();
+ addControl(text);
+
+ text.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+ text.setBackground(AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND));
+
+ button_selection = entitySelectionField.getButton_selection();
+ button_selection.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
+ button_selection.setToolTipText("Browse existing");
+
+ addControl(button_selection);
+ button_selection.addSelectionListener(this);
+
+ button_edit = entitySelectionField.getButton_edit();
+ if (isEditable) {
+ addControl(button_edit);
+ button_edit.addSelectionListener(new EditListener(this));
+ }
+ else{
+ button_edit.setVisible(false);
+ }
+
+ button_remove = entitySelectionField.getButton_remove();
+ if (isDeletable) {
+ addControl(button_remove);
+ button_remove.addSelectionListener(new DeleteListener(this));
+ }
+ else{
+ button_remove.setVisible(false);
+ }
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity());
+ setSelectionInternal(selection);
+ }
+
+ /**
+ * Return the selected object
+ *
+ * @return a T object.
+ */
+ public T getSelection() {
+ return entity;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setEnabled(boolean enabled) {
+ button_selection.setEnabled(enabled);
+ if (isEditable) {
+ button_edit.setEnabled(enabled && entity != null);
+ }
+ }
+
+ /**
+ * <p>
+ * setSelectionInternal
+ * </p>
+ *
+ * @param selection
+ * a T object.
+ */
+ protected void setSelectionInternal(T selection) {
+ if (selection != null && !selection.equals(this.entity)) {
+ setEntity(selection);
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
+ }
+ }
+
+ /**
+ * <p>
+ * Setter for the field <code>entity</code>.
+ * </p>
+ *
+ * @param selection
+ * a T object.
+ */
+ public void setEntity(T selection) {
+ this.entity = selection;
+ updateElement();
+ }
+
+ /**
+ * Updates this elements view
+ */
+ protected void updateElement() {
+ String title = CdmUtils.Nz(getTitle());
+ // we have to duplicate ampersands otherwise they are treated as
+ // mnenomic (see Label.setText() documentation)
+ title = title.replace("&", "&&");
+ text.setText(title); // title can be null
+ if (isEditable) {
+ button_edit.setEnabled(entity != null);
+ }
+ }
+
+ @Override
+ public void updateFromWizard() {
+ updateElement();
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
+ }
+
+ /**
+ * <p>
+ * getTitle
+ * </p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ protected String getTitle() {
+ if (entity != null) {
+ if (entity instanceof IIdentifiableEntity) {
+ return ((IIdentifiableEntity) entity).getTitleCache();
+ } else if (entity instanceof Group) {
+ return ((Group) entity).getName();
+ } else if (entity instanceof GrantedAuthority) {
+ return ((GrantedAuthority) entity).getAuthority();
+ }
+ }
+ return "";
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setSelected(boolean selected) {
+ setBackground(selected ? SELECTED : getPersistentBackground());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity()
+ */
+ /**
+ * <p>
+ * Getter for the field <code>entity</code>.
+ * </p>
+ *
+ * @return a T object.
+ */
+ @Override
+ public T getEntity() {
+ return entity;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#
+ * getSelectionArbitrator()
+ */
+ /**
+ * <p>
+ * Getter for the field <code>selectionArbitrator</code>.
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
+ * object.
+ */
+ @Override
+ public SelectionArbitrator getSelectionArbitrator() {
+ return selectionArbitrator;
+ }
+
+ @Override
+ public Shell getShell() {
+ return getLayoutComposite().getShell();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setIrrelevant(boolean irrelevant) {
+ String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_TEXT_DISABLED_BACKGROUND;
+
+ Color color = AbstractUtility.getColor(colorId);
+ text.setBackground(color);
+ }
+
+ private class DeleteListener extends SelectionAdapter {
+
+ private final EntitySelectionFieldController<T> selectionElement;
+
+ public DeleteListener(EntitySelectionFieldController<T> selectionElement) {
+ this.selectionElement = selectionElement;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setEntity(null);
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(selectionElement, null));
+ }
+ }
+
+ private class EditListener extends SelectionAdapter {
+
+ private final IEntitySelectionElement<T> selectionElement;
+
+ public EditListener(IEntitySelectionElement<T> selectionElement) {
+ this.selectionElement = selectionElement;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ WizardDialog dialog = new WizardDialog(selectionElement.getShell(), new EditFromSelectionWizard(selectionElement));
+ if (dialog.open() == IStatus.OK) {
+ selectionElement.updateFromWizard();
+ }
+ }
+ }
+
+ // not used
+ /** {@inheritDoc} */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ /**
+ * <p>
+ * getConversationHolder
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setBackground(Color color) {
+// label.setBackground(color);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setLabel(String labelString) {
+// if (label != null) {
+// label.setText(labelString);
+// }
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>label</code>.
+ * </p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ @Override
+ public String getLabel() {
+// if (label != null) {
+// return label.getText();
+// }
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class LanguageTextFieldController extends TextFieldController{
+
+ private LanguageString languageString;
+
+ /**
+ * <p>Constructor for LanguageStringWithLabelElement.</p>
+ *
+ * @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 languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
+ * @param style a int.
+ */
+ public LanguageTextFieldController(Text controlledText, CdmFormFactory formFactory,
+ ICdmFormElement parentElement,
+ LanguageString languageString) {
+ this(controlledText, formFactory, parentElement, languageString, null);
+ }
+
+ /**
+ * <p>Constructor for LanguageStringWithLabelElement.</p>
+ *
+ * @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 languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
+ * @param height a int.
+ * @param style a int.
+ */
+ protected LanguageTextFieldController(Text controlledText, CdmFormFactory formFactory,
+ ICdmFormElement parentElement,
+ LanguageString languageString, Integer height) {
+ super(controlledText, formFactory, parentElement, null, height);
+
+ setLanguageString(languageString);
+ }
+
+ /**
+ * <p>Getter for the field <code>languageString</code>.</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
+ */
+ public LanguageString getLanguageString() {
+ return languageString;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if(languageString == null){
+ languageString = LanguageString.NewInstance("", CdmStore.getDefaultLanguage());
+ }
+
+ languageString.setText(text.getText());
+ super.modifyText(e);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setText(String text) {
+ if(text != null && languageString!=null){
+ languageString.setText(text);
+ super.setText(text);
+ }
+ }
+
+ /**
+ * <p>Setter for the field <code>languageString</code>.</p>
+ *
+ * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
+ */
+ public void setLanguageString(LanguageString languageString) {
+ this.languageString = languageString;
+ super.setText(languageString != null ? languageString.getText() : "");
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class NamedAreaFieldController extends AbstractEntityCollectionElement<NamedArea> {
+
+ private EntitySelectionFieldController<NamedArea> selection_namedArea;
+
+ /**
+ * <p>
+ * Constructor for CollectingAreasDetailElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param section
+ * a
+ * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
+ * object.
+ * @param entity
+ * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
+ * @param removeListener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ * @param style
+ * a int.
+ */
+ public NamedAreaFieldController(CdmFormFactory formFactory, AbstractFormSection section, NamedArea entity, SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, null, style);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
+ * (java.lang.Object)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setEntity(NamedArea entity) {
+ selection_namedArea.setEntity(entity);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void createControls(ICdmFormElement formElement, int style) {
+ selection_namedArea = new EntitySelectionFieldController<NamedArea>(new EntitySelectionField(formElement.getLayoutComposite(), SWT.NONE), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, null, EntitySelectionElement.NOTHING);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
+ * (java.lang.Object)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == selection_namedArea) {
+ setEntity(selection_namedArea.getSelection());
+ }
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
+
+/**
+ * @author pplitzner
+ * @date 12.08.2013
+ *
+ */
+public class NumberFieldController extends TextFieldController {
+ private Float start;
+ private Float end;
+
+ private NumberFormatException exception;
+
+ /**
+ * <p>Constructor for NumberWithLabelElement.</p>
+ *
+ * @param toolkit 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 initialNumber a {@link java.lang.Integer} object.
+ * @param style a int.
+ */
+ public NumberFieldController(Text controlledText, CdmFormFactory formFactory, ICdmFormElement parentElement, Number initialNumber){
+ super(controlledText, formFactory, parentElement, null, null);
+ //WindowBuilder exception handling
+ if(initialNumber==null){
+ initialNumber = 0;
+ }
+ setNumber(initialNumber);
+ }
+
+ /**
+ * <p>setInteger</p>
+ *
+ * @param number a {@link java.lang.Integer} object.
+ */
+ public void setInteger(Integer number) {
+ super.setText(getStringRepresentation(number));
+ }
+
+ /**
+ * <p>setNumber</p>
+ *
+ * @param number a {@link java.lang.Number} object.
+ */
+ public void setNumber(Number number) {
+ super.setText(getStringRepresentation(number));
+ }
+
+ /**
+ * <p>getInteger</p>
+ *
+ * @return a {@link java.lang.Integer} object.
+ */
+ public Integer getInteger() {
+ String text = super.getText().trim();
+ return text.equals("") ? 0 : new Integer(text);
+ }
+
+ /**
+ * <p>getFloat</p>
+ *
+ * @return a {@link java.lang.Float} object.
+ */
+ public Float getFloat(){
+ String text = super.getText();
+ return new Float(text);
+ }
+
+ /**
+ * <p>getDouble</p>
+ *
+ * @return a {@link java.lang.Float} object.
+ */
+ public Double getDouble(){
+ String text = super.getText();
+ return new Double(text);
+ }
+
+ private String getStringRepresentation(Object number){
+ if(number != null){
+ return number.toString();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void modifyText(ModifyEvent event) {
+ String value = text.getText();
+ if(CdmUtils.isEmpty(value)){
+ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ return;
+ }
+
+ try{
+
+ Float number = Float.parseFloat(value);
+
+ if((start != null && number < start) || (end != null && number > end)){
+ throw new NumberFormatException("You entered a number that is not within the allowed bounds.");
+ }
+
+ }catch(NumberFormatException e){
+ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+ exception = e;
+ return;
+ }
+
+ exception = null;
+ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+ super.modifyText(event);
+ }
+
+ /**
+ * <p>setLimits</p>
+ *
+ * @param numberOfDigits a int.
+ * @param start a {@link java.lang.Integer} object.
+ * @param end a {@link java.lang.Integer} object.
+ */
+ public void setLimits(int numberOfDigits, Integer start, Integer end){
+ setLimits(numberOfDigits, start.floatValue(), end.floatValue());
+ }
+
+ /**
+ * <p>setLimits</p>
+ *
+ * @param numberOfDigits a int.
+ * @param start a {@link java.lang.Float} object.
+ * @param end a {@link java.lang.Float} object.
+ */
+ public void setLimits(int numberOfDigits, Float start, Float end){
+ text.setTextLimit(numberOfDigits);
+ this.start = start;
+ this.end = end;
+ }
+
+ /**
+ * <p>Getter for the field <code>exception</code>.</p>
+ *
+ * @return the exception
+ */
+ public NumberFormatException getException() {
+ return exception;
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class PointField extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text text_latitude;
+ private Text text_latitudeParsed;
+ private Text text_longitude;
+ private Text text_longitudeParsed;
+ private Text number_errorRadius;
+ private Combo combo_referenceSystem;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public PointField(Composite parent, int style) {
+ super(parent, style);
+ {
+ setLayout(new TableWrapLayout());
+ }
+
+ text_latitude = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_latitude.setText("");
+ text_latitude.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ text_latitudeParsed = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_latitudeParsed.setEnabled(false);
+ text_latitudeParsed.setText("");
+ text_latitudeParsed.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ text_longitude = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_longitude.setText("");
+ text_longitude.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ text_longitudeParsed = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_longitudeParsed.setEnabled(false);
+ text_longitudeParsed.setText("");
+ text_longitudeParsed.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ number_errorRadius = formToolkit.createText(this, "New Text", SWT.NONE);
+ number_errorRadius.setText("");
+ number_errorRadius.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ combo_referenceSystem = new Combo(this, SWT.READ_ONLY);
+ combo_referenceSystem.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(combo_referenceSystem);
+ formToolkit.paintBordersFor(combo_referenceSystem);
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getText_latitude() {
+ return text_latitude;
+ }
+ public Text getText_latitudeParsed() {
+ return text_latitudeParsed;
+ }
+ public Text getText_longitude() {
+ return text_longitude;
+ }
+ public Text getText_longitudeParsed() {
+ return text_longitudeParsed;
+ }
+ public Text getNumber_errorRadius() {
+ return number_errorRadius;
+ }
+ public Combo getCombo_referenceSystem() {
+ return combo_referenceSystem;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#setEnabled(boolean)
+ */
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ text_latitude.setEnabled(enabled);
+ text_latitudeParsed.setEnabled(enabled);
+ text_longitude.setEnabled(enabled);
+ text_longitudeParsed.setEnabled(enabled);
+ number_errorRadius.setEnabled(enabled);
+ combo_referenceSystem.setEnabled(enabled);
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import java.text.ParseException;
+
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+import eu.etaxonomy.cdm.model.location.Point;
+import eu.etaxonomy.cdm.model.location.ReferenceSystem;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+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.IEntityElement;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class PointFieldController extends AbstractCdmFormElement implements IEntityElement<Point> {
+
+ private Point point;
+
+ private final TextFieldController text_latitude;
+ private final TextFieldController text_longitude;
+ private final NumberFieldController number_errorRadius;
+ private final ComboDefinedTermController<ReferenceSystem> combo_referenceSystem;
+
+ private final TextFieldController text_latitudeParsed;
+
+ private final TextFieldController text_longitudeParsed;
+
+ /**
+ * <p>
+ * Constructor for PointElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param point
+ * a {@link eu.etaxonomy.cdm.model.location.Point} object.
+ * @param style
+ * a int.
+ */
+ public PointFieldController(PointField pointField, CdmFormFactory formFactory, ICdmFormElement formElement, Point point, final int style) {
+ super(formFactory, formElement);
+
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+
+ text_latitude = new TextFieldController(pointField.getText_latitude(), getFormFactory(), formElement, null, style);
+ text_latitudeParsed = new TextFieldController(pointField.getText_latitudeParsed(), getFormFactory(), formElement, null, style);
+ text_longitude = new TextFieldController(pointField.getText_longitude(), getFormFactory(), formElement, null, style);
+ text_longitudeParsed = new TextFieldController(pointField.getText_longitudeParsed(), getFormFactory(), formElement, null, style);
+ number_errorRadius = new NumberFieldController(pointField.getNumber_errorRadius(), getFormFactory(), formElement, (Integer)null);
+ combo_referenceSystem = new ComboDefinedTermController<ReferenceSystem>(pointField.getCombo_referenceSystem(), getFormFactory(), formElement, ReferenceSystem.class, null, style);
+
+ setPoint(point);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org
+ * .eclipse.jface.util.PropertyChangeEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event == null) {
+ return;
+ }
+
+ boolean propagate = false;
+
+ Object eventSource = event.getSource();
+ if (eventSource == text_latitude) {
+ try {
+ getPoint().setLatitudeByParsing(text_latitude.getText());
+ text_latitudeParsed.setText(point.getLatitudeSexagesimal().toString(false));
+ text_latitude.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+ propagate = true;
+ } catch (ParseException e) {
+ text_latitude.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+ }
+ } else if (eventSource == text_longitude) {
+ try {
+ getPoint().setLongitudeByParsing(text_longitude.getText());
+ text_longitudeParsed.setText(point.getLongitudeSexagesimal().toString(false));
+ text_longitude.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+ propagate = true;
+ } catch (ParseException e) {
+ text_longitude.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+ }
+ } else if (eventSource == number_errorRadius) {
+ getPoint().setErrorRadius(number_errorRadius.getInteger());
+ propagate = true;
+ } else if (eventSource == combo_referenceSystem) {
+ getPoint().setReferenceSystem(combo_referenceSystem.getSelection());
+ propagate = true;
+ }
+
+ if (propagate) {
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public Point getEntity() {
+ return getPoint();
+ }
+
+ /**
+ * <p>
+ * setEntity
+ * </p>
+ *
+ * @param point
+ * a {@link eu.etaxonomy.cdm.model.location.Point} object.
+ */
+ public void setEntity(Point point) {
+ setPoint(point);
+ }
+
+ /**
+ * <p>
+ * Setter for the field <code>point</code>.
+ * </p>
+ *
+ * @param point
+ * the point to set
+ */
+ public void setPoint(Point point) {
+ this.point = point;
+ if (point != null) {
+ String latitude = point.getLatitudeSexagesimal() == null ? "" : point.getLatitudeSexagesimal().toString(false);
+ String longitude = point.getLongitudeSexagesimal() == null ? "" : point.getLongitudeSexagesimal().toString(false);
+ text_latitude.setText(latitude);
+ text_latitudeParsed.setText(latitude);
+ text_longitude.setText(longitude);
+ text_longitudeParsed.setText(longitude);
+ number_errorRadius.setInteger(point.getErrorRadius());
+ combo_referenceSystem.setSelection(point.getReferenceSystem());
+ }
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>point</code>.
+ * </p>
+ *
+ * @return the point
+ */
+ public Point getPoint() {
+ if (point == null) {
+ point = Point.NewInstance();
+ }
+
+ return point;
+ }
+
+ @Override
+ public void setSelected(boolean selected) {
+ setBackground(selected ? SELECTED : getPersistentBackground());
+ }
+}
\ No newline at end of file
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+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.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectable;
+
+/**
+ * @author pplitzner
+ * @date 09.08.2013
+ *
+ */
+public class TextFieldController extends AbstractCdmFormElement implements ModifyListener, IEnableableFormElement, ISelectable{
+
+ protected Text text;
+
+ /** Constant <code>MAX_HEIGHT=0</code> */
+ public static final int MAX_HEIGHT = 0;
+ /** Constant <code>SINGLE=-1</code> */
+ public static final int SINGLE = -1;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ * @param initialText
+ * @param textHeight
+ */
+ public TextFieldController(Text controlledText, CdmFormFactory formFactory, ICdmFormElement parentFormElement, String initialText, Integer textHeight) {
+ super(formFactory, parentFormElement);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+
+ //vvvvvvvvvvvvv
+
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+
+ initialText = initialText==null?"":initialText;
+//
+// 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;
+// }
+ //^^^^^^^^^^^^^^
+
+ this.text = controlledText;
+// TableWrapData twd_text_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
+// twd_text_1.grabHorizontal = true;
+ setText(initialText);
+// text.setLayoutData(twd_text_1);
+
+
+ //vvvvvvvvvvvvvvvvvv
+ 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;
+ TextFieldController.this.text.traverse(SWT.TRAVERSE_TAB_NEXT);
+ }
+ }
+ });
+ }
+
+// if (textHeight != null && textHeight > 0) {
+// TableWrapData layoutData = LayoutConstants.FILL();
+// (layoutData).heightHint = textHeight;
+// text.setLayoutData(layoutData);
+// }
+
+ text.addModifyListener(this);
+
+ addControl(text);
+
+ }
+
+ /**
+ * 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);
+ }
+
+ @Override
+ public void setSelected(boolean selected) {
+ setBackground(selected ? SELECTED : getPersistentBackground());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus()
+ */
+ /** {@inheritDoc}
+ * @return */
+ @Override
+ public void setFocus() {
+ text.setFocus();
+ }
+
+ /**
+ * <p>
+ * getMainControl
+ * </p>
+ *
+ * @return a {@link org.eclipse.swt.widgets.Control} object.
+ */
+ public Control getMainControl() {
+ return text;
+ }
+
+ /**
+ * <p>
+ * setTextLimit
+ * </p>
+ *
+ * @param limit
+ * a int.
+ */
+ public void setTextLimit(int limit) {
+ text.setTextLimit(limit);
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * @author pplitzner
+ * @date 14.08.2013
+ *
+ */
+public class ToggleableTextField extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text text;
+ private Button editButton;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public ToggleableTextField(Composite parent, int style) {
+ super(parent, style);
+ setBackgroundMode(SWT.INHERIT_DEFAULT);
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ tableWrapLayout.verticalSpacing = 0;
+ tableWrapLayout.topMargin = 0;
+ tableWrapLayout.rightMargin = 0;
+ tableWrapLayout.leftMargin = 0;
+ tableWrapLayout.horizontalSpacing = 0;
+ tableWrapLayout.bottomMargin = 0;
+ setLayout(tableWrapLayout);
+ }
+
+ text = formToolkit.createText(this, "New Text", SWT.WRAP);
+ text.setText("");
+ TableWrapData twd_text = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1);
+ twd_text.grabVertical = true;
+ text.setLayoutData(twd_text);
+
+ editButton = formToolkit.createButton(this, "Edit", SWT.TOGGLE);
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getText() {
+ return text;
+ }
+ public Button getEditButton() {
+ return editButton;
+ }
+}
--- /dev/null
+// $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.campanula.basicFields;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+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.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectable;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+
+/**
+ * @author pplitzner
+ * @date 14.08.2013
+ *
+ */
+public class ToggleableTextFieldController extends AbstractCdmFormElement implements SelectionListener, ModifyListener, IEnableableFormElement, ISelectable {
+
+ private ToggleableTextField toggleableTextField;
+
+ private boolean state;
+ private Set<SelectionListener> selectionListener = new HashSet<SelectionListener>();
+ //TODO also connect label
+// private Label label;
+
+ /**
+ * <p>Constructor for ToggleableTextElement.</p>
+ *
+ * @param style a int.
+ * @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 initialState a boolean.
+ */
+ public ToggleableTextFieldController(ToggleableTextField toggleableTextField, CdmFormFactory formFactory, ICdmFormElement parentElement,
+ String initialText, boolean initialState, int style) {
+ super(formFactory, parentElement);
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+
+ this.toggleableTextField = toggleableTextField;
+
+// label = formFactory.createLabel(getLayoutComposite(), labelString, style);
+// addControl(label);
+
+ Text text = toggleableTextField.getText();
+ addControl(text);
+ text.addModifyListener(this);
+ text.setLayoutData(LayoutConstants.FILL());
+
+ // Don't accept carriage returns as input
+ text.addKeyListener( new KeyAdapter(){
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.character == SWT.CR) {
+ e.doit = false;
+ }
+ }
+ });
+
+ Button editButton = toggleableTextField.getEditButton();
+ addControl(editButton);
+ editButton.addSelectionListener(this);
+
+ setState(initialState);
+ }
+
+ /**
+ * <p>setText</p>
+ *
+ * @param text a {@link java.lang.String} object.
+ */
+ public void setText(String text){
+ if(text != null){
+ // store current caret position
+ Text textField = toggleableTextField.getText();
+ int caretPosition = textField.getCaretPosition();
+
+ Listener[] listeners = textField.getListeners(SWT.Modify);
+ for (Listener listener : listeners) {
+ textField.removeListener(SWT.Modify, listener);
+ }
+ textField.setText(CdmUtils.Nz(text));
+ for (Listener listener : listeners) {
+ textField.addListener(SWT.Modify, listener);
+ }
+
+ // restore caret position
+ textField.setSelection(caretPosition);
+ }
+ }
+
+ /**
+ * <p>getText</p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ public String getText(){
+ return toggleableTextField.getText().getText();
+ }
+
+ /**
+ * <p>Setter for the field <code>state</code>.</p>
+ *
+ * @param state a boolean.
+ */
+ public void setState(boolean state) {
+ this.state = state;
+ setEnabled(state);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setEnabled(boolean enabled) {
+ toggleableTextField.getText().setEnabled(enabled);
+ String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
+ toggleableTextField.getText().setForeground(StoreUtil.getColor(symbolicName));
+ toggleableTextField.getEditButton().setSelection(enabled);
+ }
+
+ /**
+ * <p>Getter for the field <code>state</code>.</p>
+ *
+ * @return a boolean.
+ */
+ public boolean getState(){
+ return state;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setState(toggleableTextField.getEditButton().getSelection());
+ for(SelectionListener listener : selectionListener){
+ listener.widgetSelected(e);
+ }
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+ }
+
+ /**
+ * <p>addSelectionListener</p>
+ *
+ * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public void addSelectionListener(SelectionListener listener){
+ selectionListener.add(listener);
+ }
+
+ /**
+ * <p>removeSelectionListener</p>
+ *
+ * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public void removeSelectionListener(SelectionListener listener){
+ selectionListener.remove(listener);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ /** {@inheritDoc} */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setIrrelevant(boolean irrelevant) {
+ String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND;
+
+ Color color = getColor(colorId);
+ toggleableTextField.getText().setBackground(color);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setBackground(Color color) {
+// label.setBackground(color);
+ toggleableTextField.setBackground(color);
+ }
+
+ @Override
+ public void setSelected(boolean selected) {
+ setBackground(selected ? SELECTED : getPersistentBackground());
+ }
+}
-package eu.etaxonomy.taxeditor.ui.element;
+package eu.etaxonomy.taxeditor.ui.campanula.compatibility;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.IPropertyChangeEmitter;
+
/**
* <p>ICdmFormElement interface.</p>
*
*/
public abstract void setPropertyChangeListeners(
List<IPropertyChangeListener> propertyChangeListeners);
-
+
/**
* <p>getControls</p>
*
* @return a {@link java.util.Set} object.
*/
public abstract Set<Control> getControls();
-
+
/**
* <p>getElements</p>
*
* @return a {@link java.util.Set} object.
*/
public abstract Set<ICdmFormElement> getElements();
-
+
/**
* <p>addElement</p>
*
* @param element a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
*/
public abstract void addElement(ICdmFormElement element);
-
+
/**
* <p>getParentElement</p>
*
* @return a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
*/
public abstract ICdmFormElement getParentElement();
-
+
/**
* <p>removeElements</p>
*/
public abstract void removeElements();
-
+
/**
* <p>getLayoutComposite</p>
*
* @return a {@link org.eclipse.swt.widgets.Composite} object.
*/
public abstract Composite getLayoutComposite();
-
+
/**
* <p>containsFormElement</p>
*
* @return a boolean.
*/
public boolean containsFormElement(ICdmFormElement formElement);
-
+
/**
* <p>setBackground</p>
*
* @param color a {@link org.eclipse.swt.graphics.Color} object.
*/
public void setBackground(Color color);
-
+
/**
* Sets a background color for this element and stores this background color
* for future reference
- *
+ *
* @param color
*/
public void setPersistentBackground(Color color);
-
+
/**
* Get the background color that is associated with this element.
- *
+ *
* @return
*/
public Color getPersistentBackground();
-
+
/**
* Refreshes the layout of this form element.
*
* changes and the current element needs to display that changes
*/
public void refresh();
+
+ /**
+ * <p>Getter for the field <code>formFactory</code>.</p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ */
+ public CdmFormFactory getFormFactory();
}
--- /dev/null
+// $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.campanula.compatibility;
+
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+import eu.etaxonomy.taxeditor.ui.element.ILabeledElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public interface IEntitySelectionElement<T extends ICdmBase> extends SelectionListener, IEnableableFormElement, ISelectableElement, IEntityElement<T>, ILabeledElement, IConversationEnabled {
+ /**
+ * Convenient access to current shell
+ *
+ * @return a {@link org.eclipse.swt.widgets.Shell} object.
+ */
+ public abstract Shell getShell();
+
+ /**
+ * <p>
+ * updateFromWizard
+ * </p>
+ */
+ public abstract void updateFromWizard();
+
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class FieldObservationDetailsElement extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text text_ecology;
+ private Text text_plantDescription;
+ private Text text_FieldNotes;
+ private Text text_IndividualCount;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public FieldObservationDetailsElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ tableWrapLayout.verticalSpacing = 0;
+ tableWrapLayout.topMargin = 0;
+ tableWrapLayout.rightMargin = 0;
+ tableWrapLayout.leftMargin = 0;
+ tableWrapLayout.horizontalSpacing = 0;
+ tableWrapLayout.bottomMargin = 0;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblEcology = formToolkit.createLabel(this, "Ecology", SWT.NONE);
+
+ text_ecology = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_ecology.setText("");
+ text_ecology.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblPlantDescription = formToolkit.createLabel(this, "Plant Description", SWT.NONE);
+
+ text_plantDescription = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_plantDescription.setText("");
+ text_plantDescription.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblFieldNotes = formToolkit.createLabel(this, "Field Notes", SWT.NONE);
+
+ text_FieldNotes = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_FieldNotes.setText("");
+ text_FieldNotes.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblIndividualCount = formToolkit.createLabel(this, "Individual Count", SWT.NONE);
+
+ text_IndividualCount = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_IndividualCount.setText("");
+ text_IndividualCount.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getText_ecology() {
+ return text_ecology;
+ }
+ public Text getText_plantDescription() {
+ return text_plantDescription;
+ }
+ public Text getText_FieldNotes() {
+ return text_FieldNotes;
+ }
+ public Text getText_IndividualCount() {
+ return text_IndividualCount;
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class FieldObservationDetailsElementController extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+ private FieldObservationDetailsElement fieldObservationDetailsElement;
+
+ private TextFieldController text_ecology;
+
+ private TextFieldController text_plantDescription;
+
+ private TextFieldController text_fieldObjectDefinition;
+
+ private TextFieldController text_fieldNotes;
+
+ private NumberFieldController number_individualCount;
+
+ /**
+ * <p>
+ * Constructor for FieldObservationDetailElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ */
+ public FieldObservationDetailsElementController(FieldObservationDetailsElement fieldObservationDetailsElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ this.fieldObservationDetailsElement = fieldObservationDetailsElement;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+// text_ecology = new TextFieldController(fieldObservationDetailsElement.getText_ecology(), getFormFactory(), formElement, entity.getEcology(CdmStore.getDefaultLanguage()), null);
+// text_plantDescription = new TextFieldController(fieldObservationDetailsElement.getText_plantDescription(), getFormFactory(), formElement, entity.getPlantDescription(CdmStore.getDefaultLanguage()), style);
+ // Disable for now
+ // text_fieldObjectDefinition = formFactory.createTextWithLabelElement(formElement, "Field Object Definition", entity.getFieldObjectDefinition(CdmStore.getDefaultLanguage()), style);
+ text_fieldNotes = new TextFieldController(fieldObservationDetailsElement.getText_FieldNotes(), getFormFactory(), formElement, entity.getFieldNotes(), style);
+
+ number_individualCount = new NumberFieldController(fieldObservationDetailsElement.getText_IndividualCount(), getFormFactory(), formElement, entity.getIndividualCount());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+// if (eventSource == text_ecology) {
+// getEntity().setEcology(text_ecology.getText());
+// } else if (eventSource == text_plantDescription) {
+// getEntity().setPlantDescription(text_plantDescription.getText());
+// } else if (eventSource == text_fieldObjectDefinition) {
+// getEntity().addFieldObjectDefinition(text_fieldObjectDefinition.getText(), CdmStore.getDefaultLanguage());
+// } else
+ if (eventSource == text_fieldNotes) {
+ getEntity().setFieldNotes(text_fieldNotes.getText());
+ } else if (eventSource == number_individualCount) {
+ getEntity().setIndividualCount(number_individualCount.getInteger());
+ }
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 21.08.2013
+ *
+ */
+public class FieldObservationDetailsSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+ /**
+ * <p>Constructor for FieldObservationDetailSection.</p>
+ *
+ * @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.
+ */
+ public FieldObservationDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Field Observation Details";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createFieldObservationDetailsElementController(parentElement);
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 07.08.2013
+ *
+ */
+public class FieldObservationDetailsView extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public FieldObservationDetailsView(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 1;
+ setLayout(tableWrapLayout);
+ }
+
+ ExpandableComposite xpndblcmpstNewExpandablecomposite = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstNewExpandablecomposite = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstNewExpandablecomposite.grabHorizontal = true;
+ xpndblcmpstNewExpandablecomposite.setLayoutData(twd_xpndblcmpstNewExpandablecomposite);
+ formToolkit.paintBordersFor(xpndblcmpstNewExpandablecomposite);
+ xpndblcmpstNewExpandablecomposite.setText("FieldObservation");
+ xpndblcmpstNewExpandablecomposite.setExpanded(true);
+
+ FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(xpndblcmpstNewExpandablecomposite, SWT.NONE);
+ formToolkit.adapt(fieldObservationGeneralElement);
+ formToolkit.paintBordersFor(fieldObservationGeneralElement);
+ xpndblcmpstNewExpandablecomposite.setClient(fieldObservationGeneralElement);
+
+ ExpandableComposite xpndblcmpstNewExpandablecomposite_1 = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstNewExpandablecomposite_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstNewExpandablecomposite_1.grabHorizontal = true;
+ xpndblcmpstNewExpandablecomposite_1.setLayoutData(twd_xpndblcmpstNewExpandablecomposite_1);
+ formToolkit.paintBordersFor(xpndblcmpstNewExpandablecomposite_1);
+ xpndblcmpstNewExpandablecomposite_1.setText("Gathering Event Details");
+ xpndblcmpstNewExpandablecomposite_1.setExpanded(true);
+
+ GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(xpndblcmpstNewExpandablecomposite_1, SWT.NONE);
+ formToolkit.adapt(gatheringEventDetailsElement);
+ formToolkit.paintBordersFor(gatheringEventDetailsElement);
+ xpndblcmpstNewExpandablecomposite_1.setClient(gatheringEventDetailsElement);
+
+ ExpandableComposite xpndblcmpstFieldObservationDetails = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstFieldObservationDetails = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstFieldObservationDetails.grabHorizontal = true;
+ xpndblcmpstFieldObservationDetails.setLayoutData(twd_xpndblcmpstFieldObservationDetails);
+ formToolkit.paintBordersFor(xpndblcmpstFieldObservationDetails);
+ xpndblcmpstFieldObservationDetails.setText("Field Observation Details");
+ xpndblcmpstFieldObservationDetails.setExpanded(true);
+
+ FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(xpndblcmpstFieldObservationDetails, SWT.NONE);
+ formToolkit.adapt(fieldObservationDetailsElement);
+ formToolkit.paintBordersFor(fieldObservationDetailsElement);
+ xpndblcmpstFieldObservationDetails.setClient(fieldObservationDetailsElement);
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionField;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointField;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextField;
+
+/**
+ * @author pplitzner
+ * @date 07.08.2013
+ *
+ */
+public class FieldObservationGeneralElement extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private final Text textLocality;
+ private final Text textElevation;
+ private final Text textCollectingNumber;
+ private EntitySelectionField countrySelectionField;
+ private EntitySelectionField collectorSelectionField;
+ private ToggleableTextField toggleableTextField;
+ private PointField pointField;
+ private Text textAccessionNumber;
+ private EntitySelectionField collectionSelectionField;
+ private Label lblCollection;
+ private Label lblAccesionNumber;
+ private Label lblCountry;
+ private Label lblLocality;
+ private Label lblLatitude;
+ private Label lblLongitude;
+ private Label lblErrorRadiusm;
+ private Label lblReferenceSystem;
+ private Label lblAbsoluteElevationm;
+ private Label lblDate;
+ private Label lblCollector;
+ private Label lblCollectingNumber;
+
+ /**
+ * Create the composite.
+ *
+ * @param parent
+ * @param style
+ */
+ public FieldObservationGeneralElement(Composite parent, int style) {
+ super(parent, SWT.NONE);
+ setBackgroundMode(SWT.INHERIT_DEFAULT);
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
+
+ toggleableTextField = new ToggleableTextField(this, SWT.NONE);
+ toggleableTextField.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_toggleableTextField.grabHorizontal = true;
+ toggleableTextField.setLayoutData(twd_toggleableTextField);
+ formToolkit.adapt(toggleableTextField);
+ formToolkit.paintBordersFor(toggleableTextField);
+
+ lblCountry = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblCountry, true, true);
+ lblCountry.setText("Country");
+
+ countrySelectionField = new EntitySelectionField(this, SWT.NONE);
+ countrySelectionField.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(countrySelectionField);
+ formToolkit.paintBordersFor(countrySelectionField);
+
+ lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
+
+ textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
+ textLocality.setText("");
+ textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
+
+ pointField = new PointField(this, SWT.NONE);
+ TableWrapLayout twl_pointField = (TableWrapLayout) pointField.getLayout();
+ twl_pointField.verticalSpacing = 0;
+ twl_pointField.topMargin = 0;
+ twl_pointField.rightMargin = 0;
+ twl_pointField.leftMargin = 0;
+ twl_pointField.horizontalSpacing = 0;
+ twl_pointField.bottomMargin = 0;
+ pointField.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 6, 1));
+ formToolkit.adapt(pointField);
+ formToolkit.paintBordersFor(pointField);
+ new Label(this, SWT.NONE);
+
+ lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
+ new Label(this, SWT.NONE);
+
+ lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
+
+ lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
+
+ lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
+
+ textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
+ textElevation.setText("");
+ textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
+ new Label(this, SWT.NONE);
+
+ lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
+
+ collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
+ collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(collectorSelectionField);
+ formToolkit.paintBordersFor(collectorSelectionField);
+
+ lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
+
+ textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
+ textCollectingNumber.setText("");
+ textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ lblCollection = formToolkit.createLabel(this, "Collection", SWT.NONE);
+
+ collectionSelectionField = new EntitySelectionField(this, SWT.NONE);
+ formToolkit.adapt(collectionSelectionField);
+ formToolkit.paintBordersFor(collectionSelectionField);
+
+ lblAccesionNumber = formToolkit.createLabel(this, "Accesion Number", SWT.NONE);
+
+ textAccessionNumber = formToolkit.createText(this, "New Text", SWT.NONE);
+ textAccessionNumber.setText("");
+ textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public EntitySelectionField getCountrySelectionField() {
+ return countrySelectionField;
+ }
+
+ public EntitySelectionField getCollectorSelectionField() {
+ return collectorSelectionField;
+ }
+
+ public Text getTextElevation() {
+ return textElevation;
+ }
+
+ public Text getTextLocality() {
+ return textLocality;
+ }
+
+ public Text getTextCollectingNumber() {
+ return textCollectingNumber;
+ }
+
+ public ToggleableTextField getToggleableTextField() {
+ return toggleableTextField;
+ }
+
+ public PointField getPointField() {
+ return pointField;
+ }
+ public EntitySelectionField getCollectionSelectionField() {
+ return collectionSelectionField;
+ }
+ public Text getTextAccessionNumber() {
+ return textAccessionNumber;
+ }
+ public Label getLblCollection() {
+ return lblCollection;
+ }
+ public Label getLblAccesionNumber() {
+ return lblAccesionNumber;
+ }
+ public Label getLblCountry() {
+ return lblCountry;
+ }
+ public Label getLblLocality() {
+ return lblLocality;
+ }
+ public Label getLblLatitude() {
+ return lblLatitude;
+ }
+ public Label getLblLongitude() {
+ return lblLongitude;
+ }
+ public Label getLblErrorRadiusm() {
+ return lblErrorRadiusm;
+ }
+ public Label getLblReferenceSystem() {
+ return lblReferenceSystem;
+ }
+ public Label getLblAbsoluteElevation() {
+ return lblAbsoluteElevationm;
+ }
+ public Label getLblDate() {
+ return lblDate;
+ }
+ public Label getLblCollector() {
+ return lblCollector;
+ }
+ public Label getLblCollectingNumber() {
+ return lblCollectingNumber;
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.cdm.model.occurrence.Collection;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.LanguageTextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 13.08.2013
+ *
+ */
+public class FieldObservationGeneralElementController extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+ private FieldObservationGeneralElement fieldObservationGeneralElement;
+
+ private ToggleableTextFieldController toggleableText_titleCache;
+ private EntitySelectionFieldController<NamedArea> selection_country;
+ private LanguageTextFieldController languageText_locality;
+ private PointFieldController element_point;
+ private NumberFieldController number_elevation;
+ private TimePeriodElement element_date;//TODO convert
+ private EntitySelectionFieldController<AgentBase> selection_collector;
+ private TextFieldController text_collectingNumber;
+ private EntitySelectionFieldController<Collection> selectionCollection;
+ private TextFieldController textAccessionNumber;
+
+ boolean isSpecimen;
+ boolean isWizard;
+
+ /**
+ * @param formFactory
+ * @param formElement
+ */
+ public FieldObservationGeneralElementController(FieldObservationGeneralElement fieldObservationGeneralElement, CdmFormFactory formFactory, ICdmFormElement formElement, boolean isSpecimen, boolean isWizard) {
+ super(formFactory, formElement);
+ this.fieldObservationGeneralElement = fieldObservationGeneralElement;
+ this.isSpecimen = isSpecimen;
+ this.isWizard = isWizard;
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
+ */
+ @Override
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+ toggleableText_titleCache = new ToggleableTextFieldController(fieldObservationGeneralElement.getToggleableTextField(), getFormFactory(), formElement, entity.getTitleCache(), entity.isProtectedTitleCache(), style);
+
+ selection_country = new EntitySelectionFieldController<NamedArea>(fieldObservationGeneralElement.getCountrySelectionField(), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, entity.getCountry(), EntitySelectionElement.NOTHING);
+ languageText_locality = new LanguageTextFieldController(fieldObservationGeneralElement.getTextLocality(), getFormFactory(), formElement, entity.getLocality());
+ element_point = new PointFieldController(fieldObservationGeneralElement.getPointField(),getFormFactory(), formElement, entity.getExactLocation(), style);
+ number_elevation = new NumberFieldController(fieldObservationGeneralElement.getTextElevation(), getFormFactory(), formElement, entity.getAbsoluteElevation());
+ element_date = formFactory.createTimePeriodElement(formElement, "Date", entity.getGatheringPeriod(), style);
+ selection_collector = new EntitySelectionFieldController<AgentBase>(fieldObservationGeneralElement.getCollectorSelectionField(), getFormFactory(), getConversationHolder(), formElement, AgentBase.class, entity.getCollector(), EntitySelectionElement.ALL);
+ text_collectingNumber = new TextFieldController(fieldObservationGeneralElement.getTextCollectingNumber(), getFormFactory(), formElement, entity.getFieldNumber(), null);
+ if(isWizard){
+ if(!isSpecimen){
+ fieldObservationGeneralElement.getLblCollection().setVisible(false);
+ fieldObservationGeneralElement.getCollectionSelectionField().setVisible(false);
+ fieldObservationGeneralElement.getLblAccesionNumber().setVisible(false);
+ fieldObservationGeneralElement.getTextAccessionNumber().setVisible(false);
+ }
+ else{
+ selectionCollection = new EntitySelectionFieldController<Collection>(fieldObservationGeneralElement.getCollectionSelectionField(), getFormFactory(), getConversationHolder(), formElement, Collection.class, entity.getCollection(), EntitySelectionElement.ALL);
+ textAccessionNumber = new TextFieldController(fieldObservationGeneralElement.getTextAccessionNumber(), getFormFactory(), formElement, entity.getAccessionNumber(), null);
+ }
+ }
+ else{
+ if(isSpecimen){
+ selectionCollection = new EntitySelectionFieldController<Collection>(fieldObservationGeneralElement.getCollectionSelectionField(), getFormFactory(), getConversationHolder(), formElement, Collection.class, entity.getCollection(), EntitySelectionElement.ALL);
+ textAccessionNumber = new TextFieldController(fieldObservationGeneralElement.getTextAccessionNumber(), getFormFactory(), formElement, entity.getAccessionNumber(), null);
+ fieldObservationGeneralElement.getLblCountry().setEnabled(false);
+ fieldObservationGeneralElement.getCountrySelectionField().setEnabled(false);
+ fieldObservationGeneralElement.getLblLocality().setEnabled(false);
+ fieldObservationGeneralElement.getTextLocality().setEnabled(false);
+
+ fieldObservationGeneralElement.getPointField().setEnabled(false);
+ // fieldObservationGeneralElement.getPointField().getText_latitude().setEnabled(false);
+ fieldObservationGeneralElement.getLblLatitude().setEnabled(false);
+ // fieldObservationGeneralElement.getPointField().getText_longitude().setEnabled(false);
+ fieldObservationGeneralElement.getLblLongitude().setEnabled(false);
+ // fieldObservationGeneralElement.getPointField().getNumber_errorRadius().setEnabled(false);
+ fieldObservationGeneralElement.getLblErrorRadiusm().setEnabled(false);
+ // fieldObservationGeneralElement.getPointField().getCombo_referenceSystem().setEnabled(false);
+ fieldObservationGeneralElement.getLblReferenceSystem().setEnabled(false);
+
+ fieldObservationGeneralElement.getLblAbsoluteElevation().setEnabled(false);
+ fieldObservationGeneralElement.getTextElevation().setEnabled(false);
+ fieldObservationGeneralElement.getLblDate().setEnabled(false);
+
+ fieldObservationGeneralElement.getLblCollector().setEnabled(false);
+ fieldObservationGeneralElement.getCollectorSelectionField().setEnabled(false);
+ fieldObservationGeneralElement.getLblCollectingNumber().setEnabled(false);
+ fieldObservationGeneralElement.getTextCollectingNumber().setEnabled(false);
+ }
+ else{
+ fieldObservationGeneralElement.getLblCollection().setVisible(false);
+ fieldObservationGeneralElement.getCollectionSelectionField().setVisible(false);
+ fieldObservationGeneralElement.getLblAccesionNumber().setVisible(false);
+ fieldObservationGeneralElement.getTextAccessionNumber().setVisible(false);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+ * .lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == toggleableText_titleCache) {
+ getEntity().setTitleCache(toggleableText_titleCache.getText(), toggleableText_titleCache.getState());
+ } else if (eventSource == selection_country) {
+ getEntity().setCountry(selection_country.getSelection());
+ } else if (eventSource == languageText_locality) {
+ LanguageString locality = languageText_locality.getLanguageString();
+ getEntity().setLocality(locality);
+ } else if (eventSource == element_point) {
+ getEntity().setExactLocation(element_point.getPoint());
+ } else if (eventSource == number_elevation) {
+ getEntity().setAbsoluteElevation(number_elevation.getInteger());
+ } else if (eventSource == element_date) {
+ getEntity().setGatheringPeriod(element_date.getTimePeriod());
+ } else if (eventSource == selection_collector) {
+ getEntity().setCollector(selection_collector.getSelection());
+ } else if (eventSource == text_collectingNumber) {
+ getEntity().setFieldNumber(text_collectingNumber.getText());
+ } else if (eventSource == selectionCollection) {
+ getEntity().setCollection(selectionCollection.getSelection());
+ } else if (eventSource == textAccessionNumber) {
+ getEntity().setAccessionNumber(textAccessionNumber.getText());
+ }
+ if (eventSource != toggleableText_titleCache) {
+ toggleableText_titleCache.setText(getEntity().getTitleCache());
+ }
+ }
+
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class FieldObservationGeneralSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+ /**
+ * <p>Constructor for FieldObservationDetailSection.</p>
+ *
+ * @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.
+ */
+ public FieldObservationGeneralSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Field Observation";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createFieldObservationGeneralElementController(parentElement);
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 07.08.2013
+ *
+ */
+public class GatheringEventDetailsElement extends Composite {
+ private FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text textElevationError;
+ private Text text_ElevationMinimum;
+ private Text text_ElevationMaximum;
+ private Text text_CollectingMethod;
+ private Text text_DistanceToGround;
+ private Text text_DistanceToWaterSurface;
+ private Text text_GatheringEventDescription;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public GatheringEventDetailsElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.verticalSpacing = 0;
+ tableWrapLayout.topMargin = 0;
+ tableWrapLayout.rightMargin = 0;
+ tableWrapLayout.leftMargin = 0;
+ tableWrapLayout.horizontalSpacing = 0;
+ tableWrapLayout.bottomMargin = 0;
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblElevationError = formToolkit.createLabel(this, "Elevation Error", SWT.NONE);
+
+ textElevationError = formToolkit.createText(this, "New Text", SWT.NONE);
+ textElevationError.setText("");
+ textElevationError.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblElevationMinimumm = formToolkit.createLabel(this, "Elevation Minimum (m)", SWT.NONE);
+
+ text_ElevationMinimum = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_ElevationMinimum.setText("");
+ text_ElevationMinimum.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblElevationMaximumm = formToolkit.createLabel(this, "Elevation Maximum (m)", SWT.NONE);
+
+ text_ElevationMaximum = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_ElevationMaximum.setText("");
+ text_ElevationMaximum.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblCollectingMethod = formToolkit.createLabel(this, "Collecting Method", SWT.NONE);
+
+ text_CollectingMethod = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_CollectingMethod.setText("");
+ text_CollectingMethod.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblDistanceToGround = formToolkit.createLabel(this, "Distance To Ground (m)", SWT.NONE);
+
+ text_DistanceToGround = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_DistanceToGround.setText("");
+ text_DistanceToGround.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblDistanceToWater = formToolkit.createLabel(this, "Distance To Water Surface (m)", SWT.NONE);
+
+ text_DistanceToWaterSurface = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_DistanceToWaterSurface.setText("");
+ text_DistanceToWaterSurface.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblGatheringEventDescription = formToolkit.createLabel(this, "Gathering Event Description", SWT.NONE);
+
+ text_GatheringEventDescription = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_GatheringEventDescription.setText("");
+ text_GatheringEventDescription.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getTextElevationError() {
+ return textElevationError;
+ }
+ public Text getText_ElevationMinimum() {
+ return text_ElevationMinimum;
+ }
+ public Text getText_ElevationMaximum() {
+ return text_ElevationMaximum;
+ }
+ public Text getText_CollectingMethod() {
+ return text_CollectingMethod;
+ }
+ public Text getText_DistanceToGround() {
+ return text_DistanceToGround;
+ }
+ public Text getText_DistanceToWaterSurface() {
+ return text_DistanceToWaterSurface;
+ }
+ public Text getText_GatheringEventDescription() {
+ return text_GatheringEventDescription;
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 14.08.2013
+ *
+ */
+public class GatheringEventDetailsElementController extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+ private GatheringEventDetailsElement gatheringEventDetailsElement;
+
+// private NumberFieldController number_absoluteElevationError;
+
+// private NumberFieldController number_absoluteElevationMinimum;
+
+ private NumberFieldController number_absoluteElevationMaximum;
+
+ private TextFieldController text_collectingMethod;
+
+ private NumberFieldController number_distanceToGround;
+
+ private NumberFieldController number_distanceToWaterSurface;
+
+ private TextFieldController text_gatheringEventDescription;
+
+ private CollectingAreasDetailSection section_collectingAreas;
+
+ /**
+ * <p>
+ * Constructor for GatheringEventDetailElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ */
+ public GatheringEventDetailsElementController(GatheringEventDetailsElement gatheringEventDetailsElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ this.gatheringEventDetailsElement = gatheringEventDetailsElement;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+
+// number_absoluteElevationError = new NumberFieldController(gatheringEventDetailsElement.getTextElevationError(), formFactory, this, entity.getAbsoluteElevation());
+// number_absoluteElevationMinimum = new NumberFieldController(gatheringEventDetailsElement.getText_ElevationMinimum(), formFactory, this, entity.getAbsoluteElevationMinimum());
+ number_absoluteElevationMaximum = new NumberFieldController(gatheringEventDetailsElement.getText_ElevationMaximum(), formFactory, this, entity.getAbsoluteElevationMaximum());
+ text_collectingMethod = new TextFieldController(gatheringEventDetailsElement.getText_CollectingMethod(), formFactory, this, entity.getCollectingMethod(), null);
+ number_distanceToGround = new NumberFieldController(gatheringEventDetailsElement.getText_DistanceToGround(), formFactory, this, entity.getDistanceToGround());
+ number_distanceToWaterSurface = new NumberFieldController(gatheringEventDetailsElement.getText_DistanceToWaterSurface(), formFactory, this, entity.getDistanceToWaterSurface());
+ text_gatheringEventDescription = new TextFieldController(gatheringEventDetailsElement.getText_GatheringEventDescription(), formFactory, this, entity.getGatheringEventDescription(), null);
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_collectingAreas.setEntity(entity);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+// if (eventSource == number_absoluteElevationError) {
+// getEntity().setAbsoluteElevationError(number_absoluteElevationError.getDouble());
+// }
+// else if (eventSource == number_absoluteElevationMinimum) {
+// try {
+// getEntity().setAbsoluteElevationRange(number_absoluteElevationMinimum.getInteger(), number_absoluteElevationMaximum.getInteger());
+// number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+// } catch (IllegalArgumentException e) {
+// number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+// AbstractUtility.warn(getClass(), e.getLocalizedMessage());
+// }
+// }
+// else if (eventSource == number_absoluteElevationMaximum) {
+// try {
+// getEntity().setAbsoluteElevationRange(number_absoluteElevationError.getInteger(), number_absoluteElevationMaximum.getInteger());
+// number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+// } catch (IllegalArgumentException e) {
+// number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+// AbstractUtility.warn(getClass(), e.getLocalizedMessage());
+// }
+// } else
+ if (eventSource == text_collectingMethod) {
+ getEntity().setCollectingMethod(text_collectingMethod.getText());
+ } else if (eventSource == number_distanceToGround) {
+ getEntity().setDistanceToGround(number_distanceToGround.getDouble());
+ } else if (eventSource == number_distanceToWaterSurface) {
+ getEntity().setDistanceToWaterSurface(number_distanceToWaterSurface.getDouble());
+ } else if (eventSource == text_gatheringEventDescription) {
+ getEntity().setGatheringEventDescription(text_gatheringEventDescription.getText());
+ }
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.fieldObservation;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 21.08.2013
+ *
+ */
+public class GatheringEventSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+ /**
+ * <p>Constructor for GatheringEventDetailSection.</p>
+ *
+ * @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.
+ */
+ public GatheringEventSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Gathering Event Details";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createGatheringEventDetailsElementController(parentElement);
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionField;
+
+/**
+ * @author pplitzner
+ * @date 29.08.2013
+ *
+ */
+public class DerivedUnitDetailsElement extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text textBarcode;
+ private Text textCatalogNumber;
+ private Text txtExsiccatum;
+ private Combo comboPreservationMethod;
+ private EntitySelectionField storedUnderSelectionField;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public DerivedUnitDetailsElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblBarcode = formToolkit.createLabel(this, "Barcode", SWT.NONE);
+
+ textBarcode = formToolkit.createText(this, "New Text", SWT.NONE);
+ textBarcode.setText("");
+ textBarcode.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblCatalognumber = formToolkit.createLabel(this, "CatalogNumber", SWT.NONE);
+
+ textCatalogNumber = formToolkit.createText(this, "New Text", SWT.NONE);
+ textCatalogNumber.setText("");
+ textCatalogNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblPreservationMethod = formToolkit.createLabel(this, "Preservation Method", SWT.NONE);
+
+ comboPreservationMethod = new Combo(this, SWT.NONE);
+ comboPreservationMethod.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(comboPreservationMethod);
+ formToolkit.paintBordersFor(comboPreservationMethod);
+
+ Label lblStoredUnder = formToolkit.createLabel(this, "Stored Under", SWT.NONE);
+
+ storedUnderSelectionField = new EntitySelectionField(this, SWT.NONE);
+ formToolkit.adapt(storedUnderSelectionField);
+ formToolkit.paintBordersFor(storedUnderSelectionField);
+
+ Label lblExsiccatum = formToolkit.createLabel(this, "Exsiccatum", SWT.NONE);
+
+ txtExsiccatum = formToolkit.createText(this, "New Text", SWT.NONE);
+ txtExsiccatum.setText("");
+ txtExsiccatum.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getTextBarcode() {
+ return textBarcode;
+ }
+ public Text getTextCatalogNumber() {
+ return textCatalogNumber;
+ }
+ public Combo getComboPreservationMethod() {
+ return comboPreservationMethod;
+ }
+ public EntitySelectionField getStoredUnderSelectionField() {
+ return storedUnderSelectionField;
+ }
+ public Text getTxtExsiccatum() {
+ return txtExsiccatum;
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.api.facade.MethodNotSupportedByDerivedUnitTypeException;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 29.08.2013
+ *
+ */
+public class DerivedUnitDetailsElementController extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+ private DerivedUnitDetailsElement derivedUnitDetailsElement;
+
+ private TextFieldController barCode;
+ private TextFieldController catalogNumber;
+// private ComboDefinedTermController<PreservationMethod> preservationMethod;
+ private EntitySelectionFieldController<TaxonNameBase> storedUnder;
+ private TextFieldController exsiccatum;
+
+ private SourceCollectionDetailSection section_source;
+
+
+ public DerivedUnitDetailsElementController(DerivedUnitDetailsElement derivedUnitDetailsElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ this.derivedUnitDetailsElement = derivedUnitDetailsElement;
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement, java.lang.Object, int)
+ */
+ @Override
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+ barCode = new TextFieldController(derivedUnitDetailsElement.getTextBarcode(), getFormFactory(), formElement, entity.getBarcode(), null);
+ catalogNumber = new TextFieldController(derivedUnitDetailsElement.getTextCatalogNumber(), getFormFactory(), formElement, entity.getCatalogNumber(), null);
+ PreservationMethod entityPreservationMethod;
+ try {
+ entityPreservationMethod = entity.getPreservationMethod();
+ } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+ // we ignore this
+ AbstractUtility.info(e.getMessage());
+ entityPreservationMethod = null;
+ }
+// preservationMethod = new ComboDefinedTermController<PreservationMethod>(derivedUnitDetailsElement.getComboPreservationMethod(), getFormFactory(), formElement, PreservationMethod.class, entityPreservationMethod, style);
+ storedUnder = new EntitySelectionFieldController<TaxonNameBase>(derivedUnitDetailsElement.getStoredUnderSelectionField(), getFormFactory(), getConversationHolder(), formElement, TaxonNameBase.class, entity.getStoredUnder(), EntitySelectionElement.ALL);
+ String entitiyExsiccatum;
+ try {
+ entitiyExsiccatum = entity.getExsiccatum();
+ } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+ // we ignore this
+ AbstractUtility.info(e.getMessage());
+ entitiyExsiccatum = null;
+ }
+ exsiccatum = new TextFieldController(derivedUnitDetailsElement.getTxtExsiccatum(), getFormFactory(), formElement, entitiyExsiccatum, null);
+
+ section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_source.setEntity(entity);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == barCode) {
+ getEntity().setBarcode(barCode.getText());
+ } else if (eventSource == catalogNumber) {
+ getEntity().setCatalogNumber(catalogNumber.getText());
+// } else if (eventSource == preservationMethod) {
+// try {
+// getEntity().setPreservationMethod(preservationMethod.getSelection());
+// } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+// AbstractUtility.errorDialog("MethodNotSupportedByDerivedUnitTypeException", this, "MethodNotSupportedByDerivedUnitTypeException when trying to set preservation method for derive unit", e);
+// }
+ } else if (eventSource == storedUnder) {
+ getEntity().setStoredUnder(storedUnder.getEntity());
+ } else if (eventSource == exsiccatum) {
+ try {
+ getEntity().setExsiccatum(exsiccatum.getText());
+ } catch (Exception e) {
+ AbstractUtility.error(this.getClass(), e);
+ }
+ }
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 29.08.2013
+ *
+ */
+public class DerivedUnitDetailsSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection {
+
+ public DerivedUnitDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Derived Unit Details";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createDerivedUnitDetailsElementController(parentElement);
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 29.08.2013
+ *
+ */
+public class SpecimenDetailsElement extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text text_IndividualEcology;
+ private Text text_PlantDesriptionDetails;
+ private Text text_IndividualFieldNotes;
+ private Combo comboLiveStage;
+ private Combo combo_Sex;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public SpecimenDetailsElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblNewLabel = formToolkit.createLabel(this, "Individual Ecology", SWT.NONE);
+
+ text_IndividualEcology = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_IndividualEcology.setText("");
+ text_IndividualEcology.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblPlantDescriptionDetails = formToolkit.createLabel(this, "Plant Description Details", SWT.NONE);
+
+ text_PlantDesriptionDetails = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_PlantDesriptionDetails.setText("");
+ text_PlantDesriptionDetails.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblIndividualFieldNotes = formToolkit.createLabel(this, "Individual Field Notes", SWT.NONE);
+
+ text_IndividualFieldNotes = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_IndividualFieldNotes.setText("");
+ text_IndividualFieldNotes.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblLiveStage = formToolkit.createLabel(this, "Live Stage", SWT.NONE);
+
+ comboLiveStage = new Combo(this, SWT.NONE);
+ comboLiveStage.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(comboLiveStage);
+ formToolkit.paintBordersFor(comboLiveStage);
+
+ Label lblSex = formToolkit.createLabel(this, "Sex", SWT.NONE);
+
+ combo_Sex = new Combo(this, SWT.NONE);
+ combo_Sex.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(combo_Sex);
+ formToolkit.paintBordersFor(combo_Sex);
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getText_IndividualEcology() {
+ return text_IndividualEcology;
+ }
+ public Text getText_PlantDesriptionDetails() {
+ return text_PlantDesriptionDetails;
+ }
+ public Text getText_IndividualFieldNotes() {
+ return text_IndividualFieldNotes;
+ }
+ public Combo getComboLiveStage() {
+ return comboLiveStage;
+ }
+ public Combo getCombo_Sex() {
+ return combo_Sex;
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ComboDefinedTermController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date 29.08.2013
+ *
+ */
+public class SpecimenDetailsElementController extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+ private SpecimenDetailsElement specimenDetailsElement;
+ private TextFieldController individualEcology;
+ private TextFieldController plantDescriptionDetails;
+ private TextFieldController individualFieldNotes;
+ private ComboDefinedTermController<DefinedTerm> liveStage;
+ private ComboDefinedTermController<DefinedTerm> sex;
+
+
+ public SpecimenDetailsElementController(SpecimenDetailsElement specimenDetailsElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ this.specimenDetailsElement = specimenDetailsElement;
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+ formFactory.addPropertyChangeListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement, java.lang.Object, int)
+ */
+ @Override
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+ individualEcology = new TextFieldController(specimenDetailsElement.getText_IndividualEcology(), getFormFactory(), formElement, entity.getEcology(), null);
+ plantDescriptionDetails = new TextFieldController(specimenDetailsElement.getText_PlantDesriptionDetails(), getFormFactory(), formElement, entity.getPlantDescription(), null);
+ plantDescriptionDetails = new TextFieldController(specimenDetailsElement.getText_IndividualFieldNotes(), getFormFactory(), formElement, entity.getFieldNotes(), null);
+ liveStage = new ComboDefinedTermController<DefinedTerm>(specimenDetailsElement.getComboLiveStage(), getFormFactory(), formElement, DefinedTerm.class, entity.getLifeStage(), style);
+ sex = new ComboDefinedTermController<DefinedTerm>(specimenDetailsElement.getCombo_Sex(), getFormFactory(), formElement, DefinedTerm.class, entity.getSex(), style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource == individualEcology){
+ getEntity().setEcology(individualEcology.getText());
+ }
+ else if(eventSource == plantDescriptionDetails){
+ getEntity().setPlantDescription(plantDescriptionDetails.getText());
+ }
+ else if(eventSource == individualFieldNotes){
+ getEntity().setFieldNotes(individualFieldNotes.getText());
+ }
+ else if(eventSource == liveStage){
+ getEntity().setLifeStage(liveStage.getSelection());
+ }
+ else if(eventSource == sex){
+ getEntity().setSex(sex.getSelection());
+ }
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 29.08.2013
+ *
+ */
+public class SpecimenDetailsSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection {
+
+ public SpecimenDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Specimen Details";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createSpecimenDetailsElementController(parentElement);
+ }
+}
--- /dev/null
+// $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.campanula.detailViews.specimen;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class SpecimenGeneralSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+ public SpecimenGeneralSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Specimen";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createSpecimenGeneralElementController(parentElement);
+ }
+}
--- /dev/null
+// $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.campanula.specimenSearch;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * @author pplitzner
+ * @date 03.09.2013
+ *
+ */
+public class SpecimenSearchComposite extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text textTaxonName;
+ private Text textCollector;
+ private Text textCollectorNumber;
+ private Text textAccessionNumber;
+ private Text textLocality;
+ private Combo comboHerbarium;
+ private Combo comboCountry;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public SpecimenSearchComposite(Composite parent, int style) {
+ super(parent, style);
+ setBackgroundMode(SWT.INHERIT_DEFAULT);
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblTaxonName = formToolkit.createLabel(this, "Taxon Name", SWT.NONE);
+
+ textTaxonName = new Text(this, SWT.BORDER);
+ textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(textTaxonName, true, true);
+
+ Label lblCollectors = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblCollectors, true, true);
+ lblCollectors.setText("Collector(s)");
+
+ textCollector = new Text(this, SWT.BORDER);
+ textCollector.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(textCollector, true, true);
+
+ Label lblCollectorsNumber = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblCollectorsNumber, true, true);
+ lblCollectorsNumber.setText("Collector(s) Number");
+
+ textCollectorNumber = new Text(this, SWT.BORDER);
+ textCollectorNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(textCollectorNumber, true, true);
+
+ Label lblAccessionNumber = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblAccessionNumber, true, true);
+ lblAccessionNumber.setText("Accession Number");
+
+ textAccessionNumber = new Text(this, SWT.BORDER);
+ textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(textAccessionNumber, true, true);
+
+ Label lblHerbarium = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblHerbarium, true, true);
+ lblHerbarium.setText("Herbarium");
+
+ comboHerbarium = new Combo(this, SWT.NONE);
+ comboHerbarium.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(comboHerbarium);
+ formToolkit.paintBordersFor(comboHerbarium);
+
+ Label lblCountry = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblCountry, true, true);
+ lblCountry.setText("Country");
+
+ comboCountry = new Combo(this, SWT.NONE);
+ comboCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(comboCountry);
+ formToolkit.paintBordersFor(comboCountry);
+
+ Label lblLocality = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblLocality, true, true);
+ lblLocality.setText("Locality");
+
+ textLocality = new Text(this, SWT.BORDER);
+ textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ formToolkit.adapt(textLocality, true, true);
+
+ Label lblCollectionDate = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblCollectionDate, true, true);
+ lblCollectionDate.setText("Collection Date");
+ new Label(this, SWT.NONE);
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getTextTaxonName() {
+ return textTaxonName;
+ }
+ public Text getTextCollector() {
+ return textCollector;
+ }
+ public Text getTextCollectorNumber() {
+ return textCollectorNumber;
+ }
+ public Text getTextAccessionNumber() {
+ return textAccessionNumber;
+ }
+ public Combo getComboHerbarium() {
+ return comboHerbarium;
+ }
+ public Combo getComboCountry() {
+ return comboCountry;
+ }
+ public Text getTextLocality() {
+ return textLocality;
+ }
+}
--- /dev/null
+// $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.campanula.specimenSearch;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author pplitzner
+ * @date 03.09.2013
+ *
+ */
+public class SpecimenSearchController {
+
+ private SpecimenSearchComposite specimenSearchComposite;
+
+ /**
+ * @param specimenSearchComposite
+ */
+ public SpecimenSearchController(Composite parent) {
+ this.specimenSearchComposite = new SpecimenSearchComposite(parent, SWT.NONE);
+ }
+
+ public Composite getComposite() {
+ return specimenSearchComposite;
+ }
+
+ private void runQuery(){
+
+ }
+}
--- /dev/null
+// $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.campanula.specimenSearch;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * @author pplitzner
+ * @date 12.09.2013
+ *
+ */
+public class SpecimenSearchResultsComposite extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private Text txtNewText;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public SpecimenSearchResultsComposite(Composite parent, int style) {
+ super(parent, style);
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ setLayout(tableWrapLayout);
+ }
+
+ txtNewText = formToolkit.createText(this, "New Text", SWT.NONE);
+ txtNewText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+ public Text getTxtNewText() {
+ return txtNewText;
+ }
+}
--- /dev/null
+// $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.campanula.specimenSearch;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author pplitzner
+ * @date 12.09.2013
+ *
+ */
+public class SpecimenSearchResultsController {
+
+ private SpecimenSearchResultsComposite specimenSearchResultsComposite;
+
+ public SpecimenSearchResultsController(Composite parent) {
+ this.specimenSearchResultsComposite = new SpecimenSearchResultsComposite(parent, SWT.NONE);
+ }
+
+ public Composite getComposite(){
+ return specimenSearchResultsComposite;
+ }
+
+ public void setText(String text){
+ specimenSearchResultsComposite.getTxtNewText().setText(text);
+ }
+}
import eu.etaxonomy.cdm.model.reference.ReferenceType;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.ISelectable;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.store.TermManager;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.ISelectable;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
// $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.
*/
protected List<UuidAndTitleCache<T>> model;
private final Set<T> transientCdmObjects = new HashSet<T>();
private final String settings;
-
+
protected T cdmBaseToBeFiltered;
-
+
/**
* <p>Constructor for AbstractFilteredCdmResourceSelectionDialog.</p>
*
* @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation
+ * @param conversation
* @param title a {@link java.lang.String} object.
* @param multi a boolean.
* @param settings a {@link java.lang.String} object.
setTitle(title);
setMessage("Use * for wildcard, or ? to see all entries");
this.settings = settings;
-
+
this.conversation = conversation;
-
+
init();
-
+
initModel();
-
+
String objectTitle = getTitle(cdmObject);
if (objectTitle != null) {
setInitialPattern(objectTitle);
}
-
+
setListLabelProvider(createListLabelProvider());
setDetailsLabelProvider(createDetailsLabelProvider());
-
+
setSelectionHistory(new ResourceSelectionHistory());
}
-
+
/**
* By default, we are returning the standard list label provider
- *
- * Override in subclasses if you want different behavior
- *
+ *
+ * Override in subclasses if you want different behavior
+ *
* @return
*/
protected ILabelProvider createDetailsLabelProvider() {
}
/**
- *
+ *
* @return
*/
protected ILabelProvider createListLabelProvider() {
* Will run before initModel()
*/
protected void init() {
-
+
}
-
+
/**
* <p>getSelectionFromDialog</p>
*
protected static <TYPE extends CdmBase> TYPE getSelectionFromDialog(AbstractFilteredCdmResourceSelectionDialog<TYPE> dialog) {
//dialog.setInitialPattern("");
int result = dialog.open();
-
+
if (result == Window.CANCEL) {
return null;
}
-
+
UUID uuid = dialog.getSelectedUuidAndTitleCache().getUuid();
if(uuid == null){
return null;
- }
+ }
return dialog.getCdmObjectByUuid(uuid);
}
-
+
/**
* Check if object was created during the life of this dialog. If not,
* retrieve it from the CdmStore.
}
return getPersistentObject(cdmUuid);
}
-
+
/**
* <p>getPersistentObject</p>
*
if(cdmObject == null){
return "";
}
-
+
if (cdmObject instanceof IIdentifiableEntity) {
- return ((IIdentifiableEntity) cdmObject).getTitleCache();
+ return ((IIdentifiableEntity) cdmObject).getTitleCache();
}
-
+
throw new IllegalArgumentException("Generic method only" +
" supports cdmObject of type IIdentifiableEntity." +
" Please implement specific method in subclass.");
}
-
+
/** {@inheritDoc} */
@Override
filterExcludedObjects();
super.refresh();
}
-
+
/**
* <p>initModel</p>
*/
public boolean equalsFilter(ItemsFilter filter) {
return false;
}
-
+
@Override
public boolean isConsistentItem(Object item) {
return false;
}
return text != null ? matches(text) : false;
}
-
+
};
}
-
+
/**
* Set the filter input to the Agent's title cache
* @param cdmObject a T object.
*/
protected void setPattern(T cdmObject) {
- // FilteredSelection does some very tricky caching to make sure it
- // runs with high performance.
+ // FilteredSelection does some very tricky caching to make sure it
+ // runs with high performance.
// This works for most use cases, but we want to change the model while the dialog is open
// and all the clever caching prevents the content provider from knowing that the model has changed
- // I am aware, that this is a hack, but the FilteredSelectionDialog API does not offer a convenient
+ // I am aware, that this is a hack, but the FilteredSelectionDialog API does not offer a convenient
// way to solve the problem.
try {
Field lastCompletedFilter = this.getClass().getSuperclass().getSuperclass().getDeclaredField("lastCompletedFilter");
} catch (IllegalAccessException e) {
AbstractUtility.error(getClass(), e);
}
-
- // this also is not the nicest way to do it.
+
+ // this also is not the nicest way to do it.
// I am still amazed, that FilteredSelectionDialog does not offer any methods to change its data
// once it was opened. Am I doing it wrong?
String pattern = getTitle(cdmObject);
((Text) getPatternControl()).setText(pattern);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
*/
ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
throws CoreException {
try {
- if(model != null){
+ if(model != null){
progressMonitor.beginTask("Looking for entities", model.size());
for(UuidAndTitleCache<T> element : model){
contentProvider.add(element, itemsFilter);
protected Comparator getItemsComparator() {
return new Comparator<UuidAndTitleCache>() {
@Override
- public int compare(UuidAndTitleCache entity1,
+ public int compare(UuidAndTitleCache entity1,
UuidAndTitleCache entity2) {
Collator collator = Collator.getInstance();
return collator.compare(entity1.getTitleCache(), entity2.getTitleCache());
protected IStatus validateItem(Object item) {
return Status.OK_STATUS;
}
-
+
/**
* <p>getSelectedUuidAndTitleCache</p>
*
Object[] result = getResult();
return result[0] == null ? null : (UuidAndTitleCache) result[0];
}
-
+
/**
* <p>Getter for the field <code>settings</code>.</p>
*
}
return settings;
}
-
+
/**
- *
+ *
* @author n.hoffmann
* @created Oct 19, 2009
* @version 1.0
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.SelectionHistory#restoreItemFromMemento(org.eclipse.ui.IMemento)
*/
@Override
- protected Object restoreItemFromMemento(IMemento element) {
+ protected Object restoreItemFromMemento(IMemento element) {
return element.getString("resource"); //$NON-NLS-1$
}
/*
* org.eclipse.ui.IMemento)
*/
@Override
- protected void storeItemToMemento(Object item, IMemento element) {
+ protected void storeItemToMemento(Object item, IMemento element) {
element.putString("resource", item.toString()); //$NON-NLS-1$
}
}
-
+
/**
* <p>getNewWizardLinkText</p>
*
* @return a {@link java.lang.String} object.
*/
protected abstract String getNewWizardLinkText();
-
+
/**
* <p>getNewEntityWizard</p>
- * @param parameter
+ * @param parameter
* @return a {@link eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard} object.
*/
protected abstract AbstractNewEntityWizard getNewEntityWizard(String parameter);
-
+
public class FilteredCdmResourceLabelProvider extends LabelProvider {
@Override
- public String getText(Object element) {
+ public String getText(Object element) {
if (element == null) {
return null;
}
return ((UuidAndTitleCache) element).getTitleCache();
- }
+ }
};
/* (non-Javadoc)
}
return null;
}
-
+
protected SelectionListener getNewWizardLinkSelectionListener(){
return new SelectionAdapter() {
-
+
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
AbstractNewEntityWizard wizard = getNewEntityWizard(e.text);
wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- int status = dialog.open();
-
- if (status == IStatus.OK) {
+ if(wizard.getEntity() != null) {
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ int status = dialog.open();
- T entity = (T) wizard.getEntity();
+ if (status == IStatus.OK) {
-// addObjectToModel(teamOrPerson);
- refresh();
- setPattern(entity);
- getConversationHolder().bind();
+ T entity = (T) wizard.getEntity();
+ refresh();
+ setPattern(entity);
+ getConversationHolder().bind();
+ }
}
}
};
}
-
+
/**
* <p>getConversationHolder</p>
*
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
*/
@Override
- public ConversationHolder getConversationHolder() {
+ public ConversationHolder getConversationHolder() {
return conversation;
}
-
+
/** {@inheritDoc} */
@Override
- public void update(CdmDataChangeMap changeEvents) {}
+ public void update(CdmDataChangeMap changeEvents) {}
/**
- * Don't want to add for example a taxon or synonym to itself
- * so filter the list to remove the taxon in question
+ * Don't want to add for example a taxon or synonym to itself
+ * so filter the list to remove the taxon in question
* (<code>cdmBaseToBeFiltered</code>)
* so it is not available in the filtered list.
*/
private void filterExcludedObjects() {
if (model != null && cdmBaseToBeFiltered != null) {
-
+
UuidAndTitleCache uuidAndTitleCacheToRemove = null;
-
+
for (UuidAndTitleCache uuidAndTitleCache : model){
if ((cdmBaseToBeFiltered.getUuid()).equals(uuidAndTitleCache.getUuid())) {
uuidAndTitleCacheToRemove = uuidAndTitleCache;
- }
+ }
}
model.remove(uuidAndTitleCacheToRemove);
}
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
import org.eclipse.ui.forms.widgets.Section;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>Abstract AbstractCdmFormElement class.</p>
// addControl(layoutComposite);
}
- /**
- * <p>Getter for the field <code>formFactory</code>.</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- */
- public CdmFormFactory getFormFactory() {
+ @Override
+ public CdmFormFactory getFormFactory() {
return formFactory;
}
/** {@inheritDoc} */
@Override
public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
+ //TODO: replace propertyChangeListeners with formFactory.getPropertyChangeListeners() and remove member propertyChangeListeners from AbstractCdmFormElement
Assert.isNotNull(propertyChangeListeners, "Property change listeners are not present");
try{
import java.util.ArrayList;
import java.util.List;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+
/**
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>
* @param <T>
*/
//TODO shouldn't ENTITY be bound with super class ICdmBase for example (AbstractFormSection<ENTITY extends ICdmBase>)?
-public abstract class AbstractFormSection<ENTITY> extends Section implements
- ISelectionChangedListener, IEntityElement<ENTITY>,
- IConversationEnabled {
+public abstract class AbstractFormSection<ENTITY> extends Section implements ISelectionChangedListener, IEntityElement<ENTITY>, IConversationEnabled {
private ISelectionProvider selectionProvider;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.ui.forms.widgets.TableWrapData;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+
/**
* <p>BrowserElement class.</p>
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.element;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NamedAreaFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.DerivedUnitDetailsElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.DerivedUnitDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.DerivedUnitDetailsSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralSection;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
* <p>
* CdmFormFactory class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Feb 24, 2010
* @version 1.0
*/
public class CdmFormFactory extends FormToolkit {
- private BoldFontHolder2 boldFontHolder2;
- private MouseListener selectionMouseHandler;
- private FocusListener selectionFocusHandler;
+ private BoldFontHolder2 boldFontHolder2;
+ private MouseListener selectionMouseHandler;
+ private FocusListener selectionFocusHandler;
private final Set<SelectionListener> selectionListenerList = new HashSet<SelectionListener>();
- private final List<IPropertyChangeListener> propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
+ private final List<IPropertyChangeListener> propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
- private final int orientation = Window.getDefaultOrientation();
- private ISelectionProvider selectionProvider;
+ private final int orientation = Window.getDefaultOrientation();
+ private ISelectionProvider selectionProvider;
- /** Constant <code>EMPTY_SELECTION</code> */
- public static ISelection EMPTY_SELECTION = new ISelection() {
- @Override
- public boolean isEmpty() {
- return true;
- }
- };
-
- /**
- *
- * @author n.hoffmann
- * @date Jan 25, 2010
- *
- */
- private class SelectionMouseHandler extends MouseAdapter {
- @Override
- public void mouseDown(MouseEvent e) {
- notifySelectionListeners(e);
- }
- }
+ /** Constant <code>EMPTY_SELECTION</code> */
+ public static ISelection EMPTY_SELECTION = new ISelection() {
+ @Override
+ public boolean isEmpty() {
+ return true;
+ }
+ };
+
+ /**
+ *
+ * @author n.hoffmann
+ * @date Jan 25, 2010
+ *
+ */
+ private class SelectionMouseHandler extends MouseAdapter {
+ @Override
+ public void mouseDown(MouseEvent e) {
+ notifySelectionListeners(e);
+ }
+ }
- /**
- *
- * @author n.hoffmann
- * @date Jan 25, 2010
- *
- */
- private class SelectionFocusHandler extends FocusAdapter {
- @Override
- public void focusGained(FocusEvent e) {
- notifySelectionListeners(e);
- }
- }
+ /**
+ *
+ * @author n.hoffmann
+ * @date Jan 25, 2010
+ *
+ */
+ private class SelectionFocusHandler extends FocusAdapter {
+ @Override
+ public void focusGained(FocusEvent e) {
+ notifySelectionListeners(e);
+ }
+ }
- private void notifySelectionListeners(TypedEvent e) {
- Event event = new Event();
- event.widget = e.widget;
- SelectionEvent selectionEvent = new SelectionEvent(event);
+ private void notifySelectionListeners(TypedEvent e) {
+ Event event = new Event();
+ event.widget = e.widget;
+ SelectionEvent selectionEvent = new SelectionEvent(event);
for (SelectionListener listener : selectionListenerList) {
listener.widgetSelected(selectionEvent);
- }
- }
-
- /**
- * <p>
- * Constructor for CdmFormFactory.
- * </p>
- *
- * @param display
- * a {@link org.eclipse.swt.widgets.Display} object.
- * @param selectionProvider
- * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- */
- public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
- super(display);
- this.selectionProvider = selectionProvider;
- init();
- }
-
- /**
- * <p>
- * Constructor for CdmFormFactory.
- * </p>
- *
- * @param display
- * a {@link org.eclipse.swt.widgets.Display} object.
- */
- public CdmFormFactory(Display display) {
- super(display);
- init();
- }
-
- /**
- *
- */
- private void init() {
- boldFontHolder2 = new BoldFontHolder2();
- selectionMouseHandler = new SelectionMouseHandler();
- selectionFocusHandler = new SelectionFocusHandler();
- }
+ }
+ }
- /**
- * Creates an instance initialized with the correct selectionProvider
- *
- * Make sure to remove the instance when the entityComposite disposes via
- * destroySelectionArbitrator(..)
- *
- * @param entityElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
- * object.
+ /**
+ * <p>
+ * Constructor for CdmFormFactory.
+ * </p>
+ *
+ * @param display
+ * a {@link org.eclipse.swt.widgets.Display} object.
+ * @param selectionProvider
+ * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
+ */
+ public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
+ super(display);
+ this.selectionProvider = selectionProvider;
+ init();
+ }
+
+ /**
+ * <p>
+ * Constructor for CdmFormFactory.
+ * </p>
+ *
+ * @param display
+ * a {@link org.eclipse.swt.widgets.Display} object.
+ */
+ public CdmFormFactory(Display display) {
+ super(display);
+ init();
+ }
+
+ /**
+ *
*/
+ private void init() {
+ boldFontHolder2 = new BoldFontHolder2();
+ selectionMouseHandler = new SelectionMouseHandler();
+ selectionFocusHandler = new SelectionFocusHandler();
+ }
+
+ /**
+ * Creates an instance initialized with the correct selectionProvider
+ *
+ * Make sure to remove the instance when the entityComposite disposes via
+ * destroySelectionArbitrator(..)
+ *
+ * @param entityElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
+ * object.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
+ * object.
+ */
public SelectionArbitrator createSelectionArbitrator(IEntityElement entityElement) {
SelectionArbitrator selectionArbitrator = new SelectionArbitrator(entityElement);
- selectionArbitrator.addSelectionProvider(selectionProvider);
- selectionProvider.addSelectionChangedListener(selectionArbitrator);
- addSelectionListener(selectionArbitrator);
- return selectionArbitrator;
- }
-
- /**
- * <p>
- * destroySelectionArbitrator
- * </p>
- *
- * @param selectionArbitrator
+ selectionArbitrator.addSelectionProvider(selectionProvider);
+ selectionProvider.addSelectionChangedListener(selectionArbitrator);
+ addSelectionListener(selectionArbitrator);
+ return selectionArbitrator;
+ }
+
+ /**
+ * <p>
+ * destroySelectionArbitrator
+ * </p>
+ *
+ * @param selectionArbitrator
* a
* {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
- * object.
- */
+ * object.
+ */
public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator) {
- removeSelectionListener(selectionArbitrator);
- if (selectionProvider != null) {
+ removeSelectionListener(selectionArbitrator);
+ if (selectionProvider != null) {
selectionProvider.removeSelectionChangedListener(selectionArbitrator);
- } else {
+ } else {
AbstractUtility.error(this.getClass(),
"Tried to destroy a selection listener from this factories listeners but was null", null);
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void adapt(Composite composite) {
- composite.addMouseListener(selectionMouseHandler);
- super.adapt(composite);
- }
+ }
+ }
- /**
- * <p>
+ /**
+ * <p>
* Adapts the {@link AbstractCdmFormElement}:<br>
* - sets the {@link IPropertyChangeListener}s handled by this class
- * </p>
- *
- * @param formElement
- * a
- * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
- * object.
- */
- public void adapt(AbstractCdmFormElement formElement) {
- formElement.setPropertyChangeListeners(propertyChangeListeners);
- }
-
- /** {@inheritDoc} */
- @Override
- public void adapt(Control control, boolean trackFocus, boolean trackKeyboard) {
- if (trackFocus) {
- control.addFocusListener(selectionFocusHandler);
- }
- super.adapt(control, trackFocus, trackKeyboard);
- }
-
- /**
- * <p>
- * destroyElement
- * </p>
- *
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- */
- public void destroyElement(ICdmFormElement formElement) {
- // return if element was not initialized
- if (formElement == null) {
- return;
- }
- // destroy selection arbitrator, if any
- if (formElement instanceof ISelectableElement) {
+ * </p>
+ *
+ * @param formElement
+ * a
+ * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
+ * object.
+ */
+ public void adapt(AbstractCdmFormElement formElement) {
+ formElement.setPropertyChangeListeners(propertyChangeListeners);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void adapt(Control control, boolean trackFocus, boolean trackKeyboard) {
+ if (trackFocus) {
+ control.addFocusListener(selectionFocusHandler);
+ }
+ super.adapt(control, trackFocus, trackKeyboard);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void adapt(Composite composite) {
+ composite.addMouseListener(selectionMouseHandler);
+ super.adapt(composite);
+ }
+
+ /**
+ * <p>
+ * destroyElement
+ * </p>
+ *
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ */
+ public void destroyElement(ICdmFormElement formElement) {
+ // return if element was not initialized
+ if (formElement == null) {
+ return;
+ }
+ // destroy selection arbitrator, if any
+ if (formElement instanceof ISelectableElement) {
destroySelectionArbitrator(((ISelectableElement) formElement).getSelectionArbitrator());
- }
- // remove this element form its parents list of elements
- // ICdmFormElement parentElement = formElement.getParentElement();
- // if(parentElement != null){
- // parentElement.removeElement(formElement);
- // }
- // call destroy on child elements recursively
- for (ICdmFormElement childElement : formElement.getElements()) {
- destroyElement(childElement);
- }
- // dispose of the controls
- for (Control control : formElement.getControls()) {
- // we added the layoutComposite of the parental element as the
- // layout composite to this formElement
- // but we do not want to destroy it.
- if (control.equals(formElement.getLayoutComposite())) {
- continue;
- } else {
- control.dispose();
- control = null;
- }
- }
- }
-
- /**
- * <p>
- * createEmptyCell
- * </p>
- *
- * @param parent
- * a {@link org.eclipse.swt.widgets.Composite} object.
- * @return a {@link org.eclipse.swt.widgets.Label} object.
- */
- public Label createEmptyCell(Composite parent) {
- return this.createLabel(parent, null);
- }
+ }
+ // remove this element form its parents list of elements
+ // ICdmFormElement parentElement = formElement.getParentElement();
+ // if(parentElement != null){
+ // parentElement.removeElement(formElement);
+ // }
+ // call destroy on child elements recursively
+ for (ICdmFormElement childElement : formElement.getElements()) {
+ destroyElement(childElement);
+ }
+ // dispose of the controls
+ for (Control control : formElement.getControls()) {
+ // we added the layoutComposite of the parental element as the
+ // layout composite to this formElement
+ // but we do not want to destroy it.
+ if (control.equals(formElement.getLayoutComposite())) {
+ continue;
+ } else {
+ control.dispose();
+ control = null;
+ }
+ }
+ }
- /**
- * <p>
- * createMultilineTextWithLabel
- * </p>
- *
- * @param labelString
- * a {@link java.lang.String} object.
- * @param textHeight
- * a int.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
- * object.
- */
+ /**
+ * <p>
+ * createEmptyCell
+ * </p>
+ *
+ * @param parent
+ * a {@link org.eclipse.swt.widgets.Composite} object.
+ * @return a {@link org.eclipse.swt.widgets.Label} object.
+ */
+ public Label createEmptyCell(Composite parent) {
+ return this.createLabel(parent, null);
+ }
+
+ /**
+ * <p>
+ * createMultilineTextWithLabel
+ * </p>
+ *
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param textHeight
+ * a int.
+ * @param style
+ * a int.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createMultiLanguageTextElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param multilanguageText
- * a {@link java.util.Map} object.
- * @param textHeight
- * a int.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
- * object.
- */
+ /**
+ * <p>
+ * createMultiLanguageTextElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param multilanguageText
+ * a {@link java.util.Map} object.
+ * @param textHeight
+ * a int.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
+ * object.
+ */
public MultilanguageTextElement createMultiLanguageTextElement(ICdmFormElement parentElement, String labelString,
Map<Language, LanguageString> multilanguageText, int textHeight, int style) {
MultilanguageTextElement element = new MultilanguageTextElement(this, parentElement, labelString,
multilanguageText, textHeight, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
public KeyStatementElement createKeyStatementElement(ICdmFormElement parentElement, String labelString,
- KeyStatement keyStatement, int textHeight, int style) {
+ KeyStatement keyStatement, int textHeight, int style) {
KeyStatementElement element = new KeyStatementElement(this, parentElement, labelString, keyStatement,
textHeight, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createTextWithLabelElement
- * </p>
- *
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialText
- * a {@link java.lang.String} object.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
- * object.
- */
+ /**
+ * <p>
+ * createTextWithLabelElement
+ * </p>
+ *
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param initialText
+ * a {@link java.lang.String} object.
+ * @param style
+ * a int.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
+ * object.
+ */
public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
- String initialText, int style) {
+ String initialText, int style) {
TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null,
style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ 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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * @param element
- * @param string
- * @param uri
- * @param style
- * @return
- */
+ /**
+ * @param element
+ * @param string
+ * @param uri
+ * @param style
+ * @return
+ */
public OpenUrlSelectorElement createOpenUrlSelectorElement(ICdmFormElement parentElement, String labelString,
- IOpenUrlEnabled openUrlEnabled, int style) {
+ IOpenUrlEnabled openUrlEnabled, int style) {
OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, parentElement, labelString, openUrlEnabled,
style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- *
- * @param parentElement
- * @param labelString
- * @param conversationEnabled
- * @param user
- * @param style
- * @return
- */
+ /**
+ *
+ * @param parentElement
+ * @param labelString
+ * @param conversationEnabled
+ * @param user
+ * @param style
+ * @return
+ */
public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString,
- ConversationHolder conversation, User user, int style) {
+ ConversationHolder conversation, User user, int style) {
EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createIntegerTextWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialInteger
- * a {@link java.lang.Integer} object.
- * @param style
- * a int.
+ /**
+ * <p>
+ * createIntegerTextWithLabelElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param initialInteger
+ * a {@link java.lang.Integer} object.
+ * @param style
+ * a int.
* @return a
* {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
- * object.
- */
+ * object.
+ */
public NumberWithLabelElement createNumberTextWithLabelElement(
ICdmFormElement parentElement, String labelString,
Number initialNumber, int style) {
return element;
}
-
- /**
- * <p>
- * createLanguageStringWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param languageString
- * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
- * object.
- */
+ /**
+ * <p>
+ * createLanguageStringWithLabelElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param languageString
+ * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
+ * object.
+ */
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;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createLanguageStringWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param languageString
- * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
- * @param height
- * a int.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
- * object.
- */
+ /**
+ * <p>
+ * createLanguageStringWithLabelElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param languageString
+ * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
+ * @param height
+ * a int.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createTextElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param initialText
- * a {@link java.lang.String} object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
- * object.
- */
+ /**
+ * <p>
+ * createTextElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param initialText
+ * a {@link java.lang.String} object.
+ * @param style
+ * a int.
+ * @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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createKeyValueViewerElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param keyHeading
- * a {@link java.lang.String} object.
- * @param valueHeading
- * a {@link java.lang.String} object.
- * @param map
- * a {@link java.util.Map} object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
- * object.
- */
+ /**
+ * <p>
+ * createKeyValueViewerElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param keyHeading
+ * a {@link java.lang.String} object.
+ * @param valueHeading
+ * a {@link java.lang.String} object.
+ * @param map
+ * a {@link java.util.Map} object.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
+ * object.
+ */
public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading,
- String valueHeading, Map<Object, Object> map) {
+ String valueHeading, Map<Object, Object> map) {
KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
+ /**
+ * <p>
+ * createTermComboElement
+ * </p>
+ *
+ * @param termComboType
+ * a
+ * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
+ * object.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param selection
+ * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
+ * object.
+ * @param style
+ * a int.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
+ * object.
+ */
- /**
- * <p>
- * createTermComboElement
- * </p>
- *
- * @param termComboType
- * a
- * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
- * object.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param selection
- * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
- * object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
- * object.
- */
-
public <T extends DefinedTermBase> TermComboElement<T> createTermComboElement(Class<T> termComboType,
ICdmFormElement parentElement, String labelString, T selection, int style) {
TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termComboType, labelString,
selection, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
/**
* <p>
* createTermComboElement
* </p>
- *
+ *
* @param termComboType
* a
* {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
* @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
* object.
*/
-
+
public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
- TermType termType,
+ TermType termType,
ICdmFormElement parentElement,
- String labelString,
- T selection,
+ String labelString,
+ T selection,
int style) {
TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, style);
adapt(element);
return element;
}
- /**
- * <p>
- * createEnumComboElement
- * </p>
- *
- * @param enumComboType
- * a
- * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
- * object.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
- * object.
- */
+ /**
+ * <p>
+ * createEnumComboElement
+ * </p>
+ *
+ * @param enumComboType
+ * a
+ * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
+ * object.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
+ * object.
+ */
public <T extends IEnumTerm> EnumComboElement<T> createEnumComboElement(
Class<T> enumComboType, ICdmFormElement parentElement,
int style) {
- EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createBrowserElement
- * </p>
- *
- * @param imageUri
- * a {@link java.net.URI} object.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
+ /**
+ * <p>
+ * createBrowserElement
+ * </p>
+ *
+ * @param imageUri
+ * a {@link java.net.URI} object.
+ * @param style
+ * a int.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * 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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
- /**
- * <p>
- * createImageElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param imageUri
- * a {@link java.net.URI} object.
- * @param style
- * 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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createTextActionElement
- * </p>
- *
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialText
- * a {@link java.lang.String} object.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param buttonLabel
- * a {@link java.lang.String} object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
- * object.
- */
+ /**
+ * <p>
+ * createImageElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param imageUri
+ * a {@link java.net.URI} object.
+ * @param style
+ * 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);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
+ /**
+ * <p>
+ * createTextActionElement
+ * </p>
+ *
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param initialText
+ * a {@link java.lang.String} object.
+ * @param style
+ * a int.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param buttonLabel
+ * a {@link java.lang.String} object.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
+ * object.
+ */
public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString,
- String buttonLabel, String initialText, int style) {
+ String buttonLabel, String initialText, int style) {
TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText,
style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createCheckbox
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param label
- * a {@link java.lang.String} object.
- * @param initialState
- * a boolean.
- * @param style
- * a int.
+ /**
+ * <p>
+ * createCheckbox
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param label
+ * a {@link java.lang.String} object.
+ * @param initialState
+ * a boolean.
+ * @param style
+ * a int.
* @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
* object.
- */
+ */
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;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * Creates a section as a part of the form.
- *
- * @return the section widget
- * @param section
+ /**
+ * Creates a section as a part of the form.
+ *
+ * @return the section widget
+ * @param section
* a
* {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- */
- public Section adapt(AbstractFormSection section) {
- section.setMenu(section.getLayoutComposite().getMenu());
- adapt(section, true, true);
+ * object.
+ */
+ public Section adapt(AbstractFormSection section) {
+ section.setMenu(section.getLayoutComposite().getMenu());
+ adapt(section, true, true);
- // handle focus and property change events for cdm use
- section.addFocusListener(selectionFocusHandler);
- section.setPropertyChangeListeners(propertyChangeListeners);
+ // handle focus and property change events for cdm use
+ section.addFocusListener(selectionFocusHandler);
+ section.setPropertyChangeListeners(propertyChangeListeners);
- if (section.getToggle() != null) {
+ if (section.getToggle() != null) {
section.getToggle().setHoverDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE_HOVER));
section.getToggle().setDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE));
- }
+ }
section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont()));
if ((section.getStyle() & ExpandableComposite.TITLE_BAR) != 0
|| (section.getStyle() & ExpandableComposite.SHORT_TITLE_BAR) != 0) {
- getColors().initializeSectionToolBarColors();
+ getColors().initializeSectionToolBarColors();
section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG));
section.setTitleBarBorderColor(getColors().getColor(IFormColors.TB_BORDER));
- }
- // call setTitleBarForeground regardless as it also sets the label color
+ }
+ // call setTitleBarForeground regardless as it also sets the label color
section.setTitleBarForeground(getColors().getColor(IFormColors.TB_TOGGLE));
- return section;
- }
+ return section;
+ }
- private class BoldFontHolder2 {
- private Font normalFont;
+ private class BoldFontHolder2 {
+ private Font normalFont;
- private Font boldFont;
+ private Font boldFont;
- public BoldFontHolder2() {
- }
+ public BoldFontHolder2() {
+ }
- public Font getBoldFont(Font font) {
- createBoldFont(font);
- return boldFont;
- }
+ public Font getBoldFont(Font font) {
+ createBoldFont(font);
+ return boldFont;
+ }
- private void createBoldFont(Font font) {
- if (normalFont == null || !normalFont.equals(font)) {
- normalFont = font;
- dispose();
- }
- if (boldFont == null) {
+ private void createBoldFont(Font font) {
+ if (normalFont == null || !normalFont.equals(font)) {
+ normalFont = font;
+ dispose();
+ }
+ if (boldFont == null) {
boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(), normalFont);
- }
- }
+ }
+ }
- public void dispose() {
- if (boldFont != null) {
+ public void dispose() {
+ if (boldFont != null) {
FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay());
- boldFont = null;
- }
- }
- }
+ boldFont = null;
+ }
+ }
+ }
- /**
- * <p>
- * createToggleableTextField
- * </p>
- *
- * @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 initialState
- * a boolean.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
- * object.
- */
+ /**
+ * <p>
+ * createToggleableTextField
+ * </p>
+ *
+ * @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 initialState
+ * a boolean.
+ * @param style
+ * a int.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
+ * object.
+ */
public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, String labelString,
- String initialText, boolean initialState, int style) {
+ String initialText, boolean initialState, int style) {
ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText,
initialState, style | orientation);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createTimePeriodElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param timePeriod
- * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
- * object.
- */
+ /**
+ * <p>
+ * createTimePeriodElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param timePeriod
+ * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
+ * @param style
+ * a int.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
+ * object.
+ */
public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString,
- TimePeriod timePeriod, int style) {
+ TimePeriod timePeriod, int style) {
TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
/**
* <p>
* createGatheringEventUnitElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* object.
*/
public GatheringEventUnitElement createGatheringEventUnitElement(
- ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
String labelString,
- DerivedUnitFacade gatheringEvent,
- MinMaxTextSection.UnitType unitType,
+ DerivedUnitFacade gatheringEvent,
+ MinMaxTextSection.UnitType unitType,
int style) {
- GatheringEventUnitElement element = new GatheringEventUnitElement(this,
+ GatheringEventUnitElement element = new GatheringEventUnitElement(this,
parentElement,
- labelString,
- gatheringEvent,
+ labelString,
+ gatheringEvent,
unitType,
style);
adapt(element);
return element;
}
- /**
- * <p>
- * createPointElement
- * </p>
- *
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param point
- * a {@link eu.etaxonomy.cdm.model.location.Point} object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
- */
+ /**
+ * <p>
+ * createPointElement
+ * </p>
+ *
+ * @param style
+ * a int.
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param point
+ * 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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createDateDetailSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
- * object.
- */
+ /**
+ * <p>
+ * createDateDetailSection
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
+ * object.
+ */
public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style) {
DateDetailSection section = new DateDetailSection(this, parentElement, style);
- parentElement.addElement(section);
- adapt(section);
- return section;
- }
-
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
+
/**
* <p>
* createDateDetailSection
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
return section;
}
- /**
- * <p>
- * createPartialElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param partial
- * a {@link org.joda.time.Partial} object.
- * @param style
- * a int.
+ /**
+ * <p>
+ * createPartialElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param labelString
+ * a {@link java.lang.String} object.
+ * @param partial
+ * a {@link org.joda.time.Partial} object.
+ * @param style
+ * a int.
* @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
* object.
- */
+ */
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;
- }
-
- /**
- * <p>
- * addSelectionListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- */
- public void addSelectionListener(SelectionListener listener) {
- selectionListenerList.add(listener);
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * removeSelectionListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- */
- public void removeSelectionListener(SelectionListener listener) {
- if (listener == null) {
+ /**
+ * <p>
+ * addSelectionListener
+ * </p>
+ *
+ * @param listener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public void addSelectionListener(SelectionListener listener) {
+ selectionListenerList.add(listener);
+ }
+
+ /**
+ * <p>
+ * removeSelectionListener
+ * </p>
+ *
+ * @param listener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public void removeSelectionListener(SelectionListener listener) {
+ if (listener == null) {
AbstractUtility.error(this.getClass(),
"Tried to remove a selection listener from this factories listeners but was null", null);
- } else {
- selectionListenerList.remove(listener);
- }
- }
-
- /**
- * <p>
- * addPropertyChangeListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.jface.util.IPropertyChangeListener}
- * object.
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if(propertyChangeListeners.contains(listener)){
- return;
- }
- propertyChangeListeners.add(0, listener);
- }
-
- /**
- * <p>
- * removePropertyChangeListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.jface.util.IPropertyChangeListener}
- * object.
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
+ } else {
+ selectionListenerList.remove(listener);
+ }
+ }
- /**
- * <p>
- * createHorizontalSeparator
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link org.eclipse.swt.widgets.Label} object.
- */
+ /**
+ * <p>
+ * addPropertyChangeListener
+ * </p>
+ *
+ * @param listener
+ * a {@link org.eclipse.jface.util.IPropertyChangeListener}
+ * object.
+ */
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ if (propertyChangeListeners.contains(listener)) {
+ return;
+ }
+ propertyChangeListeners.add(0, listener);
+ }
+
+ /**
+ * <p>
+ * removePropertyChangeListener
+ * </p>
+ *
+ * @param listener
+ * a {@link org.eclipse.jface.util.IPropertyChangeListener}
+ * object.
+ */
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ propertyChangeListeners.remove(listener);
+ }
+
+ /**
+ * @return the propertyChangeListeners
+ */
+ public List<IPropertyChangeListener> getPropertyChangeListeners() {
+ return propertyChangeListeners;
+ }
+
+ /**
+ * <p>
+ * createHorizontalSeparator
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
+ * @return a {@link org.eclipse.swt.widgets.Label} object.
+ */
public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
- separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
- return separator;
- }
-
- /**
- * <p>
- * createVersionElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
- * object.
- */
+ separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+ return separator;
+ }
+
+ /**
+ * <p>
+ * createVersionElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param entity
+ * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
+ * object.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
+ * object.
+ */
public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
VersionElement element = new VersionElement(this, parentElement, entity, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
- /**
- * @param cdmBaseSection
- * @param object
- * @param style
- * @return
- */
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
+ /**
+ * @param cdmBaseSection
+ * @param object
+ * @param style
+ * @return
+ */
public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) {
CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
-
- /**
- * <p>
- * createVersionSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
- * object.
- */
- public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
- VersionSection section = new VersionSection(this, parentElement, style);
- parentElement.addElement(section);
- adapt(section);
- return section;
- }
-
- /**
- * @param parent
- * @param i
- * @return
- */
- public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
- CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
- parentElement.addElement(section);
- adapt(section);
- return section;
- }
-
- /**
- * <p>
- * createEmptyElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
- */
- public EmptyElement createEmptyElement(ICdmFormElement parentElement) {
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
+ /**
+ * <p>
+ * createVersionSection
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
+ * object.
+ */
+ public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
+ VersionSection section = new VersionSection(this, parentElement, style);
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
+
+ /**
+ * @param parent
+ * @param i
+ * @return
+ */
+ public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
+ CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
+
+ /**
+ * <p>
+ * createEmptyElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
+ */
+ public EmptyElement createEmptyElement(ICdmFormElement parentElement) {
EmptyElement element = new EmptyElement(this, parentElement, null, SWT.NULL);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createHeadlineSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
- * object.
- */
- public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
+ /**
+ * <p>
+ * createHeadlineSection
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
+ * object.
+ */
+ public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
- parentElement.addElement(section);
- adapt(section);
- return section;
- }
-
- /**
- * <p>
- * createParsingMessageElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param parserProblem
- * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
- * object.
- */
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
+
+ /**
+ * <p>
+ * createParsingMessageElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param parserProblem
+ * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
+ * object.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
+ * object.
+ */
public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement,
ParserProblem parserProblem, int style) {
ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
selectionProvider, style);
-
- parentElement.addElement(section);
- adapt(section);
- return section;
-
- }
-
- /**
- * @param definedTermClass
- * @param formElement
- * @param style
- * @return
- */
+
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+
+ }
+
+ /**
+ * @param definedTermClass
+ * @param formElement
+ * @param style
+ * @return
+ */
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);
+ AbstractCdmDetailElement element = null;
+
+ if (NamedArea.class.isAssignableFrom(definedTermClass)) {
+ element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
} else {
- element = new DefinedTermDetailElement(this, parentElement);
- }
-
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ element = new DefinedTermDetailElement(this, parentElement);
+ }
+
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
//--------DetailSections---------
return section;
}
+ 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 NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
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;
- }
-
- 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);
- }
+ parentElement.addElement(section);
+ adapt(section);
+ }
//--------DetailElements------------
addAndAdaptElement(parentElement, element);
return element;
}
-
-
+
+
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;
- }
+ }
public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) {
FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return element;
- }
+ }
+
public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
- return element;
- }
+ return element;
+ }
public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return element;
- }
+ }
- /**
- * @param parentElement
+ /**
+ * @param parentElement
* @param element
- */
+ */
private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
adapt(element);
parentElement.addElement(element);
GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
- }
+ }
public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
- return section;
- }
+ return section;
+ }
- /**
- * <p>
- * createEntityCollectionElement
- * </p>
- *
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- * @param parentElement
+ /**
+ * <p>
+ * createEntityCollectionElement
+ * </p>
+ *
+ * @param removeListener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ * @param style
+ * a int.
+ * @param parentElement
* a
* {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param versionableEntity
- * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
- * object.
- * @param backgroundColor
- * a {@link org.eclipse.swt.graphics.Color} object.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
- * object.
- */
+ * object.
+ * @param versionableEntity
+ * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
+ * object.
+ * @param backgroundColor
+ * a {@link org.eclipse.swt.graphics.Color} object.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
+ * object.
+ */
public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement,
Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style) {
- AbstractEntityCollectionElement element = null;
+ AbstractEntityCollectionElement element = null;
- Object entity = HibernateProxyHelper.deproxy(versionableEntity);
+ Object entity = HibernateProxyHelper.deproxy(versionableEntity);
- if (entity instanceof Annotation) {
+ if (entity instanceof Annotation) {
element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
- } else if (entity instanceof Person) {
+ } else if (entity instanceof Person) {
element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
- } else if (entity instanceof Credit) {
+ } else if (entity instanceof Credit) {
element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
- } else if (entity instanceof Extension) {
+ } else if (entity instanceof Extension) {
element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
- } else if (entity instanceof Marker) {
+ } else if (entity instanceof Marker) {
element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
- } else if (entity instanceof Media) {
+ } else if (entity instanceof Media) {
element = new MediaElement(this, parentElement, (Media) entity, removeListener, style);
- } else if (entity instanceof MediaRepresentation) {
+ } else if (entity instanceof MediaRepresentation) {
element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
style);
- } else if (entity instanceof ImageFile) {
+ } else if (entity instanceof ImageFile) {
element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style);
- } else if (entity instanceof MediaRepresentationPart){
+ } else if (entity instanceof MediaRepresentationPart) {
element = new MediaRepresentationPartElement(this, parentElement, (MediaRepresentationPart) entity,
removeListener, style);
- } else if (entity instanceof NomenclaturalStatus) {
+ } else if (entity instanceof NomenclaturalStatus) {
element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener,
style);
- } else if (entity instanceof Rights) {
+ } else if (entity instanceof Rights) {
element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style);
} else if (entity instanceof DescriptionElementSource) {
element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
- removeListener, style);
- } else if (entity instanceof IdentifiableSource) {
+ removeListener, style);
+ } else if (entity instanceof IdentifiableSource) {
element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener,
style);
} else if (entity instanceof DefinedTerm) {
switch(((DefinedTerm)entity).getTermType()) {
case Scope:
- element = new ScopeElement(this,
- parentElement,
+ element = new ScopeElement(this,
+ parentElement,
(DefinedTerm) entity,
- removeListener,
+ removeListener,
style);
break;
case Modifier:
- element = new ModifierElement(this,
+ element = new ModifierElement(this,
parentElement,
- (DefinedTerm) entity,
- removeListener,
+ (DefinedTerm) entity,
+ removeListener,
style);
break;
default:
//FIXME : Actually we should through an exception here
element = null;
break;
-
+
}
- } else if (entity instanceof Reference) {
+ } else if (entity instanceof Reference) {
element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
- } else if (entity instanceof NameTypeDesignation) {
+ } else if (entity instanceof NameTypeDesignation) {
element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener,
style);
- } else if (entity instanceof NameRelationship) {
+ } else if (entity instanceof NameRelationship) {
element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener,
style);
- } else if (entity instanceof SpecimenTypeDesignation) {
+ } else if (entity instanceof SpecimenTypeDesignation) {
element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
removeListener, style);
- } else if (entity instanceof StateData) {
+ } else if (entity instanceof StateData) {
element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
- } else if (entity instanceof StatisticalMeasurementValue) {
+ } else if (entity instanceof StatisticalMeasurementValue) {
element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity,
- removeListener, style);
- } else if (entity instanceof DerivedUnit) {
- switch(((DerivedUnit)entity).getRecordBasis()) {
+ removeListener, style);
+ } else if (entity instanceof DerivedUnit) {
+ switch(((DerivedUnit)entity).getRecordBasis()) {
case LivingSpecimen:
case PreservedSpecimen:
case OtherSpecimen:
- element = new SpecimenCollectionDetailElement(this,
+ element = new SpecimenCollectionDetailElement(this,
parentElement,
- (DerivedUnit) entity,
- removeListener,
+ (DerivedUnit) entity,
+ removeListener,
style);
break;
default:
- element = new DerivedUnitElement(this,
+ element = new DerivedUnitElement(this,
parentElement,
- (DerivedUnit) entity,
- removeListener,
+ (DerivedUnit) entity,
+ removeListener,
style);
- }
+ }
- } else if (entity instanceof NamedArea) {
+ } else if (entity instanceof NamedArea) {
element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
- } else if (entity instanceof DeterminationEvent) {
- element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity,
- removeListener, style);
- } else if (entity instanceof User) {
+ } else if (entity instanceof DeterminationEvent) {
+ element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
+ } else if (entity instanceof User) {
element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
- } else if (entity instanceof GrantedAuthority) {
+ } else if (entity instanceof GrantedAuthority) {
element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity,
removeListener, style);
- } else if (entity instanceof Group) {
+ } else if (entity instanceof Group) {
element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
- } else if (entity instanceof Taxon) {
+ } else if (entity instanceof Taxon) {
element = new TaxonDetailElement(this, parentElement, (Taxon) entity, removeListener, style);
- } else if (entity instanceof DescriptionElementBase) {
- // this is the special case for protologs, maybe we can do this
- // differently when API improves
- DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
- if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
+ } else if (entity instanceof DescriptionElementBase) {
+ // this is the special case for protologs, maybe we can do this
+ // differently when API improves
+ DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
+ if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
- }
- }
+ }
+ }
- if (element == null) {
+ if (element == null) {
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);
-
- }
+ + entity, null);
+ }
else if (backgroundColor != null && !backgroundColor.isDisposed()) {
- element.setPersistentBackground(backgroundColor);
- }
+ element.setPersistentBackground(backgroundColor);
+ adapt(element);
+ parentElement.addElement(element);
+ }
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ return element;
+ }
- /**
- * <p>
- * Creates a selection element for the given type T.
- * </p>
- * <p>
- * <strong>Selection elements not handled by this method:</strong>
- * <ul>
+ public void createNamedAreaFieldController(AbstractFormSection parentElement, NamedArea namedArea, SelectionListener removeListener){
+// Object entity = HibernateProxyHelper.deproxy(versionableEntity); TODO deproxy necessary??
+ NamedAreaFieldController element = new NamedAreaFieldController(this, parentElement, namedArea, removeListener, SWT.NONE);
+ adapt(element);
+ parentElement.addElement(element);
+ }
+
+ /**
+ * <p>
+ * Creates a selection element for the given type T.
+ * </p>
+ * <p>
+ * <strong>Selection elements not handled by this method:</strong>
+ * <ul>
* <li>{@link TaxonNodeSelectionElement} see
* {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
* </li>
* <li>{@link NomenclaturalAuthorTeamSelectionElement} see
* {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
* </li>
- * </ul>
- * </p>
- *
- * @param clazz
+ * </ul>
+ * </p>
+ *
+ * @param clazz
* a {@link Class} object of the type that you want the selection
* element to handle
- * @param parentElement
+ * @param parentElement
* a {@link ICdmFormElement} object.
- * @param labelString
- * a {@link String} object.
- * @param selectionType
- * @param selection
- * a {@link ICdmBase} object.
- * @param style
- * a int.
- * @param conversation
- * a {@link ConversationHolder} object.
+ * @param labelString
+ * a {@link String} object.
+ * @param selectionType
+ * @param selection
+ * a {@link ICdmBase} object.
+ * @param style
+ * a int.
+ * @param conversation
+ * a {@link ConversationHolder} object.
* @return a {@link EntitySelectionElement} object.
- */
+ */
public <T extends ICdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
int style) {
EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
labelString, selection, mode, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
+ 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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
- public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
+ 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);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
-
- /** {@inheritDoc} */
- public LabelElement createLabel(ICdmFormElement parentElement, String text) {
- LabelElement labelElement = new LabelElement(this, parentElement, text);
- adapt(labelElement);
- parentElement.addElement(labelElement);
- return labelElement;
- }
-
- /**
- * <p>
- * Getter for the field <code>selectionProvider</code>.
- * </p>
- *
- * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- */
- public ISelectionProvider getSelectionProvider() {
- return selectionProvider;
- }
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
- /**
- * <p>
- * createDetailedDescriptionDetailElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param entity
- * a
- * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
- * object.
- */
- public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
+ /** {@inheritDoc} */
+ public LabelElement createLabel(ICdmFormElement parentElement, String text) {
+ LabelElement labelElement = new LabelElement(this, parentElement, text);
+ adapt(labelElement);
+ parentElement.addElement(labelElement);
+ return labelElement;
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>selectionProvider</code>.
+ * </p>
+ *
+ * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
+ */
+ public ISelectionProvider getSelectionProvider() {
+ return selectionProvider;
+ }
+
+ /**
+ * <p>
+ * createDetailedDescriptionDetailElement
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param entity
+ * a
+ * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
+ * object.
+ * @param style
+ * a int.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
+ * object.
+ */
+ public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
ICdmFormElement parentElement, DescriptionElementBase entity, int style) {
- AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
+ AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
- if (entity instanceof CategoricalData) {
+ if (entity instanceof CategoricalData) {
detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
(CategoricalData) entity, style);
- } else if (entity instanceof CommonTaxonName) {
+ } else if (entity instanceof CommonTaxonName) {
detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
style);
- } else if (entity instanceof Distribution) {
+ } else if (entity instanceof Distribution) {
detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
style);
- } else if (entity instanceof IndividualsAssociation) {
+ } else if (entity instanceof IndividualsAssociation) {
detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement,
(IndividualsAssociation) entity, style);
- } else if (entity instanceof QuantitativeData) {
+ } else if (entity instanceof QuantitativeData) {
detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement,
(QuantitativeData) entity, style);
- } else if (entity instanceof TaxonInteraction) {
+ } else if (entity instanceof TaxonInteraction) {
detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement,
(TaxonInteraction) entity, style);
- } else if (entity instanceof TextData) {
+ } else if (entity instanceof TextData) {
detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
- } else {
+ } else {
throw new IllegalStateException("There is no interface for the given description element");
- }
- adapt(detailedDescriptionElement);
- parentElement.addElement(detailedDescriptionElement);
- return detailedDescriptionElement;
-
- }
-
- /**
- * Creates a styled text as a part of the form.
- *
- * @param parent
- * the text parent
- * @param value
- * the text initial value
- * @param style
- * the text style
- * @return the text widget
- */
- public StyledText createStyledText(Composite parent, String value, int style) {
+ }
+ adapt(detailedDescriptionElement);
+ parentElement.addElement(detailedDescriptionElement);
+ return detailedDescriptionElement;
+
+ }
+
+ /**
+ * Creates a styled text as a part of the form.
+ *
+ * @param parent
+ * the text parent
+ * @param value
+ * the text initial value
+ * @param style
+ * the text style
+ * @return the text widget
+ */
+ public StyledText createStyledText(Composite parent, String value, int style) {
StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
if (value != null) {
- text.setText(value);
+ text.setText(value);
}
- text.setForeground(getColors().getForeground());
- text.setBackground(getColors().getBackground());
- // text.addFocusListener(visibilityHandler);
- return text;
- }
+ text.setForeground(getColors().getForeground());
+ text.setBackground(getColors().getBackground());
+ // text.addFocusListener(visibilityHandler);
+ return text;
+ }
+
+
+
+ /**
+ * @param conversationHolder
+ * @param parent
+ * @param detailsViewer
+ * @param i
+ * @return
+ */
+ public FieldObservationGeneralSection createFieldObservationGeneralSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ FieldObservationGeneralSection section = new FieldObservationGeneralSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+ /**
+ * @param conversationHolder
+ * @param parent
+ * @param detailsViewer
+ * @param i
+ * @return
+ */
+ public GatheringEventSection createGatheringEventSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ GatheringEventSection section = new GatheringEventSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+ /**
+ * @param conversationHolder
+ * @param parent
+ * @param detailsViewer
+ * @param i
+ * @return
+ */
+ public FieldObservationDetailsSection createFieldObservationDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ FieldObservationDetailsSection section = new FieldObservationDetailsSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
+ public SpecimenGeneralSection createSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ SpecimenGeneralSection section = new SpecimenGeneralSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
+ public SpecimenDetailsSection createSpecimenDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ SpecimenDetailsSection section = new SpecimenDetailsSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
+ public DerivedUnitDetailsSection createDerivedUnitDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ DerivedUnitDetailsSection section = new DerivedUnitDetailsSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
+ public FieldObservationGeneralElementController createSpecimenGeneralElementController(ICdmFormElement parentElement){
+ return createFieldObservationGeneralElementController_internal(parentElement, true, false);
+ }
+
+ public SpecimenDetailsElementController createSpecimenDetailsElementController(ICdmFormElement parentElement){
+ SpecimenDetailsElement element = new SpecimenDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+ element.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+ SpecimenDetailsElementController controller = new SpecimenDetailsElementController(element, this, parentElement);
+ addAndAdaptElement(parentElement, controller);
+ return controller;
+ }
+
+ public DerivedUnitDetailsElementController createDerivedUnitDetailsElementController(ICdmFormElement parentElement){
+ DerivedUnitDetailsElement element = new DerivedUnitDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+ element.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+ DerivedUnitDetailsElementController controller = new DerivedUnitDetailsElementController(element, this, parentElement);
+ addAndAdaptElement(parentElement, controller);
+ return controller;
+ }
+
+ public FieldObservationGeneralElementController createSpecimenGeneralElementControllerWizard(ICdmFormElement parentElement){
+ return createFieldObservationGeneralElementController_internal(parentElement, true, true);
+ }
+ public FieldObservationGeneralElementController createFieldObservationGeneralElementControllerWizard(ICdmFormElement parentElement){
+ return createFieldObservationGeneralElementController_internal(parentElement, false, true);
+ }
+ public FieldObservationGeneralElementController createFieldObservationGeneralElementController(ICdmFormElement parentElement){
+ return createFieldObservationGeneralElementController_internal(parentElement, false, false);
+ }
+ private FieldObservationGeneralElementController createFieldObservationGeneralElementController_internal(ICdmFormElement parentElement, boolean isSpecimen, boolean isWizard){
+ FieldObservationGeneralElement element = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
+ element.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+ FieldObservationGeneralElementController controller = new FieldObservationGeneralElementController(element, this, parentElement, isSpecimen, isWizard);
+ addAndAdaptElement(parentElement, controller);
+ return controller;
+ }
+ public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) {
+ GatheringEventDetailsElement element = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+ element.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+ GatheringEventDetailsElementController controller = new GatheringEventDetailsElementController(element, this, parentElement);
+ adapt(controller);
+ parentElement.addElement(controller);
+ return controller;
+ }
+ public FieldObservationDetailsElementController createFieldObservationDetailsElementController(ICdmFormElement parentElement) {
+ FieldObservationDetailsElement element = new FieldObservationDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+ element.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+ FieldObservationDetailsElementController controller = new FieldObservationDetailsElementController(element, this, parentElement);
+ addAndAdaptElement(parentElement, controller);
+ return controller;
+ }
}
import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>CheckboxElement class.</p>
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.TimePeriod;
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>
import org.eclipse.ui.forms.widgets.Section;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>
package eu.etaxonomy.taxeditor.ui.element;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
import eu.etaxonomy.cdm.common.UriUtils;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>ImageElement class.</p>
import org.eclipse.jface.util.PropertyChangeEvent;
import eu.etaxonomy.cdm.model.description.KeyStatement;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* @author n.hoffmann
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.forms.widgets.TableWrapData;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+
/**
* <p>KeyValueViewerElement class.</p>
import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>LabelElement class.</p>
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>LanguageStringWithLabelElement class.</p>
// $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.
*/
import org.eclipse.jface.util.PropertyChangeEvent;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>
* MinMaxTextSection class.
* </p>
- *
+ *
* @author c.mathew
* @created 23 Jul 2013
* @version 1.0
private final NumberWithLabelElement text_minVal;
private final NumberWithLabelElement text_maxVal;
private int cursorPosition;
-
+
// unit types handled by this section
public enum UnitType {
ELEVATION,
* <p>
* Constructor for DateDetailSection.
* </p>
- *
+ *
* @param formFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
text_minVal = formFactory.createNumberTextWithLabelElement(this,
"Min : ", getMinimum(), style);
-
+
text_maxVal = formFactory.createNumberTextWithLabelElement(this,
"Max : ", getMaximum(), style);
-
+
text_freeText = formFactory.createTextWithLabelElement(this,
"Freetext : ", getFreetext(), style);
* <p>
* Setter for the field <code>timePeriod</code>.
* </p>
- *
+ *
* @param timePeriod
* a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
*/
if(getEntity().getDistanceToGroundText() != null) {
text_freeText.setText(getEntity().getDistanceToGroundText());
}
- break;
+ break;
case DIST_TO_WATER:
if(getEntity().getDistanceToWaterSurface() != null) {
text_minVal.setNumber(getEntity().getDistanceToWaterSurface());
if(getEntity().getDistanceToWaterSurfaceText() != null) {
text_freeText.setText(getEntity().getDistanceToWaterSurfaceText());
}
- break;
+ break;
default:
break;
}
}
private void handleEvent(Object eventSource) {
- if (eventSource == text_minVal) {
+ if (eventSource == text_minVal) {
updateMinimum();
} else if (eventSource == text_maxVal) {
updateMaximum();
} else if (eventSource == text_freeText) {
- updateFreetext();
- }
+ updateFreetext();
+ }
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
-
+
/*
* (non-Javadoc)
- *
+ *
* @see eu.etaxonomy.taxeditor.forms.AbstractFormSection#dispose()
*/
/** {@inheritDoc} */
formFactory.removePropertyChangeListener(this);
super.dispose();
}
-
+
private void updateMinimum() {
switch(unitType) {
case ELEVATION:
break;
case DIST_TO_GROUND:
getEntity().setDistanceToGround(text_minVal.getDouble());
- break;
+ break;
case DIST_TO_WATER:
getEntity().setDistanceToWaterSurface(text_minVal.getDouble());
- break;
+ break;
}
}
-
+
private Number getMinimum() {
if(getEntity() == null) {
return null;
}
switch(unitType) {
case ELEVATION:
- return getEntity().getAbsoluteElevation();
+ return getEntity().getAbsoluteElevation();
case DIST_TO_GROUND:
- return getEntity().getDistanceToGround();
+ return getEntity().getDistanceToGround();
case DIST_TO_WATER:
- return getEntity().getDistanceToWaterSurface();
+ return getEntity().getDistanceToWaterSurface();
}
return null;
}
-
+
private void updateMaximum() {
switch(unitType) {
case ELEVATION:
break;
case DIST_TO_GROUND:
getEntity().setDistanceToGroundMax(text_maxVal.getDouble());
- break;
+ break;
case DIST_TO_WATER:
getEntity().setDistanceToWaterSurfaceMax(text_maxVal.getDouble());
- break;
+ break;
}
}
-
+
private Number getMaximum() {
if(getEntity() == null) {
return null;
}
switch(unitType) {
case ELEVATION:
- return getEntity().getAbsoluteElevationMaximum();
+ return getEntity().getAbsoluteElevationMaximum();
case DIST_TO_GROUND:
- return getEntity().getDistanceToGroundMax();
+ return getEntity().getDistanceToGroundMax();
case DIST_TO_WATER:
- return getEntity().getDistanceToWaterSurfaceMax();
+ return getEntity().getDistanceToWaterSurfaceMax();
}
return null;
}
-
+
private void updateFreetext() {
switch(unitType) {
case ELEVATION:
break;
case DIST_TO_GROUND:
getEntity().setDistanceToGroundText(text_freeText.getText());
- break;
+ break;
case DIST_TO_WATER:
getEntity().setDistanceToWaterSurfaceText(text_freeText.getText());
- break;
+ break;
}
- }
-
+ }
+
private String getFreetext() {
if(getEntity() == null) {
return null;
}
switch(unitType) {
case ELEVATION:
- return getEntity().getAbsoluteElevationText();
+ return getEntity().getAbsoluteElevationText();
case DIST_TO_GROUND:
- return getEntity().getDistanceToGroundText();
+ return getEntity().getDistanceToGroundText();
case DIST_TO_WATER:
- return getEntity().getDistanceToWaterSurfaceText();
+ return getEntity().getDistanceToWaterSurfaceText();
}
return null;
}
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.translation.TranslationWizard;
// $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.
*/
import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
private Float start;
private Float end;
-
+
private NumberFormatException exception;
/**
super(toolkit, parentElement, labelString, null, null, style);
setNumber(initialNumber);
}
-
-
+
+
/**
* <p>setNumber</p>
*
public void setNumber(Number number) {
super.setText(getStringRepresentation(number));
}
-
+
/**
* <p>getInteger</p>
*
String text = super.getText().trim();
return text.equals("") ? 0 : new Integer(text);
}
-
+
/**
* <p>getFloat</p>
*
String text = super.getText();
return new Float(text);
}
-
+
/**
* <p>getDouble</p>
*
private String getStringRepresentation(Object number){
if(number != null){
return number.toString();
- }
+ }
return null;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
return;
}
-
+
try{
-
+
Float number = Float.parseFloat(value);
-
+
if((start != null && number < start) || (end != null && number > end)){
throw new NumberFormatException("You entered a number that is not within the allowed bounds.");
}
-
+
}catch(NumberFormatException e){
text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
exception = e;
return;
}
-
+
exception = null;
text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
-
+
super.modifyText(event);
}
-
+
/**
* <p>setLimits</p>
*
public void setLimits(int numberOfDigits, Integer start, Integer end){
setLimits(numberOfDigits, start.floatValue(), end.floatValue());
}
-
+
/**
* <p>setLimits</p>
*
this.start = start;
this.end = end;
}
-
+
/**
* <p>Getter for the field <code>exception</code>.</p>
*
import org.joda.time.Partial;
import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>PartialElement class.</p>
import eu.etaxonomy.cdm.model.location.Point;
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
/**
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+
/**
* <p>RootElement class.</p>
import org.eclipse.swt.widgets.Widget;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
import org.eclipse.swt.widgets.Text;
import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>TextActionElement class.</p>
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>
import org.eclipse.ui.forms.widgets.Section;
import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* <p>
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* When the button is pressed, this textfield may be edited.
import java.net.URI;
import java.net.URISyntaxException;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+
/**
* @author n.hoffmann
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
/**
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
/**
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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;
/**
* <p>
* @created Feb 26, 2010
* @version 1.0
*/
-public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement implements IEntityElement<T>, IEnableableFormElement, IConversationEnabled {
+public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement implements ICdmDetailElement<T> {
private T entity;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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;
*/
public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSection<ENTITY> implements IEnableableFormElement, IExpansionListener {
- private AbstractCdmDetailElement<ENTITY> detailElement;
+ protected ICdmDetailElement<ENTITY> detailElement;
/**
* <p>
createControlsByType(formElement, null, style);
}
- protected abstract AbstractCdmDetailElement<ENTITY> createCdmDetailElement(AbstractCdmDetailSection<ENTITY> parentElement, int style);
+ protected abstract ICdmDetailElement<ENTITY> createCdmDetailElement(AbstractCdmDetailSection<ENTITY> parentElement, int style);
- protected AbstractCdmDetailElement<ENTITY> createCdmDetailElementByType(AbstractCdmDetailSection<ENTITY> parentElement, Class<ENTITY> entityClass, int style){
+ protected ICdmDetailElement<ENTITY> createCdmDetailElementByType(AbstractCdmDetailSection<ENTITY> parentElement, Class<ENTITY> entityClass, int style){
return createCdmDetailElement(parentElement, style);
}
// $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.
*/
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.element.ISelectable;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
* <p>
* Abstract AbstractEntityCollectionElement class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Nov 16, 2009
* @version 1.0
protected ENTITY entity;
- private Composite container;
+ private final Composite container;
- private Composite box;
+ private final Composite box;
private Button button_remove;
* <p>
* Constructor for AbstractEntityCollectionElement.
* </p>
- *
+ *
* @param style
* a int.
* @param formFactory
/**
* Init gets executed before any other setup of the section takes place
- *
+ *
* Implement this if you want to configure the section
*/
public void init() {
* <p>
* Setter for the field <code>entity</code>.
* </p>
- *
+ *
* @param entity
* a ENTITY object.
*/
* <p>
* Getter for the field <code>entity</code>.
* </p>
- *
+ *
* @return a ENTITY object.
*/
- public ENTITY getEntity() {
+ @Override
+ public ENTITY getEntity() {
return entity;
}
* <p>
* createControls
* </p>
- *
+ *
* @param element
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
/**
* Mark <code>this</code> element as selected.
*/
- public void setSelected(boolean selected) {
+ @Override
+ public void setSelected(boolean selected) {
for (ICdmFormElement element : getElements()) {
if (element instanceof ISelectable) {
/*
* (non-Javadoc)
- *
+ *
* @see
* eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org
* .eclipse.jface.util.PropertyChangeEvent)
* <p>
* handleEvent
* </p>
- *
+ *
* @param eventSource
* a {@link java.lang.Object} object.
*/
public abstract void handleEvent(Object eventSource);
/** {@inheritDoc} */
- public void setBackground(Color color) {
+ @Override
+ public void setBackground(Color color) {
backgroundColor = color;
super.setBackground(color);
box.setBackground(color);
/**
* {@inheritDoc}
- *
+ *
* React when selection occurs
*/
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
}
/** {@inheritDoc} */
- public void widgetDefaultSelected(SelectionEvent e) {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
}
/** {@inheritDoc} */
* <p>
* Getter for the field <code>backgroundColor</code>.
* </p>
- *
+ *
* @return the backgroundColor
*/
public Color getBackgroundColor() {
* <p>
* getConversationHolder
* </p>
- *
+ *
* @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();
}
/** {@inheritDoc} */
- public void update(CdmDataChangeMap changeEvents) {
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
}
}
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* This class visualizes an CDM entity of type ENTITY and additionally provides the functionality to add
return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE);
}
+ /**
+ * Remove an element from the entities collection and update the section
+ *
+ * @param element a ELEMENT object.
+ */
+ public void removeElementAndUpdate(ELEMENT element) {
+ removeElement(element);
+ internalUpdateSection(true);
+ }
+
/**
* Get the specific collection of this entity
*
import java.util.Arrays;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
/**
import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>EmptyElement class.</p>
--- /dev/null
+// $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.section;
+
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+
+/**
+ * @author pplitzner
+ * @date 30.07.2013
+ *
+ */
+public interface ICdmDetailElement<T> extends IEntityElement<T>, IEnableableFormElement, IConversationEnabled{
+
+ public abstract void setEntity(T entity);
+
+}
package eu.etaxonomy.taxeditor.ui.section.agent;
import eu.etaxonomy.cdm.model.agent.Institution;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Institution;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Institution;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
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.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>
// $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.
*/
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.parser.ParseHandler;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
* <p>
* TaxonNodeDetailElement class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Sep 27, 2010
* @version 1.0
* <p>
* Constructor for TaxonNodeDetailElement.
* </p>
- *
+ *
* @param formFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
/*
* (non-Javadoc)
- *
+ *
* @see
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
/*
* (non-Javadoc)
- *
+ *
* @see
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
* .lang.Object)
* <p>
* Getter for the field <code>classification</code>.
* </p>
- *
+ *
* @return the classification
*/
public Classification getClassification() {
* <p>
* isOpenInEditor
* </p>
- *
+ *
* @return the openInEditor
*/
public boolean isOpenInEditor() {
* <p>
* Getter for the field <code>parentTreeNode</code>.
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
*/
public ITaxonTreeNode getParentTreeNode() {
* <p>
* Getter for the field <code>taxon</code>.
* </p>
- *
+ *
* @return the taxon
*/
public Taxon getTaxon() {
selection_parentTaxonNode.setEntity((TaxonNode) parentTreeNode);
selection_parentTaxonNode.setClassification(classification);
} else if(parentTreeNode == null){
- this.parentTreeNode = selection_classification.getEntity();
+ this.parentTreeNode = selection_classification.getEntity();
}
}
* <p>
* isComplete
* </p>
- *
+ *
* @return the complete
*/
public boolean isComplete() {
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.DerivedUnitSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
package eu.etaxonomy.taxeditor.ui.section.description;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractOriginalSourceElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import java.util.Collection;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
-import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.OriginalSourceTypeSelectionDialog;
+import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.OriginalSourceTypeSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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;
import org.eclipse.swt.events.SelectionListener;
-
import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.description.IModifiable;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.description.State;
import eu.etaxonomy.cdm.model.description.StateData;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.AbstractEntityCollectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.description.StateData;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.AbstractEntityCollectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.QuantitativeData;
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
// $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.description.detail;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
* @version 1.0
*/
public abstract class AbstractDetailedDescriptionDetailElement<T extends DescriptionElementBase> extends AbstractCdmDetailElement<T>{
-
+
/**
* <p>Constructor for AbstractDetailedDescriptionDetailElement.</p>
*
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.model.description.CategoricalData;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.selection.EntitySelectionElement;
/**
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
import eu.etaxonomy.cdm.model.description.QuantitativeData;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection;
import eu.etaxonomy.cdm.model.description.TaxonInteraction;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.description.TextData;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement;
/**
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.BrowserElement;
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.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
package eu.etaxonomy.taxeditor.ui.section.grantedAuthority;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
-import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
package eu.etaxonomy.taxeditor.ui.section.grantedAuthority;
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.GrantedAuthoritySelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
package eu.etaxonomy.taxeditor.ui.section.group;
import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.UserSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.IIdentificationKey;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractIdentifiableEntityDetailElement;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.KeyStatementElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.common.media.ImageInfo;
import eu.etaxonomy.cdm.model.media.ImageFile;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.ImageElement;
import eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.AbstractEntityCollectionElement;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.cdm.model.media.ImageFile;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import java.util.Collection;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity;
import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.supplemental.AbstractReferencedEntityElement;
/**
import java.util.Arrays;
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
-import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.taxeditor.model.AuthorHelper;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
package eu.etaxonomy.taxeditor.ui.section.name;
import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.name.ZoologicalName;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
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.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.selection.EntitySelectionElement;
/**
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
// $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.
*/
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.EventBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
// $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.
*/
import java.util.Collection;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
- * <p>CollectingAreasDetailSection class.</p>
+ * <p>
+ * CollectingAreasDetailSection class.
+ * </p>
*
* @author n.hoffmann
* @created Oct 14, 2010
* @version 1.0
*/
-public class CollectingAreasDetailSection extends
- AbstractEntityCollectionSection<DerivedUnitFacade, NamedArea> {
+public class CollectingAreasDetailSection extends AbstractEntityCollectionSection<DerivedUnitFacade, NamedArea> {
/**
* <p>Constructor for CollectingAreasDetailSection.</p>
@Override
public NamedArea createNewElement() {
NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
-
+
return selection;
}
return "Add a collecting area";
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createElementComposite(java.lang.Object, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ protected void createElementComposite(NamedArea element, SelectionListener removeListener, Color backgroundColor) {
+ formFactory.createNamedAreaFieldController(this, element, removeListener);
+ }
+
}
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.occurrence.Collection;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.Collection;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
private TextWithLabelElement text_exsicatum;
- //FIXME:3.3MC---- see Ticket #3732
+ //FIXME:3.3MC----
// private TermComboElement<PreservationMethod> combo_preservationMethod;
//FIXME:3.3MC----
text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
text_catalogNumber = formFactory.createTextWithLabelElement(formElement, "Catalog Number", entity.getCatalogNumber(), style);
-
- //FIXME:3.3MC----
+ //FIXME:3.3MC----
// try {
// combo_preservationMethod = formFactory.createTermComboElement(PreservationMethod.class, formElement, "Preservation Method", entity.getPreservationMethod(), style);
// } catch (MethodNotSupportedByDerivedUnitTypeException e) {
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
--- /dev/null
+// $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.section.occurrence;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.DerivedUnitDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date 02.09.2013
+ *
+ */
+public class DerivedUnitDetailsWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param entity
+ */
+ public DerivedUnitDetailsWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, DerivedUnitFacade entity) {
+ super(formFactory, conversation, entity);
+ setTitle("Derived Unit Details");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete
+ * ()
+ */
+ @Override
+ protected void checkComplete() {
+ setPageComplete(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement)
+ */
+ @Override
+ public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
+ DerivedUnitDetailsElementController detailElement = formFactory.createDerivedUnitDetailsElementController(rootElement);
+ detailElement.setEntity(getEntity());
+ checkComplete();
+ return detailElement;
+ }
+}
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import org.eclipse.swt.events.SelectionListener;
-
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.selection.EntitySelectionElement;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElementController;
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.section.AbstractCdmDetailElement;
/**
* @created Dec 15, 2010
* @version 1.0
*/
-public class FieldObservationWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
+public class FieldObservationDetailsWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
/**
* @param formFactory
* @param conversation
* @param entity
*/
- public FieldObservationWizardPage(CdmFormFactory formFactory,
+ public FieldObservationDetailsWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setTitle("Field Observation Details");
*/
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
- FieldObservationDetailElement detailElement = formFactory.createFieldObservationDetailElement(rootElement);
+ FieldObservationDetailsElementController detailElement = formFactory.createFieldObservationDetailsElementController(rootElement);
detailElement.setEntity(getEntity());
return detailElement;
}
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElementController;
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.section.AbstractCdmDetailElement;
/**
* @created Dec 17, 2010
* @version 1.0
*/
-public class GeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
+public class FieldObservationGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
/**
* @param formFactory
* @param conversation
* @param entity
*/
- public GeneralWizardPage(CdmFormFactory formFactory,
+ public FieldObservationGeneralWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
- setTitle("General Specimen Data");
+ setTitle("Field Observation");
}
/* (non-Javadoc)
*/
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
- GeneralDetailElement detailElement = formFactory.createGeneralDetailElement(rootElement);
+ FieldObservationGeneralElementController detailElement = formFactory.createFieldObservationGeneralElementControllerWizard(rootElement);
detailElement.setEntity(getEntity());
checkComplete();
return detailElement;
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.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
-import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElementController;
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.section.AbstractCdmDetailElement;
/**
* @created Dec 15, 2010
* @version 1.0
*/
-public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
+public class GatheringEventDetailsWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
/**
* @param formFactory
* @param conversation
* @param entity
*/
- public GatheringEventWizardPage(CdmFormFactory formFactory,
+ public GatheringEventDetailsWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setTitle("Gathering Event Details");
*/
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
- GatheringEventDetailElement detailElement = formFactory.createGatheringEventDetailElement(rootElement);
+ GatheringEventDetailsElementController detailElement = formFactory.createGatheringEventDetailsElementController(rootElement);
detailElement.setEntity(getEntity());
return detailElement;
}
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.PointElement;
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
-import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
/**
* @author n.hoffmann
private TextWithLabelElement text_collectingNumber;
private EntitySelectionElement<Collection> selection_collection;
private TextWithLabelElement text_accessionNumber;
-
/**
* @param formFactory
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
--- /dev/null
+// $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.section.occurrence;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date 30.08.2013
+ *
+ */
+public class SpecimenDetailsWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param entity
+ */
+ public SpecimenDetailsWizardPage(CdmFormFactory formFactory,
+ ConversationHolder conversation, DerivedUnitFacade entity) {
+ super(formFactory, conversation, entity);
+ setTitle("Specimen Details");
+ setPageComplete(true);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
+ */
+ @Override
+ protected void checkComplete() {
+ setPageComplete(true);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
+ */
+ @Override
+ public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
+ SpecimenDetailsElementController detailElement = formFactory.createSpecimenDetailsElementController(rootElement);
+ detailElement.setEntity(getEntity());
+ return detailElement;
+ }
+}
--- /dev/null
+// $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.section.occurrence;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElementController;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date 02.09.2013
+ *
+ */
+public class SpecimenGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param entity
+ */
+ public SpecimenGeneralWizardPage(CdmFormFactory formFactory,
+ ConversationHolder conversation, DerivedUnitFacade entity) {
+ super(formFactory, conversation, entity);
+ setTitle("Specimen");
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
+ */
+ @Override
+ protected void checkComplete() {
+ setPageComplete(true);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
+ */
+ @Override
+ public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
+ FieldObservationGeneralElementController detailElement = formFactory.createSpecimenGeneralElementControllerWizard(rootElement);
+ detailElement.setEntity(getEntity());
+ checkComplete();
+ return detailElement;
+ }
+}
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.reference.ReferenceType;
import eu.etaxonomy.taxeditor.model.AuthorHelper;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
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.IErrorIntolerableElement;
import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
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.IExceptionHandler;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
// $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.
*/
import eu.etaxonomy.cdm.model.common.OriginalSourceBase;
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
/**
int style) {
super(formFactory, section, element, removeListener, style);
}
-
+
/** {@inheritDoc} */
@Override
public void init() {
super.init();
setHasOriginalNameString(true);
}
-
+
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
combo_origsourcetype = formFactory
.createEnumComboElement(OriginalSourceType.class,
- formElement, style);
+ formElement, style);
text_idInSource = formFactory.createTextWithLabelElement(formElement, "Id In Source", null, style);
text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", null, style);
super.createControls(formElement, style);
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.common.Annotation;
import eu.etaxonomy.cdm.model.common.AnnotationType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.cdm.model.common.AnnotationType;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
package eu.etaxonomy.taxeditor.ui.section.supplemental;\r
\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;\r
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;\r
\r
package eu.etaxonomy.taxeditor.ui.section.supplemental;\r
\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
\r
/**\r
* @author l.morris\r
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.Credit;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import java.util.Collection;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Credit;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.Extension;
import eu.etaxonomy.cdm.model.common.ExtensionType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.AbstractEntityCollectionElement;
import java.util.Collection;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Extension;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>HeadlineSection class.</p>
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
-import eu.etaxonomy.cdm.model.common.OriginalSourceType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>IdentifiableSourceElement class.</p>
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.section.AbstractEntityCollectionElement;
/**
import java.util.Collection;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Marker;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.cdm.model.media.RightsType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.media.Rights;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.DerivedUnitSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
/**
* <p>VersionElement class.</p>
package eu.etaxonomy.taxeditor.ui.section.supplemental;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>VersionSection class.</p>
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>ParsingMessageElement class.</p>
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-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.ITaxonBaseDetailSection;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
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.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.GroupSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.section.AbstractCdmDetailElement;
/**
/**\r
* Copyright (C) 2011 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import java.util.ListIterator;\r
import java.util.Map;\r
import java.util.Set;\r
+\r
import org.apache.log4j.Logger;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.events.SelectionListener;\r
import eu.etaxonomy.taxeditor.editor.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.store.TermStore;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
\r
- \r
+\r
/**\r
* The context manager mediates context start/stop and workbench shutdowns to all registered listeners.\r
*\r
- * @author a.theys \r
+ * @author a.theys\r
* @created mar 13, 2012\r
* @version 1.0\r
*/\r
combo_HumanGroup.addSelectionListener(this);\r
combo_EthnicGroup = formFactory.createTermComboElement(DefinedTerm.class, this, UsageTermCollection.ethnicGroupLabel, null, style);\r
combo_Country = formFactory.createTermComboElement(DefinedTerm.class, this, UsageTermCollection.countryLabel, null, style);\r
- \r
+\r
\r
List<State> termsUseCategory = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false));\r
combo_UseCategory.setTerms(termsUseCategory);\r
combo_UseCategory.setSelection(stateSelection(UsageTermCollection.useCategoryVocabularyLabel));\r
- \r
+\r
List<State> termsSubCategory = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false), combo_UseCategory.getSelection());\r
- \r
+\r
if (termsSubCategory != null) {\r
combo_UseSubCategory.setTerms(termsSubCategory);\r
combo_UseSubCategory.setSelection(stateSelection(UsageTermCollection.useSubCategoryVocabularyLabel));\r
else {\r
combo_UseSubCategory.setEnabled(false);\r
}\r
- \r
+\r
List<DefinedTerm> plantPartsToAdd = setModifierComboTerms(TermStore.getTerms(DefinedTerm.class, null, false), UsageTermCollection.plantPartLabel);\r
combo_PlantPart.setTerms(plantPartsToAdd);\r
combo_PlantPart.setSelection(modifierSelection(UsageTermCollection.plantPartLabel));\r
- \r
+\r
List<DefinedTerm> countriesToAdd = setModifierComboTerms(TermStore.getTerms(DefinedTerm.class, null, false), UsageTermCollection.countryLabel);\r
combo_Country.setTerms(countriesToAdd);\r
combo_Country.setSelection(modifierSelection(UsageTermCollection.countryLabel));\r
- \r
+\r
List<DefinedTerm> humanGroupToAdd = setModifierComboTerms(TermStore.getTerms(DefinedTerm.class, null, false), UsageTermCollection.humanGroupLabel);\r
combo_HumanGroup.setTerms(humanGroupToAdd);\r
combo_HumanGroup.setSelection(modifierSelection(UsageTermCollection.humanGroupLabel));\r
- \r
+\r
List<DefinedTerm> ethnicGroupToAdd = setEthnicGroupComboTerms(TermStore.getTerms(DefinedTerm.class, null, false), combo_HumanGroup.getSelection());\r
if (ethnicGroupToAdd != null) {\r
combo_EthnicGroup.setTerms(ethnicGroupToAdd);\r
return null;\r
}\r
return null;\r
- \r
+\r
}\r
- \r
+\r
/**\r
* Returns the selected state\r
* @param comboCategory\r
return statedata.getState();\r
}\r
}\r
- } \r
+ }\r
}\r
}\r
else {\r
return null;\r
}\r
return null;\r
- \r
+\r
}\r
- \r
+\r
/**\r
* This function sets the combo terms (Besides EthnicGroup\r
* @param listOfTerms\r
termsToAdd.add(term);\r
}\r
}\r
- \r
+\r
return termsToAdd;\r
}\r
- \r
+\r
\r
/**\r
* This function sets the Use Category combo term\r
State selectedUseCategory) {\r
List<State> termsToAdd = new ArrayList<State>();\r
if (combo_UseCategory.getSelection() != null) {\r
- \r
+\r
for (State term : listOfTerms) {\r
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(selectedUseCategory.getTitleCache()))) {\r
termsToAdd.add(term);\r
else if ((term.getVocabulary() !=null) && (term.getVocabulary().getTitleCache().equals(selectedUseCategory.getTitleCache()))) {\r
termsToAdd.add(term);\r
}\r
- \r
+\r
}\r
}\r
else if (!getEntity().getStateData().isEmpty()) {\r
termsToAdd.add(term);\r
}\r
}\r
- \r
+\r
}\r
}\r
}\r
- \r
+\r
}\r
- \r
+\r
else {\r
return null;\r
}\r
\r
return termsToAdd;\r
}\r
- \r
- \r
+\r
+\r
/**\r
* This function sets the EthnicGroup combo term\r
* @param listOfTerms\r
List<DefinedTerm> termsToAdd = new ArrayList<DefinedTerm>();\r
if (combo_HumanGroup.getSelection() != null) {\r
for (DefinedTerm term : listOfTerms) {\r
- \r
+\r
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(selectedHumangroup.getTitleCache()))) {\r
termsToAdd.add(term);\r
}\r
termsToAdd.add(modifier);\r
}\r
}\r
- \r
+\r
}\r
}\r
}\r
} else {\r
return null;\r
}\r
- \r
+\r
return termsToAdd;\r
}\r
\r
- \r
+\r
/** {@inheritDoc} */\r
@Override\r
public void handleEvent(Object eventSource) {\r
if(!useCategoryStateDataCheck.getState().getTitleCache().equals(combo_UseCategory.getSelection().getTitleCache())) {\r
isUseCategoryChanged = true;\r
}\r
- \r
+\r
}\r
}\r
ListIterator<StateData> itrExistingStates = getEntity().getStateData().listIterator();\r
stateData.setState(combo_UseCategory.getSelection());\r
stateData.putModifyingText(CdmStore.getDefaultLanguage(),UsageTermCollection.useCategoryVocabularyLabel);\r
itrExistingStates.add(stateData);\r
- \r
+\r
}\r
} else if (modifyingText.get(CdmStore.getDefaultLanguage()).getText().equals(UsageTermCollection.useSubCategoryVocabularyLabel) && isUseCategoryChanged == true) {\r
itrExistingStates.remove();\r
}\r
}\r
}\r
- \r
- \r
+\r
+\r
if (isChanged == false) {\r
StateData stateData = StateData\r
.NewInstance(combo_UseCategory.getSelection());\r
stateData.putModifyingText(CdmStore.getDefaultLanguage(), UsageTermCollection.useCategoryVocabularyLabel);\r
getEntity().addStateData(stateData);\r
}\r
- \r
+\r
combo_UseSubCategory.setEnabled(true);\r
- \r
+\r
}\r
else {\r
if (!getEntity().getStateData().isEmpty()) {\r
}\r
}\r
}\r
- \r
+\r
if (eventSource == combo_UseSubCategory) {\r
if (combo_UseSubCategory.getSelection() != null) {\r
boolean isChanged = false;\r
}\r
}\r
}\r
- \r
+\r
if (isChanged == false){\r
StateData stateData = StateData\r
.NewInstance(combo_UseSubCategory.getSelection());\r
stateData.putModifyingText(CdmStore.getDefaultLanguage(), UsageTermCollection.useSubCategoryVocabularyLabel);\r
getEntity().addStateData(stateData);\r
}\r
- \r
+\r
} else {\r
if (!getEntity().getStateData().isEmpty()) {\r
Iterator<StateData> itrStateData = getEntity().getStateData().iterator();\r
if(GetVocabularyType(modifier, UsageTermCollection.plantPartLabel)) {\r
itrExistingModifiers.remove();\r
}\r
- \r
- } \r
+\r
+ }\r
DefinedTerm plantPart = combo_PlantPart.getSelection();\r
getEntity().addModifier(plantPart);\r
} else {\r
}\r
}\r
}\r
- \r
+\r
}\r
}\r
if (eventSource == combo_Country) {\r
if(GetVocabularyType(modifier, UsageTermCollection.countryLabel)) {\r
itrExistingModifiers.remove();\r
}\r
- \r
+\r
}\r
DefinedTerm country = combo_Country.getSelection();\r
getEntity().addModifier(country);\r
if(modToCheck.equals(combo_HumanGroup.getSelection()) && (GetVocabularyType(modToCheck, UsageTermCollection.humanGroupLabel))) {\r
isHumanGroupChanged = false;\r
}\r
- \r
- \r
+\r
+\r
}\r
Iterator<DefinedTerm> itrExistingModifiers = getEntity().getModifiers().iterator();\r
while (itrExistingModifiers.hasNext()) {\r
if((GetVocabularyType(modifier, UsageTermCollection.humanGroupLabel) || GetVocabularyType(modifier, UsageTermCollection.ethnicGroupLabel)) && isHumanGroupChanged) {\r
itrExistingModifiers.remove();\r
}\r
- \r
- } \r
+\r
+ }\r
if(isHumanGroupChanged){\r
DefinedTerm humanGroup = combo_HumanGroup.getSelection();\r
getEntity().addModifier(humanGroup);\r
//DefinedTerm emptyMod = DefinedTerm.NewInstance();\r
DefinedTerm emptyMod = null;\r
//FIXME:3.3MC----\r
- \r
- \r
+\r
+\r
emptyListToResetComboBox.add(emptyMod);\r
combo_EthnicGroup.setTerms(emptyListToResetComboBox);\r
combo_EthnicGroup.setEnabled(false);\r
- \r
+\r
}\r
}\r
if (eventSource == combo_EthnicGroup) {\r
if(GetVocabularyType(modifier, combo_HumanGroup.getSelection().getTitleCache())) {\r
itrExistingModifiers.remove();\r
}\r
- \r
- } \r
+\r
+ }\r
DefinedTerm ethnicGroup = combo_EthnicGroup.getSelection();\r
getEntity().addModifier(ethnicGroup);\r
} else {\r
Set<DefinedTerm> modifiers = getEntity().getModifiers();\r
if(!modifiers.isEmpty()) {\r
- \r
+\r
Iterator<DefinedTerm> itr = modifiers.iterator();\r
while (itr.hasNext()) {\r
DefinedTerm currentMod = itr.next();\r
itr.remove();\r
}\r
}\r
- \r
+\r
}\r
}\r
}\r
}\r
- \r
- \r
+\r
+\r
\r
/**\r
* This function Checks the vocabulary type\r
}\r
return false;\r
}\r
- \r
- \r
+\r
+\r
\r
/** {@inheritDoc} */\r
@Override\r
State selectedUseCategory = combo_UseCategory.getSelection();\r
if (selectedUseCategory != null) {\r
combo_UseSubCategory.setTerms(setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false),selectedUseCategory));\r
- \r
+\r
if (!getEntity().getStateData().isEmpty()) {\r
Iterator<StateData> itrExistingState = getEntity().getStateData().iterator();\r
while(itrExistingState.hasNext()) {\r
- StateData existingStateData = (StateData) itrExistingState.next();\r
+ StateData existingStateData = itrExistingState.next();\r
Map<Language, LanguageString> modifyingText = existingStateData.getModifyingText();\r
if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {\r
if (modifyingText.get(CdmStore.getDefaultLanguage())\r
}\r
}\r
}\r
- \r
+\r
}\r
}\r
}\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;\r
\r
import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;\r
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
\r
import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
\r
/**\r
* @author l.morris\r
\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;\r
\r
import java.net.URISyntaxException;\r
\r
import eu.etaxonomy.cdm.model.common.Language;\r
-import eu.etaxonomy.cdm.model.common.Representation;\r
import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
import eu.etaxonomy.cdm.model.location.NamedAreaType;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;\r
\r
/**\r
\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.location.NamedArea;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;\r
\r
\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;\r
\r
\r
import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;\r
\r
/**\r
\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;\r
\r
// $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.
*/
import eu.etaxonomy.taxeditor.model.TextHelper;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.IEntitySelectionElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionWizardPage;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonWizardPage;
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage;
import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionWizardPage;
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailsWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailsWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationGeneralWizardPage;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceWizardPage;
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailWizardPage;
* <p>
* EditFromSelectionWizard class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Jun 1, 2010
* @version 1.0
public class EditFromSelectionWizard extends Wizard implements
SelectionListener {
- private final EntitySelectionElement selectionElement;
+ private final IEntitySelectionElement selectionElement;
/**
* <p>
* Constructor for EditFromSelectionWizard.
* </p>
- *
+ *
* @param selectionElement
* a
* {@link eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement}
* object.
*/
- public EditFromSelectionWizard(EntitySelectionElement selectionElement) {
+ public EditFromSelectionWizard(IEntitySelectionElement selectionElement) {
this.selectionElement = selectionElement;
this.setWindowTitle(String.format("Edit %s", TextHelper.deproxyClassName(selectionElement.getEntity().getClass())));
}
throw new IllegalStateException();
}
- addPage(new GeneralWizardPage(formFactory,
+ addPage(new FieldObservationGeneralWizardPage(formFactory,
selectionElement.getConversationHolder(), facade));
- addPage(new GatheringEventWizardPage(formFactory,
+ addPage(new GatheringEventDetailsWizardPage(formFactory,
selectionElement.getConversationHolder(), facade));
- addPage(new FieldObservationWizardPage(formFactory,
+ addPage(new FieldObservationDetailsWizardPage(formFactory,
selectionElement.getConversationHolder(), facade));
addPage(new DerivedUnitBaseWizardPage(formFactory,
selectionElement.getConversationHolder(), facade));
selectionElement.getConversationHolder(),
(Institution) entity));
} else if (entity instanceof User) {
- addPage(new UserDetailWizardPage(formFactory,
- selectionElement.getConversationHolder(),
+ addPage(new UserDetailWizardPage(formFactory,
+ selectionElement.getConversationHolder(),
(User) entity));
} else {
StoreUtil.warningDialog("Missing interface", this,
"No detail element for current selection");
- }
+ }
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
/** {@inheritDoc} */
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.selection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.springframework.security.core.GrantedAuthority;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.IEntitySelectionElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
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.ILabeledElement;
-import eu.etaxonomy.taxeditor.ui.element.ISelectable;
-import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
* <p>
* Abstract AbstractSelectionElement class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Nov 17, 2009
* @version 1.0
* @param <T>
*/
public class EntitySelectionElement<T extends ICdmBase> extends
- AbstractCdmFormElement implements SelectionListener,
- IEnableableFormElement, ISelectableElement, IEntityElement<T>,
- ILabeledElement, IConversationEnabled, ISelectable {
+ AbstractCdmFormElement implements IEntitySelectionElement<T>{
/**
* Bitmask for configuring functionality of selection element
* <p>
* Constructor for AbstractSelectionElement.
* </p>
- *
+ *
* @param formFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
this.isEditable = (mode & EDITABLE) == EDITABLE;
this.isDeletable = (mode & DELETABLE) == DELETABLE;
boolean isSelectable = (mode & SELECTABLE) == SELECTABLE;
-
+
this.labelString = labelString;
this.conversation = conversation;
setEntity(entity);
}
-
+
public EntitySelectionElement(CdmFormFactory formFactory,
ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz,
String labelString, T entity, int mode, int style) {
button_selection.setImage(ImageResources
.getImage(ImageResources.BROWSE_ICON));
button_selection.setToolTipText("Browse existing");
-
+
addControl(button_selection);
button_selection.addSelectionListener(this);
}
}
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity());
setSelectionInternal(selection);
}
-
+
/**
* Return the selected object
- *
+ *
* @return a T object.
*/
public T getSelection() {
/*
* (non-Javadoc)
- *
+ *
* @see
* eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean)
*/
* <p>
* setSelectionInternal
* </p>
- *
+ *
* @param selection
* a T object.
*/
* <p>
* Setter for the field <code>entity</code>.
* </p>
- *
+ *
* @param selection
* a T object.
*/
}
}
- /**
- * <p>
- * updateFromWizard
- * </p>
- */
- protected void updateFromWizard() {
+ @Override
+ public void updateFromWizard() {
updateElement();
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
* <p>
* getTitle
* </p>
- *
+ *
* @return a {@link java.lang.String} object.
*/
protected String getTitle() {
/*
* (non-Javadoc)
- *
+ *
* @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity()
*/
/**
* <p>
* Getter for the field <code>entity</code>.
* </p>
- *
+ *
* @return a T object.
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#
* getSelectionArbitrator()
*/
* <p>
* Getter for the field <code>selectionArbitrator</code>.
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
* object.
*/
/**
* Convenient access to current shell
- *
+ *
* @return a {@link org.eclipse.swt.widgets.Shell} object.
*/
- protected Shell getShell() {
+ @Override
+ public Shell getShell() {
return getLayoutComposite().getShell();
}
* <p>
* getConversationHolder
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
* object.
*/
* <p>
* Getter for the field <code>label</code>.
* </p>
- *
+ *
* @return a {@link java.lang.String} object.
*/
@Override
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NomenclaturalAuthorTeamSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* <p>
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
import eu.etaxonomy.cdm.model.common.MultilanguageTextHelper;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
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.LanguageStringWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement;
// $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.
*/
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
* <p>
* CdmSectionPart class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Feb 8, 2010
* @version 1.0
* <p>
* Constructor for CdmSectionPart.
* </p>
- *
+ *
* @param section
* a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
* object.
if (input instanceof PolytomousKeyRelationship) {
input = ((PolytomousKeyRelationship) input).getDestination();
}
-
- if ((input instanceof PolytomousKeyNode) &&
- (formSection instanceof PolytomousKeyDetailSection ||
- formSection instanceof GeographicalScopeDetailSection ||
- formSection instanceof ScopeRestrictionSection ||
+
+ if ((input instanceof PolytomousKeyNode) &&
+ (formSection instanceof PolytomousKeyDetailSection ||
+ formSection instanceof GeographicalScopeDetailSection ||
+ formSection instanceof ScopeRestrictionSection ||
formSection instanceof TaxonomicScopeSection)) {
input = ((PolytomousKeyNode)input).getKey();
}
-
-
+
+
formSection.setEntity((T) input);
-
+
return true;
}
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse
* .jface.util.PropertyChangeEvent)
public void propertyChange(PropertyChangeEvent event) {
if (event != null) {
- Object eventSource = event.getSource();
-
+ Object eventSource = event.getSource();
+
if (formSection.equals(eventSource)){
markDirty();
}
if((
- (eventSource instanceof AbstractCdmFormElement)
- && formSection.containsFormElement((AbstractCdmFormElement) eventSource))
+ (eventSource instanceof ICdmFormElement)
+ && formSection.containsFormElement((ICdmFormElement) eventSource))
) {
markDirty();
}
-
// $Id$
/**
* Copyright (C) 2011 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-
import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.DerivedUnitDetailsSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralSection;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
/**
- *
+ *
* The DetailsViewer handles the content of the details view (
* {@link DetailsViewPart}).<br>
* Depending on the type of the selected element the section of the details view
*/
public class DetailsViewer extends AbstractCdmDataViewer {
- private ISelection selection;
-
- /**
- * <p>
- * Constructor for DetailsViewer.
- * </p>
- *
- * @param parent
- * a {@link org.eclipse.swt.widgets.Composite} object.
- * @param viewPart
- * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
- * object.
- */
- public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
- super(parent, viewPart);
- }
-
- // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
- // since we are getting implementations of DerivedUnitBase from the bulk
- // editor
- // and not derived unit facade objects,
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
- * .lang.Object)
- */
- @Override
- public void setInput(Object input) {
+ private ISelection selection;
+
+ /**
+ * <p>
+ * Constructor for DetailsViewer.
+ * </p>
+ *
+ * @param parent
+ * a {@link org.eclipse.swt.widgets.Composite} object.
+ * @param viewPart
+ * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
+ * object.
+ */
+ public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
+ super(parent, viewPart);
+ }
+
+ // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
+ // since we are getting implementations of DerivedUnitBase from the bulk
+ // editor
+ // and not derived unit facade objects,
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
+ * .lang.Object)
+ */
+ @Override
+ public void setInput(Object input) {
if (input instanceof DerivedUnit) {
- try {
- input = DerivedUnitFacade.NewInstance((DerivedUnit) input,
- PreferencesUtil.getDerivedUnitConfigurator());
- } catch (DerivedUnitFacadeNotSupportedException e) {
+ try {
+ input = DerivedUnitFacade.NewInstance((DerivedUnit) input,PreferencesUtil.getDerivedUnitConfigurator());
+ } catch (DerivedUnitFacadeNotSupportedException e) {
AbstractUtility.error(getClass(), e);
- }
+ }
+ }
+ else if(input instanceof FieldUnit){
+ input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input,PreferencesUtil.getDerivedUnitConfigurator());
}
- super.setInput(input);
- }
+ super.setInput(input);
+ }
- @Override
- protected void markViewPartDirty() {
- if (getInput() instanceof DerivedUnitFacade) {
- getViewPart().changed(((DerivedUnitFacade) getInput()).innerDerivedUnit());
- }
+ @Override
+ protected void markViewPartDirty() {
+ if (getInput() instanceof DerivedUnitFacade) {
+ DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade) getInput();
+ DerivedUnit innerDerivedUnit = derivedUnitFacade.innerDerivedUnit();
+ FieldUnit innerFieldUnit = derivedUnitFacade.innerFieldUnit();
+ if(innerDerivedUnit!=null){
+ getViewPart().changed(innerDerivedUnit);
+ }
+ else if(innerFieldUnit!=null){
+ getViewPart().changed(innerFieldUnit);
+ }
+ }
+
+ super.markViewPartDirty();
+ }
+
+ // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
- super.markViewPartDirty();
- }
-
- // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.Viewer#refresh()
- */
- /** {@inheritDoc} */
- @Override
- protected void showParts() {
- // FIXME (CM) : Need to clean out this code.
- // 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.
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.Viewer#refresh()
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected void showParts() {
+ // FIXME (CM) : Need to clean out this code.
+ // 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.
Object input = getInput();
if (input instanceof TaxonBase) {
- createTaxonSections(rootElement);
+ createTaxonSections(rootElement);
} else if (input instanceof NonViralName) {
- createNameSections(rootElement);
+ createNameSections(rootElement);
} else if (input instanceof Reference) {
- createReferenceSections(rootElement);
+ createReferenceSections(rootElement);
} else if (input instanceof Team) {
- createTeamDetailSection(rootElement);
+ createTeamDetailSection(rootElement);
} else if (input instanceof Person) {
- createPersonDetailSection(rootElement);
+ createPersonDetailSection(rootElement);
} else if (input instanceof TeamOrPersonBase) {
- createTeamOrPersonBaseDetailSection(rootElement);
+ createTeamOrPersonBaseDetailSection(rootElement);
} else if (input instanceof DescriptionBase) {
Set<Marker> 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;
- }
- }
+ Boolean isUseDescription = false;
+ for (Marker marker : descriptionMarkers) {
+ if (marker.getMarkerType().equals(useMarkertype)) {
+ isUseDescription = true;
+ }
+ }
if (((DescriptionBase) input).isImageGallery()) {
- createImageGallerySection(rootElement);
+ createImageGallerySection(rootElement);
- } else if (isUseDescription) {
- createUseDescriptionSection(rootElement);
- } else {
- createDescriptionSection(rootElement);
+ } else if (isUseDescription) {
+ createUseDescriptionSection(rootElement);
+ } else {
+ createDescriptionSection(rootElement);
- }
+ }
} else if (input instanceof DescriptionElementBase) {
Set<Marker> 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)) {
- isUseDescription = true;
- }
- }
-
+ Boolean isUseDescription = false;
+ for (Marker marker : descriptionMarkers) {
+ if (marker.getMarkerType().equals(useMarkertype)) {
+ isUseDescription = true;
+ }
+ }
+
if (isUseDescription == true && input instanceof CategoricalData) {
- createUseRecordSection(rootElement);
+ createUseRecordSection(rootElement);
} else {
- createDescriptionElementSection(rootElement);
- }
+ createDescriptionElementSection(rootElement);
+ }
} else if (input instanceof Media) {
- createMediaElementSection(rootElement);
+ createMediaElementSection(rootElement);
} else if (input instanceof DerivedUnitFacade) {
- createDerivedUnitBaseElementSection(rootElement);
+ DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade)input;
+ if(derivedUnitFacade.getType()==SpecimenOrObservationType.FieldUnit){
+ createFieldObservationDetailsView(rootElement);
+ } else{
+ createSpecimenDetailsView(rootElement);
+ }
} else if (input instanceof FeatureNodeContainer) {
- createFeatureDistributionSection(rootElement);
+ createFeatureDistributionSection(rootElement);
} else if (input instanceof PolytomousKey) {
- //createPolytomousKeySection(rootElement);
+ // createPolytomousKeySection(rootElement);
} else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
- createPolytomousKeyNodeSection(rootElement);
+ createPolytomousKeyNodeSection(rootElement);
} else if (input instanceof User) {
- createUserSection(rootElement);
+ createUserSection(rootElement);
} else if (input instanceof Group) {
- createGroupSection(rootElement);
+ createGroupSection(rootElement);
} else if (input instanceof TaxonRelationship) {
- createTaxonRelationshipSection(rootElement);
+ createTaxonRelationshipSection(rootElement);
} else if (input instanceof TermVocabulary) {
- createTermVocabularySection(rootElement);
+ createTermVocabularySection(rootElement);
} else if (input instanceof DefinedTermBase) {
- createDefinedTermSection(rootElement);
- } else {
- destroySections();
- }
- layout();
- }
+ createDefinedTermSection(rootElement);
+ } else {
+ destroySections();
+ }
+ layout();
+ }
-
- /**
- * @param rootElement
- */
- private void createGroupSection(RootElement parent) {
- destroySections();
+ /**
+ * @param rootElement
+ */
+ private void createGroupSection(RootElement parent) {
+ destroySections();
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);
- addPart(grantedAuthorityDetailSection);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.Viewer#getSelection()
- */
- /** {@inheritDoc} */
- @Override
- public ISelection getSelection() {
- return selection;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
- * .ISelection, boolean)
- */
- /** {@inheritDoc} */
- @Override
- public void setSelection(ISelection selection, boolean reveal) {
- this.selection = selection;
+ addPart(groupDetailSection);
+ addPart(memberDetailSection);
+ addPart(grantedAuthorityDetailSection);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.Viewer#getSelection()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
+ * .ISelection, boolean)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setSelection(ISelection selection, boolean reveal) {
+ this.selection = selection;
SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
- fireSelectionChanged(selectionChangedEvent);
- }
+ fireSelectionChanged(selectionChangedEvent);
+ }
- /**
- * createTaxonSections(RootElement parent)
+ /**
+ * createTaxonSections(RootElement parent)
*
- * @param parent
- */
- private void createTaxonSections(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createTaxonSections(RootElement parent) {
+ destroySections();
TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
| ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
- addPart(taxonBaseDetailSection);
- addPart(nonViralNameSection);
- addPart(nomenclaturalStatusSection);
- addPart(protologSection);
- addPart(referenceDetailSection);
- addPart(typeDesignationSection);
- addPart(nameRelationshipSection);
- addPart(parsingMessagesSection);
- }
-
- /**
- * createNameSections
+ addPart(taxonBaseDetailSection);
+ addPart(nonViralNameSection);
+ addPart(nomenclaturalStatusSection);
+ addPart(protologSection);
+ addPart(referenceDetailSection);
+ addPart(typeDesignationSection);
+ addPart(nameRelationshipSection);
+ addPart(parsingMessagesSection);
+ }
+
+ /**
+ * createNameSections
*
- * @param parent
- */
- private void createNameSections(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createNameSections(RootElement parent) {
+ destroySections();
NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(nonViralNameSection);
- addPart(nomenclaturalStatusSection);
- addPart(protologSection);
- addPart(referenceDetailSection);
- addPart(typeDesignationSection);
- addPart(nameRelationshipSection);
- }
+ addPart(nonViralNameSection);
+ addPart(nomenclaturalStatusSection);
+ addPart(protologSection);
+ addPart(referenceDetailSection);
+ addPart(typeDesignationSection);
+ addPart(nameRelationshipSection);
+ }
- /**
- * createReferenceSections
+ /**
+ * createReferenceSections
*
- * @param parent
- */
- private void createReferenceSections(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createReferenceSections(RootElement parent) {
+ destroySections();
ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(referenceDetailSection);
- }
+ addPart(referenceDetailSection);
+ }
- /**
- * createTeamOrPersonBaseDetailSection
+ /**
+ * createTeamOrPersonBaseDetailSection
*
- * @param parent
- */
- private void createTeamOrPersonBaseDetailSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createTeamOrPersonBaseDetailSection(RootElement parent) {
+ destroySections();
TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(teamOrPersonBaseDetailSection);
- }
+ addPart(teamOrPersonBaseDetailSection);
+ }
- /**
- * createTeamDetailSection
+ /**
+ * createTeamDetailSection
*
- * @param parent
- */
- private void createTeamDetailSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createTeamDetailSection(RootElement parent) {
+ destroySections();
TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(teamDetailSection);
- }
-
- /**
- * createPersonDetailSection
+ addPart(teamDetailSection);
+ }
+
+ /**
+ * createPersonDetailSection
*
- * @param parent
- */
- private void createPersonDetailSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createPersonDetailSection(RootElement parent) {
+ destroySections();
PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(personDetailSection);
- }
+ addPart(personDetailSection);
+ }
- /**
- * createDescriptionElementSection
+ /**
+ * createDescriptionElementSection
*
- * @param parent
- */
- private void createDescriptionElementSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createDescriptionElementSection(RootElement parent) {
+ destroySections();
DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(descriptionElementDetailSection);
- addPart(descriptionElementSourceSection);
- addPart(descriptionElementMediaSection);
- }
+ addPart(descriptionElementDetailSection);
+ addPart(descriptionElementSourceSection);
+ addPart(descriptionElementMediaSection);
+ }
- /**
- * createDescriptionSection
+ /**
+ * createDescriptionSection
*
- * @param parent
- */
- private void createDescriptionSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createDescriptionSection(RootElement parent) {
+ destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-// DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
-// .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
-// getConversationHolder(), parent, Section.TWISTIE);
+// DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
//
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- addPart(descriptionDetailSection);
- addPart(naturalLanguageSection);
- addPart(describedSpecimenSection);
-// addPart(descriptionSourceSection);
- addPart(scopeSection);
- }
-
- /**
- * Creates the use Description section
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ addPart(descriptionDetailSection);
+ addPart(naturalLanguageSection);
+ addPart(describedSpecimenSection);
+// addPart(descriptionSourceSection);
+ addPart(scopeSection);
+ }
+
+ /**
+ * Creates the use Description section
*
- * @param parent
- */
- private void createUseDescriptionSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createUseDescriptionSection(RootElement parent) {
+ destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(descriptionDetailSection);
- addPart(descriptionSourceSection);
-
- }
+ addPart(descriptionDetailSection);
+ addPart(descriptionSourceSection);
+ }
- /**
- * @param rootElement
- */
- private void createImageGallerySection(RootElement parent) {
- destroySections();
+ /**
+ * @param rootElement
+ */
+ private void createImageGallerySection(RootElement parent) {
+ destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(descriptionDetailSection);
- }
-
- /**
- * createMediaElementSection
+ addPart(descriptionDetailSection);
+ }
+
+ /**
+ * createMediaElementSection
*
- * @param parent
- */
+ * @param parent
+ */
- private void createMediaElementSection(RootElement parent) {
- destroySections();
+ private void createMediaElementSection(RootElement parent) {
+ destroySections();
MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(mediaDetailSection);
- }
+ addPart(mediaDetailSection);
+ }
- /**
- * createDerivedUnitBaseElementSection
+ /**
+ * createDerivedUnitBaseElementSection
*
- * @param parent
- */
- private void createDerivedUnitBaseElementSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createFieldObservationDetailsView(RootElement parent) {
+ destroySections();
- GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ FieldObservationGeneralSection fieldObservationSection = formFactory.createFieldObservationGeneralSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ GatheringEventSection gatheringEventDetailSection = formFactory.createGatheringEventSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFieldObservationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ FieldObservationDetailsSection fieldObservationDetailSection = formFactory.createFieldObservationDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+// DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+//
+// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+//
+// DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(fieldObservationSection);
+ addPart(gatheringEventDetailSection);
+ addPart(fieldObservationDetailSection);
+// addPart(derivedUnitBaseDetailSection);
+// addPart(determinationDetailSection);
+ }
- DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ /**
+ * createDerivedUnitBaseElementSection
+ *
+ * @param parent
+ */
+ private void createSpecimenDetailsView(RootElement parent) {
+ destroySections();
- addPart(generalDetailSection);
- addPart(gatheringEventDetailSection);
- addPart(fieldObservationDetailSection);
- addPart(derivedUnitBaseDetailSection);
- addPart(determinationDetailSection);
+ SpecimenGeneralSection specimenSection = formFactory.createSpecimenSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- }
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ SpecimenDetailsSection specimenDetailsSection = formFactory.createSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ DerivedUnitDetailsSection derivedUnitDetailsSection = formFactory.createDerivedUnitDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+ addPart(specimenSection);
+ addPart(specimenDetailsSection);
+ addPart(derivedUnitDetailsSection);
+ }
- /**
- * @param rootElement
- */
- private void createFeatureDistributionSection(RootElement parent) {
- destroySections();
+ /**
+ * @param rootElement
+ */
+ private void createFeatureDistributionSection(RootElement parent) {
+ destroySections();
FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(featureDistributionSection);
- }
+ addPart(featureDistributionSection);
+ }
- /**
- * createPolytomousKeyNodeSection
+ /**
+ * createPolytomousKeyNodeSection
*
- * @param parent
- */
- private void createPolytomousKeyNodeSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createPolytomousKeyNodeSection(RootElement parent) {
+ destroySections();
PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
-
+
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
+
PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
- addPart(polytomousKeyDetailSection);
- addPart(polytomousKeyNodeDetailSection);
- addPart(taxonomicScopeSection);
+ addPart(polytomousKeyDetailSection);
+ addPart(polytomousKeyNodeDetailSection);
+ addPart(taxonomicScopeSection);
+
+ }
- }
-
- /**
- * create the UseRecordSection
+ /**
+ * create the UseRecordSection
*
- * @param parent
- */
- private void createUseRecordSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createUseRecordSection(RootElement parent) {
+ destroySections();
UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- addPart(descriptionUseRecordSection);
-
-
- }
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ addPart(descriptionUseRecordSection);
+
+ }
- /**
- * createUserSection
+ /**
+ * createUserSection
*
- * @param parent
- */
- private void createUserSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createUserSection(RootElement parent) {
+ destroySections();
UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(userDetailSection);
- addPart(groupByUserDetailSection);
- }
+ addPart(userDetailSection);
+ addPart(groupByUserDetailSection);
+ }
- /**
- * createTaxonRelationshipSection
+ /**
+ * createTaxonRelationshipSection
*
- * @param parent
- */
- private void createTaxonRelationshipSection(RootElement parent) {
- destroySections();
+ * @param parent
+ */
+ private void createTaxonRelationshipSection(RootElement parent) {
+ destroySections();
TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(taxonRelationshipDetailSection);
- addPart(referencedEntityBaseDetailSection);
- }
+ addPart(taxonRelationshipDetailSection);
+ addPart(referencedEntityBaseDetailSection);
+ }
- /**
- * @param rootElement
- */
- private void createTermVocabularySection(RootElement parent) {
- destroySections();
+ /**
+ * @param rootElement
+ */
+ private void createTermVocabularySection(RootElement parent) {
+ destroySections();
TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(termVocabularyDetailSection);
- }
+ addPart(termVocabularyDetailSection);
+ }
- /**
- * createDefinedTermSection
+ /**
+ * createDefinedTermSection
*
- * @param parent
- */
- private void createDefinedTermSection(RootElement parent) {
- destroySections();
-
- AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(definedTermDetailSection);
- }
-
- private void createFODetailsView(RootElement parent) {
+ * @param parent
+ */
+ private void createDefinedTermSection(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);
+ AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(definedTermDetailSection);
}
}
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2011 Google, Inc.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Google, Inc. - initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.wb.swt;
+
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.osgi.framework.Bundle;
+
+/**
+ * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
+ * etc.
+ *
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ *
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ *
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class ResourceManager extends SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>();
+ /**
+ * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified
+ * class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image descriptor.
+ * @param path
+ * the path to the image file.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ */
+ public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) {
+ return ImageDescriptor.createFromFile(clazz, path);
+ }
+ /**
+ * Returns an {@link ImageDescriptor} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ try {
+ return ImageDescriptor.createFromURL(new File(path).toURI().toURL());
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+ /**
+ * Returns an {@link Image} based on the specified {@link ImageDescriptor}.
+ *
+ * @param descriptor
+ * the {@link ImageDescriptor} for the {@link Image}.
+ * @return the {@link Image} based on the specified {@link ImageDescriptor}.
+ */
+ public static Image getImage(ImageDescriptor descriptor) {
+ if (descriptor == null) {
+ return null;
+ }
+ Image image = m_descriptorImageMap.get(descriptor);
+ if (image == null) {
+ image = descriptor.createImage();
+ m_descriptorImageMap.put(descriptor, image);
+ }
+ return image;
+ }
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated.
+ * @param decorator
+ * the {@link Image} to decorate the base image.
+ * @return {@link Image} The resulting decorated image.
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated.
+ * @param decorator
+ * the {@link Image} to decorate the base image.
+ * @param corner
+ * the corner to place decorator image.
+ * @return the resulting decorated {@link Image}.
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ final Rectangle bib = baseImage.getBounds();
+ final Rectangle dib = decorator.getBounds();
+ final Point baseImageSize = new Point(bib.width, bib.height);
+ CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(baseImage.getImageData(), 0, 0);
+ if (corner == TOP_LEFT) {
+ drawImage(decorator.getImageData(), 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ drawImage(decorator.getImageData(), bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ drawImage(decorator.getImageData(), 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height);
+ }
+ }
+ @Override
+ protected Point getSize() {
+ return baseImageSize;
+ }
+ };
+ //
+ result = compositImageDesc.createImage();
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached images.
+ */
+ public static void disposeImages() {
+ SWTResourceManager.disposeImages();
+ // dispose ImageDescriptor images
+ {
+ for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) {
+ I.next().dispose();
+ }
+ m_descriptorImageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ // dispose plugin images
+ {
+ for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) {
+ I.next().dispose();
+ }
+ m_URLImageMap.clear();
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Plugin images support
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps URL to images.
+ */
+ private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>();
+ /**
+ * Provider for plugin resources, used by WindowBuilder at design time.
+ */
+ public interface PluginResourceProvider {
+ URL getEntry(String symbolicName, String path);
+ }
+ /**
+ * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time.
+ */
+ private static PluginResourceProvider m_designTimePluginResourceProvider = null;
+ /**
+ * Returns an {@link Image} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the image
+ * @param name
+ * the path to the image within the plugin
+ * @return the {@link Image} stored in the file at the specified path
+ *
+ * @deprecated Use {@link #getPluginImage(String, String)} instead.
+ */
+ @Deprecated
+ public static Image getPluginImage(Object plugin, String name) {
+ try {
+ URL url = getPluginImageURL(plugin, name);
+ if (url != null) {
+ return getPluginImageFromUrl(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link Image} based on a {@link Bundle} and resource entry path.
+ *
+ * @param symbolicName
+ * the symbolic name of the {@link Bundle}.
+ * @param path
+ * the path of the resource entry.
+ * @return the {@link Image} stored in the file at the specified path.
+ */
+ public static Image getPluginImage(String symbolicName, String path) {
+ try {
+ URL url = getPluginImageURL(symbolicName, path);
+ if (url != null) {
+ return getPluginImageFromUrl(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link Image} based on given {@link URL}.
+ */
+ private static Image getPluginImageFromUrl(URL url) {
+ try {
+ try {
+ String key = url.toExternalForm();
+ Image image = m_URLImageMap.get(key);
+ if (image == null) {
+ InputStream stream = url.openStream();
+ try {
+ image = getImage(stream);
+ m_URLImageMap.put(key, image);
+ } finally {
+ stream.close();
+ }
+ }
+ return image;
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link ImageDescriptor} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the image.
+ * @param name
+ * the path to th eimage within the plugin.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ *
+ * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead.
+ */
+ @Deprecated
+ public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) {
+ try {
+ try {
+ URL url = getPluginImageURL(plugin, name);
+ return ImageDescriptor.createFromURL(url);
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
+ *
+ * @param symbolicName
+ * the symbolic name of the {@link Bundle}.
+ * @param path
+ * the path of the resource entry.
+ * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
+ */
+ public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) {
+ try {
+ URL url = getPluginImageURL(symbolicName, path);
+ if (url != null) {
+ return ImageDescriptor.createFromURL(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link URL} based on a {@link Bundle} and resource entry path.
+ */
+ private static URL getPluginImageURL(String symbolicName, String path) {
+ // try runtime plugins
+ {
+ Bundle bundle = Platform.getBundle(symbolicName);
+ if (bundle != null) {
+ return bundle.getEntry(path);
+ }
+ }
+ // try design time provider
+ if (m_designTimePluginResourceProvider != null) {
+ return m_designTimePluginResourceProvider.getEntry(symbolicName, path);
+ }
+ // no such resource
+ return null;
+ }
+ /**
+ * Returns an {@link URL} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the file path.
+ * @param name
+ * the file path.
+ * @return the {@link URL} representing the file at the specified path.
+ * @throws Exception
+ */
+ private static URL getPluginImageURL(Object plugin, String name) throws Exception {
+ // try to work with 'plugin' as with OSGI BundleContext
+ try {
+ Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$
+ Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$
+ if (BundleContextClass.isAssignableFrom(plugin.getClass())) {
+ Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$
+ Object bundle = getBundleMethod.invoke(plugin, new Object[0]);
+ //
+ Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
+ Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class});
+ Object path = pathConstructor.newInstance(new Object[]{name});
+ //
+ Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
+ Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$
+ Method findMethod = PlatformClass.getMethod("find", new Class[]{BundleClass, IPathClass}); //$NON-NLS-1$
+ return (URL) findMethod.invoke(null, new Object[]{bundle, path});
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ // else work with 'plugin' as with usual Eclipse plugin
+ {
+ Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$
+ if (PluginClass.isAssignableFrom(plugin.getClass())) {
+ //
+ Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
+ Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class});
+ Object path = pathConstructor.newInstance(new Object[]{name});
+ //
+ Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
+ Method findMethod = PluginClass.getMethod("find", new Class[]{IPathClass}); //$NON-NLS-1$
+ return (URL) findMethod.invoke(plugin, new Object[]{path});
+ }
+ }
+ return null;
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeFonts();
+ disposeImages();
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2011 Google, Inc.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Google, Inc. - initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.wb.swt;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
+ * <p>
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ * <p>
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Color
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>();
+ /**
+ * Returns the system {@link Color} matching the specific ID.
+ *
+ * @param systemColorID
+ * the ID value for the color
+ * @return the system {@link Color} matching the specific ID
+ */
+ public static Color getColor(int systemColorID) {
+ Display display = Display.getCurrent();
+ return display.getSystemColor(systemColorID);
+ }
+ /**
+ * Returns a {@link Color} given its red, green and blue component values.
+ *
+ * @param r
+ * the red component of the color
+ * @param g
+ * the green component of the color
+ * @param b
+ * the blue component of the color
+ * @return the {@link Color} matching the given red, green and blue component values
+ */
+ public static Color getColor(int r, int g, int b) {
+ return getColor(new RGB(r, g, b));
+ }
+ /**
+ * Returns a {@link Color} given its RGB value.
+ *
+ * @param rgb
+ * the {@link RGB} value of the color
+ * @return the {@link Color} matching the RGB value
+ */
+ public static Color getColor(RGB rgb) {
+ Color color = m_colorMap.get(rgb);
+ if (color == null) {
+ Display display = Display.getCurrent();
+ color = new Color(display, rgb);
+ m_colorMap.put(rgb, color);
+ }
+ return color;
+ }
+ /**
+ * Dispose of all the cached {@link Color}'s.
+ */
+ public static void disposeColors() {
+ for (Color color : m_colorMap.values()) {
+ color.dispose();
+ }
+ m_colorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps image paths to images.
+ */
+ private static Map<String, Image> m_imageMap = new HashMap<String, Image>();
+ /**
+ * Returns an {@link Image} encoded by the specified {@link InputStream}.
+ *
+ * @param stream
+ * the {@link InputStream} encoding the image data
+ * @return the {@link Image} encoded by the specified input stream
+ */
+ protected static Image getImage(InputStream stream) throws IOException {
+ try {
+ Display display = Display.getCurrent();
+ ImageData data = new ImageData(stream);
+ if (data.transparentPixel > 0) {
+ return new Image(display, data, data.getTransparencyMask());
+ }
+ return new Image(display, data);
+ } finally {
+ stream.close();
+ }
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(String path) {
+ Image image = m_imageMap.get(path);
+ if (image == null) {
+ try {
+ image = getImage(new FileInputStream(path));
+ m_imageMap.put(path, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(path, image);
+ }
+ }
+ return image;
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path relative to the specified class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image
+ * @param path
+ * the path to the image file, if starts with <code>'/'</code>
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(Class<?> clazz, String path) {
+ String key = clazz.getName() + '|' + path;
+ Image image = m_imageMap.get(key);
+ if (image == null) {
+ try {
+ image = getImage(clazz.getResourceAsStream(path));
+ m_imageMap.put(key, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(key, image);
+ }
+ }
+ return image;
+ }
+ private static final int MISSING_IMAGE_SIZE = 10;
+ /**
+ * @return the small {@link Image} that can be used as placeholder for missing image.
+ */
+ private static Image getMissingImage() {
+ Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ //
+ GC gc = new GC(image);
+ gc.setBackground(getColor(SWT.COLOR_RED));
+ gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ gc.dispose();
+ //
+ return image;
+ }
+ /**
+ * Style constant for placing decorator image in top left corner of base image.
+ */
+ public static final int TOP_LEFT = 1;
+ /**
+ * Style constant for placing decorator image in top right corner of base image.
+ */
+ public static final int TOP_RIGHT = 2;
+ /**
+ * Style constant for placing decorator image in bottom left corner of base image.
+ */
+ public static final int BOTTOM_LEFT = 3;
+ /**
+ * Style constant for placing decorator image in bottom right corner of base image.
+ */
+ public static final int BOTTOM_RIGHT = 4;
+ /**
+ * Internal value.
+ */
+ protected static final int LAST_CORNER_KEY = 5;
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @return {@link Image} The resulting decorated image
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @param corner
+ * the corner to place decorator image
+ * @return the resulting decorated {@link Image}
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ Rectangle bib = baseImage.getBounds();
+ Rectangle dib = decorator.getBounds();
+ //
+ result = new Image(Display.getCurrent(), bib.width, bib.height);
+ //
+ GC gc = new GC(result);
+ gc.drawImage(baseImage, 0, 0);
+ if (corner == TOP_LEFT) {
+ gc.drawImage(decorator, 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ gc.drawImage(decorator, 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height);
+ }
+ gc.dispose();
+ //
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached {@link Image}'s.
+ */
+ public static void disposeImages() {
+ // dispose loaded images
+ {
+ for (Image image : m_imageMap.values()) {
+ image.dispose();
+ }
+ m_imageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Font
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps font names to fonts.
+ */
+ private static Map<String, Font> m_fontMap = new HashMap<String, Font>();
+ /**
+ * Maps fonts to their bold versions.
+ */
+ private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>();
+ /**
+ * Returns a {@link Font} based on its name, height and style.
+ *
+ * @param name
+ * the name of the font
+ * @param height
+ * the height of the font
+ * @param style
+ * the style of the font
+ * @return {@link Font} The font matching the name, height and style
+ */
+ public static Font getFont(String name, int height, int style) {
+ return getFont(name, height, style, false, false);
+ }
+ /**
+ * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline
+ * flags are also supported.
+ *
+ * @param name
+ * the name of the font
+ * @param size
+ * the size of the font
+ * @param style
+ * the style of the font
+ * @param strikeout
+ * the strikeout flag (warning: Windows only)
+ * @param underline
+ * the underline flag (warning: Windows only)
+ * @return {@link Font} The font matching the name, height, style, strikeout and underline
+ */
+ public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
+ String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
+ Font font = m_fontMap.get(fontName);
+ if (font == null) {
+ FontData fontData = new FontData(name, size, style);
+ if (strikeout || underline) {
+ try {
+ Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
+ Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
+ if (logFont != null && logFontClass != null) {
+ if (strikeout) {
+ logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ if (underline) {
+ logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ }
+ } catch (Throwable e) {
+ System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ font = new Font(Display.getCurrent(), fontData);
+ m_fontMap.put(fontName, font);
+ }
+ return font;
+ }
+ /**
+ * Returns a bold version of the given {@link Font}.
+ *
+ * @param baseFont
+ * the {@link Font} for which a bold version is desired
+ * @return the bold version of the given {@link Font}
+ */
+ public static Font getBoldFont(Font baseFont) {
+ Font font = m_fontToBoldFontMap.get(baseFont);
+ if (font == null) {
+ FontData fontDatas[] = baseFont.getFontData();
+ FontData data = fontDatas[0];
+ font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
+ m_fontToBoldFontMap.put(baseFont, font);
+ }
+ return font;
+ }
+ /**
+ * Dispose all of the cached {@link Font}'s.
+ */
+ public static void disposeFonts() {
+ // clear fonts
+ for (Font font : m_fontMap.values()) {
+ font.dispose();
+ }
+ m_fontMap.clear();
+ // clear bold fonts
+ for (Font font : m_fontToBoldFontMap.values()) {
+ font.dispose();
+ }
+ m_fontToBoldFontMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Cursor
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps IDs to cursors.
+ */
+ private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>();
+ /**
+ * Returns the system cursor matching the specific ID.
+ *
+ * @param id
+ * int The ID value for the cursor
+ * @return Cursor The system cursor matching the specific ID
+ */
+ public static Cursor getCursor(int id) {
+ Integer key = Integer.valueOf(id);
+ Cursor cursor = m_idToCursorMap.get(key);
+ if (cursor == null) {
+ cursor = new Cursor(Display.getDefault(), id);
+ m_idToCursorMap.put(key, cursor);
+ }
+ return cursor;
+ }
+ /**
+ * Dispose all of the cached cursors.
+ */
+ public static void disposeCursors() {
+ for (Cursor cursor : m_idToCursorMap.values()) {
+ cursor.dispose();
+ }
+ m_idToCursorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeImages();
+ disposeFonts();
+ disposeCursors();
+ }
+}
\ No newline at end of file