attributeTO.setReadonly(attributeSchema.isReadonly());
}
}
final AjaxTextFieldPanel panel;
final MultiFieldPanel multiPanel;
if (templateMode) {
panel = new AjaxTextFieldPanel("values", "values", new Model<String>());
panel.setReadOnly(attributeTO.isReadonly());
multiPanel = null;
} else {
panel = new AjaxTextFieldPanel("panel", "values", new Model<String>(null));
panel.setReadOnly(attributeTO.isReadonly());
multiPanel = new MultiFieldPanel("values",
new PropertyModel<List<String>>(attributeTO, "values"), panel);
}
final DropDownChoice<String> schemaChoice = new DropDownChoice<String>("schema",
new PropertyModel<String>(attributeTO, "schema"), virSchemas,
new ChoiceRenderer<String>() {
private static final long serialVersionUID = 3109256773218160485L;
@Override
public Object getDisplayValue(final String object) {
final StringBuilder text = new StringBuilder(object);
if (templateMode) {
text.append(" (JEXL)");
}
return text.toString();
}
});
schemaChoice.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_BLUR) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
attributeTO.setSchema(schemaChoice.getModelObject());
VirSchemaTO virSchema = schemas.get(attributeTO.getSchema());
if (virSchema != null) {
attributeTO.setReadonly(virSchema.isReadonly());
panel.setReadOnly(attributeTO.isReadonly());
}
if (multiPanel != null) {
multiPanel.getView().setEnabled(false);
}
}
});
schemaChoice.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {