Example usage for org.apache.wicket.request.resource UrlResourceReference UrlResourceReference

List of usage examples for org.apache.wicket.request.resource UrlResourceReference UrlResourceReference

Introduction

In this page you can find the example usage for org.apache.wicket.request.resource UrlResourceReference UrlResourceReference.

Prototype

public UrlResourceReference(final Url url) 

Source Link

Document

Constructor.

Usage

From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java

License:Apache License

/**
 * Replace the default jquery resource reference from the given application with the given cdn
 * url.//from w ww  .  j  a  v a  2s  .  com
 *
 * @param application
 *            the WebApplication
 * @param cdnjsUrl
 *            the given cdn url.
 */
public static void replaceJQueryReference(final WebApplication application, final String cdnjsUrl) {
    application.getJavaScriptLibrarySettings()
            .setJQueryReference(new UrlResourceReference(Url.parse(cdnjsUrl)));
}

From source file:de.alpharogroup.wicket.behaviors.resource.references.TimelineGoogleChartsResourceReference.java

License:Apache License

/**
 * Specify that charts.js depends on Google JS APIs and Wicket WebSocket JavaScript
 * /*from   w  w w .j  a v a  2  s. c o m*/
 * @return a list of dependencies
 */
@Override
public List<HeaderItem> getDependencies() {
    final List<HeaderItem> dependencies = new ArrayList<HeaderItem>();
    dependencies.add(JavaScriptHeaderItem
            .forReference(new UrlResourceReference(Url.parse("https://www.google.com/jsapi"))));
    return dependencies;
}

From source file:eu.uqasar.web.components.util.DefaultTinyMCESettings.java

License:Apache License

private DefaultTinyMCESettings() {
    super(TinyMCESettings.Theme.advanced, Language.valueOf(Session.get().getLocale().getLanguage()));
    // Register non-buttuon plugins
    register(new ContextMenuPlugin());
    register(new WordcountPlugin());
    register(new AdvListPlugin());

    add(Button.fontselect, TinyMCESettings.Toolbar.first, TinyMCESettings.Position.after);
    add(Button.fontsizeselect, TinyMCESettings.Toolbar.first, TinyMCESettings.Position.after);

    // second toolbar
    PastePlugin pastePlugin = new PastePlugin();
    SearchReplacePlugin searchReplacePlugin = new SearchReplacePlugin();
    DateTimePlugin dateTimePlugin = new DateTimePlugin();
    dateTimePlugin.setDateFormat("%m-%d-%Y");
    dateTimePlugin.setTimeFormat("%H:%M");

    add(Button.cut, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(Button.copy, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(pastePlugin.getPasteButton(), TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(pastePlugin.getPasteTextButton(), TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(pastePlugin.getPasteWordButton(), TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(Button.separator, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(searchReplacePlugin.getSearchButton(), TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(searchReplacePlugin.getReplaceButton(), TinyMCESettings.Toolbar.second,
            TinyMCESettings.Position.before);
    add(Button.separator, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
    add(dateTimePlugin.getDateButton(), TinyMCESettings.Toolbar.second, TinyMCESettings.Position.after);
    add(dateTimePlugin.getTimeButton(), TinyMCESettings.Toolbar.second, TinyMCESettings.Position.after);
    add(Button.separator, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.after);
    add(Button.forecolor, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.after);
    add(Button.backcolor, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.after);

    // third toolbar
    TablePlugin tablePlugin = new TablePlugin();
    // EmotionsPlugin emotionsPlugin = new EmotionsPlugin();
    // IESpellPlugin iespellPlugin = new IESpellPlugin();
    FullScreenPlugin fullScreenPlugin = new FullScreenPlugin();
    // DirectionalityPlugin directionalityPlugin = new
    // DirectionalityPlugin();
    add(tablePlugin.getTableControls(), TinyMCESettings.Toolbar.third, TinyMCESettings.Position.before);
    add(Button.separator, TinyMCESettings.Toolbar.third, TinyMCESettings.Position.after);
    // add(emotionsPlugin.getEmotionsButton(),
    // TinyMCESettings.Toolbar.third, TinyMCESettings.Position.after);
    // add(iespellPlugin.getIespellButton(),
    // TinyMCESettings.Toolbar.third, TinyMCESettings.Position.after);
    // add(Button.separator, TinyMCESettings.Toolbar.third,
    // TinyMCESettings.Position.after);
    // add(directionalityPlugin.getLtrButton(),
    // TinyMCESettings.Toolbar.third, TinyMCESettings.Position.after);
    // add(directionalityPlugin.getRtlButton(),
    // TinyMCESettings.Toolbar.third, TinyMCESettings.Position.after);
    // add(Button.separator, TinyMCESettings.Toolbar.third,
    // TinyMCESettings.Position.after);
    add(fullScreenPlugin.getFullscreenButton(), TinyMCESettings.Toolbar.third, TinyMCESettings.Position.after);

    // other settings
    setToolbarAlign(TinyMCESettings.Align.left);
    setToolbarLocation(TinyMCESettings.Location.top);
    setStatusbarLocation(TinyMCESettings.Location.bottom);
    setResizing(true);/*from   w ww .j  a  v  a  2 s  . c o m*/
    disableButton(Button.styleselect);

    // custom settings
    // String styleFormats = "style_formats : [" +
    // "{title : 'Bold text', inline : 'b'},"
    // +
    // "{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},"
    // +
    // "{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},"
    // + "{title : 'Example 1', inline : 'span', classes : 'example1'},"
    // + "{title : 'Example 2', inline : 'span', classes : 'example2'}," +
    // "{title : 'Table styles'},"
    // + "{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}]";

    String renderContextRelativeUrl = RequestCycle.get().getUrlRenderer()
            .renderContextRelativeUrl("assets/css/tinymce-adjustments.css");
    setContentCss(new UrlResourceReference(Url.parse(renderContextRelativeUrl)));
}

From source file:org.hippoecm.frontend.util.WebApplicationHelper.java

License:Apache License

public static UrlResourceReference createUniqueUrlResourceReference(Url url) {
    url.addQueryParameter("antiCache", APPLICATION_HASH);
    return new UrlResourceReference(url);
}

From source file:org.jabylon.rest.ui.wicket.components.UserImagePanel.java

License:Open Source License

private ResourceReference getImageUrl(IModel<User> model) {
    String email = getEMail(model);
    if (email == null)
        email = model.getObject().toString();
    Url url = Url.parse(GRAVATAR_BASE_URL + MD5Util.md5Hex(normalize(email)));
    url.addQueryParameter("size", size);
    url.addQueryParameter("d", "wavatar");
    return new UrlResourceReference(url);

}

From source file:org.jaulp.wicket.base.util.application.ApplicationUtils.java

License:Apache License

/**
 * Replace the default jquery resource reference from the given application with the given cdn
 * url.//from w ww .  j a v  a2s. co  m
 * 
 * @param application
 *            the WebApplication
 * @param cdnjsUrl
 *            the given cdn url.
 */
public static void replaceJQueryReference(WebApplication application, String cdnjsUrl) {
    application.getJavaScriptLibrarySettings()
            .setJQueryReference(new UrlResourceReference(Url.parse(cdnjsUrl)));
}

From source file:org.onehippo.forge.googleauth.cms.GoogleLogoutBehavior.java

License:Apache License

@Override
public void renderHead(final Component component, final IHeaderResponse response) {
    super.renderHead(component, response);
    response.render(MetaDataHeaderItem.forMetaTag("google-signin-scope", "profile email"));
    response.render(MetaDataHeaderItem.forMetaTag("google-signin-client_id", getGoogleSignInClientId()));
    response.render(JavaScriptHeaderItem.forReference(GOOGLE_SIGNIN_LOGOUT_SCRIPT));

    final UrlResourceReference googleSignInJsReference = new UrlResourceReference(
            Url.parse(GOOGLE_SIGNIN_LIBRARY));
    response.render(//from   ww w .  j a va 2 s .  c om
            JavaScriptReferenceHeaderItem.forReference(googleSignInJsReference).setAsync(true).setDefer(true));
}

From source file:org.sakaiproject.mycalendar.WidgetApplication.java

License:Educational Community License

@Override
public void init() {
    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings()//www  . j a v  a 2 s.c  om
            .setJQueryReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(
            new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}

From source file:org.sakaiproject.myconnections.WidgetApplication.java

License:Educational Community License

@Override
public void init() {
    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings()//from w  w w. j a v a  2 s. com
            .setJQueryReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(
            new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}

From source file:org.sakaiproject.sitedescription.WidgetApplication.java

License:Educational Community License

@Override
public void init() {

    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(
            new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(
            new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}