|
@@ -1,123 +1,123 @@ |
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.boviews.*; |
9 |
|
- |
import org.litesoft.datt.client.ui.widgets.*; |
10 |
|
- |
import org.litesoft.uispecification.*; |
11 |
|
- |
|
12 |
|
- |
import com.google.gwt.user.client.ui.*; |
13 |
|
- |
|
14 |
|
- |
import static org.litesoft.uispecification.FormWidgetCtrl.*; |
15 |
|
- |
|
16 |
|
- |
public class TasksDialog extends ClickableViewObjectQBEscreenView<TaskView> implements TaskViewNames, |
17 |
|
- |
ViewUpdatable<TaskView> { |
18 |
|
- |
private ObjectURL mEditing = null; |
19 |
|
- |
|
20 |
|
- |
@Override |
21 |
|
- |
protected UriFragmentIdParams createRefreshParams() { |
22 |
|
- |
return StoriesFactory.encodeParams( mEditing ); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
@SuppressWarnings({"UnusedParameters"}) |
26 |
|
- |
public TasksDialog( String pSection, ViewDef pViewDef, ObjectURL pEditing ) { |
27 |
|
- |
super( title( pViewDef ), TaskViewDataProvider.getInstance() ); |
28 |
|
- |
|
29 |
|
- |
mEditing = pEditing; |
30 |
|
- |
|
31 |
|
- |
addStandardTitleBar(); |
32 |
|
- |
|
33 |
|
- |
SizeableQBEboxedPanel zQBEboxedPanel = getQBEboxedPanel(); |
34 |
|
- |
|
35 |
|
- |
FilteringTableModel<TaskView> zFilter = new FilteringTableModel<TaskView>( mDataProvider, true, this, this, true ); // Second 'this' allows "New" |
36 |
|
- |
TaskViewTable zTable = new TaskViewTable( zFilter, this ); |
37 |
|
- |
zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) ); |
38 |
|
- |
|
39 |
|
- |
WidgetCtrlMap zWidgetCtrlMap = TaskFieldsPanel.createWidgetCtrlMap( VISIBLE_AND_ACTIVE_ENABLED ); |
40 |
|
- |
|
41 |
|
- |
mFE = new QBE_FormEngine( zWidgetCtrlMap, null, zQBEboxedPanel, zFilter, zFilter ); |
42 |
|
- |
mFE.setFilterTransformer( new ShowBooleanUpdateFilterTransformer( mFE.getFilterTransformer(), aShowDone, aIsDone, null, false ) ); |
43 |
|
- |
|
44 |
|
- |
mFormBinder = new FormBinder<TaskView>( mFE, TaskViewMetaData.getInstance() ); |
45 |
|
- |
|
46 |
|
- |
add( mFE.createSectionTitle( "Task" ) ); |
47 |
|
- |
|
48 |
|
- |
TaskFieldsPanel zTaskFieldsPanel = new TaskFieldsPanel( mFormBinder ); |
49 |
|
- |
|
50 |
|
- |
add( zTaskFieldsPanel ); |
51 |
|
- |
|
52 |
|
- |
mFE.setPointerWidget( zTaskFieldsPanel.getPointerField() ); |
53 |
|
- |
} |
54 |
|
- |
|
55 |
|
- |
@Override |
56 |
|
- |
public void aboutToShow() { |
57 |
|
- |
super.aboutToShow(); |
58 |
|
- |
ObjectURL zEditing = mEditing; |
59 |
|
- |
modeSearch(); |
60 |
|
- |
if ( zEditing != null ) { |
61 |
|
- |
mDataProvider.requestRow( zEditing, new FetchRowDataProviderCallBack<TaskView>() { |
62 |
|
- |
@Override |
63 |
|
- |
public void success( TaskView pRow ) { |
64 |
|
- |
if ( pRow != null ) { |
65 |
|
- |
modeEdit( pRow ); |
66 |
|
- |
} |
67 |
|
- |
} |
68 |
|
- |
|
69 |
|
- |
@Override |
70 |
|
- |
public void error( String pError ) { |
71 |
|
- |
getStatusMessageSinc().setErrorMessage( pError ); |
72 |
|
- |
} |
73 |
|
- |
} ); |
74 |
|
- |
} |
75 |
|
- |
} |
76 |
|
- |
|
77 |
|
- |
@Override |
78 |
|
- |
protected void justLoaded() { |
79 |
|
- |
super.justLoaded(); |
80 |
|
- |
mFE.setFocus(); |
81 |
|
- |
} |
82 |
|
- |
|
83 |
|
- |
@Override |
84 |
|
- |
protected void processVO( TaskView pRowValue ) { |
85 |
|
- |
if ( pRowValue != null ) { |
86 |
|
- |
modeEdit( pRowValue ); |
87 |
|
- |
} else { |
88 |
|
- |
modeNew(); |
89 |
|
- |
} |
90 |
|
- |
} |
91 |
|
- |
|
92 |
|
- |
@Override |
93 |
|
- |
public Widget getBottomBar() { |
94 |
|
- |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
95 |
|
- |
|
96 |
|
- |
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
97 |
|
- |
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, this ) ) ); |
98 |
|
- |
zActionPanel.addRight( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, ViewDef.HOME ) ) ); |
99 |
|
- |
|
100 |
|
- |
return zActionPanel; |
101 |
|
- |
} |
102 |
|
- |
|
103 |
|
- |
@Override |
104 |
|
- |
public void viewUpdated( TaskView pTaskView ) { |
105 |
|
- |
modeEdit( pTaskView ); |
106 |
|
- |
} |
107 |
|
- |
|
108 |
|
- |
private void modeSearch() { |
109 |
|
- |
mEditing = null; |
110 |
|
- |
mFE.setMode( FormEngine.Mode.Search ); |
111 |
|
- |
} |
112 |
|
- |
|
113 |
|
- |
private void modeEdit( TaskView pTaskView ) { |
114 |
|
- |
mEditing = pTaskView.getObjectURL(); |
115 |
|
- |
mFormBinder.setExistingObject( mDataProvider.copyIntoNewTS( pTaskView ), FormEngine.Mode.EditFromSearch ); |
116 |
|
- |
} |
117 |
|
- |
|
118 |
|
- |
private void modeNew() { |
119 |
|
- |
mEditing = null; |
120 |
|
- |
mFE.setNamedComponentValue( aCreatorFullName, null ); |
121 |
|
- |
mFormBinder.setNewObject( TaskView.createNew() ); |
122 |
|
- |
} |
123 |
|
- |
} |
|
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.boviews.*; |
|
9 |
+ |
import org.litesoft.datt.client.ui.widgets.*; |
|
10 |
+ |
import org.litesoft.uispecification.*; |
|
11 |
+ |
|
|
12 |
+ |
import com.google.gwt.user.client.ui.*; |
|
13 |
+ |
|
|
14 |
+ |
import static org.litesoft.uispecification.FormWidgetCtrl.*; |
|
15 |
+ |
|
|
16 |
+ |
public class TasksDialog extends ClickableViewObjectQBEscreenView<TaskView> implements TaskViewNames, |
|
17 |
+ |
ViewUpdatable<TaskView> { |
|
18 |
+ |
private ObjectURL mEditing = null; |
|
19 |
+ |
|
|
20 |
+ |
@Override |
|
21 |
+ |
protected UriFragmentIdParams createRefreshParams() { |
|
22 |
+ |
return StoriesFactory.encodeParams( mEditing ); |
|
23 |
+ |
} |
|
24 |
+ |
|
|
25 |
+ |
@SuppressWarnings({"UnusedParameters"}) |
|
26 |
+ |
public TasksDialog( String pSection, ViewDef pViewDef, ObjectURL pEditing ) { |
|
27 |
+ |
super( title( pViewDef ), TaskViewDataProvider.getInstance() ); |
|
28 |
+ |
|
|
29 |
+ |
mEditing = pEditing; |
|
30 |
+ |
|
|
31 |
+ |
addStandardTitleBar(); |
|
32 |
+ |
|
|
33 |
+ |
SizeableQBEboxedPanel zQBEboxedPanel = getQBEboxedPanel(); |
|
34 |
+ |
|
|
35 |
+ |
FilteringTableModel<TaskView> zFilter = new FilteringTableModel<TaskView>( mDataProvider, true, this, this, true ); // Second 'this' allows "New" |
|
36 |
+ |
TaskViewTable zTable = new TaskViewTable( zFilter, this ); |
|
37 |
+ |
zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) ); |
|
38 |
+ |
|
|
39 |
+ |
WidgetCtrlMap zWidgetCtrlMap = TaskFieldsPanel.createWidgetCtrlMap( VISIBLE_AND_ACTIVE_ENABLED ); |
|
40 |
+ |
|
|
41 |
+ |
mFE = new QBE_FormEngine( zWidgetCtrlMap, null, zQBEboxedPanel, zFilter, zFilter ); |
|
42 |
+ |
mFE.setFilterTransformer( new ShowBooleanUpdateFilterTransformer( mFE.getFilterTransformer(), aShowDone, aIsDone, null, false ) ); |
|
43 |
+ |
|
|
44 |
+ |
mFormBinder = new FormBinder<TaskView>( mFE, TaskViewMetaData.getInstance() ); |
|
45 |
+ |
|
|
46 |
+ |
add( mFE.createSectionTitle( "Task" ) ); |
|
47 |
+ |
|
|
48 |
+ |
TaskFieldsPanel zTaskFieldsPanel = new TaskFieldsPanel( mFormBinder ); |
|
49 |
+ |
|
|
50 |
+ |
add( zTaskFieldsPanel ); |
|
51 |
+ |
|
|
52 |
+ |
mFE.setPointerWidget( zTaskFieldsPanel.getPointerField() ); |
|
53 |
+ |
} |
|
54 |
+ |
|
|
55 |
+ |
@Override |
|
56 |
+ |
public void aboutToShow() { |
|
57 |
+ |
super.aboutToShow(); |
|
58 |
+ |
ObjectURL zEditing = mEditing; |
|
59 |
+ |
modeSearch(); |
|
60 |
+ |
if ( zEditing != null ) { |
|
61 |
+ |
mDataProvider.requestRow( zEditing, new FetchRowDataProviderCallBack<TaskView>() { |
|
62 |
+ |
@Override |
|
63 |
+ |
public void success( TaskView pRow ) { |
|
64 |
+ |
if ( pRow != null ) { |
|
65 |
+ |
modeEdit( pRow ); |
|
66 |
+ |
} |
|
67 |
+ |
} |
|
68 |
+ |
|
|
69 |
+ |
@Override |
|
70 |
+ |
public void error( String pError ) { |
|
71 |
+ |
getStatusMessageSinc().setErrorMessage( pError ); |
|
72 |
+ |
} |
|
73 |
+ |
} ); |
|
74 |
+ |
} |
|
75 |
+ |
} |
|
76 |
+ |
|
|
77 |
+ |
@Override |
|
78 |
+ |
protected void justLoaded() { |
|
79 |
+ |
super.justLoaded(); |
|
80 |
+ |
mFE.setFocus(); |
|
81 |
+ |
} |
|
82 |
+ |
|
|
83 |
+ |
@Override |
|
84 |
+ |
protected void processVO( TaskView pRowValue ) { |
|
85 |
+ |
if ( pRowValue != null ) { |
|
86 |
+ |
modeEdit( pRowValue ); |
|
87 |
+ |
} else { |
|
88 |
+ |
modeNew(); |
|
89 |
+ |
} |
|
90 |
+ |
} |
|
91 |
+ |
|
|
92 |
+ |
@Override |
|
93 |
+ |
public Widget getBottomBar() { |
|
94 |
+ |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
|
95 |
+ |
|
|
96 |
+ |
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
|
97 |
+ |
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, this ) ) ); |
|
98 |
+ |
zActionPanel.addRight( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, ViewDef.HOME ) ) ); |
|
99 |
+ |
|
|
100 |
+ |
return zActionPanel; |
|
101 |
+ |
} |
|
102 |
+ |
|
|
103 |
+ |
@Override |
|
104 |
+ |
public void viewUpdated( TaskView pTaskView ) { |
|
105 |
+ |
modeEdit( pTaskView ); |
|
106 |
+ |
} |
|
107 |
+ |
|
|
108 |
+ |
private void modeSearch() { |
|
109 |
+ |
mEditing = null; |
|
110 |
+ |
mFE.setMode( FormEngine.Mode.Search ); |
|
111 |
+ |
} |
|
112 |
+ |
|
|
113 |
+ |
private void modeEdit( TaskView pTaskView ) { |
|
114 |
+ |
mEditing = pTaskView.getObjectURL(); |
|
115 |
+ |
mFormBinder.setExistingObject( mDataProvider.copyIntoNewTS( pTaskView ), FormEngine.Mode.EditFromSearch ); |
|
116 |
+ |
} |
|
117 |
+ |
|
|
118 |
+ |
private void modeNew() { |
|
119 |
+ |
mEditing = null; |
|
120 |
+ |
mFE.setNamedComponentValue( aCreatorFullName, null ); |
|
121 |
+ |
mFormBinder.setNewObject( TaskView.createNew() ); |
|
122 |
+ |
} |
|
123 |
+ |
} |