|
@@ -1,45 +1,41 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.client.view; |
3 |
3 |
|
|
4 |
|
- |
import com.google.gwt.event.dom.client.*; |
5 |
|
- |
import com.google.gwt.user.client.*; |
6 |
|
- |
import com.google.gwt.user.client.ui.*; |
7 |
4 |
|
import org.litesoft.GWT.client.*; |
8 |
5 |
|
import org.litesoft.GWT.client.command.*; |
9 |
6 |
|
import org.litesoft.GWT.client.context.*; |
10 |
7 |
|
import org.litesoft.GWT.client.dev.*; |
11 |
8 |
|
import org.litesoft.GWT.client.widgets.*; |
|
9 |
+ |
import org.litesoft.commonfoundation.typeutils.Objects; |
12 |
10 |
|
import org.litesoft.commonfoundation.typeutils.*; |
13 |
11 |
|
import org.litesoft.core.*; |
14 |
12 |
|
import org.litesoft.uispecification.*; |
15 |
13 |
|
|
16 |
|
- |
import org.litesoft.commonfoundation.typeutils.Objects; |
|
14 |
+ |
import com.google.gwt.event.dom.client.*; |
|
15 |
+ |
import com.google.gwt.user.client.*; |
|
16 |
+ |
import com.google.gwt.user.client.ui.*; |
|
17 |
+ |
|
17 |
18 |
|
import java.util.*; |
18 |
19 |
|
|
19 |
20 |
|
public abstract class ScreenView extends UiView implements PageRefreshable, |
20 |
|
- |
SuspendLogoutCallBacks |
21 |
|
- |
{ |
22 |
|
- |
public interface TitleCustomizer |
23 |
|
- |
{ |
|
21 |
+ |
SuspendLogoutCallBacks { |
|
22 |
+ |
public interface TitleCustomizer { |
24 |
23 |
|
void addTitleCustomizations( ScreenView pView ); |
25 |
24 |
|
} |
26 |
25 |
|
|
27 |
26 |
|
private static TitleCustomizer sTitleCustomizer; |
28 |
27 |
|
|
29 |
|
- |
public static void setTitleCustomizer( TitleCustomizer pTitleCustomizer ) |
30 |
|
- |
{ |
|
28 |
+ |
public static void setTitleCustomizer( TitleCustomizer pTitleCustomizer ) { |
31 |
29 |
|
sTitleCustomizer = pTitleCustomizer; |
32 |
30 |
|
} |
33 |
31 |
|
|
34 |
32 |
|
private static boolean sOpenApp = false; // True would mean NO User Login / Management |
35 |
33 |
|
|
36 |
|
- |
public static boolean isOpenApp() |
37 |
|
- |
{ |
|
34 |
+ |
public static boolean isOpenApp() { |
38 |
35 |
|
return sOpenApp; |
39 |
36 |
|
} |
40 |
37 |
|
|
41 |
|
- |
public static void setOpenApp( boolean pOpenApp ) |
42 |
|
- |
{ |
|
38 |
+ |
public static void setOpenApp( boolean pOpenApp ) { |
43 |
39 |
|
sOpenApp = pOpenApp; |
44 |
40 |
|
} |
45 |
41 |
|
|
|
@@ -47,274 +43,214 @@ |
47 |
43 |
|
|
48 |
44 |
|
private SimpleLabel mTitleLabel = null; |
49 |
45 |
|
|
50 |
|
- |
protected ScreenView( CO pCO ) |
51 |
|
- |
{ |
|
46 |
+ |
protected ScreenView( CO pCO ) { |
52 |
47 |
|
super( pCO ); |
53 |
48 |
|
mTopBar.addRight( new Spacer( 5 ).style( "CACHE_BUG" ) ); |
54 |
49 |
|
|
55 |
|
- |
if ( hasViewTitle() ) |
56 |
|
- |
{ |
|
50 |
+ |
if ( hasViewTitle() ) { |
57 |
51 |
|
updateTitle(); |
58 |
52 |
|
} |
59 |
53 |
|
|
60 |
54 |
|
PageRefreshableProxy zRefreshableProxy = ClientContext.get().checkGet( PageRefreshableProxy.class ); |
61 |
|
- |
if ( zRefreshableProxy != null ) |
62 |
|
- |
{ |
|
55 |
+ |
if ( zRefreshableProxy != null ) { |
63 |
56 |
|
zRefreshableProxy.setProxyTo( this ); |
64 |
57 |
|
} |
65 |
58 |
|
} |
66 |
59 |
|
|
67 |
60 |
|
@Override |
68 |
|
- |
public Widget getContent() |
69 |
|
- |
{ |
|
61 |
+ |
public Widget getContent() { |
70 |
62 |
|
return mContent; |
71 |
63 |
|
} |
72 |
64 |
|
|
73 |
|
- |
public Widget getTopBar() |
74 |
|
- |
{ |
|
65 |
+ |
public Widget getTopBar() { |
75 |
66 |
|
return mTopBar; |
76 |
67 |
|
} |
77 |
68 |
|
|
78 |
|
- |
protected void add( Widget pWidget ) |
79 |
|
- |
{ |
|
69 |
+ |
protected void add( Widget pWidget ) { |
80 |
70 |
|
mContent.add( pWidget ); |
81 |
71 |
|
} |
82 |
72 |
|
|
83 |
|
- |
protected void addSectionTitle( String pText ) |
84 |
|
- |
{ |
|
73 |
+ |
protected void addSectionTitle( String pText ) { |
85 |
74 |
|
add( createSectionTitle( pText ) ); |
86 |
75 |
|
} |
87 |
76 |
|
|
88 |
|
- |
protected void addSectionTitle( OurLabel pLabel ) |
89 |
|
- |
{ |
|
77 |
+ |
protected void addSectionTitle( OurLabel pLabel ) { |
90 |
78 |
|
add( createSectionTitle( pLabel ) ); |
91 |
79 |
|
} |
92 |
80 |
|
|
93 |
|
- |
protected void setLeftValign( HasVerticalAlignment.VerticalAlignmentConstant pValign ) |
94 |
|
- |
{ |
|
81 |
+ |
protected void setLeftValign( HasVerticalAlignment.VerticalAlignmentConstant pValign ) { |
95 |
82 |
|
mTopBar.setLeftValign( pValign ); |
96 |
83 |
|
} |
97 |
84 |
|
|
98 |
|
- |
protected HorizontalPanel getLeftContainer() |
99 |
|
- |
{ |
|
85 |
+ |
protected HorizontalPanel getLeftContainer() { |
100 |
86 |
|
return mTopBar.getLeftContainer(); |
101 |
87 |
|
} |
102 |
88 |
|
|
103 |
|
- |
protected void addLeft( Widget pWidget ) |
104 |
|
- |
{ |
|
89 |
+ |
protected void addLeft( Widget pWidget ) { |
105 |
90 |
|
mTopBar.addLeft( pWidget ); |
106 |
91 |
|
} |
107 |
92 |
|
|
108 |
|
- |
protected void setCenterValign( HasVerticalAlignment.VerticalAlignmentConstant pValign ) |
109 |
|
- |
{ |
|
93 |
+ |
protected void setCenterValign( HasVerticalAlignment.VerticalAlignmentConstant pValign ) { |
110 |
94 |
|
mTopBar.setCenterValign( pValign ); |
111 |
95 |
|
} |
112 |
96 |
|
|
113 |
|
- |
protected HorizontalPanel getCenterContainer() |
114 |
|
- |
{ |
|
97 |
+ |
protected HorizontalPanel getCenterContainer() { |
115 |
98 |
|
return mTopBar.getCenterContainer(); |
116 |
99 |
|
} |
117 |
100 |
|
|
118 |
|
- |
protected void addCenter( Widget pWidget ) |
119 |
|
- |
{ |
|
101 |
+ |
protected void addCenter( Widget pWidget ) { |
120 |
102 |
|
mTopBar.addCenter( pWidget ); |
121 |
103 |
|
} |
122 |
104 |
|
|
123 |
|
- |
protected void setRightValign( HasVerticalAlignment.VerticalAlignmentConstant pValign ) |
124 |
|
- |
{ |
|
105 |
+ |
protected void setRightValign( HasVerticalAlignment.VerticalAlignmentConstant pValign ) { |
125 |
106 |
|
mTopBar.setRightValign( pValign ); |
126 |
107 |
|
} |
127 |
108 |
|
|
128 |
|
- |
protected HorizontalPanel getRightContainer() |
129 |
|
- |
{ |
|
109 |
+ |
protected HorizontalPanel getRightContainer() { |
130 |
110 |
|
return mTopBar.getRightContainer(); |
131 |
111 |
|
} |
132 |
112 |
|
|
133 |
|
- |
protected void addRight( Widget pWidget ) |
134 |
|
- |
{ |
|
113 |
+ |
protected void addRight( Widget pWidget ) { |
135 |
114 |
|
mTopBar.addRight( pWidget ); |
136 |
115 |
|
} |
137 |
116 |
|
|
138 |
|
- |
protected void addStandardTitleBar() |
139 |
|
- |
{ |
|
117 |
+ |
protected void addStandardTitleBar() { |
140 |
118 |
|
styleTitleBar(); |
141 |
|
- |
if ( !isHomeScreen() ) |
142 |
|
- |
{ |
|
119 |
+ |
if ( !isHomeScreen() ) { |
143 |
120 |
|
addHome(); |
144 |
121 |
|
} |
145 |
|
- |
if ( sTitleCustomizer != null ) |
146 |
|
- |
{ |
|
122 |
+ |
if ( sTitleCustomizer != null ) { |
147 |
123 |
|
sTitleCustomizer.addTitleCustomizations( this ); |
148 |
124 |
|
} |
149 |
125 |
|
addQuickLinkRightButtons(); |
150 |
|
- |
if ( !sOpenApp ) |
151 |
|
- |
{ |
|
126 |
+ |
if ( !sOpenApp ) { |
152 |
127 |
|
addLogout(); |
153 |
128 |
|
} |
154 |
129 |
|
} |
155 |
130 |
|
|
156 |
|
- |
protected void addQuickLinkRightButtons() |
157 |
|
- |
{ |
|
131 |
+ |
protected void addQuickLinkRightButtons() { |
158 |
132 |
|
Widget[] zWidgets = getQuickLinkRightButtons(); |
159 |
|
- |
if ( zWidgets != null ) |
160 |
|
- |
{ |
161 |
|
- |
for ( Widget zWidget : zWidgets ) |
162 |
|
- |
{ |
163 |
|
- |
if ( zWidget != null ) |
164 |
|
- |
{ |
|
133 |
+ |
if ( zWidgets != null ) { |
|
134 |
+ |
for ( Widget zWidget : zWidgets ) { |
|
135 |
+ |
if ( zWidget != null ) { |
165 |
136 |
|
addRight( zWidget ); |
166 |
137 |
|
} |
167 |
138 |
|
} |
168 |
139 |
|
} |
169 |
140 |
|
} |
170 |
141 |
|
|
171 |
|
- |
protected Widget[] getQuickLinkRightButtons() |
172 |
|
- |
{ |
|
142 |
+ |
protected Widget[] getQuickLinkRightButtons() { |
173 |
143 |
|
QuickLinkRightButtonsHandler zHandler = ClientContext.get().checkGet( QuickLinkRightButtonsHandler.class ); |
174 |
144 |
|
return (zHandler != null) ? zHandler.getQuickLinkRightButtons( this ) : null; |
175 |
145 |
|
} |
176 |
146 |
|
|
177 |
|
- |
protected void styleTitleBar() |
178 |
|
- |
{ |
|
147 |
+ |
protected void styleTitleBar() { |
179 |
148 |
|
styleTitleBar( "TitleBar" ); |
180 |
149 |
|
} |
181 |
150 |
|
|
182 |
|
- |
protected void styleTitleBar( String pStyle ) |
183 |
|
- |
{ |
|
151 |
+ |
protected void styleTitleBar( String pStyle ) { |
184 |
152 |
|
mTopBar.addStyleName( pStyle ); |
185 |
153 |
|
} |
186 |
154 |
|
|
187 |
|
- |
protected void addHome() |
188 |
|
- |
{ |
|
155 |
+ |
protected void addHome() { |
189 |
156 |
|
addLeft( HomeButton.factory().add( ViewDef.HOME ).create() ); |
190 |
157 |
|
} |
191 |
158 |
|
|
192 |
|
- |
protected boolean isHomeScreen() |
193 |
|
- |
{ |
|
159 |
+ |
protected boolean isHomeScreen() { |
194 |
160 |
|
return "Home".equals( Objects.justSimpleName( this ) ); |
195 |
161 |
|
} |
196 |
162 |
|
|
197 |
|
- |
protected void addTitle( String pTitle ) |
198 |
|
- |
{ |
|
163 |
+ |
protected void addTitle( String pTitle ) { |
199 |
164 |
|
setViewTitle( pTitle ); |
200 |
165 |
|
updateTitle(); |
201 |
166 |
|
} |
202 |
167 |
|
|
203 |
|
- |
private void updateTitle() |
204 |
|
- |
{ |
205 |
|
- |
if ( mTitleLabel == null ) |
206 |
|
- |
{ |
|
168 |
+ |
private void updateTitle() { |
|
169 |
+ |
if ( mTitleLabel == null ) { |
207 |
170 |
|
addCenter( mTitleLabel = new SimpleLabel( getViewTitle() ).style( "Title" ) ); |
208 |
|
- |
} |
209 |
|
- |
else |
210 |
|
- |
{ |
|
171 |
+ |
} else { |
211 |
172 |
|
mTitleLabel.setText( getViewTitle() ); |
212 |
173 |
|
} |
213 |
174 |
|
} |
214 |
175 |
|
|
215 |
|
- |
protected void addLogout( ClickHandler pClickHandler ) |
216 |
|
- |
{ |
|
176 |
+ |
protected void addLogout( ClickHandler pClickHandler ) { |
217 |
177 |
|
addRight( LogoutBlueIconButton.factory().add( pClickHandler ).create() ); |
218 |
178 |
|
} |
219 |
179 |
|
|
220 |
|
- |
protected void addLogout() |
221 |
|
- |
{ |
222 |
|
- |
addLogout( new ClickHandler() |
223 |
|
- |
{ |
|
180 |
+ |
protected void addLogout() { |
|
181 |
+ |
addLogout( new ClickHandler() { |
224 |
182 |
|
@Override |
225 |
|
- |
public void onClick( ClickEvent event ) |
226 |
|
- |
{ |
|
183 |
+ |
public void onClick( ClickEvent event ) { |
227 |
184 |
|
logoutButtonClicked(); |
228 |
185 |
|
} |
229 |
186 |
|
} ); |
230 |
187 |
|
} |
231 |
188 |
|
|
232 |
|
- |
protected void logoutButtonClicked() |
233 |
|
- |
{ |
234 |
|
- |
if ( UtilsGwt.wasCtrlKeyDownOnCurrentEvent() && Dev.isDevMode() && isHomeScreen() ) |
235 |
|
- |
{ |
|
189 |
+ |
protected void logoutButtonClicked() { |
|
190 |
+ |
if ( UtilsGwt.wasCtrlKeyDownOnCurrentEvent() && Dev.isDevMode() && isHomeScreen() ) { |
236 |
191 |
|
NextDemoUserRequestHandler zHandler = ClientContext.get().get( NextDemoUserRequestHandler.class ); |
237 |
|
- |
if ( zHandler != null ) |
238 |
|
- |
{ |
|
192 |
+ |
if ( zHandler != null ) { |
239 |
193 |
|
zHandler.nextDemoUser(); |
240 |
194 |
|
return; |
241 |
195 |
|
} |
242 |
196 |
|
} |
243 |
|
- |
if ( UtilsGwt.wasAltKeyDownOnCurrentEvent() ) |
244 |
|
- |
{ |
|
197 |
+ |
if ( UtilsGwt.wasAltKeyDownOnCurrentEvent() ) { |
245 |
198 |
|
switchUserRequested(); |
246 |
|
- |
} |
247 |
|
- |
else |
248 |
|
- |
{ |
|
199 |
+ |
} else { |
249 |
200 |
|
logoutRequested(); |
250 |
201 |
|
} |
251 |
202 |
|
} |
252 |
203 |
|
|
253 |
|
- |
protected void switchUserRequested() |
254 |
|
- |
{ |
|
204 |
+ |
protected void switchUserRequested() { |
255 |
205 |
|
new DialogViewDialog( ClientContext.get().get( LoginDialogViewFactory.class ).createDialog( true, createLoginOnSuccessCommand() ) ).show(); |
256 |
206 |
|
} |
257 |
207 |
|
|
258 |
|
- |
protected void logoutRequested() |
259 |
|
- |
{ |
|
208 |
+ |
protected void logoutRequested() { |
260 |
209 |
|
new LogoutSuspendDialog( this, this ).show(); |
261 |
210 |
|
} |
262 |
211 |
|
|
263 |
212 |
|
@Override |
264 |
|
- |
public void logoutConfirmed() |
265 |
|
- |
{ |
|
213 |
+ |
public void logoutConfirmed() { |
266 |
214 |
|
ClientContext.get().get( SecurityUserViewDataProvider.class ).logoutUser(); |
267 |
215 |
|
new ShowScreenCommand( ViewDef.HOME ).execute(); |
268 |
216 |
|
} |
269 |
217 |
|
|
270 |
218 |
|
@Override |
271 |
|
- |
public void suspendRequested() |
272 |
|
- |
{ |
|
219 |
+ |
public void suspendRequested() { |
273 |
220 |
|
new DialogViewDialog( ClientContext.get().get( SuspendDialogViewFactory.class ).createDialog( this ) ).show(); |
274 |
221 |
|
} |
275 |
222 |
|
|
276 |
|
- |
private Command createLoginOnSuccessCommand() |
277 |
|
- |
{ |
278 |
|
- |
return new Command() |
279 |
|
- |
{ |
|
223 |
+ |
private Command createLoginOnSuccessCommand() { |
|
224 |
+ |
return new Command() { |
280 |
225 |
|
@Override |
281 |
|
- |
public void execute() |
282 |
|
- |
{ |
|
226 |
+ |
public void execute() { |
283 |
227 |
|
refreshPage(); |
284 |
228 |
|
} |
285 |
229 |
|
}; |
286 |
230 |
|
} |
287 |
231 |
|
|
288 |
232 |
|
@Override |
289 |
|
- |
public void refreshPage() |
290 |
|
- |
{ |
291 |
|
- |
if ( mViewDef == null ) |
292 |
|
- |
{ |
|
233 |
+ |
public void refreshPage() { |
|
234 |
+ |
if ( mViewDef == null ) { |
293 |
235 |
|
new ShowScreenCommand( ViewDef.HOME ).execute(); |
294 |
|
- |
} |
295 |
|
- |
else |
296 |
|
- |
{ |
|
236 |
+ |
} else { |
297 |
237 |
|
new ShowScreenCommand( mViewDef, createRefreshParams() ).execute(); |
298 |
238 |
|
} |
299 |
239 |
|
} |
300 |
240 |
|
|
301 |
241 |
|
abstract protected UriFragmentIdParams createRefreshParams(); |
302 |
242 |
|
|
303 |
|
- |
protected Widget addVerticallyDistributed( Widget... pWidgets ) |
304 |
|
- |
{ |
|
243 |
+ |
protected Widget addVerticallyDistributed( Widget... pWidgets ) { |
305 |
244 |
|
return addVerticallyDistributed( Arrays.asList( pWidgets ) ); |
306 |
245 |
|
} |
307 |
246 |
|
|
308 |
|
- |
protected Widget addVerticallyDistributed( List<Widget> pWidgets ) |
309 |
|
- |
{ |
|
247 |
+ |
protected Widget addVerticallyDistributed( List<Widget> pWidgets ) { |
310 |
248 |
|
SizeableVerticalPanel zPanel = new SizeableVerticalPanel().stretchable(); |
311 |
249 |
|
zPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE ); |
312 |
250 |
|
zPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); |
313 |
251 |
|
|
314 |
|
- |
for ( Widget zWidget : pWidgets ) |
315 |
|
- |
{ |
316 |
|
- |
if ( zWidget != null ) |
317 |
|
- |
{ |
|
252 |
+ |
for ( Widget zWidget : pWidgets ) { |
|
253 |
+ |
if ( zWidget != null ) { |
318 |
254 |
|
zPanel.add( new SizeableSpacer().stretchable() ); |
319 |
255 |
|
zPanel.add( zWidget ); |
320 |
256 |
|
} |
|
@@ -323,8 +259,7 @@ |
323 |
259 |
|
return zPanel; |
324 |
260 |
|
} |
325 |
261 |
|
|
326 |
|
- |
protected Widget viewStandIn() |
327 |
|
- |
{ |
|
262 |
+ |
protected Widget viewStandIn() { |
328 |
263 |
|
String zTitle = getViewTitle(); |
329 |
264 |
|
zTitle = Strings.replace( zTitle, ": ", "+" ); |
330 |
265 |
|
zTitle = Strings.replace( zTitle, ":", "+" ); |
|
@@ -332,26 +267,21 @@ |
332 |
267 |
|
return new SizeableFrame( "http://www.google.com/search?q=" + zTitle ); |
333 |
268 |
|
} |
334 |
269 |
|
|
335 |
|
- |
protected abstract class BigButtonScreenHelper |
336 |
|
- |
{ |
|
270 |
+ |
protected abstract class BigButtonScreenHelper { |
337 |
271 |
|
protected ViewFactoryAccessor mViewFactoryAccessor = ClientContext.get().get( ViewFactoryAccessor.class ); |
338 |
272 |
|
|
339 |
273 |
|
abstract public Widget build(); |
340 |
274 |
|
|
341 |
|
- |
protected Widget createSection( String pTitle, ViewDef... pDefs ) |
342 |
|
- |
{ |
|
275 |
+ |
protected Widget createSection( String pTitle, ViewDef... pDefs ) { |
343 |
276 |
|
return createSection( pTitle, null, pDefs ); |
344 |
277 |
|
} |
345 |
278 |
|
|
346 |
|
- |
protected Widget createSection( String pTitle, Widget pExtraButton, ViewDef... pDefs ) |
347 |
|
- |
{ |
|
279 |
+ |
protected Widget createSection( String pTitle, Widget pExtraButton, ViewDef... pDefs ) { |
348 |
280 |
|
return createSection( pTitle, createButtons( pExtraButton, pDefs ) ); |
349 |
281 |
|
} |
350 |
282 |
|
|
351 |
|
- |
protected Widget createSection( String pTitle, SizeableHorizontalPanel pButtonPanel ) |
352 |
|
- |
{ |
353 |
|
- |
if ( (pButtonPanel == null) || Strings.isNullOrEmpty( pTitle ) ) |
354 |
|
- |
{ |
|
283 |
+ |
protected Widget createSection( String pTitle, SizeableHorizontalPanel pButtonPanel ) { |
|
284 |
+ |
if ( (pButtonPanel == null) || Strings.isNullOrEmpty( pTitle ) ) { |
355 |
285 |
|
return pButtonPanel; |
356 |
286 |
|
} |
357 |
287 |
|
SizeableVerticalPanel zVpanel = new SizeableVerticalPanel().stretchableHorizontally(); |
|
@@ -360,33 +290,26 @@ |
360 |
290 |
|
return zVpanel; |
361 |
291 |
|
} |
362 |
292 |
|
|
363 |
|
- |
protected SizeableHorizontalPanel createButtons( Widget pExtraButton, ViewDef... pDefs ) |
364 |
|
- |
{ |
|
293 |
+ |
protected SizeableHorizontalPanel createButtons( Widget pExtraButton, ViewDef... pDefs ) { |
365 |
294 |
|
return createButtons( pExtraButton, Arrays.asList( pDefs ) ); |
366 |
295 |
|
} |
367 |
296 |
|
|
368 |
|
- |
protected SizeableHorizontalPanel createButtons( Widget pExtraButton, List<ViewDef> pDefs ) |
369 |
|
- |
{ |
|
297 |
+ |
protected SizeableHorizontalPanel createButtons( Widget pExtraButton, List<ViewDef> pDefs ) { |
370 |
298 |
|
List<Widget> zButtons = new ArrayList<Widget>(); |
371 |
|
- |
for ( ViewDef zDef : pDefs ) |
372 |
|
- |
{ |
|
299 |
+ |
for ( ViewDef zDef : pDefs ) { |
373 |
300 |
|
Widget zButton = createButton( zDef ); |
374 |
|
- |
if ( zButton != null ) |
375 |
|
- |
{ |
|
301 |
+ |
if ( zButton != null ) { |
376 |
302 |
|
zButtons.add( zButton ); |
377 |
303 |
|
} |
378 |
304 |
|
} |
379 |
|
- |
if ( pExtraButton != null ) |
380 |
|
- |
{ |
|
305 |
+ |
if ( pExtraButton != null ) { |
381 |
306 |
|
zButtons.add( pExtraButton ); |
382 |
307 |
|
} |
383 |
308 |
|
return createButtons( zButtons ); |
384 |
309 |
|
} |
385 |
310 |
|
|
386 |
|
- |
protected SizeableHorizontalPanel createButtons( List<Widget> pButtons ) |
387 |
|
- |
{ |
388 |
|
- |
if ( (pButtons == null) || pButtons.isEmpty() ) |
389 |
|
- |
{ |
|
311 |
+ |
protected SizeableHorizontalPanel createButtons( List<Widget> pButtons ) { |
|
312 |
+ |
if ( (pButtons == null) || pButtons.isEmpty() ) { |
390 |
313 |
|
return null; |
391 |
314 |
|
} |
392 |
315 |
|
|
|
@@ -395,27 +318,22 @@ |
395 |
318 |
|
zPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); |
396 |
319 |
|
|
397 |
320 |
|
zPanel.add( new SizeableSpacer().stretchable() ); |
398 |
|
- |
for ( Widget zButton : pButtons ) |
399 |
|
- |
{ |
|
321 |
+ |
for ( Widget zButton : pButtons ) { |
400 |
322 |
|
zPanel.add( zButton ); |
401 |
323 |
|
zPanel.add( new SizeableSpacer().stretchable() ); |
402 |
324 |
|
} |
403 |
325 |
|
return zPanel; |
404 |
326 |
|
} |
405 |
327 |
|
|
406 |
|
- |
protected Widget createButton( ViewDef pViewDef ) |
407 |
|
- |
{ |
|
328 |
+ |
protected Widget createButton( ViewDef pViewDef ) { |
408 |
329 |
|
ViewFactory zFactory = mViewFactoryAccessor.getViewFactory( pViewDef ); |
409 |
|
- |
if ( zFactory instanceof ScreenViewFactory ) |
410 |
|
- |
{ |
|
330 |
+ |
if ( zFactory instanceof ScreenViewFactory ) { |
411 |
331 |
|
return createScreenButton( pViewDef ); |
412 |
332 |
|
} |
413 |
|
- |
if ( zFactory instanceof DialogViewFactory ) |
414 |
|
- |
{ |
|
333 |
+ |
if ( zFactory instanceof DialogViewFactory ) { |
415 |
334 |
|
return ScreenBigButton.factory( pViewDef.getUiString() ).add( new ShowDialogCommand( pViewDef ) ).create(); |
416 |
335 |
|
} |
417 |
|
- |
if ( zFactory == ViewFactory.NO_ACCESS ) |
418 |
|
- |
{ |
|
336 |
+ |
if ( zFactory == ViewFactory.NO_ACCESS ) { |
419 |
337 |
|
return null; |
420 |
338 |
|
} |
421 |
339 |
|
return ScreenBigButton.factory( pViewDef.getUiString() ).disabled().create(); |