From: Patrick Plitzner Date: Wed, 30 Mar 2016 13:58:22 +0000 (+0200) Subject: Fix spacing for detail view elements #5436 X-Git-Tag: 4.0.0^2~58 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/f34721b8fb8f8ae97bde041e4d42017b2199904e Fix spacing for detail view elements #5436 --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java index 992c3127d..35e10d082 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.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. */ @@ -22,7 +22,7 @@ import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser; *

* DateDetailSection class. *

- * + * * @author n.hoffmann * @created Mar 31, 2010 * @version 1.0 @@ -39,7 +39,7 @@ public class DateDetailSection extends AbstractFormSection { *

* Constructor for DateDetailSection. *

- * + * * @param formFactory * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} * object. @@ -54,8 +54,8 @@ public class DateDetailSection extends AbstractFormSection { 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 { } return super.getEntity(); } - + /** *

* Setter for the field timePeriod. *

- * + * * @param timePeriod * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object. */ @@ -93,7 +93,7 @@ public class DateDetailSection extends AbstractFormSection { 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 { } 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 { this.setText(title); layout(); } - + /* * (non-Javadoc) - * + * * @see eu.etaxonomy.taxeditor.forms.AbstractFormSection#dispose() */ /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java index f448fe3c4..0bc4ddb1f 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.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. */ @@ -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; - + /** *

Constructor for PartialElement.

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

Setter for the field partial.

* @@ -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) { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java index 823328553..efffb130d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java @@ -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 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());