List of usage examples for com.vaadin.ui Button addClickListener
public Registration addClickListener(ClickListener listener)
From source file:com.save.employee.maintenance.MRDataGridProperties.java
Window deletConfirmationWindow(int mrId, Object itemId) { Window sub = new Window(); sub.setCaption("CONFIRM DELETE"); sub.setWidth("250px"); sub.setModal(true);/*from w w w. j av a 2 s.c o m*/ VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button deleteBtn = new Button("DELETE?"); deleteBtn.setWidth("100%"); deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); deleteBtn.addClickListener((Button.ClickEvent event) -> { boolean result = mrs.removeMaintenanceReimbursement(mrId); if (result) { getContainerDataSource().removeItem(itemId); sub.close(); } }); v.addComponent(deleteBtn); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.maintenance.MRUI.java
public MRUI(int employeeId) { this.employeeId = employeeId; setWidth("90%"); setHeight("100%"); setMargin(new MarginInfo(true, false, false, false)); MRDataGridProperties dataGrid = new MRDataGridProperties(getEmployeeId()); Button mrForm = new Button("Maintenance/Reimbursement Form"); mrForm.setWidthUndefined();//www . jav a 2 s .c om mrForm.setIcon(FontAwesome.OPENID); mrForm.addStyleName(ValoTheme.BUTTON_SMALL); mrForm.addStyleName(ValoTheme.BUTTON_LINK); mrForm.addClickListener((Button.ClickEvent event) -> { Window sub = new MRFormWindow(getEmployeeId()); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.addCloseListener((Window.CloseEvent e) -> { dataGrid.getContainerDataSource().removeAllItems(); dataGrid.setContainerDataSource(new MRDataContainer(getEmployeeId())); }); }); addComponent(mrForm); setComponentAlignment(mrForm, Alignment.MIDDLE_RIGHT); addComponent(dataGrid); setExpandRatio(dataGrid, 2); }
From source file:com.save.employee.RemoveAccountWindow.java
VerticalLayout getVLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);//from ww w. ja v a2 s . c o m vlayout.setMargin(true); vlayout.setSizeFull(); final TextArea remarks = new TextArea("Remarks: "); remarks.setRows(2); remarks.setWidth("100%"); vlayout.addComponent(remarks); Button removeBtn = new Button("REMOVE ACCOUNT?"); removeBtn.setWidth("100%"); removeBtn.addClickListener((Button.ClickEvent event) -> { if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) { Notification.show("Add Remarks!", Notification.Type.ERROR_MESSAGE); return; } boolean result = employeeService.removeAccount(getEmployeeId(), remarks.getValue().trim().toLowerCase()); if (result) { close(); } }); vlayout.addComponent(removeBtn); return vlayout; }
From source file:com.save.employee.request.RequestFormWindow.java
Component buildRequestForm() { GridLayout glayout = new GridLayout(4, 7); glayout.setSizeFull();//from w ww.j av a 2s . c om glayout.setSpacing(true); glayout.setMargin(true); controlNo = new TextField("Control No."); controlNo.setWidth("100%"); controlNo.addStyleName(ValoTheme.TEXTFIELD_SMALL); glayout.addComponent(controlNo, 0, 0); dateOfActivity = new DateField("Date of Activity: "); dateOfActivity.setWidth("100%"); dateOfActivity.addStyleName(ValoTheme.DATEFIELD_SMALL); glayout.addComponent(dateOfActivity, 1, 0); area = CommonComboBox.areas(); area.setWidth("100%"); glayout.addComponent(area, 2, 0); activity = new TextField("Activity: "); activity.setWidth("100%"); activity.addStyleName(ValoTheme.TEXTFIELD_SMALL); glayout.addComponent(activity, 0, 1, 1, 1); venue = new TextField("Venue: "); venue.setWidth("100%"); venue.addStyleName(ValoTheme.TEXTFIELD_SMALL); glayout.addComponent(venue, 0, 2, 1, 2); requirements = new TextArea("Requirements: "); requirements.setWidth("100%"); requirements.addStyleName(ValoTheme.TEXTAREA_SMALL); glayout.addComponent(requirements, 2, 1, 3, 2); Label lodging = new Label("Lodging: "); lodging.setWidthUndefined(); glayout.addComponent(lodging, 0, 3); glayout.setComponentAlignment(lodging, Alignment.MIDDLE_CENTER); lodgingPax = new TextField("Pax: "); lodgingPax.setWidth("100%"); lodgingPax.setValue("0"); lodgingPax.addStyleName(ValoTheme.TEXTFIELD_SMALL); lodgingPax.addStyleName("align-right"); glayout.addComponent(lodgingPax, 1, 3); lodgingAmount = new TextField("Amount: "); lodgingAmount.setWidth("100%"); lodgingAmount.setValue("0.00"); lodgingAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL); lodgingAmount.addStyleName("align-right"); lodgingAmount.setEnabled(false); lodgingAmount.setImmediate(true); glayout.addComponent(lodgingAmount, 3, 3); lodgingBudget = new TextField("Budget: "); lodgingBudget.setWidth("100%"); lodgingBudget.setValue("0.00"); lodgingBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL); lodgingBudget.addStyleName("align-right"); lodgingBudget.addValueChangeListener((ValueChangeEvent event) -> { if (!CommonUtilities.checkInputIfInteger(lodgingPax.getValue().trim())) { Notification.show("Enter a numeric value for Pax", Notification.Type.ERROR_MESSAGE); return; } if (!CommonUtilities.checkInputIfDouble(lodgingBudget.getValue().trim())) { Notification.show("Enter a numeric value for Budget", Notification.Type.ERROR_MESSAGE); return; } lodgingAmount.setValue(String.valueOf(CommonUtilities.convertStringToInt(lodgingPax.getValue().trim()) * CommonUtilities.convertStringToDouble(lodgingBudget.getValue().trim()))); }); lodgingBudget.setImmediate(true); glayout.addComponent(lodgingBudget, 2, 3); Label meals = new Label("Meals: "); meals.setWidthUndefined(); glayout.addComponent(meals, 0, 4); glayout.setComponentAlignment(meals, Alignment.MIDDLE_CENTER); mealsPax = new TextField("Pax: "); mealsPax.setWidth("100%"); mealsPax.setValue("0"); mealsPax.addStyleName(ValoTheme.TEXTFIELD_SMALL); mealsPax.addStyleName("align-right"); glayout.addComponent(mealsPax, 1, 4); mealsAmount = new TextField("Amount: "); mealsAmount.setWidth("100%"); mealsAmount.setValue("0.00"); mealsAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL); mealsAmount.addStyleName("align-right"); mealsAmount.setEnabled(false); mealsAmount.setImmediate(liquidated); glayout.addComponent(mealsAmount, 3, 4); mealsBudget = new TextField("Budget: "); mealsBudget.setWidth("100%"); mealsBudget.setValue("0.00"); mealsBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL); mealsBudget.addStyleName("align-right"); mealsBudget.addValueChangeListener((ValueChangeEvent event) -> { if (!CommonUtilities.checkInputIfInteger(mealsPax.getValue().trim())) { Notification.show("Enter a numeric value for Pax", Notification.Type.ERROR_MESSAGE); return; } if (!CommonUtilities.checkInputIfDouble(mealsBudget.getValue().trim())) { Notification.show("Enter a numeric value for Budget", Notification.Type.ERROR_MESSAGE); return; } mealsAmount.setValue(String.valueOf(CommonUtilities.convertStringToInt(mealsPax.getValue().trim()) * CommonUtilities.convertStringToDouble(mealsBudget.getValue().trim()))); }); mealsAmount.setImmediate(true); glayout.addComponent(mealsBudget, 2, 4); others = new TextArea("Others: "); others.setWidth("100%"); others.setRows(3); others.addStyleName(ValoTheme.TEXTAREA_SMALL); glayout.addComponent(others, 0, 5, 2, 6); othersAmount = new TextField("Amount: "); othersAmount.setWidth("100%"); othersAmount.setValue("0.00"); othersAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL); othersAmount.addStyleName("align-right"); glayout.addComponent(othersAmount, 3, 5); glayout.setComponentAlignment(othersAmount, Alignment.TOP_CENTER); Button rlButton = new Button(); rlButton.setCaption("SAVE"); rlButton.setWidth("100%"); rlButton.addStyleName(ValoTheme.BUTTON_PRIMARY); rlButton.addStyleName(ValoTheme.BUTTON_SMALL); rlButton.addClickListener(buttonClickListener); glayout.addComponent(rlButton, 3, 6); glayout.setComponentAlignment(rlButton, Alignment.TOP_CENTER); if (getRequestId() != 0) { LiquidationForm lf = rls.getRLById(getRequestId()); controlNo.setValue(String.valueOf(lf.getControlNo())); dateOfActivity.setValue(lf.getDateOfActivity()); area.setValue(lf.getAreaId()); activity.setValue(lf.getActivity()); requirements.setValue(lf.getRequirements()); venue.setValue(lf.getVenue()); others.setValue(lf.getOthersRemarks()); othersAmount.setValue(String.valueOf(lf.getOthersAmount())); lodgingAmount.setValue(String.valueOf(lf.getLodgingAmount())); mealsAmount.setValue(String.valueOf(lf.getMealsAmount())); if (getLiquidated() == true) { setCaption("LIQUIDATE FROM"); rlButton.setCaption("LIQUIDATE"); controlNo.setReadOnly(liquidated); dateOfActivity.setReadOnly(liquidated); area.setReadOnly(liquidated); activity.setReadOnly(liquidated); requirements.setReadOnly(liquidated); venue.setReadOnly(liquidated); } else { rlButton.setCaption("EDIT"); lodgingPax.setValue(String.valueOf(lf.getLodgingPax())); lodgingBudget.setValue(String.valueOf(lf.getLodgingBudget())); mealsPax.setValue(String.valueOf(lf.getMealsPax())); mealsBudget.setValue(String.valueOf(lf.getMealsBudget())); rlButton.setEnabled(rls.getRLById(getRequestId()).getLiquidated() == 0); } // delete.setVisible(true); } return glayout; }
From source file:com.save.employee.request.RequestFormWindow.java
Window deleteRequestForm() { Window sub = new Window("DELETE REQUEST"); sub.setWidth("280px"); sub.setModal(true);/*www.jav a 2s. com*/ sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delete = new Button(); delete.setCaption("CONFIRM DELETE REQUEST?"); delete.setWidth("100%"); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener((Button.ClickEvent event) -> { boolean result = rls.deleteRequestById(getRequestId()); if (result) { sub.close(); close(); } }); v.addComponent(delete); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.request.RLDataGridProperties.java
Window deletConfirmationWindow(int rlId, Object itemId) { Window sub = new Window(); sub.setCaption("CONFIRM DELETE"); sub.setWidth("250px"); sub.setModal(true);/* w w w . ja v a 2 s . c o m*/ VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button deleteBtn = new Button("DELETE?"); deleteBtn.setWidth("100%"); deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); deleteBtn.addClickListener((Button.ClickEvent event) -> { boolean result = rls.deleteRequestById(rlId); if (result) { getContainerDataSource().removeItem(itemId); sub.close(); } }); v.addComponent(deleteBtn); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.request.RLUI.java
public RLUI(int employeeId) { this.employeeId = employeeId; setWidth("90%"); setHeight("100%"); setMargin(new MarginInfo(true, false, false, false)); RLDataGridProperties dataGrid = new RLDataGridProperties(getEmployeeId()); Button rlForm = new Button("Request/Liquidation FORM"); rlForm.setIcon(FontAwesome.OPENID);//from ww w .j a va 2 s . c o m rlForm.addStyleName(ValoTheme.BUTTON_SMALL); rlForm.addStyleName(ValoTheme.BUTTON_LINK); rlForm.addClickListener((Button.ClickEvent event) -> { Window sub = new RequestFormWindow(getEmployeeId(), 0, false, dataGrid); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.addCloseListener((Window.CloseEvent e) -> { dataGrid.getContainerDataSource().removeAllItems(); dataGrid.setContainerDataSource(new RLDataContainer(getEmployeeId())); }); }); addComponent(rlForm); setComponentAlignment(rlForm, Alignment.MIDDLE_RIGHT); addComponent(dataGrid); setExpandRatio(dataGrid, 2); }
From source file:com.save.reports.maintenance.MaintenanceReportUI.java
public MaintenanceReportUI() { setSizeFull();// ww w . j a v a 2 s . c o m mrDataGrid.setFrozenColumnCount(2); addComponent(mrDataGrid); setExpandRatio(mrDataGrid, 1); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setSpacing(true); h.setMargin(new MarginInfo(false, true, true, false)); Button filter = new CommonButton("FILTER"); filter.setWidth("200px"); filter.addClickListener(this); h.addComponent(filter); h.setComponentAlignment(filter, Alignment.MIDDLE_RIGHT); h.setExpandRatio(filter, 1); Button exportToExcel = new CommonButton("EXPORT TO EXCEL"); exportToExcel.setWidth("200px"); exportToExcel.addClickListener(this); h.addComponent(exportToExcel); h.setComponentAlignment(exportToExcel, Alignment.MIDDLE_RIGHT); addComponent(h); }
From source file:com.save.reports.maintenance.MaintenanceReportUI.java
private Window filterReport() { Window sub = new Window("FILTER REPORT"); sub.setWidth("400px"); sub.setModal(true);//from w w w . jav a2s . c om sub.center(); FormLayout f = new FormLayout(); f.setWidth("100%"); f.setMargin(true); f.setSpacing(true); CheckBox areaCheckBox = new CheckBox("Filter by Area"); f.addComponent(areaCheckBox); CheckBox employeeCheckBox = new CheckBox("Filter by Employee"); f.addComponent(employeeCheckBox); CheckBox amountCheckBox = new CheckBox("Filter by Amount"); f.addComponent(amountCheckBox); CheckBox dateCheckBox = new CheckBox("Filter by Date"); f.addComponent(dateCheckBox); ComboBox areaComboBox = CommonComboBox.areas(); ComboBox employeeComboBox = CommonComboBox.getAllClients(); areaComboBox.setEnabled(false); f.addComponent(areaComboBox); areaCheckBox.addValueChangeListener((Property.ValueChangeEvent event) -> { areaComboBox.setEnabled((boolean) event.getProperty().getValue()); employeeComboBox.setEnabled(!(boolean) event.getProperty().getValue()); employeeCheckBox.setValue(!(boolean) event.getProperty().getValue()); isAreaSelect = (boolean) event.getProperty().getValue(); isEmployeeSelect = !(boolean) event.getProperty().getValue(); }); employeeComboBox.setEnabled(false); f.addComponent(employeeComboBox); employeeCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> { employeeComboBox.setEnabled((boolean) e.getProperty().getValue()); areaComboBox.setEnabled(!(boolean) e.getProperty().getValue()); areaCheckBox.setValue(!(boolean) e.getProperty().getValue()); isAreaSelect = !(boolean) e.getProperty().getValue(); isEmployeeSelect = (boolean) e.getProperty().getValue(); }); TextField amountField = new CommonTextField("Amount: "); amountField.addStyleName("align-right"); amountField.setEnabled(false); f.addComponent(amountField); amountCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> { amountField.setEnabled((boolean) e.getProperty().getValue()); isAmountSelect = (boolean) e.getProperty().getValue(); }); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Date: "); h.setWidth("100%"); h.setSpacing(true); DateField from = new DateField(); from.setWidth("100%"); from.setEnabled(false); h.addComponent(from); DateField to = new DateField(); to.setWidth("100%"); to.setEnabled(false); h.addComponent(to); dateCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> { from.setEnabled((boolean) e.getProperty().getValue()); to.setEnabled((boolean) e.getProperty().getValue()); isDateSelect = (boolean) e.getProperty().getValue(); }); f.addComponent(h); Button generate = new CommonButton("Generate Report"); generate.addClickListener((Button.ClickEvent e) -> { if (!isEmployeeSelect && !isAmountSelect && !isDateSelect) { mrDataGrid.setContainerDataSource(new MaintenanceDataContainer()); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && !isAmountSelect && !isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource( new MaintenanceDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue()))); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && !isAmountSelect && !isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (!isEmployeeSelect && isAmountSelect && !isDateSelect) { if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer( CommonUtilities.convertStringToDouble(amountField.getValue().trim()))); mrDataGrid.setFrozenColumnCount(2); } if (!isEmployeeSelect && !isAmountSelect && isDateSelect) { if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer(from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && isAmountSelect && !isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } mrDataGrid.setContainerDataSource( new MaintenanceDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue()), CommonUtilities.convertStringToDouble(amountField.getValue().trim()))); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && isAmountSelect && !isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue(), CommonUtilities.convertStringToDouble(amountField.getValue().trim()))); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && !isAmountSelect && isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer( areaComboBox.getItemCaption(areaComboBox.getValue()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && !isAmountSelect && isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue(), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (!isEmployeeSelect && isAmountSelect && isDateSelect) { if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer( CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && isAmountSelect && isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource( new MaintenanceDataContainer(employeeComboBox.getItemCaption(employeeComboBox.getValue()), CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && isAmountSelect && isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue(), CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } sub.close(); }); f.addComponent(generate); sub.setContent(f); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.reports.maintenance.MaintenanceReportUI.java
Window exportLargeData() { Window sub = new Window("EXPORT LARGE DATA"); sub.setWidth("300px"); sub.setModal(true);//from w ww . jav a2s . co m sub.center(); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.setMargin(true); v.setSpacing(true); Label status = new Label("Exporting large amount of data will take longer and will eat a lot of memory.", ContentMode.HTML); status.setContentMode(ContentMode.HTML); v.addComponent(status); Button b = new CommonButton("PROCEED TO EXPORT?"); b.addClickListener((Button.ClickEvent e) -> { sub.close(); processExportDataToExcel(); }); v.addComponent(b); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }