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/agents
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/agents/DefaultAgent.java

    r919 r1102  
    1919package org.expeditee.agents;
    2020
     21import org.expeditee.gui.DisplayController;
    2122import org.expeditee.gui.Frame;
    22 import org.expeditee.gui.FrameGraphics;
    2323import org.expeditee.gui.MessageBay;
    2424import org.expeditee.gui.TimeKeeper;
     
    128128                AGENTS_RUNNING--;
    129129
    130                 FrameGraphics.requestRefresh(true);
     130                DisplayController.requestRefresh(true);
    131131                SessionStats.setEnabled(true);
    132132        }
  • trunk/src/org/expeditee/agents/DisplayComet.java

    r919 r1102  
    2323import java.util.Stack;
    2424
    25 import org.expeditee.gui.DisplayIO;
     25import org.expeditee.gui.DisplayController;
    2626import org.expeditee.gui.Frame;
    2727import org.expeditee.gui.FrameIO;
     
    4545                Collection<String> seen = new HashSet<String>();
    4646
    47                 DisplayIO.addToBack(frame);
     47                DisplayController.addToBack(frame);
    4848
    4949                // Goto the end of the comet
     
    7474                        if (_stop)
    7575                                return null;
    76                         DisplayIO.setCurrentFrame(_frameList.pop(), true);
     76                        DisplayController.setCurrentFrame(_frameList.pop(), true);
    7777                        _frameCount++;
    7878                        pause(_delay);
  • trunk/src/org/expeditee/agents/DisplayTree.java

    r919 r1102  
    1919package org.expeditee.agents;
    2020
    21 import org.expeditee.gui.DisplayIO;
     21import org.expeditee.gui.DisplayController;
    2222import org.expeditee.gui.Frame;
    2323import org.expeditee.gui.MessageBay;
     
    5454
    5555                // push current frame on to back-stack
    56                 DisplayIO.addToBack(start);
     56                DisplayController.addToBack(start);
    5757
    5858                return super.initialise(start, launcher);
     
    6363                // return the user to the Frame they started on
    6464                if (!_stop) {
    65                         DisplayIO.Back();
     65                        DisplayController.Back();
    6666                }
    6767                super.finalise(start);
     
    7979
    8080                // ignore loops
    81                 if (toProcess != DisplayIO.getCurrentFrame())
    82                         DisplayIO.setCurrentFrame(toProcess, false);
     81                if (toProcess != DisplayController.getCurrentFrame())
     82                        DisplayController.setCurrentFrame(toProcess, false);
    8383                // parse the frame for any pause settings
    8484                delay(toProcess);
  • trunk/src/org/expeditee/agents/Format.java

    r919 r1102  
    2626import java.util.List;
    2727
     28import org.expeditee.gui.DisplayController;
    2829import org.expeditee.gui.Frame;
    29 import org.expeditee.gui.FrameGraphics;
    3030import org.expeditee.gui.FrameUtils;
    3131import org.expeditee.items.Item;
     
    148148                                                + /* item.getX() + */it.getBoundsWidth());
    149149
    150                         if (xCheck < FrameGraphics.getMaxSize().width) {
     150                        if (xCheck < DisplayController.getFramePaintArea().getWidth()) {
    151151                                Item columnHead = columnHeads.get(i + 1);
    152152                                if (columnHead.getX() < maxX && columnHead.getY() < maxY) {
     
    182182                start.setChanged(true);
    183183                start.addToUndoMove(changedItems);
    184                 FrameGraphics.requestRefresh(true);
     184                DisplayController.requestRefresh(true);
    185185                return null;
    186186        }
  • trunk/src/org/expeditee/agents/GraphFramesetLinks.java

    r919 r1102  
    1919package org.expeditee.agents;
    2020
    21 import java.awt.Color;
    2221import java.util.List;
    2322
    2423import org.expeditee.actions.Misc;
     24import org.expeditee.core.Colour;
     25import org.expeditee.core.Font;
     26import org.expeditee.gio.gesture.StandardGestureActions;
     27import org.expeditee.gui.DisplayController;
    2528import org.expeditee.gui.Frame;
    2629import org.expeditee.gui.FrameIO;
    27 import org.expeditee.gui.FrameMouseActions;
    2830import org.expeditee.gui.FrameUtils;
    2931import org.expeditee.items.Item;
     
    4143import com.mxgraph.model.mxGraphModel;
    4244import com.mxgraph.view.mxGraph;
    43 import java.awt.Font;
    4445
    4546/**
     
    7475                String resultsFramesetName = "LinksGraphResults";
    7576
    76                 Color vertColor = new Color(51,145,148);
    77                 Color unlinkedVertColor = new Color(251,107,65);
    78                 Color outgoingVertColor = new Color(246,216,107);
    79                 Color lineColor = new Color(0,0,0, 20);
     77                Colour vertColor = Colour.FromRGB255(51,145,148);
     78                Colour unlinkedVertColor = Colour.FromRGB255(251,107,65);
     79                Colour outgoingVertColor = Colour.FromRGB255(246,216,107);
     80                Colour lineColor = Colour.FromRGBA255(0,0,0, 20);
    8081
    8182                try {
     
    220221                }
    221222               
    222                 Font keyFont = Font.decode(Font.SANS_SERIF + " 14");
     223                Font keyFont = new Font("SansSerif");
     224                keyFont.setSize(14);
    223225               
    224226                Text keyLink = resultsFrame.addText(0, 0, "\u2192 = Link", null);
     
    228230               
    229231                keyLink.setFont(keyFont);
    230                 keyLink.setColor(Color.DARK_GRAY);
     232                keyLink.setColor(Colour.DARK_GREY);
    231233               
    232234                keyFrame.setFont(keyFont);;
     
    239241                keyFrameOutgoing.setColor(outgoingVertColor);
    240242               
    241                 keyFrameOutgoing.setAnchorBottom(10f);
    242                 keyFrameUnlinked.setAnchorBottom(30f);
    243                 keyFrame.setAnchorBottom(50f);
    244                 keyLink.setAnchorBottom(70f);
    245                
    246                 keyFrameOutgoing.setAnchorLeft(10f);
    247                 keyFrameUnlinked.setAnchorLeft(10f);
    248                 keyFrame.setAnchorLeft(10f);
    249                 keyLink.setAnchorLeft(10f);
     243                keyFrameOutgoing.setAnchorBottom(10);
     244                keyFrameUnlinked.setAnchorBottom(30);
     245                keyFrame.setAnchorBottom(50);
     246                keyLink.setAnchorBottom(70);
     247               
     248                keyFrameOutgoing.setAnchorLeft(10);
     249                keyFrameUnlinked.setAnchorLeft(10);
     250                keyFrame.setAnchorLeft(10);
     251                keyLink.setAnchorLeft(10);
    250252
    251253                // Moving to the area of the frame that contains the graph
     
    256258                Text link = new Text(toProcessFramesetName + " graph");
    257259                link.setLink(resultsFrame.getName());
    258                 link.setPosition(FrameMouseActions.getPosition());
    259                 FrameMouseActions.pickup(link);
     260                link.setPosition(DisplayController.getMousePosition());
     261                StandardGestureActions.pickup(link);
    260262                return null;
    261263        }
  • trunk/src/org/expeditee/agents/ScaleFrameset.java

    r919 r1102  
    2121import java.util.Collection;
    2222
     23import org.expeditee.gio.gesture.StandardGestureActions;
    2324import org.expeditee.gui.Frame;
    2425import org.expeditee.gui.FrameIO;
    25 import org.expeditee.gui.FrameKeyboardActions;
    2626import org.expeditee.gui.Vector;
    2727import org.expeditee.items.Item;
     
    6262
    6363                // TODO make this thread safe!
    64                 FrameKeyboardActions.Refresh();
     64                StandardGestureActions.Refresh();
    6565
    6666                return null;
     
    102102                                continue;
    103103                        // if (!(item instanceof Line))
    104                         item.updatePolygon();
     104                        item.invalidateBounds();
    105105
    106106                        if (item instanceof Line) {
  • trunk/src/org/expeditee/agents/SearchAgent.java

    r1069 r1102  
    2121import java.util.Collection;
    2222
     23import org.expeditee.gui.DisplayController;
    2324import org.expeditee.gui.Frame;
    2425import org.expeditee.gui.FrameCreator;
    25 import org.expeditee.gui.FrameGraphics;
    2626import org.expeditee.gui.FrameIO;
    2727import org.expeditee.io.Conversion;
     
    126126        }
    127127
    128         public static boolean searchFrame(FrameCreator results, String frameName,
    129                         String pattern, String replacementString) {
    130                 int oldMode = FrameGraphics.getMode();
    131                 FrameGraphics.forceXRayMode(false);
     128        public static boolean searchFrame(FrameCreator results, String frameName, String pattern, String replacementString)
     129        {
     130                boolean wasXrayMode = DisplayController.isXRayMode();
     131                if (!wasXrayMode) DisplayController.ToggleXRayMode();
    132132                Frame frameToSearch = FrameIO.LoadFrame(frameName);
    133                 FrameGraphics.setMode(oldMode, false);
     133                if (!wasXrayMode) DisplayController.ToggleXRayMode();
    134134                if (frameToSearch == null)
    135135                        return false;
     
    142142                        }
    143143                }
    144                 FrameGraphics.requestRefresh(true);
     144                DisplayController.requestRefresh(true);
    145145                FrameIO.SaveFrame(frameToSearch, false);
    146146                return true;
     
    177177                                _results.addText(surrogate.toString(), null,
    178178                                                frameName, null, false);
    179                                 FrameGraphics.requestRefresh(true);
     179                                DisplayController.requestRefresh(true);
    180180                        }
    181181                }
  • trunk/src/org/expeditee/agents/SearchGreenstone.java

    r919 r1102  
    2323import java.util.Vector;
    2424
     25import org.expeditee.gio.gesture.StandardGestureActions;
    2526import org.expeditee.greenstone.Greenstone3Connection;
    2627import org.expeditee.greenstone.Query;
     
    2930import org.expeditee.greenstone.ResultDocument;
    3031import org.expeditee.gui.AttributeValuePair;
    31 import org.expeditee.gui.DisplayIO;
     32import org.expeditee.gui.DisplayController;
    3233import org.expeditee.gui.Frame;
    3334import org.expeditee.gui.FrameCreator;
    3435import org.expeditee.gui.FrameGraphics;
    35 import org.expeditee.gui.FrameMouseActions;
    3636import org.expeditee.gui.MessageBay;
    3737import org.expeditee.items.Text;
     
    175175                        doQuery(_pattern);
    176176                } else if (_currentResultSet != null) {
    177                         Text newText = DisplayIO.getCurrentFrame().createNewText(
    178                                         getCursorText());
     177                        Text newText = DisplayController.getCurrentFrame().createNewText(getCursorText());
    179178                        _clicked = newText;
    180                         FrameMouseActions.pickup(newText);
     179                        StandardGestureActions.pickup(newText);
    181180                }
    182181
     
    389388                                false);
    390389
    391                 FrameGraphics.requestRefresh(true);
     390                DisplayController.requestRefresh(true);
    392391        }
    393392
  • trunk/src/org/expeditee/agents/SearchTreeAndReplace.java

    r919 r1102  
    2222import java.util.HashSet;
    2323
     24import org.expeditee.gui.DisplayController;
    2425import org.expeditee.gui.Frame;
    25 import org.expeditee.gui.FrameGraphics;
    2626import org.expeditee.gui.FrameIO;
    2727import org.expeditee.items.Text;
     
    7979                        }
    8080                }
    81                 FrameGraphics.requestRefresh(true);
     81                DisplayController.requestRefresh(true);
    8282                FrameIO.SaveFrame(frameToSearch, false);
    8383                return true;
  • trunk/src/org/expeditee/agents/Sort.java

    r919 r1102  
    1919package org.expeditee.agents;
    2020
    21 import java.awt.Point;
    2221import java.util.ArrayList;
    2322import java.util.Collection;
     
    2524import java.util.Comparator;
    2625
     26import org.expeditee.core.Point;
     27import org.expeditee.gui.DisplayController;
    2728import org.expeditee.gui.Frame;
    28 import org.expeditee.gui.FrameGraphics;
    2929import org.expeditee.gui.FrameUtils;
    3030import org.expeditee.items.Text;
     
    6868                // items will need to be resorted after this
    6969                start.setResort(true);
    70                 FrameGraphics.Repaint();
     70                DisplayController.requestRefresh(true);
    7171
    7272                return null;
  • trunk/src/org/expeditee/agents/SwitchyardTree.java

    r919 r1102  
    1919package org.expeditee.agents;
    2020
    21 import java.awt.Color;
    22 import java.awt.geom.Point2D;
    23 
     21import org.expeditee.core.Colour;
     22import org.expeditee.core.Point;
    2423import org.expeditee.gui.Frame;
    2524import org.expeditee.gui.FrameIO;
     
    4443                                        Frame childFrame = FrameIO.LoadFrame(link);
    4544                                        if (childFrame != null) {
    46                                                 Point2D.Float lastItemEnd = textItem.getParagraphEndPosition();
     45                                                Point lastItemEnd = textItem.getParagraphEndPosition();
    4746                                                for (Text childItem : childFrame.getBodyTextItems(false)) {
    4847                                                        // look for red items (remember get color may be null
    49                                                         if (Color.RED.equals(childItem.getPaintColor())) {
     48                                                        if (Colour.RED.equals(childItem.getPaintColor())) {
    5049                                                                // make a copy and add to parent frame
    5150                                                                Text itemCopy = childItem.copy();
    5251                                                                // add to the right of parent item
    53                                                                 lastItemEnd.setLocation(lastItemEnd.x + 20, lastItemEnd.y);
     52                                                                lastItemEnd.set(lastItemEnd.x + 20, lastItemEnd.y);
    5453                                                                itemCopy.setPosition(lastItemEnd.x, lastItemEnd.y);
    5554                                                                lastItemEnd = itemCopy
  • trunk/src/org/expeditee/agents/mail/MailSession.java

    r919 r1102  
    1919package org.expeditee.agents.mail;
    2020
    21 import java.awt.Color;
    22 import java.awt.Point;
    2321import java.io.BufferedReader;
    2422import java.io.InputStream;
     
    4846import javax.mail.internet.MimeMessage;
    4947
     48import org.expeditee.core.Colour;
     49import org.expeditee.core.Point;
     50import org.expeditee.gio.DragAndDropManager;
    5051import org.expeditee.gui.AttributeValuePair;
     52import org.expeditee.gui.DisplayController;
    5153import org.expeditee.gui.Frame;
    5254import org.expeditee.gui.FrameCreator;
    53 import org.expeditee.gui.FrameGraphics;
    5455import org.expeditee.gui.MessageBay;
    55 import org.expeditee.importer.FrameDNDTransferHandler;
    5656import org.expeditee.items.Text;
    5757
     
    208208                                                try {
    209209                                                        MessageBay.displayMessage("New mail message!",
    210                                                                         null, Color.green, true, "getMailByID "
     210                                                                        null, Colour.GREEN, true, "getMailByID "
    211211                                                                                        + _folder.getMessageCount());
    212212                                                        /*
     
    247247
    248248                                MessageBay.displayMessage("Mail connection complete",
    249                                                 Color.GREEN);
     249                                                Colour.GREEN);
    250250
    251251                                displayUnreadMailCount();
     
    262262                int unreadCount = getUnreadCount();
    263263                Text text = new Text(-1, unreadCount + UNREAD_MESSAGE
    264                                 + (unreadCount == 1 ? "" : "s"), Color.BLUE, null);
     264                                + (unreadCount == 1 ? "" : "s"), Colour.BLUE, null);
    265265                if (unreadCount > 0)
    266266                        text.addAction("getUnreadMail " + unreadCount);
     
    517517                        final Frame frame, final Point point) {
    518518
    519                 final Text source = FrameDNDTransferHandler.importString(
    520                                 "Reading message " + messageNo + "...", point);
     519                final Text source = DragAndDropManager.importString("Reading message " + messageNo + "...", point);
    521520
    522521                new Thread() {
     
    598597                                        frames.save();
    599598                                        source.setLink(frames.getName());
    600                                         FrameGraphics.requestRefresh(true);
     599                                        DisplayController.requestRefresh(true);
    601600                                } catch (MessageRemovedException mre) {
    602601                                        source.setText("Message removed from inbox");
Note: See TracChangeset for help on using the changeset viewer.