Hi again Matt et al,

On 15 Feb 2008 at 20:41, Rob Hills wrote:

> On 14 Feb 2008 at 9:29, Matt Raible wrote:
> > On Feb 14, 2008, at 9:24 AM, Rob Hills wrote:
> > >> BTW, is it possible to have the main part of the menu in the  
> > >> Application (as it is currently) and then a submenu in the  
> > >> Session?  Does the <menu:displayMenu> tag just hunt through the  
> > >> first repository it finds, or can it be pointed at a different  
> > >> repository?
> > > Just to clarify this question a bit further - from what you said, I  
> > > can pull a bunch of menu items inside a useMenuDisplayerTag with a  
> > > "repository" attribute, but I guess I was wondering if the  
> > > "repository" attribute might be able to be used in the displayMenu  
> > > tag - it would be pretty cool to be able to pull the common parts  
> > > of the menu from the Application and the user-specific bits from  
> > > the session, via a "repository" attribute in each displayMenu tag.
> > 
> > This feature is currently unsupported. However, you could grab the  
> > repository in a filter and re-build it with the stock+custom version.

<..>

> AFAICT, the steps involved go something like this:  
> 
> 1. Trap the user login event in my ApplicationListener class 
> 2. At the time of login, make a copy of the Application menuRepository in the 
> App context and put the copy into the session.
> 3. Add the required items to the session copy of the MenuRepository.
> 
> I've done 1 and 3 OK.  WRT step 2, I believe I need to copy the 
> MenuRepository object as otherwise when I put it in the session, 
> that's just a pointer to the original object in the App Context and any mods 
> I make to it will affect the whole app.  I've looked at the 
> javadoc and it appears the only way I can copy the object is to troll 
> through, recursively copying menu items and attributes.  Is 
> there any other way I've not discovered (or any cool new Java trick to do a 
> complete deep copy of any object)?

Well, I searched for stuff about Java and Deep Copy and came across the 
following which I thought looked promising:
http://javatechniques.com/public/java/docs/basics/faster-deep-copy.html

However, unfortunately after implementing it, I found that something inside 
MenuRepository is not Serializable and my 
deepcopy method threw a java.io.NotSerializableException.

Maybe it would be easier to read the menu.xml in again from the file.  I just 
took a look at the source for MenuLoader and it 
looks pretty straightforward to load a menu from the file, so I'll try that.

Cheers,
Rob Hills
Waikiki, Western Australia
Mobile +61 (412) 904-357
Fax: +61 (8) 9529-2137


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

Reply via email to