Package se.datadosen.util
Class PropertyBinder
java.lang.Object
se.datadosen.util.PropertyBinder
Utility class for synchronizing a Swing GUI with a Property object.
Synchronization is performed when calling getProperties() and syncUI().
Matching is done where the name of a property corresponds to the name of a
GUI element. Currently handles JText components, JCheckBox, JComboBox and
JColorSelector
Copyright (c) 2003, David Ekholm Datadosen
Copyright (c) 2003, David Ekholm Datadosen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Add support for other component types -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Properties
getProperties
(JComponentHolder jComponentHolder) Read properties from a UI.static <T extends Map>
TgetProperties
(JComponentHolder jComponentHolder, T existing) Read properties from a UI.static boolean
Return true if we're currently synching a UI from a Map object on the same thread as calling thread (see syncUI(Map props, JComponentHolder jComponentHolder)registerComponentBinder
(Class componentClass, PropertyBinder.ComponentBinder binder) Add support for other component types (subclasses of JComponent)static void
syncUI
(Map props, JComponentHolder jComponentHolder) Update a UI from a Map object.
-
Constructor Details
-
PropertyBinder
public PropertyBinder()
-
-
Method Details
-
getProperties
Read properties from a UI.- Parameters:
jComponentHolder
- object containing Swing type member variables/components- Returns:
- A property object where the keys have the same names as the member components
-
getProperties
Read properties from a UI.- Parameters:
jComponentHolder
- object containing Swing type member variables/componentsexisting
- Map<String, String> or Properties object to add properties to- Returns:
- The same object passed as parameter, but filled in with values from jComponentHolder
- Throws:
RuntimeException
-
isSynchingUI
public static boolean isSynchingUI()Return true if we're currently synching a UI from a Map object on the same thread as calling thread (see syncUI(Map props, JComponentHolder jComponentHolder)- Since:
- 17.2
-
syncUI
Update a UI from a Map object.- Parameters:
props
- Properties to pass to UIjComponentHolder
- object containing Swing type member variables/components to be synchronized.- Throws:
RuntimeException
-
registerComponentBinder
public static PropertyBinder.ComponentBinder registerComponentBinder(Class componentClass, PropertyBinder.ComponentBinder binder) Add support for other component types (subclasses of JComponent)- Parameters:
componentClass
-- Since:
- 8.4
-