com.sas.swing.visuals.olaptableview
Class OLAPTableView

com.sas.swing.visuals.olaptableview.OLAPTableView
All Implemented Interfaces:
ActionProviderViewInterface, SwingActionProviderViewInterface, com.sas.collection.ContentsChangedListener, TableRowModelListener, com.sas.table.MoveColumnInterface, SupportsGenericErrorHandlerInterface, java.awt.event.AdjustmentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.RowSorterListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable

public class OLAPTableView

OLAPTableView is a swing component that extends from TableView and allows OLAP (On-Line Analytical Processing) data to be viewed and manipulated in tabular form.

Model

OLAPTableView requires a model that implements both a TableModel and an OLAPDataSetInterfaceProvider in order to view the data correctly. The OLAPDataSetInterface will be obtained from the OLAPDataSetInterfaceProvider.

To attach a model to OLAPTableView:

setModel (your-model);

For More Information:

Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.

Examples for this class may be found on the Examples Site.

Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .

See Also:
TableView, OLAPDataSetInterfaceProvider, OLAPTableModelAdapter, OLAPDataSetInterface, Serialized Form

Field Summary
static java.lang.String RB_KEY
           
 
Fields inherited from class com.sas.swing.visuals.tableview.TableView
AUTO_RESIZE_ALL_ROWS, AUTO_RESIZE_FIRST_ROW, changingCurrentCell, clearRowSelectionAfterSorting, columnAutoResizeMode, columnHeaderFilter, columnsSized, dataCellFilter, factory, genericErrorHandler, LASTROW, lastSortDirections, lastSortedColumns, printing, rowAutoResizeMode, rowHeaderFilter, rowHeightModel, tableInitialized, titleFilter, toolbarFilter, viewerSupport
 
Constructor Summary
OLAPTableView()
          Constructs a default OLAPTableView that is initialized with a default data model, a default column model, a default row model, and default selection models.
OLAPTableView(int numRows, int numColumns)
          Constructs a OLAPTableView with numRows and numColumns of empty cells using DefaultTableModel.
OLAPTableView(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
          Constructs a OLAPTableView to display the values in the two dimensional array, rowData, with column names, columnNames.
OLAPTableView(javax.swing.table.TableModel tableModel)
          Constructs a OLAPTableView that is initialized with tableModel as the data model, a default column model, a default row model, and default selection models.
OLAPTableView(javax.swing.table.TableModel tableModel, javax.swing.table.TableColumnModel columnModel)
          Constructs a OLAPTableView that is initialized with tableModel as the data model, columnModel as the column model, a default row model, and default selection models.
OLAPTableView(javax.swing.table.TableModel tableModel, javax.swing.table.TableColumnModel columnModel, javax.swing.ListSelectionModel selectionModel)
          Constructs a OLAPTableView that is initialized with tableModel as the data model, columnModel as the column model, selectionModel as the cell selection model, and a default row model .
OLAPTableView(java.util.Vector rowData, java.util.Vector columnNames)
          Constructs a OLAPTableView to display the values in the Vector of Vectors, rowData, with column names, columnNames.
 
Method Summary
protected  ActionSupportFilter configureColumnHeaderActionFilter(int row, int column)
           
protected  ActionSupportFilter configureDataCellActionFilter(int row, int column)
           
protected  ActionSupportFilter configureRowHeaderActionFilter(int row, int column)
           
protected  ActionSupportFilter configureTitleActionFilter(int row, int column)
           
protected  ActionSupportFilter configureToolBarActionFilter()
          Configures the toolbar action filter for the ActionProvider.
 void contentsChanged(com.sas.collection.ContentsChangedEvent event)
          Invoked when the table receives a ContentsChangeEvent from the action provider.
 void createDefaultActionProviderFilters()
          Creates the default action provider filters that get used for by the action provider to return various actions for the given areas.
protected  javax.swing.table.TableColumnModel createDefaultColumnModel()
          Returns the default column model object which is a DefaultTableColumnModel.
 void createDefaultColumnsFromModel()
          Creates default columns for the table from the data model using the getColumnCount method defined in the TableModel interface.
protected  javax.swing.table.TableModel createDefaultDataModel()
          Returns the default table model object, which is a OLAPTableModelAdapter.
protected  javax.swing.JComponent createDefaultOriginComponent()
          Returns the default origin component object, which is a OLAPOriginComponent for an OLAP model.
protected  void createDefaultRenderers()
          Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons.
protected  RowHeader createDefaultRowHeader()
          Returns the default table row header object, which is a OLAPRowHeader.
protected  TableRowModel createDefaultRowModel()
          Returns the default row model object which is a DefaultTableRowModel.
protected  javax.swing.table.JTableHeader createDefaultTableHeader()
          Returns the default table header object, which is a OLAPColumnHeader if the model is OLAP, ColumnHeader if the model is relational.
 void createDefaultViewerSupport()
          Creates the default viewer support, which by default is an instanceof com.sas.actionprovider.support.SwingViewerSupport.
 AxisInterface getAxis(int axis)
          Returns an instance of the AxisInterface for the given axis if the model is an OLAPDataSetInterfaceProvider and the model has that axis present.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this OLAPTableView.
 java.lang.String getUIClassID()
          Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
protected  void repaintCells(int oldRow, int newRow, int oldColumn, int newColumn)
           
protected  void repaintCurrentCell()
           
 void setModel(javax.swing.table.TableModel newModel)
          Sets the new model of the table, if the model implements com.sas.swing.models.OLAPDataSetInterfaceProvider then appropriate OLAP headers will be created, otherwise the headers will be relational headers.
 void showPopup(int row, int column)
          Displays the popup menu at the bttom right corner of the cell specified.
 void showPopup(java.awt.Point point)
          Displays the popup menu at the given point.
 void tableChanged(javax.swing.event.TableModelEvent e)
          Invoked when this table's TableModel generates a TableModelEvent.
 void updateUI()
          Notification from the javax.swing.UIManager that the look and feel (L&F) has changed.
protected  void validateCurrentCell()
           
 
Methods inherited from class com.sas.swing.visuals.tableview.TableView
addCellSelectionInterval, addColumnSelectionInterval, addRowSelectionInterval, adjustmentValueChanged, boundColumn, boundRow, changeCurrentCell, changeSelection, clearSelection, columnAtPoint, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertRowIndexToModel, convertRowIndexToView, copy, createDefaultEditors, createDefaultSelectionModel, createOrdinal, createPopupMenu, cut, doLayout, getActionProvider, getActionSupportType, getCellAreaHeight, getCellAreaRect, getCellAreaWidth, getCellEditor, getCellRect, getCellRect, getCellRenderer, getCellSelectionEnabled, getClipboardAdapter, getColumnAutoResizeMode, getColumnHeader, getCurrentCell, getCurrentColumn, getCurrentRow, getEditController, getFirstVisibleColumn, getFirstVisibleRow, getGenericErrorHandler, getGridWidth, getHiddenColumns, getIntercellSpacing, getLastVisibleColumn, getLastVisibleRow, getOriginComponent, getPopupMenu, getRowAutoResizeMode, getRowHeader, getRowHeight, getRowMargin, getRowModel, getRowSelectionAllowed, getScrollPane, getSelectedCellCount, getSelectedCells, getSelectedCellsForColumn, getSelectedCellsForRow, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getUnformattedColumnClass, getUnformattedValueAt, getUniqueId, getValueAt, getViewPosition, handlePostSortingSelections, hideColumn, initializeLocalVars, isActionVisible, isCellEditable, isCellSelected, isColumnHeaderVisible, isColumnMoveAllowed, isColumnSelected, isPopupMenuEnabled, isRowHeaderVisible, isRowSelected, isRowsReorderable, listActionTypes, listAreaTypes, moveRow, paintComponent, paste, populatePopupMenu, populateToolBar, prepareEditor, prepareRenderer, print, printComponent, processKeyBinding, removeCellSelectionInterval, removeColumnSelectionInterval, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, rowAtPoint, rowMarginChanged, rowMoved, rowSelectionChanged, selectAll, setActionProvider, setActionSupportType, setActionVisible, setCellEditor, setCellEditor, setCellRenderer, setCellRenderer, setCellSelectionEnabled, setCellSelectionInterval, setClipboardAdapter, setColumnAutoResizeMode, setColumnHeader, setColumnHeaderVisible, setColumnSelectionAllowed, setColumnSelectionInterval, setCurrentColumn, setCurrentRow, setEditController, setGenericErrorHandler, setGridWidth, setOriginComponent, setPopupMenuEnabled, setRowAutoResizeMode, setRowHeader, setRowHeaderVisible, setRowHeight, setRowHeight, setRowMargin, setRowModel, setRowSelectionAllowed, setRowSelectionInterval, setRowsReorderable, setSelectionMode, setSize, setUniqueId, setValueAt, showAllColumns, showColumn, showPopup, tableRowsDeleted, tableRowsInserted, tableRowsUpdated, unconfigureEnclosingScrollPane, valueChanged
 
Methods inherited from interface com.sas.table.MoveColumnInterface
moveColumn
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values
Constructor Detail

OLAPTableView

public OLAPTableView()
Constructs a default OLAPTableView that is initialized with a default data model, a default column model, a default row model, and default selection models.

See Also:
JTable.createDefaultDataModel(), JTable.createDefaultColumnModel(), TableView.createDefaultSelectionModel(), createDefaultRowModel()

OLAPTableView

public OLAPTableView(javax.swing.table.TableModel tableModel)
Constructs a OLAPTableView that is initialized with tableModel as the data model, a default column model, a default row model, and default selection models.

Parameters:
tableModel - the data model for the table
See Also:
JTable.createDefaultColumnModel(), TableView.createDefaultSelectionModel(), createDefaultRowModel()

OLAPTableView

public OLAPTableView(javax.swing.table.TableModel tableModel,
                     javax.swing.table.TableColumnModel columnModel)
Constructs a OLAPTableView that is initialized with tableModel as the data model, columnModel as the column model, a default row model, and default selection models.

Parameters:
tableModel - the data model for the table
columnModel - the column model for the table
See Also:
TableView.createDefaultSelectionModel(), createDefaultRowModel()

OLAPTableView

public OLAPTableView(javax.swing.table.TableModel tableModel,
                     javax.swing.table.TableColumnModel columnModel,
                     javax.swing.ListSelectionModel selectionModel)
Constructs a OLAPTableView that is initialized with tableModel as the data model, columnModel as the column model, selectionModel as the cell selection model, and a default row model . If any of the parameters are null this method will initialize the table with the corresponding default model. The autoCreateColumnsFromModel flag is set to false if columnModel is non-null, otherwise it is set to true and the column model is populated with suitable TableColumns for the columns in tableModel.

Parameters:
tableModel - the data model for the table
columnModel - the column model for the table
selectionModel - the row selection model for the table
See Also:
JTable.createDefaultDataModel(), JTable.createDefaultColumnModel(), TableView.createDefaultSelectionModel(), createDefaultRowModel()

OLAPTableView

public OLAPTableView(int numRows,
                     int numColumns)
Constructs a OLAPTableView with numRows and numColumns of empty cells using DefaultTableModel. The columns will have names of the form "A", "B", "C", etc.

Parameters:
numRows - the number of rows the table holds
numColumns - the number of columns the table holds
See Also:
DefaultTableModel

OLAPTableView

public OLAPTableView(java.util.Vector rowData,
                     java.util.Vector columnNames)
Constructs a OLAPTableView to display the values in the Vector of Vectors, rowData, with column names, columnNames. The Vectors contained in rowData should contain the values for that row. In other words, the value of the cell at row 1, column 5 can be obtained with the following code:

((Vector)rowData.elementAt(1)).elementAt(5);

Parameters:
rowData - the data for the new table
columnNames - names of each column

OLAPTableView

public OLAPTableView(java.lang.Object[][] rowData,
                     java.lang.Object[] columnNames)
Constructs a OLAPTableView to display the values in the two dimensional array, rowData, with column names, columnNames. rowData is an array of rows, so the value of the cell at row 1, column 5 can be obtained with the following code:

 rowData[1][5]; 

All rows must be of the same length as columnNames.

Parameters:
rowData - the data for the new table
columnNames - names of each column
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this OLAPTableView.

Returns:
the ExtendedBeanInfo for this class

setModel

public void setModel(javax.swing.table.TableModel newModel)
Sets the new model of the table, if the model implements com.sas.swing.models.OLAPDataSetInterfaceProvider then appropriate OLAP headers will be created, otherwise the headers will be relational headers.

Overrides:
setModel in class javax.swing.JTable
Parameters:
newModel - the newModel for the table

getAxis

public AxisInterface getAxis(int axis)
Returns an instance of the AxisInterface for the given axis if the model is an OLAPDataSetInterfaceProvider and the model has that axis present.

Parameters:
axis - the integer representing the axis, values are from the AxisInterface class.
Returns:
the instance of the AxisInterface or null if the aixs is invalid or not present
See Also:
AxisInterface

createDefaultDataModel

protected javax.swing.table.TableModel createDefaultDataModel()
Returns the default table model object, which is a OLAPTableModelAdapter. A subclass can override this method to return a different table model object.

Overrides:
createDefaultDataModel in class javax.swing.JTable
Returns:
the default table model object
See Also:
OLAPTableModelAdapter

createDefaultTableHeader

protected javax.swing.table.JTableHeader createDefaultTableHeader()
Returns the default table header object, which is a OLAPColumnHeader if the model is OLAP, ColumnHeader if the model is relational. A subclass can override this method to return a different table header object.

Overrides:
createDefaultTableHeader in class TableView
Returns:
the default table header object
See Also:
OLAPColumnHeader

createDefaultColumnModel

protected javax.swing.table.TableColumnModel createDefaultColumnModel()
Returns the default column model object which is a DefaultTableColumnModel. A subclass can override this method to return a different column model object

Overrides:
createDefaultColumnModel in class javax.swing.JTable
Returns:
the default column model object

createDefaultColumnsFromModel

public void createDefaultColumnsFromModel()
Creates default columns for the table from the data model using the getColumnCount method defined in the TableModel interface.

Clears any existing columns before creating the new columns based on information from the model.

Overrides:
createDefaultColumnsFromModel in class javax.swing.JTable
See Also:
JTable.getAutoCreateColumnsFromModel()

createDefaultViewerSupport

public void createDefaultViewerSupport()
Creates the default viewer support, which by default is an instanceof com.sas.actionprovider.support.SwingViewerSupport. The action support type is set to com.sas.actionprovider.support.ActionProviderSupportTypes.OLAP_TABLEVIEW_SUPPORT

Overrides:
createDefaultViewerSupport in class TableView

createDefaultActionProviderFilters

public void createDefaultActionProviderFilters()
Creates the default action provider filters that get used for by the action provider to return various actions for the given areas. This method creates a filter for the following areas: OLAPTableViewAreaInterface.DATA_CELL_AREA, OLAPTableViewAreaInterface.ROW_HEADER_AREA, OLAPTableViewAreaInterface.COLUMN_HEADER_AREA, OLAPTableViewAreaInterface.TITLE_AREA, TOOLBAR_AREA

Overrides:
createDefaultActionProviderFilters in class TableView

createDefaultRenderers

protected void createDefaultRenderers()
Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons. The default renderer for the Object class is a com.sas.swing.visuals.tableview.NumberRenderer.

Overrides:
createDefaultRenderers in class TableView
See Also:
NumberRenderer

updateUI

public void updateUI()
Notification from the javax.swing.UIManager that the look and feel (L&F) has changed. Replaces the current UI object with the latest version from the javax.swing.UIManager.

Overrides:
updateUI in class TableView
See Also:
JComponent.updateUI()

getUIClassID

public java.lang.String getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.

Overrides:
getUIClassID in class TableView
Returns:
the string "OLAPTableViewUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

createDefaultRowHeader

protected RowHeader createDefaultRowHeader()
Returns the default table row header object, which is a OLAPRowHeader. A subclass can override this method to return a different table row header object.

Overrides:
createDefaultRowHeader in class TableView
Returns:
the default table row header object
See Also:
OLAPRowHeader

createDefaultRowModel

protected TableRowModel createDefaultRowModel()
Returns the default row model object which is a DefaultTableRowModel. A subclass can override this method to return a different row model object

Overrides:
createDefaultRowModel in class TableView
Returns:
the default row model object
See Also:
DefaultTableRowModel

createDefaultOriginComponent

protected javax.swing.JComponent createDefaultOriginComponent()
Returns the default origin component object, which is a OLAPOriginComponent for an OLAP model. A subclass can override this method to return a different origin component object.

Overrides:
createDefaultOriginComponent in class TableView
Returns:
the default origin component object
See Also:
OLAPOriginComponent

repaintCurrentCell

protected void repaintCurrentCell()
Overrides:
repaintCurrentCell in class TableView

repaintCells

protected void repaintCells(int oldRow,
                            int newRow,
                            int oldColumn,
                            int newColumn)
Overrides:
repaintCells in class TableView

validateCurrentCell

protected void validateCurrentCell()
Overrides:
validateCurrentCell in class TableView

contentsChanged

public void contentsChanged(com.sas.collection.ContentsChangedEvent event)
Invoked when the table receives a ContentsChangeEvent from the action provider.

Application code will not use these methods explicitly, they are used internally by OLAPTableView.

Specified by:
contentsChanged in interface com.sas.collection.ContentsChangedListener
Overrides:
contentsChanged in class TableView
Parameters:
event - the contents changed event

showPopup

public void showPopup(int row,
                      int column)
Displays the popup menu at the bttom right corner of the cell specified.

Overrides:
showPopup in class TableView
Parameters:
row - the row coordinate in the view to display the popup menu for
column - the column coordinate in the view to display the popup menu for

showPopup

public void showPopup(java.awt.Point point)
Displays the popup menu at the given point. The point will be the top-left corner of the popup, or if not enoguh space is available for the popup menu, then the point will be the bottom-left corner of the popup menu.

Overrides:
showPopup in class TableView
Parameters:
point - the location to display the popup menu

configureToolBarActionFilter

protected ActionSupportFilter configureToolBarActionFilter()
Configures the toolbar action filter for the ActionProvider. This is used by the populateToolBar method.

Overrides:
configureToolBarActionFilter in class TableView

configureRowHeaderActionFilter

protected ActionSupportFilter configureRowHeaderActionFilter(int row,
                                                             int column)
Overrides:
configureRowHeaderActionFilter in class TableView

configureColumnHeaderActionFilter

protected ActionSupportFilter configureColumnHeaderActionFilter(int row,
                                                                int column)
Overrides:
configureColumnHeaderActionFilter in class TableView

configureTitleActionFilter

protected ActionSupportFilter configureTitleActionFilter(int row,
                                                         int column)
Overrides:
configureTitleActionFilter in class TableView

configureDataCellActionFilter

protected ActionSupportFilter configureDataCellActionFilter(int row,
                                                            int column)
Overrides:
configureDataCellActionFilter in class TableView

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping to the view coordinate system is performed by this OLAPTableView when it receives the event.

Application code will not use these methods explicitly, they are used internally by OLAPTableView.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Overrides:
tableChanged in class TableView



Copyright © 2009 SAS Institute Inc. All Rights Reserved.