@Override public void enter(ViewChangeListener.ViewChangeEvent event) { if (!isLoggedIn()) { getUI().getNavigator().navigateTo(LoginView.VIEW_NAME); return; } addComponent(new HeadingLabel("会員名簿", VaadinIcons.BULLETS)); printAllMembers(); Button homeButton = new Button("会員メニュー", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME)); homeButton.setIcon(VaadinIcons.USER); addComponent(homeButton); setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER); }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { addComponent(new HeadingLabel("ログアウト確認", VaadinIcons.INFO_CIRCLE)); addComponent(new Label("ログアウトします。")); HorizontalLayout buttonArea = new HorizontalLayout(); buttonArea.setSpacing(true); addComponent(buttonArea); setComponentAlignment(buttonArea, Alignment.MIDDLE_CENTER); Button cancelButton = new Button("キャンセル", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME)); buttonArea.addComponent(cancelButton); Button logoutButton = new Button("ログアウト", click -> { membershipService.logout(); getUI().getNavigator().navigateTo(FrontView.VIEW_NAME); }); logoutButton.setIcon(VaadinIcons.SIGN_OUT); logoutButton.setStyleName(ValoTheme.BUTTON_PRIMARY); buttonArea.addComponent(logoutButton); }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { addComponent(new HeadingLabel("参加登録完了", VaadinIcons.CHECK)); addComponent(new Label("参加登録が完了し、確認メールを送信しました。")); Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。"); addressLabel.setCaption("お願い"); addressLabel.setIcon(VaadinIcons.LIGHTBULB); addComponent(addressLabel); Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME)); homeButton.setIcon(VaadinIcons.HOME); addComponent(homeButton); setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER); }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { addComponent(new HeadingLabel("パスワードリセット要求送信完了", VaadinIcons.INFO_CIRCLE)); addComponent(new Label("入力された E-mail アドレスへパスワードリセットの案内メールを送信しました。")); Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。"); addressLabel.setCaption("お願い"); addressLabel.setIcon(VaadinIcons.LIGHTBULB); addComponent(addressLabel); Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME)); homeButton.setIcon(VaadinIcons.HOME); addComponent(homeButton); setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER); }
@Override protected void buildActions(HorizontalLayout actionsContainer) { actionsContainer.setSpacing(true); // yes final Button btnYes = Components.button().styleName(ValoTheme.BUTTON_PRIMARY) .caption(Localizable.builder().message(DEFAULT_YES_BUTTON_MESSAGE) .messageCode(DEFAULT_YES_BUTTON_MESSAGE_CODE).build()) .onClick(e -> onDialogYesButtonClick(e.getButton())).build(); getYesButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnYes))); actionsContainer.addComponent(btnYes); actionsContainer.setComponentAlignment(btnYes, Alignment.MIDDLE_LEFT); if (getWidth() > -1) { btnYes.setWidth("100%"); } // no final Button btnNo = Components.button() .caption(Localizable.builder().message(DEFAULT_NO_BUTTON_MESSAGE) .messageCode(DEFAULT_NO_BUTTON_MESSAGE_CODE).build()) .onClick(e -> onDialogNoButtonClick(e.getButton())).build(); getNoButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnNo))); actionsContainer.addComponent(btnNo); actionsContainer.setComponentAlignment(btnNo, Alignment.MIDDLE_RIGHT); if (getWidth() > -1) { btnNo.setWidth("100%"); } }
/** * Rafraichi le panel de connexion sans compte */ private void refreshConnexionPanelStudent() { vlConnexionIsStudent.removeAllComponents(); OneClickButton logBtn = new OneClickButton( applicationContext.getMessage("btnConnect", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT); logBtn.addClickListener(e -> { userController.connectCAS(); }); HorizontalLayout hlConnect = new HorizontalLayout(); hlConnect.setSpacing(true); Label labelConnect = new Label( applicationContext.getMessage("accueilView.connect.cas", null, UI.getCurrent().getLocale())); hlConnect.addComponent(labelConnect); hlConnect.setComponentAlignment(labelConnect, Alignment.MIDDLE_LEFT); hlConnect.addComponent(logBtn); hlConnect.setComponentAlignment(logBtn, Alignment.MIDDLE_CENTER); vlConnexionIsStudent.addComponent(hlConnect); }
private void getVarLayout(String title, List<String> liste, HorizontalLayout hlContent){ if (liste==null || liste.size()==0){ return; } VerticalLayout vl = new VerticalLayout(); if (title!=null){ Label labelTitle = new Label(title); vl.addComponent(labelTitle); vl.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER); } StringBuilder txt = new StringBuilder("<ul>"); liste.forEach(e->txt.append("<li><input type='text' value='${"+e+"}'></li>")); txt.append("</ul>"); Label labelSearch = new Label(txt.toString(),ContentMode.HTML); vl.addComponent(labelSearch); hlContent.addComponent(vl); }
/** Ajoute des boutons de navigation * @param previousView * @param nextView */ public void setNavigationButton(String previousView, String nextView){ if (previousView!=null){ OneClickButton btnPrevious = new OneClickButton(applicationContext.getMessage("btnPrevious", null, UI.getCurrent().getLocale()),FontAwesome.ARROW_CIRCLE_O_LEFT); btnPrevious.addClickListener(e->uiController.navigateTo(previousView)); titleLayout.addComponent(btnPrevious); titleLayout.setComponentAlignment(btnPrevious, Alignment.MIDDLE_LEFT); } if (nextView!=null){ OneClickButton btnNext = new OneClickButton(applicationContext.getMessage("btnNext", null, UI.getCurrent().getLocale()),FontAwesome.ARROW_CIRCLE_O_RIGHT); btnNext.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT); btnNext.addClickListener(e->uiController.navigateTo(nextView)); titleLayout.addComponent(btnNext); titleLayout.setComponentAlignment(btnNext, Alignment.MIDDLE_RIGHT); } }
/** * @param txtCode * @return une ligne de légende */ private HorizontalLayout getLegendLineLayout(String txtCode) { HorizontalLayout hlLineLegend = new HorizontalLayout(); hlLineLegend.setWidth(100, Unit.PERCENTAGE); hlLineLegend.setSpacing(true); Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png")); Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null, UI.getCurrent().getLocale())); hlLineLegend.addComponent(flagImg); hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT); hlLineLegend.addComponent(label); hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT); hlLineLegend.setExpandRatio(label, 1); return hlLineLegend; }
/** * ajoute la mention CNIL */ private void addMentionCnil() { panelCnil.setWidth(100, Unit.PERCENTAGE); panelCnil.setHeight(100, Unit.PIXELS); addComponent(panelCnil); setComponentAlignment(panelCnil, Alignment.BOTTOM_LEFT); VerticalLayout vlContentLabelCnil = new VerticalLayout(); vlContentLabelCnil.setSizeUndefined(); vlContentLabelCnil.setWidth(100, Unit.PERCENTAGE); vlContentLabelCnil.setMargin(true); labelCnil.setContentMode(ContentMode.HTML); labelCnil.addStyleName(ValoTheme.LABEL_TINY); labelCnil.addStyleName(StyleConstants.LABEL_JUSTIFY); labelCnil.addStyleName(StyleConstants.LABEL_SAUT_LIGNE); vlContentLabelCnil.addComponent(labelCnil); panelCnil.setContent(vlContentLabelCnil); }
/** * Create a new vertical stepper using the given iterator and label change handler. * * @param stepIterator * The iterator that handles the iteration over the given steps * @param labelProvider * The handler that handles changes to labels */ private VerticalStepper(StepIterator stepIterator, LabelProvider labelProvider) { super(stepIterator, labelProvider); addStepperCompleteListener(this); getStepIterator().addElementAddListener(this); getStepIterator().addElementRemoveListener(this); this.rowMap = new HashMap<>(); this.rootLayout = new VerticalLayout(); this.rootLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); this.rootLayout.setSizeFull(); this.rootLayout.setMargin(false); this.rootLayout.setSpacing(false); setCompositionRoot(rootLayout); addStyleName(STYLE_ROOT_LAYOUT); setSizeFull(); refreshLayout(); }
@Override protected void init(VaadinRequest request) { rootLayout = getRootLayout(); setContent(rootLayout); Label title = getTitleLabel(); StepperPropertiesLayout layout = new StepperPropertiesLayout(); layout.addStepperCreateListener(this); layout.setWidth(300, Unit.PIXELS); Spacer spacer = new Spacer(); spacer.setWidth(100, Unit.PIXELS); rootLayout.addComponent(title, 0, 0, 2, 0); rootLayout.addComponent(spacer, 1, 1); rootLayout.addComponent(layout, 0, 1); rootLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER); layout.start(); }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { Label errorLabel = new Label("エラーが発生しました。"); errorLabel.setStyleName(ValoTheme.LABEL_FAILURE); VaadinSession session = VaadinSession.getCurrent(); String paramMessage = (String) session.getAttribute(PARAM_MESSAGE); if (paramMessage != null) { addComponent(new Label(paramMessage)); } session.setAttribute(PARAM_MESSAGE, null); Throwable paramThrowable = (Throwable) session.getAttribute(PARAM_THROWABLE); if (paramThrowable != null) { addComponent(new Label(throwable2html(paramThrowable), ContentMode.HTML)); } session.setAttribute(PARAM_THROWABLE, null); log.error(paramMessage, paramThrowable); if (paramThrowable instanceof AuthenticationException) { Button loginButton = new Button("ログイン", click -> getUI().getNavigator().navigateTo(LoginView.VIEW_NAME)); addComponent(loginButton); setComponentAlignment(loginButton, Alignment.MIDDLE_CENTER); } Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME)); addComponent(homeButton); setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER); }
@Override public B addAlignAndExpand(Component component, Alignment alignment, float expandRatio) { getInstance().addComponent(component); getInstance().setComponentAlignment(component, alignment); getInstance().setExpandRatio(component, expandRatio); return builder(); }
@Override public com.holonplatform.vaadin.components.builders.OrderedLayoutConfigurator.BaseOrderedLayoutConfigurator addAlignAndExpand( Component component, Alignment alignment, float expandRatio) { getInstance().addComponent(component); getInstance().setComponentAlignment(component, alignment); getInstance().setExpandRatio(component, expandRatio); return builder(); }
private void addDataGrid() { Grid<app.Event> grid = dataGrid.get(); grid.setWidth("100%"); HorizontalLayout bottomLayout = new HorizontalLayout(); bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); bottomLayout.addComponent(grid); bottomLayout.setWidth("100%"); addComponent(bottomLayout); }
private void addDataGrid() { grid = streamDataGrid.get(); grid.setWidth("100%"); HorizontalLayout bottomLayout = new HorizontalLayout(); bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); bottomLayout.addComponent(grid); bottomLayout.setWidth("100%"); addComponent(bottomLayout); }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatAdresseView.NAME, (parametreController.getIsGetCursusInterne()?CandidatCursusInterneView.NAME:CandidatCursusExterneView.NAME)); /*Edition des donneés*/ OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnSaisir", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL); btnEdit.addClickListener(e -> { candidatParcoursController.editBac(candidat, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel = new Label(applicationContext.getMessage("infobac.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*Table de présentation*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER_BAC); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
/** ajoute une option alignée au layout d'options * @param c le composant */ protected void addOption(Component c, Alignment align, Float expendRatio){ infoSuppLayout.addComponent(c); infoSuppLayout.setComponentAlignment(c, align); if (!infoSuppLayout.isVisible()){ infoSuppLayout.setVisible(true); } if (expendRatio!=null){ infoSuppLayout.setExpandRatio(c, expendRatio); } center(); }
/** * @param btn * @return le layout de bouton conditionnel */ private HorizontalLayout getLayoutBtnConditionnel(final OneClickButton btn) { btn.addStyleName(ValoTheme.BUTTON_TINY); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); layout.addComponent(btn); layout.setComponentAlignment(btn, Alignment.MIDDLE_CENTER); return layout; }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatInfoPersoView.NAME, CandidatBacView.NAME); /*Edition des donneés d'adresse*/ OneClickButton btnEdit = new OneClickButton(FontAwesome.PENCIL); btnEdit.setCaption(applicationContext.getMessage("adresse.edit.btn", null, UI.getCurrent().getLocale())); btnEdit.addClickListener(e -> { candidatController.editAdresse(cptMin, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel.setValue(applicationContext.getMessage("adresse.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*L'adresse*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
public LocalDateTimeField() { dateField = new DateField(); dateField.addValueChangeListener(e->showOrHideErrorDateField()); hourNs = new NativeSelect(); hourNs.addValueChangeListener(e->fireValueChange(false)); minuteNs = new NativeSelect(); minuteNs.addValueChangeListener(e->fireValueChange(false)); hlContent = new HorizontalLayout(); //hlContent.setSizeFull(); hlContent.setSpacing(true); dateField.setImmediate(true); hlContent.addComponent(dateField); for (Integer i = 0; i<24; i++){ hourNs.addItem(i); hourNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i)); } hourNs.setNullSelectionAllowed(false); hourNs.setImmediate(true); hourNs.setValue(0); for (Integer i = 0; i<60; i++){ minuteNs.addItem(i); minuteNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i)); } minuteNs.setNullSelectionAllowed(false); minuteNs.setImmediate(true); minuteNs.setValue(0); hlContent.addComponent(hourNs); hlContent.setComponentAlignment(hourNs, Alignment.MIDDLE_LEFT); Label label1 = new Label(":"); hlContent.addComponent(label1); hlContent.setComponentAlignment(label1, Alignment.MIDDLE_LEFT); hlContent.addComponent(minuteNs); hlContent.setComponentAlignment(minuteNs, Alignment.MIDDLE_LEFT); Label label2 = new Label("(HH:MM)"); hlContent.addComponent(label2); hlContent.setComponentAlignment(label2, Alignment.MIDDLE_LEFT); }
public LocalTimeField() { hourNs = new NativeSelect(); minuteNs = new NativeSelect(); hlContent = new HorizontalLayout(); //hlContent.setSizeFull(); hlContent.setSpacing(true); for (Integer i = 0; i<24; i++){ hourNs.addItem(i); hourNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i)); } hourNs.setNullSelectionAllowed(false); hourNs.setImmediate(true); for (Integer i = 0; i<60; i++){ minuteNs.addItem(i); minuteNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i)); } minuteNs.setNullSelectionAllowed(false); minuteNs.setImmediate(true); hlContent.addComponent(hourNs); hlContent.setComponentAlignment(hourNs, Alignment.MIDDLE_LEFT); Label label1 = new Label(":"); hlContent.addComponent(label1); hlContent.setComponentAlignment(label1, Alignment.MIDDLE_LEFT); hlContent.addComponent(minuteNs); hlContent.setComponentAlignment(minuteNs, Alignment.MIDDLE_LEFT); Label label2 = new Label("(HH:MM)"); hlContent.addComponent(label2); hlContent.setComponentAlignment(label2, Alignment.MIDDLE_LEFT); }
public OnDemandFileLayout(String fileName){ setSpacing(true); setWidth(100, Unit.PERCENTAGE); addStyleName(StyleConstants.ON_DEMAND_FILE_LAYOUT); btnDel.setDescription(applicationContext.getMessage("file.btnDel", null, UI.getCurrent().getLocale())); btnDel.setVisible(false); addComponent(btnDel); setComponentAlignment(btnDel, Alignment.MIDDLE_CENTER); btnViewer.setDescription(applicationContext.getMessage("img.viewer.btn", null, UI.getCurrent().getLocale())); btnViewer.setVisible(false); addComponent(btnViewer); setComponentAlignment(btnViewer, Alignment.MIDDLE_CENTER); btnDownload.setDescription(applicationContext.getMessage("file.btnDownload", null, UI.getCurrent().getLocale())); btnDownload.setVisible(false); addComponent(btnDownload); setComponentAlignment(btnDownload, Alignment.MIDDLE_CENTER); btnAdmin.setDescription(applicationContext.getMessage("pj.admin.btn", null, UI.getCurrent().getLocale())); btnAdmin.setVisible(false); addComponent(btnAdmin); setComponentAlignment(btnAdmin, Alignment.MIDDLE_CENTER); Label label = new Label(fileName); addComponent(label); setComponentAlignment(label, Alignment.MIDDLE_LEFT); setExpandRatio(label, 1.0f); }
/** * @param caption * Caption Text Representing Header * @param guid * Help GUID for caller view * @return * Horizontal Layout containing Caption text and Help button */ public static HorizontalLayout createSubHeader(String caption, String guid) { HorizontalLayout subHeader = new HorizontalLayout(); subHeader.setWidth("100%"); subHeader.setHeight("35px"); subHeader.setSpacing(true); subHeader.addStyleName("toolbar"); final Label title = new Label(caption); title.setSizeUndefined(); subHeader.addComponent(title); subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT); subHeader.setExpandRatio(title, 1); // create help button if we have some GUID else do not add this button if (guid != null) { Button helpButton = new Button(); helpButton.setImmediate(true); helpButton.setStyleName(Reindeer.BUTTON_LINK); helpButton.setDescription("Help"); helpButton.setIcon(new ThemeResource("img/Help.png")); subHeader.addComponent(helpButton); helpButton.addClickListener(new HelpButtonListener(guid)); } return subHeader; }
public ProgressIndicatorWindow() { center(); setVisible(true); setResizable(false); setDraggable(false); setImmediate(true); setModal(true); setClosable(false); setCaption("Loading"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setWidth("100%"); this.currentStatus = new Label(); this.currentStatus.addStyleName(StyleConstants.TEXT_ALIGN_CENTER); this.currentStatus.setSizeFull(); this.currentStatus.setImmediate(true); ProgressBar progressBar = new ProgressBar(); progressBar.setSizeFull(); progressBar.setIndeterminate(true); progressBar.setImmediate(true); progressBar.setVisible(true); layout.addComponent(progressBar); layout.addComponent(this.currentStatus); layout.setComponentAlignment(this.currentStatus, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); setContent(layout); }
public void showTransitionMessage(String message) { if (rootLayout.getComponent(1, 0) != null) { rootLayout.removeComponent(1, 0); } if (rootLayout.getComponent(0, 0) != null) { rootLayout.removeComponent(0, 0); } label.setCaptionVisible(message == null); label.setDescriptionVisible(message == null); if (message != null) { Label feedbackLabel = new Label(message); feedbackLabel.addStyleName(STYLE_FEEDBACK_MESSAGE); feedbackLabel.setWidth(100, Unit.PERCENTAGE); rootLayout.addComponent(label, 0, 0); rootLayout.addComponent(feedbackLabel, 1, 0); rootLayout.setComponentAlignment(feedbackLabel, Alignment.MIDDLE_LEFT); contentContainer.setContent(new CenteredLayout(new Spinner())); buttonBar.forEach(c -> c.setVisible(false)); } else { rootLayout.addComponent(label, 0, 0, 1, 0); contentContainer.setContent(step); } }
private GridLayout getRootLayout() { GridLayout layout = new GridLayout(3, 2); layout.setDefaultComponentAlignment(Alignment.TOP_LEFT); layout.setMargin(new MarginInfo(false, true, true, true)); layout.setSpacing(true); layout.setSizeFull(); layout.setRowExpandRatio(1, 1); layout.setColumnExpandRatio(2, 1); return layout; }
@Override protected void init(VaadinRequest request) { setSizeFull(); user = new TextField("User:"); user.setWidth("300px"); user.setRequiredIndicatorVisible(true); password = new PasswordField("Password:"); password.setWidth("300px"); user.setRequiredIndicatorVisible(true); password.setValue(""); VerticalLayout fields = new VerticalLayout(user, password, loginButton); fields.setCaption("Please login to access the application"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, false)); fields.setSizeUndefined(); VerticalLayout uiLayout = new VerticalLayout(fields); uiLayout.setSizeFull(); uiLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); setFocusedComponent(user); setContent(uiLayout); }
@Override public B defaultAlignment(Alignment alignment) { getInstance().setDefaultComponentAlignment(alignment); return builder(); }
@Override public B align(Component component, Alignment alignment) { getInstance().setComponentAlignment(component, alignment); return builder(); }
@Override public B addAndAlign(Component component, Alignment alignment) { getInstance().addComponent(component); getInstance().setComponentAlignment(component, alignment); return builder(); }
private void setupLayout() { setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); }
private void addHeaderAndButtons() { HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("80%"); Label header = new Label("Message Console"); header.addStyleName(ValoTheme.LABEL_H2); Button showButton = new Button(""); showButton.setCaption("Show"); showButton.addStyleName(ValoTheme.BUTTON_PRIMARY); // showButton.setIcon(VaadinIcons.PLUS_CIRCLE); showButton.addClickListener(click -> { System.out.println("[x] Show button clicked ..."); dataGrid.setItems(); }); Button sendButton = new Button(""); sendButton.setCaption("Send"); sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY); sendButton.setIcon(VaadinIcons.PLUS); sendButton.addClickListener(click -> { System.out.println("[x] Send button clicked ..."); Runnable runner = new Runnable() { @Override public void run() { sender.send(); } }; new Thread(runner).start(); }); topLayout.addComponent(header); topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER); topLayout.addComponent(showButton); topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER); topLayout.addComponent(sendButton); topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER); addComponent(topLayout); }