private Component createProfileEditorInvite() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); if (!SettingsManager.get().isSettingsEditorEnabled()) { layout.addComponent( new Label("No connection profiles defined and you are not allowed to create one.")); } else { Button createProfileLink = new Button( "Create profile", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addProfile(); } }); createProfileLink.setStyleName(ValoTheme.BUTTON_LINK); Label line1 = new Label("No connection profiles defined."); line1.setSizeUndefined(); VerticalLayout inner = new VerticalLayout(); inner.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); inner.addComponents(line1, createProfileLink); layout.addComponents(inner); } return layout; }
private void initLayout() { FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined(); loginForm.addComponent(userName = new TextField("Username")); loginForm.addComponent(passwordField = new PasswordField("Password")); loginForm.addComponent(login = new Button("Login")); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeUndefined(); loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(rootLayout); setSizeFull(); }
private void buildMainLayout() { // setMainWindow(new Window("Address Book Demo application")); MyApplication.debug(3, "buildMainLayout"); // getWindow().setName("FirstPage!"); layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(createToolbar()); layout.addComponent(horizontalSplit); /* Allocate all available extra space to the horizontal split panel */ layout.setExpandRatio(horizontalSplit, 1); /* Set the initial split position so we can have a 200 pixel menu to the left */ horizontalSplit.setSplitPosition(200, SplitPanel.UNITS_PIXELS); MyApplication.debug(3, "buildMainLayout 2"); try { if (layout != null) { getWindow().setLayout(layout); MyApplication.debug(3, "buildMainLayout end"); } } catch (Exception e) { e.printStackTrace(); } }
private Component buildPreferencesTab() { VerticalLayout root = new VerticalLayout(); root.setCaption("Preferences"); root.setIcon(FontAwesome.COGS); root.setSpacing(true); root.setMargin(true); root.setSizeFull(); Label message = new Label("Not implemented in this demo"); message.setSizeUndefined(); message.addStyleName(ValoTheme.LABEL_LIGHT); root.addComponent(message); root.setComponentAlignment(message, Alignment.MIDDLE_CENTER); return root; }
public MainScreen() { Label loginLabel = new Label("Welcome " + VaadinSession.getCurrent().getAttribute(String.class)); HorizontalLayout menuBar = new HorizontalLayout(loginLabel); MessageTable table = new MessageTable(); TextArea messageArea = new TextArea(); messageArea.setWidth(100, PERCENTAGE); Button sendButton = new Button("Send"); sendButton.addClickListener(new SendMessageClickListener(table, messageArea)); HorizontalLayout lowerBar = new HorizontalLayout(messageArea, sendButton); lowerBar.setWidth(100, PERCENTAGE); lowerBar.setSpacing(true); VerticalLayout mainLayout = new VerticalLayout(menuBar, table, lowerBar); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setSizeFull(); setCompositionRoot(mainLayout); }
public DashboardView() { activities = getActivities(); addStyleName(ValoTheme.PANEL_BORDERLESS); setSizeFull(); DashboardEventBus.register(this); root = new VerticalLayout(); root.setSizeFull(); root.setMargin(true); root.addStyleName("dashboard-view"); setContent(root); Responsive.makeResponsive(root); root.addComponent(buildSparkCards()); Component content = buildContent(); root.addComponent(content); root.setExpandRatio(content, 1); }
private Component createConnectionSelectorLayout() { final ProfileInfoPanelHolder infoPanelHolder = new ProfileInfoPanelHolder(); profileSelector = createProfileSelector(infoPanelHolder); HorizontalLayout content = new HorizontalLayout(profileSelector, infoPanelHolder); content.setSizeFull(); content.setExpandRatio(infoPanelHolder, 1); Component buttons = createConnectionButtons(infoPanelHolder); Component profileManagerToolbar = createProfileManagerToolbar(profileSelector); HorizontalLayout footer = new HorizontalLayout(profileManagerToolbar, buttons); footer.setWidth("100%"); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); VerticalLayout layout = new VerticalLayout(content, footer); layout.setSizeFull(); layout.setExpandRatio(content, 1); return layout; }
private ProfilePreferencesWindow(final User user, final boolean preferencesTabOpen) { addStyleName("profile-window"); setId(ID); Responsive.makeResponsive(this); setModal(true); setCloseShortcut(KeyCode.ESCAPE, null); setResizable(false); setClosable(false); setHeight(90.0f, Unit.PERCENTAGE); setWidth(60.0f, Unit.PERCENTAGE); VerticalLayout content = new VerticalLayout(); content.setSizeFull(); content.setMargin(new MarginInfo(true, false, false, false)); setContent(content); TabSheet detailsWrapper = new TabSheet(); detailsWrapper.setSizeFull(); detailsWrapper.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); detailsWrapper.addStyleName(ValoTheme.TABSHEET_ICONS_ON_TOP); detailsWrapper.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); content.addComponent(detailsWrapper); content.setExpandRatio(detailsWrapper, 1f); detailsWrapper.addComponent(buildProfileTab()); detailsWrapper.addComponent(buildPreferencesTab()); if (preferencesTabOpen) { detailsWrapper.setSelectedTab(1); } content.addComponent(buildFooter()); fieldGroup = new BeanFieldGroup<>(User.class); fieldGroup.bindMemberFields(this); fieldGroup.setItemDataSource(user); }
/** @param el */ public BookImage(Books el, String user) { super(); this.Book = el; this.setStyleName("cells"); this.setHeight("250px"); this.setWidth("200px"); rating.setAnimated(true); rating.setCaption(null); rating.setMaxValue(5); rating.setStyleName("rating"); rating.setReadOnly(true); rating_my.setAnimated(true); rating_my.setCaption(null); rating_my.setMaxValue(5); rating_my.setStyleName("rating_my"); IRaitingService iRaitingService = new IRaitingService(); try { double rate = iRaitingService.getRaiting(el.getId()); rating.setReadOnly(false); rating.setValue(rate); rating.setReadOnly(true); double myrate = iRaitingService.getRaiting(user, el.getId()); rating_my.setValue(myrate); } catch (SQLException e) { e.printStackTrace(); } rating_my.addValueChangeListener( e -> { try { Rating rat = iRaitingService.getUser( getUI().getSession().getAttribute("user").toString(), el.getId()); rat.setRaiting(rating_my.getValue()); iRaitingService.update(rat); double rate = iRaitingService.getRaiting(el.getId()); rating.setReadOnly(false); rating.setValue(rate); rating.setReadOnly(true); new Notification(String.valueOf(rate), Notification.Type.TRAY_NOTIFICATION) .show(Page.getCurrent()); } catch (SQLException e1) { e1.printStackTrace(); } }); rating_layout.addComponent(rating); rating_layout.addComponent(rating_my); rating_layout.setComponentAlignment(rating, Alignment.MIDDLE_LEFT); rating_layout.setComponentAlignment(rating_my, Alignment.MIDDLE_LEFT); rating_layout.setStyleName("ratinglayout"); imageEmbedded.setSource(new FileResource(new File(Book.getImage()))); title.setValue(Book.getTitle()); author.setValue(Book.getAuthor()); if (Book.getFile().isEmpty()) buttonDownload.setEnabled(false); buttonDownload.setWidth("80%"); imageEmbedded.setWidth("100%"); imageEmbedded.setHeight("100%"); title.setWidth(null); author.setWidth(null); VerticalLayout bodyLayout = new VerticalLayout(title, author, imageEmbedded); bodyLayout.setExpandRatio(title, 12); bodyLayout.setExpandRatio(author, 8); bodyLayout.setExpandRatio(imageEmbedded, 80); bodyLayout.setSizeFull(); bodyLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER); bodyLayout.setComponentAlignment(author, Alignment.MIDDLE_CENTER); bodyLayout.setComponentAlignment(imageEmbedded, Alignment.MIDDLE_CENTER); buttonDownload.setStyleName("super-button"); title.setStyleName("name-label"); author.setStyleName("author-label"); this.addComponent(rating_layout); this.addComponent(bodyLayout); this.addComponent(buttonDownload); this.setComponentAlignment(rating_layout, Alignment.TOP_CENTER); this.setComponentAlignment(bodyLayout, Alignment.TOP_CENTER); this.setComponentAlignment(buttonDownload, Alignment.BOTTOM_CENTER); this.setExpandRatio(rating_layout, 5); this.setExpandRatio(bodyLayout, 85); this.setExpandRatio(buttonDownload, 10); StreamResource sr = getStream(); FileDownloader fileDownloader = new FileDownloader(sr); fileDownloader.extend(buttonDownload); bodyLayout.addLayoutClickListener( e -> { BookWin win = new BookWin(this.Book); UI.getCurrent().addWindow(win); }); }