Changeset 22


Ignore:
Timestamp:
05/09/08 09:31:42 (16 years ago)
Author:
ra33
Message:
 
Location:
trunk/src/org/expeditee
Files:
2 added
12 edited

Legend:

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

    r21 r22  
    44import java.awt.Point;
    55import java.awt.event.InputEvent;
     6import java.io.BufferedReader;
     7import java.io.InputStreamReader;
    68import java.util.ArrayList;
    79import java.util.LinkedList;
    810import java.util.List;
    911
     12import org.expeditee.agents.WriteTree;
    1013import org.expeditee.gui.AttributeUtils;
    1114import org.expeditee.gui.DisplayIO;
     
    880883                                        String log = SessionStats.getFrameEventList();
    881884                                        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                                         }
     885                                        // try {
     886                                        t = (Text) context.getPointers().getVariable(tokens[1])
     887                                                        .getValue();
     888                                        t.setText(log);
     889                                        // } catch (Exception e) {
     890                                        // t = new Text(-1, log);
     891                                        // context.getPointers().setObject(tokens[1], t);
     892                                        // }
    890893
    891894                                        return Status.OK;
     
    10281031                                String stats = SessionStats.getCurrentStats();
    10291032                                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                                 }
     1033                                // try {
     1034                                t = (Text) context.getPointers().getVariable(tokens[1])
     1035                                                .getValue();
     1036                                t.setText(stats);
     1037                                // } catch (Exception e) {
     1038                                // t = new Text(-1, stats);
     1039                                // context.getPointers().setObject(tokens[1], t);
     1040                                // }
    10381041
    10391042                                return Status.OK;
     
    11231126                        Text dynamicCode = new Text(1, codeText);
    11241127                        RunItem(dynamicCode, context, Status.OK);
     1128                        return Status.OK;
     1129                } else if (tokens[0].equals("runoscommand")) {
     1130                        String command = getMessage(tokens, context, code.toString(), " ",
     1131                                        1);
     1132                        Runtime.getRuntime().exec(command);
     1133                        return Status.OK;
     1134                } else if (tokens[0].equals("executeoscommand")) {
     1135                        String command = getMessage(tokens, context, code.toString(), " ",
     1136                                        1);
     1137                        Process p = Runtime.getRuntime().exec(command);
     1138                        FrameGraphics.DisplayMessage(command, Color.darkGray);
     1139                       
     1140                        BufferedReader stdInput = new BufferedReader(new InputStreamReader(
     1141                                        p.getInputStream()));
     1142                        BufferedReader stdError = new BufferedReader(new InputStreamReader(
     1143                                        p.getErrorStream()));
     1144                        String message = "";
     1145                        while ((message = stdInput.readLine()) != null) {
     1146                                FrameGraphics.DisplayMessage(message);
     1147                        }
     1148                        while ((message = stdError.readLine()) != null) {
     1149                                FrameGraphics.ErrorMessage(message);
     1150                        }
    11251151                        return Status.OK;
    11261152                } else if (tokens[0].startsWith("else")) {
     
    12791305                        Item item = (Item) context.getPointers().getVariable(itemVar)
    12801306                                        .getValue();
     1307                        item
     1308                                        .setPosition(FrameMouseActions.MouseX,
     1309                                                        FrameMouseActions.MouseY);
    12811310                        FrameMouseActions.pickup(item);
    12821311                        return Status.OK;
     
    12911320                        Frame frame = DisplayIO.getCurrentFrame();
    12921321                        Text item = frame.createNewText(s);
     1322                        item
     1323                                        .setPosition(FrameMouseActions.MouseX,
     1324                                                        FrameMouseActions.MouseY);
    12931325                        FrameMouseActions.pickup(item);
    12941326                        // DisplayIO.repaint();
     
    13331365                        frame.addItem(new Line(dot1, dot2, frame.getNextItemID()));
    13341366                        return Status.OK;
    1335                 } else if (tokens[0].equals("createitem")) {
     1367                } else if (tokens[0].equals("createitem")
     1368                                || tokens[0].equals("createtext")) {
    13361369                        assertMinParametreCount(tokens, 4);
    13371370                        assertVariableType(tokens[1], 1, SPointer.framePrefix);
     
    13521385                                }
    13531386                                newItem = frame.addText(x, y, newText, newAction);
    1354                         } else
    1355                                 // create a point if the optional params are not provided
    1356                                 newItem = frame.addDot(x, y);
     1387                        } else {
     1388                                if (tokens[0].equals("createtext")) {
     1389                                        newItem = frame.createNewText();
     1390                                        newItem.setPosition(x, y);
     1391                                } else {
     1392                                        // create a point if the optional params are not provided
     1393                                        newItem = frame.addDot(x, y);
     1394                                }
     1395                        }
    13571396                        context.getPointers().setObject(tokens[4], newItem);
    13581397
     
    16391678                        }
    16401679                        context.createFrameset(framesetName, successVar);
     1680                        return Status.OK;
     1681                } else if (tokens[0].equals("writetree")) {
     1682                        assertMinParametreCount(tokens, 3);
     1683                        assertVariableType(tokens[1], 1, SPointer.framePrefix);
     1684                        Frame source = (Frame) context.getPointers().getVariable(tokens[1])
     1685                                        .getValue();
     1686                        String format = context.getPrimitives().getStringValue(tokens[2]);
     1687                        String fileName = context.getPrimitives().getStringValue(tokens[3]);
     1688                        WriteTree wt = new WriteTree(format, fileName);
     1689                        if (wt.initialise(source)){
     1690                                wt.setStartFrame(source);
     1691                                wt.run();
     1692                        }
    16411693                        return Status.OK;
    16421694                } else if (tokens[0].equals("concatstr")) {
  • trunk/src/org/expeditee/agents/WriteTree.java

    r4 r22  
    4545                int ind = params.indexOf(" ");
    4646                if (ind > 0) {
    47                         String param = params.substring(ind + 1);
     47                        String lastParam = params.substring(ind + 1);
    4848                        _format = params.substring(0, ind).toLowerCase();
    4949
    50                         if (param.equals("clipboard"))
     50                        if (lastParam.equals("clipboard"))
    5151                                _clipboard = true;
    5252                        else
    53                                 _outFile = param;
    54                 }
     53                                _outFile = lastParam;
     54                }
     55        }
     56       
     57        public WriteTree(String format, String outFile) {
     58                _format = format;
     59                _outFile = outFile;
    5560        }
    5661
     
    6267        @Override
    6368        public boolean initialise(Frame start) {
    64                 _outFile = start.getExportFileName();
     69                if (_outFile == null)
     70                        _outFile = start.getExportFileName();
    6571
    6672                try {
  • trunk/src/org/expeditee/gui/Browser.java

    r15 r22  
    100100                this.getGlassPane().setVisible(true);
    101101                this.getContentPane().setBackground(Color.white);
     102                this.getContentPane().setFocusTraversalKeysEnabled(false);
    102103               
    103104                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r21 r22  
    5959         * The title to display in the Title bar.
    6060         */
    61         public static final String TITLE = "Exp08May2008B";
     61        public static final String TITLE = "Exp08May2008D";
    6262
    6363        private DisplayIO() {
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r21 r22  
    546546
    547547                // if we have not returned, then there are no messages yet
    548                 DisplayMessage(message);
     548                DisplayMessage(message, Color.darkGray);
    549549        }
    550550
  • trunk/src/org/expeditee/gui/FrameIO.java

    r13 r22  
    711711                        if (toSave.getFramesetName().toLowerCase().equals(
    712712                                        UserSettings.Username.toLowerCase())) {
    713                                 FrameUtils.ParseProfile(toSave);
     713                                FrameUtils.ParseProfile(FrameIO.LoadFrame(toSave.getFramesetNameAdjusted() + "1"));
    714714                        }
    715715                } catch (IOException ioe) {
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r21 r22  
    562562                functionKey(key, 1);
    563563        }
    564        
     564
    565565        /**
    566566         * Called when a Function key has been pressed, and performs the specific
     
    743743                }
    744744                dummyItem = createText();
     745                if (Frame.textItemAttachedToCursor()) {
     746                        Text t = (Text)Frame.getItemAttachedToCursor();
     747                        dummyItem.setSize(t.getSize());
     748                        for (int i = 0; i < t.getText().size(); i++) {
     749                                newItemText += '\n';
     750                        }
     751                }
     752
    745753                dummyItem.setText(newItemText);
     754
    746755                // If the only item on the frame is the title and the frame name just
    747756                // drop a specified distance below the title
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r21 r22  
    580580                                UserSettings.Threading = getBoolean(item,
    581581                                                UserSettings.Threading);
     582                        } else if (ItemUtils.isTag(item, "@ColorWheel")) {
     583                                Item.COLOR_WHEEL = getColorWheel(item);
     584                        } else if (ItemUtils.isTag(item, "@BackgroundColorWheel")) {
     585                                Item.FILL_COLOR_WHEEL = getColorWheel(item);
    582586                        }
    583587                }
     
    586590                        UserSettings.FirstFrame = profile.getFrameName();
    587591
     592        }
     593
     594        private static Color[] getColorWheel(Item item) {
     595                String childName = item.getAbsoluteLink();
     596                if (childName != null) {
     597                        Frame child = FrameIO.LoadFrame(childName);
     598                        if (child != null) {
     599                                List<Text> textItems = child.getBodyTextItems(true);
     600                                Color[] colorList = new Color[textItems.size()];
     601                                for (int i = 0; i < textItems.size(); i++) {
     602                                        colorList[i] = textItems.get(i).getColor();
     603                                }
     604                                return colorList;
     605                        }
     606                }
     607                return new Color[]{Color.black, Color.white};
    588608        }
    589609
  • trunk/src/org/expeditee/gui/MouseEventRouter.java

    r21 r22  
    99import java.awt.event.MouseEvent;
    1010import java.awt.event.MouseWheelEvent;
    11 import java.awt.event.MouseWheelListener;
    1211
    1312import javax.swing.JComponent;
  • trunk/src/org/expeditee/items/Item.java

    r21 r22  
    8181         * this Item.
    8282         */
    83         public static final Color[] COLOR_WHEEL = { Color.BLACK, Color.RED,
     83        public static Color[] COLOR_WHEEL = { Color.BLACK, Color.RED,
    8484                        Color.BLUE, Item.GREEN, Color.MAGENTA, Color.YELLOW.darker(),
    8585                        DisplayIO.DEFAULT_BACKGROUND };
    8686
    87         public static final Color[] FILL_COLOR_WHEEL = { Color.BLACK, new Color(255,150,150),
     87        public static Color[] FILL_COLOR_WHEEL = { Color.BLACK, new Color(255,150,150),
    8888                new Color(150,150,255), new Color(150,255,150), new Color(255,150,255), new Color(255,255,100),
    8989                DisplayIO.DEFAULT_BACKGROUND };
  • trunk/src/org/expeditee/items/Text.java

    r21 r22  
    316316                if (ch != '\t')
    317317                        return insertText("" + ch, mouseX, mouseY);
    318 
    319                 return new Point(mouseX, mouseY);
     318                return insertText("   " + ch, mouseX, mouseY);
     319                //return new Point(mouseX, mouseY);
    320320        }
    321321
  • trunk/src/org/expeditee/stats/SessionStats.java

    r21 r22  
    259259                for (String s : _FrameEvents)
    260260                        eventList.append(s + '\n');
    261 
     261                eventList.deleteCharAt(eventList.length() - 1);
    262262                return eventList.toString();
    263263        }
Note: See TracChangeset for help on using the changeset viewer.