From: Patric Plitzner Date: Thu, 6 Jun 2013 07:37:08 +0000 (+0000) Subject: - added specific methods for creating detail sections X-Git-Tag: 3.6.0~968^2~27 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/20326c1c9afa87eb08e5742d3cc6cb8cfb604f1d - added specific methods for creating detail sections - formatted code --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java index 426b4c285..cece9928b 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java @@ -85,8 +85,7 @@ public abstract class AbstractFormSection extends Section implements * @param * a ENTITY object. */ - protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, - int style) { + protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) { super(parentElement.getLayoutComposite(), style); this.parentElement = parentElement; @@ -107,31 +106,29 @@ public abstract class AbstractFormSection extends Section implements this.setClient(client); } - /** - *

- * Constructor for AbstractFormSection. - *

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

+ * Constructor for AbstractFormSection. + *

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

@@ -214,17 +211,15 @@ public abstract class AbstractFormSection 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 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) { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java index aab69070b..2bcf6b521 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java @@ -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; + } + /** *

* 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 diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java index 33263074f..878788b31 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java @@ -1,5 +1,5 @@ /** - * + * */ package eu.etaxonomy.taxeditor.ui.element; @@ -22,201 +22,200 @@ import eu.etaxonomy.taxeditor.preference.Resources; *

* TextWithLabelElement class. *

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

- * Constructor for TextWithLabelElement. - *

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

- * getMainControl - *

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

- * setTextLimit - *

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

+ * Constructor for TextWithLabelElement. + *

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

+ * getMainControl + *

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

+ * setTextLimit + *

+ * + * @param limit + * a int. + */ + public void setTextLimit(int limit) { + text.setTextLimit(limit); + } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java index 5535d297e..bca55078a 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -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); } - + /** *

showEmptyPage

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

showViewer

* @@ -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(); } - + /** *

getViewer

* @@ -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(); } - + /** *

createViewer

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

getConversationHolder

* * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { - if(part != null) - return ((IConversationEnabled) part).getConversationHolder(); - + @Override + public ConversationHolder getConversationHolder() { + if(part != null) { + return ((IConversationEnabled) part).getConversationHolder(); + } + return null; } - + /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) { - + @Override + public void update(CdmDataChangeMap changeEvents) { + } - + /** {@inheritDoc} */ @Override public void dispose() { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java index 5d884ed61..cc9ea6f48 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -33,7 +33,7 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; * @version 1.0 */ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartContentHasSupplementalData{ - + /** Constant ID="eu.etaxonomy.taxeditor.editor.forms.det"{trunked} */ public static String ID = "eu.etaxonomy.taxeditor.view.detail"; @@ -43,35 +43,36 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC @Override public void createViewer(Composite parent) { //selectionService.addPostSelectionListener(this); - + viewer = new DetailsViewer(parent, this); getSite().setSelectionProvider(viewer); } /** {@inheritDoc} */ - public void selectionChanged(IWorkbenchPart part, ISelection selection) { + @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; } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java index 37884ef2e..c292c7efc 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java @@ -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); + } }