Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java @ 226:a13382876e5d
The project list is sorted now.
flys-client/trunk@1671 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 12 Apr 2011 13:11:46 +0000 |
parents | 9040663aee01 |
children | 924da6695800 |
rev | line source |
---|---|
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
3 import java.util.Date; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
4 |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.core.client.GWT; |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
6 import com.google.gwt.i18n.client.DateTimeFormat; |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
7 import com.google.gwt.user.client.rpc.AsyncCallback; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
9 import com.smartgwt.client.types.Alignment; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
10 import com.smartgwt.client.types.ListGridFieldType; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
11 import com.smartgwt.client.types.SortDirection; |
220
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
12 import com.smartgwt.client.util.SC; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.Canvas; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.Label; |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
15 import com.smartgwt.client.widgets.grid.CellFormatter; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.grid.ListGrid; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.grid.ListGridField; |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
18 import com.smartgwt.client.widgets.grid.ListGridRecord; |
220
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
19 import com.smartgwt.client.widgets.grid.events.RowContextClickEvent; |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
20 import com.smartgwt.client.widgets.grid.events.RowContextClickHandler; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import com.smartgwt.client.widgets.layout.VLayout; |
220
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
22 import com.smartgwt.client.widgets.menu.Menu; |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
23 import com.smartgwt.client.widgets.menu.MenuItem; |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
24 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent; |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
25 import com.smartgwt.client.widgets.menu.events.ClickHandler; |
79
17815a7354bc
Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
25
diff
changeset
|
26 import com.smartgwt.client.types.VerticalAlignment; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.client.shared.model.Collection; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.client.shared.model.CollectionRecord; |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
30 import de.intevation.flys.client.shared.model.User; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
32 import de.intevation.flys.client.client.Config; |
225
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
33 import de.intevation.flys.client.client.FLYS; |
211
b92281182c6b
Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
97
diff
changeset
|
34 import de.intevation.flys.client.client.FLYSConstants; |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
35 import de.intevation.flys.client.client.event.CollectionChangeEvent; |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
36 import de.intevation.flys.client.client.event.CollectionChangeHandler; |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
37 import de.intevation.flys.client.client.services.UserCollectionsService; |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
38 import de.intevation.flys.client.client.services.UserCollectionsServiceAsync; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * The project list shows a list of projects of a specific user. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 */ |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
46 public class ProjectList |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
47 extends VLayout |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
48 implements CollectionChangeHandler |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
49 { |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 /** The interface that provides i18n messages. */ |
211
b92281182c6b
Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
97
diff
changeset
|
51 private FLYSConstants messages = GWT.create(FLYSConstants.class); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
53 /** The UserService used to retrieve information about the current user. */ |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
54 protected UserCollectionsServiceAsync userCollectionsService = |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
55 GWT.create(UserCollectionsService.class); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
56 |
225
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
57 /** A pointer to the FLYS instance.*/ |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
58 protected FLYS flys; |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
59 |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 /** The user whose projects should be displayed.*/ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 protected User user; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 /** The grid that contains the project rows.*/ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 protected ListGrid grid; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 * The default constructor that creates a new ProjectList for a specific |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 * user. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * @param user The user. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 */ |
225
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
72 public ProjectList(FLYS flys, User user) { |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
73 this.flys = flys; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 this.user = user; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
76 grid = new ListGrid(); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 initGrid(); |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
78 init(); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
80 updateUserCollections(); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 protected void initGrid() { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 grid.setEmptyMessage(messages.no_projects()); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 grid.setLoadingDataMessage(messages.load_projects()); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 grid.setShowRecordComponents(true); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 grid.setShowRecordComponentsByCell(true); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 grid.setCanRemoveRecords(false); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 grid.setShowHeader(false); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 grid.setWidth100(); |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
92 grid.setHeight100(); |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
93 grid.setSortDirection(SortDirection.DESCENDING); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
94 grid.setSortField(0); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
96 ListGridField date = buildDateField(); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
97 ListGridField name = buildNameField(); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
99 grid.setFields(date, name); |
220
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
100 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
101 grid.addRowContextClickHandler(new RowContextClickHandler() { |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
102 public void onRowContextClick(RowContextClickEvent event) { |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
103 CollectionRecord record = (CollectionRecord) event.getRecord(); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
104 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
105 Menu menu = createContextMenu(record); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
106 grid.setContextMenu(menu); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
107 menu.showContextMenu(); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
108 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
109 event.cancel(); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
110 } |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
111 }); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
112 } |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
113 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
114 |
225
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
115 public FLYS getFlys() { |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
116 return flys; |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
117 } |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
118 |
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
119 |
220
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
120 /** |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
121 * Creates a new context menu that interacts with a CollectionRecord. |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
122 * |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
123 * @param record The selected record. |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
124 * |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
125 * @return the context menu with operations that interact with |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
126 * <i>record</i>. |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
127 */ |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
128 protected Menu createContextMenu(final CollectionRecord record) { |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
129 Menu menu = new Menu(); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
130 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
131 MenuItem open = new MenuItem(messages.open_project()); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
132 open.addClickHandler(new ClickHandler() { |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
133 public void onClick(MenuItemClickEvent evt) { |
225
9040663aee01
Filled the context menu point 'Open project' of the ProjectList with life - it opens a new window displaying the parameterization of the selected project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
220
diff
changeset
|
134 getFlys().openProject(record.getCollection().identifier()); |
220
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
135 } |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
136 }); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
137 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
138 MenuItem del = new MenuItem(messages.delete_project()); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
139 del.addClickHandler(new ClickHandler() { |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
140 public void onClick(MenuItemClickEvent evt) { |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
141 SC.warn("Removing projects is not implemented."); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
142 } |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
143 }); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
144 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
145 menu.addItem(open); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
146 menu.addItem(del); |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
147 |
35094660f91a
Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
148 return menu; |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 * The init() method handles the layout stuff for this widget. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 protected void init() { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 setWidth(300); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 setHeight100(); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 setShowResizeBar(true); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 setShowEdges(false); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 setLayoutMargin(0); |
79
17815a7354bc
Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
25
diff
changeset
|
161 setLayoutAlign(VerticalAlignment.TOP); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 Label title = new Label(messages.projects()); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 title.setHeight("20"); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 title.setMargin(5); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 title.setWidth100(); |
79
17815a7354bc
Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
25
diff
changeset
|
167 title.setStyleName("fontLightSmall"); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 Canvas titleWrapper = new Canvas(); |
79
17815a7354bc
Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
25
diff
changeset
|
170 titleWrapper.setStyleName("bgBlueDark"); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 titleWrapper.setWidth100(); |
79
17815a7354bc
Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
25
diff
changeset
|
172 titleWrapper.setHeight("20px"); |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 titleWrapper.addChild(title); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 Canvas gridWrapper = new Canvas(); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 gridWrapper.setPadding(0); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 titleWrapper.setWidth100(); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 gridWrapper.addChild(grid); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 addMember(titleWrapper); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 addMember(gridWrapper); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 } |
97
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
183 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
184 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
185 public void onCollectionChange(CollectionChangeEvent event) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
186 GWT.log("ProjectList.onCollectionChange"); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
187 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
188 updateUserCollections(); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
189 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
190 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
191 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
192 protected void updateUserCollections() { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
193 Config config = Config.getInstance(); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
194 String url = config.getServerUrl(); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
195 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
196 userCollectionsService.getUserCollections(url, user.identifier(), |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
197 new AsyncCallback<Collection[]>() { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
198 public void onFailure(Throwable caught) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
199 GWT.log("Could not recieve a list of user collections."); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
200 GWT.log(caught.getMessage()); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
201 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
202 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
203 public void onSuccess(Collection[] collections) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
204 int num = collections != null ? collections.length : 0; |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
205 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
206 GWT.log("Received " + num + " user collections."); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
207 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
208 if (num == 0) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
209 return; |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
210 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
211 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
212 updateGrid(collections); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
213 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
214 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
215 ); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
216 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
217 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
218 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
219 protected void clearGrid() { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
220 ListGridRecord[] records = grid.getRecords(); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
221 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
222 for (ListGridRecord record: records) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
223 grid.removeData(record); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
224 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
225 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
226 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
227 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
228 protected void updateGrid(Collection[] collections) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
229 clearGrid(); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
230 |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
231 for (Collection c: collections) { |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
232 grid.addData(new CollectionRecord(c)); |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
233 } |
0bec0112c8b3
Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
234 } |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
235 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
236 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
237 /** |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
238 * Builds the field in the grid that displays the creation time of a |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
239 * project. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
240 * |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
241 * @return the grid field. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
242 */ |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
243 protected ListGridField buildDateField() { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
244 ListGridField date = new ListGridField("creationTime", "creationTime"); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
245 date.setType(ListGridFieldType.DATE); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
246 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
247 date.setCellFormatter(new CellFormatter() { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
248 public String format(Object value, ListGridRecord rec, int r, int c) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
249 if (value == null) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
250 return null; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
251 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
252 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
253 DateTimeFormat dtf = DateTimeFormat.getFormat( |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
254 messages.datetime_format()); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
255 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
256 return dtf.format((Date)value); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
257 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
258 }); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
259 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
260 date.setWidth(105); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
261 date.setAlign(Alignment.LEFT); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
262 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
263 return date; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
264 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
265 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
266 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
267 /** |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
268 * Builds the field in the grid that displays the name of a project. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
269 * |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
270 * @return the grid field. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
271 */ |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
272 protected ListGridField buildNameField() { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
273 ListGridField name = new ListGridField("name", "name"); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
274 name.setType(ListGridFieldType.TEXT); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
275 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
276 name.setCellFormatter(new CellFormatter() { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
277 public String format(Object value, ListGridRecord record, int row, int col) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
278 String n = (String) value; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
279 int len = n.length(); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
280 int sec = len - 15; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
281 return n.substring(0, 14) + "..." + n.substring(sec, len-1); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
282 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
283 }); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
284 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
285 name.setWidth(195); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
286 name.setAlign(Alignment.LEFT); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
287 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
288 return name; |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
225
diff
changeset
|
289 } |
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |