Changeset 1177 for trunk/src/org/expeditee/items/widgets/Widget.java
- Timestamp:
- 09/28/18 10:33:02 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/Widget.java
r1159 r1177 542 542 } 543 543 544 //addThisAsContainerListenerToContent(); 545 //addKeyListenerToWidget(); 546 544 547 _textRepresentation = source; 545 548 … … 1113 1116 case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY: 1114 1117 EcosystemManager.addInteractiveWidget(this); 1118 addWidgetContent(e); 1115 1119 break; 1116 1120 } 1117 1121 1118 DisplayController.invalidateItem(_d1, get Bounds());1122 DisplayController.invalidateItem(_d1, getContentBounds()); 1119 1123 1120 1124 // Forward filtered event to upper classes... 1121 1125 onParentStateChanged(e.getEventType()); 1122 1126 } 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 1124 1164 /** 1125 1165 * Override to make use of. Internally this is reported once by all corners, … … 1154 1194 public AxisAlignedBoxBounds getBounds() 1155 1195 { 1156 return new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight()); 1196 return getContentBounds(); 1197 //return new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight()); 1157 1198 } 1158 1199 … … 1882 1923 public Clip getClip() 1883 1924 { 1884 final Clip clip = new Clip(get Bounds());1925 final Clip clip = new Clip(getContentBounds()); 1885 1926 return clip; 1886 1927 } 1928 1929 public void onResized() { 1930 invalidateSelf(); 1931 onBoundsChanged(); 1932 layout(); 1933 } 1887 1934 }
Note:
See TracChangeset
for help on using the changeset viewer.