List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:com.esofthead.mycollab.vaadin.ui.OptionPopupContent.java
License:Open Source License
public void addOption(Button btn) { CssLayout wrap = new CssLayout(); btn.setStyleName("action"); wrap.addStyleName("action-wrap"); wrap.addComponent(btn);/*from w w w . j a va 2 s.c om*/ addComponent(wrap); }
From source file:com.esofthead.mycollab.vaadin.ui.RightSidebarLayout.java
License:Open Source License
public RightSidebarLayout() { this.setStyleName("rightsidebar-layout"); this.contentWrap = new CssLayout(); this.contentWrap.setStyleName("content-wrap"); this.contentWrap.setWidth("100%"); this.addComponent(contentWrap); this.sidebarWrap = new CssLayout(); this.sidebarWrap.setStyleName("sidebar-wrap"); this.sidebarWrap.setWidth("250px"); this.addComponent(sidebarWrap); }
From source file:com.esofthead.mycollab.vaadin.ui.table.AbstractPagedBeanTable.java
License:Open Source License
private CssLayout createControls() { this.controlBarWrapper = new CssLayout(); this.controlBarWrapper.setStyleName("listControl"); this.controlBarWrapper.setWidth("100%"); final HorizontalLayout controlBar = new HorizontalLayout(); controlBar.setWidth("100%"); this.controlBarWrapper.addComponent(controlBar); this.pageManagement = new HorizontalLayout(); // defined layout here --------------------------- if (this.currentPage > 1) { final Button firstLink = new ButtonLink("1", new ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w . ja v a 2 s. com*/ public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(1); } }, false); firstLink.addStyleName("buttonPaging"); this.pageManagement.addComponent(firstLink); } if (this.currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); this.pageManagement.addComponent(ss1); } if (this.currentPage > 3) { final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage - 2); } }, false); previous2.addStyleName("buttonPaging"); this.pageManagement.addComponent(previous2); } if (this.currentPage > 2) { final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage - 1); } }, false); previous1.addStyleName("buttonPaging"); this.pageManagement.addComponent(previous1); } // Here add current ButtonLink final Button current = new ButtonLink("" + this.currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage); } }, false); current.addStyleName("buttonPaging"); current.addStyleName("buttonPagingcurrent"); this.pageManagement.addComponent(current); final int range = this.totalPage - this.currentPage; if (range >= 1) { final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage + 1); } }, false); next1.addStyleName("buttonPaging"); this.pageManagement.addComponent(next1); } if (range >= 2) { final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage + 2); } }, false); next2.addStyleName("buttonPaging"); this.pageManagement.addComponent(next2); } if (range >= 4) { final Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); this.pageManagement.addComponent(ss2); } if (range >= 3) { final Button last = new ButtonLink("" + this.totalPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.totalPage); } }, false); last.addStyleName("buttonPaging"); this.pageManagement.addComponent(last); } this.pageManagement.setWidth(null); this.pageManagement.setSpacing(true); controlBar.addComponent(this.pageManagement); controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT); return this.controlBarWrapper; }
From source file:com.esofthead.mycollab.vaadin.ui.VerticalTabsheet.java
License:Open Source License
public VerticalTabsheet(boolean isLeft) { CssLayout contentLayout = new CssLayout(); navigatorWrapper = new CssLayout(); navigatorWrapper.setStyleName("navigator-wrap"); navigatorContainer = new VerticalLayout(); navigatorWrapper.addComponent(navigatorContainer); contentWrapper = new VerticalLayout(); contentWrapper.setStyleName("container-wrap"); contentWrapper.setWidth("100%"); tabContainer = new CssLayout(); tabContainer.setWidth("100%"); contentWrapper.addComponent(tabContainer); if (isLeft) { contentLayout.addComponent(navigatorWrapper); contentLayout.addComponent(contentWrapper); } else {// w w w. j a v a 2s. c o m contentLayout.addComponent(contentWrapper); contentLayout.addComponent(navigatorWrapper); } this.setCompositionRoot(contentLayout); this.setStyleName(TABSHEET_STYLENAME); }
From source file:com.esofthead.mycollab.vaadin.web.ui.AbstractBeanBlockList.java
License:Open Source License
protected CssLayout createPageControls() { this.controlBarWrapper = new CssLayout(); this.controlBarWrapper.setWidth("100%"); final HorizontalLayout controlBar = new HorizontalLayout(); controlBar.setWidth("100%"); this.controlBarWrapper.addComponent(controlBar); pageManagement = new MHorizontalLayout(); // defined layout here --------------------------- if (currentPage > 1) { final Button firstLink = new Button("1", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/* w w w .j av a2 s . c om*/ public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(1); } }); firstLink.addStyleName("buttonPaging"); pageManagement.addComponent(firstLink); } if (currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } if (currentPage > 3) { final Button previous2 = new Button("" + (currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage - 2); } }); previous2.addStyleName("buttonPaging"); pageManagement.addComponent(previous2); } if (currentPage > 2) { final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage - 1); } }); previous1.addStyleName("buttonPaging"); pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy final Button current = new Button("" + currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage); } }); current.addStyleName("buttonPaging"); current.addStyleName("current"); pageManagement.addComponent(current); final int range = totalPage - currentPage; if (range >= 1) { final Button next1 = new Button("" + (currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage + 1); } }); next1.addStyleName("buttonPaging"); pageManagement.addComponent(next1); } if (range >= 2) { final Button next2 = new Button("" + (currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage + 2); } }); next2.addStyleName("buttonPaging"); pageManagement.addComponent(next2); } if (range >= 4) { final Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); pageManagement.addComponent(ss2); } if (range >= 3) { final Button last = new Button("" + totalPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(totalPage); } }); last.addStyleName("buttonPaging"); pageManagement.addComponent(last); } pageManagement.setWidth(null); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT); return this.controlBarWrapper; }
From source file:com.esofthead.mycollab.vaadin.web.ui.AbstractBeanPagedList.java
License:Open Source License
public AbstractBeanPagedList(RowDisplayHandler<T> rowDisplayHandler, int defaultNumberSearchItems) { this.defaultNumberSearchItems = defaultNumberSearchItems; this.rowDisplayHandler = rowDisplayHandler; listContainer = new CssLayout(); listContainer.setWidth("100%"); this.addComponent(listContainer); this.setExpandRatio(listContainer, 1.0f); this.addStyleName(UIConstants.SCROLLABLE_CONTAINER); queryHandler = buildQueryHandler();/*w w w .j a v a 2 s . c o m*/ }
From source file:com.esofthead.mycollab.vaadin.web.ui.AddViewLayout.java
License:Open Source License
public void setTitle(final String title) { if (title != null) { CssLayout titleWrap = new CssLayout(); titleWrap.setWidth("100%"); titleWrap.addComponent(ELabel.h3(title)); addComponent(titleWrap, "addViewTitle"); } else {//from w w w . ja v a 2 s. co m removeComponent("addViewTitle"); } }
From source file:com.esofthead.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java
License:Open Source License
public void addAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/*from w ww .j a v a2 s . c o m*/ final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Link thumbnail = new Link(); if (StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } else { thumbnail.setIcon(VaadinResourceFactory.getInstance().getResource(attachment.getThumbnail())); } if (MimeTypesUtil.isImageType(docName)) { thumbnail.setResource(VaadinResourceFactory.getInstance().getResource(attachment.getPath())); new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true); } Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold")); Ul ul = new Ul() .appendChild(new Li().appendText("Size: " + FileUtils.getVolumeDisplay(attachment.getSize()))) .setStyle("line-height:1.5em"); ul.appendChild(new Li().appendText( "Last modified: " + AppContext.formatPrettyTime(attachment.getLastModified().getTime()))); contentTooltip.appendChild(ul); thumbnail.setDescription(contentTooltip.write()); thumbnail.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); CssLayout attachmentNameWrap = new CssLayout(); attachmentNameWrap.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentNameWrap.setStyleName("attachment-name-wrap"); Label attachmentName = new Label(StringUtils.trim(docName, 60, true)); attachmentName.setStyleName("attachment-name"); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); Button trashBtn = new Button(null, 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, AppContext.getSiteName()), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), 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()) { ResourceService attachmentService = AppContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); trashBtn.setIcon(FontAwesome.TRASH_O); trashBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); Button downloadBtn = new Button(); FileDownloader fileDownloader = new FileDownloader( VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); this.addComponent(attachmentLayout); }
From source file:com.esofthead.mycollab.vaadin.web.ui.BlockWidget.java
License:Open Source License
public BlockWidget(String title) { titleLbl = ELabel.h2(""); super.addComponent(titleLbl); bodyLayout = new CssLayout(); bodyLayout.setWidth("100%"); super.addComponent(bodyLayout); this.setTitle(title); }
From source file:com.esofthead.mycollab.vaadin.web.ui.field.ContainerViewField.java
License:Open Source License
public ContainerViewField() { layout = new CssLayout(); layout.setWidth("100%"); }