SwipeView example requested

I am trying to get SwipeView (touchkit-addon) working while using touchkit 3.0.0 (alpha5) on Vaadin 7.0.1.

Does any one know where to look for a code example.

I understand that I need to set next, previous and current component of the NavigationManager, but when?
If i do that in the constructor then I only can do that for one component since they will overwrite each other
since all components needs to be created at the same time to be able to set next and previous.
The same problem is applicable for doing that in the attach-method…
I did find a method called “onBecomingVisible” but that is only available in NavigationView… so no help…

What am I missing here??
Can any one share a small working example?

Hi Riku,

Check out the
SwipeViewTest
in the TouchKit project. It lacks comments, but it should help you figure things out.

I think the relevant part regarding your question is the NavigationListener.

HTH,
/Jonatan

Thanks Jonatan!

That was exactly what I was looking for.

To be more specific… the following code in the NavigationManager subclass was what I was looking for.


addNavigationListener(new NavigationListener() {
  public void navigate(NavigationEvent event) {
    if (event.getDirection() == Direction.FORWARD) 
    {
    	//Set next component
    }
    else
    {
    	//Set previous component
    }
  }	
} 

It would be really neat to have that implemented as a callback also in the SwipeView… some day… :slight_smile:

Thanks!