public Widget init(final ArrayList<String> params) { final ArrayList<String> localParams = params; this.dataManager.fillData("getStatistics", localParams); Widget panel = VisualForm.visualize( null, new SearchForm(Boolean.valueOf(true), new String[0], new String[0]) { public void action(DateSearchForm.Period period, String[] ids) { localParams.set(0, "TESTS"); localParams.set(5, period.getFrom()); localParams.set(6, period.getTo()); ActsCatalogForm.this.dataManager.fillData("getStatistics", localParams); ActsCatalogForm.this.dataManager.refreshDisplays(); } }.onInitialize(null), onInitialize(null), null); addColumn( new TextCell(), "Наименование комитета", new GridForm.GetValue<String, FormInfo<Statistic>>() { public String getValue(FormInfo<Statistic> info) { return ((Statistic) info.getData()).getName(); } }, null); addColumn( new NumberCell(), "№ протокола", new GridForm.GetValue<Number, FormInfo<Statistic>>() { public Number getValue(FormInfo<Statistic> info) { return ((Statistic) info.getData()).getQnt1(); } }, null); addColumn( new NumberCell(), "Дата", new GridForm.GetValue<Number, FormInfo<Statistic>>() { public Number getValue(FormInfo<Statistic> info) { return ((Statistic) info.getData()).getQnt2(); } }, null); addColumn( new TextCell(), "Примечание", new GridForm.GetValue<String, FormInfo<Statistic>>() { public String getValue(FormInfo<Statistic> info) { return ((Statistic) info.getData()).getQnt3().toString(); } }, null); return panel; }
public Widget init() { FlexTable ft = new FlexTable(); ft.setWidth("100%"); ft.setWidget(0, 0, this.print); ft.setWidget(0, 1, this.printExcel); FlexTable.FlexCellFormatter format = ft.getFlexCellFormatter(); format.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); format.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); Widget panel = VisualForm.visualize(null, getSearchTable(), onInitializeWithScroll("300px"), ft); // Добавление столбцов addColumn( new TextCell(), "Статус", new GetValue<String, FormInfo<Statistic>>() { public String getValue(FormInfo<Statistic> info) { return ((Statistic) info.getData()).getName(); } }, null); addColumn( new NumberCell(), "Количество кандидатов", new GetValue<Number, FormInfo<Statistic>>() { public Number getValue(FormInfo<Statistic> info) { return ((Statistic) info.getData()).getQnt1(); } }, null); setPagerVisible(false); this.print.setWidth("120px"); this.print.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ReportParams params = new ReportParams(Report.CAND_PRINT, ReportType.html); params.putParam("daten", (String) CandStatisticsForm.this.localPar.get(5)); params.putParam("datek", (String) CandStatisticsForm.this.localPar.get(6)); params.putParam("pkct", (String) CandStatisticsForm.this.localPar.get(7)); params.putParam("pksro", (String) CandStatisticsForm.this.localPar.get(8)); Window.open(params.getRunString(), "", ""); } }); this.printExcel.setWidth("120px"); this.printExcel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ReportParams params = new ReportParams(Report.CAND_PRINT, ReportType.xls); params.putParam("daten", (String) CandStatisticsForm.this.localPar.get(5)); params.putParam("datek", (String) CandStatisticsForm.this.localPar.get(6)); params.putParam("pkct", (String) CandStatisticsForm.this.localPar.get(7)); params.putParam("pksro", (String) CandStatisticsForm.this.localPar.get(8)); Window.open(params.getRunString(), "", ""); } }); setFormData(); return panel; }