Search in sources :

Example 71 with MidpointForm

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

the class UserMenuPanel method initLayout.

private void initLayout() {
    WebMarkupContainer iconBox = new WebMarkupContainer(ID_ICON_BOX);
    add(iconBox);
    IModel<AbstractResource> jpegPhotoModel = loadJpegPhotoModel();
    NonCachingImage img = new NonCachingImage(ID_PHOTO, jpegPhotoModel);
    iconBox.add(img);
    Label usernameLink = new Label(ID_USERNAME_LINK, (IModel<String>) this::getShortUserName);
    add(usernameLink);
    WebMarkupContainer panelIconBox = new WebMarkupContainer(ID_PANEL_ICON_BOX);
    add(panelIconBox);
    NonCachingImage panelImg = new NonCachingImage(ID_PANEL_PHOTO, jpegPhotoModel);
    panelIconBox.add(panelImg);
    Label username = new Label(ID_USERNAME, (IModel<String>) this::getShortUserName);
    username.setRenderBodyOnly(true);
    add(username);
    Label focusType = new Label(ID_FOCUS_TYPE, getPageBase().createStringResource("PageTemplate." + getFocusType()));
    add(focusType);
    MidpointForm<?> form = new MidpointForm<>(ID_LOGOUT_FORM);
    form.add(AttributeModifier.replace("action", (IModel<String>) () -> SecurityUtils.getPathForLogoutWithContextPath(getRequest().getContextPath(), getAuthenticatedModule().getPrefix())));
    add(form);
    WebMarkupContainer csrfField = SecurityUtils.createHiddenInputForCsrf(ID_CSRF_FIELD);
    form.add(csrfField);
}
Also used : IModel(org.apache.wicket.model.IModel) NonCachingImage(org.apache.wicket.markup.html.image.NonCachingImage) Label(org.apache.wicket.markup.html.basic.Label) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) AbstractResource(org.apache.wicket.request.resource.AbstractResource) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 72 with MidpointForm

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

the class MultiplicityPolicyPanel method initLayout.

private void initLayout() {
    Form form = new MidpointForm(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    add(form);
    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<>(model, MultiplicityPolicyConstraintType.F_DESCRIPTION.getLocalPart()), createStringResource("multiplicityContainer.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE);
    form.add(description);
    WebMarkupContainer multiplicityContainer = new WebMarkupContainer(ID_MULTIPLICITY_CONTAINER);
    multiplicityContainer.setOutputMarkupId(true);
    form.add(multiplicityContainer);
    TextField<String> multiplicity = new TextField<>(ID_MULTIPLICITY, new PropertyModel<>(model, MultiplicityPolicyConstraintType.F_MULTIPLICITY.getLocalPart()));
    multiplicity.add(prepareMultiplicityValidator());
    multiplicity.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return !unbounded;
        }
    });
    multiplicityContainer.add(multiplicity);
    CheckBox multiplicityUnbounded = new CheckBox(ID_MULTIPLICITY_UNBOUND, new PropertyModel<>(this, MULTIPLICITY_UNBOUNDED));
    multiplicityUnbounded.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            model.getObject().setMultiplicity(MULTIPLICITY_UNBOUNDED);
            target.add(getMultiplicityContainer());
        }
    });
    multiplicityContainer.add(multiplicityUnbounded);
    initButtons(form);
}
Also used : Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) TextAreaFormGroup(com.evolveum.midpoint.web.component.form.TextAreaFormGroup) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBox(org.apache.wicket.markup.html.form.CheckBox) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 73 with MidpointForm

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

the class PageServices method initLayout.

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

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

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            FocusListInlineMenuHelper<ServiceType> listInlineMenuHelper = new FocusListInlineMenuHelper<ServiceType>(ServiceType.class, PageServices.this, this) {

                private static final long serialVersionUID = 1L;

                protected boolean isShowConfirmationDialog(ColumnMenuAction action) {
                    return PageServices.this.isShowConfirmationDialog(action);
                }

                protected IModel<String> getConfirmationMessageModel(ColumnMenuAction action, String actionName) {
                    return PageServices.this.getConfirmationMessageModel(action, actionName);
                }
            };
            return listInlineMenuHelper.createRowActions(getType());
        }

        @Override
        protected List<ItemPath> getFixedSearchItems() {
            List<ItemPath> fixedSearchItems = new ArrayList<>();
            fixedSearchItems.add(ObjectType.F_NAME);
            fixedSearchItems.add(AbstractRoleType.F_DISPLAY_NAME);
            fixedSearchItems.add(AbstractRoleType.F_IDENTIFIER);
            return fixedSearchItems;
        }
    };
    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) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) FocusListInlineMenuHelper(com.evolveum.midpoint.web.component.util.FocusListInlineMenuHelper) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 74 with MidpointForm

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

the class PageUsers method initLayout.

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

        // @Override
        // protected void objectDetailsPerformed(AjaxRequestTarget target, UserType user) {
        // WebComponentUtil.dispatchToObjectDetailsPage(UserType.class, user.getOid(), this, false);
        // PageParameters parameters = new PageParameters();
        // parameters.add(OnePageParameterEncoder.PARAMETER, user.getOid());
        // navigateToNext(PageUser.class, parameters);
        // }
        @Override
        protected UserProfileStorage.TableId getTableId() {
            return TableId.TABLE_USERS;
        }

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

        @Override
        protected List<ItemPath> getFixedSearchItems() {
            List<ItemPath> fixedSearchItems = new ArrayList<>();
            fixedSearchItems.add(UserType.F_NAME);
            fixedSearchItems.add(UserType.F_GIVEN_NAME);
            fixedSearchItems.add(UserType.F_FAMILY_NAME);
            return fixedSearchItems;
        }

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

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

        @Override
        protected String getConfirmMessageKeyForMultiObject() {
            return "pageUsers.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) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 75 with MidpointForm

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

the class MergeObjectsPanel method initLayout.

private void initLayout() {
    MidpointForm mainForm = new MidpointForm(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    DropDownChoicePanel mergeTypeSelect = new DropDownChoicePanel(ID_MERGE_TYPE_SELECTOR, mergeTypeModel, mergeTypeChoicesModel);
    mergeTypeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            mergeResultObject = getMergeObjectsResult();
            WebMarkupContainer resultObjectPanel = (WebMarkupContainer) get(ID_FORM).get(ID_OBJECTS_PANEL).get(ID_MERGE_RESULT_PANEL_CONTAINER);
            resultObjectPanel.addOrReplace(getMergeResultObjectPanel());
            target.add(resultObjectPanel);
        }
    });
    mergeTypeSelect.setOutputMarkupId(true);
    mainForm.add(mergeTypeSelect);
    final WebMarkupContainer objectsPanel = new WebMarkupContainer(ID_OBJECTS_PANEL);
    objectsPanel.setOutputMarkupId(true);
    mainForm.addOrReplace(objectsPanel);
    initObjectsPanel(objectsPanel);
    AjaxButton switchDirectionButton = new AjaxButton(ID_SWITCH_DIRECTION_BUTTON, pageBase.createStringResource("MergeObjectsPanel.switchDirection")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            F temp = mergeObjectModel.getObject();
            mergeObjectModel.setObject(mergeWithObjectModel.getObject());
            mergeWithObjectModel.setObject(temp);
            initObjectsPanel(objectsPanel);
            ajaxRequestTarget.add(objectsPanel);
        }
    };
    switchDirectionButton.setOutputMarkupId(true);
    mainForm.add(switchDirectionButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

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