Hi Dan,
I've (mostly) implemented an equivalent hidden() on object, and I
discovered that I was missing adding my HiddenMethodFact from the
metamodel.
Now I got the hidden() method working in the htmlviewer, but it could
be a bit of a kludge, as this approach would need each viewer to be
handled specifically.
Anyway - using this knowledge, I went back to the disabled() method,
and realised that I am probably looking at hooking into the isVetoed
and equivalent methods in the metamodel, but I can't find where the
Context is setup and appropriate Facets interrogated.
Where else do I need to add my DisabledObjectFacet so that the
metamodel picks it up?
Regards,
Kevin
On 30 Nov 2011 at 17:53, Kevin Meyer - KMZ wrote:
> Hi Dan,
>
> I remember discussing something like this with you at the Knockree
> retreat - I've implemented the various classes to support a
> String disabled(){..};
> method on an object, to runtime prevent a user from editting any of the
> properties.
>
> The problem is, it doesn't work! :)
>
> Following the examples of the Immutable facet and the "validate"
> method facet, I have:
>
> public class DisabledObjectFacetViaDisabledMethod extends
> DisabledObjectFacetAbstract implements ImperativeFacet
>
> where
>
> public abstract class DisabledObjectFacetAbstract extends FacetAbstract
> implements DisabledObjectFacet
>
> and
>
> public interface DisabledObjectFacet extends Facet,
> DisablingInteractionAdvisor
>
> The factory is registered in ProgrammingModelFacetsJava5:
> addFactory(DisabledObjectViaDisabledMethodFacetFactory.class);
>
> But when I load an object with the "disabled()" method, I can still edit it.
> The "disabled" method is not visible, so it's being picked up...
>
> This tells me that the "DisablingInteractionAdvisor " is not doing what I
> expect..
>
> What am I missing?
>
>
> Since the unit test passes, I'll check in the code, associated with
> ISIS-142
>
> Regards,
> Kevin
>
--
Kevin Meyer, PhD, Pr.Sci.Nat
KMZ P.O. Box 9822, Sharon Park, South Africa.
Tel: +27 11 363 2001 Cell: +27 83 346 3045