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



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 Vladimir K

It is possible to override onRender method. It turned out that it is not
final.

@Override
protected void onRender(MarkupStream markupStream) {
Application.get().getMarkupSettings().setStripWicketTags(true);
try {
super.onRender(markupStream);
} finally {

Application.get().getMarkupSettings().setStripWicketTags(

MyApplication.STRIP_WICKET_TAGS_IN_DEVELOPMENT_MODE);
}
}

But I don't find appropriate method to override to let children render
wicket tags.

-- 
View this message in context: 
http://www.nabble.com/how-to-strip-wicket-tags-for-particular-component-tp24568122p24569807.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

it seems that onAfterRender is not the appropriate place to restore settings
... :(


Vladimir K wrote:
> 
> 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 don't have 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 Model(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-tp24568122p24569561.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 Model(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 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  tags.
> 
> The problem is that the rendered markup contains additional
> 
> and  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 Mathias Nilsson

This may not be the best solution but it should work

DateTextField  dateField = new DateTextField("date", new Model(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