public class LafWidgetRepository
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
protected static class |
LafWidgetRepository.LafWidgetClassInfo |
Information on a single class.
|
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
isCustomLafSupportSet |
Indicates whether the currently registered LAF support is custom (not
LafWidgetSupport ). |
protected LafWidgetSupport |
lafSupport |
Currently registered LAF support.
|
protected static LafWidgetRepository |
repository |
Singleton instance.
|
protected java.util.Set<java.lang.String> |
widgetClassesToIgnore |
Contains fully qualified class names of widgets that should not be
installed on any components.
|
protected java.util.Map<java.lang.Class<?>,java.util.Set<LafWidgetRepository.LafWidgetClassInfo>> |
widgets |
All registered widgets.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addToIgnoreWidgets(java.lang.String widgetClassName) |
Marks widget with the specified class name to never be installed on any
components.
|
static java.util.ResourceBundle |
getLabelBundle() |
Retrieves the current label bundle.
|
static java.util.ResourceBundle |
getLabelBundle(java.util.Locale locale) |
Retrieves the label bundle for the specified locale.
|
LafWidgetSupport |
getLafSupport() |
Returns the currently set LAF support.
|
java.util.Set<LafWidget> |
getMatchingWidgets(javax.swing.JComponent jcomp) |
Returns a set of widgets that match the specified component.
|
static LafWidgetRepository |
getRepository() |
Returns the widget repository.
|
void |
populate() |
Populates the widget repository.
|
protected void |
populateFrom(java.net.URL url) |
Populates the repository from the specified URL.
|
void |
registerWidget(java.lang.String widgetClassName,
java.lang.Class<?> supportedClass,
boolean isExact) |
Registers a new widget for the specified UI class.
|
void |
registerWidget(java.lang.String widgetClassName,
java.util.List<java.lang.Class<?>> supportedClasses) |
Registers a new widget for the specified UI classes.
|
static void |
resetLabelBundle() |
Resets the current label bundle.
|
static void |
setLabelBundleClassLoader(java.lang.ClassLoader labelBundleClassLoader) |
Sets the class loader for
LABEL_BUNDLE . |
void |
setLafSupport(LafWidgetSupport lafSupport) |
Sets LAF support.
|
void |
unsetLafSupport() |
Unsets custom LAF support and reverts to the base LAF support.
|
protected java.util.Map<java.lang.Class<?>,java.util.Set<LafWidgetRepository.LafWidgetClassInfo>> widgets
Class
in the UI component
hierarchy, value is a Set
of fully-qualified widget class names.protected java.util.Set<java.lang.String> widgetClassesToIgnore
protected LafWidgetSupport lafSupport
protected boolean isCustomLafSupportSet
LafWidgetSupport
).protected static LafWidgetRepository repository
public static LafWidgetRepository getRepository()
protected void populateFrom(java.net.URL url)
org.pushingpixels.lafwidget.text.PasswordStrengthCheckerWidget = javax.swing.JPasswordField org.pushingpixels.lafwidget.text.LockBorderWidget = javax.swing.text.JTextComponent;javax.swing.JComboBox
url
- URL that points to a properties file.public void populate()
META-INF/lafwidget.properties
.populateFrom(URL)
public void registerWidget(java.lang.String widgetClassName, java.util.List<java.lang.Class<?>> supportedClasses)
Class
instances.widgetClassName
- Full-qualified class name for the widget.supportedClasses
- Classes supported by the widget.public void registerWidget(java.lang.String widgetClassName, java.lang.Class<?> supportedClass, boolean isExact)
widgetClassName
- Full-qualified class name for the widget.supportedClass
- Class supported by the widget.isExact
- if true
, the widget will be available only for
the components of the specified class. If false
,
the widget be available for the components of the specified
class and all its descendants (as defined in the
Class.isAssignableFrom(Class)
).public java.util.Set<LafWidget> getMatchingWidgets(javax.swing.JComponent jcomp)
isCustomLafSupportSet
is false
, only widgets that
return false
in LafWidget.requiresCustomLafSupport()
are returned.jcomp
- UI component.public void setLafSupport(LafWidgetSupport lafSupport)
lafSupport
- LAF support.java.lang.IllegalArgumentException
- If the LAF support is null
.public void unsetLafSupport()
public LafWidgetSupport getLafSupport()
null
.null
LAF support.public static java.util.ResourceBundle getLabelBundle()
resetLabelBundle()
public static java.util.ResourceBundle getLabelBundle(java.util.Locale locale)
locale
- Locale.public static void resetLabelBundle()
getLabelBundle()
public static void setLabelBundleClassLoader(java.lang.ClassLoader labelBundleClassLoader)
LABEL_BUNDLE
.labelBundleClassLoader
- Class loader for LABEL_BUNDLE
.public void addToIgnoreWidgets(java.lang.String widgetClassName)
widgetClassName
- Fully qualified widget class name.