annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ThemeNavigationPanel.java @ 532:0ba7c43e7b62

Replaced buttons displayed as labels with real buttons. flys-client/trunk@2023 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 27 May 2011 13:10:09 +0000
parents 902609b5cc79
children
rev   line source
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.chart;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.List;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import com.google.gwt.core.client.GWT;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.Canvas;
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
9 import com.smartgwt.client.widgets.ImgButton;
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.widgets.events.ClickEvent;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.widgets.events.ClickHandler;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import com.smartgwt.client.widgets.layout.HLayout;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
14 import de.intevation.flys.client.client.FLYSConstants;
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.client.client.event.OnMoveEvent;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.client.client.event.OnMoveHandler;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 /**
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 */
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 public class ThemeNavigationPanel extends Canvas {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public static final int PANEL_MARGIN = 5;
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
25 public static final int BUTTON_HEIGHT = 25;
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public static final int BUTTON_MARGIN = 5;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
29 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
30
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
31
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 protected List<OnMoveHandler> handlers;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 public ThemeNavigationPanel() {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 this.handlers = new ArrayList<OnMoveHandler>();
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 setWidth100();
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 setHeight(BUTTON_HEIGHT);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 setMargin(PANEL_MARGIN);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 HLayout layout = new HLayout();
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 layout.setWidth100();
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 layout.setHeight(BUTTON_HEIGHT);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 layout.setMembersMargin(BUTTON_MARGIN);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
47 Canvas cu = createButton(MSG.theme_top(), OnMoveEvent.TOP);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
48 Canvas u = createButton(MSG.theme_up(), OnMoveEvent.UP);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
49 Canvas d = createButton(MSG.theme_down(), OnMoveEvent.DOWN);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
50 Canvas cd = createButton(MSG.theme_bottom(), OnMoveEvent.BOTTOM);
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 layout.addMember(cu);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 layout.addMember(u);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 layout.addMember(d);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 layout.addMember(cd);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 addChild(layout);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
61 protected Canvas createButton(final String title, final int moveType) {
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
62 String url = GWT.getHostPageBaseURL() + title;
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
63
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
64 ImgButton b = new ImgButton();
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
65 b.setSrc(url);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
66 b.setHeight(BUTTON_HEIGHT);
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 b.setWidth(40);
532
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
68 b.setIconHeight(BUTTON_HEIGHT-10);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
69 b.setShowDown(false);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
70 b.setShowRollOver(false);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
71 b.setShowDisabled(false);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
72 b.setShowDisabledIcon(true);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
73 b.setShowDownIcon(false);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
74 b.setShowFocusedIcon(false);
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
75 b.setBackgroundColor("f2f2f2");
0ba7c43e7b62 Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 527
diff changeset
76 b.setBorder("1px solid #A6ABB4");
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 b.addClickHandler(new ClickHandler() {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 public void onClick(ClickEvent event) {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 fireOnMoveEvent(moveType);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 });
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 return b;
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 protected void addOnMoveHandler(OnMoveHandler handler) {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 if (handler != null) {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 handlers.add(handler);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 protected void fireOnMoveEvent(int type) {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 OnMoveEvent event = new OnMoveEvent(type);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 for (OnMoveHandler handler: handlers) {
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 handler.onMove(event);
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 }
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org