annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java @ 1261:87b6a93db523

Cleaned imports. flys-client/trunk@2789 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 19 Sep 2011 15:11:24 +0000
parents fe23bbf0ea11
children f554dce42d66
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;
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
4 import java.util.Map;
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
5 import java.util.List;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
6 import java.util.ArrayList;
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
7 import java.util.MissingResourceException;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
8
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
9 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
10 import com.google.gwt.i18n.client.DateTimeFormat;
585
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
11 import com.google.gwt.user.client.Timer;
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
12 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
13
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
14 import com.smartgwt.client.types.Alignment;
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
15 import com.smartgwt.client.types.ListGridEditEvent;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
16 import com.smartgwt.client.types.ListGridFieldType;
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
17 import com.smartgwt.client.types.SelectionStyle;
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
18 import com.smartgwt.client.types.SortArrow;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
19 import com.smartgwt.client.types.SortDirection;
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
20 import com.smartgwt.client.util.BooleanCallback;
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.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
22 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
23 import com.smartgwt.client.widgets.Label;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
24 import com.smartgwt.client.widgets.grid.CellFormatter;
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
25 import com.smartgwt.client.widgets.grid.HoverCustomizer;
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
26 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
27 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
28 import com.smartgwt.client.widgets.grid.ListGridRecord;
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
29 import com.smartgwt.client.widgets.grid.events.CellClickEvent;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
30 import com.smartgwt.client.widgets.grid.events.CellClickHandler;
253
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
31 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
32 import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
33 import com.smartgwt.client.widgets.grid.events.EditCompleteEvent;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
34 import com.smartgwt.client.widgets.grid.events.EditCompleteHandler;
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
35 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
36 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
37 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
38 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
39 import com.smartgwt.client.widgets.menu.MenuItem;
778
e14dc5fed6bb Reordered delete and rename in project context menu, add separator.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 613
diff changeset
40 import com.smartgwt.client.widgets.menu.MenuItemSeparator;
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
41 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
42 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
43 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
44
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 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
46 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
47 import de.intevation.flys.client.shared.model.User;
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
48 import de.intevation.flys.client.shared.model.Artifact;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
49 import de.intevation.flys.client.shared.model.Recommendation;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
50
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
51 import de.intevation.flys.client.client.event.FilterHandler;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
52 import de.intevation.flys.client.client.event.StringFilterEvent;
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
53
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
54 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
55 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
56 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
57 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
58 import de.intevation.flys.client.client.event.CollectionChangeHandler;
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
59 import de.intevation.flys.client.client.services.ArtifactService;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
60 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
61 import de.intevation.flys.client.client.services.DeleteCollectionService;
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
62 import de.intevation.flys.client.client.services.DeleteCollectionServiceAsync;
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
63 import de.intevation.flys.client.client.services.SetCollectionNameService;
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
64 import de.intevation.flys.client.client.services.SetCollectionNameServiceAsync;
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
65 import de.intevation.flys.client.client.services.SetCollectionTTLService;
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
66 import de.intevation.flys.client.client.services.SetCollectionTTLServiceAsync;
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
67 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
68 import de.intevation.flys.client.client.services.UserCollectionsServiceAsync;
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
69 import de.intevation.flys.client.client.services.DescribeCollectionService;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
70 import de.intevation.flys.client.client.services.DescribeCollectionServiceAsync;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
71 import de.intevation.flys.client.client.services.AddArtifactService;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
72 import de.intevation.flys.client.client.services.AddArtifactServiceAsync;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
73 import de.intevation.flys.client.client.services.CreateCollectionService;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
74 import de.intevation.flys.client.client.services.CreateCollectionServiceAsync;
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
75
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
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 /**
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 * 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
79 *
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 * @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
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 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
83 extends VLayout
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
84 implements CollectionChangeHandler, EditCompleteHandler, FilterHandler
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
85 {
585
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
86 /** Interval to refresh the user's projects.*/
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
87 public static final int UPDATE_INTERVAL = 30000;
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
88
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
89 /** Min Interval to refresh the user's projects.*/
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
90 public static final int MIN_UPDATE_INTERVAL = 5000;
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
91
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
92 /** The initial width of this panel.*/
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
93 public static final int MIN_WIDTH = 300;
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
94
613
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
95 /** The max length for new project names.*/
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
96 public static final int MAX_NAME_LENGTH = 50;
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
97
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
98 public static final String COLUMN_DATE_WIDTH = "100px";
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
99
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
100 public static final String COLUMN_TITLE_WIDTH = "*";
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
101
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
102 public static final String COLUMN_FAVORITE_WIDTH = "75px";
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
103
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
104 /** 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
105 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
106
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
107 /** 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
108 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
109 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
110
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
111 /** The service used to set the name of a project.*/
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
112 protected SetCollectionNameServiceAsync nameService =
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
113 GWT.create(SetCollectionNameService.class);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
114
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
115 /** The service used to set the name of a project.*/
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
116 protected SetCollectionTTLServiceAsync ttlService =
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
117 GWT.create(SetCollectionTTLService.class);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
118
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
119 /** The service used to set the name of a project.*/
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
120 protected DeleteCollectionServiceAsync deleteService =
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
121 GWT.create(DeleteCollectionService.class);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
122
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
123 /** The DescribeCollectionService used to update the existing collection. */
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
124 protected DescribeCollectionServiceAsync describeCollectionService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
125 GWT.create(DescribeCollectionService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
126
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
127 /** The ArtifactService used to communicate with the Artifact server. */
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
128 protected ArtifactServiceAsync createArtifactService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
129 GWT.create(ArtifactService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
130
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
131 /** The ArtifactService used to communicate with the Artifact server. */
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
132 protected CreateCollectionServiceAsync createCollectionService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
133 GWT.create(CreateCollectionService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
134
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
135 /** The AddArtifactService used to add an artifact to a collection. */
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
136 protected AddArtifactServiceAsync addArtifactService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
137 GWT.create(AddArtifactService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
138
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
139 /** 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
140 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
141
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
142 /** 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
143 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
144
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 /** 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
146 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
147
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
148 /** All user collections.*/
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
149 protected List<Collection> collections;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
150
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
151 /** The collections visible in the grid.*/
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
152 protected List<Collection> filteredCollections;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
153
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
154 /** The collection to clone*/
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
155 protected Collection cloneCollection;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
156
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
157 /**
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 * 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
159 * 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
160 *
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 * @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
162 */
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
163 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
164 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
165 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
166
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
167 filteredCollections = new ArrayList();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
168 collections = new ArrayList();
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
169 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
170 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
171 init();
585
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
172 initTimer();
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
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
174 grid.addEditCompleteHandler(this);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
175
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
176 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
177 }
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
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 protected void initGrid() {
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
181 grid.setWidth100();
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
182 grid.setHeight100();
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
183 grid.setAutoFitMaxWidth(500);
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
184 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
185 grid.setLoadingDataMessage(messages.load_projects());
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
186 grid.setCanEdit(false);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
187 grid.setEditEvent(ListGridEditEvent.NONE);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
188 grid.setShowHeaderContextMenu(false);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
189 grid.setShowSortArrow(SortArrow.NONE);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
190 grid.setSortDirection(SortDirection.DESCENDING);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
191 grid.setSortField(0);
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
192 grid.setSelectionType(SelectionStyle.SINGLE);
877
f343b4c2d135 Set header fields to fixed order in project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 778
diff changeset
193 grid.setCanReorderFields(false);
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
194
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
195 ListGridField date = buildDateField();
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
196 ListGridField name = buildNameField();
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
197 ListGridField fav = buildFavoriteField();
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
198
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
199 grid.setFields(date, name, fav);
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
200
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
201 // add a handler to set / unset the favorite state of a project
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
202 grid.addCellClickHandler(new CellClickHandler() {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
203 public void onCellClick(CellClickEvent event) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
204 if (event.getColNum() != 2) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
205 return;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
206 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
207
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
208 CollectionRecord r = (CollectionRecord) event.getRecord();
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
209 Collection c = r.getCollection();
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
210
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
211 c.setTTL(c.getTTL() == 0 ? -1 : 0);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
212 updateCollectionTTL(c);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
213 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
214 });
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
215
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
216 // add a handler to open a project
253
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
217 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
218 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
219 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
220 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
221 ? 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
222 : "";
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
223 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
224 }
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
225 });
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
226
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
227 // add a handler to open a context menu
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
228 grid.addRowContextClickHandler(new RowContextClickHandler() {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
229 public void onRowContextClick(RowContextClickEvent event) {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
230 CollectionRecord record = (CollectionRecord) event.getRecord();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
231
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
232 Menu menu = createContextMenu(record);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
233 grid.setContextMenu(menu);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
234 menu.showContextMenu();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
235
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
236 event.cancel();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
237 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
238 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
239 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
240
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
241
585
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
242 /**
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
243 * Initializes a repeating timer that updates the user's collections. The
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
244 * interval is specified by the constant <i>UPDATE_INTERVAL</i>.
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
245 */
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
246 protected void initTimer() {
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
247 Config config = Config.getInstance();
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
248 int interval = config.getProjectListUpdateInterval();
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
249
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
250 interval = interval > MIN_UPDATE_INTERVAL ? interval : UPDATE_INTERVAL;
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
251
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
252 GWT.log("Update project list every " + interval + " milliseconds.");
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
253
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
254 Timer t = new Timer() {
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
255 @Override
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
256 public void run() {
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
257 updateUserCollections();
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
258 }
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
259 };
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
260
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
261 t.scheduleRepeating(interval);
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
262 }
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
263
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
264
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
265 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
266 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
267 }
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
268
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
269
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
270 /**
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
271 * 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
272 *
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
273 * @param record The selected record.
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
274 *
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
275 * @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
276 * <i>record</i>.
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
277 */
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
278 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
279 Menu menu = new Menu();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
280
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
281 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
282 open.addClickHandler(new ClickHandler() {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
283 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
284 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
285 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
286 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
287
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
288 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
289 del.addClickHandler(new ClickHandler() {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
290 public void onClick(MenuItemClickEvent evt) {
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
291 SC.ask(messages.really_delete(), new BooleanCallback() {
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
292 public void execute(Boolean value) {
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
293 if (value) {
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
294 deleteCollection(record.getCollection());
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
295 }
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
296 }
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
297 });
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
298 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
299 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
300
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
301 MenuItem rename = new MenuItem(messages.rename_project());
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
302 rename.addClickHandler(new ClickHandler() {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
303 public void onClick(MenuItemClickEvent evt) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
304 int row = grid.getRecordIndex(record);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
305 grid.startEditing(row, 1, false);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
306 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
307 });
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
308
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
309 MenuItem clone = new MenuItem(messages.clone_project());
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
310 clone.addClickHandler(new ClickHandler() {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
311 public void onClick(MenuItemClickEvent evt) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
312 cloneProject(record.getCollection());
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
313 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
314 });
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
315
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
316 menu.addItem(open);
778
e14dc5fed6bb Reordered delete and rename in project context menu, add separator.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 613
diff changeset
317 menu.addItem(rename);
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
318 menu.addItem(clone);
778
e14dc5fed6bb Reordered delete and rename in project context menu, add separator.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 613
diff changeset
319 menu.addItem(new MenuItemSeparator());
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
320 menu.addItem(del);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
321
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
322 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
323 }
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
325
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
326 /**
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
327 * 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
328 */
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329 protected void init() {
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
330 setWidth(MIN_WIDTH);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
331 setMinWidth(MIN_WIDTH);
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
332 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
333 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
334 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
335 setLayoutMargin(0);
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
336 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
337
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
338 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
339 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
340 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
341 title.setWidth100();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
342 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
343
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
344 Canvas titleWrapper = new Canvas();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
345 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
346 titleWrapper.setWidth100();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
347 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
348 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
349
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
350 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
351 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
352 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
353 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
354
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
355 TableFilter filter = new TableFilter();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
356 filter.setHeight("30px");
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
357 filter.addFilterHandler(this);
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
358
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
359 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
360 addMember(gridWrapper);
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
361 addMember(filter);
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
362 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
363
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
364
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
365 public void onFilterCriteriaChanged(StringFilterEvent event) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
366 String search = event.getFilter();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
367 if (search != null && search.length() > 0) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
368 // Filter the records.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
369 filterCollections(search);
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
370 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
371 else {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
372 filteredCollections.clear();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
373 for(int i = 0; i < collections.size(); i++) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
374 filteredCollections.add(collections.get(i));
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
375 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
376 updateGrid();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
377 }
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
378 }
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
379
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
380
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
381 public void onCollectionChange(CollectionChangeEvent event) {
585
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
382 if (event.getOldValue() == null) {
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
383 updateUserCollections();
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
384 }
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
385 }
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
386
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
387
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
388 public void onEditComplete(EditCompleteEvent event) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
389 if (event.getColNum() != 1) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
390 return;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
391 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
392
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
393 int row = event.getRowNum();
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
394
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
395 CollectionRecord r = (CollectionRecord) grid.getRecord(row);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
396 Collection c = r.getCollection();
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
397
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
398 Map newValues = event.getNewValues();
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
399 String name = (String) newValues.get("name");
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
400
613
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
401 int maxLength = getMaxNameLength();
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
402 int length = name != null ? name.length() : 0;
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
403
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
404 if (length <= 0 || length > maxLength) {
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
405 String msg = messages.project_name_too_long();
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
406 msg = msg.replace("$LEN", String.valueOf(maxLength));
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
407 SC.warn(msg);
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
408
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
409 ListGridRecord[] rs = grid.getRecords();
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
410 rs[row] = (ListGridRecord) event.getOldRecord();
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
411 grid.setRecords(rs);
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
412
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
413 return;
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
414 }
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
415
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
416 c.setName(name);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
417 updateCollectionName(c);
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
418 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
419
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
420
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
421 /**
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
422 * Set the name of the collection <i>c</i> to a new value. If the update
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
423 * process succeeded, the project list is refreshed.
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
424 *
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
425 * @param c The Collection with a new name.
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
426 */
895
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 889
diff changeset
427 protected void updateCollectionName(final Collection c) {
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
428 if (c == null) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
429 return;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
430 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
431
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
432 GWT.log("Update Collection name: " + c.identifier());
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
433 GWT.log("=> New name = " + c.getName());
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
434
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
435 Config config = Config.getInstance();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
436 nameService.setName(c, config.getServerUrl(), new AsyncCallback<Void>(){
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
437 public void onFailure(Throwable caught) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
438 String msg = caught.getMessage();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
439
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
440 try {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
441 SC.warn(messages.getString(msg));
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
442 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
443 catch (MissingResourceException mre) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
444 SC.warn(msg);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
445 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
446 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
447
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
448 public void onSuccess(Void v) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
449 updateUserCollections();
896
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
450 if(flys.getWorkspace().hasView(c.identifier())) {
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
451 flys.getWorkspace().updateTitle(c.identifier(), c.getName());
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
452 }
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
453 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
454 });
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
455 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
456
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
457
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
458 /**
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
459 * Set the ttl of the collection <i>c</i> to a new value. If the update
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
460 * process succeeded, the project list is refreshed.
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
461 *
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
462 * @param c The Collection with a new ttl.
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
463 */
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
464 protected void updateCollectionTTL(Collection c) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
465 if (c == null) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
466 return;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
467 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
468
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
469 GWT.log("Update Collection TTL: " + c.identifier());
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
470 GWT.log("=> New ttl = " + c.getTTL());
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
471
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
472 Config config = Config.getInstance();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
473 ttlService.setTTL(c, config.getServerUrl(), new AsyncCallback<Void>() {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
474 public void onFailure(Throwable caught) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
475 String msg = caught.getMessage();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
476
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
477 try {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
478 SC.warn(messages.getString(msg));
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
479 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
480 catch (MissingResourceException mre) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
481 SC.warn(msg);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
482 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
483 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
484
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
485 public void onSuccess(Void v) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
486 updateUserCollections();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
487 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
488 });
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
489 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
490
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
491
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
492 /**
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
493 * Delete the collection <i>c</i>.
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
494 *
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
495 * @param c The Collection that should be deleted.
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
496 */
600
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 599
diff changeset
497 protected void deleteCollection(final Collection c) {
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
498 if (c == null) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
499 return;
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
500 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
501
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
502 GWT.log("Delete Collection: " + c.identifier());
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
503
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
504 Config config = Config.getInstance();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
505 deleteService.delete(c, config.getServerUrl(), new AsyncCallback<Void>(){
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
506 public void onFailure(Throwable caught) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
507 String msg = caught.getMessage();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
508
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
509 try {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
510 SC.warn(messages.getString(msg));
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
511 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
512 catch (MissingResourceException mre) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
513 SC.warn(msg);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
514 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
515 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
516
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
517 public void onSuccess(Void v) {
600
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 599
diff changeset
518 flys.getWorkspace().destroyProject(c.identifier());
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
519 updateUserCollections();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
520 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
521 });
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
522 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
523
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
524
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
525 protected void updateUserCollections() {
585
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
526 GWT.log("==> ProjectList updates user collections!");
ab7ec931bae2 #22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 554
diff changeset
527
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
528 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
529 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
530 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
531
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
532 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
533 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
534 public void onFailure(Throwable caught) {
598
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
535 String msg = caught.getMessage();
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
536
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
537 try {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
538 SC.warn(messages.getString(msg));
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
539 }
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
540 catch (MissingResourceException mre) {
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
541 SC.warn(msg);
031357c3e23e Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
542 }
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
543 }
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
544
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
545 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
546 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
547
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
548 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
549
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
550 updateGridDataSource(collections);
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
551 }
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
552 }
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
553 );
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
554 }
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
555
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
556 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
557 * Delete all entries in the ListGrid.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
558 */
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
559 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
560 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
561
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
562 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
563 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
564 }
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
565 }
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
566
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
567
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
568 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
569 * Update the collections data source.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
570 *
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
571 * First removes all collections to avoid duplicates, then add new entries.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
572 *
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
573 * @param c Collections to set to the data source.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
574 */
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
575 protected void updateGridDataSource (Collection[] c) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
576 collections.clear();
889
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
577 if(c == null) {
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
578 clearGrid();
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
579 return;
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
580 }
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
581 for (Collection coll : c) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
582 this.collections.add(coll);
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
583 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
584 filterCollections("");
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
585 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
586
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
587
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
588 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
589 * Updates the ListGrid.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
590 */
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
591 protected void updateGrid() {
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
592 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
593
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
594 if (filteredCollections == null ||
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
595 filteredCollections.size() == 0) {
599
1dbffe4c6d12 Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
596 return;
1dbffe4c6d12 Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
597 }
1dbffe4c6d12 Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
598
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
599 for (Collection c: filteredCollections) {
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
600 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
601 }
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
602 }
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
603
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
604 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
605 * Filter for the user collections.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
606 *
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
607 * @param search String to search for in collection names.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
608 */
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
609 protected void filterCollections(String search) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
610 int j = 0;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
611
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
612 // Clear the collection list.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
613 filteredCollections.clear();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
614
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
615 // Filter the list.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
616 for (int i = 0; i < collections.size(); i++) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
617 String name;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
618
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
619 // Get the collection name.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
620 if (collections.get(i).getName().equals("") ||
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
621 collections.get(i).getName() == null) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
622 name = collections.get(i).identifier();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
623 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
624 else {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
625 name = collections.get(i).getName();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
626 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
627
889
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
628 name = name.toLowerCase();
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
629 // Add a collection to the filtered list if the search string
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
630 // matches.
889
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
631 if (name.contains(search.toLowerCase())) {
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
632 filteredCollections.add(collections.get(i));
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
633 j++;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
634 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
635 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
636 updateGrid();
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
637 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
638
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
639
613
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
640 public int getMaxNameLength() {
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
641 return MAX_NAME_LENGTH;
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
642 }
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
643
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
644
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
645 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
646 * 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
647 * project.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
648 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
649 * @return the grid field.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
650 */
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
651 protected ListGridField buildDateField() {
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
652 ListGridField date = new ListGridField(
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
653 "creationTime", messages.projectlist_creationTime());
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
654
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
655 date.setType(ListGridFieldType.DATE);
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
656 date.setCanEdit(false);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
657
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
658 date.setCellFormatter(new CellFormatter() {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
659 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
660 if (value == null) {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
661 return null;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
662 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
663
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
664 DateTimeFormat dtf = DateTimeFormat.getFormat(
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
665 messages.datetime_format());
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
666
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
667 return dtf.format((Date)value);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
668 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
669 });
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
670
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
671 date.setWidth(COLUMN_DATE_WIDTH);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
672 date.setAlign(Alignment.CENTER);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
673
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
674 return date;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
675 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
676
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
677
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
678 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
679 * 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
680 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
681 * @return the grid field.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
682 */
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
683 protected ListGridField buildNameField() {
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
684 ListGridField name = new ListGridField(
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
685 "name", messages.projectlist_title());
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
686
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
687 name.setType(ListGridFieldType.TEXT);
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
688 name.setShowHover(true);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
689 name.setHoverCustomizer(new HoverCustomizer() {
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
690 public String hoverHTML(
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
691 Object value,
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
692 ListGridRecord record,
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
693 int row,
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
694 int col)
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
695 {
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
696 CollectionRecord r = (CollectionRecord) record;
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
697 Collection c = r.getCollection();
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
698
607
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 606
diff changeset
699 String name = r.getName();
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
700
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
701 return name != null && name.length() > 0
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
702 ? name
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
703 : c.identifier();
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
704 }
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
705 });
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
706
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
707 name.setWidth(COLUMN_TITLE_WIDTH);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
708 name.setAlign(Alignment.LEFT);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
709
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
710 return name;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
711 }
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
712
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
713
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
714 protected ListGridField buildFavoriteField() {
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
715 ListGridField fav = new ListGridField(
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
716 "ttl", messages.projectlist_favorite());
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
717
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
718 fav.setType(ListGridFieldType.IMAGE);
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
719 String base = GWT.getHostPageBaseURL();
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
720 fav.setImageURLPrefix(base + "images/");
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
721 fav.setImageURLSuffix(".png");
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
722 fav.setWidth(COLUMN_FAVORITE_WIDTH);
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
723 fav.setAlign(Alignment.CENTER);
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
724 fav.setCanEdit(false);
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
725
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
726 return fav;
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
727 }
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
728
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
729
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
730 protected void cloneProject(Collection c) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
731 Config config = Config.getInstance();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
732 String url = config.getServerUrl();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
733 String locale = config.getLocale();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
734
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
735 cloneCollection = c;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
736
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
737 describeCollectionService.describe(c.identifier(), url, locale,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
738 new AsyncCallback<Collection>() {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
739 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
740 GWT.log("Could not DESCRIBE collection.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
741 SC.warn(messages.getString(caught.getMessage()));
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
742 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
743
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
744
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
745 public void onSuccess(Collection newCollection) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
746 GWT.log("Successfully DESCRIBED collection.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
747 String uuid = getMasterArtifact(newCollection);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
748 cloneArtifact(uuid);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
749 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
750 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
751 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
752 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
753
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
754
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
755 protected String getMasterArtifact(Collection newCollection) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
756 String uuid = newCollection.getItem(0).identifier();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
757 // The master artifact uuid.
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
758 return uuid;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
759 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
760
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
761
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
762 protected void cloneArtifact(String uuid) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
763 Config config = Config.getInstance();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
764 final String url = config.getServerUrl();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
765 final String locale = config.getLocale();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
766
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
767 Recommendation recommendation = new Recommendation(
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
768 "winfo",
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
769 null,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
770 uuid,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
771 null);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
772
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
773 String factory = recommendation.getFactory();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
774 createArtifactService.create(
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
775 url, locale, factory, recommendation,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
776 new AsyncCallback<Artifact>() {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
777 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
778 GWT.log("Error loading recommendations: " +
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
779 caught.getMessage());
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
780 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
781
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
782 public void onSuccess(Artifact artifact) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
783 GWT.log("Created new artifact: " + artifact.getUuid());
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
784 createCollection(artifact);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
785 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
786 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
787 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
788 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
789
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
790
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
791 protected void createCollection(final Artifact artifact) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
792 Config config = Config.getInstance();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
793 final String url = config.getServerUrl();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
794 final String locale = config.getLocale();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
795 final String ownerid = user.identifier();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
796
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
797 createCollectionService.create(
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
798 url, locale, ownerid,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
799 new AsyncCallback<Collection>() {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
800 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
801 GWT.log("Could not create the new collection.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
802 SC.warn(messages.getString(caught.getMessage()));
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
803 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
804
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
805 public void onSuccess(Collection collection) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
806 GWT.log("Successfully created a new collection.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
807 addArtifactToCollection(artifact, collection);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
808 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
809 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
810 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
811 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
812
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
813
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
814 protected void addArtifactToCollection(Artifact a, Collection c) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
815 Config config = Config.getInstance();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
816 final String url = config.getServerUrl();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
817 final String locale = config.getLocale();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
818
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
819 addArtifactService.add(
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
820 c, a, url, locale,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
821 new AsyncCallback<Collection>() {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
822 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
823 GWT.log("An error occured while adding artifact.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
824 SC.warn(messages.getString(caught.getMessage()));
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
825 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
826
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
827 public void onSuccess(Collection newColl) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
828 String name = cloneCollection.getName();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
829 if(name == null || name.equals("")) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
830 name = cloneCollection.identifier();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
831 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
832
889
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
833 newColl.setName(messages.copy_of() + ": " + name);
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
834
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
835 updateCollectionName(newColl);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
836 if(cloneCollection.getTTL() == 0) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
837 newColl.setTTL(0);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
838 updateCollectionTTL(newColl);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
839 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
840 updateUserCollections();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
841 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
842 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
843 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
844 }
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
845 }
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
846 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org