Changeset 286


Ignore:
Timestamp:
08/29/08 08:17:54 (16 years ago)
Author:
ra33
Message:
 
Location:
trunk/src/org/expeditee
Files:
3 added
22 edited

Legend:

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

    r284 r286  
    2929import org.expeditee.items.ItemUtils;
    3030import org.expeditee.items.Text;
     31import org.expeditee.simple.SString;
    3132
    3233/**
     
    6566        private static HashMap<String, String> _JAGs = new HashMap<String, String>();
    6667
     68        // maps lower case IW class names to capitalized IW names
     69        private static HashMap<String, String> _IWs = new HashMap<String, String>();
     70
    6771        public static final String ROOT_PACKAGE = "org.expeditee.";
    6872
     
    7175
    7276        private static final String AGENTS_PACKAGE = ROOT_PACKAGE + "agents.";
     77
     78        private static final String WIDGET_PACKAGE = ROOT_PACKAGE
     79                        + "items.widgets.";
     80
     81        private static final String CHARTS_PACKAGE = ROOT_PACKAGE
     82                        + "items.widgets.charts.";
    7383
    7484        private static final String NAVIGATIONS_CLASS = ROOT_PACKAGE
     
    199209                                _JAGs.put(name.toLowerCase(), name);
    200210                        }
     211
     212                        classes = getClasses(WIDGET_PACKAGE);
     213
     214                        for (int i = 0; i < classes.length; i++) {
     215                                String name = classes[i].getSimpleName();
     216                                // maps lower case name to correct capitalised name
     217                                _IWs.put(name.toLowerCase(), WIDGET_PACKAGE + name);
     218                        }
     219
     220                        classes = getClasses(CHARTS_PACKAGE);
     221
     222                        for (int i = 0; i < classes.length; i++) {
     223                                String name = classes[i].getSimpleName();
     224                                // maps lower case name to correct capitalised name
     225                                _IWs.put("charts." + name.toLowerCase(), CHARTS_PACKAGE + name);
     226                        }
    201227                } catch (Exception e) {
    202228                        warnings.add("You must have Java 1.5 or higher to run Expeditee");
    203229                        warnings.add(e.getMessage());
    204230                }
     231
    205232                try {
    206233                        classes = getClasses(ACTIONS_PACKAGE);
     
    421448                                                continue;
    422449                                        for (int i = 0; i < paramCount; i++) {
    423                                                 if (paramTypes[i].equals(int.class)
    424                                                                 || paramTypes[i].equals(Integer.class)) {
    425                                                         try {
    426                                                                 params[i] = Integer.parseInt(paramStrings[i]);
    427                                                         } catch (Exception e) {
     450                                                SString nextParam = new SString(paramStrings[i]);
     451                                                try {
     452                                                        params[i] = null;
     453                                                        if (paramTypes[i].equals(int.class)
     454                                                                        || paramTypes[i].equals(Integer.class)) {
     455                                                                params[i] = nextParam.integerValue().intValue();
     456                                                        } else if (paramTypes[i].equals(long.class)
     457                                                                        || paramTypes[i].equals(Long.class)) {
     458                                                                params[i] = nextParam.integerValue();
     459                                                        } else if (paramTypes[i].equals(double.class)
     460                                                                        || paramTypes[i].equals(Double.class)) {
     461                                                                params[i] = nextParam.doubleValue();
     462                                                        } else if (paramTypes[i].equals(float.class)
     463                                                                        || paramTypes[i].equals(Float.class)) {
     464                                                                params[i] = nextParam.doubleValue()
     465                                                                                .floatValue();
     466                                                        } else if (paramTypes[i].equals(boolean.class)
     467                                                                        || paramTypes[i].equals(Boolean.class)) {
     468                                                                params[i] = nextParam.booleanValue();
     469                                                        } else if (paramTypes[i].equals(String.class)) {
     470                                                                params[i] = nextParam.stringValue();
     471                                                        } else {
    428472                                                                continue;
    429473                                                        }
    430                                                 } else if (paramTypes[i].equals(double.class)
    431                                                                 || paramTypes[i].equals(Double.class)) {
    432                                                         try {
    433                                                                 params[i] = Double.parseDouble(paramStrings[i]);
    434                                                         } catch (Exception e) {
    435                                                                 continue;
    436                                                         }
    437                                                 } else if (paramTypes[i].equals(String.class)) {
    438                                                         params[i] = paramStrings[i];
    439                                                 } else {
     474                                                } catch (Exception e) {
    440475                                                        continue;
    441476                                                }
     
    736771                return null;
    737772        }
     773
     774        /**
     775         * Gets the full class path for a widget with a given case insensitive name.
     776         *
     777         * @param widgetName
     778         * @return
     779         */
     780        public static String getClassName(String widgetName) {
     781                return _IWs.get(widgetName.toLowerCase());
     782        }
    738783}
  • trunk/src/org/expeditee/agents/PdfFrameset.java

    r282 r286  
    66import org.expeditee.gui.MessageBay;
    77import org.expeditee.io.PdfFramesetWriter;
     8import org.expeditee.items.widgets.InteractiveWidget;
    89
    910
     
    1415
    1516        private int _maxFrame = Integer.MAX_VALUE;
     17       
     18        private boolean _showFrameNames = false;
    1619
    17         public PdfFrameset(int firstFrame, int maxFrame) {
     20        public PdfFrameset(int firstFrame, int maxFrame, boolean showFrameNames) {
    1821                super();
    1922                _firstFrame = firstFrame;
    2023                _maxFrame = maxFrame;
     24                _showFrameNames = showFrameNames;
     25        }
     26       
     27        public PdfFrameset(int firstFrame, int maxFrame) {
     28                this(firstFrame, maxFrame, false);
     29        }
     30       
     31        public PdfFrameset( boolean showFrameNames) {
     32                this(1,Integer.MAX_VALUE, showFrameNames);
    2133        }
    2234
    2335        public PdfFrameset() {
    24                 super();
    25                 _firstFrame = 1;
    26                 _maxFrame = Integer.MAX_VALUE;
     36                this(false);
    2737        }
    2838
    2939        @Override
    3040        protected Frame process(Frame frame) {
    31                 _pdfWriter = new PdfFramesetWriter(_firstFrame, _maxFrame);
     41                _pdfWriter = new PdfFramesetWriter(_firstFrame, _maxFrame, _showFrameNames);
    3242               
    3343                try {
  • trunk/src/org/expeditee/agents/mail/MailSession.java

    r284 r286  
    7676                        if (item.getText().toLowerCase().trim().equals("autoconnect")) {
    7777                                _autoConnect = true;
     78                                continue;
    7879                        }
    7980                        AttributeValuePair avp = new AttributeValuePair(item.getText());
     
    156157                                _bConnecting = true;
    157158                                _transport.connect();
    158                                 message.setText("SMTP server connected");
     159                                message.setAttributeValue("SMTP server connected");
    159160                                message.setColor(Color.green);
    160161                        } else {
     
    211212                                }.start();
    212213
    213                                 message.setText("Connection complete");
     214                                message.setAttributeValue("Connection complete");
    214215                                message.setColor(Color.GREEN);
    215216
  • trunk/src/org/expeditee/gui/AttributeValuePair.java

    r247 r286  
    5454                if (text.charAt(0) == ANNOTATION_CHAR) {
    5555                        _bAnnotation = true;
    56                         if (text.length() == 1 || !Character.isLetter(text.charAt(1)))
     56                        if (text.length() == 1 || !Character.isLetterOrDigit(text.charAt(1)))
    5757                                return;
    5858                        // All chars in the attribute must be letters or digits
     
    6161                                        return;
    6262                        }
     63                        text = text.substring(1);
     64                        ind--;
    6365                        if (ind < 1) {
    64                                 setAttribute(text.substring(1));
     66                                setAttribute(text);
    6567                                return;
    6668                        }
  • trunk/src/org/expeditee/gui/Frame.java

    r282 r286  
    22
    33import java.awt.Color;
    4 import java.awt.Dimension;
    54import java.awt.Image;
    65import java.awt.Polygon;
     
    3130import org.expeditee.items.Text;
    3231import org.expeditee.items.XRayable;
     32import org.expeditee.items.Item.HighlightMode;
    3333import org.expeditee.items.widgets.InteractiveWidget;
    3434import org.expeditee.items.widgets.WidgetCorner;
     
    501501                for (Overlay o : _overlays.keySet())
    502502                        results.addAll(o.Frame.getItemsWithin(poly));
     503               
     504                for(Item i: getVectorItems()){
     505                        if (i.intersects(poly)) {
     506                                //This assumes a results is a set
     507                                results.add(i.getEditTarget());
     508                        }
     509                }
    503510
    504511                return results;
     
    10701077                        int index = toCheck.indexOf(from);
    10711078
     1079                        //If its the title index will be 0
    10721080                        if (index < 0)
    1073                                 return column;
     1081                                index = 0;
    10741082
    10751083                        for (int i = index; i < toCheck.size(); i++) {
     
    11001108                // Items must be notified that they have been added or removed from this
    11011109                // frame via the vector...
     1110                int maxX = 0;
     1111                int maxY = 0;
     1112                HighlightMode mode = toAdd.Source.getHighlightMode();
     1113                if(mode != HighlightMode.None)
     1114                        mode = HighlightMode.Connected;
     1115                Color highlightColor = toAdd.Source.getHighlightColor();
    11021116                for (Item i : ItemUtils.CopyItems(toAdd.Frame.getVectorItems(), toAdd)) {
    11031117                        i.onParentStateChanged(new ItemParentStateChangedEvent(this,
    11041118                                        ItemParentStateChangedEvent.EVENT_TYPE_ADDED_VIA_OVERLAY,
    11051119                                        toAdd.permission));
     1120                        i.setEditTarget(toAdd.Source);
     1121                        i.setHighlightMode(mode, highlightColor);
    11061122                        _vectorItems.add(i);
    11071123                        i.invalidateAll();
    11081124                        i.invalidateFill();
    1109                 }
     1125                        //Get the right most x and bottom most y pos
     1126                        int itemRight = i.getX() + i.getBoundsWidth();
     1127                        if(itemRight > maxX)
     1128                                maxX = itemRight;
     1129                        int itemBottom = i.getY() + i.getBoundsHeight();
     1130                        if(itemBottom > maxY)
     1131                                maxY = itemBottom;
     1132                }
     1133                toAdd.setSize(maxX, maxY);
    11101134                return true;
    11111135        }
     
    19161940                        }
    19171941                }
     1942               
     1943                for(Vector v: getVectors()){
     1944                        toSave.add(v.Source);
     1945                }
     1946               
    19181947                return toSave;
    19191948        }
     
    20162045                _frameName = null;
    20172046        }
     2047
     2048        public void parse() {
     2049                for(Overlay o: getOverlays()){
     2050                        o.Frame.parse();
     2051                }
     2052                //Must parse the frame AFTER the overlays
     2053                FrameUtils.Parse(this);
     2054        }
    20182055}
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r282 r286  
    3636        // the maximum size that can be used to paint on
    3737        private static Dimension _MaxSize = new Dimension(1000, 1000);
    38        
     38
    3939        // Final passes to renderering the current frame
    4040        private static LinkedList<FinalFrameRenderPass> _finalPasses = new LinkedList<FinalFrameRenderPass>();
     
    100100                        return;
    101101                _Mode = mode;
    102                 if (parse)
    103                         FrameUtils.Parse(DisplayIO.getCurrentFrame());
     102                if (parse) {
     103                        Frame current = DisplayIO.getCurrentFrame();
     104                        current.parse();
     105                }
    104106        }
    105107
     
    134136                        if (DisplayIO.isTwinFramesOn()) {
    135137                                Frame opposite = DisplayIO.getOppositeFrame();
    136                                 //if (opposite != null) {
    137                                         opposite.setBuffer(null);
    138                                         opposite.refreshSize();
    139                                 //}
     138                                // if (opposite != null) {
     139                                opposite.setBuffer(null);
     140                                opposite.refreshSize();
     141                                // }
    140142                        }
    141143                }
     
    264266         * @return
    265267         */
    266         private static Image Paint(Frame toPaint, Area clip, boolean isActualFrame, boolean createVolitile) {
     268        private static Image Paint(Frame toPaint, Area clip, boolean isActualFrame,
     269                        boolean createVolitile) {
    267270                if (toPaint == null)
    268271                        return null;
     
    276279                                if (createVolitile) {
    277280                                        buffer = ge.getDefaultScreenDevice()
    278                                         .getDefaultConfiguration()
    279                                         .createCompatibleVolatileImage(_MaxSize.width,
    280                                                         _MaxSize.height);
     281                                                        .getDefaultConfiguration()
     282                                                        .createCompatibleVolatileImage(_MaxSize.width,
     283                                                                        _MaxSize.height);
    281284                                } else {
    282285                                        buffer = new BufferedImage(_MaxSize.width, _MaxSize.height,
     
    302305         * @param bg
    303306         */
    304         public static void paintFrame(Frame toPaint, Area clip, boolean isActualFrame, boolean createVolitile, Graphics2D bg) {
     307        public static void paintFrame(Frame toPaint, Area clip,
     308                        boolean isActualFrame, boolean createVolitile, Graphics2D bg) {
    305309                bg.setClip(clip);
    306310
     
    318322                if (createVolitile) {
    319323                        backgroundColor = toPaint.getPaintBackgroundColor();
    320                 }else{
     324                } else {
    321325                        backgroundColor = toPaint.getBackgroundColor();
    322326                        if (backgroundColor == null)
     
    337341                        visibleItems.addAll(toPaint.getAllItems());
    338342                        paintWidgets = new LinkedList<InteractiveWidget>();
    339                         AddAllOverlayWidgets(paintWidgets, toPaint,
    340                                         new LinkedList<Frame>());
     343                        AddAllOverlayWidgets(paintWidgets, toPaint, new LinkedList<Frame>());
    341344                } else {
    342345                        visibleItems.addAll(toPaint.getVisibleItems());
     
    348351                // FIRST: Paint widgets swing gui (not expeditee gui) .
    349352                // Note that these are the anchored widgets
    350                 ListIterator<InteractiveWidget> widgetItor = paintWidgets.listIterator(paintWidgets.size());
    351                 while (widgetItor.hasPrevious())  {
    352                         //Paint first-in-last-serve ordering - like swing
    353                         //If it is done the other way around then widgets are covered up by the box that is supposed to be underneath
     353                ListIterator<InteractiveWidget> widgetItor = paintWidgets
     354                                .listIterator(paintWidgets.size());
     355                while (widgetItor.hasPrevious()) {
     356                        // Paint first-in-last-serve ordering - like swing
     357                        // If it is done the other way around then widgets are covered up by
     358                        // the box that is supposed to be underneath
    354359                        InteractiveWidget iw = widgetItor.previous();
    355                         if (clip == null
    356                                         || clip.intersects(iw.getComponant().getBounds())){
    357                                 iw.paint(bg);   
     360                        if (clip == null || clip.intersects(iw.getComponant().getBounds())) {
     361                                iw.paint(bg);
    358362                                PaintItem(bg, iw.getItems().get(4));
    359363                                paintedFillsAndLines.addAll(iw.getItems());
     
    702706                } else if (i instanceof Circle) {
    703707                        i.setHighlightMode(Item.HighlightMode.Connected);
     708                } else if (!i.isVisible()) {
     709                        changeHighlightMode(i, Item.HighlightMode.Connected, null);
    704710                } else {
    705711                        // FrameGraphics.ChangeSelectionMode(i,
     
    726732                if (item == null)
    727733                        return;
    728                 // Mike: TODO comment on why the line below is used!!
    729                 // I forgot already!!Opps
    730                 boolean freeItem = FreeItems.getInstance().contains(item);
    731                 for (Item i : item.getAllConnected()) {
    732                         if (/* freeItem || */!FreeItems.getInstance().contains(i)) {
    733                                 i.setHighlightMode(connectedNewMode);
    734                         }
    735                 }
    736                 if (!freeItem && newMode != connectedNewMode)
     734
     735                if (item.hasVector()) {
     736                        for (Item i : item.getParentOrCurrentFrame().getVectorItems()) {
     737                                if (i.getEditTarget() == item) {
     738                                        i.setHighlightMode(newMode);
     739                                }
     740                        }
    737741                        item.setHighlightMode(newMode);
     742                } else {
     743                        // Mike: TODO comment on why the line below is used!!
     744                        // I forgot already!!Opps
     745                        boolean freeItem = FreeItems.getInstance().contains(item);
     746                        for (Item i : item.getAllConnected()) {
     747                                if (/* freeItem || */!FreeItems.getInstance().contains(i)) {
     748                                        i.setHighlightMode(connectedNewMode);
     749                                }
     750                        }
     751                        if (!freeItem && newMode != connectedNewMode)
     752                                item.setHighlightMode(newMode);
     753                }
    738754                Repaint();
    739755        }
     
    746762         */
    747763
    748         public static void UpdateBuffer(Frame toUpdate, boolean paintOverlays, boolean useVolitile) {
     764        public static void UpdateBuffer(Frame toUpdate, boolean paintOverlays,
     765                        boolean useVolitile) {
    749766                toUpdate.setBuffer(getBuffer(toUpdate, paintOverlays, useVolitile));
    750767        }
    751        
    752         public static Image getBuffer(Frame toUpdate, boolean paintOverlays, boolean useVolitile){
     768
     769        public static Image getBuffer(Frame toUpdate, boolean paintOverlays,
     770                        boolean useVolitile) {
    753771                if (toUpdate == null)
    754772                        return null;
     
    771789        // Damaged areas pending to render. Accessessed by multiple threads
    772790        private static HashSet<Rectangle> damagedAreas = new HashSet<Rectangle>();
    773        
     791
    774792        /** The clip used while paiting */
    775793        private static Area currentClip;
    776        
     794
    777795        /**
    778796         * The current clip that is used for painting at this instant.
     
    781799         * lost in the graphics object for which can be regained via this method.
    782800         *
    783          * @return
    784          *              The current clip. Null if no clip (e.g. full screen render).
     801         * @return The current clip. Null if no clip (e.g. full screen render).
    785802         */
    786803        public static Area getCurrentClip() {
    787                 return (currentClip != null) ? (Area)currentClip.clone() : null;
     804                return (currentClip != null) ? (Area) currentClip.clone() : null;
    788805        }
    789806
     
    869886                                        MessageBay.refresh(true, dg, Item.DEFAULT_BACKGROUND);
    870887                                        return;
    871                                        
    872                                 } else return; // nothing to render
     888
     889                                } else
     890                                        return; // nothing to render
    873891                        }
    874892
     
    936954
    937955        }
    938        
     956
    939957        /**
    940958         * Adds a FinalFrameRenderPass to the frame-render pipeline...
     
    944962         *
    945963         * @param pass
    946          *              The pass to add. If already added then nothing results in the call.
     964         *            The pass to add. If already added then nothing results in the
     965         *            call.
    947966         *
    948967         * @throws NullPointerException
    949          *              If pass is null.
     968         *             If pass is null.
    950969         */
    951970        public static void addFinalFrameRenderPass(FinalFrameRenderPass pass) {
    952                 if (pass == null) throw new NullPointerException("pass");
    953                
     971                if (pass == null)
     972                        throw new NullPointerException("pass");
     973
    954974                if (!_finalPasses.contains(pass))
    955975                        _finalPasses.add(pass);
    956976        }
    957        
     977
    958978        /**
    959979         * Adds a FinalFrameRenderPass to the frame-render pipeline...
     
    963983         *
    964984         * @param pass
    965          *              The pass to remove
     985         *            The pass to remove
    966986         *
    967987         */
     
    969989                _finalPasses.remove(pass);
    970990        }
    971        
    972         /**
    973          * A FinalFrameRenderPass is invoked at the very final stages for rendering a frame:
    974          * that is, after the popups are drawn.
    975          * 
    976          * There can be many applications for FinalFrameRenderPass. Such as tool tips, balloons,
    977          * or drawing items at the highest Z-order in special situations.
     991
     992        /**
     993         * A FinalFrameRenderPass is invoked at the very final stages for rendering
     994         * a frame: that is, after the popups are drawn.
     995         *
     996         * There can be many applications for FinalFrameRenderPass. Such as tool
     997         * tips, balloons, or drawing items at the highest Z-order in special
     998         * situations.
    978999         *
    9791000         * Although if there are multiples FinalFrameRenderPasses attatach to the
  • trunk/src/org/expeditee/gui/FrameIO.java

    r282 r286  
    4444        public static void changeParentFolder(String newFolder) {
    4545                PARENT_FOLDER = newFolder;
     46                PUBLIC_PATH = PARENT_FOLDER + "public" + File.separator;
    4647                FRAME_PATH = PARENT_FOLDER + "framesets" + File.separator;
    4748                TRASH_PATH = PARENT_FOLDER + "trash" + File.separator;
     
    6566
    6667        public static String FRAME_PATH;
     68       
     69        public static String PUBLIC_PATH;
    6770
    6871        public static String IMAGES_PATH;
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r284 r286  
    1010import java.awt.event.KeyListener;
    1111import java.awt.geom.Point2D;
     12import java.text.NumberFormat;
    1213import java.util.ArrayList;
    1314import java.util.Collection;
     
    3940
    4041        private static Collection<Item> _enclosedItems = null;
    41        
     42
    4243        public static void resetEnclosedItems() {
    4344                _enclosedItems = null;
     
    330331        public void keyPressed(KeyEvent e) {
    331332                int keyCode = e.getKeyCode();
    332                
    333                 if(keyCode != KeyEvent.VK_F1 && keyCode != KeyEvent.VK_F2){
     333
     334                if (keyCode != KeyEvent.VK_F1 && keyCode != KeyEvent.VK_F2) {
    334335                        resetEnclosedItems();
    335336                }
    336                
     337
    337338                SessionStats.AddFrameEvent("k" + KeyEvent.getKeyText(keyCode));
    338339
     
    526527
    527528        }
    528 
    529529
    530530        public void keyReleased(KeyEvent e) {
     
    11141114        public static final String SHORT_DATE_FORMAT = "ddMMMyyyy";
    11151115
     1116        public static final String TIME_DATE_FORMAT = "[HH:mm]";
     1117
    11161118        public static final String LONG_DATE_FORMAT = "ddMMMyyyy[HH:mm]";
    11171119
     
    11811183                                dummyItem.setText(newItemText + dummyItem.getText());
    11821184                        }
    1183                        
     1185
    11841186                        dummyItem = createText();
    11851187                        if (FreeItems.textOnlyAttachedToCursor()) {
     
    11991201                        if (column.size() == 0) {
    12001202                                Frame current = DisplayIO.getCurrentFrame();
    1201                                 //Item itemTemplate = current.getItemTemplate();
     1203                                // Item itemTemplate = current.getItemTemplate();
    12021204                                int xPos = title.getX() + FrameCreator.INDENT_FROM_TITLE;
    12031205                                int yPos = FrameCreator.getYStart(title);
     
    15091511                        // check permissions
    15101512                        if (!item.hasPermission(Permission.full)) {
    1511                                 MessageBay
    1512                                                 .displayMessage("Insufficient permission to change the size of that item");
    1513                                 return;
     1513                                Item editTarget = item.getEditTarget();
     1514                                if (editTarget != item
     1515                                                && editTarget.hasPermission(Permission.full)) {
     1516                                        item = editTarget;
     1517                                } else {
     1518                                        MessageBay
     1519                                                        .displayMessage("Insufficient permission to change the size of that item");
     1520                                        return;
     1521                                }
    15141522                        }
    15151523                        toSet = item;
     
    15691577                                        i.setThickness((float) (i.getThickness() * ratio));
    15701578                                } else if (i instanceof XRayable) {
     1579                                        XRayable xRay = (XRayable) i;
     1580                                        Text source = xRay.getSource();
     1581                                        // Ensure that the source is done before the XRayable
     1582                                        if (!done.contains(source)) {
     1583                                                scaleText(origin, ratio, done, source);
     1584                                        }
     1585
    15711586                                        i.translate(origin, ratio);
    15721587                                        i.setThickness((float) (i.getThickness() * ratio));
    15731588                                        done.add(i);
     1589                                } else if (i.hasVector()) {
     1590                                        // TODO Improve the effiency of resizing vectors... ie...
     1591                                        // dont want to have to reparse all the time
     1592                                        assert (i instanceof Text);
     1593                                        Text text = (Text) i;
     1594                                        AttributeValuePair avp = new AttributeValuePair(text
     1595                                                        .getText());
     1596                                        double scale = 1F;
     1597                                        try {
     1598                                                scale = avp.getDoubleValue();
     1599                                        } catch (Exception e) {
     1600                                        }
     1601                                        scale *= ratio;
     1602                                        NumberFormat nf = Vector.getNumberFormatter();
     1603                                        text.setAttributeValue(nf.format(scale));
     1604                                        text.translate(origin, ratio);
     1605                                        item.getParent().parse();
    15741606                                } else if (i instanceof Text) {
    1575                                         i.translate(origin, ratio);
    1576                                         i.setSize((float) (i.getSize() * ratio));
    1577                                         done.add(i);
     1607                                        scaleText(origin, ratio, done, (Text) i);
    15781608                                }
    15791609                        }
     
    15981628                                current = Math.max(current + diff, Item.MINIMUM_THICKNESS);
    15991629                                dot.setThickness(current);
     1630                        } else if (i.hasVector()) {
     1631                                assert (item instanceof Text);
     1632                                Text text = (Text) item;
     1633                                AttributeValuePair avp = new AttributeValuePair(text.getText());
     1634                                double scale = 1F;
     1635                                try {
     1636                                        scale = avp.getDoubleValue();
     1637                                } catch (Exception e) {
     1638                                }
     1639                                scale *= ratio;
     1640                                NumberFormat nf = Vector.getNumberFormatter();
     1641                                text.setAttributeValue(nf.format(scale));
     1642                                text.translate(origin, ratio);
     1643                                item.getParent().parse();
    16001644                        } else {
    16011645                                float oldSize = Math.abs(i.getSize());
     
    16201664        }
    16211665
     1666        /**
     1667         * @param origin
     1668         * @param ratio
     1669         * @param done
     1670         * @param source
     1671         */
     1672        private static void scaleText(Point2D origin, double ratio,
     1673                        Collection<Item> done, Text source) {
     1674                source.translate(origin, ratio);
     1675                source.setSize((float) (source.getSize() * ratio));
     1676                done.add(source);
     1677        }
     1678
    16221679        private static void SetFillColor(Item item, boolean setTransparent) {
    16231680                if (item == null)
     
    17161773                        // check permissions
    17171774                        if (!item.hasPermission(Permission.full)) {
    1718                                 MessageBay
    1719                                                 .displayMessage("Insufficient permission to change that item's color");
    1720                                 return;
     1775                                Item editTarget = item.getEditTarget();
     1776                                if (editTarget != item
     1777                                                && editTarget.hasPermission(Permission.full)) {
     1778                                        item = editTarget;
     1779                                } else {
     1780                                        MessageBay
     1781                                                        .displayMessage("Insufficient permission to change color");
     1782                                        return;
     1783                                }
    17211784                        }
    17221785                        // Toggling color of circle center changes the circle fill color
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r284 r286  
    22
    33import java.awt.Point;
     4import java.awt.Rectangle;
    45import java.awt.event.ActionEvent;
    56import java.awt.event.ActionListener;
     
    1011import java.awt.event.MouseWheelEvent;
    1112import java.awt.event.MouseWheelListener;
     13import java.text.NumberFormat;
    1214import java.util.ArrayList;
    1315import java.util.Collection;
     
    683685                        // check item permissions
    684686                        if (!clicked.hasPermission(Permission.followLinks)) {
    685                                 MessageBay
    686                                                 .displayMessage("Insufficient permissions to perform action on item");
    687                                 return;
     687                                Item editTarget = clicked.getEditTarget();
     688                                if (editTarget != clicked
     689                                                && editTarget.hasPermission(Permission.followLinks)) {
     690                                        clicked = editTarget;
     691                                } else {
     692                                        MessageBay
     693                                                        .displayMessage("Insufficient permission to perform action on item");
     694                                        return;
     695                                }
    688696                        }
    689697
     
    869877                        // check permissions
    870878                        if (!clicked.hasPermission(Permission.full)) {
    871                                 MessageBay
    872                                                 .displayMessage("Insufficient permission to pick up item");
    873                                 return;
     879                                Item editTarget = clicked.getEditTarget();
     880                                if (editTarget != clicked
     881                                                && editTarget.hasPermission(Permission.full)) {
     882                                        clicked = editTarget;
     883                                } else {
     884                                        MessageBay
     885                                                        .displayMessage("Insufficient permission to pick up item");
     886                                        return;
     887                                }
    874888                        }
    875889
     
    12501264                                        }
    12511265                                } else if (!clicked.hasPermission(Permission.copy)) {
    1252                                         MessageBay
    1253                                                         .displayMessage("Insufficient permission to copy");
    1254                                         return;
     1266                                        Item editTarget = clicked.getEditTarget();
     1267                                        if (editTarget != clicked
     1268                                                        && editTarget.hasPermission(Permission.copy)) {
     1269                                                clicked = editTarget;
     1270                                        } else {
     1271                                                MessageBay
     1272                                                                .displayMessage("Insufficient permission to copy");
     1273                                                return;
     1274                                        }
    12551275                                }
    12561276
     
    15481568
    15491569        private static boolean _controlDown;
    1550        
     1570
    15511571        public static boolean isControlDown() {
    15521572                return _controlDown;
     
    15961616                MouseX = e.getX();
    15971617                MouseY = e.getY();
    1598                 //System.out.println(MouseX + "," + MouseY);
     1618                // System.out.println(MouseX + "," + MouseY);
    15991619
    16001620                // Moving the mouse a certain distance removes the last edited text if
     
    18131833                                // Item.SelectedMode.Connected);
    18141834                                // TODO: The method below is for the most part redundant
    1815                                 on = FrameGraphics.Highlight(on);
     1835                                on = FrameGraphics.Highlight(on.getEditTarget());
    18161836                        }
    18171837                        // if the last item highlighted is still highlighted, clear it
     
    20012021         */
    20022022        public static boolean tdfc(Item linker) throws RuntimeException {
    2003                 // if (linker instanceof Line)
    2004                 // return false;
    2005 
    20062023                // if this is a non-usable item
    20072024                if (linker.getID() < 0)
    20082025                        return false;
     2026
     2027                // Check if its an image that can be resized to fit a box
     2028                // around it
     2029                String text = linker.getText();
     2030                if (text.equals("@v") || text.equals("@f")) {
     2031                        Collection<Item> enclosure = FrameUtils.getEnclosingLineEnds(linker
     2032                                        .getPosition());
     2033                        if (enclosure != null) {
     2034                                for (Item i : enclosure) {
     2035                                        if (i.isLineEnd() && i.isEnclosed()) {
     2036                                                DisplayIO.getCurrentFrame().removeAllItems(enclosure);
     2037                                                Rectangle rect = i.getEnclosedRectangle();
     2038                                                long width = Math.round(rect.getWidth());
     2039                                                if (text.equals("@v")) {
     2040                                                        NumberFormat nf = Vector.getNumberFormatter();
     2041                                                        linker.setText("@v: "
     2042                                                                        + nf.format((width / FrameGraphics
     2043                                                                                        .getMaxFrameSize().getWidth())));
     2044                                                } else {
     2045                                                        linker.setText("@f: " + width);
     2046                                                }
     2047
     2048                                                linker.setPosition(new Point(rect.x, rect.y));
     2049                                                linker.setThickness(i.getThickness());
     2050                                                linker.setBorderColor(i.getColor());
     2051                                                break;
     2052                                        }
     2053                                }
     2054                                FrameMouseActions.deleteItems(enclosure, false);
     2055                        }
     2056                }
    20092057
    20102058                boolean mouseMoved;
     
    21782226                        // check permissions
    21792227                        if (!toDelete.hasPermission(Permission.full)) {
    2180                                 MessageBay
    2181                                                 .displayMessage("Insufficient permission to delete item");
    2182                                 return;
     2228                                Item editTarget = toDelete.getEditTarget();
     2229                                if (editTarget != toDelete
     2230                                                && editTarget.hasPermission(Permission.full)) {
     2231                                        toDelete = editTarget;
     2232                                } else {
     2233                                        MessageBay
     2234                                                        .displayMessage("Insufficient permission to delete item");
     2235                                        return;
     2236                                }
    21832237                        }
    21842238
     
    25322586
    25332587                if (!toGrab.hasPermission(Permission.full)) {
    2534                         MessageBay
    2535                                         .displayMessage("Insufficient permission pickup the item");
     2588                        if (toGrab.getEditTarget() != toGrab) {
     2589                                pickup(toGrab.getEditTarget());
     2590                        } else {
     2591                                MessageBay
     2592                                                .displayMessage("Insufficient permission pickup the item");
     2593                        }
    25362594                        return;
    25372595                }
     
    25392597                if (toGrab instanceof Circle)
    25402598                        toGrab.setHighlightMode(HighlightMode.Connected);
    2541                 else
     2599                //Dont set the highlight mode if a vector is being picked up
     2600                else if(toGrab.isVisible()){
    25422601                        toGrab.setHighlightMode(HighlightMode.Normal);
     2602                }
    25432603
    25442604                // Brook: If the widget corner is being picked up. Instead refer to
     
    25592619
    25602620        public static void pickup(Collection<Item> toGrab) {
    2561                 if(toGrab == null || toGrab.size() == 0)
     2621                if (toGrab == null || toGrab.size() == 0)
    25622622                        return;
    2563                
     2623
    25642624                boolean bReparse = false;
    25652625                Frame frame = DisplayIO.getCurrentFrame();
     
    25942654                                for (Item copy : copies) {
    25952655                                        FreeItems.getInstance().add(copy);
     2656                                        copy.setEditTarget(i);
    25962657                                        copy.setFloating(true);
    25972658                                        copy.setParent(null);
     2659                                        //copy.setHighlightMode(HighlightMode.Connected);
    25982660                                }
    25992661                        }
     
    26362698                } else {
    26372699                        MessageBay
    2638                                         .displayMessage("Insufficient permission pickup the items");
     2700                                        .displayMessage("Insufficient permission to pickup the items");
    26392701                }
    26402702                if (bReparse)
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r284 r286  
    44import java.awt.Point;
    55import java.awt.Polygon;
     6import java.awt.Rectangle;
    67import java.io.File;
    78import java.util.ArrayList;
     
    3132import org.expeditee.items.widgets.WidgetCorner;
    3233import org.expeditee.items.widgets.WidgetEdge;
     34import org.expeditee.network.PeerToPeer;
    3335import org.expeditee.stats.SessionStats;
    3436
     
    580582                        else if (attribute.equals("mailsettings"))
    581583                                MailSession.init(item.getChild());
     584                        else if (attribute.equals("peertopeersettings"))
     585                                PeerToPeer.init(item.getChild());
    582586                        else if (attribute.equals("reminders"))
    583587                                Reminders.init(item.getChild());
     
    779783                                } else if (i.hasFormula()) {
    780784                                        i.setText(i.getFormula());
     785                                } else if (i.hasOverlay()) {
     786                                        i.setVisible(true);
    781787                                }
    782788                        }
     
    849855                                                }
    850856                                                // check for new OVERLAY items
    851                                                 else if (!ignoreAnnotations && ItemUtils.startsWithTag(i,
    852                                                                 ItemUtils.TAG_OVERLAY)
     857                                                else if (!ignoreAnnotations
     858                                                                && ItemUtils.startsWithTag(i,
     859                                                                                ItemUtils.TAG_OVERLAY)
    853860                                                                && i.getLink() != null) {
    854861                                                        if (i.getAbsoluteLink().equalsIgnoreCase(
     
    872879                                                }
    873880                                                // check for ACTIVE_OVERLAY items
    874                                                 else if (!ignoreAnnotations && ItemUtils.startsWithTag(i,
    875                                                                 ItemUtils.TAG_ACTIVE_OVERLAY)
     881                                                else if (!ignoreAnnotations
     882                                                                && ItemUtils.startsWithTag(i,
     883                                                                                ItemUtils.TAG_ACTIVE_OVERLAY)
    876884                                                                && i.getLink() != null) {
    877885                                                        String link = i.getAbsoluteLink();
     
    10281036                        } catch (Exception e) {
    10291037                        }
    1030                         Vector newVector = new Vector(vector, vectorPermission, i
    1031                                         .getPosition(), scale, i.getColor(), i.getBackgroundColor());
     1038                        Vector newVector = new Vector(vector, vectorPermission, scale, i);
    10321039                        i.setOverlay(newVector);
     1040                        i.setVisible(false);
    10331041                        vectors.add(newVector);
    10341042                }
     
    14511459                        if (lastEdited != LastEdited) {
    14521460                                if (LastEdited.startsWith("@i")) {
     1461                                        // Check if its an image that can be resized to fit a box
     1462                                        // around it
     1463                                        String text = LastEdited.getText();
     1464                                        if (text.startsWith("@i:")
     1465                                                        && !Character.isDigit(text
     1466                                                                        .charAt(text.length() - 1))) {
     1467                                                Collection<Item> enclosure = FrameUtils
     1468                                                                .getEnclosingLineEnds(LastEdited.getPosition());
     1469                                                if (enclosure != null) {
     1470                                                        for (Item i : enclosure) {
     1471                                                                if (i.isLineEnd() && i.isEnclosed()) {
     1472                                                                        DisplayIO.getCurrentFrame().removeAllItems(
     1473                                                                                        enclosure);
     1474                                                                        Rectangle rect = i.getEnclosedRectangle();
     1475                                                                        LastEdited
     1476                                                                                        .setText(LastEdited.getText()
     1477                                                                                                        + " "
     1478                                                                                                        + Math.round(rect
     1479                                                                                                                        .getWidth()));
     1480                                                                        LastEdited.setPosition(new Point(rect.x,
     1481                                                                                        rect.y));
     1482                                                                        LastEdited.setThickness(i.getThickness());
     1483                                                                        LastEdited.setBorderColor(i.getColor());
     1484                                                                        break;
     1485                                                                }
     1486                                                        }
     1487                                                        FrameMouseActions.deleteItems(enclosure, false);
     1488                                                }
     1489                                        }
    14531490                                        toReparse = LastEdited.getParent();
    14541491                                } else if (LastEdited.recalculateWhenChanged()) {
  • trunk/src/org/expeditee/gui/UserSettings.java

    r247 r286  
    7171
    7272                UserSettings.FrameDirs.add(FrameIO.FRAME_PATH);
     73                UserSettings.FrameDirs.add(FrameIO.PUBLIC_PATH);
    7374                UserSettings.FrameDirs.add(FrameIO.PROFILE_PATH);
    7475                UserSettings.FrameDirs.add(FrameIO.HELP_PATH);
  • trunk/src/org/expeditee/gui/Vector.java

    r115 r286  
    22
    33import java.awt.Color;
     4import java.awt.Dimension;
    45import java.awt.Point;
     6import java.text.NumberFormat;
    57
     8import org.expeditee.items.Item;
    69import org.expeditee.items.Permission;
    710
     
    1518
    1619        public Color Background;
     20       
     21        public Item Source;
     22       
     23        public Dimension Size;
    1724
    18         public Vector(Frame overlay, Permission permission, Point origin,
    19                         Float scale, Color color, Color background) {
     25        public Vector(Frame overlay, Permission permission,
     26                        Float scale, Item source) {
    2027                super(overlay, permission);
    21                 Origin = origin;
     28                Origin = source.getPosition();
    2229                Scale = scale;
    23                 Foreground = color;
    24                 Background = background;
     30                Foreground = source.getColor();
     31                Background = source.getBackgroundColor();
     32                Source = source;
    2533        }
    2634
     
    5462                return (y - Origin.y) / Scale;
    5563        }
     64
     65        public void setSize(int maxX, int maxY) {
     66                Size = new Dimension(maxX, maxY);
     67        }
     68
     69        public static NumberFormat getNumberFormatter() {
     70                NumberFormat nf = NumberFormat.getInstance();
     71                nf.setMaximumFractionDigits(4);
     72                return nf;
     73        }
    5674}
  • trunk/src/org/expeditee/io/DefaultFrameWriter.java

    r284 r286  
    66import java.lang.reflect.Method;
    77import java.util.Collection;
     8import java.util.HashSet;
    89import java.util.LinkedHashMap;
    910
     
    1213import org.expeditee.gui.FrameIO;
    1314import org.expeditee.items.Item;
     15import org.expeditee.items.Line;
    1416import org.expeditee.items.Text;
    1517
     
    6365                        _ItemTags.put("G", Item.class
    6466                                        .getMethod("getBackgroundColor", param));
    65                         _ItemTags.put("K", Item.class
    66                                         .getMethod("getBorderColor", param));
     67                        _ItemTags.put("K", Item.class.getMethod("getBorderColor", param));
    6768                        _ItemTags.put("H", Item.class.getMethod("getAnchorRight", param));
    6869                        _ItemTags.put("I", Item.class.getMethod("getAnchorBottom", param));
     
    8384                        _ItemTags.put("e", Item.class.getMethod("getFillColor", param));
    8485                        _ItemTags.put("E", Item.class.getMethod("getGradientColor", param));
    85                        
     86
    8687                        _ItemTags.put("i", Item.class.getMethod("getFillPattern", param));
    8788                        _ItemTags.put("o", Item.class.getMethod("getOwner", param));
     
    9697                        _ItemTags.put("t", Text.class.getMethod("getSpacing", param));
    9798
    98                         //TODO set a boolean flag to indicate that the text is a formula
    99                         //Store the formula in the text property NOT the answer
     99                        // TODO set a boolean flag to indicate that the text is a formula
     100                        // Store the formula in the text property NOT the answer
    100101                        _ItemTags.put("J", Item.class.getMethod("getFormula", param));
    101102                        _ItemTags.put("T", Text.class.getMethod("getText", param));
     
    138139        /**
    139140         * Called before writing out the body items of each frame.
    140          * @param starting the name of the frame currently being written out.
     141         *
     142         * @param starting
     143         *            the name of the frame currently being written out.
    141144         * @throws IOException
    142145         */
     
    152155        /**
    153156         * Called after writing out the body items of each frame.
    154          * @param ending the name of the frame currently being written out.
     157         *
     158         * @param ending
     159         *            the name of the frame currently being written out.
    155160         * @throws IOException
    156161         */
     
    160165        protected void initialise(Frame start) throws IOException {
    161166                if (_filename == null)
    162                         _filename = FrameIO.EXPORTS_DIR + getValidFilename(start.getTitle()) + _format;
     167                        _filename = FrameIO.EXPORTS_DIR
     168                                        + getFileName(start) + _format;
    163169
    164170                if (_filename.equalsIgnoreCase(WriteTree.CLIPBOARD)) {
     
    189195        }
    190196
     197        protected String getFileName(Frame start) {
     198                return getValidFilename(start.getTitle());
     199        }
     200
    191201        public static String getValidFilename(String filename) {
    192202                return filename.replaceAll("[ \\.]", "_");
     
    212222                writeStartFrame(toWrite);
    213223
     224                Collection<Item> done = new HashSet<Item>();
     225
    214226                for (Item i : getItemsToWrite(toWrite)) {
    215                         if (_stop){
     227                        if (_stop) {
    216228                                return;
    217229                        }
     230
     231                        if (i instanceof Line) {
     232                                if (done.contains(i)) {
     233                                        continue;
     234                                }
     235                                done.addAll(i.getAllConnected());
     236                        }
    218237                        writeItem(i);
    219238                }
    220 
    221239                writeEndFrame(toWrite);
    222240        }
    223        
     241
    224242        protected Collection<Item> getItemsToWrite(Frame toWrite) {
    225243                return toWrite.getItemsToSave();
  • trunk/src/org/expeditee/io/DefaultFramesetWriter.java

    r284 r286  
    88
    99public class DefaultFramesetWriter extends DefaultFrameWriter {
    10         private long  _firstFrame = 1;
    11         private long _maxFrame = Long.MAX_VALUE;
     10        protected long  _firstFrame = 1;
     11        protected long _maxFrame = Long.MAX_VALUE;
    1212       
    1313        protected DefaultFramesetWriter(long firstFrame, long maxFrame){
  • trunk/src/org/expeditee/io/ItemWriter.java

    r80 r286  
    44import java.util.List;
    55
     6import org.expeditee.items.Circle;
    67import org.expeditee.items.Dot;
    78import org.expeditee.items.Item;
     
    910import org.expeditee.items.Picture;
    1011import org.expeditee.items.Text;
     12import org.expeditee.items.widgets.InteractiveWidget;
     13import org.expeditee.items.widgets.WidgetEdge;
    1114
    1215public abstract class ItemWriter {
     
    2225
    2326        /**
    24          * Called for each item on each frame to write out the contents of the items.
    25          * @param toWrite the item to be written out.
     27         * Called for each item on each frame to write out the contents of the
     28         * items.
     29         *
     30         * @param toWrite
     31         *            the item to be written out.
    2632         * @throws IOException
    2733         */
     
    3844                        writePicture((Picture) toWrite);
    3945
    40                 if (toWrite instanceof Line)
     46                if (toWrite instanceof Line) {
     47                        if (toWrite instanceof WidgetEdge) {
     48                                writeWidget(((WidgetEdge) toWrite).getWidgetSource());
     49                        }
    4150                        writeLine((Line) toWrite);
     51                }
    4252
    4353                if (toWrite instanceof Dot)
    4454                        writeDot((Item) toWrite);
     55
     56                if (toWrite instanceof Circle)
     57                        writeCircle((Circle) toWrite);
    4558        }
    4659
     
    5265                        writeAnnotationPicture((Picture) toWrite);
    5366
    54                 if (toWrite instanceof Line)
     67                if (toWrite instanceof Line) {
    5568                        writeAnnotationLine((Line) toWrite);
     69                }
    5670
    5771                if (toWrite instanceof Dot)
     
    8094        }
    8195
     96        protected void writeCircle(Circle toWrite) throws IOException {
     97        }
     98
     99        protected void writeWidget(InteractiveWidget toWrite) throws IOException {
     100        }
     101
    82102        protected void writeDot(Item toWrite) throws IOException {
    83103        }
  • trunk/src/org/expeditee/io/PdfFramesetWriter.java

    r282 r286  
    11package org.expeditee.io;
    22
     3import java.awt.Color;
    34import java.awt.Dimension;
     5import java.awt.Graphics2D;
    46import java.awt.Image;
    57import java.io.FileOutputStream;
     
    1113import org.expeditee.gui.FrameGraphics;
    1214import org.expeditee.gui.UserSettings;
     15import org.expeditee.items.Circle;
    1316import org.expeditee.items.Item;
     17import org.expeditee.items.Line;
    1418import org.expeditee.items.Picture;
    1519import org.expeditee.items.Text;
     20import org.expeditee.items.widgets.InteractiveWidget;
    1621
    1722import com.lowagie.text.Document;
     
    2631 *
    2732 * @author root
    28  *
     33 * 
    2934 */
    3035public class PdfFramesetWriter extends DefaultFramesetWriter {
     
    3439        private PdfWriter _pdfWriter;
    3540
    36         public PdfFramesetWriter(long firstFrame, long maxFrame) {
     41        private boolean _showFrameNames;
     42
     43        public PdfFramesetWriter(long firstFrame, long maxFrame,
     44                        boolean showFrameNames) {
    3745                super(firstFrame, maxFrame);
    3846                Dimension d = FrameGraphics.getMaxSize();
    3947                _pdfDocument = new Document(new Rectangle(d.width, d.height));
     48                _showFrameNames = showFrameNames;
    4049        }
    41        
     50
    4251        public PdfFramesetWriter() {
    43                 this(1, Long.MAX_VALUE);
     52                this(1, Long.MAX_VALUE, false);
     53        }
     54
     55        @Override
     56        protected String getFileName(Frame start) {
     57                String fileName = start.getFramesetName();
     58                if (_maxFrame < Long.MAX_VALUE) {
     59                        fileName += "_" + _firstFrame + "-" + _maxFrame;
     60                }
     61                return fileName;
    4462        }
    4563
     
    4866                _format = ".pdf";
    4967                super.initialise(start);
     68
    5069                try {
    5170                        _pdfWriter = PdfWriter.getInstance(_pdfDocument,
     
    6887        }
    6988
     89        protected void writeStartFrame(Frame starting) throws IOException {
     90                // TODO color in the frame background color
     91
     92                super.writeStartFrame(starting);
     93        }
     94
    7095        protected void writeEndFrame(Frame ending) throws IOException {
     96                if (_showFrameNames)
     97                        writeText((Text) ending.getNameItem());
    7198                super.writeEndFrame(ending);
    7299                // Move to the next page
     
    108135        protected void writePicture(Picture pic) throws IOException {
    109136                Image image = pic.getCroppedImage();
    110                 if(image == null)
     137                if (image == null)
    111138                        return;
    112139                try {
     
    124151
    125152        @Override
     153        protected void writeLine(Line lineEnd) throws IOException {
     154                PdfContentByte cb = _pdfWriter.getDirectContent();
     155//              Color fill = lineEnd.getFillColor();
     156//              if (fill != null) {
     157//                      cb.setColorFill(fill);
     158//              }
     159                Graphics2D g = cb.createGraphicsShapes(
     160                                FrameGraphics.getMaxSize().width,
     161                                FrameGraphics.getMaxSize().height);
     162                lineEnd.paint(g);
     163//              if (fill != null) {
     164//                      g.setPaint(fill);
     165//              }
     166//              lineEnd.paintFill(g);
     167        }
     168
     169        @Override
    126170        protected Collection<Item> getItemsToWrite(Frame toWrite) {
    127171                return toWrite.getVisibleItems();
    128172        }
     173       
     174        @Override
     175        protected void writeCircle(Circle toWrite) throws IOException {
     176                PdfContentByte cb = _pdfWriter.getDirectContent();
     177                Graphics2D g = cb.createGraphicsShapes(
     178                                FrameGraphics.getMaxSize().width,
     179                                FrameGraphics.getMaxSize().height);
     180                toWrite.paint(g);
     181        }
     182       
     183       
     184        @Override
     185        protected void writeWidget(InteractiveWidget toWrite) throws IOException {
     186                PdfContentByte cb = _pdfWriter.getDirectContent();
     187                Graphics2D g = cb.createGraphicsShapes(
     188                                FrameGraphics.getMaxSize().width,
     189                                FrameGraphics.getMaxSize().height);
     190                toWrite.paint(g);
     191        }
    129192}
  • trunk/src/org/expeditee/items/Item.java

    r284 r286  
    192192                dest._overlay = source._overlay;
    193193                dest._mode = source._mode;// SelectedMode.None;
     194                //dest._highlightColor = source._highlightColor;
     195                //dest.setHighlight(source.getHighlight());
     196               
    194197                dest._visible = source._visible;
    195198                Frame parent = source.getParentOrCurrentFrame();
     
    234237
    235238        private int _id;
     239
     240        private Item _editTarget = this;
    236241
    237242        private String _creationDate = null;
     
    18311836
    18321837        public int setHighlightColor(Color c) {
     1838                if (!this.isVisible() && this.hasVector()) {
     1839                        for (Item i : this.getParentOrCurrentFrame().getVectorItems()) {
     1840                                if (i.getEditTarget() == this) {
     1841                                        i.setHighlightColor(c);
     1842                                }
     1843                        }
     1844                }
    18331845
    18341846                _highlightThickness = DEFAULT_HIGHLIGHT_THICKNESS;
     
    18901902        public void setHighlightMode(HighlightMode mode, Color color) {
    18911903                setHighlightColor(color);
    1892                 if (hasPermission(Permission.followLinks)) {
     1904                if (hasPermission(Permission.followLinks)
     1905                                || getEditTarget().hasPermission(Permission.followLinks)) {
    18931906                        if (_mode != mode) {
    18941907                                _mode = mode;
     
    26662679                }
    26672680        }
     2681
     2682        /**
     2683         * Sets the item to be pickup when the user attempts to pick this item up.
     2684         * EditTarget has a value of 'this' by default but may be set to other
     2685         * values if this item is on a vector.
     2686         *
     2687         * @param target
     2688         *            the item to be copied or picked up when the user attempts to
     2689         *            edit this item.
     2690         */
     2691        public void setEditTarget(Item target) {
     2692                _editTarget = target;
     2693        }
     2694
     2695        public Item getEditTarget() {
     2696                return _editTarget;
     2697        }
    26682698}
  • trunk/src/org/expeditee/items/ItemUtils.java

    r247 r286  
    457457
    458458                for (Item i : toCopy) {
    459 
     459                        //Dont copy parts of a vector
     460                        if(!i.hasPermission(Permission.copy))
     461                                continue;
     462                       
    460463                        // BROOK
    461464                        if (i instanceof WidgetCorner) { // dont add these
  • trunk/src/org/expeditee/items/Text.java

    r282 r286  
    275275
    276276        public void setAttributeValue(String value) {
    277 
     277                AttributeValuePair avp = new AttributeValuePair(getText(),false);
     278                avp.setValue(value);
     279                setText(avp.toString());
    278280        }
    279281
  • trunk/src/org/expeditee/items/widgets/DataFrameWidget.java

    r228 r286  
    11package org.expeditee.items.widgets;
    22
     3import java.awt.Color;
     4import java.awt.Graphics;
    35import java.util.Collection;
    46import java.util.HashSet;
    57
    68import javax.swing.JComponent;
    7 import javax.swing.JPanel;
    89
    910import org.expeditee.gui.Frame;
     
    131132                }
    132133        }
    133        
    134         //STUFF FROM HEAVY_DUTY_INTERACTIVE_WIDGET CLASS
    135        
    136 //      @Override
    137 //      public int getLoadDelayTime() {
    138 //              // TODO Auto-generated method stub
    139 //              return 0;
    140 //      }
    141 //
    142 //      @Override
    143 //      protected float loadWidgetData() {
    144 //              // TODO Auto-generated method stub
    145 //              return 0;
    146 //      }
    147 //
    148 //      @Override
    149 //      protected void saveWidgetData() {
    150 //              // TODO Auto-generated method stub
    151 //             
    152 //      }
    153 //
    154 //      @Override
    155 //      protected void tempUnloadWidgetData() {
    156 //              // TODO Auto-generated method stub
    157 //             
    158 //      }
    159 //
    160 //      @Override
    161 //      protected void unloadWidgetData() {
    162 //              // TODO Auto-generated method stub
    163 //             
    164 //      }
    165 //
    166 //      public boolean doesNeedSaving() {
    167 //              // TODO Auto-generated method stub
    168 //              return false;
    169 //      }
    170 //
    171 //      public String getSaveName() {
    172 //              // TODO Auto-generated method stub
    173 //              return null;
    174 //      }
     134
     135        protected void paintInFreeSpace(Graphics g) {
     136                super.paintInFreeSpace(g);
     137                g.setFont(((Text)getSource()).getFont());
     138                g.setColor(Color.WHITE);
     139                g.drawString(this.getClass().getSimpleName(), getX() + 10, getY() + 20);
     140
     141        }
    175142}
  • trunk/src/org/expeditee/items/widgets/InteractiveWidget.java

    r282 r286  
    1919import javax.swing.SwingUtilities;
    2020
    21 import org.expeditee.gui.AttributeUtils;
     21import org.expeditee.actions.Actions;
    2222import org.expeditee.gui.Browser;
    2323import org.expeditee.gui.DisplayIO;
     
    184184                String classname = tokens[0];
    185185                if (classname.charAt(0) == '$')
    186                         classname = "org.expeditee.items.widgets." + classname.substring(1);
     186                        classname = Actions.getClassName(classname.substring(1));
    187187                // Attempt to locate the class using reflection
    188188                Class<?> iwclass = findIWidgetClass(classname);
  • trunk/src/org/expeditee/items/widgets/charts/TimeSeries.java

    r284 r286  
    211211                                .length()) {
    212212                        df = new SimpleDateFormat(FrameKeyboardActions.LONG_DATE_FORMAT);
    213                 } else {
     213                } else if (dateString.length() <= FrameKeyboardActions.TIME_DATE_FORMAT.length()) {
     214                        df = new SimpleDateFormat(FrameKeyboardActions.TIME_DATE_FORMAT);
     215                }else {
    214216                        df = new SimpleDateFormat(FrameKeyboardActions.SHORT_DATE_FORMAT);
    215217                }
Note: See TracChangeset for help on using the changeset viewer.