|
@@ -1,21 +1,20 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.client.widgets.datatables; |
3 |
3 |
|
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
|
6 |
|
- |
import java.util.*; |
7 |
|
- |
|
8 |
4 |
|
import org.litesoft.GWT.client.*; |
9 |
5 |
|
import org.litesoft.GWT.client.widgets.Button; |
10 |
6 |
|
import org.litesoft.GWT.client.widgets.*; |
11 |
7 |
|
import org.litesoft.bo.*; |
12 |
8 |
|
import org.litesoft.bo.views.*; |
|
9 |
+ |
import org.litesoft.commonfoundation.typeutils.*; |
13 |
10 |
|
import org.litesoft.core.util.*; |
14 |
11 |
|
|
15 |
12 |
|
import com.google.gwt.event.dom.client.*; |
16 |
13 |
|
import com.google.gwt.gen2.table.client.TableModelHelper.*; |
17 |
14 |
|
import com.google.gwt.user.client.ui.*; |
18 |
15 |
|
|
|
16 |
+ |
import java.util.*; |
|
17 |
+ |
|
19 |
18 |
|
/** |
20 |
19 |
|
* List mutations are not supported. |
21 |
20 |
|
*/ |
|
@@ -42,45 +41,37 @@ |
42 |
41 |
|
|
43 |
42 |
|
public FilteringTableModel( VoDataProvider<RowType> pDataProvider, boolean pUnique, // |
44 |
43 |
|
TableClickCommand<RowType> pDefaultSingleRowTableClickCommand, // |
45 |
|
- |
TableClickCommand<RowType> pDefaultNoRowTableClickCommand, boolean pNewAllowed ) |
46 |
|
- |
{ |
|
44 |
+ |
TableClickCommand<RowType> pDefaultNoRowTableClickCommand, boolean pNewAllowed ) { |
47 |
45 |
|
mFilterManager = new DataProviderFilterManager<RowType>( pDataProvider, this ); |
48 |
46 |
|
mDefaultSingleRowTableClickCommand = pDefaultSingleRowTableClickCommand; |
49 |
47 |
|
mDefaultNoRowTableClickCommand = pDefaultNoRowTableClickCommand; |
50 |
48 |
|
mUnique = pUnique; |
51 |
49 |
|
|
52 |
|
- |
mNewButtonHelper = new ButtonHelper( pNewAllowed, mNewButton = NewButton.factory().enabledToolTip( "Create New Record" ).add( new ClickHandler() |
53 |
|
- |
{ |
|
50 |
+ |
mNewButtonHelper = new ButtonHelper( pNewAllowed, mNewButton = NewButton.factory().enabledToolTip( "Create New Record" ).add( new ClickHandler() { |
54 |
51 |
|
@Override |
55 |
|
- |
public void onClick( ClickEvent event ) |
56 |
|
- |
{ |
|
52 |
+ |
public void onClick( ClickEvent event ) { |
57 |
53 |
|
requestNew(); |
58 |
54 |
|
} |
59 |
55 |
|
} ).create() ); |
60 |
56 |
|
updateNewButton(); |
61 |
|
- |
mSelectButtonHelper = new ButtonHelper( true, mSelectButton = SelectButton.factory().enabledToolTip( "Single Row Select" ).add( new ClickHandler() |
62 |
|
- |
{ |
|
57 |
+ |
mSelectButtonHelper = new ButtonHelper( true, mSelectButton = SelectButton.factory().enabledToolTip( "Single Row Select" ).add( new ClickHandler() { |
63 |
58 |
|
@Override |
64 |
|
- |
public void onClick( ClickEvent event ) |
65 |
|
- |
{ |
|
59 |
+ |
public void onClick( ClickEvent event ) { |
66 |
60 |
|
requestSingle(); |
67 |
61 |
|
} |
68 |
62 |
|
} ).create() ); |
69 |
63 |
|
updateSelectButton(); |
70 |
64 |
|
} |
71 |
65 |
|
|
72 |
|
- |
private void updateNewButton() |
73 |
|
- |
{ |
|
66 |
+ |
private void updateNewButton() { |
74 |
67 |
|
mNewButtonHelper.update( !mUnique || mList.isEmpty() ); |
75 |
68 |
|
} |
76 |
69 |
|
|
77 |
|
- |
private void updateSelectButton() |
78 |
|
- |
{ |
|
70 |
+ |
private void updateSelectButton() { |
79 |
71 |
|
mSelectButtonHelper.update( mList.size() == 1 ); |
80 |
72 |
|
} |
81 |
73 |
|
|
82 |
|
- |
public Widget addReloadable( TableDataReloadable pReloadable ) |
83 |
|
- |
{ |
|
74 |
+ |
public Widget addReloadable( TableDataReloadable pReloadable ) { |
84 |
75 |
|
SizeableHorizontalPanel zStatusBar = new SizeableHorizontalPanel().style( STYLE_STATUS ).stretchableHorizontally(); |
85 |
76 |
|
zStatusBar.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE ); |
86 |
77 |
|
zStatusBar.add( mNewButton ); |
|
@@ -97,10 +88,8 @@ |
97 |
88 |
|
} |
98 |
89 |
|
|
99 |
90 |
|
@Override |
100 |
|
- |
public void setSearching( boolean pSearching ) |
101 |
|
- |
{ |
102 |
|
- |
if ( mSearching != pSearching ) |
103 |
|
- |
{ |
|
91 |
+ |
public void setSearching( boolean pSearching ) { |
|
92 |
+ |
if ( mSearching != pSearching ) { |
104 |
93 |
|
mSearching = pSearching; |
105 |
94 |
|
updateNewButton(); |
106 |
95 |
|
updateSelectButton(); |
|
@@ -108,12 +97,9 @@ |
108 |
97 |
|
} |
109 |
98 |
|
|
110 |
99 |
|
@Override |
111 |
|
- |
public boolean defaultRequested() |
112 |
|
- |
{ |
113 |
|
- |
if ( mSearching ) |
114 |
|
- |
{ |
115 |
|
- |
switch ( mList.size() ) |
116 |
|
- |
{ |
|
100 |
+ |
public boolean defaultRequested() { |
|
101 |
+ |
if ( mSearching ) { |
|
102 |
+ |
switch ( mList.size() ) { |
117 |
103 |
|
case 0: |
118 |
104 |
|
return requestNew(); |
119 |
105 |
|
case 1: |
|
@@ -125,20 +111,16 @@ |
125 |
111 |
|
return false; |
126 |
112 |
|
} |
127 |
113 |
|
|
128 |
|
- |
private boolean requestSingle() |
129 |
|
- |
{ |
130 |
|
- |
if ( (mDefaultSingleRowTableClickCommand != null) && (mList.size() == 1) ) |
131 |
|
- |
{ |
|
114 |
+ |
private boolean requestSingle() { |
|
115 |
+ |
if ( (mDefaultSingleRowTableClickCommand != null) && (mList.size() == 1) ) { |
132 |
116 |
|
mDefaultSingleRowTableClickCommand.execute( mList.get( 0 ) ); |
133 |
117 |
|
return true; |
134 |
118 |
|
} |
135 |
119 |
|
return false; |
136 |
120 |
|
} |
137 |
121 |
|
|
138 |
|
- |
private boolean requestNew() |
139 |
|
- |
{ |
140 |
|
- |
if ( mDefaultNoRowTableClickCommand != null ) |
141 |
|
- |
{ |
|
122 |
+ |
private boolean requestNew() { |
|
123 |
+ |
if ( mDefaultNoRowTableClickCommand != null ) { |
142 |
124 |
|
mDefaultNoRowTableClickCommand.execute( null ); |
143 |
125 |
|
return true; |
144 |
126 |
|
} |
|
@@ -146,98 +128,78 @@ |
146 |
128 |
|
} |
147 |
129 |
|
|
148 |
130 |
|
@Override |
149 |
|
- |
public boolean isRealtimeUpdatingSuppressed() |
150 |
|
- |
{ |
|
131 |
+ |
public boolean isRealtimeUpdatingSuppressed() { |
151 |
132 |
|
return mRealtimeUpdatingSuppressed != 0; |
152 |
133 |
|
} |
153 |
134 |
|
|
154 |
135 |
|
@Override |
155 |
|
- |
public void suppressRealtimeUpdating() |
156 |
|
- |
{ |
|
136 |
+ |
public void suppressRealtimeUpdating() { |
157 |
137 |
|
mRealtimeUpdatingSuppressed++; |
158 |
138 |
|
} |
159 |
139 |
|
|
160 |
140 |
|
@Override |
161 |
|
- |
public void releaseRealtimeUpdating() |
162 |
|
- |
{ |
163 |
|
- |
if ( 0 > --mRealtimeUpdatingSuppressed ) |
164 |
|
- |
{ |
|
141 |
+ |
public void releaseRealtimeUpdating() { |
|
142 |
+ |
if ( 0 > --mRealtimeUpdatingSuppressed ) { |
165 |
143 |
|
mRealtimeUpdatingSuppressed = 0; |
166 |
144 |
|
} |
167 |
145 |
|
chkList(); |
168 |
146 |
|
} |
169 |
147 |
|
|
170 |
148 |
|
@Override |
171 |
|
- |
public void showResults( boolean pShow ) |
172 |
|
- |
{ |
|
149 |
+ |
public void showResults( boolean pShow ) { |
173 |
150 |
|
mShowing = pShow; |
174 |
151 |
|
chkList(); |
175 |
152 |
|
} |
176 |
153 |
|
|
177 |
154 |
|
@Override |
178 |
|
- |
public void clearCache() |
179 |
|
- |
{ |
|
155 |
+ |
public void clearCache() { |
180 |
156 |
|
mFilterManager.clearCache(); |
181 |
157 |
|
} |
182 |
158 |
|
|
183 |
159 |
|
@Override |
184 |
|
- |
public void clearAllFilterValues() |
185 |
|
- |
{ |
186 |
|
- |
if ( mFilterManager.clear() ) |
187 |
|
- |
{ |
|
160 |
+ |
public void clearAllFilterValues() { |
|
161 |
+ |
if ( mFilterManager.clear() ) { |
188 |
162 |
|
chkList(); |
189 |
163 |
|
} |
190 |
164 |
|
} |
191 |
165 |
|
|
192 |
166 |
|
@Override |
193 |
|
- |
public void filterValueChanged( BoAccessorFilterType pFilterType, String pAttributeName, String pValue ) |
194 |
|
- |
{ |
195 |
|
- |
if ( mFilterManager.setFilter( pFilterType, pAttributeName, pValue ) ) |
196 |
|
- |
{ |
|
167 |
+ |
public void filterValueChanged( BoAccessorFilterType pFilterType, String pAttributeName, String pValue ) { |
|
168 |
+ |
if ( mFilterManager.setFilter( pFilterType, pAttributeName, pValue ) ) { |
197 |
169 |
|
chkList(); |
198 |
170 |
|
} |
199 |
171 |
|
} |
200 |
172 |
|
|
201 |
173 |
|
@Override |
202 |
|
- |
public int activeFilters() |
203 |
|
- |
{ |
|
174 |
+ |
public int activeFilters() { |
204 |
175 |
|
return mFilterManager.activeFilters(); |
205 |
176 |
|
} |
206 |
177 |
|
|
207 |
|
- |
private void chkList() |
208 |
|
- |
{ |
209 |
|
- |
if ( mShowing && !isRealtimeUpdatingSuppressed() && (mReloadable != null) ) |
210 |
|
- |
{ |
|
178 |
+ |
private void chkList() { |
|
179 |
+ |
if ( mShowing && !isRealtimeUpdatingSuppressed() && (mReloadable != null) ) { |
211 |
180 |
|
boolean zPrevState = mUpdateRequested; |
212 |
181 |
|
mUpdateRequested = true; |
213 |
|
- |
if ( !mFilterManager.updateList() ) |
214 |
|
- |
{ |
|
182 |
+ |
if ( !mFilterManager.updateList() ) { |
215 |
183 |
|
mUpdateRequested = zPrevState; |
216 |
184 |
|
} |
217 |
185 |
|
} |
218 |
186 |
|
} |
219 |
187 |
|
|
220 |
188 |
|
@Override |
221 |
|
- |
public ImmutableArrayList<RowType> filterRows( ImmutableArrayList<RowType> pRows ) |
222 |
|
- |
{ |
|
189 |
+ |
public ImmutableArrayList<RowType> filterRows( ImmutableArrayList<RowType> pRows ) { |
223 |
190 |
|
return pRows; |
224 |
191 |
|
} |
225 |
192 |
|
|
226 |
193 |
|
@Override |
227 |
|
- |
public void setNewList( List<RowType> pList, String pMsgText ) |
228 |
|
- |
{ |
|
194 |
+ |
public void setNewList( List<RowType> pList, String pMsgText ) { |
229 |
195 |
|
mUpdateRequested = false; |
230 |
196 |
|
mMessage.setText( pMsgText ); |
231 |
|
- |
if ( mAsyncPending == null ) |
232 |
|
- |
{ |
|
197 |
+ |
if ( mAsyncPending == null ) { |
233 |
198 |
|
mNewList = pList; |
234 |
|
- |
if ( mReloadable != null ) |
235 |
|
- |
{ |
|
199 |
+ |
if ( mReloadable != null ) { |
236 |
200 |
|
mReloadable.loadData(); |
237 |
201 |
|
} |
238 |
|
- |
} |
239 |
|
- |
else |
240 |
|
- |
{ |
|
202 |
+ |
} else { |
241 |
203 |
|
mNewList = null; // just in case |
242 |
204 |
|
AsyncPending<RowType> zPending = mAsyncPending; |
243 |
205 |
|
mAsyncPending = null; |
|
@@ -245,8 +207,7 @@ |
245 |
207 |
|
} |
246 |
208 |
|
} |
247 |
209 |
|
|
248 |
|
- |
private void updateUnderlyingList( List<RowType> pList, Request pRequest, Callback<RowType> pCallback ) |
249 |
|
- |
{ |
|
210 |
+ |
private void updateUnderlyingList( List<RowType> pList, Request pRequest, Callback<RowType> pCallback ) { |
250 |
211 |
|
mList = pList; |
251 |
212 |
|
updateRowCount(); |
252 |
213 |
|
updateNewButton(); |
|
@@ -254,24 +215,20 @@ |
254 |
215 |
|
super.requestRows( pRequest, pCallback ); |
255 |
216 |
|
} |
256 |
217 |
|
|
257 |
|
- |
private static class AsyncPending<RowType> |
258 |
|
- |
{ |
|
218 |
+ |
private static class AsyncPending<RowType> { |
259 |
219 |
|
private Request mRequest; |
260 |
220 |
|
private Callback<RowType> mCallback; |
261 |
221 |
|
|
262 |
|
- |
private AsyncPending( Request pRequest, Callback<RowType> pCallback ) |
263 |
|
- |
{ |
|
222 |
+ |
private AsyncPending( Request pRequest, Callback<RowType> pCallback ) { |
264 |
223 |
|
mRequest = pRequest; |
265 |
224 |
|
mCallback = pCallback; |
266 |
225 |
|
} |
267 |
226 |
|
|
268 |
|
- |
public Request getRequest() |
269 |
|
- |
{ |
|
227 |
+ |
public Request getRequest() { |
270 |
228 |
|
return mRequest; |
271 |
229 |
|
} |
272 |
230 |
|
|
273 |
|
- |
public Callback<RowType> getCallback() |
274 |
|
- |
{ |
|
231 |
+ |
public Callback<RowType> getCallback() { |
275 |
232 |
|
return mCallback; |
276 |
233 |
|
} |
277 |
234 |
|
} |
|
@@ -280,111 +237,99 @@ |
280 |
237 |
|
private List<RowType> mNewList = null; |
281 |
238 |
|
|
282 |
239 |
|
@Override |
283 |
|
- |
public void requestRows( Request pRequest, Callback<RowType> pCallback ) |
284 |
|
- |
{ |
285 |
|
- |
if ( mNewList != null ) |
286 |
|
- |
{ |
|
240 |
+ |
public void requestRows( Request pRequest, Callback<RowType> pCallback ) { |
|
241 |
+ |
if ( mNewList != null ) { |
287 |
242 |
|
List<RowType> zNewList = mNewList; |
288 |
243 |
|
mNewList = null; |
289 |
244 |
|
updateUnderlyingList( zNewList, pRequest, pCallback ); |
290 |
|
- |
} |
291 |
|
- |
else if ( mUpdateRequested ) |
292 |
|
- |
{ |
|
245 |
+ |
} else if ( mUpdateRequested ) { |
293 |
246 |
|
mAsyncPending = new AsyncPending<RowType>( pRequest, pCallback ); |
294 |
|
- |
} |
295 |
|
- |
else |
296 |
|
- |
{ |
|
247 |
+ |
} else { |
297 |
248 |
|
super.requestRows( pRequest, pCallback ); |
298 |
249 |
|
} |
299 |
250 |
|
} |
300 |
251 |
|
|
301 |
|
- |
private ImmutableArrayList<RowType> getImmutableArrayList() |
302 |
|
- |
{ |
|
252 |
+ |
private ImmutableArrayList<RowType> getImmutableArrayList() { |
303 |
253 |
|
return new ImmutableArrayList<RowType>( mList ); |
304 |
254 |
|
} |
305 |
255 |
|
|
306 |
256 |
|
@Override |
307 |
|
- |
public Iterator<RowType> iterator() |
308 |
|
- |
{ |
|
257 |
+ |
public Iterator<RowType> iterator() { |
309 |
258 |
|
return getImmutableArrayList().iterator(); |
310 |
259 |
|
} |
311 |
260 |
|
|
312 |
261 |
|
@Override |
313 |
|
- |
public ListIterator<RowType> listIterator() |
314 |
|
- |
{ |
|
262 |
+ |
public ListIterator<RowType> listIterator() { |
315 |
263 |
|
return getImmutableArrayList().listIterator(); |
316 |
264 |
|
} |
317 |
265 |
|
|
318 |
266 |
|
@Override |
319 |
|
- |
public ListIterator<RowType> listIterator( int pIndex ) |
320 |
|
- |
{ |
|
267 |
+ |
public ListIterator<RowType> listIterator( int pIndex ) { |
321 |
268 |
|
return getImmutableArrayList().listIterator( pIndex ); |
322 |
269 |
|
} |
323 |
270 |
|
|
324 |
|
- |
@Override @Deprecated |
325 |
|
- |
public void add( int pIndex, RowType pElement ) |
326 |
|
- |
{ |
|
271 |
+ |
@Override |
|
272 |
+ |
@Deprecated |
|
273 |
+ |
public void add( int pIndex, RowType pElement ) { |
327 |
274 |
|
throw new UnsupportedOperationException(); |
328 |
275 |
|
} |
329 |
276 |
|
|
330 |
|
- |
@Override @Deprecated |
331 |
|
- |
public boolean add( RowType pO ) |
332 |
|
- |
{ |
|
277 |
+ |
@Override |
|
278 |
+ |
@Deprecated |
|
279 |
+ |
public boolean add( RowType pO ) { |
333 |
280 |
|
throw new UnsupportedOperationException(); |
334 |
281 |
|
} |
335 |
282 |
|
|
336 |
|
- |
@Override @Deprecated |
337 |
|
- |
public boolean addAll( Collection<? extends RowType> pC ) |
338 |
|
- |
{ |
|
283 |
+ |
@Override |
|
284 |
+ |
@Deprecated |
|
285 |
+ |
public boolean addAll( Collection<? extends RowType> pC ) { |
339 |
286 |
|
throw new UnsupportedOperationException(); |
340 |
287 |
|
} |
341 |
288 |
|
|
342 |
|
- |
@Override @Deprecated |
343 |
|
- |
public boolean addAll( int pIndex, Collection<? extends RowType> pC ) |
344 |
|
- |
{ |
|
289 |
+ |
@Override |
|
290 |
+ |
@Deprecated |
|
291 |
+ |
public boolean addAll( int pIndex, Collection<? extends RowType> pC ) { |
345 |
292 |
|
throw new UnsupportedOperationException(); |
346 |
293 |
|
} |
347 |
294 |
|
|
348 |
|
- |
@Override @Deprecated |
349 |
|
- |
public void clear() |
350 |
|
- |
{ |
|
295 |
+ |
@Override |
|
296 |
+ |
@Deprecated |
|
297 |
+ |
public void clear() { |
351 |
298 |
|
throw new UnsupportedOperationException(); |
352 |
299 |
|
} |
353 |
300 |
|
|
354 |
|
- |
@Override @Deprecated |
355 |
|
- |
public RowType remove( int pIndex ) |
356 |
|
- |
{ |
|
301 |
+ |
@Override |
|
302 |
+ |
@Deprecated |
|
303 |
+ |
public RowType remove( int pIndex ) { |
357 |
304 |
|
throw new UnsupportedOperationException(); |
358 |
305 |
|
} |
359 |
306 |
|
|
360 |
|
- |
@Override @Deprecated |
361 |
|
- |
public boolean remove( Object pO ) |
362 |
|
- |
{ |
|
307 |
+ |
@Override |
|
308 |
+ |
@Deprecated |
|
309 |
+ |
public boolean remove( Object pO ) { |
363 |
310 |
|
throw new UnsupportedOperationException(); |
364 |
311 |
|
} |
365 |
312 |
|
|
366 |
|
- |
@Override @Deprecated |
367 |
|
- |
public boolean removeAll( Collection<?> pC ) |
368 |
|
- |
{ |
|
313 |
+ |
@Override |
|
314 |
+ |
@Deprecated |
|
315 |
+ |
public boolean removeAll( Collection<?> pC ) { |
369 |
316 |
|
throw new UnsupportedOperationException(); |
370 |
317 |
|
} |
371 |
318 |
|
|
372 |
|
- |
@Override @Deprecated |
373 |
|
- |
public boolean retainAll( Collection<?> pC ) |
374 |
|
- |
{ |
|
319 |
+ |
@Override |
|
320 |
+ |
@Deprecated |
|
321 |
+ |
public boolean retainAll( Collection<?> pC ) { |
375 |
322 |
|
throw new UnsupportedOperationException(); |
376 |
323 |
|
} |
377 |
324 |
|
|
378 |
|
- |
@Override @Deprecated |
379 |
|
- |
public RowType set( int pIndex, RowType pElement ) |
380 |
|
- |
{ |
|
325 |
+ |
@Override |
|
326 |
+ |
@Deprecated |
|
327 |
+ |
public RowType set( int pIndex, RowType pElement ) { |
381 |
328 |
|
throw new UnsupportedOperationException(); |
382 |
329 |
|
} |
383 |
330 |
|
|
384 |
|
- |
private static class MessageLabel extends SizeableLabel |
385 |
|
- |
{ |
386 |
|
- |
private MessageLabel() |
387 |
|
- |
{ |
|
331 |
+ |
private static class MessageLabel extends SizeableLabel { |
|
332 |
+ |
private MessageLabel() { |
388 |
333 |
|
super( FilterManager.NOTHING_ENTERED, false ); |
389 |
334 |
|
addStyleName( STYLE_HAS_MSG ); |
390 |
335 |
|
addStyleName( QBE_MSG ); |
|
@@ -392,17 +337,13 @@ |
392 |
337 |
|
} |
393 |
338 |
|
|
394 |
339 |
|
@Override |
395 |
|
- |
public void setText( String pLabelText ) |
396 |
|
- |
{ |
|
340 |
+ |
public void setText( String pLabelText ) { |
397 |
341 |
|
pLabelText = Strings.noEmpty( pLabelText ); |
398 |
|
- |
if ( pLabelText == null ) |
399 |
|
- |
{ |
|
342 |
+ |
if ( pLabelText == null ) { |
400 |
343 |
|
removeStyleName( STYLE_HAS_MSG ); |
401 |
344 |
|
addStyleName( STYLE_NO_MSG ); |
402 |
345 |
|
super.setText( " " ); |
403 |
|
- |
} |
404 |
|
- |
else |
405 |
|
- |
{ |
|
346 |
+ |
} else { |
406 |
347 |
|
removeStyleName( STYLE_NO_MSG ); |
407 |
348 |
|
addStyleName( STYLE_HAS_MSG ); |
408 |
349 |
|
super.setText( pLabelText ); |
|
@@ -410,40 +351,32 @@ |
410 |
351 |
|
} |
411 |
352 |
|
} |
412 |
353 |
|
|
413 |
|
- |
private class ButtonHelper |
414 |
|
- |
{ |
|
354 |
+ |
private class ButtonHelper { |
415 |
355 |
|
private boolean mVisible = true; |
416 |
356 |
|
private boolean mEnabled = true; |
417 |
357 |
|
private boolean mAllowed; |
418 |
358 |
|
private Button mButton; |
419 |
359 |
|
|
420 |
|
- |
public ButtonHelper( boolean pAllowed, Button pButton ) |
421 |
|
- |
{ |
|
360 |
+ |
public ButtonHelper( boolean pAllowed, Button pButton ) { |
422 |
361 |
|
mAllowed = pAllowed; |
423 |
362 |
|
mButton = pButton; |
424 |
363 |
|
} |
425 |
364 |
|
|
426 |
|
- |
public void update( boolean pPossiblyEnable ) |
427 |
|
- |
{ |
428 |
|
- |
if ( !mAllowed ) |
429 |
|
- |
{ |
430 |
|
- |
if ( mVisible ) |
431 |
|
- |
{ |
|
365 |
+ |
public void update( boolean pPossiblyEnable ) { |
|
366 |
+ |
if ( !mAllowed ) { |
|
367 |
+ |
if ( mVisible ) { |
432 |
368 |
|
UtilsGwt.setHidden( mButton, !(mVisible = false) ); |
433 |
369 |
|
} |
434 |
370 |
|
return; |
435 |
371 |
|
} |
436 |
|
- |
if ( mSearching != mVisible ) |
437 |
|
- |
{ |
|
372 |
+ |
if ( mSearching != mVisible ) { |
438 |
373 |
|
UtilsGwt.setHidden( mButton, !(mVisible = mSearching) ); |
439 |
|
- |
if ( !mVisible ) |
440 |
|
- |
{ |
|
374 |
+ |
if ( !mVisible ) { |
441 |
375 |
|
return; |
442 |
376 |
|
} |
443 |
377 |
|
} |
444 |
378 |
|
boolean zEnabled = pPossiblyEnable && !mFilterManager.isEmpty(); |
445 |
|
- |
if ( mEnabled != zEnabled ) |
446 |
|
- |
{ |
|
379 |
+ |
if ( mEnabled != zEnabled ) { |
447 |
380 |
|
mButton.setEnabled( mEnabled = zEnabled ); |
448 |
381 |
|
} |
449 |
382 |
|
} |