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:com.mycollab.vaadin.ui.DateSelectionField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout().with(cboMonth, cboDate, cboYear); layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); return layout; }
From source file:com.mycollab.vaadin.web.ui.StyleCalendarExp.java
License:Open Source License
public StyleCalendarExp() { this.setWidth("230px"); this.setHeightUndefined(); this.setSpacing(false); this.setStyleName("stylecalendar-ext"); this.setMargin(new MarginInfo(true, false, false, false)); styleCalendar.setRenderHeader(false); styleCalendar.setRenderWeekNumbers(false); styleCalendar.setImmediate(true);/* w w w .j a v a 2 s . com*/ styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_next.png"))); btnShowNextYear.setStyleName(WebThemes.BUTTON_LINK); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_next.png"))); btnShowNextMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_pre.png"))); btnShowPreviousMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_pre.png"))); btnShowPreviousYear.setStyleName(WebThemes.BUTTON_LINK); lbSelectedDate.setValue(UserUIContext.formatDate(new Date())); lbSelectedDate.addStyleName("calendarDateLabel"); lbSelectedDate.setWidth("80"); HorizontalLayout layoutControl = new HorizontalLayout(); layoutControl.setStyleName("calendarHeader"); layoutControl.setWidth("100%"); layoutControl.setHeight("35px"); HorizontalLayout layoutButtonPrevious = new HorizontalLayout(); layoutButtonPrevious.setSpacing(true); layoutButtonPrevious.addComponent(btnShowPreviousYear); layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT); layoutButtonPrevious.addComponent(btnShowPreviousMonth); layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT); layoutControl.addComponent(layoutButtonPrevious); layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT); layoutControl.addComponent(lbSelectedDate); layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER); MHorizontalLayout layoutButtonNext = new MHorizontalLayout(); layoutButtonNext.addComponent(btnShowNextMonth); layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT); layoutButtonNext.addComponent(btnShowNextYear); layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT); layoutControl.addComponent(layoutButtonNext); layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT); this.addComponent(layoutControl); this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER); this.addComponent(styleCalendar); this.setExpandRatio(styleCalendar, 1.0f); }
From source file:com.mycollab.vaadin.web.ui.table.CustomizedTableWindow.java
License:Open Source License
public CustomizedTableWindow(final String viewId, final AbstractPagedBeanTable<?, ?> table) { super(UserUIContext.getMessage(GenericI18Enum.OPT_CUSTOMIZE_VIEW)); this.viewId = viewId; this.withWidth("400px").withModal(true).withResizable(false).withCenter(); this.tableItem = table; customViewStoreService = AppContextUtil.getSpringBean(CustomViewStoreService.class); final MVerticalLayout contentLayout = new MVerticalLayout(); this.setContent(contentLayout); listBuilder = new ListBuilder(); listBuilder.setImmediate(true);//from w w w. j a v a 2 s . com listBuilder.setColumns(0); listBuilder.setLeftColumnCaption(UserUIContext.getMessage(GenericI18Enum.OPT_AVAILABLE_COLUMNS)); listBuilder.setRightColumnCaption(UserUIContext.getMessage(GenericI18Enum.OPT_VIEW_COLUMNS)); listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE); listBuilder.setItemCaptionMode(ItemCaptionMode.EXPLICIT); final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class, this.getAvailableColumns()); listBuilder.setContainerDataSource(container); Iterator<TableViewField> iterator = getAvailableColumns().iterator(); while (iterator.hasNext()) { TableViewField field = iterator.next(); listBuilder.setItemCaption(field, UserUIContext.getMessage(field.getDescKey())); } this.setSelectedViewColumns(); contentLayout.with(listBuilder).withAlign(listBuilder, Alignment.TOP_CENTER); MButton restoreLink = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> { List<TableViewField> defaultSelectedColumns = tableItem.getDefaultSelectedColumns(); if (defaultSelectedColumns != null) { final List<TableViewField> selectedColumns = new ArrayList<>(); final Collection<TableViewField> itemIds = container.getItemIds(); for (TableViewField column : defaultSelectedColumns) { for (final TableViewField viewField : itemIds) { if (column.getField().equals(viewField.getField())) { selectedColumns.add(viewField); } } } listBuilder.setValue(selectedColumns); } }).withStyleName(WebThemes.BUTTON_LINK); contentLayout.with(restoreLink).withAlign(restoreLink, Alignment.TOP_RIGHT); final MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { List<TableViewField> selectedColumns = (List<TableViewField>) listBuilder.getValue(); table.setDisplayColumns(selectedColumns); // Save custom table view def CustomViewStore viewDef = new CustomViewStore(); viewDef.setSaccountid(MyCollabUI.getAccountId()); viewDef.setCreateduser(UserUIContext.getUsername()); viewDef.setViewid(viewId); viewDef.setViewinfo(FieldDefAnalyzer.toJson(new ArrayList<>(selectedColumns))); customViewStoreService.saveOrUpdateViewLayoutDef(viewDef); close(); }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); final MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn); contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT); }
From source file:com.mycollab.web.AdWindow.java
License:Open Source License
public AdWindow() { super("Buy MyCollab Pro edition"); this.setWidth("700px"); this.setModal(true); this.setResizable(false); RestTemplate restTemplate = new RestTemplate(); MVerticalLayout content = new MVerticalLayout(); try {// w w w.j a va2s .c om String result = restTemplate.getForObject("https://api.mycollab.com/api/storeweb", String.class); Label webPage = new Label(result, ContentMode.HTML); webPage.setHeight("600px"); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } catch (Exception e) { Div informDiv = new Div() .appendText("Can not load the store page. You can check the online edition at ") .appendChild(new A("https://www.mycollab.com/pricing/download/", "_blank").appendText("here")); Label webPage = new Label(informDiv.write(), ContentMode.HTML); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { MButton editLicenseBtn = new MButton("Enter license code", clickEvent -> { Window activateWindow = ViewManager.getCacheComponent(AbstractLicenseActivationWindow.class); UI.getCurrent().addWindow(activateWindow); close(); }).withStyleName(UIConstants.BUTTON_ACTION); content.with(editLicenseBtn).withAlign(editLicenseBtn, Alignment.MIDDLE_CENTER); } }
From source file:com.mycollab.web.BuyPremiumSoftwareWindow.java
License:Open Source License
public BuyPremiumSoftwareWindow() { super("Buy MyCollab Pro edition"); this.setWidth("700px"); this.setModal(true); this.setResizable(false); RestTemplate restTemplate = new RestTemplate(); MVerticalLayout content = new MVerticalLayout(); try {/*from w w w .j a v a 2 s .c om*/ String result = restTemplate.getForObject("https://api.mycollab.com/api/linktobuy", String.class); Label webPage = new Label(result, ContentMode.HTML); webPage.setHeight("600px"); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } catch (Exception e) { String result = FileUtils.readFileAsPlainString("buying.html"); Label webPage = new Label(result, ContentMode.HTML); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { MButton editLicenseBtn = new MButton("Enter license code", clickEvent -> { Window activateWindow = ViewManager.getCacheComponent(AbstractLicenseActivationWindow.class); UI.getCurrent().addWindow(activateWindow); close(); }).withStyleName(UIConstants.BUTTON_ACTION); content.with(editLicenseBtn).withAlign(editLicenseBtn, Alignment.MIDDLE_CENTER); } }
From source file:com.mycompany.perfectphone.start.java
public start() { Label title = new Label("Find Your Perfect Smartphone"); title.setId("title"); Label welcome = new Label("Welcome to DaX's Perfect Smartphone Finder"); welcome.setId("welcome"); Button start = new Button("Start"); start.setIcon(FontAwesome.SIGN_IN);// w ww . j a va 2s . com start.addStyleName(ValoTheme.BUTTON_PRIMARY); Label question1 = new Label("Do you like big screen?"); OptionGroup answer1 = new OptionGroup(); Button next = new Button("Continue"); addComponents(title, question1, answer1, next); setComponentAlignment(question1, Alignment.TOP_CENTER); setComponentAlignment(answer1, Alignment.TOP_CENTER); setComponentAlignment(next, Alignment.TOP_CENTER); }
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
@Override protected void init(final VaadinRequest request) { // Listener to disconnect JMX connection on exit. addDetachListener(new DetachListener() { @Override/*from w w w .j a v a 2 s . co m*/ public void detach(final DetachEvent event) { jmxHandler.disconnect(); } }); setPollInterval(1000); final Label labelLeft = new Label(""); final Label labelRight = new Label(""); labelLeft.setHeight("100%"); labelRight.setHeight("100%"); final HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); rootLayout.setWidth(rootLayoutWidth); rootLayout.setImmediate(true); rootLayout.addComponent(vvrManagerLayout); vvrManagerLayout.setMargin(false); vvrManagerLayout.setSpacing(true); vvrManagerLayout.setWidth(rootLayoutWidth); content.addComponent(labelLeft); content.addComponent(rootLayout); content.addComponent(labelRight); content.setExpandRatio(labelLeft, 0.5f); content.setExpandRatio(labelRight, 0.5f); content.setComponentAlignment(rootLayout, Alignment.TOP_CENTER); setContent(content); // Init Jmx Handler try { jmxHandler.connect(); // Init ui initVvrManagerUi(jmxHandler); } catch (final Exception e) { LOGGER.error("Can not connect to JMX", e); } }
From source file:com.openhris.employee.EmployeeAddress.java
public EmployeeAddress(String employeeId) { this.employeeId = employeeId; init();//from ww w. j av a 2 s . c om addComponent(layout()); setComponentAlignment(glayout, Alignment.TOP_CENTER); employeeAddressTable(); addComponent(employeeAddressTbl); }
From source file:com.openhris.employee.EmployeeCharacterReference.java
public EmployeeCharacterReference(String employeeId) { this.employeeId = employeeId; init();/*from w w w . j av a2s.com*/ addComponent(layout()); setComponentAlignment(glayout, Alignment.TOP_CENTER); characterReferenceTable(); addComponent(characterReferenceTbl); }
From source file:com.openhris.employee.EmployeePersonalInformation.java
public EmployeePersonalInformation(String employeeId, Application application) { this.employeeId = employeeId; this.application = application; init();// www . java 2 s. co m addComponent(layout()); setComponentAlignment(glayout, Alignment.TOP_CENTER); }