Re: how to strip wicket tags for particular component

2009-07-20 Thread Mathias Nilsson

This may not be the best solution but it should work

DateTextField  dateField = new DateTextField(date, new ModelDate(new
Date())){
@Override
protected void onBeforeRender() {


Application.get().getMarkupSettings().setStripWicketTags(true);
super.onBeforeRender();
}
@Override
protected void onAfterRender() {

Application.get().getMarkupSettings().setStripWicketTags(false);
super.onAfterRender();
}

}; 
-- 
View this message in context: 
http://www.nabble.com/how-to-strip-wicket-tags-for-particular-component-tp24568122p24568890.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to strip wicket tags for particular component

2009-07-20 Thread Vladimir K

For now I use the following workaround

public class CleanBorder extends Border {
private boolean savedStripWicketTags; 

public CleanBorder(String id) {
super(id);
setRenderBodyOnly(true);
getBodyContainer().setRenderBodyOnly(true);
}

public CleanBorder(String id, IModel? model) {
super(id, model);
setRenderBodyOnly(true);
getBodyContainer().setRenderBodyOnly(true);
}

@Override
protected void onAfterRender() {
super.onAfterRender();

Application.get().getMarkupSettings().setStripWicketTags(savedStripWicketTags);
}

@Override
protected void onBeforeRender() {
savedStripWicketTags =
Application.get().getMarkupSettings().getStripWicketTags();
Application.get().getMarkupSettings().setStripWicketTags(true);
super.onBeforeRender();
}


that looks like a hack. I would prefer a settings on the MarkupContainer
that by default uses the application settings but in case of border can be
overridden.


Vladimir K wrote:
 
 I'm trying to convert main menu into components to control visibility of
 items depending on the user logged in and the context.
 I use borders to wrap menu item into li tags.
 
 The problem is that the rendered markup contains additional
 wicket:border
 and wicket:body tags. They breaks the menu and it is eventually
 displayed
 as the simple list.
 
 Stripping wicket tags at the application level would obviously solve the
 problem. But I'd like to keep wicket tags for most markup and strip only
 for
 menu.
 
 Can I override Border class somehow and strip wicket tags manually?
 
 

-- 
View this message in context: 
http://www.nabble.com/how-to-strip-wicket-tags-for-particular-component-tp24568122p24568909.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to strip wicket tags for particular component

2009-07-20 Thread Vladimir K

Mathias,

I just posted right after your post :) Anyway thanks.

The problem is that you can not restore origianal settings when the body of
the border is being rendered. At lease it is difficult to figure out what
workaround I could employ.

Thankfully I haven't to care about that in my case so I use it.


Mathias Nilsson wrote:
 
 This may not be the best solution but it should work
 
 DateTextField  dateField = new DateTextField(date, new ModelDate(new
 Date())){
   @Override
   protected void onBeforeRender() {
   
   
 Application.get().getMarkupSettings().setStripWicketTags(true);
   super.onBeforeRender();
   }
   @Override
   protected void onAfterRender() {
   
 Application.get().getMarkupSettings().setStripWicketTags(false);
   super.onAfterRender();
   }
 
   }; 
 

-- 
View this message in context: 
http://www.nabble.com/how-to-strip-wicket-tags-for-particular-component-tp24568122p24568972.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to strip wicket tags for particular component

2009-07-20 Thread Mathias Nilsson

What about

@Override
public void onComponentTag( ComponentTag tag){ 
 tag.remove( wicket:id );
 super.onComponentTag(tag);
} 
-- 
View this message in context: 
http://www.nabble.com/how-to-strip-wicket-tags-for-particular-component-tp24568122p24571367.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to strip wicket tags for particular component

2009-07-20 Thread Erik van Oosten

Turning the 2 lines around might give better results.

Regards,
   Erik.


Mathias Nilsson wrote:

What about

@Override
		public void onComponentTag( ComponentTag tag){ 
		 tag.remove( wicket:id );

 super.onComponentTag(tag);
		} 
  


--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org