You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tom Götz <to...@decoded.de> on 2019/09/02 07:22:08 UTC

Wrapping a FormComponent with a Border

Hi there,
 
I would like to automatically wrap a FormComponent with a Border whenever it is added on a certain page. Let's say, a TextField is added, then I'd like to replace it with Border and add that TextField to the Border. The Border itself contains other Wicket Components such as a Label and a FeedbackPanel. I am aware of BorderBehavior, but it seems that this can only be used to wrap raw HTML around a Component.
Is this possible somehow? 
 
Cheers
Tom

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


Re: Wrapping a FormComponent with a Border

Posted by Bas Gooren <ba...@iswd.nl>.
Hi Tom,

I can have a look over the weekend, to see if I can extract some code and
put it on GitHub for you.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 september 2019 bij 13:05:42, Tom Götz (tom@richmountain.de) schreef:

Hi Bas and thanks for your input! I guess this would also be my preferred
way to deal with that task. But this also means that all "client"
applications would have to be adapted and at least change their HTML markup
which I'd like to avoid. I'm currently looking for a solution that avoids
code changes as far as possible in existing client applications (and we
have _several_ of those) ...

Any chance you could share some parts of your custom code?

Tom

> Gesendet: Dienstag, 03. September 2019 um 12:19 Uhr
> Von: "Bas Gooren" <ba...@iswd.nl>
> An: users@wicket.apache.org, "Tom Götz" <to...@richmountain.de>
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Hi Tom,
>
> I have tried various ways to make this work: from custom markup filters
and
> component tree manipulation to custom form components, which are added to
a
> repeater (and thus the entire form is created programmatically, apart
from
> a single div which our FormPanel connects to.
> In other projects I have experimented with rewriting the markup with a
> custom parser, implementing a custom markup cache etc.
>
> I think, in general, the wicket-way is to not have (too) much magic; This
> also became evident for me when working with markup filters and custom
> markup caches. I got it all to work, but it’s quite complex.
>
> In my current projects I pick (or mix) from these two strategies:
>
> a) add the div for a border component to the layout:
>
> <div wicket:id=“component-border”>
> <input type=“…” wicket:id=“component>
> </div>
>
> b) use custom form components, and render them with a repeater
>
> E.g. a TextInput<T> implements Input<T>, which contains the border, input
> component etc.
> The repeater then accepts a list of Input<?>.
> Actually, we added a FormElement base class, since we also want to have
> non-input components in our forms like tabbed panels, information boxes
etc.
>
> In both cases, in your code you know what markup and component tree you
are
> dealing with.
> In other words: no magic.
>
> My 2 cents :-)
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 3 september 2019 bij 11:19:06, Tom Götz (tom@richmountain.de) schreef:
>
> Well ok, I'll give the Panel solution a try. In the panel I will have a
> FormGroup Border and inside that there's my input/textfield. Only thing
> that still worries me:
> user creates the TextField in Java code with wicket:id that he has in
it's
> markup file. This wicket:id can't be changed afterwards (final). But in
> MyFormGroupPanel I need markup for the input, and this markup needs an
id.
> Hm, maybe I'll look into some repeater solution for that problem ...
>
> Tom
>
>
> > Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> > Von: "Martin Grigorov" <mg...@apache.org>
> > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz" <to...@richmountain.de> wrote:
> >
> > > Thanks Martin, I will look into that. But won't it be a problem that
I
> > > will add the <input/> / TextField to the Border without having any
> markup
> > > inside the Border? Won't I need my <input/> markup inside the border
> > > <div/>s?
> > >
> >
> > right! it is a Border, not a Panel (
> >
>
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> > )
> > I think it would be easier if you roll MyFormGroupPanel instead of
using
> a
> > Border.
> > If you decide to stick with FormGroup then you will need to override
> > onComponentTagBody() too
> >
> >
> > >
> > > Tom
> > >
> > >
> > > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > > Von: "Martin Grigorov" <mg...@apache.org>
> > > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > > >
> > > > Hi Tom,
> > > >
> > > > Since your "user" is going to add a TextField in the Java code then
I
> > > > assume (s)he is going to add <input wicket:id="..."/> in the
markup.
> > > > Your IComponentInitializationListener will replace all components
of
> type
> > > > TextField which do not have FormGroup as a parent with a
MyFormGroup.
> > > >
> > > > public class MyFormGroup extends FormGroup {
> > > > // constructor(s)
> > > >
> > > > @Override
> > > > public void onComponentTag(ComponentTag tag) {
> > > > super(tag);
> > > > tag.setName("div"); // this modifies <input> to <div>
> > > > }
> > > > }
> > > >
> > > > I am not sure, but you may also need to expand the tag from
OpenClose
> > > (i.e.
> > > > <input/>) to open+close (i.e. <div></div>). See
> > > ComponentTag#isOpenClose()
> > > > and Component#afterRender();
> > > >
> > > > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de>
> wrote:
> > > >
> > > > > Martin,
> > > > >
> > > > > maybe you could point me into the right direction concerning the
> markup
> > > > > manipulation part?
> > > > >
> > > > > This is what I got in my HTML:
> > > > >
> > > > > <form wicket:id="form">
> > > > > <input wicket:id="input" type="text" />
> > > > > </form>
> > > > >
> > > > > I guess this is what I need for effectively replacing the input
> with a
> > > > > FormGroup border:
> > > > >
> > > > > <form wicket:id="form">
> > > > > <div wicket:id="border">
> > > > > <input wicket:id="input" type="text" />
> > > > > </div>
> > > > > </form>
> > > > >
> > > > > Where would be the best place in the code to start looking?
> > > > >
> > > > > Thanks in advance
> > > > > Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

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

Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Hi Bas and thanks for your input! I guess this would also be my preferred way to deal with that task. But this also means that all "client" applications would have to be adapted and at least change their HTML markup which I'd like to avoid. I'm currently looking for a solution that avoids code changes as far as possible in existing client applications (and we have _several_ of those) ...

Any chance you could share some parts of your custom code?

Tom

> Gesendet: Dienstag, 03. September 2019 um 12:19 Uhr
> Von: "Bas Gooren" <ba...@iswd.nl>
> An: users@wicket.apache.org, "Tom Götz" <to...@richmountain.de>
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Hi Tom,
> 
> I have tried various ways to make this work: from custom markup filters and
> component tree manipulation to custom form components, which are added to a
> repeater (and thus the entire form is created programmatically, apart from
> a single div which our FormPanel connects to.
> In other projects I have experimented with rewriting the markup with a
> custom parser, implementing a custom markup cache etc.
> 
> I think, in general, the wicket-way is to not have (too) much magic; This
> also became evident for me when working with markup filters and custom
> markup caches. I got it all to work, but it’s quite complex.
> 
> In my current projects I pick (or mix) from these two strategies:
> 
> a) add the div for a border component to the layout:
> 
> <div wicket:id=“component-border”>
> <input type=“…” wicket:id=“component>
> </div>
> 
> b) use custom form components, and render them with a repeater
> 
> E.g. a TextInput<T> implements Input<T>, which contains the border, input
> component etc.
> The repeater then accepts a list of Input<?>.
> Actually, we added a FormElement base class, since we also want to have
> non-input components in our forms like tabbed panels, information boxes etc.
> 
> In both cases, in your code you know what markup and component tree you are
> dealing with.
> In other words: no magic.
> 
> My 2 cents :-)
> 
> Met vriendelijke groet,
> Kind regards,
> 
> Bas Gooren
> 
> Op 3 september 2019 bij 11:19:06, Tom Götz (tom@richmountain.de) schreef:
> 
> Well ok, I'll give the Panel solution a try. In the panel I will have a
> FormGroup Border and inside that there's my input/textfield. Only thing
> that still worries me:
> user creates the TextField in Java code with wicket:id that he has in it's
> markup file. This wicket:id can't be changed afterwards (final). But in
> MyFormGroupPanel I need markup for the input, and this markup needs an id.
> Hm, maybe I'll look into some repeater solution for that problem ...
> 
> Tom
> 
> 
> > Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> > Von: "Martin Grigorov" <mg...@apache.org>
> > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz" <to...@richmountain.de> wrote:
> >
> > > Thanks Martin, I will look into that. But won't it be a problem that I
> > > will add the <input/> / TextField to the Border without having any
> markup
> > > inside the Border? Won't I need my <input/> markup inside the border
> > > <div/>s?
> > >
> >
> > right! it is a Border, not a Panel (
> >
> https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> > )
> > I think it would be easier if you roll MyFormGroupPanel instead of using
> a
> > Border.
> > If you decide to stick with FormGroup then you will need to override
> > onComponentTagBody() too
> >
> >
> > >
> > > Tom
> > >
> > >
> > > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > > Von: "Martin Grigorov" <mg...@apache.org>
> > > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > > >
> > > > Hi Tom,
> > > >
> > > > Since your "user" is going to add a TextField in the Java code then I
> > > > assume (s)he is going to add <input wicket:id="..."/> in the markup.
> > > > Your IComponentInitializationListener will replace all components of
> type
> > > > TextField which do not have FormGroup as a parent with a MyFormGroup.
> > > >
> > > > public class MyFormGroup extends FormGroup {
> > > > // constructor(s)
> > > >
> > > > @Override
> > > > public void onComponentTag(ComponentTag tag) {
> > > > super(tag);
> > > > tag.setName("div"); // this modifies <input> to <div>
> > > > }
> > > > }
> > > >
> > > > I am not sure, but you may also need to expand the tag from OpenClose
> > > (i.e.
> > > > <input/>) to open+close (i.e. <div></div>). See
> > > ComponentTag#isOpenClose()
> > > > and Component#afterRender();
> > > >
> > > > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de>
> wrote:
> > > >
> > > > > Martin,
> > > > >
> > > > > maybe you could point me into the right direction concerning the
> markup
> > > > > manipulation part?
> > > > >
> > > > > This is what I got in my HTML:
> > > > >
> > > > > <form wicket:id="form">
> > > > > <input wicket:id="input" type="text" />
> > > > > </form>
> > > > >
> > > > > I guess this is what I need for effectively replacing the input
> with a
> > > > > FormGroup border:
> > > > >
> > > > > <form wicket:id="form">
> > > > > <div wicket:id="border">
> > > > > <input wicket:id="input" type="text" />
> > > > > </div>
> > > > > </form>
> > > > >
> > > > > Where would be the best place in the code to start looking?
> > > > >
> > > > > Thanks in advance
> > > > > Tom
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

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


Re: Wrapping a FormComponent with a Border

Posted by Bas Gooren <ba...@iswd.nl>.
Hi Tom,

I have tried various ways to make this work: from custom markup filters and
component tree manipulation to custom form components, which are added to a
repeater (and thus the entire form is created programmatically, apart from
a single div which our FormPanel connects to.
In other projects I have experimented with rewriting the markup with a
custom parser, implementing a custom markup cache etc.

I think, in general, the wicket-way is to not have (too) much magic; This
also became evident for me when working with markup filters and custom
markup caches. I got it all to work, but it’s quite complex.

In my current projects I pick (or mix) from these two strategies:

a) add the div for a border component to the layout:

<div wicket:id=“component-border”>
<input type=“…” wicket:id=“component>
</div>

b) use custom form components, and render them with a repeater

E.g. a TextInput<T> implements Input<T>, which contains the border, input
component etc.
The repeater then accepts a list of Input<?>.
Actually, we added a FormElement base class, since we also want to have
non-input components in our forms like tabbed panels, information boxes etc.

In both cases, in your code you know what markup and component tree you are
dealing with.
In other words: no magic.

My 2 cents :-)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 september 2019 bij 11:19:06, Tom Götz (tom@richmountain.de) schreef:

Well ok, I'll give the Panel solution a try. In the panel I will have a
FormGroup Border and inside that there's my input/textfield. Only thing
that still worries me:
user creates the TextField in Java code with wicket:id that he has in it's
markup file. This wicket:id can't be changed afterwards (final). But in
MyFormGroupPanel I need markup for the input, and this markup needs an id.
Hm, maybe I'll look into some repeater solution for that problem ...

Tom


> Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> Von: "Martin Grigorov" <mg...@apache.org>
> An: "users@wicket.apache.org" <us...@wicket.apache.org>
> Betreff: Re: Wrapping a FormComponent with a Border
>
> On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz" <to...@richmountain.de> wrote:
>
> > Thanks Martin, I will look into that. But won't it be a problem that I
> > will add the <input/> / TextField to the Border without having any
markup
> > inside the Border? Won't I need my <input/> markup inside the border
> > <div/>s?
> >
>
> right! it is a Border, not a Panel (
>
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> )
> I think it would be easier if you roll MyFormGroupPanel instead of using
a
> Border.
> If you decide to stick with FormGroup then you will need to override
> onComponentTagBody() too
>
>
> >
> > Tom
> >
> >
> > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > Von: "Martin Grigorov" <mg...@apache.org>
> > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi Tom,
> > >
> > > Since your "user" is going to add a TextField in the Java code then I
> > > assume (s)he is going to add <input wicket:id="..."/> in the markup.
> > > Your IComponentInitializationListener will replace all components of
type
> > > TextField which do not have FormGroup as a parent with a MyFormGroup.
> > >
> > > public class MyFormGroup extends FormGroup {
> > > // constructor(s)
> > >
> > > @Override
> > > public void onComponentTag(ComponentTag tag) {
> > > super(tag);
> > > tag.setName("div"); // this modifies <input> to <div>
> > > }
> > > }
> > >
> > > I am not sure, but you may also need to expand the tag from OpenClose
> > (i.e.
> > > <input/>) to open+close (i.e. <div></div>). See
> > ComponentTag#isOpenClose()
> > > and Component#afterRender();
> > >
> > > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de>
wrote:
> > >
> > > > Martin,
> > > >
> > > > maybe you could point me into the right direction concerning the
markup
> > > > manipulation part?
> > > >
> > > > This is what I got in my HTML:
> > > >
> > > > <form wicket:id="form">
> > > > <input wicket:id="input" type="text" />
> > > > </form>
> > > >
> > > > I guess this is what I need for effectively replacing the input
with a
> > > > FormGroup border:
> > > >
> > > > <form wicket:id="form">
> > > > <div wicket:id="border">
> > > > <input wicket:id="input" type="text" />
> > > > </div>
> > > > </form>
> > > >
> > > > Where would be the best place in the code to start looking?
> > > >
> > > > Thanks in advance
> > > > Tom


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

Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Well ok, I'll give the Panel solution a try. In the panel I will have a FormGroup Border and inside that there's my input/textfield. Only thing that still worries me:
user creates the TextField in Java code with wicket:id that he has in it's markup file. This wicket:id can't be changed afterwards (final). But in MyFormGroupPanel I need markup for the input, and this markup needs an id. Hm, maybe I'll look into some repeater solution for that problem ...

Tom


> Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> Von: "Martin Grigorov" <mg...@apache.org>
> An: "users@wicket.apache.org" <us...@wicket.apache.org>
> Betreff: Re: Wrapping a FormComponent with a Border
>
> On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz" <to...@richmountain.de> wrote:
> 
> > Thanks Martin, I will look into that. But won't it be a problem that I
> > will add the <input/> / TextField to the Border without having any markup
> > inside the Border? Won't I need my <input/> markup inside the border
> > <div/>s?
> >
> 
> right! it is a Border, not a Panel (
> https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> )
> I think it would be easier if you roll MyFormGroupPanel instead of using a
> Border.
> If you decide to stick with FormGroup then you will need to override
> onComponentTagBody() too
> 
> 
> >
> > Tom
> >
> >
> > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > Von: "Martin Grigorov" <mg...@apache.org>
> > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi Tom,
> > >
> > > Since your "user" is going to add a TextField in the Java code then I
> > > assume (s)he is going to add <input wicket:id="..."/> in the markup.
> > > Your IComponentInitializationListener will replace all components of type
> > > TextField which do not have FormGroup as a parent with a MyFormGroup.
> > >
> > > public class MyFormGroup extends FormGroup {
> > >    // constructor(s)
> > >
> > >   @Override
> > >   public void onComponentTag(ComponentTag tag) {
> > >     super(tag);
> > >     tag.setName("div");  // this modifies <input> to <div>
> > >   }
> > > }
> > >
> > > I am not sure, but you may also need to expand the tag from OpenClose
> > (i.e.
> > > <input/>) to open+close (i.e. <div></div>). See
> > ComponentTag#isOpenClose()
> > > and Component#afterRender();
> > >
> > > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de> wrote:
> > >
> > > > Martin,
> > > >
> > > > maybe you could point me into the right direction concerning the markup
> > > > manipulation part?
> > > >
> > > > This is what I got in my HTML:
> > > >
> > > > <form wicket:id="form">
> > > >   <input wicket:id="input" type="text" />
> > > > </form>
> > > >
> > > > I guess this is what I need for effectively replacing the input with a
> > > > FormGroup border:
> > > >
> > > > <form wicket:id="form">
> > > >   <div wicket:id="border">
> > > >     <input wicket:id="input" type="text" />
> > > >   </div>
> > > > </form>
> > > >
> > > > Where would be the best place in the code to start looking?
> > > >
> > > > Thanks in advance
> > > > Tom


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


Re: Wrapping a FormComponent with a Border

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz" <to...@richmountain.de> wrote:

> Thanks Martin, I will look into that. But won't it be a problem that I
> will add the <input/> / TextField to the Border without having any markup
> inside the Border? Won't I need my <input/> markup inside the border
> <div/>s?
>

right! it is a Border, not a Panel (
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
)
I think it would be easier if you roll MyFormGroupPanel instead of using a
Border.
If you decide to stick with FormGroup then you will need to override
onComponentTagBody() too


>
> Tom
>
>
> > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > Von: "Martin Grigorov" <mg...@apache.org>
> > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > Betreff: Re: Re: Wrapping a FormComponent with a Border
> >
> > Hi Tom,
> >
> > Since your "user" is going to add a TextField in the Java code then I
> > assume (s)he is going to add <input wicket:id="..."/> in the markup.
> > Your IComponentInitializationListener will replace all components of type
> > TextField which do not have FormGroup as a parent with a MyFormGroup.
> >
> > public class MyFormGroup extends FormGroup {
> >    // constructor(s)
> >
> >   @Override
> >   public void onComponentTag(ComponentTag tag) {
> >     super(tag);
> >     tag.setName("div");  // this modifies <input> to <div>
> >   }
> > }
> >
> > I am not sure, but you may also need to expand the tag from OpenClose
> (i.e.
> > <input/>) to open+close (i.e. <div></div>). See
> ComponentTag#isOpenClose()
> > and Component#afterRender();
> >
> > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de> wrote:
> >
> > > Martin,
> > >
> > > maybe you could point me into the right direction concerning the markup
> > > manipulation part?
> > >
> > > This is what I got in my HTML:
> > >
> > > <form wicket:id="form">
> > >   <input wicket:id="input" type="text" />
> > > </form>
> > >
> > > I guess this is what I need for effectively replacing the input with a
> > > FormGroup border:
> > >
> > > <form wicket:id="form">
> > >   <div wicket:id="border">
> > >     <input wicket:id="input" type="text" />
> > >   </div>
> > > </form>
> > >
> > > Where would be the best place in the code to start looking?
> > >
> > > Thanks in advance
> > > Tom
> > >
> > >
> > >
> > >
> > > > Gesendet: Montag, 02. September 2019 um 13:57 Uhr
> > > > Von: "Tom Götz" <to...@richmountain.de>
> > > > An: users@wicket.apache.org
> > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > >
> > > > Thanks Martin, this is exactly what I had in mind. I already
> implemented
> > > 1), replacing the TextField with said Border but now am stuck with the
> > > "HTML manipulation" part ...
> > > >
> > > > Tom
> > > >
> > > >
> > > > > Gesendet: Montag, 02. September 2019 um 13:47 Uhr
> > > > > Von: "Martin Grigorov" <mg...@apache.org>
> > > > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > > >
> > > > > Hi Tom,
> > > > >
> > > > > I imagine two ways:
> > > > > 1) use
> org.apache.wicket.application.IComponentInitializationListener
> > > that
> > > > > manipulates the component tree whenever the passed component is an
> > > instance
> > > > > of TextField and has no (direct?!) parent of type FormGroup
> > > > > 2) use AOP
> > > > >
> > > > > In both cases you will need to also the markup because FormGroup
> > > expects to
> > > > > be attached on a <div>, while you will have an <input/>. For this
> you
> > > will
> > > > > probably need to extend Wicket Bootstrap's FormGroup and in your
> > > custom one
> > > > > override onComponentTag() (and onComponentTagBody() - most probably
> > > not).
> > > > >
> > > > > On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de>
> wrote:
> > > > >
> > > > > > Let me try to explain what I want to achieve more precisely:
> > > > > >
> > > > > > - user adds a TextField to a page
> > > > > > - I want to replace that TextField with a Border (Wicket Border
> > > component,
> > > > > > e.g. FormGroup from wicket-bootstrap) and put the TextField
> inside
> > > that
> > > > > > border
> > > > > >
> > > > > > The problem ist not: "how do I wrap a component with some HTML
> > > markup?"
> > > > > > (either generated by Java code or clientside), but: how can I
> > > manipulate
> > > > > > the component tree (server side) in such a way, that I can
> remove the
> > > > > > TextField from it's parent and replace it with a Border that
> > > contains that
> > > > > > TextField....!?
> > > > > >
> > > > > > Tom
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > > > > > > Von: "Tobias Soloschenko"
> <tobiassoloschenko@googlemail.com.INVALID
> > > >
> > > > > > > An: users@wicket.apache.org
> > > > > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > why not add a css class and style it?
> > > > > > >
> > > > > > > kind regards
> > > > > > >
> > > > > > > Tobias
> > > > > > >
> > > > > > > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> > > > > > reiern70@gmail.com>:
> > > > > > > >
> > > > > > > > Another possibility is to do this client side...
> > > > > > > >
> > > > > > > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <
> tom@richmountain.de>
> > > wrote:
> > > > > > > >>
> > > > > > > >> That would be great, thanks in advance!
> > > > > > > >>
> > > > > > > >> Tom
> > > > > > > >>
> > > > > > > >>
> > > > > > > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > > > > > > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > > > > > > >>> An: users@wicket.apache.org
> > > > > > > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > > > > > > >>>
> > > > > > > >>> Hi,
> > > > > > > >>>
> > > > > > > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <
> tom@richmountain.de
> > > >
> > > > > > wrote:
> > > > > > > >>>>
> > > > > > > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > > > > > > >>>> compent.setComponentBorder ....
> > > > > > > >>>> Is there something more close to current Wicket versions
> > > available
> > > > > > > >> maybe?
> > > > > > > >>>> :)
> > > > > > > >>>>
> > > > > > > >>>
> > > > > > > >>> I think I have somewhere on a private project something
> similar
> > > > > > > >> implemented
> > > > > > > >>> for Wicket 7.x... I can try to dig it up and send classes
> to
> > > you.
> > > > > > > >>>
> > > > > > > >>> --
> > > > > > > >>> Regards - Ernesto Reinaldo Barreiro
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Thanks Martin, I will look into that. But won't it be a problem that I will add the <input/> / TextField to the Border without having any markup inside the Border? Won't I need my <input/> markup inside the border <div/>s?

Tom


> Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> Von: "Martin Grigorov" <mg...@apache.org>
> An: "users@wicket.apache.org" <us...@wicket.apache.org>
> Betreff: Re: Re: Wrapping a FormComponent with a Border
>
> Hi Tom,
> 
> Since your "user" is going to add a TextField in the Java code then I
> assume (s)he is going to add <input wicket:id="..."/> in the markup.
> Your IComponentInitializationListener will replace all components of type
> TextField which do not have FormGroup as a parent with a MyFormGroup.
> 
> public class MyFormGroup extends FormGroup {
>    // constructor(s)
> 
>   @Override
>   public void onComponentTag(ComponentTag tag) {
>     super(tag);
>     tag.setName("div");  // this modifies <input> to <div>
>   }
> }
> 
> I am not sure, but you may also need to expand the tag from OpenClose (i.e.
> <input/>) to open+close (i.e. <div></div>). See ComponentTag#isOpenClose()
> and Component#afterRender();
> 
> On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de> wrote:
> 
> > Martin,
> >
> > maybe you could point me into the right direction concerning the markup
> > manipulation part?
> >
> > This is what I got in my HTML:
> >
> > <form wicket:id="form">
> >   <input wicket:id="input" type="text" />
> > </form>
> >
> > I guess this is what I need for effectively replacing the input with a
> > FormGroup border:
> >
> > <form wicket:id="form">
> >   <div wicket:id="border">
> >     <input wicket:id="input" type="text" />
> >   </div>
> > </form>
> >
> > Where would be the best place in the code to start looking?
> >
> > Thanks in advance
> > Tom
> >
> >
> >
> >
> > > Gesendet: Montag, 02. September 2019 um 13:57 Uhr
> > > Von: "Tom Götz" <to...@richmountain.de>
> > > An: users@wicket.apache.org
> > > Betreff: Re: Wrapping a FormComponent with a Border
> > >
> > > Thanks Martin, this is exactly what I had in mind. I already implemented
> > 1), replacing the TextField with said Border but now am stuck with the
> > "HTML manipulation" part ...
> > >
> > > Tom
> > >
> > >
> > > > Gesendet: Montag, 02. September 2019 um 13:47 Uhr
> > > > Von: "Martin Grigorov" <mg...@apache.org>
> > > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > >
> > > > Hi Tom,
> > > >
> > > > I imagine two ways:
> > > > 1) use org.apache.wicket.application.IComponentInitializationListener
> > that
> > > > manipulates the component tree whenever the passed component is an
> > instance
> > > > of TextField and has no (direct?!) parent of type FormGroup
> > > > 2) use AOP
> > > >
> > > > In both cases you will need to also the markup because FormGroup
> > expects to
> > > > be attached on a <div>, while you will have an <input/>. For this you
> > will
> > > > probably need to extend Wicket Bootstrap's FormGroup and in your
> > custom one
> > > > override onComponentTag() (and onComponentTagBody() - most probably
> > not).
> > > >
> > > > On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de> wrote:
> > > >
> > > > > Let me try to explain what I want to achieve more precisely:
> > > > >
> > > > > - user adds a TextField to a page
> > > > > - I want to replace that TextField with a Border (Wicket Border
> > component,
> > > > > e.g. FormGroup from wicket-bootstrap) and put the TextField inside
> > that
> > > > > border
> > > > >
> > > > > The problem ist not: "how do I wrap a component with some HTML
> > markup?"
> > > > > (either generated by Java code or clientside), but: how can I
> > manipulate
> > > > > the component tree (server side) in such a way, that I can remove the
> > > > > TextField from it's parent and replace it with a Border that
> > contains that
> > > > > TextField....!?
> > > > >
> > > > > Tom
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > > > > > Von: "Tobias Soloschenko" <tobiassoloschenko@googlemail.com.INVALID
> > >
> > > > > > An: users@wicket.apache.org
> > > > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > why not add a css class and style it?
> > > > > >
> > > > > > kind regards
> > > > > >
> > > > > > Tobias
> > > > > >
> > > > > > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> > > > > reiern70@gmail.com>:
> > > > > > >
> > > > > > > Another possibility is to do this client side...
> > > > > > >
> > > > > > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de>
> > wrote:
> > > > > > >>
> > > > > > >> That would be great, thanks in advance!
> > > > > > >>
> > > > > > >> Tom
> > > > > > >>
> > > > > > >>
> > > > > > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > > > > > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > > > > > >>> An: users@wicket.apache.org
> > > > > > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > > > > > >>>
> > > > > > >>> Hi,
> > > > > > >>>
> > > > > > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <tom@richmountain.de
> > >
> > > > > wrote:
> > > > > > >>>>
> > > > > > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > > > > > >>>> compent.setComponentBorder ....
> > > > > > >>>> Is there something more close to current Wicket versions
> > available
> > > > > > >> maybe?
> > > > > > >>>> :)
> > > > > > >>>>
> > > > > > >>>
> > > > > > >>> I think I have somewhere on a private project something similar
> > > > > > >> implemented
> > > > > > >>> for Wicket 7.x... I can try to dig it up and send classes to
> > you.
> > > > > > >>>
> > > > > > >>> --
> > > > > > >>> Regards - Ernesto Reinaldo Barreiro
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

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


Re: Re: Wrapping a FormComponent with a Border

Posted by Martin Grigorov <mg...@apache.org>.
Hi Tom,

Since your "user" is going to add a TextField in the Java code then I
assume (s)he is going to add <input wicket:id="..."/> in the markup.
Your IComponentInitializationListener will replace all components of type
TextField which do not have FormGroup as a parent with a MyFormGroup.

public class MyFormGroup extends FormGroup {
   // constructor(s)

  @Override
  public void onComponentTag(ComponentTag tag) {
    super(tag);
    tag.setName("div");  // this modifies <input> to <div>
  }
}

I am not sure, but you may also need to expand the tag from OpenClose (i.e.
<input/>) to open+close (i.e. <div></div>). See ComponentTag#isOpenClose()
and Component#afterRender();

On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de> wrote:

> Martin,
>
> maybe you could point me into the right direction concerning the markup
> manipulation part?
>
> This is what I got in my HTML:
>
> <form wicket:id="form">
>   <input wicket:id="input" type="text" />
> </form>
>
> I guess this is what I need for effectively replacing the input with a
> FormGroup border:
>
> <form wicket:id="form">
>   <div wicket:id="border">
>     <input wicket:id="input" type="text" />
>   </div>
> </form>
>
> Where would be the best place in the code to start looking?
>
> Thanks in advance
> Tom
>
>
>
>
> > Gesendet: Montag, 02. September 2019 um 13:57 Uhr
> > Von: "Tom Götz" <to...@richmountain.de>
> > An: users@wicket.apache.org
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > Thanks Martin, this is exactly what I had in mind. I already implemented
> 1), replacing the TextField with said Border but now am stuck with the
> "HTML manipulation" part ...
> >
> > Tom
> >
> >
> > > Gesendet: Montag, 02. September 2019 um 13:47 Uhr
> > > Von: "Martin Grigorov" <mg...@apache.org>
> > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > Betreff: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi Tom,
> > >
> > > I imagine two ways:
> > > 1) use org.apache.wicket.application.IComponentInitializationListener
> that
> > > manipulates the component tree whenever the passed component is an
> instance
> > > of TextField and has no (direct?!) parent of type FormGroup
> > > 2) use AOP
> > >
> > > In both cases you will need to also the markup because FormGroup
> expects to
> > > be attached on a <div>, while you will have an <input/>. For this you
> will
> > > probably need to extend Wicket Bootstrap's FormGroup and in your
> custom one
> > > override onComponentTag() (and onComponentTagBody() - most probably
> not).
> > >
> > > On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de> wrote:
> > >
> > > > Let me try to explain what I want to achieve more precisely:
> > > >
> > > > - user adds a TextField to a page
> > > > - I want to replace that TextField with a Border (Wicket Border
> component,
> > > > e.g. FormGroup from wicket-bootstrap) and put the TextField inside
> that
> > > > border
> > > >
> > > > The problem ist not: "how do I wrap a component with some HTML
> markup?"
> > > > (either generated by Java code or clientside), but: how can I
> manipulate
> > > > the component tree (server side) in such a way, that I can remove the
> > > > TextField from it's parent and replace it with a Border that
> contains that
> > > > TextField....!?
> > > >
> > > > Tom
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > > > > Von: "Tobias Soloschenko" <tobiassoloschenko@googlemail.com.INVALID
> >
> > > > > An: users@wicket.apache.org
> > > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > > >
> > > > > Hi,
> > > > >
> > > > > why not add a css class and style it?
> > > > >
> > > > > kind regards
> > > > >
> > > > > Tobias
> > > > >
> > > > > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> > > > reiern70@gmail.com>:
> > > > > >
> > > > > > Another possibility is to do this client side...
> > > > > >
> > > > > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de>
> wrote:
> > > > > >>
> > > > > >> That would be great, thanks in advance!
> > > > > >>
> > > > > >> Tom
> > > > > >>
> > > > > >>
> > > > > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > > > > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > > > > >>> An: users@wicket.apache.org
> > > > > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > > > > >>>
> > > > > >>> Hi,
> > > > > >>>
> > > > > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <tom@richmountain.de
> >
> > > > wrote:
> > > > > >>>>
> > > > > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > > > > >>>> compent.setComponentBorder ....
> > > > > >>>> Is there something more close to current Wicket versions
> available
> > > > > >> maybe?
> > > > > >>>> :)
> > > > > >>>>
> > > > > >>>
> > > > > >>> I think I have somewhere on a private project something similar
> > > > > >> implemented
> > > > > >>> for Wicket 7.x... I can try to dig it up and send classes to
> you.
> > > > > >>>
> > > > > >>> --
> > > > > >>> Regards - Ernesto Reinaldo Barreiro
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Re: Wrapping a FormComponent with a Border

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi Tom,

Maybe you can roll your own namespace implementing ComponentTag and have
something like

<tomg:input wicket:id="input" type="text" />

and this gets replaced by

  <div wicket:id="border">
    <input wicket:id="input" type="text" />
  </div>

and the corresponding components.

On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <to...@richmountain.de> wrote:

> Martin,
>
> maybe you could point me into the right direction concerning the markup
> manipulation part?
>
> This is what I got in my HTML:
>
> <form wicket:id="form">
>   <input wicket:id="input" type="text" />
> </form>
>
> I guess this is what I need for effectively replacing the input with a
> FormGroup border:
>
> <form wicket:id="form">
>   <div wicket:id="border">
>     <input wicket:id="input" type="text" />
>   </div>
> </form>
>
> Where would be the best place in the code to start looking?
>
> Thanks in advance
> Tom
>
>
>
>
> > Gesendet: Montag, 02. September 2019 um 13:57 Uhr
> > Von: "Tom Götz" <to...@richmountain.de>
> > An: users@wicket.apache.org
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > Thanks Martin, this is exactly what I had in mind. I already implemented
> 1), replacing the TextField with said Border but now am stuck with the
> "HTML manipulation" part ...
> >
> > Tom
> >
> >
> > > Gesendet: Montag, 02. September 2019 um 13:47 Uhr
> > > Von: "Martin Grigorov" <mg...@apache.org>
> > > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > > Betreff: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi Tom,
> > >
> > > I imagine two ways:
> > > 1) use org.apache.wicket.application.IComponentInitializationListener
> that
> > > manipulates the component tree whenever the passed component is an
> instance
> > > of TextField and has no (direct?!) parent of type FormGroup
> > > 2) use AOP
> > >
> > > In both cases you will need to also the markup because FormGroup
> expects to
> > > be attached on a <div>, while you will have an <input/>. For this you
> will
> > > probably need to extend Wicket Bootstrap's FormGroup and in your
> custom one
> > > override onComponentTag() (and onComponentTagBody() - most probably
> not).
> > >
> > > On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de> wrote:
> > >
> > > > Let me try to explain what I want to achieve more precisely:
> > > >
> > > > - user adds a TextField to a page
> > > > - I want to replace that TextField with a Border (Wicket Border
> component,
> > > > e.g. FormGroup from wicket-bootstrap) and put the TextField inside
> that
> > > > border
> > > >
> > > > The problem ist not: "how do I wrap a component with some HTML
> markup?"
> > > > (either generated by Java code or clientside), but: how can I
> manipulate
> > > > the component tree (server side) in such a way, that I can remove the
> > > > TextField from it's parent and replace it with a Border that
> contains that
> > > > TextField....!?
> > > >
> > > > Tom
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > > > > Von: "Tobias Soloschenko" <tobiassoloschenko@googlemail.com.INVALID
> >
> > > > > An: users@wicket.apache.org
> > > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > > >
> > > > > Hi,
> > > > >
> > > > > why not add a css class and style it?
> > > > >
> > > > > kind regards
> > > > >
> > > > > Tobias
> > > > >
> > > > > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> > > > reiern70@gmail.com>:
> > > > > >
> > > > > > Another possibility is to do this client side...
> > > > > >
> > > > > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de>
> wrote:
> > > > > >>
> > > > > >> That would be great, thanks in advance!
> > > > > >>
> > > > > >> Tom
> > > > > >>
> > > > > >>
> > > > > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > > > > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > > > > >>> An: users@wicket.apache.org
> > > > > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > > > > >>>
> > > > > >>> Hi,
> > > > > >>>
> > > > > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <tom@richmountain.de
> >
> > > > wrote:
> > > > > >>>>
> > > > > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > > > > >>>> compent.setComponentBorder ....
> > > > > >>>> Is there something more close to current Wicket versions
> available
> > > > > >> maybe?
> > > > > >>>> :)
> > > > > >>>>
> > > > > >>>
> > > > > >>> I think I have somewhere on a private project something similar
> > > > > >> implemented
> > > > > >>> for Wicket 7.x... I can try to dig it up and send classes to
> you.
> > > > > >>>
> > > > > >>> --
> > > > > >>> Regards - Ernesto Reinaldo Barreiro
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro

Aw: Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Martin,

maybe you could point me into the right direction concerning the markup manipulation part?

This is what I got in my HTML:

<form wicket:id="form">
  <input wicket:id="input" type="text" />
</form>

I guess this is what I need for effectively replacing the input with a FormGroup border:

<form wicket:id="form">
  <div wicket:id="border">
    <input wicket:id="input" type="text" />
  </div>
</form>

Where would be the best place in the code to start looking?

Thanks in advance
Tom




> Gesendet: Montag, 02. September 2019 um 13:57 Uhr
> Von: "Tom Götz" <to...@richmountain.de>
> An: users@wicket.apache.org
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Thanks Martin, this is exactly what I had in mind. I already implemented 1), replacing the TextField with said Border but now am stuck with the "HTML manipulation" part ...
> 
> Tom
> 
> 
> > Gesendet: Montag, 02. September 2019 um 13:47 Uhr
> > Von: "Martin Grigorov" <mg...@apache.org>
> > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > Hi Tom,
> > 
> > I imagine two ways:
> > 1) use org.apache.wicket.application.IComponentInitializationListener that
> > manipulates the component tree whenever the passed component is an instance
> > of TextField and has no (direct?!) parent of type FormGroup
> > 2) use AOP
> > 
> > In both cases you will need to also the markup because FormGroup expects to
> > be attached on a <div>, while you will have an <input/>. For this you will
> > probably need to extend Wicket Bootstrap's FormGroup and in your custom one
> > override onComponentTag() (and onComponentTagBody() - most probably not).
> > 
> > On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de> wrote:
> > 
> > > Let me try to explain what I want to achieve more precisely:
> > >
> > > - user adds a TextField to a page
> > > - I want to replace that TextField with a Border (Wicket Border component,
> > > e.g. FormGroup from wicket-bootstrap) and put the TextField inside that
> > > border
> > >
> > > The problem ist not: "how do I wrap a component with some HTML markup?"
> > > (either generated by Java code or clientside), but: how can I manipulate
> > > the component tree (server side) in such a way, that I can remove the
> > > TextField from it's parent and replace it with a Border that contains that
> > > TextField....!?
> > >
> > > Tom
> > >
> > >
> > >
> > >
> > >
> > >
> > > > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > > > Von: "Tobias Soloschenko" <to...@googlemail.com.INVALID>
> > > > An: users@wicket.apache.org
> > > > Betreff: Re: Wrapping a FormComponent with a Border
> > > >
> > > > Hi,
> > > >
> > > > why not add a css class and style it?
> > > >
> > > > kind regards
> > > >
> > > > Tobias
> > > >
> > > > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> > > reiern70@gmail.com>:
> > > > >
> > > > > Another possibility is to do this client side...
> > > > >
> > > > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de> wrote:
> > > > >>
> > > > >> That would be great, thanks in advance!
> > > > >>
> > > > >> Tom
> > > > >>
> > > > >>
> > > > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > > > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > > > >>> An: users@wicket.apache.org
> > > > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > > > >>>
> > > > >>> Hi,
> > > > >>>
> > > > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de>
> > > wrote:
> > > > >>>>
> > > > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > > > >>>> compent.setComponentBorder ....
> > > > >>>> Is there something more close to current Wicket versions available
> > > > >> maybe?
> > > > >>>> :)
> > > > >>>>
> > > > >>>
> > > > >>> I think I have somewhere on a private project something similar
> > > > >> implemented
> > > > >>> for Wicket 7.x... I can try to dig it up and send classes to you.
> > > > >>>
> > > > >>> --
> > > > >>> Regards - Ernesto Reinaldo Barreiro


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


Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Thanks Martin, this is exactly what I had in mind. I already implemented 1), replacing the TextField with said Border but now am stuck with the "HTML manipulation" part ...

Tom


> Gesendet: Montag, 02. September 2019 um 13:47 Uhr
> Von: "Martin Grigorov" <mg...@apache.org>
> An: "users@wicket.apache.org" <us...@wicket.apache.org>
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Hi Tom,
> 
> I imagine two ways:
> 1) use org.apache.wicket.application.IComponentInitializationListener that
> manipulates the component tree whenever the passed component is an instance
> of TextField and has no (direct?!) parent of type FormGroup
> 2) use AOP
> 
> In both cases you will need to also the markup because FormGroup expects to
> be attached on a <div>, while you will have an <input/>. For this you will
> probably need to extend Wicket Bootstrap's FormGroup and in your custom one
> override onComponentTag() (and onComponentTagBody() - most probably not).
> 
> On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de> wrote:
> 
> > Let me try to explain what I want to achieve more precisely:
> >
> > - user adds a TextField to a page
> > - I want to replace that TextField with a Border (Wicket Border component,
> > e.g. FormGroup from wicket-bootstrap) and put the TextField inside that
> > border
> >
> > The problem ist not: "how do I wrap a component with some HTML markup?"
> > (either generated by Java code or clientside), but: how can I manipulate
> > the component tree (server side) in such a way, that I can remove the
> > TextField from it's parent and replace it with a Border that contains that
> > TextField....!?
> >
> > Tom
> >
> >
> >
> >
> >
> >
> > > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > > Von: "Tobias Soloschenko" <to...@googlemail.com.INVALID>
> > > An: users@wicket.apache.org
> > > Betreff: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi,
> > >
> > > why not add a css class and style it?
> > >
> > > kind regards
> > >
> > > Tobias
> > >
> > > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com>:
> > > >
> > > > Another possibility is to do this client side...
> > > >
> > > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de> wrote:
> > > >>
> > > >> That would be great, thanks in advance!
> > > >>
> > > >> Tom
> > > >>
> > > >>
> > > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > > >>> An: users@wicket.apache.org
> > > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > > >>>
> > > >>> Hi,
> > > >>>
> > > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de>
> > wrote:
> > > >>>>
> > > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > > >>>> compent.setComponentBorder ....
> > > >>>> Is there something more close to current Wicket versions available
> > > >> maybe?
> > > >>>> :)
> > > >>>>
> > > >>>
> > > >>> I think I have somewhere on a private project something similar
> > > >> implemented
> > > >>> for Wicket 7.x... I can try to dig it up and send classes to you.
> > > >>>
> > > >>> --
> > > >>> Regards - Ernesto Reinaldo Barreiro
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

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


Re: Wrapping a FormComponent with a Border

Posted by Martin Grigorov <mg...@apache.org>.
Hi Tom,

I imagine two ways:
1) use org.apache.wicket.application.IComponentInitializationListener that
manipulates the component tree whenever the passed component is an instance
of TextField and has no (direct?!) parent of type FormGroup
2) use AOP

In both cases you will need to also the markup because FormGroup expects to
be attached on a <div>, while you will have an <input/>. For this you will
probably need to extend Wicket Bootstrap's FormGroup and in your custom one
override onComponentTag() (and onComponentTagBody() - most probably not).

On Mon, Sep 2, 2019 at 2:05 PM "Tom Götz" <to...@richmountain.de> wrote:

> Let me try to explain what I want to achieve more precisely:
>
> - user adds a TextField to a page
> - I want to replace that TextField with a Border (Wicket Border component,
> e.g. FormGroup from wicket-bootstrap) and put the TextField inside that
> border
>
> The problem ist not: "how do I wrap a component with some HTML markup?"
> (either generated by Java code or clientside), but: how can I manipulate
> the component tree (server side) in such a way, that I can remove the
> TextField from it's parent and replace it with a Border that contains that
> TextField....!?
>
> Tom
>
>
>
>
>
>
> > Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> > Von: "Tobias Soloschenko" <to...@googlemail.com.INVALID>
> > An: users@wicket.apache.org
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > Hi,
> >
> > why not add a css class and style it?
> >
> > kind regards
> >
> > Tobias
> >
> > > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <
> reiern70@gmail.com>:
> > >
> > > Another possibility is to do this client side...
> > >
> > >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de> wrote:
> > >>
> > >> That would be great, thanks in advance!
> > >>
> > >> Tom
> > >>
> > >>
> > >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > >>> An: users@wicket.apache.org
> > >>> Betreff: Re: Wrapping a FormComponent with a Border
> > >>>
> > >>> Hi,
> > >>>
> > >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de>
> wrote:
> > >>>>
> > >>>> Thanks Ernesto! This example is from 2007 though and uses
> > >>>> compent.setComponentBorder ....
> > >>>> Is there something more close to current Wicket versions available
> > >> maybe?
> > >>>> :)
> > >>>>
> > >>>
> > >>> I think I have somewhere on a private project something similar
> > >> implemented
> > >>> for Wicket 7.x... I can try to dig it up and send classes to you.
> > >>>
> > >>> --
> > >>> Regards - Ernesto Reinaldo Barreiro
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Let me try to explain what I want to achieve more precisely:

- user adds a TextField to a page
- I want to replace that TextField with a Border (Wicket Border component, e.g. FormGroup from wicket-bootstrap) and put the TextField inside that border

The problem ist not: "how do I wrap a component with some HTML markup?" (either generated by Java code or clientside), but: how can I manipulate the component tree (server side) in such a way, that I can remove the TextField from it's parent and replace it with a Border that contains that TextField....!?

Tom






> Gesendet: Montag, 02. September 2019 um 12:49 Uhr
> Von: "Tobias Soloschenko" <to...@googlemail.com.INVALID>
> An: users@wicket.apache.org
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Hi,
> 
> why not add a css class and style it?
> 
> kind regards
> 
> Tobias
> 
> > Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <re...@gmail.com>:
> > 
> > Another possibility is to do this client side...
> > 
> >> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de> wrote:
> >> 
> >> That would be great, thanks in advance!
> >> 
> >> Tom
> >> 
> >> 
> >>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> >>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> >>> An: users@wicket.apache.org
> >>> Betreff: Re: Wrapping a FormComponent with a Border
> >>> 
> >>> Hi,
> >>> 
> >>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de> wrote:
> >>>> 
> >>>> Thanks Ernesto! This example is from 2007 though and uses
> >>>> compent.setComponentBorder ....
> >>>> Is there something more close to current Wicket versions available
> >> maybe?
> >>>> :)
> >>>> 
> >>> 
> >>> I think I have somewhere on a private project something similar
> >> implemented
> >>> for Wicket 7.x... I can try to dig it up and send classes to you.
> >>> 
> >>> --
> >>> Regards - Ernesto Reinaldo Barreiro


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


Re: Wrapping a FormComponent with a Border

Posted by Tobias Soloschenko <to...@googlemail.com.INVALID>.
Hi,

why not add a css class and style it?

kind regards

Tobias

> Am 02.09.2019 um 12:20 schrieb Ernesto Reinaldo Barreiro <re...@gmail.com>:
> 
> Another possibility is to do this client side...
> 
>> On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de> wrote:
>> 
>> That would be great, thanks in advance!
>> 
>> Tom
>> 
>> 
>>> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
>>> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
>>> An: users@wicket.apache.org
>>> Betreff: Re: Wrapping a FormComponent with a Border
>>> 
>>> Hi,
>>> 
>>>> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de> wrote:
>>>> 
>>>> Thanks Ernesto! This example is from 2007 though and uses
>>>> compent.setComponentBorder ....
>>>> Is there something more close to current Wicket versions available
>> maybe?
>>>> :)
>>>> 
>>> 
>>> I think I have somewhere on a private project something similar
>> implemented
>>> for Wicket 7.x... I can try to dig it up and send classes to you.
>>> 
>>> --
>>> Regards - Ernesto Reinaldo Barreiro
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 

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


Re: Wrapping a FormComponent with a Border

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Another possibility is to do this client side...

On Mon, Sep 2, 2019, 11:43 AM "Tom Götz" <to...@richmountain.de> wrote:

> That would be great, thanks in advance!
>
> Tom
>
>
> > Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> > Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> > An: users@wicket.apache.org
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > Hi,
> >
> > On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de> wrote:
> >
> > > Thanks Ernesto! This example is from 2007 though and uses
> > > compent.setComponentBorder ....
> > > Is there something more close to current Wicket versions available
> maybe?
> > > :)
> > >
> >
> > I think I have somewhere on a private project something similar
> implemented
> > for Wicket 7.x... I can try to dig it up and send classes to you.
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
That would be great, thanks in advance!

Tom


> Gesendet: Montag, 02. September 2019 um 10:39 Uhr
> Von: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> An: users@wicket.apache.org
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Hi,
> 
> On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de> wrote:
> 
> > Thanks Ernesto! This example is from 2007 though and uses
> > compent.setComponentBorder ....
> > Is there something more close to current Wicket versions available maybe?
> > :)
> >
> 
> I think I have somewhere on a private project something similar implemented
> for Wicket 7.x... I can try to dig it up and send classes to you.
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro
>

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


Re: Wrapping a FormComponent with a Border

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

On Mon, Sep 2, 2019 at 11:13 AM Tom Götz <to...@richmountain.de> wrote:

> Thanks Ernesto! This example is from 2007 though and uses
> compent.setComponentBorder ....
> Is there something more close to current Wicket versions available maybe?
> :)
>

I think I have somewhere on a private project something similar implemented
for Wicket 7.x... I can try to dig it up and send classes to you.

-- 
Regards - Ernesto Reinaldo Barreiro

Re: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
Thanks Ernesto! This example is from 2007 though and uses compent.setComponentBorder ....
Is there something more close to current Wicket versions available maybe? :)

Tom



> Am 02.09.2019 um 09:41 schrieb Ernesto Reinaldo Barreiro <re...@gmail.com>:
> 
> Hi,
> 
> Would approach described in [1] match your use case?
> 
> References
> 
> 1- https://www.scribd.com/document/43719247/LondonWicket-FormsWithFlair
> 
>> On Mon, Sep 2, 2019 at 10:22 AM Tom Götz <to...@decoded.de> wrote:
>> 
>> Hi there,
>> 
>> I would like to automatically wrap a FormComponent with a Border whenever
>> it is added on a certain page. Let's say, a TextField is added, then I'd
>> like to replace it with Border and add that TextField to the Border. The
>> Border itself contains other Wicket Components such as a Label and a
>> FeedbackPanel. I am aware of BorderBehavior, but it seems that this can
>> only be used to wrap raw HTML around a Component.
>> Is this possible somehow?
>> 
>> Cheers
>> Tom
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro


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


Re: Wrapping a FormComponent with a Border

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

Would approach described in [1] match your use case?

References

1- https://www.scribd.com/document/43719247/LondonWicket-FormsWithFlair

On Mon, Sep 2, 2019 at 10:22 AM Tom Götz <to...@decoded.de> wrote:

> Hi there,
>
> I would like to automatically wrap a FormComponent with a Border whenever
> it is added on a certain page. Let's say, a TextField is added, then I'd
> like to replace it with Border and add that TextField to the Border. The
> Border itself contains other Wicket Components such as a Label and a
> FeedbackPanel. I am aware of BorderBehavior, but it seems that this can
> only be used to wrap raw HTML around a Component.
> Is this possible somehow?
>
> Cheers
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro

Aw: Wrapping a FormComponent with a Border

Posted by Tom Götz <to...@richmountain.de>.
The Border I'd like to use for wrapping my FormComponents is the FormGroup from the wicket-bootstrap project: https://bit.ly/2lmU9cq.
So, the user should only care about adding the FormComponent and then I would like to wrap it with this Border ... any ideas?

Tom


> Gesendet: Montag, 02. September 2019 um 09:22 Uhr
> Von: "Tom Götz" <to...@decoded.de>
> An: users@wicket.apache.org
> Betreff: Wrapping a FormComponent with a Border
>
> Hi there,
>  
> I would like to automatically wrap a FormComponent with a Border whenever it is added on a certain page. Let's say, a TextField is added, then I'd like to replace it with Border and add that TextField to the Border. The Border itself contains other Wicket Components such as a Label and a FeedbackPanel. I am aware of BorderBehavior, but it seems that this can only be used to wrap raw HTML around a Component.
> Is this possible somehow? 
>  
> Cheers
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
>

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