annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ProjectList.java @ 5861:172338b1407f

GWT client: Added copyright header.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:30:15 +0200
parents 5aa05a7a34b7
children ea9eef426962
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.client.ui;
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
10
3473
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
11 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
12 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
13 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
14 import com.google.gwt.user.client.rpc.AsyncCallback;
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 4140
diff changeset
15
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
16 import com.smartgwt.client.types.Alignment;
3709
9969e3b0d860 Scrolling the project list is now more robust.
Christian Lins <christian.lins@intevation.de>
parents: 3531
diff changeset
17 import com.smartgwt.client.types.Autofit;
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
18 import com.smartgwt.client.types.ListGridEditEvent;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
19 import com.smartgwt.client.types.ListGridFieldType;
3709
9969e3b0d860 Scrolling the project list is now more robust.
Christian Lins <christian.lins@intevation.de>
parents: 3531
diff changeset
20 import com.smartgwt.client.types.Overflow;
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
21 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
22 import com.smartgwt.client.types.SortArrow;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
23 import com.smartgwt.client.types.SortDirection;
3473
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
24 import com.smartgwt.client.types.VerticalAlignment;
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.util.BooleanCallback;
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
26 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
27 import com.smartgwt.client.widgets.Canvas;
5144
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
28 import com.smartgwt.client.widgets.IconButton;
4
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 import com.smartgwt.client.widgets.Label;
5144
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
30 import com.smartgwt.client.widgets.events.ClickEvent;
4605
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
31 import com.smartgwt.client.widgets.events.VisibilityChangedEvent;
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
32 import com.smartgwt.client.widgets.events.VisibilityChangedHandler;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
33 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
34 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
35 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
36 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
37 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
38 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
39 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
40 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
41 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
42 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
43 import com.smartgwt.client.widgets.grid.events.EditCompleteHandler;
3473
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
44 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickEvent;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
45 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickHandler;
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
46 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
47 import com.smartgwt.client.widgets.grid.events.RowContextClickHandler;
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
48 import com.smartgwt.client.widgets.layout.HLayout;
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
49 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
50 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
51 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
52 import com.smartgwt.client.widgets.menu.MenuItemSeparator;
3473
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
53 import com.smartgwt.client.widgets.menu.events.ClickHandler;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
54 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
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
55
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
56 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
57 import org.dive4elements.river.client.client.FLYS;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
58 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
59 import org.dive4elements.river.client.client.event.CollectionChangeEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
60 import org.dive4elements.river.client.client.event.CollectionChangeHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
61 import org.dive4elements.river.client.client.event.FilterHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
62 import org.dive4elements.river.client.client.event.RangeFilterEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
63 import org.dive4elements.river.client.client.event.StringFilterEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
64 import org.dive4elements.river.client.client.services.AddArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
65 import org.dive4elements.river.client.client.services.AddArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
66 import org.dive4elements.river.client.client.services.ArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
67 import org.dive4elements.river.client.client.services.ArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
68 import org.dive4elements.river.client.client.services.CreateCollectionService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
69 import org.dive4elements.river.client.client.services.CreateCollectionServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
70 import org.dive4elements.river.client.client.services.DeleteCollectionService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
71 import org.dive4elements.river.client.client.services.DeleteCollectionServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
72 import org.dive4elements.river.client.client.services.DescribeCollectionService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
73 import org.dive4elements.river.client.client.services.DescribeCollectionServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
74 import org.dive4elements.river.client.client.services.GetArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
75 import org.dive4elements.river.client.client.services.GetArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
76 import org.dive4elements.river.client.client.services.SetCollectionNameService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
77 import org.dive4elements.river.client.client.services.SetCollectionNameServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
78 import org.dive4elements.river.client.client.services.SetCollectionTTLService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
79 import org.dive4elements.river.client.client.services.SetCollectionTTLServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
80 import org.dive4elements.river.client.client.services.UserCollectionsService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
81 import org.dive4elements.river.client.client.services.UserCollectionsServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
82 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
83 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
84 import org.dive4elements.river.client.shared.model.CollectionItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
85 import org.dive4elements.river.client.shared.model.CollectionRecord;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
86 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
87 import org.dive4elements.river.client.shared.model.User;
3473
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
88
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
89 import java.util.ArrayList;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
90 import java.util.Date;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
91 import java.util.List;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
92 import java.util.Map;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
93 import java.util.MissingResourceException;
60bf22a14ed8 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3381
diff changeset
94
4
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 /**
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 * 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
98 *
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 * @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
100 */
97
0bec0112c8b3 Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 79
diff changeset
101 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
102 extends VLayout
4605
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
103 implements CollectionChangeHandler, EditCompleteHandler, FilterHandler,
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
104 VisibilityChangedHandler
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
105 {
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
106 /** 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
107 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
108
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
109 /** 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
110 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
111
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
112 /** 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
113 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
114
613
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
115 /** 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
116 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
117
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
118 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
119
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
120 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
121
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
122 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
123
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
124 /** The interface that provides i18n messages. */
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
125 private final 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
126
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
127 /** 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
128 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
129 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
130
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
131 /** 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
132 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
133 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
134
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
135 /** 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
136 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
137 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
138
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
139 /** 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
140 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
141 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
142
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
143 /** 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
144 protected DescribeCollectionServiceAsync describeCollectionService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
145 GWT.create(DescribeCollectionService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
146
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
147 /** 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
148 protected ArtifactServiceAsync createArtifactService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
149 GWT.create(ArtifactService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
150
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
151 /** 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
152 protected CreateCollectionServiceAsync createCollectionService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
153 GWT.create(CreateCollectionService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
154
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
155 /** 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
156 protected AddArtifactServiceAsync addArtifactService =
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
157 GWT.create(AddArtifactService.class);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
158
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
159 /** The GetArtifactService used to open an existing collection. */
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
160 protected GetArtifactServiceAsync getArtifactService =
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
161 GWT.create(GetArtifactService.class);
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
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 /** 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
164 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
165
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
166 /** 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
167 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
168
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 /** 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
170 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
171
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
172 /** All user collections.*/
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
173 protected List<Collection> collections;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
174
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
175 /** The collection to clone*/
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
176 protected Collection cloneCollection;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
177
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
178 /** The message class that provides i18n strings.*/
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
179 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
180
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
181 private String filter;
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
182
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
183
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 /**
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 * 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
186 * 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
187 *
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 * @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
189 */
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
190 public ProjectList(FLYS flys, User user) {
3531
718e5c6c992e Maybe squashed issue531.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3501
diff changeset
191 super();
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
192 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
193 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
194
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
195 collections = new ArrayList<Collection>();
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
196 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
197 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
198 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
199 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
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 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
202
4605
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
203 addVisibilityChangedHandler(this);
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
204
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
205 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
206 }
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 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
210 grid.setWidth100();
3709
9969e3b0d860 Scrolling the project list is now more robust.
Christian Lins <christian.lins@intevation.de>
parents: 3531
diff changeset
211 grid.setAutoFitData(Autofit.VERTICAL);
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
212 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
213 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
214 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
215 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
216 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
217 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
218 grid.setShowSortArrow(SortArrow.NONE);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
219 grid.setSortDirection(SortDirection.DESCENDING);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
220 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
221 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
222 grid.setCanReorderFields(false);
2446
caae9d686372 Removed the scrollbar placeholder of the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1534
diff changeset
223 grid.setLeaveScrollbarGap(false);
3709
9969e3b0d860 Scrolling the project list is now more robust.
Christian Lins <christian.lins@intevation.de>
parents: 3531
diff changeset
224 grid.setBorder("0px");
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
225
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
226 ListGridField date = buildDateField();
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
227 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
228 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
229
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
230 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
231
1391
f554dce42d66 Issue 355.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 917
diff changeset
232 grid.addHeaderDoubleClickHandler(new HeaderDoubleClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
233 @Override
1391
f554dce42d66 Issue 355.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 917
diff changeset
234 public void onHeaderDoubleClick(HeaderDoubleClickEvent event) {
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
235 // Cancel the event.
1391
f554dce42d66 Issue 355.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 917
diff changeset
236 return;
f554dce42d66 Issue 355.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 917
diff changeset
237 }
f554dce42d66 Issue 355.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 917
diff changeset
238 });
f554dce42d66 Issue 355.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 917
diff changeset
239
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
240 // Add a handler to set / unset the favorite state of a project.
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
241 grid.addCellClickHandler(new CellClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
242 @Override
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
243 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
244 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
245 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
246 }
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
247
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
248 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
249 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
250
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
251 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
252 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
253 }
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
254 });
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
255
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
256 // 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
257 grid.addCellDoubleClickHandler(new CellDoubleClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
258 @Override
253
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
259 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
260 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
261 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
262 ? 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
263 : "";
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
264 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
265 }
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
266 });
aea3ab5997b2 Added a doubleclick listener to the project list to open a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
267
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
268 // 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
269 grid.addRowContextClickHandler(new RowContextClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
270 @Override
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
271 public void onRowContextClick(RowContextClickEvent event) {
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
272 CollectionRecord record = (CollectionRecord) event.getRecord();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
273
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
274 Menu menu = createContextMenu(record);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
275 grid.setContextMenu(menu);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
276 menu.showContextMenu();
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 event.cancel();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
279 }
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 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
282
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
283
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
284 /**
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
285 * 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
286 * 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
287 */
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
288 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
289 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
290 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
291
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
292 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
293
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
294 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
295
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
296 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
297 @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
298 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
299 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
300 }
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
301 };
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
302
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
303 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
304 }
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
305
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
306
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
307 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
308 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
309 }
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
310
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
311
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
312 /**
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
313 * 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
314 *
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
315 * @param record The selected record.
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
316 *
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
317 * @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
318 * <i>record</i>.
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
319 */
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
320 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
321 Menu menu = new Menu();
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
322
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
323 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
324 open.addClickHandler(new ClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
325 @Override
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
326 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
327 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
328 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
329 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
330
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
331 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
332 del.addClickHandler(new ClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
333 @Override
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
334 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
335 SC.ask(messages.really_delete(), new BooleanCallback() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
336 @Override
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
337 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
338 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
339 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
340 }
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
341 }
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
342 });
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
343 }
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
344 });
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
345
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
346 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
347 rename.addClickHandler(new ClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
348 @Override
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
349 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
350 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
351 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
352 }
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
353 });
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
354
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
355 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
356 clone.addClickHandler(new ClickHandler() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
357 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
358 public void onClick(MenuItemClickEvent evt) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
359 cloneProject(record.getCollection());
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
360 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
361 });
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
362
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
363 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
364 menu.addItem(rename);
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
365 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
366 menu.addItem(new MenuItemSeparator());
220
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
367 menu.addItem(del);
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
368
35094660f91a Implemented a context menu for the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 211
diff changeset
369 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
370 }
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
371
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
373 /**
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
374 * 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
375 */
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376 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
377 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
378 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
379 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
380 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
381 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
382 setLayoutMargin(0);
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
383 setLayoutAlign(VerticalAlignment.TOP);
3709
9969e3b0d860 Scrolling the project list is now more robust.
Christian Lins <christian.lins@intevation.de>
parents: 3531
diff changeset
384 setOverflow(Overflow.AUTO);
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
385
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 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
387 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
388 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
389 title.setWidth100();
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
390 title.setStyleName("projectHeader");
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
391
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
392 HLayout buttonWrapper = new HLayout();
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
393
5144
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
394 IconButton addButton = new IconButton("");
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
395 addButton.setIcon(messages.projectListAdd());
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
396 addButton.setTooltip(messages.new_project());
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
397 addButton.setWidth("30px");
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
398
5144
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
399 IconButton closeButton = new IconButton("");
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
400 closeButton.setIcon(messages.projectListMin());
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
401 closeButton.setTooltip(messages.projectlist_close());
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
402 closeButton.setWidth("30px");
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
403
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
404 buttonWrapper.addMember(addButton);
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
405 buttonWrapper.addMember(closeButton);
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
406 buttonWrapper.setAlign(Alignment.RIGHT);
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
407 buttonWrapper.setAutoWidth();
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
408
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
409 HLayout titleWrapper = new HLayout();
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
410 titleWrapper.setStyleName("bgBlueMid");
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
411 titleWrapper.setWidth100();
79
17815a7354bc Customized background and ProjectList styles.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 25
diff changeset
412 titleWrapper.setHeight("20px");
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
413 titleWrapper.addMember(title);
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
414 titleWrapper.addMember(buttonWrapper);
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
415
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
416 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
417 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
418 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
419 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
420
4692
f2578acc60d7 Rename filter into filterpanel
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4691
diff changeset
421 TableFilter filterpanel = new TableFilter();
f2578acc60d7 Rename filter into filterpanel
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4691
diff changeset
422 filterpanel.setHeight("30px");
f2578acc60d7 Rename filter into filterpanel
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4691
diff changeset
423 filterpanel.addFilterHandler(this);
f2578acc60d7 Rename filter into filterpanel
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4691
diff changeset
424 filterpanel.setBorder("1px solid gray");
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
425
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
426 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
427 addMember(gridWrapper);
4692
f2578acc60d7 Rename filter into filterpanel
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4691
diff changeset
428 addMember(filterpanel);
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
429
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
430 addButton.addClickHandler(
5144
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
431 new com.smartgwt.client.widgets.events.ClickHandler() {
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
432
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
433 @Override
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
434 public void onClick(ClickEvent ev) {
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
435 flys.newProject();
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
436 }
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
437 });
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
438
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
439 closeButton.addClickHandler(
5144
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4696
diff changeset
440 new com.smartgwt.client.widgets.events.ClickHandler() {
4559
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
441
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
442 @Override
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
443 public void onClick(ClickEvent ev) {
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
444 hide();
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
445 }
7f86ab48284c Add a small close and add project button to the project list header
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4184
diff changeset
446 });
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
447 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
448
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
449
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
450 @Override
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
451 public void onFilterCriteriaChanged(StringFilterEvent event) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
452 String search = event.getFilter();
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
453 // Filter the records.
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
454 setFilter(search);
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
455 updateGrid();
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
456 }
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
457
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
458
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
459 @Override
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1493
diff changeset
460 public void onFilterCriteriaChanged(RangeFilterEvent event) {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1493
diff changeset
461 //Empty. No Ranges to filter.
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1493
diff changeset
462 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1493
diff changeset
463
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1493
diff changeset
464
3531
718e5c6c992e Maybe squashed issue531.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3501
diff changeset
465 /** On collection change, update list (probably name change or similar). */
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
466 @Override
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
467 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
468 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
469 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
470 }
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
471 }
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
472
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
473
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
474 @Override
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
475 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
476 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
477 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
478 }
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
479
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
480 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
481
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
482 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
483 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
484
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
485 Map<?, ?> newValues = event.getNewValues();
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
486 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
487
613
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
488 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
489 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
490
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
491 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
492 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
493 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
494 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
495
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
496 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
497 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
498 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
499
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
500 return;
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
501 }
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
502
4693
a91d3bde7255 Change parameters of updateCollectionName
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4692
diff changeset
503 updateCollectionName(c, name);
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
504 }
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
505
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
506
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
507 /**
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
508 * 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
509 * 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
510 *
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
511 * @param c The Collection with a new name.
4693
a91d3bde7255 Change parameters of updateCollectionName
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4692
diff changeset
512 * @param name Name to set on the collection
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
513 */
4693
a91d3bde7255 Change parameters of updateCollectionName
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4692
diff changeset
514 private void updateCollectionName(final Collection c, String name) {
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
515 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
516 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
517 }
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
518
4693
a91d3bde7255 Change parameters of updateCollectionName
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4692
diff changeset
519 c.setName(name);
a91d3bde7255 Change parameters of updateCollectionName
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4692
diff changeset
520
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
521 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
522 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
523
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
524 nameService.setName(c, new AsyncCallback<Void>(){
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
525 @Override
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
526 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
527 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
528
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
529 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
530 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
531 }
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
532 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
533 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
534 }
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 }
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
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
537 @Override
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
538 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
539 updateUserCollections();
896
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
540 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
541 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
542 }
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
543 }
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
544 });
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
545 }
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
546
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
547
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
548 /**
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
549 * 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
550 * 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
551 *
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
552 * @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
553 */
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
554 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
555 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
556 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
557 }
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
558
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
559 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
560 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
561
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
562 ttlService.setTTL(c, new AsyncCallback<Void>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
563 @Override
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
564 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
565 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
566
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
567 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
568 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
569 }
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
570 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
571 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
572 }
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
573 }
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
574
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
575 @Override
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
576 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
577 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
578 }
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
579 });
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
580 }
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
581
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
582
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
583 /**
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
584 * 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
585 *
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
586 * @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
587 */
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
588 public 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
589 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
590 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
591 }
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
592
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
593 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
594
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
595 deleteService.delete(c, new AsyncCallback<Void>(){
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
596 @Override
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
597 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
598 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
599
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
600 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
601 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
602 }
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
603 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
604 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
605 }
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
606 }
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
607
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
608 @Override
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
609 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
610 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
611 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
612 }
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
613 });
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
614 }
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
615
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
616
4140
a9bafa5445f9 Change updateUserCollections visibility to public
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3709
diff changeset
617 public 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
618 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
619
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
620 Config config = Config.getInstance();
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
621 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
622
1493
07b9404d7170 Removed unused method calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1425
diff changeset
623 userCollectionsService.getUserCollections(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
624 new AsyncCallback<Collection[]>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
625 @Override
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
626 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
627 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
628
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
629 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
630 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
631 }
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
632 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
633 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
634 }
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
635 }
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
636
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
637 @Override
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
638 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
639 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
640
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
641 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
642
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
643 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
644 }
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
645 }
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
646 );
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
647 }
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
648
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
649
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
650 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
651 * Delete all entries in the ListGrid.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
652 */
4694
5411975223f0 Change only local used methods to private ones
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4693
diff changeset
653 private void clearGrid() {
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
654 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
655
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
656 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
657 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
658 }
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
659 }
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
660
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
661
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
662 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
663 * Update the collections data source.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
664 *
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
665 * 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
666 *
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
667 * @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
668 */
4694
5411975223f0 Change only local used methods to private ones
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4693
diff changeset
669 private void updateGridDataSource(Collection[] c) {
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
670 collections.clear();
889
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
671 if(c == null) {
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
672 clearGrid();
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
673 return;
2c9c3448e499 Fixed some minor problems and strings in projectlist.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 887
diff changeset
674 }
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
675 for (Collection coll : c) {
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
676 this.collections.add(coll);
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
677 }
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
678 updateGrid();
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
679 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
680
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
681
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
682 /**
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
683 * Updates the ListGrid.
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
684 */
4694
5411975223f0 Change only local used methods to private ones
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4693
diff changeset
685 private 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
686 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
687
4695
139cf1f9a22c Use isEmpty for list check
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4694
diff changeset
688 if (collections == null || collections.isEmpty()) {
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
689 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
690 }
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
691
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
692 for (Collection col: collections) {
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
693 String name;
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
694
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
695 name = col.getDisplayName().toLowerCase();
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
696
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
697 // 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
698 // matches.
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
699 if (filter == null || filter.isEmpty() ||
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
700 name.contains(filter.toLowerCase())) {
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
701 grid.addData(new CollectionRecord(col));
885
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
702 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
703 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
704 }
eeea6a02d62c Added filter functionality to the project list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 877
diff changeset
705
613
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
706 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
707 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
708 }
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
709
471ca61b83b5 #165 Set the max length of project names to 50 characters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
710
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
711 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
712 * 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
713 * project.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
714 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
715 * @return the grid field.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
716 */
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
717 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
718 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
719 "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
720
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
721 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
722 date.setCanEdit(false);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
723
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
724 date.setCellFormatter(new CellFormatter() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
725 @Override
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
726 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
727 if (value == null) {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
728 return null;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
729 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
730
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
731 DateTimeFormat dtf = DateTimeFormat.getFormat(
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
732 messages.datetime_format());
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
733
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
734 return dtf.format((Date)value);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
735 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
736 });
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
737
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
738 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
739 date.setAlign(Alignment.CENTER);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
740
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
741 return date;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
742 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
743
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
744
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
745 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
746 * 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
747 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
748 * @return the grid field.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
749 */
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
750 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
751 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
752 "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
753
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
754 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
755 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
756 name.setHoverCustomizer(new HoverCustomizer() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
757 @Override
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
758 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
759 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
760 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
761 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
762 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
763 {
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
764 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
765 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
766
607
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 606
diff changeset
767 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
768
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
769 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
770 ? name
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
771 : 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
772 }
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
773 });
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
774
606
69c0a6ecad57 #165 (part 1) Added tooltips and table headers in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 600
diff changeset
775 name.setWidth(COLUMN_TITLE_WIDTH);
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
776 name.setAlign(Alignment.LEFT);
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
777
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
778 return name;
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 225
diff changeset
779 }
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
780
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
781
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
782 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
783 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
784 "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
785
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
786 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
787 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
788 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
789 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
790 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
791 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
792 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
793
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
794 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
795 }
887
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
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
798 protected void cloneProject(Collection c) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
799 Config config = Config.getInstance();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
800 String locale = config.getLocale();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
801
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
802 cloneCollection = c;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
803
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
804 describeCollectionService.describe(c.identifier(), locale,
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
805 new AsyncCallback<Collection>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
806 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
807 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
808 GWT.log("Could not DESCRIBE collection.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
809 SC.warn(messages.getString(caught.getMessage()));
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
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
813 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
814 public void onSuccess(Collection newCollection) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
815 GWT.log("Successfully DESCRIBED collection.");
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
816 String uuid = getMasterArtifact(newCollection);
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
817 cloneArtifact(uuid, newCollection);
887
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 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
820 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
821 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
822
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
823
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
824 /** Get master artifacts UUID of a collection. */
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
825 protected String getMasterArtifact(Collection newCollection) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
826 String uuid = newCollection.getItem(0).identifier();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
827 // The master artifact uuid.
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
828 return uuid;
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
829 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
830
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
831
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
832 /** Clone artifact/create collection, using the refArtifacts factory. */
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
833 protected void cloneArtifact(String uuid, Artifact refArtifact,
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
834 final String locale) {
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
835 Recommendation recommendation = new Recommendation(
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
836 refArtifact.getName(),
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
837 null,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
838 uuid,
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
839 null);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
840
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
841 String factory = recommendation.getFactory();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
842 createArtifactService.create(
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
843 locale, factory, recommendation,
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
844 new AsyncCallback<Artifact>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
845 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
846 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
847 GWT.log("Error loading recommendations: " +
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
848 caught.getMessage());
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
849 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
850
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
851 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
852 public void onSuccess(Artifact artifact) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
853 GWT.log("Created new artifact: " + artifact.getUuid());
4696
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
854 createClonedCollection(artifact);
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
855 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
856 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
857 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
858 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
859
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
860
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
861 /**
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
862 * Clone a project (collection).
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
863 */
4694
5411975223f0 Change only local used methods to private ones
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4693
diff changeset
864 private void cloneArtifact(final String uuid, Collection newCollection) {
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
865 Config config = Config.getInstance();
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
866 final String locale = config.getLocale();
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
867
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
868 // Find out which factory to use for cloning.
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
869 CollectionItem master = newCollection.getItem(0);
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
870 getArtifactService.getArtifact(
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
871 locale,
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
872 master.identifier(),
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
873 master.hash(),
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
874 new AsyncCallback<Artifact>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
875 @Override
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
876 public void onFailure(Throwable caught) {
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
877 SC.warn(MSG.getString(caught.getMessage()));
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
878 }
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
879
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
880 @Override
3380
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
881 public void onSuccess(Artifact artifact) {
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
882 cloneArtifact(uuid, artifact, locale);
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
883 }
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
884 });
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
885 }
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
886
f6519c699fca Respect factory of cloned artifact when cloning.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2446
diff changeset
887
4696
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
888 /**
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
889 * Creates a {@link Collection} with the passed {@link Artifact}
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
890 * @param artifact {@link Artifact} to add to the new {@link Collection}
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
891 */
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
892 private void createClonedCollection(final Artifact artifact) {
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
893 Config config = Config.getInstance();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
894 final String locale = config.getLocale();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
895 final String ownerid = user.identifier();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
896
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
897 createCollectionService.create(
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
898 locale,
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
899 ownerid,
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
900 new AsyncCallback<Collection>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
901 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
902 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
903 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
904 SC.warn(messages.getString(caught.getMessage()));
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
905 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
906
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
907 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
908 public void onSuccess(Collection collection) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
909 GWT.log("Successfully created a new collection.");
4696
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
910 addArtifactToClonedCollection(artifact, collection);
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
911 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
912 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
913 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
914 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
915
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
916
4696
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
917 private void addArtifactToClonedCollection(Artifact a, Collection c) {
1493
07b9404d7170 Removed unused method calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1425
diff changeset
918 Config config = Config.getInstance();
07b9404d7170 Removed unused method calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1425
diff changeset
919 final String locale = config.getLocale();
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
920
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
921 addArtifactService.add(
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1391
diff changeset
922 c, a, locale,
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
923 new AsyncCallback<Collection>() {
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
924 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
925 public void onFailure(Throwable caught) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
926 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
927 SC.warn(messages.getString(caught.getMessage()));
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
928 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
929
3501
0de0ef04bcdc Delete empty project after closing CollectionView (#785).
Christian Lins <christian.lins@intevation.de>
parents: 3473
diff changeset
930 @Override
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
931 public void onSuccess(Collection newColl) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
932 String name = cloneCollection.getName();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
933 if(name == null || name.equals("")) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
934 name = cloneCollection.identifier();
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
935 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
936
4696
03c66281c16b Rename methods and mark them private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4695
diff changeset
937 String colname = messages.copy_of() + ": " + name;
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
938
4694
5411975223f0 Change only local used methods to private ones
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4693
diff changeset
939 updateCollectionName(newColl, colname);
887
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
940 if(cloneCollection.getTTL() == 0) {
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
941 newColl.setTTL(0);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
942 updateCollectionTTL(newColl);
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
943 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
944 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
945 }
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
946 );
6a27949c7022 Issue234/266: Added feature for duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 885
diff changeset
947 }
4605
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
948
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
949
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
950 @Override
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
951 public void onVisibilityChanged(VisibilityChangedEvent event) {
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
952 if (event.getIsVisible()) {
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
953 this.flys.hideHeaderProjectButton();
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
954 }
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
955 else {
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
956 this.flys.shoHeaderProjectButton();
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
957 }
c1c4c95ae9e4 Hide the manage project button if the project list is shown
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4559
diff changeset
958 }
4691
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
959
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
960 private void setFilter(String filter) {
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
961 this.filter = filter;
62091b0ef789 Fix filtering of Collections/Projects in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4605
diff changeset
962 }
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
963 }
89976499e013 Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
964 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org