public static InteractionBuffer IsValid(IFacetHolder facetHolder, InteractionContext ic, InteractionBuffer buf) {
     IFacet[] facets = facetHolder.GetFacets(FacetFilters.IsA(typeof (IValidatingInteractionAdvisor)));
     foreach (IValidatingInteractionAdvisor advisor in facets) {
         buf.Append(advisor.Invalidates(ic));
     }
     return buf;
 }
 private static InteractionBuffer IsUsable(IFacetHolder facetHolder, InteractionContext ic, InteractionBuffer buf) {
     IFacet[] facets = facetHolder.GetFacets(FacetFilters.IsA(typeof (IDisablingInteractionAdvisor)));
     foreach (IDisablingInteractionAdvisor advisor in facets) {
         buf.Append(advisor.Disables(ic));
     }
     return buf;
 }
 public virtual string Invalidates(InteractionContext ic) {
     INakedObject proposedArgument = ic.ProposedArgument;
     if (DoesNotMatch(proposedArgument)) {
         return string.Format(Resources.NakedObjects.MaskMismatch, proposedArgument.TitleString(), Value);
     }
     return null;
 }
 public virtual string Invalidates(InteractionContext ic) {
     INakedObject proposedArgument = ic.ProposedArgument;
     if (!Exceeds(proposedArgument)) {
         return null;
     }
     return string.Format(Resources.NakedObjects.MaximumLengthMismatch, Value);
 }
 public virtual string Disables(InteractionContext ic) {
     if (!ic.TypeEquals(InteractionType.ObjectPersist)) {
         return null;
     }
     INakedObject target = ic.Target;
     return DisabledReason(target);
 }
 public static bool IsVisible(IFacetHolder facetHolder, InteractionContext ic) {
     var buf = new InteractionBuffer();
     IFacet[] facets = facetHolder.GetFacets(FacetFilters.IsA(typeof (IHidingInteractionAdvisor)));
     foreach (IHidingInteractionAdvisor advisor in facets) {
         buf.Append(advisor.Hides(ic));
     }
     return IsVisible(buf);
 }
        public virtual string Invalidates(InteractionContext ic) {
            INakedObject proposedArgument = ic.ProposedArgument;
            if (proposedArgument == null) {
                return null;
            }
            string titleString = proposedArgument.TitleString();
            if (!DoesNotMatch(titleString)) {
                return null;
            }

            return failureMessage ?? Resources.NakedObjects.InvalidEntry;
        }
 public static bool IsVisibleWhenPersistent(IFacetHolder facetHolder, InteractionContext ic) {
     var buf = new InteractionBuffer();
     IFacet[] facets = facetHolder.GetFacets(FacetFilters.IsA(typeof (IHidingInteractionAdvisor)));
     foreach (IHidingInteractionAdvisor advisor in facets) {
         if (advisor is IHiddenFacet) {
             if (((IHiddenFacet) advisor).Value == When.OncePersisted) {
                 continue;
             }
         }
         buf.Append(advisor.Hides(ic));
     }
     return IsVisible(buf);
 }
Exemple #9
0
 public string Invalidates(InteractionContext ic) {
     return null;
 }
Exemple #10
0
 public InvalidException CreateExceptionFor(InteractionContext ic) {
     return null;
 }
 public virtual InvalidException CreateExceptionFor(InteractionContext ic) {
     return new InvalidMaskException(ic, Invalidates(ic));
 }
 public InvalidMandatoryException(InteractionContext ic)
     : this(ic, Resources.NakedObjects.Mandatory) {}
 public static IConsent IsValid(IFacetHolder facetHolder, InteractionContext ic) {
     InteractionBuffer buf = IsValid(facetHolder, ic, new InteractionBuffer());
     return IsValid(buf);
 }
 public virtual string Disables(InteractionContext ic) {
     INakedObject target = ic.Target;
     return DisabledReason(target);
 }
 public virtual string Invalidates(InteractionContext ic) {
     return InvalidReason(ic.Target, ic.ProposedArguments);
 }
 public ActionArgumentsInvalidException(InteractionContext ic, string message)
     : base(ic, message) {}
 public virtual string Hides(InteractionContext ic) {
     return HiddenReason(ic.Target);
 }
 public virtual InvalidException CreateExceptionFor(InteractionContext ic) {
     return new InvalidMaxLengthException(ic, Value, Invalidates(ic));
 }
 public InvalidMaskException(InteractionContext ic)
     : this(ic, Resources.NakedObjects.MaskError) {}
 public virtual string Invalidates(InteractionContext ic) {
     return IsRequiredButNull(ic.ProposedArgument) ? Resources.NakedObjects.Mandatory : null;
 }
 public virtual HiddenException CreateExceptionFor(InteractionContext ic) {
     return new HiddenException(ic, Hides(ic));
 }
 public virtual InvalidException CreateExceptionFor(InteractionContext ic) {
     return new InvalidRegExException(ic, FormatPattern, ValidationPattern, IsCaseSensitive, Invalidates(ic));
 }
 public ActionArgumentsInvalidException(InteractionContext ic)
     : this(ic, Resources.NakedObjects.InvalidArguments) {}
 public InvalidMaxLengthException(InteractionContext ic, int maximumLength)
     : this(ic, maximumLength, Resources.NakedObjects.MaximumLengthMessage) {}
 public virtual DisabledException CreateExceptionFor(InteractionContext ic) {
     return new DisabledException(ic, Disables(ic));
 }
 public InvalidMaxLengthException(InteractionContext ic, int maximumLength, string message)
     : base(ic, message) {
     this.maximumLength = maximumLength;
 }
 public virtual InvalidException CreateExceptionFor(InteractionContext ic) {
     return new ActionArgumentsInvalidException(ic, Invalidates(ic));
 }
 public InvalidRangeException(InteractionContext ic, object min, object max)
     : this(ic, min, max, Resources.NakedObjects.OutOfRangeMessage) {}
 public InvalidMandatoryException(InteractionContext ic, string message)
     : base(ic, message) {}
 public InvalidRangeException(InteractionContext ic, object min, object max, string message)
     : base(ic, message) {
     Min = min;
     Max = max;
 }