Class GlazedListsSwing
- java.lang.Object
-
- ca.odell.glazedlists.swing.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> DefaultEventComboBoxModel<E>
eventComboBoxModel(EventList<E> source)
Creates a new combobox model that contains all objects located in the givensource
and reacts to any changes in the givensource
.static <E> DefaultEventComboBoxModel<E>
eventComboBoxModelWithThreadProxyList(EventList<E> source)
Creates a new combobox model that contains all objects located in the givensource
and reacts to any changes in the givensource
.static <E> DefaultEventListModel<E>
eventListModel(EventList<E> source)
Creates a new list model that contains all objects located in the givensource
and reacts to any changes in the givensource
.static <E> DefaultEventListModel<E>
eventListModelWithThreadProxyList(EventList<E> source)
Creates a new list model that contains all objects located in the givensource
and reacts to any changes in the givensource
.static <E> AdvancedListSelectionModel<E>
eventSelectionModel(EventList<E> source)
Creates a new selection model that also presents a list of the selection.static <E> AdvancedListSelectionModel<E>
eventSelectionModelWithThreadProxyList(EventList<E> source)
Creates a new selection model that also presents a list of the selection.static <E> AdvancedTableModel<E>
eventTableModel(EventList<E> source, TableFormat<? super E> tableFormat)
Creates a new table model that extracts column data from the givensource
using the the giventableFormat
.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 generatedTableFormat
.static <E> AdvancedTableModel<E>
eventTableModelWithThreadProxyList(EventList<E> source, TableFormat<? super E> tableFormat)
Creates a new table model that extracts column data from the givensource
using the the giventableFormat
.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 generatedTableFormat
.static boolean
isSwingThreadProxyList(EventList list)
Returns true ifflist
is anEventList
that fires all of its update events from the Swing event dispatch thread.static javax.swing.BoundedRangeModel
lowerRangeModel(ThresholdList target)
Creates a model that manipulates the lower bound of the specified ThresholdList.static <E> TransformedList<E,E>
swingThreadProxyList(EventList<E> source)
Wraps the source in anEventList
that fires all of its update events from the Swing event dispatch thread.static javax.swing.BoundedRangeModel
upperRangeModel(ThresholdList target)
Creates a model that manipulates the upper bound of the specified ThresholdList.
-
-
-
Method Detail
-
swingThreadProxyList
public static <E> TransformedList<E,E> swingThreadProxyList(EventList<E> source)
Wraps the source in anEventList
that fires all of its update events from the Swing event dispatch thread.
-
isSwingThreadProxyList
public static boolean isSwingThreadProxyList(EventList list)
Returns true ifflist
is anEventList
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 givensource
using the the giventableFormat
.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) usingswingThreadProxyList(EventList)
.- Parameters:
source
- the EventList that provides the row objectstableFormat
- 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 givensource
using the the giventableFormat
. While holding a read lock, this method wraps the source list usingswingThreadProxyList(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 objectstableFormat
- 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 generatedTableFormat
. It uses JavaBeans and reflection to create aTableFormat
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) usingswingThreadProxyList(EventList)
.- Parameters:
source
- the EventList that provides the row objectspropertyNames
- 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 JavaBeansPropertyDescriptor
.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 generatedTableFormat
. It uses JavaBeans and reflection to create aTableFormat
as specified. While holding a read lock, this method wraps the source list usingswingThreadProxyList(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 objectspropertyNames
- 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 JavaBeansPropertyDescriptor
.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. TheAdvancedListSelectionModel
listens to thisEventList
in order to adjust selection when theEventList
is modified. For example, when an element is added to theEventList
, 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) usingswingThreadProxyList(EventList)
.- Parameters:
source
- theEventList
whose selection will be managed. This should be the sameEventList
passed to the constructor of yourAdvancedTableModel
orEventListModel
.
-
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 usingswingThreadProxyList(EventList)
. TheAdvancedListSelectionModel
listens to thisEventList
in order to adjust selection when theEventList
is modified. For example, when an element is added to theEventList
, 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
- theEventList
whose selection will be managed. This should be the sameEventList
passed to the constructor of yourAdvancedTableModel
orEventListModel
.
-
eventListModel
public static <E> DefaultEventListModel<E> eventListModel(EventList<E> source)
Creates a new list model that contains all objects located in the givensource
and reacts to any changes in the givensource
.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) usingswingThreadProxyList(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 givensource
and reacts to any changes in the givensource
. While holding a read lock, it wraps the source list usingswingThreadProxyList(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 givensource
and reacts to any changes in the givensource
.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) usingswingThreadProxyList(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 givensource
and reacts to any changes in the givensource
. While holding a read lock, it wraps the source list usingswingThreadProxyList(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
-
-