Changeset 1413 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 06/25/19 13:57:37 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.