List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:com.save.area.DeleteAreaWindow.java
VerticalLayout getLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();/*from w ww . j av a2 s. c o m*/ vlayout.setMargin(true); vlayout.setSpacing(true); vlayout.addComponent(area); Button deleteBtn = new Button("DELETE", this); deleteBtn.setWidth("100%"); vlayout.addComponent(deleteBtn); return vlayout; }
From source file:com.save.client.promodeals.PDDataGridProperties.java
Window delete(Object itemId, int promoId) { Window sub = new Window("REMOVE PROMO DEAL"); sub.setWidth("250px"); sub.setModal(true);/*from w w w. ja va 2 s.co m*/ sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delBtn = new Button("CONFIRM DELETE?", (Button.ClickEvent event) -> { boolean result = pds.delete(promoId, "removed"); getContainerDataSource().removeItem(itemId); sub.close(); }); delBtn.setWidth("100%"); delBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); delBtn.addStyleName(ValoTheme.BUTTON_SMALL); v.addComponent(delBtn); sub.setContent(v); return sub; }
From source file:com.save.client.RemoveAccountWindow.java
VerticalLayout getVLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);//from w ww. j a va2s. 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 = clientService.removeAccount(getClientId(), remarks.getValue().trim().toLowerCase()); if (result) { close(); } }); vlayout.addComponent(removeBtn); return vlayout; }
From source file:com.save.client.RemoveAccountWindow.java
void getConfirmationWindow(final String str) { final Window sub = new Window("Conifrm?"); sub.setWidth("180px"); sub.setHeight("150px"); sub.center();/*w w w. j av a 2s .c om*/ sub.setResizable(false); UI.getCurrent().addWindow(sub); VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true); vlayout.setSpacing(true); vlayout.addComponent(new Label("Client is a Distributor!")); Button removeBtn = new Button("REMOVE"); removeBtn.setWidth("100%"); removeBtn.addClickListener((Button.ClickEvent event) -> { boolean result = clientService.removeAccount(getClientId(), str); if (result) { sub.close(); close(); } }); vlayout.addComponent(removeBtn); sub.setContent(vlayout); sub.addCloseListener((CloseEvent e) -> { close(); }); }
From source file:com.save.clients.AcknowledgementPromoForm.java
VerticalLayout acknowledgementFormContent() { VerticalLayout content = new VerticalLayout(); content.setSizeFull();/* www. j a v a 2s . c om*/ content.setMargin(true); content.setSpacing(true); GridLayout glayout = new GridLayout(4, 5); glayout.setWidth("100%"); glayout.setSpacing(true); entryDate = new DateField("Date: "); entryDate.setWidth("100%"); glayout.addComponent(entryDate, 0, 0); promoItem = new TextField("Promo Items: "); promoItem.setWidth("100%"); glayout.addComponent(promoItem, 1, 0, 3, 0); promoAmount = new TextField("Amount: "); promoAmount.setWidth("100%"); promoAmount.setStyleName("align-right"); glayout.addComponent(promoAmount, 0, 1); quantity = new TextField("Quantity: "); quantity.setWidth("100%"); quantity.setStyleName("align-right"); glayout.addComponent(quantity, 1, 1); productItems = CommonComboBox.productItems(); productItems.setWidth("100%"); glayout.addComponent(productItems, 2, 1, 3, 1); startDate = new DateField("From: "); startDate.setWidth("100%"); glayout.addComponent(startDate, 0, 2); endDate = new DateField("To: "); endDate.setWidth("100%"); glayout.addComponent(endDate, 1, 2); salesRep.setWidth("100%"); glayout.addComponent(salesRep, 2, 2, 3, 2); areaSales.setWidth("100%"); glayout.addComponent(areaSales, 2, 3, 3, 3); remarks = new TextArea("Remarks: "); remarks.setWidth("100%"); remarks.setRows(4); glayout.addComponent(remarks, 0, 3, 1, 4); Button submitBtn = new Button(); submitBtn.setCaption("SAVE"); submitBtn.setWidth("100%"); submitBtn.addClickListener(this); glayout.addComponent(submitBtn, 2, 4, 3, 4); glayout.setComponentAlignment(submitBtn, Alignment.BOTTOM_CENTER); if (getPromoId() != 0) { PromoDeals pd = pds.getPromoDealById(getPromoId()); submitBtn.setCaption("UPDATE"); entryDate.setValue(pd.getEntryDate()); startDate.setValue(pd.getStartDate()); endDate.setValue(pd.getEndDate()); promoItem.setValue(pd.getPromoItem()); promoAmount.setValue(String.valueOf(pd.getPromoAmount())); quantity.setValue(String.valueOf(pd.getQuantity())); productItems.setValue(pd.getProductId()); areaSales.setValue(pd.getAreaSalesId()); salesRep.setValue(pd.getSalesRepId()); remarks.setValue(pd.getRemarks()); } content.addComponent(glayout); return content; }
From source file:com.save.employee.CreateNewAccountWindow.java
FormLayout getLayout() { FormLayout f = new FormLayout(); f.setReadOnly(false);//w w w .ja va2 s . co m f.setSpacing(true); f.setMargin(true); final TextField employeeNo = new TextField("Employee No: "); employeeNo.setWidth("100%"); employeeNo.setRequired(true); employeeNo.setNullSettingAllowed(false); f.addComponent(employeeNo); final TextField firstname = new TextField("Firstname: "); firstname.setWidth("100%"); firstname.setRequired(true); firstname.setNullSettingAllowed(false); f.addComponent(firstname); final TextField middlename = new TextField("Middlename: "); middlename.setWidth("100%"); middlename.setRequired(true); middlename.setNullSettingAllowed(false); f.addComponent(middlename); final TextField lastname = new TextField("Lastname: "); lastname.setWidth("100%"); lastname.setRequired(true); lastname.setNullSettingAllowed(false); f.addComponent(lastname); final OptionGroup gender = new OptionGroup("Gender: "); gender.addItem("Female"); gender.addItem("Male"); gender.addStyleName("horizontal"); gender.setValue("Female"); f.addComponent(gender); final ComboBox status = new ComboBox("Status: "); status.setWidth("100%"); status.setNullSelectionAllowed(false); status.addItem("Single"); status.addItem("Married"); status.addItem("Widow"); status.addItem("Separated"); f.addComponent(status); Button saveBtn = new Button("SAVE"); saveBtn.setWidth("100%"); saveBtn.addClickListener((Button.ClickEvent event) -> { //TODO if (employeeNo.getValue().isEmpty() || employeeNo.getValue() == null) { Notification.show("Requried Emloyee ID", Notification.Type.WARNING_MESSAGE); return; } if (firstname.getValue().isEmpty() || firstname.getValue() == null) { Notification.show("Requried Firstname", Notification.Type.WARNING_MESSAGE); return; } if (middlename.getValue().isEmpty() || middlename.getValue() == null) { Notification.show("Requried Middlename", Notification.Type.WARNING_MESSAGE); return; } if (lastname.getValue().isEmpty() || lastname.getValue() == null) { Notification.show("Requried Lastname", Notification.Type.WARNING_MESSAGE); return; } if (status.getValue() == null) { Notification.show("Requried Status", Notification.Type.WARNING_MESSAGE); } if (employeeService.checkIfEmployeeNoExist(employeeNo.getValue().trim().toLowerCase())) { Notification.show("EmployeeId already Exist!", Notification.Type.ERROR_MESSAGE); return; } Employee e = new Employee(); e.setEmployeeNo(employeeNo.getValue().trim().toLowerCase()); e.setFirstname(firstname.getValue().trim().toLowerCase()); e.setMiddlename(middlename.getValue().trim().toLowerCase()); e.setLastname(lastname.getValue().trim().toLowerCase()); e.setGender(gender.getValue().toString().trim().toLowerCase()); e.setPersonalStatus(status.getValue().toString()); boolean result = employeeService.createNewAccount(e); if (result) { close(); getHsplit().setFirstComponent(new EmployeesDataGridProperties(getHsplit(), "personal")); } }); f.addComponent(saveBtn); return f; }
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);// w w w.j a v a2s.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.RemoveAccountWindow.java
VerticalLayout getVLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/*from www .ja v a 2s .c om*/ 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 a va2 s . co m*/ 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);//from ww w . j av a2 s .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; }