Changeset 1102 for trunk/src/org/expeditee/actions
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- Location:
- trunk/src/org/expeditee/actions
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r990 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.GraphicsEnvironment;22 import java.io.Serializable;23 21 import java.lang.reflect.Constructor; 24 22 import java.lang.reflect.Method; … … 26 24 import java.rmi.UnexpectedException; 27 25 import java.util.ArrayList; 28 import java.util.Arrays;29 26 import java.util.Collection; 30 27 import java.util.Comparator; … … 35 32 36 33 import org.expeditee.agents.Agent; 37 import org.expeditee.gui.DisplayIO; 34 import org.expeditee.gio.EcosystemManager; 35 import org.expeditee.gui.DisplayController; 38 36 import org.expeditee.gui.Frame; 39 import org.expeditee.gui.FrameGraphics;40 37 import org.expeditee.gui.FrameIO; 41 38 import org.expeditee.gui.FrameUtils; … … 217 214 * actions. 218 215 */ 219 public static Collection<String> Init() {220 221 Collection<String> warnings = new LinkedList<String>();216 public static List<String> Init() { 217 218 List<String> warnings = new LinkedList<String>(); 222 219 List<Class<?>> classes; 223 220 … … 436 433 // loose changes 437 434 if (firstCanditate.getDeclaringClass().getName().equals(NAVIGATIONS_CLASS)) { 438 FrameIO.SaveFrame(Display IO.getCurrentFrame());435 FrameIO.SaveFrame(DisplayController.getCurrentFrame()); 439 436 } 440 437 final List<Method> canditates = new LinkedList<Method>(); … … 825 822 + nameWithCorrectCase + "'"); 826 823 } 827 FrameGraphics.refresh(false);824 DisplayController.requestRefresh(false); 828 825 } 829 826 … … 1031 1028 private static void initFonts() { 1032 1029 if (_Fonts.size() == 0) { 1033 String[] availableFonts = GraphicsEnvironment 1034 .getLocalGraphicsEnvironment() 1035 .getAvailableFontFamilyNames(); 1030 String[] availableFonts = EcosystemManager.getFontManager().getRegisteredFontFamilies(); 1036 1031 for (String s : availableFonts) { 1037 1032 _Fonts.put(s.toLowerCase(), s); -
trunk/src/org/expeditee/actions/Debug.java
r919 r1102 21 21 import java.util.List; 22 22 23 import org.expeditee.gui.Display IO;23 import org.expeditee.gui.DisplayController; 24 24 import org.expeditee.items.Constraint; 25 25 import org.expeditee.items.Item; … … 38 38 */ 39 39 public static void ShowConstraints() { 40 List<Item> items = Display IO.getCurrentFrame().getItems();40 List<Item> items = DisplayController.getCurrentFrame().getItems(); 41 41 42 42 for (Item i : items) -
trunk/src/org/expeditee/actions/ExploratorySearchActions.java
r919 r1102 19 19 package org.expeditee.actions; 20 20 21 import org.expeditee.core.Point; 22 import org.expeditee.gio.EcosystemManager; 23 import org.expeditee.gio.gesture.StandardGestureActions; 21 24 import org.expeditee.gui.Browser; 22 import org.expeditee.gui.Display IO;25 import org.expeditee.gui.DisplayController; 23 26 import org.expeditee.gui.Frame; 24 27 import org.expeditee.gui.FrameIO; 25 import org.expeditee.gui.FrameKeyboardActions;26 import org.expeditee.gui.FrameMouseActions;27 28 import org.expeditee.gui.FreeItems; 28 29 import org.expeditee.items.Item; … … 59 60 } 60 61 61 Text linkToBrowserSession = Display IO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(), " - Web Browser Session", null);62 linkToBrowserSession.setParent(Display IO.getCurrentFrame());63 FrameKeyboardActions.AddDate(linkToBrowserSession);64 FrameMouseActions.pickup(linkToBrowserSession);62 Text linkToBrowserSession = DisplayController.getCurrentFrame().addText(DisplayController.getMouseX(), DisplayController.getMouseY(), " - Web Browser Session", null); 63 linkToBrowserSession.setParent(DisplayController.getCurrentFrame()); 64 Text.AddDate(linkToBrowserSession); 65 StandardGestureActions.pickup(linkToBrowserSession); 65 66 66 67 // Create new frame … … 75 76 // Add web browser active overlay and @old 76 77 Text t = (Text) frame.addText(-150, 50, "@ao: 2", null, "overlayset2"); 77 t.setAnchorRight(-100 .0f);78 t.setAnchorTop(50 .0f);78 t.setAnchorRight(-100); 79 t.setAnchorTop(50); 79 80 t = (Text) frame.addText(-150, 50, "@old", null); 80 81 t.setFamily("Roboto Condensed"); … … 84 85 t.setJustification(Justification.right); 85 86 t.setLinkMark(false); 86 t.setAnchorLeft(9 .0f);87 t.setAnchorBottom(114 .0f);87 t.setAnchorLeft(9); 88 t.setAnchorBottom(114); 88 89 89 90 Text wt; … … 101 102 + ("--anchorLeft " + (lm + ExploratorySearchSettings.BROWSER_HORZ_OFFSET) + " --anchorRight " + rm + " --anchorTop " 102 103 + (ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm) + " --anchorBottom " + bm + " ") 103 + ( Browser._theBrowser.getContentPane().getWidth() - ExploratorySearchSettings.BROWSER_HORZ_OFFSET - lm - rm) + " "104 + ( Browser._theBrowser.getContentPane().getHeight() - ExploratorySearchSettings.BROWSER_VERT_OFFSET - tm - bm) + " : " + url, null);104 + (EcosystemManager.getGraphicsManager().getWindowSize().getWidth() - ExploratorySearchSettings.BROWSER_HORZ_OFFSET - lm - rm) + " " 105 + (EcosystemManager.getGraphicsManager().getWindowSize().getHeight() - ExploratorySearchSettings.BROWSER_VERT_OFFSET - tm - bm) + " : " + url, null); 105 106 } else { 106 107 wt = frame.addText(ExploratorySearchSettings.BROWSER_HORZ_OFFSET + lm, ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm, … … 122 123 // Replace any text item on cursor with link to a new mindmap 123 124 FreeItems.getInstance().clear(); 124 Text text = DisplayIO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(), " - Mindmap Session", null); 125 text.setParent(DisplayIO.getCurrentFrame()); 126 FrameKeyboardActions.AddDate(text); 127 FrameMouseActions.pickup(text); 125 Point cursorPos = DisplayController.getMousePosition(); 126 Text text = DisplayController.getCurrentFrame().addText(cursorPos.getX(), cursorPos.getY(), " - Mindmap Session", null); 127 text.setParent(DisplayController.getCurrentFrame()); 128 Text.AddDate(text); 129 StandardGestureActions.pickup(text); 128 130 Frame frame = FrameIO.CreateNewFrame(text); 129 131 text.setLink("" + frame.getNumber()); … … 132 134 frame.removeAllItems(frame.getItems()); 133 135 Text t = (Text) frame.addText(-150, 50, "@ao: 2", null, "overlayset3"); 134 t.setAnchorLeft(-150 .0f);135 t.setAnchorTop(50 .0f);136 t.setAnchorLeft(-150); 137 t.setAnchorTop(50); 136 138 t = (Text) frame.addText(-150, 50, "@old", null); 137 139 t.setFamily("Roboto Condensed"); … … 141 143 t.setJustification(Justification.right); 142 144 t.setLinkMark(false); 143 t.setAnchorLeft(9 .0f);144 t.setAnchorBottom(114 .0f);145 t.setAnchorLeft(9); 146 t.setAnchorBottom(114); 145 147 146 148 FrameIO.SaveFrame(frame); … … 168 170 } 169 171 170 Text linkToBrowserSession = DisplayIO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(), url, null); 171 linkToBrowserSession.setParent(DisplayIO.getCurrentFrame()); 172 FrameMouseActions.pickup(linkToBrowserSession); 172 Point cursorPos = DisplayController.getMousePosition(); 173 Text linkToBrowserSession = DisplayController.getCurrentFrame().addText(cursorPos.getX(), cursorPos.getY(), url, null); 174 linkToBrowserSession.setParent(DisplayController.getCurrentFrame()); 175 StandardGestureActions.pickup(linkToBrowserSession); 173 176 174 177 // Create new frame … … 183 186 // Add web browser active overlay and @old 184 187 Text t = (Text) frame.addText(-150, 50, "@ao: 2", null, "overlayset2"); 185 t.setAnchorLeft(-150 .0f);186 t.setAnchorTop(50 .0f);188 t.setAnchorLeft(-150); 189 t.setAnchorTop(50); 187 190 t = (Text) frame.addText(-150, 50, "@old", null); 188 191 t.setFamily("Roboto Condensed"); … … 192 195 t.setJustification(Justification.right); 193 196 t.setLinkMark(false); 194 t.setAnchorLeft(9 .0f);195 t.setAnchorBottom(114 .0f);197 t.setAnchorLeft(9); 198 t.setAnchorBottom(114); 196 199 197 200 Text wt; … … 209 212 + ("--anchorLeft " + (lm + ExploratorySearchSettings.BROWSER_HORZ_OFFSET) + " --anchorRight " + rm + " --anchorTop " 210 213 + (ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm) + " --anchorBottom " + bm + " ") 211 + ( Browser._theBrowser.getContentPane().getWidth() - ExploratorySearchSettings.BROWSER_HORZ_OFFSET - lm - rm) + " "212 + ( Browser._theBrowser.getContentPane().getHeight() - ExploratorySearchSettings.BROWSER_VERT_OFFSET - tm - bm) + " : " + url, null);214 + (EcosystemManager.getGraphicsManager().getWindowSize().getWidth() - ExploratorySearchSettings.BROWSER_HORZ_OFFSET - lm - rm) + " " 215 + (EcosystemManager.getGraphicsManager().getWindowSize().getHeight() - ExploratorySearchSettings.BROWSER_VERT_OFFSET - tm - bm) + " : " + url, null); 213 216 } else { 214 217 wt = frame.addText(ExploratorySearchSettings.BROWSER_HORZ_OFFSET + lm, ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm, -
trunk/src/org/expeditee/actions/GreenstoneActions.java
r919 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 21 import java.lang.reflect.InvocationTargetException; 23 22 import java.lang.reflect.Method; … … 25 24 26 25 import org.expeditee.agents.SearchGreenstone; 26 import org.expeditee.core.Colour; 27 27 import org.expeditee.greenstone.ResultDocument; 28 28 import org.expeditee.gui.AttributeValuePair; … … 134 134 } 135 135 } 136 MessageBay.displayMessage("Feedback complete", null, Colo r.green136 MessageBay.displayMessage("Feedback complete", null, Colour.GREEN 137 137 .darker(), true, null); 138 138 } -
trunk/src/org/expeditee/actions/Help.java
r919 r1102 25 25 import java.util.List; 26 26 27 import org.expeditee.gui.DisplayIO; 27 import org.expeditee.gio.EcosystemManager; 28 import org.expeditee.gui.DisplayController; 28 29 import org.expeditee.gui.Frame; 29 import org.expeditee.gui.FrameMouseActions;30 30 import org.expeditee.items.Item; 31 31 import org.expeditee.items.Text; … … 77 77 }); 78 78 79 Frame current = Display IO.getCurrentFrame();80 float x = FrameMouseActions.MouseX;81 float y = FrameMouseActions.MouseY;79 Frame current = DisplayController.getCurrentFrame(); 80 float x = DisplayController.getFloatMouseX(); 81 float y = DisplayController.getFloatMouseY(); 82 82 83 83 // Do case sensitive comparison -
trunk/src/org/expeditee/actions/IDE.java
r919 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 import java.io.BufferedReader;23 21 import java.io.File; 24 import java.io.InputStreamReader;25 22 26 23 import org.expeditee.agents.WriteTree; 27 import org.expeditee.gui.DisplayIO; 24 import org.expeditee.core.Colour; 25 import org.expeditee.gui.DisplayController; 28 26 import org.expeditee.gui.Frame; 29 27 import org.expeditee.gui.FrameIO; … … 37 35 int exitVal = 0; // default's to status OK 38 36 39 Frame source = Display IO.getCurrentFrame();37 Frame source = DisplayController.getCurrentFrame(); 40 38 String title = source.getTitleItem().getText(); 41 39 String[] tokens = title.split("\\s+"); … … 72 70 } 73 71 else { 74 MessageBay.displayMessage("Compiled " + fileName, Colo r.darkGray);72 MessageBay.displayMessage("Compiled " + fileName, Colour.DARK_GREY); 75 73 } 76 74 } catch (Exception e) { … … 101 99 102 100 public static void RunClass() { 103 Frame source = Display IO.getCurrentFrame();101 Frame source = DisplayController.getCurrentFrame(); 104 102 String className = getClassName(source); 105 103 try { -
trunk/src/org/expeditee/actions/Javascript.java
r919 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 21 import java.util.LinkedList; 23 22 import java.util.List; … … 26 25 import org.expeditee.agents.Agent; 27 26 import org.expeditee.agents.DefaultAgent; 28 import org.expeditee.gui.DisplayIO; 27 import org.expeditee.core.Colour; 28 import org.expeditee.gui.DisplayController; 29 29 import org.expeditee.gui.Frame; 30 import org.expeditee.gui.FrameGraphics;31 30 import org.expeditee.gui.FrameIO; 32 31 import org.expeditee.gui.MessageBay; … … 75 74 private static int _stepPause = -1; 76 75 77 private static Colo r _stepColor;76 private static Colour _stepColor; 78 77 79 78 private static boolean _nextStatement; … … 93 92 //Have changed parameters, so it takes an Item, not just a Text item. 94 93 private static void RunJavascriptFrame(Frame frame, Item current, 95 boolean acceptKeyboardInput, boolean step, int pause, Colo r color) {94 boolean acceptKeyboardInput, boolean step, int pause, Colour color) { 96 95 try { 97 96 if (current != null) { … … 101 100 */ 102 101 // DisplayIO.addToBack(current.getParent()); 103 Display IO.addToBack(DisplayIO.getCurrentFrame());102 DisplayController.addToBack(DisplayController.getCurrentFrame()); 104 103 } else { 105 104 /* TODO we should not have to pass an item just to run a frame! */ … … 108 107 } 109 108 110 _stepColor = color == null ? Colo r.green: color;111 _stepColor = new Colo r(_stepColor.getRed(), _stepColor.getGreen(),112 _stepColor.getBlue(), 50);109 _stepColor = color == null ? Colour.GREEN : color; 110 _stepColor = new Colour(_stepColor.getRed(), _stepColor.getGreen(), 111 _stepColor.getBlue(), Colour.FromComponent255(50)); 113 112 _stepPause = pause; 114 113 _step = step; … … 168 167 FrameUtils.DisplayFrame(item.getParent().getName(), true, true); 169 168 item.setHighlightMode(HighlightMode.Normal); 170 item.setHighlightColor(Colo r.CYAN);169 item.setHighlightColor(Colour.CYAN); 171 170 FrameIO.SaveFrame(item.getParent()); 172 171 } … … 192 191 193 192 if (_step) { 194 if (child != Display IO.getCurrentFrame()) {195 Display IO.setCurrentFrame(child, true);196 } 197 Display IO.addToBack(child);193 if (child != DisplayController.getCurrentFrame()) { 194 DisplayController.setCurrentFrame(child, true); 195 } 196 DisplayController.addToBack(child); 198 197 } 199 198 … … 216 215 AgentStats.ItemExecuted(); 217 216 try { 218 Colo r oldColor = item.getBackgroundColor();217 Colour oldColor = item.getBackgroundColor(); 219 218 if (_step) { 220 219 pause(item); … … 226 225 } else { 227 226 item.setHighlightMode(Item.HighlightMode.None); 227 item.setHighlightColorToDefault(); 228 228 } 229 229 } … … 233 233 && lastItemStatus != Status.FalseIf) { 234 234 if (_step) { 235 Display IO.removeFromBack();235 DisplayController.removeFromBack(); 236 236 } 237 237 return lastItemStatus; … … 257 257 258 258 if (_step) { 259 Display IO.removeFromBack();260 if (Display IO.getCurrentFrame() != current.getParent())261 Display IO.setCurrentFrame(current.getParent(), true);259 DisplayController.removeFromBack(); 260 if (DisplayController.getCurrentFrame() != current.getParent()) 261 DisplayController.setCurrentFrame(current.getParent(), true); 262 262 } 263 263 … … 276 276 return; 277 277 278 Colo r oldColor = item.getBackgroundColor();278 Colour oldColor = item.getBackgroundColor(); 279 279 item.setBackgroundColor(_stepColor); 280 280 item.setHighlightMode(Item.HighlightMode.None); 281 item.setHighlightColorToDefault(); 281 282 282 283 // Make sure we are on the frame with this item 283 284 Frame parent = item.getParentOrCurrentFrame(); 284 if (!parent.equals(Display IO.getCurrentFrame())) {285 Display IO.setCurrentFrame(parent, true);286 } 287 288 FrameGraphics.Repaint();285 if (!parent.equals(DisplayController.getCurrentFrame())) { 286 DisplayController.setCurrentFrame(parent, true); 287 } 288 289 DisplayController.requestRefresh(true); 289 290 290 291 int timeRemaining; … … 297 298 if (_stop) { 298 299 item.setBackgroundColor(oldColor); 299 item.setHighlightMode (HighlightMode.Normal, _stepColor);300 item.setHighlightModeAndColour(HighlightMode.Normal, _stepColor); 300 301 throw new Exception("Program terminated"); 301 302 } … … 388 389 _programsRunning++; 389 390 AgentStats.reset(); 390 MessageBay.displayMessage("Running Javascript Program ...", Colo r.BLUE);391 MessageBay.displayMessage("Running Javascript Program ...", Colour.BLUE); 391 392 } 392 393 -
trunk/src/org/expeditee/actions/Javascript2.java
r1080 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 import java.util.Collection;23 import java.util.LinkedList;24 import java.util.List;25 26 import javax.script.Bindings;27 21 import javax.script.Invocable; 28 import javax.script.ScriptContext;29 import javax.script.ScriptEngine;30 import javax.script.ScriptEngineManager;31 import javax.script.ScriptException;32 import javax.script.SimpleScriptContext;33 22 34 23 import org.expeditee.gui.Frame; 35 import org.expeditee.gui.FrameIO;36 import org.expeditee.gui.FrameUtils;37 24 import org.expeditee.gui.MessageBay; 38 import org.expeditee.io.flowlayout.XGroupItem;39 25 import org.expeditee.items.Item; 40 import org.expeditee.items.ItemUtils;41 import org.expeditee.items.Text;42 26 43 27 /** -
trunk/src/org/expeditee/actions/JfxBrowserActions.java
r919 r1102 22 22 import java.io.InputStreamReader; 23 23 import java.net.HttpURLConnection; 24 import java.net.MalformedURLException;25 import java.net.URI;26 import java.net.URISyntaxException;27 24 import java.net.URL; 28 25 import java.net.URLEncoder; 29 26 import java.util.ArrayList; 30 27 31 import org.expeditee.gui.Browser; 32 import org.expeditee.gui.DisplayIO; 28 import org.expeditee.gio.EcosystemManager; 29 import org.expeditee.gio.gesture.StandardGestureActions; 30 import org.expeditee.gui.DisplayController; 33 31 import org.expeditee.gui.Frame; 34 import org.expeditee.gui.FrameGraphics;35 32 import org.expeditee.gui.FrameIO; 36 import org.expeditee.gui.FrameMouseActions;37 33 import org.expeditee.gui.FrameUtils; 38 34 import org.expeditee.gui.FreeItems; … … 42 38 import org.expeditee.items.Picture; 43 39 import org.expeditee.items.Text; 44 import org.expeditee.items.widgets. InteractiveWidget;40 import org.expeditee.items.widgets.Widget; 45 41 import org.expeditee.items.widgets.JfxBrowser; 46 import org.expeditee.settings.exploratorysearch.ExploratorySearchSettings;47 42 import org.expeditee.settings.network.NetworkSettings; 48 43 import org.json.simple.JSONObject; … … 83 78 FreeItems.getInstance().clear(); // remove url text from cursor 84 79 85 wt.setParent(Display IO.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget()86 wt.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());80 wt.setParent(DisplayController.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget() 81 wt.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 87 82 88 83 // create widget from text item 89 JfxBrowser browser = (JfxBrowser) InteractiveWidget.createWidget(wt);84 JfxBrowser browser = (JfxBrowser) Widget.createWidget(wt); 90 85 91 FrameMouseActions.pickup(browser.getItems()); // attach browser widget to mouse86 StandardGestureActions.pickup(browser.getItems()); // attach browser widget to mouse 92 87 } 93 88 … … 109 104 // If no text with url is passed to action create a new text item with http://www.waikato.ac.nz for a default url 110 105 if(!FreeItems.textOnlyAttachedToCursor()) { 111 text = Display IO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(),106 text = DisplayController.getCurrentFrame().addText(DisplayController.getMouseX(), DisplayController.getMouseY(), 112 107 NetworkSettings.HomePage.get(), null); 113 text.setParent(Display IO.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget()114 FrameMouseActions.pickup(text); // Attach new text link to cursor108 text.setParent(DisplayController.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget() 109 StandardGestureActions.pickup(text); // Attach new text link to cursor 115 110 } 116 111 … … 123 118 Text wt = frame.addText(0, 0, "@iw: org.expeditee.items.widgets.JfxBrowser " 124 119 + ("--anchorLeft 0 --anchorRight 0 --anchorTop 0 --anchorBottom 0 ") 125 + Browser._theBrowser.getContentPane().getWidth() + " " + Browser._theBrowser.getContentPane().getHeight()120 + EcosystemManager.getGraphicsManager().getWindowSize().getWidth() + " " + EcosystemManager.getGraphicsManager().getWindowSize().getHeight() 126 121 + " : " + text.getText(), null); 127 122 128 InteractiveWidget.createWidget(wt);123 Widget.createWidget(wt); 129 124 130 125 FrameIO.SaveFrame(frame); // save frame to disk … … 179 174 180 175 // Create widget via text annotation 181 frame.addText(10, 10, "@iw: org.expeditee.items.widgets.JfxBrowser " + (int) ( FrameGraphics.getMaxFrameSize().getWidth() * 0.9) + " "182 + (int) ( FrameGraphics.getMaxFrameSize().getHeight() * 0.9) + " : " + url, null);176 frame.addText(10, 10, "@iw: org.expeditee.items.widgets.JfxBrowser " + (int) (DisplayController.getFramePaintArea().getWidth() * 0.9) + " " 177 + (int) (DisplayController.getFramePaintArea().getHeight() * 0.9) + " : " + url, null); 183 178 184 179 FrameIO.SaveFrame(frame); … … 294 289 295 290 if (!picSource.equals("")) { 296 pic = WebParser.getImageFromUrl(picSource, null, Display IO.getCurrentFrame(), 0, 0, 50, null, null,291 pic = WebParser.getImageFromUrl(picSource, null, DisplayController.getCurrentFrame(), 0, 0, 50, null, null, 297 292 null, null, null, 0, 0); 298 293 items.add(pic); … … 300 295 } 301 296 302 titleItem.setPosition( FrameMouseActions.getPosition());297 titleItem.setPosition(DisplayController.getMousePosition()); 303 298 mainTextItem.setPosition(titleItem.getX(), titleItem.getY() + titleItem.getBoundsHeight()); 304 299 sourceItem.setPosition(mainTextItem.getX(), mainTextItem.getY() + mainTextItem.getBoundsHeight()); … … 313 308 items.add(sourceItem); 314 309 items.add(ddgLink); 315 FrameMouseActions.pickup(items);310 StandardGestureActions.pickup(items); 316 311 } catch (IOException e) { 317 312 MessageBay.displayMessage("Problem loading results"); -
trunk/src/org/expeditee/actions/Mail.java
r919 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 21 import java.util.Collection; 23 22 … … 25 24 26 25 import org.expeditee.agents.mail.MailSession; 26 import org.expeditee.core.Colour; 27 import org.expeditee.gio.EcosystemManager; 28 import org.expeditee.gio.gesture.StandardGestureActions; 27 29 import org.expeditee.gui.AttributeValuePair; 28 import org.expeditee.gui.Display IO;30 import org.expeditee.gui.DisplayController; 29 31 import org.expeditee.gui.Frame; 30 import org.expeditee.gui.FrameKeyboardActions;31 import org.expeditee.gui.FrameMouseActions;32 32 import org.expeditee.gui.MessageBay; 33 33 import org.expeditee.items.Item; … … 116 116 public static Text getMailByID(int messageNo) { 117 117 Text mailItem = MailSession.getInstance().getMail( 118 Display IO.getCurrentFrame(), FrameMouseActions.getPosition(),118 DisplayController.getCurrentFrame(), DisplayController.getMousePosition(), 119 119 messageNo - 1); 120 120 // MessageBay.displayMessage(mailItems.size() + " messages read", … … 139 139 int noOfMessages) { 140 140 Collection<Text> mailItems = MailSession.getInstance().getMail(flag, 141 isPresent, Display IO.getCurrentFrame(),142 FrameMouseActions.getPosition(), noOfMessages);141 isPresent, DisplayController.getCurrentFrame(), 142 DisplayController.getMousePosition(), noOfMessages); 143 143 // MessageBay.displayMessage(mailItems.size() + " messages read", 144 144 // Color.green); … … 187 187 188 188 reply.setActions(null); 189 FrameMouseActions.tdfc(reply);190 191 Frame replyFrame = Display IO.getCurrentFrame();189 StandardGestureActions.tdfc(reply); 190 191 Frame replyFrame = DisplayController.getCurrentFrame(); 192 192 String titleText = frame.getTitle(); 193 193 // Add Re on the end if it is not already there … … 197 197 } 198 198 replyFrame.setTitle(titleText); 199 FrameKeyboardActions.Drop(null, false);199 StandardGestureActions.Drop(null, false); 200 200 201 201 // Add a link to the original message 202 202 Text original = replyFrame.createNewText("@original"); 203 original.setPosition( FrameMouseActions.getPosition());203 original.setPosition(DisplayController.getMousePosition()); 204 204 original.setLink(frame.getName()); 205 FrameKeyboardActions.Drop(original, false);205 StandardGestureActions.Drop(original, false); 206 206 207 207 Text to = replyFrame.createNewText("@to: " + fromAddress); 208 to.setPosition( FrameMouseActions.getPosition());208 to.setPosition(DisplayController.getMousePosition()); 209 209 to.addAction("MailTree"); 210 FrameKeyboardActions.Drop(to, false); 211 DisplayIO.setCursorPosition(FrameMouseActions.MouseX, 212 FrameMouseActions.MouseY + 15); 210 StandardGestureActions.Drop(to, false); 211 DisplayController.setCursorPosition(DisplayController.getMouseX(), DisplayController.getMouseY() + 15); 213 212 } 214 213 … … 216 215 if (FrameShare.getInstance().sendMessage(message, peerName)) { 217 216 MessageBay.displayMessage("Sent message to " + peerName, 218 Colo r.green.darker());217 Colour.GREEN.darker()); 219 218 } else { 220 219 MessageBay.errorMessage("Could not find " + peerName); -
trunk/src/org/expeditee/actions/Misc.java
r1079 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 import java.awt.Desktop;23 import java.awt.Image;24 import java.awt.image.BufferedImage;25 import java.awt.image.VolatileImage;26 21 import java.io.BufferedReader; 27 22 import java.io.File; … … 31 26 import java.io.InputStreamReader; 32 27 import java.lang.reflect.Method; 33 import java.net.URI;34 import java.net.URISyntaxException;35 28 import java.net.URL; 36 29 import java.net.URLClassLoader; … … 39 32 import java.util.LinkedList; 40 33 import java.util.List; 41 import java.util.Map;42 34 import java.util.Map.Entry; 43 import java.util.Set;44 35 import java.util.jar.Attributes; 45 36 import java.util.jar.JarFile; 46 37 47 import javax.imageio.ImageIO; 48 38 import org.expeditee.core.Colour; 39 import org.expeditee.core.Image; 40 import org.expeditee.core.Point; 41 import org.expeditee.gio.EcosystemManager; 42 import org.expeditee.gio.gesture.StandardGestureActions; 49 43 import org.expeditee.gui.AttributeUtils; 50 import org.expeditee.gui.Browser;51 44 import org.expeditee.io.Conversion; 52 import org.expeditee.gui.Display IO;45 import org.expeditee.gui.DisplayController; 53 46 import org.expeditee.io.ExpReader; 54 47 import org.expeditee.gui.Frame; 55 48 import org.expeditee.gui.FrameGraphics; 56 49 import org.expeditee.gui.FrameIO; 57 import org.expeditee.gui.FrameKeyboardActions;58 import org.expeditee.gui.FrameMouseActions;59 50 import org.expeditee.gui.FrameUtils; 60 51 import org.expeditee.gui.FreeItems; … … 63 54 import org.expeditee.gui.Reminders; 64 55 import org.expeditee.gui.TimeKeeper; 65 import org.expeditee.importer.FrameDNDTransferHandler;66 56 import org.expeditee.items.Item; 67 57 import org.expeditee.items.ItemUtils; … … 69 59 import org.expeditee.items.Text; 70 60 import org.expeditee.items.XRayable; 71 import org.expeditee.items.widgets. InteractiveWidget;61 import org.expeditee.items.widgets.Widget; 72 62 import org.expeditee.items.widgets.WidgetCorner; 73 63 import org.expeditee.items.widgets.WidgetEdge; … … 83 73 import org.nfunk.jep.ParseException; 84 74 85 import com.lowagie.text.Font;86 87 75 88 76 89 77 /** 90 * A list of miscellaneous Actions and Actionsspecific to Expeditee78 * A list of miscellaneous Actions specific to Expeditee 91 79 * 92 80 */ … … 96 84 * Causes the system to beep 97 85 */ 98 public static void beep() { 99 java.awt.Toolkit.getDefaultToolkit().beep(); 86 public static void beep() 87 { 88 EcosystemManager.getMiscManager().beep(); 100 89 } 101 90 … … 161 150 * Treats a string as a URL and attempts to open it 162 151 */ 163 public static void openURL(String siteURL){ 164 165 try { 166 URL check = new URL(siteURL); 167 Desktop.getDesktop().browse(new URI(siteURL)); 168 169 } catch (IOException| URISyntaxException e) { 170 171 MessageBay.displayMessage("'" + siteURL + "' is not a valid URL"); 172 } 152 public static void openURL(String siteURL) 153 { 154 boolean success = EcosystemManager.getMiscManager().browse(siteURL); 155 156 if (!success) MessageBay.displayMessage("'" + siteURL + "' is not a valid URL"); 173 157 } 174 158 /** … … 177 161 public static void setRestorePoint() 178 162 { 179 Frame current = Display IO.getCurrentFrame();163 Frame current = DisplayController.getCurrentFrame(); 180 164 current.change(); 181 165 FrameIO.SaveFrameAsRestore(current, true, true); … … 185 169 */ 186 170 public static void display() { 187 FrameGraphics.refresh(false);171 DisplayController.requestRefresh(false); 188 172 } 189 173 190 174 public static String getWindowSize() { 191 return Browser.getWindows()[0].getSize().toString();175 return EcosystemManager.getGraphicsManager().getWindowSize().toString(); 192 176 } 193 177 … … 205 189 */ 206 190 public static void toggleAudienceMode() { 207 FrameGraphics.ToggleAudienceMode();191 DisplayController.ToggleAudienceMode(); 208 192 } 209 193 … … 212 196 */ 213 197 public static void toggleTwinFramesMode() { 214 Display IO.ToggleTwinFrames();198 DisplayController.toggleTwinFrames(); 215 199 } 216 200 … … 227 211 for (String action : actions) { 228 212 if (!action.equalsIgnoreCase("runitem")) { 229 Actions.PerformAction(Display IO.getCurrentFrame(), current,213 Actions.PerformAction(DisplayController.getCurrentFrame(), current, 230 214 action); 231 215 } … … 249 233 String deletedFrameName = FrameIO.DeleteFrame(toDelete); 250 234 if (deletedFrameName != null) { 251 Display IO.Back();235 DisplayController.Back(); 252 236 // Remove any links on the previous frame to the one being 253 237 // deleted 254 Frame current = Display IO.getCurrentFrame();238 Frame current = DisplayController.getCurrentFrame(); 255 239 for (Item i : current.getItems()) 256 240 if (i.getLink() != null … … 312 296 // copy the item and switch 313 297 item = item.copy(); 314 item.setPosition(Display IO.getMouseX(), FrameMouseActions.getY());298 item.setPosition(DisplayController.getMousePosition()); 315 299 } 316 300 return item; … … 327 311 Collection<Item> copies = ItemUtils.CopyItems(items); 328 312 Item first = items.iterator().next(); 329 float deltaX = Display IO.getMouseX() - first.getX();330 float deltaY = FrameMouseActions.getY() - first.getY();313 float deltaX = DisplayController.getMouseX() - first.getX(); 314 float deltaY = DisplayController.getMouseY() - first.getY(); 331 315 for (Item i : copies) { 332 316 if (i.isVisible()) … … 334 318 i.setParent(null); 335 319 } 336 FrameMouseActions.pickup(copies);337 FrameGraphics.Repaint();320 StandardGestureActions.pickup(copies); 321 DisplayController.requestRefresh(true); 338 322 } 339 323 … … 347 331 * The Color to give the Item. 348 332 */ 349 public static void SetItemBackgroundColor(Item toChange, Colo r toUse) {333 public static void SetItemBackgroundColor(Item toChange, Colour toUse) { 350 334 if (toChange == null) 351 335 return; 352 336 353 337 toChange.setBackgroundColor(toUse); 354 FrameGraphics.Repaint();338 DisplayController.requestRefresh(true); 355 339 } 356 340 … … 364 348 * The Color to give the Item. 365 349 */ 366 public static void SetItemColor(Item toChange, Colo r toUse) {350 public static void SetItemColor(Item toChange, Colour toUse) { 367 351 if (toChange == null) 368 352 return; 369 353 370 354 toChange.setColor(toUse); 371 FrameGraphics.Repaint();355 DisplayController.requestRefresh(true); 372 356 } 373 357 … … 428 412 public static void attachStatsToCursor(String itemText) { 429 413 SessionStats.CreatedText(); 430 Frame current = Display IO.getCurrentFrame();414 Frame current = DisplayController.getCurrentFrame(); 431 415 Item text = current.getStatsTextItem(itemText); 432 FrameMouseActions.pickup(text);433 FrameGraphics.Repaint();416 StandardGestureActions.pickup(text); 417 DisplayController.requestRefresh(true); 434 418 } 435 419 436 420 public static void attachTextToCursor(String itemText) { 437 421 SessionStats.CreatedText(); 438 Frame current = Display IO.getCurrentFrame();422 Frame current = DisplayController.getCurrentFrame(); 439 423 Item text = current.getTextItem(itemText); 440 FrameMouseActions.pickup(text);441 FrameGraphics.Repaint();424 StandardGestureActions.pickup(text); 425 DisplayController.requestRefresh(true); 442 426 } 443 427 … … 494 478 } 495 479 496 for (Entry<String, java.awt.Font> entry: Text.FONT_WHEEL_ADDITIONAL_LOOKUP.entrySet()){480 for (Entry<String, org.expeditee.core.Font> entry: Text.FONT_WHEEL_ADDITIONAL_LOOKUP.entrySet()){ 497 481 498 482 String fontName = entry.getKey(); … … 585 569 */ 586 570 public static void jpegFrame() { 587 ImageFrame(Display IO.getCurrentFrame().getName(), "JPEG");571 ImageFrame(DisplayController.getCurrentFrame().getName(), "JPEG"); 588 572 } 589 573 … … 610 594 } 611 595 612 public static String SaveImage( BufferedImage screen, String format,596 public static String SaveImage(Image screen, String format, 613 597 String directory, String fileName) { 614 598 String suffix = "." + format.toLowerCase(); … … 633 617 634 618 // If the image is successfully written out return the fileName 635 if ( ImageIO.write(screen,format, out))619 if (screen.writeToDisk(format, out)) 636 620 return fileName; 637 621 … … 647 631 Image oldBuffer = frame.getBuffer(); 648 632 frame.setBuffer(null); 649 // Jpeg only works properly with vol itile frames633 // Jpeg only works properly with volatile frames 650 634 // Png transparency only works with bufferedImage form 651 Image frameBuffer = FrameGraphics.getBuffer(frame, false, format 652 .equalsIgnoreCase("jpeg")); 653 // Make sure overlay stuff doesnt disapear on the frame visible on the 635 Image frameBuffer = FrameGraphics.getFrameImage(frame, null, null, false, format.equalsIgnoreCase("jpeg")); 636 // Make sure overlay stuff doesnt disappear on the frame visible on the 654 637 // screen 655 638 frame.setBuffer(oldBuffer); 656 BufferedImage screen = null; 657 658 if (frameBuffer instanceof VolatileImage) { 659 // If its the current frame it will be a volitive image 660 screen = ((VolatileImage) frameBuffer).getSnapshot(); 661 } else { 662 assert (frameBuffer instanceof BufferedImage); 663 screen = (BufferedImage) frameBuffer; 664 } 665 return SaveImage(screen, format, directory, frame.getExportFileName()); 639 640 return SaveImage(frameBuffer, format, directory, frame.getExportFileName()); 666 641 } 667 642 … … 842 817 current.setActions(null); 843 818 844 FrameGraphics.Repaint();819 DisplayController.requestRefresh(true); 845 820 } 846 821 … … 932 907 text.setFormula(formulaFullCase); 933 908 if (text.isFloating()) { 934 text.setPosition(FrameMouseActions.MouseX,935 FrameMouseActions.MouseY);936 FrameMouseActions.resetOffset();909 Point cursorPos = EcosystemManager.getInputManager().getCursorPosition(); 910 text.setPosition(cursorPos.x, cursorPos.y); 911 StandardGestureActions.resetOffset(); 937 912 } else { 938 913 text.getParentOrCurrentFrame().change(); … … 956 931 public static void attachToCursor(Item item) { 957 932 item.setParent(null); 958 FrameMouseActions.pickup(item);959 FrameGraphics.Repaint();933 StandardGestureActions.pickup(item); 934 DisplayController.requestRefresh(true); 960 935 } 961 936 … … 965 940 i.invalidateAll(); 966 941 } 967 FrameMouseActions.pickup(items);942 StandardGestureActions.pickup(items); 968 943 // TODO figure out why this isnt repainting stuff immediately 969 944 // All of text item doesnt repaint until the cursor is moved 970 FrameGraphics.requestRefresh(true);945 DisplayController.requestRefresh(true); 971 946 } 972 947 … … 980 955 } 981 956 try { 982 FrameDNDTransferHandler.getInstance().importFileList(files, 983 FrameMouseActions.getPosition()); 957 EcosystemManager.getDragAndDropManager().importFileList(files, EcosystemManager.getInputManager().getCursorPosition()); 984 958 } catch (Exception e) { 985 959 } … … 990 964 if (file.exists()) { 991 965 try { 992 FrameDNDTransferHandler.getInstance().importFile(file, 993 FrameMouseActions.getPosition()); 966 EcosystemManager.getDragAndDropManager().importFile(file, EcosystemManager.getInputManager().getCursorPosition()); 994 967 } catch (Exception e) { 995 968 e.printStackTrace(); … … 1021 994 } 1022 995 1023 float curX = FrameMouseActions.MouseX; 1024 float curY = FrameMouseActions.MouseY; 996 Point cursorPos = DisplayController.getMousePosition(); 997 float curX = cursorPos.x; 998 float curY = cursorPos.y; 1025 999 1026 1000 Collection<Item> newItems = new LinkedList<Item>(); 1027 1001 Item[] d = new Item[sides]; 1028 1002 // create dots 1029 Frame current = Display IO.getCurrentFrame();1003 Frame current = DisplayController.getCurrentFrame(); 1030 1004 for (int i = 0; i < d.length; i++) { 1031 1005 d[i] = current.createDot(); … … 1053 1027 } 1054 1028 1055 Colo r newColor = item.getColor();1029 Colour newColor = item.getColor(); 1056 1030 if (newColor != null) { 1057 1031 d[0].setColor(item.getColor()); … … 1068 1042 1069 1043 ItemUtils.EnclosedCheck(newItems); 1070 FrameGraphics.refresh(false);1044 DisplayController.requestRefresh(false); 1071 1045 1072 1046 return d[0]; … … 1077 1051 } 1078 1052 1079 public static void print(String file) { 1080 try { 1081 if (Browser._theBrowser.isMinimumVersion6()) { 1082 if (Desktop.isDesktopSupported()) { 1083 Desktop.getDesktop().print(new File(file)); 1084 } 1085 } 1086 } catch (Exception e) { 1087 MessageBay.errorMessage("Printing error: " + e.getMessage()); 1088 } 1053 public static void print(String file) 1054 { 1055 String errorMessage = EcosystemManager.getMiscManager().print(file); 1056 1057 if (errorMessage != null) MessageBay.errorMessage("Printing error: " + errorMessage); 1089 1058 } 1090 1059 … … 1129 1098 * @throws Exception 1130 1099 */ 1131 public static void startLoboBrowser(Item text) throws Exception {1100 /* public static void startLoboBrowser(Item text) throws Exception { 1132 1101 if (!(text instanceof Text)) { 1133 1102 MessageBay.errorMessage("Must be a text item."); … … 1154 1123 1155 1124 FrameMouseActions.pickup(browser.getItems()); // attach browser widget to mouse 1156 } 1125 }*/ 1157 1126 1158 1127 /** … … 1161 1130 * @throws Exception 1162 1131 */ 1163 public static void startLoboBrowserNewFrame(Item text) throws Exception { 1132 public static void startLoboBrowserNewFrame(Item text) throws Exception 1133 { 1164 1134 if (!(text instanceof Text)) { 1165 1135 MessageBay.errorMessage("Must be a text item."); 1166 1136 return; 1167 1137 } 1138 1168 1139 if(text.getLink() != null) { // text item can't already have a link 1169 1140 MessageBay.errorMessage("Text item already has link."); … … 1176 1147 FrameUtils.Parse(frame); 1177 1148 1178 for( InteractiveWidget iw : frame.getInteractiveWidgets()) { // may be other widgets on frame1149 for(Widget iw : frame.getInteractiveWidgets()) { // may be other widgets on frame 1179 1150 if(iw instanceof org.expeditee.items.widgets.Browser) { 1180 1151 // Set browser to 'full screen' 1181 iw.setSize(-1, -1, -1, -1, Browser._theBrowser.getWidth(), Browser._theBrowser.getHeight() 1182 - MessageBay.MESSAGE_BUFFER_HEIGHT - 80); 1152 iw.setSize(-1, -1, -1, -1, DisplayController.getFramePaintArea().getWidth(), DisplayController.getFramePaintArea().getHeight() - 80); 1183 1153 1184 1154 // If there is a text item attached to cursor use it as url for browser 1185 if (FreeItems.textOnlyAttachedToCursor()) {1155 if (FreeItems.textOnlyAttachedToCursor()) { 1186 1156 text.setLink("" + frame.getNumber()); 1187 1157 ((org.expeditee.items.widgets.Browser)iw).navigate(text.getText()); … … 1190 1160 ((org.expeditee.items.widgets.Browser)iw).navigate("http://www.waikato.ac.nz"); 1191 1161 Text t = new Text("http://www.waikato.ac.nz"); 1192 t.setParent(Display IO.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget()1193 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());1162 t.setParent(DisplayController.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget() 1163 t.setXY(DisplayController.getFloatMouseX(), DisplayController.getFloatMouseY()); 1194 1164 t.setLink("" + frame.getNumber()); // link url text to new browser frame 1195 FrameMouseActions.pickup(t); // Attach new text link to cursor1165 StandardGestureActions.pickup(t); // Attach new text link to cursor 1196 1166 } 1197 1167 } … … 1201 1171 } 1202 1172 1203 private static boolean startWidget(String name) throws Exception { 1173 private static boolean startWidget(String name) throws Exception 1174 { 1204 1175 String fullName = Actions.getClassName(name); 1205 1176 if(fullName == null) { … … 1210 1181 FreeItems.getInstance().clear(); 1211 1182 Text wt = new Text("@iw:" + fullName); // create new text item for browser widget 1212 wt.setParent(Display IO.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget()1213 wt.setXY( FrameMouseActions.getX(), FrameMouseActions.getY()); // move to the mouse cursor1214 InteractiveWidget widget = InteractiveWidget.createWidget(wt);1215 FrameMouseActions.pickup(widget.getItems());1183 wt.setParent(DisplayController.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget() 1184 wt.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); // move to the mouse cursor 1185 Widget widget = Widget.createWidget(wt); 1186 StandardGestureActions.pickup(widget.getItems()); 1216 1187 1217 1188 return true; … … 1223 1194 } 1224 1195 1225 Actions.PerformAction(Display IO.getCurrentFrame(), null, command);1196 Actions.PerformAction(DisplayController.getCurrentFrame(), null, command); 1226 1197 } 1227 1198 … … 1241 1212 if(name == "action" || name == "agent") { 1242 1213 if(args.length() > 0) { 1243 Actions.PerformAction(Display IO.getCurrentFrame(), null, args);1214 Actions.PerformAction(DisplayController.getCurrentFrame(), null, args); 1244 1215 } else { 1245 1216 MessageBay.displayMessage("Please specify an action/agent name"); … … 1324 1295 if (i instanceof WidgetEdge || i instanceof WidgetCorner) { 1325 1296 continue; 1326 } 1327 else { 1297 } else { 1328 1298 int new_x = i.getX(); 1329 1299 int new_y = i.getY(); … … 1345 1315 } 1346 1316 // update the polygon, otherwise stuff moves but leaves it's outline behind 1347 i. updatePolygon();1348 } 1349 1350 for ( InteractiveWidget iw : frame.getInteractiveWidgets()) {1317 i.invalidateBounds(); 1318 } 1319 1320 for (Widget iw : frame.getInteractiveWidgets()) { 1351 1321 1352 1322 int new_x = iw.getX(); … … 1368 1338 frame.change(); 1369 1339 // redraw everything 1370 FrameKeyboardActions.Refresh();1340 StandardGestureActions.Refresh(); 1371 1341 } 1372 1342 … … 1505 1475 public static void GitPushFrame() { 1506 1476 1507 FrameKeyboardActions.Save();1508 1509 Frame current = Display IO.getCurrentFrame();1477 StandardGestureActions.Save(); 1478 1479 Frame current = DisplayController.getCurrentFrame(); 1510 1480 String userName = UserSettings.ProfileName.get(); 1511 1481 … … 1544 1514 1545 1515 public static void GitPullFrame() { 1546 Frame current = Display IO.getCurrentFrame();1516 Frame current = DisplayController.getCurrentFrame(); 1547 1517 1548 1518 List<String> cmd_array = new ArrayList<String>(); … … 1554 1524 1555 1525 FrameIO.Reload(); 1556 FrameKeyboardActions.Refresh();1526 StandardGestureActions.Refresh(); 1557 1527 } 1558 1528 -
trunk/src/org/expeditee/actions/Navigation.java
r1032 r1102 21 21 import java.util.List; 22 22 23 import org.expeditee.gui.Display IO;23 import org.expeditee.gui.DisplayController; 24 24 import org.expeditee.gui.Frame; 25 25 import org.expeditee.gui.FrameIO; … … 49 49 */ 50 50 public static void Back() { 51 Display IO.Back();51 DisplayController.Back(); 52 52 } 53 53 54 54 public static void Forward() { 55 Display IO.Forward();55 DisplayController.Forward(); 56 56 } 57 57 … … 78 78 public static void GotoZero() { 79 79 FrameUtils 80 .DisplayFrame(Display IO.getCurrentFrame().getFramesetName() + 0);80 .DisplayFrame(DisplayController.getCurrentFrame().getFramesetName() + 0); 81 81 } 82 82 … … 96 96 */ 97 97 public static void Goto(Integer value) { 98 FrameUtils.DisplayFrame(Display IO.getCurrentFrame().getFramesetName()98 FrameUtils.DisplayFrame(DisplayController.getCurrentFrame().getFramesetName() 99 99 + value); 100 100 } … … 132 132 */ 133 133 public static void Large() { 134 if (Display IO.isTwinFramesOn())135 Display IO.ToggleTwinFrames();134 if (DisplayController.isTwinFramesOn()) 135 DisplayController.toggleTwinFrames(); 136 136 } 137 137 … … 188 188 189 189 public static void NextChild(Frame source) { 190 String back = Display IO.peekFromBackUpStack();190 String back = DisplayController.peekFromBackUpStack(); 191 191 // if there is no parent frame (i.e. the user is on the home frame) // 192 192 if (back == null) { // No frame was on the Backup stack … … 259 259 // better to say more explicitly/directly what the mode is!!!! 260 260 public static void Small() { 261 if (!Display IO.isTwinFramesOn())262 Display IO.ToggleTwinFrames();261 if (!DisplayController.isTwinFramesOn()) 262 DisplayController.toggleTwinFrames(); 263 263 } 264 264 -
trunk/src/org/expeditee/actions/Python.java
r1080 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 import java.util.Collection;23 import java.util.LinkedList;24 21 import java.util.List; 25 22 26 import javax.script.Bindings;27 23 import javax.script.Invocable; 28 import javax.script.ScriptContext;29 import javax.script.ScriptEngine;30 import javax.script.ScriptEngineManager;31 import javax.script.ScriptException;32 import javax.script.SimpleScriptContext;33 24 34 25 import org.expeditee.gui.Frame; 35 import org.expeditee.gui.FrameIO;36 import org.expeditee.gui.FrameUtils;37 26 import org.expeditee.gui.MessageBay; 38 import org.expeditee.io.flowlayout.XGroupItem;39 27 import org.expeditee.items.Item; 40 import org.expeditee.items.ItemUtils;41 28 import org.expeditee.items.Text; 42 29 -
trunk/src/org/expeditee/actions/ScriptBase.java
r1080 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color;22 21 import java.util.Collection; 23 22 import java.util.LinkedList; … … 32 31 import javax.script.SimpleScriptContext; 33 32 33 import org.expeditee.core.Colour; 34 34 import org.expeditee.gui.Frame; 35 35 import org.expeditee.gui.FrameIO; … … 235 235 Text errorItem; 236 236 errorItem = errorFrame.addText(x, y, errorItemLines[cl.line], null); 237 errorItem.setBackgroundColor(Colo r.RED);237 errorItem.setBackgroundColor(Colour.RED); 238 238 for(String line : message.split("[\\n\\r]+")) { 239 239 errorItem.setTooltip("text: " + line); -
trunk/src/org/expeditee/actions/Simple.java
r947 r1102 19 19 package org.expeditee.actions; 20 20 21 import java.awt.Color; 22 import java.awt.Point; 23 import java.awt.event.InputEvent; 24 import java.awt.geom.Point2D; 21 //import java.awt.event.InputEvent; 25 22 import java.io.BufferedReader; 26 23 import java.io.InputStreamReader; … … 47 44 import org.expeditee.agents.SearchTree; 48 45 import org.expeditee.agents.WriteTree; 46 import org.expeditee.core.Colour; 47 import org.expeditee.core.Point; 48 import org.expeditee.gio.gesture.StandardGestureActions; 49 49 import org.expeditee.gui.AttributeUtils; 50 50 import org.expeditee.gui.AttributeValuePair; 51 51 import org.expeditee.gui.Browser; 52 import org.expeditee.gui.Display IO;52 import org.expeditee.gui.DisplayController; 53 53 import org.expeditee.gui.Frame; 54 import org.expeditee.gui.FrameGraphics;55 54 import org.expeditee.gui.FrameIO; 56 import org.expeditee.gui.FrameMouseActions;57 55 import org.expeditee.gui.FrameUtils; 58 56 import org.expeditee.gui.FreeItems; … … 156 154 private static int _stepPause = -1; 157 155 158 private static Colo r _stepColor;156 private static Colour _stepColor; 159 157 160 158 private static boolean _nextStatement; … … 173 171 174 172 public static void NewSimpleTest() { 175 Frame newSimpleTest = FrameIO.CreateFrame(Display IO.getCurrentFrame()173 Frame newSimpleTest = FrameIO.CreateFrame(DisplayController.getCurrentFrame() 176 174 .getFramesetName(), "Test", null); 177 175 List<String> actions = new ArrayList<String>(); … … 183 181 184 182 public static void NextTest() { 185 Frame next = Display IO.getCurrentFrame();183 Frame next = DisplayController.getCurrentFrame(); 186 184 do { 187 185 next = FrameIO.LoadNext(next); … … 191 189 192 190 public static void PreviousTest() { 193 Frame prev = Display IO.getCurrentFrame();191 Frame prev = DisplayController.getCurrentFrame(); 194 192 do { 195 193 prev = FrameIO.LoadPrevious(prev); … … 240 238 int testsFailed = 0; 241 239 242 FrameIO.SaveFrame(Display IO.getCurrentFrame(), false);240 FrameIO.SaveFrame(DisplayController.getCurrentFrame(), false); 243 241 MessageBay.displayMessage("Starting test suite: " + _frameset, 244 Colo r.CYAN);242 Colour.CYAN); 245 243 246 244 // Get the next number in the inf file for the _frameset … … 312 310 // Report the number of test passed and failed 313 311 MessageBay.displayMessage( 314 "Total tests: " + (testsPassed + testsFailed), Colo r.CYAN);312 "Total tests: " + (testsPassed + testsFailed), Colour.CYAN); 315 313 if (testsPassed > 0) 316 314 MessageBay.displayMessage("Passed: " + testsPassed, Item.GREEN); 317 315 if (testsFailed > 0) 318 MessageBay.displayMessage("Failed: " + testsFailed, Colo r.RED);316 MessageBay.displayMessage("Failed: " + testsFailed, Colour.RED); 319 317 // Remove items from the cursor... 320 318 FreeItems.getInstance().clear(); … … 350 348 //Have changed parameters, so it takes an Item, not just a Text item. 351 349 private static void RunFrame(Frame frame, Item current, 352 boolean acceptKeyboardInput, boolean step, int pause, Colo r color) {350 boolean acceptKeyboardInput, boolean step, int pause, Colour color) { 353 351 try { 354 352 if (current != null) { … … 358 356 */ 359 357 // DisplayIO.addToBack(current.getParent()); 360 Display IO.addToBack(DisplayIO.getCurrentFrame());358 DisplayController.addToBack(DisplayController.getCurrentFrame()); 361 359 } else { 362 360 /* TODO we should not have to pass an item just to run a frame! */ … … 365 363 } 366 364 367 _stepColor = color == null ? Colo r.green: color;368 _stepColor = new Colo r(_stepColor.getRed(), _stepColor.getGreen(),369 _stepColor.getBlue(), 50);365 _stepColor = color == null ? Colour.GREEN : color; 366 _stepColor = new Colour(_stepColor.getRed(), _stepColor.getGreen(), 367 _stepColor.getBlue(), Colour.FromComponent255(50)); 370 368 _stepPause = pause; 371 369 _step = step; … … 429 427 */ 430 428 public static void DebugFrame(Frame frame, Text current, float pause, 431 Colo r color) {429 Colour color) { 432 430 if (isProgramRunning()) { 433 431 stop(); … … 454 452 FrameUtils.DisplayFrame(item.getParent().getName(), true, true); 455 453 item.setHighlightMode(HighlightMode.Normal); 456 item.setHighlightColor(Colo r.CYAN);454 item.setHighlightColor(Colour.CYAN); 457 455 FrameIO.SaveFrame(item.getParent()); 458 456 } … … 499 497 500 498 if (_step) { 501 if (child != Display IO.getCurrentFrame()) {502 Display IO.setCurrentFrame(child, true);503 } 504 Display IO.addToBack(child);499 if (child != DisplayController.getCurrentFrame()) { 500 DisplayController.setCurrentFrame(child, true); 501 } 502 DisplayController.addToBack(child); 505 503 } 506 504 … … 524 522 AgentStats.ItemExecuted(); 525 523 try { 526 Colo r oldColor = item.getBackgroundColor();524 Colour oldColor = item.getBackgroundColor(); 527 525 if (_step) { 528 526 pause(item); … … 534 532 } else { 535 533 item.setHighlightMode(Item.HighlightMode.None); 534 item.setHighlightColorToDefault(); 536 535 } 537 536 } … … 541 540 && lastItemStatus != Status.FalseIf) { 542 541 if (_step) { 543 Display IO.removeFromBack();542 DisplayController.removeFromBack(); 544 543 } 545 544 return lastItemStatus; … … 565 564 566 565 if (_step) { 567 Display IO.removeFromBack();568 if (Display IO.getCurrentFrame() != current.getParent())569 Display IO.setCurrentFrame(current.getParent(), true);566 DisplayController.removeFromBack(); 567 if (DisplayController.getCurrentFrame() != current.getParent()) 568 DisplayController.setCurrentFrame(current.getParent(), true); 570 569 } 571 570 … … 583 582 return; 584 583 585 Colo r oldColor = item.getBackgroundColor();584 Colour oldColor = item.getBackgroundColor(); 586 585 item.setBackgroundColor(_stepColor); 587 586 item.setHighlightMode(Item.HighlightMode.None); 587 item.setHighlightColorToDefault(); 588 588 589 589 // Make sure we are on the frame with this item 590 590 Frame parent = item.getParentOrCurrentFrame(); 591 if (!parent.equals(Display IO.getCurrentFrame())) {592 Display IO.setCurrentFrame(parent, true);591 if (!parent.equals(DisplayController.getCurrentFrame())) { 592 DisplayController.setCurrentFrame(parent, true); 593 593 } 594 594 595 FrameGraphics.Repaint();595 DisplayController.requestRefresh(true); 596 596 597 597 int timeRemaining; … … 604 604 if (_stop) { 605 605 item.setBackgroundColor(oldColor); 606 item.setHighlightMode (HighlightMode.Normal, _stepColor);606 item.setHighlightModeAndColour(HighlightMode.Normal, _stepColor); 607 607 throw new Exception("Program terminated"); 608 608 } … … 1125 1125 // attribute without the value in the same item 1126 1126 if (!found && attributeItem != null) { 1127 Point2D.Float endPoint = attributeItem 1128 .getParagraphEndPosition(); 1127 Point endPoint = attributeItem.getParagraphEndPosition(); 1129 1128 1130 1129 for (Text text : targetFrame.getTextItems()) { … … 1217 1216 String stringColor = context.getPrimitives().getVariable( 1218 1217 tokens[2]).stringValue(); 1219 item.setBackgroundColor((Colo r) Conversion.Convert(1220 Colo r.class, stringColor));1218 item.setBackgroundColor((Colour) Conversion.Convert( 1219 Colour.class, stringColor)); 1221 1220 } else if (tokens[0].equals("setitemcolor")) { 1222 1221 assertVariableType(tokens[1], 1, SPointer.itemPrefix); … … 1226 1225 String stringColor = context.getPrimitives().getVariable( 1227 1226 tokens[2]).stringValue(); 1228 item.setColor((Colo r) Conversion.Convert(Color.class,1227 item.setColor((Colour) Conversion.Convert(Colour.class, 1229 1228 stringColor, item.getColor())); 1230 1229 … … 1377 1376 // attribute without the value in the same item 1378 1377 if (!found && attributeItem != null) { 1379 Point2D.Float endPoint = attributeItem 1380 .getParagraphEndPosition(); 1378 Point endPoint = attributeItem.getParagraphEndPosition(); 1381 1379 1382 1380 for (Text text : targetFrame.getTextItems()) { … … 1484 1482 assertVariableType(tokens[1], 1, SPointer.framePrefix); 1485 1483 1486 Frame currentFrame = Display IO.getCurrentFrame();1484 Frame currentFrame = DisplayController.getCurrentFrame(); 1487 1485 context.getPointers().setObject(tokens[1], currentFrame); 1488 1486 … … 1504 1502 && tokens.length > 2) { 1505 1503 Text text = (Text) currentItem; 1506 int cursorLinePos = text 1507 .getLinePosition(FrameMouseActions.getY()); 1504 int cursorLinePos = text.getLinePosition(DisplayController.getMouseY()); 1508 1505 context.getPrimitives().setValue(tokens[2], 1509 1506 new SInteger(cursorLinePos + 1)); 1510 1507 if (tokens.length > 3) { 1511 1508 int cursorCharPos = text.getCharPosition( 1512 cursorLinePos, Display IO.getMouseX())1509 cursorLinePos, DisplayController.getMouseX()) 1513 1510 .getCharIndex(); 1514 1511 context.getPrimitives().setValue(tokens[3], … … 1532 1529 1533 1530 //no frame specified by user so use current frame. 1534 getFrameName = Display IO.getCurrentFrame().getName();1531 getFrameName = DisplayController.getCurrentFrame().getName(); 1535 1532 getItem = Misc.getItemContainingData(data, FrameUtils.getFrame(getFrameName)); 1536 1533 } … … 1569 1566 1570 1567 //no frame specified by user so use current frame. 1571 getFrameName = Display IO.getCurrentFrame().getName();1568 getFrameName = DisplayController.getCurrentFrame().getName(); 1572 1569 getItem = Misc.getItemAtPosition(x, y, FrameUtils.getFrame(getFrameName)); 1573 1570 } … … 1662 1659 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 1663 1660 // assertPrimitiveType(tokens[2], 2); 1664 Colo r itemColor = ((Item) context.getPointers()1661 Colour itemColor = ((Item) context.getPointers() 1665 1662 .getVariable(tokens[1]).getValue()) 1666 1663 .getPaintBackgroundColor(); … … 1672 1669 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 1673 1670 // assertPrimitiveType(tokens[2], 2); 1674 Colo r itemColor = ((Item) context.getPointers()1671 Colour itemColor = ((Item) context.getPointers() 1675 1672 .getVariable(tokens[1]).getValue()).getPaintColor(); 1676 1673 String color = itemColor.getRed() + " " … … 1834 1831 double delay = context.getPrimitives().getDoubleValue(tokens[1]); 1835 1832 String s = getMessage(tokens, context, code.toString(), " ", 2); 1836 Display IO.typeStringDirect(delay, s);1833 DisplayController.typeStringDirect(delay, s); 1837 1834 } else if (tokens[0].equals("type") || tokens[0].equals("typenospaces")) { 1838 1835 … … 1840 1837 .equals("type") ? " " : "", 1); 1841 1838 1842 Display IO.typeStringDirect(0.025, s);1839 DisplayController.typeStringDirect(0.025, s); 1843 1840 } else if (tokens[0].equals("runstring")) { 1844 1841 String codeText = getMessage(tokens, context, code.toString(), " ", … … 1858 1855 // Process p = Runtime.getRuntime().exec(new String[]{"date", 1859 1856 // ">", "test.date"}); 1860 MessageBay.displayMessage(command, Colo r.darkGray);1857 MessageBay.displayMessage(command, Colour.DARK_GREY); 1861 1858 1862 1859 BufferedReader stdInput = new BufferedReader( … … 2028 2025 Item item = (Item) context.getPointers().getVariable(itemVar) 2029 2026 .getValue(); 2030 item 2031 .setPosition(FrameMouseActions.MouseX, 2032 FrameMouseActions.MouseY); 2033 FrameMouseActions.pickup(item); 2027 item.setPosition(DisplayController.getMouseX(), DisplayController.getMouseY()); 2028 StandardGestureActions.pickup(item); 2034 2029 } else if (tokens[0].equals("attachstrtocursor")) { 2035 2030 String stringVar = DEFAULT_STRING; … … 2040 2035 } 2041 2036 String s = context.getPrimitives().getStringValue(stringVar); 2042 Frame frame = Display IO.getCurrentFrame();2037 Frame frame = DisplayController.getCurrentFrame(); 2043 2038 Item item = frame.createNewText(s); 2044 item 2045 .setPosition(FrameMouseActions.MouseX, 2046 FrameMouseActions.MouseY); 2047 FrameMouseActions.pickup(item); 2039 item.setPosition(DisplayController.getMouseX(), DisplayController.getMouseY()); 2040 StandardGestureActions.pickup(item); 2048 2041 } else if (tokens[0].equals("additemtoframe")) { 2049 2042 String itemVar = DEFAULT_ITEM; … … 2410 2403 } 2411 2404 } 2412 Display IO.setCurrentFrame(frame, false);2405 DisplayController.setCurrentFrame(frame, false); 2413 2406 pause(thisFramesPause); 2414 2407 … … 2629 2622 tokens[3]) * 1000); 2630 2623 2631 int initialX = Display IO.getMouseX();2632 int initialY = FrameMouseActions.getY();2624 int initialX = DisplayController.getMouseX(); 2625 int initialY = DisplayController.getMouseY(); 2633 2626 2634 2627 final int timeInterval = 40; … … 2643 2636 Thread.yield(); 2644 2637 Thread.sleep(timeInterval); 2645 Display IO.setCursorPosition(newX, newY);2638 DisplayController.setCursorPosition(newX, newY); 2646 2639 // DisplayIO.repaint(); 2647 2640 } 2648 2641 // Thread.yield(); 2649 2642 Thread.sleep(milliseconds % timeInterval); 2650 Display IO.setCursorPosition(finalX, finalY);2643 DisplayController.setCursorPosition(finalX, finalY); 2651 2644 } else if (tokens[0].equals("glideitemto")) { 2652 2645 assertMinParametreCount(tokens, 3); … … 2686 2679 2687 2680 item.setPosition(newX, newY); 2688 FrameGraphics.Repaint();2681 DisplayController.requestRefresh(true); 2689 2682 } 2690 2683 // Thread.yield(); … … 2692 2685 item.setPosition(finalX, finalY); 2693 2686 // DisplayIO.setCursorPosition(finalX, finalY); 2694 FrameMouseActions.anchor(item);2687 StandardGestureActions.anchor(item); 2695 2688 FreeItems.getInstance().clear(); 2696 FrameGraphics.Repaint();2689 DisplayController.requestRefresh(true); 2697 2690 // FrameMouseActions.updateCursor(); 2698 2691 } … … 2740 2733 } else if (tokens[0].equals("pressleftbutton")) { 2741 2734 assertExactParametreCount(tokens, 0); 2742 DisplayIO.pressMouse(InputEvent.BUTTON1_MASK);2735 //DisplayIO.pressMouse(InputEvent.BUTTON1_MASK); TODO: Reinstate. cts16 2743 2736 } else if (tokens[0].equals("pressmiddlebutton")) { 2744 2737 assertExactParametreCount(tokens, 0); 2745 DisplayIO.pressMouse(InputEvent.BUTTON2_MASK);2738 //DisplayIO.pressMouse(InputEvent.BUTTON2_MASK); TODO: Reinstate. cts16 2746 2739 } else if (tokens[0].equals("pressrightbutton")) { 2747 2740 assertExactParametreCount(tokens, 0); 2748 DisplayIO.pressMouse(InputEvent.BUTTON3_MASK);2741 //DisplayIO.pressMouse(InputEvent.BUTTON3_MASK); TODO: Reinstate. cts16 2749 2742 } else if (tokens[0].equals("releaseleftbutton")) { 2750 2743 assertExactParametreCount(tokens, 0); 2751 DisplayIO.releaseMouse(InputEvent.BUTTON1_MASK);2744 //DisplayIO.releaseMouse(InputEvent.BUTTON1_MASK); TODO: Reinstate. cts16 2752 2745 } else if (tokens[0].equals("releasemiddlebutton")) { 2753 2746 assertExactParametreCount(tokens, 0); 2754 DisplayIO.releaseMouse(InputEvent.BUTTON2_MASK);2747 //DisplayIO.releaseMouse(InputEvent.BUTTON2_MASK); TODO: Reinstate. cts16 2755 2748 } else if (tokens[0].equals("releaserightbutton")) { 2756 2749 assertExactParametreCount(tokens, 0); 2757 DisplayIO.releaseMouse(InputEvent.BUTTON3_MASK);2750 //DisplayIO.releaseMouse(InputEvent.BUTTON3_MASK); TODO: Reinstate. cts16 2758 2751 } else if (tokens[0].equals("clickleftbutton")) { 2759 2752 assertExactParametreCount(tokens, 0); 2760 FrameMouseActions.leftButton();2753 // FrameMouseActions.leftButton(); TODO: Reinstate. cts16 2761 2754 // DisplayIO.clickMouse(InputEvent.BUTTON1_MASK); 2762 2755 } else if (tokens[0].equals("clickmiddlebutton")) { 2763 2756 assertExactParametreCount(tokens, 0); 2764 FrameMouseActions.middleButton();2757 // FrameMouseActions.middleButton(); TODO: Reinstate. cts16 2765 2758 // DisplayIO.clickMouse(InputEvent.BUTTON2_MASK); 2766 2759 } else if (tokens[0].equals("clickrightbutton")) { 2767 2760 assertExactParametreCount(tokens, 0); 2768 FrameMouseActions.rightButton();2761 // FrameMouseActions.rightButton(); TODO: Reinstate. cts16 2769 2762 // DisplayIO.clickMouse(InputEvent.BUTTON3_MASK); 2770 2763 } else if (tokens[0].equals("repaint")) { 2771 2764 assertExactParametreCount(tokens, 0); 2772 2765 // FrameGraphics.Repaint(); 2773 FrameGraphics.requestRefresh(true);2766 DisplayController.requestRefresh(true); 2774 2767 } else if (tokens[0].equals("add")) { 2775 2768 assertMaxParametreCount(tokens, 3); … … 2931 2924 int x = (int) context.getPrimitives().getIntegerValue(tokens[1]); 2932 2925 int y = (int) context.getPrimitives().getIntegerValue(tokens[2]); 2933 Display IO.setCursorPosition(x, y);2926 DisplayController.setCursorPosition(x, y); 2934 2927 2935 2928 … … 2981 2974 2982 2975 if (source == null) 2983 source = Display IO.getCurrentFrame();2976 source = DisplayController.getCurrentFrame(); 2984 2977 int lastParam = tokens.length - 1; 2985 2978 String resultVarName = null; … … 3102 3095 _programsRunning++; 3103 3096 AgentStats.reset(); 3104 MessageBay.displayMessage("Running SimpleProgram...", Colo r.BLUE);3097 MessageBay.displayMessage("Running SimpleProgram...", Colour.BLUE); 3105 3098 } 3106 3099
Note:
See TracChangeset
for help on using the changeset viewer.