diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java @ 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 720c5bbe2a16
children 5e38e2924c07
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);
     }
 }

http://dive4elements.wald.intevation.org