Changeset 21 for trunk/src/org/expeditee/actions/Simple.java
- Timestamp:
- 05/08/08 14:30:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Simple.java
r19 r21 38 38 import org.expeditee.simple.UnitTestFailedException; 39 39 import org.expeditee.stats.AgentStats; 40 import org.expeditee.stats.SessionStats; 40 41 41 42 public class Simple { … … 236 237 // item.setColor(Color.CYAN); 237 238 FrameUtils.DisplayFrame(item.getParent().getFrameName(), true); 238 item.s howHighlight(true,Color.CYAN);239 item.setSelectionColor(Color.CYAN); 239 240 FrameIO.SaveFrame(item.getParent()); 240 241 } … … 312 313 Frame frame = i.getParent(); 313 314 314 if (i == frame.getTitle() || i == frame.getFrameNameItem() || i.isAnnotation()) { 315 if (i == frame.getTitle() || i == frame.getFrameNameItem() 316 || i.isAnnotation()) { 315 317 return false; 316 318 } … … 576 578 for (Text text : targetFrame.getBodyTextItems(true)) { 577 579 String s = text.getTextNoList().toLowerCase(); 578 580 579 581 if (s.startsWith(targetAttribute)) { 580 582 attributeItem = text; … … 847 849 } 848 850 } 849 850 851 return Status.OK; 851 852 } else if (tokens[0].startsWith("getframename")) { … … 872 873 frameName); 873 874 context.getPrimitives().setValue(tokens[2], filePath); 875 return Status.OK; 876 } else if (tokens[0].equals("getframelog")) { 877 assertExactParametreCount(tokens, 1); 878 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 879 880 String log = SessionStats.getFrameEventList(); 881 Text t; 882 try { 883 t = (Text) context.getPointers().getVariable(tokens[1]) 884 .getValue(); 885 t.setText(log); 886 } catch (Exception e) { 887 t = new Text(-1, log); 888 context.getPointers().setObject(tokens[1], t); 889 } 890 874 891 return Status.OK; 875 892 } … … 1005 1022 FrameIO.getFramesetList()); 1006 1023 return Status.OK; 1024 } else if (tokens[0].equals("getsessionstats")) { 1025 assertExactParametreCount(tokens, 1); 1026 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 1027 1028 String stats = SessionStats.getCurrentStats(); 1029 Text t; 1030 try { 1031 t = (Text) context.getPointers().getVariable(tokens[1]) 1032 .getValue(); 1033 t.setText(stats); 1034 } catch (Exception e) { 1035 t = new Text(-1, stats); 1036 context.getPointers().setObject(tokens[1], t); 1037 } 1038 1039 return Status.OK; 1007 1040 } 1008 1041 } else if (tokens[0].equals("or")) { … … 1060 1093 || tokens[0].equals("errorln") || tokens[0].equals("errorline")) { 1061 1094 String message = getMessage(tokens, context, code.toString(), 1062 tokens[0].endsWith("nospaces") ? "" : " " );1095 tokens[0].endsWith("nospaces") ? "" : " ", 1); 1063 1096 1064 1097 if (tokens[0].equals("errorln") || tokens[0].equals("errorline")) … … 1067 1100 FrameGraphics.DisplayMessageAlways(message); 1068 1101 return Status.OK; 1069 } else if (tokens[0].equals("typein") 1070 || tokens[0].equals("typeinnospaces")) { 1102 } else if (tokens[0].equals("typeatrate")) { 1103 assertMinParametreCount(tokens, 1); 1104 double delay = context.getPrimitives().getDoubleValue(tokens[1]); 1105 String s = getMessage(tokens, context, code.toString(), " ", 2); 1106 for (int i = 0; i < s.length(); i++) { 1107 FrameKeyboardActions.processChar(s.charAt(i)); 1108 Thread.sleep((int) (delay * 1000)); 1109 } 1110 return Status.OK; 1111 } else if (tokens[0].equals("type") || tokens[0].equals("typenospaces")) { 1071 1112 1072 1113 String s = getMessage(tokens, context, code.toString(), tokens[0] 1073 .equals("type in") ? " " : "");1114 .equals("type") ? " " : "", 1); 1074 1115 for (int i = 0; i < s.length(); i++) { 1075 1116 FrameKeyboardActions.processChar(s.charAt(i)); 1076 1117 Thread.sleep(25); 1077 1118 } 1119 return Status.OK; 1120 } else if (tokens[0].equals("runstring")) { 1121 String codeText = getMessage(tokens, context, code.toString(), " ", 1122 1); 1123 Text dynamicCode = new Text(1, codeText); 1124 RunItem(dynamicCode, context, Status.OK); 1078 1125 return Status.OK; 1079 1126 } else if (tokens[0].startsWith("else")) { … … 1345 1392 } else if (tokens[0].equals("copyitem")) { 1346 1393 assertMinParametreCount(tokens, 2); 1347 assertVariableType(tokens[1],1,SPointer.itemPrefix); 1348 assertVariableType(tokens[2],2,SPointer.itemPrefix); 1349 Item item = (Item)context.getPointers().getVariable(tokens[1]).getValue(); 1394 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 1395 assertVariableType(tokens[2], 2, SPointer.itemPrefix); 1396 Item item = (Item) context.getPointers().getVariable(tokens[1]) 1397 .getValue(); 1350 1398 Item copy = item.copy(); 1351 1399 context.getPointers().setObject(tokens[2], copy); 1352 1400 1353 1401 return Status.OK; 1354 } else if (tokens[0].equals("copyframeset")) {1402 } else if (tokens[0].equals("copyframeset")) { 1355 1403 assertMinParametreCount(tokens, 2); 1356 1404 String framesetToCopy = context.getPrimitives().getStringValue( … … 1369 1417 } else if (tokens[0].equals("copyframe")) { 1370 1418 assertMinParametreCount(tokens, 2); 1371 assertVariableType(tokens[1], 1,SPointer.framePrefix);1372 assertVariableType(tokens[2], 2,SPointer.framePrefix);1419 assertVariableType(tokens[1], 1, SPointer.framePrefix); 1420 assertVariableType(tokens[2], 2, SPointer.framePrefix); 1373 1421 Frame frameToCopy = (Frame) context.getPointers().getVariable( 1374 1422 tokens[1]).getValue(); … … 2063 2111 2064 2112 private static String getMessage(String[] tokens, Context context, 2065 String code, String separator) throws Exception { 2113 String code, String separator, int firstStringIndex) 2114 throws Exception { 2066 2115 StringBuilder message = new StringBuilder(); 2067 if (tokens.length == 1) {2116 if (tokens.length == firstStringIndex) { 2068 2117 message.append(context.getPrimitives().getVariable(DEFAULT_STRING) 2069 2118 .stringValue()); 2070 2119 } else { 2071 for (int i = 1; i < tokens.length; i++) {2120 for (int i = firstStringIndex; i < tokens.length; i++) { 2072 2121 if (Primitives.isPrimitive(tokens[i])) { 2073 2122 message.append(context.getPrimitives().getVariable(
Note:
See TracChangeset
for help on using the changeset viewer.