Changeset 737
- Timestamp:
- 01/22/14 13:58:17 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/AttributeUtils.java
r720 r737 271 271 _Attrib.put("Tooltip", Item.class.getMethod("getTooltip"), 272 272 Item.class.getMethod("setTooltips", pList)); 273 _Attrib.put("Permission", Item.class.getMethod("getPermission"), 274 Item.class.getMethod("setPermission", pPermission)); 273 275 274 276 // Text Items -
trunk/src/org/expeditee/gui/Frame.java
r731 r737 1864 1864 /** 1865 1865 * Sets the item permissions to match the protection for the frame. 1866 * No longer sets item permissions, since items can have their own permissions now (but still default to frame permissions) 1866 1867 * 1867 1868 */ … … 1871 1872 1872 1873 UserAppliedPermission permission = UserAppliedPermission.min(maxPermission, getUserAppliedPermission()); 1873 _frameName.setPermission(permission);1874 1874 1875 1875 switch (permission) { … … 1894 1894 } 1895 1895 1896 for (Overlay o : getOverlays()) 1896 for (Overlay o : getOverlays()) { 1897 for(Item i : o.Frame._body) { 1898 i.setOverlayPermission(o.permission); 1899 } 1897 1900 o.Frame.refreshItemPermissions(o.permission); 1898 1899 // Only update the permissions if we have to 1900 if (_body.size() > 0 && permission.equals(_body.get(0).getPermission())) 1901 return; 1902 1903 for (Item i : _body) { 1904 i.setPermission(permission); 1905 } 1906 1901 } 1907 1902 } 1908 1903 -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r729 r737 1301 1301 if (!mouseMoved) { 1302 1302 Item moreTitle = moreFrame.getTitleItem(); 1303 moreTitle.set Permission(UserAppliedPermission.full);1303 moreTitle.setOverlayPermission(UserAppliedPermission.full); 1304 1304 Drop(moreTitle, bPasting); 1305 1305 } -
trunk/src/org/expeditee/gui/FrameUtils.java
r729 r737 796 796 for (Item i : toParse.getItems()) { 797 797 try { 798 i.setPermission(permission); 798 // reset overlay permission 799 i.setOverlayPermission(null); 800 // i.setPermission(permission); 799 801 if (i instanceof WidgetCorner) { 800 802 // TODO improve efficiency so it only updates once... using … … 1068 1070 if (message != null) { 1069 1071 if (message.contains(x, y)) { 1070 message.set Permission(UserAppliedPermission.copy);1072 message.setOverlayPermission(UserAppliedPermission.copy); 1071 1073 possibles.add(message); 1072 1074 } else { … … 1081 1083 if (MessageBay.getMessageLink() != null) { 1082 1084 if (MessageBay.getMessageLink().contains(x, y)) { 1083 MessageBay.getMessageLink().set Permission(UserAppliedPermission.copy);1085 MessageBay.getMessageLink().setOverlayPermission(UserAppliedPermission.copy); 1084 1086 possibles.add(MessageBay.getMessageLink()); 1085 1087 } … … 1097 1099 && LastEdited.getParent().getItems().contains( 1098 1100 LastEdited)) { 1099 LastEdited.set Permission(UserAppliedPermission.full);1101 LastEdited.setOverlayPermission(UserAppliedPermission.full); 1100 1102 return LastEdited; 1101 1103 } else if (bResetLastEdited) { … … 1335 1337 for (Overlay overlay : frame.getOverlays()) { 1336 1338 if (overlay.Frame == item.getParent()) { 1337 item.set Permission(overlay.permission);1339 item.setOverlayPermission(overlay.permission); 1338 1340 results.add(item); 1339 1341 break; -
trunk/src/org/expeditee/io/DefaultFrameReader.java
r720 r737 110 110 _ItemTags 111 111 .put('y', Item.class.getMethod("setLinkTemplate", pString)); 112 _ItemTags.put('g', Item.class 113 .getMethod("setLinePattern", pIntArray)); 112 _ItemTags.put('g', Item.class.getMethod("setLinePattern", pIntArray)); 114 113 115 114 _ItemTags.put('j', Item.class.getMethod("setArrow", pArrow)); … … 135 134 _ItemTags.put('B', Item.class.getMethod("setLinkHistory", pBool)); 136 135 136 _ItemTags.put('p', Item.class.getMethod("setPermission", pPermission)); 137 137 138 // Lines and constraints are created differently 138 139 _ItemTags.put('L', Line.class.getMethod("setStartItem", pItem)); -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r720 r737 38 38 39 39 // keep track of methods that are put on the same line 40 protected static LinkedHashMap< String, Method> _ItemTags = null;41 42 protected static LinkedHashMap< String, Method> _FrameTags = null;40 protected static LinkedHashMap<Character, Method> _ItemTags = null; 41 42 protected static LinkedHashMap<Character, Method> _FrameTags = null; 43 43 44 44 public DefaultFrameWriter() { 45 45 46 if (_ItemTags != null && _FrameTags != null) 46 47 return; 47 48 48 _ItemTags = new LinkedHashMap<String, Method>(); 49 _FrameTags = new LinkedHashMap<String, Method>(); 50 51 Class[] param = {}; 52 53 try { 54 _FrameTags.put("V", Frame.class.getMethod("getVersion", param)); 55 _FrameTags.put("p", Frame.class.getMethod("getPermission", param)); 56 _FrameTags.put("U", Frame.class.getMethod("getOwner", param)); 57 _FrameTags.put("D", Frame.class.getMethod("getDateCreated", param)); 58 _FrameTags.put("M", Frame.class.getMethod("getLastModifyUser", 59 param)); 60 _FrameTags.put("d", Frame.class.getMethod("getLastModifyDate", 61 param)); 62 _FrameTags.put("F", Frame.class.getMethod("getFrozenDate", param)); 63 64 _FrameTags.put("O", Frame.class.getMethod("getForegroundColor", 65 param)); 66 _FrameTags.put("B", Frame.class.getMethod("getBackgroundColor", 67 param)); 68 _ItemTags.put("S", Item.class.getMethod("getTypeAndID", param)); 69 _ItemTags.put("s", Item.class.getMethod("getDateCreated", param)); 70 _ItemTags.put("d", Item.class.getMethod("getColor", param)); 71 _ItemTags.put("G", Item.class.getMethod("getBackgroundColor", param)); 72 _ItemTags.put("K", Item.class.getMethod("getBorderColor", param)); 73 74 _ItemTags.put("R", Item.class.getMethod("getAnchorLeft", param)); 75 _ItemTags.put("H", Item.class.getMethod("getAnchorRight", param)); 76 _ItemTags.put("N", Item.class.getMethod("getAnchorTop", param)); 77 _ItemTags.put("I", Item.class.getMethod("getAnchorBottom", param)); 78 79 _ItemTags.put("P", Item.class.getMethod("getPosition", param)); 80 _ItemTags.put("T", Text.class.getMethod("getText", param)); 81 _ItemTags.put("F", Item.class.getMethod("getLink", param)); 82 _ItemTags.put("X", Item.class.getMethod("getAction", param)); 83 _ItemTags.put("x", Item.class.getMethod("getActionMark", param)); 84 _ItemTags.put("U", Item.class.getMethod("getActionCursorEnter", 85 param)); 86 _ItemTags.put("V", Item.class.getMethod("getActionCursorLeave", 87 param)); 88 _ItemTags.put("W", Item.class.getMethod("getActionEnterFrame", 89 param)); 90 _ItemTags.put("Y", Item.class.getMethod("getActionLeaveFrame", 91 param)); 92 _ItemTags.put("D", Item.class.getMethod("getData", param)); 93 _ItemTags.put("u", Item.class.getMethod("getHighlight", param)); 94 _ItemTags.put("e", Item.class.getMethod("getFillColor", param)); 95 _ItemTags.put("E", Item.class.getMethod("getGradientColor", param)); 96 _ItemTags.put("Q", Item.class.getMethod("getGradientAngle", param)); 97 98 _ItemTags.put("i", Item.class.getMethod("getFillPattern", param)); 99 _ItemTags.put("o", Item.class.getMethod("getOwner", param)); 100 _ItemTags.put("n", Item.class.getMethod("getLinkMark", param)); 101 _ItemTags.put("q", Item.class.getMethod("getLinkFrameset", param)); 102 _ItemTags.put("y", Item.class.getMethod("getLinkTemplate", param)); 103 _ItemTags.put("g", Item.class.getMethod("getLinePattern", param)); 104 105 _ItemTags.put("j", Item.class.getMethod("getArrow", param)); 106 107 _ItemTags.put("v", Item.class.getMethod("getDotType", param)); 108 _ItemTags.put("z", Item.class.getMethod("getFilled", param)); 109 110 _ItemTags.put("f", Text.class.getMethod("getFont", param)); 111 _ItemTags.put("t", Text.class.getMethod("getSpacing", param)); 49 _ItemTags = new LinkedHashMap<Character, Method>(); 50 _FrameTags = new LinkedHashMap<Character, Method>(); 51 52 try { 53 _FrameTags.put('V', Frame.class.getMethod("getVersion")); 54 _FrameTags.put('p', Frame.class.getMethod("getPermission")); 55 _FrameTags.put('U', Frame.class.getMethod("getOwner")); 56 _FrameTags.put('D', Frame.class.getMethod("getDateCreated")); 57 _FrameTags.put('M', Frame.class.getMethod("getLastModifyUser")); 58 _FrameTags.put('d', Frame.class.getMethod("getLastModifyDate")); 59 _FrameTags.put('F', Frame.class.getMethod("getFrozenDate")); 60 61 _FrameTags.put('O', Frame.class.getMethod("getForegroundColor")); 62 _FrameTags.put('B', Frame.class.getMethod("getBackgroundColor")); 63 64 _ItemTags.put('S', Item.class.getMethod("getTypeAndID")); 65 _ItemTags.put('s', Item.class.getMethod("getDateCreated")); 66 _ItemTags.put('d', Item.class.getMethod("getColor")); 67 _ItemTags.put('G', Item.class.getMethod("getBackgroundColor")); 68 _ItemTags.put('K', Item.class.getMethod("getBorderColor")); 69 70 _ItemTags.put('R', Item.class.getMethod("getAnchorLeft")); 71 _ItemTags.put('H', Item.class.getMethod("getAnchorRight")); 72 _ItemTags.put('N', Item.class.getMethod("getAnchorTop")); 73 _ItemTags.put('I', Item.class.getMethod("getAnchorBottom")); 74 75 _ItemTags.put('P', Item.class.getMethod("getPosition")); 76 _ItemTags.put('T', Text.class.getMethod("getText")); 77 _ItemTags.put('F', Item.class.getMethod("getLink")); 78 _ItemTags.put('X', Item.class.getMethod("getAction")); 79 _ItemTags.put('x', Item.class.getMethod("getActionMark")); 80 _ItemTags.put('U', Item.class.getMethod("getActionCursorEnter")); 81 _ItemTags.put('V', Item.class.getMethod("getActionCursorLeave")); 82 _ItemTags.put('W', Item.class.getMethod("getActionEnterFrame")); 83 _ItemTags.put('Y', Item.class.getMethod("getActionLeaveFrame")); 84 _ItemTags.put('D', Item.class.getMethod("getData")); 85 _ItemTags.put('u', Item.class.getMethod("getHighlight")); 86 _ItemTags.put('e', Item.class.getMethod("getFillColor")); 87 _ItemTags.put('E', Item.class.getMethod("getGradientColor")); 88 _ItemTags.put('Q', Item.class.getMethod("getGradientAngle")); 89 90 _ItemTags.put('i', Item.class.getMethod("getFillPattern")); 91 _ItemTags.put('o', Item.class.getMethod("getOwner")); 92 _ItemTags.put('n', Item.class.getMethod("getLinkMark")); 93 _ItemTags.put('q', Item.class.getMethod("getLinkFrameset")); 94 _ItemTags.put('y', Item.class.getMethod("getLinkTemplate")); 95 _ItemTags.put('g', Item.class.getMethod("getLinePattern")); 96 97 _ItemTags.put('j', Item.class.getMethod("getArrow")); 98 99 _ItemTags.put('v', Item.class.getMethod("getDotType")); 100 _ItemTags.put('z', Item.class.getMethod("getFilled")); 101 102 _ItemTags.put('f', Text.class.getMethod("getFont")); 103 _ItemTags.put('t', Text.class.getMethod("getSpacing")); 112 104 113 105 // TODO set a boolean flag to indicate that the text is a formula 114 106 // Store the formula in the text property NOT the answer 115 _ItemTags.put("J", Item.class.getMethod("getFormula", param)); 116 117 _ItemTags.put("a", Text.class.getMethod("getWordSpacing", param)); 118 _ItemTags.put("b", Text.class.getMethod("getLetterSpacing", param)); 119 _ItemTags.put("m", Text.class.getMethod("getInitialSpacing", param)); 120 _ItemTags.put("w", Text.class.getMethod("getWidthToSave", param)); 121 _ItemTags.put("k", Text.class.getMethod("getJustification", param)); 122 _ItemTags.put("r", Text.class.getMethod("getAutoWrapToSave", param)); 123 124 _ItemTags.put("h", Item.class.getMethod("getThickness", param)); 125 _ItemTags.put("l", Item.class.getMethod("getLineIDs", param)); 126 _ItemTags.put("c", Item.class.getMethod("getConstraintIDs", param)); 127 128 _ItemTags.put("A", Item.class.getMethod("getTooltip", param)); 129 _ItemTags.put("B", Item.class.getMethod("getLinkHistory", param)); 107 _ItemTags.put('J', Item.class.getMethod("getFormula")); 108 109 _ItemTags.put('a', Text.class.getMethod("getWordSpacing")); 110 _ItemTags.put('b', Text.class.getMethod("getLetterSpacing")); 111 _ItemTags.put('m', Text.class.getMethod("getInitialSpacing")); 112 _ItemTags.put('w', Text.class.getMethod("getWidthToSave")); 113 _ItemTags.put('k', Text.class.getMethod("getJustification")); 114 _ItemTags.put('r', Text.class.getMethod("getAutoWrapToSave")); 115 116 _ItemTags.put('h', Item.class.getMethod("getThickness")); 117 _ItemTags.put('l', Item.class.getMethod("getLineIDs")); 118 _ItemTags.put('c', Item.class.getMethod("getConstraintIDs")); 119 120 _ItemTags.put('A', Item.class.getMethod("getTooltip")); 121 _ItemTags.put('B', Item.class.getMethod("getLinkHistory")); 122 123 _ItemTags.put('p', Item.class.getMethod("getPermission")); 130 124 131 125 } catch (Exception e) { -
trunk/src/org/expeditee/io/ExpWriter.java
r603 r737 65 65 66 66 try { 67 _FrameTags.remove( "A");68 _ItemTags.put( "S", Item.class.getMethod("getTypeAndID",67 _FrameTags.remove('A'); 68 _ItemTags.put('S', Item.class.getMethod("getTypeAndID", 69 69 new Class[] {})); 70 70 } catch (Exception e) { … … 107 107 108 108 private void writeHeader(Frame toWrite) throws IOException { 109 Iterator< String> it = _FrameTags.keySet().iterator();109 Iterator<Character> it = _FrameTags.keySet().iterator(); 110 110 Object[] param = {}; 111 111 112 112 while (it.hasNext()) { 113 Stringtag = it.next();113 Character tag = it.next(); 114 114 try { 115 115 Object o = _FrameTags.get(tag).invoke(toWrite, param); 116 116 o = Conversion.ConvertToExpeditee(_FrameTags.get(tag), o); 117 117 if (o != null) { 118 writeLine(tag , o.toString());118 writeLine(tag.toString(), o.toString()); 119 119 } 120 120 } catch (Exception e) { … … 162 162 // lines are saved at the end of the file 163 163 // So dont worry about them in here 164 else165 System.out.println("Unknown Item: " + item.getID());164 // else 165 // System.out.println("Unknown Item: " + item.getID() + " (" + item.getClass().getName() + ")"); 166 166 167 167 writeLine(""); … … 248 248 249 249 private void writeClass(Object toWrite) throws IOException { 250 Iterator< String> it = _ItemTags.keySet().iterator();250 Iterator<Character> it = _ItemTags.keySet().iterator(); 251 251 Object[] param = {}; 252 252 253 253 while (it.hasNext()) { 254 Stringtag = it.next();254 Character tag = it.next(); 255 255 Method toRun = _ItemTags.get(tag); 256 256 Class<?> declarer = toRun.getDeclaringClass(); … … 262 262 if (o instanceof List) { 263 263 for (Object line : (List) o) 264 writeLine(tag , line.toString());264 writeLine(tag.toString(), line.toString()); 265 265 } else 266 writeLine(tag , o.toString());266 writeLine(tag.toString(), o.toString()); 267 267 } 268 268 } catch (Exception e) { -
trunk/src/org/expeditee/io/KMSWriter.java
r362 r737 62 62 63 63 try { 64 _FrameTags.put( "A", Frame.class.getMethod("getName", new Class[] {}));65 _ItemTags.put( "S", Item.class.getMethod("getID", new Class[] {}));64 _FrameTags.put('A', Frame.class.getMethod("getName", new Class[] {})); 65 _ItemTags.put('S', Item.class.getMethod("getID", new Class[] {})); 66 66 } catch (Exception e) { 67 67 … … 100 100 101 101 private void writeHeader(Frame toWrite) throws IOException { 102 Iterator< String> it = _FrameTags.keySet().iterator();102 Iterator<Character> it = _FrameTags.keySet().iterator(); 103 103 Object[] param = {}; 104 104 … … 107 107 108 108 while (it.hasNext()) { 109 Stringtag = it.next();109 Character tag = it.next(); 110 110 try { 111 111 Object o = _FrameTags.get(tag).invoke(toWrite, param); 112 112 o = Conversion.ConvertToExpeditee(_FrameTags.get(tag), o); 113 113 if (o != null) { 114 writeLine(tag , o.toString());114 writeLine(tag.toString(), o.toString()); 115 115 } 116 116 } catch (IllegalArgumentException e) { … … 240 240 241 241 private void writeClass(Object toWrite) throws IOException { 242 Iterator< String> it = _ItemTags.keySet().iterator();242 Iterator<Character> it = _ItemTags.keySet().iterator(); 243 243 Object[] param = {}; 244 244 245 245 while (it.hasNext()) { 246 Stringtag = it.next();246 Character tag = it.next(); 247 247 Method toRun = _ItemTags.get(tag); 248 248 Class<?> declarer = toRun.getDeclaringClass(); … … 254 254 if (o instanceof List) { 255 255 for (Object line : (List) o) 256 writeLine(tag , line.toString());256 writeLine(tag.toString(), line.toString()); 257 257 } else 258 writeLine(tag , o.toString());258 writeLine(tag.toString(), o.toString()); 259 259 } 260 260 } catch (IllegalArgumentException e) { -
trunk/src/org/expeditee/items/Circle.java
r450 r737 320 320 321 321 @Override 322 public void setPermission( UserAppliedPermission p) {323 super.setPermission(p );324 _center.setPermission(p );325 _line.setPermission(p );322 public void setPermission(PermissionPair permissionPair) { 323 super.setPermission(permissionPair); 324 _center.setPermission(permissionPair); 325 _line.setPermission(permissionPair); 326 326 } 327 327 -
trunk/src/org/expeditee/items/Item.java
r729 r737 312 312 private List<String> _actionLeaveFrame = null; 313 313 314 private UserAppliedPermission _permission = UserAppliedPermission.full; 315 316 public void setPermission(UserAppliedPermission permission) { 317 _permission = permission; 318 } 319 320 public UserAppliedPermission getPermission() { 321 return _permission; 314 private PermissionPair _permissionPair = null; 315 316 private UserAppliedPermission _overlayPermission = null; 317 318 public void setOverlayPermission(UserAppliedPermission overlayPermission) { 319 _overlayPermission = overlayPermission; 320 } 321 322 public void setPermission(PermissionPair permissionPair) { 323 _permissionPair = permissionPair; 324 } 325 326 public PermissionPair getPermission() { 327 return _permissionPair; 328 } 329 330 public UserAppliedPermission getUserAppliedPermission() { 331 String owner = _owner != null ? _owner : _parent != null ? _parent.getOwner() : null; 332 if(_permissionPair != null) return _permissionPair.getPermission(owner); 333 if(_overlayPermission != null) return _overlayPermission; 334 if(_parent != null) return _parent.getUserAppliedPermission(); 335 return UserAppliedPermission.full; 322 336 } 323 337 324 338 public boolean hasPermission(UserAppliedPermission permission) { 325 return _permission.ordinal() >= permission.ordinal();339 return getUserAppliedPermission().ordinal() >= permission.ordinal(); 326 340 } 327 341 -
trunk/src/org/expeditee/items/ItemUtils.java
r655 r737 946 946 Color defaultBackground = v.Background; 947 947 UserAppliedPermission permission = v.permission; 948 item.setPermission(permission); 948 // TODO should this be checking if the frame has the 949 // same permissions as the vector 950 // and if so don't set the item's permissions? 951 item.setOverlayPermission(permission); 949 952 950 953 // TODO encapsulate this somewhere inside of circle class! -
trunk/src/org/expeditee/items/Line.java
r559 r737 1230 1230 1231 1231 @Override 1232 public void setPermission( UserAppliedPermission p) {1233 _start.setPermission(p );1234 _end.setPermission(p );1232 public void setPermission(PermissionPair permissionPair) { 1233 _start.setPermission(permissionPair); 1234 _end.setPermission(permissionPair); 1235 1235 } 1236 1236 -
trunk/src/org/expeditee/items/XRayable.java
r720 r737 285 285 286 286 @Override 287 public void setPermission( UserAppliedPermission p) {288 _source.setPermission(p );287 public void setPermission(PermissionPair permissionPair) { 288 _source.setPermission(permissionPair); 289 289 } 290 290 }
Note:
See TracChangeset
for help on using the changeset viewer.