# HG changeset patch # User Björn Ricks # Date 1351247161 -7200 # Node ID cde9a6fe18448035b05ce674ef82aadbcf27d99f # Parent 0c766c475805d9de2dd4aad86616d8e57c315997 Refactor ParameterList to use new InfoPanel base class By using the base class it will be possible to show either a gauge info or a measurement station info with only small adjustments. diff -r 0c766c475805 -r cde9a6fe1844 flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Fri Oct 26 12:22:06 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Fri Oct 26 12:26:01 2012 +0200 @@ -112,7 +112,7 @@ protected VLayout report; protected VLayout helperPanel; protected VLayout tablePanel; - protected GaugePanel gaugePanel; + protected InfoPanel infoPanel; protected Canvas reportPanel; private SectionStack stack; @@ -752,17 +752,11 @@ } } if (art instanceof WINFOArtifact) { - String river = desc.getRiver(); - - if (river != null) { - renderGaugeInfo(desc.getRiver(), desc.getOldData()); - } - else { - hideGaugePanel(); - } + createGaugePanel(); + renderInfo(desc.getRiver(), desc.getOldData()); } else { - removeGaugePanel(); + removeInfoPanel(); } addOldDatas( @@ -944,49 +938,51 @@ private void createGaugePanel() { GWT.log("ParameterList - createGaugePanel"); - if (gaugePanel == null) { - gaugePanel = new GaugePanel(flys); - gaugePanel.setWidth100(); - gaugePanel.setHeight100(); + if (infoPanel == null) { + infoPanel = new GaugePanel(flys); + infoPanel.setWidth100(); + infoPanel.setHeight100(); } } - private void addGaugePanel() { - GWT.log("ParameterList - addGaugePanel"); - createGaugePanel(); - stack.addSection(gaugePanel.getSection(), 0); + private void showInfoPanel() { + GWT.log("ParameterList - showInfoPanel"); + + /* Don't add InfoPanel twice */ + SectionStackSection exists = stack.getSection(InfoPanel.SECTION_ID); + if (exists == null) { + stack.addSection(infoPanel.getSection(), 0); + } + + infoPanel.show(); } - private void showGaugePanel() { - GWT.log("ParameterList - showGaugePanel"); + private void hideInfoPanel() { + GWT.log("ParameterList - hideInfoPanel"); - /* Don't add GaugePanel twice */ - SectionStackSection exists = stack.getSection(GaugePanel.SECTION_ID); - if (exists == null) { - addGaugePanel(); - } - - gaugePanel.show(); - } - - private void hideGaugePanel() { - GWT.log("ParameterList - hideGaugePanel"); - - if (gaugePanel != null) { - gaugePanel.hide(); + if (infoPanel != null) { + infoPanel.hide(); } } - private void removeGaugePanel() { - GWT.log("ParameterList - removeGaugePanel"); - stack.removeSection(GaugePanel.SECTION_ID); + private void removeInfoPanel() { + GWT.log("ParameterList - removeInfoPanel"); + stack.removeSection(InfoPanel.SECTION_ID); } - private void renderGaugeInfo(String river, DataList[] data) { - showGaugePanel(); - gaugePanel.setRiver(river); - gaugePanel.setData(data); + private void renderInfo(String river, DataList[] data) { + GWT.log("ParameterList - renderInfo"); + + if (river != null) { + showInfoPanel(); + infoPanel.setRiver(river); + infoPanel.setData(data); + } + else { + GWT.log("ParameterList - renderInfo no river"); + hideInfoPanel(); + } } }