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]