Fix spacing for detail view elements #5436
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 30 Mar 2016 13:58:22 +0000 (15:58 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 30 Mar 2016 13:58:58 +0000 (15:58 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java

index 992c312..35e10d0 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.
  */
@@ -22,7 +22,7 @@ import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
  * <p>
  * DateDetailSection class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Mar 31, 2010
  * @version 1.0
@@ -39,7 +39,7 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
         * <p>
         * Constructor for DateDetailSection.
         * </p>
-        * 
+        *
         * @param formFactory
         *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
         *            object.
@@ -54,8 +54,8 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                super(formFactory, parentElement, style);
 
                partialElement_start = formFactory.createPartialElement(this,
-                               "Start: ", null, style);
-               partialElement_end = formFactory.createPartialElement(this, "End: ",
+                               "Start ", null, style);
+               partialElement_end = formFactory.createPartialElement(this, "End ",
                                null, style);
 
                text_parseText = formFactory.createTextWithLabelElement(this, "Parse",
@@ -78,12 +78,12 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                }
                return super.getEntity();
        }
-       
+
        /**
         * <p>
         * Setter for the field <code>timePeriod</code>.
         * </p>
-        * 
+        *
         * @param timePeriod
         *            a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
         */
@@ -93,7 +93,7 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                updateTitle();
                text_parseText.setText(timePeriod.toString());
        }
-       
+
        /**
         * When setting the entity through parsing we do not want to alter the parse field
         * @param timePeriod
@@ -147,7 +147,7 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                } else if (eventSource == text_parseText) {
                        cursorPosition = ((Text) text_parseText.getMainControl())
                                        .getCaretPosition();
-                       setEntityInternally(TimePeriodParser.parseString(text_parseText.getText()));                    
+                       setEntityInternally(TimePeriodParser.parseString(text_parseText.getText()));
                } else if (eventSource == text_freeText) {
                        getEntity().setFreeText(text_freeText.getText());
                }
@@ -160,10 +160,10 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                this.setText(title);
                layout();
        }
-       
+
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see eu.etaxonomy.taxeditor.forms.AbstractFormSection#dispose()
         */
        /** {@inheritDoc} */
index f448fe3..0bc4ddb 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.
 */
@@ -13,6 +13,7 @@ package eu.etaxonomy.taxeditor.ui.element;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
 import org.joda.time.Partial;
 
 import eu.etaxonomy.cdm.model.common.TimePeriod;
@@ -31,7 +32,7 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
        private NumberWithLabelElement number_month;
        private NumberWithLabelElement number_year;
        private Partial partial;
-       
+
        /**
         * <p>Constructor for PartialElement.</p>
         *
@@ -43,25 +44,27 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
        public PartialElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement, String labelString, int style) {
                super(formFactory, formElement);
-               
-               formElement.getLayoutComposite().setLayout(LayoutConstants.LAYOUT(7, false));
-               
+
+               TableWrapLayout layout = LayoutConstants.LAYOUT(7, false);
+               layout.horizontalSpacing = 5;
+        formElement.getLayoutComposite().setLayout(layout);
+
                label = formFactory.createLabel(getLayoutComposite(), labelString);
                addControl(label);
-               
+
                number_year = formFactory.createNumberTextWithLabelElement(this, "Year", null, style);
                number_year.setLimits(4, -9999, 9999);
-               
-               number_month = formFactory.createNumberTextWithLabelElement(this, "Month", null, style);                
+
+               number_month = formFactory.createNumberTextWithLabelElement(this, "Month", null, style);
                number_month.setLimits(2, 1, 12);
-               
+
                number_day = formFactory.createNumberTextWithLabelElement(this, "Day", null, style);
                number_day.setLimits(2, 1, 31);
-               
-               
-               formFactory.addPropertyChangeListener(this);            
+
+
+               formFactory.addPropertyChangeListener(this);
        }
-       
+
        /**
         * <p>Setter for the field <code>partial</code>.</p>
         *
@@ -69,7 +72,7 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
         */
        public void setPartial(Partial partial){
                this.partial = partial;
-               
+
                if(partial != null){
                        number_day.setNumber(TimePeriod.getPartialValue(partial, TimePeriod.DAY_TYPE));
                        number_month.setNumber(TimePeriod.getPartialValue(partial, TimePeriod.MONTH_TYPE));
@@ -95,9 +98,9 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
                if(event == null){
                        return;
                }
-               
+
                Object eventSource = event.getSource();
-               
+
                if(getElements().contains(eventSource)){
                        if(event instanceof CdmPropertyChangeEvent){
                                if(((CdmPropertyChangeEvent) event).hasException()){
@@ -106,9 +109,9 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
                                }
                        }
                        handleEvent(eventSource);
-               }               
+               }
        }
-       
+
        /**
         * @param event
         */
@@ -123,26 +126,26 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
                        } else{
                                partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE);
                        }
-                       
+
                }else if(eventSource == number_day){
                        if (number_day.getInteger() == 0){
                                partial = TimePeriod.setPartialField(partial, null, TimePeriod.DAY_TYPE);
                        } else{
                                partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE);
                        }
-                       
-                       
+
+
                }else if(eventSource == number_year){
                        if (number_year.getInteger() == 0){
                                partial = TimePeriod.setPartialField(partial, null, TimePeriod.YEAR_TYPE);
                        } else{
                                partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE);
                        }
-                       
+
                }
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void setBackground(Color color) {
index 8233285..efffb13 100644 (file)
@@ -18,7 +18,6 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Layout;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
@@ -93,7 +92,8 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                setLayoutComposite(container);
 
                addControl(container);
-               Layout containerLayout = LayoutConstants.LAYOUT(2, false);
+               TableWrapLayout containerLayout = LayoutConstants.LAYOUT(2, false);
+               containerLayout.horizontalSpacing = 5;
 
                container.setLayout(containerLayout);
                container.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());