Changeset 1102 for trunk/src/org/expeditee/items/widgets
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- Location:
- trunk/src/org/expeditee/items/widgets
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/ButtonWidget.java
r1005 r1102 1 1 package org.expeditee.items.widgets; 2 2 import java.awt.BorderLayout; 3 import java.awt.Color;4 3 import java.awt.Dimension; 5 4 import java.net.URL; … … 9 8 import javax.swing.border.EmptyBorder; 10 9 10 import org.expeditee.core.Colour; 11 import org.expeditee.gio.swing.SwingConversions; 11 12 import org.expeditee.items.Text; 12 13 … … 14 15 15 16 //Will be the default class for Rubbish Bin, Reset and Undo Button Widgets 16 public class ButtonWidget extends InteractiveWidget{17 17 public class ButtonWidget extends SwingWidget 18 { 18 19 protected JButton clicked_ = new JButton(""); 19 20 protected SVGIcon icon_ = null; 20 21 21 22 public ButtonWidget(int dimension, String filePath, Text source, String[] args) 22 23 { … … 25 26 26 27 clicked_.setBorder(new EmptyBorder(0, 0, 0, 0)); 27 clicked_.setBackground( Color.white);28 clicked_.setBackground(SwingConversions.toSwingColor(Colour.WHITE)); 28 29 29 30 Dimension size = new Dimension(dimension, dimension); 30 31 icon_ = new SVGIcon(); 31 try{ 32 33 try { 32 34 URL imageURL = ClassLoader.getSystemResource(filePath); 33 35 icon_.setSvgURI(imageURL.toURI()); 34 // This STILL works, unsure why. Don't remove it has an affect on the button appearance.36 // This STILL works, unsure why. Don't remove it has an affect on the button appearance. 35 37 icon_.setUseAntiAlias(true); 36 38 icon_.setScaleToFit(true); … … 39 41 _swingComponent.add(clicked_); 40 42 this.setWidgetEdgeThickness(0.0f); 41 this.setWidgetEdgeColor(Color.white); 42 } 43 catch(Exception e){ 44 43 this.setWidgetEdgeColor(Colour.WHITE); 44 } catch(Exception e) { 45 45 //Set a default image if image is missing 46 46 System.out.println("Unable to load image from directory"); … … 49 49 50 50 @Override 51 protected String[] getArgs() { 51 protected String[] getArgs() 52 { 52 53 // TODO Auto-generated method stub 53 54 return null; 54 55 } 55 public boolean itemHeldWhileClicked(InteractiveWidget bw) { 56 57 public boolean itemHeldWhileClicked(Widget bw) 58 { 56 59 // TODO Auto-generated method stub 57 60 return false; 58 61 } 59 public boolean getdropInteractableStatus(){ 62 63 public boolean getdropInteractableStatus() 64 { 60 65 return false; 61 66 } 62 67 63 68 @Override 64 boolean setPositions(WidgetCorner src, float x, float y) { 69 public boolean setPositions(WidgetCorner src, float x, float y) 70 { 65 71 boolean result = super.setPositions(src, x, y); 66 72 -
trunk/src/org/expeditee/items/widgets/DataFrameWidget.java
r919 r1102 19 19 package org.expeditee.items.widgets; 20 20 21 import java.awt.Color;22 import java.awt.Graphics;23 21 import java.util.Collection; 24 22 import java.util.HashSet; … … 26 24 import javax.swing.JComponent; 27 25 28 import org.expeditee.gui.DisplayIO; 26 import org.expeditee.core.Colour; 27 import org.expeditee.core.Point; 28 import org.expeditee.gio.EcosystemManager; 29 import org.expeditee.gio.GraphicsManager; 30 import org.expeditee.gui.DisplayController; 29 31 import org.expeditee.gui.Frame; 30 32 import org.expeditee.gui.FrameIO; … … 34 36 import org.expeditee.items.Text; 35 37 36 public abstract class DataFrameWidget extends InteractiveWidget implements38 public abstract class DataFrameWidget extends SwingWidget implements 37 39 FrameObserver { 38 40 … … 118 120 public void update() { 119 121 Frame parent = getParentFrame(); 120 if (parent != null && parent == Display IO.getCurrentFrame()) {122 if (parent != null && parent == DisplayController.getCurrentFrame()) { 121 123 refresh(); 122 124 } … … 166 168 } 167 169 168 protected void paintInFreeSpace( Graphics g) {169 super.paintInFreeSpace(g);170 g.setFont(((Text) getSource()).getFont());171 g.setColor(Color.WHITE);172 g.drawString(this.getClass().getSimpleName(), getX() + 10, getY() + 20);170 protected void paintInFreeSpace() 171 { 172 super.paintInFreeSpace(); 173 GraphicsManager g = EcosystemManager.getGraphicsManager(); 174 g.drawString(this.getClass().getSimpleName(), new Point(getX() + 10, getY() + 20), ((Text) getSource()).getFont(), Colour.WHITE); 173 175 174 176 } -
trunk/src/org/expeditee/items/widgets/HeavyDutyInteractiveWidget.java
r1046 r1102 19 19 package org.expeditee.items.widgets; 20 20 21 import java.awt.Color;22 21 import java.awt.Font; 23 22 import java.awt.FontMetrics; … … 33 32 import javax.swing.SwingUtilities; 34 33 34 import org.expeditee.core.Colour; 35 import org.expeditee.gio.swing.SwingConversions; 36 import org.expeditee.gio.swing.SwingGraphicsManager; 37 import org.expeditee.gio.swing.SwingMiscManager; 35 38 import org.expeditee.gui.Browser; 36 import org.expeditee.gui.DisplayIO; 37 import org.expeditee.gui.FrameGraphics; 39 import org.expeditee.gui.DisplayController; 38 40 import org.expeditee.gui.FreeItems; 39 41 import org.expeditee.items.Item; … … 53 55 * until expeditee allocates a thread to begin loading. The swing component is set as not-visible. 54 56 * 55 * At the the loading stage, a loadable widget proc cesses its load task and renders a57 * At the the loading stage, a loadable widget processes its load task and renders a 56 58 * load message/bar. 57 59 * … … 59 61 * 60 62 * When a HeavyDutyInteractiveWidget becomes visible / is anchored, it will register itself for saving at the next 61 * save point according to SaveEntityManager. Heav ey duty widgets will only save at the save points63 * save point according to SaveEntityManager. Heavy duty widgets will only save at the save points 62 64 * if the widget still belongs to a frame (i.e. is not removed) and is anchored. 63 65 * 64 * Heav ey duty widgets can also have an expiry on how long they should stay cached for. If they do have an66 * Heavy duty widgets can also have an expiry on how long they should stay cached for. If they do have an 65 67 * expiry then it they unload once expired, and will re-load once in view again. Must take care for 66 68 * unloadable widgets because you must check your unloadable elements to whether they are unloaded or not 67 * every time your widget accesses sthem.69 * every time your widget accesses them. 68 70 * 69 71 * When a heavy duty widget is deleted - any data consuming memory can be dumped temporarily if needed. … … 72 74 * 73 75 */ 74 public abstract class HeavyDutyInteractiveWidget extends InteractiveWidget implements LoadableEntity, SaveableEntity {76 public abstract class HeavyDutyInteractiveWidget extends SwingWidget implements LoadableEntity, SaveableEntity { 75 77 76 78 /** load finished */ … … 90 92 private static final String PENDING_MESSAGE = "Pending"; 91 93 92 private static final Colo r LOAD_BAR_PROGRESS_COLOR = new Color(103, 171, 203);93 private static final Colo r LOAD_BAR_INDETERM_COLOR = Color.ORANGE;94 private static final Colo r LOAD_BAR_HIGHLIGHT_COLOR = new Color(240, 240, 240);95 private static final Colo r LOAD_SCREEN_COLOR = Color.LIGHT_GRAY;96 private static final Colo r LOAD_SCREEN_COLOR_FREESPACE = FREESPACE_BACKCOLOR;94 private static final Colour LOAD_BAR_PROGRESS_COLOR = Colour.FromRGB255(103, 171, 203); 95 private static final Colour LOAD_BAR_INDETERM_COLOR = Colour.ORANGE; 96 private static final Colour LOAD_BAR_HIGHLIGHT_COLOR = Colour.FromRGB255(240, 240, 240); 97 private static final Colour LOAD_SCREEN_COLOR = Colour.LIGHT_GREY; 98 private static final Colour LOAD_SCREEN_COLOR_FREESPACE = FREESPACE_BACKCOLOR; 97 99 98 100 private static final Font LOAD_NORMAL_FONT = new Font("Arial", Font.BOLD, 12); … … 140 142 */ 141 143 protected HeavyDutyInteractiveWidget(Text source, JComponent component, 142 int minWidth, int maxWidth, int minHeight, int maxHeight, int cacheDepth, boolean skipLoad) { 144 int minWidth, int maxWidth, int minHeight, int maxHeight, int cacheDepth, boolean skipLoad) 145 { 143 146 super(source, component, minWidth, maxWidth, minHeight, maxHeight); 144 147 … … 173 176 * 174 177 * @param percent 175 * Must be between 0.0 and 1.0 inclusive for percentage. Or ne agtive if indeterminant.178 * Must be between 0.0 and 1.0 inclusive for percentage. Or negative if indeterminate. 176 179 * 177 180 * @throws IllegalArgumentException … … 182 185 * 183 186 */ 184 protected final void updateLoadPercentage(float percent) { 187 protected final void updateLoadPercentage(float percent) 188 { 185 189 if (percent > 1.0f) 186 190 throw new IllegalArgumentException("loadState is larger than 1.0"); … … 199 203 * @return The current load state. 200 204 */ 201 protected float getLoadState() { 205 protected float getLoadState() 206 { 202 207 return loadState; 203 208 } … … 206 211 * @return True if in a loading phase. 207 212 */ 208 protected boolean isInLoadProgress() { 213 protected boolean isInLoadProgress() 214 { 209 215 return loadState <= 1.0f; 210 216 } … … 226 232 227 233 // Re-render loading state 228 FrameGraphics.invalidateArea(_swingComponent.getBounds());229 FrameGraphics.requestRefresh(true);234 DisplayController.invalidateArea(getBounds()); 235 DisplayController.requestRefresh(true); 230 236 } 231 237 232 238 @Override 233 public void paintInFreeSpace( Graphics g) {234 if (loadState == LOAD_STATE_COMPLETED) super.paintInFreeSpace( g);235 else paintLoadScreen( g,LOAD_SCREEN_COLOR_FREESPACE);239 public void paintInFreeSpace() { 240 if (loadState == LOAD_STATE_COMPLETED) super.paintInFreeSpace(); 241 else paintLoadScreen(LOAD_SCREEN_COLOR_FREESPACE); 236 242 } 237 243 238 244 @Override 239 public void paint(Graphics g) { 245 protected final void paintSwingWidget(Graphics2D g) 246 { 240 247 if (loadState == LOAD_STATE_COMPLETED) { 241 super.paint(g);248 paintHeavyDutyWidget(g); 242 249 } else { 243 paintLoadScreen(g, LOAD_SCREEN_COLOR); 244 this.paintLink((Graphics2D)g); 245 } 246 247 } 248 249 /** 250 * Rendersthe load bar / load messages 250 paintLoadScreen(LOAD_SCREEN_COLOR); 251 } 252 253 } 254 255 /** Can be overridden to provide custom drawing. */ 256 protected void paintHeavyDutyWidget(Graphics2D g) 257 { 258 super.paintSwingWidget(g); 259 } 260 261 /** 262 * Renders the load bar / load messages 251 263 * 252 264 * @param g 253 265 */ 254 private void paintLoadScreen( Graphics g, Color backgroundColor) {266 private void paintLoadScreen(Colour backgroundColor) { 255 267 256 268 if (Browser._theBrowser == null) return; 257 269 270 SwingGraphicsManager manager = SwingMiscManager.getIfUsingSwingGraphicsManager(); 271 Graphics g = manager.getCurrentSurface(); 272 258 273 // Render shaded window over widget 259 g.setColor( backgroundColor);274 g.setColor(SwingConversions.toSwingColor(backgroundColor)); 260 275 g.fillRect(getX(), getY(), getWidth(), getHeight()); 261 276 … … 291 306 Rectangle tmpClip = (clipBackUp != null) ? clipBackUp.getBounds() : 292 307 new Rectangle(0, 0, 293 Browser._theBrowser.getContentPane().getWidth(),294 Browser._theBrowser.getContentPane().getHeight());295 296 g.setClip(tmpClip.intersection( getBounds()));308 manager.getContentPane().getWidth(), 309 manager.getContentPane().getHeight()); 310 311 g.setClip(tmpClip.intersection(SwingConversions.toSwingRectangle(getBounds()))); 297 312 298 313 … … 300 315 301 316 GradientPaint gp = new GradientPaint( 302 0, barY + (int)(BAR_HEIGHT * 0.8), LOAD_BAR_INDETERM_COLOR,303 0, barY, LOAD_BAR_HIGHLIGHT_COLOR);317 0, barY + (int)(BAR_HEIGHT * 0.8), SwingConversions.toSwingColor(LOAD_BAR_INDETERM_COLOR), 318 0, barY, SwingConversions.toSwingColor(LOAD_BAR_HIGHLIGHT_COLOR)); 304 319 ((Graphics2D)g).setPaint(gp); 305 320 … … 311 326 312 327 GradientPaint gp = new GradientPaint( 313 0, barY + (int)(BAR_HEIGHT * 0.8), LOAD_BAR_PROGRESS_COLOR,314 0, barY, LOAD_BAR_HIGHLIGHT_COLOR);328 0, barY + (int)(BAR_HEIGHT * 0.8), SwingConversions.toSwingColor(LOAD_BAR_PROGRESS_COLOR), 329 0, barY, SwingConversions.toSwingColor(LOAD_BAR_HIGHLIGHT_COLOR)); 315 330 ((Graphics2D)g).setPaint(gp); 316 331 … … 319 334 } 320 335 321 g.setColor( Color.DARK_GRAY);336 g.setColor(SwingConversions.toSwingColor(Colour.DARK_GREY)); 322 337 g.drawRect(barX, barY, barWidth, BAR_HEIGHT); 323 338 324 339 if (loadState == LOAD_STATE_FAILED) 325 g.setColor( Color.RED);326 327 else g.setColor( Color.BLACK);340 g.setColor(SwingConversions.toSwingColor(Colour.RED)); 341 342 else g.setColor(SwingConversions.toSwingColor(Colour.BLACK)); 328 343 329 344 … … 638 653 // Re-render loading state - if not expired 639 654 if (!expired) { 640 FrameGraphics.invalidateArea(new Rectangle(getX(), getY(), getWidth(), getHeight()));641 FrameGraphics.requestRefresh(true);655 DisplayController.invalidateArea(getBounds()); 656 DisplayController.requestRefresh(true); 642 657 } 643 658 } … … 680 695 681 696 // Only load if in view 682 if (!isFloating() && getParentFrame() != Display IO.getCurrentFrame())697 if (!isFloating() && getParentFrame() != DisplayController.getCurrentFrame()) 683 698 return; 684 699 -
trunk/src/org/expeditee/items/widgets/JSWidget.java
r1080 r1102 32 32 import javax.swing.JPanel; 33 33 34 import org.expeditee.gui.Display IO;34 import org.expeditee.gui.DisplayController; 35 35 import org.expeditee.items.ItemParentStateChangedEvent; 36 36 import org.expeditee.items.JSThreadable; … … 75 75 76 76 private static Text getSauce() { 77 Text source = new Text(Display IO.getCurrentFrame().getNextItemID(), "@iw: org.expeditee.items.widgets.JSWidget");78 source.setParent(Display IO.getCurrentFrame());77 Text source = new Text(DisplayController.getCurrentFrame().getNextItemID(), "@iw: org.expeditee.items.widgets.JSWidget"); 78 source.setParent(DisplayController.getCurrentFrame()); 79 79 return source; 80 80 } … … 172 172 173 173 @Override 174 protected void paintLink( Graphics2D g) {174 protected void paintLink() { 175 175 return; 176 176 } -
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r1060 r1102 76 76 import netscape.javascript.JSObject; 77 77 78 import org.expeditee.gui.DisplayIO; 79 import org.expeditee.gui.FrameMouseActions; 78 import org.expeditee.gio.gesture.StandardGestureActions; 79 import org.expeditee.gio.swing.SwingConversions; 80 import org.expeditee.gui.DisplayController; 80 81 import org.expeditee.gui.FreeItems; 81 82 import org.expeditee.gui.MessageBay; … … 468 469 public void handle(KeyEvent e) { 469 470 // Hiding the cursor when typing, to be more Expeditee-like 470 Display IO.setCursor(org.expeditee.items.Item.HIDDEN_CURSOR);471 DisplayController.setCursor(org.expeditee.items.Item.HIDDEN_CURSOR); 471 472 } 472 473 }); … … 481 482 } 482 483 // Checking if the user has been typing - if so, move the cursor to the caret position 483 if (Display IO.getCursor() == Item.HIDDEN_CURSOR) {484 Display IO.setCursor(org.expeditee.items.Item.TEXT_CURSOR);485 Display IO.setCursorPosition(getCoordFromCaret(JfxBrowser.this._urlField));484 if (DisplayController.getCursor() == Item.HIDDEN_CURSOR) { 485 DisplayController.setCursor(org.expeditee.items.Item.TEXT_CURSOR); 486 DisplayController.setCursorPosition(SwingConversions.fromSwingPoint(getCoordFromCaret(JfxBrowser.this._urlField))); 486 487 } else { 487 488 // Otherwise, move the caret to the cursor location … … 523 524 public void changed(ObservableValue<? extends Boolean> property, Boolean oldValue, Boolean newValue) { 524 525 if(newValue.booleanValue()) { 525 Display IO.setCursor(org.expeditee.items.Item.TEXT_CURSOR);526 DisplayController.setCursor(org.expeditee.items.Item.TEXT_CURSOR); 526 527 } else { 527 528 // Restoring the standard cursor, since it is changed to a text cursor when focus is gained 528 Display IO.setCursor(org.expeditee.items.Item.DEFAULT_CURSOR);529 DisplayController.setCursor(org.expeditee.items.Item.DEFAULT_CURSOR); 529 530 } 530 531 } … … 545 546 if (e.getButton() == MouseButton.SECONDARY) { 546 547 // Right mouse button released, so copy the selection (i.e. don't remove the original) 547 item = Display IO.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());548 FrameMouseActions.pickup(item);548 item = DisplayController.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText()); 549 StandardGestureActions.pickup(item); 549 550 } else if (e.getButton() == MouseButton.MIDDLE) { 550 551 // Middle mouse button released, so copy the selection then remove it from the URL field 551 item = Display IO.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());552 item = DisplayController.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText()); 552 553 JfxBrowser.this._urlField.setText( 553 554 JfxBrowser.this._urlField.getText().substring(0, JfxBrowser.this._urlField.getSelection().getStart()) … … 555 556 JfxBrowser.this._urlField.getText().length())); 556 557 557 FrameMouseActions.pickup(item);558 StandardGestureActions.pickup(item); 558 559 } 559 560 } … … 660 661 661 662 if (((String) style.call("getPropertyValue", new Object[] { "background-image" })).startsWith("url(")) { 662 pic = WebParser.getBackgroundImageFromNode(node, style, Display IO.getCurrentFrame(), null,663 (float) FrameMouseActions.getX(), (float) FrameMouseActions.getY(), width, height);663 pic = WebParser.getBackgroundImageFromNode(node, style, DisplayController.getCurrentFrame(), null, 664 (float) DisplayController.getMouseX(), (float) DisplayController.getMouseY(), width, height); 664 665 665 666 } else { … … 667 668 if(node.getNodeName().toLowerCase().equals("img") && 668 669 (imgSrc = ((JSObject) node).getMember("src").toString()) != null) { 669 pic = WebParser.getImageFromUrl(imgSrc, null, Display IO.getCurrentFrame(),670 (float) FrameMouseActions.getX(), (float) FrameMouseActions.getY(), (int) width, null, null, null, null, null, 0, 0);670 pic = WebParser.getImageFromUrl(imgSrc, null, DisplayController.getCurrentFrame(), 671 (float) DisplayController.getMouseX(), (float) DisplayController.getMouseY(), (int) width, null, null, null, null, null, 0, 0); 671 672 } else { 672 673 return; … … 685 686 } 686 687 687 pic.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());688 FrameMouseActions.pickup(pic);688 pic.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 689 StandardGestureActions.pickup(pic); 689 690 } catch (Exception e1) { 690 691 // TODO Auto-generated catch block … … 714 715 + ((JSObject)node).getMember("height") 715 716 + ":" + src); 716 t.setParent(Display IO.getCurrentFrame());717 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());717 t.setParent(DisplayController.getCurrentFrame()); 718 t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 718 719 JfxMedia media = new JfxMedia(t, new String[] { src }); 719 FrameMouseActions.pickup(media.getItems());720 StandardGestureActions.pickup(media.getItems()); 720 721 721 722 } else if(node.getNodeName().toLowerCase().equals("a") && ((JSObject)node).getMember("href") != null) { 722 723 // If a link is right clicked, copy the text content and give it an action to create 723 724 // a new frame containing a browser pointing to the linked page 724 Text t = Display IO.getCurrentFrame().createNewText(((String) ((JSObject)node).getMember("textContent")).trim());725 Text t = DisplayController.getCurrentFrame().createNewText(((String) ((JSObject)node).getMember("textContent")).trim()); 725 726 t.addAction("createFrameWithBrowser " + (String) ((JSObject)node).getMember("href")); 726 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());727 FrameMouseActions.pickup(t);727 t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 728 StandardGestureActions.pickup(t); 728 729 } 729 730 } 730 731 } else { 731 732 // Copy text and attach to cursor 732 Text t = Display IO.getCurrentFrame().createNewText(selection);733 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());734 FrameMouseActions.pickup(t);733 Text t = DisplayController.getCurrentFrame().createNewText(selection); 734 t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 735 StandardGestureActions.pickup(t); 735 736 } 736 737 } … … 871 872 public void getFrame() { 872 873 try { 873 WebParser.parsePageSimple(this, _webEngine, _webView, Display IO.getCurrentFrame());874 WebParser.parsePageSimple(this, _webEngine, _webView, DisplayController.getCurrentFrame()); 874 875 } catch (Exception e) { 875 876 e.printStackTrace(); … … 886 887 new Thread(new Runnable() { 887 888 public void run() { 888 WebParser.parsePageSimple(JfxBrowser.this, JfxBrowser.this._webEngine, JfxBrowser.this._webView, Display IO.getCurrentFrame());889 WebParser.parsePageSimple(JfxBrowser.this, JfxBrowser.this._webEngine, JfxBrowser.this._webView, DisplayController.getCurrentFrame()); 889 890 } 890 891 }).start(); … … 954 955 } 955 956 956 final int x = FrameMouseActions.getX() - this.getX(), y = FrameMouseActions.getY() - this.getY();957 final int x = DisplayController.getMouseX() - this.getX(), y = DisplayController.getMouseY() - this.getY(); 957 958 if(!this._urlField.getBoundsInParent().contains(x, y)) { 958 959 // fails if not clicking on urlField -
trunk/src/org/expeditee/items/widgets/MemoryMonitor.java
r919 r1102 19 19 package org.expeditee.items.widgets; 20 20 21 import java.awt.Color;22 21 import java.awt.Font; 23 22 import java.awt.Graphics; … … 27 26 import javax.swing.SwingUtilities; 28 27 28 import org.expeditee.core.Colour; 29 import org.expeditee.gio.swing.SwingConversions; 30 import org.expeditee.gio.swing.SwingMiscManager; 29 31 import org.expeditee.items.ItemParentStateChangedEvent; 30 32 import org.expeditee.items.Text; … … 36 38 * 37 39 */ 38 public class MemoryMonitor extends InteractiveWidget {40 public class MemoryMonitor extends SwingWidget { 39 41 40 42 private long totalMemoryInBytes; … … 63 65 64 66 @Override 65 public void paint (Graphics g) {66 67 public void paintSwingWidget(Graphics2D g) 68 { 67 69 int height = getHeight(); 68 70 int width = getWidth(); … … 70 72 int memHeight = (int)(height * currentMemoryUsage); 71 73 72 Colo r memColor;74 Colour memColor; 73 75 if (currentMemoryUsage > 0.8f) { 74 memColor = Colo r.RED;76 memColor = Colour.RED; 75 77 } else if (currentMemoryUsage > 0.5f) { 76 memColor = Colo r.ORANGE;78 memColor = Colour.ORANGE; 77 79 } else { 78 memColor = Colo r.GREEN;80 memColor = Colour.GREEN; 79 81 } 80 82 81 g.setColor( memColor);83 g.setColor(SwingConversions.toSwingColor(memColor)); 82 84 g.fillRect(getX(), getY() + height - memHeight, width, memHeight); 83 85 84 g.setColor( Color.WHITE);86 g.setColor(SwingConversions.toSwingColor(Colour.WHITE)); 85 87 g.fillRect(getX(), getY(), width, height - memHeight); 86 88 87 89 int percent = (int)(currentMemoryUsage * 100.0f); 88 90 89 g.setColor( Color.BLACK);91 g.setColor(SwingConversions.toSwingColor(Colour.BLACK)); 90 92 g.setFont(USAGE_FONT); 91 93 g.drawString(percent + "%", getX() + 12, getY() + (height / 2) + 8); 92 93 paintLink((Graphics2D)g);94 94 } 95 95 -
trunk/src/org/expeditee/items/widgets/Password.java
r919 r1102 32 32 * @author jts21 33 33 */ 34 public class Password extends InteractiveWidget {34 public class Password extends SwingWidget { 35 35 36 36 private JPasswordField passwordField; -
trunk/src/org/expeditee/items/widgets/RefreshButton.java
r1005 r1102 4 4 import java.awt.event.ActionListener; 5 5 6 import org.expeditee.gui.Display IO;6 import org.expeditee.gui.DisplayController; 7 7 import org.expeditee.gui.Frame; 8 8 import org.expeditee.gui.FrameGraphics; … … 20 20 public void actionPerformed(ActionEvent e) { 21 21 22 Frame f = Display IO.getCurrentFrame();22 Frame f = DisplayController.getCurrentFrame(); 23 23 try{ 24 24 FrameIO.ForceSaveFrame(f); 25 25 Frame g = FrameIO.LoadRestoreFrame(f); 26 Display IO.setCurrentFrame(g, false);27 FrameGraphics.refresh(true);26 DisplayController.setCurrentFrame(g, false); 27 DisplayController.requestRefresh(true); 28 28 } 29 29 catch(Exception e1){ -
trunk/src/org/expeditee/items/widgets/RubbishBin.java
r1005 r1102 4 4 import java.awt.event.ActionListener; 5 5 6 import org.expeditee.g ui.DisplayIO;7 import org.expeditee.gui. FrameMouseActions;6 import org.expeditee.gio.gesture.StandardGestureActions; 7 import org.expeditee.gui.DisplayController; 8 8 import org.expeditee.gui.FreeItems; 9 9 import org.expeditee.items.Item; 10 10 import org.expeditee.items.Text; 11 11 12 //When the Rubbish Bin Widget is clicked by any of the mouse buttons, whatever is currently being picked up by the mouse is destroyed 13 public class RubbishBin extends ButtonWidget{ 14 15 public RubbishBin(Text source, String[] args){ 16 12 /** 13 * When the Rubbish Bin Widget is clicked by any of the mouse buttons, 14 * whatever is currently being picked up by the mouse is destroyed. 15 * 16 * @author cts16 17 */ 18 public class RubbishBin extends ButtonWidget 19 { 20 public RubbishBin(Text source, String[] args) 21 { 17 22 super(80, "org/expeditee/assets/images/bin.svg", source, args); 18 23 19 clicked_.addActionListener(new ActionListener() { 20 public void actionPerformed(ActionEvent e) { 24 clicked_.addActionListener(new ActionListener() 25 { 26 public void actionPerformed(ActionEvent e) 27 { 21 28 22 29 } 23 30 }); 24 31 } 25 public boolean ItemsLeftClickDropped() { 26 32 33 public boolean ItemsLeftClickDropped() 34 { 27 35 //Find what the mouse was holding at the time and delete it 28 36 Item freeItems = FreeItems.getItemAttachedToCursor(); 29 if( freeItems != null){ 30 freeItems.setParent(DisplayIO.getCurrentFrame()); 37 38 if( freeItems != null) { 39 freeItems.setParent(DisplayController.getCurrentFrame()); 31 40 32 try{ 33 34 FrameMouseActions.delete(freeItems); 35 } 36 catch(Exception e){ 37 41 try { 42 StandardGestureActions.delete(freeItems, null, null, false); 43 } catch(Exception e) { 38 44 e.printStackTrace(); 39 45 } 40 46 } 47 41 48 return true; 42 49 } 43 50 44 51 @Override 45 protected String[] getArgs() { 52 protected String[] getArgs() 53 { 46 54 // TODO Auto-generated method stub 47 55 return null; 48 56 } 49 //this should be a generic method for any widget that is clicked while an item is being held 50 public boolean itemHeldWhileClicked(InteractiveWidget iw){ 51 57 58 /** 59 * This should be a generic method for any widget that is clicked while an item is being held. 60 */ 61 public boolean itemHeldWhileClicked(Widget iw) 62 { 52 63 ItemsLeftClickDropped(); 53 return true; 54 55 } 56 public boolean getdropInteractableStatus(){ 64 57 65 return true; 58 66 } 59 67 68 public boolean getdropInteractableStatus() 69 { 70 return true; 71 } 60 72 } -
trunk/src/org/expeditee/items/widgets/SampleWidget2.java
r919 r1102 19 19 package org.expeditee.items.widgets; 20 20 21 22 import java.awt.Color;23 21 import java.awt.FlowLayout; 24 22 import java.awt.Font; … … 32 30 import javax.swing.JToggleButton; 33 31 32 import org.expeditee.core.Colour; 33 import org.expeditee.gio.swing.SwingConversions; 34 34 import org.expeditee.items.Text; 35 35 36 public class SampleWidget2 extends InteractiveWidget {36 public class SampleWidget2 extends SwingWidget { 37 37 38 38 private JComboBox _combo; … … 47 47 48 48 JPanel p = new JPanel(new FlowLayout()); 49 p.setBackground( new Color(255,228,195));49 p.setBackground(SwingConversions.toSwingColor(Colour.FromRGB255(255,228,195))); 50 50 51 51 JLabel lbl = new JLabel("This is an example InteractiveWidget!"); -
trunk/src/org/expeditee/items/widgets/Undo.java
r1005 r1102 4 4 import java.awt.event.ActionListener; 5 5 6 import org.expeditee.gui.Display IO;6 import org.expeditee.gui.DisplayController; 7 7 import org.expeditee.items.Text; 8 8 … … 17 17 public void actionPerformed(ActionEvent e) { 18 18 19 Display IO.getCurrentFrame().undo();19 DisplayController.getCurrentFrame().undo(); 20 20 } 21 21 }); -
trunk/src/org/expeditee/items/widgets/WidgetCacheManager.java
r919 r1102 25 25 import java.util.Set; 26 26 27 import org.expeditee.gui.Display IOObserver;27 import org.expeditee.gui.DisplayObserver; 28 28 import org.expeditee.gui.FrameIO; 29 29 … … 37 37 * 38 38 */ 39 public final class WidgetCacheManager implements Display IOObserver {39 public final class WidgetCacheManager implements DisplayObserver { 40 40 41 41 private static HashMap<HeavyDutyInteractiveWidget, Integer> transientWidgets = new HashMap<HeavyDutyInteractiveWidget, Integer>(); -
trunk/src/org/expeditee/items/widgets/WidgetCorner.java
r919 r1102 19 19 package org.expeditee.items.widgets; 20 20 21 import java.awt.Color;22 import java.awt.Graphics2D;23 import java.awt.Polygon;24 21 import java.util.List; 25 22 23 import org.expeditee.core.Colour; 24 import org.expeditee.core.Point; 25 import org.expeditee.core.bounds.PolygonBounds; 26 26 import org.expeditee.items.Dot; 27 27 import org.expeditee.items.ItemParentStateChangedEvent; … … 30 30 public class WidgetCorner extends Dot { 31 31 32 private InteractiveWidget _widgetSource;33 34 WidgetCorner(int x, int y, int id, InteractiveWidget widgetSource) {32 private Widget _widgetSource; 33 34 WidgetCorner(int x, int y, int id, Widget widgetSource) { 35 35 super(x, y, id); 36 36 … … 38 38 throw new NullPointerException("widgetSource"); 39 39 _widgetSource = widgetSource; 40 }41 42 @Override43 public void updatePolygon() {44 super.updatePolygon();45 if (_widgetSource != null)46 _widgetSource.onBoundsChanged();47 40 } 48 41 … … 81 74 82 75 @Override 83 public void onParentStateChanged(ItemParentStateChangedEvent e) { 76 public void onParentStateChanged(ItemParentStateChangedEvent e) 77 { 84 78 super.onParentStateChanged(e); 85 79 _widgetSource.onParentStateChanged(e); 86 80 } 87 81 88 public InteractiveWidget getWidgetSource() {82 public Widget getWidgetSource() { 89 83 return _widgetSource; 90 84 } 91 85 92 86 @Override 93 public void paint(Graphics2D g) { 87 public void paint() 88 { 94 89 // For fixed widgets, always have corner selected with connected context 95 HighlightMode tmp = _ mode; // save mode96 if (_ mode == HighlightMode.Normal && _widgetSource.isFixedSize()) {97 _ mode = HighlightMode.Connected; // draw as connected context for90 HighlightMode tmp = _highlightMode; // save mode 91 if (_highlightMode == HighlightMode.Normal && _widgetSource.isFixedSize()) { 92 _highlightMode = HighlightMode.Connected; // draw as connected context for 98 93 // fixed widgets 99 94 } 100 super.paint( g);101 _ mode = tmp; // restore mode102 } 103 104 @Override 105 public void paintFill( Graphics2D g) {106 _widgetSource.paintFill( g); // only paints a fill if floating95 super.paint(); 96 _highlightMode = tmp; // restore mode 97 } 98 99 @Override 100 public void paintFill() { 101 _widgetSource.paintFill(); // only paints a fill if floating 107 102 } 108 103 … … 127 122 128 123 @Override 129 public void setArrowhead(Polygon arrow) {124 public void setArrowhead(PolygonBounds arrow) { 130 125 } 131 126 … … 139 134 140 135 @Override 141 public void setBackgroundColor(Colo r c) {136 public void setBackgroundColor(Colour c) { 142 137 if (_widgetSource != null) { 143 138 super.setBackgroundColor(c); … … 147 142 148 143 @Override 149 public void setBottomShadowColor(Colo r bottom) {150 } 151 152 @Override 153 public void setFillColor(Colo r c) {144 public void setBottomShadowColor(Colour bottom) { 145 } 146 147 @Override 148 public void setFillColor(Colour c) { 154 149 } 155 150 … … 186 181 } 187 182 188 public void setAnchorCornerX(Float anchorLeft, Float anchorRight) { 189 _anchorLeft = anchorLeft; 190 _anchorRight = anchorRight; 191 } 192 193 public void setAnchorCornerY(Float anchorTop, Float anchorBottom) { 194 _anchorTop = anchorTop; 195 _anchorBottom= anchorBottom; 196 } 197 198 @Override 199 public void setAnchorLeft(Float anchor) { 183 public void setAnchorCornerX(Integer anchorLeft, Integer anchorRight) 184 { 185 _anchoring.setLeftAnchor(anchorLeft); 186 _anchoring.setRightAnchor(anchorRight); 187 } 188 189 public void setAnchorCornerY(Integer anchorTop, Integer anchorBottom) 190 { 191 _anchoring.setTopAnchor(anchorTop); 192 _anchoring.setBottomAnchor(anchorBottom); 193 } 194 195 @Override 196 public void setAnchorLeft(Integer anchor) { 200 197 _widgetSource.setAnchorLeft(anchor); 201 _anchorLeft = anchor; 202 _anchorRight = null; 203 } 204 205 @Override 206 public void setAnchorRight(Float anchor) { 198 _anchoring.setLeftAnchor(anchor); 199 } 200 201 @Override 202 public void setAnchorRight(Integer anchor) { 207 203 _widgetSource.setAnchorRight(anchor); 208 _anchorLeft = null; 209 _anchorRight = anchor; 210 } 211 212 @Override 213 public void setAnchorTop(Float anchor) { 204 _anchoring.setRightAnchor(anchor); 205 } 206 207 @Override 208 public void setAnchorTop(Integer anchor) { 214 209 _widgetSource.setAnchorTop(anchor); 215 _anchorTop = anchor; 216 _anchorBottom = null; 217 } 218 219 @Override 220 public void setAnchorBottom(Float anchor) { 210 _anchoring.setTopAnchor(anchor); 211 } 212 213 @Override 214 public void setAnchorBottom(Integer anchor) { 221 215 _widgetSource.setAnchorBottom(anchor); 222 _anchorTop = null; 223 _anchorBottom = anchor; 216 _anchoring.setBottomAnchor(anchor); 224 217 } 225 218 … … 251 244 252 245 @Override 253 public boolean contains( int x, int y) {254 return super.contains(x, y)255 && !_widgetSource.getBounds().contains(x, y);246 public boolean contains(Point p) 247 { 248 return super.contains(p) && !_widgetSource.getBounds().contains(p); 256 249 } 257 250 … … 268 261 269 262 @Override 270 public void setColor(Colo r color) {263 public void setColor(Colour color) { 271 264 if (_widgetSource != null) { 272 265 super.setColor(color); -
trunk/src/org/expeditee/items/widgets/WidgetEdge.java
r919 r1102 19 19 package org.expeditee.items.widgets; 20 20 21 import java.awt.Color;22 import java.awt.Polygon;23 21 import java.util.List; 24 22 23 import org.expeditee.core.Colour; 24 import org.expeditee.core.Point; 25 import org.expeditee.core.bounds.PolygonBounds; 25 26 import org.expeditee.items.Item; 26 27 import org.expeditee.items.Line; … … 28 29 29 30 /** 30 * Widget edges define the bound ries of an interactive widget.31 * Widget edges define the boundaries of an interactive widget. 31 32 * 32 33 * @author Brook Novak … … 34 35 public class WidgetEdge extends Line { 35 36 36 private InteractiveWidget _widgetSource;37 private Widget _widgetSource; 37 38 38 39 WidgetEdge(WidgetCorner start, WidgetCorner end, int id, 39 InteractiveWidget widgetSource) {40 Widget widgetSource) { 40 41 super(start, end, id); 41 42 … … 45 46 } 46 47 47 public InteractiveWidget getWidgetSource() {48 public Widget getWidgetSource() { 48 49 return _widgetSource; 49 50 } … … 89 90 90 91 @Override 91 public void setArrowhead(Polygon arrow) {92 public void setArrowhead(PolygonBounds arrow) { 92 93 } 93 94 … … 101 102 102 103 @Override 103 public void setBottomShadowColor(Colo r bottom) {104 } 105 106 @Override 107 public void setFillColor(Colo r c) {104 public void setBottomShadowColor(Colour bottom) { 105 } 106 107 @Override 108 public void setFillColor(Colour c) { 108 109 } 109 110 … … 121 122 122 123 @Override 123 public void setAnchorTop( Floatanchor) {124 public void setAnchorTop(Integer anchor) { 124 125 _widgetSource.setAnchorTop(anchor); 125 126 } 126 127 127 128 @Override 128 public void setAnchorBottom( Floatanchor) {129 public void setAnchorBottom(Integer anchor) { 129 130 _widgetSource.setAnchorBottom(anchor); 130 131 } 131 132 132 133 @Override 133 public void setAnchorLeft( Floatanchor) {134 public void setAnchorLeft(Integer anchor) { 134 135 _widgetSource.setAnchorLeft(anchor); 135 136 } 136 137 137 138 @Override 138 public void setAnchorRight( Floatanchor) {139 public void setAnchorRight(Integer anchor) { 139 140 _widgetSource.setAnchorRight(anchor); 140 141 } … … 156 157 157 158 @Override 158 public FloatgetAnchorTop() {159 public Integer getAnchorTop() { 159 160 return _widgetSource.getSource().getAnchorTop(); 160 161 } 161 162 162 163 @Override 163 public FloatgetAnchorBottom() {164 public Integer getAnchorBottom() { 164 165 return _widgetSource.getSource().getAnchorBottom(); 165 166 } 166 167 167 168 @Override 168 public FloatgetAnchorLeft() {169 public Integer getAnchorLeft() { 169 170 return _widgetSource.getSource().getAnchorLeft(); 170 171 } 171 172 172 173 @Override 173 public FloatgetAnchorRight() {174 public Integer getAnchorRight() { 174 175 return _widgetSource.getSource().getAnchorRight(); 175 176 } 176 177 177 178 @Override 178 public boolean contains( int x, int y) {179 return super.contains( x, y) && !_widgetSource.getBounds().contains(x, y);180 } 181 182 @Override 183 public Polygon getEnclosedShape() {179 public boolean contains(Point p) { 180 return super.contains(p) && !_widgetSource.getBounds().contains(p); 181 } 182 183 @Override 184 public PolygonBounds getEnclosedShape() { 184 185 return getStartItem().getEnclosedShape(); 185 186 } … … 219 220 220 221 @Override 221 public void setBackgroundColor(Colo r c) {222 public void setBackgroundColor(Colour c) { 222 223 if (_widgetSource != null) { 223 224 super.setBackgroundColor(c); … … 227 228 228 229 @Override 229 public void setColor(Colo r c) {230 public void setColor(Colour c) { 230 231 if (_widgetSource != null) { 231 232 super.setColor(c); -
trunk/src/org/expeditee/items/widgets/charts/AbstractCategory.java
r919 r1102 19 19 package org.expeditee.items.widgets.charts; 20 20 21 import java.awt.Color;22 21 import java.util.Collection; 23 22 23 import org.expeditee.core.Colour; 24 import org.expeditee.gio.swing.SwingConversions; 24 25 import org.expeditee.gui.AttributeValuePair; 25 26 import org.expeditee.items.Text; … … 49 50 Collection<Text> items, boolean swap) { 50 51 boolean foundData = false; 51 Colo r newColor = null;52 Colour newColor = null; 52 53 for (Text i : items) { 53 54 try { … … 61 62 categoryName); 62 63 if (_paints.get(attribute) == null) { 63 _paints.put(attribute, i.getBackgroundColor());64 _paints.put(attribute, SwingConversions.toSwingColor(i.getBackgroundColor())); 64 65 } 65 66 } else { … … 77 78 } 78 79 if (foundData && !swap) { 79 _paints.put(categoryName, newColor);80 _paints.put(categoryName, SwingConversions.toSwingColor(newColor)); 80 81 } 81 82 return foundData; -
trunk/src/org/expeditee/items/widgets/charts/AbstractChart.java
r919 r1102 20 20 21 21 import java.awt.BasicStroke; 22 import java.awt.Color;23 22 import java.awt.Component; 24 23 import java.awt.Font; 25 24 import java.awt.Paint; 26 import java.awt.Point;27 25 import java.awt.event.KeyEvent; 28 26 import java.awt.event.KeyListener; … … 35 33 import javax.swing.JPanel; 36 34 35 import org.expeditee.core.Colour; 36 import org.expeditee.core.Point; 37 import org.expeditee.gio.gesture.StandardGestureActions; 38 import org.expeditee.gio.swing.SwingConversions; 37 39 import org.expeditee.gui.ColorUtils; 40 import org.expeditee.gui.DisplayController; 38 41 import org.expeditee.gui.Frame; 39 42 import org.expeditee.gui.FrameGraphics; 40 43 import org.expeditee.gui.FrameIO; 41 import org.expeditee.gui.FrameKeyboardActions;42 import org.expeditee.gui.FrameMouseActions;43 44 import org.expeditee.gui.FunctionKey; 44 45 import org.expeditee.items.Text; … … 103 104 case SizeUp: 104 105 invalidateLink(); 105 FrameKeyboardActions.SetSize(getFirstCorner(), 1, false, 106 true, false); 106 StandardGestureActions.SetSize(getFirstCorner(), 1, false, true, false); 107 107 invalidateSelf(); 108 FrameGraphics.refresh(true);108 DisplayController.requestRefresh(true); 109 109 // FrameGraphics.requestRefresh(true); 110 110 break; 111 111 case SizeDown: 112 112 invalidateLink(); 113 FrameKeyboardActions.SetSize(getFirstCorner(), -1, false,113 StandardGestureActions.SetSize(getFirstCorner(), -1, false, 114 114 true, false); 115 115 invalidateSelf(); 116 FrameGraphics.refresh(true);116 DisplayController.requestRefresh(true); 117 117 // FrameGraphics.ForceRepaint(); 118 118 // FrameGraphics.refresh(true); … … 125 125 setSourceFillColor(null); 126 126 } else { 127 Colo r newColor = ColorUtils.getNextColor(127 Colour newColor = ColorUtils.getNextColor( 128 128 getSource().getFillColor(), 129 129 TemplateSettings.BackgroundColorWheel.get(), null); … … 134 134 setBackgroundColor(null); 135 135 } else { 136 Colo r newColor = ColorUtils.getNextColor(136 Colour newColor = ColorUtils.getNextColor( 137 137 getSource().getColor(), TemplateSettings.ColorWheel.get(), 138 138 null); … … 141 141 } 142 142 break; 143 default: 144 break; 143 145 } 144 146 } … … 148 150 149 151 public void keyTyped(KeyEvent e) { 150 FrameKeyboardActions.processChar(e.getKeyChar(), e152 StandardGestureActions.processChar(e.getKeyChar(), e 151 153 .isShiftDown()); 152 154 } … … 155 157 156 158 public void mouseClicked(MouseEvent e) { 157 FrameMouseActions.getInstance().mouseClicked(translateEvent(e));159 //StandardGestureActions.mouseClicked(translateEvent(e)); 158 160 } 159 161 … … 167 169 168 170 public void mousePressed(MouseEvent e) { 169 FrameMouseActions.getInstance().mousePressed(translateEvent(e));171 //StandardGestureActions.mousePressed(translateEvent(e)); 170 172 } 171 173 … … 180 182 181 183 public void mouseReleased(MouseEvent e) { 182 FrameMouseActions.getInstance() 183 .mouseReleased(translateEvent(e)); 184 //StandardGestureActions.mouseReleased(translateEvent(e)); 184 185 } 185 186 … … 272 273 if (foundData |= addCategoryData(categoryName, linkFrame 273 274 .getNonAnnotationText(true), swap)) { 274 Colo r backgroundColor = category.getBackgroundColor();275 Colour backgroundColor = category.getBackgroundColor(); 275 276 if (backgroundColor != null) 276 _paints.put(categoryName, backgroundColor);277 _paints.put(categoryName, SwingConversions.toSwingColor(backgroundColor)); 277 278 addSubject(linkFrame); 278 279 } … … 307 308 308 309 @Override 309 public void setBackgroundColor(Colo r c) {310 public void setBackgroundColor(Colour c) { 310 311 super.setBackgroundColor(c); 311 312 if (_chart == null) … … 314 315 _chart.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT); 315 316 } else { 316 _chart.setBackgroundPaint( c);317 } 318 } 319 320 @Override 321 public void setSourceColor(Colo r c) {317 _chart.setBackgroundPaint(SwingConversions.toSwingColor(c)); 318 } 319 } 320 321 @Override 322 public void setSourceColor(Colour c) { 322 323 super.setSourceColor(c); 323 324 if (_chart == null) … … 326 327 _chart.getTitle().setPaint(TextTitle.DEFAULT_TEXT_PAINT); 327 328 } else { 328 _chart.getTitle().setPaint( c);329 _chart.getTitle().setPaint(SwingConversions.toSwingColor(c)); 329 330 } 330 331 for (Title t : _chart.getSubtitles()) { … … 332 333 t.setPaint(TextTitle.DEFAULT_TEXT_PAINT); 333 334 } else { 334 t.setPaint( c);335 t.setPaint(SwingConversions.toSwingColor(c)); 335 336 } 336 337 } … … 338 339 if (legend != null) { 339 340 if (c == null) { 340 legend.setFrame(new BlockBorder( Color.black));341 legend.setFrame(new BlockBorder(SwingConversions.toSwingColor(Colour.BLACK))); 341 342 } else { 342 legend.setFrame(new BlockBorder( c));343 } 344 } 345 } 346 347 @Override 348 public void setSourceBorderColor(Colo r c) {343 legend.setFrame(new BlockBorder(SwingConversions.toSwingColor(c))); 344 } 345 } 346 } 347 348 @Override 349 public void setSourceBorderColor(Colour c) { 349 350 super.setSourceBorderColor(c); 350 351 if (_chart == null) … … 353 354 _chart.getPlot().setOutlinePaint(Plot.DEFAULT_OUTLINE_PAINT); 354 355 } else { 355 _chart.getPlot().setOutlinePaint( c);356 } 357 } 358 359 @Override 360 public void setSourceFillColor(Colo r c) {356 _chart.getPlot().setOutlinePaint(SwingConversions.toSwingColor(c)); 357 } 358 } 359 360 @Override 361 public void setSourceFillColor(Colour c) { 361 362 super.setSourceFillColor(c); 362 363 if (_chart == null) … … 368 369 legend.setBackgroundPaint(null); 369 370 } else { 370 _chart.getPlot().setBackgroundPaint( c);371 _chart.getPlot().setBackgroundPaint(SwingConversions.toSwingColor(c)); 371 372 if (legend != null) 372 legend.setBackgroundPaint( c);373 legend.setBackgroundPaint(SwingConversions.toSwingColor(c)); 373 374 } 374 375 } … … 387 388 if (legend != null) { 388 389 legend.setFrame(new BlockBorder(newThickness, newThickness, 389 newThickness, newThickness, getSource().getPaintColor()));390 newThickness, newThickness, SwingConversions.toSwingColor(getSource().getPaintColor()))); 390 391 legend.setItemFont(legend.getItemFont().deriveFont(fontSize)); 391 392 float pad = newThickness + 1; -
trunk/src/org/expeditee/items/widgets/charts/AbstractPie.java
r919 r1102 20 20 21 21 import java.awt.BasicStroke; 22 import java.awt.Color;23 22 23 import org.expeditee.core.Colour; 24 import org.expeditee.gio.swing.SwingConversions; 24 25 import org.expeditee.gui.AttributeValuePair; 25 26 import org.expeditee.gui.Frame; … … 85 86 try { 86 87 _data.setValue(avp.getAttribute(), avp.getDoubleValue()); 87 _paints.put(avp.getAttribute(), t.getBackgroundColor());88 _paints.put(avp.getAttribute(), SwingConversions.toSwingColor(t.getBackgroundColor())); 88 89 } catch (NumberFormatException nfe) { 89 90 … … 94 95 95 96 @Override 96 public void setSourceBorderColor(Colo r c) {97 public void setSourceBorderColor(Colour c) { 97 98 super.setSourceBorderColor(c); 98 99 if (getChart() == null) … … 106 107 plot.setShadowPaint(PiePlot.DEFAULT_SHADOW_PAINT); 107 108 } else { 108 plot.setBaseSectionOutlinePaint( c);109 plot.setLabelLinkPaint( c);110 plot.setLabelOutlinePaint( c);111 Colo r newC = c.darker();112 Colo r faded = new Color(newC.getRed(), newC.getGreen(), newC113 .getBlue(), 128);109 plot.setBaseSectionOutlinePaint(SwingConversions.toSwingColor(c)); 110 plot.setLabelLinkPaint(SwingConversions.toSwingColor(c)); 111 plot.setLabelOutlinePaint(SwingConversions.toSwingColor(c)); 112 Colour newC = c.darker(); 113 Colour faded = new Colour(newC.getRed(), newC.getGreen(), newC 114 .getBlue(), Colour.FromComponent255(128)); 114 115 115 plot.setLabelShadowPaint( faded);116 plot.setShadowPaint( c);116 plot.setLabelShadowPaint(SwingConversions.toSwingColor(faded)); 117 plot.setShadowPaint(SwingConversions.toSwingColor(c)); 117 118 } 118 119 } 119 120 120 121 @Override 121 public void setSourceColor(Colo r c) {122 public void setSourceColor(Colour c) { 122 123 super.setSourceColor(c); 123 124 if (getChart() == null) … … 127 128 plot.setLabelPaint(PiePlot.DEFAULT_LABEL_PAINT); 128 129 } else { 129 plot.setLabelPaint( c);130 plot.setLabelPaint(SwingConversions.toSwingColor(c)); 130 131 } 131 132 } -
trunk/src/org/expeditee/items/widgets/charts/AbstractValueAxis.java
r919 r1102 20 20 21 21 import java.awt.BasicStroke; 22 import java.awt.Color;23 22 import java.awt.Stroke; 24 23 24 import org.expeditee.core.Colour; 25 import org.expeditee.gio.swing.SwingConversions; 25 26 import org.expeditee.gui.Frame; 26 27 import org.expeditee.items.Text; … … 56 57 57 58 @Override 58 public void setSourceColor(Colo r c) {59 public void setSourceColor(Colour c) { 59 60 super.setSourceColor(c); 60 61 if (getChart() == null) … … 70 71 .setTickLabelPaint(Axis.DEFAULT_TICK_LABEL_PAINT); 71 72 } else { 72 plot.getDomainAxis().setLabelPaint( c);73 plot.getRangeAxis().setLabelPaint( c);74 plot.getDomainAxis().setTickLabelPaint( c);75 plot.getRangeAxis().setTickLabelPaint( c);73 plot.getDomainAxis().setLabelPaint(SwingConversions.toSwingColor(c)); 74 plot.getRangeAxis().setLabelPaint(SwingConversions.toSwingColor(c)); 75 plot.getDomainAxis().setTickLabelPaint(SwingConversions.toSwingColor(c)); 76 plot.getRangeAxis().setTickLabelPaint(SwingConversions.toSwingColor(c)); 76 77 } 77 78 } 78 79 79 80 @Override 80 public void setSourceBorderColor(Colo r c) {81 public void setSourceBorderColor(Colour c) { 81 82 super.setSourceBorderColor(c); 82 83 if (getChart() == null) … … 89 90 plot.getRangeAxis().setTickMarkPaint(Plot.DEFAULT_OUTLINE_PAINT); 90 91 } else { 91 Colo r brighter = c.brighter();92 plot.setDomainGridlinePaint( brighter);93 plot.setRangeGridlinePaint( brighter);94 plot.getDomainAxis().setTickMarkPaint( c);95 plot.getRangeAxis().setTickMarkPaint( c);92 Colour brighter = c.brighter(); 93 plot.setDomainGridlinePaint(SwingConversions.toSwingColor(brighter)); 94 plot.setRangeGridlinePaint(SwingConversions.toSwingColor(brighter)); 95 plot.getDomainAxis().setTickMarkPaint(SwingConversions.toSwingColor(c)); 96 plot.getRangeAxis().setTickMarkPaint(SwingConversions.toSwingColor(c)); 96 97 } 97 98 } -
trunk/src/org/expeditee/items/widgets/charts/AbstractXY.java
r919 r1102 19 19 package org.expeditee.items.widgets.charts; 20 20 21 import java.awt.Color;22 21 import java.util.Collection; 23 22 import java.util.HashSet; 24 23 24 import org.expeditee.core.Colour; 25 import org.expeditee.gio.swing.SwingConversions; 25 26 import org.expeditee.gui.AttributeValuePair; 26 27 import org.expeditee.items.Item; … … 55 56 Collection<Text> items, boolean swap) { 56 57 XYSeries newSeries = new XYSeries(categoryName); 57 Colo r categoryColor = null;58 Colour categoryColor = null; 58 59 boolean foundData = false; 59 60 Collection<Item> seen = new HashSet<Item>(); … … 123 124 if (foundData) { 124 125 _data.addSeries(newSeries); 125 _paints.put(categoryName, categoryColor);126 _paints.put(categoryName, SwingConversions.toSwingColor(categoryColor)); 126 127 } 127 128 return foundData; -
trunk/src/org/expeditee/items/widgets/charts/Polar.java
r919 r1102 19 19 package org.expeditee.items.widgets.charts; 20 20 21 import java.awt.Color;22 21 import org.expeditee.core.Colour; 22 import org.expeditee.gio.swing.SwingConversions; 23 23 import org.expeditee.items.Text; 24 24 import org.jfree.chart.ChartFactory; … … 43 43 44 44 @Override 45 public void setSourceColor(Colo r c) {45 public void setSourceColor(Colour c) { 46 46 super.setSourceColor(c); 47 47 if (getChart() == null) … … 53 53 plot.setAngleLabelPaint(Axis.DEFAULT_AXIS_LABEL_PAINT); 54 54 } else { 55 plot.setAngleLabelPaint( c);55 plot.setAngleLabelPaint(SwingConversions.toSwingColor(c)); 56 56 } 57 57 } -
trunk/src/org/expeditee/items/widgets/charts/TimeSeries.java
r919 r1102 19 19 package org.expeditee.items.widgets.charts; 20 20 21 import java.awt.Color;22 21 import java.text.DateFormat; 23 22 import java.text.ParseException; … … 27 26 import java.util.Date; 28 27 28 import org.expeditee.Util; 29 import org.expeditee.core.Colour; 30 import org.expeditee.gio.swing.SwingConversions; 29 31 import org.expeditee.gui.AttributeValuePair; 30 32 import org.expeditee.gui.Frame; … … 100 102 String startDateString = dataFrame.getAnnotationValue("start"); 101 103 if (startDateString != null) { 102 _startDate = parseDate(startDateString);104 _startDate = Util.parseDate(startDateString); 103 105 } 104 106 } catch (Exception e) { … … 135 137 136 138 boolean foundData = false; 137 Colo r newColor = null;139 Colour newColor = null; 138 140 for (Text i : items) { 139 141 if (!i.isLineEnd()) { … … 157 159 RegularTimePeriod rtp = null; 158 160 if (attribute == null) { 159 Date date = parseDate(avp.getAttribute());161 Date date = Util.parseDate(avp.getAttribute()); 160 162 rtp = _periodType.getConstructor( 161 163 new Class[] { Date.class }).newInstance( … … 212 214 if (foundData) { 213 215 _data.addSeries(newSeries); 214 _paints.put(categoryName, newColor);216 _paints.put(categoryName, SwingConversions.toSwingColor(newColor)); 215 217 } 216 218 return foundData; 217 219 } 218 219 /**220 * @param avp221 * @return222 * @throws ParseException223 */224 public static Date parseDate(String dateString) throws ParseException {225 // Select the best match for a date or time format226 DateFormat df = null;227 if (dateString.length() > Formatter.DATE_FORMAT228 .length()) {229 df = new SimpleDateFormat(Formatter.DATE_TIME_FORMAT);230 } else if (dateString.length() <= Formatter.TIME_FORMAT.length()) {231 df = new SimpleDateFormat(Formatter.TIME_FORMAT);232 }else {233 df = new SimpleDateFormat(Formatter.DATE_FORMAT);234 }235 Date date = df.parse(dateString);236 return date;237 }238 220 }
Note:
See TracChangeset
for help on using the changeset viewer.