Package com.google.gwt.user.client.ui
Class HTMLTable.CellFormatter
java.lang.Object
com.google.gwt.user.client.ui.HTMLTable.CellFormatter
- Direct Known Subclasses:
FlexTable.FlexCellFormatter
- Enclosing class:
HTMLTable
This class contains methods used to format a table's cells.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStyleName
(int row, int column, String styleName) Adds a style to the specified cell.protected Element
ensureElement
(int row, int column) Gets the element associated with a cell.protected String
Convenience methods to get an attribute on a cell.getElement
(int row, int column) Gets the TD element representing the specified cell.getStyleName
(int row, int column) Gets the style of a specified cell.getStylePrimaryName
(int row, int column) Gets the primary style of a specified cell.boolean
isVisible
(int row, int column) Determines whether or not this cell is visible.void
removeStyleName
(int row, int column, String styleName) Removes a style from the specified cell.void
setAlignment
(int row, int column, HasHorizontalAlignment.HorizontalAlignmentConstant hAlign, HasVerticalAlignment.VerticalAlignmentConstant vAlign) Sets the horizontal and vertical alignment of the specified cell's contents.protected void
Convenience methods to set an attribute on a cell.void
Sets the height of the specified cell.void
setHorizontalAlignment
(int row, int column, HasHorizontalAlignment.HorizontalAlignmentConstant align) Sets the horizontal alignment of the specified cell.void
setStyleName
(int row, int column, String styleName) Sets the style name associated with the specified cell.void
setStylePrimaryName
(int row, int column, String styleName) Sets the primary style name associated with the specified cell.void
setVerticalAlignment
(int row, int column, HasVerticalAlignment.VerticalAlignmentConstant align) Sets the vertical alignment of the specified cell.void
setVisible
(int row, int column, boolean visible) Sets whether this cell is visible via the display style property.void
Sets the width of the specified cell.void
setWordWrap
(int row, int column, boolean wrap) Sets whether the specified cell will allow word wrapping of its contents.
-
Constructor Details
-
CellFormatter
public CellFormatter()
-
-
Method Details
-
addStyleName
Adds a style to the specified cell.- Parameters:
row
- the cell's rowcolumn
- the cell's columnstyleName
- the style name to be added- See Also:
-
getElement
Gets the TD element representing the specified cell.- Parameters:
row
- the row of the cell to be retrievedcolumn
- the column of the cell to be retrieved- Returns:
- the column's TD element
- Throws:
IndexOutOfBoundsException
-
getStyleName
Gets the style of a specified cell.- Parameters:
row
- the cell's rowcolumn
- the cell's column- Returns:
- returns the style name
- Throws:
IndexOutOfBoundsException
- See Also:
-
getStylePrimaryName
Gets the primary style of a specified cell.- Parameters:
row
- the cell's rowcolumn
- the cell's column- Returns:
- returns the style name
- Throws:
IndexOutOfBoundsException
- See Also:
-
isVisible
public boolean isVisible(int row, int column) Determines whether or not this cell is visible.- Parameters:
row
- the row of the cell whose visibility is to be setcolumn
- the column of the cell whose visibility is to be set- Returns:
true
if the object is visible
-
removeStyleName
Removes a style from the specified cell.- Parameters:
row
- the cell's rowcolumn
- the cell's columnstyleName
- the style name to be removed- Throws:
IndexOutOfBoundsException
- See Also:
-
setAlignment
public void setAlignment(int row, int column, HasHorizontalAlignment.HorizontalAlignmentConstant hAlign, HasVerticalAlignment.VerticalAlignmentConstant vAlign) Sets the horizontal and vertical alignment of the specified cell's contents.- Parameters:
row
- the row of the cell whose alignment is to be setcolumn
- the column of the cell whose alignment is to be sethAlign
- the cell's new horizontal alignment as specified inHasHorizontalAlignment
vAlign
- the cell's new vertical alignment as specified inHasVerticalAlignment
- Throws:
IndexOutOfBoundsException
-
setHeight
Sets the height of the specified cell.- Parameters:
row
- the row of the cell whose height is to be setcolumn
- the column of the cell whose height is to be setheight
- the cell's new height, in CSS units- Throws:
IndexOutOfBoundsException
-
setHorizontalAlignment
public void setHorizontalAlignment(int row, int column, HasHorizontalAlignment.HorizontalAlignmentConstant align) Sets the horizontal alignment of the specified cell.- Parameters:
row
- the row of the cell whose alignment is to be setcolumn
- the column of the cell whose alignment is to be setalign
- the cell's new horizontal alignment as specified inHasHorizontalAlignment
.- Throws:
IndexOutOfBoundsException
-
setStyleName
Sets the style name associated with the specified cell.- Parameters:
row
- the row of the cell whose style name is to be setcolumn
- the column of the cell whose style name is to be setstyleName
- the new style name- Throws:
IndexOutOfBoundsException
- See Also:
-
setStylePrimaryName
Sets the primary style name associated with the specified cell.- Parameters:
row
- the row of the cell whose style name is to be setcolumn
- the column of the cell whose style name is to be setstyleName
- the new style name- Throws:
IndexOutOfBoundsException
- See Also:
-
setVerticalAlignment
public void setVerticalAlignment(int row, int column, HasVerticalAlignment.VerticalAlignmentConstant align) Sets the vertical alignment of the specified cell.- Parameters:
row
- the row of the cell whose alignment is to be setcolumn
- the column of the cell whose alignment is to be setalign
- the cell's new vertical alignment as specified inHasVerticalAlignment
.- Throws:
IndexOutOfBoundsException
-
setVisible
public void setVisible(int row, int column, boolean visible) Sets whether this cell is visible via the display style property. The other cells in the row will all shift left to fill the cell's space. So, for example a table with (0,1,2) will become (1,2) if cell 1 is hidden.- Parameters:
row
- the row of the cell whose visibility is to be setcolumn
- the column of the cell whose visibility is to be setvisible
-true
to show the cell,false
to hide it
-
setWidth
Sets the width of the specified cell.- Parameters:
row
- the row of the cell whose width is to be setcolumn
- the column of the cell whose width is to be setwidth
- the cell's new width, in CSS units- Throws:
IndexOutOfBoundsException
-
setWordWrap
public void setWordWrap(int row, int column, boolean wrap) Sets whether the specified cell will allow word wrapping of its contents.- Parameters:
row
- the row of the cell whose word-wrap is to be setcolumn
- the column of the cell whose word-wrap is to be setwrap
-false
to disable word wrapping in this cell- Throws:
IndexOutOfBoundsException
-
ensureElement
Gets the element associated with a cell. If it does not exist and the subtype allows creation of elements, creates it.- Parameters:
row
- the cell's rowcolumn
- the cell's column- Returns:
- the cell's element
- Throws:
IndexOutOfBoundsException
-
getAttr
Convenience methods to get an attribute on a cell.- Parameters:
row
- cell's rowcolumn
- cell's columnattr
- attribute to get- Returns:
- the attribute's value
- Throws:
IndexOutOfBoundsException
-
setAttr
Convenience methods to set an attribute on a cell.- Parameters:
row
- cell's rowcolumn
- cell's columnattrName
- attribute to setvalue
- value to set- Throws:
IndexOutOfBoundsException
-