List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT
Alignment MIDDLE_RIGHT
To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.
Click Source Link
From source file:com.skysql.manager.ui.SetupDialog.java
License:Open Source License
/** * Add user./* w w w .ja va 2s . com*/ */ private void inputUser() { final Button finishedButton = new Button("Add User"); final UserObject user = new UserObject(); final UserForm userForm = new UserForm(null, user, "Add User to the System", finishedButton); wrapper.replaceComponent(currentForm, userForm); currentForm = userForm; buttonsBar.addComponent(finishedButton); buttonsBar.setComponentAlignment(finishedButton, Alignment.MIDDLE_RIGHT); finishedButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { if (userForm.validateUser() && user.set()) { VaadinSession.getCurrent().setAttribute(UserObject.class, user); nextForm(); } } }); }
From source file:com.skysql.manager.ui.SystemDialog.java
License:Open Source License
/** * Save system.// w w w .j av a2s. c o m * * @param okButtonCaption the ok button caption */ private void saveSystem(final String okButtonCaption) { commitButton.setCaption(okButtonCaption); final Button cancelButton = new Button("Cancel"); buttonsBar.addComponent(cancelButton); buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { windowClose(null); } }); commitButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { if (systemForm.validateSystem()) { if (systemRecord.save()) { if (button != null) { button.setName(systemRecord.getName()); button.setDescription(systemRecord.ToolTip()); if (button.isSelected()) { TabbedPanel tabbedPanel = VaadinSession.getCurrent() .getAttribute(TabbedPanel.class); tabbedPanel.refresh(); } } else { OverviewPanel overviewPanel = VaadinSession.getCurrent() .getAttribute(OverviewPanel.class); overviewPanel.refresh(); } windowClose(null); } } } }); buttonsBar.addComponent(commitButton); buttonsBar.setComponentAlignment(commitButton, Alignment.MIDDLE_RIGHT); }
From source file:com.skysql.manager.ui.TopPanel.java
License:Open Source License
/** * Instantiates a new top panel.// w ww . j a v a 2 s . c o m */ public TopPanel() { setSpacing(true); addStyleName("titleLayout"); setWidth("100%"); Embedded logo = new Embedded(null, new ThemeResource("img/productlogo.png")); addComponent(logo); setComponentAlignment(logo, Alignment.BOTTOM_LEFT); // LINKS AREA (TOP-RIGHT) HorizontalLayout userSettingsLayout = new HorizontalLayout(); userSettingsLayout.setSizeUndefined(); userSettingsLayout.setSpacing(true); addComponent(userSettingsLayout); setComponentAlignment(userSettingsLayout, Alignment.MIDDLE_RIGHT); // User icon and name VerticalLayout userLayout = new VerticalLayout(); userSettingsLayout.addComponent(userLayout); userSettingsLayout.setComponentAlignment(userLayout, Alignment.BOTTOM_CENTER); UserObject userObject = VaadinSession.getCurrent().getAttribute(UserObject.class); String name = userObject.getAnyName(); userName = new Label("Welcome, " + name); userName.setSizeUndefined(); userLayout.addComponent(userName); // buttons HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSizeUndefined(); buttonsLayout.setSpacing(true); userSettingsLayout.addComponent(buttonsLayout); userSettingsLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER); // Settings button SettingsDialog settingsDialog = new SettingsDialog("Settings"); Button settingsButton = settingsDialog.getButton(); buttonsLayout.addComponent(settingsButton); buttonsLayout.setComponentAlignment(settingsButton, Alignment.MIDDLE_CENTER); // Logout Button logoutButton = new Button("Logout"); logoutButton.setSizeUndefined(); buttonsLayout.addComponent(logoutButton); buttonsLayout.setComponentAlignment(logoutButton, Alignment.MIDDLE_CENTER); logoutButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { UI.getCurrent().getPage().setLocation(""); UI.getCurrent().close(); getSession().setAttribute(UserObject.class, null); getSession().close(); } }); }
From source file:com.skysql.manager.ui.UserDialog.java
License:Open Source License
/** * Save user.//from w ww . jav a 2 s .co m * * @param commitButtonCaption the commit button caption */ private void saveUser(final String commitButtonCaption) { final Button cancelButton = new Button("Cancel"); buttonsBar.addComponent(cancelButton); buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { windowClose(null); } }); commitButton.setCaption(commitButtonCaption); commitButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { if (userForm.validateUser()) { boolean success = userInfo.setUser(userObject); if (success) { if (isAdding) { usersSettings.addToSelect(userObject.getUserID()); } else { usersSettings.updateUserName(userObject.getUserID()); } windowClose(null); } else { return; } } } }); buttonsBar.addComponent(commitButton); buttonsBar.setComponentAlignment(commitButton, Alignment.MIDDLE_RIGHT); }
From source file:com.skysql.manager.ui.UsersSettings.java
License:Open Source License
/** * Removes the user./*from w w w. java 2 s . co m*/ * * @param event the event */ public void removeUser(Button.ClickEvent event) { secondaryDialog = new ModalWindow("Delete User", null); UI.getCurrent().addWindow(secondaryDialog); secondaryDialog.addCloseListener(this); final VerticalLayout formContainer = new VerticalLayout(); formContainer.setMargin(new MarginInfo(true, true, false, true)); formContainer.setSpacing(false); final Form form = new Form(); formContainer.addComponent(form); form.setFooter(null); form.setDescription("Delete user " + userInfo.completeNamesByID(selectedUserID) + " from the system"); HorizontalLayout buttonsBar = new HorizontalLayout(); buttonsBar.setStyleName("buttonsBar"); buttonsBar.setSizeFull(); buttonsBar.setSpacing(true); buttonsBar.setMargin(true); buttonsBar.setHeight("49px"); Label filler = new Label(); buttonsBar.addComponent(filler); buttonsBar.setExpandRatio(filler, 1.0f); Button cancelButton = new Button("Cancel"); buttonsBar.addComponent(cancelButton); buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { form.discard(); secondaryDialog.close(); } }); Button okButton = new Button("Delete User"); okButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { try { form.setComponentError(null); form.commit(); boolean success = userInfo.deleteUser(selectedUserID); if (success) { select.removeItem(selectedUserID); } else { return; } } catch (EmptyValueException e) { return; } catch (Exception e) { ManagerUI.error(e.getMessage()); return; } secondaryDialog.close(); } }); buttonsBar.addComponent(okButton); buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT); VerticalLayout windowLayout = (VerticalLayout) secondaryDialog.getContent(); windowLayout.setSpacing(false); windowLayout.setMargin(false); windowLayout.addComponent(formContainer); windowLayout.addComponent(buttonsBar); }
From source file:com.skysql.manager.ui.WarningWindow.java
License:Open Source License
/** * Instantiates a new warning window./*from w w w .j a v a 2s. c om*/ * * @param caption the caption * @param message the message * @param label the label * @param okListener the ok listener */ public WarningWindow(String caption, String message, String label, Button.ClickListener okListener) { super(caption, "60%"); HorizontalLayout wrapper = new HorizontalLayout(); wrapper.setWidth("100%"); wrapper.setMargin(true); VerticalLayout iconLayout = new VerticalLayout(); iconLayout.setWidth("100px"); wrapper.addComponent(iconLayout); Embedded image = new Embedded(null, new ThemeResource("img/warning.png")); iconLayout.addComponent(image); VerticalLayout textLayout = new VerticalLayout(); textLayout.setSizeFull(); wrapper.addComponent(textLayout); wrapper.setExpandRatio(textLayout, 1.0f); Label msgLabel = new Label(message); msgLabel.addStyleName("warning"); textLayout.addComponent(msgLabel); textLayout.setComponentAlignment(msgLabel, Alignment.MIDDLE_CENTER); HorizontalLayout buttonsBar = new HorizontalLayout(); buttonsBar.setStyleName("buttonsBar"); buttonsBar.setSizeFull(); buttonsBar.setSpacing(true); buttonsBar.setMargin(true); buttonsBar.setHeight("49px"); Label filler = new Label(); buttonsBar.addComponent(filler); buttonsBar.setExpandRatio(filler, 1.0f); Button cancelButton = new Button("Cancel"); buttonsBar.addComponent(cancelButton); buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(Button.ClickEvent event) { warningWindow.close(); } }); Button okButton = new Button(label); okButton.addClickListener(okListener); buttonsBar.addComponent(okButton); buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT); VerticalLayout windowLayout = (VerticalLayout) this.getContent(); windowLayout.setSpacing(false); windowLayout.setMargin(false); windowLayout.addComponent(wrapper); windowLayout.addComponent(buttonsBar); }
From source file:com.squadd.UI.GroupChatLayout.java
private void configureLayout(Group group) { HorizontalLayout sendL = new HorizontalLayout(message, send); sendL.setWidth(Display.width * 0.68 + "px"); send.setSizeUndefined();//from w ww . j a v a 2s . c o m message.setWidth(0.61 * Display.width - send.getWidth() + "px"); sendL.setComponentAlignment(send, Alignment.MIDDLE_RIGHT); DBManager db = new DBManager(); List<GroupChat> jb = (ArrayList) db.getAllGroupMessages(group.getGroupId()); Collections.sort(jb, dateComparator); msg = new ArrayList<MessageLayout>(); for (int i = 0; i < jb.size(); ++i) { Label when = new Label(jb.get(i).getDate().toString()); Image photo = new ImageGetter().get(group); Label text = new Label(jb.get(i).getMessage()); msg.add(new MessageLayout(when, photo, text)); } for (int i = 0; i < msg.size(); ++i) { content.addComponent(msg.get(i)); } cont = new VerticalLayout(sendL, content); cont.setVisible(false); VerticalLayout all = new VerticalLayout(name, cont); addComponent(all); }
From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java
private void openComplaintWindow(Complaint complaint) { WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); Window window = new Window("Registro de Queja"); window.setModal(true);//ww w . jav a2 s. com if (webBrowser.getScreenWidth() < 1024) { window.setSizeFull(); } else { window.setHeight(90.0f, Unit.PERCENTAGE); window.setWidth(90.0f, Unit.PERCENTAGE); } // TextField nameField = new TextField(); // nameField.setInputPrompt("Introduzca el ttulo de la queja"); // nameField.setWidth("100%"); TextArea notesArea = new TextArea(); notesArea.setInputPrompt("Introduzca el contenido de la queja"); notesArea.setSizeFull(); // CheckBox doneField = new CheckBox("Atendido"); HorizontalLayout horizontal = new HorizontalLayout(); horizontal.setSpacing(true); horizontal.addComponent(createDeleteButton(window)); horizontal.addComponent(createOkButton(window)); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.addComponent(complaintType); layout.addComponent(notesArea); // layout.addComponent(doneField); layout.addComponent(horizontal); layout.setComponentAlignment(horizontal, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(complaintType, 1); layout.setExpandRatio(notesArea, 8); // layout.setExpandRatio(doneField, 1); layout.setExpandRatio(horizontal, 1); BeanItem beanItem = new BeanItem<>(complaint); fieldGroup = new BeanFieldGroup<>(Complaint.class); fieldGroup.setItemDataSource(beanItem); fieldGroup.bind(complaintType, "complaintType"); fieldGroup.bind(notesArea, "notes"); // fieldGroup.bind(doneField, "done"); window.setContent(layout); getUI().addWindow(window); // Window windowComplaint = new Window(complaintView); // WidgetActions actions = new WidgetActions(){ // // @Override // public void saveAction() { // refreshBind(); // windowComplaint.close(); // } // // @Override // public void deleteAction() { // appointment.getComplaints().remove(complaint); // refreshBind(); // windowComplaint.close(); // } // // }; // complaintView.bind(complaint); // complaintView.setActions(actions); // getUI().addWindow(windowComplaint); }
From source file:com.toptal.ui.view.MainView.java
License:Open Source License
/** * Generates a header for main view.//from w w w . jav a2 s. c o m * @return Header. */ private HorizontalLayout header() { final User user = SecurityUtils.actualUser(); final Label info = new Label( String.format("<h3>Welcome, %s. You are %s.</h3>", user.getName(), user.getRole().text()), ContentMode.HTML); final Button logout = new MButton(FontAwesome.SIGN_OUT, e -> this.getUi().getAuth().logout()); return new MHorizontalLayout(info, logout).withAlign(info, Alignment.MIDDLE_LEFT) .withAlign(logout, Alignment.MIDDLE_RIGHT).withFullWidth(); }
From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DummyRegWithReCaptcha.java
License:Apache License
private void buildContent() { content.setMargin(true);/* w w w . j a v a 2 s .co m*/ content.addComponent(createForm()); content.addComponent(reCaptcha); Button reconfigBtn = createCancelBtn(); Button submitBtn = new Button("Register", this); submitBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER); submitBtn.addStyleName(Reindeer.BUTTON_DEFAULT); HorizontalLayout actionsLayout = new HorizontalLayout(submitBtn, reconfigBtn); actionsLayout.setSpacing(true); actionsLayout.setWidth(100, Unit.PERCENTAGE); actionsLayout.setComponentAlignment(reconfigBtn, Alignment.MIDDLE_RIGHT); content.addComponent(actionsLayout); }