Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/AbstractYearEpochUrlState.java @ 9559:ba0561906f81
Uinfo inundation duration workflow (vegetation zones, scenario), wms-config changed
author | gernotbelger |
---|---|
date | Wed, 24 Oct 2018 18:40:38 +0200 |
parents | 6dd539efebb1 |
children |
comparison
equal
deleted
inserted
replaced
9558:709a73badd48 | 9559:ba0561906f81 |
---|---|
38 */ | 38 */ |
39 public AbstractYearEpochUrlState(final YearType type) { | 39 public AbstractYearEpochUrlState(final YearType type) { |
40 this.type = type; | 40 this.type = type; |
41 } | 41 } |
42 | 42 |
43 protected abstract String getDatakey(); | |
44 | |
43 @Override | 45 @Override |
44 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { | 46 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { |
45 final String dataKey = "year_epoch_select"; | 47 final String dataKey = getDatakey(); |
46 try { | 48 try { |
47 if (dataKey.equals(name)) { | 49 if (dataKey.equals(name)) { |
48 | 50 |
49 final InundationDurationAccess access = new InundationDurationAccess((UINFOArtifact) artifact); | 51 final InundationDurationAccess access = new InundationDurationAccess((UINFOArtifact) artifact); |
50 final UedauernConfiguration properties = UedauernConfiguration.getInstance(access.getRiverName(), this.type); | 52 final UedauernConfiguration properties = UedauernConfiguration.getInstance(access.getRiverName(), this.type); |
52 | 54 |
53 final String columnType = "TEXT"; | 55 final String columnType = "TEXT"; |
54 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "select_key", context.getMeta()); // pinKeycolum; nicht zu | 56 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "select_key", context.getMeta()); // pinKeycolum; nicht zu |
55 | 57 |
56 helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); | 58 helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); |
57 helper.addColumn(1, "select_key", "240", yearOrEpoch(), columnType, "LEFT", null); | 59 helper.addColumn(1, "select_key", "240", getColumnHeader(), columnType, "LEFT", null); |
58 | 60 |
59 for (final String year : items) { | 61 for (final String year : items) { |
60 final Map<String, String> row = new HashMap<>(); | 62 final Map<String, String> row = new HashMap<>(); |
61 row.put("select_key", year); | 63 row.put("select_key", year); |
62 helper.addRow(row); | 64 helper.addRow(row); |
74 catch (final TsvReaderException e) { | 76 catch (final TsvReaderException e) { |
75 e.printStackTrace(); | 77 e.printStackTrace(); |
76 } | 78 } |
77 } | 79 } |
78 | 80 |
79 private String yearOrEpoch() { | 81 private String getColumnHeader() { |
82 switch (this.type) { | |
83 case szenario: | |
84 return "state.uinfo.inundation.scenario.table_header"; | |
85 default: | |
86 return getTypeString(); | |
87 | |
88 } | |
89 | |
90 } | |
91 | |
92 private String getTypeString() { | |
80 switch (this.type) { | 93 switch (this.type) { |
81 case jahre: | 94 case jahre: |
82 return "year"; | 95 return "year"; |
83 | 96 |
84 case mittel: | 97 case mittel: |
85 return "state.uinfo.epoch"; | 98 return "state.uinfo.epoch"; |
99 | |
100 case szenario: | |
101 return "state.uinfo.inundation.scenario"; | |
86 | 102 |
87 default: | 103 default: |
88 throw new IllegalStateException(); | 104 throw new IllegalStateException(); |
89 } | 105 } |
90 } | 106 } |
91 | 107 |
92 @Override | 108 @Override |
93 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { | 109 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { |
94 return ScenarioTypeState.changeHeaderForCurrentState(yearOrEpoch(), data.getName(), cr, context); | 110 return ScenarioTypeState.changeHeaderForCurrentState(getTypeString(), data.getName(), cr, context); |
95 } | 111 } |
96 } | 112 } |