Subversion Repository Public Repository

litesoft

Diff Revisions 755 vs 756 for /trunk/mobileGWT/mgwtPlus/src/org/litesoft/mgwt/client/pavsupport/AbstractBackableViewImpl.java

Diff revisions: vs.
  @@ -8,6 +8,7 @@
8 8 import org.litesoft.core.util.externalization.*;
9 9 import org.litesoft.mgwt.client.*;
10 10 import org.litesoft.mgwt.client.widgets.Button;
11 + import org.litesoft.mgwt.client.widgets.*;
11 12
12 13 import com.google.gwt.dom.client.*;
13 14 import com.google.gwt.event.logical.shared.*;
  @@ -25,6 +26,7 @@
25 26 import com.googlecode.mgwt.ui.client.widget.base.ButtonBase;
26 27 import com.googlecode.mgwt.ui.client.widget.base.*;
27 28 import com.googlecode.mgwt.ui.client.widget.buttonbar.*;
29 + import com.sun.istack.internal.*;
28 30
29 31 public abstract class AbstractBackableViewImpl<Presenter extends AbstractBackablePresenter> extends AbstractViewImpl<Presenter> implements AbstractBackableView<Presenter>
30 32 {
  @@ -39,7 +41,7 @@
39 41 protected final HTML title = new HTML();
40 42 protected final HeaderButton headerBackButton = new HeaderButton();
41 43
42 - public AbstractBackableViewImpl( E13nResolver pResolver )
44 + public AbstractBackableViewImpl( @NotNull E13nResolver pResolver )
43 45 {
44 46 super( pResolver );
45 47
  @@ -80,12 +82,12 @@
80 82 }
81 83
82 84 @Override
83 - public final void setTitleCode( String pTitleCode )
85 + public final void setTitleCode( @NotNull String pTitleCode )
84 86 {
85 87 title.setText( getResolver().resolve( UtilsCommon.noEmpty( pTitleCode, "NoHeaderTitle" ) ) );
86 88 }
87 89
88 - protected <T extends Widget> T setContent( T pWidget )
90 + protected <T extends Widget> T setContent( @NotNull T pWidget )
89 91 {
90 92 scrollPanel.setWidget( pWidget );
91 93 scrollPanel.setScrollingEnabledX( false );
  @@ -99,7 +101,7 @@
99 101
100 102 // "Forward" Header Buttons
101 103
102 - protected HeaderButton setForwardButton( String pName )
104 + protected HeaderButton setForwardButton( @NotNull String pName )
103 105 {
104 106 HeaderButton zHeaderButton = new HeaderButton();
105 107 headerPanel.setRightWidget( zHeaderButton );
  @@ -108,26 +110,26 @@
108 110 return zHeaderButton;
109 111 }
110 112
111 - protected HeaderButton setForwardButton( String pName, Command pOnTapCommand )
113 + protected HeaderButton setForwardButton( @NotNull String pName, @Nullable Command pOnTapCommand )
112 114 {
113 115 return add( setForwardButton( pName ), pOnTapCommand );
114 116 }
115 117
116 118 // Common Content Types
117 119
118 - protected Panel createContentFlowPanel( Widget... pWidgets )
120 + protected Panel createContentFlowPanel( @Nullable Widget... pWidgets )
119 121 {
120 122 FlowPanel zPanel = new FlowPanel();
121 123 zPanel.getElement().getStyle().setMarginTop( 20, Style.Unit.PX );
122 124 return setContent( addTo( zPanel, pWidgets ) );
123 125 }
124 126
125 - protected Panel createContentRoundPanel( Widget... pWidgets )
127 + protected Panel createContentRoundPanel( @Nullable Widget... pWidgets )
126 128 {
127 129 return setContent( addTo( new RoundPanel(), pWidgets ) );
128 130 }
129 131
130 - protected <T> OptionList<T> createContentOptionList( final SelectedListener<T> pSelectedListener )
132 + protected <T> OptionList<T> createContentOptionList( @Nullable SelectedListener<T> pSelectedListener )
131 133 {
132 134 return setContent( new OptionList<T>( getResolver(), pSelectedListener ) );
133 135 }
  @@ -139,7 +141,7 @@
139 141
140 142 // ButtonBar
141 143
142 - protected ButtonBar addButtonBar( Widget... pWidgets )
144 + protected ButtonBar addButtonBar( @Nullable Widget... pWidgets )
143 145 {
144 146 ButtonBar zButtonBar = new ButtonBar();
145 147 addTo( zButtonBar, pWidgets );
  @@ -159,143 +161,143 @@
159 161
160 162 // Non-Header Buttons
161 163
162 - protected Button addButton( HasWidgets pContainer, String pLabelTextCode, Command pOnTapCommand )
164 + protected Button addButton( @NotNull HasWidgets pContainer, @NotNull String pLabelTextCode, @Nullable Command pOnTapCommand )
163 165 {
164 166 Button zButton = createButton( pLabelTextCode, pOnTapCommand );
165 167 pContainer.add( zButton );
166 168 return zButton;
167 169 }
168 170
169 - protected Button createButton( String pLabelTextCode, Command pOnTapCommand )
171 + protected Button createButton( @NotNull String pLabelTextCode, @Nullable Command pOnTapCommand )
170 172 {
171 173 return add( new Button( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) + "Button" ) ), pOnTapCommand );
172 174 }
173 175
174 - protected TrashButton createButtonTrash( Command pOnTapCommand )
176 + protected TrashButton createButtonTrash( @Nullable Command pOnTapCommand )
175 177 {
176 178 return add( new TrashButton(), pOnTapCommand );
177 179 }
178 180
179 - protected CameraButton createButtonCamera( Command pOnTapCommand )
181 + protected CameraButton createButtonCamera( @Nullable Command pOnTapCommand )
180 182 {
181 183 return add( new CameraButton(), pOnTapCommand );
182 184 }
183 185
184 - protected ActionButton createButtonAction( Command pOnTapCommand )
186 + protected ActionButton createButtonAction( @Nullable Command pOnTapCommand )
185 187 {
186 188 return add( new ActionButton(), pOnTapCommand );
187 189 }
188 190
189 - protected ArrowDownButton createButtonArrowDown( Command pOnTapCommand )
191 + protected ArrowDownButton createButtonArrowDown( @Nullable Command pOnTapCommand )
190 192 {
191 193 return add( new ArrowDownButton(), pOnTapCommand );
192 194 }
193 195
194 - protected ArrowUpButton createButtonArrowUp( Command pOnTapCommand )
196 + protected ArrowUpButton createButtonArrowUp( @Nullable Command pOnTapCommand )
195 197 {
196 198 return add( new ArrowUpButton(), pOnTapCommand );
197 199 }
198 200
199 - protected ArrowLeftButton createButtonArrowLeft( Command pOnTapCommand )
201 + protected ArrowLeftButton createButtonArrowLeft( @Nullable Command pOnTapCommand )
200 202 {
201 203 return add( new ArrowLeftButton(), pOnTapCommand );
202 204 }
203 205
204 - protected ArrowRightButton createButtonArrowRight( Command pOnTapCommand )
206 + protected ArrowRightButton createButtonArrowRight( @Nullable Command pOnTapCommand )
205 207 {
206 208 return add( new ArrowRightButton(), pOnTapCommand );
207 209 }
208 210
209 - protected BookmarkButton createButtonBookmark( Command pOnTapCommand )
211 + protected BookmarkButton createButtonBookmark( @Nullable Command pOnTapCommand )
210 212 {
211 213 return add( new BookmarkButton(), pOnTapCommand );
212 214 }
213 215
214 - protected ComposeButton createButtonCompose( Command pOnTapCommand )
216 + protected ComposeButton createButtonCompose( @Nullable Command pOnTapCommand )
215 217 {
216 218 return add( new ComposeButton(), pOnTapCommand );
217 219 }
218 220
219 - protected FastForwardButton createButtonFastForward( Command pOnTapCommand )
221 + protected FastForwardButton createButtonFastForward( @Nullable Command pOnTapCommand )
220 222 {
221 223 return add( new FastForwardButton(), pOnTapCommand );
222 224 }
223 225
224 - protected InfoButton createButtonInfo( Command pOnTapCommand )
226 + protected InfoButton createButtonInfo( @Nullable Command pOnTapCommand )
225 227 {
226 228 return add( new InfoButton(), pOnTapCommand );
227 229 }
228 230
229 - protected LocateButton createButtonLocate( Command pOnTapCommand )
231 + protected LocateButton createButtonLocate( @Nullable Command pOnTapCommand )
230 232 {
231 233 return add( new LocateButton(), pOnTapCommand );
232 234 }
233 235
234 - protected NewIconButton createButtonNewIcon( Command pOnTapCommand )
236 + protected NewIconButton createButtonNewIcon( @Nullable Command pOnTapCommand )
235 237 {
236 238 return add( new NewIconButton(), pOnTapCommand );
237 239 }
238 240
239 - protected NextSlideButton createButtonNextSlide( Command pOnTapCommand )
241 + protected NextSlideButton createButtonNextSlide( @Nullable Command pOnTapCommand )
240 242 {
241 243 return add( new NextSlideButton(), pOnTapCommand );
242 244 }
243 245
244 - protected OrganizeButton createButtonOrganize( Command pOnTapCommand )
246 + protected OrganizeButton createButtonOrganize( @Nullable Command pOnTapCommand )
245 247 {
246 248 return add( new OrganizeButton(), pOnTapCommand );
247 249 }
248 250
249 - protected PauseButton createButtonPause( Command pOnTapCommand )
251 + protected PauseButton createButtonPause( @Nullable Command pOnTapCommand )
250 252 {
251 253 return add( new PauseButton(), pOnTapCommand );
252 254 }
253 255
254 - protected PlayButton createButtonPlay( Command pOnTapCommand )
256 + protected PlayButton createButtonPlay( @Nullable Command pOnTapCommand )
255 257 {
256 258 return add( new PlayButton(), pOnTapCommand );
257 259 }
258 260
259 - protected PlusButton createButtonPlus( Command pOnTapCommand )
261 + protected PlusButton createButtonPlus( @Nullable Command pOnTapCommand )
260 262 {
261 263 return add( new PlusButton(), pOnTapCommand );
262 264 }
263 265
264 - protected PreviousSlideButton createButtonPreviousSlide( Command pOnTapCommand )
266 + protected PreviousSlideButton createButtonPreviousSlide( @Nullable Command pOnTapCommand )
265 267 {
266 268 return add( new PreviousSlideButton(), pOnTapCommand );
267 269 }
268 270
269 - protected ReplyButton createButtonReply( Command pOnTapCommand )
271 + protected ReplyButton createButtonReply( @Nullable Command pOnTapCommand )
270 272 {
271 273 return add( new ReplyButton(), pOnTapCommand );
272 274 }
273 275
274 - protected RewindButton createButtonRewind( Command pOnTapCommand )
276 + protected RewindButton createButtonRewind( @Nullable Command pOnTapCommand )
275 277 {
276 278 return add( new RewindButton(), pOnTapCommand );
277 279 }
278 280
279 - protected SearchButton createButtonSearch( Command pOnTapCommand )
281 + protected SearchButton createButtonSearch( @Nullable Command pOnTapCommand )
280 282 {
281 283 return add( new SearchButton(), pOnTapCommand );
282 284 }
283 285
284 - protected StopButton createButtonStop( Command pOnTapCommand )
286 + protected StopButton createButtonStop( @Nullable Command pOnTapCommand )
285 287 {
286 288 return add( new StopButton(), pOnTapCommand );
287 289 }
288 290
289 291 // FlowPanel Widgets
290 292
291 - protected Widget createListHeader( String pHeaderTextCode )
293 + protected Widget createListHeader( @NotNull String pHeaderTextCode )
292 294 {
293 295 HTML header = new HTML( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Header Text Code", pHeaderTextCode ) ) );
294 296 header.addStyleName( MGWTStyle.getTheme().getMGWTClientBundle().getListCss().listHeader() );
295 297 return header;
296 298 }
297 299
298 - protected WidgetList createRoundWidgetList( Widget... pWidgets )
300 + protected WidgetList createRoundWidgetList( @Nullable Widget... pWidgets )
299 301 {
300 302 WidgetList zList = new WidgetList();
301 303 zList.setRound( true );
  @@ -303,7 +305,7 @@
303 305 return addTo( zList, pWidgets );
304 306 }
305 307
306 - protected <T extends HasWidgets> T addTo( T pPanel, Widget... pWidgets )
308 + protected <T extends HasWidgets> T addTo( @NotNull T pPanel, @Nullable Widget... pWidgets )
307 309 {
308 310 if ( pWidgets != null )
309 311 {
  @@ -318,17 +320,17 @@
318 320 return pPanel;
319 321 }
320 322
321 - protected Widget createLabel( E13nData pE13nData )
323 + protected Widget createLabel( @NotNull E13nData pE13nData )
322 324 {
323 325 return createLabel( makeSafeHtml( getResolver().resolve( UtilsCommon.assertNotNull( "Label E13nData", pE13nData ) ) ) );
324 326 }
325 327
326 - protected Widget createLabel( String pLabelTextCode )
328 + protected Widget createLabel( @NotNull String pLabelTextCode )
327 329 {
328 330 return createLabel( makeSafeHtml( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) ) ) );
329 331 }
330 332
331 - protected Widget createLabel( SafeHtml pSafeHtml )
333 + protected Widget createLabel( @NotNull SafeHtml pSafeHtml )
332 334 {
333 335 return new HTML( UtilsCommon.assertNotNull( "Label SafeHtml", pSafeHtml ) );
334 336 }
  @@ -338,54 +340,108 @@
338 340 return new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml( HTMLize.escape( pText ) );
339 341 }
340 342
341 - protected Widget withPlaceHolder( String pPlaceHolderTextCode, HasPlaceHolder pWidget )
343 + protected Widget withPlaceHolder( @NotNull String pPlaceHolderTextCode, @NotNull HasPlaceHolder pWidget )
342 344 {
343 345 pWidget.setPlaceHolder( getResolver().resolve( "PlaceHolder" + UtilsCommon.assertNotNullNotEmpty( "Place Holder Text Code", pPlaceHolderTextCode ) ) );
344 346 return (Widget) pWidget;
345 347 }
346 348
347 - protected Widget createFormListEntry( String pLabelTextCode, Widget pInputWidget )
349 + protected Widget createFormListEntry( @NotNull String pLabelTextCode, @NotNull Widget pInputWidget )
348 350 {
349 351 return new FormListEntry( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) ), //
350 352 UtilsCommon.assertNotNull( "InputWidget", pInputWidget ) );
351 353 }
352 354
353 - protected MTextArea createInputTextArea( ValueChangeHandler<String> pChangeHandler )
355 + protected <T> RadioGroup<T> createInputRadioGroup( @Nullable SelectedListener<T> pSelectedListener )
356 + {
357 + return new RadioGroup<T>( getResolver(), pSelectedListener );
358 + }
359 +
360 + protected MRadioButton createInputRadioButton( @NotNull String pLabelTextCode, @Nullable ValueChangeHandler<Boolean> pChangeHandler )
361 + {
362 + return createInputRadioButton( HTMLPanel.createUniqueId(), pLabelTextCode, pChangeHandler );
363 + }
364 +
365 + protected MRadioButton createInputRadioButton( @NotNull String pGroupID, @NotNull String pLabelTextCode, @Nullable ValueChangeHandler<Boolean> pChangeHandler )
366 + {
367 + MRadioButton zRB = new MRadioButton( pGroupID );
368 + zRB.setText( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) ) );
369 + return add( zRB, pChangeHandler );
370 + }
371 +
372 + protected <T> OptionListBox<T> createInputOptionListBox( @Nullable List<T> pOptions, @Nullable SelectedListener<T> pSelectedListener )
373 + {
374 + return createInputOptionListBox( pSelectedListener ).options( pOptions );
375 + }
376 +
377 + protected <T> OptionListBox<T> createInputOptionListBox( @Nullable SelectedListener<T> pSelectedListener, @Nullable T... pOptions )
378 + {
379 + return createInputOptionListBox( pSelectedListener ).options( pOptions );
380 + }
381 +
382 + protected <T> OptionListBox<T> createInputOptionListBox( @Nullable T... pOptions )
383 + {
384 + return new OptionListBox<T>( getResolver() ).options( pOptions );
385 + }
386 +
387 + protected <T> OptionListBox<T> createInputOptionListBox( @Nullable SelectedListener<T> pSelectedListener )
388 + {
389 + return new OptionListBox<T>( getResolver(), pSelectedListener );
390 + }
391 +
392 + protected MLabeledCheckBox createInputLabeledCheckBox( @NotNull String pLabelTextCode, @Nullable ValueChangeHandler<Boolean> pChangeHandler )
393 + {
394 + return add( new MLabeledCheckBox( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) ) ), pChangeHandler );
395 + }
396 +
397 + protected MCheckBox createInputCheckBox( @Nullable ValueChangeHandler<Boolean> pChangeHandler )
398 + {
399 + return add( new MCheckBox(), pChangeHandler );
400 + }
401 +
402 + protected MCheckBox createInputCheckBoxImportant( @Nullable ValueChangeHandler<Boolean> pChangeHandler )
403 + {
404 + MCheckBox zCheckBox = new MCheckBox();
405 + zCheckBox.setImportant( true );
406 + return add( zCheckBox, pChangeHandler );
407 + }
408 +
409 + protected MTextArea createInputTextArea( @Nullable ValueChangeHandler<String> pChangeHandler )
354 410 {
355 411 return add( new MTextArea(), pChangeHandler );
356 412 }
357 413
358 - protected MTextBox createInputTextBox( ValueChangeHandler<String> pChangeHandler )
414 + protected MTextBox createInputTextBox( @Nullable ValueChangeHandler<String> pChangeHandler )
359 415 {
360 416 return add( new MTextBox(), pChangeHandler );
361 417 }
362 418
363 - protected MPasswordTextBox createInputPasswordTextBox( ValueChangeHandler<String> pChangeHandler )
419 + protected MPasswordTextBox createInputPasswordTextBox( @Nullable ValueChangeHandler<String> pChangeHandler )
364 420 {
365 421 return add( new MPasswordTextBox(), pChangeHandler );
366 422 }
367 423
368 - protected MPhoneNumberTextBox createInputPhoneNumberTextBox( ValueChangeHandler<String> pChangeHandler )
424 + protected MPhoneNumberTextBox createInputPhoneNumberTextBox( @Nullable ValueChangeHandler<String> pChangeHandler )
369 425 {
370 426 return add( new MPhoneNumberTextBox(), pChangeHandler );
371 427 }
372 428
373 - protected MUrlTextBox createInputUrlTextBox( ValueChangeHandler<String> pChangeHandler )
429 + protected MUrlTextBox createInputUrlTextBox( @Nullable ValueChangeHandler<String> pChangeHandler )
374 430 {
375 431 return add( new MUrlTextBox(), pChangeHandler );
376 432 }
377 433
378 - protected MEmailTextBox createInputEmailTextBox( ValueChangeHandler<String> pChangeHandler )
434 + protected MEmailTextBox createInputEmailTextBox( @Nullable ValueChangeHandler<String> pChangeHandler )
379 435 {
380 436 return add( new MEmailTextBox(), pChangeHandler );
381 437 }
382 438
383 - protected MNumberTextBox createInputNumberTextBox( ValueChangeHandler<String> pChangeHandler )
439 + protected MNumberTextBox createInputNumberTextBox( @Nullable ValueChangeHandler<String> pChangeHandler )
384 440 {
385 441 return add( new MNumberTextBox(), pChangeHandler );
386 442 }
387 443
388 - protected MDateBox createInputDateBox( ValueChangeHandler<Date> pChangeHandler )
444 + protected MDateBox createInputDateBox( @Nullable ValueChangeHandler<Date> pChangeHandler )
389 445 {
390 446 return add( new MDateBox(), pChangeHandler );
391 447 }
  @@ -393,26 +449,26 @@
393 449 // Error "Alert" Dialogs
394 450
395 451 @Override
396 - public void showError( String pTitleCode, String pErrorCode )
452 + public void showError( @NotNull String pTitleCode, @NotNull String pErrorCode )
397 453 {
398 454 alert( pTitleCode, getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Error Code", pErrorCode ) ), null );
399 455 }
400 456
401 457 @Override
402 - public void showError( String pTitleCode, E13nData pErrorData )
458 + public void showError( @NotNull String pTitleCode, @NotNull E13nData pErrorData )
403 459 {
404 460 alert( pTitleCode, getResolver().resolve( UtilsCommon.assertNotNull( "Error Data", pErrorData ) ), null );
405 461 }
406 462
407 463 // Dialogs
408 464
409 - protected void alert( String pWhatCode, final DialogCloseCallBack pCallBack )
465 + protected void alert( @NotNull String pWhatCode, @Nullable DialogCloseCallBack pCallBack )
410 466 {
411 467 pWhatCode = UtilsCommon.assertNotNullNotEmpty( "What Code", pWhatCode );
412 468 alert( pWhatCode, resolveDialogBody( pWhatCode ), pCallBack );
413 469 }
414 470
415 - private void alert( String pTitleCode, String pBody, final DialogCloseCallBack pCallBack )
471 + private void alert( @NotNull String pTitleCode, String pBody, @Nullable final DialogCloseCallBack pCallBack )
416 472 {
417 473 AlertDialog zDialog = new AlertDialog( resolveDialogTitle( pTitleCode ), pBody, resolveDialogButton( BUTTON_TEXT_OK ) );
418 474
  @@ -430,13 +486,13 @@
430 486 zDialog.show();
431 487 }
432 488
433 - protected void confirm( String pWhatCode, final ConfirmCallBack pCallBack )
489 + protected void confirm( @NotNull String pWhatCode, @Nullable final ConfirmCallBack pCallBack )
434 490 {
435 491 pWhatCode = UtilsCommon.assertNotNullNotEmpty( "What Code", pWhatCode );
436 492 confirm( pWhatCode, resolveDialogBody( pWhatCode ), pCallBack );
437 493 }
438 494
439 - private void confirm( String pTitleCode, String pBody, final ConfirmCallBack pCallBack )
495 + private void confirm( @NotNull String pTitleCode, String pBody, @Nullable final ConfirmCallBack pCallBack )
440 496 {
441 497 ConfirmDialog.ConfirmCallback zCallBack = null;
442 498 if ( pCallBack != null )
  @@ -463,12 +519,12 @@
463 519 zDialog.show();
464 520 }
465 521
466 - protected <T extends Runnable> void popUp( T... pOptions )
522 + protected <T extends Runnable> void popUp( @NotNull T... pOptions )
467 523 {
468 524 popUp( Arrays.asList( pOptions ), null );
469 525 }
470 526
471 - protected <T> void popUp( List<T> pOptions, SelectedListener<T> pSelectedListener )
527 + protected <T> void popUp( @NotNull List<T> pOptions, @Nullable SelectedListener<T> pSelectedListener )
472 528 {
473 529 OptionsDialog zDialog = new OptionsDialog();
474 530