gwt-RPC problem! what is the best practice on using gwt-RPC?
- by guaz
Dear all,
I want draw a chart based on the date retrieve from the database by using RPC.
But everytime I fail to get the result. My rpc function is working.
I think is the sequence of the process.
below is my class:
public class TrafficPattern_1 extends GChart {
TrafficPattern_1() {
final DBServiceAsync dbService = GWT
.create(DBService.class);
dbService.SendData(null, null,
new AsyncCallback<Container_TrafficPattern>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(Container_TrafficPattern result) {
// TODO Auto-generated method stub
pContainer.SetaDate(result.aDate.get(1));
}
});
pContainer.aDate.get(0);
setChartSize(350, 200);
setChartTitle("<h2>Temperature vs Time<h2>");
setPadding("8px");
//setPixelSize(380, 200);
getXAxis().setAxisLabel("<small><b><i>Time</i></b></small>");
getXAxis().setHasGridlines(true);
getXAxis().setTickCount(6);
// Except for "=(Date)", a standard GWT DateTimeFormat string
getXAxis().setTickLabelFormat("=(Date)h:mm a");
getYAxis().setAxisLabel("<small><b><i>°C</i></b></small>");
getYAxis().setHasGridlines(true);
getYAxis().setTickCount(11);
getYAxis().setAxisMin(11);
getYAxis().setAxisMax(16);
addCurve();
getCurve().setLegendLabel("<i> </i>");
getCurve().getSymbol().setBorderColor("blue");
getCurve().getSymbol().setBackgroundColor("blue");
// getCurve().getSymbol().setFillSpacing(10);
// getCurve().getSymbol().setFillThickness(3);
getCurve().getSymbol().setSymbolType(SymbolType.LINE);
getCurve().getSymbol().setFillThickness(2);
getCurve().getSymbol().setFillSpacing(1);
for (int i = 0; i < dateSequence.length; i++)
// Note that getTime() returns milliseconds since
// 1/1/70--required whenever "date cast" tick label
// formats (those beginning with "=(Date)") are used.
getCurve().addPoint(dateSequence[i].date.getTime(),
dateSequence[i].value);
}