Class SWTValidationHelper


  • public class SWTValidationHelper
    extends java.lang.Object
    Helper class for accessing icons and colours for validations.
    Since:
    1.23
    Author:
    jfaltermeier
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.swt.graphics.Color getValidationBackgroundColor​(int severity)
      Returns the background color for a control with the given validation severity.
      org.eclipse.swt.graphics.Color getValidationBackgroundColor​(int severity, VElement vElement, ViewModelContext viewModelContext)
      Returns the background color for a control with the given validation severity, VElement and view model context, if applicable.
      java.lang.String getValidationColorHEX​(int severity, VElement vElement, ViewModelContext viewModelContext)
      Returns the hex color for a control with the given validation severity, VElement and view model context, if applicable.
      org.eclipse.swt.graphics.Color getValidationForegroundColor​(int severity)
      Returns the foreground color for a control with the given validation severity.
      org.eclipse.swt.graphics.Color getValidationForegroundColor​(int severity, VElement vElement, ViewModelContext viewModelContext)
      Returns the foreground color for a control with the given validation severity, VElement and view model context, if applicable.
      org.eclipse.swt.graphics.Image getValidationIcon​(int severity)
      Returns the validation icon matching the given severity.
      org.eclipse.swt.graphics.Image getValidationIcon​(int severity, VElement vElement, ViewModelContext viewModelContext)
      Returns the validation icon matching the given severity, VElement and view model context, if applicable.
      org.eclipse.jface.resource.ImageDescriptor getValidationOverlayDescriptor​(int severity)
      Returns an image descriptor which can be used as an overlay for validation icons.
      org.eclipse.jface.resource.ImageDescriptor getValidationOverlayDescriptor​(int severity, VElement vElement, ViewModelContext viewModelContext)
      Returns the validation overlay icon matching the given severity, VElement and view model context, if applicable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INSTANCE

        public static final SWTValidationHelper INSTANCE
        The instance of the SWTValidationHelper.
    • Constructor Detail

      • SWTValidationHelper

        public SWTValidationHelper()
    • Method Detail

      • getValidationBackgroundColor

        public org.eclipse.swt.graphics.Color getValidationBackgroundColor​(int severity,
                                                                           VElement vElement,
                                                                           ViewModelContext viewModelContext)
        Returns the background color for a control with the given validation severity, VElement and view model context, if applicable.
        Parameters:
        severity - severity the severity of the Diagnostic
        vElement - The VElement that is being rendered
        viewModelContext - The corresponding ViewModelContext
        Returns:
        the color to be used as a background color
      • getValidationForegroundColor

        public org.eclipse.swt.graphics.Color getValidationForegroundColor​(int severity,
                                                                           VElement vElement,
                                                                           ViewModelContext viewModelContext)
        Returns the foreground color for a control with the given validation severity, VElement and view model context, if applicable.
        Parameters:
        severity - severity the severity of the Diagnostic
        vElement - The VElement that is being rendered
        viewModelContext - The corresponding ViewModelContext
        Returns:
        the color to be used as a foreground color
        Since:
        1.10
      • getValidationBackgroundColor

        public org.eclipse.swt.graphics.Color getValidationBackgroundColor​(int severity)
        Returns the background color for a control with the given validation severity.
        Parameters:
        severity - severity the severity of the Diagnostic
        Returns:
        the color to be used as a background color
      • getValidationForegroundColor

        public org.eclipse.swt.graphics.Color getValidationForegroundColor​(int severity)
        Returns the foreground color for a control with the given validation severity.
        Parameters:
        severity - severity the severity of the Diagnostic
        Returns:
        the color to be used as a foreground color
        Since:
        1.10
      • getValidationColorHEX

        public java.lang.String getValidationColorHEX​(int severity,
                                                      VElement vElement,
                                                      ViewModelContext viewModelContext)
        Returns the hex color for a control with the given validation severity, VElement and view model context, if applicable.
        Parameters:
        severity - severity the severity of the Diagnostic
        vElement - The VElement that is being rendered
        viewModelContext - The corresponding ViewModelContext
        Returns:
        the hex value to be used
        Since:
        1.9
      • getValidationIcon

        public org.eclipse.swt.graphics.Image getValidationIcon​(int severity,
                                                                VElement vElement,
                                                                ViewModelContext viewModelContext)
        Returns the validation icon matching the given severity, VElement and view model context, if applicable.
        Parameters:
        severity - the severity of the Diagnostic
        vElement - The VElement that is being rendered
        viewModelContext - The corresponding ViewModelContext
        Returns:
        the icon to be displayed, or null when no icon is to be displayed
      • getValidationIcon

        public org.eclipse.swt.graphics.Image getValidationIcon​(int severity)
        Returns the validation icon matching the given severity.
        Parameters:
        severity - the severity of the Diagnostic
        Returns:
        the icon to be displayed, or null when no icon is to be displayed
      • getValidationOverlayDescriptor

        public org.eclipse.jface.resource.ImageDescriptor getValidationOverlayDescriptor​(int severity,
                                                                                         VElement vElement,
                                                                                         ViewModelContext viewModelContext)
        Returns the validation overlay icon matching the given severity, VElement and view model context, if applicable.
        Parameters:
        severity - the severity of the Diagnostic
        vElement - The VElement that is being rendered
        viewModelContext - The corresponding ViewModelContext
        Returns:
        the icon to be displayed, or null when no icon is to be displayed
      • getValidationOverlayDescriptor

        public org.eclipse.jface.resource.ImageDescriptor getValidationOverlayDescriptor​(int severity)
        Returns an image descriptor which can be used as an overlay for validation icons.
        Parameters:
        severity - the severity of the validation
        Returns:
        the descriptor