Search in sources :

Example 36 with MidpointForm

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

the class PageObjectCollections method initLayout.

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

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

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            List<InlineMenuItem> menu = new ArrayList<>();
            menu.add(createDeleteInlineMenu());
            return menu;
        }

        @Override
        protected List<IColumn<SelectableBean<ObjectCollectionType>, String>> createDefaultColumns() {
            return ColumnUtils.getDefaultObjectColumns();
        }

        @Override
        protected String getNothingSelectedMessage() {
            return getString("pageObjectCollections.message.nothingSelected");
        }

        @Override
        protected String getConfirmMessageKeyForSingleObject() {
            return "pageObjectCollections.message.confirmationMessageForMultipleObject";
        }

        @Override
        protected String getConfirmMessageKeyForMultiObject() {
            return "pageObjectCollections.message.confirmationMessageForSingleObject";
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ObjectCollectionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectCollectionType)

Example 37 with MidpointForm

use of com.evolveum.midpoint.web.component.form.MidpointForm 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 38 with MidpointForm

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

the class PageResourceVisualization method initLayout.

private void initLayout() {
    MidpointForm<?> form = new MidpointForm<>(ID_FORM);
    add(form);
    WebMarkupContainer dotContainer = new WebMarkupContainer(ID_DOT_CONTAINER);
    dotContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visualizationModel.getObject().getSvg() == null;
        }
    });
    form.add(dotContainer);
    TextArea<String> dot = new TextArea<>(ID_DOT, new PropertyModel<>(visualizationModel, ResourceVisualizationDto.F_DOT));
    dotContainer.add(dot);
    Label error = new Label(ID_ERROR, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_EXCEPTION_AS_STRING));
    dotContainer.add(error);
    Label svg = new Label(ID_SVG, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_SVG));
    svg.setEscapeModelStrings(false);
    svg.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visualizationModel.getObject().getSvg() != null;
        }
    });
    form.add(svg);
    AjaxSubmitButton back = new AjaxSubmitButton(ID_BACK) {

        @Override
        public void onSubmit(AjaxRequestTarget ajaxRequestTarget) {
            redirectBack();
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getFeedbackPanel());
        }
    };
    form.add(back);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) TextArea(org.apache.wicket.markup.html.form.TextArea) Label(org.apache.wicket.markup.html.basic.Label) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 39 with MidpointForm

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

the class PageResources method initLayout.

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

        @Override
        protected void objectDetailsPerformed(AjaxRequestTarget target, ResourceType object) {
            clearSessionStorageForResourcePage();
            super.objectDetailsPerformed(target, object);
        }

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

        @Override
        protected List<IColumn<SelectableBean<ResourceType>, String>> createDefaultColumns() {
            return PageResources.this.initResourceColumns();
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return PageResources.this.createRowMenuItems();
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
    table.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_RESOURCE_BOX_CSS_CLASSES);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 40 with MidpointForm

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

the class RunReportPopupPanel method initLayout.

protected void initLayout() {
    Form<?> mainForm = new MidpointForm<>(ID_MAIN_FORM);
    add(mainForm);
    FeedbackAlerts feedback = new FeedbackAlerts(ID_POPUP_FEEDBACK);
    ReportObjectsListPanel table = new ReportObjectsListPanel(ID_TABLE, getModel()) {

        private final boolean checkViewAfterInitialize = true;

        @Override
        public Component getFeedbackPanel() {
            return feedback;
        }

        @Override
        protected boolean checkViewAfterInitialize() {
            if (checkViewAfterInitialize) {
                return true;
            }
            return super.checkViewAfterInitialize();
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
    feedback.setFilter(new ComponentFeedbackMessageFilter(table) {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean accept(FeedbackMessage message) {
            return true;
        }
    });
    feedback.setOutputMarkupId(true);
    mainForm.add(feedback);
    AjaxSubmitButton runButton = new AjaxSubmitButton(ID_RUN_BUTTON, createStringResource("runReportPopupContent.button.run")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target) {
            FeedbackAlerts feedback = (FeedbackAlerts) getForm().get(ID_POPUP_FEEDBACK);
            target.add(feedback);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            runConfirmPerformed(target);
        }
    };
    runButton.setOutputMarkupId(true);
    runButton.add(new VisibleBehaviour(() -> isRunnable));
    mainForm.add(runButton);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("userBrowserDialog.button.cancelButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
        }
    };
    cancelButton.setOutputMarkupId(true);
    mainForm.add(cancelButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage)

Aggregations

MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)75 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)41 Form (org.apache.wicket.markup.html.form.Form)39 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)20 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)19 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)17 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)17 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)15 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)14 ArrayList (java.util.ArrayList)14 Label (org.apache.wicket.markup.html.basic.Label)14 IModel (org.apache.wicket.model.IModel)14 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)11 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)9 ListItem (org.apache.wicket.markup.html.list.ListItem)8 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)7 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)7 List (java.util.List)7 OnChangeAjaxBehavior (org.apache.wicket.ajax.form.OnChangeAjaxBehavior)7 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)6