|
@@ -1,140 +1,140 @@ |
1 |
|
- |
package org.litesoft.datt.client.ui.views.stories; |
2 |
|
- |
|
3 |
|
- |
import org.litesoft.GWT.client.view.*; |
4 |
|
- |
import org.litesoft.GWT.client.widgets.*; |
5 |
|
- |
import org.litesoft.GWT.client.widgets.datatables.*; |
6 |
|
- |
import org.litesoft.GWT.forms.client.*; |
7 |
|
- |
import org.litesoft.bo.views.*; |
8 |
|
- |
import org.litesoft.datt.client.*; |
9 |
|
- |
import org.litesoft.datt.client.boviews.*; |
10 |
|
- |
import org.litesoft.datt.client.support.*; |
11 |
|
- |
import org.litesoft.datt.client.ui.widgets.*; |
12 |
|
- |
import org.litesoft.uispecification.*; |
13 |
|
- |
|
14 |
|
- |
import com.google.gwt.user.client.ui.*; |
15 |
|
- |
|
16 |
|
- |
import static org.litesoft.uispecification.FormWidgetCtrl.*; |
17 |
|
- |
|
18 |
|
- |
public class MergeStoriesStepTwo extends ScreenView implements StoryFindable, |
19 |
|
- |
StoryViewNames, |
20 |
|
- |
TableClickCommand<StoryView>, |
21 |
|
- |
ViewUpdatable<StoryView> { |
22 |
|
- |
private QBE_FormEngine mFE; |
23 |
|
- |
|
24 |
|
- |
private StoryViewDataProvider mDataProvider = StoryViewDataProvider.getInstance(); |
25 |
|
- |
private FormBinder<StoryView> mFormBinder0, mFormBinder1; |
26 |
|
- |
|
27 |
|
- |
private ObjectURL mStory0 = null; |
28 |
|
- |
private ObjectURL mStory1 = null; |
29 |
|
- |
|
30 |
|
- |
@Override |
31 |
|
- |
protected UriFragmentIdParams createRefreshParams() { |
32 |
|
- |
return MergeStoriesStepTwoFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
public MergeStoriesStepTwo( String pSection, ViewDef pViewDef, TwoStoryURLs pTwoStoryURLs ) { |
36 |
|
- |
super( title( pSection, pViewDef ) ); |
37 |
|
- |
|
38 |
|
- |
if ( pTwoStoryURLs != null ) { |
39 |
|
- |
mStory0 = pTwoStoryURLs.getStory0(); |
40 |
|
- |
mStory1 = pTwoStoryURLs.getStory1(); |
41 |
|
- |
} |
42 |
|
- |
//todo: if no mStory0 show error and go back to MergeStory (lookup) |
43 |
|
- |
addStandardTitleBar(); |
44 |
|
- |
|
45 |
|
- |
addLeft( BackButton.factory( "Change From" ).add( ViewDefs.STORY_MERGE_STORIES, new UriFragmentIdParams.ScreenParamsFactory() { |
46 |
|
- |
@Override |
47 |
|
- |
public UriFragmentIdParams create( ViewDef pTarget ) { |
48 |
|
- |
return MergeStoriesFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
49 |
|
- |
} |
50 |
|
- |
} ).create() ); |
51 |
|
- |
|
52 |
|
- |
SizeableVerticalPanel zUpperPanel = new SizeableVerticalPanel().stretchable(); |
53 |
|
- |
|
54 |
|
- |
zUpperPanel.add( createSectionTitle( "Story to merge From" ) ); |
55 |
|
- |
zUpperPanel.add( new StoryInfoPanel( mFormBinder0 = new FormBinder<StoryView>( new FormEngine( new WidgetCtrlMap( VISIBLE_BUT_DISABLED ), // |
56 |
|
- |
FormEngine.Mode.ViewRegular, null ), // |
57 |
|
- |
StoryViewMetaData.getInstance() ) ) ); |
58 |
|
- |
|
59 |
|
- |
QBEscreenSupport zQBEscreenSupport = new QBEscreenSupport(); |
60 |
|
- |
SizeableVerticalPanel zFormPanel = zQBEscreenSupport.getQBEleft(); |
61 |
|
- |
SizeableQBEboxedPanel zQBEboxedPanel = zQBEscreenSupport.getQBEboxedPanel(); |
62 |
|
- |
|
63 |
|
- |
FilteringTableModel<StoryView> zFilter = |
64 |
|
- |
new FilteringTableModel<StoryView>( mDataProvider, true, this, null, false ); // Second 'this' allows auto "New" |
65 |
|
- |
StoryViewTable zTable = new StoryViewTable( zFilter, this ); |
66 |
|
- |
zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) ); |
67 |
|
- |
|
68 |
|
- |
WidgetCtrlMap zWidgetCtrlMap = StoryFieldsPanel.createWidgetCtrlMap( VISIBLE_AND_ACTIVE_ENABLED ); |
69 |
|
- |
|
70 |
|
- |
mFE = new QBE_FormEngine( zWidgetCtrlMap, null, zQBEboxedPanel, zFilter, zFilter ); |
71 |
|
- |
|
72 |
|
- |
zFormPanel.add( mFE.createSectionTitle( "Story to merge Into" ) ); |
73 |
|
- |
|
74 |
|
- |
zFormPanel.add( new StoryFieldsPanel( mFormBinder1 = new FormBinder<StoryView>( mFE, // |
75 |
|
- |
StoryViewMetaData.getInstance() ), mFE, null ) ); |
76 |
|
- |
|
77 |
|
- |
add( new SizeableVerticalSplitPairPanel().stretchable().add( zUpperPanel, zQBEscreenSupport ) ); |
78 |
|
- |
} |
79 |
|
- |
|
80 |
|
- |
@Override |
81 |
|
- |
public void aboutToShow() { |
82 |
|
- |
super.aboutToShow(); |
83 |
|
- |
StoryScreenViewHelper.requestRequiredStory( this, mStory0, 0 ); |
84 |
|
- |
} |
85 |
|
- |
|
86 |
|
- |
@Override |
87 |
|
- |
public void foundStory( StoryView pStoryView, Integer pRequestID ) { |
88 |
|
- |
if ( pRequestID == 1 ) { |
89 |
|
- |
modeEdit( pStoryView ); |
90 |
|
- |
return; |
91 |
|
- |
} |
92 |
|
- |
mFormBinder0.setExistingObject( pStoryView, FormEngine.Mode.ViewRegular ); |
93 |
|
- |
ObjectURL zStory = mStory1; |
94 |
|
- |
modeSearch(); // clears mStory |
95 |
|
- |
StoryScreenViewHelper.requestOptionalStory( this, zStory, 1 ); |
96 |
|
- |
} |
97 |
|
- |
|
98 |
|
- |
@Override |
99 |
|
- |
protected void justLoaded() { |
100 |
|
- |
super.justLoaded(); |
101 |
|
- |
mFE.setFocus(); |
102 |
|
- |
} |
103 |
|
- |
|
104 |
|
- |
@Override |
105 |
|
- |
public void execute( StoryView pRowValue ) { |
106 |
|
- |
if ( pRowValue != null ) { |
107 |
|
- |
modeEdit( pRowValue ); |
108 |
|
- |
} |
109 |
|
- |
} |
110 |
|
- |
|
111 |
|
- |
private void modeSearch() { |
112 |
|
- |
mStory1 = null; |
113 |
|
- |
mFE.setMode( FormEngine.Mode.Search ); |
114 |
|
- |
} |
115 |
|
- |
|
116 |
|
- |
private void modeEdit( StoryView pStoryView ) { |
117 |
|
- |
mStory1 = pStoryView.getObjectURL(); |
118 |
|
- |
mFormBinder1.setExistingObject( mDataProvider.copyIntoNewTS( pStoryView ), FormEngine.Mode.EditFromSearch ); |
119 |
|
- |
} |
120 |
|
- |
|
121 |
|
- |
@Override |
122 |
|
- |
public Widget getBottomBar() { |
123 |
|
- |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
124 |
|
- |
|
125 |
|
- |
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
126 |
|
- |
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder1, this ) ) ); |
127 |
|
- |
zActionPanel.addRight( mFE.addExistingUnchangedNextButton( true, ViewDefs.STORY_MERGE_STORIES_STEP_THREE, new UriFragmentIdParams.ScreenParamsFactory() { |
128 |
|
- |
@Override |
129 |
|
- |
public UriFragmentIdParams create( ViewDef pTarget ) { |
130 |
|
- |
return MergeStoriesStepThreeFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
131 |
|
- |
} |
132 |
|
- |
} ) ); |
133 |
|
- |
return zActionPanel; |
134 |
|
- |
} |
135 |
|
- |
|
136 |
|
- |
@Override |
137 |
|
- |
public void viewUpdated( StoryView pStoryView ) { |
138 |
|
- |
modeEdit( pStoryView ); |
139 |
|
- |
} |
140 |
|
- |
} |
|
1 |
+ |
package org.litesoft.datt.client.ui.views.stories; |
|
2 |
+ |
|
|
3 |
+ |
import org.litesoft.GWT.client.view.*; |
|
4 |
+ |
import org.litesoft.GWT.client.widgets.*; |
|
5 |
+ |
import org.litesoft.GWT.client.widgets.datatables.*; |
|
6 |
+ |
import org.litesoft.GWT.forms.client.*; |
|
7 |
+ |
import org.litesoft.bo.views.*; |
|
8 |
+ |
import org.litesoft.datt.client.*; |
|
9 |
+ |
import org.litesoft.datt.client.boviews.*; |
|
10 |
+ |
import org.litesoft.datt.client.support.*; |
|
11 |
+ |
import org.litesoft.datt.client.ui.widgets.*; |
|
12 |
+ |
import org.litesoft.uispecification.*; |
|
13 |
+ |
|
|
14 |
+ |
import com.google.gwt.user.client.ui.*; |
|
15 |
+ |
|
|
16 |
+ |
import static org.litesoft.uispecification.FormWidgetCtrl.*; |
|
17 |
+ |
|
|
18 |
+ |
public class MergeStoriesStepTwo extends ScreenView implements StoryFindable, |
|
19 |
+ |
StoryViewNames, |
|
20 |
+ |
TableClickCommand<StoryView>, |
|
21 |
+ |
ViewUpdatable<StoryView> { |
|
22 |
+ |
private QBE_FormEngine mFE; |
|
23 |
+ |
|
|
24 |
+ |
private StoryViewDataProvider mDataProvider = StoryViewDataProvider.getInstance(); |
|
25 |
+ |
private FormBinder<StoryView> mFormBinder0, mFormBinder1; |
|
26 |
+ |
|
|
27 |
+ |
private ObjectURL mStory0 = null; |
|
28 |
+ |
private ObjectURL mStory1 = null; |
|
29 |
+ |
|
|
30 |
+ |
@Override |
|
31 |
+ |
protected UriFragmentIdParams createRefreshParams() { |
|
32 |
+ |
return MergeStoriesStepTwoFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
public MergeStoriesStepTwo( String pSection, ViewDef pViewDef, TwoStoryURLs pTwoStoryURLs ) { |
|
36 |
+ |
super( title( pSection, pViewDef ) ); |
|
37 |
+ |
|
|
38 |
+ |
if ( pTwoStoryURLs != null ) { |
|
39 |
+ |
mStory0 = pTwoStoryURLs.getStory0(); |
|
40 |
+ |
mStory1 = pTwoStoryURLs.getStory1(); |
|
41 |
+ |
} |
|
42 |
+ |
//todo: if no mStory0 show error and go back to MergeStory (lookup) |
|
43 |
+ |
addStandardTitleBar(); |
|
44 |
+ |
|
|
45 |
+ |
addLeft( BackButton.factory( "Change From" ).add( ViewDefs.STORY_MERGE_STORIES, new UriFragmentIdParams.ScreenParamsFactory() { |
|
46 |
+ |
@Override |
|
47 |
+ |
public UriFragmentIdParams create( ViewDef pTarget ) { |
|
48 |
+ |
return MergeStoriesFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
|
49 |
+ |
} |
|
50 |
+ |
} ).create() ); |
|
51 |
+ |
|
|
52 |
+ |
SizeableVerticalPanel zUpperPanel = new SizeableVerticalPanel().stretchable(); |
|
53 |
+ |
|
|
54 |
+ |
zUpperPanel.add( createSectionTitle( "Story to merge From" ) ); |
|
55 |
+ |
zUpperPanel.add( new StoryInfoPanel( mFormBinder0 = new FormBinder<StoryView>( new FormEngine( new WidgetCtrlMap( VISIBLE_BUT_DISABLED ), // |
|
56 |
+ |
FormEngine.Mode.ViewRegular, null ), // |
|
57 |
+ |
StoryViewMetaData.getInstance() ) ) ); |
|
58 |
+ |
|
|
59 |
+ |
QBEscreenSupport zQBEscreenSupport = new QBEscreenSupport(); |
|
60 |
+ |
SizeableVerticalPanel zFormPanel = zQBEscreenSupport.getQBEleft(); |
|
61 |
+ |
SizeableQBEboxedPanel zQBEboxedPanel = zQBEscreenSupport.getQBEboxedPanel(); |
|
62 |
+ |
|
|
63 |
+ |
FilteringTableModel<StoryView> zFilter = |
|
64 |
+ |
new FilteringTableModel<StoryView>( mDataProvider, true, this, null, false ); // Second 'this' allows auto "New" |
|
65 |
+ |
StoryViewTable zTable = new StoryViewTable( zFilter, this ); |
|
66 |
+ |
zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) ); |
|
67 |
+ |
|
|
68 |
+ |
WidgetCtrlMap zWidgetCtrlMap = StoryFieldsPanel.createWidgetCtrlMap( VISIBLE_AND_ACTIVE_ENABLED ); |
|
69 |
+ |
|
|
70 |
+ |
mFE = new QBE_FormEngine( zWidgetCtrlMap, null, zQBEboxedPanel, zFilter, zFilter ); |
|
71 |
+ |
|
|
72 |
+ |
zFormPanel.add( mFE.createSectionTitle( "Story to merge Into" ) ); |
|
73 |
+ |
|
|
74 |
+ |
zFormPanel.add( new StoryFieldsPanel( mFormBinder1 = new FormBinder<StoryView>( mFE, // |
|
75 |
+ |
StoryViewMetaData.getInstance() ), mFE, null ) ); |
|
76 |
+ |
|
|
77 |
+ |
add( new SizeableVerticalSplitPairPanel().stretchable().add( zUpperPanel, zQBEscreenSupport ) ); |
|
78 |
+ |
} |
|
79 |
+ |
|
|
80 |
+ |
@Override |
|
81 |
+ |
public void aboutToShow() { |
|
82 |
+ |
super.aboutToShow(); |
|
83 |
+ |
StoryScreenViewHelper.requestRequiredStory( this, mStory0, 0 ); |
|
84 |
+ |
} |
|
85 |
+ |
|
|
86 |
+ |
@Override |
|
87 |
+ |
public void foundStory( StoryView pStoryView, Integer pRequestID ) { |
|
88 |
+ |
if ( pRequestID == 1 ) { |
|
89 |
+ |
modeEdit( pStoryView ); |
|
90 |
+ |
return; |
|
91 |
+ |
} |
|
92 |
+ |
mFormBinder0.setExistingObject( pStoryView, FormEngine.Mode.ViewRegular ); |
|
93 |
+ |
ObjectURL zStory = mStory1; |
|
94 |
+ |
modeSearch(); // clears mStory |
|
95 |
+ |
StoryScreenViewHelper.requestOptionalStory( this, zStory, 1 ); |
|
96 |
+ |
} |
|
97 |
+ |
|
|
98 |
+ |
@Override |
|
99 |
+ |
protected void justLoaded() { |
|
100 |
+ |
super.justLoaded(); |
|
101 |
+ |
mFE.setFocus(); |
|
102 |
+ |
} |
|
103 |
+ |
|
|
104 |
+ |
@Override |
|
105 |
+ |
public void execute( StoryView pRowValue ) { |
|
106 |
+ |
if ( pRowValue != null ) { |
|
107 |
+ |
modeEdit( pRowValue ); |
|
108 |
+ |
} |
|
109 |
+ |
} |
|
110 |
+ |
|
|
111 |
+ |
private void modeSearch() { |
|
112 |
+ |
mStory1 = null; |
|
113 |
+ |
mFE.setMode( FormEngine.Mode.Search ); |
|
114 |
+ |
} |
|
115 |
+ |
|
|
116 |
+ |
private void modeEdit( StoryView pStoryView ) { |
|
117 |
+ |
mStory1 = pStoryView.getObjectURL(); |
|
118 |
+ |
mFormBinder1.setExistingObject( mDataProvider.copyIntoNewTS( pStoryView ), FormEngine.Mode.EditFromSearch ); |
|
119 |
+ |
} |
|
120 |
+ |
|
|
121 |
+ |
@Override |
|
122 |
+ |
public Widget getBottomBar() { |
|
123 |
+ |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
|
124 |
+ |
|
|
125 |
+ |
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
|
126 |
+ |
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder1, this ) ) ); |
|
127 |
+ |
zActionPanel.addRight( mFE.addExistingUnchangedNextButton( true, ViewDefs.STORY_MERGE_STORIES_STEP_THREE, new UriFragmentIdParams.ScreenParamsFactory() { |
|
128 |
+ |
@Override |
|
129 |
+ |
public UriFragmentIdParams create( ViewDef pTarget ) { |
|
130 |
+ |
return MergeStoriesStepThreeFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) ); |
|
131 |
+ |
} |
|
132 |
+ |
} ) ); |
|
133 |
+ |
return zActionPanel; |
|
134 |
+ |
} |
|
135 |
+ |
|
|
136 |
+ |
@Override |
|
137 |
+ |
public void viewUpdated( StoryView pStoryView ) { |
|
138 |
+ |
modeEdit( pStoryView ); |
|
139 |
+ |
} |
|
140 |
+ |
} |