List of usage examples for com.vaadin.ui HorizontalLayout setStyleName
@Override public void setStyleName(String style)
From source file:com.haulmont.cuba.web.toolkit.ui.CubaRowsCount.java
License:Apache License
protected AbstractOrderedLayout createContentLayout() { HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setStyleName("c-paging-wrap"); contentLayout.setSpacing(true);//from w ww .j a v a 2 s.c o m firstButton = new CubaButton(); firstButton.setIcon(WebComponentsHelper.getIcon("icons/rows-count-first.png")); firstButton.setStyleName("c-paging-change-page"); firstButton.addStyleName("c-paging-first"); contentLayout.addComponent(firstButton); contentLayout.setComponentAlignment(firstButton, Alignment.MIDDLE_CENTER); prevButton = new CubaButton(); prevButton.setIcon(WebComponentsHelper.getIcon("icons/rows-count-prev.png")); prevButton.setStyleName("c-paging-change-page"); prevButton.addStyleName("c-paging-prev"); contentLayout.addComponent(prevButton); contentLayout.setComponentAlignment(prevButton, Alignment.MIDDLE_CENTER); label = new Label(); label.setWidthUndefined(); label.setStyleName("c-paging-status"); contentLayout.addComponent(label); contentLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); countButton = new CubaButton("[?]"); countButton.setWidthUndefined(); countButton.setStyleName(BaseTheme.BUTTON_LINK); countButton.addStyleName("c-paging-count"); countButton.setTabIndex(-1); contentLayout.addComponent(countButton); contentLayout.setComponentAlignment(countButton, Alignment.MIDDLE_CENTER); nextButton = new CubaButton(); nextButton.setIcon(WebComponentsHelper.getIcon("icons/rows-count-next.png")); nextButton.setStyleName("c-paging-change-page"); nextButton.addStyleName("c-paging-next"); contentLayout.addComponent(nextButton); contentLayout.setComponentAlignment(nextButton, Alignment.MIDDLE_CENTER); lastButton = new CubaButton(); lastButton.setIcon(WebComponentsHelper.getIcon("icons/rows-count-last.png")); lastButton.setStyleName("c-paging-change-page"); lastButton.addStyleName("c-paging-last"); contentLayout.addComponent(lastButton); contentLayout.setComponentAlignment(lastButton, Alignment.MIDDLE_CENTER); return contentLayout; }
From source file:com.haulmont.cuba.web.widgets.CubaRowsCount.java
License:Apache License
public CubaRowsCount() { HorizontalLayout layout = new HorizontalLayout(); // vaadin8 use CssLayout instead layout.setStyleName("c-paging"); layout.setSpacing(false);//from w w w . j av a2s .c o m layout.setMargin(new MarginInfo(false, false, false, true)); setCompositionRoot(layout); CubaPlaceHolder expander = new CubaPlaceHolder(); expander.setWidth("100%"); layout.addComponent(expander); layout.setExpandRatio(expander, 1); AbstractOrderedLayout contentLayout = createContentLayout(); layout.addComponent(contentLayout); layout.setWidth("100%"); setWidth("100%"); }
From source file:com.haulmont.cuba.web.widgets.CubaRowsCount.java
License:Apache License
protected AbstractOrderedLayout createContentLayout() { HorizontalLayout contentLayout = new HorizontalLayout(); // vaadin8 use CssLayout instead contentLayout.setStyleName("c-paging-wrap"); contentLayout.setSpacing(true);//ww w . j a v a 2s.com contentLayout.setMargin(false); firstButton = new CubaButton(); firstButton.setStyleName("c-paging-change-page"); firstButton.addStyleName("c-paging-first"); contentLayout.addComponent(firstButton); contentLayout.setComponentAlignment(firstButton, Alignment.MIDDLE_CENTER); prevButton = new CubaButton(); prevButton.setStyleName("c-paging-change-page"); prevButton.addStyleName("c-paging-prev"); contentLayout.addComponent(prevButton); contentLayout.setComponentAlignment(prevButton, Alignment.MIDDLE_CENTER); label = new Label(); label.setWidthUndefined(); label.setStyleName("c-paging-status"); contentLayout.addComponent(label); contentLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); countButton = new CubaButton("[?]"); countButton.setWidthUndefined(); countButton.setStyleName(ValoTheme.BUTTON_LINK); countButton.addStyleName("c-paging-count"); countButton.setTabIndex(-1); contentLayout.addComponent(countButton); contentLayout.setComponentAlignment(countButton, Alignment.MIDDLE_CENTER); nextButton = new CubaButton(); nextButton.setStyleName("c-paging-change-page"); nextButton.addStyleName("c-paging-next"); contentLayout.addComponent(nextButton); contentLayout.setComponentAlignment(nextButton, Alignment.MIDDLE_CENTER); lastButton = new CubaButton(); lastButton.setStyleName("c-paging-change-page"); lastButton.addStyleName("c-paging-last"); contentLayout.addComponent(lastButton); contentLayout.setComponentAlignment(lastButton, Alignment.MIDDLE_CENTER); return contentLayout; }
From source file:com.jain.common.header.Header.java
License:Apache License
private void addHeaderMenu() { HorizontalLayout layout = new HorizontalLayout(); layout.setStyleName(ApplicationTheme.HEADER_SEGMENT); int i = 0;//from w w w . j ava 2 s .c o m Button button = null; for (JHeaderItem item : JHeaderItem.values()) { button = new Button(item.getDisplayName(), this); layout.addComponent(button); if (i == 0) { current = button; current.setStyleName(ApplicationTheme.FIRST); current.addStyleName(ApplicationTheme.SELECTED); i++; } } button.setStyleName(ApplicationTheme.LAST); addComponent(layout); setComponentAlignment(layout, Alignment.MIDDLE_LEFT); setExpandRatio(layout, 1); }
From source file:com.klwork.explorer.ui.base.AbstractSecondMainPage.java
License:Apache License
protected void addSelectComponent() { VerticalLayout secondMenuLayout = new VerticalLayout(); secondMenuLayout.addStyleName("sidebar"); secondMenuLayout.addStyleName("menu"); //secondMenuLayout.setMargin(new MarginInfo(true,false,false,false)); secondMenuLayout.setSpacing(true);//from w ww .java 2 s . c o m secondMenuLayout.setSizeFull(); HorizontalLayout tableHeadLayout = new HorizontalLayout(); tableHeadLayout.setStyleName("tableHead"); tableHeadLayout.setHeight("20px"); Label nameLabel = new Label("hello,word"); tableHeadLayout.addComponent(nameLabel); tableHeadLayout.setComponentAlignment(nameLabel, Alignment.BOTTOM_CENTER); secondMenuLayout.addComponent(tableHeadLayout); //secondMenuLayout.setExpandRatio(tableHeadLayout, 0.1f); //table AbstractSelect select = createSelectComponent(); secondMenuLayout.addComponent(select); secondMenuLayout.setExpandRatio(select, 1.0f); if (select != null) { grid.addComponent(secondMenuLayout, 0, 0); } }
From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java
public PrimaryMasterPage() { //ContextWidget c= new ContextWidget(); HorizontalLayout iHorizontalLayout = new HorizontalLayout(); //addComponent(iHorizontalLayout,"top:0px;left:0px"); iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth())); iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight())); iHorizontalLayout.setStyleName("backColorBlack"); //String[] captions1 = {"Logo Here", "My Cool School", "Third"}; //Layout A and its sub components Panel AP = new Panel(); iHorizontalLayout.addComponent(AP);/*w w w .j av a 2s . com*/ AP.setSizeFull(); AP.setStyleName("backColorBlack"); VerticalLayout A1 = new VerticalLayout(); AP.setContent(A1); //A.setSizeFull(); A1.setSpacing(true); iHorizontalLayout.setExpandRatio(AP, 1); A1.setStyleName("backColorBlack"); A1.setMargin(new MarginInfo(true, true, true, true)); Button logoImage = new Button(); logoImage.setIcon(FontAwesome.PICTURE_O); logoImage.setWidth("80px"); logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS); //logoImage.setWidth("100px"); A1.addComponent(logoImage); A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER); Label schoolName = new Label("The School Of Future"); schoolName.setStyleName("v-label-big"); A1.addComponent(schoolName); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); Label schoolMinorName = new Label("Random Branch"); schoolMinorName.setStyleName("v-label-small"); A1.addComponent(schoolMinorName); VerticalLayout A2 = new VerticalLayout(); A1.addComponent(A2); MainMenuWidget iMainMenuWidget = new MainMenuWidget(); A2.addComponent(iMainMenuWidget); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); //Layout B ContextWidgetTop c = new ContextWidgetTop(); c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP, SliderPanelStyles.COLOR_RED); VerticalLayout B = new VerticalLayout(); B.setSizeFull(); //B.setSpacing(true); iHorizontalLayout.addComponent(c); c.addComponent(B); iHorizontalLayout.setExpandRatio(c, 7); //Layout B1 and its sub Components HorizontalLayout B1 = new HorizontalLayout(); B.addComponent(B1); //B.setExpandRatio(B1, 1); //B1.setHeight("70px"); B1.setSizeFull(); //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED); HorizontalLayout B11 = new HorizontalLayout(); B1.addComponent(B11); B1.setStyleName("backColorBlack"); B11.setSizeFull(); B1.setHeight("45px"); //B1.setStyleName("backColorWhite"); //B1.setMargin(new MarginInfo(false, true, false, true)); TextField iTextField = new TextField(); iTextField.setWidth("200px"); iTextField.setInputPrompt("Search!"); iTextField.setStyleName("v-text-type-search"); iTextField.focus(); B11.addComponent(iTextField); B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT); //Layout B2 and its Sub Components ContextWidget B2 = new ContextWidget(); B2.setSizeFull(); B.addComponent(B2); B.setExpandRatio(B2, 10); B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT, SliderPanelStyles.COLOR_BLUE); //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED); VerticalLayout v = new VerticalLayout(); B2.addComponent(v); Button b1111 = new Button( "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this"); v.addComponent(b1111); Button b1112 = new Button("Put all the inner components like this"); v.addComponent(b1112); /* Panel p = new Panel(); VerticalLayout v= new VerticalLayout(); v.addComponent(new TextField("Name")); v.addComponent(new TextField("Street address")); v.addComponent(new TextField("Postal code")); p.setContent(v); B2.addComponent(p); v.setWidth(String.valueOf(B2.getWidth()*10)+"px"); //v.setSizeFull();// <- This will cause issues. Don't do this p.setSizeFull(); */ //ContextWidget iContextPanel= new ContextWidget(p); //B2.addComponent(iContextPanel); //setPosition(p, iComponentPositionPanel); addComponent(iHorizontalLayout); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.crud.SampleCrudView.java
License:Apache License
public HorizontalLayout createTopBar() { TextField filter = new TextField(); filter.setStyleName("filter-textfield"); filter.setInputPrompt("Filter"); ResetButtonForTextField.extend(filter); filter.setImmediate(true);//from www. ja va2s. co m filter.addTextChangeListener(new FieldEvents.TextChangeListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void textChange(FieldEvents.TextChangeEvent event) { table.setFilter(event.getText()); } }); newProduct = new Button("New product"); newProduct.addStyleName(ValoTheme.BUTTON_PRIMARY); newProduct.setIcon(FontAwesome.PLUS_CIRCLE); newProduct.addClickListener(new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { viewLogic.newProduct(); } }); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setSpacing(true); topLayout.setWidth("100%"); topLayout.addComponent(filter); topLayout.addComponent(newProduct); topLayout.setComponentAlignment(filter, Alignment.MIDDLE_LEFT); topLayout.setExpandRatio(filter, 1); topLayout.setStyleName("top-bar"); return topLayout; }
From source file:com.mycollab.mobile.module.project.view.message.MessageAttachmentField.java
License:Open Source License
@Override protected void constructUI() { content = new VerticalLayout(); content.setStyleName("attachment-field"); rowWrap = new VerticalLayout(); rowWrap.setWidth("100%"); rowWrap.setStyleName("attachment-row-wrap"); HorizontalLayout compHeader = new HorizontalLayout(); compHeader.setWidth("100%"); compHeader.setStyleName("attachment-field-header"); Label headerLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_ATTACHMENTS)); headerLbl.setStyleName("field-caption"); compHeader.addComponent(headerLbl);//from w w w . j a va 2s.c o m compHeader.setExpandRatio(headerLbl, 1.0f); compHeader.addComponent(attachmentBtn); content.addComponent(compHeader); content.addComponent(rowWrap); }
From source file:com.mycollab.module.crm.view.activity.ActivityRootView.java
License:Open Source License
public ActivityRootView() { super();/*from ww w.jav a2 s . c o m*/ this.setSizeFull(); final CssLayout contentWrapper = new CssLayout(); contentWrapper.setStyleName("verticalTabView"); contentWrapper.setWidth("100%"); this.addComponent(contentWrapper); HorizontalLayout root = new HorizontalLayout(); root.setStyleName("menuContent"); activityTabs = new VerticalTabsheet(); activityTabs.setSizeFull(); activityTabs.setNavigatorWidth("170px"); activityTabs.setNavigatorStyleName("sidebar-menu"); activityTabs.setHeight(null); root.addComponent(activityTabs); root.setWidth("100%"); buildComponents(); contentWrapper.addComponent(root); }
From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleProjectMember member) { HorizontalLayout blockContent = new HorizontalLayout(); blockContent.setStyleName("member-block"); if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) { blockContent.addStyleName("inactive"); }/* w w w . j a va 2 s .c om*/ blockContent.setWidth("350px"); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); memberAvatar.setWidthUndefined(); blockContent.addComponent(memberAvatar); MVerticalLayout blockTop = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)) .withFullWidth(); MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, member))) .withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); editBtn.setDescription("Edit user '" + member.getDisplayName() + "' information"); MButton deleteBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectMemberService prjMemberService = AppContextUtil .getSpringBean(ProjectMemberService.class); prjMemberService.removeWithSession(member, UserUIContext.getUsername(), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null)); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); deleteBtn.setDescription("Remove user '" + member.getDisplayName() + "' out of this project"); MHorizontalLayout buttonControls = new MHorizontalLayout(editBtn, deleteBtn); blockTop.addComponent(buttonControls); blockTop.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT); A memberLink = new A( ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername())) .appendText(member.getMemberFullName()).setTitle(member.getMemberFullName()); ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS) .withFullWidth(); blockTop.with(memberNameLbl, ELabel.hr()); String roleLink = String.format("<a href=\"%s%s%s\"", MyCollabUI.getSiteUrl(), GenericLinkUtils.URL_PREFIX_PARAM, ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid())); ELabel memberRole = new ELabel("", ContentMode.HTML).withFullWidth() .withStyleName(UIConstants.TEXT_ELLIPSIS); if (member.isProjectOwner()) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", roleLink, UserUIContext.getMessage(ProjectRoleI18nEnum.OPT_ADMIN_ROLE_DISPLAY))); } else { memberRole.setValue( String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", roleLink, member.getRoleName())); } blockTop.addComponent(memberRole); if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.META_INFO).withFullWidth(); blockTop.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getJoindate()))) .withDescription(UserUIContext.formatDateTime(member.getJoindate())).withFullWidth(); blockTop.addComponent(memberSinceLabel); if (ProjectMemberStatusConstants.ACTIVE.equals(member.getStatus())) { ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastAccessTime()))) .withDescription(UserUIContext.formatDateTime(member.getLastAccessTime())); blockTop.addComponent(lastAccessTimeLbl); } String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " " + new Span().appendText("" + member.getNumOpenTasks()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) + " " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " " + new Span().appendText("" + member.getNumOpenBugs()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " " + FontAwesome.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + " " + FontAwesome.GIFT.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)); blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO)); blockContent.addComponent(blockTop); blockContent.setExpandRatio(blockTop, 1.0f); return blockContent; }