}
public void beginRender(MarkupWriter writer)
{
JSONArray selectedValues = new JSONArray();
for (OptionModel selected : selectedOptions)
{
Object value = selected.getValue();
String clientValue = encoder.toClient(value);
selectedValues.put(clientValue);
}
String clientId = getClientId();
writer.element("Select",
"multiple","multiple",
"id", clientId,
"class", CSSClassConstants.INVISIBLE,
"name", getControlName());
for(Object object: getSelected())
{
OptionModel model = valueToOptionModel.get(object);
writer.element("Option",
"value",model.getValue(),
"selected", "selected");
writer.write(model.getLabel());
writer.end();
}
writer.end();
String script = "new Tapestry.DgDpPalette('%s', %s)";
JSONArray array = new JSONArray();
for(OptionModel option : model.getOptions())
{
array.put(option.getValue() + "-" + getClientId() + "-option");
}
javascriptSupport.addScript(script,clientId, array);
}