It is possible, I implemented my own persistence strategy which uses 
DataSqueezer and it was pretty straightforward. You'll need a persistence scope 
as well - look at the Form persistence in the wiki to see how you should wire 
things together. This "squeeze" strategy combined with the HibernateSqueezer 
really simplified things for me.

public class SqueezerPersistenceStrategy
        extends ClientPropertyPersistenceStrategy
{
        private DataSqueezer squeezer;

        public SqueezerPersistenceStrategy(DataSqueezer squeezer)
        {
                this.squeezer = squeezer;
        }

        @Override
        public void store(String pageName, String idPath, String propertyName, 
Object newValue)
        {
                String squeezedString = squeezer.squeeze(newValue);
                super.store(pageName, idPath, propertyName, squeezedString);
        }

        @Override
        public Collection getStoredChanges(String pageName)
        {
                Collection<Object> result = new LinkedList<Object>();
                for (Object object : super.getStoredChanges(pageName))
                {
                        PropertyChange change = (PropertyChange) object;
                        String squeezedString = change.getNewValue().toString();
                        Object unsqueezed = squeezer.unsqueeze(squeezedString);
                        change = new 
PropertyChangeImpl(change.getComponentPath(), change.getPropertyName(), 
unsqueezed);
                        result.add(change);
                }
                return result;
        }
}


On Wed, 20 Sep 2006 01:21:49 +0200, Sam Gendler <[EMAIL PROTECTED]> wrote:

> On 9/19/06, Martin Strand <[EMAIL PROTECTED]> wrote:
>> The client persistence strategy doesn't use DataSqueezer:
>> https://issues.apache.org/jira/browse/TAPESTRY-738
>>
>
> That's unfortunate.  I suppose one could persist them yourself using
> hidden fields, at least in simple cases.  I just assumed that client
> persistence would use the same mechanisms as putting an object in a
> form.  I find it odd that it doesn't, really.  Actually, now that I
> think about it, didn't I read somewhere that it is possible to
> implement your own persistence strategies and tie them into tapestry
> via hivemind? If so, in the worst case, I guess you could grab the
> client persistence code out of the tapestry source and inject a
> modified strategy into your app.  Assuming that I'm correct about the
> possibility of doing this, anyway.
>
> --sam

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to