API Reference 0.3.24dart_web_toolkit_uiRowFormatter

RowFormatter class

This class contains methods used to format a table's rows.

class RowFormatter {

 HtmlTable _table;

 /**
  * Adds a style to the specified row.
  *
  * @param row the row to which the style will be added
  * @param styleName the style name to be added
  * @see UiObject#addStyleName(String)
  * @throws IndexOutOfBoundsException
  */
 void addStyleName(int row, String styleName) {
   UiObject.manageElementStyleName(ensureElement(row), styleName, true);
 }

 /**
  * Gets the TR element representing the specified row.
  *
  * @param row the row whose TR element is to be retrieved
  * @return the row's TR element
  * @throws IndexOutOfBoundsException
  */
 dart_html.Element getElement(int row) {
   _table.checkRowBounds(row);
   return getRow(_table.bodyElem, row);
 }

 /**
  * Gets the style of the specified row.
  *
  * @param row the row to be queried
  * @return the style name
  * @see UiObject#getStyleName()
  * @throws IndexOutOfBoundsException
  */
 String getStyleName(int row) {
   return UiObject.getElementStyleName(getElement(row));
 }

 /**
  * Gets the primary style of the specified row.
  *
  * @param row the row to be queried
  * @return the style name
  * @see UiObject#getStylePrimaryName()
  * @throws IndexOutOfBoundsException
  */
 String getStylePrimaryName(int row) {
   return UiObject.getElementStylePrimaryName(getElement(row));
 }

 /**
  * Determines whether or not this row is visible via the display style
  * attribute.
  *
  * @param row the row whose visibility is to be set
  * @return <code>true</code> if the row is visible
  */
 bool isVisible(int row) {
   dart_html.Element e = getElement(row);
   return UiObject.isVisible(e);
 }

 /**
  * Removes a style from the specified row.
  *
  * @param row the row from which the style will be removed
  * @param styleName the style name to be removed
  * @see UiObject#removeStyleName(String)
  * @throws IndexOutOfBoundsException
  */
 void removeStyleName(int row, String styleName) {
   UiObject.manageElementStyleName(ensureElement(row), styleName, false);
 }

 /**
  * Sets the style name associated with the specified row.
  *
  * @param row the row whose style name is to be set
  * @param styleName the new style name
  * @see UiObject#setStyleName(String)
  * @throws IndexOutOfBoundsException
  */
 void setStyleName(int row, String styleName) {
   UiObject.setElementStyleName(ensureElement(row), styleName);
 }

 /**
  * Sets the primary style name associated with the specified row.
  *
  * @param row the row whose style name is to be set
  * @param styleName the new style name
  * @see UiObject#setStylePrimaryName(String)
  * @throws IndexOutOfBoundsException
  */
 void setStylePrimaryName(int row, String styleName) {
   UiObject.setElementStylePrimaryName(ensureElement(row), styleName);
 }

 /**
  * Sets the vertical alignment of the specified row.
  *
  * @param row the row whose alignment is to be set
  * @param align the row's new vertical alignment as specified in
  *          {@link HasVerticalAlignment}
  * @throws IndexOutOfBoundsException
  */
 void setVerticalAlign(int row, VerticalAlignmentConstant align) {
   Dom.setStyleAttribute(ensureElement(row), "verticalAlign",
       align.getVerticalAlignString());
 }

 /**
  * Sets whether this row is visible.
  *
  * @param row the row whose visibility is to be set
  * @param visible <code>true</code> to show the row, <code>false</code> to
  *          hide it
  */
 void setVisible(int row, bool visible) {
   dart_html.Element e = ensureElement(row);
   UiObject.setVisible(e, visible);
 }

 /**
  * Ensure the TR element representing the specified row exists for
  * subclasses that allow dynamic addition of elements.
  *
  * @param row the row whose TR element is to be retrieved
  * @return the row's TR element
  * @throws IndexOutOfBoundsException
  */
 dart_html.Element ensureElement(int row) {
   _table.prepareRow(row);
   return getRow(_table.bodyElem, row);
 }

 dart_html.Element getRow(dart_html.Element elem, int row) {
   return (elem.parent as dart_html.TableElement).rows[row];
 }

 /**
  * Convenience methods to set an attribute on a row.
  *
  * @param row cell's row
  * @param attrName attribute to set
  * @param value value to set
  * @throws IndexOutOfBoundsException
  */
 void setAttr(int row, String attrName, String value) {
   dart_html.Element elem = ensureElement(row);
   Dom.setElementAttribute(elem, attrName, value);
 }
}

Methods

void addStyleName(int row, String styleName) #

Adds a style to the specified row.

@param row the row to which the style will be added @param styleName the style name to be added @see UiObject#addStyleName(String) @throws IndexOutOfBoundsException

void addStyleName(int row, String styleName) {
 UiObject.manageElementStyleName(ensureElement(row), styleName, true);
}

Element ensureElement(int row) #

Ensure the TR element representing the specified row exists for subclasses that allow dynamic addition of elements.

@param row the row whose TR element is to be retrieved @return the row's TR element @throws IndexOutOfBoundsException

dart_html.Element ensureElement(int row) {
 _table.prepareRow(row);
 return getRow(_table.bodyElem, row);
}

Element getElement(int row) #

Gets the TR element representing the specified row.

@param row the row whose TR element is to be retrieved @return the row's TR element @throws IndexOutOfBoundsException

dart_html.Element getElement(int row) {
 _table.checkRowBounds(row);
 return getRow(_table.bodyElem, row);
}

Element getRow(Element elem, int row) #

dart_html.Element getRow(dart_html.Element elem, int row) {
 return (elem.parent as dart_html.TableElement).rows[row];
}

String getStyleName(int row) #

Gets the style of the specified row.

@param row the row to be queried @return the style name @see UiObject#getStyleName() @throws IndexOutOfBoundsException

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

String getStylePrimaryName(int row) #

Gets the primary style of the specified row.

@param row the row to be queried @return the style name @see UiObject#getStylePrimaryName() @throws IndexOutOfBoundsException

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

bool isVisible(int row) #

Determines whether or not this row is visible via the display style attribute.

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

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

void removeStyleName(int row, String styleName) #

Removes a style from the specified row.

@param row the row from which the style will be removed @param styleName the style name to be removed @see UiObject#removeStyleName(String) @throws IndexOutOfBoundsException

void removeStyleName(int row, String styleName) {
 UiObject.manageElementStyleName(ensureElement(row), styleName, false);
}

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

Convenience methods to set an attribute on a row.

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

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

void setStyleName(int row, String styleName) #

Sets the style name associated with the specified row.

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

void setStyleName(int row, String styleName) {
 UiObject.setElementStyleName(ensureElement(row), styleName);
}

void setStylePrimaryName(int row, String styleName) #

Sets the primary style name associated with the specified row.

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

void setStylePrimaryName(int row, String styleName) {
 UiObject.setElementStylePrimaryName(ensureElement(row), styleName);
}

void setVerticalAlign(int row, VerticalAlignmentConstant align) #

Sets the vertical alignment of the specified row.

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

     {@link HasVerticalAlignment}

@throws IndexOutOfBoundsException

void setVerticalAlign(int row, VerticalAlignmentConstant align) {
 Dom.setStyleAttribute(ensureElement(row), "verticalAlign",
     align.getVerticalAlignString());
}

void setVisible(int row, bool visible) #

Sets whether this row is visible.

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

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