Re: Ajax Navigation

2011-07-25 Thread Barry Books
Tests are on the todo list, probably in the next day or two. Here is
any example that implements tabs with a zone.


Image

Description

In A Room



tab0




 

  




The java side is this

 @InjectComponent
  private Zone tabs;

 @Property
 private Integer tab;

  Object onTab(Integer tab) {
  this.tab = tab;
  return tabs.getBody();
  }

  public boolean isTab(Integer index) {
  if ( tab == index ) {
  return true;
  }
  return false;
  }

If you wanted history you just include history="function(event,ui,url)
{ your code }" in the pagelink element. I'm still trying to figure out
which jQuery history library to use, but I'm not going to make the
mixin depend on any of them. Also in this case bind in subclassed like
this

public class Click extends Bind {

}

to create a click handler. This allows you to name your mixin
parameters and bind multiple event types. There is also a slideChange
event that was created the same way. That component returns slide
change events back to Tapestry via

void onSlideChange(Integer value) {
logger.info("slideChange {}",value);
}

Hope that helps some. I'm still working on the api but I'm hoping to
have it finished in a few days.

Barry

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Ajax Navigation

2011-07-25 Thread dragan.sahpas...@gmail.com
Nice,
Do you have some tests for it to see it in action?
I couldn't find any using the bind mixin.

Cheers,
Dragan Sahpaski



On Mon, Jul 25, 2011 at 2:12 AM, Barry Books  wrote:

> If you look in my fork of tapestry5-jquery on github
>
> https://github.com/trsvax/tapestry5-jquery
>
> there is a mixin called bind that supports this. You can bind jQuery
> events to Tapestry component events and provide a tittle and history
> callback when the event is triggered. It also supports Tapestry zones.
> Since there is no standard jQuery history module the implementation is
> pretty generic.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Ajax Navigation

2011-07-24 Thread Barry Books
If you look in my fork of tapestry5-jquery on github

https://github.com/trsvax/tapestry5-jquery

there is a mixin called bind that supports this. You can bind jQuery
events to Tapestry component events and provide a tittle and history
callback when the event is triggered. It also supports Tapestry zones.
Since there is no standard jQuery history module the implementation is
pretty generic.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Ajax Navigation

2011-07-24 Thread dragan.sahpas...@gmail.com
HI,
On Sun, Jul 24, 2011 at 7:14 PM, stephanos2k
wrote:

> Thanks a lot for your post! :-)
>
> I looked at what you suggested, are there any hints/tips on how to
> integrate
> such functionality with Tapestry?
>
> Well it's obviously not trivial.


> I suppose a JS script (like history.js) should receive and handle + request
> and 'call' Tapestry to actually do the rendering. But I can't seem to come
> up with a good way on how to 'squeeze' the library in-between.
>
> Basically the short example here <https://github.com/balupton/History.js> 
> relies
on rendering JSON in different states (all the logic is based on states).
Using tapestry you can make a GET request and return a JSON response. So
that's maybe the simplest scenario.

More complex scenario would be that you integrate zone's in the whole
picture. This one's tricky and I wouldn't suggest much at the moment. Maybe
one idea would be: when you make an ajax request using an EventLink you
somehow put the name of the action (or some other ID) in the URL and also
the context and the parameters in the URL (basically all info that the
EventLink carries), so if you bookmark and make a GET you make an Ajax call
using those parameters and update the corresponding zone reconstructing the
link that triggers the update.
I'm not sure if this is a good idea, but as I said generalizing
the functionality using zones is not trivial.

Cheers
Dragan Sahpaski


> Cheers
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Ajax-Navigation-tp4627764p4628324.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Ajax Navigation

2011-07-24 Thread stephanos2k
Thanks a lot for your post! :-)

I looked at what you suggested, are there any hints/tips on how to integrate
such functionality with Tapestry? 

I suppose a JS script (like history.js) should receive and handle + request
and 'call' Tapestry to actually do the rendering. But I can't seem to come
up with a good way on how to 'squeeze' the library in-between.

Cheers

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Ajax-Navigation-tp4627764p4628324.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Ajax Navigation

2011-07-24 Thread dragan.sahpas...@gmail.com
Hi,
The approach in general is either use HTML5 history (works for html5
compatible browsers only), or use the hash change mechanism.

As far as I know there is no out of the box integration with tapestry5, but
there are various js scripts like the
history.js<http://plugins.jquery.com/project/history-js>jquery plugin
(supports html5 history and fallback for html4 with the hash
change mechanism), that you can try and share your experience with
community.

Cheers,
Dragan Sahpaski



On Sun, Jul 24, 2011 at 1:24 PM, stephanos2k
wrote:

> I have a web page similar to GMail: one list of items, sub-folders (like
> Spam/Inbox) and separate items to 'go in to'. Everything works via AJAX,
> but
> now I want to have bookmarkable URLs.
>
> Any recommendations on how to achieve this with Tapestry?
>
> Cheers
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Ajax-Navigation-tp4627764p4627764.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Ajax Navigation

2011-07-24 Thread stephanos2k
I have a web page similar to GMail: one list of items, sub-folders (like
Spam/Inbox) and separate items to 'go in to'. Everything works via AJAX, but
now I want to have bookmarkable URLs.

Any recommendations on how to achieve this with Tapestry?

Cheers

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Ajax-Navigation-tp4627764p4627764.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

2010-08-12 Thread Thiago H. de Paula Figueiredo
On Thu, 12 Aug 2010 18:56:44 -0300, Darren Williams   
wrote:



Thanks Thiago,


Hi!

we were trying to avoid rebuilding the beanModelSource on each render,  
because it is backed by a large dataset.


I can't see the relation between a large data set and the BeanModel  
creation. The same BeanModel instance is used to process all the objects  
shown in the grid.


We have modified your suggestion as  shown below. Is this the best  
technique to persist this value like we have here, instead of constantly  
creating?


If you're using Tapestry 5.1.0.5 or below, you can annotate the beanModel  
field with @Retain and keep your getBeanModel() method as is. This way,  
the BeanModel instance will be created. You could also keep the BeanModel  
in a static field.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

2010-08-12 Thread Darren Williams
Thanks Thiago,

we were trying to avoid rebuilding the beanModelSource on each render, because 
it is backed by a large dataset. We have modified your suggestion as  shown 
below. Is this the best technique to persist this value like we have here, 
instead of constantly creating?

@Persist
private BeanModel beanModel;

@Inject
private Messages messages;

public BeanModel getBeanModel() {
//setup the model for this user
if (beanModel == null) {

beanModel=beanModelSource.createDisplayModel(License.class, messages);
beanModel.include("entered","endDate");

beanModel.add("purchase.orgUnit.name").label("Organization");
beanModel.add("purchase.product.name").label("Product");

beanModel.add("purchase.licenseType.name").label("License");

//sorting
if (_grid.getSortModel().getSortConstraints().isEmpty() 
) {
_grid.getSortModel().updateSort("entered");
//this is still not exposed in tapestry 5.2 so 
you can't change order
//_grid.setSortAscending(false);
}
}
return beanModel;
}


On Aug 12, 2010, at 1:46 PM, Thiago wrote:

> Hi!
> 
> Try this:
> 
>   public BeanModel getBeanModel() {
>   beanModel=beanModelSource.createDisplayModel(License.class, 
> messages);
>   beanModel.include("entered","endDate");
>   beanModel.add("purchase.orgUnit.name").label("Organization");
>   beanModel.add("purchase.product.name").label("Product");
>   beanModel.add("purchase.licenseType.name").label("License");
>   
>   //sorting
>   if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
>   logger.warn("sort constraints");
>   _grid.getSortModel().updateSort("entered");
>   //this is still not exposed in tapestry 5.2 so you 
> can't change order
>   //_grid.setSortAscending(false);
>   }
>   }
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br

_
Darren Williams
LiveTime Software Inc.
http://www.livetime.com
(949) 777 5800





Re: Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

2010-08-12 Thread Thiago H. de Paula Figueiredo
On Thu, 12 Aug 2010 17:46:55 -0300, Darren Williams   
wrote:


When upgrading to Tapestry 5.2 the inPlace Ajax grid no longer works. It  
appears to be related to the sorting and the fact that the _grid sort  
model gets reset to null when using the navigation. It works fine if you  
don't use the AJAX inPlace call.


Hi!

Try this:

public BeanModel getBeanModel() {
beanModel=beanModelSource.createDisplayModel(License.class, 
messages);
beanModel.include("entered","endDate");
beanModel.add("purchase.orgUnit.name").label("Organization");
beanModel.add("purchase.product.name").label("Product");
beanModel.add("purchase.licenseType.name").label("License");

//sorting
if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
logger.warn("sort constraints");
_grid.getSortModel().updateSort("entered");
//this is still not exposed in tapestry 5.2 so you 
can't change order
//_grid.setSortAscending(false);
}
}

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

2010-08-12 Thread Darren Williams
When upgrading to Tapestry 5.2 the inPlace Ajax grid no longer works. It 
appears to be related to the sorting and the fact that the _grid sort model 
gets reset to null when using the navigation. It works fine if you don't use 
the AJAX inPlace call.

Is anyone else seeing the same thing on Tap 5.2? It looks like the singleton 
pattern has changed the behavior.


@Component(id="receiptGrid")
private Grid _grid;

@Inject
private BeanModelSource beanModelSource;
private BeanModel beanModel;
@Inject
private Messages messages;

public void setupRender() {
beanModel=beanModelSource.createDisplayModel(License.class, 
messages);
beanModel.include("entered","endDate");
beanModel.add("purchase.orgUnit.name").label("Organization");
beanModel.add("purchase.product.name").label("Product");
beanModel.add("purchase.licenseType.name").label("License");

//sorting
if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
logger.warn("sort constraints");
_grid.getSortModel().updateSort("entered");
//this is still not exposed in tapestry 5.2 so you 
can't change order
//_grid.setSortAscending(false);
}
}

public BeanModel getBeanModel() {
return beanModel;
}


cheers, darren