Class PropertyTheme

  • All Implemented Interfaces:
    Theme
    Direct Known Subclasses:
    DefaultTheme

    public class PropertyTheme
    extends AbstractTheme
    Theme implementation that stores the theme definition in a regular java Properties object. The format is:
         foreground = black
         background = white
         sgr =
         com.mypackage.mycomponent.MyClass.foreground = yellow
         com.mypackage.mycomponent.MyClass.background = white
         com.mypackage.mycomponent.MyClass.sgr =
         com.mypackage.mycomponent.MyClass.foreground[ACTIVE] = red
         com.mypackage.mycomponent.MyClass.background[ACTIVE] = black
         com.mypackage.mycomponent.MyClass.sgr[ACTIVE] = bold
         ...
     
    See the documentation on Theme for further information about different style categories that can be assigned. The foreground, background and sgr entries without a class specifier will be tied to the global fallback and is used if the libraries tries to apply a theme style that isn't specified in the Properties object and there is no other superclass specified either.
    • Constructor Detail

      • PropertyTheme

        public PropertyTheme​(java.util.Properties properties)
        Creates a new PropertyTheme that is initialized by the properties passed in. If the properties refer to a class that cannot be resolved, it will throw IllegalArgumentException.
        Parameters:
        properties - Properties to initialize this theme with
      • PropertyTheme

        public PropertyTheme​(java.util.Properties properties,
                             boolean ignoreUnknownClasses)
        Creates a new PropertyTheme that is initialized by the properties value and optionally prevents it from throwing an exception if there are invalid definitions in the properties object.
        Parameters:
        properties - Properties to initialize this theme with
        ignoreUnknownClasses - If true, will not throw an exception if there is an invalid entry in the properties object
    • Method Detail

      • getDefinition

        private java.lang.String getDefinition​(java.lang.String propertyName)
      • getStyle

        private java.lang.String getStyle​(java.lang.String propertyName)