Class PropertyBinder


  • public class PropertyBinder
    extends java.lang.Object
    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
    • Constructor Detail

      • PropertyBinder

        public PropertyBinder()
    • Method Detail

      • getProperties

        public static java.util.Properties getProperties​(JComponentHolder jComponentHolder)
        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

        public static <T extends java.util.Map> T getProperties​(JComponentHolder jComponentHolder,
                                                                T existing)
        Read properties from a UI.
        Parameters:
        jComponentHolder - object containing Swing type member variables/components
        existing - 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:
        java.lang.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

        public static void syncUI​(java.util.Map props,
                                  JComponentHolder jComponentHolder)
        Update a UI from a Map object.
        Parameters:
        props - Properties to pass to UI
        jComponentHolder - object containing Swing type member variables/components to be synchronized.
        Throws:
        java.lang.RuntimeException