From: p.ciardelli
Date: Fri, 12 Sep 2008 15:25:15 +0000 (+0000)
Subject: 1) Re-arranged packages:
X-Git-Tag: rcp.ss-first-working-version~1073
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/14ece9eac99a0fe0d7c65fcbe10b7f559b72a8fb
1) Re-arranged packages:
search, tax. tree, favorites, recent names
-> eu.etaxonomy.taxeditor.navigation
all free-text editing classes
-> eu.etaxonomy.taxeditor.editor
property sheet classes
-> eu.etaxonomy.taxeditor.propertysheet
2) eu.etaxonomy.taxeditor.editor.description - can now create a description, add elements, save, and partially display saved descriptions
---
diff --git a/.gitattributes b/.gitattributes
index b1ceeaf0b..187aad375 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -472,12 +472,6 @@ eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/Taxonomic
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/TaxonomicTreeView.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/TaxonomicTreeViewer.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/UndoView.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionElementComposite.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionLabelComposite.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/ElementWithDescription.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/IterableDescriptionList.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionComposite.java -text
-eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionEditorView.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/nameviewersupport/AnnotationMarkerAccess.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/nameviewersupport/ChangeSynonymToTaxonUiAction.java -text
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/nameviewersupport/CompositeBorderDecorator.java -text
diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionElementComposite.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionElementComposite.java
deleted file mode 100644
index ef4feaf20..000000000
--- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionElementComposite.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-
-package eu.etaxonomy.taxeditor.view.descriptionviewersupport;
-
-import org.apache.log4j.Logger;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.ITaxEditorConstants;
-import eu.etaxonomy.taxeditor.TaxEditorPlugin;
-import eu.etaxonomy.taxeditor.actions.ui.description.DeleteElementCompositeAction;
-import eu.etaxonomy.taxeditor.view.ContextMenu;
-import eu.etaxonomy.taxeditor.view.NameViewer;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.EditorGroupedComposite;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.LineBreakListener;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.LineWrapSupport;
-
-/**
- * @author p.ciardelli
- * @created 02.06.2008
- * @version 1.0
- */
-public class DescriptionElementComposite extends EditorGroupedComposite {
- private static final Logger logger = Logger.getLogger(DescriptionElementComposite.class);
-
- /**
- * ************ COMPOSITE TYPES ************
- */
- public String compositeType;
- public static final String TEXT_DATA = "text_data";
- public static final String COMMON_TAXON_NAME = "common_taxon_name";
- public static final String DISTRIBUTION = "distribution";
-// public static final String ACCEPTED_TAXON = "accepted_name_composite";
-// public static final String HOMOTYPIC_SYNONYM = "homotypic_name_composite";
-// public static final String HETEROTYPIC_SYNONYM = "heterotypic_name_composite";
-// public static final String MISAPPLIED_NAME = "misappliedname_name_composite";
-
- /**
- * ************ INDENTATIONS ************
- */
- public static final int ACCEPTED_INDENT = 0;
- public static final int SYNONYM_INDENT = 15;
- public static final int MISAPPLIEDNAME_INDENT = 15;
-
- /**
- * ************ FONTS ************
- */
- public static final Font ACCEPTED_FONT = TaxEditorPlugin.getDefault()
- .getFont(ITaxEditorConstants.ACCEPTED_TAXON_FONT);
- public static final Font SYNONYM_FONT = TaxEditorPlugin.getDefault()
- .getFont(ITaxEditorConstants.SYNONYM_FONT);
- public static final Font MISAPPLIEDNAME_FONT = TaxEditorPlugin.getDefault()
- .getFont(ITaxEditorConstants.MISAPPLIEDNAME_FONT);
-
- /**
- * ************ ICONS ************
- */
- public static final Image ACCEPTED_ICON = TaxEditorPlugin.getDefault()
- .getImage(ITaxEditorConstants.BLACK_SQUARE_ICON);
- public static final Image HOMOTYPIC_SYNONYM_ICON = TaxEditorPlugin
- .getDefault().getImage(ITaxEditorConstants.HOMOTYPIC_SYN_ICON);
- public static final Image HOMOTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON = TaxEditorPlugin
- .getDefault().getImage(
- ITaxEditorConstants.HOMOTYPIC_SYN_ORIGINAL_ICON);
- public static final Image HETEROTYPIC_SYNONYM_ICON = TaxEditorPlugin
- .getDefault().getImage(ITaxEditorConstants.HETEROTYPIC_SYN_ICON);
- public static final Image HETEROTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON = TaxEditorPlugin
- .getDefault().getImage(
- ITaxEditorConstants.HETEROTYPIC_SYN_ORIGINAL_ICON);
- public static final Image MISAPPLIEDNAME_ICON = TaxEditorPlugin
- .getDefault().getImage(ITaxEditorConstants.MISAPPLIED_NAME_ICON);
- public static final Image AUTONYM_ICON = TaxEditorPlugin.getDefault()
- .getImage(ITaxEditorConstants.AUTONYM_ICON);
- public static final Image BASIONYM_ICON = TaxEditorPlugin.getDefault()
- .getImage(ITaxEditorConstants.BASIONYM_ICON);
- public static final Image MOVE = TaxEditorPlugin.getDefault().getImage(
- ITaxEditorConstants.MOVE_ICON);
-
- /**
- * ************ TRANSFORMATIONS ************
- */
- public static final String ADD_GROUP_BASIONYM = "add_group_basionym";
- public static final String REMOVE_GROUP_BASIONYM = "remove_group_basionym";
-
- /**
- * ************ MENU ACTIONS ************
- */
- public Action CHANGE_TAXON_TO_SYNONYM_ACTION;
-
- /**
- * The constructor for a DescriptionElementComposite. Takes a parent Composite on which to
- * create itself, and an IManagedForm for Composite life cycle methods, i.e.
- * drawing borders, creating other Composites, creating line wrap support,
- * etc.
- *
- * @param parent
- * @param managedForm
- */
- public DescriptionElementComposite(Composite parent, IManagedForm managedForm, String compositeType, Object data) {
- super(parent, managedForm);
-
- createNameViewer();
- createBorderSupport();
- createLineWrapSupport();
-
- setData(data);
- transform(compositeType);
-
- setFocus();
- }
-
- private void createLineWrapSupport() {
- new LineWrapSupport(getTextViewer(), managedForm);
- }
-
- /**
- * All cosmetic - non-data-related, i.e. icons, fonts, etc. -
- * transformations take place in this method.
- *
- * @param transformation
- */
- public void transform(String transformation) {
-
- setIcon(ACCEPTED_ICON);
- createMenu();
-
- setDirty(true);
- managedForm.getForm().layout();
- }
-
- /**
- * Override of Composite.setData() which passes data along to
- * DescriptionElementComposite's TextViewer where appropriate.
- *
- * @see org.eclipse.swt.widgets.Widget#setData(java.lang.Object)
- */
- public void setData(Object data) {
- super.setData(data);
- if (data instanceof DescriptionElementBase) {
-
-// String text = ((DescriptionElementBase) data).getFeature().getLabel();
- String text = "";
- ((DescriptionElementBase) data).getFeature();
-// String text = CdmUtil.getDisplayName((TaxonBase) data);
- getTextViewer().getTextWidget().setText(text);
-
- if (getTextViewer() instanceof NameViewer) {
- ((NameViewer) getTextViewer()).setCursorToEOL();
-
-// if (((TaxonBase) data).getName() != null) {
-// boolean hasProblem = ((TaxonBase) data).getName()
-// .getHasProblem();
-// ((NameViewer) getTextViewer()).setShowError(hasProblem);
-// }
- }
- }
- }
-
- private NameViewer createNameViewer() {
- final NameViewer nameViewer = new NameViewer(this);
-
- nameViewer.setLineBreakListener(new LineBreakListener() {
-
- @Override
- public void handleSplitText(String text) {
-
- // Line breaks are allowed in DescriptionElements
-
- }
-
- });
- /*
- nameViewer.setParseListener(new ParseListener() {
-
- @Override
- public void parse(String text) {
-
- TaxonBase taxonBase = (TaxonBase) getData();
-
- NonViralName nonViralName = (NonViralName) taxonBase.getName();
- if (nonViralName != null) {
- CdmUtil.parseFullName(nonViralName, text, null, true);
- nameViewer.setShowError(nonViralName.getHasProblem());
- }
-
- setDirty(true);
- }
- });
- */
-
- nameViewer.getTextWidget().addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- setFocus();
- }
- });
-
- this.textViewer = nameViewer;
- return nameViewer;
- }
-
- private void createMenu() {
- ContextMenu contextMenu = new ContextMenu(getDraggableLabel());
-
- // Delete this description element
- Action deleteElementAction = new DeleteElementCompositeAction(
- this, getTaxon());
- contextMenu.addAction(deleteElementAction);
-
- // Add new text
- }
-
-
- public boolean setParent(Composite parent) {
-
- return super.setParent(parent);
-// if (super.setParent(parent)) {
-//
-// // Has this been moved to the misapplied names group?
-// if (parent.getData(ITaxEditorConstants.MISAPPLIED_NAME) != null) {
-// new ChangeCompositeToMisappliedNameAction(this, managedForm)
-// .run();
-// }
-//
-// // Has this been moved to a HomotypicalGroup?
-// if (parent.getData() instanceof HomotypicalGroup) {
-// new AdaptCompositeToGroupAction(this,
-// (EditorGroupComposite) parent).run();
-// }
-// return true;
-//
-// }
-// return false;
- }
-
- private Taxon getTaxon() {
- Composite parent = getParent();
- Composite grandParent = parent.getParent();
- if (grandParent != null) {
- Object parentData = grandParent.getData();
- if (parentData instanceof Taxon) {
- return (Taxon) parentData;
- }
- }
- throw new IllegalArgumentException(
- "The parent of the DescriptionElementComposite's parent does not have a Taxon in its data field as required.");
- }
-
-}
\ No newline at end of file
diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionLabelComposite.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionLabelComposite.java
deleted file mode 100644
index 8d78e0c5e..000000000
--- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/DescriptionLabelComposite.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.descriptionviewersupport;
-
-import org.apache.log4j.Logger;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-
-import eu.etaxonomy.taxeditor.ITaxEditorConstants;
-import eu.etaxonomy.taxeditor.TaxEditorPlugin;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.EditorGroupedComposite;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.NameComposite;
-
-/**
- * Composite for editing a description's label / Title Cache information
- *
- * @author p.ciardelli
- * @created 09.09.2008
- * @version 1.0
- */
-public class DescriptionLabelComposite extends EditorGroupedComposite {
- private static final Logger logger = Logger
- .getLogger(DescriptionLabelComposite.class);
-
- /**
- * ************ FONTS ************
- */
- public static final Font DESCRIPTION_LABEL_FONT = TaxEditorPlugin.getDefault()
- .getFont(ITaxEditorConstants.ACCEPTED_TAXON_FONT);
-
- /**
- * ************ ICONS ************
- */
- public static final Image DESCRIPTION_LABEL_ICON = TaxEditorPlugin.getDefault()
- .getImage(ITaxEditorConstants.BLACK_SQUARE_ICON);
-
- public DescriptionLabelComposite(Composite parent, IManagedForm managedForm, Object data) {
- super(parent, managedForm);
-
- createLabelViewer();
- createBorderSupport();
- createLineWrapSupport();
-
- setData(data);
- transform(null);
-
- setFocus();
- }
-
- @Override
- public void transform(String transformation) {
- setDraggable(false);
- setFont(DESCRIPTION_LABEL_FONT);
- setIcon(DESCRIPTION_LABEL_ICON);
- }
-
- private void createLabelViewer() {
- this.textViewer = new SourceViewer(this, null, SWT.WRAP | SWT.MULTI | SWT.RESIZE);
- this.textViewer.setDocument(new Document("Test me"));
- // Lay out StyledText
-// StyledText textWidget = this.getTextWidget();
- this.textViewer.getTextWidget().setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- }
-
-}
diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/ElementWithDescription.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/ElementWithDescription.java
deleted file mode 100644
index 391b8cb2e..000000000
--- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/ElementWithDescription.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.descriptionviewersupport;
-
-import org.apache.log4j.Logger;
-
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-
-/**
- * @author p.ciardelli
- * @created 08.09.2008
- * @version 1.0
- *
- * Contains DescriptionElementBase and the Description to which the element
- * belongs. Used as a helper class in the IterableDescriptionList, to tell when
- * the iterator is returning elements from a different description.
- */
-public class ElementWithDescription {
- private static final Logger logger = Logger
- .getLogger(ElementWithDescription.class);
-
- DescriptionElementBase element;
- TaxonDescription description;
-
- public DescriptionElementBase getElement() {
- return element;
- }
- public void setElement(DescriptionElementBase element) {
- this.element = element;
- }
- public TaxonDescription getDescription() {
- return description;
- }
- public void setDescription(TaxonDescription description) {
- this.description = description;
- }
-
-
-}
diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/IterableDescriptionList.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/IterableDescriptionList.java
deleted file mode 100644
index 99b50496a..000000000
--- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/IterableDescriptionList.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.descriptionviewersupport;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-
-/**
- * Retrieves a taxon's descriptive elements, grouped by TaxonDescription, then
- * returns them using an iterator and a sort order optionally passed in.
- *
- * @author p.ciardelli
- * @created 09.05.2008
- * @version 1.0
- */
-public class IterableDescriptionList implements Iterable {
- private static final Logger logger = Logger
- .getLogger(IterableDescriptionList.class);
-
- private Taxon taxon;
-
- public IterableDescriptionList(Taxon taxon) {
- this.taxon = taxon;
- }
-
- @Override
- public Iterator iterator() {
- return new DescriptionElementIterator(taxon);
- }
-
- class DescriptionElementIterator implements Iterator {
-
- List elementList;
- int index = 0;
-
- public DescriptionElementIterator(Taxon taxon) {
- elementList = new ArrayList();
-
- for (TaxonDescription taxonDescription : taxon.getDescriptions()) {
- for (DescriptionElementBase descriptionElement : taxonDescription.getElements()) {
-
- // TODO ask Andreas M. to add a descriptionElement.getTaxonDescription
- ElementWithDescription element = new ElementWithDescription();
- element.setDescription(taxonDescription);
- element.setElement(descriptionElement);
-
- elementList.add(element);
- }
- }
- }
-
- @Override
- public boolean hasNext() {
- if (elementList.size() == index) {
- return false;
- }
- return true;
- }
-
- @Override
- public ElementWithDescription next() {
- ElementWithDescription next = elementList.get(index);
- index++;
- return next;
- }
-
- @Override
- public void remove() {}
- }
-}
diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionComposite.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionComposite.java
deleted file mode 100644
index 0037be58e..000000000
--- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionComposite.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.descriptionviewersupport;
-
-import org.apache.log4j.Logger;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author p.ciardelli
- * @created 08.09.2008
- * @version 1.0
- */
-public class TaxonDescriptionComposite extends Composite {
- private static final Logger logger = Logger
- .getLogger(TaxonDescriptionComposite.class);
-
- TaxonDescriptionComposite(Composite parent) {
- super(parent, SWT.NONE);
-
- // TODO take all formatting info out of GroupComposite,
- // EditorGroupComposite, merge this class with one of those
-
-
- }
-
-}
\ No newline at end of file
diff --git a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionEditorView.java b/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionEditorView.java
deleted file mode 100644
index 47e48488b..000000000
--- a/eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/view/descriptionviewersupport/TaxonDescriptionEditorView.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.descriptionviewersupport;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.ITaxEditorConstants;
-import eu.etaxonomy.taxeditor.TaxEditorPlugin;
-import eu.etaxonomy.taxeditor.view.AbstractTaxonEditorView;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.EditorGroupComposite;
-import eu.etaxonomy.taxeditor.view.nameviewersupport.EditorGroupedComposite;
-
-/**
- * @author p.ciardelli
- * @created 25.08.2008
- * @version 1.0
- */
-public class TaxonDescriptionEditorView extends AbstractTaxonEditorView {
- private static final Logger logger = Logger
- .getLogger(TaxonDescriptionEditorView.class);
-
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void doSaveAs() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean isDirty() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void createPartControl(Composite composite) {
-
- super.createPartControl(composite);
-
- Taxon taxon = getTaxon();
-
- // First program dummy case for a taxon with no descirptions
- // Refactor after
-
- TaxonDescription description = TaxonDescription.NewInstance(taxon);
-
- // The property sheet should show this Description upon this EditorView
- // receiving focus
- setDefaultPropertySheetObject(description);
-
- // Create a composite for an empty description
- EditorGroupComposite descriptionComposite = new EditorGroupComposite(parent, managedForm, description);
- descriptionComposite.setDroppable(false);
-
- // Add a grouped composite for the description's label
- EditorGroupedComposite descriptionLabelComposite = new DescriptionLabelComposite(descriptionComposite,
- managedForm, description.getTitleCache());
-
- addFeatureTypeComposite(descriptionComposite, "Ecology");
- addFeatureTypeComposite(descriptionComposite, "Etymology");
-
-
-// descriptionLabelComposite
-
-
-// descriptionComposite
-
-// Make a Description group to hold all elements
-// IterableDescriptionList elementList = new IterableDescriptionList(taxon);
-//
-// boolean hasElements = false;
-//
-// for (ElementWithDescription descriptionElement : elementList) {
-//
-// // Display first DescriptionElement in property sheet
-// if (!hasElements) {
-// hasElements = true;
-// }
-// hasElements = true;
-// new DescriptionElementComposite(descriptionComposite, managedForm, DescriptionElementComposite.TEXT_DATA, descriptionElement);
-// }
-//
-// // If taxon has no DescriptionElements, create an empty DescriptionElementComposite
-// if (!hasElements) {
-// DescriptionElementBase newElement = TextData.NewInstance();
-// new DescriptionElementComposite(descriptionComposite, managedForm, DescriptionElementComposite.TEXT_DATA, newElement);
-// provider.setSelection(
-// new StructuredSelection(
-// new PropertySourceAdapter(newElement).getPropertySource()
-// ));
-// }
-
- // Listen for names being dragged outside of existing homotypic groups -
- // user wants to create a new group
-// Transfer[] types = new Transfer[] {WidgetTransfer.getInstance()};
-// int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
-// DropTarget target = new DropTarget(parent, operations);
-// target.setTransfer(types);
-// target.addDropListener(new DropTargetAdapter() {
-//
-// public void drop(DropTargetEvent event) {
-//
-// EditorGroupComposite newGroupComposite = new EditorGroupComposite(parent, managedForm, new HomotypicalGroup());
-//
-// NameComposite nameComposite = (NameComposite) event.data;
-// nameComposite.setParent(newGroupComposite);
-//
-// new AdaptCompositeToGroupAction(nameComposite, newGroupComposite).run();
-// }
-// });
-
- // We've added elements to the managed form, so redraw it
- scrolledForm.reflow(true);
- }
-
- private void addFeatureTypeComposite (Composite composite, String featureTypeString) {
-
- // Add a group composite for a feature type
- EditorGroupComposite featureTypeComposite = new EditorGroupComposite(composite, managedForm, null);
-// featureTypeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
- TableWrapLayout tlLayout = new TableWrapLayout();
- tlLayout.topMargin = 0;
- tlLayout.leftMargin = 10;
- featureTypeComposite.setLayout(tlLayout);
-// featureTypeComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
-
- // Make a composite for the feature type label
- Composite labelComposite = new Composite(featureTypeComposite, SWT.NONE);
- final TableWrapLayout tableWrapLayout = new TableWrapLayout();
- tableWrapLayout.horizontalSpacing = 1;
- tableWrapLayout.rightMargin = 10;
- tableWrapLayout.leftMargin = 10;
- tableWrapLayout.bottomMargin = 1;
- tableWrapLayout.topMargin = 1;
- tableWrapLayout.verticalSpacing = 1;
- labelComposite.setLayout(tableWrapLayout);
- labelComposite.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.MIDDLE));
-
- // Add the label
- final Label label = new Label(labelComposite, SWT.NONE);
- label.setText(featureTypeString);
-
- addFeatureComposite(featureTypeComposite);
- addFeatureComposite(featureTypeComposite);
- }
-
- private void addFeatureComposite (Composite composite) {
- // Add a feature composite
- EditorGroupedComposite featureComposite = new EditorGroupedComposite(composite, managedForm) {
-
- @Override
- public void transform(String transformation) {
- // TODO Auto-generated method stub
-
- }
- };
-
- featureComposite.setIcon(TaxEditorPlugin.getDefault()
- .getImage(ITaxEditorConstants.BLACK_SQUARE_ICON));
-
- TextViewer featureTypeSourceViewer = new SourceViewer(featureComposite, null, SWT.NONE);
- featureTypeSourceViewer.setDocument(new Document(""));
- featureComposite.setTextViewer(featureTypeSourceViewer);
- featureTypeSourceViewer.getTextWidget().setText("Test me");
-
- featureComposite.setDraggable(true);
- }
-}