- added specific methods for creating detail sections
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 6 Jun 2013 07:37:08 +0000 (07:37 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 6 Jun 2013 07:37:08 +0000 (07:37 +0000)
 - formatted code

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index 426b4c285eb075153993585890065648a064c943..cece9928bba24c05f590518a3603b11d2651c766 100644 (file)
@@ -85,8 +85,7 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
         * @param <ENTITY>
         *            a ENTITY object.
         */
-       protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement,
-                       int style) {
+    protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
                super(parentElement.getLayoutComposite(), style);
 
                this.parentElement = parentElement;
@@ -107,31 +106,29 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
                this.setClient(client);
        }
 
-       /**
-        * <p>
-        * Constructor for AbstractFormSection.
-        * </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.
-        */
-       protected AbstractFormSection(CdmFormFactory formFactory,
-                       ICdmFormElement parentElement,
-                       ISelectionProvider selectionProvider, int style) {
-               this(formFactory, parentElement, style);
-               this.selectionProvider = selectionProvider;
-       }
+           /**
+     * <p>
+     * Constructor for AbstractFormSection.
+     * </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.
+     */
+    protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+        this(formFactory, parentElement, style);
+        this.selectionProvider = selectionProvider;
+    }
 
        /**
         * <p>
@@ -214,17 +211,15 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
        /** {@inheritDoc} */
        @Override
     public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
-               Assert.isNotNull(propertyChangeListeners,
-                               "No property change listeners.");
-               try {
-                       for (Object listener : propertyChangeListeners) {
-                               ((IPropertyChangeListener) listener).propertyChange(event);
-                       }
-               } catch (ConcurrentModificationException e) {
-                       AbstractUtility.warn(getClass(),
-                                       "ConcurrentModificationException while handling PropertyChangeEvents."
-                                                       + " It seems like this is not critical");
-               }
+        Assert.isNotNull(propertyChangeListeners, "No property change listeners.");
+        try {
+            for (Object listener : propertyChangeListeners) {
+                ((IPropertyChangeListener) listener).propertyChange(event);
+            }
+        } catch (ConcurrentModificationException e) {
+            AbstractUtility.warn(getClass(), "ConcurrentModificationException while handling PropertyChangeEvents."
+                    + " It seems like this is not critical");
+        }
        }
 
        /**
@@ -314,20 +309,19 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
         *            a {@link org.eclipse.swt.events.SelectionEvent} object.
         */
        public void widgetSelected(SelectionEvent e) {
-               Widget widget = e.widget;
-
-               if (widget instanceof Control) {
-                       Control control = (Control) widget;
-                       if (checkControlAncestryForWidget(control)) {
-                               if (getEntity() != null) {
-                                       IStructuredSelection selection = new StructuredSelection(
-                                                       getEntity());
-                                       if (selectionProvider != null) {
-                                               selectionProvider.setSelection(selection);
-                                       }
-                               }
-                       }
-               }
+        Widget widget = e.widget;
+
+        if (widget instanceof Control) {
+            Control control = (Control) widget;
+            if (checkControlAncestryForWidget(control)) {
+                if (getEntity() != null) {
+                    IStructuredSelection selection = new StructuredSelection(getEntity());
+                    if (selectionProvider != null) {
+                        selectionProvider.setSelection(selection);
+                    }
+                }
+            }
+        }
        }
 
        private boolean checkControlAncestryForWidget(Control control) {
index aab69070b4fa02cba09c81910156e8787dd6165f..2bcf6b521df44e9cb322a8d783d1981329055052 100644 (file)
@@ -1396,6 +1396,27 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+    public GeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        GeneralDetailSection generalSection = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+        parentElement.addElement(generalSection);
+        adapt(generalSection);
+        return generalSection;
+    }
+
+    public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        GatheringEventDetailSection gatheringSection = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
+        parentElement.addElement(gatheringSection);
+        adapt(gatheringSection);
+        return gatheringSection;
+    }
+
+    public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        FieldObservationDetailSection foDetailsSection = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
+        parentElement.addElement(foDetailsSection);
+        adapt(foDetailsSection);
+        return foDetailsSection;
+    }
+
     /**
      * <p>
      * createCdmDetailSection
@@ -1422,7 +1443,7 @@ public class CdmFormFactory extends FormToolkit {
             ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
         AbstractFormSection section = null;
 
-        System.out.println("DetailSection: " + detailType);
+//        System.out.println("DetailSection: " + detailType);
         switch (detailType) {
         case SCIENTIFICNAME:
             section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
@@ -1748,7 +1769,7 @@ public class CdmFormFactory extends FormToolkit {
             ConversationHolder conversation, ICdmFormElement parentElement, int style) {
         AbstractFormSection section = null;
 
-        System.out.println("EntityDetailSection: " + entityDetailType);
+//        System.out.println("EntityDetailSection: " + entityDetailType);
         switch (entityDetailType) {
         case TEAM:
             // TODO this is not an AbstractEntityCollectionSection
index 33263074f1bbd20b5b06ab5c2c113dc4c065710a..878788b3150d8c646ecffa2e7c863a67ca8a81c6 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.ui.element;
 
@@ -22,201 +22,200 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * <p>
  * TextWithLabelElement class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @version $Id: $
  */
-public class TextWithLabelElement extends AbstractCdmFormElement implements
-               ModifyListener, IEnableableFormElement, ISelectable {
-
-       protected Text text;
-       private Label label;
-
-       /** Constant <code>MAX_HEIGHT=0</code> */
-       public static final int MAX_HEIGHT = 0;
-       /** Constant <code>SINGLE=-1</code> */
-       public static final int SINGLE = -1;
-
-       /**
-        * <p>
-        * Constructor for TextWithLabelElement.
-        * </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 initialText
-        *            a {@link java.lang.String} object.
-        * @param textHeight
-        *            a {@link java.lang.Integer} object.
-        * @param style
-        *            a int.
-        */
-       protected TextWithLabelElement(CdmFormFactory formFactory,
-                       ICdmFormElement parentElement, String labelString,
-                       String initialText, Integer textHeight, int style) {
-               super(formFactory, parentElement);
-
-               if (labelString != null) {
-                       label = formFactory.createLabel(getLayoutComposite(),
-                                       CdmUtils.Nz(labelString), SWT.NULL);
-                       addControl(label);
-                       label.setLayoutData(LayoutConstants.LEFT());
-               }
-
-               int scrollStyle = textHeight == null ? SWT.NULL
-                               : (SWT.V_SCROLL | SWT.MULTI);
-               
-               int combinedStyle = style | SWT.BORDER | scrollStyle;
-               
-               //SWT.PASSWORD does not work when SWT.WRAP is set. 
-               if(style != SWT.PASSWORD){
-                       combinedStyle = combinedStyle | SWT.WRAP;
-               }               
-               
-               text = formFactory.createText(getLayoutComposite(), "", combinedStyle);
-
-               addControl(text);
-
-               // text.setWO
-
-               if (textHeight == null) {
-                       text.addKeyListener(new KeyAdapter() {
-                               @Override
-                               public void keyPressed(KeyEvent e) {
-                                       if (e.character == SWT.CR) {
-                                               // Don't accept carriage returns as input when in single
-                                               // line mode
-                                               e.doit = false;
-                                       } else if (e.character == SWT.TAB) {
-                                               // traverse is not working for wrapped text widgets so
-                                               // we reintroduce it here
-                                               e.doit = false;
-                                               TextWithLabelElement.this.text
-                                                               .traverse(SWT.TRAVERSE_TAB_NEXT);
-                                       }
-                               }
-                       });
-               }
-
-               TableWrapData layoutData = LayoutConstants.FILL();
-               if (textHeight != null && textHeight > 0) {
-                       (layoutData).heightHint = textHeight;
-               }
-
-               text.setLayoutData(layoutData);
-
-               text.addModifyListener(this);
-
-               setText(initialText);
-       }
-
-       /**
-        * Get the text of this composites text composite
-        * 
-        * @return a {@link java.lang.String} object.
-        */
-       public String getText() {
-               return text.getText();
-       }
-
-       /**
-        * Set the text of this composites text composite
-        * 
-        * @param string
-        *            a {@link java.lang.String} object.
-        */
-       public void setText(String string) {
-               Listener[] listeners = text.getListeners(SWT.Modify);
-
-               for (Listener listener : listeners) {
-                       text.removeListener(SWT.Modify, listener);
-               }
-
-               text.setText(CdmUtils.Nz(string));
-
-               for (Listener listener : listeners) {
-                       text.addListener(SWT.Modify, listener);
-               }
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events
-        * .ModifyEvent)
-        */
-       /** {@inheritDoc} */
-       public void modifyText(ModifyEvent e) {
-               firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
-       }
-
-       /** {@inheritDoc} */
-       public void setEnabled(boolean enabled) {
-               text.setEnabled(enabled);
-               String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT
-                               : Resources.COLOR_TEXT_DISABLED;
-               text.setForeground(getColor(symbolicName));
-       }
-
-       /** {@inheritDoc} */
-       public void setIrrelevant(boolean irrelevant) {
-               String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT
-                               : Resources.COLOR_COMPOSITE_BACKGROUND;
-
-               Color color = getColor(colorId);
-               text.setBackground(color);
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void setBackground(Color color) {
-               if (label != null)
-                       label.setBackground(color);
-       }
-
-       @Override
-       public void setSelected(boolean selected) {
-               setBackground(selected ? SELECTED : getPersistentBackground());
-       }
-       
-       /*
-        * (non-Javadoc)
-        * 
-        * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus()
-        */
-       /** {@inheritDoc} */
-       @Override
-       public void setFocus() {
-               text.setFocus();
-       }
-
-       /**
-        * <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);
-       }
+public class TextWithLabelElement extends AbstractCdmFormElement implements ModifyListener, IEnableableFormElement,
+        ISelectable {
+
+    protected Text text;
+    private Label label;
+
+    /** Constant <code>MAX_HEIGHT=0</code> */
+    public static final int MAX_HEIGHT = 0;
+    /** Constant <code>SINGLE=-1</code> */
+    public static final int SINGLE = -1;
+
+    /**
+     * <p>
+     * Constructor for TextWithLabelElement.
+     * </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 initialText
+     *            a {@link java.lang.String} object.
+     * @param textHeight
+     *            a {@link java.lang.Integer} object.
+     * @param style
+     *            a int.
+     * @wbp.parser.entryPoint
+     */
+    protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
+            String initialText, Integer textHeight, int style) {
+        super(formFactory, parentElement);
+
+        if (labelString != null) {
+            label = formFactory.createLabel(getLayoutComposite(), CdmUtils.Nz(labelString), SWT.NULL);
+            addControl(label);
+            label.setLayoutData(LayoutConstants.LEFT());
+        }
+
+        int scrollStyle = textHeight == null ? SWT.NULL : (SWT.V_SCROLL | SWT.MULTI);
+
+        int combinedStyle = style | SWT.BORDER | scrollStyle;
+
+        // SWT.PASSWORD does not work when SWT.WRAP is set.
+        if (style != SWT.PASSWORD) {
+            combinedStyle = combinedStyle | SWT.WRAP;
+        }
+
+        text = formFactory.createText(getLayoutComposite(), "", combinedStyle);
+
+        addControl(text);
+
+        // text.setWO
+
+        if (textHeight == null) {
+            text.addKeyListener(new KeyAdapter() {
+                @Override
+                public void keyPressed(KeyEvent e) {
+                    if (e.character == SWT.CR) {
+                        // Don't accept carriage returns as input when in single
+                        // line mode
+                        e.doit = false;
+                    } else if (e.character == SWT.TAB) {
+                        // traverse is not working for wrapped text widgets so
+                        // we reintroduce it here
+                        e.doit = false;
+                        TextWithLabelElement.this.text.traverse(SWT.TRAVERSE_TAB_NEXT);
+                    }
+                }
+            });
+        }
+
+        TableWrapData layoutData = LayoutConstants.FILL();
+        if (textHeight != null && textHeight > 0) {
+            (layoutData).heightHint = textHeight;
+        }
+
+        text.setLayoutData(layoutData);
+
+        text.addModifyListener(this);
+
+        setText(initialText);
+    }
+
+    /**
+     * Get the text of this composites text composite
+     *
+     * @return a {@link java.lang.String} object.
+     */
+    public String getText() {
+        return text.getText();
+    }
+
+    /**
+     * Set the text of this composites text composite
+     *
+     * @param string
+     *            a {@link java.lang.String} object.
+     */
+    public void setText(String string) {
+        Listener[] listeners = text.getListeners(SWT.Modify);
+
+        for (Listener listener : listeners) {
+            text.removeListener(SWT.Modify, listener);
+        }
+
+        text.setText(CdmUtils.Nz(string));
+
+        for (Listener listener : listeners) {
+            text.addListener(SWT.Modify, listener);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events
+     * .ModifyEvent)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void modifyText(ModifyEvent e) {
+        firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void setEnabled(boolean enabled) {
+        text.setEnabled(enabled);
+        String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
+        text.setForeground(getColor(symbolicName));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void setIrrelevant(boolean irrelevant) {
+        String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND;
+
+        Color color = getColor(colorId);
+        text.setBackground(color);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void setBackground(Color color) {
+        if (label != null) {
+            label.setBackground(color);
+        }
+    }
+
+    @Override
+    public void setSelected(boolean selected) {
+        setBackground(selected ? SELECTED : getPersistentBackground());
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus()
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void setFocus() {
+        text.setFocus();
+    }
+
+    /**
+     * <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);
+    }
 }
index 5535d297e4a6254c624852faf101d1d0d63e0b54..bca55078a7771c5b282142a037beb5c2c2dcbb45 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -40,37 +40,37 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @version 1.0
  */
 public abstract class AbstractCdmViewPart extends ViewPart implements ISelectionListener, IPostOperationEnabled, IConversationEnabled, IDirtyMarkableSelectionProvider{
-       
+
        protected ISelectionService selectionService;
 
        public static IStructuredSelection EMPTY_SELECTION = new StructuredSelection();
-       
+
        protected IWorkbenchPart part;
-       
+
     private PageBook pageBook;
 
        private Label emptySelectionLabel;
 
        private Composite viewerComposite;
-       
+
        /** {@inheritDoc} */
        @Override
        public void createPartControl(Composite parent) {
                selectionService = getSite().getWorkbenchWindow().getSelectionService();
                selectionService.addSelectionListener(this);
-               
+
                pageBook = new PageBook(parent, SWT.NULL);
                createViewerComposite(pageBook);
                createViewer(viewerComposite);
-               
+
                // Page 2: Nothing selected
         emptySelectionLabel = new Label(pageBook, SWT.TOP + SWT.LEFT + SWT.WRAP);
-        
+
         setInitialSelection();
        }
-       
+
        /**
-        * 
+        *
         */
        private void setInitialSelection() {
                selectionChanged(StoreUtil.getActivePart(), getInitialSelection());
@@ -84,18 +84,18 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
        protected ISelection getInitialSelection() {
                return selectionService.getSelection();
        }
-       
+
        private void createViewerComposite(Composite parent) {
                viewerComposite = new SashForm(parent, SWT.HORIZONTAL);
        }
-    
+
        /**
         * <p>showEmptyPage</p>
         */
        public void showEmptyPage(){
                pageBook.showPage(emptySelectionLabel);
        }
-       
+
     /**
      * <p>showViewer</p>
      *
@@ -103,15 +103,15 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
      * @param selection a {@link org.eclipse.jface.viewers.ISelection} object.
      */
     public void showViewer(IWorkbenchPart part, IStructuredSelection selection){
-       this.part = part;               
-       
+       this.part = part;
+
                Object element = selection.getFirstElement();
-               
+
                getViewer().setInput(element);
-               
+
                showViewer();
     }
-    
+
     /**
      * <p>getViewer</p>
      *
@@ -125,53 +125,58 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
        public void showViewer(){
                pageBook.showPage(viewerComposite);
     }
-  
+
        public void setEnabled(boolean enabled){
                pageBook.setEnabled(enabled);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void setFocus() {
                if(getConversationHolder() != null){
                        getConversationHolder().bind();
-               }       
-               getViewer().getControl().setFocus();    
+               }
+               getViewer().getControl().setFocus();
        }
-       
+
        /**
         * <p>createViewer</p>
         *
         * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
         */
        public abstract void createViewer(Composite parent);
-       
+
        /** {@inheritDoc} */
-       public boolean postOperation(CdmBase objectAffectedByOperation) {
+       @Override
+    public boolean postOperation(CdmBase objectAffectedByOperation) {
                changed(objectAffectedByOperation);
                return true;
        }
-       
+
        /** {@inheritDoc} */
-       public abstract void changed(Object object);
-       
+       @Override
+    public abstract void changed(Object object);
+
        /**
         * <p>getConversationHolder</p>
         *
         * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
         */
-       public ConversationHolder getConversationHolder() {
-               if(part != null)
-                       return ((IConversationEnabled) part).getConversationHolder();
-               
+       @Override
+    public ConversationHolder getConversationHolder() {
+               if(part != null) {
+            return ((IConversationEnabled) part).getConversationHolder();
+        }
+
                return null;
        }
-       
+
        /** {@inheritDoc} */
-       public void update(CdmDataChangeMap changeEvents) {
-               
+       @Override
+    public void update(CdmDataChangeMap changeEvents) {
+
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void dispose() {
index 5d884ed617b466a02984094e37866ea877077702..cc9ea6f48951d0595e0a595f305332c902c7e9a1 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -33,7 +33,7 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
  * @version 1.0
  */
 public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartContentHasSupplementalData{
-       
+
        /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.forms.det"{trunked}</code> */
        public static String ID = "eu.etaxonomy.taxeditor.view.detail";
 
@@ -43,35 +43,36 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
        @Override
        public void createViewer(Composite parent) {
                //selectionService.addPostSelectionListener(this);
-               
+
                viewer = new DetailsViewer(parent, this);
                getSite().setSelectionProvider(viewer);
        }
 
        /** {@inheritDoc} */
-       public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+       @Override
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
                if(StoreUtil.getActiveEditor() == null){
                        showEmptyPage();
                        return;
                }
-               
+
                if(part == this){
                        return;
                }
-               
+
                if(!(selection instanceof IStructuredSelection)){
                        return;
                }
-               
+
                IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-               
+
                if((part instanceof IEditorPart) || (part instanceof AbstractCdmViewPart)) {
                        if(structuredSelection.size() != 1){
                                showEmptyPage();
                                return;
                        }
-                       
-                       // do not show details for feature nodes TODO really? 
+
+                       // do not show details for feature nodes TODO really?
                        if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
                                // do show the map for distributions
                                Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature();
@@ -80,30 +81,30 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
                                        return;
                                }
                        }
-                       
+
                        showViewer(part, structuredSelection);
                }else{
-                       showEmptyPage();                
-               }       
+                       showEmptyPage();
+               }
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public boolean postOperation(CdmBase objectAffectedByOperation) {
-               
+
                viewer.setInput(objectAffectedByOperation);
-               
+
                return super.postOperation(objectAffectedByOperation);
        }
-       
-       
+
+
        /** {@inheritDoc} */
        @Override
        public Viewer getViewer() {
                return viewer;
        }
 
-       
+
        /** {@inheritDoc} */
        @Override
        public void dispose() {
@@ -116,7 +117,8 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
         *
         * @return a boolean.
         */
-       public boolean onComplete() {
+       @Override
+    public boolean onComplete() {
                return true;
        }
 }
index 37884ef2e92428b80b7a7e91af18923293df2e0e..c292c7efc6823ca19121d5821f0303745da89616 100644 (file)
@@ -760,4 +760,22 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                         | ExpandableComposite.EXPANDED);
         addPart(definedTermDetailSection);
     }
+
+    private void createFOSection(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);
+    }
 }