SORTIE Java Interface  1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
sortie.gui.behaviorsetup.EnhancedTable Class Reference

Provides extensions and customizations for JTable. More...

Inheritance diagram for sortie.gui.behaviorsetup.EnhancedTable:

Public Member Functions

 EnhancedTable (Object[][] p_oData, Object[] p_oHeader, EnhancedTableWindow oWindow, int iFirstColumnWidth, int iColumnWidth, int iLabelRows, String sTitle)
 Constructor. More...
 
 EnhancedTable (Object[][] p_oData, Object[] p_oHeader, EnhancedTableWindow oWindow, String sTitle)
 Constructor. More...
 
String getTitle ()
 Gets the title for this table. More...
 
void setLastTouched (boolean bTouched)
 Sets whether or not this was the last table touched by the user. More...
 
boolean getLastTouched ()
 Gets whether or not this was the last table touched by the user. More...
 
TableData getData ()
 
void actionPerformed (ActionEvent e)
 Responds to our designated action events. More...
 
void focusGained (FocusEvent e)
 Sets this table as the last one focused. More...
 
void focusLost (FocusEvent e)
 This removes focus highlighting. More...
 
int copy ()
 Copies selected data to the clipboard. More...
 
void cut ()
 Cuts selected data. More...
 
void paste ()
 Pastes data to the table. More...
 

Static Public Member Functions

static String getComboValue (String sComboBoxVal)
 Extracts the value from a combo box format string. More...
 

Protected Member Functions

void makeTable (Object[][] p_oData, Object[] p_oHeader)
 Performs all table formatting. More...
 

Private Attributes

Clipboard m_jClipboard
 For clipboard controls. More...
 
String m_sRowString
 For clipboard operations. More...
 
String m_sValue
 For clipboard operations. More...
 
String m_sTitle
 Title. More...
 
StringSelection m_sStringSel
 For clipboard operations. More...
 
boolean m_bLastTouched
 Whether or not this was the last table brought into focus by the user - needed when trying to decipher intent when implementing menu copy/paste commands. More...
 
EnhancedTableWindow m_oWindow
 The parent window. More...
 
int m_iFirstColumnWidth = 200
 Preferred width of the first column (row labels) More...
 
int m_iColumnWidth = 100
 Preferred width of the data columns. More...
 
int m_iLabelRows = 2
 Lines of text allowed in the first column (row labels) More...
 

Detailed Description

Provides extensions and customizations for JTable.

These include copy/paste and cut controls, like Excel, special formatting, and support for drop-down combo boxes for editing cells.

This table assumes that it will not be displayed in a scroll pane. Copyright: Copyright (c) Charles D. Canham 2003 Company: Cary Institute of Ecosystem Studies

Author
Lora E. Murphy
Version
1.0


Edit history:
---------------—
December 8, 2011: Wiped the slate clean for version 7 (LEM)

Constructor & Destructor Documentation

◆ EnhancedTable() [1/2]

sortie.gui.behaviorsetup.EnhancedTable.EnhancedTable ( Object  p_oData[][],
Object []  p_oHeader,
EnhancedTableWindow  oWindow,
int  iFirstColumnWidth,
int  iColumnWidth,
int  iLabelRows,
String  sTitle 
)

Constructor.

This allows more control over table formatting.

Parameters
p_oDataObject[][] Table data.
p_oHeaderObject[] Header data.
oWindowEnhancedTableWindow Parent window.
iFirstColumnWidthint Width of first column (the row labels).
iColumnWidthint Width of all data columns.
iLabelRowsint Number of rows for the first column row labels.
sTitleThe title of the "owning" behavior group

◆ EnhancedTable() [2/2]

sortie.gui.behaviorsetup.EnhancedTable.EnhancedTable ( Object  p_oData[][],
Object []  p_oHeader,
EnhancedTableWindow  oWindow,
String  sTitle 
)

Constructor.

Parameters
p_oDataTable data.
p_oHeaderHeader data.
oWindowParent window.
sTitleThe title of the "owning" behavior group.

Member Function Documentation

◆ actionPerformed()

void sortie.gui.behaviorsetup.EnhancedTable.actionPerformed ( ActionEvent  e)

Responds to our designated action events.

Parameters
eThe event which triggered the action listener.

◆ copy()

int sortie.gui.behaviorsetup.EnhancedTable.copy ( )

Copies selected data to the clipboard.

Selections comprising non-adjacent cells result in invalid selection and then copy action cannot be performed.

I got this code from a now-defunct website, and then modified it a bit.

Returns
-1 if an error occurred.

◆ cut()

void sortie.gui.behaviorsetup.EnhancedTable.cut ( )

Cuts selected data.

The data is copied to the clipboard and then erased from editable cells. Combo boxes are left alone.

◆ focusGained()

void sortie.gui.behaviorsetup.EnhancedTable.focusGained ( FocusEvent  e)

Sets this table as the last one focused.

Parameters
eFocusEvent object. Ignored.

◆ focusLost()

void sortie.gui.behaviorsetup.EnhancedTable.focusLost ( FocusEvent  e)

This removes focus highlighting.

Parameters
eFocusEvent object. Ignored.

◆ getComboValue()

static String sortie.gui.behaviorsetup.EnhancedTable.getComboValue ( String  sComboBoxVal)
static

Extracts the value from a combo box format string.

Parameters
sComboBoxValString in combo box format code.
Returns
The currently selected value.

◆ getData()

TableData sortie.gui.behaviorsetup.EnhancedTable.getData ( )

◆ getLastTouched()

boolean sortie.gui.behaviorsetup.EnhancedTable.getLastTouched ( )

Gets whether or not this was the last table touched by the user.

Returns
Last touched status.

◆ getTitle()

String sortie.gui.behaviorsetup.EnhancedTable.getTitle ( )

Gets the title for this table.

Returns
String Title for this table

◆ makeTable()

void sortie.gui.behaviorsetup.EnhancedTable.makeTable ( Object  p_oData[][],
Object []  p_oHeader 
)
protected

Performs all table formatting.

Parameters
p_oDataObject[][] Table data.
p_oHeaderObject[] Header data.

◆ paste()

void sortie.gui.behaviorsetup.EnhancedTable.paste ( )

Pastes data to the table.

Combo boxes are validated against allowed values. Uneditable cells are left alone. Paste is done by aligning the upper left corner of the clipboard selection with the 1st element in the current selection of the JTable.

I got this from a now-defunct website, and then modified it a bit.

◆ setLastTouched()

void sortie.gui.behaviorsetup.EnhancedTable.setLastTouched ( boolean  bTouched)

Sets whether or not this was the last table touched by the user.

Parameters
bTouchedLast touched status.

Member Data Documentation

◆ m_bLastTouched

boolean sortie.gui.behaviorsetup.EnhancedTable.m_bLastTouched
private

Whether or not this was the last table brought into focus by the user - needed when trying to decipher intent when implementing menu copy/paste commands.

◆ m_iColumnWidth

int sortie.gui.behaviorsetup.EnhancedTable.m_iColumnWidth = 100
private

Preferred width of the data columns.

◆ m_iFirstColumnWidth

int sortie.gui.behaviorsetup.EnhancedTable.m_iFirstColumnWidth = 200
private

Preferred width of the first column (row labels)

◆ m_iLabelRows

int sortie.gui.behaviorsetup.EnhancedTable.m_iLabelRows = 2
private

Lines of text allowed in the first column (row labels)

◆ m_jClipboard

Clipboard sortie.gui.behaviorsetup.EnhancedTable.m_jClipboard
private

For clipboard controls.

◆ m_oWindow

EnhancedTableWindow sortie.gui.behaviorsetup.EnhancedTable.m_oWindow
private

The parent window.

◆ m_sRowString

String sortie.gui.behaviorsetup.EnhancedTable.m_sRowString
private

For clipboard operations.

◆ m_sStringSel

StringSelection sortie.gui.behaviorsetup.EnhancedTable.m_sStringSel
private

For clipboard operations.

◆ m_sTitle

String sortie.gui.behaviorsetup.EnhancedTable.m_sTitle
private

Title.

◆ m_sValue

String sortie.gui.behaviorsetup.EnhancedTable.m_sValue
private

For clipboard operations.


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