Ignore:
Timestamp:
08/05/08 12:42:33 (16 years ago)
Author:
ra33
Message:

Resizable, recolorable borders now available for IW's

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/WidgetEdge.java

    r186 r188  
    66/**
    77 * Widget edges define the boundries of an interactive widget.
     8 *
    89 * @author Brook Novak
    910 */
    1011public class WidgetEdge extends Line {
    11        
     12
    1213        private InteractiveWidget _widgetSource;
    13          
    14         WidgetEdge(WidgetCorner start, WidgetCorner end, int id, InteractiveWidget widgetSource) {
     14
     15        WidgetEdge(WidgetCorner start, WidgetCorner end, int id,
     16                        InteractiveWidget widgetSource) {
    1517                super(start, end, id);
    16                 super.setThickness(2.0f);
    17                 super.setColor(Color.black);
    18                
    19                 if (widgetSource == null) throw new NullPointerException("widgetSource");
     18                if (widgetSource == null)
     19                        throw new NullPointerException("widgetSource");
    2020                _widgetSource = widgetSource;
    2121        }
     
    2424                return _widgetSource;
    2525        }
    26        
     26
    2727        @Override
    2828        public Item forceMerge(Item merger, int mouseX, int mouseY) {
     
    3030        }
    3131
    32 //      @Override
    33 //      public void setThickness(float thick) {
    34 //              // Ignore
    35 //      }
    36        
     32        // @Override
     33        // public void setThickness(float thick) {
     34        // // Ignore
     35        // }
     36
    3737        @Override
    38         public void toggleArrow() { 
     38        public void toggleArrow() {
    3939                // Ignore
    4040        }
    41        
     41
    4242        @Override
    4343        public void toggleDashed(int amount) {
    4444                // Ignore
    4545        }
    46        
     46
    4747        @Override
    4848        public void toggleArrowHeadRatio(int amount) {
    4949                // Ignore
    5050        }
    51        
     51
    5252        @Override
    5353        public void toggleArrowHeadLength(int amount) {
     
    5555        }
    5656
    57 //      @OVERRIDE
    58 //      PUBLIC VOID SETCOLOR(COLOR C) {
    59 //              // IGNORE
    60 //      }
    61        
     57        // @OVERRIDE
     58        // PUBLIC VOID SETCOLOR(COLOR C) {
     59        // // IGNORE
     60        // }
     61
    6262        @Override
    6363        public void setAnnotation(boolean val) {
     
    105105        public void setSize(float size) {
    106106        }
    107        
     107
    108108        @Override
    109109        public boolean contains(int x, int y) {
    110                 return super.contains(x, y) && ! getEnclosedShape().contains(x,y);
     110                return super.contains(x, y) && !getEnclosedShape().contains(x, y);
    111111        }
    112        
     112
    113113        @Override
    114114        public Polygon getEnclosedShape() {
    115115                return getStartItem().getEnclosedShape();
    116116        }
    117        
     117
    118118        @Override
    119119        public String getLink() {
    120120                return _widgetSource.getSource().getLink();
    121121        }
    122        
     122
    123123        @Override
    124124        public void setLink(String link) {
    125125                _widgetSource.getSource().setLink(link);
    126         }       
    127        
     126        }
     127
    128128        @Override
    129129        protected boolean dontPaint() {
    130                 // TODO Auto-generated method stub
    131                 return getThickness() == 0;
     130                return getThickness() <= 0;
     131        }
     132
     133        @Override
     134        public void setThickness(float newThickness, boolean setConnected) {
     135                if (_widgetSource != null) {
     136                        float minThickness = _widgetSource.getMinimumBorderThickness();
     137                        if(newThickness < minThickness)
     138                                newThickness = minThickness;
     139                        super.setThickness(newThickness, setConnected);
     140                        _widgetSource.getSource().setThickness(newThickness, false);
     141                }
     142        }
     143
     144        @Override
     145        public void setColor(Color color) {
     146                if (_widgetSource != null) {
     147                        super.setColor(color);
     148                        _widgetSource.getSource().setColor(color);
     149                }
    132150        }
    133151}
Note: See TracChangeset for help on using the changeset viewer.