Example usage for org.apache.wicket.ajax AbstractDefaultAjaxBehavior INDICATOR

List of usage examples for org.apache.wicket.ajax AbstractDefaultAjaxBehavior INDICATOR

Introduction

In this page you can find the example usage for org.apache.wicket.ajax AbstractDefaultAjaxBehavior INDICATOR.

Prototype

ResourceReference INDICATOR

To view the source code for org.apache.wicket.ajax AbstractDefaultAjaxBehavior INDICATOR.

Click Source Link

Document

reference to the default indicator gif file.

Usage

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

License:Apache License

/**
 * Constructor// w  ww  .  ja va2  s .c o  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 .j  ava2s  .  com*/
 */
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 w w  .j ava 2s.  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}// w  w w  . ja v a  2 s.co  m
 */
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.mycompany.AjaxCanNotRollLinkPanel.java

License:Apache License

/**
 * Panel??/*  w  w w  .j  a v  a  2  s.c  o  m*/
 *
 * @param label N\
 */
private void init(String label) {
    updateLabel = new Label("updateLabel", label);
    updateLabel.setOutputMarkupId(true);

    indicator = new Image("indicator", AbstractDefaultAjaxBehavior.INDICATOR);
    indicator.setOutputMarkupId(true);
    indicator.setVisible(false);

    update = new AjaxLink("update") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            onClickEvent(target);
        }
    };
    update.setOutputMarkupId(true);
    update.add(updateLabel);
    update.add(indicator);
    add(update);
}

From source file:com.mycompany.TimerPage.java

License:Apache License

public TimerPage() {
    //        final Label timerLabel = new Label("timer",
    //                new AbstractReadOnlyModel<String>() {
    //                    @Override
    //                    public String getObject() {
    //                        SimpleDateFormat formatter =
    //                                new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    //                        return formatter.format(new Date());
    //                    }
    //                });
    //        timerLabel.setOutputMarkupId(true);
    //        add(timerLabel);
    //        add(new Image("indicator", AbstractDefaultAjaxBehavior.INDICATOR));
    ////  w w w. j  a  v  a 2 s .  c  o  m
    //        WebMarkupContainer div = new WebMarkupContainer("dummy");
    //        div.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
    //            @Override
    //            protected void onTimer(AjaxRequestTarget target) {
    //                target.add(timerLabel);
    //            }
    //        });
    //        add(div);
    final String nowTime = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date());
    final Label timerLabel = new Label("timer", nowTime);
    timerLabel.setOutputMarkupId(true);
    add(timerLabel);
    add(new Image("indicator", AbstractDefaultAjaxBehavior.INDICATOR));

    WebMarkupContainer div = new WebMarkupContainer("dummy");
    div.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
        @Override
        protected void onTimer(AjaxRequestTarget target) {
            timerLabel.setDefaultModel(
                    new Model<String>(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())));
            target.add(timerLabel);
        }
    });
    add(div);
}

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

License:Open Source License

/**
 * @param markupId// w ww.  j av a2 s  .  c o 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.alpharogroup.wicket.components.indicator.AjaxIndicatorLoadingPanel.java

License:Apache License

/**
 * Instantiates a new {@link AjaxIndicatorLoadingPanel}.
 *
 * @param id/*from w w  w .java2s.c o  m*/
 *            the id
 */
public AjaxIndicatorLoadingPanel(final String id) {
    super(id);
    setOutputMarkupId(true);
    final Image ajaxindicator = new Image("ajaxindicator", AbstractDefaultAjaxBehavior.INDICATOR);
    add(ajaxindicator);
}

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);
}