Example usage for org.apache.wicket.markup.html TransparentWebMarkupContainer TransparentWebMarkupContainer

List of usage examples for org.apache.wicket.markup.html TransparentWebMarkupContainer TransparentWebMarkupContainer

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html TransparentWebMarkupContainer TransparentWebMarkupContainer.

Prototype

public TransparentWebMarkupContainer(String id) 

Source Link

Document

Construct.

Usage

From source file:com.axway.ats.testexplorer.pages.BasePage.java

License:Apache License

public BasePage(PageParameters parameters) {

    super(parameters);

    LOG = Logger.getLogger(this.getClass());

    add(new Label("page_title", "Axway ATS Test Explorer - " + getPageName()));

    // check DB connection and sets the current DB Name
    getTESession().getDbReadConnection();

    WebMarkupContainer topRightContent = new WebMarkupContainer("topRightContent");
    add(topRightContent);/*from ww w.  j  ava 2  s .  co m*/

    String dbName = getTESession().getDbName();
    if (dbName == null || "".equals(dbName)) {
        topRightContent.add(new Label("dbName", "").setVisible(false));
        topRightContent.add(new Label("machinesLink", "").setVisible(false));
        topRightContent.add(new Label("runCopyLink", runCopyLinkModel).setVisible(false));
        topRightContent.add(new Label("testcasesCopyLink", testcasesCopyLinkModel).setVisible(false));
        topRightContent.add(new Label("representationLink", representationLinkModel).setVisible(false));
    } else {
        String dbNameAndVersion = dbName;
        String dbVersion = getTESession().getDbVersion();
        if (dbVersion != null) {
            dbNameAndVersion = dbNameAndVersion + ", v" + dbVersion;
        }
        topRightContent.add(new Label("dbName",
                "<div class=\"dbName\"><span style=\"color:#C8D5DF;\">Exploring database:</span>&nbsp; "
                        + dbNameAndVersion + "</div>").setEscapeModelStrings(false));
        topRightContent.add(new Label("machinesLink",
                "<a href=\"machines?dbname=" + dbName + "\" class=\"machinesLink\" target=\"_blank\"></a>")
                        .setEscapeModelStrings(false));
        runCopyLinkModel.setObject(
                "<a href=\"runCopy?dbname=" + dbName + "\" class=\"runCopyLink\" target=\"_blank\"></a>");
        topRightContent.add(new Label("runCopyLink", runCopyLinkModel).setEscapeModelStrings(false));

        testcasesCopyLinkModel.setObject("<a href=\"testcasesCopy?dbname=" + dbName
                + "\" class=\"testcasesCopyLink\" target=\"_blank\"></a>");
        topRightContent.add(getTestcasesCopyButton());

        representationLinkModel.setObject(createRepresentationLinkModelObject());

        topRightContent
                .add(new Label("representationLink", representationLinkModel).setEscapeModelStrings(false));

    }

    itemsCountLabel = new Label("itemsCount", new Model<Integer>() {

        private static final long serialVersionUID = 1L;

        @Override
        public Integer getObject() {

            return getTESession().getCompareContainer().size();
        }
    });
    itemsCountLabel.setOutputMarkupId(true);
    topRightContent.setVisible(!(this instanceof WelcomePage));
    topRightContent.add(itemsCountLabel);

    FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
    feedbackPanel.setOutputMarkupId(true);
    add(feedbackPanel);

    // add navigation panel
    add(new ListView<PagePojo>("navigation_links", navigationList) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<PagePojo> item) {

            final PagePojo pp = item.getModelObject();

            if (pp.pageSuffix != null && !pp.pageName.endsWith("</span>")) {
                pp.pageName = pp.pageName + " <span class=\"locationName\">[" + pp.pageSuffix + "]</span>";
            }

            item.add(new Link<Object>("navigation_link") {

                private static final long serialVersionUID = 1L;

                @Override
                protected CharSequence getURL() {

                    // generate Bookmarkable link url
                    return urlFor(pp.pageClass, pp.parameters);
                }

                @Override
                public void onClick() {

                    // This link acts like Bookmarkable link and don't have a click handler.
                }
            }.add(new Label("navigation_link_name", pp.pageName).setEscapeModelStrings(false)));
        }
    });
    add(new Label("navigation_current_page_name", getPageName()));
    add(getNavigationSuffixComponent());
    add(getTestcaseNavigationButtons());

    currentTestDetails();

    // add child page
    TransparentWebMarkupContainer pageWrapper = new TransparentWebMarkupContainer("page_wrapper");
    add(pageWrapper);

    if (TestExplorerUtils.extractPageParameter(parameters, "hacks") != null) {
        showTestcaseStatusChangeButtons = true;
    }

    add(timeOffsetField);
    add(dayLightSavingOnField);

    // AJAX handler for obtaining browser's time offset from UTC and current browser timestamp
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {

            IRequestParameters request = RequestCycle.get().getRequest().getRequestParameters();
            int timeOffset = request.getParameterValue("timeOffset").toInt();
            TestExplorerSession teSession = (TestExplorerSession) Session.get();
            teSession.setTimeOffset(timeOffset);
            teSession.setDayLightSavingOn(request.getParameterValue("dayLightSavingOn").toBoolean());
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {

            super.updateAjaxAttributes(attributes);
            attributes.getDynamicExtraParameters().add("return {'timeOffset': $('#timeOffset').val(), "
                    + "'dayLightSavingOn': $('#dayLightSavingOn').val() }");
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {

            // Date.prototype.getTimezoneOffset() returns negative value if the local time is ahead of UTC,
            // so we invert the result, before sending it to Wicket
            String getTimeOffsetScript = ";var timeOffset = $('#timeOffset');timeOffset.val(new Date().getTimezoneOffset()*60*1000*-1);"
                    + ";var dayLightSavingOn = $('#dayLightSavingOn');dayLightSavingOn.val(isDayLightSavingOn());";
            response.render(OnLoadHeaderItem.forScript(getCallbackScript().toString()));
            response.render(OnLoadHeaderItem.forScript(getTimeOffsetScript));
        }

    });

}

From source file:com.axway.ats.testexplorer.pages.LightweightBasePage.java

License:Apache License

public LightweightBasePage(PageParameters parameters) {

    super(parameters);

    currentRunId = TestExplorerUtils.extractPageParameter(parameters, "runId");

    LOG = Logger.getLogger(this.getClass());

    addHeader();/*from w w  w.  j ava 2s  .  com*/

    // add child page
    TransparentWebMarkupContainer pageWrapper = new TransparentWebMarkupContainer("page_wrapper");
    add(pageWrapper);
}

From source file:com.olegchir.flussonic_userlinks.wicket.SecurityResolver.SecurityResolver.java

License:Apache License

@Override
public Component resolve(final MarkupContainer container, final MarkupStream markupStream,
        final ComponentTag tag) {
    // It must be <wicket:...>
    if (tag instanceof WicketTag) {
        final WicketTag wicketTag = (WicketTag) tag;

        // It must be <wicket:security...>
        if (TAGNAME_SECURITY.equalsIgnoreCase(tag.getName())) {
            boolean authorized = true;
            String rolesInOneString = StringUtils.trimToNull(wicketTag.getAttribute("onlyroles"));
            if (null != rolesInOneString) {
                Roles roles = AuthChecker.extractRoles();
                authorized = roles.hasAnyRole(new Roles(rolesInOneString));
            }/*from w ww  .ja  v  a  2 s  .c om*/

            String id = wicketTag.getId() + container.getPage().getAutoIndex();

            Component result = new TransparentWebMarkupContainer(id);
            if (!authorized) {
                result.setVisible(false);
            }

            return result;
        }
    }

    // We were not able to handle the componentId
    return null;
}

From source file:eu.uqasar.web.components.navigation.notification.NotificationBookmarkablePageLink.java

License:Apache License

protected NotificationBookmarkablePageLink(final String id, final Class<C> pageClass,
        final PageParameters parameters, IModel<T> model) {

    super(id, model);
    this.parameters = parameters;

    if (pageClass == null) {
        throw new IllegalArgumentException("Page class for bookmarkable link cannot be null");
    } else if (!Page.class.isAssignableFrom(pageClass)) {
        throw new IllegalArgumentException("Page class must be derived from " + Page.class.getName());
    }/*from w w  w . j av  a  2s  . c o m*/
    pageClassName = pageClass.getName();

    final String className = (model != null) && (model.getObject() != null)
            ? model.getObject().getClass().getSimpleName()
            : this.getClass().getSimpleName();

    add(new CssClassNameAppender("notification", className));
    TransparentWebMarkupContainer notificationContainer = new TransparentWebMarkupContainer(
            "notification.container");
    add(notificationContainer);
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM,
            UQasar.getSession().getLocale());

    // Add a check whether the creation date is null
    Date creationDate = new Date();
    if (model.getObject().getCreationDate() == null) {
        creationDate = model.getObject().getCreationDate();
    }

    gotoContainer = new WebMarkupContainer("notification.goto.container");
    gotoContainer.add(notificationDate = new Label("notification.date", df.format(creationDate)));
    notificationContainer.add(icon = new Icon("notification.icon", new IconType("group")));
    notificationContainer.add(gotoContainer);
}

From source file:net.jawr.web.wicket.JawrWicketLinkResolver.java

License:Apache License

@Override
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) {

    Component component = null;//from   www  . j a  v  a 2  s  . co  m

    // Only component tags have the id == "_jawrAutolink_"
    String tagName = tag.getName();
    if (tag.getId().equals(JawrWicketLinkTagHandler.AUTOLINK_ID)) {

        // create the right component depending on the tag name
        WebMarkupContainer jawrTag = null;
        final String id = tag.getId() + container.getPage().getAutoIndex();
        if (tagName.equalsIgnoreCase(IMG_TAG_NAME)) {
            jawrTag = new JawrImageReference(id);
        } else if (tagName.equalsIgnoreCase("input") && tag.getAttribute("type").equals(IMAGE_TAG_NAME)) {
            jawrTag = new JawrHtmlImageReference(id);
        } else if (tagName.equalsIgnoreCase("script")) {
            jawrTag = new JawrJavascriptReference(id);
        } else if (tagName.equalsIgnoreCase("link")) {
            jawrTag = new JawrStylesheetReference(id);
        }

        if (jawrTag != null) {
            container.autoAdd(jawrTag, markupStream);
        }

        // Yes, we handled the tag
        return jawrTag;
    } else if (tag instanceof WicketTag) {

        // For tag wicket:jawr
        if (tagName.equals("jawr")) {

            final String id = tag.getId() + container.getPage().getAutoIndex();
            component = new TransparentWebMarkupContainer(id);
            component.setRenderBodyOnly(true);
            container.autoAdd(component, markupStream);

            // Yes, we handled the tag
            return component;
        }
    }

    // We were not able to handle the tag
    return null;
}

From source file:org.apache.openmeetings.service.mail.template.AbstractTemplatePanel.java

License:Apache License

public AbstractTemplatePanel(Long langId) {
    super(TemplatePage.COMP_ID);
    this.langId = langId == null
            ? getBean(ConfigurationDao.class).getConfValue(CONFIG_DEFAULT_LANG_KEY, Long.class, "1")
            : langId;/*  w  w  w . ja  va 2s.  co m*/
    add(new TransparentWebMarkupContainer("container").add(AttributeAppender.append("dir",
            FormatHelper.isRtlLanguage(LabelDao.languages.get(langId).toLanguageTag()) ? "rtl" : "ltr")));
}

From source file:org.apache.openmeetings.web.app.MessageTagHandler.java

License:Apache License

public Component resolve(final MarkupContainer container, final MarkupStream markupStream,
        final ComponentTag tag) {
    // localize any raw markup that has wicket:message attrs
    if ((tag != null) && (tag.getId().startsWith(getWicketMessageIdPrefix()))) {
        Component wc;//from w  w w  . j a v  a 2  s  .  com
        int autoIndex = container.getPage().getAutoIndex();
        String id = getWicketMessageIdPrefix() + autoIndex;

        if (tag.isOpenClose()) {
            wc = new WebComponent(id);
        } else {
            wc = new TransparentWebMarkupContainer(id);
        }

        return wc;
    }
    return null;
}

From source file:org.apache.openmeetings.web.pages.BasePage.java

License:Apache License

public BasePage() {
    options = new HashMap<String, String>();
    options.put("fragmentIdentifierSuffix", "");
    options.put("keyValueDelimiter", "/");
    String appName = getApplicationName();

    String code = getLanguageCode();
    add(new TransparentWebMarkupContainer("html").add(new AttributeModifier("xml:lang", code))
            .add(new AttributeModifier("lang", code))
            .add(new AttributeModifier("dir", isRtl() ? "rtl" : "ltr")));
    add(new Label("pageTitle", appName));
    add(header = new HeaderPanel("header", appName));
}

From source file:org.cast.isi.page.ISIStandardPage.java

License:Open Source License

@Override
protected void onInitialize() {

    TransparentWebMarkupContainer body = new TransparentWebMarkupContainer("body") {
        private static final long serialVersionUID = 1L;
    };//from   ww w.  j a v a  2  s  . c  om
    add(body);

    // Dialog Placeholder
    add(new WebMarkupContainer(DISPLAY_DIALOG_ID).setOutputMarkupId(true));

    // Loading Dialog
    loadingDialog = new DialogBorder(LOADING_DIALOG_ID, new Model<String>("Loading..."));
    add(loadingDialog);

    // Cancel Link on Loading Dialog
    WebMarkupContainer cancelLink = new WebMarkupContainer("cancelLink");
    cancelLink.add(loadingDialog.getClickToCloseBehavior());
    loadingDialog.getBodyContainer().add(cancelLink);
    super.onInitialize();
}

From source file:org.cdlflex.ui.markup.html.dialog.Dialog.java

License:Apache License

/**
 * Factory method for creating the outer modal container.
 *
 * @param id the component id// w ww  . j ava  2s . c om
 * @return a new component
 */
protected WebMarkupContainer newContainer(String id) {
    WebMarkupContainer modal = new TransparentWebMarkupContainer(id);
    modal.add(new CssClassNameAppender(new CssClassNameProvidingModel<>(size)));
    return modal;
}