You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andrew Berman <at...@gmail.com> on 2009/06/26 05:41:10 UTC

Hiding Components based on style

I am using Wicket 1.3 and was wondering if there is a way to hide components
in the HTML itself.  Here's the issue, say I have two forms and two
different styles.  In one style I want to display all the form fields,
however in the other one I want to display only a couple of them.  I
currently have two HTML files, one for each style, but I can't seem to find
a way to hide the form fields aside from using CSS and adding display:none.
Is that the only way to do it?

Thanks!

RE: Hiding Components based on style

Posted by "Rowe, Richard A." <RI...@saic.com>.
Andrew-

I use an attribute modifier to change styles on the fly. I create a css
with all my styles as "classes". Then I use the AttributeModifier class
to change the class attribute to be the style I want. Hope this helps.

Richard Rowe


-----Original Message-----
From: users-return-39080-RICHARD.A.ROWE=saic.com@wicket.apache.org
[mailto:users-return-39080-RICHARD.A.ROWE=saic.com@wicket.apache.org] On
Behalf Of Andrew Berman
Sent: Friday, June 26, 2009 2:13 PM
To: users@wicket.apache.org
Subject: Re: Hiding Components based on style

Right, I know that way, but I don't want to I don't want to do that
though
Igor.  That seems like really bad practice as I add styles constantly
and I
don't want to have to make a code change every time I add a style.  It's
much better for me to just modify the HTML and be done with it without
having to make code changes.  I really think there should be a way to do
this with some sort of comment tag or something.  Maybe there needs to
be a
<wicket:comment> tag where the code inside is evaluated so there are no
errors but that the component is hidden.

Thanks for your help,

Andrew

On Thu, Jun 25, 2009 at 8:47 PM, Igor Vaynberg
<ig...@gmail.com>wrote:

> add(new textfield(..) { isvisible() { return
> getsession.getstyle().equals("foo"); }});
>
> -igor
>
> On Thu, Jun 25, 2009 at 8:41 PM, Andrew Berman<at...@gmail.com>
wrote:
> > I am using Wicket 1.3 and was wondering if there is a way to hide
> components
> > in the HTML itself.  Here's the issue, say I have two forms and two
> > different styles.  In one style I want to display all the form
fields,
> > however in the other one I want to display only a couple of them.  I
> > currently have two HTML files, one for each style, but I can't seem
to
> find
> > a way to hide the form fields aside from using CSS and adding
> display:none.
> > Is that the only way to do it?
> >
> > Thanks!
> >
>
> ---------------------------------------------------------------------
> 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: Hiding Components based on style

Posted by Andrew Berman <at...@gmail.com>.
Cool that's what I was looking for Igor.  Thank you!

Also, thank you Richard.  I know of the CSS route, but I really wanted to
not have it show up in the actual HTML as I didn't want someone hacking the
form or being able to turn on the link using something like Web Developer in
Firefox.

Thanks guys!

On Fri, Jun 26, 2009 at 11:24 AM, Igor Vaynberg <ig...@gmail.com>wrote:

> so you want to include all possible components in the class, but
> exclude some in the markup and not have an error? fine, just turn off
> componentusecheck in debug settings.
>
> -igor
>
> On Fri, Jun 26, 2009 at 11:13 AM, Andrew Berman<at...@gmail.com> wrote:
> > Right, I know that way, but I don't want to I don't want to do that
> though
> > Igor.  That seems like really bad practice as I add styles constantly and
> I
> > don't want to have to make a code change every time I add a style.  It's
> > much better for me to just modify the HTML and be done with it without
> > having to make code changes.  I really think there should be a way to do
> > this with some sort of comment tag or something.  Maybe there needs to be
> a
> > <wicket:comment> tag where the code inside is evaluated so there are no
> > errors but that the component is hidden.
> >
> > Thanks for your help,
> >
> > Andrew
> >
> > On Thu, Jun 25, 2009 at 8:47 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> >wrote:
> >
> >> add(new textfield(..) { isvisible() { return
> >> getsession.getstyle().equals("foo"); }});
> >>
> >> -igor
> >>
> >> On Thu, Jun 25, 2009 at 8:41 PM, Andrew Berman<at...@gmail.com>
> wrote:
> >> > I am using Wicket 1.3 and was wondering if there is a way to hide
> >> components
> >> > in the HTML itself.  Here's the issue, say I have two forms and two
> >> > different styles.  In one style I want to display all the form fields,
> >> > however in the other one I want to display only a couple of them.  I
> >> > currently have two HTML files, one for each style, but I can't seem to
> >> find
> >> > a way to hide the form fields aside from using CSS and adding
> >> display:none.
> >> > Is that the only way to do it?
> >> >
> >> > Thanks!
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> 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: Hiding Components based on style

Posted by Igor Vaynberg <ig...@gmail.com>.
so you want to include all possible components in the class, but
exclude some in the markup and not have an error? fine, just turn off
componentusecheck in debug settings.

-igor

On Fri, Jun 26, 2009 at 11:13 AM, Andrew Berman<at...@gmail.com> wrote:
> Right, I know that way, but I don't want to I don't want to do that though
> Igor.  That seems like really bad practice as I add styles constantly and I
> don't want to have to make a code change every time I add a style.  It's
> much better for me to just modify the HTML and be done with it without
> having to make code changes.  I really think there should be a way to do
> this with some sort of comment tag or something.  Maybe there needs to be a
> <wicket:comment> tag where the code inside is evaluated so there are no
> errors but that the component is hidden.
>
> Thanks for your help,
>
> Andrew
>
> On Thu, Jun 25, 2009 at 8:47 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> add(new textfield(..) { isvisible() { return
>> getsession.getstyle().equals("foo"); }});
>>
>> -igor
>>
>> On Thu, Jun 25, 2009 at 8:41 PM, Andrew Berman<at...@gmail.com> wrote:
>> > I am using Wicket 1.3 and was wondering if there is a way to hide
>> components
>> > in the HTML itself.  Here's the issue, say I have two forms and two
>> > different styles.  In one style I want to display all the form fields,
>> > however in the other one I want to display only a couple of them.  I
>> > currently have two HTML files, one for each style, but I can't seem to
>> find
>> > a way to hide the form fields aside from using CSS and adding
>> display:none.
>> > Is that the only way to do it?
>> >
>> > Thanks!
>> >
>>
>> ---------------------------------------------------------------------
>> 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: Hiding Components based on style

Posted by "Rowe, Richard A." <RI...@saic.com>.
Andrew-

One more thing. I have already added my style sheet to the page like
this:

add(HeaderContributor.forCss("pathto/styles.css"));

Richard


-----Original Message-----
From: users-return-39080-RICHARD.A.ROWE=saic.com@wicket.apache.org
[mailto:users-return-39080-RICHARD.A.ROWE=saic.com@wicket.apache.org] On
Behalf Of Andrew Berman
Sent: Friday, June 26, 2009 2:13 PM
To: users@wicket.apache.org
Subject: Re: Hiding Components based on style

Right, I know that way, but I don't want to I don't want to do that
though
Igor.  That seems like really bad practice as I add styles constantly
and I
don't want to have to make a code change every time I add a style.  It's
much better for me to just modify the HTML and be done with it without
having to make code changes.  I really think there should be a way to do
this with some sort of comment tag or something.  Maybe there needs to
be a
<wicket:comment> tag where the code inside is evaluated so there are no
errors but that the component is hidden.

Thanks for your help,

Andrew

On Thu, Jun 25, 2009 at 8:47 PM, Igor Vaynberg
<ig...@gmail.com>wrote:

> add(new textfield(..) { isvisible() { return
> getsession.getstyle().equals("foo"); }});
>
> -igor
>
> On Thu, Jun 25, 2009 at 8:41 PM, Andrew Berman<at...@gmail.com>
wrote:
> > I am using Wicket 1.3 and was wondering if there is a way to hide
> components
> > in the HTML itself.  Here's the issue, say I have two forms and two
> > different styles.  In one style I want to display all the form
fields,
> > however in the other one I want to display only a couple of them.  I
> > currently have two HTML files, one for each style, but I can't seem
to
> find
> > a way to hide the form fields aside from using CSS and adding
> display:none.
> > Is that the only way to do it?
> >
> > Thanks!
> >
>
> ---------------------------------------------------------------------
> 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: Hiding Components based on style

Posted by Andrew Berman <at...@gmail.com>.
Right, I know that way, but I don't want to I don't want to do that though
Igor.  That seems like really bad practice as I add styles constantly and I
don't want to have to make a code change every time I add a style.  It's
much better for me to just modify the HTML and be done with it without
having to make code changes.  I really think there should be a way to do
this with some sort of comment tag or something.  Maybe there needs to be a
<wicket:comment> tag where the code inside is evaluated so there are no
errors but that the component is hidden.

Thanks for your help,

Andrew

On Thu, Jun 25, 2009 at 8:47 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> add(new textfield(..) { isvisible() { return
> getsession.getstyle().equals("foo"); }});
>
> -igor
>
> On Thu, Jun 25, 2009 at 8:41 PM, Andrew Berman<at...@gmail.com> wrote:
> > I am using Wicket 1.3 and was wondering if there is a way to hide
> components
> > in the HTML itself.  Here's the issue, say I have two forms and two
> > different styles.  In one style I want to display all the form fields,
> > however in the other one I want to display only a couple of them.  I
> > currently have two HTML files, one for each style, but I can't seem to
> find
> > a way to hide the form fields aside from using CSS and adding
> display:none.
> > Is that the only way to do it?
> >
> > Thanks!
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Hiding Components based on style

Posted by Igor Vaynberg <ig...@gmail.com>.
add(new textfield(..) { isvisible() { return
getsession.getstyle().equals("foo"); }});

-igor

On Thu, Jun 25, 2009 at 8:41 PM, Andrew Berman<at...@gmail.com> wrote:
> I am using Wicket 1.3 and was wondering if there is a way to hide components
> in the HTML itself.  Here's the issue, say I have two forms and two
> different styles.  In one style I want to display all the form fields,
> however in the other one I want to display only a couple of them.  I
> currently have two HTML files, one for each style, but I can't seem to find
> a way to hide the form fields aside from using CSS and adding display:none.
> Is that the only way to do it?
>
> Thanks!
>

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