Example usage for org.apache.wicket.ajax.markup.html IAjaxLink onClick

List of usage examples for org.apache.wicket.ajax.markup.html IAjaxLink onClick

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.markup.html IAjaxLink onClick.

Prototype

void onClick(final AjaxRequestTarget target);

Source Link

Document

Listener method invoked on the ajax request generated when the user clicks the link

Usage

From source file:com.swordlord.gozer.components.wicket.graph.common.MapArea.java

License:Open Source License

/**
 * Construct the map area/*from  w w w .  ja  v a2 s.  c o  m*/
 * 
 * @param id
 *            Component identifier
 * @param model
 *            Model
 * @param shape
 *            The specific area shape
 * @param coords
 *            The coordinates of the area as a comma separated list
 * @param tooltipText
 *            The tooltip text, or null to not include it
 * @param linkCallback
 *            The link callback function called when the area is click, or
 *            null to have no link functionality
 */
public MapArea(String id, IModel<?> model, String shape, String coords, String tooltipText,
        final IAjaxLink linkCallback) {
    super(id, model);
    this.shape = shape;
    this.coords = coords;
    this.tooltipText = tooltipText;
    if (linkCallback != null) {
        add(new AjaxEventBehavior("onclick") {
            private static final long serialVersionUID = 2615093257359874075L;

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                linkCallback.onClick(target);
            }

            /*
             * protected IAjaxCallDecorator getAjaxCallDecorator() { return
             * new CancelEventIfNoAjaxDecorator(); }
             */
        });
    }
    setOutputMarkupId(true);
}