Search in sources :

Example 31 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class AbstractRoleMainPanel method createTabs.

@Override
protected List<ITab> createTabs(final PageAdminObjectDetails<R> parentPage) {
    List<ITab> tabs = super.createTabs(parentPage);
    FocusTabVisibleBehavior authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_INDUCEMENTS_URL);
    tabs.add(new CountablePanelTab(parentPage.createStringResource("FocusType.inducement"), authorization) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new AssignmentTablePanel<R>(panelId, parentPage.createStringResource("FocusType.inducement"), inducementsModel) {

                private static final long serialVersionUID = 1L;

                @Override
                public List<AssignmentType> getAssignmentTypeList() {
                    return getObject().asObjectable().getInducement();
                }

                @Override
                public String getExcludeOid() {
                    return getObject().getOid();
                }

                @Override
                protected boolean ignoreMandatoryAttributes() {
                    return true;
                }
            };
        }

        @Override
        public String getCount() {
            return Integer.toString(inducementsModel.getObject() == null ? 0 : inducementsModel.getObject().size());
        }
    });
    authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_MEMBERS_URL);
    tabs.add(new PanelTab(parentPage.createStringResource("pageRole.members"), authorization) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return createMemberPanel(panelId);
        }

        @Override
        public boolean isVisible() {
            return super.isVisible() && getObjectWrapper().getStatus() != ContainerStatus.ADDING && isAllowedToReadRoleMembership(getObjectWrapper().getOid(), parentPage);
        }
    });
    return tabs;
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) CountablePanelTab(com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab) FocusTabVisibleBehavior(com.evolveum.midpoint.gui.api.util.FocusTabVisibleBehavior) CountablePanelTab(com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab) PageAssignmentsList(com.evolveum.midpoint.web.page.self.PageAssignmentsList) List(java.util.List) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 32 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class TextAreaFormGroup method initLayout.

private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, boolean required, int rowNumber) {
    WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
    add(labelContainer);
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        labelContainer.add(AttributeAppender.prepend("class", labelSize));
    }
    labelContainer.add(l);
    Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
    tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(tooltipKey);
        }
    }));
    tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
    tooltipLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return tooltipKey != null;
        }
    });
    tooltipLabel.setOutputMarkupId(true);
    tooltipLabel.setOutputMarkupPlaceholderTag(true);
    labelContainer.add(tooltipLabel);
    WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        textWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(textWrapper);
    TextArea text = new TextArea<>(ID_TEXT, getModel());
    text.add(new AttributeModifier("rows", rowNumber));
    text.setOutputMarkupId(true);
    text.setRequired(required);
    text.setLabel(label);
    text.add(AttributeAppender.replace("placeholder", label));
    textWrapper.add(text);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) TextArea(org.apache.wicket.markup.html.form.TextArea) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 33 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class ValueChoosePanel method initLayout.

private void initLayout(final IModel<T> value, final List<PrismReferenceValue> values, final boolean required, Collection<Class<? extends O>> types) {
    WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
    textWrapper.setOutputMarkupId(true);
    TextField<String> text = new TextField<String>(ID_TEXT, createTextModel(value));
    text.add(new AjaxFormComponentUpdatingBehavior("blur") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
        }
    });
    text.setRequired(required);
    text.setEnabled(false);
    textWrapper.add(text);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
    textWrapper.add(feedback);
    AjaxLink<String> edit = new AjaxLink<String>(ID_EDIT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            editValuePerformed(values, target);
        }
    };
    textWrapper.add(edit);
    add(textWrapper);
    initButtons();
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) TextField(org.apache.wicket.markup.html.form.TextField) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 34 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class MultiValueTextFormGroup method initLayout.

private void initLayout(final IModel<String> label, final String labelSize, final String textSize, final boolean required) {
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        l.add(AttributeAppender.prepend("class", labelSize));
    }
    add(l);
    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> item) {
            WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
            textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    StringBuilder sb = new StringBuilder();
                    if (StringUtils.isNotEmpty(textSize)) {
                        sb.append(textSize).append(' ');
                    }
                    if (item.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) {
                        sb.append(getOffsetClass()).append(' ');
                        sb.append(CLASS_MULTI_VALUE);
                    }
                    return sb.toString();
                }
            }));
            item.add(textWrapper);
            TextField text = new TextField(ID_TEXT, createTextModel(item.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("blur") {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            text.setRequired(required);
            text.add(AttributeAppender.replace("placeholder", label));
            text.setLabel(label);
            textWrapper.add(text);
            FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
            textWrapper.add(feedback);
            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) {
                        return CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    add(repeater);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) TextField(org.apache.wicket.markup.html.form.TextField) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 35 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class MultiStateHorizontalButton method initLayout.

private void initLayout() {
    WebMarkupContainer buttonsPanel = new WebMarkupContainer(ID_BUTTONS_CONTAINER);
    buttonsPanel.setOutputMarkupId(true);
    add(buttonsPanel);
    RepeatingView buttons = new RepeatingView(ID_BUTTON);
    buttons.setOutputMarkupId(true);
    buttonsPanel.add(buttons);
    for (String propertyKey : propertyKeysList) {
        AjaxSubmitButton button = new AjaxSubmitButton(buttons.newChildId(), pageBase.createStringResource(propertyKey)) {

            @Override
            public void onSubmit(AjaxRequestTarget ajaxRequestTarget, Form form) {
                MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey), ajaxRequestTarget);
            }

            @Override
            public void onError(AjaxRequestTarget ajaxRequestTarget, Form form) {
                MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey), ajaxRequestTarget);
            }
        };
        button.add(getActiveButtonClassAppender(propertyKeysList.indexOf(propertyKey)));
        button.setOutputMarkupId(true);
        buttons.add(button);
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(org.apache.wicket.markup.html.form.Form) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)227 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)106 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)101 Label (org.apache.wicket.markup.html.basic.Label)98 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)59 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)44 List (java.util.List)43 ListItem (org.apache.wicket.markup.html.list.ListItem)43 ArrayList (java.util.ArrayList)41 ListView (org.apache.wicket.markup.html.list.ListView)39 PropertyModel (org.apache.wicket.model.PropertyModel)34 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)26 TextField (org.apache.wicket.markup.html.form.TextField)25 IModel (org.apache.wicket.model.IModel)22 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)21 AttributeModifier (org.apache.wicket.AttributeModifier)21 Form (org.apache.wicket.markup.html.form.Form)21 Model (org.apache.wicket.model.Model)18 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)17 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)16