From: Patric Plitzner
Date: Wed, 29 Oct 2014 10:38:50 +0000 (+0000)
Subject: - added elevation to section title
X-Git-Tag: 3.6.0~379
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/a6b6b197dae9f34af2c20924f5064e2e8358fa4e
- added elevation to section title
---
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java
index bd16aa177..a3b2e3e6b 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java
@@ -62,12 +62,12 @@ public class MinMaxTextSection extends AbstractFormSection {
switch(unitType) {
case ELEVATION:
text_minVal = formFactory.createNumberTextWithLabelElement(this, "Min [m] : ", getMinimum(), style);
- text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);
+ text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);
break;
default:
text_minVal = formFactory.createNumberTextWithLabelElement(this, "Min [m] : ", getMinimum(), style);
- text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);
- break;
+ text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);
+ break;
}
text_freeText = formFactory.createTextWithLabelElement(this,
"Freetext : ", getFreetext(), style);
@@ -87,6 +87,7 @@ public class MinMaxTextSection extends AbstractFormSection {
public void setEntity(DerivedUnitFacade gatheringEvent) {
super.setEntity(gatheringEvent);
updateValues();
+ updateTitle();
}
private void updateValues() {
@@ -166,10 +167,26 @@ public class MinMaxTextSection extends AbstractFormSection {
} else if (eventSource == text_freeText) {
updateFreetext();
}
+ updateTitle();
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
-
+ private void updateTitle(){
+ String title = "";
+ if(text_minVal.getText()!=null){
+ title += text_minVal.getText();
+ }
+ if(text_maxVal.getText()!=null && !text_maxVal.getText().equals("")){
+ if(!title.equals("")){
+ title += " - "+text_maxVal.getText();
+ }
+ }
+ if(title.equals("") && text_freeText.getText()!=null){
+ title = text_freeText.getText();
+ }
+ this.setText(title);
+ layout();
+ }
/*
* (non-Javadoc)
@@ -186,7 +203,7 @@ public class MinMaxTextSection extends AbstractFormSection {
private void updateMinimum() {
switch(unitType) {
case ELEVATION:
- getEntity().setAbsoluteElevation(text_minVal.getDouble().intValue());
+ getEntity().setAbsoluteElevation(text_minVal.getDouble()!=null?text_minVal.getDouble().intValue():null);
break;
case DIST_TO_GROUND:
getEntity().setDistanceToGround(text_minVal.getDouble());
@@ -215,7 +232,7 @@ public class MinMaxTextSection extends AbstractFormSection {
private void updateMaximum() {
switch(unitType) {
case ELEVATION:
- getEntity().setAbsoluteElevationMax(text_maxVal.getDouble().intValue());
+ getEntity().setAbsoluteElevationMax(text_maxVal.getDouble()!=null?text_maxVal.getDouble().intValue():null);
break;
case DIST_TO_GROUND:
getEntity().setDistanceToGroundMax(text_maxVal.getDouble());
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java
index 83e229bd4..57fade3d9 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java
@@ -114,6 +114,7 @@ public class NumberWithLabelElement extends TextWithLabelElement {
String value = text.getText();
if(StringUtils.isBlank(value)){
text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ super.modifyText(event);
return;
}