From: nakyoung2.choi Date: Thu, 8 May 2014 04:54:21 +0000 (+0900) Subject: PROP : Add validate routine in Metrics. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F72%2F20472%2F1;p=sdk%2Fide%2Fweb-ui-builder-eplugin.git PROP : Add validate routine in Metrics. Check integer value. Change-Id: I52d840ed58225eb811635b3f83805b75bb8e452b Signed-off-by: nakyoung2.choi --- diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/MetricsMethod.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/MetricsMethod.java index ea2adcc..2373280 100644 --- a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/MetricsMethod.java +++ b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/MetricsMethod.java @@ -1120,8 +1120,9 @@ public class MetricsMethod extends Method { Label label = textEditor.getLabel(); String editorData = textEditor.getEditor().getText(); if (editorData != null) { - /** TODO : need validation */ - if (isDefaultValue(editorData)) { + if (!validateTextEditor(textEditor)) { + return; + } else if (isDefaultValue(editorData)) { label.setText(DEFAULT_VALUE); } else { label.setText(editorData); @@ -1145,8 +1146,10 @@ public class MetricsMethod extends Method { Label label = textEditor.getLabel(); String editorData = textEditor.getEditor().getText(); if (editorData != null) { - /** TODO : need validation */ - if (isDefaultValue(editorData)) { + if (!validateTextEditor(textEditor)) { + textEditor.showLabel(); + return; + } else if (isDefaultValue(editorData)) { label.setText(DEFAULT_VALUE); } else { label.setText(editorData); @@ -1194,4 +1197,17 @@ public class MetricsMethod extends Method { data.right = new FormAttachment(100, 0); return data; } + + private boolean validateTextEditor(TextEditor textEditor) { + String labelText = textEditor.getLabel().getText(); + String editorData = textEditor.getEditor().getText(); + if (editorData == null) { + return false; + } else if (!editorData.matches(BuilderConstants.INTEGERVALUE)) { + return false; + } else if (editorData.equals(labelText)) { + return false; + } + return true; + } }