Example usage for org.apache.wicket.core.request.handler IPartialPageRequestHandler appendJavaScript

List of usage examples for org.apache.wicket.core.request.handler IPartialPageRequestHandler appendJavaScript

Introduction

In this page you can find the example usage for org.apache.wicket.core.request.handler IPartialPageRequestHandler appendJavaScript.

Prototype

void appendJavaScript(CharSequence javascript);

Source Link

Document

Adds javascript that will be evaluated on the client side after components are replaced

If the javascript needs to do something asynchronously (i.e.

Usage

From source file:com.googlecode.wicket.kendo.ui.console.AbstractConsole.java

License:Apache License

/**
 * Logs a message//from  www. ja  va  2s . com
 *
 * @param message the message to log
 * @param error indicates whether the message is an error message
 * @param handler the {@link IPartialPageRequestHandler}
 */
public void log(IPartialPageRequestHandler handler, Serializable message, boolean error) {
    this.log(message, error);

    handler.appendJavaScript(this.consoleBehavior.$(message, error));
}

From source file:com.googlecode.wicket.kendo.ui.console.Console.java

License:Apache License

/**
 * Helper method that logs an info message
 *
 * @param message the message to log/*  w  w w  . ja va 2 s  .co  m*/
 * @param handler the {@link IPartialPageRequestHandler}
 */
public void info(IPartialPageRequestHandler handler, Serializable message) {
    this.log(message, false);

    handler.appendJavaScript(this.consoleBehavior.$(message, false));
}

From source file:com.googlecode.wicket.kendo.ui.console.Console.java

License:Apache License

/**
 * Helper method that logs an error message
 *
 * @param message the message to log/*from  w w  w.  ja  va2  s .c  o  m*/
 * @param handler the {@link IPartialPageRequestHandler}
 */
public void error(IPartialPageRequestHandler handler, Serializable message) {
    this.log(message, true);

    handler.appendJavaScript(this.consoleBehavior.$(message, true));
}

From source file:com.googlecode.wicket.kendo.ui.datatable.DataTable.java

License:Apache License

/**
 * Resets the dataSource to the first page
 *
 * @param handler the {@link IPartialPageRequestHandler}
 */// w  w w.  j  a  va2  s .co m
public void reset(IPartialPageRequestHandler handler) {
    handler.appendJavaScript(String.format("var $w = %s; if ($w) { $w.dataSource.page(1); }", this.widget()));
}

From source file:com.googlecode.wicket.kendo.ui.datatable.DataTable.java

License:Apache License

/**
 * Refreshes the widget by reading from the datasource
 *
 * @param handler the {@link IPartialPageRequestHandler}
 *///from w  ww .j av a  2  s  .co  m
public void refresh(IPartialPageRequestHandler handler) {
    handler.appendJavaScript(String.format("var $w = %s; if ($w) { $w.dataSource.read(); }", this.widget()));
}

From source file:com.googlecode.wicket.kendo.ui.KendoBehaviorFactory.java

License:Apache License

/**
 * Shows the kendo-ui widget using its selector
 *
 * @param handler the {@link IPartialPageRequestHandler}
 * @param selector the html selector (ie: '#myId')
 *//*from www.j  a v a  2 s . c  o m*/
public static void show(IPartialPageRequestHandler handler, String selector) {
    handler.appendJavaScript(KendoBehaviorFactory.getShowStatement(selector));
}

From source file:com.googlecode.wicket.kendo.ui.KendoBehaviorFactory.java

License:Apache License

/**
 * Hides the kendo-ui widget using its selector
 *
 * @param handler the {@link IPartialPageRequestHandler}
 * @param selector the html selector (ie: '#myId')
 *///from   w  w w.j  a va 2  s. c om
public static void hide(IPartialPageRequestHandler handler, String selector) {
    handler.appendJavaScript(KendoBehaviorFactory.getHideStatement(selector));
}

From source file:com.googlecode.wicket.kendo.ui.scheduler.Scheduler.java

License:Apache License

/**
 * Refreshes the events currently available in the selected view.
 *
 * @param handler the {@link IPartialPageRequestHandler}
 *//*from  w  ww  .j a v  a  2  s.  com*/
public final void refresh(IPartialPageRequestHandler handler) {
    handler.appendJavaScript(
            String.format("var widget = %s; widget.dataSource.read(); widget.refresh();", this.widget()));

    this.onRefresh(handler);
}

From source file:com.googlecode.wicket.kendo.ui.widget.accordion.AccordionBehavior.java

License:Apache License

/**
 * Selects and expands a tab, identified by its index<br/>
 * <b>Warning:</b> the index is related to visible tabs only
 *
 * @param handler the {@link IPartialPageRequestHandler}
 * @param index the visible tab's index/*from  www.  j a v a  2 s.  c om*/
 */
public void select(int index, IPartialPageRequestHandler handler) {
    this.tabIndex = index;

    handler.appendJavaScript(this.getSelectStatement(this.tabIndex));
}

From source file:com.googlecode.wicket.kendo.ui.widget.notification.NotificationBehavior.java

License:Apache License

/**
 * Shows the message/*  www  . j  a v a 2s.  co  m*/
 *
 * @param handler the {@link IPartialPageRequestHandler}
 * @param message the message to format
 * @param level the level, ie: info, success, warning, error
 */
public void show(IPartialPageRequestHandler handler, Serializable message, String level) {
    handler.appendJavaScript(this.$(message, level));
}