Changeset 278


Ignore:
Timestamp:
08/25/08 15:19:25 (16 years ago)
Author:
ra33
Message:

Fixed some bugs...
AbstractCharts can not be copied, resized, etc

Location:
trunk/src/org/expeditee
Files:
16 edited

Legend:

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

    r275 r278  
    2828import org.expeditee.items.Item;
    2929import org.expeditee.items.ItemUtils;
     30import org.expeditee.items.Text;
    3031
    3132/**
     
    304305                // separate method name and parameter names
    305306                String mname = getName(command);
    306                 if (command.length() > mname.length())
    307                         command = command.substring(mname.length() + 1);
    308                 else
    309                         command = "";
     307                command = command.substring(mname.length()).trim();
     308                //If no params are provided get them from a text item on the cursor
     309                if(command.length() == 0 && launcher instanceof Text){
     310                        command = launcher.getText();
     311                }
    310312
    311313                // Strip off the @ from annotation items
  • trunk/src/org/expeditee/actions/Misc.java

    r270 r278  
    1616import javax.imageio.ImageIO;
    1717
    18 import org.expeditee.importer.FrameDNDTransferHandler;
    1918import org.expeditee.gui.DisplayIO;
    2019import org.expeditee.gui.Frame;
     
    2423import org.expeditee.gui.MessageBay;
    2524import org.expeditee.gui.TimeKeeper;
     25import org.expeditee.importer.FrameDNDTransferHandler;
    2626import org.expeditee.items.Dot;
    2727import org.expeditee.items.Item;
     
    3030import org.expeditee.items.Text;
    3131import org.expeditee.math.ExpediteeJEP;
     32import org.expeditee.simple.SString;
    3233import org.expeditee.stats.CometStats;
    3334import org.expeditee.stats.SessionStats;
     
    759760        }
    760761
     762        public static void attachToCursor(Collection<Item> items) {
     763                for (Item i : items) {
     764                        i.setParent(null);
     765                }
     766                FrameMouseActions.pickup(items);
     767                FrameGraphics.Repaint();
     768        }
     769
    761770        public static void importFiles(Item item) {
    762771                List<File> files = new LinkedList<File>();
     
    786795        }
    787796
    788         public static void createShape(Item item, int sides) {
     797        public static Item createPolygon(Item item, int sides) {
     798                if (item instanceof Text) {
     799                        try {
     800                                SString s = new SString(item.getText());
     801                                sides = s.integerValue().intValue();
     802                        } catch (NumberFormatException e) {
     803                        }
     804                }
     805
    789806                if (sides < 3) {
    790807                        MessageBay.errorMessage("Shapes must have at least 3 sides");
    791808                }
    792                 double angle = 180 - ((sides - 2) * 180.0F) / sides;
     809                double angle = -(180 - ((sides - 2) * 180.0F) / sides);
    793810                double curAngle = 0;
    794811                double size = 50F;
     
    824841
    825842                current.addAllItems(newItems);
    826                 d[0].setThickness(item.getThickness());
    827                 d[0].setFillColor(item.getFillColor());
    828                 d[0].setColor(item.getColor());
     843                if(item instanceof Text){
     844                        for(Item i: item.getAllConnected()){
     845                                if(i instanceof Line){
     846                                        item = i;
     847                                        break;
     848                                }
     849                        }
     850                }
     851               
     852                if (!(item instanceof Text)) {
     853                        d[0].setThickness(item.getThickness());
     854                        d[0].setFillColor(item.getFillColor());
     855                        d[0].setColor(item.getColor());
     856                }
    829857
    830858                ItemUtils.EnclosedCheck(newItems);
    831859                FrameGraphics.refresh(false);
     860
     861                return d[0];
    832862        }
    833863}
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r247 r278  
    500500                        // Set the new frame
    501501                        _CurrentFrames[getCurrentSide()] = frame;
    502                         frame.refreshSize(FrameGraphics.getMaxFrameSize());
     502                        frame.refreshSize();
    503503                        // Notify items on the frame being displayed that they are in view
    504504                        // ie. widgets use this method to add themselves to the content pane
     
    745745                        _VisitedFrames[opposite].add(hiding.getName());
    746746                        _CurrentFrames[opposite] = null;
    747                         _CurrentFrames[current].refreshSize(FrameGraphics.getMaxFrameSize());
     747                        _CurrentFrames[current].refreshSize();
    748748                }
    749749                if (_CurrentFrames[current] != null)
    750                         _CurrentFrames[current].refreshSize(FrameGraphics.getMaxFrameSize());
     750                        _CurrentFrames[current].refreshSize();
    751751                if (_CurrentFrames[opposite] != null)
    752752                        _CurrentFrames[opposite]
    753                                         .refreshSize(FrameGraphics.getMaxFrameSize());
     753                                        .refreshSize();
    754754
    755755                FrameGraphics.Clear();
  • trunk/src/org/expeditee/gui/Frame.java

    r247 r278  
    709709        }
    710710
    711         public void refreshSize(Dimension size) {
    712                 assert (size != null);
    713                 int height = size.height;
    714                 int width = size.width;
     711        public void refreshSize() {
     712                //assert (size != null);
    715713                boolean bReparse = false;
    716714                for (Item i : getItems()) {
     
    718716                        Float anchorRight = i.getAnchorRight();
    719717                        if (anchorRight != null) {
    720                                 i.setX(width - anchorRight);
     718                                i.setAnchorRight(anchorRight);
    721719                                if (i.hasVector()) {
    722720                                        bReparse = true;
     
    724722                        }
    725723                        if (anchorBottom != null) {
    726                                 i.setY(height - anchorBottom);
     724                                i.setAnchorBottom(anchorBottom);
    727725                                if (i.hasVector()) {
    728726                                        bReparse = true;
     
    730728                        }
    731729                }
     730               
     731                //Do the anchors on the overlays
     732                for(Overlay o: getOverlays()){
     733                        o.Frame.refreshSize();
     734                }
     735               
    732736                if (bReparse) {
    733737                        FrameUtils.Parse(this, false);
  • trunk/src/org/expeditee/gui/FrameCreator.java

    r247 r278  
    2020
    2121        // Master copy of next & previous links
    22         private Item _Mnext = new Text("@Next");
    23 
    24         private Item _Mprev = new Text("@Previous");
     22        private Item _Mnext;
     23
     24        private Item _Mprev;
    2525
    2626        // Next and previous links for the current frame
     
    3636        }
    3737
     38        /**
     39         * Creates a text item that looks like a clickable button.
     40         *
     41         * @param text
     42         *            the caption for the button
     43         * @param x
     44         *            the x position for the button. Null if the button is anchored
     45         *            to the right of the screen.
     46         * @param y
     47         *            the y position for the button. Null if the button is anchored
     48         *            to the bottom of the scree.
     49         * @param right
     50         *            the distance the button is anchored from the right of this
     51         *            screen. Null if an absolute position is used.
     52         * @param bottom
     53         *            the distance the button is to be anchored from the bottom of
     54         *            the screen. Null if the button is given an absolute position.
     55         * @return the newly created button.
     56         */
     57        public Item createButton(String text, Float x, Float y, Float right,
     58                        Float bottom) {
     59                Item button = new Text(text);
     60                button.setBackgroundColor(Color.LIGHT_GRAY);
     61                button.setBorderColor(Color.DARK_GRAY);
     62                button.setThickness(2.0F);
     63                if (bottom != null)
     64                        button.setAnchorBottom(bottom);
     65                if (x != null)
     66                        button.setX(x);
     67                if (right != null)
     68                        button.setAnchorRight(15F);
     69                if (y != null)
     70                        button.setY(y);
     71
     72                return button;
     73        }
     74
    3875        public FrameCreator(String name, String path, String frameTitle,
    3976                        boolean recreate) {
     77                _Mnext = createButton("@Next", null, null, 15F, 15F);
     78                _Mprev = createButton("@Previous", 30F, null, null, 15F);
     79
    4080                Frame toUse = null;
    4181                try {
     
    5090                _first = toUse;
    5191                // set positions of next\prev frame links
    52                 _Mnext.setPosition(FrameGraphics.getMaxSize().width - 100,
    53                                 FrameGraphics.getMaxSize().height - 15);
    54                 _Mprev.setPosition(50, FrameGraphics.getMaxSize().height - 15);
     92                // _Mnext.setPosition(FrameGraphics.getMaxSize().width - 100,
     93                // FrameGraphics.getMaxSize().height - 15);
     94                // _Mprev.setPosition(50, FrameGraphics.getMaxSize().height - 15);
    5595        }
    5696
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r242 r278  
    131131                if (current != null) {
    132132                        current.setBuffer(null);
    133                         current.refreshSize(getMaxFrameSize());
     133                        current.refreshSize();
    134134                        if (DisplayIO.isTwinFramesOn()) {
    135135                                Frame opposite = DisplayIO.getOppositeFrame();
    136136                                //if (opposite != null) {
    137137                                        opposite.setBuffer(null);
    138                                         opposite.refreshSize(getMaxFrameSize());
     138                                        opposite.refreshSize();
    139139                                //}
    140140                        }
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r247 r278  
    15021502                                float current = Math.abs(line.getThickness());
    15031503                                current = Math.max(current + diff, Item.MINIMUM_THICKNESS);
    1504                                 line.setThickness(current);
     1504                                line.getStartItem().setThickness(current);
    15051505                                FrameGraphics.Repaint();
    15061506                                return;
     
    15411541                                }
    15421542                        }
    1543                         FrameGraphics.Repaint();
     1543                        FrameGraphics.refresh(true);
    15441544                        return;
    15451545                }
     
    15771577                        toSet.getParent().setChanged(true);
    15781578
    1579                 FrameGraphics.Repaint();
     1579                FrameGraphics.refresh(true);
    15801580        }
    15811581
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r276 r278  
    15911591                MouseX = e.getX();
    15921592                MouseY = e.getY();
     1593                //System.out.println(MouseX + "," + MouseY);
    15931594
    15941595                // Moving the mouse a certain distance removes the last edited text if
  • trunk/src/org/expeditee/items/Dot.java

    r188 r278  
    1111import org.expeditee.gui.DisplayIO;
    1212import org.expeditee.gui.Frame;
     13import org.expeditee.gui.FrameGraphics;
    1314import org.expeditee.gui.FrameKeyboardActions;
    1415
     
    6263        }
    6364
    64         /**
    65          * Sets the 'thickness' of this Dot, that is, how many pixels this Dot
    66          * should be.
    67          *
    68          * @param thick
    69          *            The number of pixels to use when displaying this Dot The Dot
    70          *            is displayed as a thick x thick square.
    71          */
    72         @Override
    73         public void setThickness(float thick) {         
    74                 super.setThickness(thick);
    75 
    76                 updatePolygon();
    77         }
    78 
    7965        @Override
    8066        public void setColor(Color c) {
     
    8470                for (Line line : getLines())
    8571                        line.setColor(c);
     72        }
     73
     74        @Override
     75        public void setAnchorBottom(Float anchor) {
     76                if(!isLineEnd()){
     77                        super.setAnchorBottom(anchor);
     78                        return;
     79                }
     80                invalidateFill();
     81                invalidateCommonTrait(ItemAppearence.PreMoved);
     82                int oldY = getY();
     83                if (anchor != null) {
     84                        float deltaY = FrameGraphics.getMaxFrameSize().height - anchor
     85                                        - getBoundsHeight() - oldY;
     86                        //Check for a more efficient way to do this!!
     87                        //Invalidate all the items
     88                        for (Item i : this.getAllConnected()) {
     89                                i.invalidateAll();
     90                        }
     91                        //Move the items
     92                        for (Item i : this.getAllConnected()) {
     93                                if (i.isLineEnd()){
     94                                        i.setAnchorBottom(null);
     95                                        i.setXY(i.getX(), i.getY() + deltaY);
     96                                        i.updatePolygon();
     97                                        i.invalidateAll();
     98                                }
     99                        }
     100                        //Invalidate them again!!
     101                        for (Item i : this.getAllConnected()) {
     102                                i.invalidateAll();
     103                        }
     104                }
     105                this._anchorBottom = anchor;
     106                invalidateCommonTrait(ItemAppearence.PostMoved);
     107                invalidateFill();
     108        }
     109       
     110        @Override
     111        public void setAnchorRight(Float anchor) {
     112                if(!isLineEnd()){
     113                        super.setAnchorRight(anchor);
     114                        return;
     115                }
     116                invalidateFill();
     117                invalidateCommonTrait(ItemAppearence.PreMoved);
     118                int oldX = getX();
     119                if (anchor != null) {
     120                        float deltaX = FrameGraphics.getMaxFrameSize().width - anchor
     121                                        - getBoundsWidth() - oldX;
     122                        //Check for a more efficient way to do this!!
     123                        //Invalidate all the items
     124                        for (Item i : this.getAllConnected()) {
     125                                i.invalidateAll();
     126                        }
     127                        //Move the items
     128                        for (Item i : this.getAllConnected()) {
     129                                if (i.isLineEnd()){
     130                                        i.setAnchorRight(null);
     131                                        i.setXY(i.getX() + deltaX, i.getY());
     132                                        i.updatePolygon();
     133                                        i.invalidateAll();
     134                                }
     135                        }
     136                        //Invalidate them again!!
     137                        for (Item i : this.getAllConnected()) {
     138                                i.invalidateAll();
     139                        }
     140                }
     141                this._anchorRight = anchor;
     142                invalidateCommonTrait(ItemAppearence.PostMoved);
     143                invalidateFill();
    86144        }
    87145
  • trunk/src/org/expeditee/items/Item.java

    r247 r278  
    182182                dest.setArrow(source.getArrowheadLength(), source.getArrowheadRatio());
    183183
     184                dest.setAnchorBottom(source.getAnchorBottom());
     185                dest.setAnchorRight(source.getAnchorRight());
     186               
    184187                dest.setFormula(source.getFormula());
    185188                dest.setParent(source.getParent());
     
    215218        }
    216219
    217         private Float _anchorRight = null;
    218 
    219         private Float _anchorBottom = null;
     220        protected Float _anchorRight = null;
     221
     222        protected Float _anchorBottom = null;
    220223
    221224        protected HighlightMode _mode = HighlightMode.None;
     
    10571060                Frame sourceFrame = null;
    10581061                Item sourceItem = FreeItems.getItemAttachedToCursor();
     1062
    10591063                if (sourceItem == null) {
    10601064                        sourceItem = this;
     1065                }else{
     1066                        for(Item i: sourceItem.getAllConnected()){
     1067                                if(i instanceof Text){
     1068                                        sourceItem = i;
     1069                                        break;
     1070                                }
     1071                        }
    10611072                }
    10621073
     
    10811092                                FreeItems.getInstance().clear();
    10821093                                if (returnValue instanceof Item) {
    1083                                         Misc.attachToCursor((Item) returnValue);
     1094                                        Misc.attachToCursor(((Item) returnValue).getAllConnected());
    10841095                                } else {
    10851096                                        Misc.attachStatsToCursor(returnValue.toString());
     
    25302541                this._anchorRight = anchor;
    25312542                if (anchor != null)
    2532                         setX(FrameGraphics.getMaxFrameSize().width - anchor);
     2543                        setX(FrameGraphics.getMaxFrameSize().width - anchor - getBoundsWidth());
    25332544        }
    25342545
     
    25402551                this._anchorBottom = anchor;
    25412552                if (anchor != null)
    2542                         setY(FrameGraphics.getMaxFrameSize().height - anchor);
     2553                        setY(FrameGraphics.getMaxFrameSize().height - anchor - getBoundsHeight());
    25432554        }
    25442555
  • trunk/src/org/expeditee/items/Line.java

    r247 r278  
    7979                if (thick < 0)
    8080                        setThickness(DEFAULT_THICKNESS);
     81                else{
     82                        refreshStroke(thick);
     83                }
     84                       
     85        }
     86
     87        private void refreshStroke(float thick) {
     88                int[] pattern = _start.getLinePattern();
     89                if (pattern == null)
     90                        pattern = _end.getLinePattern();
     91
     92                if (pattern != null) {
     93                        float[] dash = new float[pattern.length];
     94                        for (int i = 0; i < pattern.length; i++)
     95                                dash[i] = (float) pattern[i];
     96                        _lineStroke = new BasicStroke(Math.max(thick,
     97                                        MINIMUM_PAINT_THICKNESS), CAP, JOIN, 10f, dash, 0.0f);
     98                } else {
     99                        _lineStroke = new BasicStroke(Math.max(thick,
     100                                        MINIMUM_PAINT_THICKNESS), CAP, JOIN);
     101                }
     102
     103                updatePolygon();
    81104        }
    82105
     
    605628                }
    606629
    607                 int[] pattern = _start.getLinePattern();
    608                 if (pattern == null)
    609                         pattern = _end.getLinePattern();
    610 
    611                 if (pattern != null) {
    612                         float[] dash = new float[pattern.length];
    613                         for (int i = 0; i < pattern.length; i++)
    614                                 dash[i] = (float) pattern[i];
    615                         _lineStroke = new BasicStroke(Math.max(thick,
    616                                         MINIMUM_PAINT_THICKNESS), CAP, JOIN, 10f, dash, 0.0f);
    617                 } else {
    618                         _lineStroke = new BasicStroke(Math.max(thick,
    619                                         MINIMUM_PAINT_THICKNESS), CAP, JOIN);
    620                 }
    621 
    622                 updatePolygon();
     630                refreshStroke(thick);
    623631
    624632                if (bigger)
  • trunk/src/org/expeditee/items/Text.java

    r247 r278  
    286286         */
    287287        public void prependText(String text) {
    288                
     288
    289289                _text.insert(0, text);
    290290                rebuild(false);
     
    300300        public void removeText(String text) {
    301301                if (_text.length() > 0 && _text.indexOf(text) == 0) {
    302                         //Need the invalidate all for dateStamp toggling
     302                        // Need the invalidate all for dateStamp toggling
    303303                        invalidateAll();
    304304                        _text.delete(0, text.length());
     
    13931393                if (getBackgroundColor() != null) {
    13941394                        Color bgc = getBackgroundColor();
    1395                         if (_alpha > 0){
     1395                        if (_alpha > 0) {
    13961396                                bgc = new Color(bgc.getRed(), bgc.getGreen(), bgc.getBlue(),
    13971397                                                _alpha);
    13981398                        }
    13991399                        g.setColor(bgc);
    1400                        
     1400
    14011401                        Color gradientColor = getGradientColor();
    14021402                        if (gradientColor != null) {
     
    14111411                                }
    14121412                        }
    1413                        
     1413
    14141414                        g.fillPolygon(getPolygon());
    14151415                }
     
    18621862                String lowercaseFormula = formula.toLowerCase();
    18631863                ExpediteeJEP myParser = new ExpediteeJEP();
    1864                
     1864
    18651865                int nextVarNo = 1;
    1866                
     1866
    18671867                // Add variables from the containing rectangle if the item being
    18681868                // calculated is inside the enclosing rectangle
    18691869                Collection<Item> enclosed = getItemsInSameEnclosure();
    18701870                for (Item i : enclosed) {
    1871                         if(i == this)
     1871                        if (i == this)
    18721872                                continue;
    18731873                        if (i instanceof Text && !i.isAnnotation()) {
     
    18751875                                if (pair.hasPair()) {
    18761876                                        try {
    1877                                                 double value = pair
    1878                                                 .getDoubleValue();
     1877                                                double value = pair.getDoubleValue();
    18791878                                                myParser.addVariable(pair.getAttribute(), value);
    1880                                                 //myParser.addVariable("$" + nextVarNo++, value);
     1879                                                // myParser.addVariable("$" + nextVarNo++, value);
    18811880                                        } catch (NumberFormatException nfe) {
    18821881                                                continue;
     
    18841883                                                e.printStackTrace();
    18851884                                        }
    1886                                 }else{
     1885                                } else {
    18871886                                        try {
    1888                                                 double value = pair
    1889                                                 .getDoubleValue();
     1887                                                double value = pair.getDoubleValue();
    18901888                                                myParser.addVariable("$" + nextVarNo++, value);
    18911889                                        } catch (NumberFormatException nfe) {
     
    19691967         */
    19701968        public boolean recalculateWhenChanged() {
    1971                 if (/*!isAnnotation()
    1972                                 && */(hasFormula() || getText().contains(":") || isLineEnd()))
     1969                if (/*
     1970                         * !isAnnotation() &&
     1971                         */(hasFormula() || getText().contains(":") || isLineEnd()))
    19731972                        return true;
    19741973                try {
     
    19831982                return getLineDrop(_textLayouts.get(0));
    19841983        }
     1984
     1985        @Override
     1986        public void setAnchorRight(Float anchor) {
     1987                if (!isLineEnd()) {
     1988                        super.setAnchorRight(anchor);
     1989                        // Subtract off the link width
     1990                        if (anchor != null) {
     1991                                setX(FrameGraphics.getMaxFrameSize().width - anchor
     1992                                                - getBoundsWidth() + getLeftMargin());
     1993                        }
     1994                        return;
     1995                }
     1996                invalidateFill();
     1997                invalidateCommonTrait(ItemAppearence.PreMoved);
     1998                int oldX = getX();
     1999                if (anchor != null) {
     2000                        float deltaX = FrameGraphics.getMaxFrameSize().width - anchor
     2001                                        - getBoundsWidth() + getLeftMargin() - oldX;
     2002                        // Check for a more efficient way to do this!!
     2003                        // Invalidate all the items
     2004                        for (Item i : this.getAllConnected()) {
     2005                                i.invalidateAll();
     2006                        }
     2007                        // Move the items
     2008                        for (Item i : this.getAllConnected()) {
     2009                                if (i.isLineEnd()) {
     2010                                        i.setAnchorRight(null);
     2011                                        i.setXY(i.getX() + deltaX, i.getY());
     2012                                }
     2013                        }
     2014                        // Invalidate them again!!
     2015                        for (Item i : this.getAllConnected()) {
     2016                                i.updatePolygon();
     2017                                i.invalidateAll();
     2018                        }
     2019                }
     2020                this._anchorRight = anchor;
     2021                invalidateCommonTrait(ItemAppearence.PostMoved);
     2022                invalidateFill();
     2023        }
     2024       
     2025        @Override
     2026        public void setAnchorBottom(Float anchor) {
     2027                if(!isLineEnd()){
     2028                        super.setAnchorBottom(anchor);
     2029                        return;
     2030                }
     2031                invalidateFill();
     2032                invalidateCommonTrait(ItemAppearence.PreMoved);
     2033                int oldY = getY();
     2034                if (anchor != null) {
     2035                        float deltaY = FrameGraphics.getMaxFrameSize().height - anchor
     2036                                        - getBoundsHeight() - oldY;
     2037                        //Check for a more efficient way to do this!!
     2038                        //Invalidate all the items
     2039                        for (Item i : this.getAllConnected()) {
     2040                                i.invalidateAll();
     2041                        }
     2042                        //Move the items
     2043                        for (Item i : this.getAllConnected()) {
     2044                                if (i.isLineEnd()){
     2045                                        i.setAnchorBottom(null);
     2046                                        i.setXY(i.getX(), i.getY() + deltaY);
     2047                                        i.updatePolygon();
     2048                                        i.invalidateAll();
     2049                                }
     2050                        }
     2051                        //Invalidate them again!!
     2052                        for (Item i : this.getAllConnected()) {
     2053                                i.invalidateAll();
     2054                        }
     2055                }
     2056                this._anchorBottom = anchor;
     2057                invalidateCommonTrait(ItemAppearence.PostMoved);
     2058                invalidateFill();
     2059        }
    19852060}
  • trunk/src/org/expeditee/items/XRayable.java

    r242 r278  
    202202        }
    203203       
     204        @Override
     205        public void setAnchorBottom(Float anchor) {
     206                _source.setAnchorBottom(anchor);
     207        }
     208       
     209        @Override
     210        public void setAnchorRight(Float anchor) {
     211                _source.setAnchorRight(anchor);
     212        }
     213       
    204214        public boolean refresh(){
    205215                return true;
  • trunk/src/org/expeditee/items/widgets/InteractiveWidget.java

    r277 r278  
    11551155                if (_textRepresentation.getLink() != null
    11561156                                || _textRepresentation.hasAction()) {
    1157 
     1157                        //System.out.println("Painted link");
    11581158                        _textRepresentation.paintLinkGraphic(g, getLinkX(), getLinkY());
    11591159
     
    12641264         * Invalidates the link for this widget - if it has one.
    12651265         */
    1266         void invalidateLink() {
     1266        protected void invalidateLink() {
    12671267                if (_textRepresentation.getLink() != null
    12681268                                || _textRepresentation.hasAction()) {
     
    15891589                _textRepresentation.setData(data);
    15901590        }
     1591       
     1592        protected Point getOrigin() {
     1593                return _d1.getPosition();
     1594        }
     1595       
     1596        protected Item getFirstCorner() {
     1597                return _d1;
     1598        }
    15911599}
  • trunk/src/org/expeditee/items/widgets/WidgetCorner.java

    r228 r278  
    3131        @Override
    3232        public void setPosition(float x, float y) {
    33 
    3433                invalidateFill();
    3534                if (_widgetSource != null) { // _widgetSource == null on construction
     
    5453        }
    5554
    56         @Override
    57         public void translate(Point2D origin, double ratio) {
    58                 // super.translate(origin, ratio);
    59         }
     55//      @Override
     56//      public void translate(Point2D origin, double ratio) {
     57//              super.translate(origin, ratio);
     58//      }
    6059
    6160        @Override
  • trunk/src/org/expeditee/items/widgets/charts/AbstractChart.java

    r228 r278  
    33import java.awt.BasicStroke;
    44import java.awt.Color;
     5import java.awt.Component;
    56import java.awt.Font;
    67import java.awt.Paint;
     8import java.awt.Point;
    79import java.awt.event.KeyEvent;
    810import java.awt.event.KeyListener;
     11import java.awt.event.MouseEvent;
     12import java.awt.event.MouseListener;
    913import java.util.Collection;
    1014import java.util.LinkedHashMap;
     
    1519import org.expeditee.gui.ColorUtils;
    1620import org.expeditee.gui.Frame;
     21import org.expeditee.gui.FrameGraphics;
    1722import org.expeditee.gui.FrameIO;
     23import org.expeditee.gui.FrameKeyboardActions;
     24import org.expeditee.gui.FrameMouseActions;
    1825import org.expeditee.gui.FunctionKey;
    1926import org.expeditee.items.Item;
     
    7077                                int index = e.getKeyCode() - KeyEvent.VK_F1 + 1;
    7178                                // Make sure the key is within range
    72                                 if (index < 0 || index >= FunctionKey.values().length)
     79                                if (index < 0 || index >= FunctionKey.values().length) {
    7380                                        return;
     81                                }
    7482
    7583                                FunctionKey key = FunctionKey.values()[index];
    7684                                switch (key) {
    7785                                case SizeUp:
    78                                         // FrameKeyboardActions.SetSize(firstItem, 1, false, true);
     86                                        invalidateLink();
     87                                        FrameKeyboardActions.SetSize(getFirstCorner(), 1, false, true);
     88                                        invalidateSelf();
     89                                        FrameGraphics.refresh(true);
     90                                        //FrameGraphics.requestRefresh(true);
    7991                                        break;
    8092                                case SizeDown:
    81                                         // FrameKeyboardActions.SetSize(firstItem, -1, false, true);
     93                                        invalidateLink();
     94                                        FrameKeyboardActions.SetSize(getFirstCorner(), -1, false, true);
     95                                        invalidateSelf();
     96                                        FrameGraphics.refresh(true);
     97                                        //FrameGraphics.ForceRepaint();
     98                                        //FrameGraphics.refresh(true);
     99                                        //FrameGraphics.requestRefresh(true);
    82100                                        break;
    83101                                case ChangeColor:
     
    110128
    111129                        public void keyTyped(KeyEvent e) {
    112                         }
     130                                FrameKeyboardActions.processChar(e.getKeyChar(), e
     131                                                .isShiftDown());
     132                        }
     133                });
     134                cp.addMouseListener(new MouseListener() {
     135
     136                        public void mouseClicked(MouseEvent e) {
     137                                FrameMouseActions.getInstance().mouseClicked(translateEvent(e));
     138                        }
     139
     140                        public void mouseEntered(MouseEvent e) {
     141                                // FrameMouseActions.getInstance().mouseEntered(translateEvent(e));
     142                        }
     143
     144                        public void mouseExited(MouseEvent e) {
     145                                // FrameMouseActions.getInstance().mouseExited(translateEvent(e));
     146                        }
     147
     148                        public void mousePressed(MouseEvent e) {
     149                                FrameMouseActions.getInstance().mousePressed(translateEvent(e));
     150                        }
     151
     152                        private MouseEvent translateEvent(MouseEvent e) {
     153                                Point origin = getOrigin();
     154                                return new MouseEvent((Component) e.getSource(), e.getID(), e
     155                                                .getWhen(), e.getModifiers(), origin.x + e.getX(),
     156                                                origin.y + e.getY(), e.getXOnScreen(),
     157                                                e.getYOnScreen(), e.getClickCount(), false, e
     158                                                                .getButton());
     159                        }
     160
     161                        public void mouseReleased(MouseEvent e) {
     162                                FrameMouseActions.getInstance()
     163                                                .mouseReleased(translateEvent(e));
     164                        }
     165
    113166                });
    114167                super._swingComponent = cp;
     
    316369                        legend.setLegendItemGraphicPadding(new RectangleInsets(pad2, pad2,
    317370                                        pad2, pad2));
    318                         legend.setMargin(newThickness,newThickness,newThickness,newThickness);
     371                        legend.setMargin(newThickness, newThickness, newThickness,
     372                                        newThickness);
    319373                }
    320374                float pad0 = newThickness - 1;
Note: See TracChangeset for help on using the changeset viewer.