There are different types of models, depending on the structure of the data storage. Though the possible kinds of models are theoretically endless, four kinds are implemented in JBCL:
TreeControl
uses this model.See also:
Views
Item painters and item editors
Selecting
items in composite components
Handling subfocus events
Singleton interfaces and classes
Interface or class | Description |
SingletonModel
interface |
Has a single data item and provides
read-only access. This interface has get() and getCopy()
methods and an enableEvents( ) method that
switches the model events on and off. |
WritableSingletonModel
interface |
Extends SingletonModel and adds
canSet() and set() methods. |
BasicSingletonContainer
class |
A simple implementation of the WritableSingletonModel
interface. |
SingletonModelEvent
class |
The object created when the data in the singleton model changes. |
SingletonModelListener
interface |
The model event-listener methods. To receive notification of singleton model events, implement this interface and register your component with the model object. |
SingletonViewManager
interface |
Handles item painter and item editor selection for components using a singleton model. |
See also:
Vector model classes and
interfaces
Matrix model classes and
interfaces
Graph model classes and
interfaces
Vector interfaces and classes
Interface or class | Description |
VectorModel
interface |
A one-dimensional array of data items
that provides read-only access. This interface adds a getCount()
method to those in the singleton model. |
WritableVectorModel
interface |
Extends VectorModel . Includes set()
and canSet() methods, making the model writable.
This interface also has insert() , append( ),
and remove() methods and an isVariableSize property.
|
BasicVectorContainer
class |
A simple implementation of the WritableVectorModel
interface. |
VectorModelEvent
class |
The object created when the data in the vector model changes. |
VectorModelListener
interface |
The vector model event-listener methods. To receive notification of vector data model events, implement this interface and register your component with the datamodel object. |
VectorSubfocusEvent
class |
The event object created when an item in
the vector model receives focus. There are two events in
the vector subfocus event set: subfocusChanging
and subfocusChanged . |
VectorSubfocusListener
interface |
The subfocus event-listener methods. To receive notification of vector subfocus events, implement this interface and register your component with the model object. |
VectorSubfocusAdapter
class |
An event helper class that implements
the VectorSubfocusListener interface. |
VectorSelection
interface |
Provides read-only access to a vector selection pool (all selected items). |
WritableVectorSelection
interface |
Provides read-write access to a selection pool for a vector model component. |
NullVectorSelection
class |
A selection class that permits no selection in the list. |
SingleVectorSelection
class |
A selection class that permits only one data item to be selected at a time. Selecting another data item deselects the first. |
BasicVectorSelection
class |
A selection class that allows selection of one or more data items in the list. It provides for noncontiguous and range selections. |
VectorSelectionEvent
class |
The event object created when a data item is added or removed from the selection pool in the vector model. |
VectorSelectionListener
interface |
The interface implemented by components wanting to respond to selection events in a vector model component. |
VectorSelectionAdapter
class |
An event helper class that implements
the VectorSelectionListener interface. |
VectorViewManager
interface |
Handles item painter and editor selection for components using a vector model. |
See also:
Singleton model
classes and interfaces
Matrix model classes and
interfaces
Graph model classes and
interfaces
Selecting
items in composite components
Handling subfocus events
Matrix interfaces and classes
Interface or class | Description |
MatrixModel
interface |
A two-dimensional array of items that
provides read-only access. This interface replaces the getCount()
method of the vector model with getRowCount() and
getColumnCount( ) methods. |
WritableMatrixModel
interface |
Extends MatrixModel and
provides write access. This interface adds methods to
add, change, and delete rows and columns. Its isVariableColumns
and isVariableRows properties determine
whether the number of rows or columns can be changed. |
BasicMatrixContainer
class |
An implementation of the WritableMatrixModel
interface. |
MatrixLocatio n
class |
An address in a matrix data structure pointing to a specific row and column location. |
MatrixModelEvent
class |
The object created when the data in the matrix model changes. |
MatrixModelListener
interface |
The matrix model event-listener methods. To receive notification of matrix model events, implement this interface and register your component with the model object. |
MatrixSubfocusEvent
class |
The event object created when an item in
the matrix model receives focus. There are two events in
the matrix subfocus event set: subfocusChanging and
subfocusChanged . |
MatrixSubfocusListener
interface |
The subfocus event-listener methods. To receive notification of matrix subfocus events, implement this interface and register your component with the model object. |
MatrixSubfocusAdapter
class |
An event helper class that implements
the MatrixSubfocusListener interface. |
MatrixSelection
interface |
Provides read-only access to a matrix selection pool (all selected items) for a matrix model component. |
WritableMatrixSelection
interface |
Provides read-write access to a selection pool for a matrix model component. |
NullMatrixSelection
class |
A selection class that permits no selection. |
RowMatrixSelection
class |
A selection class that permits the selection of a single row only. |
ColumnMatrixSelection
class |
A selection class that allows the selection of a single column only. |
CrossMatrixSelection
class |
A selection class that provides a kind of crosshairs selection. When the user clicks on a cell, that cell's entire row and entire column are selected. |
BasicMatrixSelection
class |
A selection class that allows the selection of one or more data items. It provides for noncontiguous and range selections. |
MatrixSelectionEvent
class |
The event object created when an item is added or removed from the selection pool in the matrix model. |
MatrixSelectionListener
interface |
The interface implemented by components wanting to respond to selection events in a matrix model component. |
MatrixSelectionAdapter
class |
An event helper class that implements
the MatrixSelectionListener interface. |
MatrixViewManager
interface |
Handles item painter and editor selection for components using a matrix model. |
See also:
Singleton model
classes and interfaces
Vector model classes and
interfaces
Graph model classes and
interfaces
Selecting
items in composite components
Handling subfocus events
Graph interfaces and classes
Interface or class | Description |
GraphModel
interface |
A read-only model that holds data items in a hierarchical relationship. It includes methods to return the children, parent, or root node of a specified node in the hierarchy. |
WritableGraphModel
interface |
Extends GraphModel and adds
methods to add, change, and delete nodes in the
hierarchy. |
BasicTreeContainer
class |
An implementation of the WritableGraphModel
interface. |
GraphLocation
class |
An abstract address in a graph data structure (parent, children). |
GraphModelEvent
class |
The object created when the data in the graph model changes. |
GraphModelListener
interface |
The graph model event-listener methods. To receive notification of graph model events, implement this interface and register your component with the model object. |
GraphSubfocusEvent
class |
The event object created when a data
item in the graph model receives focus. There are two
events in the graph subfocus event set: subfocusChanging
and subfocusChanged . |
GraphSubfocusListener
interface |
The subfocus event-listener methods. To receive notification of graph subfocus events, implement this interface and register your component with the model object. |
GraphSubfocusAdapter
class |
An event helper class that implements
the GraphSubfocusListener interface. |
GraphSelection
interface |
Provides read-only access to a graph selection pool (all selected items) for a graph model component. |
WritableGraphSelection
interface |
Provides read-write access to a selection pool for a graph model component. |
NullGraphSelection
class |
A selection class that permits no selection. |
SingleGraphSelection
class |
A selection class that permits only one data item to be selected at a time. Selecting another data item deselects the first. |
BasicGraphSelection
class |
A selection class that permits the selection of one or more items. It provides for noncontiguous and range selections. |
GraphSelectionEvent
class |
The event object created when an item is added or removed from the selection pool in the graph model. |
GraphSelectionListener
interface |
The interface implemented by components wanting to respond to selection events in a graph model component. |
GraphSelectionAdapter
class |
An event helper class that implements
the GraphSelectionListener interface. |
GraphViewManager
interface |
Handles item painter and editor selection for components using a graph model. |
See also:
Singleton model
classes and interfaces
Vector model classes and
interfaces
Matrix model classes and
interfaces
Selecting
items in composite components
Handling subfocus events
View components in the JBCL reside in the view
package.
Generally, each view has a corresponding complete component in
the control package. For example,
the
ListControl
control extends
the ListView
class.
There are four special view interfaces in the view
package:
Each view interface collects the basic behavior required of any view component using that particular model. Implementing these interfaces in your new views makes the resulting component easier to test.
In addition, there are special view classes for developing
different kinds of controls. For example, the
CheckBoxView
class is used for writing check box controls.
See also:
Models
Item painters and item editors
For components whose model implements the writable interface, item editors are also provided by the view manager. Editors are necessarily data-type specific as well.
Item painters
Item painter class | Description |
BorderItemPainter |
Puts a specific border state around another item painter. Borders can have a number of different painting styles and 3-dimensional effects. |
ButtonItemPainter |
Puts a button border around another item painter. This button-type border can respond to the state of the enclosed item. |
ColorItemPainter |
Paints the color of the data item. |
CheckBoxItemPainter |
Paints a check box as checked (with a check or an X) or unchecked based on the value of the data. |
CheckboxStateItemPainter |
Paints a check box as checked (with a check or an X) or unchecked based on the state of the data item. |
CompositeItemPainter |
Tiles two separate item painters horizontally or vertically; the user can specify which. |
CustomItemPainter |
A painter that can be customized to provide the required behavior and characteristics. |
EllipsisTextItemPainter |
Paints a text string with a given
rectangle; if the rectangle is too small to hold the text
string, the paint() method truncates and the
text and appends an ellipsis (...) to indicate text is
missing. |
FocusableItemPainter |
Paints a focus rectangle around the data item with the focus. |
ImageArrayItemPainter |
Paints images selected from an array based upon the index value passed to it. |
ImageButtonItemPainter |
Paints an image on a button model-view component to it. |
ImageItemPainter |
Paints items of type
java.awt.Image . |
SelectableItemPainter |
Paints items differently depending upon whether the data item is selected. |
StateImageItemPainter |
Paints image items differently, depending upon the data item's state. States are registered with the item painter. |
StateItemPainter |
Paints items differently, depending upon the data item's state. States are registered with the item painter. |
TextItemPainter |
Paints text items, such as String objects. |
WrappedTextItemPainter |
Paints text items, such as String objects,
wrapping the text as necessary. |
Item editors
Item editor class | Description |
BooleanToggleItemEditor |
Toggles the data to the opposite boolean
state. It is used with a
CheckBoxItemPainter . |
ChoiceItemEditor |
Edits an item in a choice menu. |
CompositeItemEditor |
Edits data items that consist of two
parts, such as an image and a string in a TreeControl . |
CustomItemEditor |
A painter that can be customized to provide the required behavior and characteristics. |
ExpandingTextItemEditor |
Edits text data items, such as String
objects. The editor expands as the user types. |
ImageItemEditor |
Edits items of type
java.awt.Image
using a dialog box. |
MaskableTextItemEditor |
An item editor that can be used to validate input. |
PairItemEditor |
Edits an item from a jgl.Pair
object using the specified nested item editor. |
TextItemEditor |
Edits text data items, such as String
objects. |
View manager interfaces and classes
View manager interface or class | Description |
SingletonViewManager
interface |
Handles item painter and editor selection for components using a singleton model. |
VectorViewManager
interface |
Handles item painter and editor selection for components using a vector model. |
MatrixViewManager
interface |
Handles item painter and editor selection for components using a matrix model. |
GraphViewManager
interface |
Handles item painter and editor selection for components using a graph model. |
BasicViewManager
class |
A basic implementation of SingletonViewManager ,
VectorViewManager , MatrixViewManager ,
and GraphViewManager . BasicViewManager
provides a single item painter and a single item editor
for all items. BasicViewManager is useful when
you know the type of data contained in the model. |
TypedViewManager
class |
A basic implementation of each of SingletonViewManager ,
VectorViewManager , MatrixViewManager ,
and GraphViewManager . TypedViewManager examines
the data item passed to it and hands back an appropriate
item painter or item editor. Use TypedViewManager when
the data can be more than one type. |
ListControl
allows multiple selection of its data items, even noncontiguous
selection. A
GridControl
allows the selection of a single cell, several cells, an entire
row, or an entire column. Selection depends on the model type; a
range of selected items means very different things in a
vector-model list and in a matrix-model table. A range in a
vector includes all items between the beginning index and the
ending index of the selection. A range in a matrix includes all
the cells between the first matrix location and the last. Yet, on
one level, a selection is always the same thing: a list of the
item addresses that are selected.
In JBCL composite components, selection is handled by another group of composite objects: selection objects. Each implements an interface for the model it supports: vector, matrix, or graph. The singleton model does not support selection, as it has but a single data item.
For a brief description of the selection interfaces and classes, see the Vector, Matrix, and Graph interface and class tables. Each selection interface and class has the word "Selection" in its name.
For example, the user of an application that contains a list control can use the Tab key to move to the list control. When this happens, the list control has the focus. When the user then selects one of the items in the list control, a subfocus event occurs and the selected item has the subfocus.
There are two events in the subfocus event set: subfocusChanging
and subfocusChanged
. The subfocusChanging
event
allows registered listeners to veto the subfocusChanged
event. If, on receipt of a subfocusChanging
event, a
listener throws an EventVetoException
, the focus does
not move to the new item and the subfocusChanged
does
not occur.
For a brief description of the subfocus interfaces and classes, see the Vector, Matrix, and Graph interface and class tables. Each subfocus interface and class has the word "Subfocus" in its name.