Revision 3363
Added by barteau over 17 years ago
src/edu/ucsb/nceas/metacat/clientview/ClientHtmlHelper.java | ||
---|---|---|
34 | 34 |
* @return String, XHTML for a SELECT statement. |
35 | 35 |
*/ |
36 | 36 |
public static String mapToHtmlSelect(Map map, String name, String style, int size) { |
37 |
String result = "", item, key, optGrp; |
|
37 |
String result = "", item, key, optGrp, tmp;
|
|
38 | 38 |
Iterator iterIt; |
39 | 39 |
Object obj; |
40 | 40 |
Vector vector; |
... | ... | |
46 | 46 |
obj = map.get(key); |
47 | 47 |
if (obj instanceof String) { |
48 | 48 |
item = (String) obj; |
49 |
item = String.format(OPTION_TEMPLATE, key, item); |
|
49 |
tmp = OPTION_TEMPLATE.replaceFirst("%1$s", key); |
|
50 |
item = tmp.replaceFirst("%2$s", item); |
|
50 | 51 |
result += item; |
51 | 52 |
} else if (obj instanceof Vector) { |
52 | 53 |
vector = (Vector) obj; |
... | ... | |
54 | 55 |
completeIterIt = vector.iterator(); |
55 | 56 |
while (completeIterIt.hasNext()) { |
56 | 57 |
item = (String) completeIterIt.next(); |
57 |
item = String.format(OPTION_TEMPLATE, item, item); |
|
58 |
tmp = OPTION_TEMPLATE.replaceFirst("%1$s", item); |
|
59 |
item = tmp.replaceFirst("%2$s", item); |
|
58 | 60 |
optGrp += item; |
59 | 61 |
} |
60 |
item = String.format(OPTGRP_TEMPLATE, key, optGrp); |
|
62 |
tmp = OPTGRP_TEMPLATE.replaceFirst("%1$s", key); |
|
63 |
item = tmp.replaceFirst("%2$s", optGrp); |
|
61 | 64 |
result += item; |
62 | 65 |
} |
63 | 66 |
} |
64 |
result = String.format(SELECT_TEMPLATE, name, style, size, result); |
|
67 |
tmp = SELECT_TEMPLATE.replaceFirst("%1$s", name); |
|
68 |
tmp = tmp.replaceFirst("%2$s", style); |
|
69 |
tmp = tmp.replaceFirst("%3$s", String.valueOf(size)); |
|
70 |
result = tmp.replaceFirst("%4$s", result); |
|
65 | 71 |
return(result); |
66 | 72 |
} |
67 | 73 |
|
Also available in: Unified diff
Removed "Formatter" usage, to make java 1.4 compatible.