Search in sources :

Example 6 with ListModel

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);
}
Also used : QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) QName(javax.xml.namespace.QName) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) ListModel(org.apache.wicket.model.util.ListModel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

ListModel (org.apache.wicket.model.util.ListModel)6 ArrayList (java.util.ArrayList)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 QNameChoiceRenderer (com.evolveum.midpoint.web.component.input.QNameChoiceRenderer)2 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)2 List (java.util.List)2 QName (javax.xml.namespace.QName)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)2 Form (org.apache.wicket.markup.html.form.Form)2 IModel (org.apache.wicket.model.IModel)2 Model (org.apache.wicket.model.Model)2 ItemPathDto (com.evolveum.midpoint.gui.api.component.path.ItemPathDto)1 ItemPathPanel (com.evolveum.midpoint.gui.api.component.path.ItemPathPanel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 CanonicalItemPath (com.evolveum.midpoint.prism.path.CanonicalItemPath)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1