Package org.wicketstuff.gchart
Class DataTable
- java.lang.Object
-
- org.wicketstuff.gchart.DataTable
-
- All Implemented Interfaces:
Serializable,IClusterable,JavaScriptable,Jsonable
public class DataTable extends Object implements IClusterable, Jsonable, JavaScriptable
Abstraction of a datatable.- Author:
- Dieter Tremel
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataTable(String name, Collection<ColumnDeclaration> columDescs, Collection<DataRow> rows)DataTable(String name, Collection<ColumnDeclaration> columDescs, Collection<DataRow> rows, Map<String,Object> properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddRow(Collection<Object> newRow)booleanaddRow(DataRow newRow)static List<DataRow>fromArray(Object[][] data)Create rows for the datatable from an array.List<ColumnDeclaration>getColumnDescs()StringgetName()Map<String,Object>getProperties()List<DataRow>getRows()StringtoJavaScript()Generate declaration js for datatable variable.StringtoJavaScript(String varname)Generate declaration js for datatable variable.com.github.openjson.JSONObjecttoJSON()Create the JSON serialization of the instance.
-
-
-
Constructor Detail
-
DataTable
public DataTable(String name, Collection<ColumnDeclaration> columDescs, Collection<DataRow> rows)
-
DataTable
public DataTable(String name, Collection<ColumnDeclaration> columDescs, Collection<DataRow> rows, Map<String,Object> properties)
-
-
Method Detail
-
fromArray
public static List<DataRow> fromArray(Object[][] data)
Create rows for the datatable from an array.- Parameters:
data- Two dimensional array with data series. First index over rows, second index over columns. Do not include header in data, useColumnDeclarationfor that.- Returns:
- List of DataRows suited for
DataTable(java.lang.String, java.util.Collection, java.util.Collection).
-
toJavaScript
public String toJavaScript()
Generate declaration js for datatable variable. Fieldnameis used for variable identifier.- Specified by:
toJavaScriptin interfaceJavaScriptable- Returns:
- Declaration js.
-
toJavaScript
public String toJavaScript(String varname)
Generate declaration js for datatable variable.- Parameters:
varname- Name of datatable variable identifier.- Returns:
- Declaration js
-
toJSON
public com.github.openjson.JSONObject toJSON()
Description copied from interface:JsonableCreate the JSON serialization of the instance.
-
getName
public String getName()
-
getColumnDescs
public List<ColumnDeclaration> getColumnDescs()
-
addRow
public boolean addRow(DataRow newRow)
-
addRow
public boolean addRow(Collection<Object> newRow)
-
-