Re: Custom ViewHandlers

2007-03-28 Thread Jörn Zaefferer

The JSF 1.1 spec mentions the delegation in 10.3.5 Delegating
Implementation Support (10-52).


From what I've seen, Facelets delegates to the JSPViewHandler when it can't

find the specified view. So if you can't rely on the order of registered
view handlers, you have to rely on the handle-or-delegate behaviour. Seems
to work with Facelets, but I don't know how others deal with it.

On 3/28/07, Brad Smith [EMAIL PROTECTED] wrote:


Jörn - I do not know. Any examples that I have seen (e.g. Facelets with
Trinidad or Facelets with Ajax4JSF) show Facelets being registered in
web.xml via a custom context configuration.  I am having a difficult
time finding any specification for JSF configuration file
(faces-config.xml by default) that describes the delegation process.

Brad


On Tue, 2007-03-27 at 17:12 +0200, Jörn Zaefferer wrote:
 Isn't the delegation supposed to allow registering of more then one
 view handler?







Re: Custom ViewHandlers

2007-03-27 Thread Jörn Zaefferer

Isn't the delegation supposed to allow registering of more then one view
handler?

On 3/27/07, Brad Smith [EMAIL PROTECTED] wrote:


Thank you Simon. Do you by chance know what to do when also using
something like Facelets which also has a custom ViewHandler? I mean as
far as how the faces config file would be set up?

Thanks,

Brad Smith

On Tue, 2007-03-27 at 13:00 +1200, Simon Kitching wrote:
 First write a subclass of ViewHandler that takes another ViewHandler as
 a parameter to the constructor. This constructor will be called passing
 the preceding viewhandler instance so you can chain calls to it from
 your custom class.

 Second, add the following to your faces config file:
application
  view-handlerexample.MyViewHandler/view-handler
/application






Re: Custom ViewHandlers

2007-03-27 Thread Gary VanMatre
From: Jörn Zaefferer [EMAIL PROTECTED] 
Isn't the delegation supposed to allow registering of more then one view 
handler?


Yes, but you can not control the order they are registered. You might have a 
scenario where your view handler is registered before a greedy view handler 
that wants the hook you are trying to override.

Gary


On 3/27/07, Brad Smith  [EMAIL PROTECTED] wrote:
Thank you Simon. Do you by chance know what to do when also using 
something like Facelets which also has a custom ViewHandler? I mean as
far as how the faces config file would be set up?

Thanks,

Brad Smith

On Tue, 2007-03-27 at 13:00 +1200, Simon Kitching wrote: 
 First write a subclass of ViewHandler that takes another ViewHandler as
 a parameter to the constructor. This constructor will be called passing
 the preceding viewhandler instance so you can chain calls to it from 
 your custom class.

 Second, add the following to your faces config file:
application
  view-handlerexample.MyViewHandler/view-handler
/application 


Re: Custom ViewHandlers

2007-03-27 Thread Brad Smith
Jörn - I do not know. Any examples that I have seen (e.g. Facelets with
Trinidad or Facelets with Ajax4JSF) show Facelets being registered in
web.xml via a custom context configuration.  I am having a difficult
time finding any specification for JSF configuration file
(faces-config.xml by default) that describes the delegation process.

Brad


On Tue, 2007-03-27 at 17:12 +0200, Jörn Zaefferer wrote:
 Isn't the delegation supposed to allow registering of more then one
 view handler?






Re: Custom ViewHandlers

2007-03-26 Thread Simon Kitching

Brad Smith wrote:

I was wondering how a custom ViewHandler is managed in MyFaces. A custom
view handler seems to be an elegant solution to a problem I am dealing
with, yet I will also be using Facelets. 


Facelets uses a decorator pattern in it's ViewHandler, that is the
constructor takes a base ViewHandler as the only argument.  


I am wondering how to easily chain ViewHandlers so that my custom
ViewHandler can decorate the FaceletViewHander (or other ViewHandler
such as the default ViewHandler for MyFaces).


It's very simple. I did it just a week or so ago; it was an attempt at 
fixing something that turned out easier in another way so I've deleted 
that code however here's what I remember:


First write a subclass of ViewHandler that takes another ViewHandler as 
a parameter to the constructor. This constructor will be called passing 
the preceding viewhandler instance so you can chain calls to it from 
your custom class.


Second, add the following to your faces config file:
  application
view-handlerexample.MyViewHandler/view-handler
  /application

All done.

Regards,

Simon



Re: Custom ViewHandlers

2007-03-26 Thread Gary VanMatre
From: Simon Kitching [EMAIL PROTECTED] 

 Brad Smith wrote: 
  I was wondering how a custom ViewHandler is managed in MyFaces. A custom 
  view handler seems to be an elegant solution to a problem I am dealing 
  with, yet I will also be using Facelets. 
  
  Facelets uses a decorator pattern in it's ViewHandler, that is the 
  constructor takes a base ViewHandler as the only argument. 
  
  I am wondering how to easily chain ViewHandlers so that my custom 
  ViewHandler can decorate the FaceletViewHander (or other ViewHandler 
  such as the default ViewHandler for MyFaces). 
 
 It's very simple. I did it just a week or so ago; it was an attempt at 
 fixing something that turned out easier in another way so I've deleted 
 that code however here's what I remember: 
 
 First write a subclass of ViewHandler that takes another ViewHandler as 
 a parameter to the constructor. This constructor will be called passing 
 the preceding viewhandler instance so you can chain calls to it from 
 your custom class. 
 
 Second, add the following to your faces config file: 
  application
 view-handlerexample.MyViewHandler/view-handler
   /application

 
 All done. 


Trinidad also has an interesting pluggable view handler.  They call it an 
InternalView handler.
The basic idea is that there is a properties file that you register viewIds [1] 
that are associated with internal views.  Next, you provide your custom 
implementation of the InternalView interface [2].


[1] 
http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/resources/META-INF/org.apache.myfaces.trinidad.render.InternalView.properties?view=log
[2] 
http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/PageHandler.java?view=markup



Gary

 Regards, 
 
 Simon 
 

Re: Custom ViewHandlers

2007-03-26 Thread Brad Smith
Thank you Simon. Do you by chance know what to do when also using
something like Facelets which also has a custom ViewHandler? I mean as
far as how the faces config file would be set up?

Thanks,

Brad Smith

On Tue, 2007-03-27 at 13:00 +1200, Simon Kitching wrote:
 First write a subclass of ViewHandler that takes another ViewHandler as 
 a parameter to the constructor. This constructor will be called passing 
 the preceding viewhandler instance so you can chain calls to it from 
 your custom class.
 
 Second, add the following to your faces config file:
application
  view-handlerexample.MyViewHandler/view-handler
/application