Search in sources :

Example 26 with SelectableBean

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

the class FocusHistoryPanel method initLayout.

protected void initLayout() {
    AuditLogViewerPanel panel = new AuditLogViewerPanel(ID_MAIN_PANEL) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<IColumn<SelectableBean<AuditEventRecordType>, String>> createColumns() {
            List<IColumn<SelectableBean<AuditEventRecordType>, String>> columns = super.createColumns();
            IColumn<SelectableBean<AuditEventRecordType>, String> column = new AbstractColumn<SelectableBean<AuditEventRecordType>, String>(new Model<>()) {

                private static final long serialVersionUID = 1L;

                @Override
                public void populateItem(Item<ICellPopulator<SelectableBean<AuditEventRecordType>>> cellItem, String componentId, IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                    cellItem.add(new MultiButtonPanel<SelectableBean<AuditEventRecordType>>(componentId, rowModel, 2) {

                        private static final long serialVersionUID = 1L;

                        @Override
                        protected Component createButton(int index, String componentId, IModel<SelectableBean<AuditEventRecordType>> model) {
                            AjaxIconButton btn = null;
                            switch(index) {
                                case 0:
                                    btn = buildDefaultButton(componentId, new Model<>("fa fa-circle-o"), createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectDataTitle"), new Model<>("btn btn-sm " + DoubleButtonColumn.ButtonColorClass.INFO), target -> currentStateButtonClicked(target, getReconstructedObject(getObjectWrapper().getOid(), unwrapModel(model).getEventIdentifier(), getObjectWrapper().getCompileTimeClass()), WebComponentUtil.getLocalizedDate(unwrapModel(model).getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE)));
                                    break;
                                case 1:
                                    btn = buildDefaultButton(componentId, new Model<>(GuiStyleConstants.CLASS_FILE_TEXT), createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectXmlTitle"), new Model<>("btn btn-sm " + DoubleButtonColumn.ButtonColorClass.SUCCESS), target -> viewObjectXmlButtonClicked(getObjectWrapper().getOid(), unwrapModel(model).getEventIdentifier(), getObjectWrapper().getCompileTimeClass(), WebComponentUtil.getLocalizedDate(unwrapModel(model).getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE)));
                                    break;
                            }
                            return btn;
                        }
                    });
                }
            };
            columns.add(column);
            return columns;
        }

        @Override
        protected ObjectQuery getCustomizeContentQuery() {
            return getPageBase().getPrismContext().queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_TARGET_REF).ref(getObjectWrapper().getOid()).and().item(AuditEventRecordType.F_EVENT_STAGE).eq(AuditEventStageType.EXECUTION).build();
        }

        @Override
        protected String getAuditStorageKey(String collectionNameValue) {
            if (StringUtils.isNotEmpty(collectionNameValue)) {
                return SessionStorage.KEY_OBJECT_HISTORY_AUDIT_LOG + "." + collectionNameValue + "." + getObjectWrapper().getTypeName().getLocalPart();
            }
            return SessionStorage.KEY_OBJECT_HISTORY_AUDIT_LOG + "." + getObjectWrapper().getTypeName().getLocalPart();
        }

        @Override
        protected boolean isObjectHistoryPanel() {
            return true;
        }
    };
    panel.setOutputMarkupId(true);
    add(panel);
}
Also used : IModel(org.apache.wicket.model.IModel) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) Item(org.apache.wicket.markup.repeater.Item) 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) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton) Component(org.apache.wicket.Component) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent)

Example 27 with SelectableBean

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

the class PageMessageTemplates method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<MessageTemplateType> table = new MainObjectListPanel<>(ID_TABLE, MessageTemplateType.class) {

        @Override
        protected TableId getTableId() {
            return TableId.TABLE_MESSAGE_TEMPLATES;
        }

        @Override
        protected IColumn<SelectableBean<MessageTemplateType>, String> createCheckboxColumn() {
            return null;
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MessageTemplateType(com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTemplateType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm)

Example 28 with SelectableBean

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

the class ObjectHistoryTabPanel method initLayout.

private void initLayout() {
    AuditLogViewerPanel panel = new AuditLogViewerPanel(ID_MAIN_PANEL) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<IColumn<SelectableBean<AuditEventRecordType>, String>> createColumns() {
            List<IColumn<SelectableBean<AuditEventRecordType>, String>> columns = super.createColumns();
            IColumn<SelectableBean<AuditEventRecordType>, String> column = new AbstractColumn<SelectableBean<AuditEventRecordType>, String>(new Model<>()) {

                private static final long serialVersionUID = 1L;

                @Override
                public void populateItem(Item<ICellPopulator<SelectableBean<AuditEventRecordType>>> cellItem, String componentId, IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                    cellItem.add(new MultiButtonPanel<SelectableBean<AuditEventRecordType>>(componentId, rowModel, 2) {

                        private static final long serialVersionUID = 1L;

                        @Override
                        protected Component createButton(int index, String componentId, IModel<SelectableBean<AuditEventRecordType>> model) {
                            AjaxIconButton btn = null;
                            switch(index) {
                                case 0:
                                    btn = buildDefaultButton(componentId, new Model<>("fa fa-circle-o"), createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectDataTitle"), new Model<>("btn btn-sm " + DoubleButtonColumn.ButtonColorClass.INFO), target -> currentStateButtonClicked(target, getReconstructedObject(getObjectWrapper().getOid(), unwrapModel(model).getEventIdentifier(), getObjectWrapper().getCompileTimeClass()), WebComponentUtil.getLocalizedDate(unwrapModel(model).getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE)));
                                    break;
                                case 1:
                                    btn = buildDefaultButton(componentId, new Model<>(GuiStyleConstants.CLASS_FILE_TEXT), createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectXmlTitle"), new Model<>("btn btn-sm " + DoubleButtonColumn.ButtonColorClass.SUCCESS), target -> viewObjectXmlButtonClicked(getObjectWrapper().getOid(), unwrapModel(model).getEventIdentifier(), getObjectWrapper().getCompileTimeClass(), WebComponentUtil.getLocalizedDate(unwrapModel(model).getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE)));
                                    break;
                            }
                            return btn;
                        }
                    });
                }
            };
            columns.add(column);
            return columns;
        }

        @Override
        protected ObjectQuery getCustomizeContentQuery() {
            return getPageBase().getPrismContext().queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_TARGET_REF).ref(getObjectWrapper().getOid()).and().item(AuditEventRecordType.F_EVENT_STAGE).eq(AuditEventStageType.EXECUTION).build();
        }

        @Override
        protected String getAuditStorageKey(String collectionNameValue) {
            if (StringUtils.isNotEmpty(collectionNameValue)) {
                return SessionStorage.KEY_OBJECT_HISTORY_AUDIT_LOG + "." + collectionNameValue + "." + getObjectWrapper().getTypeName().getLocalPart();
            }
            return SessionStorage.KEY_OBJECT_HISTORY_AUDIT_LOG + "." + getObjectWrapper().getTypeName().getLocalPart();
        }

        @Override
        protected boolean isObjectHistoryPanel() {
            return true;
        }
    };
    panel.setOutputMarkupId(true);
    add(panel);
}
Also used : IModel(org.apache.wicket.model.IModel) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) Item(org.apache.wicket.markup.repeater.Item) 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) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton) Component(org.apache.wicket.Component) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent)

Example 29 with SelectableBean

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

the class PageArchetypes method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<ArchetypeType> table = new MainObjectListPanel<ArchetypeType>(ID_TABLE, ArchetypeType.class) {

        @Override
        protected TableId getTableId() {
            return UserProfileStorage.TableId.TABLE_ARCHETYPES;
        }

        @Override
        protected IColumn<SelectableBean<ArchetypeType>, String> createCheckboxColumn() {
            return null;
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) ArchetypeType(com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm)

Example 30 with SelectableBean

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

the class PageAttorneySelection method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    ObjectListPanel<UserType> table = new ObjectListPanel<>(ID_TABLE, UserType.class, Collections.emptyList()) {

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.PAGE_USER_SELECTION;
        }

        @Override
        protected IColumn<SelectableBean<UserType>, String> createCheckboxColumn() {
            return null;
        }

        @Override
        protected IColumn<SelectableBean<UserType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
            return new ObjectNameColumn<>(createStringResource("ObjectType.name")) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target, IModel<SelectableBean<UserType>> rowModel) {
                    UserType object = rowModel.getObject().getValue();
                    selectUserPerformed(object.getOid());
                }
            };
        }

        @Override
        protected List<IColumn<SelectableBean<UserType>, String>> createDefaultColumns() {
            List<IColumn<SelectableBean<UserType>, String>> columns = new ArrayList<>();
            columns.add(createNameColumn(null, null, null, null));
            columns.addAll(PageAttorneySelection.this.initColumns());
            return columns;
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return null;
        }

        @Override
        protected ISelectableDataProvider<UserType, SelectableBean<UserType>> createProvider() {
            return createSelectableBeanObjectDataProvider(() -> getAttorneySelectionQuery(), null);
        }
    };
    table.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_USER_BOX_CSS_CLASSES);
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : IModel(org.apache.wicket.model.IModel) GuiObjectColumnType(com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType) ObjectNameColumn(com.evolveum.midpoint.web.component.data.column.ObjectNameColumn) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ObjectListPanel(com.evolveum.midpoint.gui.api.component.ObjectListPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ExpressionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)39 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)37 IModel (org.apache.wicket.model.IModel)37 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)32 ArrayList (java.util.ArrayList)31 Label (org.apache.wicket.markup.html.basic.Label)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)16 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)15 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)14 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)12 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)12 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)12 Item (org.apache.wicket.markup.repeater.Item)11 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)9 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 List (java.util.List)8 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)7