Hi!

I'd make this case more general -- we have faced the one like this in
non-JS-case.

For instance, there is a Panel which contains a DataTable. Each row of
datatable represents a Document. Each row contains a set of buttons - Edit
Confirm and Download.
When panel is hidden due to security (isVisibleInHierarchy and
authorization strategy) no issues here.

However, in a case when we make the whole panel disabled with the
permissions, everything would be disabled within this panel. It is good for
Edit, Confirm buttons. It is not good for Download button. Requirement and
common sense allow for viewing everything.

I was unable to get this on easily :(

Issue is that Component's both isEnableAllowed (bindings to the auth
strategy) and isEnabledInHierarchy(traversing up component tree) are final.
Thus there is no way to make an 'exception' for certain components. In our
case, if the parent panel is disabled, everything within it would be
disabled, with no exceptions. And we need an exception.

We had to go the hard way of making our own layer of components which
support more flexible enabled/readonly behavior -- extending every single
component. Also, instead of using built-in
MetaDataRoleAuthorizationStrategy which is looped into component's life
cycle we had to bind this behavior in the compat layer component's own
lifecycle (binding to onBeforeRender and modifying isEnabled accordingly).

Maybe there's some better way that we missed?

Using wicket 1.4

Thank you all!
br,
alex.

2012/5/9 Martin Grigorov <mgrigo...@apache.org>

> Hi,
>
> Why don't use plain Javascript for this. It will be faster because it
> wont make roundtrip to the server and wont be disabled as a Wicket
> component ?
>
> On Wed, May 9, 2012 at 12:06 PM, Jürgen Lind <juergen.l...@iteratec.de>
> wrote:
> > Hi,
> >
> > I have a little problem in my application and maybe someone has an idea
> how
> > to solve it:
> > I have a complex form that is structured using a custom collapsible
> > AJAX-panel to show/hide
> > certain parts of the form. Now, if a user does not have the write
> permission
> > for the form, the
> > form is disabled and therefore all input elements as well (which is
> good).
> > However, for
> > obvious reaons, I would like the collapsible panels to remain enabled.
> How
> > could I achieve
> > this? I have already tried to have the ajax-link for the panel to always
> > return true from
> > isEnabled, but that seems to be overriden by the parent component. Any
> ideas
> > where to look?
> >
> > Cheers,
> >
> > Jürgen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Alexander Cherednichenko

[ the only way out is the way up ]

Reply via email to