X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/aeefa3f9c3c2358ebe722df23771d24cad32032c..1bf80c0c5daafa3cf40d34be966146731c669fb9:/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java index 2a019c07d..57cb79885 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java @@ -1,16 +1,15 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.view; -import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Composite; @@ -36,23 +35,24 @@ import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart; * @created Feb 9, 2010 * @version 1.0 */ -public abstract class AbstractCdmDataViewer extends Viewer implements ISelectionProvider, IConversationEnabled{ - +public abstract class AbstractCdmDataViewer extends Viewer implements IConversationEnabled{ + protected ManagedForm managedForm; protected CdmFormFactory formFactory; protected ScrolledForm scrolledForm; - - private Composite body; - + + private final Composite body; + protected RootElement rootElement; + //TODO: create a super class for this? private Object input; - private AbstractCdmViewPart viewPart; + private final AbstractCdmViewPart viewPart; + - /** *
Constructor for AbstractCdmDataViewer.
* @@ -61,9 +61,9 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection */ public AbstractCdmDataViewer(Composite parent, AbstractCdmViewPart viewPart) { this.viewPart = viewPart; - + managedForm = new ManagedForm(parent){ - + /* (non-Javadoc) * @see org.eclipse.ui.forms.ManagedForm#dirtyStateChanged() */ @@ -72,18 +72,18 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection markViewPartDirty(); } }; - + createFormFactory(); - + scrolledForm = managedForm.getForm(); - + body = scrolledForm.getBody(); - + body.setLayout(LayoutConstants.LAYOUT()); - + rootElement = new RootElement(formFactory, body); } - + /** *createFormFactory
*/ @@ -98,8 +98,8 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection protected void markViewPartDirty(){ viewPart.changed(input); } - - + + /** * @return */ @@ -116,22 +116,22 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection for(Control child : body.getChildren()){ return child; } - + return body; } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object) */ /** {@inheritDoc} */ @Override public void setInput(Object input) { - this.input = input; + this.input = input; // reset selection setSelection(new StructuredSelection(input)); refresh(); } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.Viewer#getInput() */ @@ -140,7 +140,7 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection public Object getInput() { return input; } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.Viewer#refresh() */ @@ -148,51 +148,51 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection @Override public void refresh() { showParts(); - + managedForm.setInput(input); - + managedForm.refresh(); - + managedForm.reflow(true); } - + /** *layout
*/ public void layout(){ body.layout(); } - + /** *showParts
*/ protected abstract void showParts(); - - + + /** *destroySections
*/ - protected void destroySections() { + protected void destroySections() { for (IFormPart formPart : managedForm.getParts()){ removePart((CdmSectionPart) formPart); - } - + } + managedForm.setInput(null); - + formFactory.destroyElement(rootElement); - + createFormFactory(); - + rootElement = new RootElement(formFactory, body); - + for(Control control : body.getChildren()){ control.dispose(); control = null; } } - - + + /** *setFocus
*/ @@ -205,14 +205,14 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection break; } } - + /** *reflow
*/ public void reflow(){ managedForm.reflow(true); } - + /** *removePart
* @@ -222,7 +222,7 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection managedForm.removePart(sectionPart); formFactory.removePropertyChangeListener(sectionPart); } - + /** *addPart
* @@ -233,17 +233,19 @@ public abstract class AbstractCdmDataViewer extends Viewer implements ISelection managedForm.addPart(sectionPart); formFactory.addPropertyChangeListener(sectionPart); } - + /** *getConversationHolder
* * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. */ - public ConversationHolder getConversationHolder() { + @Override + public ConversationHolder getConversationHolder() { return viewPart.getConversationHolder(); } - + /** {@inheritDoc} */ - public void update(CdmDataChangeMap changeEvents) {} + @Override + public void update(CdmDataChangeMap changeEvents) {} }