Changeset 10 for trunk/src/org/expeditee/gui/Frame.java
- Timestamp:
- 05/01/08 17:02:40 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Frame.java
r7 r10 8 8 import java.awt.image.VolatileImage; 9 9 import java.util.ArrayList; 10 import java.util.Collection; 10 11 import java.util.Collections; 11 12 import java.util.LinkedList; … … 16 17 import org.expeditee.io.Logger; 17 18 import org.expeditee.items.Dot; 19 import org.expeditee.items.InteractiveWidget; 18 20 import org.expeditee.items.Item; 19 21 import org.expeditee.items.ItemUtils; 20 22 import org.expeditee.items.Line; 21 23 import org.expeditee.items.Text; 24 import org.expeditee.items.WidgetCorner; 22 25 23 26 /** … … 86 89 87 90 public static List<Item> FreeItems = new ArrayList<Item>(); 91 92 // for drawing purposes 93 private List<InteractiveWidget> _iWidgets = new ArrayList<InteractiveWidget>(); 88 94 89 95 private int _lineCount = 0; … … 140 146 i.setID(++_lineCount); 141 147 } 148 149 /** 150 * 151 * @return The interactive widgets that are currently ancored in this frame. 152 * Hence it exlcudes free-widgets. 153 */ 154 public List<InteractiveWidget> getInteractiveWidgets() { 155 return Collections.unmodifiableList(this._iWidgets); 156 // return this._iWidgets; // faster 157 } 142 158 143 159 /** … … 163 179 _change = value; 164 180 165 if (_change) 181 if (_change){ 166 182 setBufferValid(false); 167 183 _saved = false; … … 186 202 _sorted = true; 187 203 } 188 204 189 205 List<Item> visibleItems = new ArrayList<Item>(); 190 191 for (Item i: _body) {206 207 for(Item i: _body) { 192 208 if (i.isVisible()) 193 209 visibleItems.add(i); 194 210 } 195 211 196 212 return visibleItems; 197 213 } … … 214 230 } 215 231 216 return bodyTextItems; 217 232 return bodyTextItems; 218 233 } 219 234 … … 289 304 if (autoBulletText.length() > 0) 290 305 frameTitle.stripFirstWord(); 306 } 307 //TODO Widgets... check this out 308 // Brook: Cannot figure what is going on above... widget annot titles should be stripped always 309 if (ItemUtils.isTag(frameTitle, ItemUtils.GetTag(ItemUtils.TAG_IWIDGET))) { 310 frameTitle.stripFirstWord(); 291 311 } 292 312 … … 452 472 if (_frameName != null) { 453 473 id = _frameName.getID(); 454 } else 474 } else{ 455 475 id = -1 * getNextItemID(); 456 476 } … … 575 595 if (item != null) { 576 596 if (_body.contains(item)) { 577 // 578 // 597 //System.out.println("Item (" + item.getClass().getSimpleName() 598 // + ") with ID " + item.getID() + " already in body."); 579 599 return; 580 600 } … … 582 602 if (item instanceof Line) 583 603 _lineCount++; 584 604 585 605 _itemCount = Math.max(_itemCount, item.getID()); 586 606 … … 591 611 592 612 item.setMaxSize(FrameGraphics.getMaxFrameSize()); 613 //add widget items to the list of widgets 614 if (item instanceof WidgetCorner) { 615 InteractiveWidget iw = ((WidgetCorner)item).getWidgetSource(); 616 if (!this._iWidgets.contains(iw)) { // A set would have been best 617 _iWidgets.add(iw); 618 } 619 } 620 621 item.onAddedToFrame(); 622 593 623 change(); 594 624 } … … 608 638 } 609 639 610 public void addAllItems( List<Item> toAdd) {640 public void addAllItems(Collection<Item> toAdd) { 611 641 for (Item i : toAdd) 612 642 addItem(i); 613 643 } 614 644 615 public void removeAllItems( List<Item> toRemove) {645 public void removeAllItems(Collection<Item> toRemove) { 616 646 for (Item i : toRemove) 617 647 removeItem(i); … … 621 651 if (_body.remove(item)) 622 652 change(); 653 654 //Remove widgets from the widget list 655 if (item != null) { 656 item.onRemovedFromFrame(); 657 if (item instanceof WidgetCorner) { 658 _iWidgets.remove(((WidgetCorner)item).getWidgetSource()); 659 } 660 } 661 623 662 } 624 663 … … 951 990 List<Item> copies = ItemUtils.CopyItems(toMergeWith.getItems()); 952 991 copies.remove(toMergeWith.getFrameNameItem()); 953 992 954 993 for (Item i : copies) { 955 994 if (i.getID() >= 0) {
Note:
See TracChangeset
for help on using the changeset viewer.