|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.HTMLTable
public abstract class HTMLTable
HTMLTable contains the common table algorithms for
Grid
and
FlexTable
.
Nested Class Summary | |
---|---|
class |
HTMLTable.CellFormatter
This class contains methods used to format a table's cells. |
class |
HTMLTable.ColumnFormatter
This class contains methods used to format a table's columns. |
class |
HTMLTable.RowFormatter
This class contains methods used to format a table's rows. |
Constructor Summary | |
---|---|
HTMLTable()
Create a new empty HTML Table. |
Method Summary | |
---|---|
void |
addTableListener(TableListener listener)
Adds a listener to the current table. |
protected void |
checkCellBounds(int row,
int column)
Bounds checks that the cell exists at the specified location. |
protected void |
checkRowBounds(int row)
Checks that the row is within the correct bounds. |
void |
clear()
Removes all widgets from this table, but does not remove other HTML or text contents of cells. |
boolean |
clearCell(int row,
int column)
Clears the given row and column. |
protected Element |
createCell()
Creates a new cell. |
protected Element |
getBodyElement()
Gets the table's TBODY element. |
abstract int |
getCellCount(int row)
Gets the number of cells in a given row. |
HTMLTable.CellFormatter |
getCellFormatter()
Gets the HTMLTable.CellFormatter associated with this table. |
int |
getCellPadding()
Gets the amount of padding that is added around all cells. |
int |
getCellSpacing()
Gets the amount of spacing that is added around all cells. |
HTMLTable.ColumnFormatter |
getColumnFormatter()
Gets the column formatter. |
protected int |
getDOMCellCount(Element tableBody,
int row)
Directly ask the underlying DOM what the cell count on the given row is. |
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 |
getDOMRowCount(Element elem)
|
protected Element |
getEventTargetCell(Event event)
Determines the TD associated with the specified event. |
java.lang.String |
getHTML(int row,
int column)
Gets the HTML contents of the specified cell. |
abstract int |
getRowCount()
Gets the number of rows present in this table. |
HTMLTable.RowFormatter |
getRowFormatter()
Gets the RowFormatter associated with this table. |
java.lang.String |
getText(int row,
int column)
Gets the text within the specified cell. |
Widget |
getWidget(int row,
int column)
Gets the widget in the specified cell. |
protected void |
insertCell(int row,
int column)
Inserts a new cell into the specified row. |
protected void |
insertCells(int row,
int column,
int count)
Inserts a number of cells before the specified cell. |
protected int |
insertRow(int beforeRow)
Inserts a new row into the table. |
protected boolean |
internalClearCell(Element td,
boolean clearInnerHTML)
Does actual clearing, used by clearCell and cleanCell. |
boolean |
isCellPresent(int row,
int column)
Determines whether the specified cell exists. |
java.util.Iterator |
iterator()
Returns an iterator containing all the widgets in this table. |
void |
onBrowserEvent(Event event)
Method to process events generated from the browser. |
protected abstract void |
prepareCell(int row,
int column)
Subclasses must implement this method. |
protected void |
prepareColumn(int column)
Subclasses can implement this method. |
protected abstract void |
prepareRow(int row)
Subclasses must implement this method. |
boolean |
remove(Widget widget)
Remove the specified widget from the table. |
protected void |
removeCell(int row,
int column)
Removes the specified cell from the table. |
protected void |
removeRow(int row)
Removes the specified row from the table. |
void |
removeTableListener(TableListener listener)
Removes the specified table listener. |
void |
setBorderWidth(int width)
Sets the width of the table's border. |
protected void |
setCellFormatter(HTMLTable.CellFormatter cellFormatter)
Sets the table's CellFormatter. |
void |
setCellPadding(int padding)
Sets the amount of padding to be added around all cells. |
void |
setCellSpacing(int spacing)
Sets the amount of spacing to be added around all cells. |
protected void |
setColumnFormatter(HTMLTable.ColumnFormatter formatter)
|
void |
setHTML(int row,
int column,
java.lang.String html)
Sets the HTML contents of the specified cell. |
protected void |
setRowFormatter(HTMLTable.RowFormatter rowFormatter)
Sets the table's RowFormatter. |
void |
setText(int row,
int column,
java.lang.String text)
Sets the text within the specified cell. |
void |
setWidget(int row,
int column,
Widget widget)
Sets the widget within the specified cell. |
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, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, 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 |
Constructor Detail |
---|
public HTMLTable()
Method Detail |
---|
public void addTableListener(TableListener listener)
addTableListener
in interface SourcesTableEvents
listener
- listener to addpublic void clear()
clear
in interface HasWidgets
clear
in class Panel
public boolean clearCell(int row, int column)
row
- the widget's columncolumn
- the widget's column
java.lang.IndexOutOfBoundsException
public abstract int getCellCount(int row)
row
- the row whose cells are to be counted
public HTMLTable.CellFormatter getCellFormatter()
HTMLTable.CellFormatter
associated with this table. Use casting to
get subclass-specific functionality
public int getCellPadding()
public int getCellSpacing()
public HTMLTable.ColumnFormatter getColumnFormatter()
public java.lang.String getHTML(int row, int column)
row
- the cell's rowcolumn
- the cell's column
java.lang.IndexOutOfBoundsException
public abstract int getRowCount()
public HTMLTable.RowFormatter getRowFormatter()
public java.lang.String getText(int row, int column)
row
- the cell's rowcolumn
- the cell's column
java.lang.IndexOutOfBoundsException
public Widget getWidget(int row, int column)
row
- the cell's rowcolumn
- the cell's column
null
if none is
present
java.lang.IndexOutOfBoundsException
public boolean isCellPresent(int row, int column)
row
- the cell's rowcolumn
- the cell's column
true
if the specified cell existspublic java.util.Iterator iterator()
iterator
in interface HasWidgets
public void onBrowserEvent(Event event)
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the generated eventpublic boolean remove(Widget widget)
remove
in interface HasWidgets
remove
in class Panel
widget
- widget to remove
public void removeTableListener(TableListener listener)
removeTableListener
in interface SourcesTableEvents
listener
- listener to removepublic void setBorderWidth(int width)
width
- the width of the border, in pixelspublic void setCellPadding(int padding)
padding
- the cell padding, in pixelspublic void setCellSpacing(int spacing)
spacing
- the cell spacing, in pixelspublic void setHTML(int row, int column, java.lang.String html)
row
- the cell's rowcolumn
- the cell's columnhtml
- the cell's HTML contents
java.lang.IndexOutOfBoundsException
public void setText(int row, int column, java.lang.String text)
row
- the cell's rowcolumn
- cell's columntext
- the cell's text contents
java.lang.IndexOutOfBoundsException
public void setWidget(int row, int column, Widget widget)
Inherited implementations may either throw IndexOutOfBounds exception if the cell does not exist, or allocate a new cell to store the content.
FlexTable will automatically allocate the cell at the correct location and then set the widget. Grid will set the widget if and only if the cell is within the Grid's bounding box.
widget
- The widget to be addedrow
- the cell's rowcolumn
- the cell's column
java.lang.IndexOutOfBoundsException
protected void checkCellBounds(int row, int column)
row
- cell's rowcolumn
- cell's column
java.lang.IndexOutOfBoundsException
protected void checkRowBounds(int row)
row
- row index to check
java.lang.IndexOutOfBoundsException
protected Element createCell()
protected Element getBodyElement()
protected int getDOMCellCount(Element tableBody, int row)
tableBody
- the elementrow
- the row
protected int getDOMCellCount(int row)
row
- the row
protected int getDOMRowCount()
protected int getDOMRowCount(Element elem)
protected Element getEventTargetCell(Event event)
event
- the event to be queried
null
if none is
found.protected void insertCell(int row, int column)
row
- the row into which the new cell will be insertedcolumn
- the column before which the cell will be inserted
java.lang.IndexOutOfBoundsException
protected void insertCells(int row, int column, int count)
row
- the row into which the new cells will be insertedcolumn
- the column before which the new cells will be insertedcount
- number of cells to be inserted
java.lang.IndexOutOfBoundsException
protected int insertRow(int beforeRow)
beforeRow
- the index before which the new row will be inserted
java.lang.IndexOutOfBoundsException
protected boolean internalClearCell(Element td, boolean clearInnerHTML)
td
- element to clearclearInnerHTML
- should the cell's inner html be cleared?
protected abstract void prepareCell(int row, int column)
IndexOutOfBoundsException
.
row
- the cell's rowcolumn
- the cell's columnprotected void prepareColumn(int column)
FlexTable
, that do not have a concept of a global column
length can ignore this method.
column
- the cell's column
java.lang.IndexOutOfBoundsException
protected abstract void prepareRow(int row)
IndexOutOfBoundsException
.
row
- the cell's rowprotected void removeCell(int row, int column)
row
- the row of the cell to removecolumn
- the column of cell to remove
java.lang.IndexOutOfBoundsException
protected void removeRow(int row)
row
- the index of the row to be removed
java.lang.IndexOutOfBoundsException
protected void setCellFormatter(HTMLTable.CellFormatter cellFormatter)
cellFormatter
- the table's cell formatterprotected void setColumnFormatter(HTMLTable.ColumnFormatter formatter)
protected void setRowFormatter(HTMLTable.RowFormatter rowFormatter)
rowFormatter
- the table's row formatter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |