Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 4270:cde9a6fe1844
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.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 26 Oct 2012 12:26:01 +0200 |
parents | 33b15ac17fd1 |
children | 6c776f102e03 |
comparison
equal
deleted
inserted
replaced
4269:0c766c475805 | 4270:cde9a6fe1844 |
---|---|
110 protected VLayout currentItems; | 110 protected VLayout currentItems; |
111 protected VLayout exportModes; | 111 protected VLayout exportModes; |
112 protected VLayout report; | 112 protected VLayout report; |
113 protected VLayout helperPanel; | 113 protected VLayout helperPanel; |
114 protected VLayout tablePanel; | 114 protected VLayout tablePanel; |
115 protected GaugePanel gaugePanel; | 115 protected InfoPanel infoPanel; |
116 protected Canvas reportPanel; | 116 protected Canvas reportPanel; |
117 | 117 |
118 private SectionStack stack; | 118 private SectionStack stack; |
119 | 119 |
120 public ParameterList(FLYS flys, CollectionView cView, String title) { | 120 public ParameterList(FLYS flys, CollectionView cView, String title) { |
750 // we have reached a final state with no more user input | 750 // we have reached a final state with no more user input |
751 setCurrentData(null, null); | 751 setCurrentData(null, null); |
752 } | 752 } |
753 } | 753 } |
754 if (art instanceof WINFOArtifact) { | 754 if (art instanceof WINFOArtifact) { |
755 String river = desc.getRiver(); | 755 createGaugePanel(); |
756 | 756 renderInfo(desc.getRiver(), desc.getOldData()); |
757 if (river != null) { | |
758 renderGaugeInfo(desc.getRiver(), desc.getOldData()); | |
759 } | |
760 else { | |
761 hideGaugePanel(); | |
762 } | |
763 } | 757 } |
764 else { | 758 else { |
765 removeGaugePanel(); | 759 removeInfoPanel(); |
766 } | 760 } |
767 | 761 |
768 addOldDatas( | 762 addOldDatas( |
769 desc.getOldData(), | 763 desc.getOldData(), |
770 event.getType() == ParameterChangeEvent.Type.BACK); | 764 event.getType() == ParameterChangeEvent.Type.BACK); |
942 } | 936 } |
943 | 937 |
944 | 938 |
945 private void createGaugePanel() { | 939 private void createGaugePanel() { |
946 GWT.log("ParameterList - createGaugePanel"); | 940 GWT.log("ParameterList - createGaugePanel"); |
947 if (gaugePanel == null) { | 941 if (infoPanel == null) { |
948 gaugePanel = new GaugePanel(flys); | 942 infoPanel = new GaugePanel(flys); |
949 gaugePanel.setWidth100(); | 943 infoPanel.setWidth100(); |
950 gaugePanel.setHeight100(); | 944 infoPanel.setHeight100(); |
951 } | 945 } |
952 } | 946 } |
953 | 947 |
954 private void addGaugePanel() { | 948 private void showInfoPanel() { |
955 GWT.log("ParameterList - addGaugePanel"); | 949 GWT.log("ParameterList - showInfoPanel"); |
956 createGaugePanel(); | 950 |
957 stack.addSection(gaugePanel.getSection(), 0); | 951 /* Don't add InfoPanel twice */ |
958 } | 952 SectionStackSection exists = stack.getSection(InfoPanel.SECTION_ID); |
959 | |
960 private void showGaugePanel() { | |
961 GWT.log("ParameterList - showGaugePanel"); | |
962 | |
963 /* Don't add GaugePanel twice */ | |
964 SectionStackSection exists = stack.getSection(GaugePanel.SECTION_ID); | |
965 if (exists == null) { | 953 if (exists == null) { |
966 addGaugePanel(); | 954 stack.addSection(infoPanel.getSection(), 0); |
967 } | 955 } |
968 | 956 |
969 gaugePanel.show(); | 957 infoPanel.show(); |
970 } | 958 } |
971 | 959 |
972 private void hideGaugePanel() { | 960 private void hideInfoPanel() { |
973 GWT.log("ParameterList - hideGaugePanel"); | 961 GWT.log("ParameterList - hideInfoPanel"); |
974 | 962 |
975 if (gaugePanel != null) { | 963 if (infoPanel != null) { |
976 gaugePanel.hide(); | 964 infoPanel.hide(); |
977 } | 965 } |
978 } | 966 } |
979 | 967 |
980 private void removeGaugePanel() { | 968 private void removeInfoPanel() { |
981 GWT.log("ParameterList - removeGaugePanel"); | 969 GWT.log("ParameterList - removeInfoPanel"); |
982 stack.removeSection(GaugePanel.SECTION_ID); | 970 stack.removeSection(InfoPanel.SECTION_ID); |
983 } | 971 } |
984 | 972 |
985 | 973 |
986 private void renderGaugeInfo(String river, DataList[] data) { | 974 private void renderInfo(String river, DataList[] data) { |
987 showGaugePanel(); | 975 GWT.log("ParameterList - renderInfo"); |
988 gaugePanel.setRiver(river); | 976 |
989 gaugePanel.setData(data); | 977 if (river != null) { |
978 showInfoPanel(); | |
979 infoPanel.setRiver(river); | |
980 infoPanel.setData(data); | |
981 } | |
982 else { | |
983 GWT.log("ParameterList - renderInfo no river"); | |
984 hideInfoPanel(); | |
985 } | |
990 } | 986 } |
991 | 987 |
992 } | 988 } |
993 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 989 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |