turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oki DZ <ok...@pindad.com>
Subject Re: Newbie Stateful Navigation Question
Date Fri, 03 Aug 2001 02:00:10 GMT
On Mon, 30 Jul 2001, Jonathan Kaplan wrote:
> What is the best way to implement this with regard to layout and
> navigation and/or actions?  Here is my (very newbie) thought process: It
> seems to me that my navigation choices should be cooked up as URIs to
> actions.  That way, on a navigation event I can adjust the state of the
> app though the context.  Then, during the the rendering of the vm, I can
> make visual adjustments based on the state I set.

You can save users' states regarding navigations by creating your own
class loaders. Basically, Turbine puts the layouts, navigations, screens
in their respective caches. So, my basic thinking was that if you put the
users' sessionIDs along with the names of those objects, then you'd
retrieve the users' states when you retrieved the object from the cache.

The following is some snippet code for implementing a layout loader which
uses sessionIDs for differentiating between somebody's layout with the
other ones:

public class SyslinuxLayoutLoader extends GenericLoader {
    private static SyslinuxLayoutLoader instance = null;
    private Vector packages;

    private SyslinuxLayoutLoader() {
        super();        
    }
    
    private SyslinuxLayoutLoader(int i) {
        super(i);
    }

    private void addInstance(RunData data, String name, SyslinuxLayout
layout) {        this.put(name+getSessionId(data), layout);
    }

    public void exec(RunData data, String name) throws Exception {
        getInstance(data, name).build(data);
    }

    public SyslinuxLayout getInstance(RunData data, String name) 
        throws Exception {
        SyslinuxLayout layout = null;
        String key = name+getSessionId(data);
//...

You'd have to do the same thing for navigations and screens.  This might
not be the best way (as you asked), but it works. BTW, I implemented my
web app mostly using DynamicURIs and ECS screens/navigations/layouts. I
don't know whether this way would work if the screens were templates. It
should be working I believe. By using templates, there would be a lot of
memory that could be saved. If the screens were ECS, then all the objects
would quickly fill-up the caches. 

Oki



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Mime
View raw message