You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Francis De Brabandere <fr...@gmail.com> on 2007/11/21 12:20:52 UTC

disabled AjaxEditableMultiLineLabel

doing setEnabled(false) on a AjaxEditableMultiLineLabel does not disable the
editing feature

this can be fixed by overriding onEdit():

            @Override
            protected void onEdit(AjaxRequestTarget target) {
                if(isEnabled()){
                    super.onEdit(target);
                }
            }

but shouldn't this be changed in the AjaxEditableMultiLineLabel source?

ps: this might be needed on other ajax edit lables too

-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Re: disabled AjaxEditableMultiLineLabel

Posted by Al Maw <al...@gmail.com>.
Gerolf Seitz wrote:
> i found the "problem":
> what i mentioned before with onBeforeRender didn't make it into rc1. sorry
> for messing that up.
> 
> but now there are two checks for enabled/disabled.
> i actually prefer the one with dis-/enabling the label in onBeforeRender,
> because this way the onClick attribute doesn't even get rendered,
> whereas with the second approach there's an ajax roundtrip which is
> basically in vain, since nothing will be done anyway...
> 
> Al, if you don't mind, i'd like to remove the check in
> AjaxLabelBehavior#onEvent again.

Sure, go right ahead.

I think if you enable a component, you should have to add it to the 
AjaxRequestTarget anyway (which if you do the round-trip regardless, of 
course you don't).


Regards,

Al

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


Re: disabled AjaxEditableMultiLineLabel

Posted by Gerolf Seitz <ge...@gmail.com>.
i found the "problem":
what i mentioned before with onBeforeRender didn't make it into rc1. sorry
for messing that up.

but now there are two checks for enabled/disabled.
i actually prefer the one with dis-/enabling the label in onBeforeRender,
because this way the onClick attribute doesn't even get rendered,
whereas with the second approach there's an ajax roundtrip which is
basically in vain, since nothing will be done anyway...

Al, if you don't mind, i'd like to remove the check in
AjaxLabelBehavior#onEvent again.

  Gerolf

On Nov 22, 2007 9:44 AM, Francis De Brabandere <fr...@gmail.com> wrote:

> This is the code (wicket 1.3 rc1)
>
>        add(new AjaxEditableMultiLineLabel("Comment", new
> PropertyModel(experiment, "experimentDetailStat.Comment")){
>        /*
>            @Override
>            protected void onEdit(AjaxRequestTarget target) {
>                if(isEnabled()){
>                    super.onEdit(target);
>                }
>            }
>            */
>
>            @Override
>            protected void onSubmit(AjaxRequestTarget target) {
>                super.onSubmit(target);
>                Util.getBean(GenericLocal.class).saveObject(
> experiment.getExperimentDetailStat());
>            }
>        }.setEnabled(LoginSession.get().isAdmin()));
>
> and I tested by replacing the LoginSession.get().isAdmin() by false but
> I'm
> still able to edit that field
>
> Regards
>
> Francis
>
> On 11/21/07, Gerolf Seitz <ge...@gmail.com> wrote:
> >
> > Francis,
> > i would really be interested in your code that doesn't seem to work, if
> > you
> > don't mind.
> > as of before Al's fix, it already worked for me because:
> >
> > the label is dis-/enabled in AjaxEditableLabel#onBeforeRender:
> > label.setEnabled(isEnableAllowed() && isEnabled());
> >
> > and since the LabelAjaxBehavior is derived from AjaxEventBehavior, the
> > eventhandler is only rendered,
> > if the associated component is enabled. see
> > AjaxEventBehavior#onComponentTag
> >
> > regards,
> >   Gerolf
> >
> > On Nov 21, 2007 1:26 PM, Francis De Brabandere <fr...@gmail.com>
> > wrote:
> >
> > > ok, i'll check on next release
> > >
> > > On Nov 21, 2007 12:56 PM, Al Maw <wi...@almaw.com> wrote:
> > >
> > > > Francis De Brabandere wrote:
> > > > > doing setEnabled(false) on a AjaxEditableMultiLineLabel does not
> > > disable
> > > > the
> > > > > editing feature
> > > > >
> > > > > this can be fixed by overriding onEdit():
> > > > >
> > > > >             @Override
> > > > >             protected void onEdit(AjaxRequestTarget target) {
> > > > >                 if(isEnabled()){
> > > > >                     super.onEdit(target);
> > > > >                 }
> > > > >             }
> > > > >
> > > > > but shouldn't this be changed in the AjaxEditableMultiLineLabel
> > > source?
> > > > >
> > > > > ps: this might be needed on other ajax edit lables too
> > > >
> > > > It is. This should now be fixed in trunk.
> > > >
> > > > Regards,
> > > >
> > > > Al
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > http://www.somatik.be
> > > Microsoft gives you windows, Linux gives you the whole house.
> > >
> >
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>

Re: disabled AjaxEditableMultiLineLabel

Posted by Francis De Brabandere <fr...@gmail.com>.
This is the code (wicket 1.3 rc1)

        add(new AjaxEditableMultiLineLabel("Comment", new
PropertyModel(experiment, "experimentDetailStat.Comment")){
        /*
            @Override
            protected void onEdit(AjaxRequestTarget target) {
                if(isEnabled()){
                    super.onEdit(target);
                }
            }
            */

            @Override
            protected void onSubmit(AjaxRequestTarget target) {
                super.onSubmit(target);
                Util.getBean(GenericLocal.class).saveObject(
experiment.getExperimentDetailStat());
            }
        }.setEnabled(LoginSession.get().isAdmin()));

and I tested by replacing the LoginSession.get().isAdmin() by false but I'm
still able to edit that field

Regards

Francis

On 11/21/07, Gerolf Seitz <ge...@gmail.com> wrote:
>
> Francis,
> i would really be interested in your code that doesn't seem to work, if
> you
> don't mind.
> as of before Al's fix, it already worked for me because:
>
> the label is dis-/enabled in AjaxEditableLabel#onBeforeRender:
> label.setEnabled(isEnableAllowed() && isEnabled());
>
> and since the LabelAjaxBehavior is derived from AjaxEventBehavior, the
> eventhandler is only rendered,
> if the associated component is enabled. see
> AjaxEventBehavior#onComponentTag
>
> regards,
>   Gerolf
>
> On Nov 21, 2007 1:26 PM, Francis De Brabandere <fr...@gmail.com>
> wrote:
>
> > ok, i'll check on next release
> >
> > On Nov 21, 2007 12:56 PM, Al Maw <wi...@almaw.com> wrote:
> >
> > > Francis De Brabandere wrote:
> > > > doing setEnabled(false) on a AjaxEditableMultiLineLabel does not
> > disable
> > > the
> > > > editing feature
> > > >
> > > > this can be fixed by overriding onEdit():
> > > >
> > > >             @Override
> > > >             protected void onEdit(AjaxRequestTarget target) {
> > > >                 if(isEnabled()){
> > > >                     super.onEdit(target);
> > > >                 }
> > > >             }
> > > >
> > > > but shouldn't this be changed in the AjaxEditableMultiLineLabel
> > source?
> > > >
> > > > ps: this might be needed on other ajax edit lables too
> > >
> > > It is. This should now be fixed in trunk.
> > >
> > > Regards,
> > >
> > > Al
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > http://www.somatik.be
> > Microsoft gives you windows, Linux gives you the whole house.
> >
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Re: disabled AjaxEditableMultiLineLabel

Posted by Gerolf Seitz <ge...@gmail.com>.
Francis,
i would really be interested in your code that doesn't seem to work, if you
don't mind.
as of before Al's fix, it already worked for me because:

the label is dis-/enabled in AjaxEditableLabel#onBeforeRender:
label.setEnabled(isEnableAllowed() && isEnabled());

and since the LabelAjaxBehavior is derived from AjaxEventBehavior, the
eventhandler is only rendered,
if the associated component is enabled. see AjaxEventBehavior#onComponentTag

regards,
  Gerolf

On Nov 21, 2007 1:26 PM, Francis De Brabandere <fr...@gmail.com> wrote:

> ok, i'll check on next release
>
> On Nov 21, 2007 12:56 PM, Al Maw <wi...@almaw.com> wrote:
>
> > Francis De Brabandere wrote:
> > > doing setEnabled(false) on a AjaxEditableMultiLineLabel does not
> disable
> > the
> > > editing feature
> > >
> > > this can be fixed by overriding onEdit():
> > >
> > >             @Override
> > >             protected void onEdit(AjaxRequestTarget target) {
> > >                 if(isEnabled()){
> > >                     super.onEdit(target);
> > >                 }
> > >             }
> > >
> > > but shouldn't this be changed in the AjaxEditableMultiLineLabel
> source?
> > >
> > > ps: this might be needed on other ajax edit lables too
> >
> > It is. This should now be fixed in trunk.
> >
> > Regards,
> >
> > Al
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>

Re: disabled AjaxEditableMultiLineLabel

Posted by Francis De Brabandere <fr...@gmail.com>.
ok, i'll check on next release

On Nov 21, 2007 12:56 PM, Al Maw <wi...@almaw.com> wrote:

> Francis De Brabandere wrote:
> > doing setEnabled(false) on a AjaxEditableMultiLineLabel does not disable
> the
> > editing feature
> >
> > this can be fixed by overriding onEdit():
> >
> >             @Override
> >             protected void onEdit(AjaxRequestTarget target) {
> >                 if(isEnabled()){
> >                     super.onEdit(target);
> >                 }
> >             }
> >
> > but shouldn't this be changed in the AjaxEditableMultiLineLabel source?
> >
> > ps: this might be needed on other ajax edit lables too
>
> It is. This should now be fixed in trunk.
>
> Regards,
>
> Al
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Re: disabled AjaxEditableMultiLineLabel

Posted by Al Maw <wi...@almaw.com>.
Francis De Brabandere wrote:
> doing setEnabled(false) on a AjaxEditableMultiLineLabel does not disable the
> editing feature
> 
> this can be fixed by overriding onEdit():
> 
>             @Override
>             protected void onEdit(AjaxRequestTarget target) {
>                 if(isEnabled()){
>                     super.onEdit(target);
>                 }
>             }
> 
> but shouldn't this be changed in the AjaxEditableMultiLineLabel source?
> 
> ps: this might be needed on other ajax edit lables too

It is. This should now be fixed in trunk.

Regards,

Al

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


Re: disabled AjaxEditableMultiLineLabel

Posted by Francis De Brabandere <fr...@gmail.com>.
we are using 1.3rc1 yes, I don't think it is implemented

On Nov 21, 2007 12:39 PM, Gerolf Seitz <ge...@gmail.com> wrote:

> what wicket version do you use? this should already work in 1.3rc1
>
>  Gerolf
>
> On Nov 21, 2007 12:20 PM, Francis De Brabandere <francisdb@gmail.com >
> wrote:
>
> > doing setEnabled(false) on a AjaxEditableMultiLineLabel does not disable
> > the
> > editing feature
> >
> > this can be fixed by overriding onEdit():
> >
> >            @Override
> >            protected void onEdit(AjaxRequestTarget target) {
> >                if(isEnabled()){
> >                    super.onEdit(target);
> >                }
> >            }
> >
> > but shouldn't this be changed in the AjaxEditableMultiLineLabel source?
> >
> > ps: this might be needed on other ajax edit lables too
> >
> > --
> > http://www.somatik.be
> > Microsoft gives you windows, Linux gives you the whole house.
> >
> >
> >
> > --
> > http://www.somatik.be
> > Microsoft gives you windows, Linux gives you the whole house.
> >
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Re: disabled AjaxEditableMultiLineLabel

Posted by Gerolf Seitz <ge...@gmail.com>.
what wicket version do you use? this should already work in 1.3rc1

  Gerolf

On Nov 21, 2007 12:20 PM, Francis De Brabandere <francisdb@gmail.com >
wrote:

> doing setEnabled(false) on a AjaxEditableMultiLineLabel does not disable
> the
> editing feature
>
> this can be fixed by overriding onEdit():
>
>            @Override
>            protected void onEdit(AjaxRequestTarget target) {
>                if(isEnabled()){
>                    super.onEdit(target);
>                }
>            }
>
> but shouldn't this be changed in the AjaxEditableMultiLineLabel source?
>
> ps: this might be needed on other ajax edit lables too
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>