use of org.apache.wicket.model.util.ListModel in project midpoint by Evolveum.
the class TypedAssignablePanel method initLayout.
private void initLayout(Class<T> type, final boolean multiselect) {
DropDownChoice<QName> typeSelect = new DropDownChoice(ID_TYPE, typeModel, new ListModel(WebComponentUtil.createAssignableTypesList()), new QNameChoiceRenderer());
typeSelect.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(get(ID_TABLES_CONTAINER));
target.add(addOrReplace(createCountContainer()));
}
});
typeSelect.setOutputMarkupId(true);
add(typeSelect);
WebMarkupContainer tablesContainer = new WebMarkupContainer(ID_TABLES_CONTAINER);
tablesContainer.setOutputMarkupId(true);
add(tablesContainer);
PopupObjectListPanel<T> listRolePanel = createObjectListPanel(ID_ROLE_TABLE, ID_SELECTED_ROLES, RoleType.COMPLEX_TYPE);
tablesContainer.add(listRolePanel);
PopupObjectListPanel<T> listResourcePanel = createObjectListPanel(ID_RESOURCE_TABLE, ID_SELECTED_RESOURCES, ResourceType.COMPLEX_TYPE);
tablesContainer.add(listResourcePanel);
PopupObjectListPanel<T> listOrgPanel = createObjectListPanel(ID_ORG_TABLE, ID_SELECTED_ORGS, OrgType.COMPLEX_TYPE);
tablesContainer.add(listOrgPanel);
PopupObjectListPanel<T> listServicePanel = createObjectListPanel(ID_SERVICE_TABLE, ID_SELECTED_SERVICES, ServiceType.COMPLEX_TYPE);
tablesContainer.add(listServicePanel);
WebMarkupContainer countContainer = createCountContainer();
add(countContainer);
AjaxButton addButton = new AjaxButton(ID_BUTTON_ASSIGN, createStringResource("userBrowserDialog.button.addButton")) {
@Override
public void onClick(AjaxRequestTarget target) {
List<T> selected = getSelectedData(ID_ROLE_TABLE);
selected.addAll(getSelectedData(ID_RESOURCE_TABLE));
selected.addAll(getSelectedData(ID_ORG_TABLE));
selected.addAll(getSelectedData(ID_SERVICE_TABLE));
TypedAssignablePanel.this.addPerformed(target, selected);
}
};
addButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return multiselect;
}
});
add(addButton);
}
Aggregations