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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
> > wrote:
> >
> > > ok, i'll check on next release
> > >
> > > On Nov 21, 2007 12:56 PM, Al Maw <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > --
> > > 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.
>

Reply via email to