Search in sources :

Example 31 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ObjectSelectionPanel method initLayout.

public void initLayout(PageBase pageBase) {
    Form searchForm = new Form(ID_SEARCH_FORM);
    searchForm.setOutputMarkupId(true);
    add(searchForm);
    searchForm.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return context.isSearchEnabled();
        }
    });
    BasicSearchPanel<ObjectSearchDto> basicSearch = new BasicSearchPanel<ObjectSearchDto>(ID_BASIC_SEARCH) {

        @Override
        protected IModel<String> createSearchTextModel() {
            return new PropertyModel<>(searchModel, ObjectSearchDto.F_SEARCH_TEXT);
        }

        @Override
        protected void searchPerformed(AjaxRequestTarget target) {
            ObjectSelectionPanel.this.searchPerformed(target);
        }

        @Override
        protected void clearSearchPerformed(AjaxRequestTarget target) {
            ObjectSelectionPanel.this.clearSearchPerformed(target);
        }
    };
    searchForm.add(basicSearch);
    add(context.createExtraContentContainer(ID_EXTRA_CONTENT_CONTAINER, this));
    List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
    ObjectDataProvider provider = new ObjectDataProvider(pageBase, this.objectType);
    provider.setQuery(context.getDataProviderQuery());
    provider.setOptions(context.getDataProviderOptions());
    TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
    table.setOutputMarkupId(true);
    addOrReplace(table);
    AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("chooseTypeDialog.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            modalWindow.close(ajaxRequestTarget);
        }
    };
    add(cancelButton);
}
Also used : ObjectSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto) Form(org.apache.wicket.markup.html.form.Form) PropertyModel(org.apache.wicket.model.PropertyModel) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) BasicSearchPanel(com.evolveum.midpoint.web.component.BasicSearchPanel) 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 32 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ObjectSelectionPanel method initColumns.

private List<IColumn<SelectableBean<ObjectType>, String>> initColumns() {
    List<IColumn<SelectableBean<ObjectType>, String>> columns = new ArrayList<>();
    IColumn column = new LinkColumn<SelectableBean<ObjectType>>(createStringResource("chooseTypeDialog.column.name"), context.getSortableProperty(), "value.name") {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ObjectType>> rowModel) {
            ObjectType object = rowModel.getObject().getValue();
            context.chooseOperationPerformed(target, object);
        }
    };
    columns.add(column);
    return columns;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) IModel(org.apache.wicket.model.IModel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn)

Example 33 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ObjectHistoryTabPanel method initLayout.

private void initLayout(final LoadableModel<ObjectWrapper<F>> focusWrapperModel, final PageAdminObjectDetails<F> page) {
    AuditSearchDto searchDto = new AuditSearchDto();
    ObjectReferenceType ort = new ObjectReferenceType();
    ort.setOid(focusWrapperModel.getObject().getOid());
    searchDto.setTargetNames(asList(ort));
    searchDto.setEventStage(AuditEventStageType.EXECUTION);
    Map<String, Boolean> visibilityMap = new HashMap<>();
    visibilityMap.put(AuditLogViewerPanel.TARGET_NAME_LABEL_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.TARGET_NAME_FIELD_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.TARGET_OWNER_LABEL_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.TARGET_OWNER_FIELD_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.EVENT_STAGE_LABEL_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.EVENT_STAGE_FIELD_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.EVENT_STAGE_COLUMN_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.TARGET_COLUMN_VISIBILITY, false);
    visibilityMap.put(AuditLogViewerPanel.TARGET_OWNER_COLUMN_VISIBILITY, false);
    AuditLogViewerPanel panel = new AuditLogViewerPanel(ID_MAIN_PANEL, page, searchDto, visibilityMap) {

        @Override
        protected List<IColumn<AuditEventRecordType, String>> initColumns() {
            List<IColumn<AuditEventRecordType, String>> columns = super.initColumns();
            IColumn<AuditEventRecordType, String> column = new MultiButtonColumn<AuditEventRecordType>(new Model(), 2) {

                private final DoubleButtonColumn.BUTTON_COLOR_CLASS[] colors = { DoubleButtonColumn.BUTTON_COLOR_CLASS.INFO, DoubleButtonColumn.BUTTON_COLOR_CLASS.SUCCESS };

                @Override
                public String getCaption(int id) {
                    return "";
                }

                @Override
                public String getButtonTitle(int id) {
                    switch(id) {
                        case 0:
                            return page.createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectDataTitle").getString();
                        case 1:
                            return page.createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectXmlTitle").getString();
                    }
                    return "";
                }

                @Override
                public String getButtonColorCssClass(int id) {
                    return colors[id].toString();
                }

                @Override
                protected String getButtonCssClass(int id) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(DoubleButtonColumn.BUTTON_BASE_CLASS).append(" ");
                    sb.append(getButtonColorCssClass(id)).append(" ");
                    switch(id) {
                        case 0:
                            sb.append("fa fa-circle-o");
                            break;
                        case 1:
                            sb.append("fa fa-file-text-o");
                            break;
                    }
                    return sb.toString();
                }

                @Override
                public void clickPerformed(int id, AjaxRequestTarget target, IModel<AuditEventRecordType> model) {
                    switch(id) {
                        case 0:
                            currentStateButtonClicked(target, focusWrapperModel.getObject().getOid(), model.getObject().getEventIdentifier(), WebComponentUtil.getLocalizedDate(model.getObject().getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE), page.getCompileTimeClass());
                            break;
                        case 1:
                            viewObjectXmlButtonClicked(focusWrapperModel.getObject().getOid(), model.getObject().getEventIdentifier(), page.getCompileTimeClass(), WebComponentUtil.getLocalizedDate(model.getObject().getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE));
                            break;
                    }
                }
            };
            columns.add(column);
            return columns;
        }
    };
    panel.setOutputMarkupId(true);
    add(panel);
}
Also used : IModel(org.apache.wicket.model.IModel) HashMap(java.util.HashMap) AuditSearchDto(com.evolveum.midpoint.web.page.admin.reports.dto.AuditSearchDto) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) AuditLogViewerPanel(com.evolveum.midpoint.web.page.admin.reports.component.AuditLogViewerPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) DoubleButtonColumn(com.evolveum.midpoint.web.component.data.column.DoubleButtonColumn) MultiButtonColumn(com.evolveum.midpoint.web.component.data.column.MultiButtonColumn)

Example 34 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class SubtasksPanel method initLayout.

private void initLayout(boolean workflowsEnabled) {
    List<IColumn<TaskDto, String>> columns = new ArrayList<IColumn<TaskDto, String>>();
    columns.add(PageTasks.createTaskNameColumn(this, "SubtasksPanel.label.name"));
    columns.add(PageTasks.createTaskCategoryColumn(this, "SubtasksPanel.label.category"));
    columns.add(PageTasks.createTaskExecutionStatusColumn(this, "SubtasksPanel.label.executionState"));
    columns.add(PageTasks.createTaskResultStatusColumn(this, "SubtasksPanel.label.result"));
    //columns.add(PageTasks.createTaskDetailColumn(this, "SubtasksPanel.label.detail", workflowsEnabled));
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    add(new TablePanel<TaskDto>(ID_SUBTASKS_TABLE, provider, columns));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 35 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class AbstractRoleMemberPanel method createMembersColumns.

protected List<IColumn<SelectableBean<ObjectType>, String>> createMembersColumns() {
    List<IColumn<SelectableBean<ObjectType>, String>> columns = new ArrayList<>();
    IColumn<SelectableBean<ObjectType>, String> column = new AbstractExportableColumn<SelectableBean<ObjectType>, String>(createStringResource("TreeTablePanel.fullName.displayName")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ObjectType>>> cellItem, String componentId, IModel<SelectableBean<ObjectType>> rowModel) {
            SelectableBean<ObjectType> bean = rowModel.getObject();
            ObjectType object = bean.getValue();
            cellItem.add(new Label(componentId, getMemberObjectDisplayName(object)));
        }

        @Override
        public IModel<String> getDataModel(IModel<SelectableBean<ObjectType>> rowModel) {
            return Model.of(getMemberObjectDisplayName(rowModel.getObject().getValue()));
        }
    };
    columns.add(column);
    column = new AbstractExportableColumn<SelectableBean<ObjectType>, String>(createStringResource("TreeTablePanel.identifier.description")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ObjectType>>> cellItem, String componentId, IModel<SelectableBean<ObjectType>> rowModel) {
            SelectableBean<ObjectType> bean = rowModel.getObject();
            ObjectType object = bean.getValue();
            cellItem.add(new Label(componentId, getMemberObjectIdentifier(object)));
        }

        @Override
        public IModel<String> getDataModel(IModel<SelectableBean<ObjectType>> rowModel) {
            return Model.of(getMemberObjectIdentifier(rowModel.getObject().getValue()));
        }
    };
    columns.add(column);
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) AbstractExportableColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.export.AbstractExportableColumn) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Aggregations

IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)58 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)34 ArrayList (java.util.ArrayList)33 IModel (org.apache.wicket.model.IModel)28 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)21 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)19 Label (org.apache.wicket.markup.html.basic.Label)19 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)14 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)13 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)13 Model (org.apache.wicket.model.Model)12 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)9 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)8 Item (org.apache.wicket.markup.repeater.Item)8 PropertyModel (org.apache.wicket.model.PropertyModel)8 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)7 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)7 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)7 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)7 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)6