Hi Thiago,

> Hi Hammer! :)
Friends call me nille.

> Hey! That's my open source code being used by someone besides me! Nice. :D
Just trying to learn from the masters ;-)

> .Maybe the solution to what you want to do is to use  
> ApplicationStateManager directly.
That's the trick! Thinking about your hint I rewrote GenericEntityPage<T> a 
bit. Code follows:

public abstract class GenericEntityPage<T> extends AbstractPage {
        @Inject
        private ApplicationStateManager manager;

        public T getValue() {
                return this.manager.get(this.getValueClass());
        }

        protected void setValue(final T value ) {
                this.manager.set(this.getValueClass(), value);
        }

        public boolean isValueExists() {
                return this.manager.exists(this.getValueClass());
        }

        @OnEvent(value = EventConstants.ACTIVATE)
        Object checkValueExists() {
                if (!this.isValueExists()) {
                        return this.getForwardPage();
                }
                else {
                        return null;
                }
        }

        /**
         * @return the page to be forwarded to in case value does not exist as 
SSO
         */
        protected abstract Object getForwardPage();

        /**
         * @return the value's class in the implementing page
         */
        protected abstract Class<T> getValueClass();
}

Now it works like a charm.   Muitíssimo obrigado for putting me on the right 
track.
nillehammer

==
http://www.winfonet.eu

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

Reply via email to