Skip to content

Commit

Permalink
Update column type to Object to allow specifying data type and other …
Browse files Browse the repository at this point in the history
  • Loading branch information
masergy-mobile authored and melloware committed Dec 9, 2016
1 parent bedc9d1 commit 6c473bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DefaultGChartModel implements GChartModel{
private static final long serialVersionUID = -4757917806522708660L;

public DefaultGChartModel(List<GChartModelRow> rows, GChartType gChartType,
Map<String, Object> options, List<String> columns) {
Map<String, Object> options, List<Object> columns) {
super();
this.rows = rows;
this.gChartType = gChartType;
Expand All @@ -25,7 +25,7 @@ public DefaultGChartModel(List<GChartModelRow> rows, GChartType gChartType,
private List<GChartModelRow> rows;
private GChartType gChartType;
private Map<String,Object> options;
private List<String> columns;
private List<Object> columns;

public GChartType getgChartType() {
return gChartType;
Expand All @@ -35,7 +35,7 @@ public Map<String, Object> getOptions() {
return options;
}

public Collection<String> getColumns() {
public Collection<Object> getColumns() {
return columns;
}

Expand All @@ -61,7 +61,7 @@ public String toJson() {
protected JsonElement extractData() {
Collection<Collection<Object>> dataTable = new ArrayList<Collection<Object>>(0);

dataTable.add((Collection<Object>)(Collection<?>)this.getColumns());
dataTable.add(this.getColumns());

for (GChartModelRow row : this.getRows()) {
Collection<Object> dataRow = new ArrayList<Object>(0);
Expand All @@ -74,4 +74,4 @@ protected JsonElement extractData() {
return GsonConverter.getGson().toJsonTree(dataTable);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public interface GChartModel extends Serializable {
Collection<GChartModelRow> getRows();

Collection<String> getColumns();
Collection<Object> getColumns();

Map<String, Object> getOptions();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class GChartModelBuilder {
private List<GChartModelRow> rows = new ArrayList<GChartModelRow>(0);
private GChartType gChartType;
private Map<String,Object> options = new HashMap<String, Object>(0);
private List<String> columns = new ArrayList<String>(0);
private List<Object> columns = new ArrayList<Object>(0);

public GChartModelBuilder setChartType(GChartType chartType){
if(gChartType != null){
Expand All @@ -38,12 +38,12 @@ public GChartModelBuilder importTreeNode(TreeNode root){
return this;
}

public GChartModelBuilder addColumns(String... columns){
public GChartModelBuilder addColumns(Object... columns){
this.columns.addAll(Arrays.asList(columns));
return this;
}

public GChartModelBuilder addColumns(Collection<String> columns){
public GChartModelBuilder addColumns(Collection<Object> columns){
this.columns.addAll(columns);
return this;
}
Expand Down

0 comments on commit 6c473bb

Please sign in to comment.