casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
casa::TBViewArray Class Reference

Widget for viewing array data in TBArray format. More...

#include <TBViewArray.qo.h>

List of all members.

Public Member Functions

 TBViewArray (TBTableTabs *tt, String first, String second, TBArrayData *arr, int row, int col, bool editable)
 Constructor which takes the table parent, the "indices" where this array is located, the array to view, the location in the table (if applicable, and whether this array should be editable or not.
 ~TBViewArray ()
TBArrayDatagetArrayData ()
 Returns the array that is being displayed.
void setShouldRelease (bool b)
 Sets whether the arrays being viewed should release their data when closed or not.
TBDatadataAt (vector< int > d)
 Returns the data at the given coordinates, or NULL if the coordinates are invalid.
void setDataAt (vector< int > d, TBData &newVal, bool format=true)
 Sets the data at the given coordinates to the given value WITHOUT updating the table backend.
void applyFormat (TBFormat *f)
 Applies the given format to the array cells.
void clearFormat (QFontColor *f)
 Clears the current format from the array cells and applies the given QFontColor (which should be the default table cell font and color).

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event)
 Catches the right-click event to allow for copying.

Private Slots

void dataChanged (int row, int col)
 Slot for when the user changes data in the array.
void sliceChanged (vector< int > newSlice)
 Slot for when the slicer changes (for arrays with dimensionality greater than two).
void cellClicked (int row, int col)
 Slot for when an array cell is clicked.
void cellDoubleClicked (int row, int col)
 Slot for when an array cell is double-clicked.
void copyData ()
 Slot for copying the currently selected text into the system clipboard.

Private Member Functions

void setup (String first, String second)
 Sets up the GUI components with the given parameters for the label.
vector< int > currentCell (int row, int col)
 Returns the array-relevant coordinates corresponding to the given indices.
void relabelHeaders ()
 Relabels the table headers to be 0- rather than 1-based.

Private Attributes

TBTableTabstTabs
 Table backend.
TBTablet
TBArrayDataarray
 Array being displayed.
bool update
 Flag to indicate whether GUI-generated events are "genuine.".
TBSlicerslicer
 Slicer for arrays with dimensionality greater than two.
vector< int > currentSlice
 Current slice for arrays with dimensionality greater than two.
bool editable
 Indicates whether this array is allowed to be edited.
QBrush unselectedBackground
 Background for unselected cells.
QBrush selectedBackground
 Background for selected cells.
vector< QTableWidgetItem * > selectedCells
 List of cells that are on the same row or column as the currently selected cell.
TBFormatformat
 Current format.
bool shouldRelease
 Indicates whether the underlying array data should be released when the view is closed or not.
int row
 Row of data array.
int col
 Column of data array.

Detailed Description

Widget for viewing array data in TBArray format.

Synopsis

A TBViewArray displays potentially multi-dimensional array data in a QTableWidget. If the array has dimensionality greater than two, a TBSlicer is used to control the array slice.

Definition at line 67 of file TBViewArray.qo.h.


Constructor & Destructor Documentation

casa::TBViewArray::TBViewArray ( TBTableTabs tt,
String  first,
String  second,
TBArrayData arr,
int  row,
int  col,
bool  editable 
)

Constructor which takes the table parent, the "indices" where this array is located, the array to view, the location in the table (if applicable, and whether this array should be editable or not.

The top of the array view will have a label that says "[table name][first, second] = [type] array of size [size]." For keyword arrays, row and col are irrelevant and editable should be false.


Member Function Documentation

Applies the given format to the array cells.

void casa::TBViewArray::cellClicked ( int  row,
int  col 
) [private, slot]

Slot for when an array cell is clicked.

Updates cells in the same row or column with a "selected" background.

void casa::TBViewArray::cellDoubleClicked ( int  row,
int  col 
) [private, slot]

Slot for when an array cell is double-clicked.

If the array is editable and the table is currently in editing mode, the user is then allowed to edit the cell data.

Clears the current format from the array cells and applies the given QFontColor (which should be the default table cell font and color).

void casa::TBViewArray::contextMenuEvent ( QContextMenuEvent *  event) [protected]

Catches the right-click event to allow for copying.

void casa::TBViewArray::copyData ( ) [private, slot]

Slot for copying the currently selected text into the system clipboard.

vector<int> casa::TBViewArray::currentCell ( int  row,
int  col 
) [private]

Returns the array-relevant coordinates corresponding to the given indices.

TBData* casa::TBViewArray::dataAt ( vector< int >  d)

Returns the data at the given coordinates, or NULL if the coordinates are invalid.

  
void casa::TBViewArray::dataChanged ( int  row,
int  col 
) [private, slot]

Slot for when the user changes data in the array.

If the edit is valid, a TBEditArrayDataAction is generated and sent to the browser for execution.

Returns the array that is being displayed.

Relabels the table headers to be 0- rather than 1-based.

void casa::TBViewArray::setDataAt ( vector< int >  d,
TBData newVal,
bool  format = true 
)

Sets the data at the given coordinates to the given value WITHOUT updating the table backend.

If format is true, then any current format is applied to the new value.

Sets whether the arrays being viewed should release their data when closed or not.

void casa::TBViewArray::setup ( String  first,
String  second 
) [private]

Sets up the GUI components with the given parameters for the label.

void casa::TBViewArray::sliceChanged ( vector< int >  newSlice) [private, slot]

Slot for when the slicer changes (for arrays with dimensionality greater than two).


Member Data Documentation

Array being displayed.

  

Definition at line 119 of file TBViewArray.qo.h.

int casa::TBViewArray::col [private]

Column of data array.

Definition at line 155 of file TBViewArray.qo.h.

vector<int> casa::TBViewArray::currentSlice [private]

Current slice for arrays with dimensionality greater than two.

Definition at line 128 of file TBViewArray.qo.h.

Indicates whether this array is allowed to be edited.

Data arrays should be true while keyword arrays should be false.

Definition at line 132 of file TBViewArray.qo.h.

Current format.

Definition at line 145 of file TBViewArray.qo.h.

int casa::TBViewArray::row [private]

Row of data array.

Definition at line 152 of file TBViewArray.qo.h.

Background for selected cells.

Definition at line 138 of file TBViewArray.qo.h.

vector<QTableWidgetItem*> casa::TBViewArray::selectedCells [private]

List of cells that are on the same row or column as the currently selected cell.

Definition at line 142 of file TBViewArray.qo.h.

Indicates whether the underlying array data should be released when the view is closed or not.

Definition at line 149 of file TBViewArray.qo.h.

Slicer for arrays with dimensionality greater than two.

Definition at line 125 of file TBViewArray.qo.h.

Definition at line 115 of file TBViewArray.qo.h.

Table backend.

Definition at line 114 of file TBViewArray.qo.h.

Background for unselected cells.

Definition at line 135 of file TBViewArray.qo.h.

bool casa::TBViewArray::update [private]

Flag to indicate whether GUI-generated events are "genuine.".

Definition at line 122 of file TBViewArray.qo.h.


The documentation for this class was generated from the following file: