List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.rex.components.valo.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);//from w w w.jav a 2 s .c o m content.setSpacing(true); content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for"); group.addStyleName("v-component-group"); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(800); } catch (InterruptedException e) { } } }); group.addComponent(loading); Button delay = new Button("3"); delay.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(3000); } catch (InterruptedException e) { } } }); group.addComponent(delay); Button wait = new Button("15"); wait.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(15000); } catch (InterruptedException e) { } } }); wait.addStyleName("last"); group.addComponent(wait); Label label = new Label(" seconds", ContentMode.HTML); label.setSizeUndefined(); group.addComponent(label); Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added."); spinnerDesc.addStyleName("small"); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!ReportEngineUI.isTestMode()) { final Label spinner = new Label(); spinner.addStyleName("spinner"); Button showSpinnerButton = new Button("Show spinner", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { content.replaceComponent(event.getComponent(), spinner); } }); content.addComponent(showSpinnerButton); } return p; }
From source file:com.save.area.AddLocationToAreaWindow.java
VerticalLayout getVlayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();/*from w w w . j a v a 2 s . c om*/ vlayout.setMargin(true); vlayout.setSpacing(true); area.setInputPrompt("Select Area.."); area.setNullSelectionAllowed(false); vlayout.addComponent(area); province.setInputPrompt("Select Province.."); province.addValueChangeListener(new ProvincePropertyChangeListener(city)); vlayout.addComponent(province); city.setInputPrompt("Select City.."); city.setWidth("100%"); vlayout.addComponent(city); Button addBtn = new Button("ADD LOCATION TO AREA"); addBtn.setWidth("100%"); addBtn.addClickListener(addBtnListener); vlayout.addComponent(addBtn); return vlayout; }
From source file:com.save.area.AddNewCityWindow.java
VerticalLayout getVlayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();//from w ww . ja va 2 s . co m vlayout.setMargin(true); vlayout.setSpacing(true); province.setInputPrompt("Select Province.."); province.setWidth("100%"); vlayout.addComponent(province); cityField.setWidth("100%"); vlayout.addComponent(cityField); Button addCityBtn = new Button("ADD CITY"); addCityBtn.setWidth("100%"); addCityBtn.addClickListener(addCityBtnListener); vlayout.addComponent(addCityBtn); return vlayout; }
From source file:com.save.area.AddNewProvinceWindow.java
VerticalLayout getVlayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();// ww w . j av a 2s .c o m vlayout.setMargin(true); vlayout.setSpacing(true); provinceField.setWidth("100%"); vlayout.addComponent(provinceField); Button provinceBtn = new Button("ADD PROVINCE"); provinceBtn.setWidth("100%"); provinceBtn.addClickListener(addProvinceBtnListener); vlayout.addComponent(provinceBtn); return vlayout; }
From source file:com.save.area.CreateNewAreaWindow.java
VerticalLayout getVlayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();/*from w ww.j ava 2 s .co m*/ vlayout.setMargin(true); vlayout.setSpacing(true); final TextField areaField = new TextField("Create Area: "); areaField.setWidth("100%"); areaField.setRequired(true); areaField.setRequiredError("*Required Field"); vlayout.addComponent(areaField); Button createBtn = new Button("CREATE NEW AREA"); createBtn.setWidth("100%"); createBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (as.isAreaExist(areaField.getValue().trim().toLowerCase())) { Notification.show("Area already Exist!", Notification.Type.WARNING_MESSAGE); return; } if (areaField.getValue() == null || areaField.getValue().trim().isEmpty()) { Notification.show("Area Field cannot be empty!", Notification.Type.ERROR_MESSAGE); return; } boolean result = as.createNewArea(areaField.getValue().trim().toLowerCase()); if (result) { Notification.show("Done!"); close(); } } }); createBtn.setImmediate(true); vlayout.addComponent(createBtn); return vlayout; }
From source file:com.save.area.DeleteAreaWindow.java
VerticalLayout getLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();//from ww w. j ava 2 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.area.EditAreaWindow.java
VerticalLayout getVlayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull();//from w w w . j av a 2 s . c o m vlayout.setMargin(true); vlayout.setSpacing(true); area.setInputPrompt("Select Area.."); area.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { areaField.setValue(area.getItemCaption(event.getProperty().getValue())); } }); vlayout.addComponent(area); areaField.setWidth("100%"); vlayout.addComponent(areaField); editAreaBtn.setWidth("100%"); editAreaBtn.addClickListener(editBtnListener); vlayout.addComponent(editAreaBtn); return vlayout; }
From source file:com.save.client.RemoveAccountWindow.java
VerticalLayout getVLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true); vlayout.setMargin(true);/*from ww w . j av a 2 s . c om*/ 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();/* www . ja v a 2 s.c o m*/ 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();/* w w w . ja va 2 s.c o m*/ 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; }