Re: problem with menu
Mathias P.W Nilsson wrote: Thanks alot. It worked now. inspired by suckerFishPanel this is what I came up with No problem..:) class NavigationMenuItem{ public static final String LINK_ID = "link"; private final AbstractLink link; private final Label label; public static final String LINK_TEXT_ID = "linktext"; public NavigationMenuItem(final AbstractLink link, final String strLabel, boolean active) { if (link != null && !link.getId().equals(LINK_ID)) { throw new IllegalArgumentException( "The id must be NavigationMenuItem.LINK_ID"); } this.link = link; this.label = new Label(LINK_TEXT_ID, strLabel); if( active ) this.link.add(new AttributeModifier("class", true, new Model( "navigationLinkSelected" ))); this.link.add(this.label); } public NavigationMenuItem(final AbstractLink link, final String strLabel) { this( link , strLabel, false ); } public Label getLabel(){ return this.label; } public AbstractLink getLink(){ return this.link; } } My problem here is the active flag. If a link is active I want to set background etc. But I really against setting a hard coded attribute in code. Is this really the way of doing this. Yeah I feel you, I thought of that aswell but didnt come up with anything... I think it is the only way, how else should wicket know about which kind of class etc you are using for active? -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with menu
Thanks alot. It worked now. inspired by suckerFishPanel this is what I came up with class NavigationMenuItem{ public static final String LINK_ID = "link"; private final AbstractLink link; private final Label label; public static final String LINK_TEXT_ID = "linktext"; public NavigationMenuItem(final AbstractLink link, final String strLabel, boolean active) { if (link != null && !link.getId().equals(LINK_ID)) { throw new IllegalArgumentException( "The id must be NavigationMenuItem.LINK_ID"); } this.link = link; this.label = new Label(LINK_TEXT_ID, strLabel); if( active ) this.link.add(new AttributeModifier("class", true, new Model( "navigationLinkSelected" ))); this.link.add(this.label); } public NavigationMenuItem(final AbstractLink link, final String strLabel) { this( link , strLabel, false ); } public Label getLabel(){ return this.label; } public AbstractLink getLink(){ return this.link; } } My problem here is the active flag. If a link is active I want to set background etc. But I really against setting a hard coded attribute in code. Is this really the way of doing this. -- View this message in context: http://www.nabble.com/problem-with-menu-tp16700154p16720986.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with menu
You can do it like this(pseudo): html(parent): -- Header -- footer -- java: parentPage extends page... private List menuItems; protected const String linkId="myLink" public void addMenuitem(Link link) { menuItems.add(link); } parentPage(){ Listview listofLinks()=new Listview(menuItems){populateItems(item){ item.add( item.getModelObject) }} add(header) add(footer) } Java ChildPage extends parentPage public ChildPage(){ addMenuItem(new Link(linkId){onclick...}) } As for header or footer, I'd suggest that you provide defaults(method returning true/false), and then you can override them if you want to... Remember to use the wicket:extend if your child page brings markup... Mathias P.W Nilsson wrote: Thanks! How can this be done with markup inheritance. I want to display a div menu like -- Header content change for pages -- footer -- The content for pages could be and with links. If I use inheritance then the content will be in a parent page. I don't know how to proceed. -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with menu
Thanks! How can this be done with markup inheritance. I want to display a div menu like -- Header content change for pages -- footer -- The content for pages could be and with links. If I use inheritance then the content will be in a parent page. I don't know how to proceed. -- View this message in context: http://www.nabble.com/problem-with-menu-tp16700154p16707394.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with menu
Forgot to give an example... Nino Saturnino Martinez Vazquez Wael wrote: Markup inheritance could be the way to go, it's been great for me. You could use a listview in the parent... A little like I've done with the accordion menu. http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-accordion However I think you could also use borders? Theres lots of solutions:) regards Nino Mathias P.W Nilsson wrote: Hi! I have a problem with a menu that should be in all pages but have different links. Is there anyway of achiving this. Adding links to parent class or something like that. It is a right meny with the same layout but different content. -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with menu
Markup inheritance could be the way to go, it's been great for me. However I think you could also use borders? Theres lots of solutions:) regards Nino Mathias P.W Nilsson wrote: Hi! I have a problem with a menu that should be in all pages but have different links. Is there anyway of achiving this. Adding links to parent class or something like that. It is a right meny with the same layout but different content. -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with menu
Hi! I have a problem with a menu that should be in all pages but have different links. Is there anyway of achiving this. Adding links to parent class or something like that. It is a right meny with the same layout but different content. -- View this message in context: http://www.nabble.com/problem-with-menu-tp16700154p16700154.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]