本文整理汇总了Java中com.google.gwt.core.client.JsArrayMixed.push方法的典型用法代码示例。如果您正苦于以下问题:Java JsArrayMixed.push方法的具体用法?Java JsArrayMixed.push怎么用?Java JsArrayMixed.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.client.JsArrayMixed
的用法示例。
在下文中一共展示了JsArrayMixed.push方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toJso
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
public JsArrayMixed toJso(List<Object> args) {
JsArrayMixed result = (JsArrayMixed) JavaScriptObject.createArray();
for (Object o : args) {
if (o == null) {
result.push((JavaScriptObject) null);
} else if (o instanceof String) {
result.push((String) o);
} else if (o instanceof Date) {
result.push(JsDate.create(((Date) o).getTime()));
} else if (o instanceof Double) {
result.push(((Double) o).doubleValue());
} else {
throw new IllegalArgumentException("Don't know how to handle "
+ o);
}
}
return result;
}
示例2: add
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
@Override
public void add(int index, JavaScriptObject element) {
JsArrayMixed args = JavaScriptObject.createArray().cast();
args.push(index);
args.push(0);
args.push(element);
splice.apply(data, args);
}
示例3: remove
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
@Override
public JavaScriptObject remove(int index) {
JavaScriptObject res = data.<JsArrayMixed> cast().getObject(index);
if(res != null){
JsArrayMixed args = JavaScriptObject.createArray().cast();
args.push(index);
args.push(1);
splice.apply(data, args);
}
return res;
}
示例4: testJsList
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
public void testJsList() throws Throwable {
JsDate dateIn = JsDate.create();
dateIn.setUTCFullYear(1914);
dateIn.setUTCMonth(4);
dateIn.setUTCDate(15);
dateIn.setUTCHours(22);
dateIn.setUTCMinutes(13);
JsArrayMixed mixed = (JsArrayMixed) JsArrayMixed.createArray();
mixed.push(dateIn);
mixed.push(new Double(123.12d));
mixed.push("123");
mixed.push("false");
List<Object> list = JsList.get().toList(mixed);
Date dateOut = (Date) list.get(0);
Date dateOutUtc = new Date(dateOut.getTime() + 60 * 1000 * dateOut.getTimezoneOffset());
assertEquals(14, dateOutUtc.getYear());
assertEquals(4, dateOutUtc.getMonth());
assertEquals(15, dateOutUtc.getDate());
assertEquals(22, dateOutUtc.getHours());
assertEquals(13, dateOutUtc.getMinutes());
assertEquals(new Double(123.12d), list.get(1));
assertEquals("123", list.get(2));
assertEquals("false", list.get(3));
}
示例5: build
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
public LineChart build() {
HighchartsOptions options = HighchartsOptions.create();
ChartOptions chartOptions = ChartOptions.create();
chartOptions.setChartType(ChartType.LINE);
options.setChart(chartOptions);
JsArrayMixed seriesArray = JsArrayMixed.createArray().cast();
Series series = Series.create();
JsArrayMixed dataList = JsArrayMixed.createArray().cast();
for (String key : data.keySet()) {
dataList.push((Integer) data.get(key));
}
series.setData(dataList);
series.setShowInLegend(false);
seriesArray.push(series);
options.setSeries(seriesArray);
XAxisOptions xAxis = XAxisOptions.create();
xAxis.setCategories(data.keySet());
xAxis.setAllowDecimals(super.xAxisAllowDecimals);
options.setXAxis(xAxis);
YAxisOptions yAxis = YAxisOptions.create();
yAxis.setTitle(YAxisTitle.create().setText("Count"));
yAxis.setMin(0);
options.setYAxis(yAxis);
yAxis.setAllowDecimals(super.yAxisAllowDecimals);
if (null != colors) {
options.setColors(colors);
}
options.setTitle(TitleOptions.create().setText(chartTitle));
options.setExporting(ExportingOptions.create());
options.getExporting().setURL(GWT.getHostPageBaseURL() + "highcharts/export");
options.getExporting().setFilename(chartTitle);
options.getExporting().setEnabled(true);
LineChart lc = new LineChart(height);
if (null != handler) {
PlotOptions plotOptions = PlotOptions.create();
SeriesOptions seriesOptions = SeriesOptions.create();
seriesOptions.setPoint(PointOptions.create().setEvents(SeriesEventOptions.create().setClick(lc)));
seriesOptions.setCursor(CursorType.POINTER);
plotOptions.setSeries(seriesOptions);
options.setPlotOptions(plotOptions);
lc.setSelectionHandler(handler);
}
lc.setHighchartOptions(options);
lc.setDataSource(dataSource);
return lc;
}
示例6: build
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
@Override
public Highcharts build() {
HighchartsOptions options = HighchartsOptions.create();
ChartOptions chartOptions = ChartOptions.create();
chartOptions.setPanning(true);
chartOptions.setPanKey("shift");
chartOptions.setChartType(ChartType.BAR);
chartOptions.setZoomType(ZoomType.X);
chartOptions.setHeight(null == height ? 320 : height);
options.setChart(chartOptions);
JsArrayMixed seriesArray = JsArrayMixed.createArray().cast();
Series series = Series.create();
JsArrayMixed dataList = JsArrayMixed.createArray().cast();
for (String key : data.keySet()) {
dataList.push((Integer) data.get(key));
}
series.setData(dataList);
series.setShowInLegend(false);
seriesArray.push(series);
options.setSeries(seriesArray);
XAxisOptions xAxis = XAxisOptions.create();
xAxis.setCategories(data.keySet());
xAxis.setAllowDecimals(false);
options.setXAxis(xAxis);
YAxisOptions yAxis = YAxisOptions.create();
yAxis.setTitle(YAxisTitle.create().setText("Count"));
yAxis.setMin(0);
yAxis.setAllowDecimals(super.yAxisAllowDecimals);
options.setYAxis(yAxis);
options.setTitle(TitleOptions.create().setText(chartTitle));
TooltipOptions tooltip = TooltipOptions.create();
tooltip.setFormatter((x, y, series1) -> x + ": " + y);
options.setTooltip(tooltip);
if (null != colors) {
options.setColors(colors);
}
options.setExporting(ExportingOptions.create());
options.getExporting().setURL(GWT.getHostPageBaseURL() + "highcharts/export");
options.getExporting().setFilename(chartTitle);
options.getExporting().setEnabled(true);
BarChart chart = new BarChart(null == height ? 320 : height);
if (null != handler) {
PlotOptions plotOptions = PlotOptions.create();
SeriesOptions seriesOptions = SeriesOptions.create();
seriesOptions.setPoint(PointOptions.create().setEvents(SeriesEventOptions.create().setClick(chart)));
seriesOptions.setCursor(CursorType.POINTER);
plotOptions.setSeries(seriesOptions);
options.setPlotOptions(plotOptions);
chart.setSelectionHandler(handler);
}
chart.setHighchartOptions(options);
chart.setDataSource(dataSource);
return chart;
}
示例7: build
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
public PieChart build() {
HighchartsOptions options = HighchartsOptions.create();
ChartOptions chartOptions = ChartOptions.create();
chartOptions.setChartType(ChartType.PIE);
options.setChart(chartOptions);
JsArrayMixed seriesArray = JsArrayMixed.createArray().cast();
Series series = Series.create();
series.setName(chartTitle);
JsArrayMixed dataList = JsArrayMixed.createArray().cast();
for (String key : data.keySet()) {
//FIXME: There needs to be a limit to the number of entries in a pie chart.
JsArrayMixed values = JsArrayMixed.createArray().cast();
values.push(key);
values.push((Integer) data.get(key));
dataList.push(values);
}
series.setData(dataList);
seriesArray.push(series);
options.setSeries(seriesArray);
options.setTitle(TitleOptions.create().setText(chartTitle));
if (null != colors && !colors.isEmpty()) {
options.setColors(colors);
}
options.setExporting(ExportingOptions.create());
options.getExporting().setURL(GWT.getHostPageBaseURL() + "highcharts/export");
options.getExporting().setFilename(chartTitle);
options.getExporting().setEnabled(true);
PieChart chart = new PieChart(null == height ? 320 : height);
if (null != handler) {
PlotOptions plotOptions = PlotOptions.create();
PieOptions pieOptions = PieOptions.create();
pieOptions.setPoint(PointOptions.create().setEvents(PieEventOptions.create().setClick(chart)));
pieOptions.setCursor(CursorType.POINTER);
plotOptions.setPie(pieOptions);
options.setPlotOptions(plotOptions);
chart.setDataSelectionHandler(handler);
}
chart.setDataSource(dataSource);
chart.setHighchartOptions(options);
chart.setDataSource(dataSource);
return chart;
}
示例8: build
import com.google.gwt.core.client.JsArrayMixed; //导入方法依赖的package包/类
@Override
public Highcharts build() {
HighchartsOptions options = HighchartsOptions.create();
ChartOptions chartOptions = ChartOptions.create();
chartOptions.setChartType(ChartType.AREA);
options.setChart(chartOptions);
XAxisOptions xAxis = XAxisOptions.create();
xAxis.setAllowDecimals(super.xAxisAllowDecimals);
options.setXAxis(xAxis);
YAxisOptions yAxis = YAxisOptions.create();
yAxis.setTitle(YAxisTitle.create().setText("Count"));
yAxis.setMin(0);
yAxis.setAllowDecimals(super.yAxisAllowDecimals);
options.setYAxis(yAxis);
options.setTitle(TitleOptions.create().setText(chartTitle));
TooltipOptions tooltip = TooltipOptions.create();
tooltip.setFormatter((x, y, series1) -> x + ": " + y);
options.setTooltip(tooltip);
if (null != colors) {
options.setColors(colors);
}
options.setExporting(ExportingOptions.create());
options.getExporting().setURL(GWT.getHostPageBaseURL() + "highcharts/export");
options.getExporting().setFilename(chartTitle);
options.getExporting().setEnabled(true);
PlotOptions plotOptions = PlotOptions.create();
AreaOptions areaOptions = AreaOptions.create();
MarkerOptions markerOptions = MarkerOptions.create();
markerOptions.setEnabled(false);
markerOptions.setSymbol("circle");
markerOptions.setRadius(2);
areaOptions.setMarker(markerOptions);
areaOptions.setPointStart(0.0);
plotOptions.setArea(areaOptions);
JsArrayMixed seriesArray = JsArrayMixed.createArray().cast();
Series series = Series.create();
JsArrayMixed dataList = JsArrayMixed.createArray().cast();
for (String key : data.keySet()) {
AreaChartData areaData = AreaChartData.create();
areaData.setName(key);
JsArrayMixed dataValues = JsArrayMixed.createArray().cast();
for (Double value : (List<Double>) data.get(key)) {
dataValues.push(value);
}
areaData.setData(dataValues);
seriesArray.push(areaData);
}
series.setData(dataList);
series.setShowInLegend(false);
//seriesArray.push(series);
options.setSeries(seriesArray);
options.setPlotOptions(plotOptions);
AreaChart chart = new AreaChart(null == height ? 320 : height);
if (null != handler) {
SeriesOptions seriesOptions = SeriesOptions.create();
seriesOptions.setPoint(PointOptions.create().setEvents(SeriesEventOptions.create().setClick(chart)));
seriesOptions.setCursor(CursorType.POINTER);
plotOptions.setSeries(seriesOptions);
options.setPlotOptions(plotOptions);
chart.setSelectionHandler(handler);
}
chart.setHighchartOptions(options);
chart.setDataSource(dataSource);
return chart;
}