Changeset 1415 for trunk/src/org/expeditee/items/Item.java
- Timestamp:
- 07/24/19 11:23:45 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Item.java
r1414 r1415 48 48 import org.expeditee.core.bounds.PolygonBounds; 49 49 import org.expeditee.encryption.items.surrogates.EncryptionDetail; 50 import org.expeditee.encryption.items.surrogates.EncryptionDetail.Type; 51 import org.expeditee.encryption.items.surrogates.Label; 52 import org.expeditee.encryption.items.surrogates.Label.LabelResult; 50 53 //import org.expeditee.encryption.items.surrogates.Surrogate; 51 54 import org.expeditee.gio.EcosystemManager; … … 156 159 157 160 public static final Cursor.CursorType CROP_CURSOR = Cursor.CursorType.CROSSHAIR; 158 161 159 162 /** The default value for integer attributes */ 160 163 public static final int DEFAULT_INTEGER = -1; 161 164 162 165 private static final int BRIGHTNESS = 185; 163 166 164 167 /** Contains all dots (including this one) that form an enclosure if this dot is part of an enclosing shape. */ 165 168 private Collection<Item> _enclosure = null; … … 317 320 318 321 private Data _data = new Data(); 322 323 // Used via reflection by AttributeUtils to determine if the boolean value is different from default. 324 public static final boolean acceptsKeyboardEnterDefault = false; 325 private boolean _acceptsKeyboardEnter = acceptsKeyboardEnterDefault; 319 326 320 327 private Item surrogateFor = null; … … 326 333 327 334 { 335 EncryptionDetail unencryptedOnSave = new EncryptionDetail(EncryptionDetail.Type.UnencryptedOnSave); 328 336 for(Character tag: DefaultFrameWriter.getItemTags().keySet()) { 329 337 if (tag == 'T' || tag == 'S') { … … 332 340 surrogatePropertyInheritanceDefault.put(tag + "", true); 333 341 } 334 primaryPropertyEncryptionDefault.put(tag + "", EncryptionDetail.UnencryptedOnSave);342 primaryPropertyEncryptionDefault.put(tag + "", unencryptedOnSave); 335 343 } 336 344 337 345 for(String tag: DefaultFrameWriter.getItemTagsExt().keySet()) { 338 346 surrogatePropertyInheritanceDefault.put(tag, true); 339 primaryPropertyEncryptionDefault.put(tag, EncryptionDetail.UnencryptedOnSave);347 primaryPropertyEncryptionDefault.put(tag, unencryptedOnSave); 340 348 } 341 349 } … … 383 391 dest.setLinkTemplate(this.getLinkTemplate()); 384 392 385 // dest.set MaxWidth(this.getMaxWidth());393 // dest.setWidth(this.getWidth()); 386 394 387 395 dest.setOffset(this.getOffset()); … … 424 432 } 425 433 426 final String currentUser = UserSettings.UserName.get(); 427 if (parent != null && (parent.getOwner() == null || currentUser.compareTo(parent.getOwner()) != 0)) { 428 dest.setOwner(currentUser); 429 } 434 String currentUser = UserSettings.UserName.get(); 435 // if (parent != null && !currentUser.equals(parent.getOwner())) { 436 // //dest.setOwner(currentUser); 437 // } else { 438 // System.err.println("I have duplicated a item and made it owned by " 439 // + "current user, whereas the old code would not have " 440 // + "changed ownership at this time."); 441 // System.err.println("Item: " + dest + ", Class: " + dest.getClass()); 442 // System.err.println("Current owner: " + dest.getOwner()); 443 // System.err.println("Current user: " + currentUser); 444 // } 445 dest.setOwner(currentUser); 430 446 } 431 447 … … 438 454 Item primary = getPrimary(); 439 455 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 440 primary.primaryPropertyEncryption.put(DefaultFrameWriter.DOT_TYPE_STR, EncryptionDetail.InheritanceCheckOnSave); 456 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 457 primary.primaryPropertyEncryption.put(DefaultFrameWriter.DOT_TYPE_STR, inheritanceCheckOnSave); 441 458 } 442 459 } … … 461 478 Item primary = getPrimary(); 462 479 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 463 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FILLED_STR, EncryptionDetail.InheritanceCheckOnSave); 480 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 481 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FILLED_STR, inheritanceCheckOnSave); 464 482 } 465 483 } … … 494 512 Item primary = getPrimary(); 495 513 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 496 primary.primaryPropertyEncryption.put(DefaultFrameWriter.GRADIENT_ANGLE_STR, EncryptionDetail.InheritanceCheckOnSave); 514 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 515 primary.primaryPropertyEncryption.put(DefaultFrameWriter.GRADIENT_ANGLE_STR, inheritanceCheckOnSave); 497 516 } 498 517 } … … 567 586 Item primary = getPrimary(); 568 587 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DOT_TYPE_STR)) { 569 primary.primaryPropertyEncryption.put(DefaultFrameWriter.PERMISSION_STR, EncryptionDetail.InheritanceCheckOnSave); 588 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 589 primary.primaryPropertyEncryption.put(DefaultFrameWriter.PERMISSION_STR, inheritanceCheckOnSave); 570 590 } 571 591 } … … 1114 1134 Item primary = getPrimary(); 1115 1135 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FORMULA_STR)) { 1116 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FORMULA_STR, EncryptionDetail.InheritanceCheckOnSave); 1136 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1137 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FORMULA_STR, inheritanceCheckOnSave); 1117 1138 } 1118 1139 } … … 1389 1410 if (otherBounds.equals(thisBounds)) return true; 1390 1411 1391 return otherBounds.intersects(thisBounds); 1412 boolean intersects = otherBounds.intersects(thisBounds); 1413 1414 /*if (intersects) { 1415 System.err.println("Found intersection between this item (" + this + ") with bounds: " + thisBounds + "...and..."); 1416 System.err.println("item with bounds: " + otherBounds.toString()); 1417 }*/ 1418 return intersects; 1392 1419 1393 1420 // Need to check the second equality so that we dont pick up circles … … 1523 1550 Item primary = getPrimary(); 1524 1551 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TOOLTIP_STR)) { 1525 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TOOLTIP_STR, EncryptionDetail.InheritanceCheckOnSave); 1552 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1553 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TOOLTIP_STR, inheritanceCheckOnSave); 1526 1554 } 1527 1555 } … … 1827 1855 Item primary = getPrimary(); 1828 1856 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_STR)) { 1829 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_STR, EncryptionDetail.InheritanceCheckOnSave); 1857 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1858 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_STR, inheritanceCheckOnSave); 1830 1859 } 1831 1860 } … … 1847 1876 Item primary = getPrimary(); 1848 1877 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DATA_STR)) { 1849 primary.primaryPropertyEncryption.put(DefaultFrameWriter.DATA_STR, EncryptionDetail.InheritanceCheckOnSave); 1878 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1879 primary.primaryPropertyEncryption.put(DefaultFrameWriter.DATA_STR, inheritanceCheckOnSave); 1850 1880 } 1851 1881 } … … 1863 1893 Item primary = getPrimary(); 1864 1894 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR)) { 1865 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR, EncryptionDetail.InheritanceCheckOnSave); 1895 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1896 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_CURSOR_ENTER_STR, inheritanceCheckOnSave); 1866 1897 } 1867 1898 } … … 1875 1906 Item primary = getPrimary(); 1876 1907 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR)) { 1877 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 1908 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1909 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_CURSOR_LEAVE_STR, inheritanceCheckOnSave); 1878 1910 } 1879 1911 } … … 1887 1919 Item primary = getPrimary(); 1888 1920 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_ENTER_FRAME_STR)) { 1889 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_ENTER_FRAME_STR, EncryptionDetail.InheritanceCheckOnSave); 1921 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1922 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_ENTER_FRAME_STR, inheritanceCheckOnSave); 1890 1923 } 1891 1924 } … … 1899 1932 Item primary = getPrimary(); 1900 1933 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR)) { 1901 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR, EncryptionDetail.InheritanceCheckOnSave); 1934 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1935 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_LEAVE_FRAME_STR, inheritanceCheckOnSave); 1902 1936 } 1903 1937 } … … 1914 1948 Item primary = getPrimary(); 1915 1949 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ACTION_MARK_STR)) { 1916 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_MARK_STR, EncryptionDetail.InheritanceCheckOnSave); 1950 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1951 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ACTION_MARK_STR, inheritanceCheckOnSave); 1917 1952 } 1918 1953 } … … 1947 1982 Item primary = getPrimary(); 1948 1983 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ARROW_STR)) { 1949 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ARROW_STR, EncryptionDetail.InheritanceCheckOnSave); 1984 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1985 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ARROW_STR, inheritanceCheckOnSave); 1950 1986 } 1951 1987 } … … 1985 2021 Item primary = getPrimary(); 1986 2022 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.BACKGROUND_COLOR_STR)) { 1987 primary.primaryPropertyEncryption.put(DefaultFrameWriter.BACKGROUND_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2023 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2024 primary.primaryPropertyEncryption.put(DefaultFrameWriter.BACKGROUND_COLOR_STR, inheritanceCheckOnSave); 1988 2025 } 1989 2026 } … … 2000 2037 Item primary = getPrimary(); 2001 2038 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.BORDER_COLOR_STR)) { 2002 primary.primaryPropertyEncryption.put(DefaultFrameWriter.BORDER_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2039 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2040 primary.primaryPropertyEncryption.put(DefaultFrameWriter.BORDER_COLOR_STR, inheritanceCheckOnSave); 2003 2041 } 2004 2042 } … … 2039 2077 Item primary = getPrimary(); 2040 2078 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.CONSTRAINT_IDS_STR)) { 2041 primary.primaryPropertyEncryption.put(DefaultFrameWriter.CONSTRAINT_IDS_STR, EncryptionDetail.InheritanceCheckOnSave); 2079 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2080 primary.primaryPropertyEncryption.put(DefaultFrameWriter.CONSTRAINT_IDS_STR, inheritanceCheckOnSave); 2042 2081 } 2043 2082 } … … 2068 2107 Item primary = getPrimary(); 2069 2108 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.DATE_CREATED_STR)) { 2070 primary.primaryPropertyEncryption.put(DefaultFrameWriter.DATE_CREATED_STR, EncryptionDetail.InheritanceCheckOnSave); 2109 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2110 primary.primaryPropertyEncryption.put(DefaultFrameWriter.DATE_CREATED_STR, inheritanceCheckOnSave); 2071 2111 } 2072 2112 } … … 2091 2131 Item primary = getPrimary(); 2092 2132 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FILL_COLOR_STR)) { 2093 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FILL_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2133 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2134 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FILL_COLOR_STR, inheritanceCheckOnSave); 2094 2135 } 2095 2136 } … … 2112 2153 Item primary = getPrimary(); 2113 2154 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.GRADIENT_COLOR_STR)) { 2114 primary.primaryPropertyEncryption.put(DefaultFrameWriter.GRADIENT_COLOR_STR, EncryptionDetail.InheritanceCheckOnSave); 2155 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2156 primary.primaryPropertyEncryption.put(DefaultFrameWriter.GRADIENT_COLOR_STR, inheritanceCheckOnSave); 2115 2157 } 2116 2158 } … … 2134 2176 Item primary = getPrimary(); 2135 2177 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FILL_PATTERN_STR)) { 2136 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FILL_PATTERN_STR, EncryptionDetail.InheritanceCheckOnSave); 2178 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2179 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FILL_PATTERN_STR, inheritanceCheckOnSave); 2137 2180 } 2138 2181 } … … 2156 2199 Item primary = getPrimary(); 2157 2200 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.HIGHLIGHT_STR)) { 2158 primary.primaryPropertyEncryption.put(DefaultFrameWriter.HIGHLIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 2201 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2202 primary.primaryPropertyEncryption.put(DefaultFrameWriter.HIGHLIGHT_STR, inheritanceCheckOnSave); 2159 2203 } 2160 2204 } … … 2175 2219 Item primary = getPrimary(); 2176 2220 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TYPE_AND_ID_STR)) { 2177 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TYPE_AND_ID_STR, EncryptionDetail.InheritanceCheckOnSave); 2221 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2222 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TYPE_AND_ID_STR, inheritanceCheckOnSave); 2178 2223 } 2179 2224 } … … 2191 2236 Item primary = getPrimary(); 2192 2237 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINE_IDS_STR)) { 2193 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINE_IDS_STR, EncryptionDetail.InheritanceCheckOnSave); 2238 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2239 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINE_IDS_STR, inheritanceCheckOnSave); 2194 2240 } 2195 2241 } … … 2206 2252 Item primary = getPrimary(); 2207 2253 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINE_PATTERN_STR)) { 2208 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINE_PATTERN_STR, EncryptionDetail.InheritanceCheckOnSave); 2254 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2255 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINE_PATTERN_STR, inheritanceCheckOnSave); 2209 2256 } 2210 2257 } … … 2246 2293 Item primary = getPrimary(); 2247 2294 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_STR)) { 2248 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_STR, EncryptionDetail.InheritanceCheckOnSave); 2295 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2296 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_STR, inheritanceCheckOnSave); 2249 2297 } 2250 2298 } … … 2258 2306 Item primary = getPrimary(); 2259 2307 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_HISTORY_STR)) { 2260 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_HISTORY_STR, EncryptionDetail.InheritanceCheckOnSave); 2308 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2309 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_HISTORY_STR, inheritanceCheckOnSave); 2261 2310 } 2262 2311 } … … 2284 2333 Item primary = getPrimary(); 2285 2334 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_FRAMESET_STR)) { 2286 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_FRAMESET_STR, EncryptionDetail.InheritanceCheckOnSave); 2335 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2336 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_FRAMESET_STR, inheritanceCheckOnSave); 2287 2337 } 2288 2338 } … … 2299 2349 Item primary = getPrimary(); 2300 2350 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_MARK_STR)) { 2301 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_MARK_STR, EncryptionDetail.InheritanceCheckOnSave); 2351 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2352 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_MARK_STR, inheritanceCheckOnSave); 2302 2353 } 2303 2354 } … … 2316 2367 Item primary = getPrimary(); 2317 2368 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LINK_TEMPLATE_STR)) { 2318 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_TEMPLATE_STR, EncryptionDetail.InheritanceCheckOnSave); 2369 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2370 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LINK_TEMPLATE_STR, inheritanceCheckOnSave); 2319 2371 } 2320 2372 } … … 2350 2402 Item primary = getPrimary(); 2351 2403 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.OWNER_STR)) { 2352 primary.primaryPropertyEncryption.put(DefaultFrameWriter.OWNER_STR, EncryptionDetail.InheritanceCheckOnSave); 2404 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2405 primary.primaryPropertyEncryption.put(DefaultFrameWriter.OWNER_STR, inheritanceCheckOnSave); 2353 2406 } 2354 2407 } … … 2541 2594 Item primary = getPrimary(); 2542 2595 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.POSITION_STR)) { 2543 primary.primaryPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, EncryptionDetail.InheritanceCheckOnSave); 2596 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2597 primary.primaryPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, inheritanceCheckOnSave); 2544 2598 } 2545 2599 } … … 2585 2639 Item primary = getPrimary(); 2586 2640 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.THICKNESS_STR)) { 2587 primary.primaryPropertyEncryption.put(DefaultFrameWriter.THICKNESS_STR, EncryptionDetail.InheritanceCheckOnSave); 2641 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2642 primary.primaryPropertyEncryption.put(DefaultFrameWriter.THICKNESS_STR, inheritanceCheckOnSave); 2588 2643 } 2589 2644 } … … 2697 2752 Item primary = getPrimary(); 2698 2753 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.POSITION_STR)) { 2699 primary.primaryPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, EncryptionDetail.InheritanceCheckOnSave); 2754 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2755 primary.primaryPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, inheritanceCheckOnSave); 2700 2756 } 2701 2757 } … … 2715 2771 Item primary = getPrimary(); 2716 2772 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.POSITION_STR)) { 2717 primary.primaryPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, EncryptionDetail.InheritanceCheckOnSave); 2773 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2774 primary.primaryPropertyEncryption.put(DefaultFrameWriter.POSITION_STR, inheritanceCheckOnSave); 2718 2775 } 2719 2776 } … … 2827 2884 2828 2885 current.addItem(this, false); 2829 current. setResort(true);2886 current.invalidateSorted(); 2830 2887 setRelativeLink(); 2831 2888 setFloating(false); … … 3527 3584 Item primary = getPrimary(); 3528 3585 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_LEFT_STR)) { 3529 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_LEFT_STR, EncryptionDetail.InheritanceCheckOnSave); 3586 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3587 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_LEFT_STR, inheritanceCheckOnSave); 3530 3588 } 3531 3589 } … … 3543 3601 Item primary = getPrimary(); 3544 3602 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_RIGHT_STR)) { 3545 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 3603 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3604 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, inheritanceCheckOnSave); 3546 3605 } 3547 3606 } … … 3559 3618 Item primary = getPrimary(); 3560 3619 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_TOP_STR)) { 3561 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_TOP_STR, EncryptionDetail.InheritanceCheckOnSave); 3620 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3621 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_TOP_STR, inheritanceCheckOnSave); 3562 3622 } 3563 3623 } … … 3576 3636 Item primary = getPrimary(); 3577 3637 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_BOTTOM_STR)) { 3578 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, EncryptionDetail.InheritanceCheckOnSave); 3638 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3639 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, inheritanceCheckOnSave); 3579 3640 } 3580 3641 } … … 3886 3947 Item primary = getPrimary(); 3887 3948 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR)) { 3888 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR, EncryptionDetail.InheritanceCheckOnSave); 3949 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3950 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_LEFT_STR, inheritanceCheckOnSave); 3889 3951 } 3890 3952 } … … 3911 3973 Item primary = getPrimary(); 3912 3974 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR)) { 3913 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 3975 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3976 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_RIGHT_STR, inheritanceCheckOnSave); 3914 3977 } 3915 3978 } … … 3936 3999 Item primary = getPrimary(); 3937 4000 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR)) { 3938 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR, EncryptionDetail.InheritanceCheckOnSave); 4001 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 4002 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_TOP_STR, inheritanceCheckOnSave); 3939 4003 } 3940 4004 } … … 3961 4025 Item primary = getPrimary(); 3962 4026 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR)) { 3963 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR, EncryptionDetail.InheritanceCheckOnSave); 4027 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 4028 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MAGNETIZED_ITEM_BOTTOM_STR, inheritanceCheckOnSave); 3964 4029 } 3965 4030 } … … 3975 4040 3976 4041 public void setEncryptionLabel(String label) { 4042 if (this.getParent().getEncryptionLabel() == null) { 4043 MessageBay.displayMessage("Items can only be entrypted if the frame they are on is."); 4044 return; 4045 } 4046 LabelResult labelResult = Label.getLabel(label); 4047 if (labelResult != LabelResult.SuccessResolveLabelToKey) { 4048 MessageBay.displayMessage(labelResult.toString()); 4049 return; 4050 } 4051 3977 4052 this._encryptionLabel = label; 3978 4053 this.getSurrogates().clear(); … … 3980 4055 if (copy instanceof Text) { copy.setText("Encrypted"); } 3981 4056 this.addToSurrogates(copy); 4057 } 4058 4059 public void setEncryptionLabelOnLoad(String label) { 4060 this._encryptionLabel = label; 3982 4061 } 3983 4062 … … 4006 4085 Frame current = dot.getParentOrCurrentFrame(); 4007 4086 current.removeItem(dot); 4008 ItemUtils.EnclosedCheck(current.get Items());4087 ItemUtils.EnclosedCheck(current.getSortedItems()); 4009 4088 return text; 4010 4089 // TODO: Should this add the newly-created Text item to the frame? cts16 … … 4029 4108 current.addItem(dot); 4030 4109 DisplayController.setCursor(Item.DEFAULT_CURSOR); 4031 ItemUtils.EnclosedCheck(current.get Items());4110 ItemUtils.EnclosedCheck(current.getSortedItems()); 4032 4111 return dot; 4033 4112 } … … 4044 4123 this.surrogateItems.add(surrogate); 4045 4124 surrogate.setAsSurrogateFor(this); 4125 this.getParent().addItem(surrogate); 4126 4127 EncryptionDetail reencryptOnSave = new EncryptionDetail(EncryptionDetail.Type.ReencryptOnSave); 4128 EncryptionDetail unencryptedOnSave = new EncryptionDetail(EncryptionDetail.Type.UnencryptedOnSave); 4129 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 4046 4130 4047 4131 for (Character tag: DefaultFrameWriter.getItemTags().keySet()) { 4048 4132 if (tag == 'T') { 4049 primaryPropertyEncryption.put(tag + "", EncryptionDetail.ReencryptOnSave);4133 primaryPropertyEncryption.put(tag + "", reencryptOnSave.clone()); 4050 4134 } else { 4051 primaryPropertyEncryption.put(tag + "", EncryptionDetail.UnencryptedOnSave);4135 primaryPropertyEncryption.put(tag + "", unencryptedOnSave.clone()); 4052 4136 } 4053 4137 … … 4060 4144 4061 4145 for (String tag: DefaultFrameWriter.getItemTagsExt().keySet()) { 4062 primaryPropertyEncryption.put(tag, EncryptionDetail.UnencryptedOnSave);4146 primaryPropertyEncryption.put(tag, inheritanceCheckOnSave.clone()); 4063 4147 surrogate.surrogatePropertyInheritance.put(tag + "", true); 4064 4148 } … … 4077 4161 4078 4162 if (encryptionDetail == null) { 4079 return EncryptionDetail.UnencryptedOnSave; 4163 EncryptionDetail unencryptedOnSave = new EncryptionDetail(EncryptionDetail.Type.UnencryptedOnSave); 4164 return unencryptedOnSave; 4080 4165 } else { 4081 4166 return encryptionDetail; … … 4091 4176 } 4092 4177 4093 4094 /** 4095 * If when setting a property, we find that the primary has a undeciphered value, when we must containue using that undeciphered value 4178 public void setTagNotInherited(String tag) { 4179 surrogatePropertyInheritance.put(tag, false); 4180 } 4181 4182 public boolean hasAccessToItemAsPrimary() { 4183 String label = this.getEncryptionLabel(); 4184 if (this.isSurrogate() || label == null || label.length() == 0) { 4185 return true; 4186 } 4187 4188 return Label.getLabel(label) == LabelResult.SuccessResolveLabelToKey; 4189 } 4190 4191 4192 /** 4193 * If when setting a property, we find that the primary has a undeciphered value, when we must continue using that undeciphered value 4096 4194 * when eventually saving. 4097 4195 * @return 4098 4196 */ 4099 4197 protected boolean subjectToInheritanceCheckOnSave(String tag) { 4100 if (getPrimary() == null) return false; 4101 return getPrimary().primaryPropertyEncryption.get(tag) != EncryptionDetail.UseUndecipheredValueOnSave; 4198 Item primary = getPrimary(); 4199 if (primary == null) return false; 4200 EncryptionDetail primaryItemTagEncryptionDetail = primary.primaryPropertyEncryption.get(tag); 4201 Type primaryItemTagEncryptionDetailType = primaryItemTagEncryptionDetail.getEncryptionDetailType(); 4202 return primaryItemTagEncryptionDetailType != EncryptionDetail.Type.UseUndecipheredValueOnSave; 4203 } 4204 4205 public boolean acceptsKeyboardEnter() { 4206 return _acceptsKeyboardEnter; 4207 } 4208 4209 public void setAcceptsEnter(boolean value) { 4210 if (this.getText() != null && this.getText().equals("Beep")) { 4211 System.err.println(); 4212 } 4213 _acceptsKeyboardEnter = value; 4102 4214 } 4103 4215 }
Note:
See TracChangeset
for help on using the changeset viewer.