com.google.gwt.widgetideas.table.client
Class FixedWidthFlexTable

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.widgetideas.table.client.overrides.HTMLTable
                  extended by com.google.gwt.widgetideas.table.client.overrides.FlexTable
                      extended by com.google.gwt.widgetideas.table.client.FixedWidthFlexTable
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesTableEvents

public class FixedWidthFlexTable
extends FlexTable

A variation of the FlexTable that supports smarter column resizing options. Unlike the FlexTable, columns resized in the FixedWidthFlexTable class are guaranteed to be resized correctly.


Nested Class Summary
 class FixedWidthFlexTable.FixedWidthFlexCellFormatter
          FlexTable-specific implementation of HTMLTable.CellFormatter.
 class FixedWidthFlexTable.FixedWidthFlexColumnFormatter
          This class contains methods used to format a table's columns.
 class FixedWidthFlexTable.FixedWidthFlexRowFormatter
          This class contains methods used to format a table's rows.
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.overrides.FlexTable
FlexTable.FlexCellFormatter
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatter, HTMLTable.WidgetMapper
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
static int DEFAULT_COLUMN_WIDTH
          The default width of a column in pixels.
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
FixedWidthFlexTable()
          Constructor.
 
Method Summary
protected  void addCells(int row, int num)
          Add cells to the specified row.
 int getColumnCount()
           
 int getColumnWidth(int column)
          Return the column width for a given column index.
protected  int getDOMCellCount(int row)
          Directly ask the underlying DOM what the cell count on the given row is.
protected  int getDOMRowCount()
          Directly ask the underlying DOM what the row count is.
protected  int getGhostColumnCount()
          Returns the current number of ghost columns in existence.
 com.google.gwt.user.client.Element insertCell(int beforeRow, int beforeColumn)
          Inserts a cell into the FlexTable.
 int insertRow(int beforeRow)
          Inserts a row into the FlexTable.
protected  void prepareCell(int row, int column)
          Ensure that the cell exists.
 void removeCell(int row, int column)
          Removes the specified cell from the table.
 void removeRow(int row)
          Removes the specified row from the table.
 void setColumnWidth(int column, int width)
          Set the width of a column.
 
Methods inherited from class com.google.gwt.widgetideas.table.client.overrides.FlexTable
addCell, getCellCount, getColumnIndex, getFlexCellFormatter, getRowCount, prepareRow, removeCells
 
Methods inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
addTableListener, checkCellBounds, checkRowBounds, cleanCell, clear, clearAll, clearCell, createCell, getBodyElement, getCellContainer, getCellContainer, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMRowCount, getEventTargetCell, getEventTargetRow, getHTML, getRowFormatter, getRowIndex, getText, getWidget, getWidgetMap, insertCells, internalClearCell, isCellPresent, iterator, onBrowserEvent, prepareColumn, remove, removeTableListener, setBodyElement, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setClearText, setColumnFormatter, setElement, setHTML, setRowFormatter, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onAttach, onDetach, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_COLUMN_WIDTH

public static final int DEFAULT_COLUMN_WIDTH
The default width of a column in pixels.

See Also:
Constant Field Values
Constructor Detail

FixedWidthFlexTable

public FixedWidthFlexTable()
Constructor.

Method Detail

getColumnCount

public int getColumnCount()
Returns:
the raw number of columns in this table.

getColumnWidth

public int getColumnWidth(int column)
Return the column width for a given column index. If a width has not been assigned, the default width is returned.

Parameters:
column - the column index
Returns:
the column width in pixels

insertCell

public com.google.gwt.user.client.Element insertCell(int beforeRow,
                                                     int beforeColumn)
Description copied from class: FlexTable
Inserts a cell into the FlexTable.

Overrides:
insertCell in class FlexTable
Parameters:
beforeRow - the cell's row
beforeColumn - the cell's column
Returns:
the element
See Also:
FlexTable

insertRow

public int insertRow(int beforeRow)
Description copied from class: FlexTable
Inserts a row into the FlexTable.

Overrides:
insertRow in class FlexTable
Parameters:
beforeRow - the row to insert
Returns:
the index of the newly-created row
See Also:
FlexTable

removeCell

public void removeCell(int row,
                       int column)
Description copied from class: FlexTable
Removes the specified cell from the table.

Overrides:
removeCell in class FlexTable
Parameters:
row - the row of the cell to remove
column - the column of cell to remove
See Also:
FlexTable

removeRow

public void removeRow(int row)
Description copied from class: HTMLTable
Removes the specified row from the table.

Overrides:
removeRow in class FlexTable
Parameters:
row - the index of the row to be removed
See Also:
FlexTable

setColumnWidth

public void setColumnWidth(int column,
                           int width)
Set the width of a column.

Parameters:
column - the index of the column
width - the width in pixels
Throws:
java.lang.IndexOutOfBoundsException

addCells

protected void addCells(int row,
                        int num)
Description copied from class: FlexTable
Add cells to the specified row.

Overrides:
addCells in class FlexTable
Parameters:
row - the row to affect
num - the number of cells to add
See Also:
FlexTable

getDOMCellCount

protected int getDOMCellCount(int row)
Description copied from class: HTMLTable
Directly ask the underlying DOM what the cell count on the given row is.

Overrides:
getDOMCellCount in class HTMLTable
Parameters:
row - the row
Returns:
number of columns in the row
See Also:
HTMLTable

getDOMRowCount

protected int getDOMRowCount()
Description copied from class: HTMLTable
Directly ask the underlying DOM what the row count is.

Overrides:
getDOMRowCount in class HTMLTable
Returns:
Returns the number of rows in the table
See Also:
HTMLTable

getGhostColumnCount

protected int getGhostColumnCount()
Returns the current number of ghost columns in existence.

Returns:
the number of ghost columns

prepareCell

protected void prepareCell(int row,
                           int column)
Description copied from class: FlexTable
Ensure that the cell exists.

Overrides:
prepareCell in class FlexTable
Parameters:
row - the row to prepare.
column - the column to prepare.
See Also:
FlexTable