Search in sources :

Example 51 with AjaxButton

use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.

the class AssignmentPreviewDialog method initLayout.

public void initLayout() {
    List<IColumn<AssignmentsPreviewDto, String>> columns = initColumns();
    ListDataProvider provider = new ListDataProvider(pageBase, data);
    WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
    content.setOutputMarkupId(true);
    add(content);
    TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
    table.setOutputMarkupId(true);
    content.add(table);
    AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.selectButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<AssignmentsPreviewDto> previewDtos = data.getObject();
            List<AssignmentsPreviewDto> selectedDtos = new ArrayList<>();
            for (AssignmentsPreviewDto dto : previewDtos) {
                if (dto.isSelected()) {
                    selectedDtos.add(dto);
                }
            }
            AssignmentPreviewDialog.this.addButtonClicked(target, selectedDtos);
        }
    };
    addButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return multiselect;
        }
    });
    content.add(addButton);
    AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("AssignmentPreviewDialog.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            ((PageBase) getPage()).hideMainPopup(ajaxRequestTarget);
        }
    };
    content.add(cancelButton);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) ArrayList(java.util.ArrayList) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 52 with AjaxButton

use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.

the class OrgUnitAddDeletePopup method setState.

public void setState(ActionState state, AjaxRequestTarget target) {
    this.state = state;
    AjaxButton actionButton = (AjaxButton) getContent().get(ID_BUTTON_ACTION);
    actionButton.setModel(createActionButtonStringResource());
    actionButton.add(new AttributeAppender("class", getActionButtonClass()));
    target.add(actionButton);
    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
    provider.setQuery(getDataProviderQuery());
    target.add(panel);
}
Also used : DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 53 with AjaxButton

use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.

the class MergeObjectsPanel method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    DropDownChoicePanel mergeTypeSelect = new DropDownChoicePanel(ID_MERGE_TYPE_SELECTOR, mergeTypeModel, mergeTypeChoicesModel);
    mergeTypeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            mergeResultObject = getMergeObjectsResult();
            WebMarkupContainer resultObjectPanel = (WebMarkupContainer) get(ID_FORM).get(ID_OBJECTS_PANEL).get(ID_MERGE_RESULT_PANEL_CONTAINER);
            resultObjectPanel.addOrReplace(getMergeResultObjectPanel());
            target.add(resultObjectPanel);
        }
    });
    mergeTypeSelect.setOutputMarkupId(true);
    mainForm.add(mergeTypeSelect);
    final WebMarkupContainer objectsPanel = new WebMarkupContainer(ID_OBJECTS_PANEL);
    objectsPanel.setOutputMarkupId(true);
    mainForm.addOrReplace(objectsPanel);
    initObjectsPanel(objectsPanel);
    AjaxButton switchDirectionButton = new AjaxButton(ID_SWITCH_DIRECTION_BUTTON, pageBase.createStringResource("MergeObjectsPanel.switchDirection")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            F temp = mergeObjectModel.getObject();
            mergeObjectModel.setObject(mergeWithObjectModel.getObject());
            mergeWithObjectModel.setObject(temp);
            initObjectsPanel(objectsPanel);
            ajaxRequestTarget.add(objectsPanel);
        }
    };
    switchDirectionButton.setOutputMarkupId(true);
    mainForm.add(switchDirectionButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Form(com.evolveum.midpoint.web.component.form.Form) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 54 with AjaxButton

use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.

the class DoubleButtonPanel method initLayout.

private void initLayout() {
    AjaxButton firstButton = new AjaxButton(ID_BUTTON_FIRST, createButtonStringResource(getFirstCaption())) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            firstPerformed(target, DoubleButtonPanel.this.getModel());
        }

        @Override
        public boolean isEnabled() {
            return isFirstEnabled(DoubleButtonPanel.this.getModel());
        }
    };
    firstButton.add(new AttributeAppender("class", getFirstCssClass()));
    AjaxButton secondButton = new AjaxButton(ID_BUTTON_SECOND, createButtonStringResource(getSecondCaption())) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            secondPerformed(target, DoubleButtonPanel.this.getModel());
        }

        @Override
        public boolean isEnabled() {
            return isSecondEnabled(DoubleButtonPanel.this.getModel());
        }
    };
    secondButton.add(new AttributeAppender("class", getSecondCssClass()));
    add(firstButton);
    add(secondButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 55 with AjaxButton

use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.

the class SchemaStep method initLayout.

private void initLayout() {
    List<ITab> tabs = new ArrayList<>();
    tabs.add(createSimpleSchemaView());
    tabs.add(createSchemaEditor());
    TabbedPanel<ITab> tabPanel = new TabbedPanel<>(ID_TAB_PANEL, tabs);
    tabPanel.setOutputMarkupId(true);
    add(tabPanel);
    AjaxButton reload = new AjaxButton(ID_RELOAD, createStringModel("SchemaStep.button.reload")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            reloadPerformed(target);
        }
    };
    add(reload);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ArrayList(java.util.ArrayList) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Aggregations

AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)67 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)65 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)26 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)20 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)18 Form (org.apache.wicket.markup.html.form.Form)13 Label (org.apache.wicket.markup.html.basic.Label)12 ArrayList (java.util.ArrayList)11 List (java.util.List)10 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)7 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)7 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)7 Form (com.evolveum.midpoint.web.component.form.Form)6 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)6 AjaxRequestAttributes (org.apache.wicket.ajax.attributes.AjaxRequestAttributes)4 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)4 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)4 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)4 TextArea (org.apache.wicket.markup.html.form.TextArea)4 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)3