From 693896ae00f2bbc3e8ee24979fedacc493d799b5 Mon Sep 17 00:00:00 2001 From: G S Senthil Kumar Date: Wed, 23 Mar 2016 18:36:44 +0530 Subject: [PATCH] Fix for jira IOT-1042. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/6227 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka (cherry picked from commit d2d8a8af2478b16bb85b9e56234adfdbace188b3) Reviewed-on: https://gerrit.iotivity.org/gerrit/7695 Reviewed-by: Uze Choi --- .../dialogs/UpdatePrimitiveArrayAttributeDialog.java | 15 ++++++++------- .../dialogs/UpdatePrimitiveArrayAttributeDialog.java | 16 +++++++++------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java b/service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java index cc99eac..ddb6f4c 100644 --- a/service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java +++ b/service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java @@ -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 diff --git a/service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java b/service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java index bce717e..def171e 100644 --- a/service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java +++ b/service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/UpdatePrimitiveArrayAttributeDialog.java @@ -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 -- 2.7.4