|
@@ -18,8 +18,7 @@ |
18 |
18 |
|
public class MergeStoriesStepTwo extends ScreenView implements StoryFindable, |
19 |
19 |
|
StoryViewNames, |
20 |
20 |
|
TableClickCommand<StoryView>, |
21 |
|
- |
ViewUpdatable<StoryView> |
22 |
|
- |
{ |
|
21 |
+ |
ViewUpdatable<StoryView> { |
23 |
22 |
|
private QBE_FormEngine mFE; |
24 |
23 |
|
|
25 |
24 |
|
private StoryViewDataProvider mDataProvider = StoryViewDataProvider.getInstance(); |
|
@@ -29,28 +28,23 @@ |
29 |
28 |
|
private ObjectURL mStory1 = null; |
30 |
29 |
|
|
31 |
30 |
|
@Override |
32 |
|
- |
protected UriFragmentIdParams createRefreshParams() |
33 |
|
- |
{ |
|
31 |
+ |
protected UriFragmentIdParams createRefreshParams() { |
34 |
32 |
|
return MergeStoriesStepTwoFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
35 |
33 |
|
} |
36 |
34 |
|
|
37 |
|
- |
public MergeStoriesStepTwo( String pSection, ViewDef pViewDef, TwoStoryURLs pTwoStoryURLs ) |
38 |
|
- |
{ |
|
35 |
+ |
public MergeStoriesStepTwo( String pSection, ViewDef pViewDef, TwoStoryURLs pTwoStoryURLs ) { |
39 |
36 |
|
super( title( pSection, pViewDef ) ); |
40 |
37 |
|
|
41 |
|
- |
if ( pTwoStoryURLs != null ) |
42 |
|
- |
{ |
|
38 |
+ |
if ( pTwoStoryURLs != null ) { |
43 |
39 |
|
mStory0 = pTwoStoryURLs.getStory0(); |
44 |
40 |
|
mStory1 = pTwoStoryURLs.getStory1(); |
45 |
41 |
|
} |
46 |
42 |
|
//todo: if no mStory0 show error and go back to MergeStory (lookup) |
47 |
43 |
|
addStandardTitleBar(); |
48 |
44 |
|
|
49 |
|
- |
addLeft( BackButton.factory( "Change From" ).add( ViewDefs.STORY_MERGE_STORIES, new UriFragmentIdParams.ScreenParamsFactory() |
50 |
|
- |
{ |
|
45 |
+ |
addLeft( BackButton.factory( "Change From" ).add( ViewDefs.STORY_MERGE_STORIES, new UriFragmentIdParams.ScreenParamsFactory() { |
51 |
46 |
|
@Override |
52 |
|
- |
public UriFragmentIdParams create( ViewDef pTarget ) |
53 |
|
- |
{ |
|
47 |
+ |
public UriFragmentIdParams create( ViewDef pTarget ) { |
54 |
48 |
|
return MergeStoriesFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
55 |
49 |
|
} |
56 |
50 |
|
} ).create() ); |
|
@@ -84,17 +78,14 @@ |
84 |
78 |
|
} |
85 |
79 |
|
|
86 |
80 |
|
@Override |
87 |
|
- |
public void aboutToShow() |
88 |
|
- |
{ |
|
81 |
+ |
public void aboutToShow() { |
89 |
82 |
|
super.aboutToShow(); |
90 |
83 |
|
StoryScreenViewHelper.requestRequiredStory( this, mStory0, 0 ); |
91 |
84 |
|
} |
92 |
85 |
|
|
93 |
86 |
|
@Override |
94 |
|
- |
public void foundStory( StoryView pStoryView, Integer pRequestID ) |
95 |
|
- |
{ |
96 |
|
- |
if ( pRequestID == 1 ) |
97 |
|
- |
{ |
|
87 |
+ |
public void foundStory( StoryView pStoryView, Integer pRequestID ) { |
|
88 |
+ |
if ( pRequestID == 1 ) { |
98 |
89 |
|
modeEdit( pStoryView ); |
99 |
90 |
|
return; |
100 |
91 |
|
} |
|
@@ -105,45 +96,37 @@ |
105 |
96 |
|
} |
106 |
97 |
|
|
107 |
98 |
|
@Override |
108 |
|
- |
protected void justLoaded() |
109 |
|
- |
{ |
|
99 |
+ |
protected void justLoaded() { |
110 |
100 |
|
super.justLoaded(); |
111 |
101 |
|
mFE.setFocus(); |
112 |
102 |
|
} |
113 |
103 |
|
|
114 |
104 |
|
@Override |
115 |
|
- |
public void execute( StoryView pRowValue ) |
116 |
|
- |
{ |
117 |
|
- |
if ( pRowValue != null ) |
118 |
|
- |
{ |
|
105 |
+ |
public void execute( StoryView pRowValue ) { |
|
106 |
+ |
if ( pRowValue != null ) { |
119 |
107 |
|
modeEdit( pRowValue ); |
120 |
108 |
|
} |
121 |
109 |
|
} |
122 |
110 |
|
|
123 |
|
- |
private void modeSearch() |
124 |
|
- |
{ |
|
111 |
+ |
private void modeSearch() { |
125 |
112 |
|
mStory1 = null; |
126 |
113 |
|
mFE.setMode( FormEngine.Mode.Search ); |
127 |
114 |
|
} |
128 |
115 |
|
|
129 |
|
- |
private void modeEdit( StoryView pStoryView ) |
130 |
|
- |
{ |
|
116 |
+ |
private void modeEdit( StoryView pStoryView ) { |
131 |
117 |
|
mStory1 = pStoryView.getObjectURL(); |
132 |
118 |
|
mFormBinder1.setExistingObject( mDataProvider.copyIntoNewTS( pStoryView ), FormEngine.Mode.EditFromSearch ); |
133 |
119 |
|
} |
134 |
120 |
|
|
135 |
121 |
|
@Override |
136 |
|
- |
public Widget getBottomBar() |
137 |
|
- |
{ |
|
122 |
+ |
public Widget getBottomBar() { |
138 |
123 |
|
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
139 |
124 |
|
|
140 |
125 |
|
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
141 |
126 |
|
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder1, this ) ) ); |
142 |
|
- |
zActionPanel.addRight( mFE.addExistingUnchangedNextButton( true, ViewDefs.STORY_MERGE_STORIES_STEP_THREE, new UriFragmentIdParams.ScreenParamsFactory() |
143 |
|
- |
{ |
|
127 |
+ |
zActionPanel.addRight( mFE.addExistingUnchangedNextButton( true, ViewDefs.STORY_MERGE_STORIES_STEP_THREE, new UriFragmentIdParams.ScreenParamsFactory() { |
144 |
128 |
|
@Override |
145 |
|
- |
public UriFragmentIdParams create( ViewDef pTarget ) |
146 |
|
- |
{ |
|
129 |
+ |
public UriFragmentIdParams create( ViewDef pTarget ) { |
147 |
130 |
|
return MergeStoriesStepThreeFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
148 |
131 |
|
} |
149 |
132 |
|
} ) ); |
|
@@ -151,8 +134,7 @@ |
151 |
134 |
|
} |
152 |
135 |
|
|
153 |
136 |
|
@Override |
154 |
|
- |
public void viewUpdated( StoryView pStoryView ) |
155 |
|
- |
{ |
|
137 |
+ |
public void viewUpdated( StoryView pStoryView ) { |
156 |
138 |
|
modeEdit( pStoryView ); |
157 |
139 |
|
} |
158 |
140 |
|
} |