Changeset 294
- Timestamp:
- 09/04/08 17:07:39 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r286 r294 334 334 command = command.substring(mname.length()).trim(); 335 335 // If no params are provided get them from a text item on the cursor 336 if (command.length() == 0 && launcher instanceof Text ) {336 if (command.length() == 0 && launcher instanceof Text && launcher.isFloating()) { 337 337 command = launcher.getText(); 338 338 } … … 480 480 } else if (c.getParameterTypes().length == 0 && con == null) { 481 481 con = c; 482 params = null; 482 483 } 483 484 } -
trunk/src/org/expeditee/actions/Misc.java
r284 r294 840 840 841 841 current.addAllItems(newItems); 842 if (item instanceof Text){843 for (Item i: item.getAllConnected()){844 if (i instanceof Line){842 if (item instanceof Text) { 843 for (Item i : item.getAllConnected()) { 844 if (i instanceof Line) { 845 845 item = i; 846 846 break; … … 848 848 } 849 849 } 850 851 if (!(item instanceof Text)) { 852 d[0].setThickness(item.getThickness()); 853 d[0].setFillColor(item.getFillColor()); 850 851 Color newColor = item.getColor(); 852 if (newColor != null) { 854 853 d[0].setColor(item.getColor()); 854 if (item instanceof Text && item.getBackgroundColor() != null) { 855 d[0].setFillColor(item.getBackgroundColor()); 856 }else{ 857 d[0].setFillColor(item.getFillColor()); 858 } 859 } 860 float newThickness = item.getThickness(); 861 if (newThickness > 0) { 862 d[0].setThickness(newThickness); 855 863 } 856 864 … … 860 868 return d[0]; 861 869 } 862 870 863 871 public static void StopReminder() { 864 872 Reminders.stop(); -
trunk/src/org/expeditee/agents/Format.java
r199 r294 30 30 31 31 public Format() { 32 super(); 32 33 } 33 34 -
trunk/src/org/expeditee/agents/SearchAgent.java
r292 r294 12 12 13 13 private static final String DEFAULT_RESULTS_FRAMESET = "SearchResults"; 14 14 15 15 protected FrameCreator _results; 16 16 … … 18 18 19 19 protected String _replacementString; 20 20 21 21 protected String _startName; 22 22 … … 24 24 _pattern = searchText; 25 25 } 26 26 27 27 @Override 28 28 public boolean initialise(Frame frame, Item item) { 29 29 String pattern = item.getText(); 30 30 String resultFrameset = null; 31 32 // TODO use a results frame specified on the profile frame31 32 // TODO use a results frame specified on the profile frame 33 33 if (item.getLink() == null) { 34 34 resultFrameset = DEFAULT_RESULTS_FRAMESET; … … 37 37 false); 38 38 } 39 return initialise(frame, item, frame.getFramesetName(), resultFrameset, null, pattern); 39 return initialise(frame, item, frame.getFramesetName(), resultFrameset, 40 null, pattern); 40 41 } 41 42 42 public boolean initialise(Frame frame, Item item, String startName, String resultsFrameset, 43 String replacementString, String pattern) { 44 _pattern = pattern.toLowerCase(); 43 /** 44 * 45 * @param frame 46 * @param item 47 * @param startName 48 * @param resultsFrameset 49 * @param replacementString 50 * @param pattern 51 * is ignored if the pattern has already been set earlier. 52 * @return 53 */ 54 public boolean initialise(Frame frame, Item item, String startName, 55 String resultsFrameset, String replacementString, String pattern) { 56 //TODO: Put the init params in the constructor!! Dont want to be setting _pattern in two places! 57 58 if (_pattern == null) 59 _pattern = pattern.toLowerCase(); 45 60 _replacementString = replacementString; 46 61 _startName = startName; … … 48 63 // Create a frame to put the results on with the search query 49 64 // and type as the title 50 String title = this.getClass().getSimpleName() + " [" + startName + "] [" + pattern51 + "] ";65 String title = this.getClass().getSimpleName() + " [" + startName 66 + "] [" + _pattern + "]"; 52 67 _results = new FrameCreator(resultsFrameset, null, title, false, true); 53 68 // Set the frame to be displayed after running the agent 54 69 _end = _results.getFirstFrame(); 55 70 56 71 return super.initialise(frame, item); 57 72 } 58 73 59 74 public String getResultsFrameName() { 60 75 return _results.getName(); 61 76 } 62 77 63 78 public static boolean searchItem(Text itemToSearch, String pattern, 64 79 String replacementString) { … … 85 100 // Search for the item and add it to the results page if 86 101 // it is found 87 if (searchItem(itemToSearch, pattern, 88 replacementString)) { 102 if (searchItem(itemToSearch, pattern, replacementString)) { 89 103 // Add a linked item to the results frame 90 104 results.addText(frameName, null, frameName, null, false); -
trunk/src/org/expeditee/gui/Frame.java
r290 r294 207 207 208 208 if (_change) { 209 // Notify the frame listeners that the frame has changed 210 for (FrameObserver fl : _observers) { 211 fl.update(); 212 } 209 notifyObservers(); 213 210 214 211 setBufferValid(false); 215 212 _saved = false; 213 } 214 } 215 216 public void notifyObservers() { 217 // Notify the frame listeners that the frame has changed 218 for (FrameObserver fl : _observers) { 219 fl.update(); 216 220 } 217 221 } … … 501 505 for (Overlay o : _overlays.keySet()) 502 506 results.addAll(o.Frame.getItemsWithin(poly)); 503 504 for (Item i: getVectorItems()){507 508 for (Item i : getVectorItems()) { 505 509 if (i.intersects(poly)) { 506 // This assumes a results is a set510 // This assumes a results is a set 507 511 results.add(i.getEditTarget()); 508 512 } … … 703 707 InteractiveWidget iw = ((WidgetCorner) item).getWidgetSource(); 704 708 if (!this._iWidgets.contains(iw)) { // A set would have been 705 if (FrameMouseActions.isControlDown())709 if (FrameMouseActions.isControlDown()) 706 710 _iWidgets.add(iw); 707 711 else … … 719 723 720 724 public void refreshSize() { 721 // assert (size != null);725 // assert (size != null); 722 726 boolean bReparse = false; 723 727 for (Item i : getItems()) { … … 737 741 } 738 742 } 739 740 // Do the anchors on the overlays741 for (Overlay o: getOverlays()){743 744 // Do the anchors on the overlays 745 for (Overlay o : getOverlays()) { 742 746 o.Frame.refreshSize(); 743 747 } 744 748 745 749 if (bReparse) { 746 750 FrameUtils.Parse(this, false); … … 1077 1081 int index = toCheck.indexOf(from); 1078 1082 1079 // If its the title index will be 01083 // If its the title index will be 0 1080 1084 if (index < 0) 1081 1085 index = 0; … … 1111 1115 int maxY = 0; 1112 1116 HighlightMode mode = toAdd.Source.getHighlightMode(); 1113 if (mode != HighlightMode.None)1117 if (mode != HighlightMode.None) 1114 1118 mode = HighlightMode.Connected; 1115 1119 Color highlightColor = toAdd.Source.getHighlightColor(); … … 1123 1127 i.invalidateAll(); 1124 1128 i.invalidateFill(); 1125 // Get the right most x and bottom most y pos1129 // Get the right most x and bottom most y pos 1126 1130 int itemRight = i.getX() + i.getBoundsWidth(); 1127 if (itemRight > maxX)1131 if (itemRight > maxX) 1128 1132 maxX = itemRight; 1129 1133 int itemBottom = i.getY() + i.getBoundsHeight(); 1130 if (itemBottom > maxY)1134 if (itemBottom > maxY) 1131 1135 maxY = itemBottom; 1132 1136 } … … 1309 1313 ItemParentStateChangedEvent.EVENT_TYPE_ADDED_VIA_OVERLAY, 1310 1314 permission)); 1311 // i.setPermission(permission);1315 // i.setPermission(permission); 1312 1316 _overlayItems.add(i); 1313 1317 } … … 1690 1694 for (Overlay o : getOverlays()) 1691 1695 o.Frame.refreshItemPermissions(o.permission); 1692 1693 // Only update the permissions if we have to1696 1697 // Only update the permissions if we have to 1694 1698 if (_body.size() > 0 && permission.equals(_body.get(0)._permission)) 1695 1699 return; … … 1698 1702 i.setPermission(permission); 1699 1703 } 1700 1701 1704 1702 1705 } … … 1932 1935 } 1933 1936 } 1934 1935 for (Vector v: getVectors()){1937 1938 for (Vector v : getVectors()) { 1936 1939 toSave.add(v.Source); 1937 1940 } 1938 1941 1939 1942 return toSave; 1940 1943 } … … 2039 2042 2040 2043 public void parse() { 2041 for (Overlay o: getOverlays()){2044 for (Overlay o : getOverlays()) { 2042 2045 o.Frame.parse(); 2043 2046 } 2044 // Must parse the frame AFTER the overlays2047 // Must parse the frame AFTER the overlays 2045 2048 FrameUtils.Parse(this); 2046 2049 } -
trunk/src/org/expeditee/gui/FrameIO.java
r286 r294 243 243 244 244 public static boolean canAccessFrame(String frameName) { 245 Frame current = DisplayIO.getCurrentFrame(); 246 //Just incase the current frame is not yet saved... 247 if(frameName.equals(current.getName())){ 248 FrameIO.SaveFrame(current,false,false); 249 current.change(); 250 return true; 251 } 252 245 253 for (String path : UserSettings.FrameDirs) { 246 254 if (getFrameFullPathName(path, frameName) != null) -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r293 r294 638 638 break; 639 639 case KeyEvent.VK_TAB: 640 FrameUtils.getCurrentItem().update();640 calculateItem(current); 641 641 break; 642 642 case KeyEvent.VK_ESCAPE: … … 1057 1057 break; 1058 1058 case SizeDown: 1059 if (isControlDown){1059 if (isControlDown) { 1060 1060 UserSettings.ScaleFactor -= 0.05; 1061 1061 Misc.repaint(); … … 1063 1063 } 1064 1064 case SizeUp: 1065 if (isControlDown){1065 if (isControlDown) { 1066 1066 UserSettings.ScaleFactor += 0.05; 1067 1067 Misc.repaint(); … … 1078 1078 if (isShiftDown || isControlDown) { 1079 1079 if (on != null) { 1080 on.update();1080 calculateItem(on); 1081 1081 } 1082 1082 } … … 1132 1132 } 1133 1133 1134 private static void calculateItem(Item toCalculate) { 1135 if (!toCalculate.update()) { 1136 toCalculate.setFormula(null); 1137 MessageBay.errorMessage("Can not calculate formula [" 1138 + toCalculate.getText() + ']'); 1139 } 1140 } 1141 1134 1142 private static void Save() { 1135 1143 Frame current = DisplayIO.getCurrentFrame(); 1136 1144 current.change(); 1137 FrameIO.SaveFrame(current, true, true);1145 FrameIO.SaveFrame(current, true, true); 1138 1146 } 1139 1147 … … 2088 2096 public static void Refresh() { 2089 2097 Frame currentFrame = DisplayIO.getCurrentFrame(); 2098 2099 //Refresh widgets that use its self as a data source 2100 currentFrame.notifyObservers(); 2101 2090 2102 if (FrameIO.isProfileFrame(currentFrame)) { 2091 2103 // TODO ensure that users can not delete the first frame in a -
trunk/src/org/expeditee/items/Item.java
r291 r294 2614 2614 } 2615 2615 2616 public voidupdate() {2617 calculate(getText());2616 public boolean update() { 2617 return calculate(getText()); 2618 2618 } 2619 2619 -
trunk/src/org/expeditee/items/widgets/DataFrameWidget.java
r286 r294 8 8 import javax.swing.JComponent; 9 9 10 import org.expeditee.gui.DisplayIO; 10 11 import org.expeditee.gui.Frame; 11 12 import org.expeditee.gui.FrameIO; … … 96 97 97 98 public void update() { 99 Frame parent = getParentFrame(); 100 if(parent != null && parent == DisplayIO.getCurrentFrame()){ 101 refresh(); 102 } 103 98 104 _needsUpdating = true; 99 105 } -
trunk/src/org/expeditee/items/widgets/InteractiveWidget.java
r286 r294 1555 1555 1556 1556 if (FrameIO.isPositiveInteger(link)) { // relative - convert to 1557 1557 // absolute 1558 1558 1559 1559 // Get the frameset of this item … … 1577 1577 return null; 1578 1578 } 1579 1580 /** 1581 * Sets the border color for the widget. 1582 * That is, for the source (so it is remembered) and also for all the 1583 * corners/edges. 1579 1580 /** 1581 * Sets the border color for the widget. That is, for the source (so it is 1582 * remembered) and also for all the corners/edges. 1584 1583 * 1585 1584 * @param c 1586 * 1585 * The color to set. 1587 1586 */ 1588 1587 public void setWidgetEdgeColor(Color c) { 1589 for (Item i : _expediteeItems) i.setColor(c); 1588 for (Item i : _expediteeItems) 1589 i.setColor(c); 1590 1590 // Above indirectly invokes setSourceBorderColor accordingly 1591 1591 } 1592 1592 1593 1593 /** 1594 1594 * Sets the thickness of the widget edge. … … 1597 1597 * 1598 1598 * @param thickness 1599 * 1599 * The new thickness to set. 1600 1600 */ 1601 1601 public void setWidgetEdgeThickness(float thickness) { 1602 for (Item i : _expediteeItems) i.setThickness(thickness); 1603 // Above indirectly invokes setSourceThickness accordingly 1604 } 1605 1606 // TODO: Maybe rename setSource* .. to update* ... These should actually be friendly! 1602 for (Item i : _expediteeItems) 1603 i.setThickness(thickness); 1604 // Above indirectly invokes setSourceThickness accordingly 1605 } 1606 1607 // TODO: Maybe rename setSource* .. to update* ... These should actually be 1608 // friendly! 1607 1609 public void setSourceColor(Color c) { 1608 1610 _textRepresentation.setColor(c); … … 1626 1628 1627 1629 protected Point getOrigin() { 1628 return _d1.getPosition(); // BROOK: This flips around ... the origin can be any point 1630 return _d1.getPosition(); // BROOK: This flips around ... the origin 1631 // can be any point 1629 1632 } 1630 1633 … … 1632 1635 return _d1; 1633 1636 } 1637 1638 public void setAnchorBottom(Float anchor) { 1639 setPosition(getX(), 1640 Math.round(FrameGraphics.getMaxFrameSize().height - anchor - getHeight())); 1641 getSource().setAnchorBottom(anchor); 1642 } 1643 1644 public void setAnchorRight(Float anchor) { 1645 setPosition( 1646 Math.round(FrameGraphics.getMaxFrameSize().width - anchor - getWidth()), 1647 getY()); 1648 getSource().setAnchorRight(anchor); 1649 } 1634 1650 } -
trunk/src/org/expeditee/items/widgets/WidgetCorner.java
r279 r294 6 6 import java.util.List; 7 7 8 import org.expeditee.gui.FrameGraphics; 8 9 import org.expeditee.items.Dot; 9 10 import org.expeditee.items.ItemParentStateChangedEvent; … … 15 16 WidgetCorner(int x, int y, int id, InteractiveWidget widgetSource) { 16 17 super(x, y, id); 17 18 18 19 if (widgetSource == null) 19 20 throw new NullPointerException("widgetSource"); … … 52 53 } 53 54 54 //@Override55 //public void translate(Point2D origin, double ratio) {56 //super.translate(origin, ratio);57 //}55 // @Override 56 // public void translate(Point2D origin, double ratio) { 57 // super.translate(origin, ratio); 58 // } 58 59 59 60 @Override … … 142 143 public void setSize(float size) { 143 144 } 144 145 145 146 @Override 146 147 public String getLink() { … … 149 150 150 151 @Override 152 public void setAnchorBottom(Float anchor) { 153 _widgetSource.setAnchorBottom(anchor); 154 } 155 156 @Override 157 public void setAnchorRight(Float anchor) { 158 _widgetSource.setAnchorRight(anchor); 159 } 160 161 @Override 162 public Float getAnchorBottom() { 163 return _widgetSource.getSource().getAnchorBottom(); 164 } 165 166 @Override 167 public Float getAnchorRight() { 168 return _widgetSource.getSource().getAnchorRight(); 169 } 170 171 @Override 151 172 public void setLink(String link) { 152 173 _widgetSource.setLink(link); 153 174 } 154 175 176 @Override 177 public void setFormula(String formula) { 178 } 179 155 180 @Override 156 181 public void setData(List<String> data) { … … 160 185 @Override 161 186 public boolean contains(int x, int y) { 162 return super.contains(x, y) && !_widgetSource.getBounds().contains(x, y); 187 return super.contains(x, y) 188 && !_widgetSource.getBounds().contains(x, y); 163 189 } 164 190 … … 167 193 if (_widgetSource != null) { 168 194 float minThickness = _widgetSource.getMinimumBorderThickness(); 169 if (newThickness < minThickness)195 if (newThickness < minThickness) 170 196 newThickness = minThickness; 171 197 super.setThickness(newThickness, setConnected); -
trunk/src/org/expeditee/items/widgets/WidgetEdge.java
r279 r294 98 98 99 99 @Override 100 public void setFormula(String formula) { 101 } 102 103 @Override 104 public void setAnchorBottom(Float anchor) { 105 _widgetSource.setAnchorBottom(anchor); 106 } 107 108 @Override 109 public void setAnchorRight(Float anchor) { 110 _widgetSource.setAnchorRight(anchor); 111 } 112 113 @Override 114 public Float getAnchorBottom() { 115 return _widgetSource.getSource().getAnchorBottom(); 116 } 117 118 @Override 119 public Float getAnchorRight() { 120 return _widgetSource.getSource().getAnchorRight(); 121 } 122 123 @Override 100 124 public boolean contains(int x, int y) { 101 125 return super.contains(x, y) && !_widgetSource.getBounds().contains(x, y); -
trunk/src/org/expeditee/items/widgets/charts/AbstractPie.java
r279 r294 60 60 for (Text t : dataFrame.getBodyTextItems(false)) { 61 61 // Ignore line ends for pie charts 62 if (t.isLineEnd()) 62 //TODO find out HOW text became null when i was doing a graph!! 63 String text = t.getText(); 64 if (t.isLineEnd() || text == null) 63 65 continue; 64 AttributeValuePair avp = new AttributeValuePair(t .getText());66 AttributeValuePair avp = new AttributeValuePair(text); 65 67 if (avp != null) { 66 68 try {
Note:
See TracChangeset
for help on using the changeset viewer.