- Timestamp:
- 11/29/19 15:32:17 (4 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Browser.java
r1434 r1460 141 141 public class Browser implements SaveStateChangedEventListener { 142 142 143 public static final boolean DEBUG = true; 144 143 145 public static final Ecosystem ECOSYSTEM_TYPE = Ecosystem.Swing; 144 146 -
trunk/src/org/expeditee/gui/Frame.java
r1450 r1460 729 729 _frameName = new Text(id); 730 730 _frameName.setParent(this); 731 _frameName.setOwner(this.getOwner());732 731 _frameName.setText(getFramesetName() + _number); 733 732 _frameName.resetFrameNamePosition(); … … 782 781 * The owner to use for this Frame. 783 782 */ 784 public void setOwner(String owner) 785 { 783 public void setOwner(String owner) { 786 784 _owner = owner; 785 if (_frameName != null) { 786 _frameName.setOwner(owner); 787 } else { 788 if (Browser.DEBUG) { 789 System.err.println(" *** Attempted to set owner of Frame when _frameName was null. *** "); 790 } 791 } 787 792 } 788 793 … … 879 884 880 885 public void addItem(Item item, boolean recalculate) { 881 if (item == null) { return; } 882 883 addItem(item, recalculate, getBody(false)); 886 if (item == null) { 887 return; 888 } 889 890 // Get the associated encryption label if it has one. Surrogates use their primaries encryption label. 891 String encryptionLabel = item.getEncryptionLabel(); 884 892 if (item.isSurrogate()) { 885 addItem(item, recalculate, getSurrogateBody()); 893 encryptionLabel = item.getPrimary().getEncryptionLabel(); 894 } 895 896 if (encryptionLabel == null) { 897 // If we do not have an encryption label to go off, then we cannot be a surrogate. 898 // Add item to body and primaryBody 899 addItem(item, recalculate, getBody(false)); 900 addItem(item, recalculate, getPrimaryBody()); 886 901 } else { 887 addItem(item, recalculate, getPrimaryBody()); 902 List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(getPrimaryBody()); 903 if (item.isSurrogate() && accessibleLabelsNames.contains(encryptionLabel)) { 904 // .. If it is a surrogate and its encryption label is currently active, it needs to be added to surrogateBody only 905 // .. This will result in the item disappearing when placed (as it is now accessible in only surrogate mode) 906 addItem(item, recalculate, getSurrogateBody()); 907 } else if (item.isSurrogate() && !accessibleLabelsNames.contains(encryptionLabel)) { 908 // .. If it is a surrogate and its encryption label is not currently active, it needs to be added to body and surrogateBody 909 // .. This will result in the item being visible on the frame. 910 addItem(item, recalculate, getBody(false)); 911 addItem(item, recalculate, getSurrogateBody()); 912 } else if (!item.isSurrogate() && accessibleLabelsNames.contains(encryptionLabel)) { 913 // .. If it is a primary and its encryption label is currently active, it needs to be added to body and primaryBody 914 // .. This will result in the item being visible on the frame. 915 addItem(item, recalculate, getBody(false)); 916 addItem(item, recalculate, getPrimaryBody()); 917 // for (Item surrogate: item.getSurrogates()) { 918 // surrogate.invalidateBounds(); // Should Item::invalidateBounds invalidate its surrogates bounds as well? 919 // } 920 } else { // !item.isSurrogate() && !accessibleLabelsNames.contains(encryptionLabel) 921 // .. If it is a primary and its encryption label is not currently active, it needs to be added to primaryBody only 922 // .. This will result in the item disappearing when placed (as the current surrogate mode does not contain its label) 923 // Note from Bryce: I am not sure this else condition will ever run, but it will not hurt. 924 addItem(item, recalculate, getPrimaryBody()); 925 // for (Item surrogate: item.getSurrogates()) { 926 // surrogate.invalidateBounds(); 927 // } 928 } 888 929 } 889 930 } … … 2699 2740 2700 2741 public Collection<Item> getAllItems() { 2701 ItemsList allItems = new ItemsList(getBody(true));2742 Collection<Item> allItems = getBody(true).cloneList(); 2702 2743 2703 2744 allItems.addAll(_overlayItems); 2704 2745 allItems.addAll(_vectorItems); 2705 return allItems .underlying();2746 return allItems; 2706 2747 } 2707 2748 … … 2883 2924 2884 2925 public Collection<Item> getBodyItemsWithInsufficientPermissions() { 2885 return _bodyHiddenDueToPermissions. underlying();2926 return _bodyHiddenDueToPermissions.cloneList(); 2886 2927 } 2887 2928 … … 3074 3115 */ 3075 3116 private List<Item> getAllFrameItemsRaw() { 3076 Collection<Item> primaries = getPrimaryBody().underlying();3077 Collection<Item> surrogateBody = getSurrogateBody().underlying();3117 List<Item> primaries = getPrimaryBody().cloneList(); 3118 List<Item> surrogateBody = getSurrogateBody().cloneList(); 3078 3119 primaries.addAll(surrogateBody); 3079 3120 List<Item> allFrameItems = primaries.stream().distinct().collect(Collectors.toList());
Note:
See TracChangeset
for help on using the changeset viewer.