wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard W. Adams" <RWADA...@UP.COM>
Subject Re: Graying Out Disabled Buttons/Controls
Date Wed, 26 Jun 2013 13:42:10 GMT
I believe the parent component (the page itself) is visible. My test page 
is very simple, with only two buttons, one enabled & the other disabled; 
both buttons are children of the page itself. However, only the enabled 
button appears in the generated HTML. I've tried changing the order of the 
various method calls in createDisabledButton(), tried overriding 
isVisible() with return true, etc. No matter what I do, though, the the 
generated HTML does not include the disabled button.

I'm out of ideas. Does this work in a later version of Wicket (after 
1.14.17)?
_________________________________

The source HTML (extends a generic page type, whose header/footer display 
correctly):

<wicket:extend xmlns:wicket="http://wicket.apache.org">

<p>This page demonstrates the inability to make disabled buttons visible, 
but grayed out.</p>

<button value="Enabled Button" wicket:id="enabled-button"></button>
<button value="Disabled Button" wicket:id="disabled-button"></button>

</wicket:extend>
_________________________________

The source code:
_________________________________

public DisabledButtonPage() {

        add(new Button("enabled-button"));
        add(createDisabledButton());
}
private Button createDisabledButton() {

        final Button button = new Button("disabled-button");
        button.setVisibilityAllowed(true);
        button.setVisible(true);
        button.setEnabled(false);
        return button;
}





From:   Paul Bors <paul@bors.ws>
To:     users@wicket.apache.org
Date:   06/26/2013 08:30 AM
Subject:        Re: Graying Out Disabled Buttons/Controls



You need to make sure all of your component parents are also visible.

Remeber that wicket uses a component tree (you can see it in your
DebugToolbar if you add it to your pages).
The inspector looks something like this:

http://www.wicket-library.com/wicket-examples-6.0.x/spring/wicket/bookmarkable/org.apache.wicket.devutils.inspector.InspectorPage;jsessionid=76EE1D9ED70B7660542E78B4C1333951?0&pageId=0



On Wed, Jun 26, 2013 at 9:16 AM, Richard W. Adams <RWADAMS1@up.com> wrote:

> We tried that (code below), but the button does not appear in the
> generated HTML. We're using Wicket 1.4.17. Do later versions of Wicket
> render a grayed out (vice invisible) button?
>
> private Button createDisabledButton() {
>
>         final Button button = new Button("disabled-button");
>         button.setEnabled(false);
>         button.setVisible(true);
>         return button;
> }
>
>
>
>
> From:   Thomas Matthijs <lists@selckin.be>
> To:     users@wicket.apache.org
> Date:   06/26/2013 07:45 AM
> Subject:        Re: Graying Out Disabled Buttons/Controls
>
>
>
> On Wed, Jun 26, 2013 at 2:30 PM, Richard W. Adams <RWADAMS1@up.com> 
wrote:
>
> > We have a customer requirement that disabled form buttons be grayed 
out
> > rather than Wicket's default behavior of making them invisible. Google
> has
> > a lot of discussion on the topic, but I didn't see a "best practice"
> > solution. Does Wicket provide a way to gray out buttons (or any form
> > control, for that matter)?
> >
>
>
> Use setEnabled(false) instead of setVisible()
>
>
>
> **
>
> This email and any attachments may contain information that is
> confidential and/or privileged for the sole use of the intended 
recipient.
>  Any use, review, disclosure, copying, distribution or reliance by 
others,
> and any forwarding of this email or its contents, without the express
> permission of the sender is strictly prohibited by law.  If you are not 
the
> intended recipient, please contact the sender immediately, delete the
> e-mail and destroy all copies.
> **
>



**

This email and any attachments may contain information that is confidential and/or privileged
for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution
or reliance by others, and any forwarding of this email or its contents, without the express
permission of the sender is strictly prohibited by law.  If you are not the intended recipient,
please contact the sender immediately, delete the e-mail and destroy all copies.
**

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message