Example usage for org.apache.wicket.request.handler.resource ResourceReferenceRequestHandler ResourceReferenceRequestHandler

List of usage examples for org.apache.wicket.request.handler.resource ResourceReferenceRequestHandler ResourceReferenceRequestHandler

Introduction

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

Prototype

public ResourceReferenceRequestHandler(ResourceReference resourceReference) 

Source Link

Document

Construct.

Usage

From source file:au.org.theark.lims.web.component.panel.applet.PrintAppletPanel.java

License:Open Source License

public PrintAppletPanel(String id, String printerName) {
    super(id);/*from  w  w w  .ja v a2  s  .  c  o m*/
    setOutputMarkupPlaceholderTag(true);

    applet = new WebMarkupContainer("applet");
    applet.setOutputMarkupPlaceholderTag(true);

    PackageResourceReference jarResourceReference = new PackageResourceReference(PrintAppletPanel.class,
            "jzebra.jar");
    ResourceReferenceRequestHandler reqHandler = new ResourceReferenceRequestHandler(jarResourceReference);

    final String jarResourceUrl = getRequestCycle().urlFor(reqHandler).toString();
    final String codebase = Strings.beforeLastPathComponent(jarResourceUrl, '/') + '/';
    applet.add(new AttributeModifier("codebase", codebase));
    add(applet);

    final AttributeModifier valueParam1 = new AttributeModifier("value", printerName);
    final WebMarkupContainer appletParam1 = new WebMarkupContainer("appletParam1");
    appletParam1.add(valueParam1);
    applet.add(appletParam1);
}

From source file:com.eltiland.ui.course.components.tree.ELTDefaultAbstractTree.java

License:Apache License

/**
 * Creates the icon for current node. By default uses image reference specified by
 *
 * @param parent The parent component/*  www  .  ja  va 2  s .c  om*/
 * @param id     The component id
 * @param node   The tree node
 * @return The web component that represents the icon of the current node
 */
protected Component newNodeIcon(final MarkupContainer parent, final String id, final ELTTreeNode node) {
    return new WebMarkupContainer(id) {
        private static final long serialVersionUID = 1L;

        /**
         * {@inheritDoc}
         */
        @Override
        protected void onComponentTag(final ComponentTag tag) {
            super.onComponentTag(tag);
            IRequestHandler handler = new ResourceReferenceRequestHandler(getNodeIcon(node));
            tag.put("style", "background-image: url('" + RequestCycle.get().urlFor(handler) + "')");
        }
    };
}

From source file:com.gmail.volodymyrdotsenko.jqxwicket.core.panel.LoadingPanel.java

License:Apache License

/**
 * Constructor/*from  ww w  .  j  av  a2 s . co  m*/
 *
 * @param id the markup id
 */
public LoadingPanel(String id) {
    super(id);

    IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);

    this.label = new Label(LAZY_LOAD_COMPONENT_ID,
            String.format("<img alt=\"Loading...\" src=\"%s\"/>", RequestCycle.get().urlFor(handler)));
    this.label.setEscapeModelStrings(false);
    this.label.setOutputMarkupId(true);

    this.add(this.label);
}

From source file:com.googlecode.wicket.jquery.ui.calendar.CalendarBehavior.java

License:Apache License

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

    IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);

    /* adds and configure the busy indicator */
    StringBuilder builder = new StringBuilder();

    builder.append("jQuery(function(){\n");
    builder.append("jQuery(\"<img id='calendar-indicator' src='").append(RequestCycle.get().urlFor(handler))
            .append("' />\").appendTo('.fc-header-center');\n"); //allows only one calendar.
    builder.append("jQuery(document).ajaxStart(function() { jQuery('#calendar-indicator').show(); });\n");
    builder.append("jQuery(document).ajaxStop(function() { jQuery('#calendar-indicator').hide(); });\n");
    builder.append("});\n");

    response.render(JavaScriptHeaderItem.forScript(builder, this.getClass().getSimpleName() + "-indicator"));
}

From source file:com.googlecode.wicket.jquery.ui.form.button.AjaxIndicatingButtonBehavior.java

License:Apache License

/**
 * Build the {@link CssHeaderItem} with the indicator style
 *
 * @return the {@link HeaderItem}// ww w. ja v a  2  s.  co m
 */
public static HeaderItem newIndicatorCssHeaderItem() {
    IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);
    String css = String.format(
            ".ui-icon.ui-icon-indicator { background-image: url(%s) !important; background-position: 0 0; }",
            RequestCycle.get().urlFor(handler));

    return CssHeaderItem.forCSS(css, "jquery-ui-icon-indicator");
}

From source file:com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton.java

License:Apache License

@Override
public JQueryBehavior newWidgetBehavior(String selector) {
    return new JQueryBehavior(selector, "button") {

        private static final long serialVersionUID = 1L;

        @Override//w  ww.  ja v  a  2 s .com
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);

            IRequestHandler handler = new ResourceReferenceRequestHandler(
                    AbstractDefaultAjaxBehavior.INDICATOR);

            // adds the busy indicator style //
            response.render(CssHeaderItem.forCSS(".ui-icon.ui-icon-indicator { background-image: url("
                    + RequestCycle.get().urlFor(handler).toString()
                    + ") !important; background-position: 0 0; }", "jquery-ui-icon-indicator"));
        }

        @Override
        protected String $() {
            // configure the busy indicator start & stop //
            StringBuilder builder = new StringBuilder(super.$());

            builder.append("jQuery(function() {");
            builder.append("jQuery('").append(this.getSelector()).append("')")
                    .append(".click(function() { jQuery(this).button('option', 'icons', {")
                    .append(position == Position.LEFT ? "primary" : "secondary")
                    .append(": 'ui-icon-indicator' }); }); ");
            builder.append("jQuery(document).ajaxStop(function() { jQuery('").append(this.getSelector())
                    .append("').button('option', 'icons', {")
                    .append(position == Position.LEFT ? "primary" : "secondary").append(": null }); }); ");
            builder.append("});");

            return builder.toString();
        }
    };
}

From source file:com.googlecode.wicket.kendo.ui.form.button.AjaxIndicatingButtonBehavior.java

License:Apache License

/**
 * Build the {@link CssHeaderItem} with the indicator style
 *
 * @return the {@link HeaderItem}/*from  www.j  a va  2 s . com*/
 */
private static HeaderItem newIndicatorCssHeaderItem() {
    IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);
    String css = String.format(".k-i-%s { background-image: url(%s); background-position: 0 0; }",
            CSS_INDICATOR, RequestCycle.get().urlFor(handler));

    return CssHeaderItem.forCSS(css, "kendo-ui-icon-indicator");
}

From source file:com.swordlord.gozer.components.wicket.GWAjaxLazyLoadPanel.java

License:Open Source License

/**
 * @param markupId//from  w  ww .  j  a va 2 s . co  m
 *            The components markupid.
 * @return The component to show while the real component is being created.
 */
public Component getLoadingComponent(final String markupId) {
    IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);

    return new Label(markupId, "<img alt=\"Loading...\" src=\"" + RequestCycle.get().urlFor(handler) + "\"/>")
            .setEscapeModelStrings(false);
}

From source file:de.tudarmstadt.ukp.csniper.webapp.support.wicket.ExtendedIndicatingAjaxButton.java

License:Apache License

@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    StringBuilder injection = new StringBuilder();
    CharSequence indicator = RequestCycle.get()
            .urlFor(new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR));

    injection.append("<img id=\"" + getAjaxIndicatorMarkupId() + "\" src=\"" + indicator
            + "\" style=\"vertical-align: bottom; display:none;\" /> ");
    injection.append("<span>" + model.getObject() + "</span>");

    replaceComponentTagBody(markupStream, openTag, injection);
}

From source file:jp.xet.uncommons.wicket.gp.lazy2.AjaxLazyLoadPanel2.java

License:Apache License

/**
 * loading component????/*from   ww w  . j ava  2  s  .c  o m*/
 * 
 * @param markupId The components markupid.
 * @return The component to show while the real component is being created.
 */
public Component getLoadingComponent(String markupId) {
    IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);
    return new Label(markupId, "<img alt=\"Loading...\" src=\"" + RequestCycle.get().urlFor(handler) + "\"/>")
            .setEscapeModelStrings(false);
}