Class GlazedListsSwing


  • public final class GlazedListsSwing
    extends java.lang.Object
    A factory for creating all sorts of objects to be used with Glazed Lists.
    Author:
    Jesse Wilson
    • Method Detail

      • swingThreadProxyList

        public static <E> TransformedList<E,​E> swingThreadProxyList​(EventList<E> source)
        Wraps the source in an EventList that fires all of its update events from the Swing event dispatch thread.
      • isSwingThreadProxyList

        public static boolean isSwingThreadProxyList​(EventList list)
        Returns true iff list is an EventList that fires all of its update events from the Swing event dispatch thread.
      • lowerRangeModel

        public static javax.swing.BoundedRangeModel lowerRangeModel​(ThresholdList target)
        Creates a model that manipulates the lower bound of the specified ThresholdList. The ThresholdList linked to this model type will contain a range of Objects between the results of getValue() and getMaximum() on the BoundedRangeModel.
      • upperRangeModel

        public static javax.swing.BoundedRangeModel upperRangeModel​(ThresholdList target)
        Creates a model that manipulates the upper bound of the specified ThresholdList. The ThresholdList linked to this model type will contain a range of Objects between the results of getMinimum() and getValue() on the BoundedRangeModel.
      • eventTableModel

        public static <E> AdvancedTableModel<E> eventTableModel​(EventList<E> source,
                                                                TableFormat<? super E> tableFormat)
        Creates a new table model that extracts column data from the given source using the the given tableFormat.

        The returned table model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread. To do this programmatically, use SwingUtilities.invokeAndWait(Runnable) and wrap the source list (or some part of the source list's pipeline) using swingThreadProxyList(EventList).

        Parameters:
        source - the EventList that provides the row objects
        tableFormat - the object responsible for extracting column data from the row objects
      • eventTableModelWithThreadProxyList

        public static <E> AdvancedTableModel<E> eventTableModelWithThreadProxyList​(EventList<E> source,
                                                                                   TableFormat<? super E> tableFormat)
        Creates a new table model that extracts column data from the given source using the the given tableFormat. While holding a read lock, this method wraps the source list using swingThreadProxyList(EventList).

        The returned table model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread.

        Parameters:
        source - the EventList that provides the row objects
        tableFormat - the object responsible for extracting column data from the row objects
      • eventTableModel

        public static <E> AdvancedTableModel<E> eventTableModel​(EventList<E> source,
                                                                java.lang.String[] propertyNames,
                                                                java.lang.String[] columnLabels,
                                                                boolean[] writable)
        Creates a new table model that renders the specified list with an automatically generated TableFormat. It uses JavaBeans and reflection to create a TableFormat as specified.

        Note that classes that will be obfuscated may not work with reflection. In this case, implement a TableFormat manually.

        The returned table model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread. To do this programmatically, use SwingUtilities.invokeAndWait(Runnable) and wrap the source list (or some part of the source list's pipeline) using swingThreadProxyList(EventList).

        Parameters:
        source - the EventList that provides the row objects
        propertyNames - an array of property names in the JavaBeans format. For example, if your list contains Objects with the methods getFirstName(), setFirstName(String), getAge(), setAge(Integer), then this array should contain the two strings "firstName" and "age". This format is specified by the JavaBeans PropertyDescriptor.
        columnLabels - the corresponding column names for the listed property names. For example, if your columns are "firstName" and "age", then your labels might be "First Name" and "Age".
        writable - an array of booleans specifying which of the columns in your table are writable.
      • eventTableModelWithThreadProxyList

        public static <E> AdvancedTableModel<E> eventTableModelWithThreadProxyList​(EventList<E> source,
                                                                                   java.lang.String[] propertyNames,
                                                                                   java.lang.String[] columnLabels,
                                                                                   boolean[] writable)
        Creates a new table model that renders the specified list with an automatically generated TableFormat. It uses JavaBeans and reflection to create a TableFormat as specified. While holding a read lock, this method wraps the source list using swingThreadProxyList(EventList).

        Note that classes that will be obfuscated may not work with reflection. In this case, implement a TableFormat manually.

        The returned table model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread.

        Parameters:
        source - the EventList that provides the row objects
        propertyNames - an array of property names in the JavaBeans format. For example, if your list contains Objects with the methods getFirstName(), setFirstName(String), getAge(), setAge(Integer), then this array should contain the two strings "firstName" and "age". This format is specified by the JavaBeans PropertyDescriptor.
        columnLabels - the corresponding column names for the listed property names. For example, if your columns are "firstName" and "age", then your labels might be "First Name" and "Age".
        writable - an array of booleans specifying which of the columns in your table are writable.
      • eventSelectionModel

        public static <E> AdvancedListSelectionModel<E> eventSelectionModel​(EventList<E> source)
        Creates a new selection model that also presents a list of the selection. The AdvancedListSelectionModel listens to this EventList in order to adjust selection when the EventList is modified. For example, when an element is added to the EventList, this may offset the selection of the following elements.

        The returned selection model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread. To do this programmatically, use SwingUtilities.invokeAndWait(Runnable) and wrap the source list (or some part of the source list's pipeline) using swingThreadProxyList(EventList).

        Parameters:
        source - the EventList whose selection will be managed. This should be the same EventList passed to the constructor of your AdvancedTableModel or EventListModel.
      • eventSelectionModelWithThreadProxyList

        public static <E> AdvancedListSelectionModel<E> eventSelectionModelWithThreadProxyList​(EventList<E> source)
        Creates a new selection model that also presents a list of the selection. While holding a read lock, it wraps the source list using swingThreadProxyList(EventList). The AdvancedListSelectionModel listens to this EventList in order to adjust selection when the EventList is modified. For example, when an element is added to the EventList, this may offset the selection of the following elements.

        The returned selection model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread.

        Parameters:
        source - the EventList whose selection will be managed. This should be the same EventList passed to the constructor of your AdvancedTableModel or EventListModel.
      • eventListModel

        public static <E> DefaultEventListModel<E> eventListModel​(EventList<E> source)
        Creates a new list model that contains all objects located in the given source and reacts to any changes in the given source.

        The returned selection model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread. To do this programmatically, use SwingUtilities.invokeAndWait(Runnable) and wrap the source list (or some part of the source list's pipeline) using swingThreadProxyList(EventList).

        Parameters:
        source - the EventList that provides the elements
      • eventListModelWithThreadProxyList

        public static <E> DefaultEventListModel<E> eventListModelWithThreadProxyList​(EventList<E> source)
        Creates a new list model that contains all objects located in the given source and reacts to any changes in the given source. While holding a read lock, it wraps the source list using swingThreadProxyList(EventList).

        The returned selection model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread.

        Parameters:
        source - the EventList that provides the elements
      • eventComboBoxModel

        public static <E> DefaultEventComboBoxModel<E> eventComboBoxModel​(EventList<E> source)
        Creates a new combobox model that contains all objects located in the given source and reacts to any changes in the given source.

        The returned combobox model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread. To do this programmatically, use SwingUtilities.invokeAndWait(Runnable) and wrap the source list (or some part of the source list's pipeline) using swingThreadProxyList(EventList).

        Parameters:
        source - the EventList that provides the elements
      • eventComboBoxModelWithThreadProxyList

        public static <E> DefaultEventComboBoxModel<E> eventComboBoxModelWithThreadProxyList​(EventList<E> source)
        Creates a new combobox model that contains all objects located in the given source and reacts to any changes in the given source. While holding a read lock, it wraps the source list using swingThreadProxyList(EventList).

        The returned combobox model is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread.

        Parameters:
        source - the EventList that provides the elements