Wicket JavaScript and jQuery

Wicket JS is a library that helps you to write and handle JavaScript and jQuery within Wicket

License

License

Categories

Categories

JavaScript Languages Wicket User Interface Web Frameworks
GroupId

GroupId

org.rauschig
ArtifactId

ArtifactId

wicket-js
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

bundle
Description

Description

Wicket JavaScript and jQuery
Wicket JS is a library that helps you to write and handle JavaScript and jQuery within Wicket
Project URL

Project URL

http://rauschig.org/wicket-js
Source Code Management

Source Code Management

https://github.com/thrau/wicket-js

Download wicket-js

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.wicket : wicket-core jar 6.0.0
com.fasterxml.jackson.core : jackson-databind jar 2.2.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-all jar 1.9.5

Project Modules

There are no modules declared in this project.

Wicket JavaScript and jQuery

Build Status   Coverage Status

wicket-js makes it easy to write and handle custom JavaScript and jQuery from within Wicket Components and Behaviors. It helps to separate Wicket Ajax Behavior listeners from actual client-side UI functionality, while maintaining the coupling towards Wicket Components.

It provides a (rudimentary) fluent interface that allows you to build JavaScript and jQuery expressions in Java.

Example

With wicket-js you can bind arbitrary JavaScript code to Wicket Components in a clean way. It provides basic syntax elements for typesafe script creation.

component.add(new JsBehavior() {
    @Override
    protected IJavaScript domReadyJs() {
        return new JsCall("alert", "loaded component with markup-id " + id());
    }
});

The API also provides a convenient way of writing jQuery expressions and bind client-side jQuery event behavior to components. This allows for separation of the Wicket AJAX listening mechanisms and the true client-side JavaScript functionality while keeping the JavaScript in the actuall Component definitions.

component.add(new JQueryEventBehavior("mouseenter mouseleave") {
    @Override
    protected IJavaScript callback() {
        return new JsStatements(
                $(this).toggleClass("entered"),
                $(this).trigger("toggled")
        );
    }
});

With jQuery's trigger and Wickets AjaxEventBehavior you can wire client-side JavaScript behavior with Wicket AJAX event handling in a clean way while keeping them separate.

component.add(new AjaxEventBehavior("toggled") {
    @Override
    protected void onEvent(AjaxRequestTarget target) {
        System.out.println("selection has changed!");
    }
});

Dependencies

  • wicket-core 6.11.0
  • jackson-databind [2.0,)

Notice

wicket-js is in alpha phase and subject to rapid development and change

Versions

Version
0.4.0
0.3.0
0.2.0
0.1.0