List of usage examples for com.vaadin.ui Component setWidth
public void setWidth(String width);
From source file:com.haulmont.cuba.web.app.folders.CubaFoldersPane.java
License:Apache License
protected void setupAppFoldersPane(Component appFoldersPane) { appFoldersPane.setHeight("100%"); appFoldersPane.setWidth("100%"); if (isNeedFoldersTitle()) { appFoldersLabel = new Label(messages.getMainMessage("folders.appFoldersRoot")); appFoldersLabel.setStyleName("c-folders-pane-caption"); } else {/*from w w w . j a v a2 s. co m*/ appFoldersLabel = null; } }
From source file:com.haulmont.ext.web.ui.Call.CallBrowser.java
License:Open Source License
protected void addLocStateColumn() { MetaPropertyPath pp = callDs.getMetaClass().getPropertyEx("locState"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(callTable); vTable.removeGeneratedColumn(pp);/*from w w w.j a v a 2s .c om*/ vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = callDs.getItem(uuid); boolean containsCard = cards != null ? cards.contains(doc) : false; if (doc != null && !WfUtils.isCardInStateList(doc, "Finished", "Canceled", "Obrabotan") && (containsCard || (!containsCard && WfUtils.isCardInState(doc, "New")))) { final PopupButton popupButton = new WebPopupButton(); popupButton.setCaption(callDs.getItem((UUID) itemId).getLocState()); int a = callTable.getSelected().size(); popupButton.addAction(new AbstractAction("onChange") { public void actionPerform(Component component) { if (callTable.getSelected().size() >= 1) { popupButton.setEnabled(false); } else popupButton.setEnabled(true); } }); component = WebComponentsHelper.unwrap(popupButton); ((org.vaadin.hene.popupbutton.PopupButton) component) .addListener(createProcessMenuBuilder(doc, callTable, popupButton)); component.addStyleName("link"); component.addStyleName("dashed"); } else { component = new com.vaadin.ui.Label(doc == null ? "" : doc.getLocState(), com.vaadin.ui.Label.CONTENT_XHTML); } component.setWidth("-1px"); return component; } }); }
From source file:com.haulmont.ext.web.ui.Call.CallBrowser.java
License:Open Source License
protected void addCommentColumn() { MetaPropertyPath pp = callDs.getMetaClass().getPropertyPath("comment"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(callTable); vTable.removeGeneratedColumn(pp);//from w w w .j a v a2 s . c om vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = callDs.getItem(uuid); String descr = doc.getComment(); int enterIdx = descr != null ? (descr.length() > 40 ? 40 : descr.indexOf('\n')) : -1; //? ?? if (enterIdx != -1) { com.vaadin.ui.TextField content = new com.vaadin.ui.TextField(null, descr); content.setReadOnly(true); content.setWidth("300px"); content.setHeight("300px"); component = new com.vaadin.ui.PopupView("<span>" + descr.substring(0, enterIdx) + "...</span>", content); component.addStyleName("longtext"); } else { component = new com.vaadin.ui.Label(descr == null ? "" : descr); } component.setWidth("-1px"); return component; } }); }
From source file:com.haulmont.ext.web.ui.CauseGIBDD.CauseGIBDDBrowser.java
License:Open Source License
protected void addLocStateColumn() { MetaPropertyPath pp = docsDs.getMetaClass().getPropertyEx("locState"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(docsTable); vTable.removeGeneratedColumn(pp);/*from w w w. j a v a 2s . c o m*/ vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = docsDs.getItem(uuid); boolean containsCard = cards != null ? cards.contains(doc) : false; if (doc != null && !WfUtils.isCardInStateList(doc, "Finished", "Canceled", "Obrabotan") && (containsCard || (!containsCard && WfUtils.isCardInState(doc, "New")))) { final PopupButton popupButton = new WebPopupButton(); popupButton.setCaption(docsDs.getItem((UUID) itemId).getLocState()); int a = docsTable.getSelected().size(); popupButton.addAction(new AbstractAction("onChange") { public void actionPerform(Component component) { if (docsTable.getSelected().size() >= 1) { popupButton.setEnabled(false); } else popupButton.setEnabled(true); } }); component = WebComponentsHelper.unwrap(popupButton); ((org.vaadin.hene.popupbutton.PopupButton) component) .addListener(createProcessMenuBuilder(doc, docsTable, popupButton)); component.addStyleName("link"); component.addStyleName("dashed"); } else { component = new com.vaadin.ui.Label(doc == null ? "" : doc.getLocState(), com.vaadin.ui.Label.CONTENT_XHTML); } component.setWidth("-1px"); return component; } }); }
From source file:com.haulmont.ext.web.ui.CauseGIBDD.CauseGIBDDBrowser.java
License:Open Source License
protected void addCommentColumn() { MetaPropertyPath pp = docsDs.getMetaClass().getPropertyPath("comment"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(docsTable); vTable.removeGeneratedColumn(pp);//w w w .j a va2 s . c o m vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = docsDs.getItem(uuid); String descr = doc.getComment(); int enterIdx = descr != null ? (descr.length() > 40 ? 40 : descr.indexOf('\n')) : -1; //? ?? if (enterIdx != -1) { com.vaadin.ui.TextField content = new com.vaadin.ui.TextField(null, descr); content.setReadOnly(true); content.setWidth("300px"); content.setHeight("300px"); component = new com.vaadin.ui.PopupView("<span>" + descr.substring(0, enterIdx) + "...</span>", content); component.addStyleName("longtext"); } else { component = new com.vaadin.ui.Label(descr == null ? "" : descr); } component.setWidth("-1px"); return component; } }); }
From source file:com.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); MHorizontalLayout attachmentRow = new MHorizontalLayout().withSpacing(false).withFullWidth() .withStyleName("attachment-row"); attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Component thumbnail; if (StringUtils.isNotBlank(attachment.getThumbnail())) { thumbnail = new Image(null, VaadinResourceFactory.getResource(attachment.getThumbnail())); } else {/* ww w .j a v a 2 s . c o m*/ thumbnail = new ELabel(FileAssetsUtil.getFileIconResource(attachment.getName()).getHtml(), ContentMode.HTML); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentRow.addComponent(thumbnailWrap); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); } if (MimeTypesUtil.isImageType(docName)) { MButton b = new MButton(attachment.getTitle(), clickEvent -> { AttachmentPreviewView previewView = new AttachmentPreviewView( VaadinResourceFactory.getResource(attachment.getPath())); EventBusFactory.getInstance().post(new ShellEvent.PushView(attachment, previewView)); }).withStyleName(UIConstants.TEXT_ELLIPSIS); b.setWidth("100%"); attachmentRow.with(b).expand(b); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); attachmentRow.addComponent(l); attachmentRow.setExpandRatio(l, 1.0f); } return attachmentRow; }
From source file:com.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }//from w w w.j av a2 s .c o m final MHorizontalLayout attachmentLayout = new MHorizontalLayout().withStyleName("attachment-row") .withFullWidth(); attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Component thumbnail; if (StringUtils.isNotBlank(attachment.getThumbnail())) { thumbnail = new Image(null, VaadinResourceFactory.getResource(attachment.getThumbnail())); } else { thumbnail = ELabel.fontIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap); ELabel attachmentLink = new ELabel(docName).withStyleName(UIConstants.META_INFO, UIConstants.TEXT_ELLIPSIS); attachmentLayout.with(attachmentLink).expand(attachmentLink); MButton removeAttachment = new MButton("", clickEvent -> { ConfirmDialog.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), dialog -> { if (dialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(), true, MyCollabUI.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(MobileUIConstants.BUTTON_LINK); if (additionalListener != null) { removeAttachment.addClickListener(additionalListener); } removeAttachment.setHtmlContentAllowed(true); attachmentLayout.addComponent(removeAttachment); return attachmentLayout; }
From source file:com.mycollab.vaadin.ui.BeanList.java
License:Open Source License
public void loadItems(List<T> currentListData) { contentLayout.removeAllComponents(); try {//w w w.j a va 2 s .c o m if (CollectionUtils.isEmpty(currentListData) && isDisplayEmptyListText) { Label noItemLbl = new Label(UserUIContext.getMessage(GenericI18Enum.EXT_NO_ITEM)); MVerticalLayout widgetFooter = new MVerticalLayout().withFullWidth(); widgetFooter.addStyleName("widget-footer"); widgetFooter.with(noItemLbl).withAlign(noItemLbl, Alignment.MIDDLE_CENTER); contentLayout.addComponent(widgetFooter); } else { int i = 0; for (T item : currentListData) { Component row = rowDisplayHandler.generateRow(this, item, i); if (row != null) { row.setWidth("100%"); contentLayout.addComponent(row); } i++; } } } catch (Exception e) { LOG.error("Error while generate column display", e); } }
From source file:com.mycollab.vaadin.web.ui.VerticalTabsheet.java
License:Open Source License
public void setNavigatorWidth(String width) { navigatorContainer.setWidth(width);// ww w . j a v a2s. c o m for (Component childComponent : navigatorContainer) { childComponent.setWidth(width); } }
From source file:com.mymita.vaadlets.VaadletsBuilder.java
License:Apache License
private static void setComponentAttributes(final com.vaadin.ui.Component vaadinComponent, final com.mymita.vaadlets.core.Component c) { vaadinComponent.setCaption(c.getCaption()); vaadinComponent.setEnabled(c.isEnabled()); vaadinComponent.setReadOnly(c.isReadonly()); vaadinComponent.setVisible(c.isVisible()); if (c.getHeight() != null) { vaadinComponent.setHeight(c.getHeight()); }// w w w .j a v a 2 s .com if (c.getWidth() != null) { vaadinComponent.setWidth(c.getWidth()); } if (c.isSizeUndefined() != null && c.isSizeUndefined().booleanValue()) { vaadinComponent.setSizeUndefined(); } if (c.isSizeFull() != null && c.isSizeFull().booleanValue()) { vaadinComponent.setSizeFull(); } }