Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

Location:
trunk/src/org/expeditee/items/widgets
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/ButtonWidget.java

    r1005 r1102  
    11package org.expeditee.items.widgets;
    22import java.awt.BorderLayout;
    3 import java.awt.Color;
    43import java.awt.Dimension;
    54import java.net.URL;
     
    98import javax.swing.border.EmptyBorder;
    109
     10import org.expeditee.core.Colour;
     11import org.expeditee.gio.swing.SwingConversions;
    1112import org.expeditee.items.Text;
    1213
     
    1415
    1516//Will be the default class for Rubbish Bin, Reset and Undo Button Widgets
    16 public class ButtonWidget extends InteractiveWidget{
    17 
     17public class ButtonWidget extends SwingWidget
     18{
    1819        protected JButton clicked_ = new JButton("");   
    1920        protected SVGIcon icon_ = null;
    20        
     21
    2122        public ButtonWidget(int dimension, String filePath, Text source, String[] args)
    2223        {
     
    2526                               
    2627                clicked_.setBorder(new EmptyBorder(0, 0, 0, 0));
    27                 clicked_.setBackground(Color.white);
     28                clicked_.setBackground(SwingConversions.toSwingColor(Colour.WHITE));
    2829               
    2930                Dimension size = new Dimension(dimension, dimension);
    3031                icon_ = new SVGIcon();
    31                 try{
     32               
     33                try {
    3234                        URL imageURL = ClassLoader.getSystemResource(filePath);         
    3335                        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.
    3537                        icon_.setUseAntiAlias(true);
    3638                        icon_.setScaleToFit(true);
     
    3941                        _swingComponent.add(clicked_);
    4042                        this.setWidgetEdgeThickness(0.0f);
    41                         this.setWidgetEdgeColor(Color.white);   
    42                 }
    43                 catch(Exception e){
    44                        
     43                        this.setWidgetEdgeColor(Colour.WHITE); 
     44                } catch(Exception e) {
    4545                        //Set a default image if image is missing
    4646                        System.out.println("Unable to load image from directory");                     
     
    4949
    5050        @Override
    51         protected String[] getArgs() {
     51        protected String[] getArgs()
     52        {
    5253                // TODO Auto-generated method stub
    5354                return null;
    5455        }
    55         public boolean itemHeldWhileClicked(InteractiveWidget bw) {
     56       
     57        public boolean itemHeldWhileClicked(Widget bw)
     58        {
    5659                // TODO Auto-generated method stub
    5760                return false;
    5861        }
    59         public boolean getdropInteractableStatus(){
     62       
     63        public boolean getdropInteractableStatus()
     64        {
    6065                return false;
    6166        }
    6267
    6368        @Override
    64         boolean setPositions(WidgetCorner src, float x, float y) {
     69        public boolean setPositions(WidgetCorner src, float x, float y)
     70        {
    6571                boolean result = super.setPositions(src, x, y);
    6672
  • trunk/src/org/expeditee/items/widgets/DataFrameWidget.java

    r919 r1102  
    1919package org.expeditee.items.widgets;
    2020
    21 import java.awt.Color;
    22 import java.awt.Graphics;
    2321import java.util.Collection;
    2422import java.util.HashSet;
     
    2624import javax.swing.JComponent;
    2725
    28 import org.expeditee.gui.DisplayIO;
     26import org.expeditee.core.Colour;
     27import org.expeditee.core.Point;
     28import org.expeditee.gio.EcosystemManager;
     29import org.expeditee.gio.GraphicsManager;
     30import org.expeditee.gui.DisplayController;
    2931import org.expeditee.gui.Frame;
    3032import org.expeditee.gui.FrameIO;
     
    3436import org.expeditee.items.Text;
    3537
    36 public abstract class DataFrameWidget extends InteractiveWidget implements
     38public abstract class DataFrameWidget extends SwingWidget implements
    3739                FrameObserver {
    3840
     
    118120        public void update() {
    119121                Frame parent = getParentFrame();
    120                 if (parent != null && parent == DisplayIO.getCurrentFrame()) {
     122                if (parent != null && parent == DisplayController.getCurrentFrame()) {
    121123                        refresh();
    122124                }
     
    166168        }
    167169
    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);
    173175
    174176        }
  • trunk/src/org/expeditee/items/widgets/HeavyDutyInteractiveWidget.java

    r1046 r1102  
    1919package org.expeditee.items.widgets;
    2020
    21 import java.awt.Color;
    2221import java.awt.Font;
    2322import java.awt.FontMetrics;
     
    3332import javax.swing.SwingUtilities;
    3433
     34import org.expeditee.core.Colour;
     35import org.expeditee.gio.swing.SwingConversions;
     36import org.expeditee.gio.swing.SwingGraphicsManager;
     37import org.expeditee.gio.swing.SwingMiscManager;
    3538import org.expeditee.gui.Browser;
    36 import org.expeditee.gui.DisplayIO;
    37 import org.expeditee.gui.FrameGraphics;
     39import org.expeditee.gui.DisplayController;
    3840import org.expeditee.gui.FreeItems;
    3941import org.expeditee.items.Item;
     
    5355 * until expeditee allocates a thread to begin loading. The swing component is set as not-visible.
    5456 *
    55  * At the the loading stage, a loadable widget proccesses its load task and renders a
     57 * At the the loading stage, a loadable widget processes its load task and renders a
    5658 * load message/bar.
    5759 *
     
    5961 *
    6062 * When a HeavyDutyInteractiveWidget becomes visible / is anchored, it will register itself for saving at the next
    61  * save point according to SaveEntityManager. Heavey duty widgets will only save at the save points
     63 * save point according to SaveEntityManager. Heavy duty widgets will only save at the save points
    6264 * if the widget still belongs to a frame (i.e. is not removed) and is anchored.
    6365 *
    64  * Heavey duty widgets can also have an expiry on how long they should stay cached for. If they do have an
     66 * Heavy duty widgets can also have an expiry on how long they should stay cached for. If they do have an
    6567 * expiry then it they unload once expired, and will re-load once in view again. Must take care for
    6668 * unloadable widgets because you must check your unloadable elements to whether they are unloaded or not
    67  * every time your widget accessess them.
     69 * every time your widget accesses them.
    6870 *
    6971 * When a heavy duty widget is deleted - any data consuming memory can be dumped temporarily if needed.
     
    7274 *
    7375 */
    74 public abstract class HeavyDutyInteractiveWidget extends InteractiveWidget implements LoadableEntity, SaveableEntity {
     76public abstract class HeavyDutyInteractiveWidget extends SwingWidget implements LoadableEntity, SaveableEntity {
    7577       
    7678        /** load finished */
     
    9092        private static final String PENDING_MESSAGE = "Pending";
    9193       
    92         private static final Color LOAD_BAR_PROGRESS_COLOR = new Color(103, 171, 203);
    93         private static final Color LOAD_BAR_INDETERM_COLOR = Color.ORANGE;
    94         private static final Color LOAD_BAR_HIGHLIGHT_COLOR = new Color(240, 240, 240);
    95         private static final Color LOAD_SCREEN_COLOR = Color.LIGHT_GRAY;
    96         private static final Color 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;
    9799       
    98100        private static final Font LOAD_NORMAL_FONT = new Font("Arial", Font.BOLD, 12);
     
    140142         */
    141143        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        {
    143146                super(source, component, minWidth, maxWidth, minHeight, maxHeight);
    144147               
     
    173176         *
    174177         * @param percent
    175          *              Must be between 0.0 and 1.0 inclusive for percentage. Or neagtive if indeterminant.
     178         *              Must be between 0.0 and 1.0 inclusive for percentage. Or negative if indeterminate.
    176179         *
    177180         * @throws IllegalArgumentException
     
    182185         *             
    183186         */
    184         protected final void updateLoadPercentage(float percent) {
     187        protected final void updateLoadPercentage(float percent)
     188        {
    185189                if (percent > 1.0f)
    186190                        throw new IllegalArgumentException("loadState is larger than 1.0");
     
    199203         * @return The current load state.
    200204         */
    201         protected float getLoadState() {
     205        protected float getLoadState()
     206        {
    202207                return loadState;
    203208        }
     
    206211         * @return True if in a loading phase.
    207212         */
    208         protected boolean isInLoadProgress() {
     213        protected boolean isInLoadProgress()
     214        {
    209215                return loadState <= 1.0f;
    210216        }
     
    226232               
    227233                // Re-render loading state
    228                 FrameGraphics.invalidateArea(_swingComponent.getBounds());
    229                 FrameGraphics.requestRefresh(true);
     234                DisplayController.invalidateArea(getBounds());
     235                DisplayController.requestRefresh(true);
    230236        }
    231237       
    232238        @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);
    236242        }
    237243
    238244        @Override
    239         public void paint(Graphics g) {
     245        protected final void paintSwingWidget(Graphics2D g)
     246        {
    240247                if (loadState == LOAD_STATE_COMPLETED) {
    241                         super.paint(g);
     248                        paintHeavyDutyWidget(g);
    242249                } 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
    251263         *
    252264         * @param g
    253265         */
    254         private void paintLoadScreen(Graphics g, Color backgroundColor) {
     266        private void paintLoadScreen(Colour backgroundColor) {
    255267
    256268                if (Browser._theBrowser == null) return;
    257269               
     270                SwingGraphicsManager manager = SwingMiscManager.getIfUsingSwingGraphicsManager();
     271                Graphics g = manager.getCurrentSurface();
     272               
    258273                // Render shaded window over widget
    259                 g.setColor(backgroundColor);
     274                g.setColor(SwingConversions.toSwingColor(backgroundColor));
    260275                g.fillRect(getX(), getY(), getWidth(), getHeight());
    261276               
     
    291306                Rectangle tmpClip = (clipBackUp != null) ? clipBackUp.getBounds() :
    292307                        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())));
    297312       
    298313               
     
    300315
    301316                        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));
    304319                        ((Graphics2D)g).setPaint(gp);
    305320               
     
    311326                       
    312327                        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));
    315330                        ((Graphics2D)g).setPaint(gp);
    316331                       
     
    319334                }
    320335               
    321                 g.setColor(Color.DARK_GRAY);
     336                g.setColor(SwingConversions.toSwingColor(Colour.DARK_GREY));
    322337                g.drawRect(barX, barY, barWidth, BAR_HEIGHT);
    323338               
    324339                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));
    328343               
    329344
     
    638653                        // Re-render loading state - if not expired
    639654                        if (!expired) {
    640                                 FrameGraphics.invalidateArea(new Rectangle(getX(), getY(), getWidth(), getHeight()));
    641                                 FrameGraphics.requestRefresh(true);
     655                                DisplayController.invalidateArea(getBounds());
     656                                DisplayController.requestRefresh(true);
    642657                        }
    643658                }
     
    680695                       
    681696                        // Only load if in view
    682                         if (!isFloating() && getParentFrame() != DisplayIO.getCurrentFrame())
     697                        if (!isFloating() && getParentFrame() != DisplayController.getCurrentFrame())
    683698                                return;
    684699                       
  • trunk/src/org/expeditee/items/widgets/JSWidget.java

    r1080 r1102  
    3232import javax.swing.JPanel;
    3333
    34 import org.expeditee.gui.DisplayIO;
     34import org.expeditee.gui.DisplayController;
    3535import org.expeditee.items.ItemParentStateChangedEvent;
    3636import org.expeditee.items.JSThreadable;
     
    7575   
    7676        private static Text getSauce() {
    77                 Text source = new Text(DisplayIO.getCurrentFrame().getNextItemID(), "@iw: org.expeditee.items.widgets.JSWidget");
    78                 source.setParent(DisplayIO.getCurrentFrame());
     77                Text source = new Text(DisplayController.getCurrentFrame().getNextItemID(), "@iw: org.expeditee.items.widgets.JSWidget");
     78                source.setParent(DisplayController.getCurrentFrame());
    7979                return source;
    8080        }
     
    172172   
    173173    @Override
    174         protected void paintLink(Graphics2D g) {
     174        protected void paintLink() {
    175175        return;
    176176        }
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r1060 r1102  
    7676import netscape.javascript.JSObject;
    7777
    78 import org.expeditee.gui.DisplayIO;
    79 import org.expeditee.gui.FrameMouseActions;
     78import org.expeditee.gio.gesture.StandardGestureActions;
     79import org.expeditee.gio.swing.SwingConversions;
     80import org.expeditee.gui.DisplayController;
    8081import org.expeditee.gui.FreeItems;
    8182import org.expeditee.gui.MessageBay;
     
    468469                                public void handle(KeyEvent e) {
    469470                                        // Hiding the cursor when typing, to be more Expeditee-like
    470                                         DisplayIO.setCursor(org.expeditee.items.Item.HIDDEN_CURSOR);
     471                                        DisplayController.setCursor(org.expeditee.items.Item.HIDDEN_CURSOR);
    471472                                }
    472473                        });
     
    481482                                        }
    482483                                        // Checking if the user has been typing - if so, move the cursor to the caret position
    483                                         if (DisplayIO.getCursor() == Item.HIDDEN_CURSOR) {
    484                                                 DisplayIO.setCursor(org.expeditee.items.Item.TEXT_CURSOR);
    485                                                 DisplayIO.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)));
    486487                                        } else {
    487488                                                // Otherwise, move the caret to the cursor location
     
    523524                public void changed(ObservableValue<? extends Boolean> property, Boolean oldValue, Boolean newValue) {
    524525                                        if(newValue.booleanValue()) {
    525                                                 DisplayIO.setCursor(org.expeditee.items.Item.TEXT_CURSOR);
     526                                                DisplayController.setCursor(org.expeditee.items.Item.TEXT_CURSOR);
    526527                                        } else {
    527528                                                // Restoring the standard cursor, since it is changed to a text cursor when focus is gained
    528                                                 DisplayIO.setCursor(org.expeditee.items.Item.DEFAULT_CURSOR);
     529                                                DisplayController.setCursor(org.expeditee.items.Item.DEFAULT_CURSOR);
    529530                                        }
    530531                }
     
    545546                                        if (e.getButton() == MouseButton.SECONDARY) {
    546547                                                // Right mouse button released, so copy the selection (i.e. don't remove the original)
    547                                                 item = DisplayIO.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());
    548                                                 FrameMouseActions.pickup(item);
     548                                                item = DisplayController.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());
     549                                                StandardGestureActions.pickup(item);
    549550                                        } else if (e.getButton() == MouseButton.MIDDLE) {
    550551                                                // Middle mouse button released, so copy the selection then remove it from the URL field
    551                                                 item = DisplayIO.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());
     552                                                item = DisplayController.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());
    552553                                                JfxBrowser.this._urlField.setText(
    553554                                                                JfxBrowser.this._urlField.getText().substring(0, JfxBrowser.this._urlField.getSelection().getStart())
     
    555556                                                                                JfxBrowser.this._urlField.getText().length()));
    556557
    557                                                 FrameMouseActions.pickup(item);
     558                                                StandardGestureActions.pickup(item);
    558559                                        }
    559560                }
     
    660661                                                                       
    661662                                                                        if (((String) style.call("getPropertyValue", new Object[] { "background-image" })).startsWith("url(")) {
    662                                                                                 pic = WebParser.getBackgroundImageFromNode(node, style, DisplayIO.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);
    664665                                                                               
    665666                                                                        } else {
     
    667668                                                                                if(node.getNodeName().toLowerCase().equals("img") &&
    668669                                                                                                (imgSrc = ((JSObject) node).getMember("src").toString()) != null) {
    669                                                                                         pic = WebParser.getImageFromUrl(imgSrc, null, DisplayIO.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);
    671672                                                                                } else {
    672673                                                                                        return;
     
    685686                                                                        }
    686687                                                                       
    687                                                                         pic.setXY(FrameMouseActions.getX(), FrameMouseActions.getY());
    688                                                 FrameMouseActions.pickup(pic);
     688                                                                        pic.setXY(DisplayController.getMouseX(), DisplayController.getMouseY());
     689                                                StandardGestureActions.pickup(pic);
    689690                                        } catch (Exception e1) {
    690691                                        // TODO Auto-generated catch block
     
    714715                                                                                        + ((JSObject)node).getMember("height")
    715716                                                                                        + ":" + src);
    716                                                                         t.setParent(DisplayIO.getCurrentFrame());
    717                                                                         t.setXY(FrameMouseActions.getX(), FrameMouseActions.getY());
     717                                                                        t.setParent(DisplayController.getCurrentFrame());
     718                                                                        t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY());
    718719                                                                        JfxMedia media = new JfxMedia(t, new String[] { src });
    719                                                                         FrameMouseActions.pickup(media.getItems());
     720                                                                        StandardGestureActions.pickup(media.getItems());
    720721                                                                       
    721722                                                                } else if(node.getNodeName().toLowerCase().equals("a") && ((JSObject)node).getMember("href") != null) {
    722723                                                                        // If a link is right clicked, copy the text content and give it an action to create
    723724                                                                        // a new frame containing a browser pointing to the linked page
    724                                                                         Text t = DisplayIO.getCurrentFrame().createNewText(((String) ((JSObject)node).getMember("textContent")).trim());
     725                                                                        Text t = DisplayController.getCurrentFrame().createNewText(((String) ((JSObject)node).getMember("textContent")).trim());
    725726                                                                        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);
    728729                                                                }
    729730                                                        }
    730731                                                } else {
    731732                                                        // Copy text and attach to cursor
    732                                                         Text t = DisplayIO.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);
    735736                                                }
    736737                                        }
     
    871872        public void getFrame() {
    872873                try {
    873                         WebParser.parsePageSimple(this, _webEngine, _webView, DisplayIO.getCurrentFrame());
     874                        WebParser.parsePageSimple(this, _webEngine, _webView, DisplayController.getCurrentFrame());
    874875                } catch (Exception e) {
    875876                        e.printStackTrace();
     
    886887                        new Thread(new Runnable() {
    887888                                public void run() {
    888                                         WebParser.parsePageSimple(JfxBrowser.this, JfxBrowser.this._webEngine, JfxBrowser.this._webView, DisplayIO.getCurrentFrame());
     889                                        WebParser.parsePageSimple(JfxBrowser.this, JfxBrowser.this._webEngine, JfxBrowser.this._webView, DisplayController.getCurrentFrame());
    889890                                }
    890891                        }).start();
     
    954955                }
    955956
    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();
    957958                if(!this._urlField.getBoundsInParent().contains(x, y)) {
    958959                        // fails if not clicking on urlField
  • trunk/src/org/expeditee/items/widgets/MemoryMonitor.java

    r919 r1102  
    1919package org.expeditee.items.widgets;
    2020
    21 import java.awt.Color;
    2221import java.awt.Font;
    2322import java.awt.Graphics;
     
    2726import javax.swing.SwingUtilities;
    2827
     28import org.expeditee.core.Colour;
     29import org.expeditee.gio.swing.SwingConversions;
     30import org.expeditee.gio.swing.SwingMiscManager;
    2931import org.expeditee.items.ItemParentStateChangedEvent;
    3032import org.expeditee.items.Text;
     
    3638 *
    3739 */
    38 public class MemoryMonitor extends InteractiveWidget {
     40public class MemoryMonitor extends SwingWidget {
    3941       
    4042        private long totalMemoryInBytes;
     
    6365       
    6466        @Override
    65         public void paint(Graphics g) {
    66                
     67        public void paintSwingWidget(Graphics2D g)
     68        {
    6769                int height = getHeight();
    6870                int width = getWidth();
     
    7072                int memHeight = (int)(height * currentMemoryUsage);
    7173               
    72                 Color memColor;
     74                Colour memColor;
    7375                if (currentMemoryUsage > 0.8f) {
    74                         memColor = Color.RED;
     76                        memColor = Colour.RED;
    7577                } else if (currentMemoryUsage > 0.5f) {
    76                         memColor = Color.ORANGE;
     78                        memColor = Colour.ORANGE;
    7779                } else  {
    78                         memColor = Color.GREEN;
     80                        memColor = Colour.GREEN;
    7981                }
    8082               
    81                 g.setColor(memColor);
     83                g.setColor(SwingConversions.toSwingColor(memColor));
    8284                g.fillRect(getX(), getY() + height - memHeight, width, memHeight);
    8385               
    84                 g.setColor(Color.WHITE);
     86                g.setColor(SwingConversions.toSwingColor(Colour.WHITE));
    8587                g.fillRect(getX(), getY(), width, height - memHeight);
    8688               
    8789                int percent = (int)(currentMemoryUsage * 100.0f);
    8890               
    89                 g.setColor(Color.BLACK);
     91                g.setColor(SwingConversions.toSwingColor(Colour.BLACK));
    9092                g.setFont(USAGE_FONT);
    9193                g.drawString(percent + "%", getX() + 12, getY() + (height / 2) + 8);
    92                
    93                 paintLink((Graphics2D)g);
    9494        }
    9595
  • trunk/src/org/expeditee/items/widgets/Password.java

    r919 r1102  
    3232 * @author jts21
    3333 */
    34 public class Password extends InteractiveWidget {
     34public class Password extends SwingWidget {
    3535
    3636        private JPasswordField passwordField;
  • trunk/src/org/expeditee/items/widgets/RefreshButton.java

    r1005 r1102  
    44import java.awt.event.ActionListener;
    55
    6 import org.expeditee.gui.DisplayIO;
     6import org.expeditee.gui.DisplayController;
    77import org.expeditee.gui.Frame;
    88import org.expeditee.gui.FrameGraphics;
     
    2020                public void actionPerformed(ActionEvent e) {                   
    2121                 
    22                    Frame f = DisplayIO.getCurrentFrame();         
     22                   Frame f = DisplayController.getCurrentFrame();         
    2323                   try{
    2424                           FrameIO.ForceSaveFrame(f);
    2525                           Frame g = FrameIO.LoadRestoreFrame(f);       
    26                            DisplayIO.setCurrentFrame(g, false);
    27                            FrameGraphics.refresh(true);
     26                           DisplayController.setCurrentFrame(g, false);
     27                           DisplayController.requestRefresh(true);
    2828                   }
    2929                   catch(Exception e1){
  • trunk/src/org/expeditee/items/widgets/RubbishBin.java

    r1005 r1102  
    44import java.awt.event.ActionListener;
    55
    6 import org.expeditee.gui.DisplayIO;
    7 import org.expeditee.gui.FrameMouseActions;
     6import org.expeditee.gio.gesture.StandardGestureActions;
     7import org.expeditee.gui.DisplayController;
    88import org.expeditee.gui.FreeItems;
    99import org.expeditee.items.Item;
    1010import org.expeditee.items.Text;
    1111
    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 */
     18public class RubbishBin extends ButtonWidget
     19{       
     20        public RubbishBin(Text source, String[] args)
     21        {
    1722                super(80, "org/expeditee/assets/images/bin.svg", source, args);
    1823
    19                 clicked_.addActionListener(new ActionListener() {
    20                 public void actionPerformed(ActionEvent e) {   
     24                clicked_.addActionListener(new ActionListener()
     25                {
     26                public void actionPerformed(ActionEvent e)
     27                {       
    2128                       
    2229                }         
    23              });               
     30                });             
    2431        }
    25         public boolean ItemsLeftClickDropped() {
    26                
     32       
     33        public boolean ItemsLeftClickDropped()
     34        {
    2735                //Find what the mouse was holding at the time and delete it
    2836                Item freeItems = FreeItems.getItemAttachedToCursor();
    29                 if( freeItems != null){
    30                         freeItems.setParent(DisplayIO.getCurrentFrame());
     37               
     38                if( freeItems != null) {
     39                        freeItems.setParent(DisplayController.getCurrentFrame());
    3140                       
    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) {
    3844                                e.printStackTrace();
    3945                        }                       
    4046                }
     47               
    4148                return true;
    4249        }
    4350       
    4451        @Override
    45         protected String[] getArgs() {
     52        protected String[] getArgs()
     53        {
    4654                // TODO Auto-generated method stub
    4755                return null;
    4856        }
    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        {
    5263                ItemsLeftClickDropped();
    53                 return true;
    54                        
    55         }
    56         public boolean getdropInteractableStatus(){
     64               
    5765                return true;
    5866        }
    5967       
     68        public boolean getdropInteractableStatus()
     69        {
     70                return true;
     71        }
    6072}
  • trunk/src/org/expeditee/items/widgets/SampleWidget2.java

    r919 r1102  
    1919package org.expeditee.items.widgets;
    2020
    21 
    22 import java.awt.Color;
    2321import java.awt.FlowLayout;
    2422import java.awt.Font;
     
    3230import javax.swing.JToggleButton;
    3331
     32import org.expeditee.core.Colour;
     33import org.expeditee.gio.swing.SwingConversions;
    3434import org.expeditee.items.Text;
    3535
    36 public class SampleWidget2 extends InteractiveWidget {
     36public class SampleWidget2 extends SwingWidget {
    3737       
    3838        private JComboBox _combo;
     
    4747               
    4848                JPanel p = new JPanel(new FlowLayout());
    49                 p.setBackground(new Color(255,228,195));
     49                p.setBackground(SwingConversions.toSwingColor(Colour.FromRGB255(255,228,195)));
    5050
    5151                JLabel lbl = new JLabel("This is an example InteractiveWidget!");
  • trunk/src/org/expeditee/items/widgets/Undo.java

    r1005 r1102  
    44import java.awt.event.ActionListener;
    55
    6 import org.expeditee.gui.DisplayIO;
     6import org.expeditee.gui.DisplayController;
    77import org.expeditee.items.Text;
    88
     
    1717                public void actionPerformed(ActionEvent e) {
    1818                                           
    19                    DisplayIO.getCurrentFrame().undo();               
     19                   DisplayController.getCurrentFrame().undo();               
    2020                }         
    2121             });               
  • trunk/src/org/expeditee/items/widgets/WidgetCacheManager.java

    r919 r1102  
    2525import java.util.Set;
    2626
    27 import org.expeditee.gui.DisplayIOObserver;
     27import org.expeditee.gui.DisplayObserver;
    2828import org.expeditee.gui.FrameIO;
    2929
     
    3737 *
    3838 */
    39 public final class WidgetCacheManager implements DisplayIOObserver {
     39public final class WidgetCacheManager implements DisplayObserver {
    4040       
    4141        private static HashMap<HeavyDutyInteractiveWidget, Integer> transientWidgets = new HashMap<HeavyDutyInteractiveWidget, Integer>();
  • trunk/src/org/expeditee/items/widgets/WidgetCorner.java

    r919 r1102  
    1919package org.expeditee.items.widgets;
    2020
    21 import java.awt.Color;
    22 import java.awt.Graphics2D;
    23 import java.awt.Polygon;
    2421import java.util.List;
    2522
     23import org.expeditee.core.Colour;
     24import org.expeditee.core.Point;
     25import org.expeditee.core.bounds.PolygonBounds;
    2626import org.expeditee.items.Dot;
    2727import org.expeditee.items.ItemParentStateChangedEvent;
     
    3030public class WidgetCorner extends Dot {
    3131
    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) {
    3535                super(x, y, id);
    3636
     
    3838                        throw new NullPointerException("widgetSource");
    3939                _widgetSource = widgetSource;
    40         }
    41 
    42         @Override
    43         public void updatePolygon() {
    44                 super.updatePolygon();
    45                 if (_widgetSource != null)
    46                         _widgetSource.onBoundsChanged();
    4740        }
    4841
     
    8174
    8275        @Override
    83         public void onParentStateChanged(ItemParentStateChangedEvent e) {
     76        public void onParentStateChanged(ItemParentStateChangedEvent e)
     77        {
    8478                super.onParentStateChanged(e);
    8579                _widgetSource.onParentStateChanged(e);
    8680        }
    8781
    88         public InteractiveWidget getWidgetSource() {
     82        public Widget getWidgetSource() {
    8983                return _widgetSource;
    9084        }
    9185
    9286        @Override
    93         public void paint(Graphics2D g) {
     87        public void paint()
     88        {
    9489                // For fixed widgets, always have corner selected with connected context
    95                 HighlightMode tmp = _mode; // save mode
    96                 if (_mode == HighlightMode.Normal && _widgetSource.isFixedSize()) {
    97                         _mode = HighlightMode.Connected; // draw as connected context for
     90                HighlightMode tmp = _highlightMode; // save mode
     91                if (_highlightMode == HighlightMode.Normal && _widgetSource.isFixedSize()) {
     92                        _highlightMode = HighlightMode.Connected; // draw as connected context for
    9893                        // fixed widgets
    9994                }
    100                 super.paint(g);
    101                 _mode = tmp; // restore mode
    102         }
    103 
    104         @Override
    105         public void paintFill(Graphics2D g) {
    106                 _widgetSource.paintFill(g); // only paints a fill if floating
     95                super.paint();
     96                _highlightMode = tmp; // restore mode
     97        }
     98
     99        @Override
     100        public void paintFill() {
     101                _widgetSource.paintFill(); // only paints a fill if floating
    107102        }
    108103
     
    127122
    128123        @Override
    129         public void setArrowhead(Polygon arrow) {
     124        public void setArrowhead(PolygonBounds arrow) {
    130125        }
    131126
     
    139134
    140135        @Override
    141         public void setBackgroundColor(Color c) {
     136        public void setBackgroundColor(Colour c) {
    142137                if (_widgetSource != null) {
    143138                        super.setBackgroundColor(c);
     
    147142
    148143        @Override
    149         public void setBottomShadowColor(Color bottom) {
    150         }
    151 
    152         @Override
    153         public void setFillColor(Color c) {
     144        public void setBottomShadowColor(Colour bottom) {
     145        }
     146
     147        @Override
     148        public void setFillColor(Colour c) {
    154149        }
    155150
     
    186181        }
    187182
    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) {
    200197                _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) {
    207203                _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) {
    214209                _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) {
    221215                _widgetSource.setAnchorBottom(anchor);
    222                 _anchorTop = null;
    223                 _anchorBottom = anchor;
     216                _anchoring.setBottomAnchor(anchor);
    224217        }
    225218       
     
    251244
    252245        @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);
    256249        }
    257250
     
    268261
    269262        @Override
    270         public void setColor(Color color) {
     263        public void setColor(Colour color) {
    271264                if (_widgetSource != null) {
    272265                        super.setColor(color);
  • trunk/src/org/expeditee/items/widgets/WidgetEdge.java

    r919 r1102  
    1919package org.expeditee.items.widgets;
    2020
    21 import java.awt.Color;
    22 import java.awt.Polygon;
    2321import java.util.List;
    2422
     23import org.expeditee.core.Colour;
     24import org.expeditee.core.Point;
     25import org.expeditee.core.bounds.PolygonBounds;
    2526import org.expeditee.items.Item;
    2627import org.expeditee.items.Line;
     
    2829
    2930/**
    30  * Widget edges define the boundries of an interactive widget.
     31 * Widget edges define the boundaries of an interactive widget.
    3132 *
    3233 * @author Brook Novak
     
    3435public class WidgetEdge extends Line {
    3536
    36         private InteractiveWidget _widgetSource;
     37        private Widget _widgetSource;
    3738
    3839        WidgetEdge(WidgetCorner start, WidgetCorner end, int id,
    39                         InteractiveWidget widgetSource) {
     40                        Widget widgetSource) {
    4041                super(start, end, id);
    4142               
     
    4546        }
    4647
    47         public InteractiveWidget getWidgetSource() {
     48        public Widget getWidgetSource() {
    4849                return _widgetSource;
    4950        }
     
    8990
    9091        @Override
    91         public void setArrowhead(Polygon arrow) {
     92        public void setArrowhead(PolygonBounds arrow) {
    9293        }
    9394
     
    101102
    102103        @Override
    103         public void setBottomShadowColor(Color bottom) {
    104         }
    105 
    106         @Override
    107         public void setFillColor(Color c) {
     104        public void setBottomShadowColor(Colour bottom) {
     105        }
     106
     107        @Override
     108        public void setFillColor(Colour c) {
    108109        }
    109110
     
    121122       
    122123        @Override
    123         public void setAnchorTop(Float anchor) {
     124        public void setAnchorTop(Integer anchor) {
    124125                _widgetSource.setAnchorTop(anchor);
    125126        }
    126127
    127128        @Override
    128         public void setAnchorBottom(Float anchor) {
     129        public void setAnchorBottom(Integer anchor) {
    129130                _widgetSource.setAnchorBottom(anchor);
    130131        }
    131132
    132133        @Override
    133         public void setAnchorLeft(Float anchor) {
     134        public void setAnchorLeft(Integer anchor) {
    134135                _widgetSource.setAnchorLeft(anchor);
    135136        }
    136137
    137138        @Override
    138         public void setAnchorRight(Float anchor) {
     139        public void setAnchorRight(Integer anchor) {
    139140                _widgetSource.setAnchorRight(anchor);
    140141        }
     
    156157       
    157158        @Override
    158         public Float getAnchorTop() {
     159        public Integer getAnchorTop() {
    159160                return _widgetSource.getSource().getAnchorTop();
    160161        }
    161162
    162163        @Override
    163         public Float getAnchorBottom() {
     164        public Integer getAnchorBottom() {
    164165                return _widgetSource.getSource().getAnchorBottom();
    165166        }
    166167       
    167168        @Override
    168         public Float getAnchorLeft() {
     169        public Integer getAnchorLeft() {
    169170                return _widgetSource.getSource().getAnchorLeft();
    170171        }
    171172
    172173        @Override
    173         public Float getAnchorRight() {
     174        public Integer getAnchorRight() {
    174175                return _widgetSource.getSource().getAnchorRight();
    175176        }
    176177       
    177178        @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() {
    184185                return getStartItem().getEnclosedShape();
    185186        }
     
    219220       
    220221        @Override
    221         public void setBackgroundColor(Color c) {
     222        public void setBackgroundColor(Colour c) {
    222223                if (_widgetSource != null) {
    223224                        super.setBackgroundColor(c);
     
    227228       
    228229        @Override
    229         public void setColor(Color c) {
     230        public void setColor(Colour c) {
    230231                if (_widgetSource != null) {
    231232                        super.setColor(c);
  • trunk/src/org/expeditee/items/widgets/charts/AbstractCategory.java

    r919 r1102  
    1919package org.expeditee.items.widgets.charts;
    2020
    21 import java.awt.Color;
    2221import java.util.Collection;
    2322
     23import org.expeditee.core.Colour;
     24import org.expeditee.gio.swing.SwingConversions;
    2425import org.expeditee.gui.AttributeValuePair;
    2526import org.expeditee.items.Text;
     
    4950                        Collection<Text> items, boolean swap) {
    5051                boolean foundData = false;
    51                 Color newColor = null;
     52                Colour newColor = null;
    5253                for (Text i : items) {
    5354                        try {
     
    6162                                                                        categoryName);
    6263                                                        if (_paints.get(attribute) == null) {
    63                                                                 _paints.put(attribute, i.getBackgroundColor());
     64                                                                _paints.put(attribute, SwingConversions.toSwingColor(i.getBackgroundColor()));
    6465                                                        }
    6566                                                } else {
     
    7778                }
    7879                if (foundData && !swap) {
    79                         _paints.put(categoryName, newColor);
     80                        _paints.put(categoryName, SwingConversions.toSwingColor(newColor));
    8081                }
    8182                return foundData;
  • trunk/src/org/expeditee/items/widgets/charts/AbstractChart.java

    r919 r1102  
    2020
    2121import java.awt.BasicStroke;
    22 import java.awt.Color;
    2322import java.awt.Component;
    2423import java.awt.Font;
    2524import java.awt.Paint;
    26 import java.awt.Point;
    2725import java.awt.event.KeyEvent;
    2826import java.awt.event.KeyListener;
     
    3533import javax.swing.JPanel;
    3634
     35import org.expeditee.core.Colour;
     36import org.expeditee.core.Point;
     37import org.expeditee.gio.gesture.StandardGestureActions;
     38import org.expeditee.gio.swing.SwingConversions;
    3739import org.expeditee.gui.ColorUtils;
     40import org.expeditee.gui.DisplayController;
    3841import org.expeditee.gui.Frame;
    3942import org.expeditee.gui.FrameGraphics;
    4043import org.expeditee.gui.FrameIO;
    41 import org.expeditee.gui.FrameKeyboardActions;
    42 import org.expeditee.gui.FrameMouseActions;
    4344import org.expeditee.gui.FunctionKey;
    4445import org.expeditee.items.Text;
     
    103104                                case SizeUp:
    104105                                        invalidateLink();
    105                                         FrameKeyboardActions.SetSize(getFirstCorner(), 1, false,
    106                                                         true, false);
     106                                        StandardGestureActions.SetSize(getFirstCorner(), 1, false, true, false);
    107107                                        invalidateSelf();
    108                                         FrameGraphics.refresh(true);
     108                                        DisplayController.requestRefresh(true);
    109109                                        // FrameGraphics.requestRefresh(true);
    110110                                        break;
    111111                                case SizeDown:
    112112                                        invalidateLink();
    113                                         FrameKeyboardActions.SetSize(getFirstCorner(), -1, false,
     113                                        StandardGestureActions.SetSize(getFirstCorner(), -1, false,
    114114                                                        true, false);
    115115                                        invalidateSelf();
    116                                         FrameGraphics.refresh(true);
     116                                        DisplayController.requestRefresh(true);
    117117                                        // FrameGraphics.ForceRepaint();
    118118                                        // FrameGraphics.refresh(true);
     
    125125                                                        setSourceFillColor(null);
    126126                                                } else {
    127                                                         Color newColor = ColorUtils.getNextColor(
     127                                                        Colour newColor = ColorUtils.getNextColor(
    128128                                                                        getSource().getFillColor(),
    129129                                                                        TemplateSettings.BackgroundColorWheel.get(), null);
     
    134134                                                        setBackgroundColor(null);
    135135                                                } else {
    136                                                         Color newColor = ColorUtils.getNextColor(
     136                                                        Colour newColor = ColorUtils.getNextColor(
    137137                                                                        getSource().getColor(), TemplateSettings.ColorWheel.get(),
    138138                                                                        null);
     
    141141                                        }
    142142                                        break;
     143                                default:
     144                                        break;
    143145                                }
    144146                        }
     
    148150
    149151                        public void keyTyped(KeyEvent e) {
    150                                 FrameKeyboardActions.processChar(e.getKeyChar(), e
     152                                StandardGestureActions.processChar(e.getKeyChar(), e
    151153                                                .isShiftDown());
    152154                        }
     
    155157
    156158                        public void mouseClicked(MouseEvent e) {
    157                                 FrameMouseActions.getInstance().mouseClicked(translateEvent(e));
     159                                //StandardGestureActions.mouseClicked(translateEvent(e));
    158160                        }
    159161
     
    167169
    168170                        public void mousePressed(MouseEvent e) {
    169                                 FrameMouseActions.getInstance().mousePressed(translateEvent(e));
     171                                //StandardGestureActions.mousePressed(translateEvent(e));
    170172                        }
    171173
     
    180182
    181183                        public void mouseReleased(MouseEvent e) {
    182                                 FrameMouseActions.getInstance()
    183                                                 .mouseReleased(translateEvent(e));
     184                                //StandardGestureActions.mouseReleased(translateEvent(e));
    184185                        }
    185186
     
    272273                                if (foundData |= addCategoryData(categoryName, linkFrame
    273274                                                .getNonAnnotationText(true), swap)) {
    274                                         Color backgroundColor = category.getBackgroundColor();
     275                                        Colour backgroundColor = category.getBackgroundColor();
    275276                                        if (backgroundColor != null)
    276                                                 _paints.put(categoryName, backgroundColor);
     277                                                _paints.put(categoryName, SwingConversions.toSwingColor(backgroundColor));
    277278                                        addSubject(linkFrame);
    278279                                }
     
    307308
    308309        @Override
    309         public void setBackgroundColor(Color c) {
     310        public void setBackgroundColor(Colour c) {
    310311                super.setBackgroundColor(c);
    311312                if (_chart == null)
     
    314315                        _chart.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT);
    315316                } else {
    316                         _chart.setBackgroundPaint(c);
    317                 }
    318         }
    319 
    320         @Override
    321         public void setSourceColor(Color c) {
     317                        _chart.setBackgroundPaint(SwingConversions.toSwingColor(c));
     318                }
     319        }
     320
     321        @Override
     322        public void setSourceColor(Colour c) {
    322323                super.setSourceColor(c);
    323324                if (_chart == null)
     
    326327                        _chart.getTitle().setPaint(TextTitle.DEFAULT_TEXT_PAINT);
    327328                } else {
    328                         _chart.getTitle().setPaint(c);
     329                        _chart.getTitle().setPaint(SwingConversions.toSwingColor(c));
    329330                }
    330331                for (Title t : _chart.getSubtitles()) {
     
    332333                                t.setPaint(TextTitle.DEFAULT_TEXT_PAINT);
    333334                        } else {
    334                                 t.setPaint(c);
     335                                t.setPaint(SwingConversions.toSwingColor(c));
    335336                        }
    336337                }
     
    338339                if (legend != null) {
    339340                        if (c == null) {
    340                                 legend.setFrame(new BlockBorder(Color.black));
     341                                legend.setFrame(new BlockBorder(SwingConversions.toSwingColor(Colour.BLACK)));
    341342                        } else {
    342                                 legend.setFrame(new BlockBorder(c));
    343                         }
    344                 }
    345         }
    346 
    347         @Override
    348         public void setSourceBorderColor(Color c) {
     343                                legend.setFrame(new BlockBorder(SwingConversions.toSwingColor(c)));
     344                        }
     345                }
     346        }
     347
     348        @Override
     349        public void setSourceBorderColor(Colour c) {
    349350                super.setSourceBorderColor(c);
    350351                if (_chart == null)
     
    353354                        _chart.getPlot().setOutlinePaint(Plot.DEFAULT_OUTLINE_PAINT);
    354355                } else {
    355                         _chart.getPlot().setOutlinePaint(c);
    356                 }
    357         }
    358 
    359         @Override
    360         public void setSourceFillColor(Color c) {
     356                        _chart.getPlot().setOutlinePaint(SwingConversions.toSwingColor(c));
     357                }
     358        }
     359
     360        @Override
     361        public void setSourceFillColor(Colour c) {
    361362                super.setSourceFillColor(c);
    362363                if (_chart == null)
     
    368369                                legend.setBackgroundPaint(null);
    369370                } else {
    370                         _chart.getPlot().setBackgroundPaint(c);
     371                        _chart.getPlot().setBackgroundPaint(SwingConversions.toSwingColor(c));
    371372                        if (legend != null)
    372                                 legend.setBackgroundPaint(c);
     373                                legend.setBackgroundPaint(SwingConversions.toSwingColor(c));
    373374                }
    374375        }
     
    387388                if (legend != null) {
    388389                        legend.setFrame(new BlockBorder(newThickness, newThickness,
    389                                         newThickness, newThickness, getSource().getPaintColor()));
     390                                        newThickness, newThickness, SwingConversions.toSwingColor(getSource().getPaintColor())));
    390391                        legend.setItemFont(legend.getItemFont().deriveFont(fontSize));
    391392                        float pad = newThickness + 1;
  • trunk/src/org/expeditee/items/widgets/charts/AbstractPie.java

    r919 r1102  
    2020
    2121import java.awt.BasicStroke;
    22 import java.awt.Color;
    2322
     23import org.expeditee.core.Colour;
     24import org.expeditee.gio.swing.SwingConversions;
    2425import org.expeditee.gui.AttributeValuePair;
    2526import org.expeditee.gui.Frame;
     
    8586                                try {
    8687                                        _data.setValue(avp.getAttribute(), avp.getDoubleValue());
    87                                         _paints.put(avp.getAttribute(), t.getBackgroundColor());
     88                                        _paints.put(avp.getAttribute(), SwingConversions.toSwingColor(t.getBackgroundColor()));
    8889                                } catch (NumberFormatException nfe) {
    8990
     
    9495
    9596        @Override
    96         public void setSourceBorderColor(Color c) {
     97        public void setSourceBorderColor(Colour c) {
    9798                super.setSourceBorderColor(c);
    9899                if (getChart() == null)
     
    106107                        plot.setShadowPaint(PiePlot.DEFAULT_SHADOW_PAINT);
    107108                } else {
    108                         plot.setBaseSectionOutlinePaint(c);
    109                         plot.setLabelLinkPaint(c);
    110                         plot.setLabelOutlinePaint(c);
    111                         Color newC = c.darker();
    112                         Color faded = new Color(newC.getRed(), newC.getGreen(), newC
    113                                         .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));
    114115
    115                         plot.setLabelShadowPaint(faded);
    116                         plot.setShadowPaint(c);
     116                        plot.setLabelShadowPaint(SwingConversions.toSwingColor(faded));
     117                        plot.setShadowPaint(SwingConversions.toSwingColor(c));
    117118                }
    118119        }
    119120
    120121        @Override
    121         public void setSourceColor(Color c) {
     122        public void setSourceColor(Colour c) {
    122123                super.setSourceColor(c);
    123124                if (getChart() == null)
     
    127128                        plot.setLabelPaint(PiePlot.DEFAULT_LABEL_PAINT);
    128129                } else {
    129                         plot.setLabelPaint(c);
     130                        plot.setLabelPaint(SwingConversions.toSwingColor(c));
    130131                }
    131132        }
  • trunk/src/org/expeditee/items/widgets/charts/AbstractValueAxis.java

    r919 r1102  
    2020
    2121import java.awt.BasicStroke;
    22 import java.awt.Color;
    2322import java.awt.Stroke;
    2423
     24import org.expeditee.core.Colour;
     25import org.expeditee.gio.swing.SwingConversions;
    2526import org.expeditee.gui.Frame;
    2627import org.expeditee.items.Text;
     
    5657
    5758        @Override
    58         public void setSourceColor(Color c) {
     59        public void setSourceColor(Colour c) {
    5960                super.setSourceColor(c);
    6061                if (getChart() == null)
     
    7071                                        .setTickLabelPaint(Axis.DEFAULT_TICK_LABEL_PAINT);
    7172                } 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));
    7677                }
    7778        }
    7879
    7980        @Override
    80         public void setSourceBorderColor(Color c) {
     81        public void setSourceBorderColor(Colour c) {
    8182                super.setSourceBorderColor(c);
    8283                if (getChart() == null)
     
    8990                        plot.getRangeAxis().setTickMarkPaint(Plot.DEFAULT_OUTLINE_PAINT);
    9091                } else {
    91                         Color 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));
    9697                }
    9798        }
  • trunk/src/org/expeditee/items/widgets/charts/AbstractXY.java

    r919 r1102  
    1919package org.expeditee.items.widgets.charts;
    2020
    21 import java.awt.Color;
    2221import java.util.Collection;
    2322import java.util.HashSet;
    2423
     24import org.expeditee.core.Colour;
     25import org.expeditee.gio.swing.SwingConversions;
    2526import org.expeditee.gui.AttributeValuePair;
    2627import org.expeditee.items.Item;
     
    5556                        Collection<Text> items, boolean swap) {
    5657                XYSeries newSeries = new XYSeries(categoryName);
    57                 Color categoryColor = null;
     58                Colour categoryColor = null;
    5859                boolean foundData = false;
    5960                Collection<Item> seen = new HashSet<Item>();
     
    123124                if (foundData) {
    124125                        _data.addSeries(newSeries);
    125                         _paints.put(categoryName, categoryColor);
     126                        _paints.put(categoryName, SwingConversions.toSwingColor(categoryColor));
    126127                }
    127128                return foundData;
  • trunk/src/org/expeditee/items/widgets/charts/Polar.java

    r919 r1102  
    1919package org.expeditee.items.widgets.charts;
    2020
    21 import java.awt.Color;
    22 
     21import org.expeditee.core.Colour;
     22import org.expeditee.gio.swing.SwingConversions;
    2323import org.expeditee.items.Text;
    2424import org.jfree.chart.ChartFactory;
     
    4343
    4444        @Override
    45         public void setSourceColor(Color c) {
     45        public void setSourceColor(Colour c) {
    4646                super.setSourceColor(c);
    4747                if (getChart() == null)
     
    5353                        plot.setAngleLabelPaint(Axis.DEFAULT_AXIS_LABEL_PAINT);
    5454                } else {
    55                         plot.setAngleLabelPaint(c);
     55                        plot.setAngleLabelPaint(SwingConversions.toSwingColor(c));
    5656                }
    5757        }
  • trunk/src/org/expeditee/items/widgets/charts/TimeSeries.java

    r919 r1102  
    1919package org.expeditee.items.widgets.charts;
    2020
    21 import java.awt.Color;
    2221import java.text.DateFormat;
    2322import java.text.ParseException;
     
    2726import java.util.Date;
    2827
     28import org.expeditee.Util;
     29import org.expeditee.core.Colour;
     30import org.expeditee.gio.swing.SwingConversions;
    2931import org.expeditee.gui.AttributeValuePair;
    3032import org.expeditee.gui.Frame;
     
    100102                        String startDateString = dataFrame.getAnnotationValue("start");
    101103                        if (startDateString != null) {
    102                                 _startDate = parseDate(startDateString);
     104                                _startDate = Util.parseDate(startDateString);
    103105                        }
    104106                } catch (Exception e) {
     
    135137
    136138                boolean foundData = false;
    137                 Color newColor = null;
     139                Colour newColor = null;
    138140                for (Text i : items) {
    139141                        if (!i.isLineEnd()) {
     
    157159                                                RegularTimePeriod rtp = null;
    158160                                                if (attribute == null) {
    159                                                         Date date = parseDate(avp.getAttribute());
     161                                                        Date date = Util.parseDate(avp.getAttribute());
    160162                                                        rtp = _periodType.getConstructor(
    161163                                                                        new Class[] { Date.class }).newInstance(
     
    212214                if (foundData) {
    213215                        _data.addSeries(newSeries);
    214                         _paints.put(categoryName, newColor);
     216                        _paints.put(categoryName, SwingConversions.toSwingColor(newColor));
    215217                }
    216218                return foundData;
    217219        }
    218 
    219         /**
    220          * @param avp
    221          * @return
    222          * @throws ParseException
    223          */
    224         public static Date parseDate(String dateString) throws ParseException {
    225                 // Select the best match for a date or time format
    226                 DateFormat df = null;
    227                 if (dateString.length() > Formatter.DATE_FORMAT
    228                                 .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         }
    238220}
Note: See TracChangeset for help on using the changeset viewer.