Exception handling on init, prerender and preprocess

2007-01-26 Thread JS Portal Support
Hi,

As the AbstractViewController does not throw Exceptions on its init(),
prerender() and preprocess(), I'm catching the exceptions in these methods
in my own classes extending the AbstractViewController and build my own
dispatching or logging. Why can these methods not utilize shale's exception
handling?

Regards,
Joost




Exceptions at startup

2007-01-26 Thread amjad Shahrour

Hi,

I am using shale-tiger along with ADF faces on tomcat 5.5.8. and i am having
several exceptions thrown at the startup of the server (but this seems not
affecting the working of shale, i.e. callbacks are being called)

Class = org.apache.commons.digester.Digester
Parse Error at line 83 column 19: The content of element type "attribute"
must match "(description*,display-name*,icon*,attribute-name,at
tribute-class,default-value?,suggested-value?,attribute-extension*)".
org.xml.sax.SAXParseException: The content of element type
"attribute" must match "(description*,display-name*,icon*,attribut
e-name,attribute-class,default-value?,suggested-value?,attribute-extension*)".
   at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
   at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown
Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown
Source)
   at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown
Source)
   at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
   at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.apache.commons.digester.Digester.parse(Digester.java:1647)
   at org.apache.shale.tiger.config.FacesConfigParser.parse(
FacesConfigParser.java:157)
   at
org.apache.shale.tiger.view.faces.LifecycleListener2.parseResource(
LifecycleListener2.java:1282)
   at
org.apache.shale.tiger.view.faces.LifecycleListener2.contextInitialized(
LifecycleListener2.java:290)
   at org.apache.shale.view.faces.LifecycleListener.contextInitialized(
LifecycleListener.java:138)
   at org.apache.catalina.core.StandardContext.listenerStart(
StandardContext.java:3659)
   at org.apache.catalina.core.StandardContext.start(
StandardContext.java:4097)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
:1012)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java
:718)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
:1012)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java
:442)
   at org.apache.catalina.core.StandardService.start(
StandardService.java:450)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java
:683)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)

regards,
Amjad Shahrour


Re: How to end a SCXML dialog in an action?

2007-01-26 Thread Rahul Akolkar

On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

Rahul,
I an getting the following when I click on the home link.  It appears that the 
dialog
is still running even though it was stopped.




Couldn't spot anything so dropped your code snippets into the
shale-test-dialog-scxml app. Works for me, recipe below:

1) Used SessionManagerBean and the  snippet, both verbatim
from below (snippet placed at the bottom of wizardpage1.jsp in the
test app above)

2) faces-config additions:

   
   sessionManager
   
org.apache.shale.examples.test.dialog.scxml.SessionManagerBean
   session
   

   
   /*
   
   #{sessionManager.gotoHome}
   home
   /menu.jsp
   
   

Then clicking on "Home" takes me to the test app home page (menu.jsp)
after stopping the active dialog.

-Rahul



***
* Stack Trace
***

ServletRequestAttributeAdded(org.apache.myfaces.config.beansUnderConstruction,[])
stop(id=1, name=addVendor)
remove(Removed DialogContext instance with ID '1'
handleNavigation(context='[EMAIL PROTECTED]', 
fromAction='#{sessionManager.gotoHome}', outcome='home')
Dialog instance '1' for dialog name 'addVendor' has not yet been started
java.lang.IllegalStateException: Dialog instance '1' for dialog name 
'addVendor' has not yet been started
at 
org.apache.shale.dialog.scxml.SCXMLDialogContext.advance(SCXMLDialogContext.java:316)
at 
org.apache.shale.dialog.faces.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:139)
at 
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
at 
org.apache.shale.view.faces.ViewActionListener.processAction(ViewActionListener.java:74)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at 
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
at 
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
at 
org.apache.shale.view.faces.ShaleViewRoot.processApplication(ShaleViewRoot.java:40)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)

***
* From the managed bean
***
public class SessionManagerBean
{
 public String gotoHome()
 {
 stopActiveDialogIfAny(FacesContext.getCurrentInstance());
 return "home";
 }

 private void stopActiveDialogIfAny(FacesContext facesContext)
 {
 DialogContext dcontext = (DialogContext) 
facesContext.getExternalContext().getRequestMap().get(Constants.CONTEXT_BEAN);
 if (dcontext != null)
 {
 dcontext.stop(facesContext);
 }
 }
}

**
* Form the view
***







Paul Spencer



Re: ADF faces with shale tiger

2007-01-26 Thread Gary VanMatre
>From: "amjad Shahrour" <[EMAIL PROTECTED]> 
>
> You are right Gary, that was the cause. Thanks. 
> 
> I am interested to learn more about the mapper configuration. can you point 
> me to a document about it. 
> 

We have some site documentation [1].  This is Craig's craft-work so the javadoc 
is also very helpful [2].

[1]http://shale.apache.org/shale-view/index.html
[2]http://shale.apache.org/shale-view/apidocs/org/apache/shale/view/impl/DefaultViewControllerMapper.html

> regards, 
> amjad 
> 

Gary

> On 1/26/07, Gary VanMatre wrote: 
> > 
> > >From: "amjad Shahrour" 
> > > 
> > > Hi there, 
> > > 
> > > I am trying to utilize only shale-tiger with ADF faces. 
> > > 
> > > I am interested only in using only the view controller services 
> > (callbacks). 
> > > i created a simple (adf) jsf page and used the @View @Preprocess @Init 
> > > @Prerender @Destroy on the page's backing bean. but nothing seems to 
> > take 
> > > effect (no callbacks are being called). 
> > > 
> > 
> > It sounds like you are missing the binding between a JSF view and a 
> > managed bean. This is handled by a naming convention. The JSF viewId is 
> > normalized into a value that must have a corresponding managed. 
> > 
> > So if your target page was "/something.jsf", the ViewController should be 
> > registered as a managed bean by the name of "something". The default 
> > mapper, removes the suffix of the viewId and replaces the "/" with "$". You 
> > can override the default mapper if you want to create your own rules. 
> > 
> > 
> > Since your are using the tiger annotations (you also need shale-tiger 
> > besides shale-view and shale-core), you could register your ViewControllers 
> > as managed beans with the following annotation: 
> > 
> > @Bean(name = "something", scope = Scope.REQUEST) 
> > 
> > 
> > > 
> > > following is the web.xml file content 
> > > 
> > > 
> > > 
> > > thanks in advance 
> > 
> > 
> > Gary 
> > 

Re: How to end a SCXML dialog in an action?

2007-01-26 Thread Paul Spencer

Rahul,
I an getting the following when I click on the home link.  It appears that the 
dialog
is still running even though it was stopped.

***
* Stack Trace
***

ServletRequestAttributeAdded(org.apache.myfaces.config.beansUnderConstruction,[])
stop(id=1, name=addVendor)
remove(Removed DialogContext instance with ID '1'
handleNavigation(context='[EMAIL PROTECTED]', 
fromAction='#{sessionManager.gotoHome}', outcome='home')
Dialog instance '1' for dialog name 'addVendor' has not yet been started
java.lang.IllegalStateException: Dialog instance '1' for dialog name 
'addVendor' has not yet been started
at 
org.apache.shale.dialog.scxml.SCXMLDialogContext.advance(SCXMLDialogContext.java:316)
at 
org.apache.shale.dialog.faces.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:139)
at 
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
at 
org.apache.shale.view.faces.ViewActionListener.processAction(ViewActionListener.java:74)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at 
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
at 
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
at 
org.apache.shale.view.faces.ShaleViewRoot.processApplication(ShaleViewRoot.java:40)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)

***
* From the managed bean
***
public class SessionManagerBean
{
public String gotoHome()
{
stopActiveDialogIfAny(FacesContext.getCurrentInstance());
return "home";
}

private void stopActiveDialogIfAny(FacesContext facesContext)
{
DialogContext dcontext = (DialogContext) 
facesContext.getExternalContext().getRequestMap().get(Constants.CONTEXT_BEAN);
if (dcontext != null)
{
dcontext.stop(facesContext);
}
}
}

**
* Form the view
***







Paul Spencer

Rahul Akolkar wrote:

On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

Rahul Akolkar wrote:



>
> As mentioned above, that would be inside the method called by the MB,
> if at all we wanted to stop an active dialog and delegate to the
> faces-config navigation.
>

What is the name of the method, or where do I configure it, that is
called when the outcome, does is not configured?

In the above example page's header/footer define the outcomes "home",
"logout", and "menu".  These outcomes are currently handled by
faces-config.xml, and I agree with your statement about avoiding the
modeling of "global" site navigation in each dialog.




Lets say outcome "home" is actually a commandLink, so simplistically:



This, by itself, would mess with an active dialog. Instead:



would ensure that we clean up correctly if there is an active dialog, 
where:


// In the managed bean "globals" --

public String home() {

 stopActiveDialogIfAny(); // the two lines of code from before

 return "home";  // faces-config nav rules takes over here
}

Similarly for "logout" and "menu". Also may want to check with user
via onclick or suitable event handlers before wiping out the dialog.

-Rahul





Re: Shale + Facelets + Tomahawk [OT?]

2007-01-26 Thread Greg Reddin

On 1/26/07, Reynolds, James <[EMAIL PROTECTED]> wrote:


In the taglib
file, don't be tempted to list the actual path to the component in the
tomahawk jar.  Follow the  listed in the Facelets wiki



I had a feeling it had to do with the tomahawk taglib file.  Just so you
know we are using that same configuration with our app: MyFaces
1.1.5-SNAPSHOT, Tomahawk 1.1.5-SNAPSHOT, Facelets 1.1.10 and Shale 1.0.4.

Greg


Re: ADF faces with shale tiger

2007-01-26 Thread amjad Shahrour

You are right Gary, that was the cause. Thanks.

I am interested to learn more about the mapper configuration. can you point
me to a document about it.

regards,
amjad

On 1/26/07, Gary VanMatre <[EMAIL PROTECTED]> wrote:


>From: "amjad Shahrour" <[EMAIL PROTECTED]>
>
> Hi there,
>
> I am trying to utilize only shale-tiger with ADF faces.
>
> I am interested only in using only the view controller services
(callbacks).
> i created a simple (adf) jsf page and used the @View @Preprocess @Init
> @Prerender @Destroy on the page's backing bean. but nothing seems to
take
> effect (no callbacks are being called).
>

It sounds like you are missing the binding between a JSF view and a
managed bean.  This is handled by a naming convention.  The JSF viewId is
normalized into a value that must have a corresponding managed.

So if your target page was "/something.jsf", the ViewController should be
registered as a managed bean by the name of "something".  The default
mapper, removes the suffix of the viewId and replaces the "/" with "$".  You
can override the default mapper if you want to create your own rules.


Since your are using the tiger annotations (you also need shale-tiger
besides shale-view and shale-core), you could register your ViewControllers
as managed beans with the following annotation:

@Bean(name = "something", scope = Scope.REQUEST)


>
> following is the web.xml file content
>
>
>
> thanks in advance


Gary



Re: ADF faces with shale tiger

2007-01-26 Thread Gary VanMatre
>From: "amjad Shahrour" <[EMAIL PROTECTED]> 
>
> Hi there, 
> 
> I am trying to utilize only shale-tiger with ADF faces. 
> 
> I am interested only in using only the view controller services (callbacks). 
> i created a simple (adf) jsf page and used the @View @Preprocess @Init 
> @Prerender @Destroy on the page's backing bean. but nothing seems to take 
> effect (no callbacks are being called). 
> 

It sounds like you are missing the binding between a JSF view and a managed 
bean.  This is handled by a naming convention.  The JSF viewId is normalized 
into a value that must have a corresponding managed.  

So if your target page was "/something.jsf", the ViewController should be 
registered as a managed bean by the name of "something".  The default mapper, 
removes the suffix of the viewId and replaces the "/" with "$".  You can 
override the default mapper if you want to create your own rules.


Since your are using the tiger annotations (you also need shale-tiger besides 
shale-view and shale-core), you could register your ViewControllers as managed 
beans with the following annotation:

@Bean(name = "something", scope = Scope.REQUEST)


> 
> following is the web.xml file content 
> 
> 
> 
> thanks in advance 


Gary

Re: ADF faces with shale tiger

2007-01-26 Thread Craig McClanahan

On 1/26/07, amjad Shahrour <[EMAIL PROTECTED]> wrote:


Hi there,

I am trying to utilize only shale-tiger with ADF faces.

I am interested only in using only the view controller services
(callbacks).
i created a simple (adf) jsf page and used the @View @Preprocess @Init
@Prerender @Destroy on the page's backing bean. but nothing seems to take
effect (no callbacks are being called).



A couple of quick questions:

* Is the backing bean also registered as a managed bean in faces-config.xml?
 If not, you will also want to use the @Bean annotation.

* Does the name you assign the matching bean match the view id so that
 the matching algorithm will find it?

* Have you tried this with just standard components to temporarily reduce
 the complexity of all the stuff being combined?

Craig


following is the web.xml file content



> http://java.sun.com/xml/ns/j2ee";
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
>  version="2.4">
> Empty web.xml file for Web Application
>
>
>
> 
> javax.faces.STATE_SAVING_METHOD
> server
> 
> 
> oracle.adf.view.faces.USE_APPLICATION_VIEW_CACHE
> 
> false
> 
> 
> CpxFileName
> systemsettings.DataBindings
> 
>
>
>   
>
> 
> adfFaces
> oracle.adf.view.faces.webapp.AdfFacesFilter
> 
> 
> 
> adfBindings
> oracle.adf.model.servlet.ADFBindingFilter
> 
> 
> 
> CustomSecurityFilter
> com.openaspects.comms.commons.CustomSecurityFilter
> 
> 
>
>
> 
> shale
> 
> org.apache.shale.application.faces.ShaleApplicationFilter
> 
>   
>
>
>
>
>
>   
>
>
>
> 
> adfFaces
> faces
> 
> 
> adfBindings
> *.jsp
> 
> 
> adfBindings
> *.jspx
> 
> 
> CustomSecurityFilter
> faces
> 
>
>   
> shale
> /*
>   
>
>
> 
> faces
> javax.faces.webapp.FacesServlet
> 1
> 
> 
> resources
> oracle.adf.view.faces.webapp.ResourceServlet
> 
> 
> 
> faces
> /faces/*
> 
> 
> resources
> /adf/*
> 
> 
> 35
> 
> 
> html
> text/html
> 
> 
> txt
> text/plain
> 
>
> 
> 
>   org.apache.commons.chain.web.ChainListener
> 
>   
>
>
> 
> /index.jsp
>
>
> 
> java.lang.Exception
> /Error.jsp
> 
>
> 
>  Oracle Datasource example
>  jdbc/myoracle
>  javax.sql.DataSource
>  Container
> 
>
> 
>



Am I missing something ?


thanks in advance




ADF faces with shale tiger

2007-01-26 Thread amjad Shahrour

Hi there,

I am trying to utilize only shale-tiger with ADF faces.

I am interested only in using only the view controller services (callbacks).
i created a simple (adf) jsf page and used the @View @Preprocess @Init
@Prerender @Destroy on the page's backing bean. but nothing seems to take
effect (no callbacks are being called).


following is the web.xml file content



http://java.sun.com/xml/ns/j2ee";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
 version="2.4">
Empty web.xml file for Web Application




javax.faces.STATE_SAVING_METHOD
server


oracle.adf.view.faces.USE_APPLICATION_VIEW_CACHE

false


CpxFileName
systemsettings.DataBindings



  


adfFaces
oracle.adf.view.faces.webapp.AdfFacesFilter



adfBindings
oracle.adf.model.servlet.ADFBindingFilter



CustomSecurityFilter
com.openaspects.comms.commons.CustomSecurityFilter





shale

org.apache.shale.application.faces.ShaleApplicationFilter

  





  




adfFaces
faces


adfBindings
*.jsp


adfBindings
*.jspx


CustomSecurityFilter
faces


  
shale
/*
  



faces
javax.faces.webapp.FacesServlet
1


resources
oracle.adf.view.faces.webapp.ResourceServlet



faces
/faces/*


resources
/adf/*


35


html
text/html


txt
text/plain




  org.apache.commons.chain.web.ChainListener

  



/index.jsp
   


java.lang.Exception
/Error.jsp



 Oracle Datasource example
 jdbc/myoracle
 javax.sql.DataSource
 Container








Am I missing something ?


thanks in advance


RE: Shale + Facelets + Tomahawk [OT?]

2007-01-26 Thread Reynolds, James
Solved.

This isn't a Shale issue at all, but since I've already polluted the
mail archives with it, I may as well post the solution.  In the taglib
file, don't be tempted to list the actual path to the component in the
tomahawk jar.  Follow the  listed in the Facelets wiki
(I had changed it assuming that the path had changed in later releases).
In the case of the commandLink (that I was using for testing to get this
up and running), you must also include the .  That's the
portion missing from the Facelets wiki.  Here's what the tag should look
like.


commandLink

 
org.apache.myfaces.HtmlCommandLink
javax.faces.Link




-Original Message-
From: Reynolds, James [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 26, 2007 10:05 AM
To: user@shale.apache.org
Subject: Shale + Facelets + Tomahawk [OT?]

I'm having trouble configuring myfaces tomahawk components to work with
Facelets and I'm wondering if there is a conflict with Shale.  Is anyone
else using this combination successfully?

Based on instructions at the facelets wiki, this is what I've done so
far:

I've created a file named tomahawk.taglib.xml under /WEB-INF:

http://java.sun.com/dtd/facelet-taglib_1_0.dtd";>



http://myfaces.apache.org/tomahawk


commandLink

 
org.apache.myfaces.component.html.ext.HtmlCommandLink

org.apache.myfaces.renderkit.html.HtmlLinkRenderer




I've registered the file in my web.xml:
...

facelets.LIBRARIES
/WEB-INF/tomahawk.taglib.xml

...

I've referenced the namespace declared in the taglib file in the root
html element of my page as such:
xmlns:t="http://myfaces.apache.org/tomahawk";

Is there something else I need to do on the Shale side to make this
work?

Thanks





E-Mail messages may contain viruses, worms, or other malicious code. By
reading the message and opening any attachments, the recipient accepts
full responsibility for taking protective action against such code.
Sender is not liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee(s). Access to this
e-mail by anyone else is unauthorized.






E-Mail messages may contain viruses, worms, or other malicious code. By reading 
the message and opening any attachments, the recipient accepts full 
responsibility for taking protective action against such code. Sender is not 
liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally privileged. 
It is intended solely for the addressee(s). Access to this e-mail by anyone 
else is unauthorized.



Re: How to end a SCXML dialog in an action?

2007-01-26 Thread Rahul Akolkar

On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

Rahul Akolkar wrote:



>
> As mentioned above, that would be inside the method called by the MB,
> if at all we wanted to stop an active dialog and delegate to the
> faces-config navigation.
>

What is the name of the method, or where do I configure it, that is
called when the outcome, does is not configured?

In the above example page's header/footer define the outcomes "home",
"logout", and "menu".  These outcomes are currently handled by
faces-config.xml, and I agree with your statement about avoiding the
modeling of "global" site navigation in each dialog.




Lets say outcome "home" is actually a commandLink, so simplistically:



This, by itself, would mess with an active dialog. Instead:



would ensure that we clean up correctly if there is an active dialog, where:

// In the managed bean "globals" --

public String home() {

 stopActiveDialogIfAny(); // the two lines of code from before

 return "home";  // faces-config nav rules takes over here
}

Similarly for "logout" and "menu". Also may want to check with user
via onclick or suitable event handlers before wiping out the dialog.

-Rahul


Re: How to display exception thrown by beans during a dialog?

2007-01-26 Thread Rahul Akolkar

On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

Rahul,
So, if I want to display information from the exception to the user:
1) I need to maintain the exception in the bean, #{venderDialog}.
2) The view displaying the exception would reference a property in the
bean, #{venderDialog.caughtException}?




I meant "com.foo.Vendor" in your earlier example below:


 


This is because:

* The dialog data is maintained for us, so we don't need to worry
about scoping, the information will exist for as long as the dialog is
active, and no more than that

* IMO, if the exception message (or some other bits) are meaningful
to the user interaction, then the message (or other bits) belong to
the location where we store all data associated with the user
interaction (such as form field values etc.)

Probably the easiest way to populate the dialog data in v1.0.4 is by
setting the value on the appropriate ValueBinding expression, i.e.
updated snippet:

} catch (NotConfiguredException nce) {
FacesContext ctx = FacesContext.getCurrentInstance();
 ValueBinding vb = ctx.getApplication().
 createValueBinding("#{dialog.data.cfgErrMsg}"); // or a
better prop name
 vb.setValue(ctx, nce.getMessage());
 return "notconfigured";
}

Again, the DialogHelper will help eliminate the grunt work [1] of the
catch block in future releases.

Whereby in the subsequent view (for "vendor/noconfig" state ID), we can have:



-Rahul

[1] https://issues.apache.org/struts/browse/SHALE-401




public class VendorDialog
{
   private Exception caughtException;
   // ..

  public String setup() { // no throws clause

   // ...

   try {
 // line(s) that can throw NotConfiguredException
   } catch (NotConfiguredException nce) {
 caughtException = nce;
 return "notconfigured";
   }

   // ...

   return "success";

  }
  Exception getCaughtException()
  {
return caughtException;
  }
}


Thank you,

Paul Spencer





RE: setting rowStyleClass

2007-01-26 Thread Gary VanMatre
>From: "Ian.Priest" <[EMAIL PROTECTED]> 
>
> See https://issues.apache.org/jira/browse/TOMAHAWK-523 for problem and 
> work-around. 
> 

Hey, what do you know, facelets has the same problem :--).  Thanks for 
reporting the work around.


> Cheers, 
> Ian. 
> 

Gary

> 
> > -Original Message- 
> > From: Ian.Priest [mailto:[EMAIL PROTECTED] 
> > Sent: 26 January 2007 15:30 
> > To: user@shale.apache.org 
> > Subject: setting rowStyleClass 
> > 
> > Hi, 
> > 
> > 
> > 
> > I seem to have an error when setting the rowStyleClass attribute of a 
> > table. I'm trying to set the row class dynamically so I can have 
> > certain 
> > rows highlighted based on a bean variable. Here's my widget, which 
> > extends MyFaces Tomahawk DataTable: 
> > 
> > 
> > 
> > > > allowBody="false"> 
> > 
> > 
> > 
> > > > value="[EMAIL PROTECTED]" /> 
> > 
> > 
> > 
> > ... 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > But no class at all is set in the rendered table. Viewing page source 
> > of the final page gives: 
> > 
> > 
> > 
> > ... 
> > 
> > ... 
> > 
> > ... 
> > 
> > 
> > 
> > If I try to set a rowStyleClass in my html as follows (I also remove 
> > the 
> > ref to rowStyleClass in the widget): 
> > 
> > 
> > 
> > 

> > 
> > 
> > 
> > All I get is an empty class declaration in my tag: 
> > 
> > 
> > 
> > 
... 
> > 
> > Has anyone managed to get this working? 
> > 
> > 
> > 
> > Cheers, 
> > 
> > Ian. 
> > 
> > 
> 
> 

RE: Shale + Facelets + Tomahawk [OT?]

2007-01-26 Thread Reynolds, James
I do have that setting and I should mention that Facelets + Shale are
working great together.  The problem I'm having is only with the
addition of myfaces tomahawk.  In the absence of any obvious conflict,
I'll run off to bother the myfaces mailing list for a change :)

Thanks for the suggestion and have a great day!


On 1/26/07, Reynolds, James <[EMAIL PROTECTED]> wrote:
>
> I'm having trouble configuring myfaces tomahawk components to work
with
> Facelets and I'm wondering if there is a conflict with Shale.  Is
anyone
> else using this combination successfully?


I've seen people say they did, but can't point directly at a mail thread
for
you.

One critical link for Facelets to work is setting the "default suffix"
context init parameter.  Did you do that as well?


javax.faces.DEFAULT_SUFFIX
.xhtml 


Without this setting, JSF is going to assume the extension is ".jsp"

Craig

Based on instructions at the facelets wiki, this is what I've done so
> far:
>
> I've created a file named tomahawk.taglib.xml under /WEB-INF:
> 
>"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
>   "http://java.sun.com/dtd/facelet-taglib_1_0.dtd";>
>
> 
> 
> http://myfaces.apache.org/tomahawk
>
> 
> commandLink
> 
>
>
org.apache.myfaces.component.html.ext.HtmlCommandLink omponent-type>
>
>
org.apache.myfaces.renderkit.html.HtmlLinkRenderer rer-type>
> 
> 
> 
>
> I've registered the file in my web.xml:
> ...
> 
> facelets.LIBRARIES
> /WEB-INF/tomahawk.taglib.xml
> 
> ...
>
> I've referenced the namespace declared in the taglib file in the root
> html element of my page as such:
> xmlns:t="http://myfaces.apache.org/tomahawk";
>
> Is there something else I need to do on the Shale side to make this
> work?
>
> Thanks
>
>
>
>
>
> E-Mail messages may contain viruses, worms, or other malicious code.
By
> reading the message and opening any attachments, the recipient accepts
full
> responsibility for taking protective action against such code. Sender
is not
> liable for any loss or damage arising from this message.
>
> The information in this e-mail is confidential and may be legally
> privileged. It is intended solely for the addressee(s). Access to this
> e-mail by anyone else is unauthorized.
>
>





E-Mail messages may contain viruses, worms, or other malicious code. By reading 
the message and opening any attachments, the recipient accepts full 
responsibility for taking protective action against such code. Sender is not 
liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally privileged. 
It is intended solely for the addressee(s). Access to this e-mail by anyone 
else is unauthorized.



Re: Shale + Facelets + Tomahawk [OT?]

2007-01-26 Thread Craig McClanahan

On 1/26/07, Reynolds, James <[EMAIL PROTECTED]> wrote:


I'm having trouble configuring myfaces tomahawk components to work with
Facelets and I'm wondering if there is a conflict with Shale.  Is anyone
else using this combination successfully?



I've seen people say they did, but can't point directly at a mail thread for
you.

One critical link for Facelets to work is setting the "default suffix"
context init parameter.  Did you do that as well?

   
   javax.faces.DEFAULT_SUFFIX
   .xhtml 
   

Without this setting, JSF is going to assume the extension is ".jsp".

Craig

Based on instructions at the facelets wiki, this is what I've done so

far:

I've created a file named tomahawk.taglib.xml under /WEB-INF:

http://java.sun.com/dtd/facelet-taglib_1_0.dtd";>



http://myfaces.apache.org/tomahawk


commandLink


org.apache.myfaces.component.html.ext.HtmlCommandLink

org.apache.myfaces.renderkit.html.HtmlLinkRenderer




I've registered the file in my web.xml:
...

facelets.LIBRARIES
/WEB-INF/tomahawk.taglib.xml

...

I've referenced the namespace declared in the taglib file in the root
html element of my page as such:
xmlns:t="http://myfaces.apache.org/tomahawk";

Is there something else I need to do on the Shale side to make this
work?

Thanks





E-Mail messages may contain viruses, worms, or other malicious code. By
reading the message and opening any attachments, the recipient accepts full
responsibility for taking protective action against such code. Sender is not
liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee(s). Access to this
e-mail by anyone else is unauthorized.




RE: setting rowStyleClass

2007-01-26 Thread Ian.Priest
See https://issues.apache.org/jira/browse/TOMAHAWK-523 for problem and
work-around.

Cheers,
Ian.


> -Original Message-
> From: Ian.Priest [mailto:[EMAIL PROTECTED]
> Sent: 26 January 2007 15:30
> To: user@shale.apache.org
> Subject: setting rowStyleClass
> 
> Hi,
> 
> 
> 
> I seem to have an error when setting the rowStyleClass attribute of a
> table. I'm trying to set the row class dynamically so I can have
> certain
> rows highlighted based on a bean variable. Here's my widget, which
> extends MyFaces Tomahawk DataTable:
> 
> 
> 
>allowBody="false">
> 
> 
> 
>value="[EMAIL PROTECTED]" />
> 
>   
> 
>   ...
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
> But no class at all is set  in the rendered table. Viewing page source
> of the final page gives:
> 
> 
> 
> ...
> 
> ...
> 
> ...
> 
> 
> 
> If I try to set a rowStyleClass in my html as follows (I also remove
> the
> ref to rowStyleClass in the widget):
> 
> 
> 
>   
> 
> 
> 
> All I get is an empty class declaration in my  tag:
> 
> 
> 
> ...
> 
> Has anyone managed to get this working?
> 
> 
> 
> Cheers,
> 
> Ian.
> 
> 




Shale + Facelets + Tomahawk [OT?]

2007-01-26 Thread Reynolds, James
I'm having trouble configuring myfaces tomahawk components to work with
Facelets and I'm wondering if there is a conflict with Shale.  Is anyone
else using this combination successfully?

Based on instructions at the facelets wiki, this is what I've done so
far:

I've created a file named tomahawk.taglib.xml under /WEB-INF:

http://java.sun.com/dtd/facelet-taglib_1_0.dtd";>



http://myfaces.apache.org/tomahawk


commandLink

 
org.apache.myfaces.component.html.ext.HtmlCommandLink

org.apache.myfaces.renderkit.html.HtmlLinkRenderer




I've registered the file in my web.xml:
...

facelets.LIBRARIES
/WEB-INF/tomahawk.taglib.xml

...

I've referenced the namespace declared in the taglib file in the root
html element of my page as such:
xmlns:t="http://myfaces.apache.org/tomahawk";

Is there something else I need to do on the Shale side to make this
work?

Thanks





E-Mail messages may contain viruses, worms, or other malicious code. By reading 
the message and opening any attachments, the recipient accepts full 
responsibility for taking protective action against such code. Sender is not 
liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally privileged. 
It is intended solely for the addressee(s). Access to this e-mail by anyone 
else is unauthorized.



Re: How to end a SCXML dialog in an action?

2007-01-26 Thread Paul Spencer

Rahul Akolkar wrote:

On 1/25/07, Paul Spencer <[EMAIL PROTECTED]> wrote:




Thanks for taking time to draw this out, heres the body of the
untested addVendor.xml file (I've folded most of the view IDs into the
state IDs but its possible to use  custom action if we
don't want to):

http://www.w3.org/2005/07/scxml"; version="1.0"
  xmlns:shale="http://shale.apache.org/dialog-scxml";
  initialstate="editVendor_1">



 

 





 

 





 

 




 
 
  

 





Note that we did not use faces-config navigation here, which is
probably for the good since the entire page flow for this task is now
captured in this model.



Where does the code you mentioned below go and how is it called?




As mentioned above, that would be inside the method called by the MB,
if at all we wanted to stop an active dialog and delegate to the
faces-config navigation.



What is the name of the method, or where do I configure it, that is 
called when the outcome, does is not configured?


In the above example page's header/footer define the outcomes "home", 
"logout", and "menu".  These outcomes are currently handled by 
faces-config.xml, and I agree with your statement about avoiding the 
modeling of "global" site navigation in each dialog.



-Rahul




Paul Spencer


Re: How to display exception thrown by beans during a dialog?

2007-01-26 Thread Paul Spencer

Rahul,
So, if I want to display information from the exception to the user:
1) I need to maintain the exception in the bean, #{venderDialog}.
2) The view displaying the exception would reference a property in the
   bean, #{venderDialog.caughtException}?


public class VendorDialog
{
  private Exception caughtException;
  // ..

 public String setup() { // no throws clause

  // ...

  try {
// line(s) that can throw NotConfiguredException
  } catch (NotConfiguredException nce) {
caughtException = nce;
return "notconfigured";
  }

  // ...

  return "success";

 }
 Exception getCaughtException()
 {
   return caughtException;
 }
}


Thank you,

Paul Spencer


Rahul Akolkar wrote:

On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

I would like to display exception thrown by a managed bean during a
dialog to the user. How do I configure this?

As example:
   
 
   
 
 
   

vendorDialog.setup() can throw a NotConfiguredException.

1) I want to show this to the user.
2) I would also like to define the view that will display the exception.
3) In the above view, what is the bean/variable containing the thrown
exception?




An exception out of a MBE execution is merely yet another logical
outcome for the dialog state machine and should be treated as such.
IMO, introducing Java exception specific constructs into the dialog
description is a bit of a leaky abstraction since it muddys up the
modeling layer and state machine code generation etc. (for those who
care about that). So, for the simplest case, I would author the setup
method like so:

public String setup() { // no throws clause

 // ...

 try {
   // line(s) that can throw NotConfiguredException
 } catch (NotConfiguredException nce) {
   return "notconfigured";
 }

 // ...

 return "success";

}

whereby the flow markup is:



 
   
 

 

 



Note that by returning the NotConfiguredException as a logical outcome
we did lose actual Throwable instance (which might hold needed
information), but:
(a) Its arguable whether we need to display things like the trace to the 
user

(b) We can always use dialog data to hold on to that bit, if its
needed by the subsequent view etc.

-Rahul




Paul Spencer








Re: How to display exception thrown by beans during a dialog?

2007-01-26 Thread Rahul Akolkar

On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

I would like to display exception thrown by a managed bean during a
dialog to the user. How do I configure this?

As example:
   
 
   
 
 
   

vendorDialog.setup() can throw a NotConfiguredException.

1) I want to show this to the user.
2) I would also like to define the view that will display the exception.
3) In the above view, what is the bean/variable containing the thrown
exception?




An exception out of a MBE execution is merely yet another logical
outcome for the dialog state machine and should be treated as such.
IMO, introducing Java exception specific constructs into the dialog
description is a bit of a leaky abstraction since it muddys up the
modeling layer and state machine code generation etc. (for those who
care about that). So, for the simplest case, I would author the setup
method like so:

public String setup() { // no throws clause

 // ...

 try {
   // line(s) that can throw NotConfiguredException
 } catch (NotConfiguredException nce) {
   return "notconfigured";
 }

 // ...

 return "success";

}

whereby the flow markup is:



 
   
 

 

 



Note that by returning the NotConfiguredException as a logical outcome
we did lose actual Throwable instance (which might hold needed
information), but:
(a) Its arguable whether we need to display things like the trace to the user
(b) We can always use dialog data to hold on to that bit, if its
needed by the subsequent view etc.

-Rahul




Paul Spencer




Re: How to end a SCXML dialog in an action?

2007-01-26 Thread Rahul Akolkar

On 1/25/07, Paul Spencer <[EMAIL PROTECTED]> wrote:



3) stateId = "save"
Execute the action #{vendorDialog.save}




Just noticed that "save" is an action state, and not a view state so
that bit will need to be modified in the SCXML config posted in the
earlier message.

-Rahul



OutcomeNext state
   ---
successend
failurestart





setting rowStyleClass

2007-01-26 Thread Ian.Priest
Hi,

 

I seem to have an error when setting the rowStyleClass attribute of a
table. I'm trying to set the row class dynamically so I can have certain
rows highlighted based on a bean variable. Here's my widget, which
extends MyFaces Tomahawk DataTable:

 

  



  

  

  ...

  



 











  

 

But no class at all is set  in the rendered table. Viewing page source
of the final page gives:

 

...

...

...

 

If I try to set a rowStyleClass in my html as follows (I also remove the
ref to rowStyleClass in the widget):

 

  

 

All I get is an empty class declaration in my  tag:

 

...
 
Has anyone managed to get this working?

 

Cheers,

Ian.

 



Re: How to end a SCXML dialog in an action?

2007-01-26 Thread Rahul Akolkar

On 1/25/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

Rahul,
I do not completely follow you answer.




Let me take a quick detour, I'll come back to your specific questions
in a paragraph. Generally speaking, a dialog is meant to be a complete
model of the page flow for the task at hand, and shouldn't be
interlaced with any delegation to the faces-config.xml nav rules.
However, there are cases such as a site navigation menu bar that might
be part of the header / footer etc. for consistent site L&F, wherein
for a better separation of concerns for all the flows one may want
avoid modeling these "global" site navigation links into each dialog.
The code snippet I provided in the last message was meant to be for
such a scenario, where the "action" attribute of these header / footer
menu links has a MB expression which first stop()s the active dialog,
if it finds one, and subsequently can rely on nav rules in the
faces-config to render the appropriate view knowing that the dialog
has been properly terminated.



Assume the following:

1) stateId = "start"
Display the view /editVendor_1

OutcomeNext state
   ---
successpage2
cancel end

2) stateId = "page2"
Display the view /editVendor_2

OutcomeNext state
   ---
successsave
cancel end

3) stateId = "save"
Execute the action #{vendorDialog.save}

OutcomeNext state
   ---
successend
failurestart

4) End state stateId = "end"
Execute the action #{vendorManager.listAllVendors}.  faces-config.xml
will take over form here.

5) dialog-config.xml

   


6) Using Shale 1.0.4


What does the dialog's scxml file look like?




Thanks for taking time to draw this out, heres the body of the
untested addVendor.xml file (I've folded most of the view IDs into the
state IDs but its possible to use  custom action if we
don't want to):

http://www.w3.org/2005/07/scxml"; version="1.0"
  xmlns:shale="http://shale.apache.org/dialog-scxml";
  initialstate="editVendor_1">



 

 





 

 





 

 




 
 
  

 





Note that we did not use faces-config navigation here, which is
probably for the good since the entire page flow for this task is now
captured in this model.



Where does the code you mentioned below go and how is it called?




As mentioned above, that would be inside the method called by the MB,
if at all we wanted to stop an active dialog and delegate to the
faces-config navigation.

-Rahul





Paul Spencer

Rahul Akolkar wrote:
> On 1/25/07, Paul Spencer <[EMAIL PROTECTED]> wrote:
>> I have a dialog that adds a vendor. If the dialog successfully add the
>> vendor, or the dialog is canceled, then I want to end the dialog with a
>> call to the action #{vendorManager.listAllVendors}.  The view to display
>> upon the completion of the action is configured in faces-config.xml.
>> How to do I configure this ?
>>
> 
>
> For v1.0.4, this requires a bit of knowledge of the internals (the
> recent DialogHelper addition to trunk really simplifies this ;-).
> Knowing that the active DialogContext is stored as a request-scoped
> attribute with key Constants.CONTEXT_BEAN, its possible to end the
> dialog like so:
>
> 
>
> DialogContext dcontext = (DialogContext)
> FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get


(Constants.CONTEXT_BEAN);

>
>
> dcontext.stop();
>
> 
>
> You can guard the stop() with a not null and isActive() predicate, if
> deemed necessary. The good thing is this will also do the necessary
> book-keeping cleanup associated with the DialogContextManager for you.
> Assumes the view displayed (via the faces-config nav rule) is not part
> of any dialog at that point.
>
> -Rahul
>
>
>> Paul Spencer
>>
>




How to display exception thrown by beans during a dialog?

2007-01-26 Thread Paul Spencer
I would like to display exception thrown by a managed bean during a 
dialog to the user. How do I configure this?


As example:
  

  


  

vendorDialog.setup() can throw a NotConfiguredException.

1) I want to show this to the user.
2) I would also like to define the view that will display the exception.
3) In the above view, what is the bean/variable containing the thrown 
exception?



Paul Spencer