Graphics Reference
In-Depth Information
Figure
.
.
Classes for linked views
Handler
object is generated together with a
DataModel
object that is a subject.
PlotModel
objects that implement the
DataModelListener
interface are ob-
servers. Observers are registered by a
addDataModelListener
method in the
DataModelHandler
class.
PlotModelHandler
and
DataModelHandler
are also examples of the
“Mediator” in the “Mediator” design pattern.
he Mediator pattern defines an object that encapsulates how a set of objects
interact. A mediator promotes loose coupling by keeping objects from refer-
ring to each other explicitly, and it lets you vary their interaction indepen-
dently (Gamma et al.,
).
We sometimes notice that many objects need to communicate with each other. Such
mutual interactions may prevent an object from working without the support of
many other objects. he mediator pattern is a useful approach to use to solve such
amess.hemediatorobjectprovidesacommonconnectionpoint,centralizedbehav-
ior, and behavioral management. he mediator pattern promotes loose coupling by
keeping objects from referring to each other explicitly. Objects do not need to know
about each other and only need to know their mediator. Several
JasplotPanel-
PaletteLayer
objectscommunicatewitha
PlotModelHandler
mediatorob-
ject. Figure
.
shows these classes.
Classes for Tables of Data
17.3.8
We sometimes wish to display a table of data that can be linked with graphics. Jas-
plot has two classes for this purpose:
TableModel
and
TableDisplayer
.he
TableModel
classissimilar to
PlotModel
,andtheconstructor methodrequires
a
DataModel
object as an argument. he
TableDisplayer
class is similar to
Plotter
and displaysan
TableModel
object onthescreenbyusingthe
JTable
classinSwing.Asitimplementsa
PlotModelListener
interface,the rowsspec-
ified by the
observationSelected
method are highlighted and linked with
other graphics of Jasplot via a
PlotModelHandler
.
A Class for Building Complicated Graphics
17.3.9
Jasplot provides a
MultiPlotModel
class for drawing several graphics on one
panel.his class extends the
BasicPlotModel
class and is inherited by the
Box-