Buy me a coffee :)

Wicket - jQuery UI

jQuery UI integration in Wicket 6.x, Wicket 7.x , Wicket 8.x & Wicket 9.x

CheckBox






Components / Samples

Description

This sample shows how to use the Kendo UI Check.

Since

wicket-kendo-ui-7.1.0

Licensing

Kendo UI "Core" is Apache License 2.0 licensed, starting from version 2014.1.416.
Prior to version 2014.1.416, Kendo UI "Web" was licensed under GPLv3.

A pro version - with a commercial license - is also available, it provides additional widgets (see http://docs.telerik.com/kendo-ui/intro/supporting/list-of-widgets)
To be able to use it, you need to change the ResourceReference with kendo.all.min.js

See also

[howto]-change-resource-references

Sources

  • Java
  • HTML
  • CSS
package com.googlecode.wicket.jquery.ui.samples.kendoui.radio;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import com.googlecode.wicket.kendo.ui.form.CheckBox;
import com.googlecode.wicket.kendo.ui.form.CheckBox.Label;
import com.googlecode.wicket.kendo.ui.form.button.AjaxButton;
import com.googlecode.wicket.kendo.ui.form.button.Button;
import com.googlecode.wicket.kendo.ui.panel.KendoFeedbackPanel;

public class KendoCheckBoxPage extends AbstractRadioPage
{
	private static final long serialVersionUID = 1L;

	private final Form<Boolean> form;

	public KendoCheckBoxPage()
	{
		// form //
		this.form = new Form<Boolean>("form", Model.of(Boolean.FALSE));
		this.add(this.form);

		// feedback //
		this.form.add(new KendoFeedbackPanel("feedback"));

		// checkbox //
		CheckBox checkbox = new CheckBox("check", this.form.getModel());
		Label label = new Label("label", "My checkbox", checkbox);
		this.form.add(checkbox, label);

		// buttons //
		this.form.add(this.newSubmitButton("submit"));
		this.form.add(this.newAjaxButton("button"));
	}

	private void info(Component component, IModel<Boolean> model)
	{
		this.info(component.getMarkupId() + " has been clicked");
		this.info("The model object is: " + model.getObject());
	}

	private Button newSubmitButton(String id)
	{
		return new Button(id) {

			private static final long serialVersionUID = 1L;

			@Override
			public void onSubmit()
			{
				KendoCheckBoxPage.this.info(this, form.getModel());
			}
		};
	}

	private AjaxButton newAjaxButton(String id)
	{
		return new AjaxButton(id) {

			private static final long serialVersionUID = 1L;

			@Override
			protected void onSubmit(AjaxRequestTarget target)
			{
				KendoCheckBoxPage.this.info(this, form.getModel());
				target.add(form);
			}
		};
	}
}
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<wicket:head>
	<title>Wicket Kendo UI: check</title>
</wicket:head>
</head>
<body>
<wicket:extend>

	<div id="demo-panel">
		<form wicket:id="form">
			<br/>
			<input wicket:id="check" type="checkbox"/>
			<label wicket:id="label">[label]</label>

			<br/><br/>
			<button wicket:id="submit" type="submit">Submit</button>
			<button wicket:id="button">Ajax Submit</button>

			<br/><br/>
			<div wicket:id="feedback" style="width: 360px;"></div>
		</form>
	</div>

</wicket:extend>
</body>
</html>