Search in sources :

Example 41 with WebMarkupContainer

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

the class CheckFormGroup method initLayout.

private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize) {
    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 checkWrapper = new WebMarkupContainer(ID_CHECK_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        checkWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(checkWrapper);
    CheckBox check = new CheckBox(ID_CHECK, getModel());
    check.setLabel(label);
    checkWrapper.add(check);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) CheckBox(org.apache.wicket.markup.html.form.CheckBox) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 42 with WebMarkupContainer

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

the class DropDownFormGroup method initLayout.

private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, final boolean required) {
    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 requiredContainer = new WebMarkupContainer(ID_REQUIRED);
    requiredContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return required;
        }
    });
    labelContainer.add(requiredContainer);
    WebMarkupContainer selectWrapper = new WebMarkupContainer(ID_SELECT_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        selectWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(selectWrapper);
    DropDownChoice select = createDropDown(ID_SELECT, choices, renderer, required);
    select.setLabel(label);
    selectWrapper.add(select);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(select));
    feedback.setOutputMarkupId(true);
    selectWrapper.add(feedback);
    Component additionalInfo = createAdditionalInfoComponent(ID_ADDITIONAL_INFO);
    if (additionalInfo == null) {
        additionalInfo = new Label(ID_ADDITIONAL_INFO, "");
    }
    selectWrapper.add(additionalInfo);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 43 with WebMarkupContainer

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

the class PageResource method createTabsPanel.

private AjaxTabbedPanel<ITab> createTabsPanel() {
    List<ITab> tabs = new ArrayList<ITab>();
    tabs.add(new PanelTab(createStringResource("PageResource.tab.details")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceDetailsTabPanel(panelId, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.tasks")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceTasksPanel(panelId, true, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.account")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, ShadowKindType.ACCOUNT, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.entitlement")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, ShadowKindType.ENTITLEMENT, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.generic")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, ShadowKindType.GENERIC, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.others")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, null, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.connector")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceConnectorPanel(panelId, null, resourceModel, PageResource.this);
        }
    });
    AjaxTabbedPanel<ITab> resourceTabs = new AjaxTabbedPanel<ITab>(ID_TAB_PANEL, tabs) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onTabChange(int index) {
            updateBreadcrumbParameters(PARAMETER_SELECTED_TAB, index);
        }
    };
    resourceTabs.setOutputMarkupId(true);
    return resourceTabs;
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) ArrayList(java.util.ArrayList) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel)

Example 44 with WebMarkupContainer

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

the class TestConnectionResultPanel method initLayout.

private void initLayout(Page parentPage) {
    WebMarkupContainer contentPanel = new WebMarkupContainer(ID_CONTENT_PANEL);
    contentPanel.setOutputMarkupId(true);
    add(contentPanel);
    Label messageLabel = new Label(ID_MESSAGE, ((PageBase) parentPage).createStringResource("TestConnectionResultPanel.message"));
    messageLabel.setOutputMarkupId(true);
    contentPanel.add(messageLabel);
    messageLabel.add(new VisibleEnableBehaviour() {

        public boolean isVisible() {
            return !isLoaded;
        }
    });
    AjaxLazyLoadPanel resultsPanel = new AjaxLazyLoadPanel(ID_RESULT) {

        @Override
        public Component getLazyLoadComponent(String id) {
            return new TestConnectionMessagesPanel(id, resourceOid, (PageBase) parentPage);
        }

        @Override
        protected void onComponentLoaded(Component component, AjaxRequestTarget target) {
            isLoaded = true;
            target.add(component);
            target.add(messageLabel);
        }
    };
    contentPanel.add(resultsPanel);
    AjaxButton ok = new AjaxButton(ID_OK) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
            okPerformed(target);
        }
    };
    contentPanel.add(ok);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label) AjaxLazyLoadPanel(org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 45 with WebMarkupContainer

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

the class PageAccount method initLayout.

private void initLayout() {
    Form mainForm = new Form("mainForm");
    mainForm.setMultiPart(true);
    add(mainForm);
    WebMarkupContainer protectedMessage = new WebMarkupContainer(ID_PROTECTED_MESSAGE);
    protectedMessage.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            ObjectWrapper wrapper = accountModel.getObject();
            return wrapper.isProtectedAccount();
        }
    });
    mainForm.add(protectedMessage);
    PrismObjectPanel<ShadowType> userForm = new PrismObjectPanel<ShadowType>("account", accountModel, new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM), mainForm, this);
    mainForm.add(userForm);
    initButtons(mainForm);
}
Also used : ImgResources(com.evolveum.midpoint.web.resource.img.ImgResources) Form(org.apache.wicket.markup.html.form.Form) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ObjectWrapper(com.evolveum.midpoint.web.component.prism.ObjectWrapper) PrismObjectPanel(com.evolveum.midpoint.web.component.prism.PrismObjectPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) 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