diff flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java @ 4202:1fa244f70ad5

Move RiverInfoPanel to its own java file in refactor it Allow to change the riverinfo without having to create a new instace of the RiverInfoPanel.
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 22 Oct 2012 15:23:00 +0200
parents 9be8d7942284
children de795c13dcfb
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Mon Oct 22 15:20:33 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Mon Oct 22 15:23:00 2012 +0200
@@ -142,70 +142,4 @@
         GWT.log("GaugePanel - show");
         this.sectionStack.setHidden(false);
     }
-
-    class RiverInfoPanel extends HorizontalPanel {
-
-        public final static int HEIGHT = 30;
-        public final static int BORDER_WIDTH = 3;
-        public final static int PADDING = 8;
-        public final static int MARGIN = 10;
-
-        public RiverInfoPanel(RiverInfo riverinfo) {
-            setStyleName("riverinfopanel");
-            setHeight("" + HEIGHT + "px");
-            setVerticalAlignment(ALIGN_MIDDLE);
-
-            NumberFormat nf = NumberFormat.getDecimalFormat();
-
-            addLabel(riverinfo.getName(), false);
-
-            String kmtext = "";
-            Double start = riverinfo.getKmStart();
-            Double end = riverinfo.getKmEnd();
-
-            if (!riverinfo.isKmUp()) {
-                Double tmp = end;
-                end = start;
-                start = tmp;
-            }
-            if (end != null) {
-                kmtext += nf.format(end);
-                kmtext += " - ";
-            }
-            if (start != null) {
-                kmtext += nf.format(start);
-            }
-            kmtext += " km";
-
-            addLabel(kmtext, false);
-
-            String qtext = "";
-            Double qmin = riverinfo.getMinQ();
-            Double qmax = riverinfo.getMaxQ();
-            if (qmin != null) {
-                qtext += nf.format(qmin);
-                qtext += " " + MSG.gauge_q_unit();
-                qtext += " - ";
-            }
-            if (qmax != null) {
-                qtext += nf.format(qmax);
-                qtext += " " + MSG.gauge_q_unit();
-            }
-
-            addLabel(qtext, false);
-
-            Long number = riverinfo.getOfficialNumber();
-            String url = number != null ?
-                MSG.gauge_river_url() + number :
-                MSG.gauge_river_url();
-            Anchor anchor = new Anchor(MSG.gauge_river_info_link(), url, "_blank");
-            add(anchor);
-        }
-
-        private void addLabel(String text, boolean wordwrap) {
-            Label label = new Label(text, wordwrap);
-            add(label);
-            setCellHeight(label, "" + HEIGHT + "px");
-        }
-    }
 }

http://dive4elements.wald.intevation.org