From: jaeyeol lee Date: Sun, 4 May 2014 04:32:03 +0000 (+0900) Subject: PROP : bug fixed runtime java script function in the action tab X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf1448c18058493586b9a191c0e932ff992177ad;p=sdk%2Fide%2Fweb-ui-builder-eplugin.git PROP : bug fixed runtime java script function in the action tab not used the wrong index Change-Id: I7af439bf02ff512592070c7f5d241d8831475880 Signed-off-by: jaeyeol lee --- diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/SetPartEventCommand.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/SetPartEventCommand.java index e84c69e..88cd847 100644 --- a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/SetPartEventCommand.java +++ b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/SetPartEventCommand.java @@ -48,11 +48,6 @@ public class SetPartEventCommand extends Command { private String eventValue; /** - * An old event value. - */ - private String oldEventValue; - - /** * JavaScript function index. */ private int index; @@ -111,9 +106,6 @@ public class SetPartEventCommand extends Command { @Override public void execute() { if (canExecute()) { - if (oldEventValue == null) { - oldEventValue = part.getEventValue(eventName, index); - } part.setEventValue(eventName, eventValue, index); } } @@ -123,7 +115,7 @@ public class SetPartEventCommand extends Command { */ @Override public void undo() { - part.setEventValue(eventName, oldEventValue, index); + part.setEventValue(eventName, eventValue, index); } } diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/Part.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/Part.java index d3c9a6f..fc5519c 100644 --- a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/Part.java +++ b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/Part.java @@ -1114,6 +1114,21 @@ public class Part implements ISerializer { return null; } + + public Boolean hasEventValue(String eventName, String value) { + List list = events.get(eventName); + if (list != null) { + if (!list.isEmpty()) { + for (String str : list) { + if (str.equals(value)) { + return true; + } + } + } + } + return false; + + } // public String getEventValue(String eventName) { // return events.get(eventName); @@ -1144,9 +1159,9 @@ public class Part implements ISerializer { oldValues = new ArrayList(); } - if ((value != null) && (value.isEmpty())) { - oldValues.remove(index); - // oldValues.add(index, null); + if ((value != null) && (hasEventValue(eventName, value))) { + oldValues.remove(value); + //TODO change order } else if ((value != null) && (oldValueText != null)) { oldValues.remove(index); oldValues.add(index, value);