API Reference 0.7.1rikulo_modelRenderContext<T>

RenderContext<T> class

The render context used to render DataModel.

Note: Which renderer to use depends on the view. See also Renderer.

class RenderContext<T> {
 RenderContext(this.view, this.model, this.data, this.selected, this.disabled,
   [this.index = -1, this.column, this.columnIndex = -1]);

 /** The view that renders the model. */
 final View view;
 /** The model. */
 final DataModel model;
 /** The data being rendered.
  */
 final T data;
 /** The index of data, or -1 if not applicable.
  */
 final int index;
 /** Whether the data is selected, or false if not applicable.
  */
 final bool selected;
 /** Whetehr the data is disabled, or false if not applicable.
  */
 final bool disabled;

 /** The column index, or -1 if not applicable.
  * It is used only if the view is a grid-type UI and it supports the render-on-demand
  * at the horizontal direction. In other words, [data] is the data representing
  * the whole row, while [columnIndex] specifies which part of the data to render.
  *
  * Please refer to the views that support this field.
  */
 final int columnIndex;
 /** The column's name, or null if not applicable.
  * Like [columnIndex], it is used only if the view is a grid-type UI and
  * it supports the render-on-demand at the horizontal direction.
  * In other words, [data] is the data representing
  * the whole row, while [column] specifies which part of the data to render.
  *
  * Note: dependong on the view, [column] might not be supported, even if
  * supports [columnIndex].
  *
  * Please refer to the views that support this field.
  */
 final String column;

 /** Converts the given object to a string.
  *
  * + [encode] specifies whether to invoke [XmlUtil.encode].
  */
 String getDataAsString([bool encode=false]) {
   var val = data;
   if (val is TreeNode)
     val = (val as TreeNode).data;
   if (val is Map && (val as Map).containsKey("text"))
     val = val["text"];
   return val != null ? encode ? "${XmlUtil.encode(val)}": val.toString(): "";
 }
}

Constructors

new RenderContext(View view, DataModel model, T data, bool selected, bool disabled, [int index = -1, String column, int columnIndex = -1]) #

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
RenderContext(this.view, this.model, this.data, this.selected, this.disabled,
 [this.index = -1, this.column, this.columnIndex = -1]);

Properties

final String column #

The column's name, or null if not applicable. Like columnIndex, it is used only if the view is a grid-type UI and it supports the render-on-demand at the horizontal direction. In other words, data is the data representing the whole row, while column specifies which part of the data to render.

Note: dependong on the view, column might not be supported, even if supports columnIndex.

Please refer to the views that support this field.

final String column

final int columnIndex #

The column index, or -1 if not applicable. It is used only if the view is a grid-type UI and it supports the render-on-demand at the horizontal direction. In other words, data is the data representing the whole row, while columnIndex specifies which part of the data to render.

Please refer to the views that support this field.

final int columnIndex

final T data #

The data being rendered.

final T data

final bool disabled #

Whetehr the data is disabled, or false if not applicable.

final bool disabled

final int index #

The index of data, or -1 if not applicable.

final int index

final DataModel model #

The model.

final DataModel model

final bool selected #

Whether the data is selected, or false if not applicable.

final bool selected

final View view #

The view that renders the model.

final View view

Methods

String getDataAsString([bool encode = false]) #

Converts the given object to a string.

String getDataAsString([bool encode=false]) {
 var val = data;
 if (val is TreeNode)
   val = (val as TreeNode).data;
 if (val is Map && (val as Map).containsKey("text"))
   val = val["text"];
 return val != null ? encode ? "${XmlUtil.encode(val)}": val.toString(): "";
}