You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joe123 --- <jp...@hotmail.com> on 2008/12/13 15:36:40 UTC

Usage of ApllicationState Object

Hello

I have a question about the usage of an ApplicationState object.

Can I use the @ApplicationState only in the com.application.tapestry.components and com.application.tapestry.pages packages?

Or is it also valid in for example com.application.tapestry.beans package?

Because I have an ConversationManagerImpl class the isConversationsExists()  always returns false.
When I call conversationManager.startConversation(..) it prints false.

package com.application.tapestry.beans
public class ConversationManagerImpl implements ConversationManager {

    @ApplicationState(create=false)
    private Conversations conversations;
    
    private boolean conversationsExists;
    
     public boolean isConversationsExists() {
         return conversationsExists;
     }

     public String startConversation(Object target) {
          if(!conversationsExists) {
              conversations = new Conversations();
          }
          System.out.println("conversation exists: " + isConversationsExists());
      }


_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

Re: Usage of ApllicationState Object

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sat, 13 Dec 2008 11:48:23 -0300, Martijn Brinkers  
<ma...@gmail.com> escreveu:

> afaik you can only use ASO's from pages, components, mixins or base
> packages.

That's absolutely correct for the @ApplicationState annotation, but you  
can still get and set ASO values using the ApplicationStateManager service.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: Usage of ApllicationState Object

Posted by Martijn Brinkers <ma...@gmail.com>.
afaik you can only use ASO's from pages, components, mixins or base
packages. 

(from http://tapestry.apache.org/tapestry5/guide/component-classes.html)

"Component classes must exist within an appropriate package (this is
necessary for runtime code transformation and class reloading to
operate).

These packages exist under the application's root package.

For pages, place classes in root.pages. Page names are mapped to classes
within this package.

For components, place classes in root.components. Component types are
mapped to classes within this package.

For mixins, place classes in root.mixins. Mixin types are mapped to
classes within this package.

In addition, it is common for an application to have base classes, often
abstract base classes, that should not be directly referenced. These
should not go in the pages, components or mixins packages, because they
then look like valid pages, components or mixins. Instead, use the
root.base package to store such base classes."


Martijn

On Sat, 2008-12-13 at 14:36 +0000, Joe123 --- wrote:
> Hello
> 
> I have a question about the usage of an ApplicationState object.
> 
> Can I use the @ApplicationState only in the com.application.tapestry.components and com.application.tapestry.pages packages?
> 
> Or is it also valid in for example com.application.tapestry.beans package?
> 
> Because I have an ConversationManagerImpl class the isConversationsExists()  always returns false.
> When I call conversationManager.startConversation(..) it prints false.
> 
> package com.application.tapestry.beans
> public class ConversationManagerImpl implements ConversationManager {
> 
>     @ApplicationState(create=false)
>     private Conversations conversations;
>     
>     private boolean conversationsExists;
>     
>      public boolean isConversationsExists() {
>          return conversationsExists;
>      }
> 
>      public String startConversation(Object target) {
>           if(!conversationsExists) {
>               conversations = new Conversations();
>           }
>           System.out.println("conversation exists: " + isConversationsExists());
>       }
> 
> 
> _________________________________________________________________
> Connect to the next generation of MSN Messenger 
> http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline


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