comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java @ 7934:71a2e408adca

Moved info stack section to top level widget (parameterlist).
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 17 Jun 2014 09:47:45 +0200
parents 165020640d7b
children 5e38e2924c07
comparison
equal deleted inserted replaced
7933:900299ab8e6e 7934:71a2e408adca
9 package org.dive4elements.river.client.client.ui.stationinfo; 9 package org.dive4elements.river.client.client.ui.stationinfo;
10 10
11 import com.google.gwt.core.client.GWT; 11 import com.google.gwt.core.client.GWT;
12 12
13 import com.smartgwt.client.types.Overflow; 13 import com.smartgwt.client.types.Overflow;
14 import com.smartgwt.client.widgets.Canvas;
15 import com.smartgwt.client.widgets.layout.SectionStackSection;
16 import com.smartgwt.client.widgets.layout.VLayout; 14 import com.smartgwt.client.widgets.layout.VLayout;
17 import org.dive4elements.river.client.client.FLYS; 15 import org.dive4elements.river.client.client.FLYS;
18 import org.dive4elements.river.client.client.FLYSConstants; 16 import org.dive4elements.river.client.client.FLYSConstants;
19 import org.dive4elements.river.client.client.services.RiverInfoService; 17 import org.dive4elements.river.client.client.services.RiverInfoService;
20 import org.dive4elements.river.client.client.services.RiverInfoServiceAsync; 18 import org.dive4elements.river.client.client.services.RiverInfoServiceAsync;
28 public abstract class InfoPanel extends VLayout { 26 public abstract class InfoPanel extends VLayout {
29 27
30 /** The instance of FLYS */ 28 /** The instance of FLYS */
31 protected FLYS flys; 29 protected FLYS flys;
32 30
33 /** SectionStackSection where this InfoPanel belongs in*/
34 protected SectionStackSection section;
35
36 /** Name of the river */ 31 /** Name of the river */
37 protected String river; 32 protected String river;
38 33
39 /** The message class that provides i18n strings.*/ 34 /** The message class that provides i18n strings.*/
40 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); 35 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
47 protected InfoListGrid listgrid; 42 protected InfoListGrid listgrid;
48 43
49 public final static String SECTION_ID = "InfoPanelSection"; 44 public final static String SECTION_ID = "InfoPanelSection";
50 45
51 public InfoPanel(FLYS flys, InfoListGrid listgrid) { 46 public InfoPanel(FLYS flys, InfoListGrid listgrid) {
52 SectionStackSection section = new SectionStackSection();
53 section.setExpanded(false);
54 section.setTitle(getSectionTitle());
55 section.setName(SECTION_ID);
56 section.setID(SECTION_ID);
57
58 setOverflow(Overflow.HIDDEN); 47 setOverflow(Overflow.HIDDEN);
59 setStyleName("infopanel"); 48 setStyleName("infopanel");
60 49
61 this.flys = flys; 50 this.flys = flys;
62 51
63 section.setHidden(true);
64 section.setItems(this);
65 this.section = section;
66 this.listgrid = listgrid; 52 this.listgrid = listgrid;
67 this.addMember(listgrid); 53 this.addMember(listgrid);
68 } 54 }
69 55
70 /** 56 /**
94 riverinfopanel.setRiverInfo(riverinfo); 80 riverinfopanel.setRiverInfo(riverinfo);
95 } 81 }
96 this.listgrid.setRiverInfo(riverinfo); 82 this.listgrid.setRiverInfo(riverinfo);
97 } 83 }
98 84
99 /**
100 * Hide the section stack section.
101 */
102 @Override
103 public void hide() {
104 GWT.log("InfoPanel - hide");
105 this.section.setHidden(true);
106 }
107
108 /**
109 * Show the section stack section.
110 */
111 @Override
112 public void show() {
113 GWT.log("InfoPanel - show");
114 this.section.setHidden(false);
115 }
116
117 @Override
118 public void addMember(Canvas component) {
119 super.addMember(component);
120 expand();
121 }
122
123 @Override
124 public void removeMembers(Canvas[] components) {
125 super.removeMembers(components);
126 contract();
127 }
128
129 public SectionStackSection getSection() {
130 return this.section;
131 }
132
133 protected void removeAllMembers() { 85 protected void removeAllMembers() {
134 removeMembers(getMembers()); 86 removeMembers(getMembers());
135 } 87 }
136 88
137 /**
138 * Expands the gauge section.
139 */
140 public void expand() {
141 section.setExpanded(true);
142 }
143
144 /**
145 * Contracts/shrinks the expanded gauge section.
146 */
147 public void contract() {
148 section.setExpanded(false);
149 }
150
151 protected abstract void refresh(); 89 protected abstract void refresh();
152 90
153 protected abstract String getSectionTitle(); 91 public abstract String getSectionTitle();
154 } 92 }

http://dive4elements.wald.intevation.org