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.StringDESC_PATH_PROPERTYstatic java.lang.StringOPTIONS_PREFIXThe standard directory name for the defined options. -
Constructor Summary
Constructors Constructor Description GlobalDesc() -
Method Summary
Modifier and Type Method Description static voidensureOptionsInitialized()static java.awt.ColorgetColor(java.lang.String value)Tries to locate the given color name.static LayoutDescgetLayoutDesc(java.lang.Class<?> cls, ComponentDesc parent)Resolves the givenLayoutManagerclass to the relatedLayoutDesctype.static LayoutDescgetLayoutDesc(java.lang.Class<?> cls, ComponentDesc parent, java.lang.String... packageNames)Resolves the givenLayoutManagerclass to the relatedLayoutDesctype.static MarginDescgetMarginDesc(java.lang.Class<?> cls)Resolves the givenBorderclass to the relatedMarginDesctype.static MarginDescgetMarginDesc(java.lang.Class<?> cls, java.lang.String... packageNames)Resolves the givenBorderclass to the relatedMarginDesctype.static java.util.PropertiesgetSharedOption(java.lang.Class<?> cls)Tries to locate all options defined for the given class.static java.util.PropertiesgetSharedOption(java.lang.String className)Tries to locate all options defined for the given class name.
-
Field Details
-
OPTIONS_PREFIX
public static final java.lang.String OPTIONS_PREFIXThe standard directory name for the defined options.- See Also:
- Constant Field Values
-
DESC_PATH_PROPERTY
public static final java.lang.String DESC_PATH_PROPERTY- See Also:
- Constant Field Values
-
-
Constructor Details
-
GlobalDesc
public GlobalDesc()
-
-
Method Details
-
getSharedOption
public static java.util.Properties getSharedOption(java.lang.Class<?> cls) throws java.lang.NullPointerExceptionTries to locate all options defined for the given class.- Parameters:
cls- the given class- Returns:
nullif no options are registered to that class name; aPropertiesinstance otherwise.- Throws:
java.lang.NullPointerException- the given class isnull
-
getSharedOption
public static java.util.Properties getSharedOption(java.lang.String className) throws java.lang.NullPointerExceptionTries to locate all options defined for the given class name.- Parameters:
className- the class name the options are mapped to- Returns:
nullif no options are registered to that class name; aPropertiesinstance otherwise.- Throws:
java.lang.NullPointerException- the given name isnull
-
getMarginDesc
public static MarginDesc getMarginDesc(java.lang.Class<?> cls) throws java.lang.NullPointerExceptionResolves the givenBorderclass to the relatedMarginDesctype. This method uses theClass.forName(String)method to retrieve the class instance for theMarginDesc.- Parameters:
cls- the border type- Returns:
- a new instance of the qualified
MarginDesc - Throws:
java.lang.NullPointerException- if the border type wasnull
-
getMarginDesc
public static MarginDesc getMarginDesc(java.lang.Class<?> cls, java.lang.String... packageNames) throws java.lang.NullPointerExceptionResolves the givenBorderclass to the relatedMarginDesctype. This method uses theClass.forName(String)method to retrieve the class instance for theMarginDesc.- Parameters:
cls- the border typepackageNames- 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 wasnull
-
getLayoutDesc
public static LayoutDesc getLayoutDesc(java.lang.Class<?> cls, ComponentDesc parent) throws java.lang.NullPointerExceptionResolves the givenLayoutManagerclass to the relatedLayoutDesctype. This method uses theClass.forName(String)method to retrieve the class instance for theLayoutDesc.- Parameters:
cls- the layout manager type- Returns:
- a new instance of the qualified
LayoutDesc - Throws:
java.lang.NullPointerException- if the layout manager type wasnull
-
getLayoutDesc
public static LayoutDesc getLayoutDesc(java.lang.Class<?> cls, ComponentDesc parent, java.lang.String... packageNames) throws java.lang.NullPointerExceptionResolves the givenLayoutManagerclass to the relatedLayoutDesctype. This method uses theClass.forName(String)method to retrieve the class instance for theLayoutDesc.- Parameters:
cls- the layout manager typeparent- the component descriptionpackageNames- 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 wasnull
-
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 theUIDefaultsof the currentLookAndFeel. To do that, just put theOption.Query.indicatorin font of the color's name.- Parameters:
value- the color's name- Returns:
- a new
Colorobject representing the color
-
ensureOptionsInitialized
public static void ensureOptionsInitialized()
-