Changeset 121
- Timestamp:
- 07/03/08 16:48:09 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 1 deleted
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r115 r121 19 19 import org.expeditee.gui.DisplayIO; 20 20 import org.expeditee.gui.Frame; 21 import org.expeditee.gui.FrameGraphics;22 21 import org.expeditee.gui.FrameIO; 23 22 import org.expeditee.gui.FrameUtils; 23 import org.expeditee.gui.MessageBay; 24 24 import org.expeditee.io.Conversion; 25 25 import org.expeditee.io.Logger; … … 315 315 // check for protection on frame 316 316 if (ItemUtils.ContainsTag(source.getItems(), "@No" + mname)) { 317 FrameGraphics.DisplayMessage("Frame is protected by @No" + mname317 MessageBay.displayMessage("Frame is protected by @No" + mname 318 318 + " tag."); 319 319 return; … … 365 365 } 366 366 if (possibles.size() > 0) { 367 FrameGraphics.ErrorMessage("Incorrect parameters for " + mname);367 MessageBay.errorMessage("Incorrect parameters for " + mname); 368 368 } else { 369 369 assert (false); 370 FrameGraphics.ErrorMessage(mname + " action not found");370 MessageBay.errorMessage(mname + " action not found"); 371 371 } 372 372 } … … 431 431 // if there is no constructor, return 432 432 if (con == null) { 433 FrameGraphics.DisplayMessage(INVALID_PARAMETERS_ERROR433 MessageBay.displayMessage(INVALID_PARAMETERS_ERROR 434 434 + nameWithCorrectCase); 435 435 // System.out.println("Constructor not found..."); … … 445 445 // check for errors during initialisation 446 446 if (!_Agent.initialise(source)) { 447 FrameGraphics.ErrorMessage("Error initialising agent: "447 MessageBay.errorMessage("Error initialising agent: " 448 448 + nameWithCorrectCase); 449 449 return; … … 461 461 462 462 } catch (ClassNotFoundException cnf) { 463 FrameGraphics.ErrorMessage(nameWithCorrectCase463 MessageBay.errorMessage(nameWithCorrectCase 464 464 + "' is not an action or agent."); 465 465 } catch (Exception e) { 466 FrameGraphics.ErrorMessage("Error creating Agent: '"466 MessageBay.errorMessage("Error creating Agent: '" 467 467 + nameWithCorrectCase + "'"); 468 468 System.out.println("Agent set to Null."); … … 494 494 public static void stopAgent() { 495 495 if (_Agent != null && _Agent.isRunning()) { 496 FrameGraphics.ErrorMessage("Stopping Agent...");496 MessageBay.errorMessage("Stopping Agent..."); 497 497 _Agent.stop(); 498 498 } -
trunk/src/org/expeditee/actions/IDE.java
r80 r121 8 8 import org.expeditee.gui.DisplayIO; 9 9 import org.expeditee.gui.Frame; 10 import org.expeditee.gui. FrameGraphics;10 import org.expeditee.gui.MessageBay; 11 11 12 12 public class IDE { … … 23 23 try { 24 24 Runtime.getRuntime().exec("javac -d expeditee/bin " + fileName); 25 FrameGraphics.DisplayMessage("Compiled " + fileName, Color.darkGray);25 MessageBay.displayMessage("Compiled " + fileName, Color.darkGray); 26 26 } catch (Exception e) { 27 FrameGraphics.ErrorMessage("Could not compile class!");27 MessageBay.errorMessage("Could not compile class!"); 28 28 } 29 29 } else { 30 FrameGraphics.ErrorMessage("Could not initialise agent!");30 MessageBay.errorMessage("Could not initialise agent!"); 31 31 } 32 32 } … … 50 50 String message = ""; 51 51 while ((message = stdInput.readLine()) != null) { 52 FrameGraphics.DisplayMessage(message);52 MessageBay.displayMessage(message); 53 53 } 54 54 while ((message = stdError.readLine()) != null) { 55 FrameGraphics.ErrorMessage(message);55 MessageBay.errorMessage(message); 56 56 } 57 57 } catch (Exception e) { 58 FrameGraphics.ErrorMessage("Could not run class!");58 MessageBay.errorMessage("Could not run class!"); 59 59 } 60 60 } -
trunk/src/org/expeditee/actions/Misc.java
r115 r121 20 20 import org.expeditee.gui.FrameIO; 21 21 import org.expeditee.gui.FrameMouseActions; 22 import org.expeditee.gui.MessageBay; 22 23 import org.expeditee.gui.TimeKeeper; 23 24 import org.expeditee.items.Item; … … 55 56 public static void Restore() { 56 57 FrameIO.Reload(); 57 // FrameGraphics.DisplayMessage("Restoration complete.");58 // MessageBay.displayMessage("Restoration complete."); 58 59 } 59 60 … … 144 145 DisplayIO.Back(); 145 146 FrameGraphics.Repaint(); 146 FrameGraphics.DisplayMessage(deletedFrame + " deleted");147 MessageBay.displayMessage(deletedFrame + " deleted"); 147 148 return; 148 149 } … … 156 157 e.printStackTrace(); 157 158 } 158 FrameGraphics.ErrorMessage(errorMessage);159 MessageBay.errorMessage(errorMessage); 159 160 } 160 161 … … 249 250 public static void GetCometStats(Frame frame) { 250 251 TimeKeeper timer = new TimeKeeper(); 251 FrameGraphics.DisplayMessage("Computing comet stats...");252 MessageBay.displayMessage("Computing comet stats..."); 252 253 253 254 CometStats cometStats = new CometStats(frame); 254 255 attachStatsToCursor(cometStats.toString()); 255 FrameGraphics.OverwriteMessage("Comet stats time: "256 MessageBay.overwriteMessage("Comet stats time: " 256 257 + timer.getElapsedStringSeconds()); 257 258 } … … 259 260 public static void GetTreeStats(Frame frame) { 260 261 TimeKeeper timer = new TimeKeeper(); 261 FrameGraphics.DisplayMessage("Computing tree stats...");262 MessageBay.displayMessage("Computing tree stats..."); 262 263 263 264 TreeStats treeStats = new TreeStats(frame); 264 265 attachStatsToCursor(treeStats.toString()); 265 FrameGraphics.OverwriteMessage("Tree stats time: "266 MessageBay.overwriteMessage("Tree stats time: " 266 267 + timer.getElapsedStringSeconds()); 267 268 } … … 473 474 String frameName = ImageFrame(loaded, format, path); 474 475 if (frameName != null) 475 FrameGraphics.DisplayMessage("Frame successfully saved to "476 MessageBay.displayMessage("Frame successfully saved to " 476 477 + path + frameName); 477 478 else 478 FrameGraphics.ErrorMessage("Could not find image writer for "479 MessageBay.errorMessage("Could not find image writer for " 479 480 + format + " format"); 480 481 // if the frame was not loaded successfully, alert the user 481 482 } else 482 FrameGraphics.DisplayMessage("Frame '" + framename483 MessageBay.displayMessage("Frame '" + framename 483 484 + "' could not be found."); 484 485 } … … 491 492 */ 492 493 public static void MessageLn(String message) { 493 FrameGraphics.DisplayMessage(message);494 MessageBay.displayMessage(message); 494 495 } 495 496 496 497 public static void MessageLn2(String message, String message2) { 497 FrameGraphics.DisplayMessage(message + " " + message2);498 MessageBay.displayMessage(message + " " + message2); 498 499 } 499 500 … … 502 503 // TODO is there a built in method which will do this faster? 503 504 504 FrameGraphics.DisplayMessage("Copying file " + existingFile505 MessageBay.displayMessage("Copying file " + existingFile 505 506 + " to " + newFileName + "..."); 506 507 FrameIO.copyFile(existingFile, newFileName); 507 FrameGraphics.DisplayMessage("File copied successfully");508 MessageBay.displayMessage("File copied successfully"); 508 509 } catch (FileNotFoundException e) { 509 FrameGraphics.DisplayMessage("Error opening file: " + existingFile);510 MessageBay.displayMessage("Error opening file: " + existingFile); 510 511 } catch (Exception e) { 511 FrameGraphics.DisplayMessage("File could not be copied");512 MessageBay.displayMessage("File could not be copied"); 512 513 } 513 514 } … … 561 562 float aveTimeB = timeB * 1000F / repsPerTest / tests; 562 563 // Display Results 563 FrameGraphics.DisplayMessage("Average Execution Time");564 FrameGraphics.DisplayMessage(methodNameA + ": "564 MessageBay.displayMessage("Average Execution Time"); 565 MessageBay.displayMessage(methodNameA + ": " 565 566 + TimeKeeper.Formatter.format(aveTimeA) + "us"); 566 FrameGraphics.DisplayMessage(methodNameB + ": "567 MessageBay.displayMessage(methodNameB + ": " 567 568 + TimeKeeper.Formatter.format(aveTimeB) + "us"); 568 569 } catch (Exception e) { 569 FrameGraphics.ErrorMessage(e.getClass().getSimpleName() + ": "570 MessageBay.errorMessage(e.getClass().getSimpleName() + ": " 570 571 + e.getMessage()); 571 572 } … … 634 635 // the item must link to a frame 635 636 if (current.getLink() == null) { 636 FrameGraphics637 . DisplayMessage("Cannot get item from child - this item has no link");637 MessageBay 638 .displayMessage("Cannot get item from child - this item has no link"); 638 639 return null; 639 640 } … … 643 644 // if the frame could not be loaded 644 645 if (child == null) { 645 FrameGraphics.ErrorMessage("Could not load child frame.");646 MessageBay.errorMessage("Could not load child frame."); 646 647 return null; 647 648 } … … 663 664 // if no item was found 664 665 if (item == null) { 665 FrameGraphics.DisplayMessage("No item found to copy");666 MessageBay.displayMessage("No item found to copy"); 666 667 return null; 667 668 } -
trunk/src/org/expeditee/actions/NavigationActions.java
r108 r121 5 5 import org.expeditee.gui.DisplayIO; 6 6 import org.expeditee.gui.Frame; 7 import org.expeditee.gui.FrameGraphics;8 7 import org.expeditee.gui.FrameIO; 9 8 import org.expeditee.gui.FrameUtils; 9 import org.expeditee.gui.MessageBay; 10 10 import org.expeditee.items.Item; 11 11 … … 143 143 // if there is no parent frame (i.e. the user is on the home frame) // 144 144 if (back == null) { // No frame was on the Backup stack 145 FrameGraphics.DisplayMessage("No Parent Frame Found.");145 MessageBay.displayMessage("No Parent Frame Found."); 146 146 _LastItemUsed = null; // ByRob: what is reason for setting 147 147 // this to null, who is going to use it???? … … 200 200 } // ByRob: End of For 201 201 202 FrameGraphics.DisplayMessage("No more child frames found.");202 MessageBay.displayMessage("No more child frames found."); 203 203 } 204 204 -
trunk/src/org/expeditee/actions/Simple.java
r117 r121 27 27 import org.expeditee.gui.FrameMouseActions; 28 28 import org.expeditee.gui.FrameUtils; 29 import org.expeditee.gui.FreeItems; 30 import org.expeditee.gui.MessageBay; 29 31 import org.expeditee.io.Conversion; 30 32 import org.expeditee.items.Dot; … … 144 146 newSimpleTest.getTitleItem().setActions(actions); 145 147 FrameUtils.DisplayFrame(newSimpleTest, true); 146 FrameGraphics.DisplayMessage("New test created");148 MessageBay.displayMessage("New test created"); 147 149 } 148 150 … … 206 208 207 209 FrameIO.SaveFrame(DisplayIO.getCurrentFrame(), false); 208 FrameGraphics.DisplayMessage("Starting test suite: " + _frameset,210 MessageBay.displayMessage("Starting test suite: " + _frameset, 209 211 Color.CYAN); 210 212 … … 257 259 if (passed) { 258 260 if (_verbose) 259 FrameGraphics.DisplayMessage("Test passed: "261 MessageBay.displayMessage("Test passed: " 260 262 + title.toString(), Item.GREEN); 261 263 testsPassed++; … … 263 265 testsFailed++; 264 266 // Print out the reason for failed tests 265 FrameGraphics.LinkedErrorMessage(errorMessage);267 MessageBay.linkedErrorMessage(errorMessage); 266 268 if (Simple._stop) { 267 269 Simple._stop = false; … … 275 277 assert (_programsRunning == 0); 276 278 // Report the number of test passed and failed 277 FrameGraphics.DisplayMessage("Total tests: "279 MessageBay.displayMessage("Total tests: " 278 280 + (testsPassed + testsFailed), Color.CYAN); 279 281 if (testsPassed > 0) 280 FrameGraphics.DisplayMessage("Passed: " + testsPassed, Item.GREEN);282 MessageBay.displayMessage("Passed: " + testsPassed, Item.GREEN); 281 283 if (testsFailed > 0) 282 FrameGraphics.DisplayMessage("Failed: " + testsFailed, Color.RED);284 MessageBay.displayMessage("Failed: " + testsFailed, Color.RED); 283 285 // Remove items from the cursor... 284 Fr ame.FreeItems.clear();286 FreeItems.getInstance().clear(); 285 287 286 288 return testsFailed == 0; … … 1437 1439 .getValue(); 1438 1440 try { 1439 FrameGraphics.DisplayMessage(((Text) message).copy());1441 MessageBay.displayMessage(((Text) message).copy()); 1440 1442 } catch (NullPointerException e) { 1441 FrameGraphics.DisplayMessage("null");1443 MessageBay.displayMessage("null"); 1442 1444 } catch (ClassCastException e) { 1443 1445 // Just ignore not text items! 1444 FrameGraphics.DisplayMessage(message.toString());1446 MessageBay.displayMessage(message.toString()); 1445 1447 } catch (Exception e) { 1446 1448 // Just ignore other errors … … 1455 1457 1456 1458 if (tokens[0].equals("errorln") || tokens[0].equals("errorline")) 1457 FrameGraphics.ErrorMessage(message);1459 MessageBay.errorMessage(message); 1458 1460 else 1459 FrameGraphics.DisplayMessageAlways(message);1461 MessageBay.displayMessageAlways(message); 1460 1462 } else if (tokens[0].equals("typeatrate")) { 1461 1463 assertMinParametreCount(tokens, 1); … … 1488 1490 try { 1489 1491 Process p = Runtime.getRuntime().exec(command); 1490 FrameGraphics.DisplayMessage(command, Color.darkGray);1492 MessageBay.displayMessage(command, Color.darkGray); 1491 1493 1492 1494 BufferedReader stdInput = new BufferedReader( … … 1496 1498 String message = ""; 1497 1499 while ((message = stdInput.readLine()) != null) { 1498 FrameGraphics.DisplayMessage(message);1500 MessageBay.displayMessage(message); 1499 1501 } 1500 1502 while ((message = stdError.readLine()) != null) { 1501 FrameGraphics.ErrorMessage(message);1503 MessageBay.errorMessage(message); 1502 1504 } 1503 1505 } catch (Exception e) { … … 1758 1760 success = FrameIO.DeleteFrame(frame); 1759 1761 if (!success && _verbose) 1760 FrameGraphics.WarningMessage(errorMessage);1762 MessageBay.warningMessage(errorMessage); 1761 1763 } catch (Exception e) { 1762 1764 // If an exception is thrown then success is false 1763 1765 if (_verbose) { 1764 FrameGraphics.WarningMessage(errorMessage1766 MessageBay.warningMessage(errorMessage 1765 1767 + (e.getMessage() != null ? ". " + e.getMessage() 1766 1768 : "")); … … 1777 1779 boolean success = FrameIO.DeleteFrameset(framesetName); 1778 1780 if (!success && _verbose) { 1779 FrameGraphics.WarningMessage("Error deleting " + framesetName);1781 MessageBay.warningMessage("Error deleting " + framesetName); 1780 1782 } 1781 1783 if (tokens.length > 2) { … … 1800 1802 copiedFrameset); 1801 1803 if (!success && _verbose) 1802 FrameGraphics.WarningMessage("Error copying " + framesetToCopy);1804 MessageBay.warningMessage("Error copying " + framesetToCopy); 1803 1805 if (tokens.length > 3) { 1804 1806 context.getPrimitives().setValue(tokens[3], … … 1829 1831 boolean success = fileContents != null; 1830 1832 if (!success && _verbose) 1831 FrameGraphics.WarningMessage("Error copying "1833 MessageBay.warningMessage("Error copying " 1832 1834 + frameToCopy.getName()); 1833 1835 if (tokens.length > 4) { … … 2026 2028 if (freeMemory < DisplayTree.GARBAGE_COLLECTION_THRESHOLD) { 2027 2029 runtime.gc(); 2028 FrameGraphics2029 . DisplayMessage("Force Garbage Collection!");2030 MessageBay 2031 .displayMessage("Force Garbage Collection!"); 2030 2032 } 2031 2033 } … … 2128 2130 success = false; 2129 2131 if (_verbose) 2130 FrameGraphics.WarningMessage("Error parsing " + frameName);2132 MessageBay.warningMessage("Error parsing " + frameName); 2131 2133 } 2132 2134 // assertPrimitiveType(tokens[2], 2); … … 2299 2301 // DisplayIO.setCursorPosition(finalX, finalY); 2300 2302 FrameMouseActions.anchor(item); 2301 Fr ame.FreeItems.clear();2303 FreeItems.getInstance().clear(); 2302 2304 FrameGraphics.Repaint(); 2303 2305 // FrameMouseActions.updateCursor(); … … 2591 2593 _programsRunning++; 2592 2594 AgentStats.reset(); 2593 FrameGraphics.DisplayMessage("Running SimpleProgram...", Color.BLUE);2595 MessageBay.displayMessage("Running SimpleProgram...", Color.BLUE); 2594 2596 } 2595 2597 -
trunk/src/org/expeditee/agents/CopyTree.java
r80 r121 5 5 6 6 import org.expeditee.gui.Frame; 7 import org.expeditee.gui.FrameGraphics;8 7 import org.expeditee.gui.FrameIO; 9 8 import org.expeditee.gui.FrameUtils; 9 import org.expeditee.gui.MessageBay; 10 10 import org.expeditee.items.Item; 11 11 … … 49 49 processFrame(zero); 50 50 } catch (ExistingFramesetException efe) { 51 FrameGraphics.ErrorMessage("A frameset called " + _nameTo51 MessageBay.errorMessage("A frameset called " + _nameTo 52 52 + " already exists."); 53 53 return false; -
trunk/src/org/expeditee/agents/DefaultAgent.java
r108 r121 2 2 3 3 import org.expeditee.gui.Frame; 4 import org.expeditee.gui. FrameGraphics;4 import org.expeditee.gui.MessageBay; 5 5 import org.expeditee.gui.TimeKeeper; 6 6 import org.expeditee.stats.SessionStats; … … 93 93 // init is now called by Actions.java 94 94 /* 95 * if(!initialise(_start)){ FrameGraphics.ErrorMessage("Error95 * if(!initialise(_start)){ MessageBay.errorMessage("Error 96 96 * initialising agent."); _running = false; return; } 97 97 */ … … 135 135 */ 136 136 protected void message(String message) { 137 FrameGraphics.DisplayMessageAlways(message);137 MessageBay.displayMessageAlways(message); 138 138 } 139 139 140 140 protected void overwriteMessage(String message) { 141 FrameGraphics.OverwriteMessage(message);141 MessageBay.overwriteMessage(message); 142 142 } 143 143 -
trunk/src/org/expeditee/agents/DisplayComet.java
r103 r121 7 7 import org.expeditee.gui.DisplayIO; 8 8 import org.expeditee.gui.Frame; 9 import org.expeditee.gui.FrameGraphics;10 9 import org.expeditee.gui.FrameIO; 10 import org.expeditee.gui.MessageBay; 11 11 import org.expeditee.items.Item; 12 12 import org.expeditee.items.ItemUtils; … … 45 45 if (link != null && !seen.contains(linkLowerCase)) { 46 46 oldFrame = FrameIO.LoadFrame(linkLowerCase); 47 FrameGraphics.OverwriteMessage("Loading frames: " + link);47 MessageBay.overwriteMessage("Loading frames: " + link); 48 48 } 49 49 } -
trunk/src/org/expeditee/agents/DisplayTree.java
r108 r121 3 3 import org.expeditee.gui.DisplayIO; 4 4 import org.expeditee.gui.Frame; 5 import org.expeditee.gui. FrameGraphics;5 import org.expeditee.gui.MessageBay; 6 6 import org.expeditee.items.Item; 7 7 import org.expeditee.items.ItemUtils; … … 55 55 if (freeMemory < GARBAGE_COLLECTION_THRESHOLD) { 56 56 _runtime.gc(); 57 FrameGraphics.DisplayMessage("Force Garbage Collection!");57 MessageBay.displayMessage("Force Garbage Collection!"); 58 58 } 59 59 -
trunk/src/org/expeditee/agents/SwitchyardTree.java
r108 r121 12 12 @Override 13 13 protected Frame process(Frame frame) { 14 // FrameGraphics.DisplayMessage("Running switchyard tree...");14 //MessageBay.displayMessage("Running switchyard tree..."); 15 15 16 16 for (Text textItem : frame.getBodyTextItems(false)) { -
trunk/src/org/expeditee/agents/WriteTree.java
r80 r121 6 6 import org.expeditee.actions.Actions; 7 7 import org.expeditee.gui.Frame; 8 import org.expeditee.gui. FrameGraphics;8 import org.expeditee.gui.MessageBay; 9 9 import org.expeditee.io.FrameWriter; 10 10 import org.expeditee.io.Logger; … … 88 88 // check that o is a valid treewriter 89 89 if (!(o instanceof TreeWriter)) { 90 FrameGraphics.WarningMessage(_format.toUpperCase()90 MessageBay.warningMessage(_format.toUpperCase() 91 91 + " format cannot be used to write trees."); 92 92 return false; … … 101 101 } else { 102 102 if (!(o instanceof FrameWriter) && !(o instanceof TreeWriter)) { 103 FrameGraphics.WarningMessage(_format.toUpperCase()103 MessageBay.warningMessage(_format.toUpperCase() 104 104 + " format cannot be used to write frames."); 105 105 return false; … … 115 115 116 116 } catch (ClassNotFoundException e) { 117 FrameGraphics118 . WarningMessage("The agent does not exist or has incorrect parametres.");117 MessageBay 118 .warningMessage("The agent does not exist or has incorrect parametres."); 119 119 return false; 120 120 } catch (Exception e) { … … 141 141 //System.out.println("Caught"); 142 142 Logger.Log(e); 143 FrameGraphics.ErrorMessage("IOException in WriteTree: "143 MessageBay.errorMessage("IOException in WriteTree: " 144 144 + e.getMessage()); 145 145 e.printStackTrace(); -
trunk/src/org/expeditee/gui/AttributeUtils.java
r115 r121 476 476 // Display an error message if its not in our list of 477 477 // attributes to ignore when copying 478 FrameGraphics.WarningMessage("Attribute: '"478 MessageBay.warningMessage("Attribute: '" 479 479 + getAttribute(v.toString()) 480 480 + "' does not exist."); … … 484 484 .getParameterTypes()) 485 485 types += c.getSimpleName() + " "; 486 FrameGraphics.WarningMessage("Wrong arguments for: '"486 MessageBay.warningMessage("Wrong arguments for: '" 487 487 + getAttribute(v.toString()) + "' expecting " 488 488 + types.trim() + " found '" … … 576 576 e.printStackTrace(); 577 577 } catch (InvocationTargetException e) { 578 FrameGraphics.DisplayMessage(toSet.getClass()578 MessageBay.displayMessage(toSet.getClass() 579 579 .getSimpleName() 580 580 + " type does not support that attribute."); -
trunk/src/org/expeditee/gui/Browser.java
r115 r121 15 15 16 16 import javax.swing.JFrame; 17 import javax.swing.RepaintManager; 17 18 18 19 import org.expeditee.AbsoluteLayout; … … 48 49 */ 49 50 public static void main(String[] args) { 50 // FrameGraphics.SupressMessages(true);51 //MessageBay.supressMessages(true); 51 52 _theBrowser = new Browser(); 52 // FrameGraphics.SupressMessages(false);53 //MessageBay.supressMessages(false); 53 54 // Why do we want to ignore repaint? 54 55 // _theBrowser.setIgnoreRepaint(true); … … 114 115 addComponentListener(this); 115 116 pack(); 117 118 // Expeditee handles its own repainting of AWT/Swing components 119 RepaintManager.setCurrentManager(ExpediteeRepaintManager.getInstance()); 120 121 116 122 try { 117 123 Collection<String> warningMessages = Actions.Init(); … … 129 135 //Must be loaded after setupGraphics if images are on the frame 130 136 //Turn off XRay mode and load the first frame 137 FrameUtils.loadFirstFrame(profile); 131 138 FrameGraphics.setMode(FrameGraphics.MODE_NORMAL, false); 132 FrameUtils.loadFirstFrame(profile);133 139 DisplayIO.UpdateTitle(); 134 140 … … 136 142 //It used to crash the program trying to print error messages up the top 137 143 for (String message : warningMessages) 138 FrameGraphics.WarningMessage(message);144 MessageBay.warningMessage(message); 139 145 140 146 FrameKeyboardActions keyboardListner = new FrameKeyboardActions(); … … 142 148 this.addKeyListener(keyboardListner); 143 149 144 //FrameKeyboardActions.Refresh();150 FrameKeyboardActions.Refresh(); 145 151 //setVisible(true); 146 152 } catch (Exception e) { … … 150 156 } 151 157 152 Graphics2D g;158 public Graphics2D g; 153 159 154 160 private void setupGraphics() { … … 170 176 // then moved back into view 171 177 super.paint(g); 172 FrameGraphics. Repaint();178 FrameGraphics.ForceRepaint(); 173 179 // System.out.println("Paint " + count++); 174 180 } … … 181 187 setupGraphics(); 182 188 FrameIO.RefreshCasheImages(); 183 FrameGraphics. Repaint();189 FrameGraphics.ForceRepaint(); 184 190 } 185 191 -
trunk/src/org/expeditee/gui/DisplayIO.java
r116 r121 10 10 import java.awt.geom.Point2D; 11 11 import java.awt.image.MemoryImageSource; 12 import java.util.ArrayList; 12 13 import java.util.Collection; 13 14 import java.util.LinkedList; … … 205 206 206 207 if (Frame.itemAttachedToCursor()) { 207 List<Item> toMove = Fr ame.FreeItems;208 List<Item> toMove = FreeItems.getInstance(); 208 209 for (Item move : toMove) { 209 210 move.setPosition(move.getX() + deltax, move.getY() + deltay); … … 333 334 if (frame == null) 334 335 return; 335 336 336 337 if (_TwinFrames) { 337 338 if (_CurrentFrames[0] == null) { … … 348 349 if (frame == getCurrentFrame()) { 349 350 FrameGraphics.Repaint(); 350 FrameGraphics.DisplayMessage(frame.getName()351 MessageBay.displayMessage(frame.getName() 351 352 + " is already the current frame."); 352 353 return; … … 355 356 } 356 357 358 359 // Invalidate free items 360 if (!FreeItems.getInstance().isEmpty() && getCurrentFrame() != null) { 361 362 // Empty free items temporarily so that the old frames buffer is repainted 363 // without the free items. 364 ArrayList<? extends Item> tmp = (ArrayList<? extends Item>)FreeItems.getInstance().clone(); 365 FreeItems.getInstance().clear(); // NOTE: This will invalidate all the cleared free items 366 FrameGraphics.refresh(true); 367 FreeItems.getInstance().addAll(tmp); 368 369 370 } 371 372 357 373 if (_TwinFrames) { 358 374 // if the same frame is being shown in both sides, load a fresh … … 379 395 _CurrentFrames[getCurrentSide()] = frame; 380 396 381 // BROOK : TODO... 397 // BROOK : TODO... overlays and loadable widgets 382 398 for (Item i : _CurrentFrames[getCurrentSide()].getItems()) { 383 399 i.onParentStateChanged(new ItemParentStateChangedEvent( … … 469 485 } 470 486 471 FrameGraphics. Repaint();487 FrameGraphics.refresh(false); 472 488 } 473 489 … … 573 589 // there must be a frame to go back to 574 590 if (_VisitedFrames[side].size() < 1) { 575 FrameGraphics576 . DisplayMessageOnce("You are already on the home frame");591 MessageBay 592 .displayMessageOnce("You are already on the home frame"); 577 593 return; 578 594 } 579 595 580 596 if (!FrameUtils.LeavingFrame(getCurrentFrame())) { 581 FrameGraphics.DisplayMessage("Back operation cancelled");597 MessageBay.displayMessage("Back operation cancelled"); 582 598 return; 583 599 } -
trunk/src/org/expeditee/gui/Frame.java
r116 r121 24 24 import org.expeditee.items.InteractiveWidget; 25 25 import org.expeditee.items.Item; 26 import org.expeditee.items.ItemAppearence; 26 27 import org.expeditee.items.ItemParentStateChangedEvent; 27 28 import org.expeditee.items.ItemUtils; … … 99 100 // Note: Needs to be able to be iterated through (for painting) 100 101 private List<Item> _body = new ArrayList<Item>(); 101 102 public static List<Item> FreeItems = new ArrayList<Item>();103 102 104 103 // for drawing purposes … … 660 659 _body.add(item); 661 660 item.setParent(this); 661 item.invalidateCommonTrait(ItemAppearence.Added); 662 662 663 663 // If the item is a line end and has constraints with items already … … 717 717 _iWidgets.remove(((WidgetCorner) item).getWidgetSource()); 718 718 } 719 } 719 item.invalidateCommonTrait(ItemAppearence.Removed); 720 } 721 720 722 } 721 723 } … … 862 864 _background = back; 863 865 change(); 864 // FrameGraphics.Repaint(); 866 867 if (this == DisplayIO.getCurrentFrame()) { 868 FrameGraphics.refresh(false); 869 } 865 870 } 866 871 … … 1012 1017 toAdd.permission)); 1013 1018 _vectorItems.add(i); 1019 i.invalidateAll(); 1020 i.invalidateFill(); 1014 1021 } 1015 1022 return true; … … 1097 1104 public void clearVectors() { 1098 1105 _vectors.clear(); 1106 1107 for (Item i : _vectorItems) { // TODO: Rethink where this should live 1108 i.invalidateAll(); 1109 i.invalidateFill(); 1110 } 1099 1111 _vectorItems.clear(); 1112 1100 1113 } 1101 1114 … … 1104 1117 return false; 1105 1118 for (Item i : toRemove.Frame.getVectorItems()) { 1119 i.invalidateAll(); 1120 i.invalidateFill(); 1106 1121 _overlayItems.remove(i); 1107 1122 i.onParentStateChanged(new ItemParentStateChangedEvent(this, 1108 1123 ItemParentStateChangedEvent.EVENT_TYPE_REMOVED_VIA_OVERLAY, 1109 1124 toRemove.permission)); 1125 1110 1126 } 1111 1127 return true; … … 1142 1158 } 1143 1159 } 1144 1160 1145 1161 public void addAllOverlays(Collection<Overlay> overlays) { 1146 1162 for (Overlay o : overlays) { … … 1396 1412 1397 1413 public static boolean rubberbandingLine() { 1398 return FreeItems. size() == 21399 && (FreeItems.get (0) instanceof Line || FreeItems.get(1) instanceof Line);1414 return FreeItems.getInstance().size() == 2 1415 && (FreeItems.getInstance().get(0) instanceof Line || FreeItems.getInstance().get(1) instanceof Line); 1400 1416 } 1401 1417 1402 1418 public static boolean itemAttachedToCursor() { 1403 return FreeItems. size() > 0;1419 return FreeItems.getInstance().size() > 0; 1404 1420 } 1405 1421 1406 1422 public static boolean textItemAttachedToCursor() { 1407 return itemAttachedToCursor() && FreeItems.get (0) instanceof Text;1423 return itemAttachedToCursor() && FreeItems.getInstance().get(0) instanceof Text; 1408 1424 } 1409 1425 1410 1426 public static Item getItemAttachedToCursor() { 1411 1427 if (itemAttachedToCursor()) 1412 return FreeItems.get (0);1428 return FreeItems.getInstance().get(0); 1413 1429 1414 1430 return null; -
trunk/src/org/expeditee/gui/FrameGraphics.java
r115 r121 5 5 import java.awt.Container; 6 6 import java.awt.Dimension; 7 import java.awt. Font;7 import java.awt.EventQueue; 8 8 import java.awt.Graphics; 9 9 import java.awt.Graphics2D; … … 11 11 import java.awt.Image; 12 12 import java.awt.Point; 13 import java.awt.Rectangle; 13 14 import java.awt.RenderingHints; 15 import java.awt.geom.Area; 14 16 import java.awt.image.BufferedImage; 15 import java.awt.image.VolatileImage;16 17 import java.util.Collection; 17 18 import java.util.Collections; … … 21 22 import java.util.List; 22 23 24 import javax.swing.JComponent; 23 25 import javax.swing.JPopupMenu; 24 26 import javax.swing.SwingUtilities; 25 27 26 import org.expeditee.actions.Misc;27 28 import org.expeditee.items.Circle; 28 29 import org.expeditee.items.InteractiveWidget; … … 30 31 import org.expeditee.items.ItemUtils; 31 32 import org.expeditee.items.Line; 32 import org.expeditee.items.Text;33 33 import org.expeditee.items.WidgetEdge; 34 34 import org.expeditee.items.XRayable; 35 35 36 36 public class FrameGraphics { 37 public static final int MESSAGE_BUFFER_HEIGHT = 100;38 39 private static final int MESSAGE_LINK_Y_OFFSET = 100;40 41 private static final int MESSAGE_LINK_X = 50;42 37 43 38 // the graphics used to paint with … … 47 42 private static Dimension _MaxSize; 48 43 49 // messages shown in the message window50 public static Text[] Messages = new Text[4];51 52 // buffer of the message window53 private static VolatileImage _MessageBuffer = null;54 55 // font used for the messages56 private static Font _MessageFont = Font.decode("Serif-Plain-16");57 58 // the number of messages currently shown (used for scrolling up)59 private static int _MessageCount = 0;60 61 44 // modes 62 45 public static final int MODE_NORMAL = 0; … … 65 48 66 49 public static final int MODE_XRAY = 2; 67 68 public static final Color ERROR_COLOR = Color.red;69 50 70 51 // Start in XRay mode so that errors arnt thrown when parsing the profile 71 52 // frame if it has images on it 72 53 private static int _Mode = MODE_XRAY; 73 74 // if true, error messages are not shown to the user 75 private static boolean _SupressMessages = false; 76 77 public static String MESSAGES_FRAMESET_NAME = "Messages"; 78 79 // The link to the message frameset 80 public static Item MessageLink = new Text(-2, "@" + MESSAGES_FRAMESET_NAME, 81 Color.black, Color.white); 82 83 // creator for creating the message frames 84 private static FrameCreator _creator; 54 55 private FrameGraphics() { 56 // util constructor 57 } 85 58 86 59 /** … … 104 77 FrameUtils.Parse(current); 105 78 DisplayIO.UpdateTitle(); 106 setMaxSize(new Dimension(_MaxSize.width, _MessageBuffer.getHeight()79 setMaxSize(new Dimension(_MaxSize.width, MessageBay.getMessageBufferHeight() 107 80 + _MaxSize.height)); 108 Repaint();81 refresh(false); 109 82 } 110 83 … … 120 93 DisplayIO.UpdateTitle(); 121 94 FrameMouseActions.getInstance().refreshHighlights(); 122 Repaint();95 refresh(false); 123 96 } 124 97 … … 151 124 // Hide the message buffer if in audience mode 152 125 int newMaxHeight = max.height 153 - (isAudienceMode() ? 0 : M ESSAGE_BUFFER_HEIGHT);126 - (isAudienceMode() ? 0 : MessageBay.MESSAGE_BUFFER_HEIGHT); 154 127 if (newMaxHeight > 0) { 155 128 _MaxSize.setSize(max.width, newMaxHeight); … … 161 134 } 162 135 163 if (newMaxHeight > 0) { 164 _MessageBuffer = null; 165 166 for (int i = 0; i < Messages.length; i++) { 167 if (Messages[i] != null) { 168 Messages[i].setOffset(0, -_MaxSize.height); 169 Messages[i].setMaxSize(_MaxSize); 170 } 171 } 172 173 MessageLink.setOffset(0, -_MaxSize.height); 174 MessageLink.setMaxSize(_MaxSize); 175 MessageLink.setPosition(_MaxSize.width - MESSAGE_LINK_Y_OFFSET, 176 MESSAGE_LINK_X); 177 } 178 // Repaint(); 136 if (newMaxHeight > 0) 137 MessageBay.updateSize(); 179 138 } 180 139 … … 205 164 * Displays the given Item on the screen 206 165 */ 207 privatestatic void PaintItem(Graphics2D g, Item i) {166 static void PaintItem(Graphics2D g, Item i) { 208 167 if (i == null || g == null) 209 168 return; … … 286 245 } 287 246 288 private static Image Paint(Frame toPaint) { 289 return Paint(toPaint, true); 290 } 291 292 private static Image Paint(Frame toPaint, boolean isActualFrame) { 247 private static Image Paint(Frame toPaint, Area clip) { 248 return Paint(toPaint, clip, true); 249 } 250 251 /** 252 * 253 * @param toPaint 254 * @param clip If null, then no clip applied. 255 * @param isActualFrame 256 * @return 257 */ 258 private static Image Paint(Frame toPaint, Area clip, boolean isActualFrame) { 293 259 if (toPaint == null) 294 260 return null; … … 313 279 314 280 Graphics2D bg = (Graphics2D) buffer.getGraphics(); 281 bg.setClip(clip); 282 283 // TODO: Revise images and clip - VERY IMPORTANT 315 284 316 285 // Nicer looking lines, but may be too jerky while … … 331 300 } 332 301 302 333 303 bg.setColor(backgroundColor); 304 // bg.setColor(Color.pink); // TODO: TEMP FOR DEBUGGING 305 334 306 bg.fillRect(0, 0, _MaxSize.width, _MaxSize.height); 335 307 336 List<Item> paintItems = new LinkedList<Item>();308 List<Item> visibleItems = new LinkedList<Item>(); 337 309 List<InteractiveWidget> paintWidgets; 338 310 … … 340 312 // Add all the items for this frame and any other from other 341 313 // frames 342 paintItems.addAll(toPaint.getAllItems()); 343 314 visibleItems.addAll(toPaint.getAllItems()); 344 315 paintWidgets = new LinkedList<InteractiveWidget>(); 345 316 AddAllOverlayWidgets(paintWidgets, toPaint, 346 317 new LinkedList<Frame>()); 347 318 } else { 348 paintItems.addAll(toPaint.getVisibleItems());349 paintItems.addAll(toPaint.getVectorItems());319 visibleItems.addAll(toPaint.getVisibleItems()); 320 visibleItems.addAll(toPaint.getVectorItems()); 350 321 paintWidgets = toPaint.getInteractiveWidgets(); 351 322 } 352 323 353 324 // FIRST: Paint widgets swing gui (not expeditee gui) . 354 // Note that these are the anc ored widgets325 // Note that these are the anchored widgets 355 326 for (InteractiveWidget iw : paintWidgets) { 356 iw.paint(bg); 357 } 358 359 PaintPictures(bg, paintItems); 360 PaintLines(bg, paintItems); 361 327 if (clip == null || clip.intersects(iw.getComponant().getBounds())) 328 iw.paint(bg); 329 } 330 331 // Filter out items that do not need to be painted 332 List<Item> paintItems; 333 HashSet<Item> fillOnlyItems = null; // only contains items that do not need drawing but fills might 334 335 if (clip == null) { 336 paintItems = visibleItems; 337 } else { 338 fillOnlyItems = new HashSet<Item>(); 339 paintItems = new LinkedList<Item>(); 340 for (Item i : visibleItems) { 341 if (i.isInDrawingArea(clip)) { 342 paintItems.add(i); 343 } else if (i.isEnclosed()) { 344 // just add all fill items despite possibility of fills not being in clip 345 // because it will be faster than having to test twice for fills that do need 346 // repainting. 347 fillOnlyItems.add(i); 348 } 349 } 350 } 351 // Only paint files and lines once ... between anchored AND free items 352 HashSet<Item> paintedFillsAndLines = new HashSet<Item> (); 353 PaintPictures(bg, paintItems, fillOnlyItems, paintedFillsAndLines); 354 PaintLines(bg, visibleItems); 355 356 // Filter out free items that do not need to be painted 357 // This is efficient in cases with animation while free items exist 358 359 List<Item> freeItemsToPaint = new LinkedList<Item>(); 360 if (clip == null) { 361 freeItemsToPaint = FreeItems.getInstance(); 362 } else { 363 freeItemsToPaint = new LinkedList<Item>(); 364 fillOnlyItems.clear(); 365 for (Item i : FreeItems.getInstance()) { 366 if (i.isInDrawingArea(clip)) { 367 freeItemsToPaint.add(i); 368 } else if (i.isEnclosed()) { 369 fillOnlyItems.add(i); 370 } 371 } 372 } 373 362 374 if (isActualFrame /* && toPaint == DisplayIO.getCurrentFrame() */) 363 PaintPictures(bg, Frame.FreeItems);364 // TODO if we can get transparency with FreeItems. .. then text can375 PaintPictures(bg, freeItemsToPaint, fillOnlyItems, paintedFillsAndLines); 376 // TODO if we can get transparency with FreeItems.getInstance()... then text can 365 377 // be done before freeItems 366 378 PaintNonLinesNonPicture(bg, paintItems); … … 374 386 if (DisplayIO.isTwinFramesOn()) { 375 387 List<Item> lines = new LinkedList<Item>(); 376 for (Item i : Frame.FreeItems) {388 for (Item i : freeItemsToPaint) { 377 389 if (i instanceof Line) { 378 390 Line line = (Line) i; … … 411 423 // Dont paint the 412 424 if (isActualFrame) 413 PaintLines(bg, Frame.FreeItems);425 PaintLines(bg, freeItemsToPaint); 414 426 } 415 427 416 428 if (isActualFrame /* && toPaint == DisplayIO.getCurrentFrame() */) 417 PaintNonLinesNonPicture(bg, Frame.FreeItems);429 PaintNonLinesNonPicture(bg, freeItemsToPaint); 418 430 419 431 // BROOK: Ensure popups are repainted … … 465 477 } 466 478 467 private static void Paint(Image left, Image right, Color background) { 468 if (_MessageBuffer == null) { 469 GraphicsEnvironment ge = GraphicsEnvironment 470 .getLocalGraphicsEnvironment(); 471 _MessageBuffer = ge.getDefaultScreenDevice() 472 .getDefaultConfiguration().createCompatibleVolatileImage( 473 _MaxSize.width, 474 (isAudienceMode() ? 0 : MESSAGE_BUFFER_HEIGHT)); 475 } 476 477 paintMessage(_MessageBuffer.createGraphics(), background); 478 Graphics g = _DisplayGraphics.create(); 479 private static void Paint(Graphics g, Image left, Image right, Color background) { 479 480 480 481 // if TwinFrames mode is on, then clipping etc has to be set … … 503 504 g.drawImage(right, 0, 0, Item.DEFAULT_BACKGROUND, null); 504 505 } 505 // Dont display the message area in audience mode 506 if (!isAudienceMode()) { 507 // draw the message area 508 g.drawImage(_MessageBuffer, 0, _MaxSize.height, null); 509 } 510 g.dispose(); 511 512 } 513 514 /** 515 * Paints the message area 516 * 517 * @param g 518 * @param background 519 */ 520 private static void paintMessage(Graphics2D g, Color background) { 521 ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, 522 RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 523 g.setColor(background); 524 g.fillRect(0, 0, _MaxSize.width, MESSAGE_BUFFER_HEIGHT); 525 g.setFont(_MessageFont); 526 g.setColor(Color.BLACK); 527 g.drawLine(0, 0, _MaxSize.width, 0); 528 for (Item t : Messages) 529 PaintItem(g, t); 530 if (MessageLink.getLink() != null) 531 PaintItem(g, MessageLink); 532 g.dispose(); 506 533 507 } 534 508 … … 539 513 g.dispose(); 540 514 } 541 542 /**543 * Called to refresh the display screen.544 *545 */546 public static void Repaint() {547 Runtime.getRuntime();548 if (_DisplayGraphics == null)549 return;550 551 if (UserSettings.Threading) {552 if (painter == null) {553 painter = new FrameGraphics().new Repainter();554 555 painter.setDaemon(true);556 painter.setPriority(Thread.MIN_PRIORITY);557 558 painter.start();559 } else560 painter.run();561 } else {562 Frame[] toPaint = DisplayIO.getFrames();563 564 if (toPaint != null) {565 Image left = Paint(toPaint[0]);566 Image right = Paint(toPaint[1]);567 Paint(left, right, Item.DEFAULT_BACKGROUND);568 }569 }570 }571 572 private static Repainter painter = null;573 515 574 516 private static void PaintNonLinesNonPicture(Graphics2D g, List<Item> toPaint) { … … 601 543 } 602 544 545 603 546 /** 604 547 * Paint filled areas and their surrounding lines as well as pictures. 605 * 548 * Note: floating widgets are painted as fills 606 549 * @param g 607 550 * @param toPaint 608 551 */ 609 private static void PaintPictures(Graphics2D g, List<Item> toPaint) { 610 // Use this set to keep track of the items that dont need to be 611 // repainted 612 Collection<Item> done = new HashSet<Item>(); 552 private static void PaintPictures(Graphics2D g, List<Item> toPaint, 553 HashSet<Item> fillOnlyItems, HashSet<Item> done) { 554 613 555 List<Item> toFill = new LinkedList<Item>(); 614 556 for (Item i : toPaint) { … … 634 576 } 635 577 } 578 579 if (fillOnlyItems != null) { 580 for (Item i : fillOnlyItems) { 581 if (done.contains(i)) continue; 582 else if (!isAudienceMode() || !i.isConnectedToAnnotation()) { 583 toFill.add(i); 584 } 585 done.addAll(i.getAllConnected()); 586 } 587 } 588 636 589 // Sort the items to fill 637 590 Collections.sort(toFill, new Comparator<Item>() { … … 639 592 Double aArea = a.getEnclosedArea(); 640 593 Double bArea = b.getEnclosedArea(); 641 return aArea.compareTo(bArea) * -1; 594 int cmp = aArea.compareTo(bArea); 595 if (cmp == 0) { 596 return new Integer(a.getID()).compareTo(b.getID()); 597 } 598 return cmp * -1; 642 599 } 643 600 }); … … 715 672 // Mike: TODO comment on why the line below is used!! 716 673 // I forgot already!!Opps 717 boolean freeItem = Fr ame.FreeItems.contains(item);674 boolean freeItem = FreeItems.getInstance().contains(item); 718 675 for (Item i : item.getAllConnected()) { 719 if (/* freeItem || */!Fr ame.FreeItems.contains(i)) {676 if (/* freeItem || */!FreeItems.getInstance().contains(i)) { 720 677 i.setHighlightMode(connectedNewMode); 721 678 } … … 723 680 if (!freeItem && newMode != connectedNewMode) 724 681 item.setHighlightMode(newMode); 725 Repaint();726 }727 728 public static void OverwriteMessage(String message) {729 for (int ind = Messages.length - 1; ind >= 0; ind--) {730 if (Messages[ind] != null) {731 Messages[ind].setText(getMessagePrefix(false) + message);732 Repaint();733 return;734 }735 }736 737 // if we have not returned, then there are no messages yet738 DisplayMessage(message, Color.darkGray);739 }740 741 /**742 * Displays the given message in the message area of the Frame, any previous743 * message is cleared from the screen.744 *745 * @param message746 * The message to display to the user in the message area747 */748 public static void DisplayMessage(String message) {749 DisplayMessageAlways(message);750 }751 752 public static void DisplayMessageOnce(String message) {753 displayMessage(message, null, null, Color.BLACK, false);754 }755 756 public static void DisplayMessage(String message, Color textColor) {757 displayMessage(message, null, null, textColor);758 // Misc.Beep();759 }760 761 public static void DisplayMessage(Text message) {762 displayMessage(message.getFirstLine(), message.getLink(), message763 .getAction(), message.getColor());764 // Misc.Beep();765 }766 767 public static void DisplayMessageAlways(String message) {768 displayMessage(message, null, null, Color.BLACK);769 // Misc.Beep();770 }771 772 public static void WarningMessage(String message) {773 displayMessage(message, null, null, Color.MAGENTA);774 // Misc.Beep();775 }776 777 private static String _lastMessage = null;778 779 private static void displayMessage(String message, String link,780 List<String> actions, Color color) {781 displayMessage(message, link, actions, color, true);782 }783 784 private static void displayMessage(String message, String link,785 List<String> actions, Color color, boolean displayAlways) {786 787 System.out.println(message);788 assert (message != null);789 790 if (_SupressMessages)791 return;792 793 if (!displayAlways && message.equals(_lastMessage)) {794 Misc.Beep();795 return;796 }797 _lastMessage = message;798 799 if (_creator == null) {800 _creator = new FrameCreator(MESSAGES_FRAMESET_NAME, true);801 802 // set up 'Messages' link on the right hand side803 MessageLink.setPosition(_MaxSize.width - MESSAGE_LINK_Y_OFFSET,804 MESSAGE_LINK_X);805 MessageLink.setOffset(0, -_MaxSize.height);806 }807 808 // if the message slots have not all been used yet809 if (_MessageCount <= Messages.length) {810 int pos = 15;811 // find the next empty slot, and create the new message812 for (int i = 0; i < Messages.length; i++) {813 if (Messages[i] == null) {814 Messages[i] = new Text(getMessagePrefix(true) + message);815 Messages[i].setPosition(20, pos);816 Messages[i].setOffset(0, -_MaxSize.height);817 Messages[i].setMaxSize(_MaxSize);818 Messages[i].setColor(color);819 Messages[i].setLink(link);820 _creator.addItem(Messages[i].copy());821 MessageLink.setLink(_creator.getCurrent());822 Repaint();823 return;824 }825 826 pos += 25;827 }828 }829 830 // if we have not returned then all message slots are used831 for (int i = 0; i < Messages.length - 1; i++) {832 Messages[i].setText(Messages[i + 1].getFirstLine());833 Messages[i].setColor(Messages[i + 1].getColor());834 Messages[i].setLink(Messages[i + 1].getLink());835 }836 837 // show the new message838 Text last = Messages[Messages.length - 1];839 last.setColor(color);840 // Make set the text for the new message841 last.setText(getMessagePrefix(true) + message);842 last.setLink(link);843 last.setActions(actions);844 845 _creator.addItem(last.copy());846 // update the link to the latest message frame847 MessageLink.setLink(_creator.getCurrent());848 Repaint();849 }850 851 private static String getMessagePrefix(boolean incrementCounter) {852 if (incrementCounter)853 _MessageCount++;854 return "@" + _MessageCount + ": ";855 }856 857 /**858 * Checks if the error message ends with a frame name after the859 * frameNameSeparator symbol860 *861 * @param message862 * the message to be displayed863 */864 public static void LinkedErrorMessage(String message) {865 if (_SupressMessages)866 return;867 Misc.Beep();868 String[] tokens = message.split(Text.FRAME_NAME_SEPARATOR);869 String link = null;870 if (tokens.length > 1)871 link = tokens[tokens.length - 1];872 displayMessage(message, link, null, ERROR_COLOR);873 }874 875 public static void ErrorMessage(String message) {876 if (_SupressMessages)877 return;878 Misc.Beep();879 displayMessage(message, null, null, ERROR_COLOR);880 }881 882 private class Repainter extends Thread {883 public boolean isPainting = false;884 885 public void run() {886 // TODO see if there is any other way to deal with this887 if (_MaxSize.width <= 0 || _MaxSize.height <= 0) {888 return;889 }890 isPainting = true;891 892 Frame[] toPaint = DisplayIO.getFrames();893 894 if (toPaint != null) {895 Image left = Paint(toPaint[0]);896 Image right = Paint(toPaint[1]);897 Paint(left, right, Item.DEFAULT_BACKGROUND);898 }899 isPainting = false;900 }901 }902 903 /**904 * Invalidates the buffered image of the current Frame and forces it to be905 * repainted on to the screen.906 */907 public static void ForceRepaint() {908 Frame current = DisplayIO.getCurrentFrame();909 910 if (current == null)911 return;912 913 682 Repaint(); 914 683 } … … 925 694 return; 926 695 927 Image vi = Paint(toUpdate, paintOverlays);696 Image vi = Paint(toUpdate, null, paintOverlays); 928 697 toUpdate.setBuffer(vi); 929 }930 931 public static void SupressMessages(boolean val) {932 _SupressMessages = val;933 698 } 934 699 … … 939 704 Browser._theBrowser.getContentPane()); 940 705 706 c.setIgnoreRepaint(true); 707 ((JComponent)c).setDoubleBuffered(false); 941 708 g.translate(p.x, p.y); 942 709 c.paint(g); … … 952 719 return _Mode; 953 720 } 721 722 // Damaged areas pending to render. Accessessed by multiple threads 723 private static HashSet<Rectangle> damagedAreas = new HashSet<Rectangle>(); 724 725 /** 726 * Checks that the item is visible (on current frame && overlays) - if visible 727 * then damaged area will be re-rendered on the next refresh. 728 * @param damagedItem 729 * @param toRepaint 730 */ 731 public static void invalidateItem(Item damagedItem, Rectangle toRepaint) { 732 // Only add area to repaint if item is visible... 733 if (ItemUtils.isVisible(damagedItem)) { 734 synchronized(damagedAreas) { 735 damagedAreas.add(toRepaint); 736 } 737 } else if(MessageBay.isMessageItem(damagedItem)) { 738 MessageBay.addDirtyArea(toRepaint); 739 } 740 } 741 742 /** 743 * The given area will be re-rendered in the next refresh. This is the quicker version 744 * and is more useful for re-rendering animated areas. 745 * @param toRepaint 746 */ 747 public static void invalidateArea(Rectangle toRepaint) { 748 synchronized(damagedAreas) { 749 damagedAreas.add(toRepaint); 750 } 751 } 752 753 public static void clearInvalidAreas() { 754 synchronized(damagedAreas) { 755 damagedAreas.clear(); 756 } 757 } 758 759 /** 760 * Invalidates the buffered image of the current Frame and forces it to be 761 * repainted on to the screen. Repaints all items. This is more expensive 762 * than refresh. 763 */ 764 public static void ForceRepaint() { // TODO: TEMP: Use refresh 765 Frame current = DisplayIO.getCurrentFrame(); 766 767 if (current == null) 768 return; 769 refresh(false); 770 } 771 772 public static void Repaint() { // TODO: TEMP: Use refresh 773 refresh(true); 774 } 775 776 /** 777 * Called to refresh the display screen. Thread safe. 778 */ 779 public static void refresh(boolean useInvalidation) { 780 781 if (_DisplayGraphics == null) return; 782 783 Area clip = null; 784 if (useInvalidation) { // build clip 785 786 synchronized(damagedAreas) { 787 if (!damagedAreas.isEmpty()) { 788 789 for (Rectangle r : damagedAreas) { 790 if (clip == null) clip = new Area(r); 791 clip.add(new Area(r)); 792 } 793 damagedAreas.clear(); 794 } else return; // nothing to render 795 } 796 797 } else { 798 synchronized(damagedAreas) { 799 damagedAreas.clear(); 800 } 801 System.out.println("FULLSCREEN REFRESH"); // TODO: REMOVE 802 } 803 804 Frame[] toPaint = DisplayIO.getFrames(); 805 Image left = Paint(toPaint[0], clip); 806 Image right = Paint(toPaint[1], clip); 807 808 Graphics dg = _DisplayGraphics.create(); 809 810 // Paint frame to window 811 Paint(dg, left, right, Item.DEFAULT_BACKGROUND); 812 813 // Paint message bay 814 MessageBay.refresh(useInvalidation, dg, Item.DEFAULT_BACKGROUND); 815 816 dg.dispose(); 817 } 818 819 /** 820 * If wanting to refresh from another thread - other than the main thread that 821 * handles the expeditee datamodel (modifying / accessing / rendering). Use 822 * this method for thread safety. 823 */ 824 public static synchronized void requestRefresh(boolean useInvalidation) { 825 826 _requestMarsheller._useInvalidation = useInvalidation; 827 828 if (_requestMarsheller._isQueued) { 829 return; 830 } 831 832 _requestMarsheller._isQueued = true; 833 EventQueue.invokeLater(_requestMarsheller); // Render on AWT thread 834 } 835 836 private static RenderRequestMarsheller _requestMarsheller = new FrameGraphics().new RenderRequestMarsheller(); 837 838 /** 839 * Used for marshelling render requests from foreign threads to the event dispatcher thread... (AWT) 840 * @author Brook Novak 841 */ 842 private class RenderRequestMarsheller implements Runnable { 843 844 boolean _useInvalidation = true; 845 boolean _isQueued = false; 846 847 public void run() { 848 refresh(_useInvalidation); 849 _isQueued = false; 850 _useInvalidation = true; 851 } 852 853 } 854 954 855 } -
trunk/src/org/expeditee/gui/FrameIO.java
r108 r121 116 116 // do not display errors encountered to the user 117 117 // (they will be shown at load time) 118 FrameGraphics.SupressMessages(true);118 MessageBay.supressMessages(true); 119 119 // loading automatically caches the frame is caching is turned on 120 120 LoadUnknownPath(framename); 121 FrameGraphics.SupressMessages(false);121 MessageBay.supressMessages(false); 122 122 } 123 123 … … 255 255 256 256 if (frame == null) { 257 FrameGraphics.ErrorMessage("Error: " + frameName257 MessageBay.errorMessage("Error: " + frameName 258 258 + " could not be successfully loaded."); 259 259 return null; … … 276 276 e.printStackTrace(); 277 277 Logger.Log(e); 278 FrameGraphics.ErrorMessage("Error: " + frameName278 MessageBay.errorMessage("Error: " + frameName 279 279 + " could not be successfully loaded."); 280 280 } … … 311 311 // if we did not find another Frame then this one must be the last one 312 312 // in the frameset 313 FrameGraphics314 . DisplayMessageOnce("This is the first frame in the frameset");313 MessageBay 314 .displayMessageOnce("This is the first frame in the frameset"); 315 315 return null; 316 316 } … … 335 335 max = ReadINF(current.path, current.getFramesetName()); 336 336 } catch (IOException ioe) { 337 FrameGraphics.ErrorMessage("Error loading INF file for frameset '"337 MessageBay.errorMessage("Error loading INF file for frameset '" 338 338 + name + "'"); 339 339 return null; … … 349 349 // if we did not find another Frame then this one must be the last one 350 350 // in the frameset 351 FrameGraphics352 . DisplayMessageOnce("This is the last frame in the frameset");351 MessageBay 352 .displayMessageOnce("This is the last frame in the frameset"); 353 353 return null; 354 354 } … … 375 375 max = ReadINF(path, framesetName); 376 376 } catch (IOException ioe) { 377 FrameGraphics.ErrorMessage("Error loading INF file for frameset '"377 MessageBay.errorMessage("Error loading INF file for frameset '" 378 378 + framesetName + "'"); 379 379 return null; … … 389 389 // if we did not find another Frame then this one must be the last one 390 390 // in the frameset 391 FrameGraphics.DisplayMessage("This is the last frame in the frameset");391 MessageBay.displayMessage("This is the last frame in the frameset"); 392 392 return null; 393 393 } … … 701 701 if (savedVersion > toSave.getVersion() 702 702 && !toSave.getFramesetName().equalsIgnoreCase( 703 FrameGraphics.MESSAGES_FRAMESET_NAME)) {703 MessageBay.MESSAGES_FRAMESET_NAME)) { 704 704 // remove this frame from the cache if it is there 705 705 // This will make sure links to the original are set correctly … … 714 714 // Show the messages alerting the user 715 715 Text originalMessage = new Text(-1); 716 originalMessage.setColor( FrameGraphics.ERROR_COLOR);716 originalMessage.setColor(MessageBay.ERROR_COLOR); 717 717 originalMessage.setText(original.getName() 718 718 + " was updated by another user."); 719 719 originalMessage.setLink(original.getName()); 720 720 Text yourMessage = new Text(-1); 721 yourMessage.setColor( FrameGraphics.ERROR_COLOR);721 yourMessage.setColor(MessageBay.ERROR_COLOR); 722 722 yourMessage.setText("Your version was renamed " 723 723 + toSave.getName()); 724 724 yourMessage.setLink(toSave.getName()); 725 FrameGraphics.DisplayMessage(originalMessage);726 FrameGraphics.DisplayMessage(yourMessage);725 MessageBay.displayMessage(originalMessage); 726 MessageBay.displayMessage(yourMessage); 727 727 } else if (checkBackup 728 728 && ItemUtils.ContainsExactTag(toSave.getItems(), -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r115 r121 82 82 // permission check 83 83 if (on != null && !on.hasPermission(Permission.full)) { 84 FrameGraphics85 . DisplayMessage("Insufficient permission to edit this item");84 MessageBay 85 .displayMessage("Insufficient permission to edit this item"); 86 86 return; 87 87 } … … 577 577 && clicked.getParent() != null 578 578 && clicked.getParent().getNameItem() != clicked) { 579 FrameGraphics.DisplayMessage("Insufficient Permission");579 MessageBay.displayMessage("Insufficient Permission"); 580 580 return; 581 581 } … … 621 621 if (current instanceof Text) { 622 622 if (current != null && !current.hasPermission(Permission.copy)) { 623 FrameGraphics624 . DisplayMessage("Insufficient permission to copy that item");623 MessageBay 624 .displayMessage("Insufficient permission to copy that item"); 625 625 return; 626 626 } 627 627 copyItemToClipboard(current); 628 // FrameGraphics.DisplayMessage("Item copied to clipboard");628 // MessageBay.displayMessage("Item copied to clipboard"); 629 629 return; 630 630 } 631 631 if (current != null && !current.hasPermission(Permission.full)) { 632 FrameGraphics633 . DisplayMessage("Insufficient permission edit that item");632 MessageBay 633 .displayMessage("Insufficient permission edit that item"); 634 634 return; 635 635 } … … 656 656 return; 657 657 if (current != null && !current.hasPermission(Permission.full)) { 658 FrameGraphics659 . DisplayMessage("Insufficient permission to cut that item");658 MessageBay 659 .displayMessage("Insufficient permission to cut that item"); 660 660 return; 661 661 } … … 667 667 return; 668 668 if (current != null && !current.hasPermission(Permission.full)) { 669 FrameGraphics670 . DisplayMessage("Insufficient permission toggle the items mark");669 MessageBay 670 .displayMessage("Insufficient permission toggle the items mark"); 671 671 return; 672 672 } … … 742 742 743 743 if (item != null && !item.hasPermission(Permission.full)) { 744 FrameGraphics745 . DisplayMessage("Insufficient permission to copy that item");744 MessageBay 745 .displayMessage("Insufficient permission to copy that item"); 746 746 return null; 747 747 } … … 840 840 break; 841 841 default: 842 FrameGraphics.DisplayMessageOnce(displayMessage);842 MessageBay.displayMessageOnce(displayMessage); 843 843 return; 844 844 } … … 892 892 Collection<Item> enclosed = FrameUtils.getCurrentItems(on); 893 893 if (on == null && (enclosed == null || enclosed.size() == 0)) 894 FrameGraphics.DisplayMessage(displayMessage);894 MessageBay.displayMessage(displayMessage); 895 895 } 896 896 … … 932 932 // if no item was found, return 933 933 if (toDropFrom == null) { 934 FrameGraphics 935 .ErrorMessage("No item could be found to drop from"); 934 MessageBay.errorMessage("No item could be found to drop from"); 936 935 return; 937 936 } 938 937 939 938 if (!(toDropFrom instanceof Text)) { 940 FrameGraphics941 . DisplayMessage("Only text items can be dropped from");939 MessageBay 940 .displayMessage("Only text items can be dropped from"); 942 941 return; 943 942 } … … 948 947 949 948 if (column == null) { 950 FrameGraphics.ErrorMessage("No column found to align items to");949 MessageBay.errorMessage("No column found to align items to"); 951 950 return; 952 951 } … … 1025 1024 FrameMouseActions.getY()); 1026 1025 } else { 1027 FrameGraphics1028 . WarningMessage("Can not create items outside the frame area");1026 MessageBay 1027 .warningMessage("Can not create items outside the frame area"); 1029 1028 // ensures correct repainting when items don't move 1030 1029 DisplayIO.setCursorPosition(DisplayIO.getMouseX(), … … 1045 1044 int deltaY = firstItem.getY() - dummyItem.getY(); 1046 1045 1047 for (Item i : Fr ame.FreeItems) {1046 for (Item i : FreeItems.getInstance()) { 1048 1047 i.setPosition(i.getX() - deltaX, i.getY() - deltaY); 1049 1048 } … … 1057 1056 FrameGraphics.Repaint(); 1058 1057 } catch (RuntimeException e) { 1059 // FrameGraphics.ErrorMessage(e.getMessage());1058 // MessageBay.errorMessage(e.getMessage()); 1060 1059 e.printStackTrace(); 1061 1060 } … … 1237 1236 if (item == null) { 1238 1237 if (Frame.itemAttachedToCursor()) 1239 toSize.addAll(Fr ame.FreeItems);1238 toSize.addAll(FreeItems.getInstance()); 1240 1239 else { 1241 FrameGraphics1242 . DisplayMessage("There are no Items selected on the Frame or on the Cursor");1240 MessageBay 1241 .displayMessage("There are no Items selected on the Frame or on the Cursor"); 1243 1242 return; 1244 1243 } 1245 1244 } else { 1246 1245 if (item.isFrameName()) { 1247 FrameGraphics.DisplayMessage("Can not resize the frame name");1246 MessageBay.displayMessage("Can not resize the frame name"); 1248 1247 return; 1249 1248 } 1250 1249 // check permissions 1251 1250 if (!item.hasPermission(Permission.full)) { 1252 FrameGraphics1253 . DisplayMessage("Insufficient permission to change the size of that item");1251 MessageBay 1252 .displayMessage("Insufficient permission to change the size of that item"); 1254 1253 return; 1255 1254 } … … 1362 1361 1363 1362 // if (color == null) { 1364 // FrameGraphics.DisplayMessage("FillColor is now transparent");1363 // MessageBay.displayMessage("FillColor is now transparent"); 1365 1364 // } 1366 1365 … … 1385 1384 if (item == null) { 1386 1385 if (Frame.itemAttachedToCursor()) { 1387 color = Fr ame.FreeItems.get(0).getColor();1386 color = FreeItems.getInstance().get(0).getColor(); 1388 1387 } else { 1389 1388 return; … … 1394 1393 // check permissions 1395 1394 if (!item.hasPermission(Permission.full)) { 1396 FrameGraphics1397 . DisplayMessage("Insufficient permission to the frame's background color");1395 MessageBay 1396 .displayMessage("Insufficient permission to the frame's background color"); 1398 1397 return; 1399 1398 } … … 1405 1404 // if (currentFrame.getBackgroundColor() == null) 1406 1405 // FrameGraphics 1407 // . DisplayMessage("Background color is now transparent");1406 // .displayMessage("Background color is now transparent"); 1408 1407 FrameGraphics.Repaint(); 1409 1408 return; … … 1411 1410 // check permissions 1412 1411 if (!item.hasPermission(Permission.full)) { 1413 FrameGraphics1414 . DisplayMessage("Insufficient permission to change that item's color");1412 MessageBay 1413 .displayMessage("Insufficient permission to change that item's color"); 1415 1414 return; 1416 1415 } … … 1439 1438 // if color is being set to default display a message to indicate that 1440 1439 // if (color == null) { 1441 // FrameGraphics.DisplayMessage("Color is set to default");1440 // MessageBay.displayMessage("Color is set to default"); 1442 1441 // } 1443 1442 1444 1443 if (setBackgroundColor) { 1445 1444 if (item == null && Frame.itemAttachedToCursor()) { 1446 for (Item i : Fr ame.FreeItems)1445 for (Item i : FreeItems.getInstance()) 1447 1446 i.setBackgroundColor(color); 1448 1447 } else { … … 1452 1451 } else { 1453 1452 if (item == null && Frame.itemAttachedToCursor()) { 1454 for (Item i : Fr ame.FreeItems)1453 for (Item i : FreeItems.getInstance()) 1455 1454 i.setColor(color); 1456 1455 } else { … … 1470 1469 private static void ToggleAnnotation(Item toToggle) { 1471 1470 if (toToggle == null) { 1472 FrameGraphics.DisplayMessage("There is no Item selected to toggle");1471 MessageBay.displayMessage("There is no Item selected to toggle"); 1473 1472 return; 1474 1473 } … … 1476 1475 // check permissions 1477 1476 if (!toToggle.hasPermission(Permission.full)) { 1478 FrameGraphics1479 . DisplayMessage("Insufficient permission to toggle that item's annotation");1477 MessageBay 1478 .displayMessage("Insufficient permission to toggle that item's annotation"); 1480 1479 return; 1481 1480 } … … 1494 1493 private static void ToggleFontStyle(Item toToggle) { 1495 1494 if (toToggle == null) { 1496 FrameGraphics.DisplayMessage("There is no Item selected to toggle");1495 MessageBay.displayMessage("There is no Item selected to toggle"); 1497 1496 return; 1498 1497 } … … 1500 1499 // check permissions 1501 1500 if (!toToggle.hasPermission(Permission.full)) { 1502 FrameGraphics1503 . DisplayMessage("Insufficient permission to toggle that item's annotation");1501 MessageBay 1502 .displayMessage("Insufficient permission to toggle that item's annotation"); 1504 1503 return; 1505 1504 } … … 1522 1521 private static void ToggleFontFamily(Item toToggle) { 1523 1522 if (toToggle == null) { 1524 FrameGraphics.DisplayMessage("There is no Item selected to toggle");1523 MessageBay.displayMessage("There is no Item selected to toggle"); 1525 1524 return; 1526 1525 } … … 1528 1527 // check permissions 1529 1528 if (!toToggle.hasPermission(Permission.full)) { 1530 FrameGraphics 1531 .DisplayMessage("Insufficient permission to toggle that item's annotation"); 1529 MessageBay.displayMessage("Insufficient permission to toggle that item's annotation"); 1532 1530 return; 1533 1531 } … … 1565 1563 // permission check 1566 1564 if (!toAdd.hasPermission(Permission.full)) { 1567 FrameGraphics1568 . DisplayMessage("Insufficicent permission to add the date to that item");1565 MessageBay 1566 .displayMessage("Insufficicent permission to add the date to that item"); 1569 1567 return; 1570 1568 } … … 1617 1615 FrameGraphics.Repaint(); 1618 1616 } else { 1619 FrameGraphics1620 . DisplayMessage("Only text items can have the date prepended to them");1617 MessageBay 1618 .displayMessage("Only text items can have the date prepended to them"); 1621 1619 } 1622 1620 // otherwise, create a new text item … … 1640 1638 private static void CreateFrameset(Item item) { 1641 1639 if (item == null) { 1642 FrameGraphics1643 . DisplayMessage("There is no selected item to use for the frameset name");1640 MessageBay 1641 .displayMessage("There is no selected item to use for the frameset name"); 1644 1642 return; 1645 1643 } 1646 1644 1647 1645 if (!(item instanceof Text)) { 1648 FrameGraphics1649 . DisplayMessage("Framesets can only be created from text items");1646 MessageBay 1647 .displayMessage("Framesets can only be created from text items"); 1650 1648 return; 1651 1649 } … … 1653 1651 // dont create frameset if the item is linked 1654 1652 if (item.getLink() != null) { 1655 FrameGraphics1656 . DisplayMessage("A frameset can not be created from a linked item");1653 MessageBay 1654 .displayMessage("A frameset can not be created from a linked item"); 1657 1655 return; 1658 1656 } … … 1660 1658 // check permissions 1661 1659 if (!item.hasPermission(Permission.full)) { 1662 FrameGraphics1663 . DisplayMessage("Insufficient permission to create a frameset from this item");1660 MessageBay 1661 .displayMessage("Insufficient permission to create a frameset from this item"); 1664 1662 return; 1665 1663 } … … 1678 1676 DisplayIO.setCursor(Item.DEFAULT_CURSOR); 1679 1677 } catch (Exception e) { 1680 FrameGraphics.ErrorMessage(e.getMessage());1678 MessageBay.errorMessage(e.getMessage()); 1681 1679 } 1682 1680 } … … 1695 1693 + "1"); 1696 1694 assert (profile != null); 1695 FrameUtils.Parse(currentFrame); 1697 1696 FrameUtils.ParseProfile(profile); 1698 1697 } else { -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r116 r121 165 165 public void actionPerformed(ActionEvent ae) { 166 166 // check if we are in free space 167 if (_lastClickedOn == null && Fr ame.FreeItems.size() == 0) {167 if (_lastClickedOn == null && FreeItems.getInstance().size() == 0) { 168 168 // System.out.println("SuperBack!"); 169 169 _MouseTimer.setDelay(ZERO_MOUSE_PAUSE); … … 172 172 if (FrameUtils.getCurrentItem() == null) { 173 173 // Check if we are toggling arrowhead 174 if (Fr ame.FreeItems.size() <= 2) {175 for (Item i : Fr ame.FreeItems) {174 if (FreeItems.getInstance().size() <= 2) { 175 for (Item i : FreeItems.getInstance()) { 176 176 if (i instanceof Line) { 177 177 ((Line) i).toggleArrow(); … … 273 273 // the other 274 274 // Long depress actions if that is what is wanted. 275 if (_lastClickedOn == null && Fr ame.FreeItems.size() == 0) {275 if (_lastClickedOn == null && FreeItems.getInstance().size() == 0) { 276 276 // System.out.println(e.getClickCount()); 277 277 if (e.getClickCount() >= 2) { 278 278 _MouseTimer.start(); 279 279 } 280 } else if (_lastClickedOn != null && Fr ame.FreeItems.size() == 0280 } else if (_lastClickedOn != null && FreeItems.getInstance().size() == 0 281 281 && e.getButton() == MouseEvent.BUTTON3) { 282 282 _ExtrudeMouseTimer.start(); … … 318 318 319 319 _lastHighlightedItem = Frame.getItemAttachedToCursor(); 320 for (Item i : Fr ame.FreeItems) {320 for (Item i : FreeItems.getInstance()) { 321 321 i.setHighlightColor(Item.DEPRESSED_HIGHLIGHT); 322 322 } … … 438 438 439 439 if (Frame.itemAttachedToCursor()) { 440 move(Fr ame.FreeItems);441 } 442 443 FrameGraphics444 . DisplayMessage("Action cancelled, mouse moved more than "440 move(FreeItems.getInstance()); 441 } 442 443 MessageBay 444 .displayMessage("Action cancelled, mouse moved more than " 445 445 + UserSettings.NoOpThreshold + " pixels."); 446 446 FrameGraphics.Repaint(); … … 456 456 if (i != null && i instanceof Text) { 457 457 lastRanged.replaceSelectedText(((Text) i).getText()); 458 Fr ame.FreeItems.clear();458 FreeItems.getInstance().clear(); 459 459 } else 460 460 lastRanged.cutSelectedText(); … … 504 504 if (!lastRanged.hasPermission(Permission.full) 505 505 || lastRanged.isFrameName()) { 506 FrameGraphics507 . DisplayMessage("Insufficient permission to cut text");506 MessageBay 507 .displayMessage("Insufficient permission to cut text"); 508 508 lastRanged.clearSelection(); 509 509 FrameGraphics.Repaint(); … … 524 524 // do not have permission to do so... or it is the frame name 525 525 if (!lastRanged.hasPermission(Permission.copy)) { 526 FrameGraphics527 . DisplayMessage("Insufficient permission to copy text");526 MessageBay 527 .displayMessage("Insufficient permission to copy text"); 528 528 lastRanged.clearSelection(); 529 529 FrameGraphics.Repaint(); … … 628 628 // check item permissions 629 629 if (!clicked.hasPermission(Permission.followLinks)) { 630 FrameGraphics631 . DisplayMessage("Insufficient permissions to perform action on item");630 MessageBay 631 .displayMessage("Insufficient permissions to perform action on item"); 632 632 return; 633 633 } … … 658 658 // check for TDFC permission 659 659 if (!clicked.hasPermission(Permission.createFrames)) { 660 FrameGraphics661 . DisplayMessage("Insufficient permission to TDFC from that item");660 MessageBay 661 .displayMessage("Insufficient permission to TDFC from that item"); 662 662 return; 663 663 } … … 675 675 tdfc(clickedOn); 676 676 } catch (RuntimeException e) { 677 FrameGraphics.ErrorMessage(e.getMessage());677 MessageBay.errorMessage(e.getMessage()); 678 678 } 679 679 return; … … 698 698 return false; 699 699 700 // System.out.println(Fr ame.FreeItems.size());700 // System.out.println(FreeItems.getInstance().size()); 701 701 if (isRubberBandingCorner()) { 702 702 if (clicked.isLineEnd() … … 707 707 } 708 708 709 if (Fr ame.FreeItems.size() > 2)709 if (FreeItems.getInstance().size() > 2) 710 710 return false; 711 711 … … 734 734 && clicked.getParent() != null 735 735 && clicked.getParent().getNameItem() != clicked) { 736 FrameGraphics.DisplayMessage("Insufficient permission");736 MessageBay.displayMessage("Insufficient permission"); 737 737 return; 738 738 } 739 739 740 Item merger = Fr ame.FreeItems.get(0);740 Item merger = FreeItems.getInstance().get(0); 741 741 assert (merger != null); 742 Collection<Item> left = merge(Fr ame.FreeItems, clicked);742 Collection<Item> left = merge(FreeItems.getInstance(), clicked); 743 743 anchor(left); 744 Fr ame.FreeItems.clear();744 FreeItems.getInstance().clear(); 745 745 FrameGraphics.Repaint(); 746 746 updateCursor(); … … 750 750 // if a line is being rubber-banded, check for auto 751 751 // straightening 752 anchor(Fr ame.FreeItems);753 Fr ame.FreeItems.clear();752 anchor(FreeItems.getInstance()); 753 FreeItems.getInstance().clear(); 754 754 updateCursor(); 755 755 _offX = _offY = 0; … … 760 760 // check permissions 761 761 if (!clicked.hasPermission(Permission.full)) { 762 FrameGraphics763 . DisplayMessage("Insufficient permission to pick up item");762 MessageBay 763 .displayMessage("Insufficient permission to pick up item"); 764 764 return; 765 765 } … … 885 885 return; 886 886 } 887 SessionStats.MovedItems(Fr ame.FreeItems);887 SessionStats.MovedItems(FreeItems.getInstance()); 888 888 } 889 889 890 890 private static Item getFirstFreeLineEnd() { 891 for (Item i : Fr ame.FreeItems)891 for (Item i : FreeItems.getInstance()) 892 892 if (i.isLineEnd()) 893 893 return i; … … 896 896 897 897 private static boolean isRubberBandingCorner() { 898 return getShapeCorner(Fr ame.FreeItems) != null;898 return getShapeCorner(FreeItems.getInstance()) != null; 899 899 } 900 900 … … 949 949 if (!clicked.hasPermission(Permission.full) 950 950 && clicked.getParent().getNameItem() != clicked) { 951 FrameGraphics952 . DisplayMessage("Insufficient permission to merge items");951 MessageBay 952 .displayMessage("Insufficient permission to merge items"); 953 953 return; 954 954 } … … 988 988 copies = copy(toCopy); 989 989 // Now do the merging 990 Collection<Item> remain = merge(Fr ame.FreeItems,990 Collection<Item> remain = merge(FreeItems.getInstance(), 991 991 clicked); 992 992 // anchor the points 993 993 anchor(remain); 994 Fr ame.FreeItems.clear();994 FreeItems.getInstance().clear(); 995 995 pickup(copies); 996 996 // line onto something 997 } else if (Fr ame.FreeItems.size() == 2997 } else if (FreeItems.getInstance().size() == 2 998 998 /* && clicked instanceof XRayable */) { 999 copies = ItemUtils.UnreelLine(Fr ame.FreeItems,999 copies = ItemUtils.UnreelLine(FreeItems.getInstance(), 1000 1000 _controlDown); 1001 Collection<Item> leftOver = merge(Fr ame.FreeItems,1001 Collection<Item> leftOver = merge(FreeItems.getInstance(), 1002 1002 clicked); 1003 1003 anchor(leftOver); 1004 1004 if (copies == null) 1005 copies = copy(Fr ame.FreeItems);1006 Fr ame.FreeItems.clear();1005 copies = copy(FreeItems.getInstance()); 1006 FreeItems.getInstance().clear(); 1007 1007 for (Item i : copies) 1008 1008 i.setOffset(0, 0); … … 1011 1011 pickup(copies); 1012 1012 // point onto point 1013 } else if (Fr ame.FreeItems.size() == 1) {1014 copies = copy(Fr ame.FreeItems);1013 } else if (FreeItems.getInstance().size() == 1) { 1014 copies = copy(FreeItems.getInstance()); 1015 1015 Collection<Item> remain = merge(copies, clicked); 1016 1016 … … 1019 1019 } else { 1020 1020 stampItemsOnCursor(); 1021 copies = Fr ame.FreeItems;1021 copies = FreeItems.getInstance(); 1022 1022 } 1023 1023 } else { 1024 1024 copies = ItemUtils 1025 .UnreelLine(Fr ame.FreeItems, _controlDown);1025 .UnreelLine(FreeItems.getInstance(), _controlDown); 1026 1026 if (copies == null) 1027 copies = copy(Fr ame.FreeItems);1027 copies = copy(FreeItems.getInstance()); 1028 1028 for (Item i : copies) { 1029 1029 i.setOffset(0, 0); 1030 1030 } 1031 anchor(Fr ame.FreeItems);1032 Fr ame.FreeItems.clear();1031 anchor(FreeItems.getInstance()); 1032 FreeItems.getInstance().clear(); 1033 1033 pickup(copies); 1034 1034 } … … 1039 1039 Item d = getFirstFreeLineEnd(); 1040 1040 // anchor the points 1041 anchor(Fr ame.FreeItems);1042 Fr ame.FreeItems.clear();1041 anchor(FreeItems.getInstance()); 1042 FreeItems.getInstance().clear(); 1043 1043 updateCursor(); 1044 1044 // pick up a copy of all enclosed items … … 1083 1083 if (rubberBanding()) { 1084 1084 if (clicked != null) { 1085 Collection<Item> leftOver = merge(Fr ame.FreeItems,1085 Collection<Item> leftOver = merge(FreeItems.getInstance(), 1086 1086 clicked); 1087 1087 anchor(leftOver); … … 1089 1089 // This is executed when the user is putting down a line 1090 1090 // endpoint and unreeling. ie. Normal unreeling 1091 copies = ItemUtils.UnreelLine(Fr ame.FreeItems,1091 copies = ItemUtils.UnreelLine(FreeItems.getInstance(), 1092 1092 _controlDown); 1093 1093 1094 1094 if (copies == null) 1095 copies = copy(Fr ame.FreeItems);1096 anchor(Fr ame.FreeItems);1095 copies = copy(FreeItems.getInstance()); 1096 anchor(FreeItems.getInstance()); 1097 1097 for (Item i : copies) 1098 1098 i.setOffset(0, 0); … … 1104 1104 // remove any lines that dont have both endpoints 1105 1105 // floating 1106 for (Item i : Fr ame.FreeItems) {1106 for (Item i : FreeItems.getInstance()) { 1107 1107 if (i.isFloating()) 1108 1108 originals.add(i); … … 1112 1112 for (Item i : copies) 1113 1113 i.setOffset(0, 0); 1114 anchor(Fr ame.FreeItems);1114 anchor(FreeItems.getInstance()); 1115 1115 // Move isnt working right for extruding!! 1116 1116 // move(copies); … … 1118 1118 } else { 1119 1119 stampItemsOnCursor(); 1120 copies = Fr ame.FreeItems;1120 copies = FreeItems.getInstance(); 1121 1121 } 1122 1122 } … … 1127 1127 // check permissions 1128 1128 if (!clicked.hasPermission(Permission.copy)) { 1129 FrameGraphics1130 . DisplayMessage("Insufficient permission to copy item");1129 MessageBay 1130 .displayMessage("Insufficient permission to copy item"); 1131 1131 return; 1132 1132 } … … 1164 1164 Collection<Item> enclosed = getFullyEnclosedItems(clickedIn); 1165 1165 if (enclosed.size() == 0) { 1166 FrameGraphics1167 . DisplayMessage("Insufficient permission to copy items");1166 MessageBay 1167 .displayMessage("Insufficient permission to copy items"); 1168 1168 } else { 1169 1169 copies = copy(enclosed); … … 1202 1202 merge(toMerge, on); 1203 1203 // anchor(left); 1204 // Fr ame.FreeItems.clear();1204 // FreeItems.getInstance().clear(); 1205 1205 FrameGraphics.Repaint(); 1206 1206 updateCursor(); … … 1251 1251 */ 1252 1252 private static void stampItemsOnCursor() { 1253 List<Item> copies = copy(Fr ame.FreeItems);1253 List<Item> copies = copy(FreeItems.getInstance()); 1254 1254 // MIKE: what does the below 2 lines do? 1255 1255 for (Item i : copies) … … 1257 1257 // The below code has a little problem withflicker when stamp 1258 1258 // and dragging 1259 move(Fr ame.FreeItems);1259 move(FreeItems.getInstance()); 1260 1260 for (Item i : copies) { 1261 1261 i.setHighlightMode(HighlightMode.None); … … 1379 1379 e.getY()); 1380 1380 1381 if (Fr ame.FreeItems.size() == 0) {1381 if (FreeItems.getInstance().size() == 0) { 1382 1382 // if the user can spot-weld, show the virtual spot 1383 1383 if (on instanceof Line) { … … 1454 1454 // Wait until the last Robot mouse move event arrives before 1455 1455 // processing other events 1456 if (/* Fr ame.FreeItems.size() == 0 || */1456 if (/* FreeItems.getInstance().size() == 0 || */ 1457 1457 (LastRobotX == e.getX() && LastRobotY == e.getY())) { 1458 1458 LastRobotX = null; … … 1460 1460 _RobotTimer.stop(); 1461 1461 } else { 1462 // System.out.println("Ignored: " + Fr ame.FreeItems.size());1462 // System.out.println("Ignored: " + FreeItems.getInstance().size()); 1463 1463 return; 1464 1464 } … … 1477 1477 1478 1478 // If shift is down then the movement is constrained 1479 if (_controlDown && Fr ame.FreeItems.size() > 0) {1479 if (_controlDown && FreeItems.getInstance().size() > 0) { 1480 1480 // Check if we are rubber banding a line 1481 1481 if (shiftStateChanged && rubberBanding()) { 1482 1482 // Get the line end that is being rubber banded 1483 Item thisEnd = Fr ame.FreeItems.get(0).isLineEnd() ? Frame.FreeItems1483 Item thisEnd = FreeItems.getInstance().get(0).isLineEnd() ? FreeItems.getInstance() 1484 1484 .get(0) 1485 : Fr ame.FreeItems.get(1);1486 Line line = (Line) (Fr ame.FreeItems.get(0).isLineEnd() ? Frame.FreeItems1485 : FreeItems.getInstance().get(1); 1486 Line line = (Line) (FreeItems.getInstance().get(0).isLineEnd() ? FreeItems.getInstance() 1487 1487 .get(1) 1488 : Fr ame.FreeItems.get(0));1488 : FreeItems.getInstance().get(0)); 1489 1489 Item otherEnd = line.getOppositeEnd(thisEnd); 1490 1490 int deltaX = Math.abs(e.getX() - otherEnd.getX()); … … 1533 1533 }// If its a lineend attached to two lines lengthen the shorter 1534 1534 // so it is the same length as the longer line 1535 else if (Fr ame.FreeItems.size() == 3) {1535 else if (FreeItems.getInstance().size() == 3) { 1536 1536 // check if we are rubber banding the corner of a shape 1537 Item thisEnd = getShapeCorner(Fr ame.FreeItems);1537 Item thisEnd = getShapeCorner(FreeItems.getInstance()); 1538 1538 if (thisEnd != null) { 1539 1539 Line line1 = thisEnd.getLines().get(0); … … 1614 1614 } else if (shiftStateChanged && !_controlDown && rubberBanding()) { 1615 1615 // Get the line end that is being rubber banded 1616 Item thisEnd = Fr ame.FreeItems.get(0).isLineEnd() ? Frame.FreeItems1617 .get(0) : Fr ame.FreeItems.get(1);1616 Item thisEnd = FreeItems.getInstance().get(0).isLineEnd() ? FreeItems.getInstance() 1617 .get(0) : FreeItems.getInstance().get(1); 1618 1618 thisEnd.removeAllConstraints(); 1619 1619 } … … 1627 1627 1628 1628 if (Frame.itemAttachedToCursor()) { 1629 move(Fr ame.FreeItems);1630 // System.out.println(Fr ame.FreeItems.size());1629 move(FreeItems.getInstance()); 1630 // System.out.println(FreeItems.getInstance().size()); 1631 1631 } 1632 1632 … … 1652 1652 _context = CONTEXT_AT_TEXT; 1653 1653 } 1654 if (Fr ame.FreeItems.size() > 0)1654 if (FreeItems.getInstance().size() > 0) 1655 1655 _alpha = 60; 1656 1656 else … … 1662 1662 1663 1663 // if the user is pointing at an item, highlight it 1664 if (on != null && !Fr ame.FreeItems.contains(on)) {1664 if (on != null && !FreeItems.getInstance().contains(on)) { 1665 1665 // if the user can spot-weld, show the virtual spot 1666 if (Fr ame.FreeItems.size() == 2 && on instanceof Line) {1666 if (FreeItems.getInstance().size() == 2 && on instanceof Line) { 1667 1667 Line line = (Line) on; 1668 Item freeItem0 = Fr ame.FreeItems.get(0);1669 Item freeItem1 = Fr ame.FreeItems.get(1);1668 Item freeItem0 = FreeItems.getInstance().get(0); 1669 Item freeItem1 = FreeItems.getInstance().get(1); 1670 1670 Item lineEnd = freeItem0.isLineEnd() ? freeItem0 : (freeItem1 1671 1671 .isLineEnd() ? freeItem1 : null); … … 1702 1702 // check that the enclosure is not part of a point being 1703 1703 // dragged in space 1704 !ContainsOneOf(enclosure, Fr ame.FreeItems)) {1704 !ContainsOneOf(enclosure, FreeItems.getInstance())) { 1705 1705 on = firstLineEnd.getLines().get(0); 1706 1706 // System.out.println(on == null ? "Null" : … … 1760 1760 */ 1761 1761 private static boolean rubberBanding() { 1762 if (Fr ame.FreeItems.size() != 2) {1762 if (FreeItems.getInstance().size() != 2) { 1763 1763 return false; 1764 1764 } … … 1766 1766 // if rubber-banding, there will be 1 lineend and the rest will be lines 1767 1767 boolean foundLineEnd = false; 1768 for (Item i : Fr ame.FreeItems) {1768 for (Item i : FreeItems.getInstance()) { 1769 1769 if (i.isLineEnd()) { 1770 1770 if (foundLineEnd) { … … 1803 1803 public static void resetOffset() { 1804 1804 if (Frame.itemAttachedToCursor()) { 1805 _offX = DisplayIO.getMouseX() - Fr ame.FreeItems.get(0).getX()1806 + Fr ame.FreeItems.get(0).getOffset().x;1807 _offY = getY() - Fr ame.FreeItems.get(0).getY()1808 + Fr ame.FreeItems.get(0).getOffset().y;1805 _offX = DisplayIO.getMouseX() - FreeItems.getInstance().get(0).getX() 1806 + FreeItems.getInstance().get(0).getOffset().x; 1807 _offY = getY() - FreeItems.getInstance().get(0).getY() 1808 + FreeItems.getInstance().get(0).getOffset().y; 1809 1809 } 1810 1810 } … … 1835 1835 FrameUtils.DisplayFrame(toLoad); 1836 1836 } else { 1837 FrameGraphics.ErrorMessage(toLoad + " is not a valid frame name.");1837 MessageBay.errorMessage(toLoad + " is not a valid frame name."); 1838 1838 } 1839 1839 } … … 1844 1844 // repaint things if necessary 1845 1845 if (Frame.itemAttachedToCursor()) 1846 move(Fr ame.FreeItems);1846 move(FreeItems.getInstance()); 1847 1847 } 1848 1848 … … 1921 1921 1922 1922 if (attribs == null) 1923 FrameGraphics1924 . DisplayMessage("All attributes of that item are default values.");1923 MessageBay 1924 .displayMessage("All attributes of that item are default values."); 1925 1925 else { 1926 1926 // Give the attribute text item the color of the item for which … … 1946 1946 if (Frame.itemAttachedToCursor()) { 1947 1947 // if this is an item-swap 1948 if (Fr ame.FreeItems.size() == 11949 && Fr ame.FreeItems.get(0) instanceof Text1948 if (FreeItems.getInstance().size() == 1 1949 && FreeItems.getInstance().get(0) instanceof Text 1950 1950 && toDelete != null && toDelete instanceof Text) { 1951 1951 1952 1952 // check permissions 1953 1953 if (!toDelete.hasPermission(Permission.full)) { 1954 FrameGraphics1955 . DisplayMessage("Insufficient permission to swap Item text");1954 MessageBay 1955 .displayMessage("Insufficient permission to swap Item text"); 1956 1956 return; 1957 1957 } 1958 1958 Text anchored = (Text) toDelete; 1959 Text free = (Text) Fr ame.FreeItems.get(0);1959 Text free = (Text) FreeItems.getInstance().get(0); 1960 1960 SessionStats.DeletedItem(free); 1961 1961 // List<String> temp = anchored.getText(); … … 1963 1963 1964 1964 // free.setTextList(temp); 1965 Fr ame.FreeItems.clear();1965 FreeItems.getInstance().clear(); 1966 1966 1967 1967 anchored.getParent().setChanged(true); … … 1972 1972 _offY = getY() - anchored.getY() + anchored.getOffset().y; 1973 1973 } else { 1974 deleteItems(Fr ame.FreeItems);1974 deleteItems(FreeItems.getInstance()); 1975 1975 } 1976 1976 // reset the mouse cursor … … 2032 2032 // check permissions 2033 2033 if (!toDelete.hasPermission(Permission.full)) { 2034 FrameGraphics2035 . DisplayMessage("Insufficient permission to delete item");2034 MessageBay 2035 .displayMessage("Insufficient permission to delete item"); 2036 2036 return; 2037 2037 } … … 2355 2355 2356 2356 if (!toGrab.hasPermission(Permission.full)) { 2357 FrameGraphics2358 . DisplayMessage("Insufficient permission pickup the item");2357 MessageBay 2358 .displayMessage("Insufficient permission pickup the item"); 2359 2359 return; 2360 2360 } … … 2402 2402 i.setParent(null); 2403 2403 } 2404 Fr ame.FreeItems.add(i);2404 FreeItems.getInstance().add(i); 2405 2405 i.setFloating(true); 2406 2406 if (i.hasVector()) { … … 2409 2409 // Collection<Item> copies = ItemUtils.CopyItems(overlayFrame 2410 2410 // .getNonAnnotationItems(), i.getVector()); 2411 // Fr ame.FreeItems.addAll(copies);2411 // FreeItems.getInstance().addAll(copies); 2412 2412 // TODO add the copies to the free items so they are visible 2413 2413 // when the cursor is moving around but are not anchored … … 2429 2429 // make the offset item the first item in the list (so 2430 2430 // move method knows which item to use) 2431 Fr ame.FreeItems.set(Frame.FreeItems.indexOf(i),2432 Fr ame.FreeItems.get(0));2433 Fr ame.FreeItems.set(0, i);2431 FreeItems.getInstance().set(FreeItems.getInstance().indexOf(i), 2432 FreeItems.getInstance().get(0)); 2433 FreeItems.getInstance().set(0, i); 2434 2434 break; 2435 2435 } 2436 2436 } 2437 2437 2438 move(Fr ame.FreeItems);2438 move(FreeItems.getInstance()); 2439 2439 ItemUtils.EnclosedCheck(toGrab); 2440 2440 // otherwise, just use the first item … … 2448 2448 move(toGrab); 2449 2449 } else { 2450 FrameGraphics2451 . DisplayMessage("Insufficient permission pickup the items");2450 MessageBay 2451 .displayMessage("Insufficient permission pickup the items"); 2452 2452 } 2453 2453 if (bReparse) … … 2536 2536 int clicks = arg0.getClickCount(); 2537 2537 2538 if (Fr ame.FreeItems.size() == 2) {2539 if ((Fr ame.FreeItems.get(0).isLineEnd() && Frame.FreeItems.get(1) instanceof Line)2540 || (Fr ame.FreeItems.get(1).isLineEnd() && Frame.FreeItems2538 if (FreeItems.getInstance().size() == 2) { 2539 if ((FreeItems.getInstance().get(0).isLineEnd() && FreeItems.getInstance().get(1) instanceof Line) 2540 || (FreeItems.getInstance().get(1).isLineEnd() && FreeItems.getInstance() 2541 2541 .get(0) instanceof Line)) { 2542 2542 2543 2543 Line line; 2544 if (Fr ame.FreeItems.get(0) instanceof Line)2545 line = (Line) Fr ame.FreeItems.get(0);2544 if (FreeItems.getInstance().get(0) instanceof Line) 2545 line = (Line) FreeItems.getInstance().get(0); 2546 2546 else 2547 line = (Line) Fr ame.FreeItems.get(1);2547 line = (Line) FreeItems.getInstance().get(1); 2548 2548 2549 2549 // User must do multiple clicks to toggle the line … … 2590 2590 // check permissions 2591 2591 if (!item.hasPermission(Permission.full)) { 2592 FrameGraphics2593 . DisplayMessage("Insufficient permission to edit the Line");2592 MessageBay 2593 .displayMessage("Insufficient permission to edit the Line"); 2594 2594 return; 2595 2595 } -
trunk/src/org/expeditee/gui/FrameUtils.java
r116 r121 331 331 if (Frame.itemAttachedToCursor()) { 332 332 List<Item> toAdd = new ArrayList<Item>(); 333 List<Item> toCheck = new ArrayList<Item>(Fr ame.FreeItems);333 List<Item> toCheck = new ArrayList<Item>(FreeItems.getInstance()); 334 334 335 335 while (toCheck.size() > 0) { … … 339 339 // // Only move completely enclosed items 340 340 // if (!toCheck.containsAll(connected)) { 341 // connected.retainAll(Fr ame.FreeItems);342 // Fr ame.FreeItems.removeAll(connected);341 // connected.retainAll(FreeItems.getInstance()); 342 // FreeItems.getInstance().removeAll(connected); 343 343 // toCheck.removeAll(connected); 344 344 // FrameMouseActions.anchor(connected); … … 349 349 // Anchor overlay items where they belong 350 350 if (i.getParent() != null && i.getParent() != current) { 351 Fr ame.FreeItems.removeAll(connected);351 FreeItems.getInstance().removeAll(connected); 352 352 toCheck.removeAll(connected); 353 353 FrameMouseActions.anchor(connected); … … 357 357 toCheck.removeAll(connected); 358 358 // Dont add the items that are free 359 connected.removeAll(Fr ame.FreeItems);359 connected.removeAll(FreeItems.getInstance()); 360 360 toAdd.addAll(connected); 361 361 } … … 376 376 // if the saving happened properly, we can continue 377 377 if (!LeavingFrame(current)) { 378 FrameGraphics.DisplayMessage("Navigation cancelled");378 MessageBay.displayMessage("Navigation cancelled"); 379 379 return; 380 380 } … … 437 437 438 438 if (f == null) { 439 FrameGraphics.ErrorMessage("Frame '" + frameName439 MessageBay.errorMessage("Frame '" + frameName 440 440 + "' could not be found."); 441 441 } … … 461 461 if (imagePath.length() == 0) { 462 462 return false; 463 // FrameGraphics.ErrorMessage("Expected image path after @i:");463 // MessageBay.errorMessage("Expected image path after @i:"); 464 464 } else { 465 FrameGraphics.ErrorMessage("Image " + imagePath465 MessageBay.errorMessage("Image " + imagePath 466 466 + " could not be loaded"); 467 467 } … … 506 506 } catch (InteractiveWidgetNotAvailableException e) { 507 507 e.printStackTrace(); 508 FrameGraphics.ErrorMessage("Cannot create iWidget: " 509 + e.getMessage()); 508 MessageBay.errorMessage("Cannot create iWidget: " + e.getMessage()); 510 509 } catch (InteractiveWidgetInitialisationFailedException e) { 511 510 e.printStackTrace(); 512 FrameGraphics.ErrorMessage("Cannot create iWidget: " 513 + e.getMessage()); 511 MessageBay.errorMessage("Cannot create iWidget: " + e.getMessage()); 514 512 } catch (IllegalArgumentException e) { 515 513 e.printStackTrace(); 516 FrameGraphics.ErrorMessage("Cannot create iWidget: " 517 + e.getMessage()); 514 MessageBay.errorMessage("Cannot create iWidget: " + e.getMessage()); 518 515 } 519 516 … … 557 554 // warn the user 558 555 else { 559 // FrameGraphics.WarningMessage("Home frame: " + first556 // MessageBay.warningMessage("Home frame: " + first 560 557 // + " is not a valid frame."); 561 558 UserSettings.FirstFrame = profile.getName(); … … 627 624 UserSettings.FrameDirs.addAll(getDirs(item)); 628 625 } else { 629 FrameGraphics.WarningMessage(attributeFullCase626 MessageBay.warningMessage(attributeFullCase 630 627 + " is not a profile frame tag"); 631 628 } … … 636 633 if (UserSettings.FirstFrame == null) 637 634 UserSettings.FirstFrame = profile.getName(); 638 else {639 640 641 FrameGraphics.WarningMessage("Home frame not found: "642 643 644 645 646 647 648 }635 // else { 636 Frame firstFrame = FrameIO.LoadFrame(UserSettings.FirstFrame); 637 if (firstFrame == null) { 638 MessageBay.warningMessage("Home frame not found: " 639 + UserSettings.FirstFrame); 640 UserSettings.FirstFrame = profile.getName(); 641 DisplayIO.setCurrentFrame(profile); 642 } else { 643 DisplayIO.setCurrentFrame(firstFrame); 644 } 645 // } 649 646 } 650 647 … … 727 724 return name + File.separator; 728 725 } else { 729 FrameGraphics.ErrorMessage("Directory not found: " + name);726 MessageBay.errorMessage("Directory not found: " + name); 730 727 } 731 728 } else { 732 FrameGraphics.WarningMessage("Missing value for profile attribute"729 MessageBay.warningMessage("Missing value for profile attribute" 733 730 + name); 734 731 } … … 866 863 } 867 864 }// check for new VECTOR items 868 else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_VECTOR) 865 else if (!FrameGraphics.isXRayMode() 866 && ItemUtils.startsWithTag(i, ItemUtils.TAG_VECTOR) 869 867 && i.getLink() != null) { 870 868 // TODO It is possible to get into an infinate loop if a … … 879 877 vectorPermission = Permission.min(vectorPermission, 880 878 permission); 881 //Highest permissable permission for vectors is copy 882 vectorPermission = Permission.min(vectorPermission, Permission.copy); 879 // Highest permissable permission for vectors is copy 880 vectorPermission = Permission.min(vectorPermission, 881 Permission.copy); 883 882 if (vector != null) { 884 883 String scaleString = AttributeUtils … … 889 888 } catch (Exception e) { 890 889 } 891 Vector newVector = new Vector(vector, vectorPermission, i892 .getPosition(), scale, i.getColor(), i893 .getBackgroundColor());890 Vector newVector = new Vector(vector, 891 vectorPermission, i.getPosition(), scale, i 892 .getColor(), i.getBackgroundColor()); 894 893 i.setOverlay(newVector); 895 894 vectors.add(newVector); … … 903 902 // This frame contains an active overlay which 904 903 // points to itself 905 FrameGraphics.ErrorMessage(toParse.getName()904 MessageBay.errorMessage(toParse.getName() 906 905 + " contains an @o which links to itself"); 907 906 continue; … … 921 920 // This frame contains an active overlay which 922 921 // points to itself 923 FrameGraphics.ErrorMessage(toParse.getName()922 MessageBay.errorMessage(toParse.getName() 924 923 + " contains an @ao which links to itself"); 925 924 continue; … … 1054 1053 Logger.Log(e); 1055 1054 e.printStackTrace(); 1056 FrameGraphics.WarningMessage("Exception occured when loading "1055 MessageBay.warningMessage("Exception occured when loading " 1057 1056 + i.getClass().getSimpleName() + "(ID: " + i.getID() 1058 1057 + ") " + e.getMessage()); … … 1100 1099 if (y > FrameGraphics.getMaxFrameSize().getHeight()) { 1101 1100 // check the individual message items 1102 for (Item message : FrameGraphics.Messages) {1101 for (Item message : MessageBay.getMessages()) { 1103 1102 if (message != null) { 1104 1103 if (message.contains(x, y)) { … … 1114 1113 1115 1114 // check the link to the message frame 1116 if ( FrameGraphics.MessageLink!= null) {1117 if ( FrameGraphics.MessageLink.contains(x, y)) {1118 FrameGraphics.MessageLink.setPermission(Permission.copy);1119 possibles.add( FrameGraphics.MessageLink);1115 if (MessageBay.getMessageLink() != null) { 1116 if (MessageBay.getMessageLink().contains(x, y)) { 1117 MessageBay.getMessageLink().setPermission(Permission.copy); 1118 possibles.add(MessageBay.getMessageLink()); 1120 1119 } 1121 1120 } … … 1128 1127 * LastEdited.isVisible() && 1129 1128 */LastEdited.contains(x, y) 1130 && !Fr ame.FreeItems.contains(LastEdited)1129 && !FreeItems.getInstance().contains(LastEdited) 1131 1130 && LastEdited.getParent() == DisplayIO.getCurrentFrame() 1132 1131 && LastEdited.getParent().getItems().contains(LastEdited)) { … … 1141 1140 for (Item i : checkList) { 1142 1141 // do not check annotation items in audience mode 1143 if (i.isVisible() && !(FrameGraphics.isAudienceMode() && i.isAnnotation())) { 1144 if (i.contains(x, y) && !Frame.FreeItems.contains(i)) { 1142 if (i.isVisible() 1143 && !(FrameGraphics.isAudienceMode() && i.isAnnotation())) { 1144 if (i.contains(x, y) 1145 && !FreeItems.getInstance().contains(i)) { 1145 1146 possibles.add(i); 1146 1147 } … … 1232 1233 1233 1234 // Remove all items that are connected to freeItems 1234 List<Item> freeItems = new ArrayList<Item>(Fr ame.FreeItems);1235 List<Item> freeItems = new ArrayList<Item>(FreeItems.getInstance()); 1235 1236 while (freeItems.size() > 0) { 1236 1237 Item item = freeItems.get(0); -
trunk/src/org/expeditee/io/AbstractHTMLWriter.java
r80 r121 5 5 6 6 import org.expeditee.gui.Frame; 7 import org.expeditee.gui. FrameGraphics;7 import org.expeditee.gui.MessageBay; 8 8 import org.expeditee.items.Item; 9 9 … … 39 39 dir.mkdirs(); 40 40 } catch (Exception e) { 41 FrameGraphics.ErrorMessage("Could not create folder: "41 MessageBay.errorMessage("Could not create folder: " 42 42 + dir.getName()); 43 43 _filesFolderName = null; -
trunk/src/org/expeditee/io/DefaultTreeWriter.java
r80 r121 6 6 7 7 import org.expeditee.gui.Frame; 8 import org.expeditee.gui.FrameGraphics;9 8 import org.expeditee.gui.FrameIO; 9 import org.expeditee.gui.MessageBay; 10 10 import org.expeditee.items.Item; 11 11 import org.expeditee.items.Text; … … 91 91 this.resumeFrame(next); 92 92 } else { 93 FrameGraphics.OverwriteMessage("Writing: " + next.getName());93 MessageBay.overwriteMessage("Writing: " + next.getName()); 94 94 _frameCount++; 95 95 writeStartFrame(next); -
trunk/src/org/expeditee/io/KMSReader.java
r108 r121 12 12 13 13 import org.expeditee.gui.Frame; 14 import org.expeditee.gui. FrameGraphics;14 import org.expeditee.gui.MessageBay; 15 15 import org.expeditee.items.Constraint; 16 16 import org.expeditee.items.Dot; … … 361 361 if (_FrameTags.get(tag) == null) { 362 362 if (!tag.equals("t") && !tag.equals("v")) 363 FrameGraphics.ErrorMessage("Tag '" + tag + "' in '" + line363 MessageBay.errorMessage("Tag '" + tag + "' in '" + line 364 364 + "' is not supported."); 365 365 return; … … 379 379 private Frame readFrameClass() throws IOException { 380 380 if (_data.size() == 0) { 381 FrameGraphics382 . ErrorMessage("IO Error: File contains no valid KMS lines.");381 MessageBay 382 .errorMessage("IO Error: File contains no valid KMS lines."); 383 383 return null; 384 384 } -
trunk/src/org/expeditee/io/PNGWriter.java
r80 r121 6 6 import org.expeditee.agents.DefaultAgent; 7 7 import org.expeditee.gui.Frame; 8 import org.expeditee.gui.FrameGraphics;9 8 import org.expeditee.gui.FrameIO; 9 import org.expeditee.gui.MessageBay; 10 10 import org.expeditee.items.Item; 11 11 … … 26 26 _writer.write(ItemWriter.NEW_LINE); 27 27 } else { 28 FrameGraphics.ErrorMessage("Could not create image for "28 MessageBay.errorMessage("Could not create image for " 29 29 + starting.getName()); 30 30 } -
trunk/src/org/expeditee/items/Circle.java
r115 r121 7 7 import java.awt.Graphics2D; 8 8 import java.awt.Polygon; 9 import java.awt.Rectangle; 9 10 import java.awt.geom.Point2D; 10 11 import java.util.Collection; … … 36 37 updatePolygon(); 37 38 } 38 39 39 40 public Collection<Item> getItemsToSave() { 40 Collection<Item> toSave = super.getItemsToSave();41 Collection<Item> toSave = super.getItemsToSave(); 41 42 toSave.add(_center); 42 43 return toSave; … … 196 197 return super.setHighlightColor(c); 197 198 } 198 199 199 200 @Override 200 201 public void setFillColor(Color c) { … … 254 255 @Override 255 256 public float getSize() { 256 return (float) getRadius();257 return (float) getRadius(); 257 258 } 258 259 259 260 /** 260 * Resizes the circle from the center.261 * Resizes the circle from the center. 261 262 */ 262 263 @Override … … 283 284 public void translate(Point2D origin, double ratio) { 284 285 updatePolygon(); 285 //_center.translate(origin, ratio); 286 //super.translate(origin, ratio); 286 // _center.translate(origin, ratio); 287 // super.translate(origin, ratio); 288 } 289 290 @Override 291 public Rectangle[] getDrawingArea() { 292 293 float thickness = getThickness(); 294 double radius = getRadius(); 295 296 int size = (int) ((2 * radius) + 3.0 + thickness); 297 298 return new Rectangle[] { new Rectangle((int) (_center.getX() - radius 299 - 0.5 - (thickness / 2.0)), (int) (_center.getY() - radius 300 - 0.5 - (thickness / 2.0)), size, size) }; 301 } 302 303 // @Override 304 // public void setPosition(float x, float y){ 305 // float deltaX = x - _source._x; 306 // float deltaY = y = _source._y; 307 // _center.setPosition(deltaX, deltaY); 308 // super.setPosition(x,y); 309 // } 310 public Item getCenter() { 311 return _center; 287 312 } 288 313 289 // @Override 290 // public void setPosition(float x, float y){ 291 // float deltaX = x - _source._x; 292 // float deltaY = y = _source._y; 293 // _center.setPosition(deltaX, deltaY); 294 // super.setPosition(x,y); 295 // } 296 public Item getCenter(){ 297 return _center; 298 } 314 299 315 } -
trunk/src/org/expeditee/items/Dot.java
r115 r121 86 86 @Override 87 87 public void paint(Graphics2D g) { 88 if (isHighlighted() /* && !Fr ame.FreeItems.contains(this) */) {88 if (isHighlighted() /* && !FreeItems.getInstance().contains(this) */) { 89 89 Color highlightColor = getHighlightColor(); 90 90 g.setColor(highlightColor); -
trunk/src/org/expeditee/items/InteractiveWidget.java
r108 r121 20 20 import org.expeditee.gui.Frame; 21 21 import org.expeditee.gui.FrameGraphics; 22 import org.expeditee.gui.FreeItems; 22 23 23 24 /** … … 53 54 // world 54 55 private Text _textRepresentation; 56 57 private final static Color FREESPACE_BACKCOLOR = new Color(100,100,100,128); 55 58 56 59 // A flag for signifying whether the swing components are ready to paint. 57 60 // If the swing components has not been layed out, if they are painted they 58 // will 59 // not draw in the correct positions.61 // will not draw in the correct positions. 62 // Also for setting AWT and Swing -Related drawing options after construction 60 63 private boolean _isReadyToPaint = false; 61 64 62 65 /** 63 66 * Creates a InteractiveWidget from a text item. … … 356 359 _swingComponent = component; 357 360 _textRepresentation = source; 358 361 359 362 _minWidth = minWidth; 360 363 … … 742 745 743 746 } 747 748 FrameGraphics.invalidateItem(_d1, _swingComponent.getBounds()); 744 749 } 745 750 … … 772 777 773 778 synchronized (_widgetsToAddLater) { 774 _widgetsToAddLater.add(new WidgetInfo(this, e));779 _widgetsToAddLater.add(new DelayedWidgetEvent(this, e)); 775 780 } 776 781 SwingUtilities.invokeLater(new AddToFrameLater()); … … 780 785 781 786 } 787 788 /** 789 * @return True if at least one corner is floating 790 */ 791 public boolean isFloating() { 792 return _d1.isFloating() || _d2.isFloating() 793 || _d3.isFloating() || _d4.isFloating(); 794 } 795 796 public boolean areCornersFullyAnchored() { 797 return _d1.getParent() != null && _d2.getParent() != null 798 && _d3.getParent() != null && _d4.getParent() != null; 799 } 782 800 783 801 /** … … 786 804 * @author Brook Novak 787 805 */ 788 class WidgetInfo{789 790 WidgetInfo(InteractiveWidget widget, ItemParentStateChangedEvent e) {806 class DelayedWidgetEvent { 807 808 DelayedWidgetEvent(InteractiveWidget widget, ItemParentStateChangedEvent e) { 791 809 _widget = widget; 792 810 _e = e; … … 802 820 * before the browser singleton is made available. 803 821 */ 804 private static List< WidgetInfo> _widgetsToAddLater = new LinkedList<WidgetInfo>();822 private static List<DelayedWidgetEvent> _widgetsToAddLater = new LinkedList<DelayedWidgetEvent>(); 805 823 806 824 /** … … 810 828 public void run() { 811 829 if (!_widgetsToAddLater.isEmpty()) { 812 List< WidgetInfo> tmp = null;830 List<DelayedWidgetEvent> tmp = null; 813 831 synchronized (_widgetsToAddLater) { 814 tmp = new LinkedList< WidgetInfo>(_widgetsToAddLater);832 tmp = new LinkedList<DelayedWidgetEvent>(_widgetsToAddLater); 815 833 } 816 834 _widgetsToAddLater.clear(); 817 for ( WidgetInfoiwi : tmp) {835 for (DelayedWidgetEvent iwi : tmp) { 818 836 iwi._widget.addJComponantToFrame(iwi._e); 819 837 } … … 821 839 } 822 840 } 841 842 public void onBoundsChanged() { 843 844 _swingComponent.setBounds(getX(), getY(), getWidth(), getHeight()); 845 846 } 847 823 848 824 849 /** … … 841 866 } 842 867 868 } 869 870 private void ignoreAWTPainting(Component c) { 871 872 if (c instanceof JComponent) { 873 ((JComponent)c).setDoubleBuffered(false); 874 } 875 876 c.setIgnoreRepaint(true); 877 878 if (c instanceof Container) { 879 for (Component child : ((Container) c).getComponents()) { 880 881 if (child instanceof Container) { 882 ignoreAWTPainting(child); 883 } else { 884 if (child instanceof JComponent) { 885 ((JComponent)child).setDoubleBuffered(false); 886 } 887 888 child.setIgnoreRepaint(true); 889 } 890 } 891 } 892 } 893 894 private void prepareToPaint() { 843 895 _isReadyToPaint = true; 844 } 845 846 public void onBoundsChanged() { 847 848 _swingComponent.setBounds(getX(), getY(), getWidth(), getHeight()); 849 850 } 896 layout(_swingComponent); 897 ignoreAWTPainting(_swingComponent); 898 } 899 851 900 852 901 /** … … 858 907 859 908 if (!_isReadyToPaint) { 860 layout(_swingComponent);909 prepareToPaint(); 861 910 } 862 911 863 912 Point loc = _swingComponent.getLocation(); 913 864 914 g.translate(loc.x, loc.y - 1); 865 915 _swingComponent.paint(g); … … 867 917 868 918 } 869 870 /** 871 * Called from the widgets corners: Whenever the corners are repainted and 872 * the widget is floating (e.g. currently picked up / rubberbanding) then a 919 920 /** 921 * Invoked whenever the widget is to be repainted in free space. 922 * @param g 923 */ 924 protected void paintInFreeSpace(Graphics g) { 925 g.setColor(FREESPACE_BACKCOLOR); 926 g.fillRect(getX(), getY(), getWidth(), getHeight()); 927 } 928 929 /** 930 * Called from the widgets corners: Whenever one of the corners are invoked for 931 * a refill of the enclosed area. 932 * 933 * If the widget is floating (e.g. currently picked up / rubberbanding) then a 873 934 * shaded area is drawn instead of the actual widget so the manipulation of 874 * the widget is as smooth as possible. The shaded area is only draw once so 875 * it selects one of the 4 possible notifiers to be the actual trigger to 876 * draw the shaded area 935 * the widget is as smooth as possible. 877 936 * 878 937 * @param g 879 938 * @param notifier 880 939 */ 881 void paint (Graphics g, WidgetCorner notifier) {940 void paintFill(Graphics g) { 882 941 if (_swingComponent.getParent() == null) { 883 942 // Note that frames with @f may want to paint the widgets so do not 884 943 // paint over the widget interface in these cases: must only 885 944 // paint if an object is floating 886 if (notifier == _d4 887 && (_d1.isFloating() || _d2.isFloating() 888 || _d3.isFloating() || _d4.isFloating())) { 889 g.setColor(Color.DARK_GRAY); 890 g.fillRect(getX(), getY(), getWidth(), getHeight()); 945 if (isFloating()) { 946 paintInFreeSpace(g); 891 947 } 892 948 } … … 909 965 * 910 966 * The purpose of this is so that widgets can have an extra context: no 911 * expeditee highlighting if focus is on a swing compon et.967 * expeditee highlighting if focus is on a swing componant. 912 968 * 913 969 * @param enable … … 921 977 } 922 978 923 public static boolean isEx epiteeHighlightingEnabled() {979 public static boolean isExpediteeHighlightingEnabled() { 924 980 return _isExepiteeHighlightingEnabled; 925 981 } 926 982 983 /** 984 * Removes this widget from the parent frame or free space 985 */ 986 protected void removeSelf() { 987 988 Frame parent = getParentFrame(); 989 990 if (parent == null) { 991 FreeItems.getInstance().removeAll(_expediteeItems); 992 } else { 993 parent.removeAllItems(_expediteeItems); 994 } 995 996 } 997 998 /** 999 * @return The parent frame. Null if has none. Note: Based on corners parents. 1000 */ 1001 public Frame getParentFrame() { 1002 1003 Frame parent = null; 1004 if (_d1.getParent() != null) parent = _d1.getParent(); 1005 else if (_d2.getParent() != null) parent = _d2.getParent(); 1006 else if (_d3.getParent() != null) parent = _d3.getParent(); 1007 else if (_d4.getParent() != null) parent = _d4.getParent(); 1008 1009 return parent; 1010 } 1011 1012 927 1013 } -
trunk/src/org/expeditee/items/Item.java
r116 r121 5 5 import java.awt.Cursor; 6 6 import java.awt.Dimension; 7 import java.awt.GradientPaint; 7 8 import java.awt.Graphics2D; 8 9 import java.awt.Point; 9 10 import java.awt.Polygon; 10 11 import java.awt.Rectangle; 12 import java.awt.Shape; 11 13 import java.awt.Stroke; 12 14 import java.awt.geom.AffineTransform; … … 29 31 import org.expeditee.gui.FrameIO; 30 32 import org.expeditee.gui.FrameUtils; 33 import org.expeditee.gui.MessageBay; 31 34 import org.expeditee.gui.Overlay; 32 35 import org.expeditee.gui.Vector; … … 185 188 if (parent != null) { 186 189 dest.setID(source.getParentOrCurrentFrame().getNextItemID()); 187 } 190 } 191 // else { 192 // dest.setID(source.getID()); 193 // } 188 194 } 189 195 … … 254 260 private Color _color = null; 255 261 256 pr ivateColor _highlightColor = DEFAULT_HIGHLIGHT;262 protected Color _highlightColor = DEFAULT_HIGHLIGHT; 257 263 258 264 private Color _colorBackground = null; … … 525 531 } 526 532 527 protected Polygon get Circle() {533 protected Polygon getLinkPoly() { 528 534 if (_circle == null) { 529 535 int points = 16; … … 552 558 _circleCross = new Polygon(); 553 559 554 Rectangle bounds = get Circle().getBounds();560 Rectangle bounds = getLinkPoly().getBounds(); 555 561 int x1 = (int) bounds.getMinX(); 556 562 int x2 = (int) bounds.getMaxX(); … … 943 949 g.setColor(fillColor); 944 950 // The painting is not efficient enough for gradients... 945 // Shapes = getEnclosedShape();946 //Rectangle b = s.getBounds();947 //GradientPaint gp = new GradientPaint((int) (b.x + b.width * 0.3),948 //b.y, getFillColor(), (int) (b.x + b.width * 1.3), b.y,949 //Color.white);950 //g.setPaint(gp);951 // g.fill(s);951 // Polygon s = getEnclosedShape(); 952 // Rectangle b = s.getBounds(); 953 // GradientPaint gp = new GradientPaint((int) (b.x + b.width * 0.3), 954 // b.y, getFillColor(), (int) (b.x + b.width * 1.3), b.y, 955 // Color.white); 956 // g.setPaint(gp); 957 // g.fillPolygon(s); 952 958 g.fillPolygon(getEnclosedShape()); 953 959 } … … 994 1000 */ 995 1001 public void removeAllLines() { 1002 for (Line l : _lines) { 1003 l.invalidateAll(); 1004 } 996 1005 _lines.clear(); 997 1006 } … … 1016 1025 */ 1017 1026 public void removeLine(Line line) { 1018 _lines.remove(line); 1027 if (_lines.remove(line)) 1028 line.invalidateAll(); 1019 1029 } 1020 1030 … … 1024 1034 Simple.RunFrameAndReportError(this, new Context()); 1025 1035 Simple.ProgramFinished(); 1026 FrameGraphics.DisplayMessage(AgentStats.getStats(), GREEN);1036 MessageBay.displayMessage(AgentStats.getStats(), GREEN); 1027 1037 } catch (ConcurrentModificationException ce) { 1028 1038 Simple.ProgramFinished(); 1029 1039 ce.printStackTrace(); 1030 1040 } catch (Exception e) { 1031 FrameGraphics.LinkedErrorMessage(e.getMessage());1041 MessageBay.linkedErrorMessage(e.getMessage()); 1032 1042 Simple.ProgramFinished(); 1033 1043 } … … 1142 1152 1143 1153 public void setBackgroundColor(Color c) { 1144 _colorBackground = c; 1154 if (c != _colorBackground) { 1155 _colorBackground = c; 1156 invalidateCommonTrait(ItemAppearence.BackgroundColorChanged); 1157 } 1145 1158 } 1146 1159 … … 1163 1176 */ 1164 1177 public void setColor(Color c) { 1165 _color = c; 1178 if (c != _color) { 1179 _color = c; 1180 invalidateCommonTrait(ItemAppearence.ForegroundColorChanged); 1181 } 1166 1182 } 1167 1183 … … 1191 1207 1192 1208 public void setFillColor(Color c) { 1209 1193 1210 _colorFill = c; 1194 1211 … … 1198 1215 other.setFillColor(c); 1199 1216 } 1217 1218 invalidateCommonTrait(ItemAppearence.FillColor); 1219 invalidateFill(); 1200 1220 } 1201 1221 1202 1222 public void setFillPattern(String patternLink) { 1203 1223 _fillPattern = patternLink; 1224 invalidateCommonTrait(ItemAppearence.FillPattern); 1225 invalidateFill(); 1204 1226 } 1205 1227 … … 1244 1266 for (Line line : lines) 1245 1267 line.setLinePattern(getLinePattern()); 1268 1269 1246 1270 } 1247 1271 … … 1254 1278 */ 1255 1279 public void setLink(String frameName) { 1256 if (FrameIO.isValidLink(frameName)) 1280 if (FrameIO.isValidLink(frameName)) 1257 1281 _link = frameName; 1258 1282 else 1259 FrameGraphics.ErrorMessage("[" + frameName1283 MessageBay.errorMessage("[" + frameName 1260 1284 + "] is not a valid frame name"); 1261 1285 // TODO make this throw exceptions etc... 1286 1287 invalidate(getLinkDrawArea()); 1262 1288 } 1263 1289 … … 1266 1292 _link_frameset = frameset; 1267 1293 else 1268 FrameGraphics.ErrorMessage("[" + frameset1294 MessageBay.errorMessage("[" + frameset 1269 1295 + "] is not a valid frameset name"); 1270 1296 // TODO make this throw exceptions etc... … … 1280 1306 _link_template = template; 1281 1307 else 1282 FrameGraphics.ErrorMessage("[" + template1308 MessageBay.errorMessage("[" + template 1283 1309 + "] is not a valid frame name"); 1284 1310 // TODO make this throw exceptions etc... … … 1316 1342 1317 1343 /** 1344 * Invalidates this, connected lines and fill 1345 * @param trait 1346 */ 1347 private void invalidateCommonTraitForAll(ItemAppearence trait) { 1348 invalidateCommonTrait(trait); 1349 for (Line line : getLines()) 1350 line.invalidateCommonTrait(trait); 1351 if (_colorFill != null) { 1352 invalidateFill(); // only invalidates if has fill 1353 } 1354 for(XRayable x: getEnclosures()){ 1355 x.invalidateCommonTrait(trait); 1356 } 1357 1358 } 1359 1360 1361 /** 1318 1362 * Sets the position of this item on the screen 1319 1363 * … … 1326 1370 float deltaX = x - _x; 1327 1371 float deltaY = y - _y; 1372 1373 if (deltaX == 0 && deltaY == 0) return; 1374 1375 invalidateCommonTraitForAll(ItemAppearence.PreMoved); 1328 1376 1329 1377 _x = x; … … 1413 1461 } 1414 1462 1415 for (Line line : getLines()) 1416 line.updatePolygon(); 1463 for (Line line : getLines()) { 1464 line.updatePolygon(); 1465 } 1466 1467 invalidateCommonTraitForAll(ItemAppearence.PostMoved); 1468 1417 1469 } 1418 1470 … … 1463 1515 */ 1464 1516 public void setThickness(float thick, boolean setConnectedThickness) { 1517 1518 if (thick == _thickness) return; 1519 boolean bigger = thick > _thickness; 1520 1521 if (!bigger) invalidateCommonTrait(ItemAppearence.Thickness); 1522 1465 1523 _thickness = thick; 1466 1524 // update the size of any lines 1467 1525 for (Line line : getLines()) 1468 1526 line.setThickness(thick, setConnectedThickness); 1527 1528 if (bigger) invalidateCommonTrait(ItemAppearence.Thickness); 1469 1529 } 1470 1530 … … 1534 1594 1535 1595 public int setHighlightColor(Color c) { 1596 1536 1597 _highlightThickness = DEFAULT_HIGHLIGHT_THICKNESS; 1537 if (c != null) 1538 _highlightColor = c; 1539 else 1540 _highlightColor = DEFAULT_HIGHLIGHT; 1598 1599 Color selColor = (c != null) ? c : DEFAULT_HIGHLIGHT; 1600 if (_highlightColor != c) { 1601 _highlightColor = selColor; 1602 this.invalidateCommonTrait(ItemAppearence.HighlightColorChanged); 1603 } 1541 1604 1542 1605 return Item.UNCHANGED_CURSOR; 1606 1543 1607 } 1544 1608 … … 1589 1653 public void setHighlightMode(HighlightMode mode, Color color) { 1590 1654 setHighlightColor(color); 1591 _mode = mode; 1655 if (_mode != mode) { 1656 _mode = mode; 1657 this.invalidateCommonTrait(ItemAppearence.HighlightModeChanged); 1658 } 1592 1659 } 1593 1660 … … 1655 1722 */ 1656 1723 public void setEnclosedList(Collection<Item> enclosed) { 1724 1725 boolean changed = (_enclosure == null && enclosed != null); 1726 1727 if (_enclosure != null && enclosed == null) { 1728 invalidateFill(); 1729 } 1730 1657 1731 _enclosure = enclosed; 1732 1733 if (changed) { 1734 invalidateFill();; 1735 } 1658 1736 } 1659 1737 … … 1773 1851 if (_actions == null || _actions.size() == 0) { 1774 1852 _poly = null; 1853 invalidateCommonTrait(ItemAppearence.LinkChanged); 1775 1854 } 1776 1855 _actions = new LinkedList<String>(); … … 1780 1859 protected int getLinkYOffset() { 1781 1860 return 0; 1861 } 1862 1863 protected Rectangle getLinkDrawArea() { // TODO: Revise 1864 return new Rectangle(getX() - LEFT_MARGIN - 3, getY() + getLinkYOffset() - 3, 6, 6); 1782 1865 } 1783 1866 … … 1804 1887 1805 1888 if (getLinkMark() && getLink() != null) { 1806 g.drawPolygon(get Circle());1889 g.drawPolygon(getLinkPoly()); 1807 1890 1808 1891 // if the link is not valid, cross out the circle … … 1812 1895 1813 1896 if (getActionMark() && getAction() != null) { 1814 g.drawPolygon(get Circle());1815 g.fillPolygon(get Circle());1897 g.drawPolygon(getLinkPoly()); 1898 g.fillPolygon(getLinkPoly()); 1816 1899 1817 1900 // if the link is not valid, cross out the circle … … 1973 2056 */ 1974 2057 public void translate(Point2D origin, double ratio) { 2058 2059 invalidateCommonTraitForAll(ItemAppearence.PreMoved); 2060 1975 2061 _x = (float) (origin.getX() + ratio * (_x - origin.getX())); 1976 2062 _y = (float) (origin.getY() + ratio * (_y - origin.getY())); … … 1978 2064 for (Line line : getLines()) 1979 2065 line.updatePolygon(); 2066 2067 invalidateCommonTraitForAll(ItemAppearence.PostMoved); 2068 1980 2069 } 1981 2070 … … 2005 2094 setLinePattern(new int[] { LinePatterns[i], LinePatterns[i] }); 2006 2095 } 2096 2097 invalidateCommonTrait(ItemAppearence.ToggleDashed); 2007 2098 return; 2008 2099 } 2009 2100 } 2101 2102 2010 2103 } 2011 2104 … … 2037 2130 public boolean isDeleted() { 2038 2131 return _deleted; 2132 } 2133 2134 /** 2135 * @return The full canvas that this item draws to. Must include highlighting bounds 2136 */ 2137 public Rectangle[] getDrawingArea() { 2138 2139 return new Rectangle[] { 2140 ItemUtils.expandRectangle(getPolygon().getBounds(), 2141 _highlightThickness) 2142 }; 2143 2144 } 2145 2146 /** 2147 * 2148 * @param area 2149 * @return True if area intersects with this items drawing area. 2150 */ 2151 public final boolean isInDrawingArea(Area area) { 2152 for (Rectangle r : getDrawingArea()) { 2153 if (area.intersects(r)) return true; 2154 } 2155 return false; 2156 } 2157 2158 /** 2159 * Completetly invalidates the item - so that it should be redrawed. 2160 * Note: This is handled internally, it should be reare to invoke this 2161 * externally 2162 */ 2163 public final void invalidateAll() { 2164 invalidate(getDrawingArea()); 2165 } 2166 2167 /** 2168 * Invalidates areas on the parent frame. 2169 * Purpose: to be called on specific areas of the item that needs redrawing. 2170 * @param damagedAreas 2171 */ 2172 protected final void invalidate(Rectangle[] damagedAreas) { 2173 for (Rectangle r : damagedAreas) invalidate(r); 2174 } 2175 2176 /** 2177 * Invalidates areas on the parent frame. 2178 * Purpose: to be called on specific areas of the item that needs redrawing. 2179 * @param damagedAreas 2180 */ 2181 protected final void invalidate(Rectangle damagedArea) { 2182 FrameGraphics.invalidateItem(this, damagedArea); 2183 } 2184 2185 /** 2186 * Used to invalidate visual traits commonly shared by all items. 2187 * @param trait 2188 */ 2189 public final void invalidateCommonTrait(ItemAppearence trait) { 2190 invalidate(getDamagedArea(trait)); 2191 2192 if (_colorFill != null && ( 2193 trait == ItemAppearence.Added 2194 || trait == ItemAppearence.Removed) 2195 ) { 2196 invalidateFill(); 2197 } 2198 } 2199 2200 /** 2201 * Invalidates fill if has one, even if no color is set. 2202 */ 2203 public void invalidateFill() { 2204 if (isLineEnd() && _enclosure != null) { 2205 invalidate(getEnclosedShape().getBounds()); 2206 } 2207 } 2208 2209 /** 2210 * Default implementation always uses drawing area except for links, 2211 * where the link drawing area is used. Override to make item 2212 * drawing more efficient - defining only parts of the item that needs 2213 * redrawing. 2214 * 2215 * @see Item.getDrawingArea 2216 * 2217 * @param trait The visual trait that has changed. 2218 * 2219 * @return The damaged area according to the visual trait that has changed. 2220 */ 2221 protected Rectangle[] getDamagedArea(ItemAppearence trait) { 2222 2223 if (trait == ItemAppearence.LinkChanged) 2224 return new Rectangle[] {getLinkDrawArea()}; // Invalidate area where link is drawn 2225 2226 return getDrawingArea(); 2227 2039 2228 } 2040 2229 … … 2056 2245 _overlay = overlay; 2057 2246 } 2247 2058 2248 } -
trunk/src/org/expeditee/items/ItemUtils.java
r115 r121 2 2 3 3 import java.awt.Color; 4 import java.awt.Rectangle; 4 5 import java.awt.image.ImageObserver; 5 6 import java.io.File; … … 17 18 import org.expeditee.gui.DisplayIO; 18 19 import org.expeditee.gui.Frame; 20 import org.expeditee.gui.FreeItems; 19 21 import org.expeditee.gui.Vector; 20 22 import org.expeditee.items.Item.HighlightMode; 23 21 24 22 25 //Static methods that provide functions for the objects\ … … 847 850 } 848 851 852 /** 853 * Determines if an item is visible from a the current frame(s). 854 * If the item is free then it is considered visible. 855 * @param i The item to check 856 * @return True if visible/free from given frame. 857 */ 858 public static boolean isVisible(Item i) { 859 if (DisplayIO.isTwinFramesOn()) { 860 if (!isVisible(DisplayIO.getFrames()[0], i)) { 861 return isVisible(DisplayIO.getFrames()[1], i); 862 } else { 863 return true; 864 } 865 } else { 866 return isVisible(DisplayIO.getCurrentFrame(), i); 867 } 868 } 869 870 /** 871 * Determines if an item is visible from a given frame. 872 * If the item is free then it is considered visible. 873 * 874 * @param fromFrame The frame to check from. 875 * @param i The item to check 876 * @return True if visible/free from given frame. 877 */ 878 public static boolean isVisible(Frame fromFrame, Item i) { 879 if (fromFrame == null) return false; 880 881 Frame parent = i.getParent(); 882 883 if (parent == fromFrame) return true; 884 885 else if (parent == null) return FreeItems.getInstance().contains(i); 886 887 return fromFrame.getAllItems().contains(i) && i.isVisible(); 888 } 889 890 public static Rectangle expandRectangle(Rectangle r, int n) { 891 return new Rectangle(r.x - (n >> 1), r.y - (n >> 1), 892 r.width + n, r.height + n); 893 } 894 849 895 /* 850 896 * FrameMouseActions while (!copies.isEmpty()) { Iterator<Item> iterator = -
trunk/src/org/expeditee/items/Line.java
r115 r121 54 54 return _lineStroke; 55 55 } 56 57 56 58 57 59 /** … … 344 346 if (_virtualSpot != null) { 345 347 _virtualSpot.paint(g); 348 invalidateVirtualSpot(); 346 349 _virtualSpot = null; 347 350 } 351 } 352 353 private void invalidateVirtualSpot() { 354 assert (_virtualSpot != null); 355 356 invalidate(_virtualSpot.getDrawingArea()); 357 348 358 } 349 359 … … 390 400 return; 391 401 if (arrowLength == AUTO_ARROWHEAD_LENGTH) { 392 arrowLength = length / ARROW_HEAD_TO_LENGTH_RATIO; 393 arrowLength = Math.max(MINIMUM_ARROW_HEAD_LENGTH, arrowLength); 394 arrowLength = Math.min(MAXIMUM_ARROW_HEAD_LENGTH, arrowLength); 402 arrowLength = getAutoArrowheadLength(length); 395 403 withArrow.setArrowhead(null); 396 404 if (arrowRatio < 0) … … 416 424 AffineTransform tx = AffineTransform.getRotateInstance(rad, x0, y0); 417 425 g.draw(tx.createTransformedShape((Shape) arrowhead)); 426 } 427 428 429 /** 430 * 431 * @param length The length of the line 432 * @return 433 */ 434 private float getAutoArrowheadLength(float length) { 435 float arrowLength; 436 arrowLength = length / ARROW_HEAD_TO_LENGTH_RATIO; 437 arrowLength = Math.max(MINIMUM_ARROW_HEAD_LENGTH, arrowLength); 438 arrowLength = Math.min(MAXIMUM_ARROW_HEAD_LENGTH, arrowLength); 439 return arrowLength; 418 440 } 419 441 … … 540 562 @Override 541 563 public void setThickness(float thick, boolean setConnectedThickness) { 564 565 float oldThickness = this.getThickness(); 566 if (thick == oldThickness) return; 567 boolean bigger = thick > oldThickness; 568 569 if (!bigger) invalidateAll(); 570 542 571 if (thick < 0) 543 572 thick = DEFAULT_THICKNESS; … … 564 593 _lineStroke = new BasicStroke(Math.max(thick, MINIMUM_THICKNESS), 565 594 CAP, JOIN); 595 596 if (bigger) invalidateAll(); 566 597 } 567 598 … … 759 790 spot.setPosition((int) x, (int) y); 760 791 _virtualSpot = spot; 792 invalidateVirtualSpot(); 761 793 } 762 794 … … 797 829 spot.setPosition((int) x, (int) y); 798 830 _virtualSpot = spot; 831 invalidateVirtualSpot(); 799 832 } 800 833 … … 974 1007 _poly.addPoint((int) one.getMaxX(), (int) one.getMaxY()); 975 1008 } 1009 976 1010 } 977 1011 … … 1035 1069 return Point.distance(p1.x, p1.y, p2.x, p2.y); 1036 1070 } 1071 1072 @Override 1073 public Rectangle[] getDrawingArea() { // TODO: CACHE - LIKE UPDATE POLYGON 1074 1075 float currentThickness = this.getThickness(); 1076 1077 // Establish bounds 1078 int x = Math.min(_start.getX(), _end.getX()); 1079 int y = Math.min(_start.getY(), _end.getY()); 1080 int w = (Math.max(_start.getX(), _end.getX()) - x) + 1; 1081 int h = (Math.max(_start.getY(), _end.getY()) - y) + 1; 1082 1083 int thickness = (int)Math.ceil(currentThickness); 1084 if (thickness < 4) thickness = 4; 1085 int halfThickness = (int)Math.ceil(currentThickness / 2); 1086 1087 // Consider line thickness 1088 w += thickness; 1089 h += thickness; 1090 x -= halfThickness; 1091 y -= halfThickness; 1092 1093 Rectangle bounds = new Rectangle(x, y, w, h); 1094 1095 // TODO: Cap bounds 1096 1097 if (_end.hasVisibleArrow()) { 1098 1099 double arrowLength = _end.getArrowheadLength(); 1100 1101 if (arrowLength == AUTO_ARROWHEAD_LENGTH) { 1102 arrowLength = Math.ceil(getAutoArrowheadLength((float)getLength())); 1103 } else { 1104 arrowLength = Math.ceil(arrowLength); 1105 } 1106 1107 arrowLength += ((thickness * 2) + 1); 1108 int nArrowLength = (int)arrowLength; 1109 1110 // NAIVE version - but probably more efficient in the long run... overall 1111 // as opposed to advanced/expensive calculations for getting exact bounding box 1112 Rectangle arrowBounds = new Rectangle( 1113 _end.getX() - nArrowLength, 1114 _end.getY() - nArrowLength, 1115 2 * nArrowLength, 1116 2 * nArrowLength); 1117 1118 if (currentThickness > 0.0f) { 1119 1120 arrowBounds = new Rectangle( 1121 arrowBounds.x - halfThickness, 1122 arrowBounds.y - halfThickness, 1123 arrowBounds.width + thickness, 1124 arrowBounds.height + thickness); 1125 } 1126 1127 return new Rectangle[] { bounds, arrowBounds }; 1128 } else { 1129 return new Rectangle[] { bounds }; 1130 } 1131 1132 } 1037 1133 1038 1134 @Override … … 1046 1142 _end.setPermission(p); 1047 1143 } 1144 1048 1145 } -
trunk/src/org/expeditee/items/Picture.java
r115 r121 526 526 super.translate(origin, ratio); 527 527 } 528 529 @Override 530 public Rectangle[] getDrawingArea() { 531 532 Rectangle[] da = super.getDrawingArea(); 533 534 if (getLink() != null || getAction() != null) { 535 Rectangle[] da2 = new Rectangle[da.length + 1]; 536 System.arraycopy(da, 0, da2, 0, da.length); 537 da2[da.length] = getLinkPoly().getBounds(); 538 da2[da.length].translate(getX() - LEFT_MARGIN, getY() + getLinkYOffset()); 539 da2[da.length].width += 2; 540 da2[da.length].height += 2; 541 da = da2; 542 } 543 544 return da; 545 546 } 547 548 528 549 } -
trunk/src/org/expeditee/items/Text.java
r116 r121 182 182 } 183 183 184 @Override 185 public Color getHighlightColor() { 186 if (_highlightColor.equals(getPaintBackgroundColor())) 187 return ALTERNATE_HIGHLIGHT; 188 return _highlightColor; 189 } 190 191 184 192 /** 185 193 * Sets the justification of this Text item. The given integer should … … 225 233 */ 226 234 public void setText(String text) { 235 // if (_text != null && text.length() < _text.length()) 236 // invalidateAll(); 227 237 _text = new StringBuffer(text); 228 238 rebuild(false); 239 // invalidateAll(); 229 240 } 230 241 … … 265 276 */ 266 277 public void removeText(String text) { 267 if (_text.length() > 0 && _text.indexOf(text) == 0) 278 279 if (_text.length() > 0 && _text.indexOf(text) == 0) { 280 //invalidateAll(); 268 281 _text.delete(0, text.length()); 282 } 283 269 284 270 285 } … … 273 288 int length = _text.length(); 274 289 if (length > 0) { 290 //invalidateAll(); 275 291 int pos = _text.indexOf(textToRemove); 276 292 int textToRemoveLength = textToRemove.length(); … … 279 295 } 280 296 } 297 281 298 } 282 299 … … 411 428 TextHitInfo hit = getCharPosition(line, mouseX); 412 429 _selectionStart = hit.getInsertionIndex() + _lineOffsets.get(line); 430 invalidateAll(); 413 431 } 414 432 … … 420 438 TextHitInfo hit = getCharPosition(line, mouseX); 421 439 _selectionEnd = hit.getInsertionIndex() + _lineOffsets.get(line); 440 invalidateAll(); 422 441 } 423 442 … … 425 444 _selectionStart = -1; 426 445 _selectionEnd = -1; 446 invalidateAll(); 427 447 } 428 448 429 449 public void clearSelectionEnd() { 430 450 _selectionEnd = -1; 451 invalidateAll(); 431 452 } 432 453 … … 448 469 if (_selectionStart < 0 || _selectionEnd < 0) 449 470 return null; 450 else if (_selectionEnd > _text.length()) 471 472 invalidateAll(); 473 474 if (_selectionEnd > _text.length()) 451 475 _selectionEnd = _text.length(); 452 476 … … 459 483 _text.insert(left, newText); 460 484 rebuild(true); 485 486 invalidateAll(); 461 487 462 488 return s; … … 493 519 TextLayout current = null; 494 520 int line; 521 522 invalidateAll(); 495 523 496 524 // check for empty string … … 635 663 x, 636 664 (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 665 666 invalidateAll(); 667 637 668 return new Point2D.Float(Math.round(x), Math.round(getY() + y 638 669 + caret[1])); … … 777 808 public void setFont(Font font) { 778 809 // all decoding occurs in the Utils class 810 779 811 _font = font; 780 781 812 // rejustify(); 782 813 rebuild(false); … … 1105 1136 return; 1106 1137 } 1107 1138 1108 1139 AttributedString paragraphText = new AttributedString(_text.toString()); 1109 1140 paragraphText.addAttribute(TextAttribute.FONT, getPaintFont()); … … 1154 1185 1155 1186 updatePolygon(); 1187 1156 1188 } 1157 1189 … … 1515 1547 _lineBreaker.deleteChar(inserting.getIterator(), pos); 1516 1548 } 1549 1550 1551 1517 1552 } 1518 1553 … … 1682 1717 @Override 1683 1718 protected int getLinkYOffset() { 1719 if (_textLayouts.size() == 0) return 0; 1684 1720 return Math.round(-(_textLayouts.get(0).getAscent() / 2)); 1685 1721 } -
trunk/src/org/expeditee/items/WidgetCorner.java
r115 r121 1 1 package org.expeditee.items; 2 2 3 import java.awt.Color; 3 4 import java.awt.Graphics2D; 5 import java.awt.Polygon; 6 import java.awt.geom.Point2D; 4 7 5 8 … … 10 13 WidgetCorner(int x, int y, int id, InteractiveWidget widgetSource) { 11 14 super(x, y, id); 15 16 super.setThickness(2.0f); 17 12 18 if (widgetSource == null) throw new NullPointerException("widgetSource"); 13 19 _widgetSource = widgetSource; … … 22 28 @Override 23 29 public void setPosition(float x, float y) { 30 invalidateFill(); 31 if (_widgetSource != null) { // _widgetSource == null on construction 32 if (!_widgetSource.setPositions(this,(int)(x+0.5),(int)(y+0.5))) { 33 super.setPosition(x, y); 34 } 35 } else super.setPosition(x, y); 36 invalidateFill(); 37 } 38 39 @Override 40 public void setXY(float x, float y) { 41 invalidateFill(); 42 if (_widgetSource != null) { // _widgetSource == null on construction 43 if (!_widgetSource.setPositions(this,(int)(x+0.5),(int)(y+0.5))) { 44 super.setXY(x, y); 45 } 46 } else super.setXY(x, y); 47 invalidateFill(); 48 } 24 49 25 if (_widgetSource != null) { // _widgetSource == null on construction 26 if (!_widgetSource.setPositions(this,(int)(x+0.5),(int)(y+0.5))) 27 super.setPosition(x, y); 28 } else super.setPosition(x, y); 50 @Override 51 public void translate(Point2D origin, double ratio) { 52 //super.translate(origin, ratio); 29 53 } 30 54 … … 41 65 @Override 42 66 public void paint(Graphics2D g) { 43 if (InteractiveWidget.isEx epiteeHighlightingEnabled()) { // only paint if flag is set to true67 if (InteractiveWidget.isExpediteeHighlightingEnabled()) { // only paint if flag is set to true 44 68 45 69 // For fixed widgets, always have corner selected with connected context … … 51 75 _mode = tmp; // restore mode 52 76 } 53 _widgetSource.paint(g, this); 77 } 78 79 @Override 80 public void paintFill(Graphics2D g) { 81 _widgetSource.paintFill(g); // only paints a fill if floating 54 82 } 55 83 … … 69 97 return "WidgetCorner: [" + this.getX() + "," + this.getY() + "]"; 70 98 } 99 100 @Override 101 public void setThickness(float thick) { 102 } 103 104 @Override 105 public void setArrow(float length, double ratio) { 106 } 107 108 @Override 109 public void setArrowhead(Polygon arrow) { 110 } 111 112 @Override 113 public void setArrowheadLength(float length) { 114 } 115 116 @Override 117 public void setArrowheadRatio(double ratio) { 118 } 119 120 @Override 121 public void setBackgroundColor(Color c) { 122 } 123 124 @Override 125 public void setBottomShadowColor(Color bottom) { 126 } 127 128 @Override 129 public void setFillColor(Color c) { 130 } 131 132 @Override 133 public void setFillPattern(String patternLink) { 134 } 135 136 @Override 137 public void toggleDashed(int amount) { 138 } 139 140 @Override 141 public void setSize(float size) { 142 } 143 144 71 145 72 146 73 147 } -
trunk/src/org/expeditee/items/WidgetEdge.java
r54 r121 2 2 3 3 import java.awt.Color; 4 import java.awt.Polygon; 4 5 5 6 /** … … 60 61 } 61 62 62 63 @Override 64 public void setArrow(float length, double ratio) { 65 } 66 67 @Override 68 public void setArrowhead(Polygon arrow) { 69 } 70 71 @Override 72 public void setArrowheadLength(float length) { 73 } 74 75 @Override 76 public void setArrowheadRatio(double ratio) { 77 } 78 79 @Override 80 public void setBackgroundColor(Color c) { 81 } 82 83 @Override 84 public void setBottomShadowColor(Color bottom) { 85 } 86 87 @Override 88 public void setFillColor(Color c) { 89 } 90 91 @Override 92 public void setFillPattern(String patternLink) { 93 } 94 95 @Override 96 public void setSize(float size) { 97 } 63 98 } -
trunk/src/org/expeditee/items/XRayable.java
r109 r121 107 107 @Override 108 108 public void setThickness(float thick) { 109 this.invalidateCommonTrait(ItemAppearence.Thickness); 109 110 _source.setThickness(thick); 111 this.invalidateCommonTrait(ItemAppearence.Thickness); 110 112 } 111 113 … … 171 173 public void setPosition(float x, float y) { 172 174 //_source.setPosition(x, y); 175 173 176 } 174 177 -
trunk/src/org/expeditee/simple/Context.java
r108 r121 9 9 import org.expeditee.actions.Simple; 10 10 import org.expeditee.gui.Frame; 11 import org.expeditee.gui.FrameGraphics;12 11 import org.expeditee.gui.FrameIO; 12 import org.expeditee.gui.MessageBay; 13 13 import org.expeditee.items.Text; 14 14 … … 40 40 public void display() { 41 41 if (size() == 0) { 42 FrameGraphics.ErrorMessage("No variables exist!");42 MessageBay.errorMessage("No variables exist!"); 43 43 return; 44 44 } … … 238 238 } 239 239 if (!success && Simple.isVerbose()) 240 FrameGraphics.WarningMessage("Error creating " + framesetName);240 MessageBay.warningMessage("Error creating " + framesetName); 241 241 if (successVar != null) { 242 242 primitives_.setValue(successVar, new SBoolean(success)); -
trunk/src/org/expeditee/simple/Variables.java
r80 r121 3 3 import java.util.ArrayList; 4 4 5 import org.expeditee.gui. FrameGraphics;5 import org.expeditee.gui.MessageBay; 6 6 7 7 public abstract class Variables<T extends SVariable<?>> { … … 23 23 public void display() { 24 24 for (T v : list_) { 25 FrameGraphics.DisplayMessage(v.getName() + ": " + v.stringValue());25 MessageBay.displayMessage(v.getName() + ": " + v.stringValue()); 26 26 } 27 27 } -
trunk/src/org/expeditee/stats/TreeStats.java
r115 r121 6 6 7 7 import org.expeditee.gui.Frame; 8 import org.expeditee.gui.FrameGraphics;9 8 import org.expeditee.gui.FrameIO; 9 import org.expeditee.gui.MessageBay; 10 10 import org.expeditee.io.Logger; 11 11 import org.expeditee.items.Item; … … 27 27 super(topFrame); 28 28 visited.add(_name.toLowerCase()); 29 FrameGraphics.OverwriteMessage("Computed: " + _name);29 MessageBay.overwriteMessage("Computed: " + _name); 30 30 31 31 // Initialise variables with the data for this frames comet
Note:
See TracChangeset
for help on using the changeset viewer.