List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
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);/* ww w. jav a 2 s. co 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.reports.maintenance.MaintenanceReportUI.java
public MaintenanceReportUI() { setSizeFull();/*w w 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.promodeals.PromoDealReportUI.java
public PromoDealReportUI() { setSizeFull();// w w w. ja v a 2 s. c om addComponent(promoDealGrid); setExpandRatio(promoDealGrid, 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.reimbursement.ReimbursementReportUI.java
public ReimbursementReportUI() { setSizeFull();/*from w ww .j a va 2 s. c o m*/ 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 print = new CommonButton("EXPORT TO EXCEL"); print.setWidth("200px"); print.addClickListener(this); h.addComponent(print); h.setComponentAlignment(print, Alignment.MIDDLE_RIGHT); addComponent(h); }
From source file:com.scsb.crpro.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * /*from www. j a v a 2 s . com*/ * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.scsb.vaadin.composite.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * //from w w w . j a v a2 s . co m * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("./images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("./images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("./images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("./images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.squadd.views.ChatView.java
private void buildLayout() { VerticalLayout chatAndFooter = new VerticalLayout(); chatAndFooter.setHeight("90%"); VerticalLayout contacts = new VerticalLayout(); contacts.setSizeFull();//from ww w . j a va 2 s .c o m contactsPanel.setHeight("800px"); contactsPanel.setWidth("300px"); contactsPanel.setContent(contactsLayout); contacts.addComponent(contactsPanel); contacts.setHeight("90%"); TextField idTo = new TextField("idTo"); idTo.setWidth("200px"); Button setIdTo = new Button("set"); setIdTo.setWidth("100px"); HorizontalLayout setUserToId = new HorizontalLayout(); Button.ClickListener st = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (!idTo.getValue().equals("")) { UserInfoBean newUserTo = new UserInfoBean(); newUserTo.setId(Integer.parseInt(idTo.getValue())); newUserTo.setName("id" + idTo.getValue()); control.setUserTo(newUserTo); if (footer.isVisible() == false) { footer.setVisible(true); } UserInfoFace look = new UserInfoFace(newUserTo, control, footer); Panel panel = look.getUserPanel(); boolean exists = false; for (int i = 0; i < contactsLayout.getComponentCount(); i++) { if (contactsLayout.getComponent(i).getClass() == Panel.class) { Panel pan = (Panel) contactsLayout.getComponent(i); if ((!(pan.getId() == null)) && pan.getId().equals(idTo.getValue())) { exists = true; } } } if (exists == false) { contactsLayout.addComponent(panel); } control.clearChat(); control.updateChatLog(10); } idTo.clear(); } }; setIdTo.addClickListener(st); setUserToId.addComponents(idTo, setIdTo); setUserToId.setComponentAlignment(setIdTo, Alignment.BOTTOM_CENTER); contacts.addComponent(setUserToId); mainLayout.addComponents(contacts); footer.setVisible(false);///////// chatAndFooter.addComponents(chatPanel, footer); chatLayout = new VerticalLayout(); chatPanel.setHeight("750px"); chatPanel.setWidth("900px"); chatPanel.setContent(chatLayout); chatInput = new TextField(); chatInput.setWidthUndefined(); footer.addComponent(chatInput); chatInput.focus(); send.setWidth("120px"); footer.addComponent(send); clear.setWidth("120px"); footer.addComponent(clear); update.setWidth("120px"); footer.addComponent(update); footer.setHeight("50px"); footer.setWidth("900px"); chatInput.setWidth("100%"); footer.setExpandRatio(chatInput, 1f); chatAndFooter.setExpandRatio(chatPanel, 1f); mainLayout.addComponents(chatAndFooter); mainLayout.setExpandRatio(chatAndFooter, 1f); control.loadFriends(); }
From source file:de.escidoc.admintool.view.admintask.filter.ShowFilterResultCommandImpl.java
License:Open Source License
private void addPurgeButton() { final Button purgeBtn = new Button(ViewConstants.PURGE); purgeBtn.setWidth("150px"); formLayout.addComponent(purgeBtn);/*from ww w . ja va2 s. co m*/ purgeBtn.addListener(new PurgeResourcesListener(this, formLayout, filterResourceView.adminService, filterResourceView.mainWindow)); }
From source file:de.steinwedel.messagebox.MessageBox.java
License:Apache License
/** * Shows the dialog.//www .ja v a 2 s . c o m */ public void open() { // Ensure, that the dialog has at least one button if (!buttonAdded && BUTTON_ADD_CLOSE_PER_DEFAULT) { withCloseButton(); } // Apply some layouting options to the buttons for (int i = 0; i < buttonLayout.getComponentCount(); i++) { Component c = buttonLayout.getComponent(i); if (buttonWidth != null && c instanceof Button) { Button b = (Button) c; b.setWidth(buttonWidth); } buttonLayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER); } // Add window to the UI if (DIALOG_DEFAULT_TRANSITION_LISTENER == null || (DIALOG_DEFAULT_TRANSITION_LISTENER != null && DIALOG_DEFAULT_TRANSITION_LISTENER.show(this))) { UI.getCurrent().addWindow(window); } immutable = true; }
From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java
private Component getProfiles(Group g) { VerticalLayout layoutRootProfiles = new VerticalLayout(); layoutRootProfiles.setMargin(false); layoutRootProfiles.setWidth("100%"); Panel panelProfiles = new Panel(Language.get(Word.PROFILES)); Language.setCustom(Word.PROFILES, s -> panelProfiles.setCaption(s)); panelProfiles.setWidth("100%"); panelProfiles.setHeight("200px"); VerticalLayout layoutProfiles = new VerticalLayout(); mapLayoutProfiles.put(g, layoutProfiles); layoutProfiles.setWidth("100%"); refreshProfiles(g, layoutProfiles);//from www. ja v a 2 s.c o m panelProfiles.setContent(layoutProfiles); layoutRootProfiles.addComponent(panelProfiles); if (GroupUtils.isAdmin(g, UserUtils.getCurrent())) { CssLayout addProfileGroup = new CssLayout(); addProfileGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); addProfileGroup.setWidth("100%"); TextField textFieldAddProfile = new TextField(); Language.setCustom(Word.PROFILE_NAME, s -> textFieldAddProfile.setPlaceholder(s)); textFieldAddProfile.setMaxLength(255); textFieldAddProfile.setWidth("35%"); addProfileGroup.addComponent(textFieldAddProfile); Button buttonAddProfile = new Button(); buttonAddProfile.setIcon(VaadinIcons.PLUS); buttonAddProfile.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddProfile.setWidth("15%"); buttonAddProfile.addClickListener(e -> { try { String name = textFieldAddProfile.getValue(); textFieldAddProfile.clear(); Runnable onClose = () -> refreshAll(g); UI.getCurrent().addWindow(GroupProfileWindow.create(g, name, true, onClose)); } catch (UserNotFoundException ex) { VaadinUtils.errorNotification(Language.get(Word.USER_NOT_FOUND)); } }); addProfileGroup.addComponent(buttonAddProfile); layoutRootProfiles.addComponent(addProfileGroup); } return layoutRootProfiles; }