Class GlobalDesc

java.lang.Object
org.proto4j.swing.core.GlobalDesc

public final class GlobalDesc
extends java.lang.Object
This class wraps general and utility methods on providing the option namespace. At initialization this manager will look up the /META-INF/options directory in order to retrieve all defined options.
Since:
1.0
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String DESC_PATH_PROPERTY  
    static java.lang.String OPTIONS_PREFIX
    The standard directory name for the defined options.
  • Constructor Summary

    Constructors 
    Constructor Description
    GlobalDesc()  
  • Method Summary

    Modifier and Type Method Description
    static void ensureOptionsInitialized()  
    static java.awt.Color getColor​(java.lang.String value)
    Tries to locate the given color name.
    static LayoutDesc getLayoutDesc​(java.lang.Class<?> cls, ComponentDesc parent)
    Resolves the given LayoutManager class to the related LayoutDesc type.
    static LayoutDesc getLayoutDesc​(java.lang.Class<?> cls, ComponentDesc parent, java.lang.String... packageNames)
    Resolves the given LayoutManager class to the related LayoutDesc type.
    static MarginDesc getMarginDesc​(java.lang.Class<?> cls)
    Resolves the given Border class to the related MarginDesc type.
    static MarginDesc getMarginDesc​(java.lang.Class<?> cls, java.lang.String... packageNames)
    Resolves the given Border class to the related MarginDesc type.
    static java.util.Properties getSharedOption​(java.lang.Class<?> cls)
    Tries to locate all options defined for the given class.
    static java.util.Properties getSharedOption​(java.lang.String className)
    Tries to locate all options defined for the given class name.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • getSharedOption

      public static java.util.Properties getSharedOption​(java.lang.Class<?> cls) throws java.lang.NullPointerException
      Tries to locate all options defined for the given class.
      Parameters:
      cls - the given class
      Returns:
      null if no options are registered to that class name; a Properties instance otherwise.
      Throws:
      java.lang.NullPointerException - the given class is null
    • getSharedOption

      public static java.util.Properties getSharedOption​(java.lang.String className) throws java.lang.NullPointerException
      Tries to locate all options defined for the given class name.
      Parameters:
      className - the class name the options are mapped to
      Returns:
      null if no options are registered to that class name; a Properties instance otherwise.
      Throws:
      java.lang.NullPointerException - the given name is null
    • getMarginDesc

      public static MarginDesc getMarginDesc​(java.lang.Class<?> cls) throws java.lang.NullPointerException
      Resolves the given Border class to the related MarginDesc type. This method uses the Class.forName(String) method to retrieve the class instance for the MarginDesc.
      Parameters:
      cls - the border type
      Returns:
      a new instance of the qualified MarginDesc
      Throws:
      java.lang.NullPointerException - if the border type was null
    • getMarginDesc

      public static MarginDesc getMarginDesc​(java.lang.Class<?> cls, java.lang.String... packageNames) throws java.lang.NullPointerException
      Resolves the given Border class to the related MarginDesc type. This method uses the Class.forName(String) method to retrieve the class instance for the MarginDesc.
      Parameters:
      cls - the border type
      packageNames - the root packages where the corresponding Desc-class are located
      Returns:
      a new instance of the qualified MarginDesc
      Throws:
      java.lang.NullPointerException - if the border type was null
    • getLayoutDesc

      public static LayoutDesc getLayoutDesc​(java.lang.Class<?> cls, ComponentDesc parent) throws java.lang.NullPointerException
      Resolves the given LayoutManager class to the related LayoutDesc type. This method uses the Class.forName(String) method to retrieve the class instance for the LayoutDesc.
      Parameters:
      cls - the layout manager type
      Returns:
      a new instance of the qualified LayoutDesc
      Throws:
      java.lang.NullPointerException - if the layout manager type was null
    • getLayoutDesc

      public static LayoutDesc getLayoutDesc​(java.lang.Class<?> cls, ComponentDesc parent, java.lang.String... packageNames) throws java.lang.NullPointerException
      Resolves the given LayoutManager class to the related LayoutDesc type. This method uses the Class.forName(String) method to retrieve the class instance for the LayoutDesc.
      Parameters:
      cls - the layout manager type
      parent - the component description
      packageNames - the root packages where the corresponding Desc-class are located
      Returns:
      a new instance of the qualified LayoutDesc
      Throws:
      java.lang.NullPointerException - if the layout manager type was null
    • getColor

      public static java.awt.Color getColor​(java.lang.String value)
      Tries to locate the given color name.

      RGB values can be represented through three numbers separated by a ,. It is also possible to query a color that has been added to the UIDefaults of the current LookAndFeel. To do that, just put the Option.Query.indicator in font of the color's name.

      Parameters:
      value - the color's name
      Returns:
      a new Color object representing the color
    • ensureOptionsInitialized

      public static void ensureOptionsInitialized()