Search in sources :

Example 1 with MessagePanel

use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.

the class AssignmentPopup method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    Form form = new Form(ID_FORM);
    form.setOutputMarkupId(true);
    add(form);
    MultiCompositedButtonPanel newObjectIcon = new MultiCompositedButtonPanel(ID_COMPOSITED_BUTTONS, createNewButtonDescriptionModel()) {

        @Override
        protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
            Form form = (Form) AssignmentPopup.this.get(ID_FORM);
            AssignmentPopup.this.getModelObject().setSelectionVisible(false);
            addOrReplaceTabPanels(form, relationSpec);
            target.add(form);
        }
    };
    form.add(newObjectIcon);
    newObjectIcon.add(new VisibleBehaviour(() -> getModelObject() != null && getModelObject().isSelectionVisible()));
    addOrReplaceTabPanels(form, null);
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    add(warningMessage);
    form.add(createCancelButton());
    form.add(createAddButton());
    form.add(createBackButton());
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WebPage(org.apache.wicket.markup.html.WebPage) Form(org.apache.wicket.markup.html.form.Form) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) MultiCompositedButtonPanel(com.evolveum.midpoint.web.component.MultiCompositedButtonPanel) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 2 with MessagePanel

use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.

the class ChooseFocusTypeAndRelationDialogPanel method initLayout.

private void initLayout() {
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_FEEDBACK, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    add(warningMessage);
    DropDownFormGroup<QName> type = new DropDownFormGroup<>(ID_OBJECT_TYPE, Model.of(getDefaultObjectType()), Model.ofList(getSupportedObjectTypes()), new QNameObjectTypeChoiceRenderer(), createStringResource("chooseFocusTypeAndRelationDialogPanel.type"), "chooseFocusTypeAndRelationDialogPanel.tooltip.type", "col-md-4", "col-md-8", true);
    type.getInput().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    type.setOutputMarkupId(true);
    type.add(new VisibleBehaviour(this::isFocusTypeSelectorVisible));
    add(type);
    IModel<Map<String, String>> options = new Model(null);
    options.setObject(new HashMap<>());
    ListMultipleChoicePanel<QName> relation = new ListMultipleChoicePanel<>(ID_RELATION, Model.ofList(getDefaultRelations()), new ListModel<>(getSupportedRelations()), WebComponentUtil.getRelationChoicesRenderer(getPageBase()), options);
    relation.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    relation.setOutputMarkupId(true);
    add(relation);
    WebMarkupContainer relationRequired = new WebMarkupContainer(ID_RELATION_REQUIRED);
    relationRequired.add(new VisibleBehaviour((this::isRelationRequired)));
    add(relationRequired);
    Label label = new Label(ID_INFO_MESSAGE, getModel());
    label.add(new VisibleBehaviour(() -> getModel() != null && getModelObject() != null));
    add(label);
    AjaxButton confirmButton = new AjaxButton(ID_BUTTON_OK, createStringResource("Button.ok")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            DropDownFormGroup<QName> type = getTypePanel(getParent());
            QName typeChosen = type.getModelObject();
            ListMultipleChoicePanel<QName> relation = getRelationPanel(getParent());
            Collection<QName> relationChosen = relation.getModelObject();
            if (relationChosen.contains(PrismConstants.Q_ANY)) {
                relationChosen = getSupportedRelations();
            }
            ChooseFocusTypeAndRelationDialogPanel.this.okPerformed(typeChosen, relationChosen, target);
            getPageBase().hideMainPopup(target);
        }
    };
    add(confirmButton);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_OK, createStringResource("Button.cancel")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
        }
    };
    add(cancelButton);
    AjaxButton configuredButton = new AjaxButton(ID_CONFIGURE_TASK, new StringResourceModel("ConfigureTaskConfirmationPanel.configure", this, null)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            DropDownFormGroup<QName> type = getTypePanel(getParent());
            QName typeChosen = type.getModelObject();
            ListMultipleChoicePanel<QName> relation = getRelationPanel(getParent());
            Collection<QName> relationChosen = relation.getModelObject();
            PrismObject<TaskType> task = getTask(typeChosen, relationChosen, target);
            if (task == null) {
                return;
            }
            ((PageBase) getPage()).hideMainPopup(target);
            WebComponentUtil.dispatchToObjectDetailsPage(task, true, ChooseFocusTypeAndRelationDialogPanel.this);
        }
    };
    configuredButton.add(new VisibleBehaviour(this::isTaskConfigureButtonVisible));
    add(configuredButton);
}
Also used : DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) Label(org.apache.wicket.markup.html.basic.Label) ListMultipleChoicePanel(com.evolveum.midpoint.web.component.input.ListMultipleChoicePanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) StringResourceModel(org.apache.wicket.model.StringResourceModel) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) StringResourceModel(org.apache.wicket.model.StringResourceModel) QNameObjectTypeChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameObjectTypeChoiceRenderer)

Example 3 with MessagePanel

use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.

the class ExportingPanel method initLayout.

private void initLayout() {
    MidpointForm form = new MidpointForm<>(ID_MAIN_FORM, true);
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    form.add(warningMessage);
    FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
    feedbackList.setOutputMarkupId(true);
    feedbackList.setOutputMarkupPlaceholderTag(true);
    form.add(feedbackList);
    TextPanel<String> nameField = new TextPanel<>(ID_NAME, nameModel);
    form.add(nameField);
    BoxedTablePanel<SelectableBean<Integer>> table = createTable(ID_TABLE, dataTable);
    form.add(table);
    AjaxSubmitButton exportSelected = new AjaxSubmitButton(ID_EXPORT, getPageBase().createStringResource("ExportingPopupPanel.exportSelected")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            performSelectedColumns(table);
            if (exportedColumnsIndex.isEmpty()) {
                LOGGER.warn("None columns selected");
                getPageBase().warn(getPageBase().createStringResource("ExportingPanel.message.error.selectColumn").getString());
                target.add(feedbackList);
                return;
            }
            ((PageBase) getPage()).hideMainPopup(target);
            exportPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    form.add(exportSelected);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL, new StringResourceModel("Button.cancel", this, null)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    form.add(cancelButton);
    add(form);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 4 with MessagePanel

use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.

the class AbstractPageObjectDetails method initMainPanel.

private void initMainPanel(ContainerPanelConfigurationType panelConfig, MidpointForm form) {
    if (panelConfig == null) {
        WebMarkupContainer panel = new MessagePanel(ID_MAIN_PANEL, MessagePanel.MessagePanelType.WARN, createStringResource("AbstractPageObjectDetails.noPanels"), false);
        panel.add(AttributeAppender.append("style", "margin-top: 20px;"));
        form.addOrReplace(panel);
        return;
    }
    getSessionStorage().setObjectDetailsStorage("details" + getType().getSimpleName(), panelConfig);
    String panelType = panelConfig.getPanelType();
    if (panelType == null) {
        return;
    }
    Class<? extends Panel> panelClass = findObjectPanel(panelConfig.getPanelType());
    Panel panel = WebComponentUtil.createPanel(panelClass, ID_MAIN_PANEL, objectDetailsModels, panelConfig);
    form.addOrReplace(panel);
}
Also used : MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) DetailsNavigationPanel(com.evolveum.midpoint.gui.impl.component.menu.DetailsNavigationPanel) Panel(org.apache.wicket.markup.html.panel.Panel) OperationalButtonsPanel(com.evolveum.midpoint.gui.impl.page.admin.component.OperationalButtonsPanel) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 5 with MessagePanel

use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.

the class ObjectBrowserPanel method initLayout.

private void initLayout() {
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    add(warningMessage);
    List<ObjectTypes> supported = new ArrayList<>();
    for (QName qname : supportedTypes) {
        supported.add(ObjectTypes.getObjectTypeFromTypeQName(qname));
    }
    WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_PANEL);
    typePanel.setOutputMarkupId(true);
    typePanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return supportedTypes.size() != 1;
        }
    });
    add(typePanel);
    DropDownChoice<ObjectTypes> typeSelect = new DropDownChoice<>(ID_TYPE, typeModel, new ListModel<>(supported), new EnumChoiceRenderer<>(this));
    typeSelect.add(new OnChangeAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            ObjectListPanel<O> listPanel = (ObjectListPanel<O>) get(ID_TABLE);
            listPanel = createObjectListPanel(typeModel.getObject(), multiselect);
            addOrReplace(listPanel);
            target.add(listPanel);
        }
    });
    typePanel.add(typeSelect);
    ObjectTypes objType = defaultType != null ? ObjectTypes.getObjectType(defaultType) : null;
    ObjectListPanel<O> listPanel = createObjectListPanel(objType, multiselect);
    add(listPanel);
    AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.addButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<O> selected = ((PopupObjectListPanel) getParent().get(ID_TABLE)).getSelectedRealObjects();
            ObjectTypes type = ObjectBrowserPanel.this.typeModel.getObject();
            QName qname = type != null ? type.getTypeQName() : null;
            ObjectBrowserPanel.this.addPerformed(target, qname, selected);
        }
    };
    addButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

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

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            getPageBase().hideMainPopup(ajaxRequestTarget);
        }
    };
    add(cancelButton);
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

MessagePanel (com.evolveum.midpoint.gui.api.component.result.MessagePanel)5 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)2 QName (javax.xml.namespace.QName)2 StringResourceModel (org.apache.wicket.model.StringResourceModel)2 DetailsNavigationPanel (com.evolveum.midpoint.gui.impl.component.menu.DetailsNavigationPanel)1 OperationalButtonsPanel (com.evolveum.midpoint.gui.impl.page.admin.component.OperationalButtonsPanel)1 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)1 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)1 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)1 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)1 MultiCompositedButtonPanel (com.evolveum.midpoint.web.component.MultiCompositedButtonPanel)1 DropDownFormGroup (com.evolveum.midpoint.web.component.form.DropDownFormGroup)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 ListMultipleChoicePanel (com.evolveum.midpoint.web.component.input.ListMultipleChoicePanel)1 QNameObjectTypeChoiceRenderer (com.evolveum.midpoint.web.component.input.QNameObjectTypeChoiceRenderer)1 TextPanel (com.evolveum.midpoint.web.component.input.TextPanel)1