public abstract class ModelAdapter extends java.lang.Object implements Model, ControllerActions, DataDirectorListener, java.io.Serializable
In the Model-View-Controller architecture, the model is responsible for
handling the data that is displayed in a view. In the full BI Beans set,
the DataSource
is the "big" model. This model interacts
with the DataSource
, manipulating and retrieving data.
Users of a view normally do not need to call any of the methods of this
class.
Modifier and Type | Field and Description |
---|---|
protected DataAccess |
dataAccess |
protected DataDirector |
dataDirector |
protected DataSource |
dataDirectorFactory |
protected boolean |
drillingEnabled |
protected static int |
INITIAL_DATA_COLUMN |
protected static int |
INITIAL_DATA_ROW |
protected static int |
INITIAL_EDGE_SIZE |
protected javax.swing.event.EventListenerList |
listenerList |
protected ErrorHandler |
m_eh |
protected DataAccess |
metadataAccess |
VIEW_PAGE_FIRST, VIEW_PAGE_LAST, VIEW_PAGE_NEXT, VIEW_PAGE_PREVIOUS
Constructor and Description |
---|
ModelAdapter()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataListener(DataListener l)
Registers a data listener with this model.
|
void |
addModelListener(ModelListener l)
Registers a model listener with this model.
|
boolean |
canDrill(java.lang.Object source,
int edge,
int layer,
int slice,
int flags)
Indicates whether a drill gesture is legal.
|
boolean |
canPivot(java.lang.Object source,
int fromEdge,
int toEdge,
int fromLayer,
int toLayer,
int flags)
Indicates whether a pivot operation is legal.
|
protected DataSource |
createDefaultDataSource() |
boolean |
drillGestureHappened(java.lang.Object source,
int edge,
int layer,
int slice,
int flags)
Drills in data.
|
protected void |
fireviewDrillRequested(DrillEvent e) |
protected void |
fireviewDrillRequesting(DrillEvent e) |
protected void |
fireviewPageRequested(PageEvent e) |
protected void |
fireviewPageRequesting(PageEvent e) |
protected void |
fireviewPivotRequested(PivotEvent e) |
protected void |
fireviewPivotRequesting(PivotEvent e) |
ControllerActions |
getControllerActions() |
DataAccess |
getDataAccess()
Get the data access for this view.
|
DataDirector |
getDataDirector()
Retrieves the data director for this view.
|
protected abstract DataMap |
getDataMap() |
DataSource |
getDataSource()
Retrieves the data source for this view.
|
ErrorHandler |
getErrorHandler()
Retrieves the error handler for this view.
|
protected FormatManager |
getFormatManager()
Get the format manager.
|
protected abstract LayerMetadataMap |
getLayerMetadataMap(int edge) |
protected abstract MetadataMap |
getMetadataMap(int edge) |
protected void |
initDefaults(DataviewDefaultValues ddv)
Initialize default values from the given DataviewDefaultValues instance.
|
boolean |
isDrillingEnabled()
Indicates whether drilling is allowed in this view.
|
boolean |
pageChangeHappened(java.lang.Object source,
int pos)
Changes the current page.
|
boolean |
pageChangeHappened(java.lang.Object source,
int[] hPos,
int maxLayerSpecified)
Changes the current page.
|
boolean |
pivotGestureHappened(java.lang.Object source,
int fromEdge,
int toEdge,
int fromLayer,
int toLayer,
int flags)
Pivots data.
|
void |
pollingRequired(PollingRequiredEvent polling)
Event fired to inform listeners that the given DataDirector requires polling to retrieve data using
the DataDirector3 events getStatus and possibly fireEvents.
|
void |
removeDataListener(DataListener l)
Removes the data listener from this model.
|
void |
removeModelListener(ModelListener l)
Removes a model listener from the list of listeners for this model.
|
void |
setDataAccess(DataAccess dp)
Specifies the data access for this view.
|
void |
setDataDirector(DataDirector dd)
Specifies the data director for this view.
|
void |
setDataSource(DataSource ds)
Specifies the data source for this view.
|
void |
setDrillingEnabled(boolean b)
Specifies whether drilling is allowed in this view.
|
void |
setErrorHandler(ErrorHandler eh)
Specifies the error handler for this view.
|
protected void |
setFormatManager(FormatManager fm)
Specifies the format manager.
|
protected abstract void |
setSupportedDataLayerFlags()
Set the flags for data layer supported.
|
void |
viewDataAvailable(DataAvailableEvent e)
Notifies listeners of a change in the availability of data.
|
void |
viewDataChanged(DataChangedEvent e)
Notify listeners of changes to the data or metadata.
|
void |
waitDataAvailable(WaitDataAvailableEvent e)
Notifies listeners that a slow data fetch has been completed.
|
protected static final int INITIAL_EDGE_SIZE
protected static final int INITIAL_DATA_COLUMN
protected static final int INITIAL_DATA_ROW
protected javax.swing.event.EventListenerList listenerList
protected transient DataSource dataDirectorFactory
protected transient DataDirector dataDirector
protected transient DataAccess dataAccess
protected transient DataAccess metadataAccess
protected boolean drillingEnabled
protected transient ErrorHandler m_eh
protected void initDefaults(DataviewDefaultValues ddv)
public void setErrorHandler(ErrorHandler eh)
setErrorHandler
in interface Model
eh
- The error handler.Dataview.addErrorHandler(oracle.dss.util.ErrorHandler)
public ErrorHandler getErrorHandler()
getErrorHandler
in interface Model
null
if no
error handler has been specified for the view.public void setDataSource(DataSource ds)
setDataSource
in interface Model
ds
- The data source for this view.protected DataSource createDefaultDataSource()
public DataSource getDataSource()
getDataSource
in interface Model
null
if no data source has been specified for this
view.public void setDataDirector(DataDirector dd)
Model
implementation as a listener to the data director.setDataDirector
in interface Model
dd
- A DataDirector
implementation that has been
initialized.protected abstract void setSupportedDataLayerFlags()
public DataDirector getDataDirector()
getDataDirector
in interface Model
public void setDataAccess(DataAccess dp)
setDataAccess
in interface Model
dp
- An implementation of the DataAccess
interface.public DataAccess getDataAccess()
getDataAccess
in interface Model
DataAccess
for this view. This method can return
null
if no data access has been specified for
this view.public void addDataListener(DataListener l)
addDataListener
in interface Model
l
- The listener to add.public void removeDataListener(DataListener l)
removeDataListener
in interface Model
l
- The listener to remove.public void addModelListener(ModelListener l)
Dataview
calls this method to register itself as
a listener for this Model
.
Application developers do not need to call this method.addModelListener
in interface Model
l
- The listener to add.public void removeModelListener(ModelListener l)
Dataview
calls this method before it shuts down,
to remove itself from the list of listeners for this Model
.removeModelListener
in interface Model
l
- The listener to remove.public boolean pivotGestureHappened(java.lang.Object source, int fromEdge, int toEdge, int fromLayer, int toLayer, int flags) throws EdgeOutOfRangeException, LayerOutOfRangeException, DataDirectorException
ControllerActions
viewPivotRequesting
event.
If the event is not consumed, this method then calls the
pivot
method in the data director, to pivot the data in the
data source.
After the call to the data director, this method fires a
viewPivotRequested
event.
The view calls this method when a pivot gesture is detected in the UI.
pivotGestureHappened
in interface ControllerActions
pivotGestureHappened
in interface Model
source
- The source of any events that this method fires.
The DataView
passes this
as
this parameter.fromEdge
- A constant that represents the edge to pivot from,
such as COLUMN_EDGE
.
Edge constants are listed in the See Also section.toEdge
- A constant that represents the edge to pivot to.fromLayer
- The layer to pivot from.
The layer identifies the location of the dimension or
dimension member on the edge.
Zero is the outer-most layer on the edge.toLayer
- The layer to pivot to.flags
- A constant that represents the type of pivot to perform,
such as PIVOT_SWAP
or
PIVOT_MOVE_BEFORE
. The constants are
listed in the See Also section, and they begin with
PIVOT_.true
if the data director performs the pivot,
false
if the pivot is not performed for some reason.EdgeOutOfRangeException
- If either edge parameter is too large.LayerOutOfRangeException
- If either layer parameter is negative
or too large.DataDirectorException
- If a data provider error occurs.DataDirector.COLUMN_EDGE
,
DataDirector.ROW_EDGE
,
DataDirector.PAGE_EDGE
,
DataDirector.PIVOT_EDGES
,
DataDirector.PIVOT_MOVE_AFTER
,
DataDirector.PIVOT_MOVE_BEFORE
,
DataDirector.PIVOT_SWAP
viewPivotRequesting
event.
If the event is not consumed, this method then calls the
pivot
method in the data director, to pivot the data in the
data source.
After the call to the data director, this method fires a
viewPivotRequested
event.
The view calls this method when a pivot gesture is detected in the UI.
public boolean canPivot(java.lang.Object source, int fromEdge, int toEdge, int fromLayer, int toLayer, int flags) throws EdgeOutOfRangeException, LayerOutOfRangeException, DataDirectorException
ControllerActions
pivotOK
method in the data director,
to pivot the data in the data source.
The view calls this method when a pivot gesture is detected in the UI.canPivot
in interface ControllerActions
canPivot
in interface Model
source
- The source of any events that this method fires.
The DataView
passes this
as
this parameter.fromEdge
- A constant that represents the edge to pivot from,
such as COLUMN_EDGE
.
Edge constants are listed in the See Also section.toEdge
- A constant that represents the edge to pivot to.fromLayer
- The layer to pivot from.
The layer identifies the location of the dimension or
dimension member on the edge.
Zero is the outer-most dimension on the edge.toLayer
- The layer to pivot to.flags
- A constant that represents the type of pivot to perform,
such as PIVOT_SWAP
or
PIVOT_MOVE_BEFORE
. The constants are listed
in the See Also section, and
they all begin with PIVOT_.true
if the pivot operation is legal,
false
if not.EdgeOutOfRangeException
- If either edge parameter is too large.LayerOutOfRangeException
- If either layer parameter is negative
or too large.DataDirectorException
- If a data provider error occurs.DataDirector.COLUMN_EDGE
,
DataDirector.ROW_EDGE
,
DataDirector.PAGE_EDGE
,
DataDirector.PIVOT_EDGES
,
DataDirector.PIVOT_MOVE_AFTER
,
DataDirector.PIVOT_MOVE_BEFORE
,
DataDirector.PIVOT_SWAP
pivotOK
method in the data director,
to pivot the data in the data source.
The view calls this method when a pivot gesture is detected in the UI.public boolean drillGestureHappened(java.lang.Object source, int edge, int layer, int slice, int flags) throws EdgeOutOfRangeException, LayerOutOfRangeException, SliceOutOfRangeException, DataDirectorException
ControllerActions
drillGestureHappened
in interface ControllerActions
drillGestureHappened
in interface Model
source
- The source of any events that this method fires.
The DataView
passes this
as
this parameter.edge
- A constant that represents the edge to drill, such as
COLUMN_EDGE
. Edge constants are listed in the
See Also secton.layer
- The layer to drill.
The layer identifies the location of the dimension or
dimension member on the edge.
Zero is the outer-most layer on the edge.slice
- The slice to drill. The slice is zero-based.
Each layer member in the innermost dimension has
a unique slice. In outer layers, any slice that the
outer layer spans can be used.flags
- A constant that represents the type of drill to perform,
such as DRILLSTATE_DRILLABLE
to drill down
in data.
Drill constants are listed in the See Also section.
They begin with DRILLSTATE_.true
if the data director performs the drill,
false
if not.EdgeOutOfRangeException
- If edge
is
too large.LayerOutOfRangeException
- If layer
is negative or
too large.SliceOutOfRangeException
- If slice
is negative or
too large.DataDirectorException
- If a data provider error occurs.DataDirector.COLUMN_EDGE
,
DataDirector.ROW_EDGE
,
DataDirector.PAGE_EDGE
,
DataDirector.DRILLSTATE_DRILLABLE
,
DataDirector.DRILLSTATE_IS_DRILLED
,
DataDirector.DRILLSTATE_NOT_DRILLABLE
public boolean canDrill(java.lang.Object source, int edge, int layer, int slice, int flags) throws EdgeOutOfRangeException, LayerOutOfRangeException, SliceOutOfRangeException, DataDirectorException
ControllerActions
canDrill
in interface ControllerActions
canDrill
in interface Model
source
- The source of any events that this method fires.
The DataView
passes this
as
this parameter.edge
- A constant that represents the edge to drill, such as
COLUMN_EDGE
. Edge constants listed in the
See Also section.layer
- The layer to drill.
The layer identifies the location of the dimension or
dimension member on the edge.
Zero is the outer-most layer on the edge.slice
- The slice to drill. The slice is zero-based.
Each layer member in the innermost layer has
a unique slice. In outer layers, any slice that the
outer layer spans can be used.flags
- A constant that represents the type of drill to perform,
such as DRILLSTATE_DRILLABLE to drill down in data.
Drill constants are listed in the See Also section.
They begin with DRILLSTATE_.true
if the drill operation is legal,
false
if not.EdgeOutOfRangeException
- If edge
is
too large.DepthOutOfRangeException
- If depth
is negative or
too large.SliceOutOfRangeException
- If slice
is negative or
too large.DataDirectorException
- If a data provider error occurs.LayerOutOfRangeException
DataDirector.COLUMN_EDGE
,
DataDirector.ROW_EDGE
,
DataDirector.PAGE_EDGE
,
DataDirector.DRILLSTATE_DRILLABLE
,
DataDirector.DRILLSTATE_IS_DRILLED
,
DataDirector.DRILLSTATE_NOT_DRILLABLE
public boolean pageChangeHappened(java.lang.Object source, int pos) throws SliceOutOfRangeException, DataDirectorException
ControllerActions
pageChangeHappened
in interface ControllerActions
pageChangeHappened
in interface Model
source
- The source of any event that this method fires.pos
- A constant that represents the first page, last page, next
page, or previous page. Constants are listed in the
See Also section.true
if the page is changed,
false
if not.SliceOutOfRangeException
- If page
is negative or too
large.DataDirectorException
- If a data provider error occurs.Model.VIEW_PAGE_FIRST
,
* @see Model#VIEW_PAGE_NEXT
,
Model.VIEW_PAGE_PREVIOUS
public boolean pageChangeHappened(java.lang.Object source, int[] hPos, int maxLayerSpecified) throws LayerOutOfRangeException, SliceOutOfRangeException, DataDirectorException
ControllerActions
pageChangeHappened
in interface ControllerActions
pageChangeHappened
in interface Model
source
- The source of any event that this method fires.hPos
- An array of relative indices that indicate the set of
new values to give to the various layers that make up the
target slice.maxLayerSpecified
- The maximum index into hPos
(layer) that the
call should use in making the slice change.true
if the page is changed,
false
if not.LayerOutOfRangeException
- If there are too many layers.SliceOutOfRangeException
- If page
is negative or too
large.DataDirectorException
- If a data provider error occurs.public void setDrillingEnabled(boolean b)
setDrillingEnabled
in interface Model
b
- true
to enable drilling,
false
to disable drilling.public boolean isDrillingEnabled()
isDrillingEnabled
in interface Model
true
if drilling is enabled,
false
if not.public ControllerActions getControllerActions()
getControllerActions
in interface Model
ModelAdapter
.ControllerActions
interface.
This method returns this
.protected void fireviewPivotRequesting(PivotEvent e)
protected void fireviewPivotRequested(PivotEvent e)
protected void fireviewDrillRequesting(DrillEvent e)
protected void fireviewDrillRequested(DrillEvent e)
protected void fireviewPageRequesting(PageEvent e)
protected void fireviewPageRequested(PageEvent e)
public void viewDataChanged(DataChangedEvent e)
modelDataChanged
method of
each registered listener.viewDataChanged
in interface Model
viewDataChanged
in interface DataDirectorListener
e
- Information about the data change.public void viewDataAvailable(DataAvailableEvent e)
modelDataAvailable
method of each
registered listeners.viewDataAvailable
in interface DataDirectorListener
e
- Information about the availability of data.public void waitDataAvailable(WaitDataAvailableEvent e)
modelWaitDataAvailable
method of each
registered ModelListener
.waitDataAvailable
in interface DataDirectorListener
e
- Information about the fetch.DataDirector
,
WaitData
public void pollingRequired(PollingRequiredEvent polling)
DataDirectorListener
pollingRequired
in interface DataDirectorListener
protected void setFormatManager(FormatManager fm)
fm
- format manager instanceprotected FormatManager getFormatManager()
protected abstract DataMap getDataMap()
protected abstract MetadataMap getMetadataMap(int edge)
protected abstract LayerMetadataMap getLayerMetadataMap(int edge)