Changeset 376 for trunk/src/org/expeditee/gui/Frame.java
- Timestamp:
- 11/02/08 13:05:01 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Frame.java
r362 r376 204 204 boolean oldValue = _change; 205 205 206 if (value) {207 208 }206 // if (value) { 207 // notifyObservers(); 208 // } 209 209 210 210 if (oldValue == value) … … 219 219 } 220 220 221 public void notifyObservers() { 221 //private static int updateCount = 0; 222 223 /** 224 * Notify items observing the data on this frame that the frame content has 225 * changed. 226 * 227 * @param recalculate 228 * true if the frame should be recalculated first. 229 */ 230 public void notifyObservers(boolean bRecalculate) { 231 if(bRecalculate){ 232 recalculate(); 233 } 222 234 // Notify the frame listeners that the frame has changed 223 for (FrameObserver fl : _observers) { 224 fl.update(); 235 /* 236 * Avoid ConcurrentMod Exceptions when user anchors an item onto this 237 * frame which is observing this frame, by NOT using foreach loop. 238 * Calling update on a dataFrameWidget resets its subjects hence 239 * changing this frames observer list. 240 */ 241 Collection<FrameObserver> observersCopy = new LinkedList<FrameObserver>( 242 _observers); 243 //System.out.println(++updateCount + " update"); 244 245 for (FrameObserver fl : observersCopy) { 246 if (/* !Item.isLocked(fl) && */fl.isVisible()) 247 fl.update(); 225 248 } 226 249 } … … 370 393 if (UserSettings.TitleTemplate == null) { 371 394 frameTitle = new Text(getNextItemID(), title); 395 /* 396 * Need to set the parent otherwise an exception is thrown when 397 * new profile is created 398 */ 399 frameTitle.setParent(this); 372 400 frameTitle.resetTitlePosition(); 373 401 } else { … … 721 749 item.onParentStateChanged(new ItemParentStateChangedEvent(this, 722 750 ItemParentStateChangedEvent.EVENT_TYPE_ADDED)); 723 if (recalculate && item.recalculateWhenChanged()) 724 recalculate(); 751 752 // if (recalculate && item.recalculateWhenChanged()) 753 // recalculate(); 725 754 726 755 change(); … … 799 828 } 800 829 // TODO Improve efficiency when removeAll is called 801 if (recalculate && item.recalculateWhenChanged())802 830 // if (recalculate && item.recalculateWhenChanged()) 831 // recalculate(); 803 832 } 804 833 } … … 834 863 Item undo = null; 835 864 boolean bReparse = false; 865 boolean bRecalculate = false; 836 866 837 867 if (_undo.size() <= 0) … … 871 901 for (Item i : toRestore) { 872 902 bReparse |= i.hasOverlay(); 903 bRecalculate |= i.recalculateWhenChanged(); 873 904 if (i instanceof Line) { 874 905 Line line = (Line) i; … … 885 916 if (bReparse) 886 917 FrameUtils.Parse(this, false); 918 else { 919 notifyObservers(bRecalculate); 920 } 887 921 FrameGraphics.Repaint(); 888 922 ItemUtils.EnclosedCheck(_body); … … 1455 1489 // t.setMaxWidth(FrameGraphics.getMaxFrameSize().width); 1456 1490 // if (t.getWidth() <= 0) { 1457 //String maxWidthString = getAnnotationValue("maxwidth");1458 //int width = FrameGraphics.getMaxFrameSize().width;1459 //if (maxWidthString != null) {1460 //try {1461 //width = Math.min(width, Integer.parseInt(maxWidthString));1462 //} catch (NumberFormatException nfe) {1463 //}1464 //}1465 //1466 //t.setRightMargin(width);1491 // String maxWidthString = getAnnotationValue("maxwidth"); 1492 // int width = FrameGraphics.getMaxFrameSize().width; 1493 // if (maxWidthString != null) { 1494 // try { 1495 // width = Math.min(width, Integer.parseInt(maxWidthString)); 1496 // } catch (NumberFormatException nfe) { 1497 // } 1498 // } 1499 // 1500 // t.setRightMargin(width); 1467 1501 // } 1468 1502 addItem(t); … … 2023 2057 2024 2058 public void recalculate() { 2059 2025 2060 for (Item i : getItems()) { 2026 2061 if (i.hasFormula() && !i.isAnnotation()) { … … 2118 2153 } 2119 2154 } 2155 2156 public boolean hasObservers() { 2157 return _observers != null && _observers.size() > 0; 2158 } 2120 2159 }
Note:
See TracChangeset
for help on using the changeset viewer.