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/ >