use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.
the class NameStep method createConnectorDropDown.
private DropDownFormGroup<PrismObject<ConnectorType>> createConnectorDropDown() {
return new DropDownFormGroup<PrismObject<ConnectorType>>(ID_CONNECTOR, selectedConnectorModel, relevantConnectorsModel, new IChoiceRenderer<PrismObject<ConnectorType>>() {
@Override
public PrismObject<ConnectorType> getObject(String id, IModel<? extends List<? extends PrismObject<ConnectorType>>> choices) {
return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
}
@Override
public Object getDisplayValue(PrismObject<ConnectorType> object) {
return WebComponentUtil.getName(object);
}
@Override
public String getIdValue(PrismObject<ConnectorType> object, int index) {
return Integer.toString(index);
}
}, createStringResource("NameStep.connectorType"), "col-md-3", "col-md-6", true) {
@Override
protected DropDownChoice<PrismObject<ConnectorType>> createDropDown(String id, IModel<List<PrismObject<ConnectorType>>> choices, IChoiceRenderer<PrismObject<ConnectorType>> renderer, boolean required) {
DropDownChoice<PrismObject<ConnectorType>> choice = super.createDropDown(id, choices, renderer, required);
choice.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(getConnectorDropDown().getAdditionalInfoComponent());
}
});
choice.setOutputMarkupId(true);
return choice;
}
@Override
protected Component createAdditionalInfoComponent(String id) {
Label l = new Label(id, schemaChangeWarningModel);
l.add(new AttributeAppender("class", "text-danger"));
l.setOutputMarkupId(true);
return l;
}
};
}
use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.
the class NameStep method createHostDropDown.
@NotNull
private DropDownFormGroup<PrismObject<ConnectorHostType>> createHostDropDown() {
return new DropDownFormGroup<PrismObject<ConnectorHostType>>(ID_CONNECTOR_HOST, selectedHostModel, allHostsModel, new IChoiceRenderer<PrismObject<ConnectorHostType>>() {
@Override
public PrismObject<ConnectorHostType> getObject(String id, IModel<? extends List<? extends PrismObject<ConnectorHostType>>> choices) {
if (StringUtils.isBlank(id)) {
return null;
}
return choices.getObject().get(Integer.parseInt(id));
}
@Override
public Object getDisplayValue(PrismObject<ConnectorHostType> object) {
if (object == null) {
return NameStep.this.getString("NameStep.hostNotUsed");
}
return ConnectorHostTypeComparator.getUserFriendlyName(object);
}
@Override
public String getIdValue(PrismObject<ConnectorHostType> object, int index) {
return Integer.toString(index);
}
}, createStringResource("NameStep.connectorHost"), "col-md-3", "col-md-6", false) {
@Override
protected DropDownChoice<PrismObject<ConnectorHostType>> createDropDown(String id, IModel<List<PrismObject<ConnectorHostType>>> choices, IChoiceRenderer<PrismObject<ConnectorHostType>> renderer, boolean required) {
DropDownChoice<PrismObject<ConnectorHostType>> choice = super.createDropDown(id, choices, renderer, required);
choice.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
discoverConnectorsPerformed(target);
}
});
return choice;
}
};
}
Aggregations