Re: rendering the navigation toolbar

2008-04-29 Thread Eyal Golan
wow!!
cool. That was so educational :)
Thanks.

If I change this, it will change EVERYTHING, right?
What if I want to do something like: em style=color: green; only for
this PNL ?
Is there a way?
My other option is to add this style (attribute and CSS actually) to the
inner span.

I think that the second option is better. isn't it?

Now I need to look how to do this ...



On Tue, Apr 29, 2008 at 1:26 AM, Gerolf Seitz [EMAIL PROTECTED]
wrote:

 a PagingNavigationLink is autoenabled (see constructor of PNL).
 for a PNL this means, that when the page the PNL links to is the
 same as the current page, the link is automatically disabled.
 the em tags come from a setting in IMarkupSettings.
 check accessors for defaultBeforeDisabledLink and
 defaultAfterDisabled link.

  Gerolf

 On Mon, Apr 28, 2008 at 4:29 PM, Eyal Golan [EMAIL PROTECTED] wrote:

  hi all,
  I've been trying to change some styling in the navigation toolbar.
  I have a StyledAjaxNavigationToolbar which inherit from
  AjaxNavigationToolbar.
  I thought to override newPagingNavigator that will return
  StyledAjaxPagingNavigator (inherit AjaxPagingNavigator).
 
  I overridden AjaxNavigationToolbar to add class for the navigation
 toolbar
  (A small change in the html file).
  Here's the html:
  ?xml version=1.0?
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
  html xmlns=http://www.w3.org/1999/xhtml;
 xmlns:wicket=http://wicket.sourceforge.net/; xml:lang=en
 lang=en
  wicket:panel
 tr class=navigation
 td wicket:id=span
 div class=navigatorLabelspan
 wicket:id=navigatorLabel[navigator-label]/span/div
 div class=navigatorspan
 wicket:id=navigator[navigator]/span/div
 /td
 /tr
  /wicket:panel
  /html
 
  OK, so what is actually my question?
  In the navigation toolbar we have the labels of the pages.
  Each label is a link EXCEPT the one of the current page.
  All I want to do is add a class to this label (which is in a span).
  I could not find where Wicket put a em before the span of the current
  page
  and how it is not a link.
  How should I build the hierarchy?
 
  thanks
 
 
  --
  Eyal Golan
  [EMAIL PROTECTED]
 
  Visit: http://jvdrums.sourceforge.net/
 




-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/


Re: rendering the navigation toolbar

2008-04-29 Thread Gerolf Seitz
On Tue, Apr 29, 2008 at 11:00 AM, Eyal Golan [EMAIL PROTECTED] wrote:

 wow!!
 cool. That was so educational :)
 Thanks.

np :)



 If I change this, it will change EVERYTHING, right?

yes, this is the setting for all disabled links.



 What if I want to do something like: em style=color: green; only for
 this PNL ?
 Is there a way?

there are numerous ;)

you could add a SimpleAttributeModifier to the specific PNL:
PNL link = new PNL(...);
link.add(new SimpleAttributeModifier(class, green) {
  public boolean isEnabled() {
return !getComponent().isEnabled();
  }
}

you could easily achieve the same result with overriding
PNL#onComponentTag ...


Gerolf


Re: rendering the navigation toolbar

2008-04-29 Thread Eyal Golan
thanks,
here's what I did.
1. I have a StyledAjaxNavigationToolbar that overrides:
@Override
protected PagingNavigator newPagingNavigator(String navigatorId, final
DataTable table) {
return new StyledAjaxPagingNavigator(navigatorId, table);
}

2. Then my StyledAjaxPagingNavigator overrides:
@Override
protected PagingNavigation newNavigation(IPageable pageable,
IPagingLabelProvider labelProvider) {
return new StyledAjaxPagingNavigation(navigation, pageable,
labelProvider);
}

3. StyledAjaxPagingNavigation overrides:
@Override
protected Link newPagingNavigationLink(String id, IPageable pageable,
int pageIndex) {
Link link = super.newPagingNavigationLink(id, pageable, pageIndex);
link.add(new AbstractBehavior() {
private static final long serialVersionUID = 1L;

@Override
public void onComponentTag(Component component, ComponentTag
tag) {
super.onComponentTag(component, tag);
if (!component.isEnabled()) {
CharSequence oldClassName = tag.getString(class);
if (oldClassName == null || oldClassName.equals()) {
tag.put(class, disabledPagingLink);
} else {
tag.put(class, oldClassName +   +
disabledPagingLink);
}
}
}
});
return link;
}

And then, in the CSS file I do whatever I want...

And now, is this the best way to access the PNL ?
Was I able to get the newPagingNavigationLink with less overridden classes?

And thanks for you help.
I really enjoy this Wicket stuff!! It's so wicked ;)

On Tue, Apr 29, 2008 at 12:43 PM, Gerolf Seitz [EMAIL PROTECTED]
wrote:

 On Tue, Apr 29, 2008 at 11:00 AM, Eyal Golan [EMAIL PROTECTED] wrote:

  wow!!
  cool. That was so educational :)
  Thanks.
 
 np :)


 
  If I change this, it will change EVERYTHING, right?

 yes, this is the setting for all disabled links.


 
  What if I want to do something like: em style=color: green; only for
  this PNL ?
  Is there a way?

 there are numerous ;)

 you could add a SimpleAttributeModifier to the specific PNL:
 PNL link = new PNL(...);
 link.add(new SimpleAttributeModifier(class, green) {
  public boolean isEnabled() {
return !getComponent().isEnabled();
  }
 }

 you could easily achieve the same result with overriding
 PNL#onComponentTag ...


 Gerolf




-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/


Re: rendering the navigation toolbar

2008-04-29 Thread Gerolf Seitz
instead of the custom AbstractBehavior, you could add an
AttributeAppender like this:
link.add(new AttributeAppender(class, true, new
Model(disabledPaginLink),  ) {
  public boolean isEnabled() {
return !getComponent().isEnabled();
  }
});

  Gerolf

On Tue, Apr 29, 2008 at 1:09 PM, Eyal Golan [EMAIL PROTECTED] wrote:

 thanks,
 here's what I did.
 1. I have a StyledAjaxNavigationToolbar that overrides:
@Override
protected PagingNavigator newPagingNavigator(String navigatorId, final
 DataTable table) {
return new StyledAjaxPagingNavigator(navigatorId, table);
}

 2. Then my StyledAjaxPagingNavigator overrides:
@Override
protected PagingNavigation newNavigation(IPageable pageable,
IPagingLabelProvider labelProvider) {
return new StyledAjaxPagingNavigation(navigation, pageable,
 labelProvider);
}

 3. StyledAjaxPagingNavigation overrides:
@Override
protected Link newPagingNavigationLink(String id, IPageable pageable,
 int pageIndex) {
Link link = super.newPagingNavigationLink(id, pageable, pageIndex);
link.add(new AbstractBehavior() {
private static final long serialVersionUID = 1L;

@Override
public void onComponentTag(Component component, ComponentTag
 tag) {
super.onComponentTag(component, tag);
if (!component.isEnabled()) {
CharSequence oldClassName = tag.getString(class);
if (oldClassName == null || oldClassName.equals()) {
tag.put(class, disabledPagingLink);
} else {
tag.put(class, oldClassName +   +
 disabledPagingLink);
}
}
}
});
return link;
}

 And then, in the CSS file I do whatever I want...

 And now, is this the best way to access the PNL ?
 Was I able to get the newPagingNavigationLink with less overridden
 classes?

 And thanks for you help.
 I really enjoy this Wicket stuff!! It's so wicked ;)

 On Tue, Apr 29, 2008 at 12:43 PM, Gerolf Seitz [EMAIL PROTECTED]
 wrote:

  On Tue, Apr 29, 2008 at 11:00 AM, Eyal Golan [EMAIL PROTECTED] wrote:
 
   wow!!
   cool. That was so educational :)
   Thanks.
  
  np :)
 
 
  
   If I change this, it will change EVERYTHING, right?
 
  yes, this is the setting for all disabled links.
 
 
  
   What if I want to do something like: em style=color: green; only
 for
   this PNL ?
   Is there a way?
 
  there are numerous ;)
 
  you could add a SimpleAttributeModifier to the specific PNL:
  PNL link = new PNL(...);
  link.add(new SimpleAttributeModifier(class, green) {
   public boolean isEnabled() {
 return !getComponent().isEnabled();
   }
  }
 
  you could easily achieve the same result with overriding
  PNL#onComponentTag ...
 
 
  Gerolf
 



 --
 Eyal Golan
 [EMAIL PROTECTED]

 Visit: http://jvdrums.sourceforge.net/



Re: rendering the navigation toolbar

2008-04-29 Thread Eyal Golan
hh,
the isEnabled() of the AttributeAppender is a really cool tool.
I used it in another place.
I have a StyledDataTable that overridden onComponentTag:

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
if (dataProvider.size() == 0) {
CharSequence oldClassName = tag.getString(class);
if (oldClassName == null || oldClassName.equals()) {
tag.put(class, emptyTable);
} else {
tag.put(class, oldClassName +   + emptyTable);
}
}
}

And instead, I put in the constructor:

add(new AttributeAppender(class, true, new Model(emptyTable), 
) {
private static final long serialVersionUID = 1L;

@Override
public boolean isEnabled(Component component) {
return (EurekifyDataTable.this.dataProvider.size() == 0);
}
});


That is so much better ..


On Tue, Apr 29, 2008 at 2:18 PM, Gerolf Seitz [EMAIL PROTECTED]
wrote:

 instead of the custom AbstractBehavior, you could add an
 AttributeAppender like this:
 link.add(new AttributeAppender(class, true, new
 Model(disabledPaginLink),  ) {
   public boolean isEnabled() {
return !getComponent().isEnabled();
  }
 });

  Gerolf

 On Tue, Apr 29, 2008 at 1:09 PM, Eyal Golan [EMAIL PROTECTED] wrote:

  thanks,
  here's what I did.
  1. I have a StyledAjaxNavigationToolbar that overrides:
 @Override
 protected PagingNavigator newPagingNavigator(String navigatorId,
 final
  DataTable table) {
 return new StyledAjaxPagingNavigator(navigatorId, table);
 }
 
  2. Then my StyledAjaxPagingNavigator overrides:
 @Override
 protected PagingNavigation newNavigation(IPageable pageable,
 IPagingLabelProvider labelProvider) {
 return new StyledAjaxPagingNavigation(navigation, pageable,
  labelProvider);
 }
 
  3. StyledAjaxPagingNavigation overrides:
 @Override
 protected Link newPagingNavigationLink(String id, IPageable pageable,
  int pageIndex) {
 Link link = super.newPagingNavigationLink(id, pageable,
 pageIndex);
 link.add(new AbstractBehavior() {
 private static final long serialVersionUID = 1L;
 
 @Override
 public void onComponentTag(Component component, ComponentTag
  tag) {
 super.onComponentTag(component, tag);
 if (!component.isEnabled()) {
 CharSequence oldClassName = tag.getString(class);
 if (oldClassName == null || oldClassName.equals())
 {
 tag.put(class, disabledPagingLink);
 } else {
 tag.put(class, oldClassName +   +
  disabledPagingLink);
 }
 }
 }
 });
 return link;
 }
 
  And then, in the CSS file I do whatever I want...
 
  And now, is this the best way to access the PNL ?
  Was I able to get the newPagingNavigationLink with less overridden
  classes?
 
  And thanks for you help.
  I really enjoy this Wicket stuff!! It's so wicked ;)
 
  On Tue, Apr 29, 2008 at 12:43 PM, Gerolf Seitz [EMAIL PROTECTED]
  wrote:
 
   On Tue, Apr 29, 2008 at 11:00 AM, Eyal Golan [EMAIL PROTECTED]
 wrote:
  
wow!!
cool. That was so educational :)
Thanks.
   
   np :)
  
  
   
If I change this, it will change EVERYTHING, right?
  
   yes, this is the setting for all disabled links.
  
  
   
What if I want to do something like: em style=color: green; only
  for
this PNL ?
Is there a way?
  
   there are numerous ;)
  
   you could add a SimpleAttributeModifier to the specific PNL:
   PNL link = new PNL(...);
   link.add(new SimpleAttributeModifier(class, green) {
public boolean isEnabled() {
  return !getComponent().isEnabled();
}
   }
  
   you could easily achieve the same result with overriding
   PNL#onComponentTag ...
  
  
   Gerolf
  
 
 
 
  --
  Eyal Golan
  [EMAIL PROTECTED]
 
  Visit: http://jvdrums.sourceforge.net/
 




-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/


rendering the navigation toolbar

2008-04-28 Thread Eyal Golan
hi all,
I've been trying to change some styling in the navigation toolbar.
I have a StyledAjaxNavigationToolbar which inherit from
AjaxNavigationToolbar.
I thought to override newPagingNavigator that will return
StyledAjaxPagingNavigator (inherit AjaxPagingNavigator).

I overridden AjaxNavigationToolbar to add class for the navigation toolbar
(A small change in the html file).
Here's the html:
?xml version=1.0?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:wicket=http://wicket.sourceforge.net/; xml:lang=en lang=en
wicket:panel
tr class=navigation
td wicket:id=span
div class=navigatorLabelspan
wicket:id=navigatorLabel[navigator-label]/span/div
div class=navigatorspan
wicket:id=navigator[navigator]/span/div
/td
/tr
/wicket:panel
/html

OK, so what is actually my question?
In the navigation toolbar we have the labels of the pages.
Each label is a link EXCEPT the one of the current page.
All I want to do is add a class to this label (which is in a span).
I could not find where Wicket put a em before the span of the current page
and how it is not a link.
How should I build the hierarchy?

thanks


-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/