Mercurial > dive4elements > river
changeset 7933:900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 17 Jun 2014 09:45:48 +0200 |
parents | b1393f96c153 |
children | 71a2e408adca |
files | gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeInfoPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java |
diffstat | 3 files changed, 65 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Fri Jun 13 16:34:29 2014 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Tue Jun 17 09:45:48 2014 +0200 @@ -10,12 +10,11 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; - -import java.util.Iterator; +import com.smartgwt.client.widgets.layout.HLayout; import org.dive4elements.river.client.client.Config; import org.dive4elements.river.client.client.FLYS; @@ -26,7 +25,7 @@ * Panel to display information about a river. * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> */ -public class RiverInfoPanel extends HorizontalPanel { +public class RiverInfoPanel extends HLayout { /** The flys instance */ protected FLYS flys; @@ -43,9 +42,9 @@ this.flys = flys; setStyleName("riverinfopanel"); - setHeight("" + HEIGHT + "px"); - setVerticalAlignment(ALIGN_MIDDLE); - + setHeight(HEIGHT + "px"); + setAlign(VerticalAlignment.CENTER); + setAlign(Alignment.LEFT); setRiverInfo(riverinfo); } @@ -54,7 +53,7 @@ NumberFormat nf = NumberFormat.getDecimalFormat(); - removeAllLabels(); + //removeAllLabels(); addLabel(riverinfo.getName(), false); @@ -101,7 +100,8 @@ DynamicForm infoLink = WikiLinks.linkDynamicForm(this.flys, wikiBaseUrl + url, MSG.gauge_river_info_link()); infoLink.setTop(5); - add(infoLink); + infoLink.setMargin(5); + addMember(infoLink); } public static int getStaticHeight() { @@ -112,21 +112,9 @@ } private void addLabel(String text, boolean wordwrap) { - Label label = new Label(text, wordwrap); - add(label); - setCellHeight(label, "" + HEIGHT + "px"); - } - - private void removeAllLabels() { - GWT.log("RiverInfoPanel - removeAllLabels"); - - Iterator<Widget> it = this.iterator(); - while(it.hasNext()) { - it.next(); - it.remove(); - } - /* for (Widget wid: this) { */ - /* this.remove(wid); */ - /* } */ + Label label = new Label("<span style='font-size:1.3em'>" + text + "</span>"); + label.setWrap(wordwrap); + label.setMargin(5); + addMember(label); } }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeInfoPanel.java Fri Jun 13 16:34:29 2014 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeInfoPanel.java Tue Jun 17 09:45:48 2014 +0200 @@ -9,10 +9,11 @@ package org.dive4elements.river.client.client.ui.stationinfo; import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.events.ClickEvent; +import com.smartgwt.client.widgets.form.fields.events.ClickHandler; +import com.smartgwt.client.widgets.form.fields.LinkItem; import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.ui.Anchor; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.Label; @@ -83,7 +84,9 @@ } HLayout line5 = new HLayout(); - line5.addMember(new GaugeMainValueAnchor(flys, gauge)); + DynamicForm line5Form = new DynamicForm(); + line5Form.setItems(new GaugeMainValueAnchor(flys, gauge)); + line5.addMember(line5Form); if (minw != null && maxw != null) { grid.addMember(line1); @@ -105,16 +108,17 @@ * Clickable anchor that asks application to show window with * main values for gauge. */ - class GaugeMainValueAnchor extends Anchor implements ClickHandler { + class GaugeMainValueAnchor extends LinkItem implements ClickHandler { private FLYS flys; private GaugeInfo gauge; public GaugeMainValueAnchor(FLYS flys, GaugeInfo gauge) { - super(MSG.show_mainvalues()); + super(); + this.setLinkTitle(MSG.show_mainvalues()); + this.setShowTitle(false); this.flys = flys; this.gauge = gauge; - this.setHeight("5"); addClickHandler(this); }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java Fri Jun 13 16:34:29 2014 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java Tue Jun 17 09:45:48 2014 +0200 @@ -13,7 +13,8 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; -import com.google.gwt.user.client.ui.Grid; +import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import org.dive4elements.river.client.client.FLYSConstants; @@ -28,39 +29,64 @@ setStyleName("infopanel"); setWidth100(); - Grid grid = new Grid(5, 2); + VLayout grid = new VLayout(); + HLayout line1 = new HLayout(); String type = station.getMeasurementType(); if (type != null) { - grid.setText(0, 0, MSG.measurement_station_type()); - grid.setText(0, 1, type); + Label key = new Label(MSG.measurement_station_type()); + Label value = new Label(type); + key.setWidth(150); + line1.addMember(key); + line1.addMember(value); + grid.addMember(line1); } + HLayout line2 = new HLayout(); String riverside = station.getRiverSide(); if (riverside != null) { - grid.setText(1, 0, MSG.riverside()); - grid.setText(1, 1, riverside); + Label key = new Label(MSG.riverside()); + Label value = new Label(riverside); + key.setWidth(150); + line2.addMember(key); + line2.addMember(value); + grid.addMember(line2); } + HLayout line3 = new HLayout(); String gaugename = station.getGaugeName(); if (gaugename != null) { - grid.setText(2, 0, MSG.measurement_station_gauge_name()); - grid.setText(2, 1, gaugename); + Label key = new Label(MSG.measurement_station_gauge_name()); + Label value = new Label(gaugename); + key.setWidth(150); + line3.addMember(key); + line3.addMember(value); + grid.addMember(line3); } + HLayout line4 = new HLayout(); DateTimeFormat df = DateTimeFormat.getFormat( - PredefinedFormat.DATE_MEDIUM); + PredefinedFormat.DATE_MEDIUM); Date starttime = station.getStartTime(); if (starttime != null) { - grid.setText(3, 0, MSG.measurement_station_start_time()); - grid.setText(3, 1, df.format(starttime)); + Label key = new Label(MSG.measurement_station_start_time()); + Label value = new Label(df.format(starttime)); + key.setWidth(150); + line4.addMember(key); + line4.addMember(value); + grid.addMember(line4); } + HLayout line5 = new HLayout(); String moperator = station.getOperator(); if (moperator != null) { - grid.setText(4, 0, MSG.measurement_station_operator()); - grid.setText(4, 1, moperator); + Label key = new Label(MSG.measurement_station_operator()); + Label value = new Label(moperator); + key.setWidth(150); + line5.addMember(key); + line5.addMember(value); + grid.addMember(line5); } addMember(grid);