List of usage examples for com.vaadin.ui Alignment TOP_CENTER
Alignment TOP_CENTER
To view the source code for com.vaadin.ui Alignment TOP_CENTER.
Click Source Link
From source file:ch.bfh.ti.soed.hs16.srs.yellow.views.MainView.java
License:Open Source License
public MainView() { setSizeFull();//from www . j a v a 2 s . c o m headerLayout = new HorizontalLayout(); date = new Date(); limitDate = Calendar.getInstance(); limitDate.setTime(date); limitDate.add(Calendar.YEAR, 1); lastDate = limitDate.getTime(); fromDate.setValue(date); fromDate.setRangeStart(date); fromDate.setRangeEnd(lastDate); fromDate.setImmediate(true); fromDate.setResolution(Resolution.MINUTE); toDate.setRangeStart(date); toDate.setRangeEnd(lastDate); toDate.setImmediate(true); toDate.setResolution(Resolution.MINUTE); objSelect.setSizeFull(); equipSelect.setSizeFull(); fromDate.setSizeFull(); toDate.setSizeFull(); searchBtn.setSizeFull(); signupBtn.addClickListener(e -> { navigationRoot.navigator.navigateTo(NavigationRoot.SIGNUPVIEW); }); loginBtn.addClickListener(e -> { navigationRoot.navigator.navigateTo(NavigationRoot.LOGINVIEW); }); searchBtn.addClickListener(evt -> { Notification.show("Sorry, search will be made later with Vaadin Grid."); }); loginLayout.addComponents(signupBtn, loginBtn); headerLayout.addComponent(titleLbl); leftVLayout.addComponents(fromDate, objSelect); leftVLayout.setSpacing(true); leftVLayout.setSizeFull(); rightVLayout.addComponents(toDate, equipSelect); rightVLayout.setSpacing(true); rightVLayout.setSizeFull(); inputLayout.addComponents(leftVLayout, rightVLayout); inputLayout.setSpacing(true); inputLayout.setSizeFull(); searchLayout.addComponents(headerLayout, inputLayout, searchBtn); searchLayout.setComponentAlignment(headerLayout, Alignment.TOP_CENTER); searchLayout.setMargin(true); searchLayout.setSpacing(true); searchLayout.setWidth(500, Sizeable.Unit.PIXELS); panelContent.addComponents(loginLayout, searchLayout); panelContent.setComponentAlignment(searchLayout, Alignment.MIDDLE_CENTER); panelContent.setComponentAlignment(loginLayout, Alignment.TOP_RIGHT); panel.setContent(panelContent); setCompositionRoot(panelContent); }
From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java
License:Apache License
@Override public void init() { iApplication = this; iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory(); //add theme// w ww. java 2s . c o m setTheme("sigpep"); //add main window Window lMainwindow = new Window("Sigpep Application"); setMainWindow(lMainwindow); lMainwindow.addStyleName("v-app-my"); //add notification component iNotifique = new Notifique(Boolean.FALSE); CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow()); getMainWindow().addComponent(lCustomOverlay); //add form help iFormHelp = new FormHelp(); iFormHelp.setFollowFocus(Boolean.TRUE); this.getMainWindow().getContent().addComponent(iFormHelp); //add panels iCenterLeft = new Panel(); iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT); iCenterLeft.setHeight("400px"); iCenterLeft.setWidth("100%"); iCenterRight = new Panel(); iCenterRight.addStyleName(Reindeer.PANEL_LIGHT); iCenterRight.setHeight("400px"); iCenterRight.setWidth("75%"); //add form tabs iFormTabSheet = new FormTabSheet(this); iCenterLeft.addComponent(iFormTabSheet); iBottomLayoutResults = new VerticalLayout(); if (PropertiesConfigurationHolder.showTestDemoFolder()) { Button lButton = new Button("load test data"); lButton.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { new BackgroundThread().run(); } }); iBottomLayoutResults.addComponent(lButton); } // Add the selector component iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this); iCenterRight.addComponent(iSelectionComponent); iHeaderLayout = new HorizontalLayout(); iHeaderLayout.setSizeFull(); iHeaderLayout.setHeight("100px"); iHeaderLayout.addStyleName("v-header"); VerticalLayout lVerticalLayout = new VerticalLayout(); GridLayout lGridLayout = new GridLayout(2, 1); lGridLayout.setSpacing(true); lGridLayout.setSizeFull(); lGridLayout.addComponent(iCenterLeft, 0, 0); lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT); lGridLayout.addComponent(iCenterRight, 1, 0); lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER); lVerticalLayout.addComponent(iHeaderLayout); lVerticalLayout.addComponent(lGridLayout); lVerticalLayout.addComponent(iBottomLayoutResults); lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER); lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER); lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER); lMainwindow.addComponent(lVerticalLayout); lMainwindow.addComponent(pusher); // Create a tracker for vaadin.com domain. String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain"); String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page"); GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName); lMainwindow.addComponent(tracker); tracker.trackPageview(lPageId); /** * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService */ Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler()); parseSessionId(); }
From source file:com.dungnv.streetfood.view.ArticleInsert.java
public final void init() { layout = new VerticalLayout(); layout.setSpacing(true);//w ww. ja v a 2 s . c om layout.setMargin(true); wizard = new Wizard(); wizard.setHeight("80%"); wizard.setUriFragmentEnabled(true); wizard.addListener(this); ((HorizontalLayout) wizard.getFinishButton().findAncestor(HorizontalLayout.class)) .setMargin(new MarginInfo(true, false, true, true)); if (Constants.ACTION.INSERT.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.article.insert")); } else if (Constants.ACTION.UPDATE.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.article.update")); } wizard.addStep(new SecondStep(), BundleUtils.getLanguage("lbl.language.update")); layout.addComponent(wizard); layout.setComponentAlignment(wizard, Alignment.TOP_CENTER); }
From source file:com.dungnv.streetfood.view.CategoryInsert.java
public final void init() { layout = new VerticalLayout(); layout.setSpacing(true);//from w w w . j a v a 2 s . c o m layout.setMargin(true); wizard = new Wizard(); wizard.setUriFragmentEnabled(true); wizard.addListener(this); ((HorizontalLayout) wizard.getFinishButton().findAncestor(HorizontalLayout.class)) .setMargin(new MarginInfo(true, false, true, true)); if (Constants.ACTION.INSERT.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.category.insert")); } else if (Constants.ACTION.UPDATE.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.category.update")); } wizard.addStep(new SecondStep(), "intro"); layout.addComponent(wizard); layout.setComponentAlignment(wizard, Alignment.TOP_CENTER); }
From source file:com.dungnv.streetfood.view.DishInsert.java
public final void init() { layout = new VerticalLayout(); layout.setSpacing(true);/*ww w .j a va2 s.com*/ layout.setMargin(true); wizard = new Wizard(); wizard.setHeight("80%"); wizard.setUriFragmentEnabled(true); wizard.addListener(this); ((HorizontalLayout) wizard.getFinishButton().findAncestor(HorizontalLayout.class)) .setMargin(new MarginInfo(true, false, true, true)); if (Constants.ACTION.INSERT.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.dish.insert")); } else if (Constants.ACTION.UPDATE.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.dish.update")); } wizard.addStep(new SecondStep(), "intro"); layout.addComponent(wizard); layout.setComponentAlignment(wizard, Alignment.TOP_CENTER); }
From source file:com.dungnv.streetfood.view.RestaurantInsert.java
public final void init() { layout = new VerticalLayout(); layout.setSpacing(true);//from w w w . j av a 2s . c om layout.setMargin(true); wizard = new Wizard(); wizard.setHeight("80%"); wizard.setUriFragmentEnabled(true); wizard.addListener(this); ((HorizontalLayout) wizard.getFinishButton().findAncestor(HorizontalLayout.class)) .setMargin(new MarginInfo(true, false, true, true)); if (Constants.ACTION.INSERT.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.restaurant.insert")); } else if (Constants.ACTION.UPDATE.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.restaurant.update")); } wizard.addStep(new SecondStep(), BundleUtils.getLanguage("lbl.language.update")); layout.addComponent(wizard); layout.setComponentAlignment(wizard, Alignment.TOP_CENTER); }
From source file:com.dungnv.streetfood.view.SlideShowInsert.java
public final void init() { layout = new VerticalLayout(); layout.setSpacing(true);//from ww w .j a v a 2s . com layout.setMargin(true); wizard = new Wizard(); wizard.setHeight("80%"); wizard.setUriFragmentEnabled(true); wizard.addListener(this); ((HorizontalLayout) wizard.getFinishButton().findAncestor(HorizontalLayout.class)) .setMargin(new MarginInfo(true, false, true, true)); if (Constants.ACTION.INSERT.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.slideShow.insert")); } else if (Constants.ACTION.UPDATE.equals(action)) { wizard.addStep(new IntroStep(), BundleUtils.getLanguage("lbl.slideShow.update")); } wizard.addStep(new SecondStep(), BundleUtils.getLanguage("lbl.language.update")); layout.addComponent(wizard); layout.setComponentAlignment(wizard, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false) .withWidth("100%").withStyleName("message"); MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px"); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); ClickListener gotoUser = new ClickListener() { private static final long serialVersionUID = 1L; @Override/*w ww .j av a 2 s .co m*/ public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser())); } }; Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(), comment.getOwnerFullName()); userAvatarBtn.addClickListener(gotoUser); userBlock.addComponent(userAvatarBtn); Button userName = new Button(comment.getOwnerFullName()); userName.setStyleName("user-name"); userName.addStyleName("link"); userName.addStyleName(UIConstants.WORD_WRAP); userName.addClickListener(gotoUser); userBlock.addComponent(userName); layout.addComponent(userBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true) .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label timePostLbl = new Label( AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())), ContentMode.HTML); timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.addComponent(timePostLbl); messageHeader.setExpandRatio(timePostLbl, 1.0f); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new UrlDetectableLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true) .withWidth("100%").withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.addComponent(attachmentDisplay); messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.addComponent(rowLayout); layout.setExpandRatio(rowLayout, 1.0f); return layout; }
From source file:com.esofthead.mycollab.community.module.project.view.client.ClientPresenter.java
License:Open Source License
@Override protected void onGo(ComponentContainer container, ScreenData<?> data) { ProjectModule prjContainer = (ProjectModule) container; prjContainer.removeAllComponents();/*from w w w . ja v a 2s .co m*/ prjContainer.with(view).withAlign(view, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.mobile.module.crm.view.CrmLoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);/*from www . ja va2s .com*/ contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); Label welcomeText = new Label("Login to CRM"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] { emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) })); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }