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