annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java @ 253:aea3ab5997b2

Added a doubleclick listener to the project list to open a project. flys-client/trunk@1863 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 09 May 2011 10:31:54 +0000
parents 924da6695800
children ad2ba6e2b8bd
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;
253
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
19 import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
20 import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
21 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
22 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
23 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
24 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
25 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
26 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
27 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
28 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
29
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 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
31 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
32 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
33
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
34 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
35 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
36 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
37 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
38 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
39 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
40 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
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
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 * 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
45 *
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 * @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
47 */
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
48 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
49 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
50 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
51 {
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 /** 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
53 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
54
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
55 /** 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
56 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
57 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
58
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
59 /** 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
60 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
61
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
62 /** 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
63 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
64
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 /** 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
66 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
67
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 /**
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 * 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
70 * 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 *
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 * @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
73 */
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
74 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
75 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
76 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
77
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
78 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
79 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
80 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
81
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
82 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
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
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
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 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94 grid.setHeight100();
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
95 grid.setSortDirection(SortDirection.DESCENDING);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
96 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
97
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
98 ListGridField date = buildDateField();
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
99 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
100
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
101 grid.setFields(date, name);
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
102
253
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
103 grid.addCellDoubleClickHandler(new CellDoubleClickHandler() {
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
104 public void onCellDoubleClick(CellDoubleClickEvent e) {
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
105 CollectionRecord record = (CollectionRecord) e.getRecord();
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
106 String uuid = record != null
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
107 ? record.getCollection().identifier()
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
108 : "";
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
109 getFlys().openProject(uuid);
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
110 }
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
111 });
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
112
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
113 grid.addRowContextClickHandler(new RowContextClickHandler() {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
114 public void onRowContextClick(RowContextClickEvent event) {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
115 CollectionRecord record = (CollectionRecord) event.getRecord();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
116
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
117 Menu menu = createContextMenu(record);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
118 grid.setContextMenu(menu);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
119 menu.showContextMenu();
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 event.cancel();
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 });
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
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
126
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
127 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
128 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
129 }
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
130
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
131
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
132 /**
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
133 * 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
134 *
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
135 * @param record The selected record.
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 * @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
138 * <i>record</i>.
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
139 */
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
140 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
141 Menu menu = new Menu();
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 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
144 open.addClickHandler(new ClickHandler() {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
145 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
146 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
147 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
148 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
149
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
150 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
151 del.addClickHandler(new ClickHandler() {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
152 public void onClick(MenuItemClickEvent evt) {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
153 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
154 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
155 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
156
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
157 menu.addItem(open);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
158 menu.addItem(del);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
159
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
160 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
161 }
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
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 /**
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 * 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
166 */
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 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
168 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
169 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
170 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
171 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
172 setLayoutMargin(0);
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
173 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
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 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
176 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
177 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
178 title.setWidth100();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
179 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
180
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 Canvas titleWrapper = new Canvas();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
182 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
183 titleWrapper.setWidth100();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
184 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
185 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
186
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 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
188 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
189 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
190 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
191
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 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
193 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
194 }
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
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
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 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
198 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
199
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 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
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
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 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
205 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
206 String url = config.getServerUrl();
229
924da6695800 Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
207 String locale = config.getLocale();
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
208
229
924da6695800 Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
209 userCollectionsService.getUserCollections(url, locale, user.identifier(),
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
210 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
211 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
212 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
213 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
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 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
217 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
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 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
220
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 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
222 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
223 }
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 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
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 );
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 }
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
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 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
233 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
234
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
235 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
236 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
237 }
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
238 }
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
239
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
240
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
241 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
242 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
243
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
244 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
245 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
246 }
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
247 }
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
248
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
249
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
250 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
251 * 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
252 * project.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
253 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
254 * @return the grid field.
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 protected ListGridField buildDateField() {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
257 ListGridField date = new ListGridField("creationTime", "creationTime");
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
258 date.setType(ListGridFieldType.DATE);
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.setCellFormatter(new CellFormatter() {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
261 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
262 if (value == null) {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
263 return null;
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 DateTimeFormat dtf = DateTimeFormat.getFormat(
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
267 messages.datetime_format());
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
268
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
269 return dtf.format((Date)value);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
270 }
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
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
273 date.setWidth(105);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
274 date.setAlign(Alignment.LEFT);
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 return date;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
277 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
278
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
279
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
280 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
281 * 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
282 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
283 * @return the grid field.
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 protected ListGridField buildNameField() {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
286 ListGridField name = new ListGridField("name", "name");
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
287 name.setType(ListGridFieldType.TEXT);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
288
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
289 name.setCellFormatter(new CellFormatter() {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
290 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
291 String n = (String) value;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
292 int len = n.length();
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
293 int sec = len - 15;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
294 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
295 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
296 });
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
297
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
298 name.setWidth(195);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
299 name.setAlign(Alignment.LEFT);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
300
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
301 return name;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
302 }
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
303 }
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org