|
@@ -15,8 +15,7 @@ |
15 |
15 |
|
import com.google.gwt.user.client.*; |
16 |
16 |
|
import com.google.gwt.user.client.ui.*; |
17 |
17 |
|
|
18 |
|
- |
public abstract class FormImageSelector extends AbstractFocusWidgetErrorableFormElement implements ISizeableWidget |
19 |
|
- |
{ |
|
18 |
+ |
public abstract class FormImageSelector extends AbstractFocusWidgetErrorableFormElement implements ISizeableWidget { |
20 |
19 |
|
public static final String NO_IMAGE = "common/images/misc/tmp/NotAvailable.gif"; |
21 |
20 |
|
|
22 |
21 |
|
protected PopupPanel mPicker; |
|
@@ -35,8 +34,8 @@ |
35 |
34 |
|
protected ISizeableDimensionHelper mWidthHelper; |
36 |
35 |
|
protected ISizeableDimensionHelper mHeightHelper; |
37 |
36 |
|
|
38 |
|
- |
public FormImageSelector( String pFieldLabel, UiFont pLabelFont, String pTooltip, boolean pViewOnly, Integer pInitialWidth, boolean pWidthNotStretchable, Integer pInitialHeight, boolean pHeightNotStretchable ) |
39 |
|
- |
{ |
|
37 |
+ |
public FormImageSelector( String pFieldLabel, UiFont pLabelFont, String pTooltip, boolean pViewOnly, Integer pInitialWidth, boolean pWidthNotStretchable, |
|
38 |
+ |
Integer pInitialHeight, boolean pHeightNotStretchable ) { |
40 |
39 |
|
super( new MyFocusPanel(), pTooltip, "frmImageSelector", false ); |
41 |
40 |
|
mViewOnly = pViewOnly; |
42 |
41 |
|
mWidthHelper = pWidthNotStretchable ? NullWidthHelper.INSTANCE : new StretchableWidthHelper( this ); |
|
@@ -48,21 +47,17 @@ |
48 |
47 |
|
|
49 |
48 |
|
zFocusPanel.add( mDualImage ); |
50 |
49 |
|
|
51 |
|
- |
zFocusPanel.addMouseDownHandler( new MouseDownHandler() |
52 |
|
- |
{ |
|
50 |
+ |
zFocusPanel.addMouseDownHandler( new MouseDownHandler() { |
53 |
51 |
|
@Override |
54 |
|
- |
public void onMouseDown( MouseDownEvent event ) |
55 |
|
- |
{ |
|
52 |
+ |
public void onMouseDown( MouseDownEvent event ) { |
56 |
53 |
|
setFocus(); |
57 |
54 |
|
} |
58 |
55 |
|
} ); |
59 |
56 |
|
|
60 |
|
- |
if ( pInitialWidth != null ) |
61 |
|
- |
{ |
|
57 |
+ |
if ( pInitialWidth != null ) { |
62 |
58 |
|
mDualImage.setImageWidth( pInitialWidth ); |
63 |
59 |
|
} |
64 |
|
- |
if ( pInitialHeight != null ) |
65 |
|
- |
{ |
|
60 |
+ |
if ( pInitialHeight != null ) { |
66 |
61 |
|
mDualImage.setImageHeight( pInitialHeight ); |
67 |
62 |
|
} |
68 |
63 |
|
|
|
@@ -70,14 +65,12 @@ |
70 |
65 |
|
} |
71 |
66 |
|
|
72 |
67 |
|
@Override |
73 |
|
- |
public ISizeableDimensionHelper getWidthHelper() |
74 |
|
- |
{ |
|
68 |
+ |
public ISizeableDimensionHelper getWidthHelper() { |
75 |
69 |
|
return mWidthHelper; |
76 |
70 |
|
} |
77 |
71 |
|
|
78 |
72 |
|
@Override |
79 |
|
- |
public ISizeableDimensionHelper getHeightHelper() |
80 |
|
- |
{ |
|
73 |
+ |
public ISizeableDimensionHelper getHeightHelper() { |
81 |
74 |
|
return mHeightHelper; |
82 |
75 |
|
} |
83 |
76 |
|
|
|
@@ -88,8 +81,7 @@ |
88 |
81 |
|
* @param width the object's new width, in CSS units (e.g. "10px", "1em") |
89 |
82 |
|
*/ |
90 |
83 |
|
@Override |
91 |
|
- |
public void setWidth( String width ) |
92 |
|
- |
{ |
|
84 |
+ |
public void setWidth( String width ) { |
93 |
85 |
|
setDimensionFromWidget( getWidthHelper(), width ); |
94 |
86 |
|
} |
95 |
87 |
|
|
|
@@ -100,123 +92,101 @@ |
100 |
92 |
|
* @param height the object's new height, in CSS units (e.g. "10px", "1em") |
101 |
93 |
|
*/ |
102 |
94 |
|
@Override |
103 |
|
- |
public void setHeight( String height ) |
104 |
|
- |
{ |
|
95 |
+ |
public void setHeight( String height ) { |
105 |
96 |
|
setDimensionFromWidget( getHeightHelper(), height ); |
106 |
97 |
|
} |
107 |
98 |
|
|
108 |
|
- |
protected void setPicker( PopupPanel pPicker ) |
109 |
|
- |
{ |
110 |
|
- |
(mPicker = pPicker).addCloseHandler( new CloseHandler<PopupPanel>() |
111 |
|
- |
{ |
|
99 |
+ |
protected void setPicker( PopupPanel pPicker ) { |
|
100 |
+ |
(mPicker = pPicker).addCloseHandler( new CloseHandler<PopupPanel>() { |
112 |
101 |
|
@Override |
113 |
|
- |
public void onClose( CloseEvent<PopupPanel> event ) |
114 |
|
- |
{ |
|
102 |
+ |
public void onClose( CloseEvent<PopupPanel> event ) { |
115 |
103 |
|
pickerClosed( event.isAutoClosed() ); |
116 |
104 |
|
} |
117 |
105 |
|
} ); |
118 |
106 |
|
} |
119 |
107 |
|
|
120 |
108 |
|
@Override |
121 |
|
- |
public void simulateUserTextEntry( String pText ) |
122 |
|
- |
{ |
|
109 |
+ |
public void simulateUserTextEntry( String pText ) { |
123 |
110 |
|
throw new UnsupportedOperationException( "simulateUserTextEntry on '" + mFieldLabel + "' to:" + pText ); //todo... |
124 |
111 |
|
} |
125 |
112 |
|
|
126 |
113 |
|
@Override |
127 |
|
- |
public void publishAnyPendingChanges() |
128 |
|
- |
{ |
129 |
|
- |
if ( hidePicker() || mBlurring ) |
130 |
|
- |
{ |
|
114 |
+ |
public void publishAnyPendingChanges() { |
|
115 |
+ |
if ( hidePicker() || mBlurring ) { |
131 |
116 |
|
mPicking = false; |
132 |
117 |
|
processDefferredBlur(); |
133 |
118 |
|
} |
134 |
119 |
|
super.publishAnyPendingChanges(); |
135 |
120 |
|
} |
136 |
121 |
|
|
137 |
|
- |
@Override public void onFocus( FocusEvent event ) // FocusPanel / Button |
|
122 |
+ |
@Override |
|
123 |
+ |
public void onFocus( FocusEvent event ) // FocusPanel / Button |
138 |
124 |
|
{ |
139 |
|
- |
if ( mBlurring ) |
140 |
|
- |
{ |
|
125 |
+ |
if ( mBlurring ) { |
141 |
126 |
|
mBlurring = false; |
142 |
|
- |
} |
143 |
|
- |
else |
144 |
|
- |
{ |
|
127 |
+ |
} else { |
145 |
128 |
|
super.onFocus( event ); |
146 |
129 |
|
} |
147 |
130 |
|
} |
148 |
131 |
|
|
149 |
|
- |
@Override public void onBlur( BlurEvent event ) // FocusPanel / Button |
|
132 |
+ |
@Override |
|
133 |
+ |
public void onBlur( BlurEvent event ) // FocusPanel / Button |
150 |
134 |
|
{ |
151 |
135 |
|
mBlurring = true; |
152 |
136 |
|
defferBlur(); |
153 |
137 |
|
} |
154 |
138 |
|
|
155 |
|
- |
protected void processDefferredBlur() |
156 |
|
- |
{ |
157 |
|
- |
if ( mBlurring && !mPicking ) |
158 |
|
- |
{ |
|
139 |
+ |
protected void processDefferredBlur() { |
|
140 |
+ |
if ( mBlurring && !mPicking ) { |
159 |
141 |
|
mBlurring = false; |
160 |
142 |
|
super.onBlur( null ); |
161 |
143 |
|
} |
162 |
144 |
|
} |
163 |
145 |
|
|
164 |
|
- |
protected void defferBlur() |
165 |
|
- |
{ |
166 |
|
- |
Scheduler.get().scheduleDeferred( new Command() |
167 |
|
- |
{ |
|
146 |
+ |
protected void defferBlur() { |
|
147 |
+ |
Scheduler.get().scheduleDeferred( new Command() { |
168 |
148 |
|
@Override |
169 |
|
- |
public void execute() |
170 |
|
- |
{ |
|
149 |
+ |
public void execute() { |
171 |
150 |
|
processDefferredBlur(); |
172 |
151 |
|
} |
173 |
152 |
|
} ); |
174 |
153 |
|
} |
175 |
154 |
|
|
176 |
|
- |
protected void showPicker( int pAbsoluteLeft, int pAbsoluteTop ) |
177 |
|
- |
{ |
|
155 |
+ |
protected void showPicker( int pAbsoluteLeft, int pAbsoluteTop ) { |
178 |
156 |
|
mBlurring = mPicking = true; |
179 |
157 |
|
setFocus(); |
180 |
158 |
|
LLshowPicker( new PointXY( pAbsoluteLeft, pAbsoluteTop ) ); |
181 |
159 |
|
} |
182 |
160 |
|
|
183 |
|
- |
protected void LLshowPicker( PointXY pPointXY ) |
184 |
|
- |
{ |
|
161 |
+ |
protected void LLshowPicker( PointXY pPointXY ) { |
185 |
162 |
|
mPicker.setPopupPositionAndShow( new PopupPanelVisiblePositionCallBack( mPicker, // |
186 |
163 |
|
pPointXY.getX(), pPointXY.getY() ) ); |
187 |
164 |
|
} |
188 |
165 |
|
|
189 |
|
- |
protected boolean hidePicker() |
190 |
|
- |
{ |
|
166 |
+ |
protected boolean hidePicker() { |
191 |
167 |
|
boolean rv = mPicking; |
192 |
|
- |
if ( mPicking ) |
193 |
|
- |
{ |
|
168 |
+ |
if ( mPicking ) { |
194 |
169 |
|
mPicker.hide(); |
195 |
170 |
|
} |
196 |
171 |
|
return rv; |
197 |
172 |
|
} |
198 |
173 |
|
|
199 |
|
- |
protected void pickerClosed( boolean autoClosed ) |
200 |
|
- |
{ |
201 |
|
- |
if ( !autoClosed ) |
202 |
|
- |
{ |
|
174 |
+ |
protected void pickerClosed( boolean autoClosed ) { |
|
175 |
+ |
if ( !autoClosed ) { |
203 |
176 |
|
setFocus(); |
204 |
177 |
|
} |
205 |
178 |
|
mPicking = false; |
206 |
179 |
|
defferBlur(); |
207 |
180 |
|
} |
208 |
181 |
|
|
209 |
|
- |
public boolean isViewOnly() |
210 |
|
- |
{ |
|
182 |
+ |
public boolean isViewOnly() { |
211 |
183 |
|
return mViewOnly; |
212 |
184 |
|
} |
213 |
185 |
|
|
214 |
186 |
|
@Override |
215 |
|
- |
protected int buildComponentPanel( String pLabel, UiFont pLabelFont ) |
216 |
|
- |
{ |
|
187 |
+ |
protected int buildComponentPanel( String pLabel, UiFont pLabelFont ) { |
217 |
188 |
|
int zUniqueID = super.buildComponentPanel( pLabel, pLabelFont ); |
218 |
|
- |
if ( !mViewOnly ) |
219 |
|
- |
{ |
|
189 |
+ |
if ( !mViewOnly ) { |
220 |
190 |
|
mInnerHTMLpanel.add( mPickerButton = createPickerButton(), "imgPick_" + zUniqueID ); |
221 |
191 |
|
mPickerButton.addFocusHandler( this ); |
222 |
192 |
|
mPickerButton.addBlurHandler( this ); |
|
@@ -226,37 +196,31 @@ |
226 |
196 |
|
} |
227 |
197 |
|
|
228 |
198 |
|
@Override |
229 |
|
- |
protected String buildInputRow( String pTrId, String pInputId, int pUniqueID ) |
230 |
|
- |
{ |
|
199 |
+ |
protected String buildInputRow( String pTrId, String pInputId, int pUniqueID ) { |
231 |
200 |
|
String zAdditionalInputCell = mViewOnly ? "" : "<td valign='top'><div class='litesoft-PickerButtonContainer' id='imgPick_" + pUniqueID + "'></div></td>"; |
232 |
201 |
|
return buildInputRowWithOptionalCell( pTrId, pInputId, zAdditionalInputCell ); |
233 |
202 |
|
} |
234 |
203 |
|
|
235 |
204 |
|
@Override |
236 |
|
- |
protected String buildInputRowWithOptionalCell( String pTrId, String pInputId, String pAdditionalInputCell ) |
237 |
|
- |
{ |
238 |
|
- |
return "<tr class='litesoft-FormComponentInputRow'><td id='" + pInputId + "'></td>" + "<td valign='top'>" + "<table cellpadding='0' cellspacing='0'><tr id='" + pTrId + "'>" + pAdditionalInputCell + "</tr></table></td></tr>"; |
|
205 |
+ |
protected String buildInputRowWithOptionalCell( String pTrId, String pInputId, String pAdditionalInputCell ) { |
|
206 |
+ |
return "<tr class='litesoft-FormComponentInputRow'><td id='" + pInputId + "'></td>" + "<td valign='top'>" + |
|
207 |
+ |
"<table cellpadding='0' cellspacing='0'><tr id='" + pTrId + "'>" + pAdditionalInputCell + "</tr></table></td></tr>"; |
239 |
208 |
|
} |
240 |
209 |
|
|
241 |
210 |
|
@Override |
242 |
|
- |
protected void addIndicator( String pTrId ) |
243 |
|
- |
{ |
244 |
|
- |
if ( !mViewOnly ) |
245 |
|
- |
{ |
|
211 |
+ |
protected void addIndicator( String pTrId ) { |
|
212 |
+ |
if ( !mViewOnly ) { |
246 |
213 |
|
mInnerHTMLpanel.add( mIndicatorTd = new IndicatorTd(), pTrId ); |
247 |
214 |
|
} |
248 |
215 |
|
} |
249 |
216 |
|
|
250 |
|
- |
protected Button createPickerButton() |
251 |
|
- |
{ |
|
217 |
+ |
protected Button createPickerButton() { |
252 |
218 |
|
mPickerButton = PickerButton.factory( "litesoft-IconImagePickerButton" ).create(); |
253 |
219 |
|
mPickerButton.setTabIndex( -1 ); |
254 |
220 |
|
|
255 |
|
- |
mPickerButton.addClickHandler( new ClickHandler() |
256 |
|
- |
{ |
|
221 |
+ |
mPickerButton.addClickHandler( new ClickHandler() { |
257 |
222 |
|
@Override |
258 |
|
- |
public void onClick( ClickEvent event ) |
259 |
|
- |
{ |
|
223 |
+ |
public void onClick( ClickEvent event ) { |
260 |
224 |
|
int absoluteLeft = mPickerButton.getAbsoluteLeft(); |
261 |
225 |
|
int absoluteTop = mPickerButton.getAbsoluteTop(); |
262 |
226 |
|
showPicker( absoluteLeft, absoluteTop ); |
|
@@ -266,27 +230,19 @@ |
266 |
230 |
|
return mPickerButton; |
267 |
231 |
|
} |
268 |
232 |
|
|
269 |
|
- |
public ResourceKeyNameURL getCurrentResourceKeyNameURL() |
270 |
|
- |
{ |
|
233 |
+ |
public ResourceKeyNameURL getCurrentResourceKeyNameURL() { |
271 |
234 |
|
return mCurrentResourceKeyNameURL; |
272 |
235 |
|
} |
273 |
236 |
|
|
274 |
|
- |
public void setCurrentResourceKeyNameURL( ResourceKeyNameURL pNewResourceKeyNameURL ) |
275 |
|
- |
{ |
276 |
|
- |
if ( null == (mCurrentResourceKeyNameURL = pNewResourceKeyNameURL) ) |
277 |
|
- |
{ |
|
237 |
+ |
public void setCurrentResourceKeyNameURL( ResourceKeyNameURL pNewResourceKeyNameURL ) { |
|
238 |
+ |
if ( null == (mCurrentResourceKeyNameURL = pNewResourceKeyNameURL) ) { |
278 |
239 |
|
mDualImage.setUrl( NO_IMAGE, "No Image", null ); |
279 |
|
- |
} |
280 |
|
- |
else |
281 |
|
- |
{ |
|
240 |
+ |
} else { |
282 |
241 |
|
mDualImage.setUrl( mCurrentResourceKeyNameURL.getURL(), "" + mCurrentResourceKeyNameURL.getValue(), // |
283 |
|
- |
new Command() |
284 |
|
- |
{ |
|
242 |
+ |
new Command() { |
285 |
243 |
|
@Override |
286 |
|
- |
public void execute() |
287 |
|
- |
{ |
288 |
|
- |
if ( UtilsGwt.wasAltKeyDownOnCurrentEvent() ) |
289 |
|
- |
{ |
|
244 |
+ |
public void execute() { |
|
245 |
+ |
if ( UtilsGwt.wasAltKeyDownOnCurrentEvent() ) { |
290 |
246 |
|
UtilsGwt.windowOpen( mDualImage.getUrl(), "", "" ); |
291 |
247 |
|
} |
292 |
248 |
|
} |
|
@@ -296,175 +252,142 @@ |
296 |
252 |
|
} |
297 |
253 |
|
|
298 |
254 |
|
@Override |
299 |
|
- |
public void setEnabled( boolean pEnabled ) |
300 |
|
- |
{ |
301 |
|
- |
if ( mPickerButton != null ) |
302 |
|
- |
{ |
|
255 |
+ |
public void setEnabled( boolean pEnabled ) { |
|
256 |
+ |
if ( mPickerButton != null ) { |
303 |
257 |
|
mPickerButton.setEnabled( pEnabled ); |
304 |
258 |
|
} |
305 |
259 |
|
} |
306 |
260 |
|
|
307 |
261 |
|
@Override |
308 |
|
- |
public void relayout() |
309 |
|
- |
{ |
|
262 |
+ |
public void relayout() { |
310 |
263 |
|
} |
311 |
264 |
|
|
312 |
|
- |
private static class MyFocusPanel extends FocusPanel implements IFocusWidget |
313 |
|
- |
{ |
|
265 |
+ |
private static class MyFocusPanel extends FocusPanel implements IFocusWidget { |
314 |
266 |
|
private boolean mEnabled = true; |
315 |
267 |
|
|
316 |
268 |
|
@Override |
317 |
|
- |
public boolean isEnabled() |
318 |
|
- |
{ |
|
269 |
+ |
public boolean isEnabled() { |
319 |
270 |
|
return mEnabled; |
320 |
271 |
|
} |
321 |
272 |
|
|
322 |
273 |
|
@Override |
323 |
|
- |
public void setEnabled( boolean pEnabled ) |
324 |
|
- |
{ |
|
274 |
+ |
public void setEnabled( boolean pEnabled ) { |
325 |
275 |
|
mEnabled = pEnabled; |
326 |
276 |
|
} |
327 |
277 |
|
} |
328 |
278 |
|
|
329 |
|
- |
protected static class NullWidthHelper extends AbstractWidthHelper |
330 |
|
- |
{ |
|
279 |
+ |
protected static class NullWidthHelper extends AbstractWidthHelper { |
331 |
280 |
|
public static final NullWidthHelper INSTANCE = new NullWidthHelper(); |
332 |
281 |
|
|
333 |
|
- |
private NullWidthHelper() |
334 |
|
- |
{ |
|
282 |
+ |
private NullWidthHelper() { |
335 |
283 |
|
super( false ); |
336 |
284 |
|
} |
337 |
285 |
|
} |
338 |
286 |
|
|
339 |
|
- |
protected static class NullHeightHelper extends AbstractWidthHelper |
340 |
|
- |
{ |
|
287 |
+ |
protected static class NullHeightHelper extends AbstractWidthHelper { |
341 |
288 |
|
public static final NullWidthHelper INSTANCE = new NullWidthHelper(); |
342 |
289 |
|
|
343 |
|
- |
private NullHeightHelper() |
344 |
|
- |
{ |
|
290 |
+ |
private NullHeightHelper() { |
345 |
291 |
|
super( false ); |
346 |
292 |
|
} |
347 |
293 |
|
} |
348 |
294 |
|
|
349 |
|
- |
private void setDimensionFromWidget( ISizeableDimensionHelper pDimensionHelper, String pSize_1D ) |
350 |
|
- |
{ |
|
295 |
+ |
private void setDimensionFromWidget( ISizeableDimensionHelper pDimensionHelper, String pSize_1D ) { |
351 |
296 |
|
int zSize_1D; |
352 |
|
- |
try |
353 |
|
- |
{ |
|
297 |
+ |
try { |
354 |
298 |
|
zSize_1D = AbstractSizeableWidget.parse( pSize_1D ); |
355 |
299 |
|
} |
356 |
|
- |
catch ( NumberFormatException e ) |
357 |
|
- |
{ |
|
300 |
+ |
catch ( NumberFormatException e ) { |
358 |
301 |
|
throw new IllegalArgumentException( "Attempt to set" + pDimensionHelper.getWhat() + "( \"" + pSize_1D + "\" ) on " + getClass().getName() ); |
359 |
302 |
|
} |
360 |
303 |
|
pDimensionHelper.deligateSetDimensionFromWidget( zSize_1D ); |
361 |
304 |
|
} |
362 |
305 |
|
|
363 |
|
- |
private static abstract class AbstractHeightHelper extends AbstractDimensionHelper |
364 |
|
- |
{ |
365 |
|
- |
protected AbstractHeightHelper( boolean pStretchable ) |
366 |
|
- |
{ |
|
306 |
+ |
private static abstract class AbstractHeightHelper extends AbstractDimensionHelper { |
|
307 |
+ |
protected AbstractHeightHelper( boolean pStretchable ) { |
367 |
308 |
|
super( pStretchable, HeightDimensionHelper.INSTANCE ); |
368 |
309 |
|
} |
369 |
310 |
|
} |
370 |
311 |
|
|
371 |
|
- |
private static abstract class AbstractWidthHelper extends AbstractDimensionHelper |
372 |
|
- |
{ |
373 |
|
- |
protected AbstractWidthHelper( boolean pStretchable ) |
374 |
|
- |
{ |
|
312 |
+ |
private static abstract class AbstractWidthHelper extends AbstractDimensionHelper { |
|
313 |
+ |
protected AbstractWidthHelper( boolean pStretchable ) { |
375 |
314 |
|
super( pStretchable, WidthDimensionHelper.INSTANCE ); |
376 |
315 |
|
} |
377 |
316 |
|
} |
378 |
317 |
|
|
379 |
|
- |
private static class StretchableHeightHelper extends AbstractHeightHelper |
380 |
|
- |
{ |
|
318 |
+ |
private static class StretchableHeightHelper extends AbstractHeightHelper { |
381 |
319 |
|
public static final int DUAL_IMAGE_OVERHEAD = 9; |
382 |
320 |
|
|
383 |
321 |
|
private FormImageSelector mOurWidget; |
384 |
322 |
|
|
385 |
|
- |
public StretchableHeightHelper( FormImageSelector pOurWidget ) |
386 |
|
- |
{ |
|
323 |
+ |
public StretchableHeightHelper( FormImageSelector pOurWidget ) { |
387 |
324 |
|
super( true ); |
388 |
325 |
|
mOurWidget = pOurWidget; |
389 |
326 |
|
} |
390 |
327 |
|
|
391 |
328 |
|
@Override |
392 |
|
- |
public void setDimension( int pDimension ) |
393 |
|
- |
{ |
|
329 |
+ |
public void setDimension( int pDimension ) { |
394 |
330 |
|
setDimension( mOurWidget, pDimension ); |
395 |
331 |
|
} |
396 |
332 |
|
|
397 |
333 |
|
@Override |
398 |
|
- |
public int getDimension() |
399 |
|
- |
{ |
|
334 |
+ |
public int getDimension() { |
400 |
335 |
|
return getDimension( mOurWidget ); |
401 |
336 |
|
} |
402 |
337 |
|
|
403 |
338 |
|
@Override |
404 |
|
- |
public int getDimensionMaxShrinkability() |
405 |
|
- |
{ |
|
339 |
+ |
public int getDimensionMaxShrinkability() { |
406 |
340 |
|
return getDimension( mOurWidget.mDualImage ) - DUAL_IMAGE_OVERHEAD; |
407 |
341 |
|
} |
408 |
342 |
|
|
409 |
343 |
|
@Override |
410 |
|
- |
public int getDecorationSize() |
411 |
|
- |
{ |
|
344 |
+ |
public int getDecorationSize() { |
412 |
345 |
|
return getDimension() - getDimension( mOurWidget.mDualImage ); |
413 |
346 |
|
} |
414 |
347 |
|
|
415 |
348 |
|
@Override |
416 |
|
- |
public void deligateSetDimensionFromWidget( int pDimension ) |
417 |
|
- |
{ |
|
349 |
+ |
public void deligateSetDimensionFromWidget( int pDimension ) { |
418 |
350 |
|
pDimension -= getDecorationSize(); |
419 |
|
- |
if ( pDimension > DUAL_IMAGE_OVERHEAD ) |
420 |
|
- |
{ |
|
351 |
+ |
if ( pDimension > DUAL_IMAGE_OVERHEAD ) { |
421 |
352 |
|
setDimension( mOurWidget.mDualImage, pDimension ); |
422 |
353 |
|
} |
423 |
354 |
|
} |
424 |
355 |
|
} |
425 |
356 |
|
|
426 |
|
- |
private static class StretchableWidthHelper extends AbstractWidthHelper |
427 |
|
- |
{ |
|
357 |
+ |
private static class StretchableWidthHelper extends AbstractWidthHelper { |
428 |
358 |
|
public static final int DUAL_IMAGE_OVERHEAD = 9; |
429 |
359 |
|
|
430 |
360 |
|
private FormImageSelector mOurWidget; |
431 |
361 |
|
|
432 |
|
- |
public StretchableWidthHelper( FormImageSelector pOurWidget ) |
433 |
|
- |
{ |
|
362 |
+ |
public StretchableWidthHelper( FormImageSelector pOurWidget ) { |
434 |
363 |
|
super( true ); |
435 |
364 |
|
mOurWidget = pOurWidget; |
436 |
365 |
|
} |
437 |
366 |
|
|
438 |
367 |
|
@Override |
439 |
|
- |
public void setDimension( int pDimension ) |
440 |
|
- |
{ |
|
368 |
+ |
public void setDimension( int pDimension ) { |
441 |
369 |
|
setDimension( mOurWidget, pDimension ); |
442 |
370 |
|
} |
443 |
371 |
|
|
444 |
372 |
|
@Override |
445 |
|
- |
public int getDimension() |
446 |
|
- |
{ |
|
373 |
+ |
public int getDimension() { |
447 |
374 |
|
return getDimension( mOurWidget ); |
448 |
375 |
|
} |
449 |
376 |
|
|
450 |
377 |
|
@Override |
451 |
|
- |
public int getDimensionMaxShrinkability() |
452 |
|
- |
{ |
|
378 |
+ |
public int getDimensionMaxShrinkability() { |
453 |
379 |
|
return getDimension( mOurWidget.mDualImage ) - DUAL_IMAGE_OVERHEAD; |
454 |
380 |
|
} |
455 |
381 |
|
|
456 |
382 |
|
@Override |
457 |
|
- |
public int getDecorationSize() |
458 |
|
- |
{ |
|
383 |
+ |
public int getDecorationSize() { |
459 |
384 |
|
return getDimension() - getDimension( mOurWidget.mDualImage ); |
460 |
385 |
|
} |
461 |
386 |
|
|
462 |
387 |
|
@Override |
463 |
|
- |
public void deligateSetDimensionFromWidget( int pDimension ) |
464 |
|
- |
{ |
|
388 |
+ |
public void deligateSetDimensionFromWidget( int pDimension ) { |
465 |
389 |
|
pDimension -= getDecorationSize(); |
466 |
|
- |
if ( pDimension > DUAL_IMAGE_OVERHEAD ) |
467 |
|
- |
{ |
|
390 |
+ |
if ( pDimension > DUAL_IMAGE_OVERHEAD ) { |
468 |
391 |
|
setDimension( mOurWidget.mDualImage, pDimension ); |
469 |
392 |
|
} |
470 |
393 |
|
} |