Changeset 21


Ignore:
Timestamp:
05/08/08 14:30:09 (16 years ago)
Author:
ra33
Message:
 
Location:
trunk/src/org/expeditee
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Actions.java

    r7 r21  
    244244         */
    245245        public static void PerformAction(Frame source, Item launcher, String command) {
     246                FrameIO.SaveFrame(source, false);
     247               
    246248                // separate method name and parameter names
    247249                String mname = getName(command);
     
    303305                        } catch (Exception e) {
    304306                                Logger.Log(e);
    305                                 // e.printStackTrace();
     307                                e.printStackTrace();
    306308                        }
    307309                }
  • trunk/src/org/expeditee/actions/Misc.java

    r19 r21  
    1818import org.expeditee.gui.FrameMouseActions;
    1919import org.expeditee.items.Item;
     20import org.expeditee.items.Picture;
    2021import org.expeditee.items.Text;
    2122import org.expeditee.stats.SessionStats;
     
    203204         * cursor via FrameMouseActions.pickup(Item)
    204205         */
    205         public static void GetCurrentStats() {
     206        public static void GetSessionStats() {
    206207                String stats = SessionStats.getCurrentStats();
    207208
  • trunk/src/org/expeditee/actions/Simple.java

    r19 r21  
    3838import org.expeditee.simple.UnitTestFailedException;
    3939import org.expeditee.stats.AgentStats;
     40import org.expeditee.stats.SessionStats;
    4041
    4142public class Simple {
     
    236237                // item.setColor(Color.CYAN);
    237238                FrameUtils.DisplayFrame(item.getParent().getFrameName(), true);
    238                 item.showHighlight(true, Color.CYAN);
     239                item.setSelectionColor(Color.CYAN);
    239240                FrameIO.SaveFrame(item.getParent());
    240241        }
     
    312313                Frame frame = i.getParent();
    313314
    314                 if (i == frame.getTitle() || i == frame.getFrameNameItem() || i.isAnnotation()) {
     315                if (i == frame.getTitle() || i == frame.getFrameNameItem()
     316                                || i.isAnnotation()) {
    315317                        return false;
    316318                }
     
    576578                                for (Text text : targetFrame.getBodyTextItems(true)) {
    577579                                        String s = text.getTextNoList().toLowerCase();
    578                                        
     580
    579581                                        if (s.startsWith(targetAttribute)) {
    580582                                                attributeItem = text;
     
    847849                                                }
    848850                                        }
    849 
    850851                                        return Status.OK;
    851852                                } else if (tokens[0].startsWith("getframename")) {
     
    872873                                                        frameName);
    873874                                        context.getPrimitives().setValue(tokens[2], filePath);
     875                                        return Status.OK;
     876                                } else if (tokens[0].equals("getframelog")) {
     877                                        assertExactParametreCount(tokens, 1);
     878                                        assertVariableType(tokens[1], 1, SPointer.itemPrefix);
     879
     880                                        String log = SessionStats.getFrameEventList();
     881                                        Text t;
     882                                        try {
     883                                                t = (Text) context.getPointers().getVariable(tokens[1])
     884                                                                .getValue();
     885                                                t.setText(log);
     886                                        } catch (Exception e) {
     887                                                t = new Text(-1, log);
     888                                                context.getPointers().setObject(tokens[1], t);
     889                                        }
     890
    874891                                        return Status.OK;
    875892                                }
     
    10051022                                                FrameIO.getFramesetList());
    10061023                                return Status.OK;
     1024                        } else if (tokens[0].equals("getsessionstats")) {
     1025                                assertExactParametreCount(tokens, 1);
     1026                                assertVariableType(tokens[1], 1, SPointer.itemPrefix);
     1027
     1028                                String stats = SessionStats.getCurrentStats();
     1029                                Text t;
     1030                                try {
     1031                                        t = (Text) context.getPointers().getVariable(tokens[1])
     1032                                                        .getValue();
     1033                                        t.setText(stats);
     1034                                } catch (Exception e) {
     1035                                        t = new Text(-1, stats);
     1036                                        context.getPointers().setObject(tokens[1], t);
     1037                                }
     1038
     1039                                return Status.OK;
    10071040                        }
    10081041                } else if (tokens[0].equals("or")) {
     
    10601093                                || tokens[0].equals("errorln") || tokens[0].equals("errorline")) {
    10611094                        String message = getMessage(tokens, context, code.toString(),
    1062                                         tokens[0].endsWith("nospaces") ? "" : " ");
     1095                                        tokens[0].endsWith("nospaces") ? "" : " ", 1);
    10631096
    10641097                        if (tokens[0].equals("errorln") || tokens[0].equals("errorline"))
     
    10671100                                FrameGraphics.DisplayMessageAlways(message);
    10681101                        return Status.OK;
    1069                 } else if (tokens[0].equals("typein")
    1070                                 || tokens[0].equals("typeinnospaces")) {
     1102                } else if (tokens[0].equals("typeatrate")) {
     1103                        assertMinParametreCount(tokens, 1);
     1104                        double delay = context.getPrimitives().getDoubleValue(tokens[1]);
     1105                        String s = getMessage(tokens, context, code.toString(), " ", 2);
     1106                        for (int i = 0; i < s.length(); i++) {
     1107                                FrameKeyboardActions.processChar(s.charAt(i));
     1108                                Thread.sleep((int) (delay * 1000));
     1109                        }
     1110                        return Status.OK;
     1111                } else if (tokens[0].equals("type") || tokens[0].equals("typenospaces")) {
    10711112
    10721113                        String s = getMessage(tokens, context, code.toString(), tokens[0]
    1073                                         .equals("typein") ? " " : "");
     1114                                        .equals("type") ? " " : "", 1);
    10741115                        for (int i = 0; i < s.length(); i++) {
    10751116                                FrameKeyboardActions.processChar(s.charAt(i));
    10761117                                Thread.sleep(25);
    10771118                        }
     1119                        return Status.OK;
     1120                } else if (tokens[0].equals("runstring")) {
     1121                        String codeText = getMessage(tokens, context, code.toString(), " ",
     1122                                        1);
     1123                        Text dynamicCode = new Text(1, codeText);
     1124                        RunItem(dynamicCode, context, Status.OK);
    10781125                        return Status.OK;
    10791126                } else if (tokens[0].startsWith("else")) {
     
    13451392                } else if (tokens[0].equals("copyitem")) {
    13461393                        assertMinParametreCount(tokens, 2);
    1347                         assertVariableType(tokens[1],1,SPointer.itemPrefix);
    1348                         assertVariableType(tokens[2],2,SPointer.itemPrefix);
    1349                         Item item = (Item)context.getPointers().getVariable(tokens[1]).getValue();
     1394                        assertVariableType(tokens[1], 1, SPointer.itemPrefix);
     1395                        assertVariableType(tokens[2], 2, SPointer.itemPrefix);
     1396                        Item item = (Item) context.getPointers().getVariable(tokens[1])
     1397                                        .getValue();
    13501398                        Item copy = item.copy();
    13511399                        context.getPointers().setObject(tokens[2], copy);
    13521400
    13531401                        return Status.OK;
    1354                 }else if (tokens[0].equals("copyframeset")) {
     1402                } else if (tokens[0].equals("copyframeset")) {
    13551403                        assertMinParametreCount(tokens, 2);
    13561404                        String framesetToCopy = context.getPrimitives().getStringValue(
     
    13691417                } else if (tokens[0].equals("copyframe")) {
    13701418                        assertMinParametreCount(tokens, 2);
    1371                         assertVariableType(tokens[1],1,SPointer.framePrefix);
    1372                         assertVariableType(tokens[2],2,SPointer.framePrefix);
     1419                        assertVariableType(tokens[1], 1, SPointer.framePrefix);
     1420                        assertVariableType(tokens[2], 2, SPointer.framePrefix);
    13731421                        Frame frameToCopy = (Frame) context.getPointers().getVariable(
    13741422                                        tokens[1]).getValue();
     
    20632111
    20642112        private static String getMessage(String[] tokens, Context context,
    2065                         String code, String separator) throws Exception {
     2113                        String code, String separator, int firstStringIndex)
     2114                        throws Exception {
    20662115                StringBuilder message = new StringBuilder();
    2067                 if (tokens.length == 1) {
     2116                if (tokens.length == firstStringIndex) {
    20682117                        message.append(context.getPrimitives().getVariable(DEFAULT_STRING)
    20692118                                        .stringValue());
    20702119                } else {
    2071                         for (int i = 1; i < tokens.length; i++) {
     2120                        for (int i = firstStringIndex; i < tokens.length; i++) {
    20722121                                if (Primitives.isPrimitive(tokens[i])) {
    20732122                                        message.append(context.getPrimitives().getVariable(
  • trunk/src/org/expeditee/agents/DisplayTree.java

    r4 r21  
    6161        @Override
    6262        protected void processFrame(Frame toProcess) {
     63                FrameUtils.ResponseTimer.restart();
     64               
    6365                // ignore loops
    6466                if (toProcess != DisplayIO.getCurrentFrame())
    6567                        FrameUtils.DisplayFrame(toProcess, false);
    66 
    67                 FrameUtils.ResponseTimer.restart();
    6868
    6969                // parse the frame for any pause settings
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r18 r21  
    5959         * The title to display in the Title bar.
    6060         */
    61         public static final String TITLE = "Exp06May2008A";
     61        public static final String TITLE = "Exp08May2008B";
    6262
    6363        private DisplayIO() {
     
    8888                cursorType = Item.TEXT_CURSOR;
    8989
    90                 //Do some stuff to adjust the cursor size based on the font size
     90                // Do some stuff to adjust the cursor size based on the font size
    9191                final int MEDIUM_CURSOR_CUTOFF = 31;
    9292                final int LARGE_CURSOR_CUTOFF = 62;
     
    112112                }
    113113
    114                 /*System.out.println("hs: " + hotspotPos + " start: " + start + " font: "
    115                                 + size + " cursor: " + (cursorSize - start));*/
     114                /*
     115                 * System.out.println("hs: " + hotspotPos + " start: " + start + " font: " +
     116                 * size + " cursor: " + (cursorSize - start));
     117                 */
    116118
    117119                int[] pixels = new int[cursorSize * cursorSize];
     
    174176
    175177        public static void setCursorPosition(int x, int y, boolean forceArrow) {
    176                 if (Frame.itemAttachedToCursor()) {
    177                         List<Item> toMove = Frame.FreeItems;
    178 
    179                         int deltax = x - FrameMouseActions.MouseX;
    180                         int deltay = y - FrameMouseActions.MouseY;
    181 
    182                         for (Item move : toMove) {
    183                                 move.setPosition(move.getX() + deltax, move.getY() + deltay);
    184                         }
    185 
    186                         // FrameGraphics.Repaint();
    187 
    188                         // if (!item.getArea().contains(x, y))
    189                         // item.setPosition(x, y);
    190                 }
     178                int deltax = x - FrameMouseActions.MouseX;
     179                int deltay = y - FrameMouseActions.MouseY;
    191180
    192181                if (_TwinFrames) {
     
    195184                }
    196185
    197                 // cheat
    198                 FrameMouseActions.setForceArrow(forceArrow);
    199 
    200186                // ensures the cursor doesn't fall behind while waiting for robot
    201187                FrameMouseActions.MouseX = x;
    202188                FrameMouseActions.MouseY = y;
    203189
    204                 _Robot.mouseMove((int)_Browser.getContentPane().getLocationOnScreen().getX() + x, (int)_Browser.getContentPane().getLocationOnScreen().getY() + y);
     190                if (Frame.itemAttachedToCursor()) {
     191                        List<Item> toMove = Frame.FreeItems;
     192                        for (Item move : toMove) {
     193                                move.setPosition(move.getX() + deltax, move.getY() + deltay);
     194                        }
     195                }
     196
     197                // cheat
     198                FrameMouseActions.setForceArrow(forceArrow);
     199                _Robot.mouseMove((int) _Browser.getContentPane().getLocationOnScreen()
     200                                .getX()
     201                                + x, (int) _Browser.getContentPane().getLocationOnScreen()
     202                                .getY()
     203                                + y);
    205204        }
    206205
     
    330329                                FrameIO.ResumeCache();
    331330                        }
    332                        
     331
    333332                        // If the frames are the same then the items for the
    334333                        // frame that is just about to hide will still be in view
    335334                        // so only notify items that they are hidden if the
    336335                        // frames differ.
    337                         if (_CurrentFrames[getCurrentSide()] != null &&
    338                                 _CurrentFrames[0] != _CurrentFrames[1]) {
     336                        if (_CurrentFrames[getCurrentSide()] != null
     337                                        && _CurrentFrames[0] != _CurrentFrames[1]) {
    339338                                for (Item i : _CurrentFrames[getCurrentSide()].getItems()) {
    340                                         i.onParentFameHidden(); 
     339                                        i.onParentFameHidden();
    341340                                }
    342341                        }
    343342                        _CurrentFrames[getCurrentSide()] = frame;
    344                        
    345                         // BROOK 
     343
     344                        // BROOK
    346345                        for (Item i : _CurrentFrames[getCurrentSide()].getItems()) {
    347346                                i.onParentFameShown();
    348347                        }
    349348                } else {
    350                         // Notifying items on the frame being hidden that they 
     349                        // Notifying items on the frame being hidden that they
    351350                        // are about to be hidden.
    352351                        // ie. Widgets use this method to remove themselves from
    353                         //the JPanel
     352                        // the JPanel
    354353                        if (_CurrentFrames[getCurrentSide()] != null) {
    355354                                for (Item i : _CurrentFrames[getCurrentSide()].getItems()) {
    356                                         i.onParentFameHidden(); 
     355                                        i.onParentFameHidden();
    357356                                }
    358357                        }
    359                        
     358
    360359                        _CurrentFrames[getCurrentSide()] = frame;
    361360                        frame.setMaxSize(FrameGraphics.getMaxFrameSize());
    362                
     361
    363362                        // Notify items on the frame being displayed that they are in view
    364                         //ie. widgets use this method to add themselves to the content pane
     363                        // ie. widgets use this method to add themselves to the content pane
    365364                        for (Item i : _CurrentFrames[getCurrentSide()].getItems()) {
    366365                                i.onParentFameShown();
     
    369368
    370369                FrameGraphics.Repaint();
    371                 UpdateTitle();
    372370        }
    373371
     
    539537                        if (i.getLink() != null
    540538                                        && i.getAbsoluteLink().toLowerCase().equals(oldFrame)) {
    541                                 i.showHighlight(true, BACK_HIGHLIGHT_COLOR);
    542                                 //check if its an @f item and if so update the buffer
     539                                i.setSelectedMode(Item.SelectedMode.Normal,
     540                                                BACK_HIGHLIGHT_COLOR);
     541                                // check if its an @f item and if so update the buffer
    543542                                if (i instanceof Picture) {
    544                                         Picture p = (Picture)i;
     543                                        Picture p = (Picture) i;
    545544                                        p.refresh();
    546545                                }
  • trunk/src/org/expeditee/gui/FrameCreator.java

    r19 r21  
    4141                }
    4242                _name = name;
    43                 _lastY += toUse.getTitle().getPosition().y;
    44                
    45                 //Check for @Start
    46                 for (Item it : toUse.getItems()) {
    47                         if (it instanceof Text) {
    48                                 Text t = (Text) it;
    49                                 if (t.getTextNoList().toLowerCase().equals("@start") ||
    50                                                 t.getTextNoList().toLowerCase().startsWith("@start:")) {
    51                                         t.stripFirstWord();
    52 
    53                                         if (t.getTextNoList().equals("")){
    54                                                 _lastY = t.getY();
    55                                                 _lastX = t.getX();
    56                                                 t.delete();
    57                                                 break;
    58                                         }
    59                                 }
    60                         }
    61                 }
    62                 _current = toUse;
     43                resetGlobals(toUse);
    6344
    6445                // set positions of next\prev frame links
     
    9172                        FrameIO.SaveFrame(_current, false);
    9273
    93                         // update\reset globals
    94                         _current = newFrame;
    95                         _lastY = START_Y + _current.getTitle().getPosition().y;
    96                         ;
    97                         _lastX = START_X;
     74                        resetGlobals(newFrame);
    9875                        _maxX = 0;
    9976                        return true;
     
    10178                        return false;
    10279                }
     80        }
     81
     82        private void resetGlobals(Frame toUse) {
     83                _lastY = START_Y + toUse.getTitle().getPosition().y;
     84                _lastX = START_X;
     85                //Check for @Start
     86                for (Item it : toUse.getItems()) {
     87                        if (it instanceof Text) {
     88                                Text t = (Text) it;
     89                                if (t.getTextNoList().toLowerCase().equals("@start") ||
     90                                                t.getTextNoList().toLowerCase().startsWith("@start:")) {
     91                                        t.stripFirstWord();
     92
     93                                        if (t.getTextNoList().equals("")){
     94                                                _lastY = t.getY();
     95                                                _lastX = t.getX();
     96                                                t.delete();
     97                                                break;
     98                                        }
     99                                }
     100                        }
     101                }
     102                _current = toUse;       
    103103        }
    104104
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r19 r21  
    191191                                && (!isAudienceMode()
    192192                                                || (isAudienceMode() && !i.isAnnotation()) || i == FrameUtils.LastEdited)) {
    193                         /*
    194                          * // do not paint the name of overlay frames if (i.getParent() ==
    195                          * null || i.getParent() == DisplayIO.getCurrentFrame() ||
    196                          * i.getParent() == DisplayIO.getOppositeFrame() || i !=
    197                          * i.getParent().getFrameNameItem()) {
    198                          */
     193
    199194                        Graphics2D tg = (Graphics2D) g.create();
    200195                        i.paint(tg);
     
    260255                                iw.paint(bg);
    261256                        }
    262                        
     257
    263258                        PaintPictures(bg, paintItems);
    264259
     
    314309                                PaintLines(bg, Frame.FreeItems);
    315310                        }
    316                        
     311
    317312                        if (paintOverlay) {
    318313                                PaintItem(bg, toPaint.getFrameNameItem());
    319314                        }
    320                        
     315
    321316                        // BROOK: Ensure popups are repainted
    322317                        if (Browser._theBrowser != null)
     
    408403                g.drawImage(_MessageBuffer, 0, _MaxSize.height, null);
    409404                g.dispose();
    410                
    411         }
    412        
    413 
    414 
     405
     406        }
     407
     408        /**
     409         * Paints the message area
     410         * @param g
     411         * @param background
     412         */
    415413        private static void paintMessage(Graphics2D g, Color background) {
    416414                ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
     
    497495         *            erased.
    498496         */
    499         public static void Highlight(Item i, boolean val, boolean changeMouse) {
     497        public static void Highlight(Item i) {
    500498                if ((i instanceof Line)) {
    501499                        // Check if within 20% of the end of the line
     
    506504                        // Brook: Widget Edges do not have such a context
    507505                        if (toDisconnect != null && !(i instanceof WidgetEdge)) {
    508                                 if(Frame.itemAttachedToCursor())
    509                                         return;
    510                                
    511                                 //unhighlight all the other dots
     506                                Item.SelectedMode newMode = toDisconnect.getSelectedMode();
     507                                if (Frame.itemAttachedToCursor())
     508                                        newMode = Item.SelectedMode.Normal;
     509                                // unhighlight all the other dots
    512510                                for (Item conn : toDisconnect.getAllConnected()) {
    513                                         conn.showHighlight(false);
     511                                        conn.setSelectedMode(Item.SelectedMode.None);
    514512                                }
    515                                 //highlight the dot that will be in disconnect mode
    516                                 toDisconnect.showDisconnectHighlight(val);
    517                                 toDisconnect.setFilledHighlight(true);
     513                                l.setSelectedMode(newMode);
     514                                // highlight the dot that will be in disconnect mode
     515                                toDisconnect.setSelectedMode(newMode);
    518516                        } else {
    519517                                List<Item> connected = i.getAllConnected();
    520518                                for (Item conn : connected) {
    521                                         conn.showHighlight(val);
    522                                         conn.setFilledHighlight(false);
     519                                        conn.setSelectedMode(Item.SelectedMode.Connected);
    523520                                }
    524521                        }
    525522                } else {
    526                         i.showHighlight(val);
    527                         i.setFilledHighlight(true);
    528                 }
    529 
     523                        i.setSelectedMode(Item.SelectedMode.Normal);
     524                }
     525
     526                Repaint();
     527        }
     528       
     529        public static void ChangeSelectionMode(Item item, Item.SelectedMode newMode) {
     530                if (item == null)
     531                        return;
     532               
     533                for(Item i: item.getAllConnected())
     534                        i.setSelectedMode(newMode);
    530535                Repaint();
    531536        }
     
    567572
    568573        public static void DisplayMessageAlways(String message) {
    569                 //_lastMessage = null;
     574                // _lastMessage = null;
    570575                displayMessage(message, null, Color.BLACK);
    571576                Misc.Beep();
     
    577582        }
    578583
    579         //private static String _lastMessage = null;
     584        // private static String _lastMessage = null;
    580585
    581586        private static void displayMessage(String message, String link, Color color) {
    582587                // add timestamp to message
    583                 //if (message.equals(_lastMessage))
    584                 //      return;
    585                 //_lastMessage = message;
     588                // if (message.equals(_lastMessage))
     589                // return;
     590                // _lastMessage = message;
    586591
    587592                // message += _formatter.format(Calendar.getInstance().getTime());
     
    603608                        for (int i = 0; i < Messages.length; i++) {
    604609                                if (Messages[i] == null) {
    605                                         Messages[i] = new Text(-1, "@" + _MessageCount++ + ": " + message);
     610                                        Messages[i] = new Text(-1, "@" + _MessageCount++ + ": "
     611                                                        + message);
    606612                                        Messages[i].setPosition(20, pos);
    607613                                        Messages[i].setOffset(0, -_MaxSize.height);
     
    748754                _SupressErrors = val;
    749755        }
    750        
    751756
    752757        private static void repaintPopups(Container parent, Graphics g) {
    753758                for (Component c : parent.getComponents()) {
    754                         if (c instanceof JPopupMenu && ((JPopupMenu)c).isVisible()) {
    755                                
    756                                 Point p = SwingUtilities.convertPoint(c, c.getLocation(), Browser._theBrowser.getContentPane());
    757                                
     759                        if (c instanceof JPopupMenu && ((JPopupMenu) c).isVisible()) {
     760
     761                                Point p = SwingUtilities.convertPoint(c, c.getLocation(),
     762                                                Browser._theBrowser.getContentPane());
     763
    758764                                g.translate(p.x, p.y);
    759765                                c.paint(g);
    760766                                g.translate(-p.x, -p.y);
    761                         } else if (c instanceof Container &&
    762                                         c != Browser._theBrowser.getContentPane()) {
    763                                 repaintPopups((Container)c, g);
     767                        } else if (c instanceof Container
     768                                        && c != Browser._theBrowser.getContentPane()) {
     769                                repaintPopups((Container) c, g);
    764770                        }
    765771                }
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r19 r21  
    559559        }
    560560
     561        public static void functionKey(int key) {
     562                functionKey(key, 1);
     563        }
     564       
    561565        /**
    562566         * Called when a Function key has been pressed, and performs the specific
    563567         * action based on the key.
    564568         */
    565         public static void functionKey(int key) {
     569        public static void functionKey(int key, int repeat) {
    566570                // get whatever the user is pointing at
    567571                Item on = FrameUtils.getCurrentItem();
     
    594598                                                        if (resizeLines
    595599                                                                        || (!(ip instanceof Line) && !(ip instanceof Dot)))
    596                                                                 SetSize(ip, 1, false);
     600                                                                SetSize(ip, repeat, false);
    597601                                                        break;
    598602                                                case SIZE_DOWN:
    599603                                                        if (resizeLines
    600604                                                                        || (!(ip instanceof Line) && !(ip instanceof Dot)))
    601                                                                 SetSize(ip, -1, false);
     605                                                                SetSize(ip, -repeat, false);
    602606                                                        break;
    603607                                                // case COLOR_CHANGE: SetFillColor(ip); break;
     
    632636                        break;
    633637                case SIZE_UP:
    634                         SetSize(on, 1, true);
     638                        SetSize(on, repeat, true);
    635639                        break;
    636640                case SIZE_DOWN:
    637                         SetSize(on, -1, true);
     641                        SetSize(on, -repeat, true);
    638642                        break;
    639643                case COLOR_CHANGE:
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r10 r21  
    3232public class FrameMouseActions implements MouseListener, MouseMotionListener,
    3333                MouseWheelListener {
    34        
    35 
    36         private FrameMouseActions() {}
    37        
     34
     35        private FrameMouseActions() {
     36        }
     37
    3838        private static FrameMouseActions _instance = null;
    39        
     39
    4040        public static FrameMouseActions getInstance() {
    41                 if (_instance == null) _instance = new FrameMouseActions();
     41                if (_instance == null)
     42                        _instance = new FrameMouseActions();
    4243                return _instance;
    4344        }
     
    198199        public void mouseClicked(MouseEvent e) {
    199200        }
    200        
     201
    201202        /**
    202203         * Each Item on the Frame is checked to determine if the mouse x,y
     
    275276                {
    276277                        // This must happen before the previous code
     278                        // This is when the user is anchoring something
    277279                        if (_context == CONTEXT_FREESPACE && Frame.itemAttachedToCursor()) {
     280                                FrameGraphics.ChangeSelectionMode(_lastHighlightedItem, Item.SelectedMode.None);
     281                               
    278282                                _lastHighlightedItem = Frame.getItemAttachedToCursor();
    279                         }
    280                         // show depressed highlighting
    281                         if (_lastHighlightedItem != null) {
    282                                 _lastHighlightedItem.showDepressedHighlight(true);
     283                                for (Item i : Frame.FreeItems) {
     284                                        i.restoreLastMode(Item.DEPRESSED_HIGHLIGHT);
     285                                }
     286                                FrameGraphics.Repaint();
     287                                // this is when the user is picking something up
     288                        } else if (_lastHighlightedItem != null) {
     289                                if (!(_lastHighlightedItem instanceof Line)) {
     290                                        _lastHighlightedItem
     291                                                        .setSelectionColor(Item.DEPRESSED_HIGHLIGHT);
     292                                } else {
     293                                        for (Item i : _lastHighlightedItem.getAllConnected()) {
     294                                                i.setSelectionColor(Item.DEPRESSED_HIGHLIGHT);
     295                                        }
     296                                }
    283297                                FrameGraphics.Repaint();
    284298                        }
     
    305319        // This is where all the processing happens
    306320        public void mouseReleased(MouseEvent e) {
     321                FrameUtils.ResponseTimer.restart();
     322               
    307323                _mouseDown -= e.getButton();
    308324                updateCursor();
     
    331347                }
    332348
    333                 FrameUtils.ResponseTimer.restart();
    334 
    335349                _ExtrudeMouseTimer.stop();
    336350                _MouseTimer.stop();
     
    374388
    375389                        if (_lastHighlightedItem != null)
    376                                 FrameGraphics.Highlight(_lastHighlightedItem, false, false);
     390                                FrameGraphics.ChangeSelectionMode(_lastHighlightedItem,
     391                                                Item.SelectedMode.None);
    377392
    378393                        if (Frame.itemAttachedToCursor()) {
     
    578593                if (clicked == null)
    579594                        return false;
    580                
     595
    581596                // Brook: widgets do not merge
    582                 if (clicked instanceof WidgetCorner) return false;
    583                
     597                if (clicked instanceof WidgetCorner)
     598                        return false;
     599
    584600                // Brook: widgets do not merge
    585                 if (clicked instanceof WidgetEdge) return false;
     601                if (clicked instanceof WidgetEdge)
     602                        return false;
    586603
    587604                // System.out.println(Frame.FreeItems.size());
     
    655672
    656673                                        if (toDisconnect != null) {
    657                                                 List<Line> lines = toDisconnect.getLines();
    658                                                 if (lines.size() == 1) {
    659                                                         //remove constraints
    660                                                         toDisconnect.removeAllConstraints();
    661                                                        
    662                                                         DisplayIO.setCursorPosition(toDisconnect
    663                                                                         .getPosition(), false);
     674                                                if (toDisconnect.getSelectedMode() == Item.SelectedMode.Normal) {
    664675                                                        pickup(toDisconnect);
    665676                                                        return;
    666                                                 }
    667                                                 // If we are then detatch the line and pick up its end
    668                                                 // point...
    669                                                 Frame currentFrame = DisplayIO.getCurrentFrame();
    670                                                 Item newPoint = toDisconnect.copy();
    671                                                 newPoint.setID(currentFrame.getNextItemID());
    672                                                 currentFrame.addItem(newPoint);
    673                                                 // remove the current item from the connected
    674                                                 // list for this item
    675                                                 for (Item i : lines) {
    676                                                         if (i == l) {
    677                                                                 toDisconnect.removeLine(l);
    678                                                                 break;
     677                                                } else {
     678                                                        List<Line> lines = toDisconnect.getLines();
     679                                                        if (lines.size() == 1) {
     680                                                                // remove constraints
     681                                                                toDisconnect.removeAllConstraints();
     682
     683                                                                DisplayIO.setCursorPosition(toDisconnect
     684                                                                                .getPosition(), false);
     685                                                                pickup(toDisconnect);
     686                                                                return;
    679687                                                        }
    680                                                 }
    681                                                 if (toDisconnect == l.getStartItem()) {
    682                                                         l.setStartItem(newPoint);
    683                                                 } else {
    684                                                         l.setEndItem(newPoint);
    685                                                 }
    686 
    687                                                 // remove unneeded constrains
    688                                                 List<Constraint> constraints = toDisconnect
    689                                                                 .getConstraints();
    690                                                 if (constraints != null) {
    691                                                         for (Constraint c : constraints) {
    692                                                                 Item oppositeEnd = l.getOppositeEnd(newPoint);
    693                                                                 if (c.contains(oppositeEnd)) {
    694                                                                         toDisconnect.removeConstraint(c);
    695                                                                         oppositeEnd.removeConstraint(c);
     688                                                        // If we are then detatch the line and pick up its
     689                                                        // end
     690                                                        // point...
     691                                                        Frame currentFrame = DisplayIO.getCurrentFrame();
     692                                                        Item newPoint = toDisconnect.copy();
     693                                                        newPoint.setID(currentFrame.getNextItemID());
     694                                                        currentFrame.addItem(newPoint);
     695                                                        // remove the current item from the connected
     696                                                        // list for this item
     697                                                        for (Item i : lines) {
     698                                                                if (i == l) {
     699                                                                        toDisconnect.removeLine(l);
    696700                                                                        break;
    697701                                                                }
    698702                                                        }
     703                                                        if (toDisconnect == l.getStartItem()) {
     704                                                                l.setStartItem(newPoint);
     705                                                        } else {
     706                                                                l.setEndItem(newPoint);
     707                                                        }
     708
     709                                                        // remove unneeded constrains
     710                                                        List<Constraint> constraints = toDisconnect
     711                                                                        .getConstraints();
     712                                                        if (constraints != null) {
     713                                                                for (Constraint c : constraints) {
     714                                                                        Item oppositeEnd = l
     715                                                                                        .getOppositeEnd(newPoint);
     716                                                                        if (c.contains(oppositeEnd)) {
     717                                                                                toDisconnect.removeConstraint(c);
     718                                                                                oppositeEnd.removeConstraint(c);
     719                                                                                break;
     720                                                                        }
     721                                                                }
     722                                                        }
     723
     724                                                        toDisconnect
     725                                                                        .setSelectedMode(Item.SelectedMode.None);
     726                                                        DisplayIO.setCursorPosition(toDisconnect
     727                                                                        .getPosition(), false);
     728                                                        pickup(newPoint);
     729
     730                                                        return;
    699731                                                }
    700 
    701                                                 toDisconnect.showHighlight(false);
    702                                                 DisplayIO.setCursorPosition(toDisconnect.getPosition(),
    703                                                                 false);
    704                                                 pickup(newPoint);
    705 
    706                                                 return;
    707732                                        }
    708733                                }
    709                                
     734
    710735                                pickup(clicked);
    711736                                return;
     
    11101135         */
    11111136        public void mouseMoved(MouseEvent e) {
    1112                 // System.out.println("MouseMoved");
    1113 
    11141137                MouseX = e.getX();
    11151138                MouseY = e.getY();
     
    11341157                // threshold speed. If so it doesnt execute the code that checks if
    11351158                // items underneath the cursor need to be highlighted.
    1136                 if (Frame.itemAttachedToCursor()) {
     1159                /*if (Frame.itemAttachedToCursor()) {
    11371160                        long time = e.getWhen() - _lastMouseEvent.getWhen();
    11381161                        // System.out.println(time + " D:" + distance);
     
    11411164                                // System.out.println("Dont check highlight!");
    11421165                                if (_lastHighlightedItem != null && !_lastHoldsHighlight) {
    1143                                         FrameGraphics.Highlight(_lastHighlightedItem, false, true);
    1144                                 }
    1145                         }
    1146                 }
     1166                                        if(_lastHighlightedItem instanceof Text) {
     1167                                                FrameGraphics.ChangeSelectionMode(_lastHighlightedItem,
     1168                                                        Item.SelectedMode.None);
     1169                                        }
     1170                                }
     1171                        }
     1172                }*/
    11471173
    11481174                _lastMouseEvent = e;
     
    11921218                                                                DisplayIO.getMouseX(), DisplayIO.getMouseY());
    11931219                                        else
    1194                                                 FrameGraphics.Highlight(on, true, true);
    1195                                 } else
    1196                                         FrameGraphics.Highlight(on, true, true);
    1197 
     1220                                                // The user is pointing at another point or text item
     1221                                                // etc
     1222                                                FrameGraphics.ChangeSelectionMode(on,
     1223                                                                Item.SelectedMode.Normal);
     1224                                } else {
     1225                                        // FrameGraphics.ChangeSelectionMode(on,
     1226                                        // Item.SelectedMode.Connected);
     1227                                        FrameGraphics.Highlight(on);
     1228                                }
    11981229                                // if the last item highlighted is still highlighted, clear it
    11991230                                if (_lastHoldsHighlight) {
     
    12011232                                        for (Item i : DisplayIO.getCurrentFrame().getItems())
    12021233                                                if (i.isHighlighted() && i != on)
    1203                                                         FrameGraphics.Highlight(i, false, false);
     1234                                                        FrameGraphics.ChangeSelectionMode(i,
     1235                                                                        Item.SelectedMode.None);
    12041236                                }
    12051237
     
    12091241                                List<Dot> enclosure = FrameUtils.getEnclosingDots();
    12101242                                if (enclosure != null && enclosure.size() > 1) {
    1211                                         if (enclosure.get(0).getLines().size() > 1) {
     1243                                        if (enclosure.get(0).getLines().size() > 1 &&
     1244                                        // check that the enclosure is not part of a point being
     1245                                                        // dragged in space
     1246                                                        !ContainsOneOf(enclosure, Frame.FreeItems)) {
    12121247                                                on = enclosure.get(0).getLines().get(0);
    1213                                                 // FrameGraphics.Highlight(enclosure.get(0).getLines().get(0),
    1214                                                 // true, true);
    1215                                                 FrameGraphics.Highlight(on, true, true);
     1248                                                FrameGraphics.ChangeSelectionMode(on,
     1249                                                                Item.SelectedMode.Enclosed);
    12161250                                        }
    1217                                         // for(Dot d : enclosure){
    1218                                         // FrameGraphics.Highlight(d, true, true);
    1219                                         // break;
    1220                                         // }
    12211251                                } else if (_lastHighlightedItem != null) {
    12221252                                        _lastHoldsHighlight = false;
     
    12311261                        if (_lastHighlightedItem != null && _lastHighlightedItem != on
    12321262                                        && !_lastHoldsHighlight) {
    1233                                 FrameGraphics.Highlight(_lastHighlightedItem, false, true);
     1263                                if (!_lastHighlightedItem.getAllConnected().contains(on))
     1264                                        FrameGraphics.ChangeSelectionMode(_lastHighlightedItem,
     1265                                                        Item.SelectedMode.None);
    12341266                        }
    12351267
     
    12491281
    12501282                _forceArrowCursor = true;
     1283        }
     1284
     1285        private boolean ContainsOneOf(List<Dot> enclosure, List<Item> freeItems) {
     1286                if (freeItems == null)
     1287                        return false;
     1288                for (Item i : freeItems) {
     1289                        if (enclosure.contains(i))
     1290                                return true;
     1291                }
     1292                return false;
    12511293        }
    12521294
     
    13421384        private static void back() {
    13431385                checkTDFCItemWaiting();
    1344                
     1386
    13451387                DisplayIO.Back();
    13461388
     
    15371579                List<Item> toUndo = new LinkedList<Item>();
    15381580                List<Item> seen = new LinkedList<Item>();
    1539                
     1581
    15401582                // disconnect any connected items
    15411583                for (Item i : itemList) {
     
    16041646
    16051647        private static List<Item> deleteDot(Dot dot) {
    1606                
     1648
    16071649                if (dot instanceof WidgetCorner) { // Brook
    1608                        
    1609                         WidgetCorner wc = (WidgetCorner)dot;
     1650
     1651                        WidgetCorner wc = (WidgetCorner) dot;
    16101652                        List<Item> wccopy;
    1611                        
     1653
    16121654                        try {
    16131655                                wccopy = wc.getWidgetSource().copy().getItems();
     
    16161658                                return new LinkedList<Item>();
    16171659                        }
    1618                        
     1660
    16191661                        if (dot.getParent() != null) {
    16201662                                dot.getParent().removeAllItems(wc.getWidgetSource().getItems());
     
    16221664                        return wccopy;
    16231665                } else {
    1624                        
     1666
    16251667                        // create a backup copy of the dot
    16261668                        List<Item> copy = copy(dot.getConnected());
     
    16361678                                }
    16371679                        }
    1638        
     1680
    16391681                        // remove all lines being deleted
    16401682                        for (Item ic : dot.getConnected()) {
    1641                                 if (ic instanceof Line && ((Line) ic).getOppositeEnd(dot) != null) {
     1683                                if (ic instanceof Line
     1684                                                && ((Line) ic).getOppositeEnd(dot) != null) {
    16421685                                        Line line = (Line) ic;
    1643        
     1686
    16441687                                        Item d = line.getOppositeEnd(dot);
    16451688                                        d.removeLine(line);
    1646        
     1689
    16471690                                        // if the dot was only part of one line, it can be
    16481691                                        // removed
     
    16531696                                                        copy.add(d);
    16541697                                        }
    1655        
     1698
    16561699                                        if (dot.getParent() != null)
    16571700                                                dot.getParent().removeItem(ic);
     
    18071850         */
    18081851        public static void pickup(Item toGrab) {
    1809                
    1810                 // Brook: If the widget corner is being picked up. Instead refer to picking
     1852
     1853                // Brook: If the widget corner is being picked up. Instead refer to
     1854                // picking
    18111855                // up the edge for fixed-sized widgets so it is not so confusing
    18121856                if (toGrab instanceof WidgetCorner) {
     
    18161860                        }
    18171861                }
    1818                
     1862
    18191863                pickup(toGrab.getConnected());
    18201864        }
     
    19231967                                if (line.getID() < 0 && !current.getItems().contains(line)) {
    19241968                                        line.setID(current.getNextItemID());
    1925                                         line.showHighlight(true);
     1969                                        line.setSelectionColor();
    19261970                                        // Mike: Why was this line here?
    19271971                                        // anchor(line);
     
    19882032                        }
    19892033
    1990                         for (int i = 0; i < clicks; i++)
    1991                                 FrameKeyboardActions.functionKey(rotationType);
     2034                        Item ip = FrameUtils.getCurrentItem();
     2035                        if (ip != null && clicks > 1)
     2036                                //base the number of clicks on the size of the object
     2037                                clicks = (int)Math.ceil(ip.getSize() / 20.0 * clicks);
     2038
     2039                        FrameKeyboardActions.functionKey(rotationType, clicks);
    19922040                } else if (clicks == MOUSE_WHEEL_THRESHOLD) {
    19932041                        Item ip = FrameUtils.getCurrentItem();
     
    20292077
    20302078        public static boolean isDelete(int modifiersEx) {
    2031                
     2079
    20322080                int onMask = MouseEvent.BUTTON3_DOWN_MASK
    20332081                                | MouseEvent.BUTTON2_DOWN_MASK;
     
    20482096
    20492097        public static boolean wasDeleteClicked() {
    2050                 if (_lastMouseClick == null) return false;
     2098                if (_lastMouseClick == null)
     2099                        return false;
    20512100                return isDelete(_lastMouseClick.getModifiersEx());
    20522101        }
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r19 r21  
    246246
    247247                for (Item i : current.getItems())
    248                         i.showHighlight(false);
     248                        i.setSelectedMode(Item.SelectedMode.None);
    249249                return true;
    250250        }
     
    354354                _LastResponse = ResponseTimer.getElapsedSeconds();
    355355                _ResponseTimeSum += _LastResponse;
     356                DisplayIO.UpdateTitle();
    356357        }
    357358
     
    454455                return true;
    455456        }
    456        
     457
    457458        /**
    458          * Creates an interactive widget and adds it to a frame.
    459          * If txt has no parent the parent will be set to frame.
    460          *
    461          * @param frame 
    462          *              Frame to add widget to. Must not be null.
    463          *
    464          * @param txt 
    465          *              Text to create the widget from. Must not be null.
     459         * Creates an interactive widget and adds it to a frame. If txt has no
     460         * parent the parent will be set to frame.
     461         *
     462         * @param frame
     463         *            Frame to add widget to. Must not be null.
     464         *
     465         * @param txt
     466         *            Text to create the widget from. Must not be null.
    466467         *
    467468         * @return True if created/added. False if coul not create.
     
    471472        private static boolean createWidget(Frame frame, Text txt) {
    472473
    473                 if (frame == null) throw new NullPointerException("frame");
    474                 if (txt == null) throw new NullPointerException("txt");
    475                
     474                if (frame == null)
     475                        throw new NullPointerException("frame");
     476                if (txt == null)
     477                        throw new NullPointerException("txt");
     478
    476479                // Safety
    477                 if (txt.getParent() == null) txt.setParent(frame);
    478                
     480                if (txt.getParent() == null)
     481                        txt.setParent(frame);
     482
    479483                InteractiveWidget iw = null;
    480                
     484
    481485                try {
    482                        
     486
    483487                        iw = InteractiveWidget.CreateWidget(txt);
    484                        
     488
    485489                } catch (InteractiveWidgetNotAvailableException e) {
    486490                        e.printStackTrace();
    487                         FrameGraphics.ErrorMessage("Cannot create iWidget: " + e.getMessage());
    488                        
    489                 }  catch (IllegalArgumentException e) {
     491                        FrameGraphics.ErrorMessage("Cannot create iWidget: "
     492                                        + e.getMessage());
     493
     494                } catch (IllegalArgumentException e) {
    490495                        e.printStackTrace();
    491                         FrameGraphics.ErrorMessage("Cannot create iWidget: " + e.getMessage());
    492                 }
    493                
    494                 if (iw == null) return false;
     496                        FrameGraphics.ErrorMessage("Cannot create iWidget: "
     497                                        + e.getMessage());
     498                }
     499
     500                if (iw == null)
     501                        return false;
    495502
    496503                frame.removeItem(txt);
    497                
     504
    498505                frame.addAllItems(iw.getItems());
    499506
     
    682689                // if XRayMode is on, replace pictures with their underlying text
    683690                if (FrameGraphics.isXRayMode()) {
    684                        
     691
    685692                        // BROOK: Must handle these a little different
    686                         //List<InteractiveWidget> widgets = toParse.getInteractiveWidgets();
     693                        // List<InteractiveWidget> widgets =
     694                        // toParse.getInteractiveWidgets();
    687695                        ArrayList<InteractiveWidget> widgets = new ArrayList<InteractiveWidget>();
    688696                        /*
     697                         * for (Item i : items) { if (i instanceof Picture) {
     698                         * toParse.removeItem(i); toParse.addItem(((Picture) i).getText()); }
     699                         * else if (i instanceof WidgetCorner) { toParse.removeItem(i); }
     700                         * else if (i instanceof WidgetEdge) { toParse.removeItem(i); } }
     701                         */
    689702                        for (Item i : items) {
    690703                                if (i instanceof Picture) {
     
    693706                                } else if (i instanceof WidgetCorner) {
    694707                                        toParse.removeItem(i);
    695                                 } else if (i instanceof WidgetEdge) {
    696                                         toParse.removeItem(i);
    697                                 }
    698                         }*/
    699                         for (Item i : items) {
    700                                 if (i instanceof Picture) {
    701                                         toParse.removeItem(i);
    702                                         toParse.addItem(((Picture) i).getText());
    703                                 } else if (i instanceof WidgetCorner) {
    704                                         toParse.removeItem(i);
    705                                         InteractiveWidget iw = ((WidgetCorner)i).getWidgetSource();
    706                                         if (!widgets.contains(iw)) { // hmmm I should be using a set... meh
     708                                        InteractiveWidget iw = ((WidgetCorner) i).getWidgetSource();
     709                                        if (!widgets.contains(iw)) { // hmmm I should be using a
     710                                                // set... meh
    707711                                                widgets.add(iw);
    708712                                        }
    709                                 } else if (i instanceof WidgetEdge) toParse.removeItem(i);
    710                         }
    711 
     713                                } else if (i instanceof WidgetEdge)
     714                                        toParse.removeItem(i);
     715                        }
    712716
    713717                        for (InteractiveWidget iw : widgets) {
    714718                                toParse.addItem(iw.getSource());
    715719                        }
    716                        
     720
    717721                        // update the list of items
    718722                        items.clear();
     
    918922                                        if (message.contains(x, y)) {
    919923                                                message.Permission = Item.PERMISSION_COPY;
    920                                         }
    921                                         possibles.add(message);
     924                                                possibles.add(message);
     925                                        } else
     926                                                // Not sure why but if the line below is removed then
     927                                                // several items can be highlighted at once
     928                                                message.setSelectedMode(Item.SelectedMode.None);
    922929                                }
    923930                        }
     
    927934                                if (FrameGraphics.MessageLink.contains(x, y)) {
    928935                                        FrameGraphics.MessageLink.Permission = Item.PERMISSION_COPY;
    929                                 }
    930                                 possibles.add(FrameGraphics.MessageLink);
    931                         }
    932                         y -= FrameGraphics.getMaxFrameSize().getHeight();
     936                                        possibles.add(FrameGraphics.MessageLink);
     937                                }
     938                        }
     939
     940                        // this is taken into account in contains
     941                        // y -= FrameGraphics.getMaxFrameSize().height;
    933942                        // otherwise, the mouse is on the frame
    934943                } else {
     
    942951                        } else
    943952                                LastEdited = null;
    944                        
     953
    945954                        ArrayList<Item> checkList = new ArrayList<Item>();
    946955                        checkList.addAll(toCheck.getItems());
     
    10281037                        return null;
    10291038
    1030                 return getItemsEnclosedBy(DisplayIO.getCurrentFrame(), enclosure.get(0)
    1031                                 .getEnclosedShape());
     1039                List<Item> enclosed = getItemsEnclosedBy(DisplayIO.getCurrentFrame(),
     1040                                enclosure.get(0).getEnclosedShape());
     1041                for (Item i : enclosed) {
     1042                        if (!enclosure.contains(i))
     1043                                i.setSelectedMode(Item.SelectedMode.None);
     1044                }
     1045
     1046                return enclosed;
    10321047        }
    10331048
     
    11231138                        // if the item is on the frame
    11241139                        if (item.getParent() == frame || item.getParent() == null) {
    1125                                 // TODO this is a bit of a hack...
    1126                                 // the
    1127                                 // item
    1128                                 // parent
    1129                                 // should
    1130                                 // really
    1131                                 // be
    1132                                 // set
    1133                                 // when
    1134                                 // the
    1135                                 // polygon
    1136                                 // is
    1137                                 // created...
    11381140                                item.Permission = Item.PERMISSION_FULL;
    11391141                                results.add(item);
  • trunk/src/org/expeditee/gui/MouseEventRouter.java

    r14 r21  
    99import java.awt.event.MouseEvent;
    1010import java.awt.event.MouseWheelEvent;
     11import java.awt.event.MouseWheelListener;
    1112
    1213import javax.swing.JComponent;
     
    1920
    2021/**
    21  * The gateway for mouse input; conditionally forwards mouse messages
    22  * to swing components / expeditee frames for the Browser
     22 * The gateway for mouse input; conditionally forwards mouse messages to swing
     23 * components / expeditee frames for the Browser
    2324 *
    2425 * @author Brook Novak
    25  *
     26 * 
    2627 */
    27 public class MouseEventRouter extends JComponent implements AWTEventListener {
    28 
     28public class MouseEventRouter extends JComponent implements AWTEventListener{
    2929
    3030        private static final long serialVersionUID = 1L;
    31        
     31
    3232        private JMenuBar _menuBar;
     33
    3334        private Container _contentPane;
    34        
     35
    3536        public MouseEventRouter(JMenuBar menuBar, Container contentPane) {
    36                
    37                 if (contentPane == null) throw new NullPointerException("contentPane");
    38                
     37
     38                if (contentPane == null)
     39                        throw new NullPointerException("contentPane");
     40
    3941                // Listen for all AWT events (ensures popups are included)
    40                 Toolkit.getDefaultToolkit().addAWTEventListener(this,
    41                 AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    42                
     42                Toolkit.getDefaultToolkit().addAWTEventListener(
     43                                this,
     44                                AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK
     45                                                | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
     46
    4347                this._menuBar = menuBar;
    4448                this._contentPane = contentPane;
    4549        }
    46        
     50
    4751        /**
    4852         * All events for every component in frame are fired to here
    49          */ 
     53         */
    5054        public void eventDispatched(AWTEvent event) {
    51            if (event instanceof MouseEvent) {
    52                    routeMouseEvent((MouseEvent)event);
    53            }
    54         }
    55                  
     55                if (event instanceof MouseEvent) {
     56                        routeMouseEvent((MouseEvent) event);
     57                }
     58        }
     59
    5660        /**
    57          * Forwards the mouse event to its appropriate destination. For events
    58          * that belong to Expiditee space the events are consumed and manually
    59          * routed to the mouse actions handler.
     61         * Forwards the mouse event to its appropriate destination. For events that
     62         * belong to Expiditee space the events are consumed and manually routed to
     63         * the mouse actions handler.
    6064         *
    61          * @param e The mouse event for any component in the browser frame
     65         * @param e
     66         *            The mouse event for any component in the browser frame
    6267         */
    6368        private void routeMouseEvent(MouseEvent e) {
    64                
     69
    6570                // First convert the point to expeditee space
    66                 Point containerPoint = SwingUtilities.convertPoint(
    67                                 e.getComponent(),
    68                                 e.getPoint(),
    69                         _contentPane);
    70                
     71                Point containerPoint = SwingUtilities.convertPoint(e.getComponent(), e
     72                                .getPoint(), _contentPane);
     73
    7174                if (containerPoint.y < 0) { // not in the content pane
    72                        
    73                         if (_menuBar != null && containerPoint.y + _menuBar.getHeight() >= 0) {
    74                                   //The mouse event is over the menu bar.
    75                                   //Could handle specially.
    76                         } else {
    77                           //The mouse event is over non-system window
    78                           //decorations, such as the ones provided by
    79                           //the Java look and feel.
    80                           //Could handle specially.
    81                         }
    82                        
     75
     76                        if (_menuBar != null
     77                                        && containerPoint.y + _menuBar.getHeight() >= 0) {
     78                                // The mouse event is over the menu bar.
     79                                // Could handle specially.
     80                        } else {
     81                                // The mouse event is over non-system window
     82                                // decorations, such as the ones provided by
     83                                // the Java look and feel.
     84                                // Could handle specially.
     85                        }
     86
    8387                } else {
    84                        
     88
    8589                        // Check to see if the mouse is over an expeditee item or
    8690                        // whether an expeditee item is currently picked up
    8791                        boolean forwardToExpiditee = false;
    88                        
     92
    8993                        // Note: all frame.content pane events belong to expeditee
    90                         if (e.getSource() == _contentPane ||
    91                                         e.getSource() == Browser._theBrowser ||
    92                                         Frame.itemAttachedToCursor()) {
     94                        if (e.getSource() == _contentPane
     95                                        || e.getSource() == Browser._theBrowser
     96                                        || Frame.itemAttachedToCursor()) {
    9397                                forwardToExpiditee = true;
    94                         } else if (DisplayIO.getCurrentFrame() != null) { // is mouse over a specific expeditee item?
    95                                 // NOTE: Do not use FrameUtils.getCurrentItem() - thats relevent for old mouse position only
     98                        } else if (DisplayIO.getCurrentFrame() != null) { // is mouse over
     99                                // a specific
     100                                // expeditee
     101                                // item?
     102                                // NOTE: Do not use FrameUtils.getCurrentItem() - thats relevent
     103                                // for old mouse position only
    96104                                for (Item i : DisplayIO.getCurrentFrame().getItems()) {
    97105                                        if (i.getPolygon().contains(containerPoint)) {
     
    101109                                }
    102110                        }
    103                                
     111
    104112                        if (forwardToExpiditee) {
    105                                
    106                                 // If forwarding to Expiditee ensure that widgets highlighting is enabled
    107                                 // do give visual feedback yo users such that Expiditee has focus.
     113
     114                                // If forwarding to Expiditee ensure that widgets highlighting
     115                                // is enabled
     116                                // do give visual feedback yo users such that Expiditee has
     117                                // focus.
    108118                                InteractiveWidget.enableExepiteeHighlighting(true);
    109                                
     119
    110120                                // Ensure that underlying widgets don't get the event
    111121                                e.consume();
    112122
    113123                                // Create artificial mouse event and forward it to expeditee
    114                                 MouseEvent expediteeEvent = SwingUtilities.convertMouseEvent(
    115                                                 e.getComponent(), e, _contentPane);
    116                        
     124                                MouseEvent expediteeEvent = SwingUtilities.convertMouseEvent(e
     125                                                .getComponent(), e, _contentPane);
     126
    117127                                switch (e.getID()) {
    118128                                case MouseEvent.MOUSE_MOVED:
    119129                                        FrameMouseActions.getInstance().mouseMoved(expediteeEvent);
    120                                        
     130
    121131                                        // Ensure that expiditee has focus only if no popups exist
    122132                                        if (!Browser._theBrowser.getContentPane().isFocusOwner()
     
    124134                                                Browser._theBrowser.getContentPane().requestFocus();
    125135                                        }
    126                                        
     136
    127137                                        break;
    128138                                case MouseEvent.MOUSE_CLICKED:
    129                                         FrameMouseActions.getInstance().mouseClicked(expediteeEvent);
     139                                        FrameMouseActions.getInstance()
     140                                                        .mouseClicked(expediteeEvent);
    130141                                        break;
    131142                                case MouseEvent.MOUSE_PRESSED:
    132                                         FrameMouseActions.getInstance().ProccessMousePressedEvent(expediteeEvent, e.getModifiersEx());
     143                                        FrameMouseActions.getInstance().ProccessMousePressedEvent(
     144                                                        expediteeEvent, e.getModifiersEx());
    133145                                        break;
    134146                                case MouseEvent.MOUSE_RELEASED:
    135                                         FrameMouseActions.getInstance().mouseReleased(expediteeEvent);
     147                                        FrameMouseActions.getInstance().mouseReleased(
     148                                                        expediteeEvent);
    136149                                        break;
    137150                                case MouseEvent.MOUSE_WHEEL:
    138                                         FrameMouseActions.getInstance().mouseWheelMoved((MouseWheelEvent)expediteeEvent);
     151                                        FrameMouseActions.getInstance().mouseWheelMoved(
     152                                                        (MouseWheelEvent) expediteeEvent);
    139153                                        break;
    140154                                case MouseEvent.MOUSE_ENTERED:
    141                                         FrameMouseActions.getInstance().mouseEntered(expediteeEvent);
     155                                        FrameMouseActions.getInstance()
     156                                                        .mouseEntered(expediteeEvent);
    142157                                        break;
    143158                                case MouseEvent.MOUSE_EXITED:
     
    145160                                        break;
    146161                                case MouseEvent.MOUSE_DRAGGED:
    147                                         FrameMouseActions.getInstance().mouseDragged(expediteeEvent);
     162                                        FrameMouseActions.getInstance()
     163                                                        .mouseDragged(expediteeEvent);
    148164                                        break;
    149165                                }
    150166
    151                                
    152167                        } else {
    153                                
    154                                 // If forwarding to swing ensure that widgets are not highlighted
     168
     169                                // If forwarding to swing ensure that widgets are not
     170                                // highlighted
    155171                                // to give visual feedback yo users such that swing has focus.
    156172                                InteractiveWidget.enableExepiteeHighlighting(false);
    157                                
    158                                 // Also bring expideditee behaviour to swing: Auto-focus on component
     173
     174                                // Also bring expideditee behaviour to swing: Auto-focus on
     175                                // component
    159176                                // whenever the mouse moves over it.
    160177                                if (e.getID() == MouseEvent.MOUSE_MOVED) {
    161178                                        if (e.getSource() instanceof Component) {
    162                                                 Component target = (Component)e.getSource();
     179                                                Component target = (Component) e.getSource();
    163180                                                if (!target.isFocusOwner()) {
    164181                                                        target.requestFocus();
     
    169186                }
    170187        }
    171        
     188
    172189        public static boolean isPopupVisible() {
    173190                return isPopupVisible(Browser._theBrowser.getLayeredPane());
    174191        }
    175        
     192
    176193        private static boolean isPopupVisible(Container parent) {
    177                
     194
    178195                for (Component c : parent.getComponents()) {
    179                
    180                         if (c instanceof JPopupMenu && ((JPopupMenu)c).isVisible()) {
     196
     197                        if (c instanceof JPopupMenu && ((JPopupMenu) c).isVisible()) {
    181198                                return true;
    182                                
    183                         } else if (c instanceof Container &&
    184                                         c != Browser._theBrowser.getContentPane()) {
    185                                 if (isPopupVisible((Container)c)) return true;
     199
     200                        } else if (c instanceof Container
     201                                        && c != Browser._theBrowser.getContentPane()) {
     202                                if (isPopupVisible((Container) c))
     203                                        return true;
    186204                        }
    187205                }
    188                
     206
    189207                return false;
    190208        }
    191        
    192209}
  • trunk/src/org/expeditee/items/Dot.java

    r7 r21  
    33import java.awt.Graphics2D;
    44import java.awt.Polygon;
     5import java.awt.Rectangle;
    56import java.util.ArrayList;
    67import java.util.LinkedList;
    78import java.util.List;
     9
     10import org.expeditee.gui.Frame;
    811
    912/**
     
    1922        // Standard Item variables
    2023
     24        private static final int _MINIMUM_DOT_SIZE = 6;
     25
    2126        // contains all dots (including this one) that form an enclosure
    2227        // if this dot is part of an enclosing shape
     
    3237
    3338        private boolean _filled = true;
    34        
     39
    3540        protected boolean _filledHighlight = false;
    3641
     
    108113        @Override
    109114        public void paint(Graphics2D g) {
    110                 if (isHighlighted()) {
     115                if (isHighlighted() /* && !Frame.FreeItems.contains(this) */) {
    111116                        g.setColor(getHighlightColor());
    112117                        // Draw the highlighting rectangle surrounding the dot
    113118                        // this is drawn even if its part of a rectangle
    114                         if (_filledHighlight)
    115                                 g.fillPolygon(getPolygon());
    116                         else
    117                                 g.drawPolygon(getPolygon());
     119                        Rectangle rect = getPolygon().getBounds();
     120                        if (_mode == SelectedMode.Enclosed ||
     121                        // Make sure single dots are highlighted filled
     122                                        this.getConnected().size() <= 1)
     123                                g.fillRect(rect.x, rect.y, rect.width, rect.height);
     124                        else if (_mode == SelectedMode.Connected)
     125                                g.drawRect(rect.x, rect.y, rect.width, rect.height);
     126                        else if (_mode == SelectedMode.Normal) {
     127                                g.fillOval(rect.x, rect.y, rect.width, rect.height);
     128                        }
     129                        //System.out.println(_mode.toString());
    118130                }
    119131
     
    129141
    130142                int width = thick / 2;
    131 
    132                 // if(_thickness < 1)
    133                 /*
    134                  * if(_filled) g.fillRect(getX(), getY(), thick,thick); else
    135                  * g.drawRect(getX(), getY(), thick,thick); else
    136                  */
    137143
    138144                if (_pointType == Item.POINTTYPE_CIRCLE) {
     
    168174                int thick = (int) Math.ceil(getThickness());
    169175                // Sets a minimum size for the dot
    170                 thick = Math.max(thick, 10);
     176                thick = Math.max(thick, _MINIMUM_DOT_SIZE);
    171177
    172178                int x = getX() - thick / 2;
     
    205211
    206212        @Override
    207         public int showHighlight(boolean val) {
    208                 super.showHighlight(val);
     213        public int setSelectionColor() {
     214                super.setSelectionColor();
    209215
    210216                return Item.DEFAULT_CURSOR;
     
    353359                return "P " + getID();
    354360        }
    355        
     361
    356362        @Override
    357363        public void setFilledHighlight(boolean value) {
    358364                _filledHighlight = value;
    359365        }
    360        
     366
    361367        @Override
    362368        public void delete() {
    363369                super.delete();
    364                
    365                 for(Line l: this.getLines())
     370
     371                for (Line l : this.getLines())
    366372                        l.delete();
    367373        }
  • trunk/src/org/expeditee/items/Item.java

    r10 r21  
    168168        }
    169169       
     170        public enum SelectedMode {
     171                None, Enclosed, Connected, Disconnect, Normal
     172        }
     173       
     174        public void setSelectedMode(SelectedMode mode) {
     175                setSelectedMode(mode, DEFAULT_HIGHLIGHT);
     176        }
     177       
     178        protected SelectedMode _mode = SelectedMode.None;
     179       
    170180        private Point _offset = new Point(0, 0);
    171181
     
    183193
    184194        private boolean _highlight = true;
    185 
    186         private boolean _isHighlighted = false;
    187195
    188196        private Dimension _maxSize = null;
     
    252260       
    253261        private boolean _visible = true;
     262       
     263        private SelectedMode _lastMode = SelectedMode.None;
    254264
    255265        protected Item() {
     
    838848         */
    839849        public boolean isHighlighted() {
    840                 return _isHighlighted;
     850                return _mode != SelectedMode.None;
    841851        }
    842852
     
    13501360        }
    13511361
    1352         public int showDepressedHighlight(boolean val) {
    1353                 _highlightThickness = DEFAULT_HIGHLIGHT_THICKNESS;
    1354                 return showHighlight(val, DEPRESSED_HIGHLIGHT);
    1355         }
    1356 
    1357         public int showDisconnectHighlight(boolean val) {
    1358                 _highlightThickness = DEFAULT_HIGHLIGHT_THICKNESS;
    1359                 return showHighlight(val, DISCONNECT_HIGHLIGHT);
    1360         }
    1361 
    13621362        /**
    13631363         * Paints any highlighting of this Item. This may include changing the
     
    13691369         * @param val
    13701370         *            True if this Item should be highlighted, false if the
    1371          *            highlighting is being cleared.\
     1371         *            highlighting is being cleared.
    13721372         * @return The desired mouse cursor when this Item is highlighted (negative
    13731373         *         means no change)
    13741374         */
    1375         public int showHighlight(boolean val) {
     1375        public int setSelectionColor() {
     1376                return setSelectionColor(DEFAULT_HIGHLIGHT);
     1377        }
     1378
     1379        public int setSelectionColor(Color c) {
    13761380                _highlightThickness = DEFAULT_HIGHLIGHT_THICKNESS;
    1377                 return showHighlight(val, DEFAULT_HIGHLIGHT);
    1378         }
    1379 
    1380         public int showHighlight(boolean val, Color c) {
    1381                 _isHighlighted = val;
    13821381                if (c != null)
    13831382                        _highlightColor = c;
     
    13871386                return Item.UNCHANGED_CURSOR;
    13881387        }
     1388       
    13891389        private void updateArrowPolygon() {
    13901390                if (getArrowheadLength() < 0 || getArrowheadRatio() < 0)
     
    14221422        public void onParentFameHidden() {} // because of caching
    14231423        public void onParentFameShown() {} // because of caching
     1424
     1425        public void setSelectedMode(SelectedMode mode, Color color) {
     1426                setSelectionColor(color);
     1427                _lastMode = _mode;
     1428                _mode = mode;
     1429        }
     1430
     1431        public void restoreLastMode(Color selectionColor) {
     1432                setSelectionColor(selectionColor);
     1433                if (_mode != SelectedMode.None)
     1434                        return;
     1435                _mode = _lastMode;
     1436                _lastMode = SelectedMode.None;
     1437        }
     1438
     1439        public SelectedMode getSelectedMode() {
     1440                return _mode;
     1441        }
    14241442}
  • trunk/src/org/expeditee/items/Line.java

    r7 r21  
    287287                g.setColor(getPaintColor());
    288288
     289                //if (this._mode == Item.SelectedMode.Disconnect)
     290                //      System.out.println("Disconnect mode!");
     291               
    289292                if (_start instanceof Text && ((Text) _start).startsWith("@c")) {
    290293                        g.setStroke(_lineStroke);
     
    337340                        Point endOffset) {
    338341                // only draw an arrowhead if necessary
    339                 if (!withArrow.hasVisibleArrow() || withArrow.getLines().size() > 1)
     342                if (!(this._mode == Item.SelectedMode.Disconnect
     343                                && withArrow._mode == Item.SelectedMode.Disconnect)
     344                                && (!withArrow.hasVisibleArrow()
     345                                || withArrow.getLines().size() > 1))
    340346                        return;
    341347
     
    350356                double arrowRatio = withArrow.getArrowheadRatio();
    351357
     358                //set the size of the disconnect indicator arrowhead
     359                if (this._mode == Item.SelectedMode.Disconnect){
     360                        //System.out.println("Disconnect mode!");
     361                        arrowLength = 15;
     362                        arrowRatio = 0.3;
     363                        //Make sure the arrowhead positions get recalculated
     364                        withArrow.setArrowhead(null);
     365                }
     366               
    352367                // if the arrowhead is 'auto', then one and only one end must be
    353368                // floating
     
    464479                int distEnd = (int) Math.sqrt(endX * endX + endY * endY);
    465480
    466                 final double THRESHHOLD = Math.min(0.2 * lineLength, 25.0);
    467 
    468                 if (distStart < THRESHHOLD) {
     481                final double DISCONNECT_THRESHHOLD = Math.min(0.2 * lineLength, 25.0);
     482                final double NORMAL_THRESHHOLD = Math.min(0.1 * lineLength, 13.0);
     483
     484                if (distStart < NORMAL_THRESHHOLD) {
     485                        start._mode = Item.SelectedMode.Normal;
    469486                        return start;
    470                 } else if (distEnd < THRESHHOLD) {
     487                } else if (distEnd < NORMAL_THRESHHOLD) {
     488                        end._mode = Item.SelectedMode.Normal;
    471489                        return end;
     490                } else if (distStart < DISCONNECT_THRESHHOLD) {
     491                        start._mode = Item.SelectedMode.Disconnect;
     492                        return start;
     493                } else if (distEnd < DISCONNECT_THRESHHOLD) {
     494                        end._mode = Item.SelectedMode.Disconnect;
     495                        return end;
    472496                }
    473497
     
    476500
    477501        @Override
    478         public int showHighlight(boolean val) {
    479                 super.showHighlight(val);
     502        public int setSelectionColor() {
     503                super.setSelectionColor();
    480504
    481505                return Item.UNCHANGED_CURSOR;
  • trunk/src/org/expeditee/items/Picture.java

    r7 r21  
    291291
    292292                        if (_isFrame) {
    293                                 Frame frame = FrameIO.LoadFrame(_source.getLink());
    294                                 // if (frame.getBuffer() == null)
    295                                 FrameGraphics.UpdateBuffer(frame, false);
    296                                 _image = frame.getBuffer();
     293                                if (_source.getLink() == null) {
     294                                        Frame parent = getParent();
     295                                        if (parent != null){
     296                                                parent.removeItem(this);
     297                                                parent.addItem(_source);
     298                                        }
     299                                } else {
     300                                        Frame frame = FrameIO.LoadFrame(_source.getLink());
     301                                        if (frame != null) {
     302                                                FrameGraphics.UpdateBuffer(frame, false);
     303                                                _image = frame.getBuffer();
     304                                        }
     305                                }
    297306                        }
    298307                }
     
    416425
    417426        @Override
    418         public int showHighlight(boolean val) {
    419                 super.showHighlight(val);
     427        public int setSelectionColor() {
     428                super.setSelectionColor();
    420429
    421430                return Item.DEFAULT_CURSOR;
  • trunk/src/org/expeditee/items/Text.java

    r13 r21  
    2323
    2424import org.expeditee.gui.FrameMouseActions;
     25import org.expeditee.items.Item.SelectedMode;
    2526
    2627/**
     
    13251326        }
    13261327
    1327         @Override
    1328         public int showHighlight(boolean val) {
    1329                 super.showHighlight(val);
    1330 
    1331                 if (val)
    1332                         return Item.UNCHANGED_CURSOR;
    1333                 else
    1334                         return Item.DEFAULT_CURSOR;
    1335         }
    1336 
    13371328        /**
    13381329         * Determines if this text has any text in it.
  • trunk/src/org/expeditee/simple/Context.java

    r7 r21  
    225225
    226226        public void createFrameset(String framesetNameVar, String successVar)
    227                         throws Exception {
    228                 // Get the values to be set
    229                 String framesetName = primitives_.getStringValue(framesetNameVar);
    230                 Frame firstFrame = FrameIO.CreateNewFrameset(framesetName);
    231 
    232                 if (successVar != null) {
    233                         Boolean success = firstFrame != null;
     227                        throws IncorrectTypeException {
     228                boolean success = true;
     229                try {
     230                        // Get the values to be set
     231                        String framesetName = primitives_.getStringValue(framesetNameVar);
     232                        Frame firstFrame = FrameIO.CreateNewFrameset(framesetName);
     233                        success = firstFrame != null;
     234                } catch (Exception e) {
     235                        success = false;
     236                }
     237                if (successVar != null) {
    234238                        primitives_.setValue(successVar, new SBoolean(success));
    235239                }
  • trunk/src/org/expeditee/simple/IncorrectTypeException.java

    r4 r21  
    33public class IncorrectTypeException extends RuntimeException {
    44        static final long serialVersionUID = -7034897190745766939L;
    5 
     5       
    66        public IncorrectTypeException(String type, int no) {
    77                super("Expected param " + no + " to be " + type);
  • trunk/src/org/expeditee/simple/Primitives.java

    r4 r21  
    2424
    2525        public void setValue(String variableName, SPrimitive newValue)
    26                         throws Exception {
     26                        throws IncorrectTypeException {
    2727                try {
    2828                        // if it is an existing variable change the value
     
    4949         *             if the variable name is invalid
    5050         */
    51         public void add(String name, SPrimitive value) throws Exception {
     51        public void add(String name, SPrimitive value) throws IncorrectTypeException {
    5252                // figure out the type and add it...
    5353                SPrimitive newVar;
  • trunk/src/org/expeditee/simple/SBoolean.java

    r4 r21  
    1212        }
    1313
    14         public SBoolean(Boolean value) throws Exception {
     14        public SBoolean(Boolean value) throws IncorrectTypeException {
    1515                super(value);
    1616        }
     
    4444
    4545        @Override
    46         public void setValue(SPrimitive v) throws Exception {
     46        public void setValue(SPrimitive v) throws IncorrectTypeException {
    4747                value_ = v.booleanValue();
    4848        }
  • trunk/src/org/expeditee/simple/SCharacter.java

    r4 r21  
    5050
    5151        @Override
    52         public void setValue(SPrimitive v) throws Exception {
     52        public void setValue(SPrimitive v) throws IncorrectTypeException {
    5353                value_ = v.characterValue();
    5454        }
  • trunk/src/org/expeditee/simple/SInteger.java

    r4 r21  
    5353
    5454        @Override
    55         public void setValue(SPrimitive v) throws Exception {
     55        public void setValue(SPrimitive v) throws IncorrectTypeException {
    5656                value_ = v.integerValue();
    5757        }
  • trunk/src/org/expeditee/simple/SPrimitive.java

    r4 r21  
    1515        }
    1616
    17         public Long integerValue() throws Exception {
    18                 throw new Exception("Can not convert " + this.getClass().getName()
    19                                 + " to Integer");
     17        public Long integerValue() throws IncorrectTypeException {
     18                throw new IncorrectTypeException("integer",this.getClass().getName());
    2019        }
    2120
    22         public Boolean booleanValue() throws Exception {
    23                 throw new Exception("Can not convert " + this.getClass().getName()
    24                                 + " to Boolean");
     21        public Boolean booleanValue() throws IncorrectTypeException {
     22                throw new IncorrectTypeException("boolean", this.getClass().getName());
    2523        }
    2624
    27         public Double doubleValue() throws Exception {
    28                 throw new Exception("Can not convert " + this.getClass().getName()
    29                                 + " to Real");
     25        public Double doubleValue() throws IncorrectTypeException {
     26                throw new IncorrectTypeException("real", this.getClass().getName());
    3027        }
    3128
    32         public Character characterValue() throws Exception {
    33                 throw new Exception("Can not convert " + this.getClass().getName()
    34                                 + " to Character");
     29        public Character characterValue() throws IncorrectTypeException {
     30                throw new IncorrectTypeException("character", this.getClass().getName());
    3531        }
    3632
    37         public abstract void setValue(SPrimitive v) throws Exception;
     33        public abstract void setValue(SPrimitive v) throws IncorrectTypeException;
    3834
    3935        @Override
    40         public void setValue(SVariable<T> v) throws Exception {
     36        public void setValue(SVariable<T> v) throws IncorrectTypeException {
    4137                if (v instanceof SPrimitive) {
    4238                        setValue((SPrimitive<?>) v);
    4339                        return;
    4440                }
    45                 throw new Exception("Can not set primitive variable with pointer");
     41                throw new IncorrectTypeException("primitive", "pointer");
    4642        }
    4743
  • trunk/src/org/expeditee/simple/SReal.java

    r4 r21  
    4949
    5050        @Override
    51         public void setValue(SPrimitive v) throws Exception {
     51        public void setValue(SPrimitive v) throws IncorrectTypeException {
    5252                value_ = v.doubleValue();
    5353        }
  • trunk/src/org/expeditee/stats/SessionStats.java

    r7 r21  
    250250                                - _FrameAccessTime.getTime());
    251251
    252                 _FrameEvents.add(Logger.EasyDateFormat("mm:ss", elapsedTime) + " "
     252                _FrameEvents.add(Logger.EasyDateFormat("mm:ss:SSS", elapsedTime) + " "
    253253                                + DisplayIO.getMouseX() + " " + DisplayIO.getMouseY() + " "
    254254                                + description);
Note: See TracChangeset for help on using the changeset viewer.