public abstract class HTMLTable extends Panel implements SourcesTableEvents, HasAllDragAndDropHandlers, HasClickHandlers, HasDoubleClickHandlers
Modifier and Type | Class and Description |
---|---|
class |
HTMLTable.Cell
Return value for
getCellForEvent(com.google.gwt.event.dom.client.ClickEvent) . |
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.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
HTMLTable()
Create a new empty HTML Table.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addClickHandler(ClickHandler handler)
Adds a
ClickEvent handler. |
HandlerRegistration |
addDoubleClickHandler(DoubleClickHandler handler)
Adds a
DoubleClickEvent handler. |
HandlerRegistration |
addDragEndHandler(DragEndHandler handler)
Adds a
DragEndEvent handler. |
HandlerRegistration |
addDragEnterHandler(DragEnterHandler handler)
Adds a
DragEnterEvent handler. |
HandlerRegistration |
addDragHandler(DragHandler handler)
Adds a
DragEvent handler. |
HandlerRegistration |
addDragLeaveHandler(DragLeaveHandler handler)
Adds a
DragLeaveEvent handler. |
HandlerRegistration |
addDragOverHandler(DragOverHandler handler)
Adds a
DragOverEvent handler. |
HandlerRegistration |
addDragStartHandler(DragStartHandler handler)
Adds a
DragStartEvent handler. |
HandlerRegistration |
addDropHandler(DropHandler handler)
Adds a
DropEvent handler. |
void |
addTableListener(TableListener listener)
Deprecated.
add a click handler instead and use
getCellForEvent(ClickEvent) to get the cell
information (remember to check for a null return value) |
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.
|
void |
clear(boolean clearInnerHTML)
Removes all widgets from this table, optionally clearing the inner HTML of
each cell.
|
boolean |
clearCell(int row,
int column)
Clears the cell at 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.Cell |
getCellForEvent(ClickEvent event)
Given a click event, return the Cell that was clicked, or null if the event
did not hit this table.
|
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(Element tableBody,
int row)
Deprecated.
Call and override
getDOMCellCount(Element, int) instead. |
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 tbody) |
protected int |
getDOMRowCount(Element tbody)
Deprecated.
Call and override
getDOMRowCount(Element) instead. |
protected Element |
getEventTargetCell(Event event)
Determines the TD associated with the specified event.
|
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.
|
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.
|
protected boolean |
internalClearCell(Element td,
boolean clearInnerHTML)
Deprecated.
Call and override
internalClearCell(Element, boolean) instead. |
boolean |
isCellPresent(int row,
int column)
Determines whether the specified cell exists.
|
Iterator<Widget> |
iterator()
Returns an iterator containing all the widgets in this table.
|
protected void |
onEnsureDebugId(String baseID)
Affected Elements:
-(row)#-(cell)# = the cell at the given row and cell index.
|
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)
Deprecated.
Use the
HandlerRegistration.removeHandler()
method on the object returned by an add*Handler method instead |
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,
SafeHtml html)
Sets the HTML contents of the specified cell.
|
void |
setHTML(int row,
int column,
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,
String text)
Sets the text within the specified cell.
|
void |
setWidget(int row,
int column,
IsWidget widget)
Overloaded version for IsWidget.
|
void |
setWidget(int row,
int column,
Widget widget)
Sets the widget within the specified cell.
|
add, add, adopt, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
fireEvent
public HandlerRegistration addClickHandler(ClickHandler handler)
HasClickHandlers
ClickEvent
handler.addClickHandler
in interface HasClickHandlers
handler
- the click handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
HasDoubleClickHandlers
DoubleClickEvent
handler.addDoubleClickHandler
in interface HasDoubleClickHandlers
handler
- the double click handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragEndHandler(DragEndHandler handler)
HasDragEndHandlers
DragEndEvent
handler.addDragEndHandler
in interface HasDragEndHandlers
handler
- the drag end handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
HasDragEnterHandlers
DragEnterEvent
handler.addDragEnterHandler
in interface HasDragEnterHandlers
handler
- the drag end handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragHandler(DragHandler handler)
HasDragHandlers
DragEvent
handler.addDragHandler
in interface HasDragHandlers
handler
- the drag handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
HasDragLeaveHandlers
DragLeaveEvent
handler.addDragLeaveHandler
in interface HasDragLeaveHandlers
handler
- the drag leave handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragOverHandler(DragOverHandler handler)
HasDragOverHandlers
DragOverEvent
handler.addDragOverHandler
in interface HasDragOverHandlers
handler
- the drag over handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragStartHandler(DragStartHandler handler)
HasDragStartHandlers
DragStartEvent
handler.addDragStartHandler
in interface HasDragStartHandlers
handler
- the drag start handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDropHandler(DropHandler handler)
HasDropHandlers
DropEvent
handler.addDropHandler
in interface HasDropHandlers
handler
- the drop handlerHandlerRegistration
used to remove this handler@Deprecated public void addTableListener(TableListener listener)
getCellForEvent(ClickEvent)
to get the cell
information (remember to check for a null return value)addTableListener
in interface SourcesTableEvents
listener
- listener to addpublic void clear()
clear
in interface HasWidgets
clear
in class Panel
public void clear(boolean clearInnerHTML)
clearInnerHTML
- should the cell's inner html be cleared?public boolean clearCell(int row, int column)
row
- the widget's rowcolumn
- the widget's columnIndexOutOfBoundsException
public abstract int getCellCount(int row)
row
- the row whose cells are to be countedpublic HTMLTable.Cell getCellForEvent(ClickEvent event)
event
- A click event of indeterminate originpublic HTMLTable.CellFormatter getCellFormatter()
HTMLTable.CellFormatter
associated with this table. Use casting to
get subclass-specific functionalitypublic int getCellPadding()
public int getCellSpacing()
public HTMLTable.ColumnFormatter getColumnFormatter()
public String getHTML(int row, int column)
row
- the cell's rowcolumn
- the cell's columnIndexOutOfBoundsException
public abstract int getRowCount()
public HTMLTable.RowFormatter getRowFormatter()
public String getText(int row, int column)
row
- the cell's rowcolumn
- the cell's columnIndexOutOfBoundsException
public Widget getWidget(int row, int column)
row
- the cell's rowcolumn
- the cell's columnnull
if none is
presentIndexOutOfBoundsException
public boolean isCellPresent(int row, int column)
row
- the cell's rowcolumn
- the cell's columntrue
if the specified cell existspublic Iterator<Widget> iterator()
iterator
in interface HasWidgets
iterator
in interface Iterable<Widget>
public boolean remove(Widget widget)
remove
in interface HasWidgets
remove
in class Panel
widget
- widget to remove@Deprecated public void removeTableListener(TableListener listener)
HandlerRegistration.removeHandler()
method on the object returned by an add*Handler method insteadremoveTableListener
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, String html)
row
- the cell's rowcolumn
- the cell's columnhtml
- the cell's HTML contentsIndexOutOfBoundsException
public void setHTML(int row, int column, SafeHtml html)
row
- the cell's rowcolumn
- the cell's columnhtml
- the cell's safe html contentsIndexOutOfBoundsException
public void setText(int row, int column, String text)
row
- the cell's rowcolumn
- cell's columntext
- the cell's text contentsIndexOutOfBoundsException
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 added, or null to clear the cellrow
- the cell's rowcolumn
- the cell's columnIndexOutOfBoundsException
public void setWidget(int row, int column, IsWidget widget)
setWidget(int,int,Widget)
protected void checkCellBounds(int row, int column)
row
- cell's rowcolumn
- cell's columnIndexOutOfBoundsException
protected void checkRowBounds(int row)
row
- row index to checkIndexOutOfBoundsException
protected Element createCell()
protected Element getBodyElement()
protected int getDOMCellCount(Element tableBody, int row)
tableBody
- the elementrow
- the row@Deprecated protected int getDOMCellCount(Element tableBody, int row)
getDOMCellCount(Element, int)
instead.protected int getDOMCellCount(int row)
row
- the rowprotected int getDOMRowCount()
protected int getDOMRowCount(Element tbody)
@Deprecated protected int getDOMRowCount(Element tbody)
getDOMRowCount(Element)
instead.protected Element getEventTargetCell(Event event)
event
- the event to be queriednull
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 insertedIndexOutOfBoundsException
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 insertedIndexOutOfBoundsException
protected int insertRow(int beforeRow)
beforeRow
- the index before which the new row will be insertedIndexOutOfBoundsException
protected boolean internalClearCell(Element td, boolean clearInnerHTML)
td
- element to clearclearInnerHTML
- should the cell's inner html be cleared?@Deprecated protected boolean internalClearCell(Element td, boolean clearInnerHTML)
internalClearCell(Element, boolean)
instead.protected void onEnsureDebugId(String baseID)
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
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 columnIndexOutOfBoundsException
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 removeIndexOutOfBoundsException
protected void removeRow(int row)
row
- the index of the row to be removedIndexOutOfBoundsException
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 formatterCopyright © 2018. All rights reserved.