Class HighlightPredicate.TypeHighlightPredicate

java.lang.Object
org.jdesktop.swingx.decorator.HighlightPredicate.TypeHighlightPredicate
All Implemented Interfaces:
HighlightPredicate
Enclosing interface:
HighlightPredicate

public static class HighlightPredicate.TypeHighlightPredicate extends Object implements HighlightPredicate
Predicate testing the componentAdapter value type against a given Class.
  • Field Details

    • clazz

      private Class<?> clazz
  • Constructor Details

    • TypeHighlightPredicate

      public TypeHighlightPredicate()
      Instantiates a predicate with Object.clazz. This is essentially the same as testing the adapter's value against null.
    • TypeHighlightPredicate

      public TypeHighlightPredicate(Class<?> compareValue)
      Instantiates a predicate with the given compare class.

      PENDING JW: support array?

      Parameters:
      compareValue - the fixed class to compare the adapter value against, must not be null
      Throws:
      NullPointerException - if the class is null.
  • Method Details

    • isHighlighted

      public boolean isHighlighted(Component renderer, ComponentAdapter adapter)
      Returns a boolean to indicate whether the component should be highlighted.

      Note: both parameters should be considered strictly read-only! Implemented to return true if the adapter value is an instance of this predicate's class type.

      Specified by:
      isHighlighted in interface HighlightPredicate
      Parameters:
      renderer - the cell renderer component that is to be decorated, must not be null
      adapter - the ComponentAdapter for this decorate operation, most not be null
      Returns:
      a boolean to indicate whether the component should be highlighted.
    • getType

      public Class<?> getType()
      Returns:
      type of predicate compare class