comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MinMaxState.java @ 2205:a22e0cb6eace

Format the timerange (static ui) inserted in the 'historical discharge curves' calculation. flys-artifacts/trunk@3829 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 30 Jan 2012 13:29:07 +0000
parents d1660809daab
children ee5310134463
comparison
equal deleted inserted replaced
2204:45f7762767e2 2205:a22e0cb6eace
55 select.appendChild(max); 55 select.appendChild(max);
56 } 56 }
57 57
58 58
59 /** 59 /**
60 * @param cc
61 * @param name
62 * @param value
63 * @param type
64 *
65 * @return
66 */
67 @Override
68 protected String getLabelFor(
69 CallContext cc,
70 String name,
71 String value,
72 String type
73 ) {
74 if (type.indexOf("range") > 0) {
75 String[] minmax = extractRangeAsString(value);
76
77 if (minmax != null) {
78 return minmax[0] + " - " + minmax[1];
79 }
80 }
81
82 return super.getLabelFor(cc, name, value, type);
83 }
84
85
86 /**
87 * Returns a string array with [min,max] from <i>rawValue</i>.
88 * <i>rawValue</i> should be a string like "1999;2001".
89 *
90 * @param rawValue A string with min and max separated by a ';'.
91 *
92 * @return the min and max as string array ([min,max]).
93 */
94 protected String[] extractRangeAsString(String rawValue) {
95 return rawValue.split(";");
96 }
97
98
99 /**
60 * This method returns the default values for min and max. If the static 100 * This method returns the default values for min and max. If the static
61 * field DefaultState.USE_DEFAULTS is set, the minimum and maximum inserted 101 * field DefaultState.USE_DEFAULTS is set, the minimum and maximum inserted
62 * by the user is returned as string. Otherwise, the absolute minimum and 102 * by the user is returned as string. Otherwise, the absolute minimum and
63 * maximum are returned. 103 * maximum are returned.
64 * 104 *
98 return null; 138 return null;
99 } 139 }
100 140
101 logger.debug("Raw value for '" + name + "' = " + rawValue); 141 logger.debug("Raw value for '" + name + "' = " + rawValue);
102 142
103 return rawValue.split(";"); 143 return extractRangeAsString(rawValue);
104 } 144 }
105 145
106 146
107 /** 147 /**
108 * Returns a string array with absolute minimum and maximum as [min,max]. 148 * Returns a string array with absolute minimum and maximum as [min,max].

http://dive4elements.wald.intevation.org