String sizeUnits = new ProcessUtil(getDataContext()).getSizeUnits();
SortedMap<String, SizePerItemTable> tables = SizePerItemTable
.getDefinedTables(getDataRepository(), sizeUnits);
for (Entry<String, SizePerItemTable> e : tables.entrySet()) {
String sizePerItemTableName = e.getKey();
SizePerItemTable sizePerItemTable = e.getValue();
String valuePrefix = getCategoryValuePrefix(sizePerItemTableName);
options.append("<optgroup label=\"")
.append(esc(sizePerItemTableName)).append("\">\n");
for (String category : sizePerItemTable.getCategoryNames()) {
String fullCat = valuePrefix + category;
options.append("<option value=\"").append(esc(fullCat))
.append("\">").append(esc(category)).append("\n");
for (RelativeSize relSize : RelativeSize.values()) {
sizeData.append('"')
.append(StringUtils.javaEncode(fullCat))
.append("/").append(REL_SIZE_NAMES[relSize.ordinal()])
.append("\" : ")
.append(sizePerItemTable.getSize(category, relSize))
.append(",\n");
}
}
options.append("</optgroup>\n");