/// <summary> /// Determines whether the specified container has validation errors, according to this strategy. /// </summary> public bool HasValidationErrors(IApplicationComponentContainer container) { // true if any started component has validation errors return(CollectionUtils.Contains <IApplicationComponent>(container.ContainedComponents, delegate(IApplicationComponent c) { return c.IsStarted && c.HasValidationErrors; })); }
/// <summary> /// Determines whether the specified container has validation errors, according to this strategy. /// </summary> public bool HasValidationErrors(IApplicationComponentContainer container) { // true if any started component has validation errors return CollectionUtils.Contains<IApplicationComponent>(container.ContainedComponents, delegate(IApplicationComponent c) { return c.IsStarted && c.HasValidationErrors; }); }
/// <summary> /// Displays validation errors for the specified container to the user, according to the logic /// encapsulated in this strategy. /// </summary> public void ShowValidation(IApplicationComponentContainer container, bool show) { if (show) { // propagate to each component, starting the component if not already started foreach (IApplicationComponent c in container.ContainedComponents) { container.EnsureStarted(c); c.ShowValidation(show); } bool visibleComponentHasErrors = CollectionUtils.Contains(container.VisibleComponents, delegate(IApplicationComponent c) { return(c.HasValidationErrors); }); // if there are no errors on a visible component, find the first component with errors and ensure it is visible if (!visibleComponentHasErrors) { IApplicationComponent firstComponentWithErrors = CollectionUtils.SelectFirst( container.ContainedComponents, delegate(IApplicationComponent c) { return(c.HasValidationErrors); }); if (firstComponentWithErrors != null) { container.EnsureVisible(firstComponentWithErrors); // bug #1644 : call ShowValidation after this component is already visible, // to ensure that the error icons actually show up firstComponentWithErrors.ShowValidation(show); } } } else { // propagate to each started component foreach (IApplicationComponent c in container.ContainedComponents) { if (c.IsStarted) { c.ShowValidation(show); } } } }
/// <summary> /// Displays validation errors for the specified container to the user, according to the logic /// encapsulated in this strategy. /// </summary> public void ShowValidation(IApplicationComponentContainer container, bool show) { if (show) { // propagate to each component, starting the component if not already started foreach (IApplicationComponent c in container.ContainedComponents) { container.EnsureStarted(c); c.ShowValidation(show); } bool visibleComponentHasErrors = CollectionUtils.Contains(container.VisibleComponents, delegate(IApplicationComponent c) { return c.HasValidationErrors; }); // if there are no errors on a visible component, find the first component with errors and ensure it is visible if (!visibleComponentHasErrors) { IApplicationComponent firstComponentWithErrors = CollectionUtils.SelectFirst( container.ContainedComponents, delegate(IApplicationComponent c) { return c.HasValidationErrors; }); if (firstComponentWithErrors != null) { container.EnsureVisible(firstComponentWithErrors); // bug #1644 : call ShowValidation after this component is already visible, // to ensure that the error icons actually show up firstComponentWithErrors.ShowValidation(show); } } } else { // propagate to each started component foreach (IApplicationComponent c in container.ContainedComponents) { if(c.IsStarted) c.ShowValidation(show); } } }
/// <summary> /// Displays validation errors for the specified container to the user, according to the logic /// encapsulated in this strategy. /// </summary> public void ShowValidation(IApplicationComponentContainer container, bool show) { if (show) { // propagate to each started component foreach (IApplicationComponent c in container.ContainedComponents) { if (c.IsStarted) { c.ShowValidation(show); } } bool visibleComponentHasErrors = CollectionUtils.Contains <IApplicationComponent>(container.VisibleComponents, delegate(IApplicationComponent c) { return(c.HasValidationErrors); }); // if there are no errors on a visible component, find the first component with errors and ensure it is visible if (!visibleComponentHasErrors) { IApplicationComponent firstComponentWithErrors = CollectionUtils.SelectFirst <IApplicationComponent>( container.ContainedComponents, delegate(IApplicationComponent c) { return(c.IsStarted && c.HasValidationErrors); }); if (firstComponentWithErrors != null) { container.EnsureVisible(firstComponentWithErrors); } } } else { // propagate to each started component foreach (IApplicationComponent c in container.ContainedComponents) { if (c.IsStarted) { c.ShowValidation(show); } } } }
/// <summary> /// Displays validation errors for the specified container to the user, according to the logic /// encapsulated in this strategy. /// </summary> public void ShowValidation(IApplicationComponentContainer container, bool show) { if (show) { // propagate to each started component foreach (IApplicationComponent c in container.ContainedComponents) { if(c.IsStarted) c.ShowValidation(show); } bool visibleComponentHasErrors = CollectionUtils.Contains<IApplicationComponent>(container.VisibleComponents, delegate(IApplicationComponent c) { return c.HasValidationErrors; }); // if there are no errors on a visible component, find the first component with errors and ensure it is visible if (!visibleComponentHasErrors) { IApplicationComponent firstComponentWithErrors = CollectionUtils.SelectFirst<IApplicationComponent>( container.ContainedComponents, delegate(IApplicationComponent c) { return c.IsStarted && c.HasValidationErrors; }); if (firstComponentWithErrors != null) container.EnsureVisible(firstComponentWithErrors); } } else { // propagate to each started component foreach (IApplicationComponent c in container.ContainedComponents) { if (c.IsStarted) c.ShowValidation(show); } } }
/// <summary> /// Does nothing. /// </summary> public void ShowValidation(IApplicationComponentContainer container, bool show) { // do nothing }
/// <summary> /// Returns false. /// </summary> public bool HasValidationErrors(IApplicationComponentContainer container) { return false; }
/// <summary> /// Does nothing. /// </summary> public void ShowValidation(IApplicationComponentContainer container, bool show) { // do nothing }
/// <summary> /// Returns false. /// </summary> public bool HasValidationErrors(IApplicationComponentContainer container) { return(false); }