public void onModuleLoad() {
// Create a callback to be called when the visualization API
// has been loaded.
Runnable onLoadCallback = new GraphRunnable(this) {
public void run() {
Panel panel = RootPanel.get();
list = new ArrayList<ArrayList<String>>();
// DEFINISCO L' HEADER DEL GRAFICO
h1 = "Data";
h2 = "Temperatura(fahrenheit)";
h1type = ColumnType.DATETIME;
h2type = ColumnType.NUMBER;
// Creo il grafico
ScatterChart pie = new ScatterChart(createTable(), createScarredOptions());
DecoratorPanel dp = new DecoratorPanel(); // panel about search
VerticalPanel hpv = new VerticalPanel();//
HorizontalPanel hpz = new HorizontalPanel();
// tab panel relativo al grafico,esportazione arff ecc..
final TabPanel tp = new TabPanel();
pieLayer.add(pie);
tp.add(pieLayer,"Grafico");
tp.selectTab(0);
Runnable onLoadCallback = new Runnable() {
public void run() {
// Creo la tabella.
Table grid = new Table(createTable(),createTableOptions());
Cgrid.add(grid);
// aggiungo la tabella al tab panel.
tp.add(Cgrid,"Dati");
// Creo la text area relativa all'arff
text = new TextArea();
text.setWidth("700px");
text.setVisibleLines(20);
text.getElement().setId("copytxt");
text.setReadOnly(true);
// aggiungo la textarea al pannello
export.add(text);
// aggiungo il pannello al tabpanel
tp.add(export,"Export to Arff");
}
};
VisualizationUtils.loadVisualizationApi(onLoadCallback, Table.PACKAGE);
//-----------
// pannelli di ricerca
HorizontalPanel typepanel_hpz = new HorizontalPanel();
HorizontalPanel typepanel_hpz2 = new HorizontalPanel();
HorizontalPanel date_hp_hz_date1 = new HorizontalPanel();
HorizontalPanel date_hp_hz_date2 = new HorizontalPanel();
HorizontalPanel date_hp_hz_time1 = new HorizontalPanel();
HorizontalPanel date_hp_hz_time2 = new HorizontalPanel();
HorizontalPanel limit1_hp = new HorizontalPanel();
HorizontalPanel limit2_hp = new HorizontalPanel();
HorizontalPanel check_hp = new HorizontalPanel();
// check box lista aggiunte.
blist.addItem("Data-Temperatura");
blist.addItem("Data-Luce");
blist.addItem("Luce-Temperatura");
// lista dati grafici
typepanel_hpz.add(new Label("Dati del grafico"));
typepanel_hpz.add(blist);
blist2 = getGraphList(Constant.DATA_TEMP);
typepanel_hpz2.add(new Label("Tipi del grafico"));
typepanel_hpz2.add(blist2);
hpv.add(new Label("Ricerca:"));
hpv.add(typepanel_hpz);
hpv.add(typepanel_hpz2);
hpv.add(new Label("Filtri:"));
date_hp.setVisible(false);
temp_hp.setVisible(false);
light_hp.setVisible(false);
// VINCOLI DP
// DATA FILTRO
final CheckBox chkdata = new CheckBox();
hpheaderdata.add(chkdata);
hpheaderdata.add(new Label("Data"));
hpv.add(hpheaderdata);
// END DATA FILTRO
// DATA
ComponentCreator.CreateDate(date_hp_hz_date1);
ComponentCreator.CreateDate(date_hp_hz_date2);
ComponentCreator.CreateTime(date_hp_hz_time1);
ComponentCreator.CreateTime(date_hp_hz_time2);
date_hp.add(new Label("Da:"));
date_hp.add(date_hp_hz_date1);
date_hp.add(date_hp_hz_time1);
date_hp.add(new Label("A:"));
date_hp.add(date_hp_hz_date2);
date_hp.add(date_hp_hz_time2);
hpv.add(date_hp);
// FINE DATA
// TEMP FILTRO
final CheckBox check_temp = new CheckBox();
hpheadertemp.add(check_temp);
hpheadertemp.add(new Label("Temperatura"));
hpv.add(hpheadertemp);
// FINE FILTRO DI TEMPERATURA
// FILTRO DI TEMPERATURA
ComponentCreator.CreateTemp(temp_hp);
hpv.add(temp_hp);
//
// LUCE FILTRO
final CheckBox check_light = new CheckBox();
hpv.add(check_light);
hpheaderlight.add(check_light);
hpheaderlight.add(new Label("Luce"));
hpv.add(hpheaderlight);
// FINE LUCE FILTRO.
// LUCE DATA FILTRO .
ComponentCreator.CreateLight(light_hp) ;// adding data.
hpv.add(light_hp);
limit1.setSize("50px", "12px");
limit2.setSize("50px", "12px");
// LUCE DATA.FILTRO FINE
// LIMITI& NUMERO ELEMENTI
Label lb = new Label("Se questo è vuoto assume 0 come valore");
Label lb2 = new Label("Se questo è vuoto assume 5000 come valore");
Label lb3 = new Label("Mostra il numero totale degli elementi associati a questa ricerca");
lb.getElement().getStyle().setFontSize(10.0, Unit.PX);
lb2.getElement().getStyle().setFontSize(10.0, Unit.PX);
limit1_hp.add(new Label("Riga di partenza"));
limit1_hp.add(limit1);
limit1_hp.add(lb);
limit2_hp.add(new Label("Numero elementi "));
limit2_hp.add(limit2);
limit2_hp.add(lb2);
check_hp.add(ck);
check_hp.add(lb3);
hpv.add(check_hp);
hpv.add(limit1_hp);
hpv.add(limit2_hp);
// SEARCH.
Button searchButton = new Button("Cerca");
hpv.add(searchButton); // ADDING SERCH BUTTON.
//VERTICAL PANEL
// RESULT PANEL
HTML html = new HTML("<hr>");
hpv.add(html);
hpv.add(notice);
notice.setText("La pagina non contiene risultati.");
dp.add(hpv);
// FINE VP.
hpz.add(dp);// SEARCHBAR
hpz.add(tp);// PAGE DATA AND GRAPH
panel.add(hpz);
// EVENT
loaded = false;
searchButton.addClickHandler(getRoot());
// setVisible da rootPanel modifica la visibility, non la proprietà display,
// quindi elementi (es. GIF) continuano a pesare sulla pagina