ca.odell.glazedlists.swing
Class GlazedListsSwing

java.lang.Object
  extended by ca.odell.glazedlists.swing.GlazedListsSwing

public final class GlazedListsSwing
extends Object

A factory for creating all sorts of objects to be used with Glazed Lists.

Author:
Jesse Wilson

Method Summary
static
<E> TableModelEventAdapter.Factory<E>
defaultEventAdapterFactory()
          Gets a factory for creating a default TableModelEventAdapter.
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.
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.
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.
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.
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, String[] propertyNames, String[] columnLabels, boolean[] writable)
          Creates a new table model that renders the specified list with an automatically generated TableFormat.
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.
static
<E> AdvancedTableModel<E>
eventTableModel(EventList<E> source, TableFormat<? super E> tableFormat, TableModelEventAdapter.Factory<E> eventAdapterFactory)
          Creates a new table model that extracts column data from the given source using the the given tableFormat.
static
<E> AdvancedTableModel<E>
eventTableModelWithThreadProxyList(EventList<E> source, String[] propertyNames, String[] columnLabels, boolean[] writable)
          Creates a new table model that renders the specified list with an automatically generated TableFormat.
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.
static
<E> AdvancedTableModel<E>
eventTableModelWithThreadProxyList(EventList<E> source, TableFormat<? super E> tableFormat, TableModelEventAdapter.Factory<E> eventAdapterFactory)
          Creates a new table model that extracts column data from the given source using the the given tableFormat.
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.
static BoundedRangeModel lowerRangeModel(ThresholdList target)
          Creates a model that manipulates the lower bound of the specified ThresholdList.
static
<E> TableModelEventAdapter.Factory<E>
manyToOneEventAdapterFactory()
          Gets a factory for creating a non-default TableModelEventAdapter.
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.
static BoundedRangeModel upperRangeModel(ThresholdList target)
          Creates a model that manipulates the upper bound of the specified ThresholdList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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 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,
                                                        TableFormat<? super E> tableFormat,
                                                        TableModelEventAdapter.Factory<E> eventAdapterFactory)
Creates a new table model that extracts column data from the given source using the the given tableFormat.

The eventAdapterFactory is used to create a TableModelEventAdapter, which is then used by the created table model to convert list events to table model events.

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
eventAdapterFactory - factory for creating a TableModelEventAdapter

eventTableModelWithThreadProxyList

public static <E> AdvancedTableModel<E> eventTableModelWithThreadProxyList(EventList<E> source,
                                                                           TableFormat<? super E> tableFormat,
                                                                           TableModelEventAdapter.Factory<E> eventAdapterFactory)
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 eventAdapterFactory is used to create a TableModelEventAdapter, which is then used by the created table model to convert list events to table model events.

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
eventAdapterFactory - factory for creating a TableModelEventAdapter

eventTableModel

public static <E> AdvancedTableModel<E> eventTableModel(EventList<E> source,
                                                        String[] propertyNames,
                                                        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,
                                                                           String[] propertyNames,
                                                                           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.

defaultEventAdapterFactory

public static <E> TableModelEventAdapter.Factory<E> defaultEventAdapterFactory()
Gets a factory for creating a default TableModelEventAdapter.

The default strategy to convert list events to table model events is to be as accurate as possible. In particular, each list event block as converted to and fired as a separate TableModelEvent. So, one list event can cause multiple table model events.

In some cases, this conversion strategy can lead to undesirable effects, such as table repainting issues. One known case is when the table property fillsViewportHeight is true. Using the other standard factory is then recommended.

Returns:
the factory for creating a default TableModelEventAdapter
See Also:
manyToOneEventAdapterFactory(), TableModelEventAdapter.Factory, ListEvent, TableModelEvent

manyToOneEventAdapterFactory

public static <E> TableModelEventAdapter.Factory<E> manyToOneEventAdapterFactory()
Gets a factory for creating a non-default TableModelEventAdapter.

Whereas the default TableModelEventAdapter converts each ListEvent block to a TableModelEvent, this strategy tries to create only one TableModelEvent for a ListEvent, if it does not represent a reorder. If the ListEvent contains multiple blocks, a special data changed TableModelEvent will be fired, indicating that all row data has changed. Note, that such a data changed TableModelEvent can lead to a loss of the table selection.

Therefore you should use this strategy only, when the default strategy doesn't fit your needs or causes undesirable effects/behaviour.

Returns:
the factory for creating a non-default TableModelEventAdapter
See Also:
defaultEventAdapterFactory(), TableModelEventAdapter.Factory, ListEvent, TableModelEvent

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


Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by hbrands at 2017-03-13 22:58