de.twenty11.skysail.common.grids
Class RowData

java.lang.Object
  extended by de.twenty11.skysail.common.grids.RowData
All Implemented Interfaces:
Serializable

public class RowData
extends Object
implements Serializable

A rowData object basically holds a map between the columns name and a value, thus providing access to the cells making up the row. It can be constructed by either using the constructor taking a columns object and then 'filling it up' by calling 'add' repeatedly, or, by using the default constructor and then calling setCells.

Author:
carsten
See Also:
Serialized Form

Constructor Summary
RowData()
           
RowData(Columns cols)
          constructor fed with the mapping between column names and columnDefinitions.
 
Method Summary
 RowData add(Object data)
          A value object (think of a cell in a grid) gets added to the rowData instance, taking into account the position of the column (by increasing an internal counter each time 'add' is called).
 void add(Object data, String defaultString)
          Adds "rows" to the rowData instance unless data is null; in this case the defaultString is added.
 RowData add(String colName, String value)
           
 boolean equals(Object obj)
           
 Map<String,String> getCells()
           
 List<Object> getColumnData()
          This method might not work like expected when the rowData was created by deserializing a string representation (e.g.
 int hashCode()
           
 void setCells(Map<String,String> props)
          This is being called for example by jackson when trying to deserialize from a string representation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowData

public RowData()

RowData

public RowData(Columns cols)
constructor fed with the mapping between column names and columnDefinitions.

Parameters:
cols - the mapping you can get from getSkysailData().getColumns();
Method Detail

add

public RowData add(Object data)
A value object (think of a cell in a grid) gets added to the rowData instance, taking into account the position of the column (by increasing an internal counter each time 'add' is called). The combination columnDefinition/value is stored in an internal map (to be used later)

Parameters:
data - a value object (like a cell in a datagrid)
Returns:
this (DSL style)

add

public RowData add(String colName,
                   String value)

add

public void add(Object data,
                String defaultString)
Adds "rows" to the rowData instance unless data is null; in this case the defaultString is added.

Parameters:
data - a value object (like a cell in a datagrid)
defaultString - this string will be added instead of "rows" if data is null. May not be null.

getCells

public Map<String,String> getCells()
Returns:
mapping between the name of the columns and the values for the current row

setCells

public void setCells(Map<String,String> props)
This is being called for example by jackson when trying to deserialize from a string representation. All the internal members are reconstructed as much as possible, but some information might be lost.

Parameters:
props -

getColumnData

public List<Object> getColumnData()
This method might not work like expected when the rowData was created by deserializing a string representation (e.g. by jackson) (though not verified yet).

Returns:
a list of the values, sorted like they were added.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2011-2012. All Rights Reserved.