Fix for jira IOT-1042.
authorG S Senthil Kumar <senthil.gs@samsung.com>
Wed, 23 Mar 2016 13:06:44 +0000 (18:36 +0530)
committerUze Choi <uzchoi@samsung.com>
Mon, 11 Apr 2016 11:22:53 +0000 (11:22 +0000)
Resolving the issue of incorrectly shown allowed values in
"Modify Array Attribute Value" UI dialog of Service Provider Plug-in.

Change-Id: Ie652d5bc1185f51d2c52a55b72ded68e38c32664
Signed-off-by: G S Senthil Kumar <senthil.gs@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/6227
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
(cherry picked from commit d2d8a8af2478b16bb85b9e56234adfdbace188b3)
Reviewed-on: https://gerrit.iotivity.org/gerrit/7695
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java

index cc99eac..ddb6f4c 100644 (file)
@@ -270,10 +270,11 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
         AttributeProperty elementProp = arrProp.getElementProperty();
 
         StringBuilder values = new StringBuilder();
+        String value = "";
         if (elementProp.isInteger()) {
             IntegerProperty intProp = elementProp.asInteger();
             if (intProp.hasRange()) {
-                values.append(intProp.min() + " - " + intProp.max());
+                value = intProp.min() + " - " + intProp.max();
             } else if (intProp.hasValues()) {
                 int[] arr = intProp.getValues();
                 for (int i = 0; i < arr.length; i++) {
@@ -284,13 +285,13 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
                 }
 
                 if (!values.toString().isEmpty()) {
-                    values.append("[" + values + "]");
+                    value = "[" + values + "]";
                 }
             }
         } else if (elementProp.isDouble()) {
             DoubleProperty dblProp = elementProp.asDouble();
             if (dblProp.hasRange()) {
-                values.append(dblProp.min() + " - " + dblProp.max());
+                value = dblProp.min() + " - " + dblProp.max();
             } else if (dblProp.hasValues()) {
                 double[] arr = dblProp.getValues();
                 for (int i = 0; i < arr.length; i++) {
@@ -301,11 +302,11 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
                 }
 
                 if (!values.toString().isEmpty()) {
-                    values.append("[" + values + "]");
+                    value = "[" + values + "]";
                 }
             }
         } else if (elementProp.isBoolean()) {
-            values.append("[true, false]");
+            value = "[true, false]";
         } else if (elementProp.isString()) {
             StringProperty strProp = elementProp.asString();
             if (strProp.hasValues()) {
@@ -318,12 +319,12 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
                 }
 
                 if (!values.toString().isEmpty()) {
-                    values.append("[" + values + "]");
+                    value = "[" + values + "]";
                 }
             }
         }
 
-        allowedValuesTxt.setText(values.toString());
+        allowedValuesTxt.setText(value);
 
         // Set the current value.
         currentValueTxt.setText(new AttributeValueStringConverter(attribute
index bce717e..def171e 100644 (file)
@@ -270,10 +270,11 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
         AttributeProperty elementProp = arrProp.getElementProperty();
 
         StringBuilder values = new StringBuilder();
+        String value = "";
         if (elementProp.isInteger()) {
             IntegerProperty intProp = elementProp.asInteger();
             if (intProp.hasRange()) {
-                values.append(intProp.min() + " - " + intProp.max());
+                value = intProp.min() + " - " + intProp.max();
             } else if (intProp.hasValues()) {
                 int[] arr = intProp.getValues();
                 for (int i = 0; i < arr.length; i++) {
@@ -284,13 +285,13 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
                 }
 
                 if (!values.toString().isEmpty()) {
-                    values.append("[" + values + "]");
+                    value = "[" + values + "]";
                 }
             }
         } else if (elementProp.isDouble()) {
             DoubleProperty dblProp = elementProp.asDouble();
             if (dblProp.hasRange()) {
-                values.append(dblProp.min() + " - " + dblProp.max());
+                value = dblProp.min() + " - " + dblProp.max();
             } else if (dblProp.hasValues()) {
                 double[] arr = dblProp.getValues();
                 for (int i = 0; i < arr.length; i++) {
@@ -301,11 +302,11 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
                 }
 
                 if (!values.toString().isEmpty()) {
-                    values.append("[" + values + "]");
+                    value = "[" + values + "]";
                 }
             }
         } else if (elementProp.isBoolean()) {
-            values.append("[true, false]");
+            value = "[true, false]";
         } else if (elementProp.isString()) {
             StringProperty strProp = elementProp.asString();
             if (strProp.hasValues()) {
@@ -318,11 +319,12 @@ public class UpdatePrimitiveArrayAttributeDialog extends TitleAreaDialog {
                 }
 
                 if (!values.toString().isEmpty()) {
-                    values.append("[" + values + "]");
+                    value = "[" + values + "]";
                 }
             }
         }
-        allowedValuesTxt.setText(values.toString());
+
+        allowedValuesTxt.setText(value);
 
         // Set the current value.
         currentValueTxt.setText(new AttributeValueStringConverter(attribute