eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/WarningAnnotation.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/DescriptionElementComposite.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/DescriptionLabelComposite.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/ElementWithDescription.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/FeatureGroupComposite.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/IterableDescriptionList.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/TaxonDescriptionComposite.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/description/TaxonDescriptionEditorView.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/name/IterableSynonymyList.java -text
import org.eclipse.core.runtime.IPath;\r
import org.eclipse.core.runtime.Path;\r
import org.eclipse.jface.databinding.swt.SWTObservables;\r
-import org.eclipse.jface.preference.IPreferenceStore;\r
import org.eclipse.jface.resource.FontRegistry;\r
import org.eclipse.jface.resource.ImageDescriptor;\r
import org.eclipse.jface.resource.ImageRegistry;\r
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;\r
import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
import eu.etaxonomy.cdm.model.common.init.TermNotFoundException;\r
-import eu.etaxonomy.cdm.model.description.Feature;\r
import eu.etaxonomy.cdm.model.name.BotanicalName;\r
import eu.etaxonomy.cdm.model.name.NameRelationshipType;\r
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;\r
import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.taxeditor.model.CdmUtil;\r
-import eu.etaxonomy.taxeditor.navigation.TaxonomicTreeView;\r
import eu.etaxonomy.taxeditor.navigation.TaxonomicTreeViewer;\r
\r
/**\r
\r
if (initDatastore) {\r
dbSchemaValidation = DbSchemaValidation.CREATE;\r
-// initDatastore();\r
+ initDatastore();\r
}\r
\r
cdmApp = getCdmApp();\r
+++ /dev/null
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\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
-\r
-package eu.etaxonomy.taxeditor.editor.description;\r
-\r
-import org.apache.log4j.Logger;\r
-\r
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
-import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 08.09.2008\r
- * @version 1.0\r
- * \r
- * Contains DescriptionElementBase and the Description to which the element\r
- * belongs. Used as a helper class in the IterableDescriptionList, to tell when\r
- * the iterator is returning elements from a different description. \r
- */\r
-public class ElementWithDescription {\r
- private static final Logger logger = Logger\r
- .getLogger(ElementWithDescription.class);\r
- \r
- DescriptionElementBase element;\r
- TaxonDescription description;\r
- \r
- public DescriptionElementBase getElement() {\r
- return element;\r
- }\r
- public void setElement(DescriptionElementBase element) {\r
- this.element = element;\r
- }\r
- public TaxonDescription getDescription() {\r
- return description;\r
- }\r
- public void setDescription(TaxonDescription description) {\r
- this.description = description;\r
- }\r
- \r
- \r
-}\r
+++ /dev/null
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\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
-\r
-package eu.etaxonomy.taxeditor.editor.description;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-\r
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
-import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-\r
-/**\r
- * Retrieves a taxon's descriptive elements, grouped by TaxonDescription, then\r
- * returns them using an iterator and a sort order optionally passed in.\r
- * \r
- * @author p.ciardelli\r
- * @created 09.05.2008\r
- * @version 1.0\r
- */\r
-public class IterableDescriptionList implements Iterable<ElementWithDescription> {\r
- private static final Logger logger = Logger\r
- .getLogger(IterableDescriptionList.class);\r
- \r
- private Taxon taxon;\r
-\r
- public IterableDescriptionList(Taxon taxon) {\r
- this.taxon = taxon;\r
- }\r
-\r
- @Override\r
- public Iterator<ElementWithDescription> iterator() {\r
- return new DescriptionElementIterator(taxon);\r
- }\r
- \r
- class DescriptionElementIterator implements Iterator<ElementWithDescription> {\r
-\r
- List<ElementWithDescription> elementList;\r
- int index = 0;\r
- \r
- public DescriptionElementIterator(Taxon taxon) {\r
- elementList = new ArrayList<ElementWithDescription>();\r
- \r
- for (TaxonDescription taxonDescription : taxon.getDescriptions()) {\r
- for (DescriptionElementBase descriptionElement : taxonDescription.getElements()) {\r
- \r
- // TODO ask Andreas M. to add a descriptionElement.getTaxonDescription\r
- ElementWithDescription element = new ElementWithDescription();\r
- element.setDescription(taxonDescription);\r
- element.setElement(descriptionElement);\r
- \r
- elementList.add(element);\r
- }\r
- }\r
- }\r
-\r
- @Override\r
- public boolean hasNext() {\r
- if (elementList.size() == index) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public ElementWithDescription next() {\r
- ElementWithDescription next = elementList.get(index);\r
- index++;\r
- return next;\r
- }\r
-\r
- @Override\r
- public void remove() {}\r
- }\r
-}\r
\r
import org.apache.log4j.Logger;\r
import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.jface.text.Document;\r
-import org.eclipse.jface.text.TextViewer;\r
-import org.eclipse.jface.text.source.SourceViewer;\r
-import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.Composite;\r
\r
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
import eu.etaxonomy.cdm.model.description.Feature;\r
import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.taxeditor.ITaxEditorConstants;\r
-import eu.etaxonomy.taxeditor.TaxEditorPlugin;\r
import eu.etaxonomy.taxeditor.editor.AbstractTaxonEditorView;\r
import eu.etaxonomy.taxeditor.editor.EditorGroupComposite;\r
import eu.etaxonomy.taxeditor.editor.EditorGroupedComposite;\r
\r
/**\r
+ * Displays the <code>TaxonDescription</code>s attached to a <code>Taxon</code>.\r
+ * <p>\r
+ * For each <code>TaxonDescription</code>:\r
+ * <ul>\r
+ * <li>Displays a <code>DescriptionLabelComposite</code> with <code>TaxonDescription#getTextCache()</code></li>\r
+ * <li>Displays a <code>FeatureGroupComposite</code> for each <code>Feature</code> for which there are descriptive elements</li>\r
+ * <li>Displays a <code>DescriptionElementComposite</code> for each <code>TaxonDescription#getElements()</code></li>\r
+ * </ul>\r
+ * </p> \r
+ * <p>\r
+ * If the <Taxon> has no descriptions, creates a <code>TaxonDescription</code> that is saved when \r
+ * <code>firePropertyChange()</code> is called with <code>PROP_DIRTY</code>.\r
+ * </p>\r
* @author p.ciardelli\r
* @created 25.08.2008\r
* @version 1.0\r
private static final Logger logger = Logger\r
.getLogger(TaxonDescriptionEditorView.class);\r
\r
+ /**\r
+ * If this view is opened and the <code>Taxon</code> has no <code>Description</code>,\r
+ * a <code>Description</code> element is created and saved to <code>emptyDescription</code>.\r
+ * It should not be added to the <code>Taxon</code> until it has been changed.\r
+ * \r
+ * @see firePropertyChange(int)\r
+ */\r
+ private TaxonDescription emptyDescription;\r
+ \r
+ private boolean pageInitialized = false; \r
\r
@Override\r
public void doSave(IProgressMonitor monitor) {\r
\r
// If the Taxon has no descriptions, give it an empty one to display\r
if (descriptions == null || descriptions.size() == 0) {\r
- TaxonDescription description = TaxonDescription.NewInstance(taxon);\r
+ emptyDescription = TaxonDescription.NewInstance();\r
+ TaxonDescription description = emptyDescription;\r
description.setTitleCache("");\r
descriptions.add(description); \r
}\r
}\r
}\r
}\r
- \r
- \r
- \r
-// addFeatureComposite(descriptionComposite, "Ecology");\r
-// addFeatureComposite(descriptionComposite, "Etymology"); \r
- \r
-// Make a Description group to hold all elements\r
-// IterableDescriptionList elementList = new IterableDescriptionList(taxon);\r
-// \r
-// boolean hasElements = false;\r
-// \r
-// for (ElementWithDescription descriptionElement : elementList) {\r
-// \r
-// // Display first DescriptionElement in property sheet \r
-// if (!hasElements) {\r
-// hasElements = true;\r
-// }\r
-// hasElements = true;\r
-// new DescriptionElementComposite(descriptionComposite, managedForm, DescriptionElementComposite.TEXT_DATA, descriptionElement);\r
-// }\r
-// \r
-// // If taxon has no DescriptionElements, create an empty DescriptionElementComposite\r
-// if (!hasElements) {\r
-// DescriptionElementBase newElement = TextData.NewInstance(); \r
-// new DescriptionElementComposite(descriptionComposite, managedForm, DescriptionElementComposite.TEXT_DATA, newElement);\r
-// provider.setSelection(\r
-// new StructuredSelection(\r
-// new PropertySourceAdapter(newElement).getPropertySource()\r
-// ));\r
-// }\r
-\r
- // Listen for names being dragged outside of existing homotypic groups -\r
- // user wants to create a new group\r
-// Transfer[] types = new Transfer[] {WidgetTransfer.getInstance()};\r
-// int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;\r
-// DropTarget target = new DropTarget(parent, operations);\r
-// target.setTransfer(types);\r
-// target.addDropListener(new DropTargetAdapter() {\r
-// \r
-// public void drop(DropTargetEvent event) {\r
-// \r
-// EditorGroupComposite newGroupComposite = new EditorGroupComposite(parent, managedForm, new HomotypicalGroup()); \r
-// \r
-// NameComposite nameComposite = (NameComposite) event.data;\r
-// nameComposite.setParent(newGroupComposite); \r
-// \r
-// new AdaptCompositeToGroupAction(nameComposite, newGroupComposite).run();\r
-// } \r
-// });\r
\r
// We've added elements to the managed form, so redraw it\r
scrolledForm.reflow(true);\r
- }\r
- \r
- private void addFeatureComposite (Composite composite, String featureString) {\r
\r
- // Add a group composite for a feature type\r
- Feature feature = Feature.NewInstance();\r
- EditorGroupComposite featureComposite = new FeatureGroupComposite(composite, managedForm, feature);\r
- \r
- addFeatureComposite(featureComposite);\r
- addFeatureComposite(featureComposite);\r
+ pageInitialized = true;\r
}\r
\r
- private void addFeatureComposite (Composite composite) {\r
- // Add a feature composite\r
- EditorGroupedComposite featureComposite = new EditorGroupedComposite(composite, managedForm) {\r
-\r
- @Override\r
- public void transform(String transformation) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
- };\r
- \r
- featureComposite.setIcon(TaxEditorPlugin.getDefault()\r
- .getImage(ITaxEditorConstants.BLACK_SQUARE_ICON));\r
- \r
- TextViewer featureTypeSourceViewer = new SourceViewer(featureComposite, null, SWT.NONE);\r
- featureTypeSourceViewer.setDocument(new Document(""));\r
- featureComposite.setTextViewer(featureTypeSourceViewer);\r
- featureTypeSourceViewer.getTextWidget().setText("Test me");\r
- \r
- featureComposite.setDraggable(true);\r
+ /* (non-Javadoc)\r
+ * @see org.eclipse.ui.part.WorkbenchPart#firePropertyChange(int)\r
+ */\r
+ protected void firePropertyChange(final int propertyId) {\r
+ if (pageInitialized && propertyId == PROP_DIRTY && emptyDescription != null) {\r
+ getTaxon().addDescription(emptyDescription);\r
+ emptyDescription = null;\r
+ }\r
+ super.firePropertyChange(propertyId);\r
}\r
}\r
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
\r
/**\r
- * Retrieves the elements of a taxon's synonymy list, including misapplied names,\r
- * using an iterator. Note: does not return an entry for the taxon itself.\r
+ * Retrieves the elements of a <code>Taxon</code>'s synonymy list, including misapplied names,\r
+ * using an iterator. \r
+ * <p> \r
+ * Note: does not return an entry for the <code>Taxon</code> itself.\r
+ * </p>\r
* \r
* @author p.ciardelli\r
* @created 09.05.2008\r
\r
// Property unique keys\r
public static final String P_ID_LABEL = "label";\r
+ public static final String P_ID_UUID = "uuid";\r
\r
// Property display keys\r
// Note: for an explanation of the sorting prefixes ("04:"), \r
// @see eu.etaxonomy.taxeditor.propertysheet.CustomSortPropertySheetEntry\r
- public static final String P_LABEL = "00:Description Text"; \r
+ public static final String P_LABEL = "00:Description Text";\r
+ public static final String P_UUID = "01:UUID"; \r
\r
- protected static final String[] TOP_LEVEL_PROPERTIES = new String[] {P_ID_LABEL}; \r
+ protected static final String[] TOP_LEVEL_PROPERTIES = new String[] {\r
+ P_ID_LABEL, P_ID_UUID}; \r
\r
/**\r
* Constructor for top level property fields. All fields that are not subfields\r
descriptors.addElement(\r
new TextPropertyDescriptor(P_ID_LABEL, P_LABEL));\r
}\r
+ if (id.equals(P_ID_UUID)) {\r
+ descriptors.addElement(\r
+ new TextPropertyDescriptor(P_ID_UUID, P_UUID));\r
+ }\r
}\r
\r
/* (non-Javadoc)\r
if (id.equals(P_ID_LABEL)) {\r
return taxonDescription.getTitleCache();\r
}\r
+ if (id.equals(P_ID_UUID)) {\r
+ return taxonDescription.getUuid().toString();\r
+ }\r
return null;\r
}\r
\r