|
@@ -6,11 +6,13 @@ |
6 |
6 |
|
import org.litesoft.GWT.client.pavsupport.*; |
7 |
7 |
|
import org.litesoft.core.util.*; |
8 |
8 |
|
import org.litesoft.core.util.externalization.*; |
9 |
|
- |
import org.litesoft.mgwt.client.Button; |
10 |
9 |
|
import org.litesoft.mgwt.client.*; |
|
10 |
+ |
import org.litesoft.mgwt.client.widgets.Button; |
11 |
11 |
|
|
12 |
12 |
|
import com.google.gwt.dom.client.*; |
|
13 |
+ |
import com.google.gwt.event.logical.shared.*; |
13 |
14 |
|
import com.google.gwt.safehtml.shared.*; |
|
15 |
+ |
import com.google.gwt.user.client.*; |
14 |
16 |
|
import com.google.gwt.user.client.ui.*; |
15 |
17 |
|
import com.googlecode.mgwt.dom.client.event.tap.*; |
16 |
18 |
|
import com.googlecode.mgwt.ui.client.*; |
|
@@ -20,7 +22,9 @@ |
20 |
22 |
|
import com.googlecode.mgwt.ui.client.widget.HeaderPanel; |
21 |
23 |
|
import com.googlecode.mgwt.ui.client.widget.LayoutPanel; |
22 |
24 |
|
import com.googlecode.mgwt.ui.client.widget.ScrollPanel; |
|
25 |
+ |
import com.googlecode.mgwt.ui.client.widget.base.ButtonBase; |
23 |
26 |
|
import com.googlecode.mgwt.ui.client.widget.base.*; |
|
27 |
+ |
import com.googlecode.mgwt.ui.client.widget.buttonbar.*; |
24 |
28 |
|
|
25 |
29 |
|
public abstract class AbstractBackableViewImpl<Presenter extends AbstractBackablePresenter> extends AbstractViewImpl<Presenter> implements AbstractBackableView<Presenter> |
26 |
30 |
|
{ |
|
@@ -79,7 +83,7 @@ |
79 |
83 |
|
title.setText( getResolver().resolve( UtilsCommon.noEmpty( pTitleCode, "NoHeaderTitle" ) ) ); |
80 |
84 |
|
} |
81 |
85 |
|
|
82 |
|
- |
protected void setContent( Widget pWidget ) |
|
86 |
+ |
protected <T extends Widget> T setContent( T pWidget ) |
83 |
87 |
|
{ |
84 |
88 |
|
scrollPanel.setWidget( pWidget ); |
85 |
89 |
|
scrollPanel.setScrollingEnabledX( false ); |
|
@@ -88,6 +92,7 @@ |
88 |
92 |
|
scrollPanel.setUsePos( MGWT.getOsDetection().isAndroid() ); |
89 |
93 |
|
|
90 |
94 |
|
ChromeWorkaround.maybeUpdateScroller( scrollPanel ); |
|
95 |
+ |
return pWidget; |
91 |
96 |
|
} |
92 |
97 |
|
|
93 |
98 |
|
// "Forward" Header Buttons |
|
@@ -101,14 +106,9 @@ |
101 |
106 |
|
return zHeaderButton; |
102 |
107 |
|
} |
103 |
108 |
|
|
104 |
|
- |
protected HeaderButton setForwardButton( String pName, TapHandler pHandler ) |
|
109 |
+ |
protected HeaderButton setForwardButton( String pName, Command pOnTapCommand ) |
105 |
110 |
|
{ |
106 |
|
- |
HeaderButton zHeaderButton = setForwardButton( pName ); |
107 |
|
- |
if ( pHandler != null ) |
108 |
|
- |
{ |
109 |
|
- |
zHeaderButton.addTapHandler( pHandler ); |
110 |
|
- |
} |
111 |
|
- |
return zHeaderButton; |
|
111 |
+ |
return add( setForwardButton( pName ), pOnTapCommand ); |
112 |
112 |
|
} |
113 |
113 |
|
|
114 |
114 |
|
// Common Content Types |
|
@@ -117,28 +117,17 @@ |
117 |
117 |
|
{ |
118 |
118 |
|
FlowPanel zPanel = new FlowPanel(); |
119 |
119 |
|
zPanel.getElement().getStyle().setMarginTop( 20, Style.Unit.PX ); |
120 |
|
- |
|
121 |
|
- |
setContent( zPanel ); |
122 |
|
- |
|
123 |
|
- |
return addTo( zPanel, pWidgets ); |
|
120 |
+ |
return setContent( addTo( zPanel, pWidgets ) ); |
124 |
121 |
|
} |
125 |
122 |
|
|
126 |
123 |
|
protected Panel createContentRoundPanel( Widget... pWidgets ) |
127 |
124 |
|
{ |
128 |
|
- |
Panel zPanel = new RoundPanel(); |
129 |
|
- |
|
130 |
|
- |
setContent( zPanel ); |
131 |
|
- |
|
132 |
|
- |
return addTo( zPanel, pWidgets ); |
|
125 |
+ |
return setContent( addTo( new RoundPanel(), pWidgets ) ); |
133 |
126 |
|
} |
134 |
127 |
|
|
135 |
128 |
|
protected <T> OptionList<T> createContentOptionList( final SelectedListener<T> pSelectedListener ) |
136 |
129 |
|
{ |
137 |
|
- |
OptionList<T> zList = new OptionList<T>( getResolver(), pSelectedListener ); |
138 |
|
- |
|
139 |
|
- |
setContent( zList ); |
140 |
|
- |
|
141 |
|
- |
return zList; |
|
130 |
+ |
return setContent( new OptionList<T>( getResolver(), pSelectedListener ) ); |
142 |
131 |
|
} |
143 |
132 |
|
|
144 |
133 |
|
protected <T> OptionList<T> createContentOptionList() |
|
@@ -146,25 +135,155 @@ |
146 |
135 |
|
return createContentOptionList( null ); |
147 |
136 |
|
} |
148 |
137 |
|
|
149 |
|
- |
// Non-Header Buttons |
|
138 |
+ |
// ButtonBar |
150 |
139 |
|
|
151 |
|
- |
protected Button createButton( String pLabelTextCode, TapHandler pTapHandler ) |
|
140 |
+ |
protected ButtonBar addButtonBar( Widget... pWidgets ) |
152 |
141 |
|
{ |
153 |
|
- |
Button zButton = new Button( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) + "Button" ) ); |
154 |
|
- |
if ( pTapHandler != null ) |
155 |
|
- |
{ |
156 |
|
- |
zButton.addTapHandler( pTapHandler ); |
157 |
|
- |
} |
158 |
|
- |
return zButton; |
|
142 |
+ |
ButtonBar zButtonBar = new ButtonBar(); |
|
143 |
+ |
addTo( zButtonBar, pWidgets ); |
|
144 |
+ |
main.add( zButtonBar ); |
|
145 |
+ |
return zButtonBar; |
159 |
146 |
|
} |
160 |
147 |
|
|
161 |
|
- |
protected Button addButton( HasWidgets pContainer, String pLabelTextCode, TapHandler pTapHandler ) |
|
148 |
+ |
protected ButtonBarText createButtonBarText() |
162 |
149 |
|
{ |
163 |
|
- |
Button zButton = createButton( pLabelTextCode, pTapHandler ); |
|
150 |
+ |
return new ButtonBarText( getResolver().resolve( "ButtonBarText" ) ); |
|
151 |
+ |
} |
|
152 |
+ |
|
|
153 |
+ |
protected ButtonBarSpacer createButtonBarSpacer() |
|
154 |
+ |
{ |
|
155 |
+ |
return new ButtonBarSpacer(); |
|
156 |
+ |
} |
|
157 |
+ |
|
|
158 |
+ |
// Non-Header Buttons |
|
159 |
+ |
|
|
160 |
+ |
protected Button addButton( HasWidgets pContainer, String pLabelTextCode, Command pOnTapCommand ) |
|
161 |
+ |
{ |
|
162 |
+ |
Button zButton = createButton( pLabelTextCode, pOnTapCommand ); |
164 |
163 |
|
pContainer.add( zButton ); |
165 |
164 |
|
return zButton; |
166 |
165 |
|
} |
167 |
166 |
|
|
|
167 |
+ |
protected Button createButton( String pLabelTextCode, Command pOnTapCommand ) |
|
168 |
+ |
{ |
|
169 |
+ |
return add( new Button( getResolver().resolve( UtilsCommon.assertNotNullNotEmpty( "Label Text Code", pLabelTextCode ) + "Button" ) ), pOnTapCommand ); |
|
170 |
+ |
} |
|
171 |
+ |
|
|
172 |
+ |
protected TrashButton createButtonTrash( Command pOnTapCommand ) |
|
173 |
+ |
{ |
|
174 |
+ |
return add( new TrashButton(), pOnTapCommand ); |
|
175 |
+ |
} |
|
176 |
+ |
|
|
177 |
+ |
protected CameraButton createButtonCamera( Command pOnTapCommand ) |
|
178 |
+ |
{ |
|
179 |
+ |
return add( new CameraButton(), pOnTapCommand ); |
|
180 |
+ |
} |
|
181 |
+ |
|
|
182 |
+ |
protected ActionButton createButtonAction( Command pOnTapCommand ) |
|
183 |
+ |
{ |
|
184 |
+ |
return add( new ActionButton(), pOnTapCommand ); |
|
185 |
+ |
} |
|
186 |
+ |
|
|
187 |
+ |
protected ArrowDownButton createButtonArrowDown( Command pOnTapCommand ) |
|
188 |
+ |
{ |
|
189 |
+ |
return add( new ArrowDownButton(), pOnTapCommand ); |
|
190 |
+ |
} |
|
191 |
+ |
|
|
192 |
+ |
protected ArrowUpButton createButtonArrowUp( Command pOnTapCommand ) |
|
193 |
+ |
{ |
|
194 |
+ |
return add( new ArrowUpButton(), pOnTapCommand ); |
|
195 |
+ |
} |
|
196 |
+ |
|
|
197 |
+ |
protected ArrowLeftButton createButtonArrowLeft( Command pOnTapCommand ) |
|
198 |
+ |
{ |
|
199 |
+ |
return add( new ArrowLeftButton(), pOnTapCommand ); |
|
200 |
+ |
} |
|
201 |
+ |
|
|
202 |
+ |
protected ArrowRightButton createButtonArrowRight( Command pOnTapCommand ) |
|
203 |
+ |
{ |
|
204 |
+ |
return add( new ArrowRightButton(), pOnTapCommand ); |
|
205 |
+ |
} |
|
206 |
+ |
|
|
207 |
+ |
protected BookmarkButton createButtonBookmark( Command pOnTapCommand ) |
|
208 |
+ |
{ |
|
209 |
+ |
return add( new BookmarkButton(), pOnTapCommand ); |
|
210 |
+ |
} |
|
211 |
+ |
|
|
212 |
+ |
protected ComposeButton createButtonCompose( Command pOnTapCommand ) |
|
213 |
+ |
{ |
|
214 |
+ |
return add( new ComposeButton(), pOnTapCommand ); |
|
215 |
+ |
} |
|
216 |
+ |
|
|
217 |
+ |
protected FastForwardButton createButtonFastForward( Command pOnTapCommand ) |
|
218 |
+ |
{ |
|
219 |
+ |
return add( new FastForwardButton(), pOnTapCommand ); |
|
220 |
+ |
} |
|
221 |
+ |
|
|
222 |
+ |
protected InfoButton createButtonInfo( Command pOnTapCommand ) |
|
223 |
+ |
{ |
|
224 |
+ |
return add( new InfoButton(), pOnTapCommand ); |
|
225 |
+ |
} |
|
226 |
+ |
|
|
227 |
+ |
protected LocateButton createButtonLocate( Command pOnTapCommand ) |
|
228 |
+ |
{ |
|
229 |
+ |
return add( new LocateButton(), pOnTapCommand ); |
|
230 |
+ |
} |
|
231 |
+ |
|
|
232 |
+ |
protected NewIconButton createButtonNewIcon( Command pOnTapCommand ) |
|
233 |
+ |
{ |
|
234 |
+ |
return add( new NewIconButton(), pOnTapCommand ); |
|
235 |
+ |
} |
|
236 |
+ |
|
|
237 |
+ |
protected NextSlideButton createButtonNextSlide( Command pOnTapCommand ) |
|
238 |
+ |
{ |
|
239 |
+ |
return add( new NextSlideButton(), pOnTapCommand ); |
|
240 |
+ |
} |
|
241 |
+ |
|
|
242 |
+ |
protected OrganizeButton createButtonOrganize( Command pOnTapCommand ) |
|
243 |
+ |
{ |
|
244 |
+ |
return add( new OrganizeButton(), pOnTapCommand ); |
|
245 |
+ |
} |
|
246 |
+ |
|
|
247 |
+ |
protected PauseButton createButtonPause( Command pOnTapCommand ) |
|
248 |
+ |
{ |
|
249 |
+ |
return add( new PauseButton(), pOnTapCommand ); |
|
250 |
+ |
} |
|
251 |
+ |
|
|
252 |
+ |
protected PlayButton createButtonPlay( Command pOnTapCommand ) |
|
253 |
+ |
{ |
|
254 |
+ |
return add( new PlayButton(), pOnTapCommand ); |
|
255 |
+ |
} |
|
256 |
+ |
|
|
257 |
+ |
protected PlusButton createButtonPlus( Command pOnTapCommand ) |
|
258 |
+ |
{ |
|
259 |
+ |
return add( new PlusButton(), pOnTapCommand ); |
|
260 |
+ |
} |
|
261 |
+ |
|
|
262 |
+ |
protected PreviousSlideButton createButtonPreviousSlide( Command pOnTapCommand ) |
|
263 |
+ |
{ |
|
264 |
+ |
return add( new PreviousSlideButton(), pOnTapCommand ); |
|
265 |
+ |
} |
|
266 |
+ |
|
|
267 |
+ |
protected ReplyButton createButtonReply( Command pOnTapCommand ) |
|
268 |
+ |
{ |
|
269 |
+ |
return add( new ReplyButton(), pOnTapCommand ); |
|
270 |
+ |
} |
|
271 |
+ |
|
|
272 |
+ |
protected RewindButton createButtonRewind( Command pOnTapCommand ) |
|
273 |
+ |
{ |
|
274 |
+ |
return add( new RewindButton(), pOnTapCommand ); |
|
275 |
+ |
} |
|
276 |
+ |
|
|
277 |
+ |
protected SearchButton createButtonSearch( Command pOnTapCommand ) |
|
278 |
+ |
{ |
|
279 |
+ |
return add( new SearchButton(), pOnTapCommand ); |
|
280 |
+ |
} |
|
281 |
+ |
|
|
282 |
+ |
protected StopButton createButtonStop( Command pOnTapCommand ) |
|
283 |
+ |
{ |
|
284 |
+ |
return add( new StopButton(), pOnTapCommand ); |
|
285 |
+ |
} |
|
286 |
+ |
|
168 |
287 |
|
// FlowPanel Widgets |
169 |
288 |
|
|
170 |
289 |
|
protected Widget createListHeader( String pHeaderTextCode ) |
|
@@ -229,6 +348,16 @@ |
229 |
348 |
|
UtilsCommon.assertNotNull( "InputWidget", pInputWidget ) ); |
230 |
349 |
|
} |
231 |
350 |
|
|
|
351 |
+ |
protected MTextBox createTextBox( ValueChangeHandler<String> pChangeHandler ) |
|
352 |
+ |
{ |
|
353 |
+ |
MTextBox zTextBox = new MTextBox(); |
|
354 |
+ |
if ( pChangeHandler != null ) |
|
355 |
+ |
{ |
|
356 |
+ |
zTextBox.addValueChangeHandler( pChangeHandler ); |
|
357 |
+ |
} |
|
358 |
+ |
return zTextBox; |
|
359 |
+ |
} |
|
360 |
+ |
|
232 |
361 |
|
// Dialogs |
233 |
362 |
|
|
234 |
363 |
|
protected void alert( String pWhatCode, final DialogCloseCallBack pCallBack ) |
|
@@ -366,4 +495,13 @@ |
366 |
495 |
|
{ |
367 |
496 |
|
return getResolver().resolve( pButtonCode + "DialogButton" ); |
368 |
497 |
|
} |
|
498 |
+ |
|
|
499 |
+ |
private <T extends ButtonBase> T add( T pButton, Command pOnTapCommand ) |
|
500 |
+ |
{ |
|
501 |
+ |
if ( pOnTapCommand != null ) |
|
502 |
+ |
{ |
|
503 |
+ |
pButton.addTapHandler( new CommandTapHandler( pOnTapCommand ) ); |
|
504 |
+ |
} |
|
505 |
+ |
return pButton; |
|
506 |
+ |
} |
369 |
507 |
|
} |