|
@@ -1,9 +1,5 @@ |
1 |
1 |
|
package org.litesoft.datt.client.ui.views.stories; |
2 |
2 |
|
|
3 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
4 |
|
- |
|
5 |
|
- |
import java.util.*; |
6 |
|
- |
|
7 |
3 |
|
import org.litesoft.GWT.client.*; |
8 |
4 |
|
import org.litesoft.GWT.client.view.*; |
9 |
5 |
|
import org.litesoft.GWT.client.widgets.Button; |
|
@@ -11,6 +7,7 @@ |
11 |
7 |
|
import org.litesoft.GWT.client.widgets.datatables.*; |
12 |
8 |
|
import org.litesoft.GWT.forms.client.*; |
13 |
9 |
|
import org.litesoft.bo.views.*; |
|
10 |
+ |
import org.litesoft.commonfoundation.typeutils.*; |
14 |
11 |
|
import org.litesoft.core.util.*; |
15 |
12 |
|
import org.litesoft.datt.client.boviews.*; |
16 |
13 |
|
import org.litesoft.datt.client.support.*; |
|
@@ -22,10 +19,11 @@ |
22 |
19 |
|
import com.google.gwt.user.client.*; |
23 |
20 |
|
import com.google.gwt.user.client.ui.*; |
24 |
21 |
|
|
|
22 |
+ |
import java.util.*; |
|
23 |
+ |
|
25 |
24 |
|
public abstract class AbstractPrioritizeScreenView extends ScreenView implements StoryViewNames, |
26 |
25 |
|
SimpleDataProviderCallBack, |
27 |
|
- |
DataAvailableCallBack<StoryView> |
28 |
|
- |
{ |
|
26 |
+ |
DataAvailableCallBack<StoryView> { |
29 |
27 |
|
protected final String mWhat; |
30 |
28 |
|
protected final StoryViewDataProvider mDP = StoryViewDataProvider.getInstance(); |
31 |
29 |
|
protected final ListTableModel<StoryView> mTableModel = new ListTableModel<StoryView>(); |
|
@@ -36,25 +34,21 @@ |
36 |
34 |
|
private Integer mTopRowOffset = null; |
37 |
35 |
|
|
38 |
36 |
|
@Override |
39 |
|
- |
protected UriFragmentIdParams createRefreshParams() |
40 |
|
- |
{ |
|
37 |
+ |
protected UriFragmentIdParams createRefreshParams() { |
41 |
38 |
|
return ReprioritizeFactory.encodeParams( mTopRowOffset ); |
42 |
39 |
|
} |
43 |
40 |
|
|
44 |
41 |
|
public AbstractPrioritizeScreenView( String pSection, ViewDef pViewDef, String pWhat, boolean pAddUpDown, BoTableDefinition<StoryView> pTableDef, |
45 |
|
- |
Integer pTopRowOffset ) |
46 |
|
- |
{ |
|
42 |
+ |
Integer pTopRowOffset ) { |
47 |
43 |
|
super( title( pSection, pViewDef ) ); |
48 |
44 |
|
|
49 |
45 |
|
mTopRowOffset = pTopRowOffset; |
50 |
46 |
|
|
51 |
47 |
|
mWhat = pWhat; |
52 |
48 |
|
|
53 |
|
- |
addRight( Button.named( "Refresh" ).blue().text().add( new ClickHandler() |
54 |
|
- |
{ |
|
49 |
+ |
addRight( Button.named( "Refresh" ).blue().text().add( new ClickHandler() { |
55 |
50 |
|
@Override |
56 |
|
- |
public void onClick( ClickEvent event ) |
57 |
|
- |
{ |
|
51 |
+ |
public void onClick( ClickEvent event ) { |
58 |
52 |
|
fetchRows(); |
59 |
53 |
|
} |
60 |
54 |
|
} ).create() ); |
|
@@ -72,39 +66,32 @@ |
72 |
66 |
|
} |
73 |
67 |
|
|
74 |
68 |
|
@Override |
75 |
|
- |
protected void justLoaded() |
76 |
|
- |
{ |
|
69 |
+ |
protected void justLoaded() { |
77 |
70 |
|
super.justLoaded(); |
78 |
71 |
|
fetchRows(); |
79 |
72 |
|
} |
80 |
73 |
|
|
81 |
74 |
|
abstract protected void fetchRows(); |
82 |
75 |
|
|
83 |
|
- |
protected FetchRowsDataProviderCallBack<StoryView> createFetchRowsCallBack() |
84 |
|
- |
{ |
85 |
|
- |
return new FetchRowsDataProviderCallBack<StoryView>() |
86 |
|
- |
{ |
|
76 |
+ |
protected FetchRowsDataProviderCallBack<StoryView> createFetchRowsCallBack() { |
|
77 |
+ |
return new FetchRowsDataProviderCallBack<StoryView>() { |
87 |
78 |
|
@Override |
88 |
|
- |
public void tooMany( long pCount ) |
89 |
|
- |
{ |
|
79 |
+ |
public void tooMany( long pCount ) { |
90 |
80 |
|
systemError( "System Error: Should not happen", // |
91 |
81 |
|
"Found " + pCount + " " + mWhat + ".", // |
92 |
82 |
|
"This is more than the application is willing to display." ); |
93 |
83 |
|
} |
94 |
84 |
|
|
95 |
85 |
|
@Override |
96 |
|
- |
public void error( String pError ) |
97 |
|
- |
{ |
|
86 |
+ |
public void error( String pError ) { |
98 |
87 |
|
systemError( "Requesting " + mWhat + " - Errored", // |
99 |
88 |
|
"", // |
100 |
89 |
|
"Error: " + pError ); |
101 |
90 |
|
} |
102 |
91 |
|
|
103 |
92 |
|
@Override |
104 |
|
- |
public void success( ImmutableArrayList<StoryView> pRows ) |
105 |
|
- |
{ |
106 |
|
- |
if ( pRows.isEmpty() ) |
107 |
|
- |
{ |
|
93 |
+ |
public void success( ImmutableArrayList<StoryView> pRows ) { |
|
94 |
+ |
if ( pRows.isEmpty() ) { |
108 |
95 |
|
backToHome( "Nothing to " + mWhat ); |
109 |
96 |
|
return; |
110 |
97 |
|
} |
|
@@ -116,15 +103,11 @@ |
116 |
103 |
|
mMoveControlPanel.handleButtons( reselectAll() ); |
117 |
104 |
|
} |
118 |
105 |
|
|
119 |
|
- |
private Set<StoryView> reselectAll() |
120 |
|
- |
{ |
|
106 |
+ |
private Set<StoryView> reselectAll() { |
121 |
107 |
|
boolean zFound = false; |
122 |
|
- |
if ( mSavedSelectedValues != null ) |
123 |
|
- |
{ |
124 |
|
- |
for ( StoryView zValue : mSavedSelectedValues ) |
125 |
|
- |
{ |
126 |
|
- |
if ( mTable.selectRow( zValue ) ) |
127 |
|
- |
{ |
|
108 |
+ |
if ( mSavedSelectedValues != null ) { |
|
109 |
+ |
for ( StoryView zValue : mSavedSelectedValues ) { |
|
110 |
+ |
if ( mTable.selectRow( zValue ) ) { |
128 |
111 |
|
zFound = true; |
129 |
112 |
|
} |
130 |
113 |
|
} |
|
@@ -136,31 +119,24 @@ |
136 |
119 |
|
} |
137 |
120 |
|
|
138 |
121 |
|
@Override |
139 |
|
- |
public void error( String pError ) |
140 |
|
- |
{ |
141 |
|
- |
if ( Strings.isNotNullOrEmpty( pError ) ) |
142 |
|
- |
{ |
|
122 |
+ |
public void error( String pError ) { |
|
123 |
+ |
if ( Strings.isNotNullOrEmpty( pError ) ) { |
143 |
124 |
|
systemError( "Requested Prioritizing - Errored", // |
144 |
125 |
|
"", // |
145 |
126 |
|
"Error: " + pError ); |
146 |
|
- |
} |
147 |
|
- |
else |
148 |
|
- |
{ |
|
127 |
+ |
} else { |
149 |
128 |
|
fetchRows(); |
150 |
129 |
|
} |
151 |
130 |
|
} |
152 |
131 |
|
|
153 |
132 |
|
@Override |
154 |
|
- |
public Widget getBottomBar() |
155 |
|
- |
{ |
|
133 |
+ |
public Widget getBottomBar() { |
156 |
134 |
|
return null; |
157 |
135 |
|
} |
158 |
136 |
|
|
159 |
137 |
|
protected static class TableDef extends BoTableDefinition<StoryView> implements StoryViewNames, |
160 |
|
- |
DataTableStyle |
161 |
|
- |
{ |
162 |
|
- |
public TableDef() |
163 |
|
- |
{ |
|
138 |
+ |
DataTableStyle { |
|
139 |
+ |
public TableDef() { |
164 |
140 |
|
StoryViewMetaData zMD = StoryViewMetaData.getInstance(); |
165 |
141 |
|
|
166 |
142 |
|
addColumn( zMD.getBoAttribute( aName ) ); // .initialWidth( FontSizer.get( TABLE_TEXT ).EMsPlus( 20, CELL_PADDING ) ); |
|
@@ -169,34 +145,26 @@ |
169 |
145 |
|
} |
170 |
146 |
|
} |
171 |
147 |
|
|
172 |
|
- |
private class MoveControlPanel extends VerticalPanel implements SelectionHandler<StoryView> |
173 |
|
- |
{ |
|
148 |
+ |
private class MoveControlPanel extends VerticalPanel implements SelectionHandler<StoryView> { |
174 |
149 |
|
private final Button mBetweenButton, mUpButton, mDownButton; |
175 |
150 |
|
private final List<GroupMover> mGroupMovers = new ArrayList<GroupMover>(); |
176 |
151 |
|
|
177 |
|
- |
private MoveControlPanel( boolean pAddUpDown ) |
178 |
|
- |
{ |
179 |
|
- |
mBetweenButton = Button.named( "Between" ).blue().text( "To There" ).add( new ClickHandler() |
180 |
|
- |
{ |
|
152 |
+ |
private MoveControlPanel( boolean pAddUpDown ) { |
|
153 |
+ |
mBetweenButton = Button.named( "Between" ).blue().text( "To There" ).add( new ClickHandler() { |
181 |
154 |
|
@Override |
182 |
|
- |
public void onClick( ClickEvent event ) |
183 |
|
- |
{ |
|
155 |
+ |
public void onClick( ClickEvent event ) { |
184 |
156 |
|
reprioritizeBetween(); |
185 |
157 |
|
} |
186 |
158 |
|
} ).create().disable(); |
187 |
|
- |
mUpButton = Button.named( "Up" ).blue().text().add( new ClickHandler() |
188 |
|
- |
{ |
|
159 |
+ |
mUpButton = Button.named( "Up" ).blue().text().add( new ClickHandler() { |
189 |
160 |
|
@Override |
190 |
|
- |
public void onClick( ClickEvent event ) |
191 |
|
- |
{ |
|
161 |
+ |
public void onClick( ClickEvent event ) { |
192 |
162 |
|
reprioritizeUp(); |
193 |
163 |
|
} |
194 |
164 |
|
} ).create().disable(); |
195 |
|
- |
mDownButton = Button.named( "Down" ).blue().text().add( new ClickHandler() |
196 |
|
- |
{ |
|
165 |
+ |
mDownButton = Button.named( "Down" ).blue().text().add( new ClickHandler() { |
197 |
166 |
|
@Override |
198 |
|
- |
public void onClick( ClickEvent event ) |
199 |
|
- |
{ |
|
167 |
+ |
public void onClick( ClickEvent event ) { |
200 |
168 |
|
reprioritizeDown(); |
201 |
169 |
|
} |
202 |
170 |
|
} ).create().disable(); |
|
@@ -207,129 +175,103 @@ |
207 |
175 |
|
add( mBetweenButton ); |
208 |
176 |
|
add( new Spacer( 20 ) ); |
209 |
177 |
|
PriorityGroup[] zGroups = PriorityGroup.values(); |
210 |
|
- |
for ( int i = zGroups.length; --i >= 0; ) |
211 |
|
- |
{ |
|
178 |
+ |
for ( int i = zGroups.length; --i >= 0; ) { |
212 |
179 |
|
PriorityGroup zGroup = zGroups[i]; |
213 |
|
- |
if ( PriorityGroup.Initial != zGroup ) |
214 |
|
- |
{ |
|
180 |
+ |
if ( PriorityGroup.Initial != zGroup ) { |
215 |
181 |
|
GroupMover zMover = new GroupMover( zGroup ); |
216 |
182 |
|
mGroupMovers.add( zMover ); |
217 |
183 |
|
add( zMover.getButton() ); |
218 |
184 |
|
} |
219 |
185 |
|
} |
220 |
186 |
|
add( new Spacer( 20 ) ); |
221 |
|
- |
if ( pAddUpDown ) |
222 |
|
- |
{ |
|
187 |
+ |
if ( pAddUpDown ) { |
223 |
188 |
|
add( mUpButton ); |
224 |
189 |
|
add( mDownButton ); |
225 |
190 |
|
} |
226 |
191 |
|
} |
227 |
192 |
|
|
228 |
193 |
|
@Override |
229 |
|
- |
protected void onAttach() |
230 |
|
- |
{ |
|
194 |
+ |
protected void onAttach() { |
231 |
195 |
|
super.onAttach(); |
232 |
196 |
|
sameSizeButtons(); |
233 |
197 |
|
} |
234 |
198 |
|
|
235 |
|
- |
private void sameSizeButtons() |
236 |
|
- |
{ |
237 |
|
- |
if ( isAttached() ) |
238 |
|
- |
{ |
|
199 |
+ |
private void sameSizeButtons() { |
|
200 |
+ |
if ( isAttached() ) { |
239 |
201 |
|
Integer zMaxWidth = getMaxControlButtonWidth(); |
240 |
|
- |
if ( zMaxWidth != null ) |
241 |
|
- |
{ |
|
202 |
+ |
if ( zMaxWidth != null ) { |
242 |
203 |
|
setControlButtonSameWidth( zMaxWidth ); |
243 |
204 |
|
return; |
244 |
205 |
|
} |
245 |
206 |
|
} |
246 |
|
- |
Scheduler.get().scheduleDeferred( new Command() |
247 |
|
- |
{ |
|
207 |
+ |
Scheduler.get().scheduleDeferred( new Command() { |
248 |
208 |
|
@Override |
249 |
|
- |
public void execute() |
250 |
|
- |
{ |
|
209 |
+ |
public void execute() { |
251 |
210 |
|
sameSizeButtons(); |
252 |
211 |
|
} |
253 |
212 |
|
} ); |
254 |
213 |
|
} |
255 |
214 |
|
|
256 |
|
- |
private Integer getMaxControlButtonWidth() |
257 |
|
- |
{ |
|
215 |
+ |
private Integer getMaxControlButtonWidth() { |
258 |
216 |
|
int zMaxWidth = mBetweenButton.getOffsetWidth(); |
259 |
|
- |
for ( Widget zWidget : getChildren() ) |
260 |
|
- |
{ |
261 |
|
- |
if ( zWidget instanceof Button ) |
262 |
|
- |
{ |
|
217 |
+ |
for ( Widget zWidget : getChildren() ) { |
|
218 |
+ |
if ( zWidget instanceof Button ) { |
263 |
219 |
|
zMaxWidth = Math.max( zMaxWidth, zWidget.getOffsetWidth() ); |
264 |
220 |
|
} |
265 |
221 |
|
} |
266 |
222 |
|
return (zMaxWidth > 30) ? zMaxWidth : null; |
267 |
223 |
|
} |
268 |
224 |
|
|
269 |
|
- |
private void setControlButtonSameWidth( int pWidth ) |
270 |
|
- |
{ |
|
225 |
+ |
private void setControlButtonSameWidth( int pWidth ) { |
271 |
226 |
|
String zWidth = "" + pWidth; |
272 |
|
- |
for ( Widget zWidget : getChildren() ) |
273 |
|
- |
{ |
274 |
|
- |
if ( zWidget instanceof Button ) |
275 |
|
- |
{ |
|
227 |
+ |
for ( Widget zWidget : getChildren() ) { |
|
228 |
+ |
if ( zWidget instanceof Button ) { |
276 |
229 |
|
zWidget.setWidth( zWidth ); |
277 |
230 |
|
} |
278 |
231 |
|
} |
279 |
232 |
|
} |
280 |
233 |
|
|
281 |
234 |
|
@Override |
282 |
|
- |
public void onSelection( SelectionEvent<StoryView> event ) |
283 |
|
- |
{ |
|
235 |
+ |
public void onSelection( SelectionEvent<StoryView> event ) { |
284 |
236 |
|
handleButtons( mTable.getSelectedValues() ); |
285 |
237 |
|
} |
286 |
238 |
|
|
287 |
|
- |
private void handleButtons( Set<StoryView> pSelectedValues ) |
288 |
|
- |
{ |
|
239 |
+ |
private void handleButtons( Set<StoryView> pSelectedValues ) { |
289 |
240 |
|
boolean zAnySelected = (pSelectedValues != null) && !pSelectedValues.isEmpty(); |
290 |
241 |
|
mBetweenButton.setEnabled( zAnySelected && betweenable( pSelectedValues ) ); |
291 |
242 |
|
mUpButton.setEnabled( zAnySelected && upable( pSelectedValues ) ); |
292 |
243 |
|
mDownButton.setEnabled( zAnySelected && downable( pSelectedValues ) ); |
293 |
|
- |
for ( GroupMover zMover : mGroupMovers ) |
294 |
|
- |
{ |
|
244 |
+ |
for ( GroupMover zMover : mGroupMovers ) { |
295 |
245 |
|
zMover.setEnable( zAnySelected, pSelectedValues ); |
296 |
246 |
|
} |
297 |
247 |
|
} |
298 |
248 |
|
} |
299 |
249 |
|
|
300 |
|
- |
private class GroupMover implements ClickHandler |
301 |
|
- |
{ |
|
250 |
+ |
private class GroupMover implements ClickHandler { |
302 |
251 |
|
private PriorityGroup mGroup; |
303 |
252 |
|
private Button mButton; |
304 |
253 |
|
|
305 |
|
- |
private GroupMover( PriorityGroup pGroup ) |
306 |
|
- |
{ |
|
254 |
+ |
private GroupMover( PriorityGroup pGroup ) { |
307 |
255 |
|
mGroup = pGroup; |
308 |
256 |
|
mButton = Button.named( mGroup.name() ).blue().text().add( this ).create().disable(); |
309 |
257 |
|
} |
310 |
258 |
|
|
311 |
|
- |
public Button getButton() |
312 |
|
- |
{ |
|
259 |
+ |
public Button getButton() { |
313 |
260 |
|
return mButton; |
314 |
261 |
|
} |
315 |
262 |
|
|
316 |
263 |
|
@Override |
317 |
|
- |
public void onClick( ClickEvent event ) |
318 |
|
- |
{ |
|
264 |
+ |
public void onClick( ClickEvent event ) { |
319 |
265 |
|
reprioritizeToGroup( mGroup ); |
320 |
266 |
|
} |
321 |
267 |
|
|
322 |
|
- |
public void setEnable( boolean pAnySelected, Set<StoryView> pSelectedValues ) |
323 |
|
- |
{ |
|
268 |
+ |
public void setEnable( boolean pAnySelected, Set<StoryView> pSelectedValues ) { |
324 |
269 |
|
mButton.setEnabled( pAnySelected && applicable( pSelectedValues ) ); |
325 |
270 |
|
} |
326 |
271 |
|
|
327 |
|
- |
private boolean applicable( Set<StoryView> pSelectedValues ) |
328 |
|
- |
{ |
329 |
|
- |
for ( StoryView zStoryView : pSelectedValues ) |
330 |
|
- |
{ |
331 |
|
- |
if ( mGroup != PriorityGroup.from( zStoryView.getPriority() ) ) |
332 |
|
- |
{ |
|
272 |
+ |
private boolean applicable( Set<StoryView> pSelectedValues ) { |
|
273 |
+ |
for ( StoryView zStoryView : pSelectedValues ) { |
|
274 |
+ |
if ( mGroup != PriorityGroup.from( zStoryView.getPriority() ) ) { |
333 |
275 |
|
return true; |
334 |
276 |
|
} |
335 |
277 |
|
} |
|
@@ -339,108 +281,87 @@ |
339 |
281 |
|
|
340 |
282 |
|
abstract protected boolean betweenable( Set<StoryView> pSelectedValues ); |
341 |
283 |
|
|
342 |
|
- |
protected boolean upable( Set<StoryView> pSelectedValues ) |
343 |
|
- |
{ |
|
284 |
+ |
protected boolean upable( Set<StoryView> pSelectedValues ) { |
344 |
285 |
|
return !isAtEdge( pSelectedValues, 0 ); |
345 |
286 |
|
} |
346 |
287 |
|
|
347 |
|
- |
protected boolean downable( Set<StoryView> pSelectedValues ) |
348 |
|
- |
{ |
|
288 |
+ |
protected boolean downable( Set<StoryView> pSelectedValues ) { |
349 |
289 |
|
return !isAtEdge( pSelectedValues, mTableModel.size() - 1 ); |
350 |
290 |
|
} |
351 |
291 |
|
|
352 |
|
- |
protected boolean isAtEdge( Set<StoryView> pSelectedValues, int pEdge ) |
353 |
|
- |
{ |
354 |
|
- |
for ( StoryView zStoryView : pSelectedValues ) |
355 |
|
- |
{ |
356 |
|
- |
if ( mTableModel.indexOf( zStoryView ) == pEdge ) |
357 |
|
- |
{ |
|
292 |
+ |
protected boolean isAtEdge( Set<StoryView> pSelectedValues, int pEdge ) { |
|
293 |
+ |
for ( StoryView zStoryView : pSelectedValues ) { |
|
294 |
+ |
if ( mTableModel.indexOf( zStoryView ) == pEdge ) { |
358 |
295 |
|
return true; |
359 |
296 |
|
} |
360 |
297 |
|
} |
361 |
298 |
|
return false; |
362 |
299 |
|
} |
363 |
300 |
|
|
364 |
|
- |
private void reprioritizeUp() |
365 |
|
- |
{ |
|
301 |
+ |
private void reprioritizeUp() { |
366 |
302 |
|
int zMin = mTableModel.size(); |
367 |
|
- |
for ( StoryView zStoryView : mTable.getSelectedValues() ) |
368 |
|
- |
{ |
|
303 |
+ |
for ( StoryView zStoryView : mTable.getSelectedValues() ) { |
369 |
304 |
|
zMin = Math.min( zMin, mTableModel.indexOf( zStoryView ) ); |
370 |
305 |
|
} |
371 |
|
- |
if ( zMin != mTableModel.size() ) |
372 |
|
- |
{ |
|
306 |
+ |
if ( zMin != mTableModel.size() ) { |
373 |
307 |
|
reprioritizeBetween( mSavedSelectedValues = mTable.getSelectedValues(), getStoryView( zMin - 1 ), getStoryView( zMin - 2 ) ); |
374 |
308 |
|
} |
375 |
309 |
|
} |
376 |
310 |
|
|
377 |
|
- |
private void reprioritizeDown() |
378 |
|
- |
{ |
|
311 |
+ |
private void reprioritizeDown() { |
379 |
312 |
|
int zMax = -1; |
380 |
|
- |
for ( StoryView zStoryView : mTable.getSelectedValues() ) |
381 |
|
- |
{ |
|
313 |
+ |
for ( StoryView zStoryView : mTable.getSelectedValues() ) { |
382 |
314 |
|
zMax = Math.max( zMax, mTableModel.indexOf( zStoryView ) ); |
383 |
315 |
|
} |
384 |
|
- |
if ( zMax != -1 ) |
385 |
|
- |
{ |
|
316 |
+ |
if ( zMax != -1 ) { |
386 |
317 |
|
reprioritizeBetween( mSavedSelectedValues = mTable.getSelectedValues(), getStoryView( zMax + 2 ), getStoryView( zMax + 1 ) ); |
387 |
318 |
|
} |
388 |
319 |
|
} |
389 |
320 |
|
|
390 |
|
- |
private void reprioritizeBetween( StoryView pLowerBound, StoryView pUpperBound ) |
391 |
|
- |
{ |
|
321 |
+ |
private void reprioritizeBetween( StoryView pLowerBound, StoryView pUpperBound ) { |
392 |
322 |
|
reprioritizeBetween( mTable.getSelectedValues(), pLowerBound, pUpperBound ); |
393 |
323 |
|
} |
394 |
324 |
|
|
395 |
|
- |
private void reprioritizeBetween( Set<StoryView> pSelectedValues, StoryView pLowerBound, StoryView pUpperBound ) |
396 |
|
- |
{ |
|
325 |
+ |
private void reprioritizeBetween( Set<StoryView> pSelectedValues, StoryView pLowerBound, StoryView pUpperBound ) { |
397 |
326 |
|
mDP.reprioritizeBetween( pLowerBound, pUpperBound, pSelectedValues, this ); |
398 |
327 |
|
} |
399 |
328 |
|
|
400 |
|
- |
private void reprioritizeToGroup( PriorityGroup pGroup ) |
401 |
|
- |
{ |
|
329 |
+ |
private void reprioritizeToGroup( PriorityGroup pGroup ) { |
402 |
330 |
|
mDP.reprioritizeToGroup( pGroup, mTable.getSelectedValues(), this ); |
403 |
331 |
|
} |
404 |
332 |
|
|
405 |
|
- |
private StoryView getStoryView( int pIndex ) |
406 |
|
- |
{ |
|
333 |
+ |
private StoryView getStoryView( int pIndex ) { |
407 |
334 |
|
return ((0 <= pIndex) && (pIndex < mTableModel.size())) ? mTableModel.get( pIndex ) : null; |
408 |
335 |
|
} |
409 |
336 |
|
|
410 |
337 |
|
abstract protected void fetchTargetBetweenRows( final DataAvailableCallBack<StoryView> pCallBack ); |
411 |
338 |
|
|
412 |
|
- |
private void reprioritizeBetween() |
413 |
|
- |
{ |
|
339 |
+ |
private void reprioritizeBetween() { |
414 |
340 |
|
fetchTargetBetweenRows( this ); |
415 |
341 |
|
} |
416 |
342 |
|
|
417 |
343 |
|
@Override |
418 |
344 |
|
public void dataAvailable( List<StoryView> pData ) // called when we can proceed with the InjectionPointSelector |
419 |
345 |
|
{ |
420 |
|
- |
if ( pData.isEmpty() ) |
421 |
|
- |
{ |
|
346 |
+ |
if ( pData.isEmpty() ) { |
422 |
347 |
|
error( "There are Nothing but " + PriorityGroup.Initial + " priority Stories" ); |
423 |
348 |
|
return; |
424 |
349 |
|
} |
425 |
350 |
|
Set<StoryView> zSelectedRows = mTable.getSelectedValues(); |
426 |
351 |
|
List<StoryView> zNonSelectedRows = new ArrayList<StoryView>( pData.size() ); |
427 |
|
- |
for ( StoryView zStoryView : pData ) |
428 |
|
- |
{ |
429 |
|
- |
if ( !zSelectedRows.contains( zStoryView ) ) |
430 |
|
- |
{ |
|
352 |
+ |
for ( StoryView zStoryView : pData ) { |
|
353 |
+ |
if ( !zSelectedRows.contains( zStoryView ) ) { |
431 |
354 |
|
zNonSelectedRows.add( zStoryView ); |
432 |
355 |
|
} |
433 |
356 |
|
} |
434 |
|
- |
if ( zNonSelectedRows.isEmpty() ) |
435 |
|
- |
{ |
|
357 |
+ |
if ( zNonSelectedRows.isEmpty() ) { |
436 |
358 |
|
error( "At least one Story must not be selected" ); |
437 |
359 |
|
return; |
438 |
360 |
|
} |
439 |
361 |
|
new InjectionPointSelectionDialog<StoryView>( "Select 'There' to Move Selected Rows", 4, zNonSelectedRows, |
440 |
|
- |
new InjectionPointSelector.Callback<StoryView>() |
441 |
|
- |
{ |
442 |
|
- |
@Override public void injectBetween( StoryView pLowerBound, StoryView pUpperBound ) |
443 |
|
- |
{ |
|
362 |
+ |
new InjectionPointSelector.Callback<StoryView>() { |
|
363 |
+ |
@Override |
|
364 |
+ |
public void injectBetween( StoryView pLowerBound, StoryView pUpperBound ) { |
444 |
365 |
|
reprioritizeBetween( pLowerBound, pUpperBound ); |
445 |
366 |
|
} |
446 |
367 |
|
} ).show(); |