package net.xoetrope.html;
import java.awt.ItemSelectable;
import java.awt.event.ItemListener;
import net.xoetrope.awt.XTableRenderer;
import net.xoetrope.xui.XAttributedComponent;
import net.xoetrope.xui.XHashCode;
import net.xoetrope.xui.XModelHolder;
import net.xoetrope.xui.data.XModel;
import net.xoetrope.xui.data.XRowSelector;
import net.xoetrope.xui.style.XStyleComponent;
import netscape.javascript.JSObject;
import org.w3c.dom.html.HTMLAnchorElement;
import org.w3c.dom.html.HTMLTableCellElement;
import org.w3c.dom.html.HTMLTableElement;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLTableCaptionElement;
import org.w3c.dom.html.HTMLTableRowElement;
import org.w3c.dom.html.HTMLTableSectionElement;
/**
* <p>
* Provides a simple read-only tables/grid component.
* </p>
* <p>
* Copyright (c) Xoetrope Ltd., 1998-2004<br>
* License: see license.txt $Revision: 2.7 $
*/
public class XTable extends XHtmlWidget implements XAttributedComponent, XModelHolder, ItemSelectable, XStyleComponent, XHashCode, XRowSelector
{
private XTableRenderer content;
private XModel model;
protected JSObject obj;
protected static int addRow = 0;
protected static int addCol = 0;
protected static int initialRow = 0;
protected static int initialCol = 0;
/**
* Create a new table
*/
public XTable()
{
super();
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
HTMLTableElement table = (HTMLTableElement)htmlDoc.createElement( "TABLE" );
HTMLTableSectionElement body = (HTMLTableSectionElement)htmlDoc.createElement( "TBODY" );
HTMLTableRowElement row = (HTMLTableRowElement)htmlDoc.createElement( "TR" );
HTMLTableCellElement cell = (HTMLTableCellElement)htmlDoc.createElement( "TD" );
table.appendChild( text );
table.appendChild( body );
body.appendChild( row );
body.appendChild( text.cloneNode( true ) );
row.appendChild( text.cloneNode( true ) );
row.appendChild( cell );
row.appendChild( text.cloneNode( true ) );
cell.appendChild( text.cloneNode( true ) );
tableElement = table;
}
public XTable( String id, String[][] elements )
{
super();
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
HTMLTableElement table = (HTMLTableElement)htmlDoc.createElement( "TABLE" );
HTMLTableSectionElement body = (HTMLTableSectionElement)htmlDoc.createElement( "TBODY" );
HTMLTableRowElement row = (HTMLTableRowElement)htmlDoc.createElement( "TR" );
HTMLTableCellElement cell = (HTMLTableCellElement)htmlDoc.createElement( "TD" );
table.appendChild( text );
table.appendChild( body );
table.setId( id );
body.appendChild( row );
body.appendChild( text.cloneNode( true ) );
row.appendChild( text.cloneNode( true ) );
row.appendChild( cell );
row.appendChild( text.cloneNode( true ) );
cell.appendChild( text.cloneNode( true ) );
tableElement = table;
for ( int i = 0; i < elements.length; i++ ) {
for ( int j = 0; j < elements[ i ].length; j++ ) {
setValue( i + 1, j + 1, elements[ i ][ j ] );
if ( ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( i ).getChildNodes().item( j ) ).getId().equals( "" ) ) {
( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( i ).getChildNodes().item( j ) ).setId( "initialColumn"
+ initialCol );
initialCol++;
}
}
if ( ( (HTMLTableRowElement)tableElement.getLastChild().getChildNodes().item( i ) ).getId().equals( "" ) ) {
( (HTMLTableRowElement)tableElement.getLastChild().getChildNodes().item( i ) ).setId( "initialRow" + initialRow );
initialRow++;
}
}
}
public XTable( HTMLTableElement table )
{
super( table );
// Gives a unique ID to each row and column if they don't have one
for ( int i = 0; i < tableElement.getLastChild().getChildNodes().getLength(); i += 2 ) {
if ( ( (HTMLTableRowElement)tableElement.getLastChild().getChildNodes().item( i ) ).getId().equals( "" ) ) {
( (HTMLTableRowElement)tableElement.getLastChild().getChildNodes().item( i ) ).setId( "initialRow" + initialRow );
initialRow++;
}
for ( int j = 1; j < tableElement.getLastChild().getChildNodes().item( i ).getChildNodes().getLength(); j += 2 ) {
if ( ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( i ).getChildNodes().item( j ) ).getId().equals( "" ) ) {
( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( i ).getChildNodes().item( j ) ).setId( "initialColumn"
+ initialCol );
initialCol++;
}
}
}
}
public void resetValues()
{
if ( !tableElement.hasChildNodes() && !tableElement.getLastChild().hasChildNodes() ) {
for ( int i = tableElement.getLastChild().getChildNodes().getLength() - 1; i >= 0; i-- ) {
tableElement.getLastChild().removeChild( tableElement.getLastChild().getChildNodes().item( i ) );
}
}
}
/**
* @return 0 for success, non zero for failure or to require some further
* action
*/
public int setAttribute( String attribName, Object attribValue )
{
tableElement.setAttribute( attribName, (String)attribValue );
return 0;
}
/** @todo merge the setValue methods so as to take an Object in argument */
public void setValue( int row, int column, String value )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).getFirstChild().setNodeValue( value );
}
public void setValue( int row, int column, XButton button )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( button.inputElement );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( text );
}
public void setValue( int row, int column, XCheckbox check )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( check.inputElement );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( text );
}
public void setValue( int row, int column, XRadioButton radio )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( radio.inputElement );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( text );
}
public void setValue( int row, int column, XLabel label )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( label.labelElement );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( text );
}
public void setValue( int row, int column, XPanel panel )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( panel.divElement );
tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ).appendChild( text );
}
public void setLink( int row, int column, String name, String url )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
if ( column > ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
this.insertCell( row, column );
}
Node location = tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 );
HTMLAnchorElement anchor = (HTMLAnchorElement)htmlDoc.createElement( "A" );
Node text = htmlDoc.getBody().getFirstChild().cloneNode( true );
anchor.appendChild( text );
anchor.getFirstChild().setNodeValue( name );
anchor.setHref( url );
location.insertBefore( anchor, location.getFirstChild() );
location.insertBefore( text.cloneNode( true ), anchor );
}
/**
* Get the object in the cell located by the row and column arguments.
*
* @param row
* the index of the row (starting at 1)
* @param column
* the index of the column (starting at 1)
* @return the object in the cell, or the text if there is no object
*/
public Object getValue( int row, int column )
{
Node location = tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 );
if ( location.getChildNodes().item( 1 ) == null ) {
return location.getFirstChild().getNodeValue();
}
else {
return location.getChildNodes().item( 1 );
}
}
public void insertRow( int rowIndex )
{
Node n1 = htmlDoc.createElement( "TR" );
Node n2 = tableElement.getFirstChild().cloneNode( true );
n1.appendChild( n2 );
( (HTMLTableRowElement)n1 ).setId( "InsertedRow" + addRow );
addRow++;
if ( rowIndex <= this.getRowNumber() ) {
tableElement.getLastChild().insertBefore( n1, tableElement.getLastChild().getChildNodes().item( 2 * ( rowIndex - 1 ) ) );
tableElement.getLastChild().insertBefore( n2.cloneNode( true ), tableElement.getLastChild().getChildNodes().item( 2 * rowIndex - 1 ) );
}
else {
tableElement.getLastChild().appendChild( n1 );
tableElement.getLastChild().appendChild( n2.cloneNode( true ) );
}
}
public void insertRow( int rowIndex, int numCol )
{
Node n1 = htmlDoc.createElement( "TR" );
Node n2 = tableElement.getFirstChild().cloneNode( true );
for ( int i = 1; i <= numCol; i++ ) {
Node cell = htmlDoc.createElement( "TD" );
( (HTMLTableCellElement)cell ).setId( "InsertedColumn" + addCol );
addCol++;
cell.appendChild( n2.cloneNode( true ) );
n1.appendChild( n2.cloneNode( true ) );
n1.appendChild( cell );
}
( (HTMLTableRowElement)n1 ).setId( "InsertedRow" + addRow );
addRow++;
if ( rowIndex <= this.getRowNumber() ) {
tableElement.getLastChild().insertBefore( n1, tableElement.getLastChild().getChildNodes().item( 2 * ( rowIndex - 1 ) ) );
tableElement.getLastChild().insertBefore( n2.cloneNode( true ), tableElement.getLastChild().getChildNodes().item( 2 * rowIndex - 1 ) );
}
else {
tableElement.getLastChild().appendChild( n1 );
tableElement.getLastChild().appendChild( n2.cloneNode( true ) );
}
n1.appendChild( n2.cloneNode( true ) );
}
public void insertCell( int row, int column )
{
if ( row > this.getRowNumber() ) {
this.insertRow( row );
}
Node n1 = tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) );
Node n2 = tableElement.getFirstChild().cloneNode( true );
Node cell = htmlDoc.createElement( "TD" );
( (HTMLTableCellElement)cell ).setId( "InsertedColumn" + addCol );
addCol++;
cell.appendChild( n2 );
if ( column <= ( tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().getLength() / 2 ) ) {
n1.insertBefore( cell, this.getCell( row, column ) );
n1.insertBefore( n2.cloneNode( true ), this.getCell( row, column ) );
}
else {
n1.appendChild( cell );
n1.appendChild( n2.cloneNode( true ) );
}
}
public void deleteRow( int rowIndex )
{
if ( 0 < rowIndex && rowIndex <= tableElement.getRows().getLength() ) {
tableElement.deleteRow( rowIndex - 1 );
tableElement.getLastChild().removeChild( tableElement.getLastChild().getChildNodes().item( rowIndex ) );
}
}
public void insertColumn( int columnIndex )
{
Node tBodyNode = tableElement.getLastChild();
HTMLTableCellElement cell;
Node text = tableElement.getFirstChild().cloneNode( true );
for ( int i = 0; i < tBodyNode.getChildNodes().getLength(); i += 2 ) {
cell = (HTMLTableCellElement)htmlDoc.createElement( "TD" );
cell.appendChild( text.cloneNode( true ) );
cell.setId( "insertedColumn" + addCol );
addCol++;
if ( columnIndex <= ( tBodyNode.getChildNodes().item( 0 ).getChildNodes().getLength() ) / 2 ) {
tBodyNode.getChildNodes().item( i ).insertBefore( text, tBodyNode.getChildNodes().item( i ).getChildNodes().item( 2 * columnIndex - 1 ) );
tBodyNode.getChildNodes().item( i ).insertBefore( cell, tBodyNode.getChildNodes().item( i ).getChildNodes().item( 2 * columnIndex - 1 ) );
}
else {
tBodyNode.getChildNodes().item( i ).appendChild( cell );
tBodyNode.getChildNodes().item( i ).appendChild( text );
}
}
}
public void deleteColumn( int columnIndex )
{
Node tBodyNode = tableElement.getLastChild();
if ( columnIndex <= ( tBodyNode.getChildNodes().item( 0 ).getChildNodes().getLength() ) / 2 ) {
for ( int i = 0; i < tBodyNode.getChildNodes().getLength(); i += 2 ) {
tBodyNode.getChildNodes().item( i ).removeChild( tBodyNode.getChildNodes().item( i ).getChildNodes().item( columnIndex + 1 ) );
tBodyNode.getChildNodes().item( i ).removeChild( tBodyNode.getChildNodes().item( i ).getChildNodes().item( columnIndex + 1 ) );
}
}
}
public void setAlign( String align )
{
tableElement.setAlign( align );
}
public String getAlign()
{
return tableElement.getAlign();
}
public void setBgColor( String bgColor )
{
tableElement.setBgColor( bgColor );
}
public String getBgColor()
{
return tableElement.getBgColor();
}
public void setBorder( int pixel )
{
tableElement.setBorder( "" + pixel );
}
public String getBorder()
{
return tableElement.getBorder();
}
public void setCellPadding( int cellPadding )
{
tableElement.setCellPadding( "" + cellPadding );
}
public String getCellPadding()
{
return tableElement.getCellPadding();
}
public void setCellSpacing( int cellSpacing )
{
tableElement.setCellSpacing( "" + cellSpacing );
}
public String getCellSpacing()
{
return tableElement.getCellSpacing();
}
public void setFrame( String frame )
{
tableElement.setFrame( frame );
}
public String getFrame()
{
return tableElement.getFrame();
}
public void setRules( String rules )
{
tableElement.setRules( rules );
}
public String getRules()
{
return tableElement.getRules();
}
public void setWidth( int width )
{
tableElement.setWidth( "" + width );
}
public String getWidth()
{
return tableElement.getWidth();
}
public HTMLTableCaptionElement getCaption()
{
return tableElement.getCaption();
}
public void setCaption( HTMLTableCaptionElement captionElement )
{
tableElement.setCaption( captionElement );
}
public HTMLCollection getRows()
{
return tableElement.getRows();
}
public HTMLCollection getTBodies()
{
return tableElement.getTBodies();
}
public void setTFoot( HTMLTableSectionElement tFoot )
{
tableElement.setTFoot( tFoot );
}
public void setTHead( HTMLTableSectionElement tHead )
{
tableElement.setTHead( tHead );
}
public HTMLTableSectionElement getTFoot()
{
return tableElement.getTFoot();
}
public HTMLTableSectionElement getTHead()
{
return tableElement.getTHead();
}
public HTMLElement createTFoot()
{
return tableElement.createTFoot();
}
public void deleteTFoot()
{
tableElement.deleteTFoot();
}
public HTMLElement createCaption()
{
return tableElement.createCaption();
}
public void deleteCaption()
{
tableElement.deleteCaption();
}
public HTMLElement createTHead()
{
return tableElement.createTHead();
}
public void deleteTHead()
{
tableElement.deleteTHead();
}
public int getFontSize()
{
obj = JSObject.getWindow( XApplet.getApplet() );
return Integer.parseInt( (String)obj.eval( "document.all." + tableElement.getId() + ".style.fontSize" ) );
}
public void setFontSize( int fontsize )
{
obj = JSObject.getWindow( XApplet.getApplet() );
obj.eval( "document.all." + tableElement.getId() + ".style.fontSize = \"" + fontsize + "\"" );
}
public String getBackgroundColor()
{
obj = JSObject.getWindow( XApplet.getApplet() );
return (String)obj.eval( "document.all." + tableElement.getId() + ".style.background" );
}
public void setBackgroundColor( String hexColor )
{
obj = JSObject.getWindow( XApplet.getApplet() );
obj.eval( "document.all." + tableElement.getId() + ".style.background = \"" + hexColor + "\"" );
}
public String getFontColor()
{
obj = JSObject.getWindow( XApplet.getApplet() );
return (String)obj.eval( "document.all." + tableElement.getId() + ".style.color" );
}
public void setFontColor( String hexColor )
{
obj = JSObject.getWindow( XApplet.getApplet() );
obj.eval( "document.all." + tableElement.getId() + ".style.color = \"" + hexColor + "\"" );
}
/**
* @todo change the elements argument to an Object[] as soon as the setValue
* method takes an Object[] in argument.
*/
public void insertRow( int index, String[] elements )
{
Node text = tableElement.getFirstChild().cloneNode( true );
insertRow( index, elements.length );
Node currentRow = tableElement.getLastChild().getChildNodes().item( 2 * ( index - 1 ) );
currentRow.appendChild( text );
( (HTMLTableRowElement)currentRow ).setId( "insertedRow" + addRow );
addRow++;
for ( int i = 0; i < elements.length; i++ ) {
setValue( index, i + 1, elements[ i ] );
}
}
/**
* @todo change the elements argument to an Object[] as soon as the setValue
* method takes an Object[] in argument.
*/
public void fillRow( int rowIndex, String[] elements )
{
if ( rowIndex <= tableElement.getRows().getLength() ) {
for ( int i = 0; i < elements.length; i++ ) {
setValue( rowIndex, i + 1, elements[ i ] );
}
}
else {
insertRow( rowIndex, elements );
}
}
public int getColumnNumber()
{
if ( tableElement.getLastChild().getFirstChild().getChildNodes().getLength() == 0 ) {
return 0;
}
else {
return ( tableElement.getLastChild().getFirstChild().getChildNodes().getLength() / 2 );
}
}
public int getRowNumber()
{
return tableElement.getRows().getLength();
}
public String getBackgroundColorAt( int row, int column )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String colId = ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ) )
.getId();
return (String)obj.eval( "document.all." + colId + ".style.background" );
}
public String getFontColorAt( int row, int column )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String colId = ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ) )
.getId();
return (String)obj.eval( "document.all." + colId + ".style.color" );
}
public void setBackgroundColorAt( int row, int column, String hexColor )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String colId = ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ) )
.getId();
obj.eval( "document.all." + colId + ".style.background = \"" + hexColor + "\"" );
}
public void setFontColorAt( int row, int column, String hexColor )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String colId = ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ) )
.getId();
obj.eval( "document.all." + colId + ".style.color = \"" + hexColor + "\"" );
}
public void setBoldAt( int row, int column )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String colId = ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ) )
.getId();
obj.eval( "document.all." + colId + ".style.fontWeight = \"bold\"" );
}
public void unsetBoldAt( int row, int column )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String colId = ( (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 ) )
.getId();
obj.eval( "document.all." + colId + ".style.fontWeight = \"\"" );
}
public HTMLTableCellElement getCell( int row, int column )
{
return (HTMLTableCellElement)tableElement.getLastChild().getChildNodes().item( 2 * ( row - 1 ) ).getChildNodes().item( 2 * column - 1 );
}
public void setVisible( boolean visible )
{
obj = JSObject.getWindow( XApplet.getApplet() );
String status = "";
if ( !visible ) {
status = "hidden";
}
else {
status = "visible";
}
obj.eval( "document.all." + tableElement.getId() + ".style.visibility = \"" + status + "\"" );
}
public HTMLTableElement getHTMLElement()
{
return tableElement;
}
/*
* ============================================================================== |
* Abstract methods from the interfaces implemented |
* =============================================================================
*/
/**
* Set the XModel which we will be generating the table from
*
* @param xmodel
* The XModel of data
*/
public void setModel( XModel xmodel )
{
model = xmodel;
if ( model != null )
model.get();
content.setContent( xmodel );
}
/**
* implemented from XModelHolder interface
*/
public void update()
{
}
/**
* Returns the selected items on the list in an array of objects.
*
* @see ItemSelectable
* @return an array of the selected components
*/
public Object[] getSelectedObjects()
{
return content.getSelectedObjects();
}
/**
* Adds the specified item listener to receive item events from this list.
* Item events are sent in response to user input, but not in response to
* calls to <code>select</code> or <code>deselect</code>. If listener
* <code>l</code> is <code>null</code>, no exception is thrown and no
* action is performed.
*
* @param l
* the item listener
* @see #removeItemListener( ItemListener )
* @see java.awt.event.ItemEvent
* @see java.awt.event.ItemListener
* @since JDK1.1
*/
public void addItemListener( ItemListener l )
{
content.addItemListener( l );
}
/**
* Removes the specified item listener so that it no longer receives item
* events from this list. If listener <code>l</code> is <code>null</code>,
* no exception is thrown and no action is performed.
*
* @param l
* the item listener
* @see #addItemListener
* @see java.awt.event.ItemEvent
* @see java.awt.event.ItemListener
* @since JDK1.1
*/
public void removeItemListener( ItemListener l )
{
content.removeItemListener( l );
}
/**
* Set the general style of the XTable
*
* @param style
* XStyle
*/
public void setStyle( String style )
{
content.setStyle( style );
}
/**
* Get the hash code to be used by the event handler for this component
*
* @return the hash code
*/
public long getComponentHashCode()
{
return content.hashCode();
}
/**
* Sets the index of the selected row
*
* @param idx
* the new selected row
*/
public void setSelectedRow( int rowIdx )
{
content.setSelectedRow( rowIdx );
}
/**
* Get the index of the selected row
*
* @return the index of the selected row
*/
public int getSelectedRow()
{
return content.getSelectedRow();
}
}