Changeset 77


Ignore:
Timestamp:
05/26/08 08:17:18 (16 years ago)
Author:
bjn8
Message:

Renamed some things for better descriptions ... Removed an unused private function

Location:
trunk/src/org/expeditee/items
Files:
3 edited

Legend:

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

    r76 r77  
    2828public abstract class InteractiveWidget {
    2929
    30         protected JComponent _component;
     30        protected JComponent _swingComponent;
    3131
    3232        /** A widget is comprised of dots and lines that basically form a rectangle */
     
    3838         * GUIDE: l1 d1-------d2 | | l4 | X | 12 | | d4-------d3 13
    3939         */
    40         private List<Item> _items; // used for quickly returning item list
     40        private List<Item> _expediteeItems; // used for quickly returning item list
    4141
    4242        // Widget size restrictions
     
    5151        // The Expeditee item that is used for saving widget state in expiditee
    5252        // world
    53         private Text _source;
     53        private Text _textRepresentation;
    5454
    5555        // A flag for signifying whether the swing components are ready to paint.
     
    346346                                        "source's parent is null, InteractiveWidget's must be created from Text items with non-null parents");
    347347
    348                 _component = component;
    349                 _source = source;
     348                _swingComponent = component;
     349                _textRepresentation = source;
    350350
    351351                _minWidth = minWidth;
     
    367367                int height = (_minHeight < 0) ? 10 : _minHeight;
    368368
    369                 Frame idAllocator = _source.getParent();
     369                Frame idAllocator = _textRepresentation.getParent();
    370370
    371371                // create WidgetCorners
     
    382382                _l4 = new WidgetEdge(_d4, _d1, idAllocator.getNextItemID());
    383383
    384                 _items = new ArrayList<Item>(8); // Note: order important
    385                 _items.add(_d1);
    386                 _items.add(_d2);
    387                 _items.add(_d3);
    388                 _items.add(_d4);
    389                 _items.add(_l1);
    390                 _items.add(_l2);
    391                 _items.add(_l3);
    392                 _items.add(_l4);
    393         }
    394 
    395         /**
    396          * This is for consistancy and to make the code clearer.
    397          *
    398          * @return the corner chosen to listen for events from.
    399          */
    400         private WidgetCorner getEventCorner() {
    401                 return _d4;
     384                _expediteeItems = new ArrayList<Item>(8); // Note: order important
     385                _expediteeItems.add(_d1);
     386                _expediteeItems.add(_d2);
     387                _expediteeItems.add(_d3);
     388                _expediteeItems.add(_d4);
     389                _expediteeItems.add(_l1);
     390                _expediteeItems.add(_l2);
     391                _expediteeItems.add(_l3);
     392                _expediteeItems.add(_l4);
    402393        }
    403394
     
    408399                        throws InteractiveWidgetNotAvailableException {
    409400
    410                 Text t = _source.copy();
     401                Text t = _textRepresentation.copy();
    411402                String clonedAnnotation = getAnnotationString(true);
    412                 _source.setText(clonedAnnotation);
     403                _textRepresentation.setText(clonedAnnotation);
    413404                return InteractiveWidget.CreateWidget(t);
    414405        }
     
    431422
    432423                // Set the new text
    433                 _source.setText(newAnnotation);
    434 
    435                 return _source;
     424                _textRepresentation.setText(newAnnotation);
     425
     426                return _textRepresentation;
    436427        }
    437428
     
    672663                int newTextX = getX();
    673664                int newTextY = getY();
    674                 if (_source.getX() != newTextX || _source.getY() != newTextY)
    675                         _source.setPosition(newTextX, newTextY);
     665                if (_textRepresentation.getX() != newTextX || _textRepresentation.getY() != newTextY)
     666                        _textRepresentation.setPosition(newTextX, newTextY);
    676667
    677668                _settingPositionFlag = false;
     
    703694         */
    704695        public List<Item> getItems() {
    705                 return Collections.unmodifiableList(_items);
     696                return Collections.unmodifiableList(_expediteeItems);
    706697        }
    707698
    708699        public JComponent getComponant() {
    709                 return _component;
     700                return _swingComponent;
    710701        }
    711702
     
    716707                case ItemParentStateChangedEvent.EVENT_TYPE_REMOVED_VIA_OVERLAY:
    717708                case ItemParentStateChangedEvent.EVENT_TYPE_HIDDEN:
    718                         if (_component.getParent() != null) {
    719                                 _component.getParent().remove(_component);
     709                        if (_swingComponent.getParent() != null) {
     710                                _swingComponent.getParent().remove(_swingComponent);
    720711                        }
    721712                        break;
     
    725716                case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN:
    726717                case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY:
    727                         if (_component.getParent() == null) {
     718                        if (_swingComponent.getParent() == null) {
    728719                                addJComponantToFrame(e);
    729720                        }
     
    741732                }
    742733
    743                 if (_component.getParent() == null) {
     734                if (_swingComponent.getParent() == null) {
    744735
    745736                        if (Browser._theBrowser != null) {
     
    754745                                                || e.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY
    755746                                                || e.getSource() == DisplayIO.getCurrentFrame()) {
    756                                         Browser._theBrowser.getContentPane().add(_component);
    757                                         layout(_component);
     747                                        Browser._theBrowser.getContentPane().add(_swingComponent);
     748                                        layout(_swingComponent);
    758749                                }
    759750
     
    835826        public void onBoundsChanged() {
    836827
    837                 _component.setBounds(getX(), getY(), getWidth(), getHeight());
     828                _swingComponent.setBounds(getX(), getY(), getWidth(), getHeight());
    838829
    839830        }
     
    847838
    848839                if (!_isReadyToPaint) {
    849                         layout(_component);
    850                 }
    851 
    852                 Point loc = _component.getLocation();
     840                        layout(_swingComponent);
     841                }
     842
     843                Point loc = _swingComponent.getLocation();
    853844                g.translate(loc.x, loc.y - 1);
    854                 _component.paint(g);
     845                _swingComponent.paint(g);
    855846                g.translate(-loc.x, -(loc.y - 1));
    856847
     
    869860         */
    870861        void paint(Graphics g, WidgetCorner notifier) {
    871                 if (_component.getParent() == null) {
     862                if (_swingComponent.getParent() == null) {
    872863                        // Note that frames with @f may want to paint the widgets so do not
    873864                        // paint over the widget interface in these cases: must only
  • trunk/src/org/expeditee/items/SampleWidget1.java

    r28 r77  
    1111        public SampleWidget1(Text source, String[] args) {
    1212                super(source, new JComboBox(testItems), 200, 200, 50, 50);
    13                 _combo = (JComboBox)super._component;
     13                _combo = (JComboBox)super._swingComponent;
    1414
    1515                // Set state
  • trunk/src/org/expeditee/items/SampleWidget2.java

    r28 r77  
    1919                super(source, new JSplitPane(JSplitPane.VERTICAL_SPLIT), 60, -1, 40, -1);
    2020
    21                 JSplitPane sp = (JSplitPane)super._component;
     21                JSplitPane sp = (JSplitPane)super._swingComponent;
    2222               
    2323                JPanel p = new JPanel(new FlowLayout());
     
    6868                                try {
    6969                                        int div = Integer.parseInt(args[2]);
    70                                         ((JSplitPane)super._component).setDividerLocation(div);
     70                                        ((JSplitPane)super._swingComponent).setDividerLocation(div);
    7171                                } catch (NumberFormatException e) {}
    7272                               
     
    8282                                Integer.toString(_combo.getSelectedIndex()),
    8383                                _text.getText(),
    84                                 Integer.toString(((JSplitPane)super._component).getDividerLocation())
     84                                Integer.toString(((JSplitPane)super._swingComponent).getDividerLocation())
    8585                        };
    8686        }
Note: See TracChangeset for help on using the changeset viewer.