Search in sources :

Example 21 with ListDataProvider

use of com.evolveum.midpoint.web.component.util.ListDataProvider 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 22 with ListDataProvider

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

the class JasperReportConfigurationPanel method initParametersTable.

private void initParametersTable() {
    ISortableDataProvider<JasperReportParameterDto, String> provider = new ListDataProvider<JasperReportParameterDto>(this, new PropertyModel<List<JasperReportParameterDto>>(getModel(), "jasperReportDto.parameters"));
    BoxedTablePanel<JasperReportParameterDto> table = new BoxedTablePanel<>(ID_PARAMETERS_TABLE, provider, initParameterColumns(), null, 10);
    //		table.setShowPaging(false);
    table.setOutputMarkupId(true);
    add(table);
    AjaxButton addParameter = new AjaxButton(ID_BUTTON_ADD_PARAMETER, createStringResource("JasperReportConfigurationPanel.addParameter")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            addParameterPerformed(target);
        }
    };
    add(addParameter);
    AjaxButton deleteParameter = new AjaxButton(ID_DELETE_PARAMETER, createStringResource("JasperReportConfigurationPanel.deleteParameter")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            deleteParameterPerformed(target);
        }
    };
    add(deleteParameter);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ArrayList(java.util.ArrayList) List(java.util.List) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) JasperReportParameterDto(com.evolveum.midpoint.web.page.admin.reports.dto.JasperReportParameterDto)

Aggregations

ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)22 ArrayList (java.util.ArrayList)15 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)15 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)12 List (java.util.List)11 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)11 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)8 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)8 Label (org.apache.wicket.markup.html.basic.Label)8 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)7 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)6 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)5 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)5 ISortableDataProvider (org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider)5 Item (org.apache.wicket.markup.repeater.Item)5 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)4 DataView (org.apache.wicket.markup.repeater.data.DataView)4 IModel (org.apache.wicket.model.IModel)4 PropertyModel (org.apache.wicket.model.PropertyModel)4 NavigatorPanel (com.evolveum.midpoint.web.component.data.paging.NavigatorPanel)3