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