Search in sources :

Example 16 with OnChangeAjaxBehavior

use of org.apache.wicket.ajax.form.OnChangeAjaxBehavior 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

AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)16 OnChangeAjaxBehavior (org.apache.wicket.ajax.form.OnChangeAjaxBehavior)16 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)10 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)6 QName (javax.xml.namespace.QName)6 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)6 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)4 ArrayList (java.util.ArrayList)4 Label (org.apache.wicket.markup.html.basic.Label)4 Form (org.apache.wicket.markup.html.form.Form)4 QNameChoiceRenderer (com.evolveum.midpoint.web.component.input.QNameChoiceRenderer)3 StringResourceChoiceRenderer (com.evolveum.midpoint.web.util.StringResourceChoiceRenderer)3 List (java.util.List)3 AutoCompleteTextField (org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField)3 AceEditor (com.evolveum.midpoint.web.component.AceEditor)2 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)2 DropDownFormGroup (com.evolveum.midpoint.web.component.form.DropDownFormGroup)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 CheckBox (org.apache.wicket.markup.html.form.CheckBox)2