List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:com.squadd.UI.GroupParticipantsLayout.java
private void buildLayout(Group group) { Label label = new Label("Participants"); label.setSizeUndefined();/*from w w w. ja v a 2 s . c o m*/ HorizontalLayout hor = new HorizontalLayout(); hor.setWidth(0.67 * Display.width + "px"); hor.addComponent(label); hor.setComponentAlignment(label, Alignment.TOP_CENTER); name.setWidth(0.68 * Display.width + "px"); name.setContent(hor); name.setStyleName("backColorGrey"); DBManager db = new DBManager(); List<UserInfoBean> users = (ArrayList) db.getUsersForGroup(group); participants.setVisible(false); fillGrid(users); VerticalLayout vert = new VerticalLayout(name, participants); addComponents(vert); }
From source file:com.squadd.UI.LoginUI.java
private void buildLayout(Button first) { HorizontalLayout usernameLayout = new HorizontalLayout(username); usernameLayout.setSizeFull();/* ww w . jav a2 s . c o m*/ usernameLayout.setComponentAlignment(username, Alignment.TOP_CENTER); HorizontalLayout passwordLayout = new HorizontalLayout(password); passwordLayout.setSizeFull(); passwordLayout.setComponentAlignment(password, Alignment.TOP_CENTER); actions.setSizeFull(); actions.setComponentAlignment(first, Alignment.TOP_RIGHT); actions.setSpacing(true); if (!isModal) { addComponent(header); for (int i = 0; i < 3; ++i) { HorizontalLayout curr = new HorizontalLayout(); curr.setSizeFull(); addComponents(curr); } } addComponents(usernameLayout, passwordLayout, actions); }
From source file:com.squadd.views.ChatView.java
private void buildLayout() { VerticalLayout chatAndFooter = new VerticalLayout(); chatAndFooter.setHeight("90%"); VerticalLayout contacts = new VerticalLayout(); contacts.setSizeFull();// w ww .j av a2s. c om 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:com.squadd.views.RegisterView.java
private void configureActionsLayout(HorizontalLayout layout) { layout.setSizeFull();//from ww w . j av a2 s . c o m layout.setSpacing(true); layout.setComponentAlignment(back, Alignment.TOP_RIGHT); }
From source file:com.studiodojo.qwikinvoice.QwikInvoiceApplication.java
License:Apache License
@Override public void init() { this.mainWindow = new Window( "QwikInvoice CRM Tools - Developed by StudioDojo. Engineered by Vaadin. Powered by Google."); setMainWindow(mainWindow);//from w w w . j a va 2 s . c o m // // Check if a user is logged in // UserService us = UserServiceFactory.getUserService(); this.logoutURL = us.createLogoutURL(super.getURL().toExternalForm()); if (us.getCurrentUser() == null || us.getCurrentUser().getEmail() == null) { super.setLogoutURL(logoutURL); super.close(); return; } String login = us.getCurrentUser().getEmail(); this.userKey = KeyFactory.createKey(TokenBean.class.getSimpleName(), us.getCurrentUser().getEmail()); // Key ucKey = KeyFactory.createKey(UserCompanyBean.class.getSimpleName(), us.getCurrentUser().getEmail()); UserCompanyBean ucBean = UserDAO.getUserCompanyBean(us.getCurrentUser().getEmail()); this.theSession = new SessionBean(login, ucBean); // // SETUP WORKING AREA // HorizontalLayout appLayout = new HorizontalLayout(); appLayout.setSizeFull(); // The Main Layout VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setWidth(APP_WIDTH); mainLayout.setHeight(APP_HEIGHT); appLayout.addComponent(mainLayout); appLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER); appLayout.setExpandRatio(mainLayout, 2); // // Setup Header (Welcome Message) // Label welcome = new Label( "<h1>QWIK!NVOICE</h1> You are " + (us.isUserLoggedIn() ? "logged in" : "logged out") + " as <b>" + us.getCurrentUser().getNickname() + "</b>", Label.CONTENT_XHTML); mainLayout.addComponent(welcome); mainLayout.setComponentAlignment(welcome, Alignment.TOP_LEFT); // // Menu Bar // MenuBar menuBar = new MenuBar(); menuBar.setWidth(APP_WIDTH); MenuBar.MenuItem fileMenuItem = menuBar.addItem("File", null, null); MenuItem newMenuItem = fileMenuItem.addItem("New...", null, null); newMenuItem.addItem("Invoice/Quote", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(InvoiceApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading panel", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); newMenuItem.addItem("Order", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(FFOrderApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading panel", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); /** SAVE */ fileMenuItem.addItem("Save", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { TokenBean userTokenBean = TokenStore.getToken(QwikInvoiceApplication.this.userKey); // User must have an OAuth AUTH Token to access Google Doc service if (userTokenBean != null) { /* GDocFileWindow saveWindow = new GDocFileWindow("Save As..."); saveWindow.init(QwikInvoiceApplication.this, PdfWriter.getFilename(QwikInvoiceApplication.this.theSession)); QwikInvoiceApplication.this.mainWindow.addWindow(saveWindow); */ QwikInvoiceApplication.this.activePanel.validate(); QwikInvoiceApplication.this.activePanel.onSave(); } else { AuthSubWindow authsubWindow = new AuthSubWindow("Service Authorization Required"); authsubWindow.init(QwikInvoiceApplication.this.userKey); QwikInvoiceApplication.this.mainWindow.addWindow(authsubWindow); } } catch (Exception e) { Log.log(Level.SEVERE, "Error Saving file", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); /** * SETTINGS */ fileMenuItem.addSeparator(); MenuItem settingsMenuItem = fileMenuItem.addItem("Settings...", null, null); settingsMenuItem.addItem("Profile", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { UserCompanySetupWindow aWindow = new UserCompanySetupWindow(); aWindow.init(QwikInvoiceApplication.this); QwikInvoiceApplication.this.mainWindow.addWindow(aWindow); } catch (Exception e) { Log.log(Level.SEVERE, "Error Saving Profile", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); fileMenuItem.addSeparator(); fileMenuItem.addItem("Logout", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { QwikInvoiceApplication.this.setLogoutURL(logoutURL); QwikInvoiceApplication.this.close(); } }); /** * Products */ MenuBar.MenuItem productsMenuItem = menuBar.addItem("Products", null, null); productsMenuItem.addItem("Products", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(ProductApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading products", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); productsMenuItem.addItem("Categories", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { ProductCategorySettingsWindow window = new ProductCategorySettingsWindow(); window.setCaption("Product Category"); window.init(QwikInvoiceApplication.this.theSession, QwikInvoiceApplication.this); QwikInvoiceApplication.this.mainWindow.addWindow(window); } catch (Exception e) { Log.log(Level.SEVERE, "Error Loading Products", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); productsMenuItem.addItem("Catalogs", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(CatalogApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading catalogs", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); /** * Help */ MenuBar.MenuItem helpMenuItem = menuBar.addItem("Help", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { AboutWindow aboutWindow = new AboutWindow(); aboutWindow.init(); QwikInvoiceApplication.this.mainWindow.addWindow(aboutWindow); } }); helpMenuItem.addItem("About...", null, null); mainLayout.addComponent(menuBar); mainLayout.setComponentAlignment(menuBar, Alignment.TOP_CENTER); // // Load Main Panel // IApplicationPanel invoiceApplicationPanel = (IApplicationPanel) this.map.get(InvoiceApplicationPanel.class); try { invoiceApplicationPanel.init(this.theSession, this); mainLayout.addComponent((Component) invoiceApplicationPanel); mainLayout.setComponentAlignment((Component) invoiceApplicationPanel, Alignment.TOP_CENTER); this.activePanel = invoiceApplicationPanel; } catch (Exception e) { } // // Setup Footer // //Label footerMessage = new Label("QwikInvoice <b>version "+_VERSION_+"</b>. This service is provided as is. E&O accepted. Developed by <a href='mailto:public@studiodojo.com?subject=QwikInvoice' target='_blank'>StudioDojo</a>. Engineered by Vaadin. Powered by Google. Apache License 2.0", Label.CONTENT_XHTML); //mainLayout.addComponent(footerMessage); //mainLayout.setComponentAlignment(footerMessage, Alignment.TOP_CENTER); Panel mainPanel = new Panel(); mainPanel.setScrollable(true); mainPanel.setContent(appLayout); this.mainWindow.setContent(mainPanel); }
From source file:com.swifta.mats.web.usermanagement.AddUserModule.java
public VerticalLayout aumModifier(HorizontalLayout contentC) { contentC.removeAllComponents();/* w w w . j ava2 s . c o m*/ VerticalLayout uf = getAddUserForm(); contentC.addComponent(uf); contentC.setComponentAlignment(uf, Alignment.MIDDLE_CENTER); contentC.setSpacing(false); contentC.setMargin(true); contentC.setSizeFull(); return uf; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getAccLog() { HorizontalLayout c = new HorizontalLayout(); c.setSizeFull();/* w w w. j a v a2 s . co m*/ Label lb = new Label("No Data Available!"); c.addComponent(lb); c.setMargin(true); c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER); return c; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getActLog() { HorizontalLayout c = new HorizontalLayout(); c.setSizeFull();/* w w w.j a v a 2 s .c om*/ Label lb = new Label("No Data Available!"); c.addComponent(lb); c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER); c.setMargin(true); return c; }
From source file:com.toptal.ui.view.LoginView.java
License:Open Source License
/** * Generates content./* w w w . j av a2s. com*/ * @return Content. */ private Component content() { final HorizontalLayout content = new HorizontalLayout(); content.setSpacing(true); this.username = new TextField("Username"); this.username.setIcon(FontAwesome.USER); this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); this.password = new PasswordField("Password"); this.password.setIcon(FontAwesome.LOCK); this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button login = new Button("Log In"); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); login.setClickShortcut(KeyCode.ENTER); login.focus(); login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue())); final Button signup = new Button("Sign Up"); signup.addStyleName(ValoTheme.BUTTON_PRIMARY); signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue())); content.addComponents(this.username, this.password, login, signup); content.setComponentAlignment(login, Alignment.BOTTOM_LEFT); content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT); return content; }
From source file:com.vphakala.SubscriberUI.java
public SubscriberUI(SubscriberService service) { super();/*from www . ja va 2 s .com*/ this.service = service; setMargin(true); setSpacing(true); setCaption("Subscriber"); Toolbar toolbar = new Toolbar(this.getCaption(), read, create, update, delete); recharge.setStyleName(BaseTheme.BUTTON_LINK); HorizontalLayout account = new HorizontalLayout(balance, recharge, rechargeResponse); account.setSpacing(true); account.setComponentAlignment(recharge, Alignment.BOTTOM_LEFT); voucher = voucherService.getRtBVoucherWSImplPort(); addComponents(toolbar, email, phoneNumber, account); }