annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java @ 3522:6eeacd0bbe26

New projects are now maximized by default. flys-client/trunk@5321 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 30 Aug 2012 20:54:14 +0000
parents fe23bbf0ea11
children 6a8f83c538e3
rev   line source
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.smartgwt.client.widgets.Canvas;
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
5 import java.util.HashMap;
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
6 import java.util.Map;
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 /**
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 */
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 public class FLYSWorkspace extends Canvas {
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
279
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
14 /** The maximal number of windows that fit into the browser view when an
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
15 * offset is used to move windows initially.*/
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
16 public static int MAX_WINDOWS = 10;
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
17
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
18 /** The number of pixels used to move windows.*/
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
19 public static int WINDOW_OFFSET = 20;
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
20
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
21
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 /** A map that contains the open CollectionViews. */
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
23 protected Map<String, CollectionView> views;
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 /**
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 * The default constructor creates an empty FLYSWorkspace with no
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 * CollectionViews opened.
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 */
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 public FLYSWorkspace() {
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
31 views = new HashMap<String, CollectionView>();
3522
6eeacd0bbe26 New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents: 896
diff changeset
32
6eeacd0bbe26 New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents: 896
diff changeset
33 setWidth("100%");
6eeacd0bbe26 New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents: 896
diff changeset
34 setHeight("100%");
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 }
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 /**
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 * This method adds a new CollectionView to this workspace and stores a
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 * reference in {@link views}.
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 *
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 * @param collectionView A new CollectionView.
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 */
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
44 public void addView(String uuid, CollectionView collectionView) {
3522
6eeacd0bbe26 New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents: 896
diff changeset
45 collectionView.moveTo(0, 0);
6eeacd0bbe26 New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents: 896
diff changeset
46 collectionView.setMaximized(true);
279
e763d8efd42f ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 273
diff changeset
47
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
48 views.put(uuid, collectionView);
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 addChild(collectionView);
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 }
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
51
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
52
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
53 public void removeProject(String uuid) {
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
54 views.remove(uuid);
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
55 }
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
56
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
57
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
58 public void bringUp(String uuid) {
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
59 CollectionView view = views.get(uuid);
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
60
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
61 view.show();
591
62b65b7b5c7c Restore the size of project windows if they are brought up to front.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 557
diff changeset
62 view.restore();
557
92c200887b20 #21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 279
diff changeset
63 }
600
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
64
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
65
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
66 /**
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
67 * Removes a project from workspace (view) and clears its reference from
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
68 * hash map.
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
69 *
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
70 * @param uuid The project's uuid.
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
71 */
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
72 public void destroyProject(String uuid) {
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
73 CollectionView project = views.get(uuid);
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
74
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
75 if (project != null) {
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
76 removeProject(uuid);
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
77 project.destroy();
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
78 }
347cf4a5a486 Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 591
diff changeset
79 }
895
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 600
diff changeset
80
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 600
diff changeset
81
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 600
diff changeset
82 public void updateTitle(String uuid, String title) {
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 600
diff changeset
83 CollectionView view = views.get(uuid);
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 600
diff changeset
84 view.setTitle(title);
9acbd3f98262 Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 600
diff changeset
85 }
896
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
86
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
87
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
88 public boolean hasView(String uuid) {
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
89 if(views.get(uuid) != null) {
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
90 return true;
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
91 }
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
92 return false;
fe23bbf0ea11 Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 895
diff changeset
93 }
6
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 }
e2b3966b40ca Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org