ReflectionSaltSource in tapestry-spring-security

2011-03-07 Thread Chuck Kring
Does anybody have experience configuring tapestry-spring-security to use 
a ReflectionSaltSource?   I've tried a few things and haven't been able 
to get it to work.   I was able to get the tapestry side wired up as an 
alias contribution but spring-security was not configured.


Thanks in advance

Chuck Kring

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



Re: Discussion

2010-12-21 Thread Chuck Kring
For what it's worth, Tapestry provides an embedded user interface for a 
medical device.


We received FDA 510k clearance last fall and are working on the final 
details before our 1.0 release.


This is deployed on a Linux appliance and mostly consists of Jetty, 
Tapestry, HSQLDB, Chenillekit, Spring-tapestry-security, JFreechart and 
JasperReports.Every instance of this product will provide services 
for all of the staff in a nursing home as well as collect data from 
every bed.


There are not a lot of users per facility, but the user interface has a 
number of Ajax-enabled dashboards that have to stay alive, unattended, 
7/24.   I hope this qualifies as a 'serious project'.


We've found Tapestry to be very reliable and once you get up the 
learning curve it is a very effective development environment.   
Personally I don't care what Howard looks like because his code looks 
great


Chuck Kring
www.wirelessmedcare.com

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



Re: [Bulk] Re: add target to Link

2010-12-20 Thread Chuck Kring

Hi Howard,  thanks for the response.

The issue is that I'm returning a PageLink from an event handler.   
There is no template involved.


This is called from a form in page embedded in a frame (I know...).   In 
general the form does things like go back, etc, but in one case I want 
the form to return a page not in the frame - either as a tab or new window.


Having said that,  I've come up with a workable solution for now.  The 
event handler returns null and rather I use the onClick() event handler 
on the button  with a URL constructed from the PageLink.  It's messy but 
not too bad.


I would have preferred a setTarget() method on the Link.

Regards,

Chuck

On 12/20/2010 2:21 PM, Howard Lewis Ship wrote:

Have you tried this?  Just adding a target=foo attribute to the template
will get the job done ... that's what informal parameters are for.

On Sat, Dec 18, 2010 at 8:34 PM, Chuck Kringcjkr...@pacbell.net  wrote:


Hello,

I have a submit button that returns a link that I'd like to have open in a
new window.  I noticed that the Tapestry 4 link API supported specification
of that target, but I can figure out how to do it in Tapestry 5.1.0.5.

How do I specify the target for a Link in Tapestry 5?

Thanks in advance.

Chuck

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






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



Re: [Bulk] Re: add target to Link

2010-12-20 Thread Chuck Kring
My mistake.  I am only returning a link. I ended up using Javascript and 
it would have been nice to be able to set the target attribute in Java.  
My question was based upon the fact that you could do that in Tapestry 4 
so I figured there was some other way to do this in T5.


On 12/20/2010 4:17 PM, Thiago H. de Paula Figueiredo wrote:
Link != PageLink. Link is not a component and it only represents an 
URL. There's no way of returning one and getting it to open in another 
tab without using JavaScript. 


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



add target to Link

2010-12-18 Thread Chuck Kring

Hello,

I have a submit button that returns a link that I'd like to have open in 
a new window.  I noticed that the Tapestry 4 link API supported 
specification of that target, but I can figure out how to do it in 
Tapestry 5.1.0.5.


How do I specify the target for a Link in Tapestry 5?

Thanks in advance.

Chuck

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



Re: Storing assets in database ...

2010-12-09 Thread Chuck Kring
I use onActivate() to return an image for a heartbeat to an Ajax 
dashboard.  Using an image allows me to use the onLoad event to verify 
connectivity.When I proposed that, I was warned that using 
onActivate() to return an image can create performance issues.   In my 
case I'm returning a 1-pixel GIF so wasn't worried about performance but 
you might want to be careful because you are doing a lot of back end 
processing.


Chuck

On 12/9/2010 9:37 AM, Michael Gentry wrote:

I took a more conventional approach.  I created a DatabaseImage page
that streams the image from the database.

In the TML of the page that wants to embed an image from the database:

img src=${imageLink}/

In the Java:

@Inject
private PageRenderLinkSource pageRenderLinkSource;

public Link getImageLink()
{
 String encryptedContext = DatabaseImage.encrypt(...);
 return 
pageRenderLinkSource.createPageRenderLinkWithContext(DatabaseImage.class,
encryptedContext);
}

The encrypt method basically encrypts everything I need (table names,
primary keys, etc) to go find the database image and stuffs it into
the link's context.  At runtime, I end up with requests from the
browser like:

GET 
/MyApp/databaseimage/$002faiNglawZWKGHKrl$002fgpKneotYRwaq9gMk3dPr5zQkW8KkoezyRBm0TutynHstG0$002fyn$002b6izoD$002f$002f9V$000a$002fqAXmUmgxQ$003d$003d

Ugly URL, but it works.  In the DatabaseImage page itself I have:

public StreamResponse onActivate(String context)
{
  ...
}

that decrypts the encrypted context, finds the image blob stored in
the database, and streams it out as the response.

mrg


On Thu, Dec 9, 2010 at 7:22 AM, Igor Drobiazkoigor.drobia...@gmail.com  wrote:

There is no documentation for it as this is not an often use case. However,
just provide you own implementation of AsssetFactory, build it or bind it in
your module and make the contribution:

public void contributeAssetSource(MappedConfigurationString,
AssetFactory  configuration, @InjectService(DbAssetFactory) AssetFactory
dbAssetFactory) {
configuration.add(db, dbAssetFactory);
}

Now it is up to you to implement the AssetFactory.

On Thu, Dec 9, 2010 at 11:53 AM, Gunnar Eketrapp
gunnar.eketr...@gmail.comwrote:


Hi!

I would like to store uploaded images in the database and then use them in
  template files.

Are there any examples of how to do this? I.e. how to define a new
AssetFactory and contribute it to the AssetSource service configuration.

Thanks in advance,
Gunnar Eketrapp (from a very cold and snowy Stockholm)

==
The doc says ...

New Asset Domains

If you wish to create new domains for assets, for example to allow assets
to
be stored on the file system or in a database, you may define a new
AssetFactory and contribute it to the AssetSource service configuration.

===




--
Best regards,

Igor Drobiazko
http://tapestry5.de


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




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



Re: Storing assets in database ...

2010-12-09 Thread Chuck Kring

Hi Thiago,

On 12/9/2010 1:10 PM, Thiago H. de Paula Figueiredo wrote:
On Thu, 09 Dec 2010 18:33:13 -0200, Chuck Kring cjkr...@pacbell.net 
wrote:


I use onActivate() to return an image for a heartbeat to an Ajax 
dashboard.


Why the heartbeat? Are you talking about the Tapestry heartbeat concept?


No, this is different.  My application uses an Ajax dashboard on a 
kiosk.  Components on the dashboard are periodically polled to produce 
updated charts,  status icon changes, etc. In addition to the 
component updates the dashboard refreshes every few minutes and when 
objects (beds, this is a medical application) are added or removed.  
This is required because the icon components represent beds and the 
number of icons (components) changes when the number of beds changes.


This dashboard has to run 7/24 and to reconnect when the server or the 
network are down.


I use the image (essentially a web bug) before a page update.  If the 
image fails, I continually poll the image until I get a response, then I 
do a page refresh.   This prevent a page failure  when the server is down.




When I proposed that, I was warned that using onActivate() to return 
an image can create performance issues.


I can't see why, specially in T5.2, which doesn't use page pooling.



I agree that this is likely not an issue for T5.2 - I'm currently on 
5.1.05.


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



another bug in image submit

2010-11-24 Thread Chuck Kring

Hello,

Something odd is occurring in Tapestry 5.1.0.5.

I'm using a form inside of a zone.  In the form are several image 
submits - arrows to move time back and forth in a chart.  When I click 
on any submit,  all  image submits receive an event.   It doesn't matter 
if I specify the event or use onSelectedFrom.   When using a normal 
submit (no image parameter) everything is fine.


For example, in the following tml, when I click on back, the onBack() 
AND the onForward() event handlers fire.  When I click on the forward 
icon,  only the onForward() event handler fires.


?xml version=1.0 encoding=utf-8?
t:container xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
div
t:zone t:id=theZone
form t:type=form t:zone=theZone
t:submit t:id=back t:event=back  class=timecontrol/
t:submit t:id=forward t:event=forward class=timecontrol
  image=context:icons2/control_forward.png/
/form
/t:zone
/div
/t:container
~

Am I doing something wrong?   If this is a bug, is it related to 
TAP5-711 or something else?


Thanks!

Chuck Kring

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



Re: another bug in image submit

2010-11-24 Thread Chuck Kring
Oops.  Sorry about the title.  I'm not sure yet that this is a bug or 
operator error.


On 11/24/2010 4:05 PM, Chuck Kring wrote:

Hello,

Something odd is occurring in Tapestry 5.1.0.5.

I'm using a form inside of a zone.  In the form are several image 
submits - arrows to move time back and forth in a chart.  When I click 
on any submit,  all  image submits receive an event.   It doesn't 
matter if I specify the event or use onSelectedFrom.   When using 
a normal submit (no image parameter) everything is fine.


For example, in the following tml, when I click on back, the onBack() 
AND the onForward() event handlers fire.  When I click on the forward 
icon,  only the onForward() event handler fires.


?xml version=1.0 encoding=utf-8?
t:container 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;

div
t:zone t:id=theZone
form t:type=form t:zone=theZone
t:submit t:id=back t:event=back  class=timecontrol/
t:submit t:id=forward t:event=forward class=timecontrol
  image=context:icons2/control_forward.png/
/form
/t:zone
/div
/t:container
~

Am I doing something wrong?   If this is a bug, is it related to 
TAP5-711 or something else?


Thanks!

Chuck Kring

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




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



Re: Tap 5.2.2 With JQuery Problems

2010-11-10 Thread Chuck Kring
I'm using T5.0.5 and the Jquery accordion.   I ran into compatibility 
issues between JQuery and Prototype that were solved using the 
suggestions on this page:


http://docs.jquery.com/Using_jQuery_with_Other_Libraries

Chuck Kring

On 11/10/2010 11:19 AM, iberck wrote:

Dear tapestry users:

I try to use http://github.com/andyhot/tapestry5-jquery/tree/tap-5.2 with
Tapestry 5.2 but I have some problems, when I open my application I watch
the exception:

org.apache.tapestry5.internal.services.RenderQueueException: Render queue
error in SetupRender[core/ExceptionReport:exceptiondisplay]: Unable to
create a client URL for classpath resource org/got5/tapestry5/tapestry.js:
The resource path was not within an aliased path. [at
classpath:org/apache/tapestry5/corelib/pages/ExceptionReport.tml, line 11]

My pom.xml

dependency
 groupIdorg.apache.tapestry/groupId
 artifactIdtapestry-core/artifactId
 version5.2.2/version
/dependency
dependency
 groupIdorg.got5/groupId
 artifactIdtapestry5-jquery/artifactId
 version1.1.0-SNAPSHOT/version
/dependency

...
repository
 iddevlab722-repo/id

urlhttp://nexus.devlab722.net/nexus/content/repositories/releases/url
 releases
 enabledtrue/enabled
 /releases
 snapshots
 enabledfalse/enabled
 /snapshots
 /repository

 repository
 iddevlab722-snapshot-repo/id

urlhttp://nexus.devlab722.net/nexus/content/repositories/snapshots/url
 releases
 enabledfalse/enabled
 /releases
 snapshots
 enabledtrue/enabled
 /snapshots
 /repository

Anyone may help me ?

Thanks in advance for your time



Re: how to create a loop of parameters?

2010-10-15 Thread Chuck Kring

 I'm going to give it a try.  It looks very usable.

Thanks for the lead.

Chuck

On 10/14/2010 5:51 PM, ael wrote:

JQuery on the Go...

http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/

Simple Stupid JQuery Accordion :)


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



Re: how to create a loop of parameters?

2010-10-15 Thread Chuck Kring

 Understood.

The use model for this would be to allow Blocks to be dynamically 
created in the template then retrieved using 
ComponentResources.findtBlock().   I think findBlock() works off of the 
Tapestry id which can't be set.


Chuck

On 10/15/2010 11:45 AM, Howard Lewis Ship wrote:

On Fri, Oct 15, 2010 at 11:41 AM, Chuck Kringcjkr...@pacbell.net  wrote:

  Whoa.   Everything is easy in Tapestry.  The hard part is figuring out the
easy way to do it.

Howard, if you happen to read this,  one thing that would be generally
useful would be to allow t:id to be set using a variable.  Something like
this:

t:loop source=items value=item
t:something t:id=${item.identifier}/
/t:loop


I don't see that as doable; that implies that the structure of the
page itself is variable.  A component's id, just like its type and
parameter bindings, is part of the static structure that is essential
to Tapestry's ability to share a single page instance across multiple
threads, or share requests across multiple servers in a cluster.

Typically, you will use an Environmental object to coordinate an outer
component (that pushes an object into the Environment) with an inner
component (that pulls the environmental out of the Environment).


Right now you can set the HTML id but not the tapestry id this way.   There
have been a number of cases where I wanted to do this.  It might have been
useful here.

Thanks for building a great framework.

Chuck

On 10/14/2010 3:05 PM, Howard Lewis Ship wrote:

There isn't a good way to do this.

You could inject the parameters as Blocks into your code, then pass
a List or Map of those Blocks to your component.

It isn't as pretty in the markup.

Alternately, you could have a naming convention, i.e.

t:parameter name=fooTitle.../t:parameter
t:parameter name=fooContent.../t:parameter
t:parameter name=barTitle.../t:parameter
t:parameter name=barContent.../t:parameter


On Thu, Oct 14, 2010 at 2:29 PM, Chuck Kringcjkr...@pacbell.netwrote:

  Hi everyone,

I'm trying to get equanda/accordion to work with a variable set of tabs
and
contents.The intent is that I want to loop across a list of groups of
objects, with each group a tab and each entry in the tab is a Link to a
page
about the object.  Something like this:

Group A
  obj 1
  obj 2
  obj 3
Group B
  obj 1
  obj 4

For various reasons an accordion will work well for this.

This doesn't work but describes what I'd like to do:

div type=equanda/accordion
t:loop source=groups value=group
t:parameter id=${panel.title_id}${panel.title}/t:parameter
t:parameter id=${panel.content_id}${panel.content}/t:parameter
/t:loop
/div

Any suggestions?

Thanks

Chuck Kring


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





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







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



Re: how to create a loop of parameters?

2010-10-15 Thread Chuck Kring
 Clarification: programatically created with ids specified from the 
page or component class, then retrieved using findBlock() or something 
similar.


On 10/15/2010 2:54 PM, Chuck Kring wrote:

 Understood.

The use model for this would be to allow Blocks to be dynamically 
created in the template then retrieved using 
ComponentResources.findtBlock().   I think findBlock() works off of 
the Tapestry id which can't be set.


Chuck

On 10/15/2010 11:45 AM, Howard Lewis Ship wrote:
On Fri, Oct 15, 2010 at 11:41 AM, Chuck Kringcjkr...@pacbell.net  
wrote:
  Whoa.   Everything is easy in Tapestry.  The hard part is figuring 
out the

easy way to do it.

Howard, if you happen to read this,  one thing that would be generally
useful would be to allow t:id to be set using a variable.  Something 
like

this:

t:loop source=items value=item
t:something t:id=${item.identifier}/
/t:loop


I don't see that as doable; that implies that the structure of the
page itself is variable.  A component's id, just like its type and
parameter bindings, is part of the static structure that is essential
to Tapestry's ability to share a single page instance across multiple
threads, or share requests across multiple servers in a cluster.

Typically, you will use an Environmental object to coordinate an outer
component (that pushes an object into the Environment) with an inner
component (that pulls the environmental out of the Environment).

Right now you can set the HTML id but not the tapestry id this 
way.   There
have been a number of cases where I wanted to do this.  It might 
have been

useful here.

Thanks for building a great framework.

Chuck

On 10/14/2010 3:05 PM, Howard Lewis Ship wrote:

There isn't a good way to do this.

You could inject the parameters as Blocks into your code, then pass
a List or Map of those Blocks to your component.

It isn't as pretty in the markup.

Alternately, you could have a naming convention, i.e.

t:parameter name=fooTitle.../t:parameter
t:parameter name=fooContent.../t:parameter
t:parameter name=barTitle.../t:parameter
t:parameter name=barContent.../t:parameter


On Thu, Oct 14, 2010 at 2:29 PM, Chuck 
Kringcjkr...@pacbell.netwrote:

  Hi everyone,

I'm trying to get equanda/accordion to work with a variable set of 
tabs

and
contents.The intent is that I want to loop across a list of 
groups of
objects, with each group a tab and each entry in the tab is a Link 
to a

page
about the object.  Something like this:

Group A
  obj 1
  obj 2
  obj 3
Group B
  obj 1
  obj 4

For various reasons an accordion will work well for this.

This doesn't work but describes what I'd like to do:

div type=equanda/accordion
t:loop source=groups value=group
t:parameter id=${panel.title_id}${panel.title}/t:parameter
t:parameter id=${panel.content_id}${panel.content}/t:parameter
/t:loop
/div

Any suggestions?

Thanks

Chuck Kring


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





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







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




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



Re: how to create a loop of parameters?

2010-10-15 Thread Chuck Kring

 Separate issues.

For this I'm using the SImple Stupid JQuery Accordion and it's working 
well.


The issue that I've run into in the past is that there are cases where 
generating Blocks in the page based upon page data and accessing them 
(e.g. to pass into a zone) would be useful.


I understand the issues with generating Blocks and using them in 
components in the same page.


Chuck

On 10/15/2010 4:41 PM, Josh Canfield wrote:

The use model for this would be to allow Blocks to be dynamically created
in the template then retrieved using ComponentResources.findtBlock().

 From my understanding, adding something like this would be a serious
departure from how tapestry works.

First, in order to create the dynamic blocks that you want to access
with findBlock, you would actually have to render the body of the
component. When would you get a chance to call findBlock? your outer
component calls setuprender, beginrender, beforerendertemplate,
beforerenderbody before the body is actually rendered.

It seems like what you are running into is that your use case is
outside the scope of the component you are trying to use. Accordion
was built to have a static number of panes.

You could build a new component that supports dynamic panes.

Josh

On Fri, Oct 15, 2010 at 3:01 PM, Chuck Kringcjkr...@pacbell.net  wrote:

  Clarification: programatically created with ids specified from the page or
component class, then retrieved using findBlock() or something similar.

On 10/15/2010 2:54 PM, Chuck Kring wrote:

  Understood.

The use model for this would be to allow Blocks to be dynamically created
in the template then retrieved using ComponentResources.findtBlock().   I
think findBlock() works off of the Tapestry id which can't be set.

Chuck

On 10/15/2010 11:45 AM, Howard Lewis Ship wrote:

On Fri, Oct 15, 2010 at 11:41 AM, Chuck Kringcjkr...@pacbell.net
  wrote:

  Whoa.   Everything is easy in Tapestry.  The hard part is figuring out
the
easy way to do it.

Howard, if you happen to read this,  one thing that would be generally
useful would be to allow t:id to be set using a variable.  Something
like
this:

t:loop source=items value=item
t:something t:id=${item.identifier}/
/t:loop


I don't see that as doable; that implies that the structure of the
page itself is variable.  A component's id, just like its type and
parameter bindings, is part of the static structure that is essential
to Tapestry's ability to share a single page instance across multiple
threads, or share requests across multiple servers in a cluster.

Typically, you will use an Environmental object to coordinate an outer
component (that pushes an object into the Environment) with an inner
component (that pulls the environmental out of the Environment).


Right now you can set the HTML id but not the tapestry id this way.
There
have been a number of cases where I wanted to do this.  It might have
been
useful here.

Thanks for building a great framework.

Chuck

On 10/14/2010 3:05 PM, Howard Lewis Ship wrote:

There isn't a good way to do this.

You could inject the parameters as Blocks into your code, then pass
a List or Map of those Blocks to your component.

It isn't as pretty in the markup.

Alternately, you could have a naming convention, i.e.

t:parameter name=fooTitle  .../t:parameter
t:parameter name=fooContent  .../t:parameter
t:parameter name=barTitle  .../t:parameter
t:parameter name=barContent  .../t:parameter


On Thu, Oct 14, 2010 at 2:29 PM, Chuck Kringcjkr...@pacbell.net
  wrote:

  Hi everyone,

I'm trying to get equanda/accordion to work with a variable set of
tabs
and
contents.The intent is that I want to loop across a list of groups
of
objects, with each group a tab and each entry in the tab is a Link to
a
page
about the object.  Something like this:

Group A
  obj 1
  obj 2
  obj 3
Group B
  obj 1
  obj 4

For various reasons an accordion will work well for this.

This doesn't work but describes what I'd like to do:

div type=equanda/accordion
t:loop source=groups value=group
t:parameter id=${panel.title_id}${panel.title}/t:parameter
t:parameter id=${panel.content_id}${panel.content}/t:parameter
/t:loop
/div

Any suggestions?

Thanks

Chuck Kring


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



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





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



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

how to create a loop of parameters?

2010-10-14 Thread Chuck Kring

 Hi everyone,

I'm trying to get equanda/accordion to work with a variable set of tabs 
and contents.The intent is that I want to loop across a list of 
groups of objects, with each group a tab and each entry in the tab is a 
Link to a page about the object.  Something like this:


Group A
  obj 1
  obj 2
  obj 3
Group B
  obj 1
  obj 4

For various reasons an accordion will work well for this.

This doesn't work but describes what I'd like to do:

div type=equanda/accordion
t:loop source=groups value=group
t:parameter id=${panel.title_id}${panel.title}/t:parameter
t:parameter id=${panel.content_id}${panel.content}/t:parameter
/t:loop
/div

Any suggestions?

Thanks

Chuck Kring


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



Re: Stream redirection problem when using JFreeChart with Tapestry

2010-08-13 Thread Chuck Kring
 You should try to separate JFreeChart from Tapestry.   As a test, have 
the onChart getStream return a FileInputStream from a known-good jpeg 
file.  This will allow you to determine if the problem is in the 
Tapestry event handling or the chart.


Chuck

On 8/13/2010 3:56 AM, Ruksen Inanir wrote:




Yes it seems to be valid. I wrote some lines of code which saves the image to a 
file before returning the stream just to see if the stream returned belongs to 
image. And image file is created correctly.
Somehow I cannot redirect to stream to page, although it actually is created..



-Original Message-
From: Chuck Kring [mailto:cjkr...@pacbell.net]
Sent: Friday, August 13, 2010 2:08 AM
To: users@tapestry.apache.org
Subject: Re: Stream redirection problem when using JFreeChart with Tapestry


   Did you verify that the _context in onChart() is valid?

On 8/12/2010 1:45 PM, Ruksen Inanir wrote:

Thanks for the response. I had not post the Chart component to keep
the mail shorter. But here it is;

public class Chart {
  @Inject
  private ComponentResources _resources;
  @Inject
  private TypeCoercer _coercer;
  /**list(array) of paired values(label   value): 
[String,Number,String,Number,...]*/
  @Parameter(required=true)
  private JFreeChart _chart;
  @Persist
  private JFreeChart _context;
  @Parameter(required=true)
  private int _width;
  @Parameter(required=true)
  private int _height;

  void beginRender(MarkupWriter writer)
  {
  _context=_chart;
  Object[] params = { new Integer(_width),
  new Integer(_height) };

  //generate action link
  Link link = _resources.createEventLink(chart, params);
  Element img = writer.element(img, src, link);
  _resources.renderInformalParameters(writer);
  }

  void afterRender(MarkupWriter writer)
  {
  writer.end();
  }

  public StreamResponse onChart(final int width, final int height/*, Object 
...rest*/){
  return new StreamResponse(){
  public String getContentType(){
  return image/jpeg;
  }
  public InputStream getStream() throws IOException {
  BufferedImage image  = _context.createBufferedImage(width, 
height);
  ByteArrayOutputStream byteArray = new ByteArrayOutputStream() 
;
  ChartUtilities.writeBufferedImageAsJPEG(byteArray, image) ;
  return new ByteArrayInputStream(byteArray.toByteArray());
  }
  public void prepareResponse(Response response){}
  };
  }
}


-Original Message-
From: Chuck Kring [mailto:cjkr...@pacbell.net]
Sent: Thursday, August 12, 2010 11:32 PM
Cc: Tapestry users
Subject: Re: Stream redirection problem when using JFreeChart with
Tapestry


A few things:

1) You didn't include the chart component.  It's the thing that is generating 
the exception.

2) I would verify that  _context in getStream() is a valid JFreeChart
and that ChartUtils.writeBufferedImageAsJpeg works correctly.   I
suspect that a problem with the chart is causing getStream() to fail, which 
then causes the Chart onChart() event to not return a StreamResponse.

I generate charts in a slightly different manner than this example:

a) I use Chart as a base object and extend Chart for my individual
chart types.  For example, I don't callt:chart  t:chart=lineChart
but use MyLineChart extends Chart and callt:myLinerChart
nodeId=...

b) The code to create the chart is in the derived class rather than the page 
class.  I don't pass the serialized chart object to the client as a context.  
Rather, the context contains the identity of the object to be charted - in my 
case a nodeId - and the chart is generated by the
component rather than the page.   One benefit of this approach is it
allows me to use the same chart on different pages.

c) I personally like PNG as an output format rather than JPEG.

Once again, make sure that the actual chart is working correctly.

Chuck

public class MyParticularChart extends Chart{

   private static final Logger logger =
Logger.getLogger(gateway.components.MyParticularChart );

   public StreamResponse onChart(short id, long timestamp)
   {
   BSU bsu = (BSU)Node.getByNodeId(id);
   ArrayListMotecomm   list =
MotecommCache.getInstance().getList(bsu, getTimeService(),
getSession());

   synchronized(ChartMutex.getMutex()){

   TimeSeriesCollection dataset = new TimeSeriesCollection();
   addBSUTimeSeries(bsu.getIdleVariance(), list, dataset);


   final JFreeChart chart = ChartFactory.createTimeSeriesChart(
   null, // title
   null, // x-axis label
   null,   // y-axis label
   null,// data
   true

Re: Stream redirection problem when using JFreeChart with Tapestry

2010-08-12 Thread Chuck Kring

 Did you verify that the _context in onChart() is valid?

On 8/12/2010 1:45 PM, Ruksen Inanir wrote:

Thanks for the response. I had not post the Chart component to keep the mail 
shorter. But here it is;

public class Chart {
 @Inject
 private ComponentResources _resources;
 @Inject
 private TypeCoercer _coercer;
 /**list(array) of paired values(label  value): 
[String,Number,String,Number,...]*/
 @Parameter(required=true)
 private JFreeChart _chart;
 @Persist
 private JFreeChart _context;
 @Parameter(required=true)
 private int _width;
 @Parameter(required=true)
 private int _height;

 void beginRender(MarkupWriter writer)
 {
 _context=_chart;
 Object[] params = { new Integer(_width),
 new Integer(_height) };

 //generate action link
 Link link = _resources.createEventLink(chart, params);
 Element img = writer.element(img, src, link);
 _resources.renderInformalParameters(writer);
 }

 void afterRender(MarkupWriter writer)
 {
 writer.end();
 }

 public StreamResponse onChart(final int width, final int height/*, Object 
...rest*/){
 return new StreamResponse(){
 public String getContentType(){
 return image/jpeg;
 }
 public InputStream getStream() throws IOException {
 BufferedImage image  = _context.createBufferedImage(width, 
height);
 ByteArrayOutputStream byteArray = new ByteArrayOutputStream() ;
 ChartUtilities.writeBufferedImageAsJPEG(byteArray, image) ;
 return new ByteArrayInputStream(byteArray.toByteArray());
 }
 public void prepareResponse(Response response){}
 };
 }
}


-Original Message-
From: Chuck Kring [mailto:cjkr...@pacbell.net]
Sent: Thursday, August 12, 2010 11:32 PM
Cc: Tapestry users
Subject: Re: Stream redirection problem when using JFreeChart with Tapestry


   A few things:

1) You didn't include the chart component.  It's the thing that is generating 
the exception.

2) I would verify that  _context in getStream() is a valid JFreeChart
and that ChartUtils.writeBufferedImageAsJpeg works correctly.   I
suspect that a problem with the chart is causing getStream() to fail, which 
then causes the Chart onChart() event to not return a StreamResponse.

I generate charts in a slightly different manner than this example:

a) I use Chart as a base object and extend Chart for my individual chart types.  For example, I don't 
callt:chart  t:chart=lineChart  but use MyLineChart extends Chart and callt:myLinerChart 
nodeId=...

b) The code to create the chart is in the derived class rather than the page 
class.  I don't pass the serialized chart object to the client as a context.  
Rather, the context contains the identity of the object to be charted - in my 
case a nodeId - and the chart is generated by the
component rather than the page.   One benefit of this approach is it
allows me to use the same chart on different pages.

c) I personally like PNG as an output format rather than JPEG.

Once again, make sure that the actual chart is working correctly.

Chuck

public class MyParticularChart extends Chart{

  private static final Logger logger = 
Logger.getLogger(gateway.components.MyParticularChart );

  public StreamResponse onChart(short id, long timestamp)
  {
  BSU bsu = (BSU)Node.getByNodeId(id);
  ArrayListMotecomm  list =
MotecommCache.getInstance().getList(bsu, getTimeService(), getSession());

  synchronized(ChartMutex.getMutex()){

  TimeSeriesCollection dataset = new TimeSeriesCollection();
  addBSUTimeSeries(bsu.getIdleVariance(), list, dataset);


  final JFreeChart chart = ChartFactory.createTimeSeriesChart(
  null, // title
  null, // x-axis label
  null,   // y-axis label
  null,// data
  true,   // create legend?
  false,   // generate tooltips?
  false   // generate URLs?
  );

  XYItemRenderer r = chart.getXYPlot().getRenderer();
  r.setSeriesPaint(0, Color.darkGray);
  r.setSeriesPaint(1, Color.RED);
  r.setSeriesPaint(2, Color.GREEN);
  r.setSeriesPaint(3, Color.GRAY);

  XYPlot plot = chart.getXYPlot();
  plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
  NumberAxis axis = new NumberAxis();
  axis.setRange(new Range(0,4 * bsu.getIdleVariance()), true, false 
);
  plot.setRangeAxis(0, axis);
  plot.setDataset(1,dataset);

  return new StreamResponse(){
  public String getContentType

Re: Stream redirection problem when using JFreeChart with Tapestry

2010-08-10 Thread Chuck Kring

 Hi.

I use JfreeChart extensively with T 5.0.1.5 and I'm very happy with 
it.   Most likely your exception is caused by a bug in your .tml or the 
underlying class. If you could reduce the template and the class to 
the minimum size that still shows the bug and post both to a follow up 
email, somebody on the list will probably be able to help you.


Chuck

On 8/10/2010 2:10 AM, Ruksen Inanir wrote:

Hi,
   I want to display a line-chart for my application. I tested chenille-kit chart 
component it worked quite good, but it does not support Dates on the x-axis. I want to to 
draw time-series on the chart. So I decided to use JFreeChart. The link 
http://wiki.apache.org/tapestry/Tapestry5HowToCreateGenericGraphComponent describes the 
usage of JFreeChart with Tapestry. I used to code as it is, I put the Chart.java under 
components package, Prepared the LineChartPage.java and LineChartPage.tml. The page 
rendered, displayed but the chart is not displayed. When I look at the Jboss console I 
saw the neither a stream response nor a redirect response was generated for this 
action request. exception;

[org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler] 
Processing of request failed with uncaught exception: Sanity check - neither a 
stream response nor a redirect response was generated for this action request.
java.lang.IllegalStateException: Sanity check - neither a stream response nor a 
redirect response was generated for this action request.
at 
org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:63)
at 
$ComponentEventRequestHandler_12a5b36106e.handle($ComponentEventRequestHandler_12a5b36106e.java)
at 
org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
at 
$ComponentEventRequestHandler_12a5b36106e.handle($ComponentEventRequestHandler_12a5b36106e.java)
at 
org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75)
at 
$ComponentEventRequestHandler_12a5b36106e.handle($ComponentEventRequestHandler_12a5b36106e.java)
at 
org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2164)
at 
$ComponentEventRequestHandler_12a5b36106e.handle($ComponentEventRequestHandler_12a5b36106e.java)
at 
$ComponentEventRequestHandler_12a5b361006.handle($ComponentEventRequestHandler_12a5b361006.java)
at 
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
at 
$ComponentRequestHandler_12a5b360ff8.handleComponentEvent($ComponentRequestHandler_12a5b360ff8.java)
at 
org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)

Did anyone encountered this exception? Or do you have any idea of the cause? Or 
a better solution to display time-series charts, which contain time information 
on x-axis.

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




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



Asset in css file?

2010-08-04 Thread Chuck Kring

 Hi everybody,

I'm trying to override the gif image used for tabs in the Chenillekit 
tabset.This is specified in

the chenillekit TabSet.css  like this:

a.ck.tab {
  background:url(white-top-bottom.gif)repeat-x scroll 0 -1px 
transparent;

  .
}

At this point I assume that the css file is not rendered, so I can't 
directly specify the gif as an asset.  Aside from returning the asset as 
a StreamResponse from an onActivate() event is there a better way to 
serve a gif file into a css-specified background?


Thanks,

Chuck

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



Re: Asset in css file?

2010-08-04 Thread Chuck Kring
 Of course.  But what is most efficient way to  return a Tapestry Asset 
specified in the css file.  The css file is not a template.


On 8/4/2010 4:23 AM, Steve Eynon wrote:

You're probably better off just overriding the css to return the image you
want.

Steve.
---
Sent on the move from my X10 Mini, so excuse the small words and spelling
mistakes!

On 4 Aug 2010 07:33, Chuck Kringcjkr...@pacbell.net  wrote:

  Hi everybody,

I'm trying to override the gif image used for tabs in the Chenillekit
tabset.This is specified in
the chenillekit TabSet.css  like this:

a.ck.tab {
  background:url(white-top-bottom.gif)repeat-x scroll 0 -1px
transparent;
  .
}

At this point I assume that the css file is not rendered, so I can't
directly specify the gif as an asset.  Aside from returning the asset as a
StreamResponse from an onActivate() event is there a better way to serve a
gif file into a css-specified background?

Thanks,

Chuck

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



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



Re: Asset in css file?

2010-08-04 Thread Chuck Kring

 Thanks.  That should work and it keeps the image in the web app.

On 8/4/2010 8:13 AM, Ville Virtanen wrote:

The most efficient way (cpu cycle wise) is to bypass Tapestry all together
and let httpd share the images. This approach however lacks the ability to
version assets using the T5 facilities.

The best way IMHO is to use relative paths in css (if there are images and
css folders, then the images are referenced like ../images/image.png),
this way the versioning is preserved and it just works. This method
obviously has some limitations also. (Works only when your image and css are
in the domain.)

The images are exposed to web via two urls: versioned and non versioned.
Hardcode one of those to the css is also an option. Use firebug or similar
to get the url. If you use versioned url, you may have to change the url in
css when upgrading the 3rd party lib.

You don't have to (atleast in 5.1) expose the image as an asset to reference
it in css or html.

  - Ville


Chuck Kring wrote:

   Of course.  But what is most efficient way to  return a Tapestry Asset
specified in the css file.  The css file is not a template.

On 8/4/2010 4:23 AM, Steve Eynon wrote:

You're probably better off just overriding the css to return the image
you
want.

Steve.
---
Sent on the move from my X10 Mini, so excuse the small words and spelling
mistakes!

On 4 Aug 2010 07:33, Chuck Kringcjkr...@pacbell.net   wrote:

   Hi everybody,

I'm trying to override the gif image used for tabs in the Chenillekit
tabset.This is specified in
the chenillekit TabSet.css  like this:

a.ck.tab {
   background:url(white-top-bottom.gif)repeat-x scroll 0 -1px
transparent;
   .
}

At this point I assume that the css file is not rendered, so I can't
directly specify the gif as an asset.  Aside from returning the asset as
a
StreamResponse from an onActivate() event is there a better way to serve
a
gif file into a css-specified background?

Thanks,

Chuck

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


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





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



Re: directly return an image from Tapestry

2010-07-21 Thread Chuck Kring
Thanks for the warning.  I'm using this to serve a 1-pixel gif file 
every 20 seconds so I don't think this will cause performance issues.  
Note taken though.


Chuck

Peter Stavrinides wrote:

Just return it in the page's onActivate() method.


Just be careful of this approach, its fine for an image or two, but anything 
more may generate a lot of requests and cause performance problems in larger 
pages.


- Original Message -
From: Thiago H. de Paula Figueiredo thiag...@gmail.com
To: Tapestry users users@tapestry.apache.org
Sent: Wednesday, 21 July, 2010 01:22:31 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: directly return an image from Tapestry

On Tue, 20 Jul 2010 19:15:33 -0300, Chuck Kring cjkr...@pacbell.net  
wrote:


  

Hi everybody,



Hi!

  
I don't want to handle this as an event on the watched page because I'm  
not sure how Tapestry will handle the event if the server has restarted.



It will, no doubt about that.

  

So, it is possible for a Tapestry page to return a streamresponse?



Just return it in the page's onActivate() method.

  


add context to redirected page

2010-07-21 Thread Chuck Kring

Hi,

I have a page that takes a nodeId as a parameter, then redirects into 
the page to a different page depending upon the type of object referred 
to by the nodeId.   I also would like to set the nodeId of the 
redirected page.  What's the best way to do this?


Thanks.

Chuck


public class myPage()
{
@Persist
private int nodeId;

@InjectPage
private GreenPage green;
@InjectPage
private RedPage red;

onActivate(id){
this.nodeId = id;
}

public Object setupRender(){
   node = Node.getByNodeId(nodeId);
   if( node.isRed()){
  // doesn't work because red nodeId is not set.
  return red;
  }
  // doesn't work because green nodeId is not set.
  return green;
}

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



Re: add context to redirected page

2010-07-21 Thread Chuck Kring

Thanks!

Chuck

Luu Tuan Cuong wrote:

Hi,

You can use the service: PageRenderLinkSource.

@Inject
PageRenderLinkSource _linkSource;

private Link getPageLink(Class? pageClass, Object... context) {
return _linkSource.createPageRenderWithContext(pageClass, 
context);

}

public Object setupRender(){
   node = Node.getByNodeId(nodeId);
   if( node.isRed()){
  return getPageLink(Red.class, nodeId);
  }
  return getPageLink(Green.class, nodeId);
}


In Red or Green page, you use activate method to get nodeId.

On 7/22/2010 9:26 AM, Chuck Kring wrote:

Hi,

I have a page that takes a nodeId as a parameter, then redirects into 
the page to a different page depending upon the type of object 
referred to by the nodeId.   I also would like to set the nodeId of 
the redirected page.  What's the best way to do this?


Thanks.

Chuck


public class myPage()
{
@Persist
private int nodeId;

@InjectPage
private GreenPage green;
@InjectPage
private RedPage red;

onActivate(id){
this.nodeId = id;
}

public Object setupRender(){
   node = Node.getByNodeId(nodeId);
   if( node.isRed()){
  // doesn't work because red nodeId is not set.
  return red;
  }
  // doesn't work because green nodeId is not set.
  return green;
}

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




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




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



directly return an image from Tapestry

2010-07-20 Thread Chuck Kring

Hi everybody,

I need to create a watchdog on a page that reloads the entire page when 
I detect the server has restarted.  

So far, my approach is to retrieve and image from the Tapestry web app 
by setting an image src field, then reloading or not based upon onload 
vs.onerror event handlers.   This tests the webapp and server and I can 
reload the page if I receive an onload after an onerror event.


In other words

var img = new Image();
img.onerror = imageFailed;
img.onload = imageLoaded;
failed = false;
setTimeout( doPoll, 1);

doPoll(){
   img.src = location.locationhost + /t/testpage/ + Date.UTC();   // 
to prevent image caching

}

imageFailed()
{
   failed = true;
   setTimeout( doPoll, 1);
}
imageLoaded()
{
   if( failed == true ){
   location.reload(true);
   } else {
  setTimeOut(doPoll, 1);
   }
}

I *think* I need to create a Tapestry page that returns an Asset or 
StreamResponse.   I don't want to handle this as an event on the watched 
page because I'm not sure how Tapestry will handle the event if the 
server has restarted.


So, it is possible for a Tapestry page to return a streamresponse?  Or 
is there a better way to do this?I hesitate to use Ajax requests 
because I'm not sure that I'll be able to differentiate between the 
server not up yet and Tapestry not knowing what to do with old Ajax 
requests from another session.  Images seem easy from the Javascript 
side but I'm not sure how to handle this in tapestry.


Regards,

Chuck Kring


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



Re: directly return an image from Tapestry

2010-07-20 Thread Chuck Kring

That was simple and effective.   Thanks!

Chuck

Thiago H. de Paula Figueiredo wrote:
On Tue, 20 Jul 2010 19:15:33 -0300, Chuck Kring cjkr...@pacbell.net 
wrote:



Hi everybody,


Hi!

I don't want to handle this as an event on the watched page because 
I'm not sure how Tapestry will handle the event if the server has 
restarted.


It will, no doubt about that.


So, it is possible for a Tapestry page to return a streamresponse?


Just return it in the page's onActivate() method.



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



Re: [Tapestry Central] Everyone out of the Pool! Tapestry goes singleton!

2010-07-15 Thread Chuck Kring

Howard,

I have another use case where this might be very useful.

Our application consists of several dashboard pages that are used like a 
network management console works:  the pages automatically refresh as 
things change, users can click on icons to drill down, etc.   The page 
relies heavily on Ajax calls to update icons and charts and we very 
often use the same component multiple times in a page.  This is a 
medical application and we have icons to represent every patient state - 
that component is reused once for every patient displayed.


We tend to have two types of Ajax calls:  zones and images.  Images are 
handled similar to zones but use our own Javascript that sets the img 
src field once the image has been loaded into the browser cache.  

We've had a series of problems relating to persistence of component 
fields when components are reused in the page and called as part of an 
Ajax request.   We fixed this by having components register a context 
with the calling page, then we set the component context prior to 
generating the JSON response.  I'm sure there is a better way to do this 
(perhaps a Tapestry Service) but this is workable for now.  Once again, 
the specific issue is that when multiple copies of a component are used 
on a page and the components are returned as a response to an XHR 
request, persisted fields are not handled correctly across all similar 
components.


I think another benefit of your proposal is it could make state 
management in components more easily controlled by the application.  For 
example, I could forgo the above context mechanism if it were possible 
to retrieve a handle to the FieldValueCondiut and to set that before 
re-rendering the component.


Regards,

Chuck Kring

Howard wrote:

Tapestry applications are inherently stateful: during and between
requests, information in Tapestry components, value stored in fields,
stick around. This is a great thing: it lets you program a web
application in a sensible way, using stateful objects full of mutable
properties and methods to operate on those properties.
It also has its downside: Tapestry has to maintain a pool of page
instances. And in Tapestry, page instances are big: a tree of hundreds
or perhaps thousands of interrelated objects: the tree of Tapestry
structural objects that forms the basic page structure, the component
and mixin objects hanging off that tree, the binding objects that
connect parameters of components to properties of their containing
component, the template objects that represents elements and content
from component templates, and many, many more that most Tapestry
developers are kept unawares of.
This has proven to be a problem with biggest and busiest sites
constructed using Tapestry. Keeping a pool of those objects, checking
them in and out, and discarded them when no longer needed is draining
needed resources, especially heap space.
So that seems like an irreconcilable problem eh? Removing mutable state
from pages and components would turn Tapestry into something else
entirely. On the other hand, allowing mutable state means that
applications, especially big complex applications with many pages,
become memory hogs.
I suppose one approach would be to simply create a page instance for
the duration of a request, and discard it at the end. However, page
construction in Tapestry is very complicated and although some effort
was expended in Tapestry 5.1 to reduce the cost of page construction,
it is still present. Additionally, Tapestry is full of small
optimizations that improve performance ... assuming a page is reused
over time. Throwing away pages is a non-starter.
So we're back to square one ... we can't eliminate mutable state, but
(for large applications) we can't live with it either.
Tapestry has already been down this route: the way persistent fields
are handled gives the illusion that the page is kept around between
requests. You might think that Tapestry serializes the page and stores
the whole thing in the session. In reality, Tapestry is shuffling just
the individual persistent field values in to and out of the HttpSessio.
To both the end user and the Tapestry developer, it feels like the
entire page is live between requests, but it's a bit of a shell game,
providing an equivalent page instance that has the same values in its
fields.
What's going on in trunk right now is extrapolating that concept from
persistent fields to all mutable fields. Every access to every mutable
field in a Tapestry page is converted, as part of the class
transformation process, into an access against a per-thread Map of keys
and values. The end result is that a single page instance can be used
across threads without any synchronization issues and without any
conflicts. Each thread has its own per-thread Map.
This idea was suggested in years past, but the APIs to accomplish it
(as well as the necessary meta-programming savvy) just wasn't
available. However, as a side effect of rewriting

Re: [Tapestry Central] Everyone out of the Pool! Tapestry goes singleton!

2010-07-15 Thread Chuck Kring
I didn't file a Jira because I initially ran into this with our polled 
img components which are somewhat out of the box..  I'll create a 
small test case using zones and file a Jira if that fails.


Chuck

Josh Canfield wrote:

We've had a series of problems relating to persistence of component fields
when components are reused in the page and called as part of an Ajax
request.



Is this problem in jira? I did a quick search but didn't see it.

On Thu, Jul 15, 2010 at 12:28 PM, Chuck Kring cjkr...@pacbell.net wrote:
  

Howard,

I have another use case where this might be very useful.

Our application consists of several dashboard pages that are used like a
network management console works:  the pages automatically refresh as things
change, users can click on icons to drill down, etc.   The page relies
heavily on Ajax calls to update icons and charts and we very often use the
same component multiple times in a page.  This is a medical application and
we have icons to represent every patient state - that component is reused
once for every patient displayed.

We tend to have two types of Ajax calls:  zones and images.  Images are
handled similar to zones but use our own Javascript that sets the img src
field once the image has been loaded into the browser cache.
We've had a series of problems relating to persistence of component fields
when components are reused in the page and called as part of an Ajax
request.   We fixed this by having components register a context with the
calling page, then we set the component context prior to generating the JSON
response.  I'm sure there is a better way to do this (perhaps a Tapestry
Service) but this is workable for now.  Once again, the specific issue is
that when multiple copies of a component are used on a page and the
components are returned as a response to an XHR request, persisted fields
are not handled correctly across all similar components.

I think another benefit of your proposal is it could make state management
in components more easily controlled by the application.  For example, I
could forgo the above context mechanism if it were possible to retrieve a
handle to the FieldValueCondiut and to set that before re-rendering the
component.

Regards,

Chuck Kring

Howard wrote:


Tapestry applications are inherently stateful: during and between
requests, information in Tapestry components, value stored in fields,
stick around. This is a great thing: it lets you program a web
application in a sensible way, using stateful objects full of mutable
properties and methods to operate on those properties.
It also has its downside: Tapestry has to maintain a pool of page
instances. And in Tapestry, page instances are big: a tree of hundreds
or perhaps thousands of interrelated objects: the tree of Tapestry
structural objects that forms the basic page structure, the component
and mixin objects hanging off that tree, the binding objects that
connect parameters of components to properties of their containing
component, the template objects that represents elements and content
from component templates, and many, many more that most Tapestry
developers are kept unawares of.
This has proven to be a problem with biggest and busiest sites
constructed using Tapestry. Keeping a pool of those objects, checking
them in and out, and discarded them when no longer needed is draining
needed resources, especially heap space.
So that seems like an irreconcilable problem eh? Removing mutable state
from pages and components would turn Tapestry into something else
entirely. On the other hand, allowing mutable state means that
applications, especially big complex applications with many pages,
become memory hogs.
I suppose one approach would be to simply create a page instance for
the duration of a request, and discard it at the end. However, page
construction in Tapestry is very complicated and although some effort
was expended in Tapestry 5.1 to reduce the cost of page construction,
it is still present. Additionally, Tapestry is full of small
optimizations that improve performance ... assuming a page is reused
over time. Throwing away pages is a non-starter.
So we're back to square one ... we can't eliminate mutable state, but
(for large applications) we can't live with it either.
Tapestry has already been down this route: the way persistent fields
are handled gives the illusion that the page is kept around between
requests. You might think that Tapestry serializes the page and stores
the whole thing in the session. In reality, Tapestry is shuffling just
the individual persistent field values in to and out of the HttpSessio.
To both the end user and the Tapestry developer, it feels like the
entire page is live between requests, but it's a bit of a shell game,
providing an equivalent page instance that has the same values in its
fields.
What's going on in trunk right now is extrapolating that concept from
persistent fields to all mutable fields. Every access to every mutable

Re: Why can't I return a rendered block via JSON?

2010-05-11 Thread Chuck Kring
I wish it were so easy.  BlockImpl toString() prints out useful 
information such as where the block was defined in the template but it 
doesn't render.  The normal route is to use render() which requires a 
RenderQueue.  At that point the were using internal APIs.


Thanks for the suggestion.

Chuck

Alex Kotchnev wrote:

Chuck,
   I think you already know more than I do on the subject, but here's what
came to mind :

1. The documentation of Block (
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/Block.html)
indicates that they should be easily convertible to Strings (e.g. via
BlockImpl.toString()

2. It should be pretty easy to build a JSONObject (
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/json/JSONObject.html),
and add a key and put the value as the stringified block. Then , have an
event handler that returns the JSONObject and have the event handler
triggered by an JS function or something similar.

   Once again, I'm not an expert on this, maybe one of the T5 devs can chime
if I'm sputtering complete garbage.

Regards,

Alex K

On Tue, May 11, 2010 at 12:57 AM, Chuck Kring cjkr...@pacbell.net wrote:

  

Hi Alex,

No quite.  Currently, you can return a Block to refresh a zone or a JSON
array to send data to a custom handler on the client.  My project has a
number of dashboards and I use JSON data to refresh image tags to make
'real-time' charts and icons that automatically update.   My handler
replaces the img src tags when it receives the response.

I'd like to use the same framework to replace div bodies - essentially
zones.  In trying to get this to work I looked at the implementation of
MultiZoneUpdate and I think that code could easily be reused to allow
rendered blocks to be included in JSON responses.That would open up
Tapestry 5 to developers creating applications like my dashboard that don't
lend themselves to Zones.
If you know a route to render a Block as part of a JSON XHR response I'd
really appreciate a pointer.   Otherwise I'm trying to understand if I
should file a Jira suggesting this as an enhancement.

Thanks.

Chuck


Alex Kotchnev wrote:



Chuck,
 it is my understanding that today, when you return a Block in response to
an ajax request, the contents of that block do get serialized into a JSON
structure which is then parsed on the client. Isn't that what you need ?

Regards,

Alex Kotchnev

On Mon, May 10, 2010 at 2:18 AM, Chuck Kring cjkr...@pacbell.net wrote:



  

Hi guys,

My application uses Ajax extensively  to provide a dashboard-like
functionality.  I use a rather small Javascript library that contains a
poller and then updates img src= fields for every registered components.
This works very well for dashboard pages that have charts and status
icons.

I'd love to be able to put zones in the page and call the ZoneUpdater
from
my Javascript loop.   This seems easy because it's essentially the
behavior
of the MultiZoneUpdate.

My question is shouldn't there be a coercer that allows a rendered block
or
component to be added to a JSON return?
Chuck Kring

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







  


  


Why can't I return a rendered block via JSON?

2010-05-10 Thread Chuck Kring

Hi guys,

My application uses Ajax extensively  to provide a dashboard-like 
functionality.  I use a rather small Javascript library that contains a 
poller and then updates img src= fields for every registered 
components.   This works very well for dashboard pages that have charts 
and status icons.


I'd love to be able to put zones in the page and call the ZoneUpdater 
from my Javascript loop.   This seems easy because it's essentially the 
behavior of the MultiZoneUpdate.


My question is shouldn't there be a coercer that allows a rendered block 
or component to be added to a JSON return? 


Chuck Kring

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



Re: Why can't I return a rendered block via JSON?

2010-05-10 Thread Chuck Kring

Hi Alex,

No quite.  Currently, you can return a Block to refresh a zone or a JSON 
array to send data to a custom handler on the client.  My project has a 
number of dashboards and I use JSON data to refresh image tags to make 
'real-time' charts and icons that automatically update.   My handler 
replaces the img src tags when it receives the response.


I'd like to use the same framework to replace div bodies - essentially 
zones.  In trying to get this to work I looked at the implementation of 
MultiZoneUpdate and I think that code could easily be reused to allow 
rendered blocks to be included in JSON responses.That would open up 
Tapestry 5 to developers creating applications like my dashboard that 
don't lend themselves to Zones. 

If you know a route to render a Block as part of a JSON XHR response I'd 
really appreciate a pointer.   Otherwise I'm trying to understand if I 
should file a Jira suggesting this as an enhancement.


Thanks.

Chuck

Alex Kotchnev wrote:

Chuck,
  it is my understanding that today, when you return a Block in response to
an ajax request, the contents of that block do get serialized into a JSON
structure which is then parsed on the client. Isn't that what you need ?

Regards,

Alex Kotchnev

On Mon, May 10, 2010 at 2:18 AM, Chuck Kring cjkr...@pacbell.net wrote:

  

Hi guys,

My application uses Ajax extensively  to provide a dashboard-like
functionality.  I use a rather small Javascript library that contains a
poller and then updates img src= fields for every registered components.
This works very well for dashboard pages that have charts and status icons.

I'd love to be able to put zones in the page and call the ZoneUpdater from
my Javascript loop.   This seems easy because it's essentially the behavior
of the MultiZoneUpdate.

My question is shouldn't there be a coercer that allows a rendered block or
component to be added to a JSON return?
Chuck Kring

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





  


Is this a bug?

2010-05-03 Thread Chuck Kring

Hello,

I have a form that references a zone.   When the form is linked to the 
zone (form t:zone=zone), a file upload component fails.  When the link 
is removed the file upload works fine.


Java and tml are below.  This currently prints Uploaded = null.  To 
get it to work remove t::zone=theForm from the form.


Is this a bug or am I doing something wrong?   If it's a bug I'll file a 
Jira.


Thanks.

Chuck Kring


?xml version=1.0 encoding=utf-8?
html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
body
div class=dialog_outer style=width:700px
   t:zone t:id=theForm/
t:form t:zone=theForm
tabletbody
  tr
  tdUpload file/td
  tdinput t:type= upload t:id=uploaded//td
  /tr
   /tbody/table
t:submit t:id=apply value=Apply/
   /t:form
/div
/body/html


package gateway.pages;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.upload.services.UploadedFile;

public class BugReport {
  
   @Property

   private UploadedFile uploaded;
  
   public void onSelectedFromApply()

   {
   if(uploaded == null ){
   System.out.println(Uploaded = null);
   } else {
   System.out.println(Uploaded =  + uploaded.getFileName());
   }
   }
}


Re: Is this a bug?

2010-05-03 Thread Chuck Kring

Thanks.

Does it make sense to file a Jira?  Something like 'upload component 
should be enhanced to work with Ajax'? 


Chuck


Thiago H. de Paula Figueiredo wrote:
On Mon, 03 May 2010 17:07:13 -0300, Chuck Kring cjkr...@pacbell.net 
wrote:



Hello,


Hi!

I have a form that references a zone.   When the form is linked to 
the zone (form t:zone=zone), a file upload component fails.  When 
the link is removed the file upload works fine.


Independently of Tapestry, AJAX doesn't support file uploads. When you 
see something that seems to be a file submission through AJAX, it's 
implemented by some Flash control ou using an iframe. Of course, as 
Howard said, the Upload component could handle this options itself.




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



Re: Is this a bug?

2010-05-03 Thread Chuck Kring
Tapestry360 Jira is down.  I'll file  it when it comes back up.  Thanks 
for helping.


Chuck

Thiago H. de Paula Figueiredo wrote:
On Mon, 03 May 2010 19:25:55 -0300, Chuck Kring cjkr...@pacbell.net 
wrote:


Does it make sense to file a Jira?  Something like 'upload component 
should be enhanced to work with Ajax'?


Yes. :)



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



Re: Is this a bug?

2010-05-03 Thread Chuck Kring

Got it.  Thanks.

Thiago H. de Paula Figueiredo wrote:
On Mon, 03 May 2010 19:43:41 -0300, Chuck Kring cjkr...@pacbell.net 
wrote:


Tapestry360 Jira is down.  I'll file  it when it comes back up.  
Thanks for helping.


Tapestry's JIRA is https://issues.apache.org/jira/browse/TAP5.



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



Re: Checkbox in a Grid in a Zone in a Form?

2010-05-01 Thread Chuck Kring
Thanks.  


Thiago H. de Paula Figueiredo wrote:
On Sat, 01 May 2010 02:10:43 -0300, Chuck Kring cjkr...@pacbell.net 
wrote:



Hi,


Hi!


The Upgrade component must be enclosed by a Form component.


Currently, you cannot have a form field working inside a Zone unless 
you put the whole Form inside the Zone.




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



Checkbox in a Grid in a Zone in a Form?

2010-04-30 Thread Chuck Kring

Hi,

I have need for form containing a grid containing a checkbox 'upgrade' 
used to denote whether to process each entity.  That all works fine, but 
I need the grid to update after submits (e.g. a submit button to select 
all and another to deselect all).   I wrapped the grid in a zone and set 
the form's zone parameter to the zone id.  My onSubmit() handler returns 
the zone.getBody();


Then I received the following error:

The Upgrade component must be enclosed by a Form component.

I assume the error is due to the zone not being in the form when it is 
re-rendered. 

Is there anything I can do about this?  Or do I need to have the Select 
All and Deselect All buttons save state and return another copy of the form?


Thanks!

Chuck Kring

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



Re: Cleaning up AJAX dashboard

2009-05-20 Thread Chuck Kring

Thanks.

Thiago H. de Paula Figueiredo wrote:
Em Mon, 18 May 2009 13:44:44 -0300, Chuck Kring cjkr...@pacbell.net 
escreveu:



Hi everybody,


Hi!

I need to cleanup the persistent fields when the page is no longer in 
use and I'm considering using the window onunload event

and a hidden eventlink to trigger the page to clean up.


You don't need a hidden eventlink: just use 
ComponentResources.createEventLink() to generate the event URL and 
make your Javascript call it. 
ComponentResources.discardPersistentFieldChanges() removes all 
persistent field values from the session.




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



Cleaning up AJAX dashboard

2009-05-18 Thread Chuck Kring

Hi everybody,

I have a page that implements a dashboard-like functionality in which 
various AJAX calls update charts and other data.


This page is has several persistent variables in order to support the 
AJAX functionality.   All of the elements in the page are
surrounded for a form but the usual use case is for the user to move 
away from the page (no submit).  

I need to cleanup the persistent fields when the page is no longer in 
use and I'm considering using the window onunload event

and a hidden eventlink to trigger the page to clean up.

Is there a better way to do this?

Thanks.

Chuck Kring

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



Re: Clarification on discardPersistentFieldChanges

2009-05-09 Thread Chuck Kring

Thank you!

Igor Drobiazko wrote:

Hi,

a call of discardPersistentFieldChanges() will clean the state of the page
and all embedded components.
So you don't have to iterate over all components.

On Sat, May 9, 2009 at 1:24 AM, Chuck Kring cjkr...@pacbell.net wrote:

  

Hi,

I have a question about ComponentResources discardPersistentFieldChanges.

The page in question is a configuration page and contains a large number of
components that each have some persisted state and I'm currently calling
discardPersistentFieldChanges on the page onSubmit..   I want to make sure
that all persisted state is discarded for the page as well as for all
components used in that page.

The documentation for this function says: Discards all persistent field
changes for the page containing the component.

My reading of this is that I can call discardPersistentFieldChanges  on any
component on the page and it will discard all persistent field changes on
the page and on all components used in the page.   Is this true or do I need
to explicitly call discardPersistentFieldChanges on each component?

Thanks.

Chuck Kring


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






  


Clarification on discardPersistentFieldChanges

2009-05-08 Thread Chuck Kring

Hi,

I have a question about ComponentResources discardPersistentFieldChanges.

The page in question is a configuration page and contains a large number 
of components that each have some persisted state and I'm currently 
calling discardPersistentFieldChanges on the page onSubmit..   I want to 
make sure that all persisted state is discarded for the page as well as 
for all components used in that page.


The documentation for this function says: Discards all persistent field 
changes for the page containing the component.


My reading of this is that I can call discardPersistentFieldChanges  on 
any component on the page and it will discard all persistent field 
changes on the page and on all components used in the page.   Is this 
true or do I need to explicitly call discardPersistentFieldChanges on 
each component?


Thanks.

Chuck Kring


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



Re: T5.0.18: how to have variable data structures in a bean?

2009-04-19 Thread Chuck Kring

Ville,

It works like a charm.   I appreciate your help.  Thanks.

Chuck


Ville Virtanen wrote:

Hi,

the given tml is missing encoder for the inner loop. Without this T5 uses
the default approach which is the highly inefficient
serialize-whole-thing-to-form-data. 


This encoder can be constructed in the bean itself (resident) but imho
should not be there, so the best approach (afaik) is to construct it in the
page based on the data that resident contains (So that one encoder is
created per resident for the profiles loop.).

 Add the encoder and if this doesn't work attach the associated java code
snippet also

 - Ville


Chuck Kring wrote:
  

Hi all,

This is somewhat complicated so bear with me.

I'm trying to create a bean with a variable number of fields, each which 
has a name and an associated select box to set various properties.   
The  tml looks something like this:


.
tr t: type=AjaxFormLoop t:sources=residents t:value=resident 
t:encoder=encoder

t:submitnotifier
tdinput t:type=TextField t:value=resident.name /td
   t:loop source=resident.profiles value=profile
  tdselect: t:value=profile.selection 
model=profile.model encoder=profile.model / /td

   /t:loop
/t:submitnotifier
/tr

Resident and profile are standard beans except that resident contains an 
ArrayList of profiles that is accesses through getProfiles().


This all works pretty well except that Tapestry 5.0.18 tries to 
serialize the profile bean (I get errors unless I make it extend 
Serializable)  AND it appears to set the selection on another instance 
of the profile bean.  I suspect that tapestry serializes the profile 
bean,  unserializes it to create it's own copy, then changes selection 
on it's own copy.  My bean never sees the updated result.


The work around is ugly - to store the profiles list in the session, the 
retrieve it and update the actual bean in in the profile.setSelection() 
method. 

My question is is this a bug in tapestry or am I doing something wrong?  
Is there a better way to accomplish this?


Thanks!

Chuck Kring





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






  


T5.0.18: how to have variable data structures in a bean?

2009-04-18 Thread Chuck Kring

Hi all,

This is somewhat complicated so bear with me.

I'm trying to create a bean with a variable number of fields, each which 
has a name and an associated select box to set various properties.   
The  tml looks something like this:


.
tr t: type=AjaxFormLoop t:sources=residents t:value=resident 
t:encoder=encoder

   t:submitnotifier
   tdinput t:type=TextField t:value=resident.name /td
  t:loop source=resident.profiles value=profile
 tdselect: t:value=profile.selection 
model=profile.model encoder=profile.model / /td

  /t:loop
   /t:submitnotifier
/tr

Resident and profile are standard beans except that resident contains an 
ArrayList of profiles that is accesses through getProfiles().


This all works pretty well except that Tapestry 5.0.18 tries to 
serialize the profile bean (I get errors unless I make it extend 
Serializable)  AND it appears to set the selection on another instance 
of the profile bean.  I suspect that tapestry serializes the profile 
bean,  unserializes it to create it's own copy, then changes selection 
on it's own copy.  My bean never sees the updated result.


The work around is ugly - to store the profiles list in the session, the 
retrieve it and update the actual bean in in the profile.setSelection() 
method. 

My question is is this a bug in tapestry or am I doing something wrong?  
Is there a better way to accomplish this?


Thanks!

Chuck Kring





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



Re: T5's Ajax/Zone implementation has substantial limitations

2009-01-08 Thread Chuck Kring
I think it's important to separate the core tapestry zone infrastructure 
from the Javascript zone wrappers.  I have a lot of Ajax in my 
application - it's a systems management console /dashboard - and pretty 
early on I decided to use the Tapestry zone Javascript as template and 
use my own javascript against the standard tapestry core.I do things 
like update zones from a Javascript poller (calling an actionlink from a 
Javascript function) and updating multiple zones with one server call 
(the JSON key is not contents but there are several objects keyed by 
the zone name).


Given a suitable Tapestry JSON layer, I believe that zones should be 
handled as a component library issue. 

My main issue with the T5 zone is is the need to instantiate all 
components in the template.  In general, this is an example of the 
dynamic rendering issue that comes up occasionally.  I should NOT have 
to put all possible components into my template a-priori.  In my case, I 
have a number of alarm conditions that require user input and use AJAX 
components in a div provide condition-based user response.  Right now 
it's a pain to add components to the template for the 10 user conditions 
I current have, but what happens over time when I have 100's of possible 
user responses. 

In other words,  I agree with Francois to a point.  I think Tapestry5 
was designed to render pages and doesn't naturally handle dynamic 
updates.  That paradigm works well for rendered pages but should be 
relaxed for components rendered via JSON XHR requests.   If I have a div 
in the template and want to change the contents T5 should let me drop in 
any component I want even it it hasn't been defined in the template.


Another area where zones break is in embedded forms and form support.  
I'd love to be able to register a component with a form, drop it into 
the page, then later deregister the component and put in another. 


I'm summary, I think zones need:

1) JSON components returned via XHR should have their own render cycle 
and should not have to be defined in the template

.
2) API support to 'register' a component with a form, then to deregister 
if when that component is replace.


3) A stable JSON/XHR interface in Tapestry core that will allow 
component developers to create zone-like components that do things like 
update cells in grids,  extend forms based upon a select, etc. 


Regards,

Chuck Kring




Francois Armand wrote:

Avi Cherry wrote:
First off, I want to say that I'm a huge supporter, advocate (and 
long time user) of Tapestry, particularly T5.

Hello Avi,


[...] a lot of intersting things


To be honest, the Ajax support on Tapestry 5 is one of the rare things 
that seems to be not _just_rigth_ on the framework, as if it has been 
an afterthougth (one of the other is the four types of 
translator/encoder, but that's for an other thread).


So, thank you for having some time to start this thread. My personal 
experience is rather similar than yours: Tapestry component 
abstraction seems to leak with Ajax (perhaps it's the price for T5 
component not being fully statefull, and perhaps it's better like 
that). As soon as you want to do Ajaxified components, you have to 
take care by hand to a lot of more things than for normal request: 
component id and id availability (you are not in a standards Render 
cycle, ids are not available), you must differentiate normal/xhr 
request on event handler, you must enforce component bounds...


Now, what can we actually purpose ?
You're approach (a component return null on XHR = refresh himself, 
return a component on XHR = refresh this component) seems to me more 
consistent with T5. But it seems to be a major evolution, the kind 
that will be difficult to sell along with easy update of T5. Moreover, 
as you said, it's likelly that somewhere, the full dom tree will have 
to be build, and it seems not really efficient.

And finally, it's too late for Tapestry 5.0 final.

So, for now, what I REALLY need and want with priority #1 is a lot of 
documentation on how using AJAX with T5 the right way: general 
pifalls to avoid, what information are available (state of the server 
view of the DOM on XHR, etc), what are all the differences with normal 
request (you don't have access to a bunch of things), etc.


And for the long run, yes, perhaps we have to see how to make AJAX 
simpler. Perhaps just a different handler naming convention for xhr 
would be a good start, as they are actually differents 
(onMyeventFromComponent and onXhrMyeventFromComponent ? So that user 
would have to really take care of the two case ?)





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



T5: Dynamically returning a component to a zone

2008-05-28 Thread Chuck Kring

Hello,

I have an application where I use a zone to display content that changes 
depending upon user input.  This content can vary and I would like to 
have different versions of the content served by a library of 
components.  Think if this a zone with various modes that depend upon 
other user input and I would like to serve content for each mode using a 
separate component.


The idea is similar to using an iframe with the content of the frame 
dependent upon what mode the page is in.


My issue is that I haven't figured out how to inject components into the 
page class unless the component is referenced in the page template.
Furthermore it would be nice if I didn't have to inject the component 
into the page because that would require that I specify all possibly 
zone components a-priori.


Rather, I would love to be able to look up the component by name then 
dynamically create instances of the component and return it the zone's 
event handler.


I know that I can explicitly render the component and package that as a 
JSON object that I return from the event handler but it seems that doing 
so would bypassing rather than using Tapestry.


Can somebody give me a hint how to proceed?

Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5.0.9 bug? Session in actionlink URL kills context

2008-02-03 Thread Chuck Kring

Should I file a bug?  What version and component should I file it under?

Howard Lewis Ship wrote:

That looks like a bug ... as if it were running the partial path
through HttpServletResponse.encodeURL rather than the full path.

On Feb 2, 2008 5:22 PM, Chuck Kring [EMAIL PROTECTED] wrote:
  

I'm debugging a strange behavior in a T5.0.9 application.   The
application is a dashboard containing multiple zone-like divs that are
refreshed via a javascript keypress event handler.  The handler does an
Ajax.request on an actionlink.href, then updates several zone-like div
areas.  This is in concept similar to the tapestry zone but driven by
javascript.

The page works fine except when my Firefox 2.0.0.11 browser first views
the window and there is no session.  In that case, T5 renders the
actionlink url as:

/t/room.updatedetail;jsessionid=5elfporj6wel/Task/13

When there is an active session, T5 renders the actionlink url as:

/t/room.updatedetail/Task/13

My event hander does not fire when the first (no session) url is posted
and fires when the second url is posted.   In other words, my page fails
to update when the brower first renders the page but works correctly
when you hit refresh.

I wrote a second event handler that captures all updatedetail events and
prints out the event context.  In the first case, the second event
handler is called and the context is empty.  In the second case, both
event handers are called and the context contains {Task, 13}.

I suspect that the sessionid in the url causes T5.0.9 to drop the event
context but also recognize that I might be doing something wrong.

Any suggestions?

  Chuck

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5.0.9 bug? Session in actionlink URL kills context

2008-02-02 Thread Chuck Kring
I'm debugging a strange behavior in a T5.0.9 application.   The 
application is a dashboard containing multiple zone-like divs that are 
refreshed via a javascript keypress event handler.  The handler does an 
Ajax.request on an actionlink.href, then updates several zone-like div 
areas.  This is in concept similar to the tapestry zone but driven by 
javascript.


The page works fine except when my Firefox 2.0.0.11 browser first views 
the window and there is no session.  In that case, T5 renders the 
actionlink url as:


/t/room.updatedetail;jsessionid=5elfporj6wel/Task/13

When there is an active session, T5 renders the actionlink url as:

/t/room.updatedetail/Task/13

My event hander does not fire when the first (no session) url is posted 
and fires when the second url is posted.   In other words, my page fails 
to update when the brower first renders the page but works correctly 
when you hit refresh.


I wrote a second event handler that captures all updatedetail events and 
prints out the event context.  In the first case, the second event 
handler is called and the context is empty.  In the second case, both 
event handers are called and the context contains {Task, 13}.


I suspect that the sessionid in the url causes T5.0.9 to drop the event 
context but also recognize that I might be doing something wrong.


Any suggestions?

 Chuck

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Exception in grid component if source returns an empty list

2008-01-31 Thread Chuck Kring
I have an application that pulls data from a remote database and 
presents it in a Grid component. 
Sometimes the database is not available and my access method returns an 
empty arraylist.  This triggers a bad-looking exception in tapestry 5:



org.apache.tapestry.ioc.internal.util.TapestryException
Failure reading parameter model of component SelectRoom:grid: xxx -- 
no source to determine list type from


location
context:SelectRoom.tml, line 11, column 141

I understand the issue - Tapestry cannot determine how to format the row 
without a valid source object.  I do think the grid component's behavior 
is a bit harsh here.


Any suggestions about how to a) avoid this or b) detect the condition 
and replace the grid component layout with an appropriate error message?


Thanks!

Chuck


Re: Exception in grid component if source returns an empty list

2008-01-31 Thread Chuck Kring

Jonathan,

Thanks.  Good idea.

I ended up using t:if test=hasData to conditionally layout the grid 
or output an error message.


 Chuck

Jonathan Barker wrote:

Chuck,

Build and pass your own BeanModel rather than relying on auto-creation from
the source. 


I hit the same issue.

Jonathan


  

-Original Message-
From: Chuck Kring [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 31, 2008 6:55 PM
To: Tapestry users
Subject: Exception in grid component if source returns an empty list

I have an application that pulls data from a remote database and
presents it in a Grid component.
Sometimes the database is not available and my access method returns an
empty arraylist.  This triggers a bad-looking exception in tapestry 5:



org.apache.tapestry.ioc.internal.util.TapestryException
Failure reading parameter model of component SelectRoom:grid: xxx --
no source to determine list type from

location
context:SelectRoom.tml, line 11, column 141

  

I understand the issue - Tapestry cannot determine how to format the row
without a valid source object.  I do think the grid component's behavior
is a bit harsh here.

Any suggestions about how to a) avoid this or b) detect the condition
and replace the grid component layout with an appropriate error message?

Thanks!

 Chuck




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


Re: How to use LinkImpl in T5.0.9 ?

2008-01-30 Thread Chuck Kring
If you are talking about using LinkImpl to send a redirect, use the 
following:


@Inject private Response response;
response.sendRedirect(yourUrl);

Christian Gorbach wrote:

hi
http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
you can simply return an URL object

c)hristian



Kheldar666 wrote:
  

Hello everybody !

Can anybody post an exemple of how to use the 'new' LinkImpl in T5.0.9 ?
Do we still have to use the Internal component ? Is there now a more
elegant and recommanded way to create a Link to an external URL -the use
of an Internal componant is not safe at all- ?

Thanks for the answers :)

Regards,

Martin






  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Add a DOCTYPE?

2008-01-29 Thread Chuck Kring

Was there any resolution to this issue?

I just ran into it.  My templates work fine with 5.0.7 (prerelease) but
break with 5.0.9.

My headers look like this:
  
?xml version=1.0 encoding=utf-8?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

The exception I received was:

ERROR 13:00:21:015
org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.(DefaultRequestExceptionHandler.java:50):
Processing of request failed with uncaught exception: Namespace prefix for
URI 'http://www.w3.org/XML/1998/namespace' is not defined.
java.lang.RuntimeException: Namespace prefix for URI
'http://www.w3.org/XML/1998/namespace' is not defined.
at org.apache.tapestry.dom.Element.toNamespacePrefix(Element.java:501)
at org.apache.tapestry.dom.Element.toPrefixedName(Element.java:364)
...

   Chuck Kring


Donyee wrote:
 
 T5.07 works fine!
 T5.08-SANPSHOT turns wrong!
 
 2008/1/10, Donyee [EMAIL PROTECTED]:

 I use T5.08-SNAPSHOT.
 my page:
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN
  http://www.w3.org/TR/html4/strict.dtd;
 html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 head...

 
 
 
 -- 
 徐 依伟
 
 

-- 
View this message in context: 
http://www.nabble.com/Add-a-DOCTYPE--tp14706973p15169764.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Add a DOCTYPE?

2008-01-29 Thread Chuck Kring

The problem is with the html tag:

html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

works

html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

worked on 5.0.7 and fails on 5.0.9

Cheers,

   Chuck


Chuck Kring wrote:

Was there any resolution to this issue?

I just ran into it.  My templates work fine with 5.0.7 (prerelease) but
break with 5.0.9.

My headers look like this:
  
?xml version=1.0 encoding=utf-8?

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

The exception I received was:

ERROR 13:00:21:015
org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.(DefaultRequestExceptionHandler.java:50):
Processing of request failed with uncaught exception: Namespace prefix for
URI 'http://www.w3.org/XML/1998/namespace' is not defined.
java.lang.RuntimeException: Namespace prefix for URI
'http://www.w3.org/XML/1998/namespace' is not defined.
at org.apache.tapestry.dom.Element.toNamespacePrefix(Element.java:501)
at org.apache.tapestry.dom.Element.toPrefixedName(Element.java:364)
...

   Chuck Kring


Donyee wrote:
  

T5.07 works fine!
T5.08-SANPSHOT turns wrong!

2008/1/10, Donyee [EMAIL PROTECTED]:


I use T5.08-SNAPSHOT.
my page:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN
 http://www.w3.org/TR/html4/strict.dtd;
html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head...

  


--
徐 依伟





  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]