Re: Radio Button Event ??

2011-02-24 Thread leandroaispuru
 First of all , thank you for your answers.
I thought that taking an action over other components when the radio is
clicked was a so common problem that a mixin or a similar component had been
already deveolped.

Well, i will do it using pure javascript.
If anyone has another idea, please write to me!

Good Luck!
Leandro

2011/2/23 Josh Canfield joshcanfi...@gmail.com

  I do not find an event dispatched by the Radio allowing me to update the
  disabled property of the select and textInput from my java code.

 Why do you need an event? Use the value bound to the radio button as
 the value of the disabled parameter.

 If you want to dynamically change the form the you need to fall back
 to good ol' javascript. Try observing onchange on the radio button.

 Josh

 On Wed, Feb 23, 2011 at 9:52 AM,  leandroaisp...@gmail.com wrote:
  Hi everyone,
  I am having a problem with a page that has two Radio buttons, a Select
 and a
  TextInput.
  I need the Select or the TextInput to be disabled depending on the Radio
  that has been clicked.
  What is the best way to do it?
  I do not find an event dispatched by the Radio allowing me to update the
  disabled property of the select and textInput from my java code.
 
  Thanks in advance!
  Leandro
 

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




Re: Page configuration and activation not exactly separated?

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 04:58:26 -0300, Vjeran Marcinko  
vjeran.marci...@email.t-com.hr wrote:



Hello all,


Hi!

I just wanted to hear if current state of page configuration and  
activation is the desired one?


What do you mean by page configuration?

(this is the reason for one of my architectural problems, but I don't  
want to go into details here since it will boil down to - why don't I  
use RequestFilters insted of page hiererchy for some common  
preprocessing actions)


Page hierarchy is not as good as a solution as request filters or mixins.

Documentation states that page configuration via @PageActivationContext  
and @ActivationRequestParameter fields is done prior to calling  
activate handler, but it doesn't state what happens when one has page  
hierarchy.


This isn't page configuration. This is receiving information from request  
parameters.


With version 5.2.1 it changed in such way that these annotation are  
kinda tied with activate and handled in bundle with it. For example,  
when activate is being handled, Tapestry first takes superclass, sets  
@PageActivationContext field  and calls activate on it, then it takes  
subclass, and again sets @PageActivationContext field and calls  
activate on it. In other words, activate handler in superclass is  
called prior to @PageActivationContext field in subclass.

Is this behaviour as it is supose to be?


I don't know, but I'd avoid having more than one method handling the same  
event. As you're using subclassing, why don't you override the activate  
event handler method instead of adding a new one?


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

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

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



Re: Update table column via Zone(s)

2011-02-24 Thread Dmitriy Vsekhvalnov
Thanks, guys, both approaches works.

I went with Renderable, because wanted to render some other markup, not only
text.

Quick question to Cezary:

 - why are you updating class fileds withing separate RenderCommand? Any
pitfalls?

In my experiments rendering and updating class state is working fine withing
one class, like this:

private RenderCommand cellZoneRenderer(final POS pos, final Contract cnt)
{
return new RenderCommand()
{
public void render(MarkupWriter writer, RenderQueue queue)
{
//update state
contract=cnt;
pointofsale=pos;

//render zone
((RenderCommand) visitsZone.getBody()).render(writer,queue);
}
};
}


On Tue, Feb 22, 2011 at 9:03 PM, Cezary Biernacki cezary...@gmail.comwrote:

 Hi Dmitriy,
 I solved similar problem by chaining list of MultiZoneUpdate, each with its
 own RenderCommand, something like that:

 @Inject
 private Block myBlock;
 

 MultiZoneUpdate mzu = null;
 for(String id : indexes) {
mzu = addMZU(mzu, zone- + id, prepareRender(id));
 }

 
private RenderCommand prepareRendering(final String id) {
return new RenderCommand() {
@Override
public void render(MarkupWriter writer, RenderQueue queue) {
((RenderCommand)myBlock).render(writer, queue);
queue.push(new RenderCommand() {
@Override
public void render(MarkupWriter writer, RenderQueue
 queue) {
currentId = id;
}
});
}
};
}

 in .tml, I have:
 t:block t:id=myBlock
   Here rendering based on ${currentId}
 /t:block

 t:loop value=currentId 
   t:zone id=zoneIdt:delegate to=block:myBlock//t:zone
 /t:loop

 I can not guarantee that it is the simplest way, but it works for me.

 Regards,
 Cezary

 On Tue, Feb 22, 2011 at 4:16 PM, Dmitriy Vsekhvalnov 
 dvsekhval...@gmail.com
  wrote:

  Hi all,
 
   i'm looking for some ideas how to update entire column in html table,
  without updating overall table.
 
  For instance:
  table
  tr t:type=loop source=rows value=rowValue index=rowIndex
 td${rowValue.a}/td
 td${rowValue.b}/td
 td${rowValue.c}/td
 td
 t:zone t:id=myZone id=myZone-${rowIndex}
 ${some rowValue derived text or other
  components}
 /t:zone
 /td
  /tr
  /table
 
  on some event i want to update all zones with t:id=myZone.   The issue
 is
  that with XHR request t:loop is not executed and rowValue property is not
  bound.
 
  So even if i return properly populated MultiZoneUpdate it is rendered
  incorrectly, because rowValue is not changed before invocations.
 
  Any ideas how i can force t:loop to be executed or force myZone body to
 be
  rendered (i can re-iterate collection myself in handler method)?
 
  Thanks.
 



Zone updates fail after cancelling a window.onbeforeonload?

2011-02-24 Thread Richard Hill

Hi,

So I have the following:

window.onbeforeunload = function() {
  return You will lose your changes.; 
};

I have a number of actionlinks on my page, all of which update a zone.
Clicking these the beforeunload event is not fired (which is the
behaviour I want).

When I do a page refresh the it _is_ fired - also good. However if I
click Cancel, subsequent zone updates no longer work. On clicking an
actionlink a POST request is being triggered, and the zone contents is
coming back, but the page is not updating. If I click OK subsequent
zone updates work fine.

Any thoughts? 

Thanks Richard.




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



onActivate not called for components [T5.2]

2011-02-24 Thread Richard Hill

Hi,

Sorry another question - I was under the impression that the
onActivate() method mas called for all pages and components?

However it seems never to be called for any of my components. Has this
behaviour changed in 5.2?

Thanks


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



Re: onActivate not called for components [T5.2]

2011-02-24 Thread Igor Drobiazko
No, the activate method is specific to pages. It didn't change.

On Thu, Feb 24, 2011 at 2:45 PM, Richard Hill r...@su3analytics.com wrote:


 Hi,

 Sorry another question - I was under the impression that the
 onActivate() method mas called for all pages and components?

 However it seems never to be called for any of my components. Has this
 behaviour changed in 5.2?

 Thanks


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




-- 
Best regards,

Igor Drobiazko
http://tapestry5.de


Re: onActivate not called for components [T5.2]

2011-02-24 Thread Richard Hill

Ak ok thanks. For some reason I thought it was for components too.



On Thu, 2011-02-24 at 14:56 +0100, Igor Drobiazko wrote:
 No, the activate method is specific to pages. It didn't change.
 
 On Thu, Feb 24, 2011 at 2:45 PM, Richard Hill r...@su3analytics.com wrote:
 
 
  Hi,
 
  Sorry another question - I was under the impression that the
  onActivate() method mas called for all pages and components?
 
  However it seems never to be called for any of my components. Has this
  behaviour changed in 5.2?
 
  Thanks
 
 
  -
  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: EventLink URI and loop component

2011-02-24 Thread Mark
An eventLink tells the application to do something.  The context says
what you want to do it to.

When you aren't in a loop it is easy to figure out what to do things
to and you don't need a context because the thing you are doing the
action to is the same for the entire rendering of the page. However,
when you are in a loop the thing the action is performed on changes
with each iteration.

The behavior of the loop is a bit more expecte when you think about
how a framework can handle a loop.

There are two ways for the framework to solve this (that I'm aware
of).  One way is the way WebObjects does it.  It keeps track of the
state of all the variables at the moment each link is rendered.  If
you click on a link it goes back to that point in time to figure out
how things were when that particular link was rendered.

The second way is the way Tapestry does it.  You have to tell it what
object or objects are important for performing the action.  These are
specified in the context and then the object is passed to the event
handler. If you are using Hibernate, Tapestry takes care of just using
the IDs in the link and then pulling the entire object out of the
database to give to the event handler when it is invoked.

The downside of course is that you have to tell the component what
objects are important for the action.  The upside is that it requires
much less memory because the application doesn't have to remember the
state of ever iteration of every loop.  Also the Tapestry approach
means that the page doesn't have to rely on a a session.  The links
can still be good even after the session goes away because they
contain everything necessary to still fire off the event on the proper
object.

As far as the documentation, the EventLink docs show how it is used in a loop:
http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/EventLink.html

It might be a bit confusing because the context is specified in the
java class in an annotation instead of in the component, but it does
demonstrate how it works.

Mark

On Tue, Feb 22, 2011 at 2:57 AM, Erik Fäßler erik.faess...@uni-jena.de wrote:
  Thank you all for your answers. This behaviour of the loop is actually
 unexpected. I see that I'll have to stick with a more static structure or to
 rewrite the components in question. For the moment, I will pospone these
 things and come back to them later.

 And no, I havn't found anything about this in the docs either :)

 Best,

    Erik


 Am 18.02.2011 19:38, schrieb Rich M:

 On 02/18/2011 12:59 PM, Thiago H. de Paula Figueiredo wrote:

 On Fri, 18 Feb 2011 15:45:54 -0200, Rich M rich...@moremagic.com wrote:

 The challenge in your case is I don't believe you can dynamically assign
 a component ID. I double checked myself just now, and t:id only took a
 discrete ID (in 5.1.0.5), and was not happy pulling it from a property or
 other dynamic means.

 Static structure is not possible with dynamic component ids. I think the
 issue here is forgetting the event instance and relying only on passing
 information to the event handler method (in this case, using the context).

 I fully agree, my answer was convoluted in attempts to reference the
 broader scope of challenges faced when dealing with the static structure of
 a component enclosed within a loop. The concept of static structure, given a
 full understanding, makes the proper use of components in a Loop clear.

 However, I still think for someone coming to Tapestry it is likely to
 think of loops in the Java sense where each iteration is fresh
 (loop-declared objects/variables are unique between iterations, etc). It
 would be worthwhile to clarify the implications of static structure in loops
 where users are most likely to confuse a need for dynamic behavior with
 dynamic structure based on prior experiences with loops. Perhaps I haven't
 found the right documentation page, but I can't readily find much
 explanation of static structure and its implications in the Tapestry site
 documentation on pages where I might expect it.

 Regards,
 Rich

 -
 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



No context for a t:select?

2011-02-24 Thread Richard Hill

Hi - again :)

I have a simple select component in a loop: each object has some
property which can be one of three possible states. The user can update
this state by changing the value in a drop down.

I am supplying select and option models, which seem to work fine. But
how how do I supply a context? The t:select component does not appear to
take one. Without this I cannot know to what object my state change
relates. 

I've looked at valueencoders, but according to the docs, and from what
Thiago said yesterday, this seems to be alternative approach to using
models, which doesn't help.

Thanks

Richard.



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



Re: Using HTTPS to secure tapestry pages

2011-02-24 Thread Nicolas Barrera
Hi,

public void contributeMetaDataLocator(
 MappedConfigurationString,String configuration) {
 configuration.add(MetaDataConstants.SECURE_PAGE, true);
 }



didn't work for me either...

I 'm using tapestry 5.0.1.5,

can you confirm me if that configuration should work on this version?

thanks

Nicolás.-


On Wed, Feb 23, 2011 at 3:40 PM, Matias Moran matiasmo...@yahoo.com.arwrote:


 public void contributeMetaDataLocator(MappedConfigurationString,String
 configuration) {
 configuration.add(MetaDataConstants.SECURE_PAGE, true);
 }


Re: No context for a t:select?

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 11:58:26 -0300, Richard Hill r...@su3analytics.com  
wrote:



Hi - again :)


Hi!


I am supplying select and option models, which seem to work fine. But
how how do I supply a context? The t:select component does not appear to
take one. Without this I cannot know to what object my state change
relates.


Have you read the Select component documentation?  
(http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html).
The event handler method for the event valuechanged is used to provide  
the available car models of the currently selected car maker. The new  
Select's value is passed as context.


public Object onValueChanged(CarMaker maker)

In other words: you will receive the selected option as the event handler  
method parameter.



I've looked at valueencoders, but according to the docs, and from what
Thiago said yesterday, this seems to be alternative approach to using
models, which doesn't help.


I haven't said that. ValueEncoder and SelectModel are not alternative  
approaches to do the same thing. They do different things: SelectModel  
provides the options (including labels) and ValueEncoder encodes them for  
the value attribute of the option tag.


Here's the description from the SelectModel javadoc:

(SelectModel) Defines the possible options and option groups for a  
select [X]HTML element.


Primarily used by the Select component, but potentially used by anything  
similar, that needs to present a list of options to the user. Generally  
paired with a ValueEncoder to create client-side representations of  
server-side values.


Please read the documentation before asking. ;)

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

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

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



Adding properties to BeanModels dynamically

2011-02-24 Thread Stephan Windmüller
Hello!

Is it possible to extend the BeanModel of an object dynamically for a
BeanEditForm?

I tried to create one with BeanModelSource.createEditModel using my own
propertyConduits. But when the BeanEditForm loads, the datatype of the
property is null and I am getting this error:

The data type for property 'name' of null: null is null.

Is this the wrong way to extend the model?

Regards
 Stephan

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



Re: No context for a t:select?

2011-02-24 Thread Richard Hill

Hi Thiago,

Thanks for this. I think I understand better what ValueEncoder does now.
However, this doesn't answer my question: when I say context I mean
the loop context - not the option value that was selected. This I know
how to get, but I don't know for which loop item it refers.

Let's say I have a list of pens, and each can be red, blue or green:

t:loop source=pens value=pen
${pen.id}

t:select t:id=penSelect t:model=penModel t:value=penOption /

/t:loop

The penModel just models the three possible colors, penOption is the
selected color.

Now when a user makes a change, the onValueChangedFromPenSelect(Color
color) method is called.

No problem - but for which pen is it called? Without a loop context I do
not know this.

Given what you've said about value encoder, can I use this to store some
combination of both the pen id and the color id as the option value?








On Thu, 2011-02-24 at 12:34 -0300, Thiago H. de Paula Figueiredo wrote:

 On Thu, 24 Feb 2011 11:58:26 -0300, Richard Hill r...@su3analytics.com  
 wrote:
 
  Hi - again :)
 
 Hi!
 
  I am supplying select and option models, which seem to work fine. But
  how how do I supply a context? The t:select component does not appear to
  take one. Without this I cannot know to what object my state change
  relates.
 
 Have you read the Select component documentation?  
 (http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html).
 The event handler method for the event valuechanged is used to provide  
 the available car models of the currently selected car maker. The new  
 Select's value is passed as context.
 
 public Object onValueChanged(CarMaker maker)
 
 In other words: you will receive the selected option as the event handler  
 method parameter.
 
  I've looked at valueencoders, but according to the docs, and from what
  Thiago said yesterday, this seems to be alternative approach to using
  models, which doesn't help.
 
 I haven't said that. ValueEncoder and SelectModel are not alternative  
 approaches to do the same thing. They do different things: SelectModel  
 provides the options (including labels) and ValueEncoder encodes them for  
 the value attribute of the option tag.
 
 Here's the description from the SelectModel javadoc:
 
 (SelectModel) Defines the possible options and option groups for a  
 select [X]HTML element.
 
 Primarily used by the Select component, but potentially used by anything  
 similar, that needs to present a list of options to the user. Generally  
 paired with a ValueEncoder to create client-side representations of  
 server-side values.
 
 Please read the documentation before asking. ;)
 




Re: Adding properties to BeanModels dynamically

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 12:35:50 -0300, Stephan Windmüller  
stephan.windmuel...@tu-dortmund.de wrote:



Hello!


Hi!


Is it possible to extend the BeanModel of an object dynamically for a
BeanEditForm?


Yes!


I tried to create one with BeanModelSource.createEditModel using my own
propertyConduits. But when the BeanEditForm loads, the datatype of the
property is null and I am getting this error:
The data type for property 'name' of null: null is null.


Please post your code. The datatype of a property can never be null.

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

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

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



Re: No context for a t:select?

2011-02-24 Thread Richard Hill

Thanks for this. I think I understand better what ValueEncoder does now.
However, this doesn't answer my question: when I say context I mean
the loop context - not the option value that was selected. This I know
how to get, but I don't know for which loop item it refers.

Let's say I have a list of pens, and each can be red, blue or green:

t:loop source=pens value=pen
${pen.id}

t:select t:id=penSelect t:model=penModel t:value=penOption /

/t:loop

The penModel just models the three possible colors, penOption is the
selected color.

Now when a user makes a change, the onValueChangedFromPenSelect(Color
color) method is called.

No problem - but for which pen is it called? Without a loop context I do
not know this.

Given what you've said about value encoder, can I use this to store some
combination of both the pen id and the color id as the option value?




On Thu, 2011-02-24 at 12:34 -0300, Thiago H. de Paula Figueiredo wrote:
 On Thu, 24 Feb 2011 11:58:26 -0300, Richard Hill r...@su3analytics.com  
 wrote:
 
  Hi - again :)
 
 Hi!
 
  I am supplying select and option models, which seem to work fine. But
  how how do I supply a context? The t:select component does not appear to
  take one. Without this I cannot know to what object my state change
  relates.
 
 Have you read the Select component documentation?  
 (http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html).
 The event handler method for the event valuechanged is used to provide  
 the available car models of the currently selected car maker. The new  
 Select's value is passed as context.
 
 public Object onValueChanged(CarMaker maker)
 
 In other words: you will receive the selected option as the event handler  
 method parameter.
 
  I've looked at valueencoders, but according to the docs, and from what
  Thiago said yesterday, this seems to be alternative approach to using
  models, which doesn't help.
 
 I haven't said that. ValueEncoder and SelectModel are not alternative  
 approaches to do the same thing. They do different things: SelectModel  
 provides the options (including labels) and ValueEncoder encodes them for  
 the value attribute of the option tag.
 
 Here's the description from the SelectModel javadoc:
 
 (SelectModel) Defines the possible options and option groups for a  
 select [X]HTML element.
 
 Primarily used by the Select component, but potentially used by anything  
 similar, that needs to present a list of options to the user. Generally  
 paired with a ValueEncoder to create client-side representations of  
 server-side values.
 
 Please read the documentation before asking. ;)
 



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



Re: No context for a t:select?

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 13:15:51 -0300, Richard Hill r...@su3analytics.com  
wrote:



Thanks for this. I think I understand better what ValueEncoder does now.
However, this doesn't answer my question: when I say context I mean
the loop context - not the option value that was selected. This I know
how to get, but I don't know for which loop item it refers.


The Loop component doesn't have a context, so now I know what you were  
talking about.



Let's say I have a list of pens, and each can be red, blue or green:

t:loop source=pens value=pen
${pen.id}

t:select t:id=penSelect t:model=penModel t:value=penOption /

/t:loop

The penModel just models the three possible colors, penOption is the
selected color.

Now when a user makes a change, the onValueChangedFromPenSelect(Color
color) method is called.

No problem - but for which pen is it called? Without a loop context I do
not know this.


The example makes it all very clear. It seems to me that Select needs an  
improvement: having a context parameter that allows you to pass more  
values to the event handler method. For example, your method would be  
onValueChangedFromPenSelect(Color color, XXX xxx). Please file a JIRA  
about it.



Given what you've said about value encoder, can I use this to store some
combination of both the pen id and the color id as the option value?


I think that's technically possible, but I'd not recommend that.

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

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

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



Re: Adding properties to BeanModels dynamically

2011-02-24 Thread Stephan Windmüller
On Thu, 24. Feb 2011, Thiago H. de Paula Figueiredo wrote:

 I tried to create one with BeanModelSource.createEditModel using my own
 propertyConduits. But when the BeanEditForm loads, the datatype of the
 property is null and I am getting this error:
 The data type for property 'name' of null: null is null.
 Please post your code. The datatype of a property can never be null.

In short, it is reduced to this:

-

ListString valueTypes = dao.getValueTypes();

BeanModelTreatmentModel model =
beanModelSource.createEditModel(MyObject.class, messages);

for (String type : valueTypes) {
   PropertyConduit propertyConduit = new PropertyConduit() { ... };
   model.add(type, propertyConduit);
}

-

The resulting model contains properties with a null datatype.

If you need more information like how I build the PropertyConduit,
please let me know.

Regards
 Stephan


signature.asc
Description: Digital signature


Re: Adding properties to BeanModels dynamically

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 13:33:44 -0300, Stephan Windmüller  
stephan.windmuel...@tu-dortmund.de wrote:



ListString valueTypes = dao.getValueTypes();

BeanModelTreatmentModel model =
beanModelSource.createEditModel(MyObject.class, messages);

for (String type : valueTypes) {
   PropertyConduit propertyConduit = new PropertyConduit() { ... };
   model.add(type, propertyConduit);
}


This looks correct.


The resulting model contains properties with a null datatype.


That surely looks like something you shouldn't do. How can the component  
know how edit an value which hasn't a data type? In this case, you either  
define a custom datatype and provide edition and viewing blocks for them  
or you don't add this property to the bean model.



If you need more information like how I build the PropertyConduit,
please let me know.


Please post it.

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

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

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



Re: No context for a t:select?

2011-02-24 Thread Richard Hill

Yes agreed - I think t:select should take an optional context parameter.
I will file a JIRA.

As a work around I see two options:

1) In my case here I don't need to actually re-render a zone when the
user changes the selection. So I will probably just render the select
manually and attach my own js handler to fire back the change to the
server.

2) If you did require a zone update, I think you would have to use
context-dependent select and option models which provided client-side
option values that were some combination of the context and option id.
These could then be parsed out server-side when a user makes his
selection. But sounds a bit hacky :)

Thiago - thanks for your help and patience on this.

Cheers Richard





On Thu, 2011-02-24 at 13:24 -0300, Thiago H. de Paula Figueiredo wrote:
 On Thu, 24 Feb 2011 13:15:51 -0300, Richard Hill r...@su3analytics.com  
 wrote:
 
  Thanks for this. I think I understand better what ValueEncoder does now.
  However, this doesn't answer my question: when I say context I mean
  the loop context - not the option value that was selected. This I know
  how to get, but I don't know for which loop item it refers.
 
 The Loop component doesn't have a context, so now I know what you were  
 talking about.
 
  Let's say I have a list of pens, and each can be red, blue or green:
 
  t:loop source=pens value=pen
  ${pen.id}
 
  t:select t:id=penSelect t:model=penModel t:value=penOption /
 
  /t:loop
 
  The penModel just models the three possible colors, penOption is the
  selected color.
 
  Now when a user makes a change, the onValueChangedFromPenSelect(Color
  color) method is called.
 
  No problem - but for which pen is it called? Without a loop context I do
  not know this.
 
 The example makes it all very clear. It seems to me that Select needs an  
 improvement: having a context parameter that allows you to pass more  
 values to the event handler method. For example, your method would be  
 onValueChangedFromPenSelect(Color color, XXX xxx). Please file a JIRA  
 about it.
 
  Given what you've said about value encoder, can I use this to store some
  combination of both the pen id and the color id as the option value?
 
 I think that's technically possible, but I'd not recommend that.
 



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



Re: Adding properties to BeanModels dynamically

2011-02-24 Thread Stephan Windmüller
On Thu, 24. Feb 2011, Thiago H. de Paula Figueiredo wrote:

 The resulting model contains properties with a null datatype.
 That surely looks like something you shouldn't do. How can the component  
 know how edit an value which hasn't a data type? In this case, you either 
 define a custom datatype and provide edition and viewing blocks for them  
 or you don't add this property to the bean model.

It's a simple number. Okay, not simple, but BigDecimal.

However, I did not set/change the datatype myself, as you can see in the
posted code.

 If you need more information like how I build the PropertyConduit,
 please let me know.
 Please post it.

private void addPropertyConduitsToBeanModel(BeanModelTreatmentModel model) {
   for (final ValueType valueTypes : dao.getValueTypes()) {
  PropertyConduit propertyConduit = new PropertyConduit() {
 public Object get(Object instance) {
MyObject myObject = (MyObject) instance;
return model.getValue(valueType);
 }

 public void set(Object instance, Object value) {
MyObject myObject = (MyObject) instance;
BigDecimal myValue = (BigDecimal) value;
myObject.setValue(valueType, value);
 }

 public Class getPropertyType() {
return BigDecimal.class;
 }

 public T extends Annotation T getAnnotation(ClassT 
annotationClass) {
return null;
 }
  };

  String propertyName = valueType.getName();
  model.add(propertyName, propertyConduit);
   }
}

- Stephan


signature.asc
Description: Digital signature


Update symbols outside of App Module

2011-02-24 Thread Mark
I'm using ChenilleKitMail and I want to let end users update the SMTP
settings from the application.

So right now my AppModule has a contributeApplicationDefaults that
hard code all the values like:

// Email Setup
configuration.add(ChenilleKitMailConstants.SMTP_HOST, smtp.a.com);
configuration.add(ChenilleKitMailConstants.SMTP_PORT, 25);
configuration.add(ChenilleKitMailConstants.SMTP_DEBUG, true);
configuration.add(ChenilleKitMailConstants.SMTP_USER, a...@a.com);
configuration.add(ChenilleKitMailConstants.SMTP_PASSWORD, *);
configuration.add(ChenilleKitMailConstants.SMTP_SSL, true);
configuration.add(ChenilleKitMailConstants.SMTP_SSLPORT, 465);
configuration.add(ChenilleKitMailConstants.SMTP_TLS, true);


I want to be able to update these to different settings from a page
class. I'm assuming I can inject something into the page class to
update these symbols, but I'm not sure what to use.

Mark

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



Re: Adding properties to BeanModels dynamically

2011-02-24 Thread Thiago H. de Paula Figueiredo
That's strange. Your PropertyConduit implementation and use looks correct  
to me. Could you post the full stack trace please? The datatype is defined  
by the DataTypeAnalyzer service, and its configuration provided by  
Tapestry alread maps BigDecimal to the number datatype.


On Thu, 24 Feb 2011 14:02:14 -0300, Stephan Windmüller  
stephan.windmuel...@tu-dortmund.de wrote:



On Thu, 24. Feb 2011, Thiago H. de Paula Figueiredo wrote:


The resulting model contains properties with a null datatype.

That surely looks like something you shouldn't do. How can the component
know how edit an value which hasn't a data type? In this case, you  
either

define a custom datatype and provide edition and viewing blocks for them
or you don't add this property to the bean model.


It's a simple number. Okay, not simple, but BigDecimal.

However, I did not set/change the datatype myself, as you can see in the
posted code.


If you need more information like how I build the PropertyConduit,
please let me know.

Please post it.


private void addPropertyConduitsToBeanModel(BeanModelTreatmentModel  
model) {

   for (final ValueType valueTypes : dao.getValueTypes()) {
  PropertyConduit propertyConduit = new PropertyConduit() {
 public Object get(Object instance) {
MyObject myObject = (MyObject) instance;
return model.getValue(valueType);
 }

 public void set(Object instance, Object value) {
MyObject myObject = (MyObject) instance;
BigDecimal myValue = (BigDecimal) value;
myObject.setValue(valueType, value);
 }

 public Class getPropertyType() {
return BigDecimal.class;
 }

	 public T extends Annotation T getAnnotation(ClassT  
annotationClass) {

return null;
 }
  };

  String propertyName = valueType.getName();
  model.add(propertyName, propertyConduit);
   }
}

- Stephan



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

Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com  
Ênfase em Java da Faculdade Pitágoras

http://www.arsmachina.com.br

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



Re: Update symbols outside of App Module

2011-02-24 Thread Thiago H. de Paula Figueiredo

Tapestry-IoC symbols aren't updateable.

On Thu, 24 Feb 2011 14:17:10 -0300, Mark mark-li...@xeric.net wrote:


I'm using ChenilleKitMail and I want to let end users update the SMTP
settings from the application.

So right now my AppModule has a contributeApplicationDefaults that
hard code all the values like:

// Email Setup
configuration.add(ChenilleKitMailConstants.SMTP_HOST, smtp.a.com);
configuration.add(ChenilleKitMailConstants.SMTP_PORT, 25);
configuration.add(ChenilleKitMailConstants.SMTP_DEBUG, true);
configuration.add(ChenilleKitMailConstants.SMTP_USER, a...@a.com);
configuration.add(ChenilleKitMailConstants.SMTP_PASSWORD, *);
configuration.add(ChenilleKitMailConstants.SMTP_SSL, true);
configuration.add(ChenilleKitMailConstants.SMTP_SSLPORT, 465);
configuration.add(ChenilleKitMailConstants.SMTP_TLS, true);


I want to be able to update these to different settings from a page
class. I'm assuming I can inject something into the page class to
update these symbols, but I'm not sure what to use.

Mark

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




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

Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com  
Ênfase em Java da Faculdade Pitágoras

http://www.arsmachina.com.br

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



Re: Adding properties to BeanModels dynamically

2011-02-24 Thread Stephan Windmüller
On Thu, 24. Feb 2011, Thiago H. de Paula Figueiredo wrote:

 That's strange. Your PropertyConduit implementation and use looks correct 
 to me. Could you post the full stack trace please?

Of course:

org.apache.tapestry5.ioc.internal.util.TapestryException: The data type for 
property 'myValue' of null: null is null. [at 
classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, line 5]
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:194)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.render(ComponentPageElementImpl.java:246)
at 
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
at 
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:127)
at 
$PageRenderQueue_12e58b89fbf.render($PageRenderQueue_12e58b89fbf.java)
at 
$PageRenderQueue_12e58b89fb7.render($PageRenderQueue_12e58b89fb7.java)
at 
org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37)
at 
org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:2089)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:2073)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:2055)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:2040)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:2026)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
org.apache.tapestry5.services.TapestryModule$24.renderMarkup(TapestryModule.java:2008)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
org.apache.tapestry5.services.TapestryModule$23.renderMarkup(TapestryModule.java:1989)
at 
$MarkupRenderer_12e58b89fc1.renderMarkup($MarkupRenderer_12e58b89fc1.java)
at 
$MarkupRenderer_12e58b89fbe.renderMarkup($MarkupRenderer_12e58b89fbe.java)
at 
org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
at 
$PageMarkupRenderer_12e58b89fbc.renderPageMarkup($PageMarkupRenderer_12e58b89fbc.java)
at 
org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:67)
at 
$PageResponseRenderer_12e58b89f5e.renderPageResponse($PageResponseRenderer_12e58b89f5e.java)
at 
org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:64)
at 
org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2326)
at 
$PageRenderRequestHandler_12e58b89f60.handle($PageRenderRequestHandler_12e58b89f60.java)
at 
$PageRenderRequestHandler_12e58b89f5a.handle($PageRenderRequestHandler_12e58b89f5a.java)
at 
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
at 
org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
at 
$ComponentRequestHandler_12e58b89f5b.handlePageRender($ComponentRequestHandler_12e58b89f5b.java)
at 
$ComponentRequestHandler_12e58b89f3f.handlePageRender($ComponentRequestHandler_12e58b89f3f.java)
at 
org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45)
at $Dispatcher_12e58b89f41.dispatch($Dispatcher_12e58b89f41.java)
at $Dispatcher_12e58b89f3c.dispatch($Dispatcher_12e58b89f3c.java)
at 
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:321)
at 
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
at $RequestHandler_12e58b89f3d.service($RequestHandler_12e58b89f3d.java)
at 
org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:984)
at $RequestHandler_12e58b89f3d.service($RequestHandler_12e58b89f3d.java)
at 
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:974)
at $RequestHandler_12e58b89f3d.service($RequestHandler_12e58b89f3d.java)
at 
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
at $RequestHandler_12e58b89f3d.service($RequestHandler_12e58b89f3d.java)

Re: Problem deploying tapestry webapp

2011-02-24 Thread Howard Lewis Ship
I wonder how we can turn this into a FAQ?  The cause and symptoms are
pretty obscure!

On Wed, Feb 23, 2011 at 11:08 PM, Marek Matus marek.ma...@geisom.com wrote:
 I had similar problem - the problem was that the class loader cannot load
 sax parser. I had to explicit define which sax parser should be loaded by
 setting:

 -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser

 Marek

 2011/2/23 Ulrich Stärk u...@spielviel.de

 Can you give us some more information? What request was sent to the server,
 can you post some code
 (page/component class and template)?

 Uli

 On 23.02.2011 22:35, Andreas Deininger wrote:
  Hi all,
 
  I just created a first tapestry webapp. I can run mvn tomcat:run
  locally, and everything is fine. However, after running mvn package
  and deploying the app to my server (apache tomat 6.0.10) I'm getting
  the error listed below. Any idea what's wrong here?
 
  Thanks
  Andreas
 
  Stacktrace:
 
  org.apache.tapestry5.ioc.internal.OperationException: -1
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:102)
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:69)
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
 
 org.apache.tapestry5.internal.services.TemplateParserImpl.parseTemplate(TemplateParserImpl.java:57)
 
 $TemplateParser_12e54598525.parseTemplate($TemplateParser_12e54598525.java)
 
 org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl.parseTemplate(ComponentTemplateSourceImpl.java:153)
 
 org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl.getTemplate(ComponentTemplateSourceImpl.java:136)
 
 $ComponentTemplateSource_12e54598524.getTemplate($ComponentTemplateSource_12e54598524.java)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:226)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:219)
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:218)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:208)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:180)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174)
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173)
        $PageLoader_12e5459851b.loadPage($PageLoader_12e5459851b.java)
 
 org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81)
        $PageSource_12e5459851a.getPage($PageSource_12e5459851a.java)
 
 org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74)
 
 $RequestPageCache_12e54598519.get($RequestPageCache_12e54598519.java)
 
 $RequestPageCache_12e54598513.get($RequestPageCache_12e54598513.java)
 
 org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:77)
 
 $RequestExceptionHandler_12e545984f1.handleRequestException($RequestExceptionHandler_12e545984f1.java)
 
 org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:42)
 
 $RequestHandler_12e545984f4.service($RequestHandler_12e545984f4.java)
 
 org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:984)
 
 $RequestHandler_12e545984f4.service($RequestHandler_12e545984f4.java)
 
 org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:974)
 
 $RequestHandler_12e545984f4.service($RequestHandler_12e545984f4.java)
 
 org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
 
 $RequestHandler_12e545984f4.service($RequestHandler_12e545984f4.java)
 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:80)
 
 org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
 
 $RequestHandler_12e545984f4.service($RequestHandler_12e545984f4.java)
 
 

Re: No context for a t:select?

2011-02-24 Thread Josh Canfield
 Yes agreed - I think t:select should take an optional context parameter.

I guess it's a little late to second guess the wisdom of adding a
zone parameter to the Select component in the first place... I
hadn't noticed it until now. This functionality could have been
provided as a mixin and then applied to Radio and Checkbox as well...

A context parameter doesn't make sense outside of the ajax update
scenario. Someone will inevitably try to use the attribute outside of
an ajax update and file another defect.

Would it be reasonable to instead provide an OnChange mixin in core
(one exists in a third party library already, right?) that handled the
context correctly?

Josh

On Thu, Feb 24, 2011 at 8:49 AM, Richard Hill r...@su3analytics.com wrote:

 Yes agreed - I think t:select should take an optional context parameter.
 I will file a JIRA.

 As a work around I see two options:

 1) In my case here I don't need to actually re-render a zone when the
 user changes the selection. So I will probably just render the select
 manually and attach my own js handler to fire back the change to the
 server.

 2) If you did require a zone update, I think you would have to use
 context-dependent select and option models which provided client-side
 option values that were some combination of the context and option id.
 These could then be parsed out server-side when a user makes his
 selection. But sounds a bit hacky :)

 Thiago - thanks for your help and patience on this.

 Cheers Richard





 On Thu, 2011-02-24 at 13:24 -0300, Thiago H. de Paula Figueiredo wrote:
 On Thu, 24 Feb 2011 13:15:51 -0300, Richard Hill r...@su3analytics.com
 wrote:

  Thanks for this. I think I understand better what ValueEncoder does now.
  However, this doesn't answer my question: when I say context I mean
  the loop context - not the option value that was selected. This I know
  how to get, but I don't know for which loop item it refers.

 The Loop component doesn't have a context, so now I know what you were
 talking about.

  Let's say I have a list of pens, and each can be red, blue or green:
 
  t:loop source=pens value=pen
  ${pen.id}
 
  t:select t:id=penSelect t:model=penModel t:value=penOption /
 
  /t:loop
 
  The penModel just models the three possible colors, penOption is the
  selected color.
 
  Now when a user makes a change, the onValueChangedFromPenSelect(Color
  color) method is called.
 
  No problem - but for which pen is it called? Without a loop context I do
  not know this.

 The example makes it all very clear. It seems to me that Select needs an
 improvement: having a context parameter that allows you to pass more
 values to the event handler method. For example, your method would be
 onValueChangedFromPenSelect(Color color, XXX xxx). Please file a JIRA
 about it.

  Given what you've said about value encoder, can I use this to store some
  combination of both the pen id and the color id as the option value?

 I think that's technically possible, but I'd not recommend that.




 -
 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: No context for a t:select?

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 16:12:10 -0300, Josh Canfield joshcanfi...@gmail.com  
wrote:



Yes agreed - I think t:select should take an optional context parameter.


I guess it's a little late to second guess the wisdom of adding a
zone parameter to the Select component in the first place... I
hadn't noticed it until now. This functionality could have been
provided as a mixin and then applied to Radio and Checkbox as well...


We can still write this plugin and leave Select as is.


A context parameter doesn't make sense outside of the ajax update
scenario. Someone will inevitably try to use the attribute outside of
an ajax update and file another defect.


What about ajaxContext instead of context in this case?


Would it be reasonable to instead provide an OnChange mixin in core
(one exists in a third party library already, right?) that handled the
context correctly?


I think so. Tapestry 4 was quite easy to make AJAX updates in response to  
arbitrary JavaScript events.


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

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

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



pagination

2011-02-24 Thread Josh Kamau
Hi Users;

How does tapestry do the pagination on a grid? Does it retrieve all the data
from the database and then does the pagination on the clientside or does it
retrieve a page at a time from the database?

I have used wicket before and all i did was implement something like
getIterator(first, count, sortProperty, isAscending), That way, the way the
data is retrieved is transparent and i can write a dao that gets each page
at a time without loading all the records. Is there a way to achieve the
same with tapestry. I mean , is there a way to load a page at a time from
the database using tapestry pagination.

Kind regards.
Josh.


Re: pagination

2011-02-24 Thread Howard Lewis Ship
If you look at the source parameter of the Grid, it is a
GridDataSource object.  You can bind a List to the source parameter,
and Tapestry takes care of converting the list to a GridDataSource,
but for large result sets from a database, you really want to use the
GridDataSource interface, because it supports sorting and pagination
in the database.

On Thu, Feb 24, 2011 at 11:53 AM, Josh Kamau joshnet2...@gmail.com wrote:
 Hi Users;

 How does tapestry do the pagination on a grid? Does it retrieve all the data
 from the database and then does the pagination on the clientside or does it
 retrieve a page at a time from the database?

 I have used wicket before and all i did was implement something like
 getIterator(first, count, sortProperty, isAscending), That way, the way the
 data is retrieved is transparent and i can write a dao that gets each page
 at a time without loading all the records. Is there a way to achieve the
 same with tapestry. I mean , is there a way to load a page at a time from
 the database using tapestry pagination.

 Kind regards.
 Josh.




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Re: Using HTTPS to secure tapestry pages

2011-02-24 Thread Ulrich Stärk
What Tapestry version? Just checked with 5.3.0-SNAPSHOT and it works like a 
charm.

BTW: SECURE_ENABLED is only needed when PRODUCTION_MODE is set to false. In 
production mode, secure
is enabled by default.

Uli

On 23.02.2011 19:40, Matias Moran wrote:
 Dear Tapestry users, how have you been?
 
 I'm writing this time to ask you about using HTTPS with Jetty.
 
 I followed the advices of the page 
 http://tapestry.apache.org/tapestry5/guide/secure.html and others, but I 
 wasn't able to make it work for all the pages at once.
 What I'm trying to do is securing all the pages in one place, an avoid to put 
 the @Secure annotation in every single page.
 
 I tried putting in AppModule, inside of contributeApplicationDefaults the 
 values: 
 
 configuration.add(SymbolConstants.PRODUCTION_MODE, true);
 configuration.add(SymbolConstants.SECURE_ENABLED, true);
 
 And then, I added also in AppModule:
 
 public void contributeMetaDataLocator(MappedConfigurationString,String 
 configuration) {
 configuration.add(MetaDataConstants.SECURE_PAGE, true);
 }
 
 and
 
 public static void contributeAlias(ConfigurationAliasContribution? 
 configuration) {
 
 BaseURLSource source = new BaseURLSource() {
 
 public String getBaseURL(boolean secure) {
 
 String protocol = secure ? https : http;
 
 int port = secure ? 8443 : 8080;
 
 return String.format(%s://server:%d, protocol, port);
 }
 };
 
 configuration.add(AliasContribution.create(BaseURLSource.class, source));
 }
 
 
 
 At last, in the Jetty plugin, I defined the connectors, to force the use of 
 certain ports for certain protocol:
 
 connectors
 connector 
 implementation=org.eclipse.jetty.server.nio.SelectChannelConnector
 port8080/port
 maxIdleTime6/maxIdleTime
 /connector
 connector 
 implementation=org.eclipse.jetty.server.ssl.SslSocketConnector
 port8443/port
 maxIdleTime6/maxIdleTime
 keystoresrc/test/resources/keystore/keystore
 passwordpassword/password
 keyPasswordpassword/keyPassword
 /connector
 /connectors
 
 
 But it doesn't work, at least for me. I tried adding the @Secure annotation 
 to every page (which is exactly what I'm trying to avoid), and it started to 
 work the way I wanted. 
 
 Is there anything I'm forgetting? Does it require any other configurations?
 
 
 Thanks in advance!!! Best wishes!
 
 Matias.
 
 
   

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



Re: pagination

2011-02-24 Thread Ulrich Stärk
Also have a look at Tapestry's Hibernate integration [1] which supplies a 
HibernateGridDataSource
[2] that implements pagination and only fetches the necessary objects from the 
database.

Uli

[1] http://tapestry.apache.org/hibernate.html
[2]
http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/hibernate/HibernateGridDataSource.html

On 24.02.2011 21:00, Howard Lewis Ship wrote:
 If you look at the source parameter of the Grid, it is a
 GridDataSource object.  You can bind a List to the source parameter,
 and Tapestry takes care of converting the list to a GridDataSource,
 but for large result sets from a database, you really want to use the
 GridDataSource interface, because it supports sorting and pagination
 in the database.
 
 On Thu, Feb 24, 2011 at 11:53 AM, Josh Kamau joshnet2...@gmail.com wrote:
 Hi Users;

 How does tapestry do the pagination on a grid? Does it retrieve all the data
 from the database and then does the pagination on the clientside or does it
 retrieve a page at a time from the database?

 I have used wicket before and all i did was implement something like
 getIterator(first, count, sortProperty, isAscending), That way, the way the
 data is retrieved is transparent and i can write a dao that gets each page
 at a time without loading all the records. Is there a way to achieve the
 same with tapestry. I mean , is there a way to load a page at a time from
 the database using tapestry pagination.

 Kind regards.
 Josh.

 
 
 

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



Re: pagination

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 17:00:33 -0300, Howard Lewis Ship hls...@gmail.com  
wrote:



If you look at the source parameter of the Grid, it is a
GridDataSource object.  You can bind a List to the source parameter,
and Tapestry takes care of converting the list to a GridDataSource,
but for large result sets from a database, you really want to use the
GridDataSource interface, because it supports sorting and pagination
in the database.


In addition, take a look at the HibernateGridDataSource class from  
tapestry-hibernate.


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

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

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



Re: pagination

2011-02-24 Thread Josh Kamau
Thanks guys.

I will implement the GridDataSource. I didnt know it existed.

Thiago, for some personal reasons, i prefer using mybatis(formerly ibatis)
as opposed to hibernate (i had a very bad experience with hibernate in a
live environment, most of it caused by my limited understanding of hibernate
advanced features.)

Josh.
ps: am eagerly waiting for the T5 in action book.

On Thu, Feb 24, 2011 at 11:12 PM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Thu, 24 Feb 2011 17:00:33 -0300, Howard Lewis Ship hls...@gmail.com
 wrote:

  If you look at the source parameter of the Grid, it is a
 GridDataSource object.  You can bind a List to the source parameter,
 and Tapestry takes care of converting the list to a GridDataSource,
 but for large result sets from a database, you really want to use the
 GridDataSource interface, because it supports sorting and pagination
 in the database.


 In addition, take a look at the HibernateGridDataSource class from
 tapestry-hibernate.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br


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




Re: pagination

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 17:16:27 -0300, Josh Kamau joshnet2...@gmail.com  
wrote:



Thanks guys.


:)


I will implement the GridDataSource. I didnt know it existed.


It's in the Grid component reference as the type of the source parameter.


Thiago, for some personal reasons, i prefer using mybatis(formerly  
ibatis)

as opposed to hibernate (i had a very bad experience with hibernate in a
live environment, most of it caused by my limited understanding of  
hibernate advanced features.)


Even using a different ORM framework, it still can be used as an example.

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

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

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



Re: pagination

2011-02-24 Thread Howard Lewis Ship
If you look at the source parameter of the Grid, it is a
GridDataSource object.  You can bind a List to the source parameter,
and Tapestry takes care of converting the list to a GridDataSource,
but for large result sets from a database, you really want to use the
GridDataSource interface, because it supports sorting and pagination
in the database.

On Thu, Feb 24, 2011 at 11:53 AM, Josh Kamau joshnet2...@gmail.com wrote:
 Hi Users;

 How does tapestry do the pagination on a grid? Does it retrieve all the data
 from the database and then does the pagination on the clientside or does it
 retrieve a page at a time from the database?

 I have used wicket before and all i did was implement something like
 getIterator(first, count, sortProperty, isAscending), That way, the way the
 data is retrieved is transparent and i can write a dao that gets each page
 at a time without loading all the records. Is there a way to achieve the
 same with tapestry. I mean , is there a way to load a page at a time from
 the database using tapestry pagination.

 Kind regards.
 Josh.




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Re: pagination

2011-02-24 Thread Josh Kamau
Thanks HLS , I appreciate the quick response. I have already implemented a
simple case and its working. I am reading the user guide to make sure that i
dont miss anything out.

Josh.

On Thu, Feb 24, 2011 at 11:46 PM, Howard Lewis Ship hls...@gmail.comwrote:

 If you look at the source parameter of the Grid, it is a
 GridDataSource object.  You can bind a List to the source parameter,
 and Tapestry takes care of converting the list to a GridDataSource,
 but for large result sets from a database, you really want to use the
 GridDataSource interface, because it supports sorting and pagination
 in the database.

 On Thu, Feb 24, 2011 at 11:53 AM, Josh Kamau joshnet2...@gmail.com
 wrote:
  Hi Users;
 
  How does tapestry do the pagination on a grid? Does it retrieve all the
 data
  from the database and then does the pagination on the clientside or does
 it
  retrieve a page at a time from the database?
 
  I have used wicket before and all i did was implement something like
  getIterator(first, count, sortProperty, isAscending), That way, the way
 the
  data is retrieved is transparent and i can write a dao that gets each
 page
  at a time without loading all the records. Is there a way to achieve the
  same with tapestry. I mean , is there a way to load a page at a time from
  the database using tapestry pagination.
 
  Kind regards.
  Josh.
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com

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




Re: No context for a t:select?

2011-02-24 Thread Andreas Andreou
That's exactly why i asked the question about implementation
mixins in the dev list ( http://markmail.org/thread/ft755d4vbkfaip4v )

And there's no reason to restict it to onchange events - anyway, i'll
open some related jira issues tonight...

On Thu, Feb 24, 2011 at 21:12, Josh Canfield joshcanfi...@gmail.com wrote:
 Yes agreed - I think t:select should take an optional context parameter.

 I guess it's a little late to second guess the wisdom of adding a
 zone parameter to the Select component in the first place... I
 hadn't noticed it until now. This functionality could have been
 provided as a mixin and then applied to Radio and Checkbox as well...

 A context parameter doesn't make sense outside of the ajax update
 scenario. Someone will inevitably try to use the attribute outside of
 an ajax update and file another defect.

 Would it be reasonable to instead provide an OnChange mixin in core
 (one exists in a third party library already, right?) that handled the
 context correctly?

 Josh

 On Thu, Feb 24, 2011 at 8:49 AM, Richard Hill r...@su3analytics.com wrote:

 Yes agreed - I think t:select should take an optional context parameter.
 I will file a JIRA.

 As a work around I see two options:

 1) In my case here I don't need to actually re-render a zone when the
 user changes the selection. So I will probably just render the select
 manually and attach my own js handler to fire back the change to the
 server.

 2) If you did require a zone update, I think you would have to use
 context-dependent select and option models which provided client-side
 option values that were some combination of the context and option id.
 These could then be parsed out server-side when a user makes his
 selection. But sounds a bit hacky :)

 Thiago - thanks for your help and patience on this.

 Cheers Richard





 On Thu, 2011-02-24 at 13:24 -0300, Thiago H. de Paula Figueiredo wrote:
 On Thu, 24 Feb 2011 13:15:51 -0300, Richard Hill r...@su3analytics.com
 wrote:

  Thanks for this. I think I understand better what ValueEncoder does now.
  However, this doesn't answer my question: when I say context I mean
  the loop context - not the option value that was selected. This I know
  how to get, but I don't know for which loop item it refers.

 The Loop component doesn't have a context, so now I know what you were
 talking about.

  Let's say I have a list of pens, and each can be red, blue or green:
 
  t:loop source=pens value=pen
  ${pen.id}
 
  t:select t:id=penSelect t:model=penModel t:value=penOption /
 
  /t:loop
 
  The penModel just models the three possible colors, penOption is the
  selected color.
 
  Now when a user makes a change, the onValueChangedFromPenSelect(Color
  color) method is called.
 
  No problem - but for which pen is it called? Without a loop context I do
  not know this.

 The example makes it all very clear. It seems to me that Select needs an
 improvement: having a context parameter that allows you to pass more
 values to the event handler method. For example, your method would be
 onValueChangedFromPenSelect(Color color, XXX xxx). Please file a JIRA
 about it.

  Given what you've said about value encoder, can I use this to store some
  combination of both the pen id and the color id as the option value?

 I think that's technically possible, but I'd not recommend that.




 -
 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





-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Apache Tapestry PMC / http://chesstu.be owner
Open Source / JEE Consulting

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



Akismet API compatible Tapestry 5 Module

2011-02-24 Thread raulmt

Hi,

I created a Github project for an Akismet service for Tapestry 5 .

For those who doesn't know Akismet, is a service for detecting spam comments
(specially useful for blogs). Is a paid service, but there is also a free
and open source alternative called TypePad AntiSpam
(http://antispam.typepad.com/) which uses the exact same API Akismet does
and this module uses it by default.

This module is strongly based on java-akismet from Michael Simons
(https://github.com/michael-simons/java-akismet) but ready to be integrated
in the beatiful context of a Tapestry 5 app ;-)

You can see the project and a README here:
https://github.com/raulmt/quilt-akismet

If you want to use it and have any question, just ask... and if you have a
comment or something that can be improved, it will be welcome.

Regards,
Raul.
-- 
View this message in context: 
http://tapestry-users.832.n2.nabble.com/Akismet-API-compatible-Tapestry-5-Module-tp6062121p6062121.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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



Re: No context for a t:select?

2011-02-24 Thread Thiago H. de Paula Figueiredo
On Thu, 24 Feb 2011 18:19:39 -0300, Andreas Andreou andy...@di.uoa.gr  
wrote:



That's exactly why i asked the question about implementation
mixins in the dev list ( http://markmail.org/thread/ft755d4vbkfaip4v )


Cool!


And there's no reason to restict it to onchange events - anyway, i'll
open some related jira issues tonight...


Agreed.

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

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

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



[5.1] recordError for Forms in Blocks

2011-02-24 Thread Rich M

Hi,

I'm having a hard time tracking down my issue at hand here. I have Form 
components defined in a set of Block components in a Page class. The 
entire set of Blocks is nested within a Zone that allows for navigation 
between the Blocks without a page refresh.


Each form has supporting onValidateXXX(Object xxx) methods for most of 
the fields. When I submit a given form within one of the related fields 
in error, my debugging statements reveal that the expected 
onValidateXXX(Object xxx) method(s) are called in the Page class. 
Likewise, the form fails to submit when I use the recordError method of 
the Form components.


However, the Validation Bubbles are failing to display despite being 
designated for the related fields. Maybe I'm overlooking something here.


A simplified code example TML and Page class below.

Thanks,
Rich

TML:

t:zone t:id=blockZone id=blockZone update=show

t:delegate to=selectedBlock /

!-- TRIGGERING PRICING --
t:block t:id=triggerPrice

t:form t:id=tPriceForm t:zone=blockZone
ul class=registerConvoList
li class=fieldHelp${message:discountPercentage-help}/li
li
label ${message:discountPercentage-label} /label
t:textfield t:id=discountPercentage value=prod.discountPercentage 
t:validate=required /

/li
li
br/input type=submit value=${message:trigger-done-label}/
/li
/ul
/t:form

/t:block

/t:zone


Page Class:

@Inject
private Messages messages;

@InjectComponent
private Form tPriceForm;

@Component(id=discountPercentage)
private TextField discountPercentageField;

@Inject
private Block triggerPrice;

@Persist
private Block selectedBlock;

@InjectComponent
private Zone blockZone;

void onValidateFromDiscountPercentage(Double percent){
if(percent  0 || percent  100.0){
debug(Attempted to be created with a discount percentage 
of:  + percent);
tPriceForm.recordError(discountPercentageField, 
messages.get(percentage-out-of-bounds));

return;
}
}



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



Select with zone failing intermittently

2011-02-24 Thread Bryan Lewis
I've been trying to figure out a weird bug today, and before I lose the
night over it I thought I'd ask the list.  I'm using the cool new chained
select feature.  One Select has a zone, and triggers an onValueChanged()
method that affects another Select.  It works fine on my machine and when
most users try it.  When the first selection changes the server gets the
method call and the zone updates, no problem.

We have a few users in a remote office who access the application through a
slightly slow connection to a Citrix server.  That is, the browser is
actually running here (in the same network as the app server) and the user
receives only screen updates.  Occasionally these users will see that the
chained selects don't work at all.  I've debugged it a little (kinda
difficult since I can't make it happen locally) and the first Select's
method call doesn't happen.  I don't think it's only a case of slowness -- I
waited about ten seconds.

Does this ring any bells?  I can't see how the Citrix factor or the
connection speed would have any effect.  The app server and browser are in
the same network.  Other requests are working fine; the app has been running
almost a year.  I have a periodic-update ajax request that successfully
makes it to the server for the same user.

So maybe I'm using the new feature incorrectly.

.tml:

t:zone t:id=recipientZone update=show
  br/
  t:label for=carrierSelectRecipients/t:label
  table style=margin-left:124px;
tr
  td
t:select t:id=carrierSelect
  model=carrierModel
  value=selectedCarrier
  blankLabel=literal:Select a carrier first
  zone=recipientZone
  style=width:180px;/
  /td
  td
  t:select t:id=recipientSelect
model=recipientModel
value=selectedRecipient
style=width:360px;/
  /td
/tr
  /table
/t:zone


.java:

private final SelectModel carrierModel = new AbstractSelectModel()
{
// Omitting null-returning getOptionGroups() for simplicity

public ListOptionModel getOptions()
{
ListCompany carriers = getModel().getCarriers();  // sorted by
name
ListOptionModel options =
CollFactory.newList(carriers.size());
for (Company carrier : carriers) {
options.add(new
OptionModelImpl(carrier.getCarrierShortName(), carrier));
}
return options;
}
};
public SelectModel getCarrierModel()
{
return carrierModel;
}

public Object onValueChangedFromCarrierSelect(Company carrier)
{
debug(-- onValueChangedFromCarrierSelect  +
carrier.getCarrierShortName());
selectedCarrier = carrier;
return recipientZone.getBody();
}


To be clear:  In the real app, the recipientSelect also has a zone parameter
to update a third list.  I omitted it here because the bug happens before
that.

The only thing I can see that I'm doing different from the documented
example is, my selects are in the same zone.  I'll try splitting them up and
using a MultiZoneUpdate or some such.

Thanks for any ideas.


Re: Hello,Can anyone tell how to use servlet session Listener with tapestry IoC services ?

2011-02-24 Thread jqzone
Thank for your replies.
Finally ,I found TapestryFilter has put registry into servlet context,so I
do it like this,
MyHttpSessionListoner.java

   @Override
public void sessionDestroyed(HttpSessionEvent se) {
//Get Tapestry IoC Registry
Registry registry = (Registry)
se.getSession().getServletContext().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);
ISocialPartyOnlineService socialPartyOnlineService =
registry.getService(ISocialPartyOnlineService.class);
  //Do my session sessionDestroyed logic
}



2011/2/23 Kristian Marinkovic kristian.marinko...@porscheinformatik.at

 hi thiage,

 you're right HttpSessionActivationListener is another possibility :)

 i dont recreate the registry in my HttpSessionListener, i just reuse the
 one created by my tapestry listener

 My TapestryListener snippet (could be a filter):

 public class TapestryListener implements ServletContextListener
 {
public static final String REGISTRY_CONTEXT_NAME =
 org.apache.tapestry5.application-registry;

public void contextInitialized(ServletContextEvent sce)
{

  // same code as in TapestryFilter

registry = appInitializer.createRegistry();

  // set registry in context
context.setAttribute(REGISTRY_CONTEXT_NAME, registry);
...
  // same code as in TapestryFilter
}
 }

 My HttpSessionListener:

 public final class MyHttpSessionListener implements HttpSessionListener
 {
...
public void sessionDestroyed(HttpSessionEvent event)
{
HttpSession httpSession = event.getSession();
...
Registry registry = (Registry)
 httpSession.getServletContext().getAttribute(TapestryListener.
 REGISTRY_CONTEXT_NAME);

if(registry == null)
throw new RuntimeException(No Tapestry registry
 found. Please check that TapestryListener or -Filter is added as
 listener);

... //do something
}
 }

 g,
 kris



 Von:Thiago H. de Paula Figueiredo thiag...@gmail.com
 An: Tapestry users users@tapestry.apache.org, Kristian
 Marinkovic kristian.marinko...@porscheinformatik.at
 Datum:  23.02.2011 12:15
 Betreff:Re: Hello,Can anyone tell how to use servlet session
 Listener with tapestry IoC services ?



 On Wed, 23 Feb 2011 06:18:24 -0300, Kristian Marinkovic
 kristian.marinko...@porscheinformatik.at wrote:

  we've written an own listener (you can create a filter as well) that
  starts tapestry. this listener saves the registry in the servlet context
  so another serlvet listener can then access it. we use it in a
  HttpSessionListener to clear lock if the user session expires.

 My approach was to use a RequestFilter to put in the session an object
 that implements HttpSessionActivationListener. It will be notified when
 the session is created and when its destroyed. No need to create the
 Registry manually. :)

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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





Re: T5: onActivate called before onSuccessFrom

2011-02-24 Thread jqzone
I met this problem before , I change the onActivatereturn type to void .

2011/2/17 Alessandro Badin jave...@gmail.com


 Hello guys,

 What about I have something like this:

Object onActivate() {
condition = service.findSomething();
return (condition == null) ? OtherPage.class : null;
}

 Thanks.
 Alessandro Badin
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-onActivate-called-before-onSuccessFrom-tp2430026p3389328.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

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




Live class/template reloading with netbeans 6.9.1

2011-02-24 Thread Josh Kamau
Hi there,

Am looking for the best way to enable live class/template reloading when
using netbeans 6.9.1.  Any help will be appreciated.

Josh.