List of usage examples for com.vaadin.ui AbstractComponent setWidth
@Override public void setWidth(float width, Unit unit)
From source file:com.mycollab.module.project.ui.ProjectAssetsUtil.java
License:Open Source License
public static Component buildProjectLogo(String projectShortname, Integer projectId, String projectAvatarId, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(projectAvatarId)) { wrapper = new Image(null, new ExternalResource(StorageFactory.getResourcePath(String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(MyCollabUI.getAccountId(), projectId), projectAvatarId, size))));// w w w .jav a 2 s .c o m } else { ELabel projectIcon = new ELabel(projectShortname).withStyleName(UIConstants.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center"); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(ProjectI18nEnum.OPT_CHANGE_LOGO_HELP, UserUIContext.getMessage(ProjectI18nEnum.EDIT))); return wrapper; }
From source file:com.mycollab.module.project.ui.ProjectAssetsUtil.java
License:Open Source License
public static Component buildClientLogo(SimpleAccount account, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(account.getAvatarid())) { wrapper = new Image(null, new ExternalResource( StorageFactory.getEntityLogoPath(MyCollabUI.getAccountId(), account.getAvatarid(), 100))); } else {//from w ww. j ava 2 s . co m String accountName = account.getAccountname(); accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; ELabel projectIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(ClientI18nEnum.OPT_CHANGE_LOGO_HELP, UserUIContext.getMessage(ClientI18nEnum.EDIT))); return wrapper; }
From source file:com.rdonasco.security.user.controllers.UserEditorViewController.java
License:Apache License
private void configureTabContentLayout(HorizontalLayout container, AbstractComponent leftContent, AbstractComponent rightContent) { container.setSpacing(true);/*from w w w. j av a 2 s. c o m*/ container.setMargin(true, true, true, true); container.addComponent(leftContent); container.addComponent(rightContent); leftContent.setWidth(100f, Sizeable.UNITS_PERCENTAGE); container.setExpandRatio(leftContent, 1f); container.setExpandRatio(rightContent, 0.25f); // fix the size of the panels float panelHeight = 300; leftContent.setHeight(panelHeight, Sizeable.UNITS_PIXELS); rightContent.setHeight(panelHeight, Sizeable.UNITS_PIXELS); }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java
License:Open Source License
public void addComponentToContent(AbstractComponent component) { if (contentLayout != null) { component.setWidth(100, Unit.PERCENTAGE); contentLayout.addComponent(component); }//from w ww .ja v a 2 s . co m }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java
License:Open Source License
public void addComponentToLeftContentColumn(AbstractComponent component) { if (leftContentColumnLayout != null) { component.setWidth(100, Unit.PERCENTAGE); leftContentColumnLayout.addComponent(component); }//from w ww . j av a 2s .c o m }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java
License:Open Source License
public void addComponentToRightContentColumn(AbstractComponent component) { if (rightContentColumnLayout != null) { component.setWidth(100, Unit.PERCENTAGE); rightContentColumnLayout.addComponent(component); }//from w ww .j a v a 2 s . c om }
From source file:org.hoot.HootView.java
License:Apache License
/** * {@inheritDoc}// w w w . ja v a 2 s. c o m */ @Override protected void initializeComponents() { final int columnCount = 5; final int rowCount = 3; final GridLayout layout = this; layout.setMargin(true); layout.setSpacing(true); layout.setColumns(columnCount); layout.setRows(rowCount); //layout.setColumnExpandRatio(0, MARGIN_COLUMN_EXPAND_RATIO); //layout.setColumnExpandRatio(MARGIN_COLUMN_RIGTH_INDEX, MARGIN_COLUMN_EXPAND_RATIO); layout.setRowExpandRatio(1, 1.0f); layout.setColumnExpandRatio(2, 1.0f); layout.setSizeFull(); final AbstractComponent logoComponent = getComponent("logo"); logoComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); layout.addComponent(logoComponent, 1, 0); final AbstractComponent navigationComponent = getComponent("navigation"); navigationComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); navigationComponent.setHeight(NAVIGATION_HEIGHT, Unit.PIXELS); layout.addComponent(navigationComponent, 1, 1); //final AbstractComponent headerComponent = getComponent("header"); //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); //headerComponent.setSizeFull(); //layout.addComponent(headerComponent, 2, 0); final AbstractComponent contentComponent = getComponent("content"); //contentComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); contentComponent.setSizeFull(); layout.addComponent(contentComponent, 2, 0, 2, 2); //final AbstractComponent footerComponent = getComponent("footer"); //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); //layout.addComponent(footerComponent, 2, 2); }
From source file:org.vaadin.addons.sitekit.site.FixedWidthView.java
License:Apache License
/** * {@inheritDoc}/* w ww . j ava2 s. com*/ */ @Override protected void initializeComponents() { final int columnCount = 5; final int rowCount = 3; final GridLayout layout = this; layout.setMargin(true); layout.setColumns(columnCount); layout.setRows(rowCount); layout.setColumnExpandRatio(0, MARGIN_COLUMN_EXPAND_RATIO); layout.setColumnExpandRatio(MARGIN_COLUMN_RIGTH_INDEX, MARGIN_COLUMN_EXPAND_RATIO); layout.setRowExpandRatio(1, 1.0f); layout.setSizeFull(); layout.setMargin(false); layout.setSpacing(true); final AbstractComponent logoComponent = getComponent("logo"); logoComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); layout.addComponent(logoComponent, 1, 0); final AbstractComponent navigationComponent = getComponent("navigation"); navigationComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); navigationComponent.setHeight(NAVIGATION_HEIGHT, Unit.PIXELS); layout.addComponent(navigationComponent, 1, 1); final AbstractComponent headerComponent = getComponent("header"); headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); headerComponent.setSizeFull(); layout.addComponent(headerComponent, 2, 0); final AbstractComponent contentComponent = getComponent("content"); contentComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); contentComponent.setSizeFull(); layout.addComponent(contentComponent, 2, 1); final AbstractComponent footerComponent = getComponent("footer"); headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); layout.addComponent(footerComponent, 2, 2); }