i created a class to hold Menu MetaData like:
public class MenuXItem implements Serializable{
private String tooltip;
private String description;
private Class pageClass;
private boolean externalLink;
private String externalUrl;
}
I can create that in a List and add to the main MenuBar component and where i loved the flexibility of wicket was when with ease i was able to dynamically determine the MenuItem that is selected by the user by doing this somewhere in my menubar impl:
MenuXItem xitem = (MenuXItem) listItem.getModelObject();
if(MenuXBar.this.getPage().getClass() == xitem.getPageClass()){
//so that here i can customize the link of the selected active page
dislink = new Link("dashMenuId") {
@Override
public void onClick() {
}
public boolean isEnabled() {
return false;
}
};
dislink.add(menuDescribe);
menuCan.add(dislink);
menuItem.add (menuCan);
menuCan.add(new AttributeModifier("class",true, new Model("selected_cell")));
menuItem.add(new AttributeModifier("class",true, new Model("selected_menu")));
} else{
//and here other Menu items can render
menuLink = new PageLink("dashMenuId", new IPageLink() {
public Page getPage() {
try {
Class page = xitem.getPage();
Object pobj = page.newInstance();
return (Page)pobj;
} catch (InstantiationException ex) {
ex.printStackTrace ();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
}
return null;
}
public Class getPageIdentity() {
return xitem.getPage();
}
});
The result was just boom!
I love wicket
On 10/5/06, Igor Vaynberg <
[EMAIL PROTECTED]> wrote:
awesome, keep it up.
-IgorOn 10/3/06, Stefan Lindner < [EMAIL PROTECTED]> wrote:I have uploaded a first initial implementation of a menu bar to https://svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-extensions-menubar <https://svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-extensions-menubar >-------------------------------------------------------------------------
Please not the following items
1. Only one menu bar per page
2. Currently 3 types of links supported
3. Example code in MenuBarPanel's javadoc
Ejoy it and tell me about your experience
Stefan Lindner
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Aladejebi Ayodeji A.,
DabarObjects Solutions
Email: [EMAIL PROTECTED]
Mobile: +234 803 589 1780
Web: www.dabarobjects.com
Blog: blog.dabarobjects.com
Community:
www.cowblock.net
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
