|
@@ -1,135 +1,135 @@ |
1 |
|
- |
package org.litesoft.nasvideo.client.ui.views.admin; |
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.nasvideo.client.boviews.*; |
9 |
|
- |
import org.litesoft.nasvideo.client.ui.widgets.*; |
10 |
|
- |
import org.litesoft.uispecification.*; |
11 |
|
- |
|
12 |
|
- |
import com.google.gwt.user.client.ui.*; |
13 |
|
- |
|
14 |
|
- |
public class RestrictedResourceManagement extends ClickableViewObjectQBEscreenView<RestrictedResourceView> implements RestrictedResourceViewNames, |
15 |
|
- |
ViewUpdatable<RestrictedResourceView> |
16 |
|
- |
{ |
17 |
|
- |
private ObjectURL mEditing = null; |
18 |
|
- |
|
19 |
|
- |
@Override |
20 |
|
- |
protected UriFragmentIdParams createRefreshParams() |
21 |
|
- |
{ |
22 |
|
- |
return RestrictedResourceManagementFactory.encodeParams( mEditing ); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
public RestrictedResourceManagement( String pSection, ViewDef pViewDef, ObjectURL pEditing ) |
26 |
|
- |
{ |
27 |
|
- |
super( title( pSection, pViewDef ), RestrictedResourceViewDataProvider.getInstance() ); |
28 |
|
- |
|
29 |
|
- |
mEditing = pEditing; |
30 |
|
- |
|
31 |
|
- |
addStandardTitleBar(); |
32 |
|
- |
|
33 |
|
- |
SizeableQBEboxedPanel zQBEboxedPanel = getQBEboxedPanel(); |
34 |
|
- |
|
35 |
|
- |
FilteringTableModel<RestrictedResourceView> zFilter = new FilteringTableModel<RestrictedResourceView>( mDataProvider, true, this, this, true ); // Second 'this' allows "New" |
36 |
|
- |
RestrictedResourceViewTable zTable = new RestrictedResourceViewTable( zFilter, this ); |
37 |
|
- |
zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) ); |
38 |
|
- |
|
39 |
|
- |
RestrictedResourceAbstractFieldsPanel zFieldsPanel = new RestrictedResourceFieldsPanel(); |
40 |
|
- |
|
41 |
|
- |
mFE = new QBE_FormEngine( zFieldsPanel.createCtrlMap(), null, zQBEboxedPanel, zFilter, zFilter ); |
42 |
|
- |
mFormBinder = new FormBinder<RestrictedResourceView>( mFE, RestrictedResourceViewMetaData.getInstance() ); |
43 |
|
- |
|
44 |
|
- |
add( mFE.createSectionTitle( "Project" ) ); |
45 |
|
- |
|
46 |
|
- |
add( zFieldsPanel.initialize( mFE, mFormBinder ) ); |
47 |
|
- |
add( new SizeableSpacer().stretchable() ); |
48 |
|
- |
|
49 |
|
- |
mFE.setPointerWidget( zFieldsPanel.getPointerField() ); |
50 |
|
- |
} |
51 |
|
- |
|
52 |
|
- |
@Override |
53 |
|
- |
public void aboutToShow() |
54 |
|
- |
{ |
55 |
|
- |
super.aboutToShow(); |
56 |
|
- |
ObjectURL zEditing = mEditing; |
57 |
|
- |
modeSearch(); |
58 |
|
- |
if ( zEditing != null ) |
59 |
|
- |
{ |
60 |
|
- |
mDataProvider.requestRow( zEditing, new FetchRowDataProviderCallBack<RestrictedResourceView>() |
61 |
|
- |
{ |
62 |
|
- |
@Override |
63 |
|
- |
public void success( RestrictedResourceView pRow ) |
64 |
|
- |
{ |
65 |
|
- |
if ( pRow != null ) |
66 |
|
- |
{ |
67 |
|
- |
modeEdit( pRow ); |
68 |
|
- |
} |
69 |
|
- |
} |
70 |
|
- |
|
71 |
|
- |
@Override |
72 |
|
- |
public void error( String pError ) |
73 |
|
- |
{ |
74 |
|
- |
getStatusMessageSinc().setErrorMessage( pError ); |
75 |
|
- |
} |
76 |
|
- |
} ); |
77 |
|
- |
} |
78 |
|
- |
} |
79 |
|
- |
|
80 |
|
- |
@Override |
81 |
|
- |
protected void justLoaded() |
82 |
|
- |
{ |
83 |
|
- |
super.justLoaded(); |
84 |
|
- |
mFE.setFocus(); |
85 |
|
- |
} |
86 |
|
- |
|
87 |
|
- |
@Override |
88 |
|
- |
protected void processVO( RestrictedResourceView pRowValue ) |
89 |
|
- |
{ |
90 |
|
- |
if ( pRowValue != null ) |
91 |
|
- |
{ |
92 |
|
- |
modeEdit( pRowValue ); |
93 |
|
- |
} |
94 |
|
- |
else |
95 |
|
- |
{ |
96 |
|
- |
modeNew(); |
97 |
|
- |
} |
98 |
|
- |
} |
99 |
|
- |
|
100 |
|
- |
private void modeSearch() |
101 |
|
- |
{ |
102 |
|
- |
mEditing = null; |
103 |
|
- |
mFE.setMode( FormEngine.Mode.Search ); |
104 |
|
- |
} |
105 |
|
- |
|
106 |
|
- |
private void modeEdit( RestrictedResourceView pRestrictedResourceView ) |
107 |
|
- |
{ |
108 |
|
- |
mEditing = pRestrictedResourceView.getObjectURL(); |
109 |
|
- |
mFormBinder.setExistingObject( mDataProvider.copyIntoNewTS( pRestrictedResourceView ), FormEngine.Mode.EditFromSearch ); |
110 |
|
- |
} |
111 |
|
- |
|
112 |
|
- |
private void modeNew() |
113 |
|
- |
{ |
114 |
|
- |
mEditing = null; |
115 |
|
- |
mFormBinder.setNewObject( RestrictedResourceView.createNew() ); |
116 |
|
- |
} |
117 |
|
- |
|
118 |
|
- |
@Override |
119 |
|
- |
public Widget getBottomBar() |
120 |
|
- |
{ |
121 |
|
- |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
122 |
|
- |
|
123 |
|
- |
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
124 |
|
- |
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, this ) ) ); |
125 |
|
- |
zActionPanel.addRight( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, ViewDef.HOME ) ) ); |
126 |
|
- |
|
127 |
|
- |
return zActionPanel; |
128 |
|
- |
} |
129 |
|
- |
|
130 |
|
- |
@Override |
131 |
|
- |
public void viewUpdated( RestrictedResourceView pRestrictedResourceView ) |
132 |
|
- |
{ |
133 |
|
- |
modeEdit( pRestrictedResourceView ); |
134 |
|
- |
} |
135 |
|
- |
} |
|
1 |
+ |
package org.litesoft.nasvideo.client.ui.views.admin; |
|
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.initfrom.client.boviews.*; |
|
9 |
+ |
import org.litesoft.nasvideo.client.ui.widgets.*; |
|
10 |
+ |
import org.litesoft.uispecification.*; |
|
11 |
+ |
|
|
12 |
+ |
import com.google.gwt.user.client.ui.*; |
|
13 |
+ |
|
|
14 |
+ |
public class RestrictedResourceManagement extends ClickableViewObjectQBEscreenView<RestrictedResourceView> implements RestrictedResourceViewNames, |
|
15 |
+ |
ViewUpdatable<RestrictedResourceView> |
|
16 |
+ |
{ |
|
17 |
+ |
private ObjectURL mEditing = null; |
|
18 |
+ |
|
|
19 |
+ |
@Override |
|
20 |
+ |
protected UriFragmentIdParams createRefreshParams() |
|
21 |
+ |
{ |
|
22 |
+ |
return RestrictedResourceManagementFactory.encodeParams( mEditing ); |
|
23 |
+ |
} |
|
24 |
+ |
|
|
25 |
+ |
public RestrictedResourceManagement( String pSection, ViewDef pViewDef, ObjectURL pEditing ) |
|
26 |
+ |
{ |
|
27 |
+ |
super( title( pSection, pViewDef ), RestrictedResourceViewDataProvider.getInstance() ); |
|
28 |
+ |
|
|
29 |
+ |
mEditing = pEditing; |
|
30 |
+ |
|
|
31 |
+ |
addStandardTitleBar(); |
|
32 |
+ |
|
|
33 |
+ |
SizeableQBEboxedPanel zQBEboxedPanel = getQBEboxedPanel(); |
|
34 |
+ |
|
|
35 |
+ |
FilteringTableModel<RestrictedResourceView> zFilter = new FilteringTableModel<RestrictedResourceView>( mDataProvider, true, this, this, true ); // Second 'this' allows "New" |
|
36 |
+ |
RestrictedResourceViewTable zTable = new RestrictedResourceViewTable( zFilter, this ); |
|
37 |
+ |
zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) ); |
|
38 |
+ |
|
|
39 |
+ |
RestrictedResourceAbstractFieldsPanel zFieldsPanel = new RestrictedResourceFieldsPanel(); |
|
40 |
+ |
|
|
41 |
+ |
mFE = new QBE_FormEngine( zFieldsPanel.createCtrlMap(), null, zQBEboxedPanel, zFilter, zFilter ); |
|
42 |
+ |
mFormBinder = new FormBinder<RestrictedResourceView>( mFE, RestrictedResourceViewMetaData.getInstance() ); |
|
43 |
+ |
|
|
44 |
+ |
add( mFE.createSectionTitle( "Project" ) ); |
|
45 |
+ |
|
|
46 |
+ |
add( zFieldsPanel.initialize( mFE, mFormBinder ) ); |
|
47 |
+ |
add( new SizeableSpacer().stretchable() ); |
|
48 |
+ |
|
|
49 |
+ |
mFE.setPointerWidget( zFieldsPanel.getPointerField() ); |
|
50 |
+ |
} |
|
51 |
+ |
|
|
52 |
+ |
@Override |
|
53 |
+ |
public void aboutToShow() |
|
54 |
+ |
{ |
|
55 |
+ |
super.aboutToShow(); |
|
56 |
+ |
ObjectURL zEditing = mEditing; |
|
57 |
+ |
modeSearch(); |
|
58 |
+ |
if ( zEditing != null ) |
|
59 |
+ |
{ |
|
60 |
+ |
mDataProvider.requestRow( zEditing, new FetchRowDataProviderCallBack<RestrictedResourceView>() |
|
61 |
+ |
{ |
|
62 |
+ |
@Override |
|
63 |
+ |
public void success( RestrictedResourceView pRow ) |
|
64 |
+ |
{ |
|
65 |
+ |
if ( pRow != null ) |
|
66 |
+ |
{ |
|
67 |
+ |
modeEdit( pRow ); |
|
68 |
+ |
} |
|
69 |
+ |
} |
|
70 |
+ |
|
|
71 |
+ |
@Override |
|
72 |
+ |
public void error( String pError ) |
|
73 |
+ |
{ |
|
74 |
+ |
getStatusMessageSinc().setErrorMessage( pError ); |
|
75 |
+ |
} |
|
76 |
+ |
} ); |
|
77 |
+ |
} |
|
78 |
+ |
} |
|
79 |
+ |
|
|
80 |
+ |
@Override |
|
81 |
+ |
protected void justLoaded() |
|
82 |
+ |
{ |
|
83 |
+ |
super.justLoaded(); |
|
84 |
+ |
mFE.setFocus(); |
|
85 |
+ |
} |
|
86 |
+ |
|
|
87 |
+ |
@Override |
|
88 |
+ |
protected void processVO( RestrictedResourceView pRowValue ) |
|
89 |
+ |
{ |
|
90 |
+ |
if ( pRowValue != null ) |
|
91 |
+ |
{ |
|
92 |
+ |
modeEdit( pRowValue ); |
|
93 |
+ |
} |
|
94 |
+ |
else |
|
95 |
+ |
{ |
|
96 |
+ |
modeNew(); |
|
97 |
+ |
} |
|
98 |
+ |
} |
|
99 |
+ |
|
|
100 |
+ |
private void modeSearch() |
|
101 |
+ |
{ |
|
102 |
+ |
mEditing = null; |
|
103 |
+ |
mFE.setMode( FormEngine.Mode.Search ); |
|
104 |
+ |
} |
|
105 |
+ |
|
|
106 |
+ |
private void modeEdit( RestrictedResourceView pRestrictedResourceView ) |
|
107 |
+ |
{ |
|
108 |
+ |
mEditing = pRestrictedResourceView.getObjectURL(); |
|
109 |
+ |
mFormBinder.setExistingObject( mDataProvider.copyIntoNewTS( pRestrictedResourceView ), FormEngine.Mode.EditFromSearch ); |
|
110 |
+ |
} |
|
111 |
+ |
|
|
112 |
+ |
private void modeNew() |
|
113 |
+ |
{ |
|
114 |
+ |
mEditing = null; |
|
115 |
+ |
mFormBinder.setNewObject( RestrictedResourceView.createNew() ); |
|
116 |
+ |
} |
|
117 |
+ |
|
|
118 |
+ |
@Override |
|
119 |
+ |
public Widget getBottomBar() |
|
120 |
+ |
{ |
|
121 |
+ |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
|
122 |
+ |
|
|
123 |
+ |
zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) ); |
|
124 |
+ |
zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, this ) ) ); |
|
125 |
+ |
zActionPanel.addRight( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder, ViewDef.HOME ) ) ); |
|
126 |
+ |
|
|
127 |
+ |
return zActionPanel; |
|
128 |
+ |
} |
|
129 |
+ |
|
|
130 |
+ |
@Override |
|
131 |
+ |
public void viewUpdated( RestrictedResourceView pRestrictedResourceView ) |
|
132 |
+ |
{ |
|
133 |
+ |
modeEdit( pRestrictedResourceView ); |
|
134 |
+ |
} |
|
135 |
+ |
} |