Search in sources :

Example 6 with AjaxIconButton

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

the class TaskOperationalButtonsPanel method createResumeButton.

private void createResumeButton(RepeatingView repeatingView) {
    AjaxIconButton resume = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.CLASS_RESUME_MENU_ITEM), createStringResource("pageTaskEdit.button.resume")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            resumePerformed(target, getPrismObject());
        }
    };
    resume.showTitleAsLabel(true);
    resume.add(AttributeAppender.append("class", "btn-primary"));
    resume.add(new VisibleBehaviour(() -> WebComponentUtil.canResumeTask(getObjectType(), getPageBase())));
    repeatingView.add(resume);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton)

Example 7 with AjaxIconButton

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

the class FocusOperationalButtonsPanel method createPreviewButton.

private void createPreviewButton(RepeatingView repeatingView) {
    AjaxIconButton preview = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_PREVIEW), getPageBase().createStringResource("pageAdminFocus.button.previewChanges")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            previewPerformed(ajaxRequestTarget);
        }
    };
    preview.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_PREVIEW_CHANGES_URL) && !getModelObject().isReadOnly();
        }

        @Override
        public boolean isEnabled() {
            return isSavePreviewButtonEnabled();
        }
    });
    preview.showTitleAsLabel(true);
    preview.add(AttributeAppender.append("class", "btn btn-info btn-sm"));
    repeatingView.add(preview);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 8 with AjaxIconButton

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

the class ResourceOperationalButtonsPanel method initResourceButtons.

private void initResourceButtons(RepeatingView resourceButtons) {
    AjaxIconButton test = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM), createStringResource("pageResource.button.test")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            testConnectionPerformed(target);
        }
    };
    test.showTitleAsLabel(true);
    test.add(new VisibleBehaviour(() -> isEditingObject()));
    test.add(AttributeAppender.append("class", "btn-default btn-sm"));
    resourceButtons.add(test);
    AjaxIconButton setMaintenance = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_RESOURCE_MAINTENANCE), createStringResource("pageResource.button.toggleMaintenance")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            WebComponentUtil.toggleResourceMaintenance(getPrismObject(), OPERATION_SET_MAINTENANCE, target, getPageBase());
            refreshStatus(target);
        }
    };
    setMaintenance.showTitleAsLabel(true);
    setMaintenance.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isEditingObject() && canEdit(getObjectType());
        }
    });
    setMaintenance.add(AttributeAppender.append("class", "btn-default btn-sm"));
    resourceButtons.add(setMaintenance);
    AjaxIconButton refreshSchema = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_RESOURCE_SCHEMA), createStringResource("pageResource.button.refreshSchema")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            WebComponentUtil.refreshResourceSchema(getPrismObject(), OPERATION_REFRESH_SCHEMA, target, getPageBase());
        }
    };
    refreshSchema.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isVisibleRefresSchemaButton(getObjectType());
        }
    });
    refreshSchema.showTitleAsLabel(true);
    refreshSchema.add(AttributeAppender.append("class", "btn-default btn-sm"));
    resourceButtons.add(refreshSchema);
    AjaxIconButton wizardShow = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_WIZARD), createStringResource("pageResource.button.wizardShow")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            startWizard(false, true);
        }
    };
    wizardShow.showTitleAsLabel(true);
    wizardShow.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isEditingObject() && canEdit(getObjectType());
        }
    });
    wizardShow.add(AttributeAppender.append("class", "btn-default btn-sm"));
    resourceButtons.add(wizardShow);
    AjaxIconButton wizardEdit = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_WIZARD), createStringResource("pageResource.button.wizardEdit")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            startWizard(false, false);
        }
    };
    wizardEdit.showTitleAsLabel(true);
    wizardEdit.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isEditingObject() && canEdit(getObjectType());
        }
    });
    wizardEdit.add(AttributeAppender.append("class", "btn-default btn-sm"));
    resourceButtons.add(wizardEdit);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 9 with AjaxIconButton

use of com.evolveum.midpoint.web.component.AjaxIconButton 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 10 with AjaxIconButton

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

the class OperationalButtonsPanel method createBackButton.

private void createBackButton(RepeatingView repeatingView) {
    AjaxIconButton back = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.ARROW_LEFT), getPageBase().createStringResource("pageAdminFocus.button.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            backPerformed(ajaxRequestTarget);
        }
    };
    back.showTitleAsLabel(true);
    back.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
    repeatingView.add(back);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton)

Aggregations

AjaxIconButton (com.evolveum.midpoint.web.component.AjaxIconButton)31 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)27 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)11 Component (org.apache.wicket.Component)9 IModel (org.apache.wicket.model.IModel)9 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)7 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)6 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)5 ArrayList (java.util.ArrayList)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)4 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)3 List (java.util.List)3 AbstractColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)3 Item (org.apache.wicket.markup.repeater.Item)3 ChooseMemberPopup (com.evolveum.midpoint.gui.api.component.ChooseMemberPopup)2 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)2 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)2 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2