javawrapper.EnhancedTable Class Reference

Provides extensions and customizations for JTable. More...

Inherits javax::swing::JTable, and java::awt::event::ActionListener.

List of all members.

Public Member Functions

String GetTitle ()
 Gets the title for this table.
void SetLastTouched (boolean bTouched)
 Sets whether or not this was the last table touched by the user.
boolean GetLastTouched ()
 Gets whether or not this was the last table touched by the user.
void actionPerformed (ActionEvent e)
 Responds to our designated action events.
void focusGained (FocusEvent e)
 Sets this table as the last one focused.
void focusLost (FocusEvent e)
 This removes focus highlighting.
int Copy ()
 Copies selected data to the clipboard.
void Cut ()
 Cuts selected data.
void Paste ()
 Pastes data to the table.

Protected Member Functions

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

Package Functions

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

Static Package Functions

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

Static Package Attributes

static final long serialVersionUID = 1

Private Attributes

Clipboard m_jClipboard
 For clipboard controls.
String m_sRowString
 For clipboard operations.
String m_sValue
 For clipboard operations.
String m_sTitle
 Title.
StringSelection m_sStringSel
 For clipboard operations.
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.
EnhancedTableWindow m_oWindow
 The parent window.
int m_iFirstColumnWidth = 200
 Preferred width of the first column (row labels).
int m_iColumnWidth = 100
 Preferred width of the data columns.
int m_iLabelRows = 2
 Lines of text allowed in the first column (row labels).


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: Institute of Ecosystem Studies

Author:
Lora E. Murphy
Version:
1.0

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)
February 28, 2008: Updated to improve display of combo boxes (LEM)
November 3, 2010: Added support to paste enum values (LEM)

Constructor & Destructor Documentation

javawrapper.EnhancedTable.EnhancedTable ( Object  p_oData[][],
Object[]  p_oHeader,
EnhancedTableWindow  oWindow,
int  iFirstColumnWidth,
int  iColumnWidth,
int  iLabelRows,
String  sTitle 
) [package]

Constructor.

This allows more control over table formatting.

Parameters:
p_oData Object[][] Table data.
p_oHeader Object[] Header data.
oWindow EnhancedTableWindow Parent window.
iFirstColumnWidth int Width of first column (the row labels).
iColumnWidth int Width of all data columns.
iLabelRows int Number of rows for the first column row labels.
sTitle The title of the "owning" behavior group

javawrapper.EnhancedTable.EnhancedTable ( Object  p_oData[][],
Object[]  p_oHeader,
EnhancedTableWindow  oWindow,
String  sTitle 
) [package]

Constructor.

Parameters:
p_oData Table data.
p_oHeader Header data.
oWindow Parent window.
sTitle The title of the "owning" behavior group.


Member Function Documentation

String javawrapper.EnhancedTable.GetTitle (  ) 

Gets the title for this table.

Returns:
String Title for this table

void javawrapper.EnhancedTable.MakeTable ( Object  p_oData[][],
Object[]  p_oHeader 
) [protected]

Performs all table formatting.

Parameters:
p_oData Object[][] Table data.
p_oHeader Object[] Header data.

void javawrapper.EnhancedTable.SetLastTouched ( boolean  bTouched  ) 

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

Parameters:
bTouched Last touched status.

boolean javawrapper.EnhancedTable.GetLastTouched (  ) 

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

Returns:
Last touched status.

void javawrapper.EnhancedTable.actionPerformed ( ActionEvent  e  ) 

Responds to our designated action events.

Parameters:
e The event which triggered the action listener.

void javawrapper.EnhancedTable.focusGained ( FocusEvent  e  ) 

Sets this table as the last one focused.

Parameters:
e FocusEvent object. Ignored.

void javawrapper.EnhancedTable.focusLost ( FocusEvent  e  ) 

This removes focus highlighting.

Parameters:
e FocusEvent object. Ignored.

int javawrapper.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 from http://www.javaworld.com/javaworld/javatips/jw-javatip77.html, and then modified it a bit.

Returns:
-1 if an error occurred.

void javawrapper.EnhancedTable.Cut (  ) 

Cuts selected data.

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

void javawrapper.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 http://www.javaworld.com/javaworld/javatips/jw-javatip77.html, and then modified it a bit.

static String javawrapper.EnhancedTable.GetComboValue ( String  sComboBoxVal  )  [static, package]

Extracts the value from a combo box format string.

Parameters:
sComboBoxVal String in combo box format code.
Returns:
The currently selected value.


Member Data Documentation

final long javawrapper.EnhancedTable.serialVersionUID = 1 [static, package]

For clipboard controls.

For clipboard operations.

For clipboard operations.

Title.

StringSelection javawrapper.EnhancedTable.m_sStringSel [private]

For clipboard operations.

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.

The parent window.

Preferred width of the first column (row labels).

Preferred width of the data columns.

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


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

Generated on Tue Apr 19 13:59:39 2011 for SORTIE Java Interface by  doxygen 1.5.6