API Reference 0.3.24dart_web_toolkit_uiFlexCellFormatter

FlexCellFormatter class

FlexTable-specific implementation of {@link HTMLTable.CellFormatter}. The formatter retrieved from {@link HTMLTable#getCellFormatter()} may be cast to this class.

class FlexCellFormatter extends CellFormatter {

 FlexCellFormatter(HtmlTable table) : super(table);

 /**
  * Gets the column span for the given cell. This is the number of logical
  * columns covered by the cell.
  *
  * @param row the cell's row
  * @param column the cell's column
  * @return the cell's column span
  * @throws IndexOutOfBoundsException
  */
 int getColSpan(int row, int column) {
   return Dom.getElementPropertyInt(getElement(row, column), "colSpan");
 }

 /**
  * Gets the row span for the given cell. This is the number of logical rows
  * covered by the cell.
  *
  * @param row the cell's row
  * @param column the cell's column
  * @return the cell's row span
  * @throws IndexOutOfBoundsException
  */
 int getRowSpan(int row, int column) {
   return Dom.getElementPropertyInt(getElement(row, column), "rowSpan");
 }

 /**
  * Sets the column span for the given cell. This is the number of logical
  * columns covered by the cell.
  *
  * @param row the cell's row
  * @param column the cell's column
  * @param colSpan the cell's column span
  * @throws IndexOutOfBoundsException
  */
 void setColSpan(int row, int column, int colSpan) {
   Dom.setElementPropertyInt(ensureElement(row, column), "colSpan", colSpan);
 }

 /**
  * Sets the row span for the given cell. This is the number of logical rows
  * covered by the cell.
  *
  * @param row the cell's row
  * @param column the cell's column
  * @param rowSpan the cell's row span
  * @throws IndexOutOfBoundsException
  */
 void setRowSpan(int row, int column, int rowSpan) {
   Dom.setElementPropertyInt(ensureElement(row, column), "rowSpan", rowSpan);
 }
}

Extends

CellFormatter > FlexCellFormatter

Constructors

new FlexCellFormatter(HtmlTable table) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
FlexCellFormatter(HtmlTable table) : super(table);

Methods

void addStyleName(int row, int column, String styleName) #

inherited from CellFormatter

Adds a style to the specified cell.

@param row the cell's row @param column the cell's column @param styleName the style name to be added @see UiObject#addStyleName(String)

void addStyleName(int row, int column, String styleName) {
 _table.prepareCell(row, column);
 dart_html.Element td = getCellElement(_table.bodyElem, row, column);
 UiObject.manageElementStyleName(td, styleName, true);
}

Element ensureElement(int row, int column) #

inherited from CellFormatter

Gets the element associated with a cell. If it does not exist and the subtype allows creation of elements, creates it.

@param row the cell's row @param column the cell's column @return the cell's element @throws IndexOutOfBoundsException

dart_html.Element ensureElement(int row, int column) {
 _table.prepareCell(row, column);
 return getCellElement(_table.bodyElem, row, column);
}

String getAttr(int row, int column, String attr) #

inherited from CellFormatter

Convenience methods to get an attribute on a cell.

@param row cell's row @param column cell's column @param attr attribute to get @return the attribute's value @throws IndexOutOfBoundsException

String getAttr(int row, int column, String attr) {
 dart_html.Element elem = getElement(row, column);
 return elem.attributes[attr];
}

Element getCellElement(Element table, int row, int col) #

inherited from CellFormatter

Native method to get a cell's element.

@param table the table element @param row the row of the cell @param col the column of the cell @return the element

dart_html.Element getCellElement(dart_html.Element table, int row, int col) {
 if (table is! dart_html.TableElement) {
   table = table.parent as dart_html.TableElement;
 }
 assert (table is dart_html.TableElement);
 return (table as dart_html.TableElement).rows[row].cells[col];
}

int getColSpan(int row, int column) #

Gets the column span for the given cell. This is the number of logical columns covered by the cell.

@param row the cell's row @param column the cell's column @return the cell's column span @throws IndexOutOfBoundsException

int getColSpan(int row, int column) {
 return Dom.getElementPropertyInt(getElement(row, column), "colSpan");
}

Element getElement(int row, int column) #

inherited from CellFormatter

Gets the TD element representing the specified cell.

@param row the row of the cell to be retrieved @param column the column of the cell to be retrieved @return the column's TD element @throws IndexOutOfBoundsException

dart_html.Element getElement(int row, int column) {
 _table.checkCellBounds(row, column);
 return getCellElement(_table.bodyElem, row, column);
}

Element getRawElement(int row, int column) #

inherited from CellFormatter

Gets the TD element representing the specified cell unsafely (meaning that it doesn't ensure that <code>row</code> and <code>column</code> are valid).

@param row the row of the cell to be retrieved @param column the column of the cell to be retrieved @return the cell's TD element

dart_html.Element getRawElement(int row, int column) {
 return getCellElement(_table.bodyElem, row, column);
}

int getRowSpan(int row, int column) #

Gets the row span for the given cell. This is the number of logical rows covered by the cell.

@param row the cell's row @param column the cell's column @return the cell's row span @throws IndexOutOfBoundsException

int getRowSpan(int row, int column) {
 return Dom.getElementPropertyInt(getElement(row, column), "rowSpan");
}

String getStyleName(int row, int column) #

inherited from CellFormatter

Gets the style of a specified cell.

@param row the cell's row @param column the cell's column @see UiObject#getStyleName() @return returns the style name @throws IndexOutOfBoundsException

String getStyleName(int row, int column) {
 return UiObject.getElementStyleName(getElement(row, column));
}

String getStylePrimaryName(int row, int column) #

inherited from CellFormatter

Gets the primary style of a specified cell.

@param row the cell's row @param column the cell's column @see UiObject#getStylePrimaryName() @return returns the style name @throws IndexOutOfBoundsException

String getStylePrimaryName(int row, int column) {
 return UiObject.getElementStylePrimaryName(getElement(row, column));
}

bool isVisible(int row, int column) #

inherited from CellFormatter

Determines whether or not this cell is visible.

@param row the row of the cell whose visibility is to be set @param column the column of the cell whose visibility is to be set @return <code>true</code> if the object is visible

bool isVisible(int row, int column) {
 dart_html.Element e = getElement(row, column);
 return UiObject.isVisible(e);
}

void removeStyleName(int row, int column, String styleName) #

inherited from CellFormatter

Removes a style from the specified cell.

@param row the cell's row @param column the cell's column @param styleName the style name to be removed @see UiObject#removeStyleName(String) @throws IndexOutOfBoundsException

void removeStyleName(int row, int column, String styleName) {
 _table.checkCellBounds(row, column);
 dart_html.Element td = getCellElement(_table.bodyElem, row, column);
 UiObject.manageElementStyleName(td, styleName, false);
}

void setAlignment(int row, int column, HorizontalAlignmentConstant hAlign, VerticalAlignmentConstant vAlign) #

inherited from CellFormatter

Sets the horizontal and vertical alignment of the specified cell's contents.

@param row the row of the cell whose alignment is to be set @param column the column of the cell whose alignment is to be set @param hAlign the cell's new horizontal alignment as specified in

     {@link HasHorizontalAlignment}

@param vAlign the cell's new vertical alignment as specified in

     {@link HasVerticalAlignment}

@throws IndexOutOfBoundsException

void setAlignment(int row, int column,
                        HorizontalAlignmentConstant hAlign, VerticalAlignmentConstant vAlign) {
 setHorizontalAlignment(row, column, hAlign);
 setVerticalAlignment(row, column, vAlign);
}

void setAttr(int row, int column, String attrName, String value) #

inherited from CellFormatter

Convenience methods to set an attribute on a cell.

@param row cell's row @param column cell's column @param attrName attribute to set @param value value to set @throws IndexOutOfBoundsException

void setAttr(int row, int column, String attrName, String value) {
 dart_html.Element elem = ensureElement(row, column);
 Dom.setElementAttribute(elem, attrName, value);
}

void setColSpan(int row, int column, int colSpan) #

Sets the column span for the given cell. This is the number of logical columns covered by the cell.

@param row the cell's row @param column the cell's column @param colSpan the cell's column span @throws IndexOutOfBoundsException

void setColSpan(int row, int column, int colSpan) {
 Dom.setElementPropertyInt(ensureElement(row, column), "colSpan", colSpan);
}

void setHeight(int row, int column, String height) #

inherited from CellFormatter

Sets the height of the specified cell.

@param row the row of the cell whose height is to be set @param column the column of the cell whose height is to be set @param height the cell's new height, in CSS units @throws IndexOutOfBoundsException

void setHeight(int row, int column, String height) {
 _table.prepareCell(row, column);
 dart_html.Element elem = getCellElement(_table.bodyElem, row, column);
 Dom.setElementProperty(elem, "height", height);
}

void setHorizontalAlignment(int row, int column, HorizontalAlignmentConstant align) #

inherited from CellFormatter

Sets the horizontal alignment of the specified cell.

@param row the row of the cell whose alignment is to be set @param column the column of the cell whose alignment is to be set @param align the cell's new horizontal alignment as specified in

     {@link HasHorizontalAlignment}.

@throws IndexOutOfBoundsException

void setHorizontalAlignment(int row, int column,
                                  HorizontalAlignmentConstant align) {
 _table.prepareCell(row, column);
 dart_html.Element elem = getCellElement(_table.bodyElem, row, column);
 Dom.setElementProperty(elem, "align", align.getTextAlignString());
}

void setRowSpan(int row, int column, int rowSpan) #

Sets the row span for the given cell. This is the number of logical rows covered by the cell.

@param row the cell's row @param column the cell's column @param rowSpan the cell's row span @throws IndexOutOfBoundsException

void setRowSpan(int row, int column, int rowSpan) {
 Dom.setElementPropertyInt(ensureElement(row, column), "rowSpan", rowSpan);
}

void setStyleName(int row, int column, String styleName) #

inherited from CellFormatter

Sets the style name associated with the specified cell.

@param row the row of the cell whose style name is to be set @param column the column of the cell whose style name is to be set @param styleName the new style name @see UiObject#setStyleName(String) @throws IndexOutOfBoundsException

void setStyleName(int row, int column, String styleName) {
 _table.prepareCell(row, column);
 UiObject.setElementStyleName(getCellElement(_table.bodyElem, row, column), styleName);
}

void setStylePrimaryName(int row, int column, String styleName) #

inherited from CellFormatter

Sets the primary style name associated with the specified cell.

@param row the row of the cell whose style name is to be set @param column the column of the cell whose style name is to be set @param styleName the new style name @see UiObject#setStylePrimaryName(String) @throws IndexOutOfBoundsException

void setStylePrimaryName(int row, int column, String styleName) {
 UiObject.setElementStylePrimaryName(getCellElement(_table.bodyElem, row, column), styleName);
}

void setVerticalAlignment(int row, int column, VerticalAlignmentConstant align) #

inherited from CellFormatter

Sets the vertical alignment of the specified cell.

@param row the row of the cell whose alignment is to be set @param column the column of the cell whose alignment is to be set @param align the cell's new vertical alignment as specified in

     {@link HasVerticalAlignment}.

@throws IndexOutOfBoundsException

void setVerticalAlignment(int row, int column,
                                VerticalAlignmentConstant align) {
 _table.prepareCell(row, column);
 Dom.setStyleAttribute(getCellElement(_table.bodyElem, row, column),
     "verticalAlign", align.getVerticalAlignString());
}

void setVisible(int row, int column, bool visible) #

inherited from CellFormatter

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.

@param row the row of the cell whose visibility is to be set @param column the column of the cell whose visibility is to be set @param visible <code>true</code> to show the cell, <code>false</code> to

     hide it
void setVisible(int row, int column, bool visible) {
 dart_html.Element e = ensureElement(row, column);
 UiObject.setVisible(e, visible);
}

void setWidth(int row, int column, String width) #

inherited from CellFormatter

Sets the width of the specified cell.

@param row the row of the cell whose width is to be set @param column the column of the cell whose width is to be set @param width the cell's new width, in CSS units @throws IndexOutOfBoundsException

void setWidth(int row, int column, String width) {
 // Give the subclass a chance to prepare the cell.
 _table.prepareCell(row, column);
 Dom.setElementProperty(getCellElement(_table.bodyElem, row, column), "width",
     width);
}

void setWordWrap(int row, int column, bool wrap) #

inherited from CellFormatter

Sets whether the specified cell will allow word wrapping of its contents.

@param row the row of the cell whose word-wrap is to be set @param column the column of the cell whose word-wrap is to be set @param wrap <code>false </code> to disable word wrapping in this cell @throws IndexOutOfBoundsException

void setWordWrap(int row, int column, bool wrap) {
 _table.prepareCell(row, column);
 String wrapValue = wrap ? "" : "nowrap";
 Dom.setStyleAttribute(getElement(row, column), "whiteSpace", wrapValue);
}