Search in sources :

Example 1 with TransparentWebMarkupContainer

use of org.apache.wicket.markup.html.TransparentWebMarkupContainer in project ocvn by devgateway.

the class VietnamImportPage method addLogText.

protected void addLogText() {
    importContainer = new TransparentWebMarkupContainer("importContainer");
    importContainer.setOutputMarkupId(true);
    importForm.add(importContainer);
    AbstractReadOnlyModel<String> logTextModel = new AbstractReadOnlyModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            return vnExcelImportService.getMsgBuffer().toString();
        }
    };
    logText = new LogLabel("logText", logTextModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onPostProcessTarget(final AjaxRequestTarget target) {
            if (threadPoolTaskExecutor.getActiveCount() == 0) {
                getSelfUpdatingBehavior().stop(target);
                spinner.setVisibilityAllowed(false);
                target.add(spinner);
            }
        }
    };
    importContainer.add(logText);
    spinner = new WebMarkupContainer("spinner");
    spinner.setOutputMarkupId(true);
    importContainer.add(spinner);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) LogLabel(org.devgateway.ocvn.forms.wicket.components.LogLabel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer)

Example 2 with TransparentWebMarkupContainer

use of org.apache.wicket.markup.html.TransparentWebMarkupContainer in project wicket by apache.

the class Enclosure method resolveChild.

/**
 * Searches for the controlling child component looking also
 * through transparent components.
 *
 * @param container
 * 			the current container
 * @return the controlling child component, null if no one is found
 */
private Component resolveChild(MarkupContainer container) {
    Component childController = container.get(childId);
    Iterator<Component> children = container.iterator();
    while (children.hasNext() && childController == null) {
        Component transparentChild = children.next();
        if (transparentChild instanceof TransparentWebMarkupContainer) {
            childController = resolveChild((MarkupContainer) transparentChild);
        }
    }
    return childController;
}
Also used : MarkupContainer(org.apache.wicket.MarkupContainer) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) Component(org.apache.wicket.Component)

Example 3 with TransparentWebMarkupContainer

use of org.apache.wicket.markup.html.TransparentWebMarkupContainer in project wicket by apache.

the class WicketMessageTagHandler method resolve.

@Override
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) {
    // localize any raw markup that has wicket:message attrs
    if ((tag != null) && (tag.getId().startsWith(getWicketMessageIdPrefix(markupStream)))) {
        Component wc;
        String id = tag.getId();
        if (tag.isOpenClose()) {
            wc = new WebComponent(id);
        } else {
            wc = new TransparentWebMarkupContainer(id);
        }
        return wc;
    }
    return null;
}
Also used : WebComponent(org.apache.wicket.markup.html.WebComponent) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) WebComponent(org.apache.wicket.markup.html.WebComponent) Component(org.apache.wicket.Component)

Example 4 with TransparentWebMarkupContainer

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

the class PageBase method initLayout.

private void initLayout() {
    TransparentWebMarkupContainer body = new TransparentWebMarkupContainer(ID_BODY);
    // body.add(new AttributeAppender("class", "hold-transition ", " "));
    // body.add(new AttributeAppender("class", "custom-hold-transition ", " "));
    body.add(AttributeAppender.append("class", new IModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
            if (info == null || StringUtils.isEmpty(info.getSkin())) {
                return CLASS_DEFAULT_SKIN;
            }
            return info.getSkin();
        }
    }));
    add(body);
    WebMarkupContainer mainHeader = new WebMarkupContainer(ID_MAIN_HEADER);
    mainHeader.setOutputMarkupId(true);
    add(mainHeader);
    AjaxLink<String> logo = new AjaxLink<>(ID_LOGO) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            Class<? extends Page> page = MidPointApplication.get().getHomePage();
            setResponsePage(page);
        }
    };
    logo.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !isCustomLogoVisible();
        }

        @Override
        public boolean isEnabled() {
            return isLogoLinkEnabled();
        }
    });
    mainHeader.add(logo);
    AjaxLink<String> customLogo = new AjaxLink<>(ID_CUSTOM_LOGO) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            // TODO may be this should lead to customerUrl ?
            Class<? extends Page> page = MidPointApplication.get().getHomePage();
            setResponsePage(page);
        }
    };
    customLogo.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isCustomLogoVisible();
        }
    });
    mainHeader.add(customLogo);
    WebMarkupContainer navigation = new WebMarkupContainer(ID_NAVIGATION);
    navigation.setOutputMarkupId(true);
    mainHeader.add(navigation);
    IModel<IconType> logoModel = new IModel<>() {

        private static final long serialVersionUID = 1L;

        @Override
        public IconType getObject() {
            DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
            return info != null ? info.getLogo() : null;
        }
    };
    ExternalImage customLogoImgSrc = new ExternalImage(ID_CUSTOM_LOGO_IMG_SRC) {

        @Override
        protected void buildSrcAttribute(ComponentTag tag, IModel<?> srcModel) {
            tag.put("src", WebComponentUtil.getIconUrlModel(logoModel.getObject()).getObject());
        }
    };
    customLogoImgSrc.add(new VisibleBehaviour(() -> logoModel.getObject() != null && StringUtils.isEmpty(logoModel.getObject().getCssClass())));
    WebMarkupContainer customLogoImgCss = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_CSS);
    customLogoImgCss.add(new VisibleBehaviour(() -> logoModel.getObject() != null && StringUtils.isNotEmpty(logoModel.getObject().getCssClass())));
    customLogoImgCss.add(new AttributeAppender("class", new IModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            return logoModel.getObject() != null ? logoModel.getObject().getCssClass() : null;
        }
    }));
    mainHeader.add(new AttributeAppender("style", new IModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            return logoModel.getObject() != null ? "background-color: " + GuiStyleConstants.DEFAULT_BG_COLOR + " !important;" : null;
        }
    }));
    customLogo.add(customLogoImgSrc);
    customLogo.add(customLogoImgCss);
    Label title = new Label(ID_TITLE, createPageTitleModel());
    title.setRenderBodyOnly(true);
    add(title);
    initHeaderLayout(navigation);
    initTitleLayout(navigation);
    logo.add(createHeaderColorStyleModel(false));
    customLogo.add(createHeaderColorStyleModel(false));
    mainHeader.add(createHeaderColorStyleModel(false));
    navigation.add(createHeaderColorStyleModel(true));
    initDebugBarLayout();
    LeftMenuPanel sidebarMenu = new LeftMenuPanel(ID_SIDEBAR_MENU);
    sidebarMenu.add(createUserStatusBehaviour());
    add(sidebarMenu);
    WebMarkupContainer footerContainer = new WebMarkupContainer(ID_FOOTER_CONTAINER);
    footerContainer.add(new VisibleBehaviour(() -> !isErrorPage() && isFooterVisible()));
    add(footerContainer);
    WebMarkupContainer version = new WebMarkupContainer(ID_VERSION) {

        private static final long serialVersionUID = 1L;

        @Deprecated
        public String getDescribe() {
            return PageBase.this.getDescribe();
        }
    };
    version.add(new VisibleBehaviour(() -> isFooterVisible() && RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType())));
    footerContainer.add(version);
    WebMarkupContainer copyrightMessage = new WebMarkupContainer(ID_COPYRIGHT_MESSAGE);
    copyrightMessage.add(getFooterVisibleBehaviour());
    footerContainer.add(copyrightMessage);
    Label subscriptionMessage = new Label(ID_SUBSCRIPTION_MESSAGE, new IModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            String subscriptionId = getSubscriptionId();
            if (StringUtils.isEmpty(subscriptionId)) {
                return "";
            }
            if (!WebComponentUtil.isSubscriptionIdCorrect(subscriptionId)) {
                return " " + createStringResource("PageBase.nonActiveSubscriptionMessage").getString();
            }
            if (SubscriptionType.DEMO_SUBSRIPTION.getSubscriptionType().equals(subscriptionId.substring(0, 2))) {
                return " " + createStringResource("PageBase.demoSubscriptionMessage").getString();
            }
            return "";
        }
    });
    subscriptionMessage.setOutputMarkupId(true);
    subscriptionMessage.add(getFooterVisibleBehaviour());
    footerContainer.add(subscriptionMessage);
    WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
    feedbackContainer.setOutputMarkupId(true);
    feedbackContainer.setOutputMarkupPlaceholderTag(true);
    add(feedbackContainer);
    FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
    feedbackList.setOutputMarkupId(true);
    feedbackList.setOutputMarkupPlaceholderTag(true);
    feedbackContainer.add(feedbackList);
    MainPopupDialog mainPopup = new MainPopupDialog(ID_MAIN_POPUP);
    // mainPopup.showUnloadConfirmation(false);
    // mainPopup.setResizable(false);
    add(mainPopup);
}
Also used : IModel(org.apache.wicket.model.IModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) LeftMenuPanel(com.evolveum.midpoint.gui.impl.component.menu.LeftMenuPanel) MainPopupDialog(com.evolveum.midpoint.web.component.dialog.MainPopupDialog) Label(org.apache.wicket.markup.html.basic.Label) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) ComponentTag(org.apache.wicket.markup.ComponentTag) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ExternalImage(org.apache.wicket.markup.html.image.ExternalImage) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 5 with TransparentWebMarkupContainer

use of org.apache.wicket.markup.html.TransparentWebMarkupContainer in project ocvn by devgateway.

the class ListViewSectionPanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    listWrapper = new TransparentWebMarkupContainer("listWrapper");
    listWrapper.setOutputMarkupId(true);
    add(listWrapper);
    listWrapper.add(new Label("panelTitle", title));
    listView = new ListView<T>("list", getModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<T> item) {
            // we wrap the item model on a compound model so we can use the field ids as property models
            final CompoundPropertyModel<T> compoundPropertyModel = new CompoundPropertyModel<>(item.getModel());
            // we set back the model as the compound model, thus ensures the rest of the items added will benefit
            item.setModel(compoundPropertyModel);
            // we add the rest of the items in the listItem
            populateCompoundListItem(item);
            // we add the remove button
            final BootstrapDeleteButton removeButton = getRemoveChildButton(item.getIndex());
            item.add(removeButton);
        }
    };
    listView.setReuseItems(true);
    listView.setOutputMarkupId(true);
    listWrapper.add(listView);
    final BootstrapAddButton addButton = getAddNewChildButton();
    add(addButton);
}
Also used : CompoundPropertyModel(org.apache.wicket.model.CompoundPropertyModel) BootstrapDeleteButton(org.devgateway.toolkit.forms.wicket.components.form.BootstrapDeleteButton) BootstrapAddButton(org.devgateway.toolkit.forms.wicket.components.form.BootstrapAddButton) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) Label(org.apache.wicket.markup.html.basic.Label)

Aggregations

TransparentWebMarkupContainer (org.apache.wicket.markup.html.TransparentWebMarkupContainer)11 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 Component (org.apache.wicket.Component)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 Label (org.apache.wicket.markup.html.basic.Label)3 CompoundPropertyModel (org.apache.wicket.model.CompoundPropertyModel)2 BootstrapAddButton (org.devgateway.toolkit.forms.wicket.components.form.BootstrapAddButton)2 BootstrapDeleteButton (org.devgateway.toolkit.forms.wicket.components.form.BootstrapDeleteButton)2 LeftMenuPanel (com.evolveum.midpoint.gui.impl.component.menu.LeftMenuPanel)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 MainPopupDialog (com.evolveum.midpoint.web.component.dialog.MainPopupDialog)1 FeedbackAlerts (com.evolveum.midpoint.web.component.message.FeedbackAlerts)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 MarkupContainer (org.apache.wicket.MarkupContainer)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 ComponentTag (org.apache.wicket.markup.ComponentTag)1 WebComponent (org.apache.wicket.markup.html.WebComponent)1 ExternalImage (org.apache.wicket.markup.html.image.ExternalImage)1