Ignore:
Timestamp:
09/28/18 10:33:02 (6 years ago)
Author:
bln4
Message:

The following commit comments all relate to work undertaken getting widgets working in the new refactored code.
org.expeditee.items.widgets.JavaFXWidget ->
org.expeditee.items.widgets.SwingWidget ->
org.expeditee.items.widgets.Widget ->

Some additional abstract piping. While the concrete implementation for this code has been added to SwingWidget's, it has not been properly done in JavaFXWidget


org.expeditee.items.widgets.WidgetCorner ->

WidgetCorner's updateBounds() reimplemented.

File:
1 edited

Legend:

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

    r1159 r1177  
    542542                }
    543543               
     544                //addThisAsContainerListenerToContent();
     545                //addKeyListenerToWidget();
     546               
    544547                _textRepresentation = source;
    545548
     
    11131116                        case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY:
    11141117                                EcosystemManager.addInteractiveWidget(this);
     1118                                addWidgetContent(e);
    11151119                                break;
    11161120                }
    11171121
    1118                 DisplayController.invalidateItem(_d1, getBounds());
     1122                DisplayController.invalidateItem(_d1, getContentBounds());
    11191123
    11201124                // Forward filtered event to upper classes...
    11211125                onParentStateChanged(e.getEventType());
    11221126        }
    1123 
     1127       
     1128        /**
     1129         * Subclassing Widgets overwrite to add their specific content to the Frame.
     1130         * For example, a widget being Java Swing must add their Swing component to Expeditee's content pane.
     1131         * @param e Can be used to identify if it is appropriate to draw the widget.
     1132         */
     1133        abstract protected void addWidgetContent(final ItemParentStateChangedEvent e);
     1134       
     1135        /**
     1136         * Subclassing Widgets overwrite to specify their own functionality as to how key events
     1137         * are to be forwarded to Expeditee.
     1138         */
     1139        abstract protected void addKeyListenerToWidget();
     1140       
     1141        /**
     1142         * Subclassing widgets overwrite to specify how content will respond to being added and removed.
     1143         */
     1144        abstract protected void addThisAsContainerListenerToContent();
     1145       
     1146        /**
     1147         * Subclassing widgets overwrite to provide the size and position of their content.
     1148         * For example, a widget using Java Swing might return _swingComponent.getBounds().
     1149         * @return The bounds of the content that is being drawn.
     1150         */
     1151        abstract public AxisAlignedBoxBounds getContentBounds();
     1152       
     1153        /**
     1154         * Due to absolute positioning...
     1155         * @param parent
     1156         */
     1157        abstract protected void layout();
     1158       
     1159        /**
     1160         * Subclassing widgets overwrite  to respond to changes in widget bounds.
     1161         */
     1162        abstract protected void onBoundsChanged();
     1163       
    11241164        /**
    11251165         * Override to make use of. Internally this is reported once by all corners,
     
    11541194        public AxisAlignedBoxBounds getBounds()
    11551195        {
    1156                 return new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight());
     1196                return getContentBounds();
     1197                //return new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight());
    11571198        }
    11581199
     
    18821923        public Clip getClip()
    18831924        {
    1884                 final Clip clip = new Clip(getBounds());
     1925                final Clip clip = new Clip(getContentBounds());
    18851926                return clip;
    18861927        }
     1928       
     1929        public void onResized() {
     1930                invalidateSelf();
     1931                onBoundsChanged();
     1932                layout();
     1933        }
    18871934}
Note: See TracChangeset for help on using the changeset viewer.