Changeset 1413
- Timestamp:
- 06/25/19 13:57:37 (5 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/encryption/io/EncryptedExpReader.java
r1409 r1413 26 26 import org.expeditee.encryption.items.surrogates.EncryptionDetail; 27 27 import org.expeditee.encryption.items.surrogates.Label; 28 import org.expeditee.encryption.items.surrogates.Surrogate;29 28 import org.expeditee.encryption.items.surrogates.Label.LabelResult; 30 29 import org.expeditee.gui.Frame; … … 37 36 38 37 public class EncryptedExpReader extends ExpReader implements CryptographyConstants { 38 39 39 private static final String ENCRYPTED_EXP_FLAG = "EncryptedExp"; 40 40 private static final String labelProfile = "Profile"; … … 43 43 private boolean accessDenied = false; 44 44 45 public EncryptedExpReader(String frameName) {46 super(frameName);47 }48 49 45 public static boolean isEncryptedExpediteeFile(final String path) throws IOException { 50 46 final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8")); … … 52 48 in.close(); 53 49 return firstLine.startsWith(ENCRYPTED_EXP_FLAG); 50 } 51 52 public EncryptedExpReader(String frameName) { 53 super(frameName); 54 54 } 55 55 … … 132 132 continue; 133 133 } 134 134 135 String tag = getTagEnc(next); 135 if ( tag.equals("S")) {136 if (next.startsWith("S ")) { 136 137 currentItem = newItem(next); 137 138 _linePoints.put(currentItem.getID(), currentItem); 138 139 newFrame.addItem(currentItem); 139 140 currentItem.setEncryptionDetailForTag(tag + "", EncryptionDetail.UnencryptedOnSave); 141 } else if (next.startsWith("SurrogateFor")) { 142 int parentID = Integer.parseInt(next.split(" ")[1]); 143 newFrame.getItemWithID(parentID).addToSurrogates(currentItem); 140 144 } else if (currentItem != null && actionShouldBeDelayed(tag.charAt(0))) { 141 145 delayedActions.add(new DelayedAction(currentItem, next)); … … 147 151 } 148 152 149 if (next.equals( "Z...")) {150 next = readThe SurrogateItems(newFrame, delayedActions);153 if (next.equals(EncryptedExpWriter.SURROGATE_TERMINATOR)) { 154 next = readTheItems(newFrame, delayedActions); 151 155 } 152 156 … … 159 163 String tag = getTagEnc(line); 160 164 String value = getValue(line); 165 166 if (item.isSurrogate() && item.isTagInherited(tag)) { 167 return; 168 } 161 169 162 170 // Attempt to decrypt the line if necessary. … … 192 200 } 193 201 } 194 195 private String readTheSurrogateItems(Frame newFrame, List<DelayedAction> delayedActions) throws IOException {196 String next = null;197 Item currentItem = null;198 199 Predicate<String> endOfSection = s -> s.equals("Z") || s.equals("Z...");200 while (_reader.ready() && !endOfSection.test(next = _reader.readLine())) {201 if (!isValidLine(next)) {202 continue;203 }204 205 String tag = getTagEnc(next);206 if (tag.equals("S") && !next.startsWith("SurrogateFor")) {207 currentItem = newItem(next);208 currentItem.setEncryptionDetailForTag(tag + "", EncryptionDetail.UnencryptedOnSave);209 } else if (next.startsWith("SurrogateFor")) {210 String id = next.split(" ")[1];211 Item classic = newFrame.getItemWithID(Integer.parseInt(id));212 if (id == null) {213 System.err.println("WARNING: Attempted to create surrogate for classic ID " +214 id + " but was no item on frame " + newFrame.getName() + " exists.");215 continue;216 }217 currentItem.setAsSurrogateFor(classic);218 classic.addToSurrogates(new Surrogate(currentItem));219 } else if (currentItem != null && actionShouldBeDelayed(getTag(next))) {220 delayedActions.add(new DelayedAction(currentItem, next));221 } else if (currentItem != null) {222 processBodyLine(currentItem, next);223 } else {224 System.err.println("Error while reading in frame (ExpReader): Found body line but no current item to apply it to.");225 }226 }227 228 return next;229 }230 231 protected static String getTagEnc(String line) {232 char charAtZero = line.charAt(0);233 if (charAtZero == '_') {234 return line.split(" ")[0];235 } else {236 return charAtZero + "";237 }238 }239 202 240 203 protected static String getValue(String line) { … … 247 210 } 248 211 249 protected static boolean isEncryptedLine(String line) { 212 private static String getTagEnc(String line) { 213 char charAtZero = line.charAt(0); 214 if (charAtZero == '_') { 215 return line.split(" ")[0]; 216 } else { 217 return charAtZero + ""; 218 } 219 } 220 221 private static boolean isEncryptedLine(String line) { 250 222 if (line.startsWith("S") || line.startsWith("_el")) { 251 223 return false; … … 278 250 } 279 251 } 280 252 281 253 private class EncryptedLineReader extends BufferedReader { 282 254 private boolean noneMode = false; -
trunk/src/org/expeditee/encryption/io/EncryptedExpWriter.java
r1410 r1413 6 6 import java.security.InvalidKeyException; 7 7 import java.security.NoSuchAlgorithmException; 8 import java.util.ArrayList;9 8 import java.util.Arrays; 10 9 import java.util.Base64; 11 10 import java.util.LinkedHashMap; 12 11 import java.util.List; 13 import java.util.Set; 14 import java.util.function.Consumer; 12 import java.util.function.BinaryOperator; 13 import java.util.function.Function; 14 import java.util.stream.Collectors; 15 15 16 16 import javax.crypto.BadPaddingException; … … 24 24 import org.expeditee.encryption.items.surrogates.EncryptionDetail; 25 25 import org.expeditee.encryption.items.surrogates.Label; 26 import org.expeditee.encryption.items.surrogates.Surrogate;27 26 import org.expeditee.encryption.items.surrogates.Label.LabelResult; 28 27 import org.expeditee.gui.Frame; … … 76 75 77 76 @Override 78 public void outputFrame(Frame frame) throws IOException {79 if (_writer == null) { return; }80 81 preOutputFrame();82 writeHeader(frame);83 84 // write item85 writeItemData(frame);86 writeTerminator();87 88 // write lines and constraints89 writeLineData();90 writeTerminator();91 writeConstraintData();92 writeTerminator();93 94 writeLine(SessionStats.getFrameEventList(frame));95 }96 97 @Override98 77 protected void preOutputFrame() { 99 78 try { … … 107 86 108 87 @Override 88 public void outputFrame(Frame frame) throws IOException { 89 if (_writer == null) { return; } 90 91 preOutputFrame(); 92 writeHeader(frame); 93 94 // write item 95 writeItemData(frame); 96 writeTerminator(); 97 98 // write lines and constraints 99 writeLineData(); 100 writeTerminator(); 101 writeConstraintData(); 102 writeTerminator(); 103 104 writeLine(SessionStats.getFrameEventList(frame)); 105 } 106 107 @Override 109 108 protected void writeLine(String line) throws IOException { 110 109 // do not write empty lines … … 125 124 } 126 125 127 @Override128 protected void writeLineData() throws IOException {129 super.writeLineData();130 131 writeSurrogateLineData();132 }133 134 @Override135 126 protected void writeClass(Item toWrite) throws IOException { 136 127 LinkedHashMap<Character,Method> itemTags = new LinkedHashMap<Character, Method>(getItemTags()); 137 128 LinkedHashMap<String,Method> itemTagsExt = new LinkedHashMap<String, Method>(getItemTagsExt()); 138 129 139 // Perform final update on surrogates to ensure inheritance works.140 Set<Surrogate> surrogates = toWrite.getSurrogates();141 for (Surrogate s: surrogates) {142 s.toString();143 }144 145 130 writeTag(toWrite, new Object[] {}, itemTags, 'S'); 146 131 writeTag(toWrite, new Object[] {}, itemTagsExt, "_el"); 147 132 133 if (toWrite.isSurrogate()) { 134 writeLine("SurrogateFor " + toWrite.getClassic().getID()); 135 } 136 148 137 itemTags.remove('S'); 149 138 itemTagsExt.remove("_el"); 150 139 151 140 writeTags(toWrite, new Object[] {}, itemTags); 152 141 writeTags(toWrite, new Object[] {}, itemTagsExt); … … 155 144 @Override 156 145 protected <T> void writeTag(Item toWrite, Object[] param, LinkedHashMap<T, Method> tags, T tag) { 146 if (toWrite.isSurrogate() && toWrite.isTagInherited(tag + "")) { 147 return; 148 } 157 149 EncryptionDetail encryptionDetail = toWrite.getEncryptionDetailForTag(tag + ""); 158 switch (encryptionDetail) { 150 151 switch(encryptionDetail) { 159 152 case UnencryptedOnSave: 160 super.writeTag(toWrite, param, tags, tag); 153 writeTagUnencryptedOnSave(toWrite, param, tags, tag); 154 break; 155 case InheritanceCheckOnSave: 156 writeTagInheritanceCheckOnSave(toWrite, tags, tag); 161 157 break; 162 158 case ReencryptOnSave: 163 Method toRun = tags.get(tag); 164 Class<?> declarer = toRun.getDeclaringClass(); 165 LabelResult res = Label.resolveKey(toWrite.getEncryptionLabel()); 166 if (declarer.isAssignableFrom(toWrite.getClass()) && res == LabelResult.SuccessResolveLabelToKey) { 167 SecretKey key = new SecretKeySpec(res.key, SymmetricAlgorithm); 168 try { 169 Object o = toRun.invoke(toWrite, new Object[] {}); 170 o = Conversion.ConvertToExpeditee(toRun, o); 171 if (o != null) { 172 if (o instanceof List) { 173 for (Object line: (List<?>)o) { 174 byte[] encryptedBytes = EncryptSymmetric(line.toString().getBytes(), key); 175 writeLine(tag + "E", Base64.getEncoder().encodeToString(encryptedBytes)); 176 } 177 } else { 178 byte[] encryptedBytes = EncryptSymmetric(o.toString().getBytes(), key); 179 writeLine(tag + "E", Base64.getEncoder().encodeToString(encryptedBytes)); 180 } 181 } 182 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { 183 e.printStackTrace(); 184 } catch (IOException e) { 185 e.printStackTrace(); 186 } 187 } 159 writeTagReencryptOnSave(toWrite, tags, tag); 188 160 break; 189 161 case UseUndecipheredValueOnSave: 190 try { 191 writeLine(tag + "E", encryptionDetail.getUndecipheredValue()); 192 } catch (IOException e) { 193 e.printStackTrace(); 194 } 162 writeTagUseUndecipheredValueOnSave(toWrite, tags, tag); 195 163 break; 196 164 } … … 204 172 } 205 173 206 for ( finalItem i: frame.getBodyItemsWithInsufficientPermissions()) {174 for (Item i: frame.getBodyItemsWithInsufficientPermissions()) { 207 175 assert (!(i instanceof Line)); 208 176 writeItem(i); 209 177 } 210 178 211 writeSurrogateItemsData(frame); 212 } 213 214 private void writeSurrogateItemsData(Frame frame) throws IOException { 215 List<Surrogate> surrogates = new ArrayList<Surrogate>(); 216 217 Consumer<? super Item> store = item -> surrogates.addAll(item.getSurrogates()); 218 frame.getItemsToSave().forEach(store); 219 frame.getBodyItemsWithInsufficientPermissions().forEach(store); 220 179 List<Item> surrogates = frame.getSurrogateItemsToSave(); 221 180 if (!surrogates.isEmpty()) { 222 // If there is some surrogates, write the surrogate223 // terminator, then write out the surrogates.224 181 writeSurrogateTerminator(); 225 226 for (Surrogate surrogate: surrogates) { 227 String output = surrogate.toString(); 228 writeLine(output); 229 } 230 } 231 } 232 233 private void writeSurrogateLineData() throws IOException { 234 List<Surrogate> surrogateLines = new ArrayList<Surrogate>(); 235 236 for(Item lineEnd: _lineEnds) { 237 List<Line> lines = lineEnd.getLines(); 238 for (Line line: lines) { 239 surrogateLines.addAll(line.getSurrogates()); 240 } 241 } 242 243 if (!surrogateLines.isEmpty()) { 244 // If there is some surrogates, write the surrogate 245 // terminator, then write out the surrogates. 246 writeSurrogateTerminator(); 247 248 for (Surrogate surrogate: surrogateLines) { 249 String output = surrogate.toString(); 250 writeLine(output); 251 } 252 } 182 for (Item i: surrogates) { 183 assert (!(i instanceof Line)); 184 writeItem(i); 185 } 186 } 187 } 188 189 private <T> void writeTagInheritanceCheckOnSave(Item toWrite, LinkedHashMap<T, Method> tags, T tag) { 190 List<Item> surrogateItems = toWrite.getSurrogates().stream().collect(Collectors.toList()); 191 Function<Item, Boolean> isTagInherited = surrogate -> surrogate.isTagInherited(tag + ""); 192 BinaryOperator<Boolean> trueExists = (a, b) -> a || b; 193 boolean surrogatesInherit = surrogateItems.stream().map(isTagInherited).collect(Collectors.reducing(trueExists)).get(); 194 if (surrogatesInherit && 195 Label.resolveKey(toWrite.getEncryptionLabel()) == LabelResult.SuccessResolveLabelToKey) { 196 toWrite.setEncryptionDetailForTag(tag + "", EncryptionDetail.UnencryptedOnSave); 197 writeTagUnencryptedOnSave(toWrite, new Object[] {}, tags, tag); 198 } else { 199 toWrite.setEncryptionDetailForTag(tag + "", EncryptionDetail.ReencryptOnSave); 200 writeTagReencryptOnSave(toWrite, tags, tag); 201 } 202 } 203 204 private <T> void writeTagReencryptOnSave(Item toWrite, LinkedHashMap<T, Method> tags, T tag) { 205 Method toRun = tags.get(tag); 206 Class<?> declarer = toRun.getDeclaringClass(); 207 LabelResult res = Label.resolveKey(toWrite.getEncryptionLabel()); 208 if (declarer.isAssignableFrom(toWrite.getClass()) && res == LabelResult.SuccessResolveLabelToKey) { 209 try { 210 Object o = toRun.invoke(toWrite, new Object[] {}); 211 o = Conversion.ConvertToExpeditee(toRun, o); 212 if (o == null) { 213 return; 214 } 215 if (o instanceof List) { 216 for (Object line: (List<?>) o) { 217 writeLineEnc(tag, line, res.key); 218 } 219 } else { 220 writeLineEnc(tag, o, res.key); 221 } 222 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { 223 e.printStackTrace(); 224 } catch (IOException e) { 225 e.printStackTrace(); 226 } 227 } 228 } 229 230 private <T> void writeTagUseUndecipheredValueOnSave(Item toWrite, LinkedHashMap<T, Method> tags, T tag) { 231 EncryptionDetail encryptionDetail = toWrite.getEncryptionDetailForTag(tag + ""); 232 try { 233 writeLine(tag + "E", encryptionDetail.getUndecipheredValue()); 234 } catch (IOException e) { 235 e.printStackTrace(); 236 } 237 } 238 239 private <T> void writeTagUnencryptedOnSave(Item toWrite, Object[] param, LinkedHashMap<T, Method> tags, T tag) { 240 super.writeTag(toWrite, param, tags, tag); 253 241 } 254 242 255 243 private void writeSurrogateTerminator() throws IOException { 256 244 writeLine(SURROGATE_TERMINATOR + nl); 245 } 246 247 private <T> void writeLineEnc(T tag, Object line, byte[] keyBytes) throws IOException { 248 SecretKey key = new SecretKeySpec(keyBytes, SymmetricAlgorithm); 249 byte[] lineEncryptedBytes = EncryptSymmetric(line.toString().getBytes(), key); 250 line = Base64.getEncoder().encodeToString(lineEncryptedBytes); 251 writeLine(tag + "E", line.toString()); 257 252 } 258 253 … … 271 266 return null; 272 267 } 273 } 268 } 274 269 } -
trunk/src/org/expeditee/encryption/items/surrogates/EncryptionDetail.java
r1408 r1413 2 2 3 3 public enum EncryptionDetail { 4 UnencryptedOnSave, ReencryptOnSave, UseUndecipheredValueOnSave; 4 // If the property needs to be unencrypted due to inheritance then do not try to encrypt it. 5 UnencryptedOnSave, 6 7 // If the property is not inherited by any surrogates then we can try to encrypt it. 8 // If we do not have key then default to UnencryptedOnSave. 9 ReencryptOnSave, 10 11 // If the property is no longer inherited by at least one surrogate then this value is present. 12 // If it turns out there is no longer any surrogates who inherit the value then this value can be replaced with ReencryptOnSave. 13 // Otherwise, this value must be replaced with UnencryptedOnSave. 14 InheritanceCheckOnSave, 15 16 // If we could not decrypt the value on load then EncryptionDetail.getUndecipheredValue() can be used to get the value for saving. 17 UseUndecipheredValueOnSave; 5 18 6 19 private String undecipheredValue = null; -
trunk/src/org/expeditee/encryption/items/surrogates/Label.java
r1409 r1413 1 1 package org.expeditee.encryption.items.surrogates; 2 2 3 import java.util.ArrayList; 3 4 import java.util.Base64; 4 5 import java.util.Collection; 6 import java.util.List; 7 import java.util.Set; 8 import java.util.stream.Collectors; 5 9 6 10 import org.expeditee.auth.AuthenticatorBrowser; 11 import org.expeditee.gui.DisplayController; 7 12 import org.expeditee.gui.Frame; 8 13 import org.expeditee.gui.FrameIO; 14 import org.expeditee.gui.MessageBay; 15 import org.expeditee.items.Item; 9 16 import org.expeditee.items.Text; 10 17 import org.expeditee.settings.UserSettings; … … 12 19 public class Label { 13 20 21 private static List<LabelResult> labelCache = new ArrayList<LabelResult>(); 22 private static List<String> forbiddenLabels = new ArrayList<String>(); 23 14 24 public static LabelResult resolveKey(String label) { 25 26 if (forbiddenLabels.contains(label)) { 27 return LabelResult.ErrorUnableToFindLabel; 28 } 29 30 LabelResult fromCache = getFromCache(label); 31 if (fromCache != null) { 32 return fromCache; 33 } 34 35 15 36 String credentialsFrameName = UserSettings.ProfileName.get() + 16 37 AuthenticatorBrowser.CREDENTIALS_FRAME; … … 44 65 LabelResult res = LabelResult.SuccessResolveLabelToKey; 45 66 res.key = Base64.getDecoder().decode(data); 67 res.name = label; 68 labelCache.add(res); 46 69 return res; 47 70 } catch (IllegalArgumentException e) { … … 50 73 } 51 74 } 75 76 public static void progressSurrogateMode() { 77 Collection<Item> allItems = DisplayController.getCurrentFrame().getAllItems(); 78 allItems.removeIf(item -> item.getEncryptionLabel() == null); 79 MessageBay.displayMessage("Encryption labels found on items on current frame: "); 80 Set<String> allLabels = allItems.stream().map(i -> i.getEncryptionLabel()).collect(Collectors.toSet()); 81 StringBuilder sb = new StringBuilder(); 82 for (String label: allLabels) { 83 sb.append(label + ","); 84 } 85 MessageBay.displayMessage(sb.deleteCharAt(sb.length() - 1).toString()); 86 } 87 88 public static void resetSurrogateMode() { 89 // TODO Auto-generated method stub 90 91 } 92 93 private static LabelResult getFromCache(String label) { 94 List<LabelResult> cacheCanditates = labelCache.stream().filter(labelResult -> labelResult.name.equals(label)).collect(Collectors.toList()); 95 if (!cacheCanditates.isEmpty()) { 96 return cacheCanditates.get(0); 97 } else { 98 return null; 99 } 100 } 101 102 // private static List<List<String>> permutation(List<String> strings, List<List<String>> acc) { 103 // for (int i = 0; i < strings.size(); i++) { 104 // 105 // } 106 // } 52 107 53 108 public enum LabelResult { … … 58 113 59 114 public byte[] key; 115 public String name; 60 116 61 117 @Override -
trunk/src/org/expeditee/gio/gesture/ExpediteeKBMGestureTranslator.java
r1186 r1413 698 698 699 699 // Return the gesture 700 return Gesture.single(StandardGestureActions.getInstance().gestureType(StandardGestureType.TOGGLE_XRAY_MODE), null); 700 if (kbmTranslator.isKeyDown(Key.SHIFT)) { 701 UndoGestureData data = new UndoGestureData(kbmTranslator.isKeyDown(Key.CTRL)); 702 return Gesture.single(StandardGestureActions.getInstance().gestureType(StandardGestureType.TOGGLE_SURROGATE_MODE), data); 703 } else { 704 return Gesture.single(StandardGestureActions.getInstance().gestureType(StandardGestureType.TOGGLE_XRAY_MODE), null); 705 } 701 706 } 702 707 }); -
trunk/src/org/expeditee/gio/gesture/StandardGestureActions.java
r1406 r1413 123 123 TOGGLE_ITEMS_MARK, // Show/hide the little circle indicating the item has a link and/or action 124 124 TOGGLE_XRAY_MODE, // F10 125 TOGGLE_SURROGATE_MODE, // Shift + F10 125 126 UNDO, 126 127 ZOOM … … 965 966 } 966 967 }); 968 969 setGestureAction(gestureType(StandardGestureType.TOGGLE_SURROGATE_MODE), new GestureAction() { 970 @Override 971 public void exec(Gesture gesture) { 972 if (((UndoGestureData) gesture.getData()).getRedo()) { 973 DisplayController.ResetSurrogateMode(); 974 } else { 975 DisplayController.ToggleSurrogateMode(); 976 } 977 } 978 }); 967 979 968 980 } -
trunk/src/org/expeditee/gui/DisplayController.java
r1363 r1413 42 42 import org.expeditee.core.bounds.AxisAlignedBoxBounds; 43 43 import org.expeditee.core.bounds.Bounds; 44 import org.expeditee.encryption.items.surrogates.Label; 44 45 import org.expeditee.gio.EcosystemManager; 45 46 import org.expeditee.gio.GraphicsManager; … … 1228 1229 } 1229 1230 1231 public static void ToggleSurrogateMode() { 1232 // Turn off x-ray mode if it is on 1233 if (_audienceMode) { 1234 ToggleAudienceMode(); 1235 } 1236 1237 Label.progressSurrogateMode(); 1238 1239 getCurrentFrame().parse(); 1240 getCurrentFrame().refreshSize(); 1241 updateTitle(); 1242 StandardGestureActions.refreshHighlights(); 1243 StandardGestureActions.updateCursor(); 1244 requestRefresh(false); 1245 } 1246 1247 public static void ResetSurrogateMode() { 1248 // Turn off x-ray mode if it is on 1249 if (_audienceMode) { 1250 ToggleAudienceMode(); 1251 } 1252 1253 Label.resetSurrogateMode(); 1254 1255 getCurrentFrame().parse(); 1256 getCurrentFrame().refreshSize(); 1257 updateTitle(); 1258 StandardGestureActions.refreshHighlights(); 1259 StandardGestureActions.updateCursor(); 1260 requestRefresh(false); 1261 } 1262 1230 1263 /** Whether audience mode is currently on. */ 1231 1264 public static boolean isAudienceMode() -
trunk/src/org/expeditee/gui/Frame.java
r1408 r1413 2554 2554 * @return the list of items to be saved to a text file 2555 2555 */ 2556 public List<Item> getItemsToSave() 2557 { 2556 public List<Item> getItemsToSave() { 2558 2557 if (!_sorted) { 2559 2558 Collections.sort(_body); … … 2595 2594 2596 2595 return toSave; 2596 } 2597 2598 public List<Item> getSurrogateItemsToSave() { 2599 List<Item> surrogates = new ArrayList<Item>(); 2600 _body.forEach(item -> surrogates.addAll(item.getSurrogates())); 2601 return surrogates; 2597 2602 } 2598 2603 -
trunk/src/org/expeditee/gui/FrameGraphics.java
r1410 r1413 32 32 import org.expeditee.core.Image; 33 33 import org.expeditee.core.bounds.PolygonBounds; 34 import org.expeditee.encryption.items.surrogates.Label.LabelResult;35 import org.expeditee.encryption.items.surrogates.Label;36 import org.expeditee.encryption.items.surrogates.Surrogate;37 34 import org.expeditee.gio.EcosystemManager; 38 35 import org.expeditee.gio.input.KBMInputEvent.Key; … … 457 454 if (i == null) { 458 455 return; 459 }460 461 String encryptionLabel = i.getEncryptionLabel();462 if (encryptionLabel != null && encryptionLabel.length() > 0 && !i.isSurrogate()) {463 LabelResult result = Label.resolveKey(encryptionLabel);464 if (result != LabelResult.SuccessResolveLabelToKey) {465 for(Surrogate s: i.getSurrogates()) {466 PaintItem(s.getSurrogateItem());467 }468 return;469 }470 456 } 471 457 -
trunk/src/org/expeditee/io/DefaultFrameReader.java
r1408 r1413 99 99 100 100 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters. 101 _ItemTags.put( 'S', Item.class.getMethod("setID", pInt));102 _ItemTags.put( 's', Item.class.getMethod("setDateCreated", pString));103 _ItemTags.put( 'd', Item.class.getMethod("setColor", pColor));104 _ItemTags.put( 'G', Item.class.getMethod("setBackgroundColor",101 _ItemTags.put(DefaultFrameWriter.TYPE_AND_ID, Item.class.getMethod("setID", pInt)); 102 _ItemTags.put(DefaultFrameWriter.DATE_CREATED, Item.class.getMethod("setDateCreated", pString)); 103 _ItemTags.put(DefaultFrameWriter.COLOR, Item.class.getMethod("setColor", pColor)); 104 _ItemTags.put(DefaultFrameWriter.BACKGROUND_COLOR, Item.class.getMethod("setBackgroundColor", 105 105 pColor)); 106 _ItemTags.put( 'K', Item.class.getMethod("setBorderColor",106 _ItemTags.put(DefaultFrameWriter.BORDER_COLOR, Item.class.getMethod("setBorderColor", 107 107 pColor)); 108 108 109 _ItemTags.put( 'R', Item.class.getMethod("setAnchorLeft", pIntO));110 _ItemTags.put( 'H', Item.class.getMethod("setAnchorRight", pIntO));111 _ItemTags.put( 'N', Item.class.getMethod("setAnchorTop", pIntO));112 _ItemTags.put( 'I', Item.class.getMethod("setAnchorBottom", pIntO));113 114 _ItemTags.put( 'P', Item.class.getMethod("setPosition", pPoint));115 _ItemTags.put( 'F', Item.class.getMethod("setLink", pString));116 _ItemTags.put( 'J', Item.class.getMethod("setFormula", pString));117 118 _ItemTags.put( 'X', Item.class.getMethod("setActions", pList));119 _ItemTags.put( 'x', Item.class.getMethod("setActionMark", pBool));120 _ItemTags.put( 'U', Item.class.getMethod("setActionCursorEnter",121 pList)); 122 _ItemTags.put( 'V', Item.class.getMethod("setActionCursorLeave",123 pList)); 124 _ItemTags.put( 'W', Item.class.getMethod("setActionEnterFrame",125 pList)); 126 _ItemTags.put( 'Y', Item.class.getMethod("setActionLeaveFrame",127 pList)); 128 _ItemTags.put( 'D', Item.class.getMethod("addToData", pString));129 _ItemTags.put( 'u', Item.class.getMethod("setHighlight", pBool));130 _ItemTags.put( 'e', Item.class.getMethod("setFillColor", pColor));131 _ItemTags.put( 'E', Item.class.getMethod("setGradientColor", pColor));132 _ItemTags.put( 'Q', Item.class.getMethod("setGradientAngle", pDouble));133 134 _ItemTags.put( 'i', Item.class.getMethod("setFillPattern", pString));135 _ItemTags.put( 'o', Item.class.getMethod("setOwner", pString));136 _ItemTags.put( 'n', Item.class.getMethod("setLinkMark", pBool));109 _ItemTags.put(DefaultFrameWriter.ANCHOR_LEFT, Item.class.getMethod("setAnchorLeft", pIntO)); 110 _ItemTags.put(DefaultFrameWriter.ANCHOR_RIGHT, Item.class.getMethod("setAnchorRight", pIntO)); 111 _ItemTags.put(DefaultFrameWriter.ANCHOR_TOP, Item.class.getMethod("setAnchorTop", pIntO)); 112 _ItemTags.put(DefaultFrameWriter.ANCHOR_BOTTOM, Item.class.getMethod("setAnchorBottom", pIntO)); 113 114 _ItemTags.put(DefaultFrameWriter.POSITION, Item.class.getMethod("setPosition", pPoint)); 115 _ItemTags.put(DefaultFrameWriter.LINK, Item.class.getMethod("setLink", pString)); 116 _ItemTags.put(DefaultFrameWriter.FORMULA, Item.class.getMethod("setFormula", pString)); 117 118 _ItemTags.put(DefaultFrameWriter.ACTION, Item.class.getMethod("setActions", pList)); 119 _ItemTags.put(DefaultFrameWriter.ACTION_MARK, Item.class.getMethod("setActionMark", pBool)); 120 _ItemTags.put(DefaultFrameWriter.ACTION_CURSOR_ENTER, Item.class.getMethod("setActionCursorEnter", 121 pList)); 122 _ItemTags.put(DefaultFrameWriter.ACTION_CURSOR_LEAVE, Item.class.getMethod("setActionCursorLeave", 123 pList)); 124 _ItemTags.put(DefaultFrameWriter.ACTION_ENTER_FRAME, Item.class.getMethod("setActionEnterFrame", 125 pList)); 126 _ItemTags.put(DefaultFrameWriter.ACTION_LEAVE_FRAME, Item.class.getMethod("setActionLeaveFrame", 127 pList)); 128 _ItemTags.put(DefaultFrameWriter.DATA, Item.class.getMethod("addToData", pString)); 129 _ItemTags.put(DefaultFrameWriter.HIGHLIGHT, Item.class.getMethod("setHighlight", pBool)); 130 _ItemTags.put(DefaultFrameWriter.FILL_COLOR, Item.class.getMethod("setFillColor", pColor)); 131 _ItemTags.put(DefaultFrameWriter.GRADIENT_COLOR, Item.class.getMethod("setGradientColor", pColor)); 132 _ItemTags.put(DefaultFrameWriter.GRADIENT_ANGLE, Item.class.getMethod("setGradientAngle", pDouble)); 133 134 _ItemTags.put(DefaultFrameWriter.FILL_PATTERN, Item.class.getMethod("setFillPattern", pString)); 135 _ItemTags.put(DefaultFrameWriter.OWNER, Item.class.getMethod("setOwner", pString)); 136 _ItemTags.put(DefaultFrameWriter.LINK_MARK, Item.class.getMethod("setLinkMark", pBool)); 137 137 _ItemTags 138 .put( 'q', Item.class.getMethod("setLinkFrameset", pString));138 .put(DefaultFrameWriter.LINK_FRAMESET, Item.class.getMethod("setLinkFrameset", pString)); 139 139 _ItemTags 140 .put( 'y', Item.class.getMethod("setLinkTemplate", pString));141 _ItemTags.put( 'g', Item.class.getMethod("setLinePattern", pIntArray));142 143 _ItemTags.put( 'j', Item.class.getMethod("setArrow", pArrow));144 145 _ItemTags.put( 'v', Dot.class.getMethod("setDotType", pDotType));146 _ItemTags.put( 'z', Dot.class.getMethod("setFilled", pBool));147 148 _ItemTags.put( 'f', Text.class.getMethod("setFont", pFont));149 _ItemTags.put( 't', Text.class.getMethod("setSpacing", pFloat));150 _ItemTags.put( 'T', Text.class.getMethod("appendLine", pString));151 _ItemTags.put( 'a', Text.class.getMethod("setWordSpacing", pInt));152 _ItemTags.put( 'b', Text.class.getMethod("setLetterSpacing", pFloat));153 _ItemTags.put( 'm', Text.class.getMethod("setInitialSpacing", pFloat));154 _ItemTags.put( 'w', Text.class.getMethod("setWidth", pIntO));155 _ItemTags.put( 'M', Text.class.getMethod("setMinWidth", pIntO));156 _ItemTags.put( 'k', Text.class.getMethod("setJustification", pJustification));157 _ItemTags.put( 'r', Text.class.getMethod("setAutoWrap", pBool));158 159 _ItemTags.put( 'h', Item.class.getMethod("setThickness", pFloat));160 _ItemTags.put( 'l', Item.class.getMethod("setLineIDs", pString));161 _ItemTags.put( 'c', Item.class.getMethod("setConstraintIDs", pString));162 163 _ItemTags.put( 'A', Item.class.getMethod("setTooltip", pString));164 _ItemTags.put( 'B', Item.class.getMethod("setLinkHistory", pBool));165 166 _ItemTags.put( 'p', Item.class.getMethod("setPermission", pPermission));167 168 _ItemTags.put( 'O', Text.class.getMethod("setMask", pIntO));140 .put(DefaultFrameWriter.LINK_TEMPLATE, Item.class.getMethod("setLinkTemplate", pString)); 141 _ItemTags.put(DefaultFrameWriter.LINE_PATTERN, Item.class.getMethod("setLinePattern", pIntArray)); 142 143 _ItemTags.put(DefaultFrameWriter.ARROW, Item.class.getMethod("setArrow", pArrow)); 144 145 _ItemTags.put(DefaultFrameWriter.DOT_TYPE, Dot.class.getMethod("setDotType", pDotType)); 146 _ItemTags.put(DefaultFrameWriter.FILLED, Dot.class.getMethod("setFilled", pBool)); 147 148 _ItemTags.put(DefaultFrameWriter.FONT, Text.class.getMethod("setFont", pFont)); 149 _ItemTags.put(DefaultFrameWriter.SPACING, Text.class.getMethod("setSpacing", pFloat)); 150 _ItemTags.put(DefaultFrameWriter.TEXT, Text.class.getMethod("appendLine", pString)); 151 _ItemTags.put(DefaultFrameWriter.WORD_SPACING, Text.class.getMethod("setWordSpacing", pInt)); 152 _ItemTags.put(DefaultFrameWriter.LETTER_SPACING, Text.class.getMethod("setLetterSpacing", pFloat)); 153 _ItemTags.put(DefaultFrameWriter.INITIAL_SPACING, Text.class.getMethod("setInitialSpacing", pFloat)); 154 _ItemTags.put(DefaultFrameWriter.WIDTH_TO_SAVE, Text.class.getMethod("setWidth", pIntO)); 155 _ItemTags.put(DefaultFrameWriter.MIN_WIDTH_TO_SAVE, Text.class.getMethod("setMinWidth", pIntO)); 156 _ItemTags.put(DefaultFrameWriter.JUSTIFICATION, Text.class.getMethod("setJustification", pJustification)); 157 _ItemTags.put(DefaultFrameWriter.AUTO_WRAP_TO_SAVE, Text.class.getMethod("setAutoWrap", pBool)); 158 159 _ItemTags.put(DefaultFrameWriter.THICKNESS, Item.class.getMethod("setThickness", pFloat)); 160 _ItemTags.put(DefaultFrameWriter.LINE_IDS, Item.class.getMethod("setLineIDs", pString)); 161 _ItemTags.put(DefaultFrameWriter.CONSTRAINT_IDS, Item.class.getMethod("setConstraintIDs", pString)); 162 163 _ItemTags.put(DefaultFrameWriter.TOOLTIP, Item.class.getMethod("setTooltip", pString)); 164 _ItemTags.put(DefaultFrameWriter.LINK_HISTORY, Item.class.getMethod("setLinkHistory", pBool)); 165 166 _ItemTags.put(DefaultFrameWriter.PERMISSION, Item.class.getMethod("setPermission", pPermission)); 167 168 _ItemTags.put(DefaultFrameWriter.MASK, Text.class.getMethod("setMask", pIntO)); 169 169 170 170 // Lines and constraints are created differently … … 172 172 _ItemTags.put('C', Constraint.class.getMethod("getID", (Class[]) null)); 173 173 174 _ItemTags.put( '[', Item.class.getMethod("setMagnetizedItemLeft", pInt));174 _ItemTags.put(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT, Item.class.getMethod("setMagnetizedItemLeft", pInt)); 175 175 _DelayedItemTags.add('['); 176 _ItemTags.put( ']', Item.class.getMethod("setMagnetizedItemRight", pInt));176 _ItemTags.put(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT, Item.class.getMethod("setMagnetizedItemRight", pInt)); 177 177 _DelayedItemTags.add(']'); 178 _ItemTags.put( '^', Item.class.getMethod("setMagnetizedItemTop", pInt));178 _ItemTags.put(DefaultFrameWriter.MAGNETIZED_ITEM_TOP, Item.class.getMethod("setMagnetizedItemTop", pInt)); 179 179 _DelayedItemTags.add('^'); 180 _ItemTags.put( '/', Item.class.getMethod("setMagnetizedItemBottom", pInt));180 _ItemTags.put(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM, Item.class.getMethod("setMagnetizedItemBottom", pInt)); 181 181 _DelayedItemTags.add('/'); 182 182 183 _ItemTagsExt.put( "_el", Item.class.getMethod("setEncryptionLabelOnLoad", pString));184 185 _ItemTagsExt.put( "_ph", Text.class.getMethod("setPlaceholder", pString));186 _ItemTagsExt.put( "_sl", Text.class.getMethod("setSingleLineOnly", pBool));187 _ItemTagsExt.put( "_ti", Text.class.getMethod("setTabIndex", pInt));183 _ItemTagsExt.put(DefaultFrameWriter.ENCRYPTION_LABEL_STR, Item.class.getMethod("setEncryptionLabelOnLoad", pString)); 184 185 _ItemTagsExt.put(DefaultFrameWriter.PLACEHOLDER_STR, Text.class.getMethod("setPlaceholder", pString)); 186 _ItemTagsExt.put(DefaultFrameWriter.SINGLE_LINE_ONLY_STR, Text.class.getMethod("setSingleLineOnly", pBool)); 187 _ItemTagsExt.put(DefaultFrameWriter.TAB_INDEX_STR, Text.class.getMethod("setTabIndex", pInt)); 188 188 } catch (Exception e) { 189 189 e.printStackTrace(); -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r1410 r1413 41 41 public abstract class DefaultFrameWriter extends ItemWriter implements 42 42 FrameWriter { 43 44 public static final String TAB_INDEX = "_ti"; 45 public static final String SINGLE_LINE_ONLY = "_sl"; 46 public static final String PLACEHOLDER = "_ph"; 47 public static final String ENCRYPTION_LABEL = "_el"; 48 public static final char MAGNETIZED_ITEM_BOTTOM = '/'; 49 public static final char MAGNETIZED_ITEM_TOP = '^'; 50 public static final char MAGNETIZED_ITEM_RIGHT = ']'; 51 public static final char MAGNETIZED_ITEM_LEFT = '['; 52 public static final char PERMISSION = 'p'; 53 public static final char LINK_HISTORY = 'B'; 54 public static final char TOOLTIP = 'A'; 55 public static final char CONSTRAINT_IDS = 'c'; 56 public static final char LINE_IDS = 'l'; 57 public static final char THICKNESS = 'h'; 58 public static final char AUTO_WRAP_TO_SAVE = 'r'; 59 public static final char JUSTIFICATION = 'k'; 60 public static final char MIN_WIDTH_TO_SAVE = 'M'; 61 public static final char WIDTH_TO_SAVE = 'w'; 62 public static final char INITIAL_SPACING = 'm'; 63 public static final char LETTER_SPACING = 'b'; 64 public static final char WORD_SPACING = 'a'; 65 public static final char FORMULA = 'J'; 66 public static final char MASK = 'O'; 67 public static final char SPACING = 't'; 68 public static final char FONT = 'f'; 69 public static final char FILLED = 'z'; 70 public static final char DOT_TYPE = 'v'; 71 public static final char ARROW = 'j'; 72 public static final char LINE_PATTERN = 'g'; 73 public static final char LINK_TEMPLATE = 'y'; 74 public static final char LINK_FRAMESET = 'q'; 75 public static final char LINK_MARK = 'n'; 76 public static final char OWNER = 'o'; 77 public static final char FILL_PATTERN = 'i'; 78 public static final char ANCHOR_BOTTOM = 'I'; 79 public static final char ANCHOR_TOP = 'N'; 80 public static final char ANCHOR_RIGHT = 'H'; 81 public static final char ANCHOR_LEFT = 'R'; 82 public static final char GRADIENT_ANGLE = 'Q'; 83 public static final char GRADIENT_COLOR = 'E'; 84 public static final char FILL_COLOR = 'e'; 85 public static final char HIGHLIGHT = 'u'; 86 public static final char DATA = 'D'; 87 public static final char ACTION_LEAVE_FRAME = 'Y'; 88 public static final char ACTION_ENTER_FRAME = 'W'; 89 public static final char ACTION_CURSOR_LEAVE = 'V'; 90 public static final char ACTION_CURSOR_ENTER = 'U'; 91 public static final char ACTION_MARK = 'x'; 92 public static final char ACTION = 'X'; 93 public static final char LINK = 'F'; 94 public static final char TEXT = 'T'; 95 public static final char POSITION = 'P'; 96 public static final char BORDER_COLOR = 'K'; 97 public static final char BACKGROUND_COLOR = 'G'; 98 public static final char COLOR = 'd'; 99 public static final char DATE_CREATED = 's'; 100 public static final char TYPE_AND_ID = 'S'; 43 protected static final char MAGNETIZED_ITEM_BOTTOM = '/'; 44 protected static final char MAGNETIZED_ITEM_TOP = '^'; 45 protected static final char MAGNETIZED_ITEM_RIGHT = ']'; 46 protected static final char MAGNETIZED_ITEM_LEFT = '['; 47 protected static final char PERMISSION = 'p'; 48 protected static final char LINK_HISTORY = 'B'; 49 protected static final char TOOLTIP = 'A'; 50 protected static final char CONSTRAINT_IDS = 'c'; 51 protected static final char LINE_IDS = 'l'; 52 protected static final char THICKNESS = 'h'; 53 protected static final char AUTO_WRAP_TO_SAVE = 'r'; 54 protected static final char JUSTIFICATION = 'k'; 55 protected static final char MIN_WIDTH_TO_SAVE = 'M'; 56 protected static final char WIDTH_TO_SAVE = 'w'; 57 protected static final char INITIAL_SPACING = 'm'; 58 protected static final char LETTER_SPACING = 'b'; 59 protected static final char WORD_SPACING = 'a'; 60 protected static final char FORMULA = 'J'; 61 protected static final char MASK = 'O'; 62 protected static final char SPACING = 't'; 63 protected static final char FONT = 'f'; 64 protected static final char FILLED = 'z'; 65 protected static final char DOT_TYPE = 'v'; 66 protected static final char ARROW = 'j'; 67 protected static final char LINE_PATTERN = 'g'; 68 protected static final char LINK_TEMPLATE = 'y'; 69 protected static final char LINK_FRAMESET = 'q'; 70 protected static final char LINK_MARK = 'n'; 71 protected static final char OWNER = 'o'; 72 protected static final char FILL_PATTERN = 'i'; 73 protected static final char ANCHOR_BOTTOM = 'I'; 74 protected static final char ANCHOR_TOP = 'N'; 75 protected static final char ANCHOR_RIGHT = 'H'; 76 protected static final char ANCHOR_LEFT = 'R'; 77 protected static final char GRADIENT_ANGLE = 'Q'; 78 protected static final char GRADIENT_COLOR = 'E'; 79 protected static final char FILL_COLOR = 'e'; 80 protected static final char HIGHLIGHT = 'u'; 81 protected static final char DATA = 'D'; 82 protected static final char ACTION_LEAVE_FRAME = 'Y'; 83 protected static final char ACTION_ENTER_FRAME = 'W'; 84 protected static final char ACTION_CURSOR_LEAVE = 'V'; 85 protected static final char ACTION_CURSOR_ENTER = 'U'; 86 protected static final char ACTION_MARK = 'x'; 87 protected static final char ACTION = 'X'; 88 protected static final char LINK = 'F'; 89 protected static final char TEXT = 'T'; 90 protected static final char POSITION = 'P'; 91 protected static final char BORDER_COLOR = 'K'; 92 protected static final char BACKGROUND_COLOR = 'G'; 93 protected static final char COLOR = 'd'; 94 protected static final char DATE_CREATED = 's'; 95 protected static final char TYPE_AND_ID = 'S'; 96 97 public static final String TAB_INDEX_STR = "_ti"; 98 public static final String SINGLE_LINE_ONLY_STR = "_sl"; 99 public static final String PLACEHOLDER_STR = "_ph"; 100 public static final String ENCRYPTION_LABEL_STR = "_el"; 101 public static final String MAGNETIZED_ITEM_BOTTOM_STR = MAGNETIZED_ITEM_BOTTOM + ""; 102 public static final String MAGNETIZED_ITEM_TOP_STR = MAGNETIZED_ITEM_TOP + ""; 103 public static final String MAGNETIZED_ITEM_RIGHT_STR = MAGNETIZED_ITEM_RIGHT + ""; 104 public static final String MAGNETIZED_ITEM_LEFT_STR = MAGNETIZED_ITEM_LEFT + ""; 105 public static final String PERMISSION_STR = PERMISSION + ""; 106 public static final String LINK_HISTORY_STR = LINK_HISTORY + ""; 107 public static final String TOOLTIP_STR = TOOLTIP + ""; 108 public static final String CONSTRAINT_IDS_STR = CONSTRAINT_IDS + ""; 109 public static final String LINE_IDS_STR = LINE_IDS + ""; 110 public static final String THICKNESS_STR = THICKNESS + ""; 111 public static final String AUTO_WRAP_TO_SAVE_STR = AUTO_WRAP_TO_SAVE + ""; 112 public static final String JUSTIFICATION_STR = JUSTIFICATION + ""; 113 public static final String MIN_WIDTH_TO_SAVE_STR = MIN_WIDTH_TO_SAVE + ""; 114 public static final String WIDTH_TO_SAVE_STR = WIDTH_TO_SAVE + ""; 115 public static final String INITIAL_SPACING_STR = INITIAL_SPACING + ""; 116 public static final String LETTER_SPACING_STR = LETTER_SPACING + ""; 117 public static final String WORD_SPACING_STR = WORD_SPACING + ""; 118 public static final String FORMULA_STR = FORMULA + ""; 119 public static final String MASK_STR = MASK + ""; 120 public static final String SPACING_STR = SPACING + ""; 121 public static final String FONT_STR = FONT + ""; 122 public static final String FILLED_STR = FILLED + ""; 123 public static final String DOT_TYPE_STR = DOT_TYPE + ""; 124 public static final String ARROW_STR = ARROW + ""; 125 public static final String LINE_PATTERN_STR = LINE_PATTERN + ""; 126 public static final String LINK_TEMPLATE_STR = LINK_TEMPLATE + ""; 127 public static final String LINK_FRAMESET_STR = LINK_FRAMESET + ""; 128 public static final String LINK_MARK_STR = LINK_MARK + ""; 129 public static final String OWNER_STR = OWNER + ""; 130 public static final String FILL_PATTERN_STR = FILL_PATTERN + ""; 131 public static final String ANCHOR_BOTTOM_STR = ANCHOR_BOTTOM + ""; 132 public static final String ANCHOR_TOP_STR = ANCHOR_TOP + ""; 133 public static final String ANCHOR_RIGHT_STR = ANCHOR_RIGHT + ""; 134 public static final String ANCHOR_LEFT_STR = ANCHOR_LEFT + ""; 135 public static final String GRADIENT_ANGLE_STR = GRADIENT_ANGLE + ""; 136 public static final String GRADIENT_COLOR_STR = GRADIENT_COLOR + ""; 137 public static final String FILL_COLOR_STR = FILL_COLOR + ""; 138 public static final String HIGHLIGHT_STR = HIGHLIGHT + ""; 139 public static final String DATA_STR = DATA + ""; 140 public static final String ACTION_LEAVE_FRAME_STR = ACTION_LEAVE_FRAME + ""; 141 public static final String ACTION_ENTER_FRAME_STR = ACTION_ENTER_FRAME + ""; 142 public static final String ACTION_CURSOR_LEAVE_STR = ACTION_CURSOR_LEAVE + ""; 143 public static final String ACTION_CURSOR_ENTER_STR = ACTION_CURSOR_ENTER + ""; 144 public static final String ACTION_MARK_STR = ACTION_MARK + ""; 145 public static final String ACTION_STR = ACTION + ""; 146 public static final String LINK_STR = LINK + ""; 147 public static final String TEXT_STR = TEXT + ""; 148 public static final String POSITION_STR = POSITION + ""; 149 public static final String BORDER_COLOR_STR = BORDER_COLOR + ""; 150 public static final String BACKGROUND_COLOR_STR = BACKGROUND_COLOR + ""; 151 public static final String COLOR_STR = COLOR + ""; 152 public static final String DATE_CREATED_STR = DATE_CREATED + ""; 153 public static final String TYPE_AND_ID_STR = TYPE_AND_ID + ""; 101 154 102 155 protected String _filename = null; … … 113 166 114 167 // keep track of methods that are put on the same line 115 private static LinkedHashMap<Character, Method> _ItemTags = n ull;168 private static LinkedHashMap<Character, Method> _ItemTags = new LinkedHashMap<Character, Method>(); 116 169 // IMPORTANT: keys in _ItemTagsExt must start with underscore as their first character 117 private static LinkedHashMap<String, Method> _ItemTagsExt = null; 118 119 protected static LinkedHashMap<Character, Method> _FrameTags = null; 120 121 public DefaultFrameWriter() { 122 123 if (_ItemTags != null && _FrameTags != null) 124 return; 125 126 _ItemTags = new LinkedHashMap<Character, Method>(); 127 _ItemTagsExt = new LinkedHashMap<String, Method>(); 128 _FrameTags = new LinkedHashMap<Character, Method>(); 129 170 private static LinkedHashMap<String, Method> _ItemTagsExt = new LinkedHashMap<String, Method>(); 171 172 protected static LinkedHashMap<Character, Method> _FrameTags = new LinkedHashMap<Character, Method>(); 173 174 { 130 175 try { 131 176 _FrameTags.put('V', Frame.class.getMethod("getVersion")); … … 213 258 _ItemTags.put(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM, Item.class.getMethod("getMagnetizedItemBottom")); 214 259 215 _ItemTagsExt.put(DefaultFrameWriter.ENCRYPTION_LABEL , Item.class.getMethod("getEncryptionLabel"));216 217 _ItemTagsExt.put(DefaultFrameWriter.PLACEHOLDER , Text.class.getMethod("getPlaceholder"));218 _ItemTagsExt.put(DefaultFrameWriter.SINGLE_LINE_ONLY , Text.class.getMethod("isSingleLineOnly"));219 _ItemTagsExt.put(DefaultFrameWriter.TAB_INDEX , Text.class.getMethod("getTabIndex"));260 _ItemTagsExt.put(DefaultFrameWriter.ENCRYPTION_LABEL_STR, Item.class.getMethod("getEncryptionLabel")); 261 262 _ItemTagsExt.put(DefaultFrameWriter.PLACEHOLDER_STR, Text.class.getMethod("getPlaceholder")); 263 _ItemTagsExt.put(DefaultFrameWriter.SINGLE_LINE_ONLY_STR, Text.class.getMethod("isSingleLineOnly")); 264 _ItemTagsExt.put(DefaultFrameWriter.TAB_INDEX_STR, Text.class.getMethod("getTabIndex")); 220 265 } catch (Exception e) { 221 266 e.printStackTrace(); 222 267 } 268 } 269 270 public DefaultFrameWriter() { 271 272 223 273 } 224 274 -
trunk/src/org/expeditee/items/Item.java
r1412 r1413 48 48 import org.expeditee.core.bounds.PolygonBounds; 49 49 import org.expeditee.encryption.items.surrogates.EncryptionDetail; 50 import org.expeditee.encryption.items.surrogates.Surrogate;50 //import org.expeditee.encryption.items.surrogates.Surrogate; 51 51 import org.expeditee.gio.EcosystemManager; 52 52 import org.expeditee.gio.GraphicsManager; … … 319 319 320 320 private Item surrogateFor = null; 321 private Set<Surrogate> surrogateItems = new HashSet<Surrogate>(); 322 private Map<String, EncryptionDetail> propertyEncryption = new HashMap<String, EncryptionDetail>(); 321 private Set<Item> surrogateItems = new HashSet<Item>(); 322 private static Map<String, EncryptionDetail> classicPropertyEncryptionDefault = new HashMap<String, EncryptionDetail>(); 323 private static Map<String, Boolean> surrogatePropertyInheritanceDefault = new HashMap<String, Boolean>(); 324 protected Map<String, EncryptionDetail> classicPropertyEncryption = new HashMap<String, EncryptionDetail>(classicPropertyEncryptionDefault); 325 protected Map<String, Boolean> surrogatePropertyInheritance = new HashMap<String, Boolean>(surrogatePropertyInheritanceDefault); 326 327 { 328 for(Character tag: DefaultFrameWriter.getItemTags().keySet()) { 329 if (tag == 'T' || tag == 'S') { 330 surrogatePropertyInheritanceDefault.put(tag + "", false); 331 } else { 332 surrogatePropertyInheritanceDefault.put(tag + "", true); 333 } 334 classicPropertyEncryptionDefault.put(tag + "", EncryptionDetail.UnencryptedOnSave); 335 } 336 337 for(String tag: DefaultFrameWriter.getItemTagsExt().keySet()) { 338 surrogatePropertyInheritanceDefault.put(tag, true); 339 classicPropertyEncryptionDefault.put(tag, EncryptionDetail.UnencryptedOnSave); 340 } 341 } 323 342 324 343 /** Just calls source.duplicateOnto(dest). */ … … 415 434 _type = type; 416 435 invalidateAll(); 436 if (isSurrogate()) { 437 surrogatePropertyInheritance.put(DefaultFrameWriter.DOT_TYPE_STR, false); 438 Item classic = getClassic(); 439 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 440 classic.classicPropertyEncryption.put(DefaultFrameWriter.DOT_TYPE_STR, EncryptionDetail.InheritanceCheckOnSave); 441 } 442 } 417 443 } 418 444 419 445 public DotType getDotType() { 420 Surrogate surrogate = Surrogate.of(this); 421 if (surrogate != null && 422 surrogate.isPropertyIsInherited(DefaultFrameWriter.DOT_TYPE + "")) { 446 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.DOT_TYPE_STR)) { 423 447 return this.getClassic().getDotType(); 424 448 } else { … … 428 452 429 453 430 public void setFilled(boolean filled) 431 { 454 public void setFilled(boolean filled) { 432 455 invalidateAll(); 433 456 _filled = filled; 434 457 invalidateAll(); 458 459 if (isSurrogate()) { 460 surrogatePropertyInheritance.put(DefaultFrameWriter.FILLED_STR, false); 461 Item classic = getClassic(); 462 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 463 classic.classicPropertyEncryption.put(DefaultFrameWriter.FILLED_STR, EncryptionDetail.InheritanceCheckOnSave); 464 } 465 } 435 466 } 436 467 437 468 public boolean getFilled() { 438 Surrogate surrogate = Surrogate.of(this); 439 if (surrogate != null && 440 surrogate.isPropertyIsInherited(DefaultFrameWriter.FILLED + "")) { 469 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.FILLED_STR)) { 441 470 return this.getClassic().getFilled(); 442 471 } else { … … 450 479 * @param gradientAngle The new angle of colour change. 451 480 */ 452 public void setGradientAngle(double gradientAngle) 453 { 481 public void setGradientAngle(double gradientAngle) { 454 482 _gradientAngle = gradientAngle; 455 483 … … 461 489 invalidateCommonTrait(ItemAppearence.GradientColor); 462 490 invalidateFill(); 491 492 if (isSurrogate()) { 493 surrogatePropertyInheritance.put(DefaultFrameWriter.GRADIENT_ANGLE_STR, false); 494 Item classic = getClassic(); 495 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 496 classic.classicPropertyEncryption.put(DefaultFrameWriter.GRADIENT_ANGLE_STR, EncryptionDetail.InheritanceCheckOnSave); 497 } 498 } 463 499 } 464 500 … … 469 505 */ 470 506 public double getGradientAngle() { 471 Surrogate surrogate = Surrogate.of(this); 472 if (surrogate != null && 473 surrogate.isPropertyIsInherited(DefaultFrameWriter.GRADIENT_ANGLE + "")) { 507 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.GRADIENT_ANGLE_STR)) { 474 508 return this.getClassic().getGradientAngle(); 475 509 } else { … … 528 562 this.getParent().moveItemToBodyHiddenDueToPermission(this); 529 563 } 564 565 if (isSurrogate()) { 566 surrogatePropertyInheritance.put(DefaultFrameWriter.PERMISSION_STR, false); 567 Item classic = getClassic(); 568 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 569 classic.classicPropertyEncryption.put(DefaultFrameWriter.PERMISSION_STR, EncryptionDetail.InheritanceCheckOnSave); 570 } 571 } 530 572 } 531 573 532 574 public PermissionTriple getPermission() { 533 Surrogate surrogate = Surrogate.of(this); 534 if (surrogate != null && 535 surrogate.isPropertyIsInherited(DefaultFrameWriter.PERMISSION + "")) { 575 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.PERMISSION_STR)) { 536 576 return this.getClassic().getPermission(); 537 577 } else { … … 683 723 */ 684 724 public List<String> getAction() { 685 Surrogate surrogate = Surrogate.of(this); 686 if (surrogate != null && 687 surrogate.isPropertyIsInherited(DefaultFrameWriter.ACTION + "")) { 725 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ACTION_STR)) { 688 726 return this.getClassic().getAction(); 689 727 } else { … … 693 731 694 732 public List<String> getData() { 695 Surrogate surrogate = Surrogate.of(this); 696 if (surrogate != null && 697 surrogate.isPropertyIsInherited(DefaultFrameWriter.DATA + "")) { 733 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.DATA_STR)) { 698 734 return this.getClassic().getData(); 699 735 } else { 700 return _data.getData();736 return _data.getData(); 701 737 } 702 738 } 703 739 704 740 public List<String> getActionCursorEnter() { 705 Surrogate surrogate = Surrogate.of(this); 706 if (surrogate != null && 707 surrogate.isPropertyIsInherited(DefaultFrameWriter.ACTION_CURSOR_ENTER + "")) { 741 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR)) { 708 742 return this.getClassic().getActionCursorEnter(); 709 743 } else { 710 return _actionCursorEnter;744 return _actionCursorEnter; 711 745 } 712 746 } 713 747 714 748 public List<String> getActionCursorLeave() { 715 Surrogate surrogate = Surrogate.of(this); 716 if (surrogate != null && 717 surrogate.isPropertyIsInherited(DefaultFrameWriter.ACTION_CURSOR_LEAVE + "")) { 749 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR)) { 718 750 return this.getClassic().getActionCursorLeave(); 719 751 } else { 720 return _actionCursorLeave;752 return _actionCursorLeave; 721 753 } 722 754 } 723 755 724 756 public List<String> getActionEnterFrame() { 725 Surrogate surrogate = Surrogate.of(this); 726 if (surrogate != null && 727 surrogate.isPropertyIsInherited(DefaultFrameWriter.ACTION_ENTER_FRAME + "")) { 757 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ACTION_ENTER_FRAME_STR)) { 728 758 return this.getClassic().getActionEnterFrame(); 729 759 } else { 730 return _actionEnterFrame;760 return _actionEnterFrame; 731 761 } 732 762 } 733 763 734 764 public List<String> getActionLeaveFrame() { 735 Surrogate surrogate = Surrogate.of(this); 736 if (surrogate != null && 737 surrogate.isPropertyIsInherited(DefaultFrameWriter.ACTION_LEAVE_FRAME + "")) { 765 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR)) { 738 766 return this.getClassic().getActionLeaveFrame(); 739 767 } else { 740 return _actionLeaveFrame;768 return _actionLeaveFrame; 741 769 } 742 770 } 743 771 744 772 public boolean getActionMark() { 745 Surrogate surrogate = Surrogate.of(this); 746 if (surrogate != null && 747 surrogate.isPropertyIsInherited(DefaultFrameWriter.ACTION_MARK + "")) { 773 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ACTION_MARK_STR)) { 748 774 return this.getClassic().getActionMark(); 749 775 } else { 750 return _actionMark;776 return _actionMark; 751 777 } 752 778 } … … 770 796 771 797 public String getArrow() { 772 Surrogate surrogate = Surrogate.of(this); 773 if (surrogate != null && 774 surrogate.isPropertyIsInherited(DefaultFrameWriter.ARROW + "")) { 798 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ARROW_STR)) { 775 799 return this.getClassic().getArrow(); 776 800 } else { … … 807 831 808 832 public Colour getBackgroundColor() { 809 Surrogate surrogate = Surrogate.of(this); 810 if (surrogate != null && 811 surrogate.isPropertyIsInherited(DefaultFrameWriter.BACKGROUND_COLOR + "")) { 833 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.BACKGROUND_COLOR_STR)) { 812 834 return this.getClassic().getBackgroundColor(); 813 835 } else { 814 return _backgroundColour;836 return _backgroundColour; 815 837 } 816 838 } 817 839 818 840 public Colour getBorderColor() { 819 Surrogate surrogate = Surrogate.of(this); 820 if (surrogate != null && 821 surrogate.isPropertyIsInherited(DefaultFrameWriter.TYPE_AND_ID + "")) { 841 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.BORDER_COLOR_STR)) { 822 842 return this.getClassic().getBorderColor(); 823 843 } else { 824 return _colorBorder;844 return _colorBorder; 825 845 } 826 846 } … … 896 916 897 917 public Colour getColor() { 898 Surrogate surrogate = Surrogate.of(this); 899 if (surrogate != null && 900 surrogate.isPropertyIsInherited(DefaultFrameWriter.COLOR + "")) { 918 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.COLOR_STR)) { 901 919 return this.getClassic().getColor(); 902 920 } else { 903 return _foregroundColour;921 return _foregroundColour; 904 922 } 905 923 } … … 915 933 916 934 public String getConstraintIDs() { 917 Surrogate surrogate = Surrogate.of(this); 918 if (surrogate != null && 919 surrogate.isPropertyIsInherited(DefaultFrameWriter.CONSTRAINT_IDS + "")) { 935 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.CONSTRAINT_IDS_STR)) { 920 936 return this.getClassic().getConstraintIDs(); 921 937 } else { … … 954 970 955 971 public String getDateCreated() { 956 Surrogate surrogate = Surrogate.of(this); 957 if (surrogate != null && 958 surrogate.isPropertyIsInherited(DefaultFrameWriter.DATE_CREATED + "")) { 972 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.DATE_CREATED_STR)) { 959 973 return this.getClassic().getDateCreated(); 960 974 } else { 961 return _creationDate;975 return _creationDate; 962 976 } 963 977 } 964 978 965 979 public Colour getFillColor() { 966 Surrogate surrogate = Surrogate.of(this); 967 if (surrogate != null && 968 surrogate.isPropertyIsInherited(DefaultFrameWriter.FILL_COLOR + "")) { 980 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.FILL_COLOR_STR)) { 969 981 return this.getClassic().getFillColor(); 970 982 } else { 971 return _fillColour;983 return _fillColour; 972 984 } 973 985 } 974 986 975 987 public String getFillPattern() { 976 Surrogate surrogate = Surrogate.of(this); 977 if (surrogate != null && 978 surrogate.isPropertyIsInherited(DefaultFrameWriter.FILL_PATTERN + "")) { 988 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.FILL_PATTERN_STR)) { 979 989 return this.getClassic().getFillPattern(); 980 990 } else { 981 return _fillPattern;991 return _fillPattern; 982 992 } 983 993 } … … 997 1007 */ 998 1008 public boolean getHighlight() { 999 Surrogate surrogate = Surrogate.of(this); 1000 if (surrogate != null && 1001 surrogate.isPropertyIsInherited(DefaultFrameWriter.HIGHLIGHT + "")) { 1009 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.HIGHLIGHT_STR)) { 1002 1010 return this.getClassic().getHighlight(); 1003 1011 } else { 1004 return _highlight;1012 return _highlight; 1005 1013 } 1006 1014 } … … 1031 1039 */ 1032 1040 public String getLineIDs() { 1033 Surrogate surrogate = Surrogate.of(this); 1034 if (surrogate != null && 1035 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINE_IDS + "")) { 1041 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINE_IDS_STR)) { 1036 1042 return this.getClassic().getLineIDs(); 1037 1043 } else { … … 1050 1056 1051 1057 public int[] getLinePattern() { 1052 Surrogate surrogate = Surrogate.of(this); 1053 if (surrogate != null && 1054 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINE_PATTERN + "")) { 1058 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINE_PATTERN_STR)) { 1055 1059 return this.getClassic().getLinePattern(); 1056 1060 } else { 1057 return _linePattern;1061 return _linePattern; 1058 1062 } 1059 1063 } … … 1078 1082 */ 1079 1083 public String getLink() { 1080 Surrogate surrogate = Surrogate.of(this); 1081 if (surrogate != null && 1082 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINK + "")) { 1084 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINK_STR)) { 1083 1085 return this.getClassic().getLink(); 1084 1086 } else { 1085 return _link;1087 return _link; 1086 1088 } 1087 1089 } 1088 1090 1089 1091 public String getFormula() { 1090 Surrogate surrogate = Surrogate.of(this); 1091 if (surrogate != null && 1092 surrogate.isPropertyIsInherited(DefaultFrameWriter.FORMULA + "")) { 1092 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.FORMULA_STR)) { 1093 1093 return this.getClassic().getFormula(); 1094 1094 } else { 1095 return _formula;1095 return _formula; 1096 1096 } 1097 1097 } … … 1107 1107 } 1108 1108 1109 public void setFormula(String formula) 1110 { 1109 public void setFormula(String formula) { 1111 1110 _formula = formula; 1111 1112 if (isSurrogate()) { 1113 surrogatePropertyInheritance.put(DefaultFrameWriter.FORMULA_STR, false); 1114 Item classic = getClassic(); 1115 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FORMULA_STR)) { 1116 classic.classicPropertyEncryption.put(DefaultFrameWriter.FORMULA_STR, EncryptionDetail.InheritanceCheckOnSave); 1117 } 1118 } 1112 1119 } 1113 1120 … … 1119 1126 1120 1127 public String getLinkFrameset() { 1121 Surrogate surrogate = Surrogate.of(this); 1122 if (surrogate != null && 1123 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINK_FRAMESET + "")) { 1128 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINK_FRAMESET_STR)) { 1124 1129 return this.getClassic().getLinkFrameset(); 1125 1130 } else { 1126 return _link_frameset;1131 return _link_frameset; 1127 1132 } 1128 1133 } 1129 1134 1130 1135 public boolean getLinkMark() { 1131 Surrogate surrogate = Surrogate.of(this); 1132 if (surrogate != null && 1133 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINK_MARK + "")) { 1136 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINK_MARK_STR)) { 1134 1137 return this.getClassic().getLinkMark(); 1135 1138 } else { 1136 return _linkMark;1139 return _linkMark; 1137 1140 } 1138 1141 } 1139 1142 1140 1143 public String getLinkTemplate() { 1141 Surrogate surrogate = Surrogate.of(this); 1142 if (surrogate != null && 1143 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINK_TEMPLATE + "")) { 1144 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINK_TEMPLATE_STR)) { 1144 1145 return this.getClassic().getLinkTemplate(); 1145 1146 } else { 1146 return _link_template; 1147 } 1148 } 1149 1150 // public int getMaxWidth() 1151 // { 1152 // return _maxWidth; 1153 // } 1147 return _link_template; 1148 } 1149 } 1154 1150 1155 1151 public Point getOffset() … … 1159 1155 1160 1156 public String getOwner() { 1161 Surrogate surrogate = Surrogate.of(this); 1162 if (surrogate != null && 1163 surrogate.isPropertyIsInherited(DefaultFrameWriter.OWNER + "")) { 1157 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.OWNER_STR)) { 1164 1158 return this.getClassic().getOwner(); 1165 1159 } else { 1166 return _owner;1160 return _owner; 1167 1161 } 1168 1162 } … … 1281 1275 /** Gets the position of this item. */ 1282 1276 public final Point getPosition() { 1283 Surrogate surrogate = Surrogate.of(this); 1284 if (surrogate != null && 1285 surrogate.isPropertyIsInherited(DefaultFrameWriter.POSITION + "")) { 1277 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.POSITION_STR)) { 1286 1278 return this.getClassic().getPosition(); 1287 1279 } else { … … 1313 1305 1314 1306 public String getTypeAndID() { 1315 Surrogate surrogate = Surrogate.of(this); 1316 if (surrogate != null && 1317 surrogate.isPropertyIsInherited(DefaultFrameWriter.TYPE_AND_ID + "")) { 1307 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.TYPE_AND_ID_STR)) { 1318 1308 return this.getClassic().getTypeAndID(); 1319 1309 } else { … … 1323 1313 1324 1314 public Integer getWidthToSave() { 1325 Surrogate surrogate = Surrogate.of(this); 1326 if (surrogate != null && 1327 surrogate.isPropertyIsInherited(DefaultFrameWriter.WIDTH_TO_SAVE + "")) { 1315 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.WIDTH_TO_SAVE_STR)) { 1328 1316 return this.getClassic().getWidthToSave(); 1329 1317 } else { … … 1333 1321 1334 1322 public Integer getMinWidthToSave() { 1335 Surrogate surrogate = Surrogate.of(this); 1336 if (surrogate != null && 1337 surrogate.isPropertyIsInherited(DefaultFrameWriter.MIN_WIDTH_TO_SAVE + "")) { 1323 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR)) { 1338 1324 return this.getClassic().getMinWidthToSave(); 1339 1325 } else { … … 1362 1348 */ 1363 1349 public int getX() { 1364 Surrogate surrogate = Surrogate.of(this); 1365 if (surrogate != null && 1366 surrogate.isPropertyIsInherited(DefaultFrameWriter.POSITION + "")) { 1350 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.POSITION_STR)) { 1367 1351 return this.getClassic().getX(); 1368 1352 } else { … … 1377 1361 */ 1378 1362 public int getY() { 1379 Surrogate surrogate = Surrogate.of(this); 1380 if (surrogate != null && 1381 surrogate.isPropertyIsInherited(DefaultFrameWriter.POSITION + "")) { 1363 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.POSITION_STR)) { 1382 1364 return this.getClassic().getY(); 1383 1365 } else { … … 1532 1514 } 1533 1515 1534 public void setTooltip(final String tooltip) 1535 { 1516 public void setTooltip(final String tooltip) { 1536 1517 if(tooltip != null && tooltip.trim().length() > 0) { 1537 1518 _tooltip.addTooltip(tooltip, this); 1538 1519 } 1520 1521 if (isSurrogate()) { 1522 surrogatePropertyInheritance.put(DefaultFrameWriter.TOOLTIP_STR, false); 1523 Item classic = getClassic(); 1524 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TOOLTIP_STR)) { 1525 classic.classicPropertyEncryption.put(DefaultFrameWriter.TOOLTIP_STR, EncryptionDetail.InheritanceCheckOnSave); 1526 } 1527 } 1539 1528 } 1540 1529 1541 1530 public List<String> getTooltip() { 1542 Surrogate surrogate = Surrogate.of(this); 1543 if (surrogate != null && 1544 surrogate.isPropertyIsInherited(DefaultFrameWriter.TOOLTIP + "")) { 1531 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.TOOLTIP_STR)) { 1545 1532 return this.getClassic().getTooltip(); 1546 1533 } else { … … 1824 1811 * The lines of code to associate with this Item 1825 1812 */ 1826 public void setActions(List<String> actions) 1827 { 1813 public void setActions(List<String> actions) { 1828 1814 if (actions == null || actions.size() == 0) { 1829 1815 invalidateCommonTrait(ItemAppearence.LinkChanged); … … 1836 1822 invalidateBounds(); 1837 1823 invalidateCommonTrait(ItemAppearence.LinkChanged); 1824 1825 if (isSurrogate()) { 1826 surrogatePropertyInheritance.put(DefaultFrameWriter.ACTION_STR, false); 1827 Item classic = getClassic(); 1828 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_STR)) { 1829 classic.classicPropertyEncryption.put(DefaultFrameWriter.ACTION_STR, EncryptionDetail.InheritanceCheckOnSave); 1830 } 1831 } 1838 1832 } 1839 1833 … … 1848 1842 public void addToData(String dataItem) { 1849 1843 _data.addToData(dataItem); 1844 1845 if (isSurrogate()) { 1846 surrogatePropertyInheritance.put(DefaultFrameWriter.DATA_STR, false); 1847 Item classic = getClassic(); 1848 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DATA_STR)) { 1849 classic.classicPropertyEncryption.put(DefaultFrameWriter.DATA_STR, EncryptionDetail.InheritanceCheckOnSave); 1850 } 1851 } 1850 1852 } 1851 1853 … … 1856 1858 public void setActionCursorEnter(List<String> enter) { 1857 1859 _actionCursorEnter = enter; 1860 1861 if (isSurrogate()) { 1862 surrogatePropertyInheritance.put(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR, false); 1863 Item classic = getClassic(); 1864 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR)) { 1865 classic.classicPropertyEncryption.put(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR, EncryptionDetail.InheritanceCheckOnSave); 1866 } 1867 } 1858 1868 } 1859 1869 1860 1870 public void setActionCursorLeave(List<String> leave) { 1861 1871 _actionCursorLeave = leave; 1872 1873 if (isSurrogate()) { 1874 surrogatePropertyInheritance.put(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR, false); 1875 Item classic = getClassic(); 1876 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR)) { 1877 classic.classicPropertyEncryption.put(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 1878 } 1879 } 1862 1880 } 1863 1881 1864 1882 public void setActionEnterFrame(List<String> enter) { 1865 1883 _actionEnterFrame = enter; 1884 1885 if (isSurrogate()) { 1886 surrogatePropertyInheritance.put(DefaultFrameWriter.ACTION_ENTER_FRAME_STR, false); 1887 Item classic = getClassic(); 1888 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_ENTER_FRAME_STR)) { 1889 classic.classicPropertyEncryption.put(DefaultFrameWriter.ACTION_ENTER_FRAME_STR, EncryptionDetail.InheritanceCheckOnSave); 1890 } 1891 } 1866 1892 } 1867 1893 1868 1894 public void setActionLeaveFrame(List<String> leave) { 1869 1895 _actionLeaveFrame = leave; 1870 } 1871 1872 public void setActionMark(boolean val) 1873 { 1896 1897 if (isSurrogate()) { 1898 surrogatePropertyInheritance.put(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR, false); 1899 Item classic = getClassic(); 1900 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR)) { 1901 classic.classicPropertyEncryption.put(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR, EncryptionDetail.InheritanceCheckOnSave); 1902 } 1903 } 1904 } 1905 1906 public void setActionMark(boolean val) { 1874 1907 if (!val) invalidateCommonTrait(ItemAppearence.LinkChanged); 1875 1908 invalidateBounds(); 1876 1909 _actionMark = val; 1877 1910 if (val) invalidateCommonTrait(ItemAppearence.LinkChanged); 1911 1912 if (isSurrogate()) { 1913 surrogatePropertyInheritance.put(DefaultFrameWriter.ACTION_MARK_STR, false); 1914 Item classic = getClassic(); 1915 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_MARK_STR)) { 1916 classic.classicPropertyEncryption.put(DefaultFrameWriter.ACTION_MARK_STR, EncryptionDetail.InheritanceCheckOnSave); 1917 } 1918 } 1878 1919 } 1879 1920 … … 1901 1942 _arrowheadNibPerc = nib_perc; 1902 1943 updateArrowPolygon(); 1944 1945 if (isSurrogate()) { 1946 surrogatePropertyInheritance.put(DefaultFrameWriter.ARROW_STR, false); 1947 Item classic = getClassic(); 1948 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ARROW_STR)) { 1949 classic.classicPropertyEncryption.put(DefaultFrameWriter.ARROW_STR, EncryptionDetail.InheritanceCheckOnSave); 1950 } 1951 } 1903 1952 } 1904 1953 … … 1931 1980 invalidateCommonTrait(ItemAppearence.BackgroundColorChanged); 1932 1981 } 1982 1983 if (isSurrogate()) { 1984 surrogatePropertyInheritance.put(DefaultFrameWriter.BACKGROUND_COLOR_STR, false); 1985 Item classic = getClassic(); 1986 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.BACKGROUND_COLOR_STR)) { 1987 classic.classicPropertyEncryption.put(DefaultFrameWriter.BACKGROUND_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 1988 } 1989 } 1933 1990 } 1934 1991 … … 1937 1994 _colorBorder = c; 1938 1995 invalidateCommonTrait(ItemAppearence.BorderColorChanged); 1996 } 1997 1998 if (isSurrogate()) { 1999 surrogatePropertyInheritance.put(DefaultFrameWriter.BORDER_COLOR_STR, false); 2000 Item classic = getClassic(); 2001 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.BORDER_COLOR_STR)) { 2002 classic.classicPropertyEncryption.put(DefaultFrameWriter.BORDER_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2003 } 1939 2004 } 1940 2005 } … … 1970 2035 1971 2036 public void setConstraintIDs(String IDs) { 2037 if (isSurrogate()) { 2038 surrogatePropertyInheritance.put(DefaultFrameWriter.CONSTRAINT_IDS_STR, false); 2039 Item classic = getClassic(); 2040 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.CONSTRAINT_IDS_STR)) { 2041 classic.classicPropertyEncryption.put(DefaultFrameWriter.CONSTRAINT_IDS_STR, EncryptionDetail.InheritanceCheckOnSave); 2042 } 2043 } 1972 2044 } 1973 2045 … … 1991 2063 public void setDateCreated(String date) { 1992 2064 _creationDate = date; 2065 2066 if (isSurrogate()) { 2067 surrogatePropertyInheritance.put(DefaultFrameWriter.DATE_CREATED_STR, false); 2068 Item classic = getClassic(); 2069 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DATE_CREATED_STR)) { 2070 classic.classicPropertyEncryption.put(DefaultFrameWriter.DATE_CREATED_STR, EncryptionDetail.InheritanceCheckOnSave); 2071 } 2072 } 1993 2073 } 1994 2074 … … 2006 2086 invalidateCommonTrait(ItemAppearence.FillColor); 2007 2087 invalidateFill(); 2008 } 2009 2010 public void setGradientColor(Colour c) 2011 { 2088 2089 if (isSurrogate()) { 2090 surrogatePropertyInheritance.put(DefaultFrameWriter.FILL_COLOR_STR, false); 2091 Item classic = getClassic(); 2092 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FILL_COLOR_STR)) { 2093 classic.classicPropertyEncryption.put(DefaultFrameWriter.FILL_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2094 } 2095 } 2096 } 2097 2098 public void setGradientColor(Colour c) { 2012 2099 _gradientColour = c; 2013 2100 … … 2020 2107 invalidateCommonTrait(ItemAppearence.GradientColor); 2021 2108 invalidateFill(); 2109 2110 if (isSurrogate()) { 2111 surrogatePropertyInheritance.put(DefaultFrameWriter.GRADIENT_COLOR_STR, false); 2112 Item classic = getClassic(); 2113 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.GRADIENT_COLOR_STR)) { 2114 classic.classicPropertyEncryption.put(DefaultFrameWriter.GRADIENT_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2115 } 2116 } 2022 2117 } 2023 2118 2024 2119 public Colour getGradientColor() { 2025 Surrogate surrogate = Surrogate.of(this); 2026 if (surrogate != null && 2027 surrogate.isPropertyIsInherited(DefaultFrameWriter.GRADIENT_COLOR + "")) { 2120 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.GRADIENT_COLOR_STR)) { 2028 2121 return this.getClassic().getGradientColor(); 2029 2122 } else { … … 2036 2129 invalidateCommonTrait(ItemAppearence.FillPattern); 2037 2130 invalidateFill(); 2131 2132 if (isSurrogate()) { 2133 surrogatePropertyInheritance.put(DefaultFrameWriter.FILL_PATTERN_STR, false); 2134 Item classic = getClassic(); 2135 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FILL_PATTERN_STR)) { 2136 classic.classicPropertyEncryption.put(DefaultFrameWriter.FILL_PATTERN_STR, EncryptionDetail.InheritanceCheckOnSave); 2137 } 2138 } 2038 2139 } 2039 2140 … … 2050 2151 public void setHighlight(boolean val) { 2051 2152 _highlight = val; 2153 2154 if (isSurrogate()) { 2155 surrogatePropertyInheritance.put(DefaultFrameWriter.HIGHLIGHT_STR, false); 2156 Item classic = getClassic(); 2157 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.HIGHLIGHT_STR)) { 2158 classic.classicPropertyEncryption.put(DefaultFrameWriter.HIGHLIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 2159 } 2160 } 2052 2161 } 2053 2162 … … 2061 2170 public void setID(int newID) { 2062 2171 _id = newID; 2172 2173 if (isSurrogate()) { 2174 surrogatePropertyInheritance.put(DefaultFrameWriter.TYPE_AND_ID_STR, false); 2175 Item classic = getClassic(); 2176 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TYPE_AND_ID_STR)) { 2177 classic.classicPropertyEncryption.put(DefaultFrameWriter.TYPE_AND_ID_STR, EncryptionDetail.InheritanceCheckOnSave); 2178 } 2179 } 2063 2180 } 2064 2181 … … 2070 2187 */ 2071 2188 public void setLineIDs(String lineID) { 2189 if (isSurrogate()) { 2190 surrogatePropertyInheritance.put(DefaultFrameWriter.LINE_IDS_STR, false); 2191 Item classic = getClassic(); 2192 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINE_IDS_STR)) { 2193 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINE_IDS_STR, EncryptionDetail.InheritanceCheckOnSave); 2194 } 2195 } 2072 2196 } 2073 2197 … … 2077 2201 for (Line line : getLines()) 2078 2202 line.setLinePattern(pattern); 2203 2204 if (isSurrogate()) { 2205 surrogatePropertyInheritance.put(DefaultFrameWriter.LINE_PATTERN_STR, false); 2206 Item classic = getClassic(); 2207 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINE_PATTERN_STR)) { 2208 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINE_PATTERN_STR, EncryptionDetail.InheritanceCheckOnSave); 2209 } 2210 } 2079 2211 } 2080 2212 … … 2094 2226 * The name of the Frame to link this item to. 2095 2227 */ 2096 public void setLink(String frameName) 2097 { 2228 public void setLink(String frameName) { 2098 2229 if (frameName == null) invalidateCommonTrait(ItemAppearence.LinkChanged); 2099 2230 … … 2110 2241 2111 2242 invalidateCommonTrait(ItemAppearence.LinkChanged); 2243 2244 if (isSurrogate()) { 2245 surrogatePropertyInheritance.put(DefaultFrameWriter.LINK_STR, false); 2246 Item classic = getClassic(); 2247 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_STR)) { 2248 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINK_STR, EncryptionDetail.InheritanceCheckOnSave); 2249 } 2250 } 2112 2251 } 2113 2252 2114 2253 public void setLinkHistory(boolean value) { 2115 2254 _linkHistory = value; 2255 2256 if (isSurrogate()) { 2257 surrogatePropertyInheritance.put(DefaultFrameWriter.LINK_HISTORY_STR, false); 2258 Item classic = getClassic(); 2259 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_HISTORY_STR)) { 2260 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINK_HISTORY_STR, EncryptionDetail.InheritanceCheckOnSave); 2261 } 2262 } 2116 2263 } 2117 2264 2118 2265 public boolean getLinkHistory() { 2119 Surrogate surrogate = Surrogate.of(this); 2120 if (surrogate != null && 2121 surrogate.isPropertyIsInherited(DefaultFrameWriter.LINK_HISTORY + "")) { 2266 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LINK_HISTORY_STR)) { 2122 2267 return this.getClassic().getLinkHistory(); 2123 2268 } else { … … 2134 2279 } 2135 2280 // TODO make this throw exceptions etc... 2136 } 2137 2138 public void setLinkMark(boolean val) 2139 { 2281 2282 if (isSurrogate()) { 2283 surrogatePropertyInheritance.put(DefaultFrameWriter.LINK_FRAMESET_STR, false); 2284 Item classic = getClassic(); 2285 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_FRAMESET_STR)) { 2286 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINK_FRAMESET_STR, EncryptionDetail.InheritanceCheckOnSave); 2287 } 2288 } 2289 } 2290 2291 public void setLinkMark(boolean val) { 2140 2292 if (!val) invalidateCommonTrait(ItemAppearence.LinkChanged); 2141 2293 invalidateBounds(); 2142 2294 _linkMark = val; 2143 2295 if (val) invalidateCommonTrait(ItemAppearence.LinkChanged); 2144 } 2145 2146 public void setLinkTemplate(String template) 2147 { 2296 2297 if (isSurrogate()) { 2298 surrogatePropertyInheritance.put(DefaultFrameWriter.LINK_MARK_STR, false); 2299 Item classic = getClassic(); 2300 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_MARK_STR)) { 2301 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINK_MARK_STR, EncryptionDetail.InheritanceCheckOnSave); 2302 } 2303 } 2304 } 2305 2306 public void setLinkTemplate(String template) { 2148 2307 if (FrameIO.isValidLink(template)) { 2149 2308 _link_template = template; … … 2152 2311 } 2153 2312 // TODO make this throw exceptions etc... 2313 2314 if (isSurrogate()) { 2315 surrogatePropertyInheritance.put(DefaultFrameWriter.LINK_TEMPLATE_STR, false); 2316 Item classic = getClassic(); 2317 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_TEMPLATE_STR)) { 2318 classic.classicPropertyEncryption.put(DefaultFrameWriter.LINK_TEMPLATE_STR, EncryptionDetail.InheritanceCheckOnSave); 2319 } 2320 } 2154 2321 } 2155 2322 … … 2178 2345 public void setOwner(String own) { 2179 2346 _owner = own; 2347 2348 if (isSurrogate()) { 2349 surrogatePropertyInheritance.put(DefaultFrameWriter.OWNER_STR, false); 2350 Item classic = getClassic(); 2351 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.OWNER_STR)) { 2352 classic.classicPropertyEncryption.put(DefaultFrameWriter.OWNER_STR, EncryptionDetail.InheritanceCheckOnSave); 2353 } 2354 } 2180 2355 } 2181 2356 … … 2258 2433 * The new Y coordinate 2259 2434 */ 2260 public void setPosition(float x, float y) 2261 { 2435 public void setPosition(float x, float y) { 2262 2436 float deltaX = x - _x; 2263 2437 float deltaY = y - _y; … … 2363 2537 invalidateCommonTraitForAll(ItemAppearence.PostMoved); 2364 2538 2539 if (isSurrogate()) { 2540 surrogatePropertyInheritance.put(DefaultFrameWriter.POSITION_STR, false); 2541 Item classic = getClassic(); 2542 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.POSITION_STR)) { 2543 classic.classicPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, EncryptionDetail.InheritanceCheckOnSave); 2544 } 2545 } 2365 2546 } 2366 2547 … … 2399 2580 public final void setThickness(float thick) { 2400 2581 setThickness(thick, true); 2582 2583 if (isSurrogate()) { 2584 surrogatePropertyInheritance.put(DefaultFrameWriter.THICKNESS_STR, false); 2585 Item classic = getClassic(); 2586 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.THICKNESS_STR)) { 2587 classic.classicPropertyEncryption.put(DefaultFrameWriter.THICKNESS_STR, EncryptionDetail.InheritanceCheckOnSave); 2588 } 2589 } 2401 2590 } 2402 2591 … … 2451 2640 */ 2452 2641 public float getThickness() { 2453 Surrogate surrogate = Surrogate.of(this); 2454 if (surrogate != null && 2455 surrogate.isPropertyIsInherited(DefaultFrameWriter.THICKNESS + "")) { 2642 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.THICKNESS_STR)) { 2456 2643 return this.getClassic().getThickness(); 2457 2644 } else { … … 2505 2692 public void setX(float newX) { 2506 2693 setPosition(newX, getY()); 2694 2695 if (isSurrogate()) { 2696 surrogatePropertyInheritance.put(DefaultFrameWriter.POSITION_STR, false); 2697 Item classic = getClassic(); 2698 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.POSITION_STR)) { 2699 classic.classicPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, EncryptionDetail.InheritanceCheckOnSave); 2700 } 2701 } 2507 2702 } 2508 2703 … … 2515 2710 public void setY(float newY) { 2516 2711 setPosition(getX(), newY); 2712 2713 if (isSurrogate()) { 2714 surrogatePropertyInheritance.put(DefaultFrameWriter.POSITION_STR, false); 2715 Item classic = getClassic(); 2716 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.POSITION_STR)) { 2717 classic.classicPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, EncryptionDetail.InheritanceCheckOnSave); 2718 } 2719 } 2517 2720 } 2518 2721 … … 3313 3516 } 3314 3517 3315 public void setAnchorLeft(Integer anchor) 3316 { 3518 public void setAnchorLeft(Integer anchor) { 3317 3519 this._anchoring.setLeftAnchor(anchor); 3318 3520 if (anchor != null) { … … 3320 3522 setX(anchor); 3321 3523 } 3322 } 3323 3324 public void setAnchorRight(Integer anchor) 3325 { 3524 3525 if (isSurrogate()) { 3526 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_LEFT_STR, false); 3527 Item classic = getClassic(); 3528 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_LEFT_STR)) { 3529 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_LEFT_STR, EncryptionDetail.InheritanceCheckOnSave); 3530 } 3531 } 3532 } 3533 3534 public void setAnchorRight(Integer anchor) { 3326 3535 this._anchoring.setRightAnchor(anchor); 3327 3536 if (anchor != null) { … … 3329 3538 setX(DisplayController.getFramePaintArea().getMaxX() - anchor - getBoundsWidth()); 3330 3539 } 3331 } 3332 3333 public void setAnchorTop(Integer anchor) 3334 { 3540 3541 if (isSurrogate()) { 3542 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, false); 3543 Item classic = getClassic(); 3544 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_RIGHT_STR)) { 3545 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 3546 } 3547 } 3548 } 3549 3550 public void setAnchorTop(Integer anchor) { 3335 3551 this._anchoring.setTopAnchor(anchor); 3336 3552 if (anchor != null) { … … 3338 3554 setY(anchor); 3339 3555 } 3340 } 3341 3342 3343 public void setAnchorBottom(Integer anchor) 3344 { 3556 3557 if (isSurrogate()) { 3558 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_TOP_STR, false); 3559 Item classic = getClassic(); 3560 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_TOP_STR)) { 3561 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_TOP_STR, EncryptionDetail.InheritanceCheckOnSave); 3562 } 3563 } 3564 } 3565 3566 3567 public void setAnchorBottom(Integer anchor) { 3345 3568 this._anchoring.setBottomAnchor(anchor); 3346 3569 if (anchor != null) { … … 3348 3571 setY(DisplayController.getFramePaintArea().getMaxY() - anchor); 3349 3572 } 3573 3574 if (isSurrogate()) { 3575 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, false); 3576 Item classic = getClassic(); 3577 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_BOTTOM_STR)) { 3578 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, EncryptionDetail.InheritanceCheckOnSave); 3579 } 3580 } 3350 3581 } 3351 3582 … … 3364 3595 3365 3596 public Integer getAnchorLeft() { 3366 Surrogate surrogate = Surrogate.of(this); 3367 if (surrogate != null && 3368 surrogate.isPropertyIsInherited(DefaultFrameWriter.ANCHOR_LEFT + "")) { 3597 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_LEFT_STR)) { 3369 3598 return this.getClassic().getAnchorLeft(); 3370 3599 } else { … … 3374 3603 3375 3604 public Integer getAnchorRight() { 3376 Surrogate surrogate = Surrogate.of(this); 3377 if (surrogate != null && 3378 surrogate.isPropertyIsInherited(DefaultFrameWriter.ANCHOR_RIGHT + "")) { 3605 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_RIGHT_STR)) { 3379 3606 return this.getClassic().getAnchorRight(); 3380 3607 } else { … … 3384 3611 3385 3612 public Integer getAnchorTop() { 3386 Surrogate surrogate = Surrogate.of(this); 3387 if (surrogate != null && 3388 surrogate.isPropertyIsInherited(DefaultFrameWriter.ANCHOR_TOP + "")) { 3613 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_TOP_STR)) { 3389 3614 return this.getClassic().getAnchorTop(); 3390 3615 } else { … … 3394 3619 3395 3620 public Integer getAnchorBottom() { 3396 Surrogate surrogate = Surrogate.of(this); 3397 if (surrogate != null && 3398 surrogate.isPropertyIsInherited(DefaultFrameWriter.ANCHOR_BOTTOM + "")) { 3621 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_BOTTOM_STR)) { 3399 3622 return this.getClassic().getAnchorBottom(); 3400 3623 } else { … … 3404 3627 3405 3628 public String getText() { 3406 Surrogate surrogate = Surrogate.of(this); 3407 if (surrogate != null && 3408 surrogate.isPropertyIsInherited(DefaultFrameWriter.TEXT + "")) { 3629 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.TEXT_STR)) { 3409 3630 return this.getClassic().getText(); 3410 3631 } else { … … 3646 3867 3647 3868 public int getMagnetizedItemLeft() { 3648 Surrogate surrogate = Surrogate.of(this); 3649 if (surrogate != null && 3650 surrogate.isPropertyIsInherited(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT + "")) { 3869 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR)) { 3651 3870 return this.getClassic().getMagnetizedItemLeft(); 3652 3871 } else { … … 3662 3881 public void setMagnetizedItemLeft(final int id) { 3663 3882 setMagnetizedItemLeft(this.getParent().getItemWithID(id)); 3883 3884 if (isSurrogate()) { 3885 surrogatePropertyInheritance.put(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR, false); 3886 Item classic = getClassic(); 3887 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR)) { 3888 classic.classicPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR, EncryptionDetail.InheritanceCheckOnSave); 3889 } 3890 } 3664 3891 } 3665 3892 3666 3893 public int getMagnetizedItemRight() { 3667 Surrogate surrogate = Surrogate.of(this); 3668 if (surrogate != null && 3669 surrogate.isPropertyIsInherited(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT + "")) { 3894 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR)) { 3670 3895 return this.getClassic().getMagnetizedItemRight(); 3671 3896 } else { … … 3681 3906 public void setMagnetizedItemRight(final int id) { 3682 3907 setMagnetizedItemRight(this.getParent().getItemWithID(id)); 3908 3909 if (isSurrogate()) { 3910 surrogatePropertyInheritance.put(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR, false); 3911 Item classic = getClassic(); 3912 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR)) { 3913 classic.classicPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 3914 } 3915 } 3683 3916 } 3684 3917 3685 3918 public int getMagnetizedItemTop() { 3686 Surrogate surrogate = Surrogate.of(this); 3687 if (surrogate != null && 3688 surrogate.isPropertyIsInherited(DefaultFrameWriter.MAGNETIZED_ITEM_TOP + "")) { 3919 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR)) { 3689 3920 return this.getClassic().getMagnetizedItemTop(); 3690 3921 } else { … … 3700 3931 public void setMagnetizedItemTop(final int id) { 3701 3932 setMagnetizedItemTop(this.getParent().getItemWithID(id)); 3933 3934 if (isSurrogate()) { 3935 surrogatePropertyInheritance.put(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR, false); 3936 Item classic = getClassic(); 3937 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR)) { 3938 classic.classicPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR, EncryptionDetail.InheritanceCheckOnSave); 3939 } 3940 } 3702 3941 } 3703 3942 3704 3943 public int getMagnetizedItemBottom() { 3705 Surrogate surrogate = Surrogate.of(this); 3706 if (surrogate != null && 3707 surrogate.isPropertyIsInherited(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM + "")) { 3944 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR)) { 3708 3945 return this.getClassic().getMagnetizedItemBottom(); 3709 3946 } else { … … 3719 3956 public void setMagnetizedItemBottom(final int id) { 3720 3957 setMagnetizedItemBottom(this.getParent().getItemWithID(id)); 3958 3959 if (isSurrogate()) { 3960 surrogatePropertyInheritance.put(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR, false); 3961 Item classic = getClassic(); 3962 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR)) { 3963 classic.classicPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR, EncryptionDetail.InheritanceCheckOnSave); 3964 } 3965 } 3721 3966 } 3722 3967 3723 3968 public String getEncryptionLabel() { 3724 Surrogate surrogate = Surrogate.of(this); 3725 if (surrogate != null && 3726 surrogate.isPropertyIsInherited(DefaultFrameWriter.ENCRYPTION_LABEL + "")) { 3969 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ENCRYPTION_LABEL_STR)) { 3727 3970 return this.getClassic().getEncryptionLabel(); 3728 3971 } else { … … 3734 3977 this._encryptionLabel = label; 3735 3978 if (this.getSurrogates().isEmpty()) { 3736 Surrogate surrogate = Surrogate.forItem(this); 3737 this.addToSurrogates(surrogate); 3738 } 3979 Item copy = this.copy(); 3980 if (copy instanceof Text) { copy.setText("Encrypted"); } 3981 this.addToSurrogates(copy); 3982 } 3983 3984 3739 3985 3740 3986 for (Character tag: DefaultFrameWriter.getItemTags().keySet()) { 3741 3987 if (tag == 'S') { 3742 propertyEncryption.put(tag + "", EncryptionDetail.UnencryptedOnSave);3988 classicPropertyEncryption.put(tag + "", EncryptionDetail.UnencryptedOnSave); 3743 3989 } else { 3744 propertyEncryption.put(tag + "", EncryptionDetail.ReencryptOnSave); 3990 classicPropertyEncryption.put(tag + "", EncryptionDetail.ReencryptOnSave); 3991 } 3992 3993 for (Item surrogate: this.getSurrogates()) { 3994 if (tag == 'T') { 3995 surrogate.surrogatePropertyInheritance.put(tag + "", false); 3996 } else { 3997 surrogate.surrogatePropertyInheritance.put(tag + "", true); 3998 } 3745 3999 } 3746 4000 } … … 3748 4002 for (String tag: DefaultFrameWriter.getItemTagsExt().keySet()) { 3749 4003 if (tag == "_el") { 3750 propertyEncryption.put(tag, EncryptionDetail.UnencryptedOnSave);4004 classicPropertyEncryption.put(tag, EncryptionDetail.UnencryptedOnSave); 3751 4005 } else { 3752 propertyEncryption.put(tag, EncryptionDetail.ReencryptOnSave); 3753 } 3754 } 4006 classicPropertyEncryption.put(tag, EncryptionDetail.ReencryptOnSave); 4007 } 4008 4009 for (Item surrogate: this.getSurrogates()) { 4010 surrogate.surrogatePropertyInheritance.put(tag + "", true); 4011 } 4012 } 4013 4014 /* if (isSurrogate()) { 4015 surrogatePropertyInheritance.put(DefaultFrameWriter.ENCRYPTION_LABEL_STR, false); 4016 Item classic = getClassic(); 4017 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ENCRYPTION_LABEL_STR)) { 4018 classic.classicPropertyEncryption.put(DefaultFrameWriter.ENCRYPTION_LABEL_STR, EncryptionDetail.InheritanceCheckOnSave); 4019 } 4020 }*/ 3755 4021 } 3756 4022 … … 3760 4026 for (Character tag: DefaultFrameWriter.getItemTags().keySet()) { 3761 4027 if (tag == 'S') { 3762 propertyEncryption.put(tag + "", EncryptionDetail.UnencryptedOnSave);4028 classicPropertyEncryption.put(tag + "", EncryptionDetail.UnencryptedOnSave); 3763 4029 } else { 3764 propertyEncryption.put(tag + "", EncryptionDetail.ReencryptOnSave);4030 classicPropertyEncryption.put(tag + "", EncryptionDetail.ReencryptOnSave); 3765 4031 } 3766 4032 } … … 3768 4034 for (String tag: DefaultFrameWriter.getItemTagsExt().keySet()) { 3769 4035 if (tag == "_el") { 3770 propertyEncryption.put(tag, EncryptionDetail.UnencryptedOnSave);4036 classicPropertyEncryption.put(tag, EncryptionDetail.UnencryptedOnSave); 3771 4037 } else { 3772 propertyEncryption.put(tag, EncryptionDetail.ReencryptOnSave);4038 classicPropertyEncryption.put(tag, EncryptionDetail.ReencryptOnSave); 3773 4039 } 3774 4040 } … … 3826 4092 } 3827 4093 3828 public Set< Surrogate> getSurrogates() {4094 public Set<Item> getSurrogates() { 3829 4095 return surrogateItems; 3830 4096 } 3831 4097 3832 p ublicvoid setAsSurrogateFor(Item classic) {4098 private void setAsSurrogateFor(Item classic) { 3833 4099 this.surrogateFor = classic; 3834 4100 } 3835 4101 3836 public void addToSurrogates( Surrogatesurrogate) {4102 public void addToSurrogates(Item surrogate) { 3837 4103 this.surrogateItems.add(surrogate); 4104 surrogate.setAsSurrogateFor(this); 3838 4105 } 3839 4106 … … 3847 4114 3848 4115 public EncryptionDetail getEncryptionDetailForTag(String tag) { 3849 EncryptionDetail encryptionDetail = propertyEncryption.get(tag);4116 EncryptionDetail encryptionDetail = classicPropertyEncryption.get(tag); 3850 4117 3851 4118 if (encryptionDetail == null) { … … 3857 4124 3858 4125 public void setEncryptionDetailForTag(String tag, EncryptionDetail encryptionDetail) { 3859 propertyEncryption.put(tag, encryptionDetail); 4126 classicPropertyEncryption.put(tag, encryptionDetail); 4127 } 4128 4129 public boolean isTagInherited(String tag) { 4130 return surrogatePropertyInheritance.get(tag); 4131 } 4132 4133 4134 /** 4135 * If when setting a property, we find that the classic has a undeciphered value, when we must containue using that undeciphered value 4136 * when eventually saving. 4137 * @return 4138 */ 4139 protected boolean subjectToInheritanceCheckOnSave(String tag) { 4140 if (getClassic() == null) return false; 4141 return getClassic().classicPropertyEncryption.get(tag) != EncryptionDetail.UseUndecipheredValueOnSave; 3860 4142 } 3861 4143 } -
trunk/src/org/expeditee/items/Text.java
r1410 r1413 41 41 import org.expeditee.core.bounds.AxisAlignedBoxBounds; 42 42 import org.expeditee.core.bounds.PolygonBounds; 43 import org.expeditee.encryption.items.surrogates. Surrogate;43 import org.expeditee.encryption.items.surrogates.EncryptionDetail; 44 44 import org.expeditee.gio.EcosystemManager; 45 45 import org.expeditee.gio.GraphicsManager; … … 404 404 rebuild(true); 405 405 invalidateAll(); 406 407 if (isSurrogate()) { 408 surrogatePropertyInheritance.put(DefaultFrameWriter.WIDTH_TO_SAVE_STR, false); 409 Item classic = getClassic(); 410 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.WIDTH_TO_SAVE_STR)) { 411 classic.classicPropertyEncryption.put(DefaultFrameWriter.WIDTH_TO_SAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 412 } 413 } 406 414 } 407 415 … … 419 427 rebuild(true); 420 428 invalidateAll(); 429 430 if (isSurrogate()) { 431 surrogatePropertyInheritance.put(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR, false); 432 Item classic = getClassic(); 433 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR)) { 434 classic.classicPropertyEncryption.put(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 435 } 436 } 421 437 } 422 438 … … 434 450 @Override 435 451 public Integer getWidth() { 436 if ( _width == null || _width <= 0) {437 return null;438 } 439 440 return _width;452 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.WIDTH_TO_SAVE_STR)) { 453 return this.getClassic().getWidth(); 454 } else { 455 return _width; 456 } 441 457 } 442 458 … … 450 466 451 467 public Integer getMinWidth() { 452 if (_minWidth == null || _minWidth <= 0) { 453 return null; 454 } 455 return _minWidth; 468 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR)) { 469 return this.getClassic().getMinWidth(); 470 } else { 471 return _minWidth; 472 } 456 473 } 457 474 … … 465 482 @Override 466 483 public Colour getHighlightColor() { 467 if (_highlightColour.equals(getPaintBackgroundColor())) { 468 return ALTERNATE_HIGHLIGHT; 469 } 470 return _highlightColour; 484 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.HIGHLIGHT_STR)) { 485 return this.getClassic().getHighlightColor(); 486 } else { 487 return _highlightColour; 488 } 471 489 } 472 490 … … 490 508 rebuild(true); 491 509 invalidateAll(); 510 511 if (isSurrogate()) { 512 surrogatePropertyInheritance.put(DefaultFrameWriter.JUSTIFICATION_STR, false); 513 Item classic = getClassic(); 514 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.JUSTIFICATION_STR)) { 515 classic.classicPropertyEncryption.put(DefaultFrameWriter.JUSTIFICATION_STR, EncryptionDetail.InheritanceCheckOnSave); 516 } 517 } 492 518 } 493 519 … … 501 527 */ 502 528 public Justification getJustification() { 503 Surrogate surrogate = Surrogate.of(this); 504 if (surrogate != null && 505 surrogate.isPropertyIsInherited(DefaultFrameWriter.JUSTIFICATION + "")) { 529 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.JUSTIFICATION_STR)) { 506 530 return ((Text) this.getClassic()).getJustification(); 507 531 } else { … … 665 689 666 690 rebuild(true); 691 692 if (isSurrogate()) { 693 surrogatePropertyInheritance.put(DefaultFrameWriter.TEXT_STR, false); 694 Item classic = getClassic(); 695 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TEXT_STR)) { 696 classic.classicPropertyEncryption.put(DefaultFrameWriter.TEXT_STR, EncryptionDetail.InheritanceCheckOnSave); 697 } 698 } 667 699 } 668 700 … … 1295 1327 1296 1328 invalidateAll(); 1329 1330 if (isSurrogate()) { 1331 surrogatePropertyInheritance.put(DefaultFrameWriter.FONT_STR, false); 1332 Item classic = getClassic(); 1333 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FONT_STR)) { 1334 classic.classicPropertyEncryption.put(DefaultFrameWriter.FONT_STR, EncryptionDetail.InheritanceCheckOnSave); 1335 } 1336 } 1297 1337 } 1298 1338 … … 1303 1343 */ 1304 1344 public Font getFont() { 1305 Surrogate surrogate = Surrogate.of(this); 1306 if (surrogate != null && 1307 surrogate.isPropertyIsInherited(DefaultFrameWriter.FONT + "")) { 1345 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.FONT_STR)) { 1308 1346 return ((Text) this.getClassic()).getFont(); 1309 1347 } else { … … 1469 1507 @Override 1470 1508 public String getText() { 1471 return _text.toString(); 1509 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.TEXT_STR)) { 1510 return this.getClassic().getText(); 1511 } else { 1512 return _text.toString(); 1513 } 1472 1514 } 1473 1515 … … 1507 1549 _spacing = spacing; 1508 1550 invalidateBounds(); 1551 1552 if (isSurrogate()) { 1553 surrogatePropertyInheritance.put(DefaultFrameWriter.SPACING_STR, false); 1554 Item classic = getClassic(); 1555 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.SPACING_STR)) { 1556 classic.classicPropertyEncryption.put(DefaultFrameWriter.SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1557 } 1558 } 1509 1559 } 1510 1560 … … 1515 1565 */ 1516 1566 public float getSpacing() { 1517 Surrogate surrogate = Surrogate.of(this); 1518 if (surrogate != null && 1519 surrogate.isPropertyIsInherited(DefaultFrameWriter.SPACING + "")) { 1567 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.SPACING_STR)) { 1520 1568 return ((Text) this.getClassic()).getSpacing(); 1521 1569 } else { … … 1542 1590 public void setWordSpacing(int spacing) { 1543 1591 _word_spacing = spacing; 1592 1593 if (isSurrogate()) { 1594 surrogatePropertyInheritance.put(DefaultFrameWriter.WORD_SPACING_STR, false); 1595 Item classic = getClassic(); 1596 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.WORD_SPACING_STR)) { 1597 classic.classicPropertyEncryption.put(DefaultFrameWriter.WORD_SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1598 } 1599 } 1544 1600 } 1545 1601 1546 1602 public int getWordSpacing() { 1547 Surrogate surrogate = Surrogate.of(this); 1548 if (surrogate != null && 1549 surrogate.isPropertyIsInherited(DefaultFrameWriter.WORD_SPACING + "")) { 1603 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.WORD_SPACING_STR)) { 1550 1604 return ((Text) this.getClassic()).getWordSpacing(); 1551 1605 } else { … … 1567 1621 currentFont.setSpacing(spacing); 1568 1622 // setFont(currentFont); 1623 1624 if (isSurrogate()) { 1625 surrogatePropertyInheritance.put(DefaultFrameWriter.LETTER_SPACING_STR, false); 1626 Item classic = getClassic(); 1627 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LETTER_SPACING_STR)) { 1628 classic.classicPropertyEncryption.put(DefaultFrameWriter.LETTER_SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1629 } 1630 } 1569 1631 } 1570 1632 … … 1574 1636 */ 1575 1637 public float getLetterSpacing() { 1576 Surrogate surrogate = Surrogate.of(this); 1577 if (surrogate != null && 1578 surrogate.isPropertyIsInherited(DefaultFrameWriter.LETTER_SPACING + "")) { 1638 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.LETTER_SPACING_STR)) { 1579 1639 return ((Text) this.getClassic()).getLetterSpacing(); 1580 1640 } else { … … 1585 1645 public void setInitialSpacing(float spacing) { 1586 1646 _initial_spacing = spacing; 1647 1648 if (isSurrogate()) { 1649 surrogatePropertyInheritance.put(DefaultFrameWriter.INITIAL_SPACING_STR, false); 1650 Item classic = getClassic(); 1651 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.INITIAL_SPACING_STR)) { 1652 classic.classicPropertyEncryption.put(DefaultFrameWriter.INITIAL_SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1653 } 1654 } 1587 1655 } 1588 1656 1589 1657 public float getInitialSpacing() { 1590 Surrogate surrogate = Surrogate.of(this); 1591 if (surrogate != null && 1592 surrogate.isPropertyIsInherited(DefaultFrameWriter.INITIAL_SPACING + "")) { 1658 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.INITIAL_SPACING_STR)) { 1593 1659 return ((Text) this.getClassic()).getInitialSpacing(); 1594 1660 } else { … … 2795 2861 invalidateCommonTrait(ItemAppearence.PostMoved); 2796 2862 invalidateFill(); 2863 2864 if (isSurrogate()) { 2865 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_LEFT_STR, false); 2866 Item classic = getClassic(); 2867 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_LEFT_STR)) { 2868 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_LEFT_STR, EncryptionDetail.InheritanceCheckOnSave); 2869 } 2870 } 2797 2871 } 2798 2872 … … 2821 2895 invalidateCommonTrait(ItemAppearence.PostMoved); 2822 2896 invalidateFill(); 2897 2898 if (isSurrogate()) { 2899 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, false); 2900 Item classic = getClassic(); 2901 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_RIGHT_STR)) { 2902 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 2903 } 2904 } 2823 2905 } 2824 2906 … … 2854 2936 invalidateCommonTrait(ItemAppearence.PostMoved); 2855 2937 invalidateFill(); 2938 2939 if (isSurrogate()) { 2940 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_TOP_STR, false); 2941 Item classic = getClassic(); 2942 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_TOP_STR)) { 2943 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_TOP_STR, EncryptionDetail.InheritanceCheckOnSave); 2944 } 2945 } 2856 2946 } 2857 2947 … … 2892 2982 invalidateCommonTrait(ItemAppearence.PostMoved); 2893 2983 invalidateFill(); 2984 2985 if (isSurrogate()) { 2986 surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, false); 2987 Item classic = getClassic(); 2988 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_BOTTOM_STR)) { 2989 classic.classicPropertyEncryption.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, EncryptionDetail.InheritanceCheckOnSave); 2990 } 2991 } 2894 2992 } 2895 2993 … … 3047 3145 3048 3146 public boolean getAutoWrap() { 3049 Surrogate surrogate = Surrogate.of(this); 3050 if (surrogate != null && 3051 surrogate.isPropertyIsInherited(DefaultFrameWriter.AUTO_WRAP_TO_SAVE + "")) { 3147 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR)) { 3052 3148 return ((Text) this.getClassic()).getAutoWrap(); 3053 3149 } else { … … 3059 3155 // normally 3060 3156 public String getAutoWrapToSave() { 3061 if (! _autoWrap) {3157 if (!getAutoWrap()) { 3062 3158 return null; 3063 3159 } … … 3067 3163 public void setAutoWrap(boolean autoWrap) { 3068 3164 _autoWrap = autoWrap; 3165 3166 if (isSurrogate()) { 3167 surrogatePropertyInheritance.put(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR, false); 3168 Item classic = getClassic(); 3169 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR)) { 3170 classic.classicPropertyEncryption.put(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 3171 } 3172 } 3069 3173 } 3070 3174 … … 3189 3293 3190 3294 public Integer getMask() { 3191 Surrogate surrogate = Surrogate.of(this); 3192 if (surrogate != null && 3193 surrogate.isPropertyIsInherited(DefaultFrameWriter.MASK + "")) { 3295 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.MASK_STR)) { 3194 3296 return ((Text) this.getClassic()).getMask(); 3195 3297 } else { 3196 if (_mask == null) { 3197 return null; 3198 } else { 3199 return _mask; 3200 } 3201 } 3202 3298 return _mask; 3299 } 3203 3300 } 3204 3301 3205 3302 public void setMask(final Integer c) { 3206 3303 _mask = c; 3304 3305 if (isSurrogate()) { 3306 surrogatePropertyInheritance.put(DefaultFrameWriter.MASK_STR, false); 3307 Item classic = getClassic(); 3308 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MASK_STR)) { 3309 classic.classicPropertyEncryption.put(DefaultFrameWriter.MASK_STR, EncryptionDetail.InheritanceCheckOnSave); 3310 } 3311 } 3207 3312 } 3208 3313 3209 3314 public String getPlaceholder() { 3210 Surrogate surrogate = Surrogate.of(this); 3211 if (surrogate != null && 3212 surrogate.isPropertyIsInherited(DefaultFrameWriter.PLACEHOLDER + "")) { 3315 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.PLACEHOLDER_STR)) { 3213 3316 return ((Text) this.getClassic()).getPlaceholder(); 3214 3317 } else { … … 3222 3325 public void setPlaceholder(String _placeholder) { 3223 3326 this._placeholder = new StringBuffer(_placeholder); 3327 3328 if (isSurrogate()) { 3329 surrogatePropertyInheritance.put(DefaultFrameWriter.PLACEHOLDER_STR, false); 3330 Item classic = getClassic(); 3331 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.PLACEHOLDER_STR)) { 3332 classic.classicPropertyEncryption.put(DefaultFrameWriter.PLACEHOLDER_STR, EncryptionDetail.InheritanceCheckOnSave); 3333 } 3334 } 3224 3335 } 3225 3336 … … 3235 3346 3236 3347 public boolean isSingleLineOnly() { 3237 Surrogate surrogate = Surrogate.of(this); 3238 if (surrogate != null && 3239 surrogate.isPropertyIsInherited(DefaultFrameWriter.SINGLE_LINE_ONLY + "")) { 3348 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.SINGLE_LINE_ONLY_STR)) { 3240 3349 return ((Text) this.getClassic()).isSingleLineOnly(); 3241 3350 } else { … … 3246 3355 public void setSingleLineOnly(boolean _singleLine) { 3247 3356 this._singleLine = _singleLine; 3357 3358 if (isSurrogate()) { 3359 surrogatePropertyInheritance.put(DefaultFrameWriter.SINGLE_LINE_ONLY_STR, false); 3360 Item classic = getClassic(); 3361 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.SINGLE_LINE_ONLY_STR)) { 3362 classic.classicPropertyEncryption.put(DefaultFrameWriter.SINGLE_LINE_ONLY_STR, EncryptionDetail.InheritanceCheckOnSave); 3363 } 3364 } 3248 3365 } 3249 3366 3250 3367 public int getTabIndex() { 3251 Surrogate surrogate = Surrogate.of(this); 3252 if (surrogate != null && 3253 surrogate.isPropertyIsInherited(DefaultFrameWriter.TAB_INDEX + "")) { 3368 if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.TAB_INDEX_STR)) { 3254 3369 return ((Text) this.getClassic()).getTabIndex(); 3255 3370 } else { … … 3260 3375 public void setTabIndex(int index) { 3261 3376 this._tabIndex = index; 3377 3378 if (isSurrogate()) { 3379 surrogatePropertyInheritance.put(DefaultFrameWriter.TAB_INDEX_STR, false); 3380 Item classic = getClassic(); 3381 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TAB_INDEX_STR)) { 3382 classic.classicPropertyEncryption.put(DefaultFrameWriter.TAB_INDEX_STR, EncryptionDetail.InheritanceCheckOnSave); 3383 } 3384 } 3262 3385 } 3263 3386
Note:
See TracChangeset
for help on using the changeset viewer.