Re: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Muhammad Gelbana
Also what if I need to should down services in a specific order ? To shut
down the dependents before the dependencies.

On Thu, Oct 6, 2011 at 1:59 AM, Muhammad Gelbana wrote:

> I don't know but I think I wasn't clear enough !
>
> Here is what I'm trying to do. I have a service that implements "*
> RegistryShutdownListener*" which has a method called "*registryDidShutdown
> *" within which I should have my clean-up logic.
>
> But to register this service as a "*RegistryShutdownListener*", I should
> invoke the "*addRegistryShutdownListener" *method on a "*
> RegistryShutdownHub*" instance. I do that by injecting the "*
> RegistryShutdownHub*" service in the *AppModule*, and  invoking the
> mentioned method in a *@Startup* annotated method in my *AppModule* class,
> and of course *@Inject*ing "*RegistryShutdownHub*".
>
> Will it differe if I do this in a *@Startup* annotated method in the *
> AppModule* or in a *@PostInjection* annotated method in my service itself
> ?
> >> Or should *each* injected service that required a clean-up, implement
> the "*RegistryShutdownListener*" interface and invoke it's own clean-up
> code ?
>
> I'm currently using a @Startup annotated method and the clean-up code is
> executed when tomcat starts to shutdown, it's just that when I try to
> reference my services to instruct them to shutdown, I get exceptions because
> the registry is already shutdown ! Shouldn't my service's implemented "*
> RegistryShutdownListener*.*registryDidShutdown*" method be called *before*the 
> registry starts to shutdown ? So that I can refer to services I need to
> shutdown ?!
>
> Here is some code to demonstrate what I'm currenlty doing:
> *
> *
> *AppModule.java*
> @Inject
> private IpkDestroyer ipk;
>
> @Inject
> private RegistryShutdownHub rsh;
>
> @Startup
> public void init(){
>   Runnable r = new Runnable() {
> public void run() {
> ipk.registerRegistryShutdownListener(rsh);
> }
>   };
>   Thread t = new Thread(r, "SkyContextListener-Initializing-Thread");
>   t.start();
>   try {
>   t.join();
>   } catch (InterruptedException e) {
>   e.printStackTrace();
>   }
> }
> *
> *
> *IpkDestroyerImpl.java*
> public class IpkDestroyerImpl implements RegistryShutdownListener,
> IpkDestroyer {
> public void registryDidShutdown() {
> Runnable r = new Runnable() {
> public void run() {
> //clean up code referring to tapestry injected
> services. This is when an exception is thrown reporting that tapestry's
> registry is already closed.
> }
> public void *registerRegistryShutdownListener*(RegistryShutdownHub
> shutdownHub) {
> log.info("Service registered as a registry shutdown listener.");
> shutdownHub.addRegistryShutdownListener(*this*);
> }
> }
>
> *I use threads because each thread will spawn multiple threads and wait
> for them to finish. I do that to speed up the process. Then I wait for the
> main threads before I return from the current method.*
>
> Isn't this the right way and as explained in the page mentioned in my first
> message ?
> @Thiago, Would you please be more specific about what I need to read to do
> what I need ? The IoC documentation is huge and time isn't on my side.
> @Howard, I have no problem depending on tapestry but I need my core
> services to be independent as much as possible. If there is no other way at
> the moment then no problem, I have to find out if I have other options or
> not.
>
> Thank you all for your time and help.
>
>
> On Thu, Oct 6, 2011 at 1:08 AM, Howard Lewis Ship wrote:
>
>> There's more than one way to do these things.
>>
>> A service builder method (see the docs) is fully responsible for
>> instantiating a service.  Tapestry treats this method as a black box.
>> Inside the method, your code can instantiate a class, provided
>> dependencies, and do other initializations, such as registering the
>> new instance as a listener.
>>
>> However, most people don't want to have to write a main class and a
>> builder method; that's why you can bind the service, and let Tapestry
>> instantiate it, set dependencies, and invoke @PostInjection methods to
>> do secondary initializations, such as this listener business.
>>
>> Don't like the annotations?  Don't use them ... but you'll write more
>> code, since you've deprived Tapestry IoC of the hints it need to
>> instantiate your service for you.
>>
>> On Wed, Oct 5, 2011 at 2:47 PM, Thiago H. de Paula Figueiredo
>>  wrote:
>> > On Wed, 05 Oct 2011 17:23:44 -0300, Muhammad Gelbana <
>> m.gelb...@gmail.com>
>> > wrote:
>> >
>> >> I've done everything as directed in the page but the annotation
>> >> *@PostInjection *didn't work so I had to invoke the method "public void
>> >> startupService(RegistryShutdownHub shutdownHub)" manually at a static
>> >> method annotated with @Startup in my "AppModule" class.
>> >
>> > You mixed two things th

Re: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Muhammad Gelbana
I don't know but I think I wasn't clear enough !

Here is what I'm trying to do. I have a service that implements "*
RegistryShutdownListener*" which has a method called "*registryDidShutdown*"
within which I should have my clean-up logic.

But to register this service as a "*RegistryShutdownListener*", I should
invoke the "*addRegistryShutdownListener" *method on a "*RegistryShutdownHub
*" instance. I do that by injecting the "*RegistryShutdownHub*" service in
the *AppModule*, and  invoking the mentioned method in a
*@Startup*annotated method in my
*AppModule* class, and of course *@Inject*ing "*RegistryShutdownHub*".

Will it differe if I do this in a *@Startup* annotated method in the *
AppModule* or in a *@PostInjection* annotated method in my service itself ?
>> Or should *each* injected service that required a clean-up, implement the
"*RegistryShutdownListener*" interface and invoke it's own clean-up code ?

I'm currently using a @Startup annotated method and the clean-up code is
executed when tomcat starts to shutdown, it's just that when I try to
reference my services to instruct them to shutdown, I get exceptions because
the registry is already shutdown ! Shouldn't my service's implemented "*
RegistryShutdownListener*.*registryDidShutdown*" method be called
*before*the registry starts to shutdown ? So that I can refer to
services I need to
shutdown ?!

Here is some code to demonstrate what I'm currenlty doing:
*
*
*AppModule.java*
@Inject
private IpkDestroyer ipk;

@Inject
private RegistryShutdownHub rsh;

@Startup
public void init(){
  Runnable r = new Runnable() {
public void run() {
ipk.registerRegistryShutdownListener(rsh);
}
  };
  Thread t = new Thread(r, "SkyContextListener-Initializing-Thread");
  t.start();
  try {
  t.join();
  } catch (InterruptedException e) {
  e.printStackTrace();
  }
}
*
*
*IpkDestroyerImpl.java*
public class IpkDestroyerImpl implements RegistryShutdownListener,
IpkDestroyer {
public void registryDidShutdown() {
Runnable r = new Runnable() {
public void run() {
//clean up code referring to tapestry injected services.
This is when an exception is thrown reporting that tapestry's registry is
already closed.
}
public void *registerRegistryShutdownListener*(RegistryShutdownHub
shutdownHub) {
log.info("Service registered as a registry shutdown listener.");
shutdownHub.addRegistryShutdownListener(*this*);
}
}

*I use threads because each thread will spawn multiple threads and wait for
them to finish. I do that to speed up the process. Then I wait for the main
threads before I return from the current method.*

Isn't this the right way and as explained in the page mentioned in my first
message ?
@Thiago, Would you please be more specific about what I need to read to do
what I need ? The IoC documentation is huge and time isn't on my side.
@Howard, I have no problem depending on tapestry but I need my core services
to be independent as much as possible. If there is no other way at the
moment then no problem, I have to find out if I have other options or not.

Thank you all for your time and help.

On Thu, Oct 6, 2011 at 1:08 AM, Howard Lewis Ship  wrote:

> There's more than one way to do these things.
>
> A service builder method (see the docs) is fully responsible for
> instantiating a service.  Tapestry treats this method as a black box.
> Inside the method, your code can instantiate a class, provided
> dependencies, and do other initializations, such as registering the
> new instance as a listener.
>
> However, most people don't want to have to write a main class and a
> builder method; that's why you can bind the service, and let Tapestry
> instantiate it, set dependencies, and invoke @PostInjection methods to
> do secondary initializations, such as this listener business.
>
> Don't like the annotations?  Don't use them ... but you'll write more
> code, since you've deprived Tapestry IoC of the hints it need to
> instantiate your service for you.
>
> On Wed, Oct 5, 2011 at 2:47 PM, Thiago H. de Paula Figueiredo
>  wrote:
> > On Wed, 05 Oct 2011 17:23:44 -0300, Muhammad Gelbana <
> m.gelb...@gmail.com>
> > wrote:
> >
> >> I've done everything as directed in the page but the annotation
> >> *@PostInjection *didn't work so I had to invoke the method "public void
> >> startupService(RegistryShutdownHub shutdownHub)" manually at a static
> >> method annotated with @Startup in my "AppModule" class.
> >
> > You mixed two things that are different. You need this method to your
> > AppModule to contribute something to be run at startup:
> >
> > public static void
> contributeRegistryStartup(OrderedConfiguration)
> > {
> >...
> > }
> >
> > Please read the Tapestry-IoC documentation to understand what this method
> > does.
> >
> > For shutdown, inject RegistryShutdownHub and add RegistryShutdownL

Re: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Howard Lewis Ship
There's more than one way to do these things.

A service builder method (see the docs) is fully responsible for
instantiating a service.  Tapestry treats this method as a black box.
Inside the method, your code can instantiate a class, provided
dependencies, and do other initializations, such as registering the
new instance as a listener.

However, most people don't want to have to write a main class and a
builder method; that's why you can bind the service, and let Tapestry
instantiate it, set dependencies, and invoke @PostInjection methods to
do secondary initializations, such as this listener business.

Don't like the annotations?  Don't use them ... but you'll write more
code, since you've deprived Tapestry IoC of the hints it need to
instantiate your service for you.

On Wed, Oct 5, 2011 at 2:47 PM, Thiago H. de Paula Figueiredo
 wrote:
> On Wed, 05 Oct 2011 17:23:44 -0300, Muhammad Gelbana 
> wrote:
>
>> I've done everything as directed in the page but the annotation
>> *@PostInjection *didn't work so I had to invoke the method "public void
>> startupService(RegistryShutdownHub shutdownHub)" manually at a static
>> method annotated with @Startup in my "AppModule" class.
>
> You mixed two things that are different. You need this method to your
> AppModule to contribute something to be run at startup:
>
> public static void contributeRegistryStartup(OrderedConfiguration)
> {
>        ...
> }
>
> Please read the Tapestry-IoC documentation to understand what this method
> does.
>
> For shutdown, inject RegistryShutdownHub and add RegistryShutdownLister to
> 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
>
>



-- 
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: Question about ComponentClassTransformWorker2 order and events

2011-10-05 Thread Howard Lewis Ship
The event handlers can get confusing ... often the order in which the
workers are executed is the inverse of the order in which the added
method advice executes.

On Wed, Oct 5, 2011 at 2:48 PM, Thiago H. de Paula Figueiredo
 wrote:
> On Wed, 05 Oct 2011 18:21:30 -0300, Books Barry  wrote:
>
>> That seems like what's going on. I looked at the TapestryModule file and
>> decided
>>
>> configuration.add("NVLWorker", new NVLWorker(nvlService),"after:onEvent");
>
> Nice to know. :)
>
>> is the correct configuration. The thing I still don't understand is why
>> onActivate and onSuccess were not called since I only added a PREPARE event.
>
> Good question . . . I wish I had to investigate that because this seems to
> be a very interesting question. :)
>
> --
> 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
>
>



-- 
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: Compiled CSS

2011-10-05 Thread Howard Lewis Ship
No progress yet ... it was more important to get 5.3 out than to add
this feature.  I expect to add it in Tapestry 5.4.

On Wed, Oct 5, 2011 at 2:55 PM, Toby O'Rourke
 wrote:
> On 5 Oct 2011, at 14:55, "Jérôme BERNARD"  wrote:
>
>> On Wed, Oct 5, 2011 at 15:33, Toby O'Rourke 
>> wrote:
>>
>>> Hi,
>>>
>>> Some time ago there was talk of introducing support for WRO4J, SASS or
>>> LessCSS
>>>
>>>
>>> http://tapestry.1045711.n5.nabble.com/Alternate-template-format-td4639774.html#a4641048
>>>
>>> Has there been any progress on that yet? It is something that we've started
>>> discussing at work, perhaps we could discuss the implementation here, before
>>> submitting what we do as a patch if it is not currently being developed?
>>
>>
>> Not sure if it helps, but I've released a Maven plugin recently which can
>> compile LESS files into CSS :
>> http://kalixia.github.com/maven-less-compiler-plugin/
>
> Cool, I'll take a look. Thanks.
>
>>
>> I'm using it in order to compile my extended version of Twitter's Bootstrap
>> CSS framework.
>>
>> I was thinking about a way to have Tapestry to compile the LESS files at
>> runtime and cache the results.
>> Changes to LESS files would mean recompilation, of course.
>> I haven't started to work on such a thing though.
>
> That is exactly what I was thinking. Was hoping for some thoughts from the 
> tapestry committers about a solution that would be in line with the direction 
> the product is taking... Don't want to have to replace whatever we do at some 
> later stage!
>
>>
>>
>> Jérôme
>
> Cheers,
>
> Toby
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
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: SessionState problem

2011-10-05 Thread leothelion
"If you did private SalesItem salesItem = new SalesItem()"
You got me!!!:-P
Thank you very much.

On 10/5/2011 3:12 PM, Thiago H de Paula Figueiredo [via Tapestry] wrote:
> On Wed, 05 Oct 2011 19:00:05 -0300, okramlee <[hidden email] 
> > wrote:
>
> > Hi Thiago,
>
> Hi!
>
> > " If a field isn't @SessionState, it is completely thread-safe, not
> > being shared between users."
> > Yeah, that was what I thought about. But it did share the object 
> between
> > users even though I remove everything and keep salesItem plain there. I
> > think I did something wrong in my code.
>
> If you did private SalesItem salesItem = new SalesItem(), which is a
> common newbie error, that is expected. Never, never, never initialize a
> page or component field in its initialization.
>
> -- 
> 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: [hidden email] 
> 
> For additional commands, e-mail: [hidden email] 
> 
>
>
>
> 
> If you reply to this email, your message will be added to the 
> discussion below:
> http://tapestry.1045711.n5.nabble.com/SessionState-problem-tp4873622p4874465.html
>  
>
> To unsubscribe from SessionState problem, click here 
> .
>  
>



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

Re: SessionState problem

2011-10-05 Thread Thiago H. de Paula Figueiredo

On Wed, 05 Oct 2011 19:00:05 -0300, okramlee  wrote:


Hi Thiago,


Hi!

" If a field isn't @SessionState, it is completely thread-safe, not  
being shared between users."
Yeah, that was what I thought about. But it did share the object between  
users even though I remove everything and keep salesItem plain there. I  
think I did something wrong in my code.


If you did private SalesItem salesItem = new SalesItem(), which is a  
common newbie error, that is expected. Never, never, never initialize a  
page or component field in its initialization.


--
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: Compiled CSS

2011-10-05 Thread Toby O'Rourke
On 5 Oct 2011, at 14:55, "Jérôme BERNARD"  wrote:

> On Wed, Oct 5, 2011 at 15:33, Toby O'Rourke wrote:
> 
>> Hi,
>> 
>> Some time ago there was talk of introducing support for WRO4J, SASS or
>> LessCSS
>> 
>> 
>> http://tapestry.1045711.n5.nabble.com/Alternate-template-format-td4639774.html#a4641048
>> 
>> Has there been any progress on that yet? It is something that we've started
>> discussing at work, perhaps we could discuss the implementation here, before
>> submitting what we do as a patch if it is not currently being developed?
> 
> 
> Not sure if it helps, but I've released a Maven plugin recently which can
> compile LESS files into CSS :
> http://kalixia.github.com/maven-less-compiler-plugin/

Cool, I'll take a look. Thanks. 

> 
> I'm using it in order to compile my extended version of Twitter's Bootstrap
> CSS framework.
> 
> I was thinking about a way to have Tapestry to compile the LESS files at
> runtime and cache the results.
> Changes to LESS files would mean recompilation, of course.
> I haven't started to work on such a thing though.

That is exactly what I was thinking. Was hoping for some thoughts from the 
tapestry committers about a solution that would be in line with the direction 
the product is taking... Don't want to have to replace whatever we do at some 
later stage!

> 
> 
> Jérôme

Cheers, 

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



Re: Question about ComponentClassTransformWorker2 order and events

2011-10-05 Thread Thiago H. de Paula Figueiredo

On Wed, 05 Oct 2011 18:21:30 -0300, Books Barry  wrote:

That seems like what's going on. I looked at the TapestryModule file and  
decided


configuration.add("NVLWorker", new  
NVLWorker(nvlService),"after:onEvent");


Nice to know. :)

is the correct configuration. The thing I still don't understand is why  
onActivate and onSuccess were not called since I only added a PREPARE  
event.


Good question . . . I wish I had to investigate that because this seems to  
be a very interesting question. :)


--
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: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Thiago H. de Paula Figueiredo
On Wed, 05 Oct 2011 17:23:44 -0300, Muhammad Gelbana   
wrote:


I've done everything as directed in the page but the annotation  
*@PostInjection *didn't work so I had to invoke the method "public void
startupService(RegistryShutdownHub shutdownHub)" manually at a static  
method annotated with @Startup in my "AppModule" class.


You mixed two things that are different. You need this method to your  
AppModule to contribute something to be run at startup:


public static void  
contributeRegistryStartup(OrderedConfiguration) {

...
}

Please read the Tapestry-IoC documentation to understand what this method  
does.


For shutdown, inject RegistryShutdownHub and add RegistryShutdownLister to  
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



At JavaOne?

2011-10-05 Thread Howard Lewis Ship
I'm here until friday. Tweet me for a meeting, or come to my 4:30 session in
PARC 55 Embarcadero.


Re: SessionState problem

2011-10-05 Thread Lenny Primak
Tapestry objects's instance variables will never leak from user to user..
You have to try pretty hard to make that work.
Whether its' @Persist, @SessionState, @SessinoAttribute,
or just plain field, it will never leak.


On Oct 5, 2011, at 5:22 PM, leothelion wrote:

> Hi Thiago,
> 
> Thanks for your reply. I will try it. 
> 
> Just a question out of this topic. I use salesItem as SessionState is
> because I don't what it to be shared by the other users when they are
> loading the same page. That's why I came up with the idea of SessionState. I
> don't know if there another way (or easier way) other than setting salesItem
> to be SessionState.
> 
> Thanks again!
> 
> Leo
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/SessionState-problem-tp4873622p4874282.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
> 


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



Re: SessionState problem

2011-10-05 Thread leothelion
Hi Thiago,

Thanks for your reply. I will try it. 

Just a question out of this topic. I use salesItem as SessionState is
because I don't what it to be shared by the other users when they are
loading the same page. That's why I came up with the idea of SessionState. I
don't know if there another way (or easier way) other than setting salesItem
to be SessionState.

Thanks again!

Leo

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

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



Re: SessionState problem

2011-10-05 Thread Thiago H. de Paula Figueiredo
On Wed, 05 Oct 2011 17:56:44 -0300, leothelion   
wrote:


If I erase the ' row="salesItem" ', then the adding problem is gone. But  
I cannot use a SessionState instance as a row in grid component?


Yeah, but it's not a good idea, as you're using the same field for two  
very different things (using as a loop variable in a Grid and storing a  
value in the session) You end up setting the last object in the grid to  
the SSO, and I don't think that's what you want.



If not, what is the alternative way to do so?
Anyone got any idea?


Just create another field to use as grid loop variable (row parameter). ;)

--
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: textchanged like clientEvent

2011-10-05 Thread leothelion
Thank you for your response. "keyup" doesn't work because I have a
autocomplete pop up list of partrial matches. What I want to do is to
trigger the event by both the keyboard and mouse action. That's why I want
to get a valueChanged client event. It seems I need to something to the
autoCompleter.js. I am still not quite sure in this issue. 

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/textchanged-like-clientEvent-tp4808658p4874218.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: SessionState problem

2011-10-05 Thread leothelion
I think I found where causes the problem.

Here is the tml file:



${salesItem.sku}

...
...


If I erase the ' row="salesItem" ', then the adding problem is gone. But I
cannot use a SessionState instance as a row in grid component? If not, what
is the alternative way to do so?
Anyone got any idea?

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

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



Re: beanedit form issues (the FAQ seems to be incorrect)

2011-10-05 Thread George Ludwig
Josh,

I'm on Tapestry 5.2.6

I just tried to recreate this issue, and was unable, so it must have
been me (working too late some nights).

However, the onPrepareFromMyBeanEditor() method is still called twice,
which seems inefficient. onActivate() is only called once, so I'm
going to leave the bean instantiation code there, at least for now.

-George

On Tue, Oct 4, 2011 at 4:01 PM, Josh Canfield  wrote:
> "This occurs when the BeanEditForm's object parameter is bound to null"
>
> Looking at the code, it seems that it only calls the constructor if
> your "object" parameter is null.
>
> Can you provide some of the actual template/project code or a small
> example project that reproduces the problem?
>
> Also, I may have overlooked it, but what version of tapestry are you using?
>
> Josh
>
> On Mon, Oct 3, 2011 at 7:21 PM, George Ludwig  wrote:
>> I've got a bean that reads/writes to the file system. To do that, it's
>> constructor takes a param for the file path. Very straightforward, however
>> using this bean has been problematic. I got the "no service implements the
>> interface String" exception when constructing the bean, which led me to the
>> FAQ here: http://tapestry.apache.org/beaneditform-faq.html However, things
>> do not work as advertised in the FAQ.
>>
>> No matter what I do, Tapestry requires that the bean have a no argument
>> constructor, and that I annotate that constructor with @Inject. And in the
>> debugger I see that the parameterized constructor is called twice
>> from onPrepareFromMyBeanEditor(), after which the no-param constructor is
>> called.
>>
>> At the time the page renders, my bean lacks a filepath, I assume because the
>> last time the constructor was called, it had no parameters.
>>
>> Summary:
>> Bean constructors are called multiple times, twice with params and once
>> without, always resulting in a bean that has been created with no
>> parameters.
>>
>> What can I do here? I've included hacked version of the FAQ code with notes.
>>
>> Best,
>>
>> George
>>
>> public class MyBean {
>>  @Inject           <-- without this annotation
>> on the no-param constructor, Tapestry always throws a "no service ..."
>> exception
>>  public MyBean() { ... }
>>  public MyBean(String filePath) { ... }
>> }
>>
>> public class MyPage {
>>  @Property
>>  public MyBean myBean;  <--- the example code declares this as
>> public, but Tapestry throws an exception, insisting it be made private...is
>> this possibly related to the problem I'm seeing?
>>  void onPrepareFromMyBeanEditor() {
>>   myBean = new MyBean(getFilePath()); <--- I need a param
>> to point to the file, but can't seem to hang on to the bean that is
>> instantiated here
>>  }
>> }
>>
>
> -
> 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: beanedit form issues (the FAQ seems to be incorrect)

2011-10-05 Thread George Ludwig
Muhammad,

Thanks for the reply! I did clean an rebuild the project. Also, I used
the event handler onPrepareFromMyBeanEditor() method, and as I wrote
in my original post, my bean is instantiated twice with parameters,
and is finally instantiated one more time without parameters.

No matter what I did using the approaches described in the FAQ,
Tapestry forced a no-param constructor.

Another list member wrote to me off-list and suggested I simply
instantiate the bean in the onActivate() method. I did that, and now
everything works: the constructor is called exactly once with the
proper parameters.

Which leaves me still wondering what exactly is going on with the
examples in the FAQ!

-George


On Tue, Oct 4, 2011 at 2:38 PM, Muhammad Gelbana  wrote:
> 2 Suggestions:
>
> 1. Have you tried cleaning your project and re-building it ? Restarting the
> server on which you are developing ?
> 2. Why don't you construct the bean yourself ? Add an event handler method
> to handle the "PREPARE" event of form embracing your bean editor.
>
> On Tue, Oct 4, 2011 at 4:21 AM, George Ludwig wrote:
>
>> I've got a bean that reads/writes to the file system. To do that, it's
>> constructor takes a param for the file path. Very straightforward, however
>> using this bean has been problematic. I got the "no service implements the
>> interface String" exception when constructing the bean, which led me to the
>> FAQ here: http://tapestry.apache.org/beaneditform-faq.html However, things
>> do not work as advertised in the FAQ.
>>
>> No matter what I do, Tapestry requires that the bean have a no argument
>> constructor, and that I annotate that constructor with @Inject. And in the
>> debugger I see that the parameterized constructor is called twice
>> from onPrepareFromMyBeanEditor(), after which the no-param constructor is
>> called.
>>
>> At the time the page renders, my bean lacks a filepath, I assume because
>> the
>> last time the constructor was called, it had no parameters.
>>
>> Summary:
>> Bean constructors are called multiple times, twice with params and once
>> without, always resulting in a bean that has been created with no
>> parameters.
>>
>> What can I do here? I've included hacked version of the FAQ code with
>> notes.
>>
>> Best,
>>
>> George
>>
>> public class MyBean {
>>  @Inject           <-- without this annotation
>> on the no-param constructor, Tapestry always throws a "no service ..."
>> exception
>>  public MyBean() { ... }
>>  public MyBean(String filePath) { ... }
>> }
>>
>> public class MyPage {
>>  @Property
>>  public MyBean myBean;  <--- the example code declares this as
>> public, but Tapestry throws an exception, insisting it be made private...is
>> this possibly related to the problem I'm seeing?
>>  void onPrepareFromMyBeanEditor() {
>>   myBean = new MyBean(getFilePath()); <--- I need a param
>> to point to the file, but can't seem to hang on to the bean that is
>> instantiated here
>>  }
>> }
>>
>
>
>
> --
> *Regards,*
> *Muhammad Gelbana
> Java Developer*
>

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



Re: Select Model - Adding entries from the form

2011-10-05 Thread Muhammad Gelbana
What should fire the "onValueChanged" event you are talking about ?

Anyway here is what I think:
- You'll need to persist your list of items fed by the "onPrepare" method.
- When the form containing the text-field is submitted, obtain the new
value, do your logic and decide whether to add the new item to the persisted
list or not.
- Then "onPrepare" should do the trick on the next page load.

Did I get your question right ?

On Wed, Oct 5, 2011 at 4:22 PM, sibleygh  wrote:

> Hi
>
> I'm pretty new to Tapestry.
>
> I have a requirement where I want to add a new entry to a Select Model, if
> the entry doesn't exist. e.g.
>
> - Populate the select model using the onPrepare() method executing a finder
> in hibernate, and present this in the page.
> - Allow the user to provide text in the drop down text box, if a new entry
> is required in the model.
> - Persist the new data using a form of Tapestry 'onValueChangedFrom'
> action.
>
> I've used the select model successfully to process 'bound' lists, but I
> don't seem to see any examples or documentation on how to process an
> 'unbound' list.
>
> Regards
>
> George
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Select-Model-Adding-entries-from-the-form-tp4872879p4872879.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
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*


Question about ComponentClassTransformWorker2 order and events

2011-10-05 Thread Barry Books
I wrote a pretty simple transform worker and when I changed its name
all my events quit working.

After a bit of debugging I tried adding after:* to the configuration
and they work again

configuration.add("NVLWorker", new NVLWorker(nvlService),"after:*");

If I change to

configuration.add("NVLWorker", new NVLWorker(nvlService),"before:*");

They stop.

The worker does mess with events but I'm not sure what I'm doing that
would stop all events


public class NVLWorker implements ComponentClassTransformWorker2 {

private NVLService nvlService;
private final String id = NVLWorker.class.getName();


public NVLWorker(NVLService nvlService) {
this.nvlService = nvlService;
}

public void transform(PlasticClass plasticClass, TransformationSupport 
support,
MutableComponentModel model) {

List fields = 
plasticClass.getFieldsWithAnnotation(NVL.class);
for ( PlasticField field : fields ) {
if ( nvlService.isImplemented(field.getTypeName()))  {

support.addEventHandler(EventConstants.PREPARE,0,"Init if null",

createPrepareHandler(field.getTypeName(), field.getHandle()));
}
}

}


private ComponentEventHandler createPrepareHandler(final String
typeName, final FieldHandle handle) {
return new ComponentEventHandler() {
public void handleEvent(Component component, 
ComponentEvent event) {
if ( handle.get(component) == null ) {
handle.set(component, 
nvlService.newInstance(typeName));
}
}
};
}

}


The page contains

@PageActivationContext
@Property
@NVL
private IPerson person;

void onActivate() {
if ( person == null ) {
logger.info("person is null");
}
}

void onSuccess() {
logger.info("age {}" , person.getAge());
}

with after:* both onActivate and onSuccess are called. With before:*
neither is called. I'm OK with added after:* but I don't really
understand why that fixes it. Any help would be appreciated. FYI I'm
running 5.3-beta-13


Thanks
Barry

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



Re: Page .tml location

2011-10-05 Thread Lenny Primak
those can go eitiher in the classpath or webapp, your choice,
you can retrieve them with classpath: or context: binding prefixes from your 
app.

On Oct 5, 2011, at 3:51 PM, Tim wrote:

> Thanks Lenny and Thiago.  My Eclipse wasn't copying everything from my 
> resources to my target.  But it works now.  Thank you very much.
> 
> What about other files like .js files or image files?  Can they be put into 
> my jar file?
> 
> --
> Tim Koop
> 


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



Re: Page .tml location

2011-10-05 Thread Tim
Thanks Lenny and Thiago.  My Eclipse wasn't copying everything from my 
resources to my target.  But it works now.  Thank you very much.


What about other files like .js files or image files?  Can they be put 
into my jar file?


--
Tim Koop


On 05/10/2011 1:28 PM, Lenny Primak wrote:

The tml files should be right along your .class files that are compiled from 
your page Java classes.

for example,
(contents of jar file)
classes/com/myapp/tappackage/pages/Mypage.class
classes/com/myapp/tappackage/pages/Mypage.tml

On Oct 5, 2011, at 2:25 PM, Tim wrote:


So the page .tml files can actually be anywhere in the classpath?  So I can 
just put them into any jar file?

Would the home page (Index.tml) reside in the root level of the class path 
(/Index.tml) or should it be in a subfolder like /com/app/pages/Index.tml) 
kinda like the components .tml files?

--
Tim Koop


On 05/10/2011 1:18 PM, Lenny Primak wrote:

What you are doing is absolutely correct.  Make sure that your war file is 
packaged as expected. That seems to be recurring problem that the tml files 
aren't deployed in your war file correctly.



On Oct 5, 2011, at 2:14 PM, Tim   wrote:


According to http://tapestry.apache.org/project-layout.html, the page template 
files (.tml) /may /be stored in src/main/webapp.  Does this mean that it's 
possible to put them somewhere else?  I would like to put them into my jar file 
along with my page classes.  Is this possible?

I just tried to put my Index.tml in /src/main/resources, and I tried 
/src/main/resources/com/app/pages/ and it didn't work.

Can somebody please confirm or deny that it's possible to put your .tml page 
files somewhere else?

Thanks.

--
Tim Koop

-
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




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



Re: Page .tml location

2011-10-05 Thread Lenny Primak
The tml files should be right along your .class files that are compiled from 
your page Java classes.

for example,
(contents of jar file)
classes/com/myapp/tappackage/pages/Mypage.class
classes/com/myapp/tappackage/pages/Mypage.tml

On Oct 5, 2011, at 2:25 PM, Tim wrote:

> So the page .tml files can actually be anywhere in the classpath?  So I can 
> just put them into any jar file?
> 
> Would the home page (Index.tml) reside in the root level of the class path 
> (/Index.tml) or should it be in a subfolder like /com/app/pages/Index.tml) 
> kinda like the components .tml files?
> 
> --
> Tim Koop
> 
> 
> On 05/10/2011 1:18 PM, Lenny Primak wrote:
>> What you are doing is absolutely correct.  Make sure that your war file is 
>> packaged as expected. That seems to be recurring problem that the tml files 
>> aren't deployed in your war file correctly.
>> 
>> 
>> 
>> On Oct 5, 2011, at 2:14 PM, Tim  wrote:
>> 
>>> According to http://tapestry.apache.org/project-layout.html, the page 
>>> template files (.tml) /may /be stored in src/main/webapp.  Does this mean 
>>> that it's possible to put them somewhere else?  I would like to put them 
>>> into my jar file along with my page classes.  Is this possible?
>>> 
>>> I just tried to put my Index.tml in /src/main/resources, and I tried 
>>> /src/main/resources/com/app/pages/ and it didn't work.
>>> 
>>> Can somebody please confirm or deny that it's possible to put your .tml 
>>> page files somewhere else?
>>> 
>>> Thanks.
>>> 
>>> --
>>> Tim Koop
>>> 
>>> -
>>> 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: Page .tml location

2011-10-05 Thread Tim
So the page .tml files can actually be anywhere in the classpath?  So I 
can just put them into any jar file?


Would the home page (Index.tml) reside in the root level of the class 
path (/Index.tml) or should it be in a subfolder like 
/com/app/pages/Index.tml) kinda like the components .tml files?


--
Tim Koop


On 05/10/2011 1:18 PM, Lenny Primak wrote:

What you are doing is absolutely correct.  Make sure that your war file is 
packaged as expected. That seems to be recurring problem that the tml files 
aren't deployed in your war file correctly.



On Oct 5, 2011, at 2:14 PM, Tim  wrote:


According to http://tapestry.apache.org/project-layout.html, the page template 
files (.tml) /may /be stored in src/main/webapp.  Does this mean that it's 
possible to put them somewhere else?  I would like to put them into my jar file 
along with my page classes.  Is this possible?

I just tried to put my Index.tml in /src/main/resources, and I tried 
/src/main/resources/com/app/pages/ and it didn't work.

Can somebody please confirm or deny that it's possible to put your .tml page 
files somewhere else?

Thanks.

--
Tim Koop

-
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: Page .tml location

2011-10-05 Thread Lenny Primak
What you are doing is absolutely correct.  Make sure that your war file is 
packaged as expected. That seems to be recurring problem that the tml files 
aren't deployed in your war file correctly. 



On Oct 5, 2011, at 2:14 PM, Tim  wrote:

> According to http://tapestry.apache.org/project-layout.html, the page 
> template files (.tml) /may /be stored in src/main/webapp.  Does this mean 
> that it's possible to put them somewhere else?  I would like to put them into 
> my jar file along with my page classes.  Is this possible?
> 
> I just tried to put my Index.tml in /src/main/resources, and I tried 
> /src/main/resources/com/app/pages/ and it didn't work.
> 
> Can somebody please confirm or deny that it's possible to put your .tml page 
> files somewhere else?
> 
> Thanks.
> 
> --
> Tim Koop
> 
> -
> 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



Page .tml location

2011-10-05 Thread Tim
According to http://tapestry.apache.org/project-layout.html, the page 
template files (.tml) /may /be stored in src/main/webapp.  Does this 
mean that it's possible to put them somewhere else?  I would like to put 
them into my jar file along with my page classes.  Is this possible?


I just tried to put my Index.tml in /src/main/resources, and I tried 
/src/main/resources/com/app/pages/ and it didn't work.


Can somebody please confirm or deny that it's possible to put your .tml 
page files somewhere else?


Thanks.

--
Tim Koop

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



SessionState problem

2011-10-05 Thread leothelion
Hi Guys,

I have a problem in using SessionState.

Here is the thing:
@SessionState
private Sales salesItem;

@SessionState
private SalesSessionInfo ssi;

SalesSessionInfo contains a list of Sales objects. However, every time when
I add the updated salesItem to ssi, it seems that the last element in the
Sales list of ssi is pointed the salesItem.

For example, I add salesItem A to ssi, then I have
[A] 
Add B, I got
[B, B]
Add C, I got
[B, C, C]

This is really weird. If I change salesItem back to like @property, it works
fine in adding, but not work for my purpose. I know SessionState is differed
by class, but in my case should I be OK?

Does anyone knows what I am missing in using SesstionState?

Regards,
Leo

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

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



RE: Block parameter

2011-10-05 Thread Wechsung, Wulf
Hi Thiago,

that's awesome information! Thanks!

Kind Regards,
Wulf

-Original Message-
From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] 
Sent: Mittwoch, 5. Oktober 2011 19:38
To: Tapestry users; Ulrich Stärk
Subject: Re: Block parameter

On Wed, 05 Oct 2011 14:19:31 -0300, Ulrich Stärk  wrote:

> This is obviously much better than fiddling with internal stuff if it
> suffices your needs.

I don't think internal stuff is needed for both of the solutions. A  
RenderCommand (which isn't internal) can be implemented and it receives  
the MarkupWriter (so you can render DOM elements) and the RenderQueue (so  
you can add other RenderCommands to the rendering queue). BlockImpl, the  
implementation of the Block interface, also implements RenderCommand, so  
rendering a block it's just a matter of doing a cast and pushing it into  
the queue. You can also return a RenderCommand in render event handler  
methods and they'll be rendered (i.e. executed).

Maybe few people know, but Tapestry's DOM rendering is completely based on  
RenderCommand. Everything which is rendered in Tapestry is a RenderCommand  
or provides one some way (components and pages, for example, through  
ComponentResources.getBody());. It's almost a hidden gem. :)

-- 
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: Block parameter

2011-10-05 Thread Thiago H. de Paula Figueiredo

On Wed, 05 Oct 2011 14:19:31 -0300, Ulrich Stärk  wrote:


This is obviously much better than fiddling with internal stuff if it
suffices your needs.


I don't think internal stuff is needed for both of the solutions. A  
RenderCommand (which isn't internal) can be implemented and it receives  
the MarkupWriter (so you can render DOM elements) and the RenderQueue (so  
you can add other RenderCommands to the rendering queue). BlockImpl, the  
implementation of the Block interface, also implements RenderCommand, so  
rendering a block it's just a matter of doing a cast and pushing it into  
the queue. You can also return a RenderCommand in render event handler  
methods and they'll be rendered (i.e. executed).


Maybe few people know, but Tapestry's DOM rendering is completely based on  
RenderCommand. Everything which is rendered in Tapestry is a RenderCommand  
or provides one some way (components and pages, for example, through  
ComponentResources.getBody());. It's almost a hidden gem. :)


--
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: Injecting domain object into all pages

2011-10-05 Thread Cezary Biernacki
Hi,
I am still using Tapestry 5.2.6, so I am not sure what changed in Tapestry
5.3. However I believe, that "field.inject(new Site());" line is wrong. It
inserts a constant value to the field. I believe (if online documentation is
still relevant) that you should use field.setConduit() instead, and provide
FieldConduit instance that selects in get() method a correct Site
based on a request.

See

http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/plastic/PlasticField.html#setConduit(org.apache.tapestry5.plastic.FieldConduit)

http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/plastic/FieldConduit.html

However, I would recommend avoiding using such advanced techniques with a
beta version of Tapestry. More mundane approach with normal injection of a
service, that has a single method returning Site would work on all versions
of Tapestry 5 without any headaches.

Best regards,
Cezary


On Wed, Oct 5, 2011 at 7:07 PM, Sonny Gill  wrote:

> Hi guys,
>
> I tried this a few days ago, ran into a few problems, and then tried again
> today.
>
> Unfortunately I could not get this to work.
>
> On changing the method name to contributeSiteInjectionProvider, it was
> detected by Tapestry, and the provider and FieldValueConduit is created,
> but
> the ReadOnlyFieldValueConduit.get() was never called.
>
> Then I upgraded to Tapestry 5.3-beta-16, and it looks
> like ReadOnlyFieldValueConduit has been removed.
>
>
> Finally, I tried to follow
> http://wiki.apache.org/tapestry/JEE-Annotationand added the following
> :-
>
> public class SiteAnnotationWorker implements ComponentClassTransformWorker2
> {
>
>@Override
>public void transform(PlasticClass plasticClass, TransformationSupport
> transformationSupport, MutableComponentModel mutableComponentModel) {
>for (PlasticField field :
> plasticClass.getFieldsWithAnnotation(Inject.class)) {
>if (Site.class.getName().equals(field.getTypeName())) {
>field.inject(new Site());
>field.claim(Inject.class);
>}
>}
>}
>
> }
>
> and in AppModule,
>
>@Contribute(ComponentClassTransformWorker2.class)
>@Primary
>public static void
>
> provideClassTransformWorkers(OrderedConfiguration
> configuration) {
>configuration.addInstance("site", SiteAnnotationWorker.class,
> "before:Property");
>}
>
> With this, the field is injected correctly (great!).
>
> The problem now is that Tapestry continues to keep the injected object
> around and injects the same object for every request.
> This is probably correct for the use case
> for ComponentClassTransformWorker(s), but I need to inject a different
> object on each HTTP request.
>
> How can I achieve that?
>
> Again.. I am very thankful for the help received so far. I would have been
> completely lost without it.
>
>
> Best regards,
> Sonny
>
>
>
>
> On Wed, Sep 28, 2011 at 2:59 PM, Cezary Biernacki  >wrote:
>
> > Hi,
> > I built a website with similar requirements, and it is not hard to do
> that
> > with Tapestry. A simple approach is to built a service that returns
> correct
> > 'Site' instance, and use it everywhere where you need to 'site'.
> >
> > So instead having
> >  private Site site;
> >
> > you would have, e.g.
> >   @Inject
> >   private SiteLookup lookup;
> >
> >
> > and instead using 'site', you would use 'lookup.getSite()'. SiteLookup
> can
> > depend on 'Request' service, so there is no need to pass it as argument
> to
> > getSite() method.
> >
> > But, if you are not afraid of some more advanced machinery, you can
> > contribute your own InjectionProvider, and inject 'Site' directly,
> > something
> > like:
> >
> >
> > public class SiteInjectionProvider implements InjectionProvider {
> >private final Request request;
> >
> >public  SiteInjectionProvider (Request request) {
> >this.request = request;
> >}
> >
> >@Override
> >public boolean provideInjection(String fieldName,
> > @SuppressWarnings("rawtypes") Class fieldType,
> >ObjectLocator locator, ClassTransformation transformation,
> > MutableComponentModel componentModel) {
> >
> >if (!Site.class.equals(fieldType)) {
> >return false;
> >}
> >
> >TransformField field = transformation.getField(fieldName);
> >
> >ComponentValueProvider provider =
> > createProvider(fieldName);
> >
> >field.replaceAccess(provider);
> >
> >return true;
> >}
> >
> >private ComponentValueProvider createProvider(final
> > String fieldName) {
> >
> >return new ComponentValueProvider() {
> >
> >public FieldValueConduit get(final ComponentResources
> resources)
> > {
> >
> >return new ReadOnlyFieldValueConduit(resources, fieldName)
> {
> >public Object get() {
> >return ; // <--- here implement selecting
> > correct Site based on Request
> >}
> >};
> >   

Re: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Josh Canfield
> In my defense, since Josh asked, I have actually tried it - but only in a
> browser (by copying and pasting the encoded URL) where such URL wouldn't
> work for me in Chrome (target PHP page would see a variable named "amp;2"
> instead of "2") but when I use an encoded URL in a Tapestry template, it
> actually works as expected.

I'm guessing that what was happening was that your PHP page was doing
the encoding for you and you ended up with it double encoded
("&"). Tapestry isn't doing anything special with it.

> Anyway, all the fuss for such a stupid mistake... one learns every day!
> Thank you for your patience and help. I know some online forums where people
> would send me to hell for this, instead of patiently answering and
> explaining. :-)

Yeah, we've all been there! Who wants to be a part of a community that
berates people for trying to learn?

Josh

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



RE: Block parameter

2011-10-05 Thread Ulrich Stärk
One more thing that Thiago made me aware of is returning the block from
your setupRender method and closing the surrounding element in
afterRender.

Something along the lines of

Object setupRender(MarkupWriter writer) {
  writer.element(...);
  return block;
}

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

This is obviously much better than fiddling with internal stuff if it
suffices your needs.

I'd recommend to refactor your code to use iteration instead of recursion
if you can. While recursion is very expressive and might save you some
code, Java just isn't a functional language were function calls are cheap.
Additionally you will most likely at some point run into stack space
problems, depending on your data.

Uli

Am Mi, 5.10.2011, 17:53 schrieb Wechsung, Wulf:
> Hello Ulrich,
>
> thanks for the quick response! I would like to use a component template
> but this is one of the few cases where this is afaik impossible due to the
> need for recursion in the rendering.
>
> Thanks for the pointer on how I can proceed!
>
> Kind Regards,
> Wulf
>
>
> -Original Message-
> From: Ulrich Stärk [mailto:u...@spielviel.de]
> Sent: Mittwoch, 5. Oktober 2011 15:43
> To: Tapestry users
> Subject: Re: Block parameter
>
> Rendering component markup directly from your component class is only
> useful for very simple
> components. What you want to do is to mimick some of Tapestry's internals
> that are abstracted away
> for a reason. Now would be the time to start using a component template.
>
> (If you really really have to do this which I strongly discourage, you
> would probably need to cast
> the Block to it's implementation, a BlockImpl, instantiate a
> RenderQueueImpl, call BlockImpl's
> render() method to push the child elements to the queue and afterwards
> call the RenderQueueImpl's
> run method. No guarantees though.)
>
> Uli
>
> On 05.10.2011 14:57, Wechsung, Wulf wrote:
>> Hello guys!
>>
>> Is the following at all possible and if so, where in the framework
>> sources might I be able to find an example of how it works?
>>
>> My component has to render html directly ie:
>>
>> beginRender(MarkupWriter mw) {
>> mw.element(...)
>> etc ...
>> }
>>
>> I now want the component to take a block parameter (ie header) and have
>> this block parameter render within my html ie
>>
>> beginRender( .. ) {
>> mw.element("div")
>> /** something like:
>> header.render()
>> **/
>> mw.end();
>> }
>>
>> For this requirement the block wouldn't even need to do anything
>> dynamic, I just need a way to "inject" specific markup in a general html
>> structure.
>>
>> Thanks for taking the time to read this!
>>
>> Kind Regards,
>> Wulf
>>
>
> -
> 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: Injecting domain object into all pages

2011-10-05 Thread Sonny Gill
Hi guys,

I tried this a few days ago, ran into a few problems, and then tried again
today.

Unfortunately I could not get this to work.

On changing the method name to contributeSiteInjectionProvider, it was
detected by Tapestry, and the provider and FieldValueConduit is created, but
the ReadOnlyFieldValueConduit.get() was never called.

Then I upgraded to Tapestry 5.3-beta-16, and it looks
like ReadOnlyFieldValueConduit has been removed.


Finally, I tried to follow
http://wiki.apache.org/tapestry/JEE-Annotationand added the following
:-

public class SiteAnnotationWorker implements ComponentClassTransformWorker2
{

@Override
public void transform(PlasticClass plasticClass, TransformationSupport
transformationSupport, MutableComponentModel mutableComponentModel) {
for (PlasticField field :
plasticClass.getFieldsWithAnnotation(Inject.class)) {
if (Site.class.getName().equals(field.getTypeName())) {
field.inject(new Site());
field.claim(Inject.class);
}
}
}

}

and in AppModule,

@Contribute(ComponentClassTransformWorker2.class)
@Primary
public static void
provideClassTransformWorkers(OrderedConfiguration
configuration) {
configuration.addInstance("site", SiteAnnotationWorker.class,
"before:Property");
}

With this, the field is injected correctly (great!).

The problem now is that Tapestry continues to keep the injected object
around and injects the same object for every request.
This is probably correct for the use case
for ComponentClassTransformWorker(s), but I need to inject a different
object on each HTTP request.

How can I achieve that?

Again.. I am very thankful for the help received so far. I would have been
completely lost without it.


Best regards,
Sonny




On Wed, Sep 28, 2011 at 2:59 PM, Cezary Biernacki wrote:

> Hi,
> I built a website with similar requirements, and it is not hard to do that
> with Tapestry. A simple approach is to built a service that returns correct
> 'Site' instance, and use it everywhere where you need to 'site'.
>
> So instead having
>  private Site site;
>
> you would have, e.g.
>   @Inject
>   private SiteLookup lookup;
>
>
> and instead using 'site', you would use 'lookup.getSite()'. SiteLookup can
> depend on 'Request' service, so there is no need to pass it as argument to
> getSite() method.
>
> But, if you are not afraid of some more advanced machinery, you can
> contribute your own InjectionProvider, and inject 'Site' directly,
> something
> like:
>
>
> public class SiteInjectionProvider implements InjectionProvider {
>private final Request request;
>
>public  SiteInjectionProvider (Request request) {
>this.request = request;
>}
>
>@Override
>public boolean provideInjection(String fieldName,
> @SuppressWarnings("rawtypes") Class fieldType,
>ObjectLocator locator, ClassTransformation transformation,
> MutableComponentModel componentModel) {
>
>if (!Site.class.equals(fieldType)) {
>return false;
>}
>
>TransformField field = transformation.getField(fieldName);
>
>ComponentValueProvider provider =
> createProvider(fieldName);
>
>field.replaceAccess(provider);
>
>return true;
>}
>
>private ComponentValueProvider createProvider(final
> String fieldName) {
>
>return new ComponentValueProvider() {
>
>public FieldValueConduit get(final ComponentResources resources)
> {
>
>return new ReadOnlyFieldValueConduit(resources, fieldName) {
>public Object get() {
>return ; // <--- here implement selecting
> correct Site based on Request
>}
>};
>}
>
>};
>}
>
> }
>
>
> Remember to contribute your injection provider in your AppModule
>
>@Contribute(InjectionProvider.class)
>public static void
> setupInjectingSite(OrderedConfiguration configuration) {
>configuration.addInstance("site", SiteInjectionProvider .class,
> "after:Default");
>
>}
>
>
> After that, you would be able to use
>   @Inject
>private Site site;
>
> on your pages and components.
>
> Best regards,
> Cezary
>
>
>
>
>
>
>
> On Wed, Sep 28, 2011 at 2:39 PM, Sonny Gill 
> wrote:
>
> > Thanks Barry.
> >
> > Site is a domain layer object and knows nothing about Request/Response
> etc.
> > There will be a limited number of Site objects, one for each site
> > supported,
> > created and configured at the application start up.
> >
> > I could set it up as a Service for Tapestry application.
> > But can I then provide a Service lookup method that can look at the
> current
> > request, get the correct Site using some criteria, and hand it over to
> > Tapestry to inject into the page for current request?
> >
> > So, something like :-
> >
> > public Service lookupSiteService(Request request) {
> >   String id = ...get site id from the request in some 

RE: Block parameter

2011-10-05 Thread Wechsung, Wulf
Hello Ulrich,

thanks for the quick response! I would like to use a component template but 
this is one of the few cases where this is afaik impossible due to the need for 
recursion in the rendering. 

Thanks for the pointer on how I can proceed!

Kind Regards,
Wulf


-Original Message-
From: Ulrich Stärk [mailto:u...@spielviel.de] 
Sent: Mittwoch, 5. Oktober 2011 15:43
To: Tapestry users
Subject: Re: Block parameter

Rendering component markup directly from your component class is only useful 
for very simple
components. What you want to do is to mimick some of Tapestry's internals that 
are abstracted away
for a reason. Now would be the time to start using a component template.

(If you really really have to do this which I strongly discourage, you would 
probably need to cast
the Block to it's implementation, a BlockImpl, instantiate a RenderQueueImpl, 
call BlockImpl's
render() method to push the child elements to the queue and afterwards call the 
RenderQueueImpl's
run method. No guarantees though.)

Uli

On 05.10.2011 14:57, Wechsung, Wulf wrote:
> Hello guys!
>
> Is the following at all possible and if so, where in the framework sources 
> might I be able to find an example of how it works?
>
> My component has to render html directly ie:
>
> beginRender(MarkupWriter mw) {
> mw.element(...)
> etc ...
> }
>
> I now want the component to take a block parameter (ie header) and have this 
> block parameter render within my html ie
>
> beginRender( .. ) {
> mw.element("div")
> /** something like:
> header.render()
> **/
> mw.end();
> }
>
> For this requirement the block wouldn't even need to do anything dynamic, I 
> just need a way to "inject" specific markup in a general html structure.
>
> Thanks for taking the time to read this!
>
> Kind Regards,
> Wulf
>

-
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: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Immutability
Thiago, Uli, Josh - thank you all. Silly me! Got it now...

In my defense, since Josh asked, I have actually tried it - but only in a
browser (by copying and pasting the encoded URL) where such URL wouldn't
work for me in Chrome (target PHP page would see a variable named "amp;2"
instead of "2") but when I use an encoded URL in a Tapestry template, it
actually works as expected.

Anyway, all the fuss for such a stupid mistake... one learns every day!
Thank you for your patience and help. I know some online forums where people
would send me to hell for this, instead of patiently answering and
explaining. :-)

Rado


On Wed, Oct 5, 2011 at 5:01 PM, Ulrich Stärk  wrote:

> Please go to http://validator.w3.org/ and see for yourself. The & in the
> URL is invalid HTML4.01 as
> well as invalid XHTML1.0. It has to be encoded as "&".
>
> Uli
>
> On 05.10.2011 16:36, Radoslav Bielik wrote:
> > Uli, thank you for your response. I'm confused though. The ampersand is a
> > regular element of the URL and a separator of 2 querystring variables. If
> it
> > was encoded as you suggest, then the target server wouldn't recognize
> those
> > as 2 separate variables (in case of Google Web Fonts those variables are
> > "family" and "subset").
> >
> > Thanks,
> > Rado
> >
> > On Wed, Oct 5, 2011 at 4:28 PM, Ulrich Stärk  wrote:
> >
> >> This is absolutely correct behaviour since the url in the href attribute
> is
> >> not encoded as it should
> >> be. Replace '&' with '&' and you should be fine.
> >>
> >> Uli
> >>
> >> On 05.10.2011 16:14, Immutability wrote:
> >>> Hi everyone :)
> >>>
> >>> While playing with Google Web Fonts today
> http://www.google.com/webfontI
> >>> ran into an interesting issue with Tapestry 5.3 (currently running beta
> >> 10).
> >>> When a possible entity name is encountered by Tapestry within a
> template
> >>> file (TML) even if it resides within an element attribute, it will
> raise
> >> an
> >>> exception. For those unfamiliar with Google Web Fonts, it basically
> >>> generates a LINK element pointing to a CSS style hosted by Google. The
> >> HREF
> >>> contains various stuff such as font family and character sets, here's
> an
> >>> example:
> >>>
> >>> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
> >> "
> >>> rel="stylesheet" type="text/css"/>
> >>>
> >>> Now - if you do this, Tapestry will scream:
> >>>
> >>> Failure parsing template
> >> classpath:sk/jazd/kniha/components/SiteBorder.tml:
> >>> The reference to entity "subset" must end with the ';' delimiter.
> >>>
> >>> This seems like a similar issue to the old JavaScript problem, where an
> >>> ampersand within a string will also cause an error. What do you guys
> >> think?
> >>> Is this to be expected, or is it a bug that should be addressed (i.e.
> not
> >>> check entities within quoted element attributes)?
> >>>
> >>> Of course, as always (well - most of the time) with Tapestry, there's
> an
> >>> easy workaround:
> >>>
> >>> 
> >>>
> >>> and in your code:
> >>>
> >>> public String getGoogleFontStyle()
> >>> {
> >>> return "
> >>>
> >>
> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
> >> ";
> >>> }
> >>>
> >>> Rado
> >>>
> >> -
> >> 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: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Ulrich Stärk
Please go to http://validator.w3.org/ and see for yourself. The & in the URL is 
invalid HTML4.01 as
well as invalid XHTML1.0. It has to be encoded as "&".

Uli

On 05.10.2011 16:36, Radoslav Bielik wrote:
> Uli, thank you for your response. I'm confused though. The ampersand is a
> regular element of the URL and a separator of 2 querystring variables. If it
> was encoded as you suggest, then the target server wouldn't recognize those
> as 2 separate variables (in case of Google Web Fonts those variables are
> "family" and "subset").
>
> Thanks,
> Rado
>
> On Wed, Oct 5, 2011 at 4:28 PM, Ulrich Stärk  wrote:
>
>> This is absolutely correct behaviour since the url in the href attribute is
>> not encoded as it should
>> be. Replace '&' with '&' and you should be fine.
>>
>> Uli
>>
>> On 05.10.2011 16:14, Immutability wrote:
>>> Hi everyone :)
>>>
>>> While playing with Google Web Fonts today http://www.google.com/webfontI
>>> ran into an interesting issue with Tapestry 5.3 (currently running beta
>> 10).
>>> When a possible entity name is encountered by Tapestry within a template
>>> file (TML) even if it resides within an element attribute, it will raise
>> an
>>> exception. For those unfamiliar with Google Web Fonts, it basically
>>> generates a LINK element pointing to a CSS style hosted by Google. The
>> HREF
>>> contains various stuff such as font family and character sets, here's an
>>> example:
>>>
>>> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
>> "
>>> rel="stylesheet" type="text/css"/>
>>>
>>> Now - if you do this, Tapestry will scream:
>>>
>>> Failure parsing template
>> classpath:sk/jazd/kniha/components/SiteBorder.tml:
>>> The reference to entity "subset" must end with the ';' delimiter.
>>>
>>> This seems like a similar issue to the old JavaScript problem, where an
>>> ampersand within a string will also cause an error. What do you guys
>> think?
>>> Is this to be expected, or is it a bug that should be addressed (i.e. not
>>> check entities within quoted element attributes)?
>>>
>>> Of course, as always (well - most of the time) with Tapestry, there's an
>>> easy workaround:
>>>
>>> 
>>>
>>> and in your code:
>>>
>>> public String getGoogleFontStyle()
>>> {
>>> return "
>>>
>> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
>> ";
>>> }
>>>
>>> Rado
>>>
>> -
>> 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



Select Model - Adding entries from the form

2011-10-05 Thread sibleygh
Hi 

I'm pretty new to Tapestry. 

I have a requirement where I want to add a new entry to a Select Model, if
the entry doesn't exist. e.g. 

- Populate the select model using the onPrepare() method executing a finder
in hibernate, and present this in the page. 
- Allow the user to provide text in the drop down text box, if a new entry
is required in the model. 
- Persist the new data using a form of Tapestry 'onValueChangedFrom' action. 

I've used the select model successfully to process 'bound' lists, but I
don't seem to see any examples or documentation on how to process an
'unbound' list. 

Regards 

George

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Select-Model-Adding-entries-from-the-form-tp4872879p4872879.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Josh Canfield
Did you try it? The browser should do the right thing and decode it before
using the link.

If you use firebug you'll probably see that it's already been unescaped in
the Dom.
On Oct 5, 2011 7:37 AM, "Radoslav Bielik"  wrote:
> Uli, thank you for your response. I'm confused though. The ampersand is a
> regular element of the URL and a separator of 2 querystring variables. If
it
> was encoded as you suggest, then the target server wouldn't recognize
those
> as 2 separate variables (in case of Google Web Fonts those variables are
> "family" and "subset").
>
> Thanks,
> Rado
>
> On Wed, Oct 5, 2011 at 4:28 PM, Ulrich Stärk  wrote:
>
>> This is absolutely correct behaviour since the url in the href attribute
is
>> not encoded as it should
>> be. Replace '&' with '&' and you should be fine.
>>
>> Uli
>>
>> On 05.10.2011 16:14, Immutability wrote:
>> > Hi everyone :)
>> >
>> > While playing with Google Web Fonts today
http://www.google.com/webfontI
>> > ran into an interesting issue with Tapestry 5.3 (currently running beta
>> 10).
>> > When a possible entity name is encountered by Tapestry within a
template
>> > file (TML) even if it resides within an element attribute, it will
raise
>> an
>> > exception. For those unfamiliar with Google Web Fonts, it basically
>> > generates a LINK element pointing to a CSS style hosted by Google. The
>> HREF
>> > contains various stuff such as font family and character sets, here's
an
>> > example:
>> >
>> > http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
>> "
>> > rel="stylesheet" type="text/css"/>
>> >
>> > Now - if you do this, Tapestry will scream:
>> >
>> > Failure parsing template
>> classpath:sk/jazd/kniha/components/SiteBorder.tml:
>> > The reference to entity "subset" must end with the ';' delimiter.
>> >
>> > This seems like a similar issue to the old JavaScript problem, where an
>> > ampersand within a string will also cause an error. What do you guys
>> think?
>> > Is this to be expected, or is it a bug that should be addressed (i.e.
not
>> > check entities within quoted element attributes)?
>> >
>> > Of course, as always (well - most of the time) with Tapestry, there's
an
>> > easy workaround:
>> >
>> > 
>> >
>> > and in your code:
>> >
>> > public String getGoogleFontStyle()
>> > {
>> > return "
>> >
>>
http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
>> ";
>> > }
>> >
>> > Rado
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>


Re: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Thiago H. de Paula Figueiredo
On Wed, 05 Oct 2011 11:36:43 -0300, Radoslav Bielik   
wrote:



Uli, thank you for your response. I'm confused though. The ampersand is a
regular element of the URL and a separator of 2 querystring variables.  
If it was encoded as you suggest, then the target server wouldn't  
recognize those as 2 separate variables (in case of Google Web Fonts  
those variables are

"family" and "subset").


This is not correct. The URL is still the same, just encoded differently,  
and the requested URL will be the original, unencoded 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: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Immutability
Uli, thank you for your response. I'm confused though. The ampersand is a
regular element of the URL and a separator of 2 querystring variables. If it
was encoded as you suggest, then the target server wouldn't recognize those
as 2 separate variables (in case of Google Web Fonts those variables are
"family" and "subset").

Thanks,
Rado

On Wed, Oct 5, 2011 at 4:28 PM, Ulrich Stärk  wrote:

> This is absolutely correct behaviour since the url in the href attribute is
> not encoded as it should
> be. Replace '&' with '&' and you should be fine.
>
> Uli
>
> On 05.10.2011 16:14, Immutability wrote:
> > Hi everyone :)
> >
> > While playing with Google Web Fonts today http://www.google.com/webfontI
> > ran into an interesting issue with Tapestry 5.3 (currently running beta
> 10).
> > When a possible entity name is encountered by Tapestry within a template
> > file (TML) even if it resides within an element attribute, it will raise
> an
> > exception. For those unfamiliar with Google Web Fonts, it basically
> > generates a LINK element pointing to a CSS style hosted by Google. The
> HREF
> > contains various stuff such as font family and character sets, here's an
> > example:
> >
> > http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
> "
> > rel="stylesheet" type="text/css"/>
> >
> > Now - if you do this, Tapestry will scream:
> >
> > Failure parsing template
> classpath:sk/jazd/kniha/components/SiteBorder.tml:
> > The reference to entity "subset" must end with the ';' delimiter.
> >
> > This seems like a similar issue to the old JavaScript problem, where an
> > ampersand within a string will also cause an error. What do you guys
> think?
> > Is this to be expected, or is it a bug that should be addressed (i.e. not
> > check entities within quoted element attributes)?
> >
> > Of course, as always (well - most of the time) with Tapestry, there's an
> > easy workaround:
> >
> > 
> >
> > and in your code:
> >
> > public String getGoogleFontStyle()
> > {
> > return "
> >
> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
> ";
> > }
> >
> > Rado
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Radoslav Bielik
Uli, thank you for your response. I'm confused though. The ampersand is a
regular element of the URL and a separator of 2 querystring variables. If it
was encoded as you suggest, then the target server wouldn't recognize those
as 2 separate variables (in case of Google Web Fonts those variables are
"family" and "subset").

Thanks,
Rado

On Wed, Oct 5, 2011 at 4:28 PM, Ulrich Stärk  wrote:

> This is absolutely correct behaviour since the url in the href attribute is
> not encoded as it should
> be. Replace '&' with '&' and you should be fine.
>
> Uli
>
> On 05.10.2011 16:14, Immutability wrote:
> > Hi everyone :)
> >
> > While playing with Google Web Fonts today http://www.google.com/webfontI
> > ran into an interesting issue with Tapestry 5.3 (currently running beta
> 10).
> > When a possible entity name is encountered by Tapestry within a template
> > file (TML) even if it resides within an element attribute, it will raise
> an
> > exception. For those unfamiliar with Google Web Fonts, it basically
> > generates a LINK element pointing to a CSS style hosted by Google. The
> HREF
> > contains various stuff such as font family and character sets, here's an
> > example:
> >
> > http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
> "
> > rel="stylesheet" type="text/css"/>
> >
> > Now - if you do this, Tapestry will scream:
> >
> > Failure parsing template
> classpath:sk/jazd/kniha/components/SiteBorder.tml:
> > The reference to entity "subset" must end with the ';' delimiter.
> >
> > This seems like a similar issue to the old JavaScript problem, where an
> > ampersand within a string will also cause an error. What do you guys
> think?
> > Is this to be expected, or is it a bug that should be addressed (i.e. not
> > check entities within quoted element attributes)?
> >
> > Of course, as always (well - most of the time) with Tapestry, there's an
> > easy workaround:
> >
> > 
> >
> > and in your code:
> >
> > public String getGoogleFontStyle()
> > {
> > return "
> >
> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext
> ";
> > }
> >
> > Rado
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Ulrich Stärk
This is absolutely correct behaviour since the url in the href attribute is not 
encoded as it should
be. Replace '&' with '&' and you should be fine.

Uli

On 05.10.2011 16:14, Immutability wrote:
> Hi everyone :)
>
> While playing with Google Web Fonts today http://www.google.com/webfont I
> ran into an interesting issue with Tapestry 5.3 (currently running beta 10).
> When a possible entity name is encountered by Tapestry within a template
> file (TML) even if it resides within an element attribute, it will raise an
> exception. For those unfamiliar with Google Web Fonts, it basically
> generates a LINK element pointing to a CSS style hosted by Google. The HREF
> contains various stuff such as font family and character sets, here's an
> example:
>
> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext";
> rel="stylesheet" type="text/css"/>
>
> Now - if you do this, Tapestry will scream:
>
> Failure parsing template classpath:sk/jazd/kniha/components/SiteBorder.tml:
> The reference to entity "subset" must end with the ';' delimiter.
>
> This seems like a similar issue to the old JavaScript problem, where an
> ampersand within a string will also cause an error. What do you guys think?
> Is this to be expected, or is it a bug that should be addressed (i.e. not
> check entities within quoted element attributes)?
>
> Of course, as always (well - most of the time) with Tapestry, there's an
> easy workaround:
>
> 
>
> and in your code:
>
> public String getGoogleFontStyle()
> {
> return "
> http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext";;
> }
>
> Rado
>

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



[5.3] Possible issue with entity names in HTML attributes

2011-10-05 Thread Immutability
Hi everyone :)

While playing with Google Web Fonts today http://www.google.com/webfont I
ran into an interesting issue with Tapestry 5.3 (currently running beta 10).
When a possible entity name is encountered by Tapestry within a template
file (TML) even if it resides within an element attribute, it will raise an
exception. For those unfamiliar with Google Web Fonts, it basically
generates a LINK element pointing to a CSS style hosted by Google. The HREF
contains various stuff such as font family and character sets, here's an
example:

http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext";
rel="stylesheet" type="text/css"/>

Now - if you do this, Tapestry will scream:

Failure parsing template classpath:sk/jazd/kniha/components/SiteBorder.tml:
The reference to entity "subset" must end with the ';' delimiter.

This seems like a similar issue to the old JavaScript problem, where an
ampersand within a string will also cause an error. What do you guys think?
Is this to be expected, or is it a bug that should be addressed (i.e. not
check entities within quoted element attributes)?

Of course, as always (well - most of the time) with Tapestry, there's an
easy workaround:



and in your code:

public String getGoogleFontStyle()
{
return "
http://fonts.googleapis.com/css?family=Francois+One&subset=latin,latin-ext";;
}

Rado


Re: T5.2 and Metro / SOAP

2011-10-05 Thread Thiago H. de Paula Figueiredo
On Wed, 05 Oct 2011 10:46:03 -0300, Peter Stavrinides  
 wrote:


Registry is an ObjectLocator. Registry is a subinterface of  
ObjectLocator.

What do you need in Registry that ObjectLocator doesn't have?
Okay I get it now, wrap it all in an IoC service that uses ObjectLocator  
to lookup the services, and contribute this service to RegistryStartup  
so there would be no need for a reference to the Registry...


Exactly. It doesn't even need to be a service, as you can inject  
ObjectLocator in your contributeRegistryStartup() method.


As I said before, I am fine with my approach, much of a muchness but  
this could be a better way for others.


I'm not saying it was wrong: it isn't. I just prefer solutions that don't  
involve web.xml. :)


--
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: Compiled CSS

2011-10-05 Thread Jérôme BERNARD
On Wed, Oct 5, 2011 at 15:33, Toby O'Rourke wrote:

> Hi,
>
> Some time ago there was talk of introducing support for WRO4J, SASS or
> LessCSS
>
>
> http://tapestry.1045711.n5.nabble.com/Alternate-template-format-td4639774.html#a4641048
>
> Has there been any progress on that yet? It is something that we've started
> discussing at work, perhaps we could discuss the implementation here, before
> submitting what we do as a patch if it is not currently being developed?


Not sure if it helps, but I've released a Maven plugin recently which can
compile LESS files into CSS :
http://kalixia.github.com/maven-less-compiler-plugin/

I'm using it in order to compile my extended version of Twitter's Bootstrap
CSS framework.

I was thinking about a way to have Tapestry to compile the LESS files at
runtime and cache the results.
Changes to LESS files would mean recompilation, of course.
I haven't started to work on such a thing though.


Jérôme


Fwd: T5.2 and Metro / SOAP

2011-10-05 Thread Peter Stavrinides
> Registry is an ObjectLocator. Registry is a subinterface of ObjectLocator.  
> What do you need in Registry that ObjectLocator doesn't have?
Okay I get it now, wrap it all in an IoC service that uses ObjectLocator to 
lookup the services, and contribute this service to RegistryStartup so there 
would be no need for a reference to the Registry... As I said before, I am fine 
with my approach, much of a muchness but this could be a better way for others.

Regards,
Peter
- Original Message -
From: "Thiago H. de Paula Figueiredo" 
To: "Peter Stavrinides" 
Sent: Wednesday, 5 October, 2011 16:37:31 GMT +02:00 Athens, Bucharest, Istanbul
Subject: Re: T5.2 and Metro / SOAP

On Wed, 05 Oct 2011 10:30:10 -0300, Peter Stavrinides  
 wrote:

> The ObjectLocator provides access to services defined within a Registry,  
> but I haven't seen an example of using it to get hold of a reference to  
> the actual registry?

Registry is an ObjectLocator. Registry is a subinterface of ObjectLocator.  
What do you need in Registry that ObjectLocator doesn't have?

-- 
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



Compiled CSS

2011-10-05 Thread Toby O'Rourke
Hi,

Some time ago there was talk of introducing support for WRO4J, SASS or LessCSS

http://tapestry.1045711.n5.nabble.com/Alternate-template-format-td4639774.html#a4641048

Has there been any progress on that yet? It is something that we've started 
discussing at work, perhaps we could discuss the implementation here, before 
submitting what we do as a patch if it is not currently being developed?

Cheers,

Toby.


Re: Block parameter

2011-10-05 Thread Ulrich Stärk
Rendering component markup directly from your component class is only useful 
for very simple
components. What you want to do is to mimick some of Tapestry's internals that 
are abstracted away
for a reason. Now would be the time to start using a component template.

(If you really really have to do this which I strongly discourage, you would 
probably need to cast
the Block to it's implementation, a BlockImpl, instantiate a RenderQueueImpl, 
call BlockImpl's
render() method to push the child elements to the queue and afterwards call the 
RenderQueueImpl's
run method. No guarantees though.)

Uli

On 05.10.2011 14:57, Wechsung, Wulf wrote:
> Hello guys!
>
> Is the following at all possible and if so, where in the framework sources 
> might I be able to find an example of how it works?
>
> My component has to render html directly ie:
>
> beginRender(MarkupWriter mw) {
> mw.element(...)
> etc ...
> }
>
> I now want the component to take a block parameter (ie header) and have this 
> block parameter render within my html ie
>
> beginRender( .. ) {
> mw.element("div")
> /** something like:
> header.render()
> **/
> mw.end();
> }
>
> For this requirement the block wouldn't even need to do anything dynamic, I 
> just need a way to "inject" specific markup in a general html structure.
>
> Thanks for taking the time to read this!
>
> Kind Regards,
> Wulf
>

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



Re: T5.2 and Metro / SOAP

2011-10-05 Thread Peter Stavrinides
The ObjectLocator provides access to services defined within a Registry, but I 
haven't seen an example of using it to get hold of a reference to the actual 
registry? is that possible? if so pls provide a code example, I have only seen 
this from the Context. ie: Registry registry = (Registry) 
context.getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME); Am I missing 
something, perhaps show us what you are referring to in some code.

- Original Message -
From: "Thiago H. de Paula Figueiredo" 
To: "Tapestry users" , "P Stavrinides" 

Sent: Wednesday, 5 October, 2011 15:32:51 GMT +02:00 Athens, Bucharest, Istanbul
Subject: Re: T5.2 and Metro / SOAP

On Wed, 05 Oct 2011 09:08:21 -0300,  wrote:

> I don't know Thiago, I suppose that may be true, but I never tried it...  
> In theory, the only thing you really need is a reference to the Tapestry  
> registry in order to publish the endpoints, this was the best solution I  
> found at the time, I am still not convinced I would do it any other way.

You can inject an ObjectLocator (which is the interface that provides the  
getService() and autobuild() methods of Registry) in any service. This  
avoids the need of web.xml changes.

-- 
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



Block parameter

2011-10-05 Thread Wechsung, Wulf
Hello guys!

Is the following at all possible and if so, where in the framework sources 
might I be able to find an example of how it works?

My component has to render html directly ie:

beginRender(MarkupWriter mw) {
mw.element(...)
etc ...
}

I now want the component to take a block parameter (ie header) and have this 
block parameter render within my html ie

beginRender( .. ) {
mw.element("div")
/** something like:
header.render()
**/
mw.end();
}

For this requirement the block wouldn't even need to do anything dynamic, I 
just need a way to "inject" specific markup in a general html structure.

Thanks for taking the time to read this!

Kind Regards,
Wulf


Re: T5.2 and Metro / SOAP

2011-10-05 Thread Thiago H. de Paula Figueiredo

On Wed, 05 Oct 2011 09:08:21 -0300,  wrote:

I don't know Thiago, I suppose that may be true, but I never tried it...  
In theory, the only thing you really need is a reference to the Tapestry  
registry in order to publish the endpoints, this was the best solution I  
found at the time, I am still not convinced I would do it any other way.


You can inject an ObjectLocator (which is the interface that provides the  
getService() and autobuild() methods of Registry) in any service. This  
avoids the need of web.xml changes.


--
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.2 and Metro / SOAP

2011-10-05 Thread P . Stavrinides
I don't know Thiago, I suppose that may be true, but I never tried it... In 
theory, the only thing you really need is a reference to the Tapestry registry 
in order to publish the endpoints, this was the best solution I found at the 
time, I am still not convinced I would do it any other way.



- Original Message -
From: "Thiago H. de Paula Figueiredo" 
To: "Tapestry users" 
Sent: Wednesday, 5 October, 2011 14:41:16 GMT +02:00 Athens, Bucharest, Istanbul
Subject: Re: T5.2 and Metro / SOAP

On Wed, 05 Oct 2011 08:03:50 -0300,  wrote:

> Hello!

Hi!

I haven't tried what you've done, but I don't think you need to subclass
TapestryFilter. Couldn't the logic inside publicEndpointSingletonServices
be replaced by a class contributed to the RegistryStartup service? I can't
see anything that needs to be in a servlet filter.

-- 
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


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



Re: T5.2 and Metro / SOAP

2011-10-05 Thread Thiago H. de Paula Figueiredo

On Wed, 05 Oct 2011 08:03:50 -0300,  wrote:


Hello!


Hi!

I haven't tried what you've done, but I don't think you need to subclass
TapestryFilter. Couldn't the logic inside publicEndpointSingletonServices
be replaced by a class contributed to the RegistryStartup service? I can't
see anything that needs to be in a servlet filter.

--
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: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Thiago H. de Paula Figueiredo
On Wed, 05 Oct 2011 06:04:08 -0300, Muhammad Gelbana   
wrote:



But this implies carrying tapestry IoC jar along with my jar (because
services are annotated with tapestry IoC annotations) even in an  
environment that doesn't use tapestry's IoC. I just don't wan't my jar  
to be tapestry

dependent just to separate the presentation layer from anything else.


You don't need to use any annotation in your service classes. Use  
constructor injection, so you don't need @Inject. For startup and shutdown  
listeners, you can register them through a module class outside of your  
services JAR. This way, you can have it completely independent of  
Tapestry-IoC.


In addition, since 5.3, you can use the JSR 330 annotations instead of  
Tapestry-IoC ones:  
http://tapestry.apache.org/using-jsr-330-standard-annotations.html



So is ther a *@Shutdown* annotation just like the *@Startup* one ?


@Startup, as far as I can remember, is just a shortcut for contributing a  
service to the RegistryStartup. As Steve said, RegistryShutdownHub does  
the same, but for shutdown. Registering your services in these two  
services replaces the use of the contextInitialized and contextDestroyed*  
methods implemented in context listeners.


--
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.2 and Metro / SOAP

2011-10-05 Thread P . Stavrinides
Hello!

I am using Metro Web Services for near over a year now, and I am pretty happy 
with it... Integration with .Net was very trivial , in-fact there is nothing to 
do on the client except point to the wsdl file. Having said that though, 
recently we have created some CXF web services, and the integration was also 
very clean, there are only some slight differences btw them. Both are great, 
Metro docs are a little thin for my liking, I battled through some edge cases. 
The CXF web services we deployed are standalone services, with only the 
tapestry IoC jar, whereas I integrated Metro directly into a Tapestry web app. 

This is a basic outline of how I did it, I don't know if its the best approach, 
but at the time I found very minimal help / docs, so it was largely my own 
device. My approach has zero xml as well, which is what I was after, but be 
warned you may have problems if you need your wsdl to be published as an SSL 
URL, for that Endpoint.publish will not work, you need the bottom up xml first 
approach:

1. Create your own filter that will extend Tapestry's

app
com.web.services.entws.NewWebFilter



2. Extend TapestryFilter, Tapestry provides you a convenient extension point 
out the box:


public class NewWebFilter extends TapestryFilter {


@Override
protected void init(Registry registry) throws ServletException {
publishEndpointSingletonServices(registry, HOST_ABSOULTE_URI);
}


// Generic method to my bind Handler chains and EndPoints
@SuppressWarnings("unchecked")
private void publishEndpointSingletonServices(Registry registry, String 
host) {
for (Class serviceInterface : getSingletonEndPoints()) {
WebService annotation = serviceInterface
.getAnnotation(WebService.class);
if (annotation != null) {
Endpoint endpoint = Endpoint.create(registry
.getService(serviceInterface));


//eliminates the need to bind using 
@HandlerChain(file = "handlers.xml")
List chain = 
endpoint.getBinding().getHandlerChain();
chain.add(new WsAccessLog());
chain.add(new WsSoapAccessLog());
endpoint.getBinding().setHandlerChain(chain);

String fullAddress = host + 
annotation.serviceName();
endpoint.publish(fullAddress);

}
}
}

/**
 * A method to bind enterprise web service endpoints
 * @return a list of the service endpoint proxies
 */
private ArrayList> getSingletonEndPoints() {
ArrayList> serviceEndpointInterfaces = new 
ArrayList>();

// *** Add services here:
serviceEndpointInterfaces.add(WsFundQueryImpl.class);
serviceEndpointInterfaces.add(WsAuthenticationImpl.class);
...etc
return serviceEndpointInterfaces;
}
}

3. Now use regular IoC bindings in your AppModule:
binder.bind(WsAuthenticationImpl.class).withId(
"WsAuthentication");
binder.bind(WsFundQueryImpl.class).withId("WsFundQuery");


4. Then create your web service, it is a regular IoC service, you can use any 
services via constructor injection as per normal (even other bound web services 
work), only difference being the class is annotated with JAXWS annotations

@WebService(serviceName = "fundquery", targetNamespace="WsClient")
public class WsFundQueryImpl {

private FundsService fundData_;
private final SOAPSessionFactory soapSessionFactory_;
private final WsAuthenticationImpl wsAuthentication_;
private final FundClassRepository fundClassRepository_;
private final TimeSeriesRepository timeSeriesRepository_;

public SOAPSessionFactory getSoapSessionFactory() {
return soapSessionFactory_;
}

public WsFundQueryImpl(FundsService fundData,
SOAPSessionFactory soapSessionFactory,
WsAuthenticationImpl wsAuthentication,
FundClassRepository 
fundClassRepository,TimeSeriesRepository timeSeriesRepository) throws 
IOException {
fundData_ = fundData;
soapSessionFactory_ = soapSessionFactory;
castleWsAuthentication_ = wsAuthentication;
fundClassRepository_ = fundClassRepository;
timeSeriesRepository_ = timeSeriesRepository;

}



  

Re: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Muhammad Gelbana
*I'm confused, to use the @Startup in your module class, then you need*
*the IoC jar to reference the @Startup annotation class!?*


I meant the shutdown mechanism explained in this page (
https://cwiki.apache.org/confluence/display/TAPESTRY/Tapestry+Inversion+of+Control+FAQ)
makes
my services tapestry dependent, not the start-up mechanism.

*Could you not have a class / service in your web teir that registers*
*with the RegistryShutdownHub, which then calls into your business*
*logic jar to shut it down?*


Very nice idea ! I'll start implementing it right away.
Thanks a lot :)

On Wed, Oct 5, 2011 at 11:34 AM, Steve Eynon  wrote:

> Hiya,
>
> No, there is no @Shutdown method - as you say, you have to register
> with the RegistryShutdownHub.
>
> > I just don't wan't my jar to be tapestry dependent
>
> I'm confused, to use the @Startup in your module class, then you need
> the IoC jar to reference the @Startup annotation class!?
>
> Could you not have a class / service in your web teir that registers
> with the RegistryShutdownHub, which then calls into your business
> logic jar to shut it down?
>
> Steve.
>
>
> On 5 October 2011 17:04, Muhammad Gelbana  wrote:
> > I have a current project that I am VERY close to converting all it's code
> > from core servlets to t5.2.6. But I have this project split to a jar file
> > containing most of the business logic, servicec, dao, etc.
> >
> > After intergrating this jar into the tapestry project, I need to start
> some
> > services and shut them down when I'm done.
> > For startup I use the *@Startup* annotation to mark a *static void*
> method
> > which runs a thread, initializing my services.
> >
> > About shutdown I found very nice information on this page:
> >
> https://cwiki.apache.org/confluence/display/TAPESTRY/Tapestry+Inversion+of+Control+FAQ
> >
> > But this implies carrying tapestry IoC jar along with my jar (because
> > services are annotated with tapestry IoC annotations) even in an
> environment
> > that doesn't use tapestry's IoC. I just don't wan't my jar to be tapestry
> > dependent just to separate the presentation layer from anything else.
> >
> > So is ther a *@Shutdown* annotation just like the *@Startup* one ?
> >
> > This is will mirror perfectly to the *contextInitialized* and *
> > contextDestroyed* methods implemented in context listeners usually
> > implemented for the same purpose in core servlets projects.
> >
> > --
> > *Regards,*
> > *Muhammad Gelbana
> > Java Developer*
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*


Re: Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Steve Eynon
Hiya,

No, there is no @Shutdown method - as you say, you have to register
with the RegistryShutdownHub.

> I just don't wan't my jar to be tapestry dependent

I'm confused, to use the @Startup in your module class, then you need
the IoC jar to reference the @Startup annotation class!?

Could you not have a class / service in your web teir that registers
with the RegistryShutdownHub, which then calls into your business
logic jar to shut it down?

Steve.


On 5 October 2011 17:04, Muhammad Gelbana  wrote:
> I have a current project that I am VERY close to converting all it's code
> from core servlets to t5.2.6. But I have this project split to a jar file
> containing most of the business logic, servicec, dao, etc.
>
> After intergrating this jar into the tapestry project, I need to start some
> services and shut them down when I'm done.
> For startup I use the *@Startup* annotation to mark a *static void* method
> which runs a thread, initializing my services.
>
> About shutdown I found very nice information on this page:
> https://cwiki.apache.org/confluence/display/TAPESTRY/Tapestry+Inversion+of+Control+FAQ
>
> But this implies carrying tapestry IoC jar along with my jar (because
> services are annotated with tapestry IoC annotations) even in an environment
> that doesn't use tapestry's IoC. I just don't wan't my jar to be tapestry
> dependent just to separate the presentation layer from anything else.
>
> So is ther a *@Shutdown* annotation just like the *@Startup* one ?
>
> This is will mirror perfectly to the *contextInitialized* and *
> contextDestroyed* methods implemented in context listeners usually
> implemented for the same purpose in core servlets projects.
>
> --
> *Regards,*
> *Muhammad Gelbana
> Java Developer*
>

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



Development decision regarding tapestry IoC (Application start-up and shutdown)

2011-10-05 Thread Muhammad Gelbana
I have a current project that I am VERY close to converting all it's code
from core servlets to t5.2.6. But I have this project split to a jar file
containing most of the business logic, servicec, dao, etc.

After intergrating this jar into the tapestry project, I need to start some
services and shut them down when I'm done.
For startup I use the *@Startup* annotation to mark a *static void* method
which runs a thread, initializing my services.

About shutdown I found very nice information on this page:
https://cwiki.apache.org/confluence/display/TAPESTRY/Tapestry+Inversion+of+Control+FAQ

But this implies carrying tapestry IoC jar along with my jar (because
services are annotated with tapestry IoC annotations) even in an environment
that doesn't use tapestry's IoC. I just don't wan't my jar to be tapestry
dependent just to separate the presentation layer from anything else.

So is ther a *@Shutdown* annotation just like the *@Startup* one ?

This is will mirror perfectly to the *contextInitialized* and *
contextDestroyed* methods implemented in context listeners usually
implemented for the same purpose in core servlets projects.

-- 
*Regards,*
*Muhammad Gelbana
Java Developer*


Re: Tap-5.3-beta-16 tapestry-core v. tapestry-hibernate

2011-10-05 Thread Steve Eynon
Could this be a normal Java method overriding thing?

i.e. if you override setupRender()  in a child class you need to call
super.setupRender() to get execute the parent's method...?

Steve.

On 4 October 2011 21:58, Emmanuel DEMEY  wrote:
> Hi Tony
>
> I just have a look to your issue, and I think it should work now (with the
> last version available on Github). I have forgotten to suppress a comment in
> my FormResourcesInclusionWorker.java in Tapestry5-jQuery. This worker has to
> be used just for the Form Component, but was used for all components.
>
> BUT ... I have a question about this issue. In fact, in my worker, I add an
> advice to a SetupRender method :
>
> PlasticMethod setupRender =
> plasticClass.introduceMethod(TransformConstants.SETUP_RENDER_DESCRIPTION);
>
> setupRender.addAdvice(new MethodAdvice() {
>   public void advise(MethodInvocation invocation) {
>         javaScriptSupport.importStack(FormSupportStack.STACK_ID);
>         invocation.proceed();
>   }
> });
>
> model.addRenderPhase(SetupRender.class);
>
> With my previous mistake, this worker was executed also for the TextField
> component. The Texfield Class extends AbstractTextField, and this one
> extends AbstractField. I found just one SetupRender method in the
> AbstractField class.
>
> When Tony tested his page, the SetupRender method of the AbstractField was
> never called, so the ClientId and ControlName were never initialized. So, in
> the generated HTML, both attributes are missing.
>
> Is it normal ? Or am I missing something ?
>
> Thanks
>
> Emmanuel
>
>
>
>
>
>
> 2011/10/3 Tony Nelson 
>
>> I have found with the latest Tap5.3 beta that the html generated from a
>> simple textfield differs significantly if you are using tapestry-core or
>> tapestry-hibernate.
>>
>> In my .tml file I have the following simple input:
>>
>>        Username: 
>>        
>>
>> When this is run with tapestry-core I get the following html:
>>
>> Username: 
>> > type="text">
>>
>> When I run the same template with tapestry-hibernate I get the following
>> html:
>>
>> Username: 
>> 
>>
>> Notice the tapestry-hibernate version is missing the id attribute which is
>> causing my javascript to fail (and I think when the form is submitted, tap
>> can't seem to decode the values).
>>
>> I've put together a small sample app that you can clone from github that
>> demonstrates the problem:
>>
>> https://github.com/hhubris/broken
>>
>> Simply change the tapestry dependency from tapestry-core to
>> tapestry-hibernate and restart jetty with "mvn clean jetty:run" to see the
>> problem.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks
>> Tony Nelson
>> Starpoint Solutions
>

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



Re: AjaxFormLoop problem with Tapestry 5.2.-beta-9

2011-10-05 Thread Michael Dukaczewski
I am now on version 5.3-beta-16 and the error still occurs. Can someone 
please try out my example and confirm that it is a bug? Or give a hint 
what I'm doing wrong?


@Steve
Are you sure that you can remove lines that you just added?

Regards,
Michael



Am 21.09.2011 19:44, schrieb Emmanuel DEMEY:

My Sample is the one on the Tapestry-jQuery Test application :

https://github.com/got5/tapestry5-jquery/blob/master/src/test/java/org/got5/tapestry5/jquery/test/pages/test/AjaxFormLoop.java

Manu

2011/9/21 Michael Dukaczewski


Emmanuel is right. I have the same problem. This simple example does not
work with Tapestry 5.3-beta-9:

public class AjaxTest {

@Persist
private List  source;

@Property
private String str;

public List  getSource() {
if (source == null) {
source = new LinkedList();
}
return source;
}

Object onAddRowFromTest() {
String s = ""+System.currentTimeMillis();
getSource().add(s);
return s;
}

void onRemoveRowFromTest(String s) {
getSource().remove(s);
}
}

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
xmlns:p="tapestry:parameter">



${str}remove






Regards,
Michael


Am 20.09.2011 15:27, schrieb Steve Eynon:

I don't know what I'm doing differently, but my AjaxFormLoop still
seems to add and remove rows with T5.3-beta-9.

My implementation (like most people's I suspect!) is based on Geoff's
Jumpstart example

http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1

Steve.
--
Steve Eynon
---
"If at first you don't succeed,
so much for skydiving!"





On 20 September 2011 19:10, Emmanuel DEMEY

wrote:

Hi everybody

Few days ago, I created a simple sample for the AjaxFormLoop component,

with

Tapestry 5.3.0. Everything was OK.

This morning, I updated to Tapestry 5.3-beta-9. But when I add a new row

(by

clicking to the "add" link), the JSON response of the AJAX request does

not

include the elementId value. So, when I want to delete the new row,
tapestry.js throw me an exception.

After a debugging phase, I think the PartialMarkupRenderFilter, declared

in

the onInject method of the FormInjector component, is added to the
PageRenderQueue to late. The renderPartial method (PageRenderQueue) is
called before added this last Filter.

Does anyone of you have the same issue ?

I hope I have enough informations. !
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







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