Example usage for org.apache.wicket.markup.html.link ExternalLink setOutputMarkupId

List of usage examples for org.apache.wicket.markup.html.link ExternalLink setOutputMarkupId

Introduction

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

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

From source file:org.hippoecm.frontend.plugins.login.LoginPlugin.java

License:Apache License

public LoginPlugin(IPluginContext context, IPluginConfig config) {
    super(context, config);

    add(CssClass.append("hippo-login-plugin"));

    add(new Label("pageTitle", getString("page.title")));

    final ResourceReference iconReference = getFaviconReference();
    add(new ResourceLink("faviconLink", iconReference));

    String[] supported = config.getStringArray(SUPPORTED_BROWSERS);
    if (supported != null) {
        add(new BrowserCheckBehavior(supported));
    }//from  w ww .  jav a 2  s . c  o m

    // In case of using a different edition, add extra CSS rules to show the required styling
    if (config.containsKey(EDITION)) {
        final String edition = config.getString(EDITION);
        editionCss = new CssResourceReference(LoginPlugin.class, "login_" + edition + ".css");
    }

    ExternalLink termsAndConditions = new ExternalLink("termsAndConditions", TERMS_AND_CONDITIONS_LINK) {
        @Override
        public boolean isVisible() {
            return UsageStatisticsSettings.get().isEnabled();
        }
    };
    termsAndConditions.setOutputMarkupId(true);
    add(termsAndConditions);

    final boolean autoComplete = getPluginConfig().getAsBoolean(AUTOCOMPLETE, true);
    String[] localeArray = GlobalSettings.get().getStringArray(LOCALES);
    if (localeArray == null || localeArray.length == 0) {
        localeArray = DEFAULT_LOCALES;
    }
    add(createLoginPanel("login-panel", autoComplete, Arrays.asList(localeArray),
            new LoginPluginHandler(termsAndConditions)));

    add(new Label("pinger"));
}

From source file:org.onehippo.forge.resetpassword.frontend.ResetPassword.java

License:Apache License

/**
 * ResetPassword initializer.//from  w  ww. j  a va 2 s  .  co  m
 * @param context plugin context
 * @param config plugin config
 */
public ResetPassword(final IPluginContext context, final IPluginConfig config) {
    super(context, new JavaPluginConfig(config));
    configurationPath = config.getString("labels.location");

    add(CssClass.append("hippo-login-plugin"));

    add(new Label("pageTitle", getString("page.title")));
    add(new ResourceLink("faviconLink", DEFAULT_FAVICON));

    final Configuration configuration = getCustomPluginUserSession();
    final Map<String, String> labelsMap = configuration != null ? configuration.getLabelMap() : new HashMap<>();
    final int urlDuration = configuration != null
            ? configuration.getDurationsMap().get(Configuration.URL_VALIDITY_IN_MINUTES).intValue()
            : DEFAULT_URL_VALIDITY_IN_MINUTES;

    final IRequestParameters requestParameters = getRequest().getQueryParameters();
    final String code = requestParameters.getParameterValue(PARAM_CODE).toString();
    final String uid = requestParameters.getParameterValue(PARAM_UID).toString();
    final boolean hasParameters = StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(uid);

    final boolean autocomplete = getPluginConfig().getAsBoolean("signin.form.autocomplete", true);

    final PanelInfo panelInfo = new PanelInfo(autocomplete, uid, configuration, context, config);
    final Panel resetPasswordForm = new ResetPasswordPanel(panelInfo);
    resetPasswordForm.setVisible(!hasParameters);
    add(resetPasswordForm);

    final Panel setPasswordForm = new SetPasswordPanel(panelInfo, code, resetPasswordForm);
    setPasswordForm.setVisible(hasParameters);
    add(setPasswordForm);

    // In case of using a different edition, add extra CSS rules to show the required styling
    if (config.containsKey(EDITION)) {
        final String edition = config.getString(EDITION);
        editionCss = new CssResourceReference(LoginPlugin.class, "login_" + edition + ".css");
    }

    final ExternalLink termsAndConditions = new ExternalLink("termsAndConditions", TERMS_AND_CONDITIONS_LINK) {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return UsageStatisticsSettings.get().isEnabled();
        }
    };
    termsAndConditions.setOutputMarkupId(true);
    add(termsAndConditions);
}

From source file:org.sakaiproject.sitestats.tool.wicket.widget.Widget.java

License:Educational Community License

private void renderWidget() {
    setRenderBodyOnly(true);/*from  w w  w .  j  a  v a  2s.  co m*/
    removeAll();

    // Icon
    add(new ExternalImage("icon", iconUrl));

    // Title
    add(new Label("title", title));

    // Show more/less links
    ExternalLink showMore = new ExternalLink("showMore", "#");
    showMore.setOutputMarkupId(true);
    add(showMore);
    ExternalLink showLess = new ExternalLink("showLess", "#");
    showLess.setOutputMarkupId(true);
    add(showLess);

    // Content details (middle)
    WebMarkupContainer middle = new WebMarkupContainer("middle");
    middle.setOutputMarkupId(true);
    add(middle);

    // MiniStats ajax load behavior
    AjaxLazyLoadFragment ministatContainer = new AjaxLazyLoadFragment("ministatContainer") {
        private static final long serialVersionUID = 12L;

        @Override
        public Fragment getLazyLoadFragment(String markupId) {
            return Widget.this.getLazyLoadedMiniStats(markupId);
        }

        @Override
        public Component getLoadingComponent(String markupId) {
            StringBuilder loadingComp = new StringBuilder();
            loadingComp.append("<div class=\"ministat load\">");
            loadingComp.append("  <img src=\"");
            loadingComp.append(RequestCycle.get().urlFor(AbstractDefaultAjaxBehavior.INDICATOR, null));
            loadingComp.append("\"/>");
            loadingComp.append("</div>");
            return new Label(markupId, loadingComp.toString()).setEscapeModelStrings(false);
        }
    };
    add(ministatContainer);

    // Tabs
    WidgetTabs widgetTabs = new WidgetTabs("widgetTabs", tabs, 0);
    middle.add(widgetTabs);

    // Links behaviors
    String showMoreOnclick = "showMoreLess('#" + middle.getMarkupId() + "', '#" + showMore.getMarkupId()
            + "','#" + showLess.getMarkupId() + "');return false;";
    showMore.add(AttributeModifier.replace("onclick", showMoreOnclick));
    String showLessOnclick = "showMoreLess('#" + middle.getMarkupId() + "', '#" + showMore.getMarkupId()
            + "','#" + showLess.getMarkupId() + "');return false;";
    showLess.add(AttributeModifier.replace("onclick", showLessOnclick));
}