Question

I am trying to optimize a webapplication for ipad use. I am now implementing the user interaction and related action / feedback. I have the following idea and was wondering if it is possible to achieve this.

Detect the user-interaction with javascript

Determine what element is touched.

Determine the movement.

Communicate with Wicket

Send the movement to the touched element if it implements a certain interface, i.e., touchable.

The element reacts to the user-interaction by implementing, in the interface, defined methods.

An example of a touchable element could be the following:

public class MyPanel extends Panel implements TouchableElement


     @Override
     public void react(int x, int y, int movement) {
           ....
     }
}

Could someone tell me if this is possible and/or give me some tips, drawbacks et cetera. Every piece of feedback is helpfull.

Was it helpful?

Solution

Could someone tell me if this is possible and/or give me some tips, drawbacks et cetera.

This would certainly be possible by creating your own AJAX Behavior extending AbstractDefaultAjaxBehavior that "listens" on the user's clicks via javascript and sends any information you calculated within the javascript to the server, where you can react to it in the Behavior's respond() method. A tutorial on how to create your own AJAX Behavior can be found here.

The code would look something like this then:

MyPanel panel = new MyPanel("panel");
panel.add(new MyAjaxBehavior());

However, if all you want is drag and drop you might find existing solutions like Sven Meiers wicket-dnd.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top