diff --git a/src/org/zeroxlab/aster/cmds/AsterCommand.java b/src/org/zeroxlab/aster/cmds/AsterCommand.java index c594f76..f748591 100644 --- a/src/org/zeroxlab/aster/cmds/AsterCommand.java +++ b/src/org/zeroxlab/aster/cmds/AsterCommand.java @@ -40,6 +40,7 @@ public abstract class AsterCommand { protected BufferedImage mImage = null; protected AsterOperation[] mOps; protected boolean mExecuting = false; + protected boolean mFilled = false; public static class ExecutionResult { public boolean mSuccess; @@ -54,6 +55,14 @@ public ExecutionResult(boolean success, String message) { } } + public boolean isFilled() { + return mFilled; + } + + protected void setFilled(boolean status) { + mFilled = status; + } + static public void setScriptRunner(ScriptRunner runner) { mRunner = runner; } @@ -98,6 +107,11 @@ public AsterOperation[] getOperations() { return mOps; } + public final void fillSettings(SimpleBindings settings) throws IOException { + setFilled(true); + onFillSettings(settings); + } + /* Get name of command */ public abstract String getName(); @@ -105,7 +119,7 @@ public AsterOperation[] getOperations() { public abstract SimpleBindings getSettings(); /* Set settings of a command */ - public abstract void fillSettings(SimpleBindings settings) throws IOException; + protected abstract void onFillSettings(SimpleBindings settings) throws IOException; /* Dump command to script text */ protected abstract String toScript(); diff --git a/src/org/zeroxlab/aster/cmds/Drag.java b/src/org/zeroxlab/aster/cmds/Drag.java index 20e4a0c..fe64a31 100644 --- a/src/org/zeroxlab/aster/cmds/Drag.java +++ b/src/org/zeroxlab/aster/cmds/Drag.java @@ -57,6 +57,7 @@ public Drag() { public Drag(String prefix, String argline) throws IllegalArgumentException { String[] args = splitArgs(argline); + super.setFilled(true); if (args.length == 8) { // drag(start_image, (dx, dy), duration, steps, timeout, similarity, @@ -146,7 +147,7 @@ public SimpleBindings getSettings() { } @Override - public void fillSettings(SimpleBindings settings) throws IOException { + protected void onFillSettings(SimpleBindings settings) throws IOException { if (settings.containsKey("CoordType")) { mCoordType = (CoordType)settings.get("CoordType"); } diff --git a/src/org/zeroxlab/aster/cmds/Press.java b/src/org/zeroxlab/aster/cmds/Press.java index a9de686..06bf320 100644 --- a/src/org/zeroxlab/aster/cmds/Press.java +++ b/src/org/zeroxlab/aster/cmds/Press.java @@ -64,13 +64,14 @@ public Press(AsterOperation op) { super.mOps = new AsterOperation[1]; super.mOps[0] = op; try { - fillSettings(op.getSettings()); + this.onFillSettings(op.getSettings()); } catch (Exception e) { e.printStackTrace(); } } public Press(String argline) throws IllegalArgumentException { + super.setFilled(true); String[] args = splitArgs(argline); if (args.length == 2) { // press(keycode, type) @@ -102,7 +103,7 @@ public SimpleBindings getSettings() { } @Override - public void fillSettings(SimpleBindings settings) throws IOException { + protected void onFillSettings(SimpleBindings settings) throws IOException { if (settings.containsKey("KeyCode")) { mKeyCode = (String)settings.get("KeyCode"); } diff --git a/src/org/zeroxlab/aster/cmds/Recall.java b/src/org/zeroxlab/aster/cmds/Recall.java index 9aa7bd8..1761dd2 100644 --- a/src/org/zeroxlab/aster/cmds/Recall.java +++ b/src/org/zeroxlab/aster/cmds/Recall.java @@ -35,6 +35,7 @@ public Recall() { } public Recall(String argline) throws IllegalArgumentException { + super.setFilled(true); String[] args = splitArgs(argline); if (args.length == 1) { @@ -61,7 +62,7 @@ public SimpleBindings getSettings() { } @Override - public void fillSettings(SimpleBindings settings) throws IOException { + protected void onFillSettings(SimpleBindings settings) throws IOException { if (settings.containsKey("Script")) { mScript = (String)settings.get("Script"); } diff --git a/src/org/zeroxlab/aster/cmds/Touch.java b/src/org/zeroxlab/aster/cmds/Touch.java index 6fa25a1..d912a90 100644 --- a/src/org/zeroxlab/aster/cmds/Touch.java +++ b/src/org/zeroxlab/aster/cmds/Touch.java @@ -74,6 +74,7 @@ public Touch() { public Touch(String prefix, String argline) throws IllegalArgumentException { + super.setFilled(true); String[] args = splitArgs(argline); if (args.length == 5) { @@ -150,7 +151,7 @@ public SimpleBindings getSettings() { } @Override - public void fillSettings(SimpleBindings settings) throws IOException { + protected void onFillSettings(SimpleBindings settings) throws IOException { if (settings.containsKey("CoordType")) { mCoordType = (CoordType)settings.get("CoordType"); } diff --git a/src/org/zeroxlab/aster/cmds/Type.java b/src/org/zeroxlab/aster/cmds/Type.java index 284ee4b..bd17077 100644 --- a/src/org/zeroxlab/aster/cmds/Type.java +++ b/src/org/zeroxlab/aster/cmds/Type.java @@ -36,6 +36,7 @@ public Type() { } public Type(String argline) throws IllegalArgumentException { + super.setFilled(true); String[] args = splitArgs(argline); if (args.length == 1) { @@ -66,7 +67,7 @@ public SimpleBindings getSettings() { } @Override - public void fillSettings(SimpleBindings settings) throws IOException { + protected void onFillSettings(SimpleBindings settings) throws IOException { if (settings == null) { return; } diff --git a/src/org/zeroxlab/aster/cmds/Wait.java b/src/org/zeroxlab/aster/cmds/Wait.java index 5c32563..990df8c 100644 --- a/src/org/zeroxlab/aster/cmds/Wait.java +++ b/src/org/zeroxlab/aster/cmds/Wait.java @@ -44,6 +44,7 @@ public Wait() { public Wait(String prefix, String argline) throws IllegalArgumentException { + super.setFilled(true); String[] args = splitArgs(argline); if (args.length == 4) { // wait(image, timeout, similarity, landscape) @@ -98,7 +99,7 @@ public SimpleBindings getSettings() { } @Override - public void fillSettings(SimpleBindings settings) throws IOException { + protected void onFillSettings(SimpleBindings settings) throws IOException { if (settings.containsKey("WaitType")) { mWaitType = (WaitType)settings.get("WaitType"); }