Create constant for default column number in detail sections
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 25 Aug 2015 06:06:12 +0000 (08:06 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 25 Aug 2015 06:06:12 +0000 (08:06 +0200)
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/section/AbstractCdmDetailSection.java

index 6afa2b7..a50561e 100644 (file)
@@ -52,6 +52,11 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
 //TODO shouldn't ENTITY be bound with super class ICdmBase for example (AbstractFormSection<ENTITY extends ICdmBase>)?
 public abstract class AbstractFormSection<ENTITY> extends Section implements ISelectionChangedListener, IEntityElement<ENTITY>, IConversationEnabled {
 
+    /**
+     * The default number of columns in detail sections
+     */
+    public static final int DEFAULT_NUM_COLUMNS = 2;
+
        private ISelectionProvider selectionProvider;
 
        private ENTITY entity;
index 07f08c7..f88a9d0 100644 (file)
@@ -42,27 +42,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
 
        protected ICdmDetailElement<ENTITY> detailElement;
 
-       /**
-        * <p>
-        * Constructor for AbstractCdmDetailSection.
-        * </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.
-        * @param <ENTITY>
-        *            a ENTITY object.
-        */
        public AbstractCdmDetailSection(CdmFormFactory formFactory,
                        ConversationHolder conversation, ICdmFormElement parentElement,
                        ISelectionProvider selectionProvider, int style) {
@@ -88,15 +67,10 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
         }
        }
 
-       /**
-        * @param abstractCdmDetailSection
-        * @param definedTermClass
-        * @param null1
-        */
        protected void createControlsByType(AbstractCdmDetailSection<ENTITY> formElement, Class<ENTITY> entityClass, int style) {
            TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout();
            layout.topMargin = 10;
-           layout.numColumns = 2;
+           layout.numColumns = DEFAULT_NUM_COLUMNS;
 
            getLayoutComposite().setLayout(layout);
            if(entityClass==null){
@@ -107,19 +81,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
            }
        }
 
-
-       /**
-        * <p>
-        * createControls
-        * </p>
-        *
-        * @param formElement
-        *            a
-        *            {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection}
-        *            object.
-        * @param style
-        *            a int.
-        */
        protected void createControls(AbstractCdmDetailSection<ENTITY> formElement, int style) {
            createControlsByType(formElement, null, style);
        }
@@ -130,13 +91,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
            return createCdmDetailElement(parentElement, style);
        }
 
-       /**
-        * <p>
-        * getHeading
-        * </p>
-        *
-        * @return the heading for this section
-        */
        public abstract String getHeading();
 
        /** {@inheritDoc} */
@@ -152,13 +106,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
                super.dispose();
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground
-        * (org.eclipse.swt.graphics.Color)
-        */
        /** {@inheritDoc} */
        @Override
        public void setBackground(Color color) {
@@ -168,14 +115,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
                super.setBackground(color);
        }
 
-       /**
-        * <p>
-        * setEntity
-        * </p>
-        *
-        * @param entity
-        *            a ENTITY object.
-        */
        @Override
        public void setEntity(ENTITY entity) {
                if (detailElement != null) {
@@ -186,11 +125,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
                layout();
        }
 
-       /**
-        * <p>
-        * setSectionTitle
-        * </p>
-        */
        protected void setSectionTitle() {
                String title = "";
                if (getEntity() != null && (getEntity() instanceof IdentifiableEntity) && !(getEntity() instanceof SpecimenOrObservationBase)) {
@@ -200,19 +134,11 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
                setTextClient(createToolbar());
        }
 
-       /**
-        * @return
-        */
        protected Control createToolbar() {
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
                return toolBarManager.createControl(this);
        }
 
-       /**
-        * <p>
-        * updateTitle
-        * </p>
-        */
        public void updateTitle() {
                if (!isDisposed()) {
                        setSectionTitle();