List of usage examples for com.vaadin.ui VerticalLayout setWidth
@Override public void setWidth(String width)
From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleUser member) { VerticalLayout blockContent = new VerticalLayout(); blockContent.setWidth("350px"); blockContent.setStyleName("member-block"); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { blockContent.addStyleName("inactive"); }// ww w. java 2 s . c o m MHorizontalLayout blockTop = new MHorizontalLayout().withFullWidth(); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); blockTop.addComponent(memberAvatar); MVerticalLayout memberInfo = new MVerticalLayout().withMargin(false); MHorizontalLayout buttonControls = new MHorizontalLayout(); buttonControls.setDefaultComponentAlignment(Alignment.TOP_RIGHT); buttonControls.setVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { MButton resendBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_RESEND_INVITATION), clickEvent -> { SendUserInvitationEvent invitationEvent = new SendUserInvitationEvent(member.getUsername(), null, member.getInviteUser(), MyCollabUI.getSubDomain(), MyCollabUI.getAccountId()); AsyncEventBus asyncEventBus = AppContextUtil.getSpringBean(AsyncEventBus.class); asyncEventBus.post(invitationEvent); NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_SUCCESS), UserUIContext.getMessage(UserI18nEnum.OPT_SEND_INVITATION_SUCCESSFULLY, member.getDisplayName())); }).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(resendBtn); } MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance() .post(new UserEvent.GotoEdit(UserListViewImpl.this, member))).withIcon(FontAwesome.EDIT) .withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(editBtn); 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()) { UserService userService = AppContextUtil.getSpringBean(UserService.class); userService.pendingUserAccounts(Collections.singletonList(member.getUsername()), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new UserEvent.GotoList(UserListViewImpl.this, null)); } })).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(deleteBtn); memberInfo.addComponent(buttonControls); memberInfo.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT); A memberLink = new A( AccountLinkGenerator.generatePreviewFullUserLink(MyCollabUI.getSiteUrl(), member.getUsername())) .appendText(member.getDisplayName()); ELabel memberLinkLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS); memberInfo.addComponent(memberLinkLbl); memberInfo.addComponent(ELabel.hr()); if (member.getRoleid() != null) { String memberRoleLinkPrefix = String.format("<a href=\"%s\"", AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid())); ELabel memberRole = new ELabel(ContentMode.HTML).withStyleName(UIConstants.TEXT_ELLIPSIS); if (Boolean.TRUE.equals(member.getIsAccountOwner())) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", memberRoleLinkPrefix, UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER))); } else { memberRole.setValue(String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", memberRoleLinkPrefix, member.getRoleName())); } memberInfo.addComponent(memberRole); } else if (Boolean.TRUE.equals(member.getIsAccountOwner())) { Label memberRole = new Label(String.format("<a style=\"color: #B00000;\">%s</a>", UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)), ContentMode.HTML); memberInfo.addComponent(memberRole); } else { Label lbl = new Label(); lbl.setHeight("10px"); memberInfo.addComponent(lbl); } if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.TEXT_ELLIPSIS, UIConstants.META_INFO).withFullWidth(); memberInfo.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getRegisteredtime()))) .withDescription(UserUIContext.formatDateTime(member.getRegisteredtime())).withFullWidth(); memberInfo.addComponent(memberSinceLabel); ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastaccessedtime()))) .withDescription(UserUIContext.formatDateTime(member.getLastaccessedtime())); memberInfo.addComponent(lastAccessTimeLbl); blockTop.with(memberInfo).expand(memberInfo); blockContent.addComponent(blockTop); return blockContent; }
From source file:com.mycollab.module.user.ui.components.ImagePreviewCropWindow.java
License:Open Source License
public ImagePreviewCropWindow(final ImageSelectionCommand imageSelectionCommand, final byte[] imageData) { super(UserUIContext.getMessage(ShellI18nEnum.OPT_PREVIEW_EDIT_IMAGE)); MVerticalLayout content = new MVerticalLayout(); withModal(true).withResizable(false).withWidth("700px").withCenter().withContent(content); try {/* w ww . j a va 2 s . com*/ originalImage = ImageIO.read(new ByteArrayInputStream(imageData)); } catch (IOException e) { throw new UserInvalidInputException("Invalid image type"); } originalImage = ImageUtil.scaleImage(originalImage, 650, 650); MHorizontalLayout previewBox = new MHorizontalLayout().withMargin(new MarginInfo(false, true, true, false)) .withFullWidth(); previewPhoto = new VerticalLayout(); previewPhoto.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); previewPhoto.setWidth("100px"); previewBox.with(previewPhoto).withAlign(previewPhoto, Alignment.TOP_LEFT); VerticalLayout previewBoxTitle = new VerticalLayout(); previewBoxTitle.setMargin(new MarginInfo(false, true, false, true)); previewBoxTitle .addComponent(ELabel.html(UserUIContext.getMessage(ShellI18nEnum.OPT_IMAGE_EDIT_INSTRUCTION))); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MButton acceptBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ACCEPT), clickEvent -> { if (scaleImageData != null && scaleImageData.length > 0) { try { BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData)); imageSelectionCommand.process(image); close(); } catch (IOException e) { throw new MyCollabException("Error when saving user avatar", e); } } }).withIcon(FontAwesome.CHECK).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout controlBtns = new MHorizontalLayout(acceptBtn, cancelBtn); previewBoxTitle.addComponent(controlBtns); previewBoxTitle.setComponentAlignment(controlBtns, Alignment.TOP_LEFT); previewBox.with(previewBoxTitle).expand(previewBoxTitle); CssLayout cropBox = new CssLayout(); cropBox.setWidth("100%"); VerticalLayout currentPhotoBox = new VerticalLayout(); Resource resource = new ByteArrayImageResource(ImageUtil.convertImageToByteArray(originalImage), "image/png"); CropField cropField = new CropField(resource); cropField.setImmediate(true); cropField.setSelectionAspectRatio(1.0f); cropField.addValueChangeListener(valueChangeEvent -> { VCropSelection newSelection = (VCropSelection) valueChangeEvent.getProperty().getValue(); int x1 = newSelection.getXTopLeft(); int y1 = newSelection.getYTopLeft(); int x2 = newSelection.getXBottomRight(); int y2 = newSelection.getYBottomRight(); if (x2 > x1 && y2 > y1) { BufferedImage subImage = originalImage.getSubimage(x1, y1, (x2 - x1), (y2 - y1)); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); try { ImageIO.write(subImage, "png", outStream); scaleImageData = outStream.toByteArray(); displayPreviewImage(); } catch (IOException e) { LOG.error("Error while scale image: ", e); } } }); currentPhotoBox.setWidth("520px"); currentPhotoBox.setHeight("470px"); currentPhotoBox.addComponent(cropField); cropBox.addComponent(currentPhotoBox); content.with(previewBox, ELabel.hr(), cropBox); displayPreviewImage(); }
From source file:com.naoset.framework.frontend.view.window.Window.java
protected void buildConfirmCloseDialog() { VerticalLayout vl = new VerticalLayout(); vl.setWidth("100%"); vl.addComponent(new Label("Hay cambios sin grabar.")); vl.addComponent(new Label("Si contina, perder estos cambios.")); vl.addComponent(new Label("")); vl.addComponent(new Label("Desea continuar?")); DialogWindow dlgWin = new DialogWindow("Confirmacin de cierre", vl, DialogWindow.DialogButton.YES, DialogWindow.DialogButton.NO) { @Override/* w ww.j a v a 2 s . c o m*/ protected void onButtonNoClicked() { close(); } @Override protected void onButtonYesClicked() { close(); mySelf.close(); } }; UI.getCurrent().addWindow(dlgWin); dlgWin.focus(); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createCenterPiece() { HorizontalLayout centerpieceLayout = new HorizontalLayout(); centerpieceLayout.setWidth("100%"); centerpieceLayout.setSpacing(true);//from www . j a v a 2 s. c o m VerticalLayout centerpieceSettings = new VerticalLayout(); centerpieceSettings.setWidth("100%"); centerpieceSettings.setSpacing(true); Field richTextField = listener.createRichTextField(); richTextField.setCaption("Teaser"); richTextField.setWidth("100%"); richTextField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { try { articleItem.removeItemProperty("siteAlert"); articleItem.addItemProperty("siteAlert", DefaultPropertyUtil.newDefaultProperty(String.class, event.getProperty().getValue().toString())); articleItem.applyChanges(); } catch (RepositoryException e) { e.printStackTrace(); } } }); centerpieceSettings.addComponent(richTextField); Label placementLabel = new Label("", ContentMode.HTML); placementLabel.setCaption("Placement"); centerpieceSettings.addComponent(placementLabel); CheckBox home = listener.createCheckBox("Home Page"); centerpieceSettings.addComponent(home); CheckBox news = listener.createCheckBox("News Landing"); centerpieceSettings.addComponent(news); CheckBox comm = listener.createCheckBox("Community Landing"); centerpieceSettings.addComponent(comm); CheckBox team = listener.createCheckBox("Team Landing"); centerpieceSettings.addComponent(team); CheckBox cheer = listener.createCheckBox("Cheerleader Landing"); centerpieceSettings.addComponent(cheer); centerpieceLayout.addComponent(centerpieceSettings); Label previewLabel = new Label("", ContentMode.HTML); previewLabel.setCaption("Centerpiece preview"); centerpieceLayout.addComponent(previewLabel); centerPiece.setContent(centerpieceLayout); }
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
/** * Initialize VVRs representation./* w w w. j a v a 2 s. c om*/ * * @param jmxHandler */ private final void initVvrManagerUi(final JmxHandler jmxHandler) { // Create Model for vvrManager vvrManagerModel = jmxHandler.createVvrManagerModel(); // Vvr representation vvrsTabsheet = new TabSheet(); vvrManagerLayout.addComponent(vvrsTabsheet); // Sheet 0 create new VVR final VerticalLayout lastLayout = new VerticalLayout(); lastLayout.setWidth("100%"); lastLayout.setHeight(lastLayoutHeight); vvrsTabsheet.addTab(lastLayout, "+"); // Add a sheet for each vvr final Set<UUID> vvrUuidList = vvrManagerModel.getVvrs(); for (final UUID vvrUuid : vvrUuidList) { addVvr(vvrUuid); } // Window to create a new vvr (display on the last tabsheet) final VvrCreateWindow createWindow = new VvrCreateWindow(new PostProcessing() { @Override public void execute() { // After creation select the first tab vvrsTabsheet.setSelectedTab(0); } }); vvrsTabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) { final TabSheet tabsheet = event.getTabSheet(); final String caption = tabsheet.getTab(tabsheet.getSelectedTab()).getCaption(); if (caption.equals("+")) { createWindow.add(vvrManagerModel); } else { // Remove window if another tab is selected createWindow.remove(); } } }); // If no other tab, display creation window (+ tab can not be selected) if (vvrUuidList.isEmpty()) { createWindow.add(vvrManagerModel); } }
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
/** * Add a VVR user interface./*from w ww . j a va 2 s. c o m*/ * * @param vvrUuid * the vvr unique identifier * */ public final void addVvr(final UUID vvrUuid) { // Create a vvr model final VvrModel vvrModel = jmxHandler.createVvrModel(vvrUuid); vvrModels.put(vvrUuid, vvrModel); // Layout for the first component final VerticalLayout vvrLayout = new VerticalLayout(); vvrLayout.setWidth("100%"); vvrsTabsheet.addTab(vvrLayout, vvrModel.getVvrName(), null, vvrsTabsheet.getComponentCount() - 1); vvrLayouts.put(vvrUuid, vvrLayout); // Create component for vvr operations final VvrOperationComponent op = new VvrOperationComponent(vvrManagerModel); final AbstractComponent opComponent = op.createComponent(vvrModel, jmxHandler); opComponent.setHeight(opLayoutHeight); vvrLayout.addComponent(opComponent); final Label label = new Label(" ", ContentMode.HTML); label.setHeight(labelLayoutHeight); vvrLayout.addComponent(label); vvrLayout.addComponent(new Label("<hr />", ContentMode.HTML)); // Create Tool tip for attributes final VvrAttributesComponent attr = new VvrAttributesComponent(vvrUuid); vvrsTabsheet.getTab(vvrLayout).setDescription(attr.createComponent(vvrModel)); // If there was only the + sheet, select the new vvr sheet if (vvrsTabsheet.getComponentCount() == 2) { vvrsTabsheet.setSelectedTab(0); } // Create its panel final HorizontalSplitPanel panel = new HorizontalSplitPanel(); vvrLayout.addComponent(panel); panel.setWidth("100%"); panel.setHeight(panelLayoutHeight); panel.setSplitPosition(35); // Component to display snapshot/device atributes final VerticalLayout vvrTreeLayout = new VerticalLayout(); final VvrTreeComponent vvrTreeComponent = new VvrTreeComponent(vvrTreeLayout); panel.setFirstComponent(vvrTreeComponent.createComponent(vvrModel, jmxHandler)); panel.setSecondComponent(vvrTreeLayout); vvrTreeComponents.put(vvrUuid, vvrTreeComponent); }
From source file:com.openhris.employee.allowance.EmployeeAllowanceInformation.java
Window remarks(final String buttonCaption) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true);// w w w .j av a 2 s . c o m v.setSpacing(true); remarksSubWindow = new Window("REMARKS", v); remarksSubWindow.setWidth("400px"); remarksSubWindow.setModal(true); remarksSubWindow.center(); remarks = new TextArea("Add Remarks: "); remarks.setWidth("100%"); remarks.setRows(3); remarksSubWindow.addComponent(remarks); Button b = new Button(buttonCaption); b.setWidth("100%"); b.addListener(updateClickListener); remarksSubWindow.addComponent(b); return remarksSubWindow; }
From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java
private Window editDateEntryWindow(final String entryDate) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setWidth("100%"); vlayout.setMargin(true);/*from ww w .ja v a 2s. c o m*/ vlayout.setSpacing(true); final Window window = new Window("EDIT DATE ENTRY", vlayout); window.setResizable(false); Button editBtn = new Button("EDIT DATE ENTRY?"); editBtn.setWidth("100%"); editBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { boolean result = si.editEmploymentDateEntry(getEmployeeId(), entryDate); if (result) { getWindow().showNotification("Update Entry Date.", Window.Notification.TYPE_TRAY_NOTIFICATION); (window.getParent()).removeWindow(window); } } }); window.addComponent(editBtn); return window; }
From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleTab.java
License:Open Source License
private void init() { setMargin(true);/* w ww .j av a 2s . c o m*/ setSpacing(true); // ---------------------------------------------------- // Title // ---------------------------------------------------- HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true); header.setMargin(true); Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(), getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion())); title.addStyleName("h1"); header.addComponent(title); header.setComponentAlignment(title, Alignment.MIDDLE_LEFT); addComponent(header); // ---------------------------------------------------- // Action(s) Bar // ---------------------------------------------------- HorizontalLayout actions = new HorizontalLayout(); if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) { Button changeState = new Button(); changeState.addClickListener(new StartBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Start"); changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png")); actions.addComponent(changeState); } if (BundleHelper.isState(bundle, Bundle.ACTIVE)) { Button changeState = new Button(); changeState.addClickListener(new StopBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Stop"); changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png")); actions.addComponent(changeState); } // Update Button update = new Button(); update.addClickListener(new UpdateBundleClickListener(bundle, notifierService)); //update.addStyleName("no-padding"); update.setCaption("Update"); update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png")); actions.addComponent(update); // Trash Button trash = new Button(); trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService)); //trash.addStyleName("no-padding"); trash.setCaption("Remove"); trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png")); actions.addComponent(trash); addComponent(actions); setComponentAlignment(actions, Alignment.MIDDLE_RIGHT); // ---------------------------------------------------- // Standard Section // ---------------------------------------------------- Table table = new Table(); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setWidth("100%"); Section mainSection = new Section("Standard", table); addComponent(mainSection); table.addContainerProperty("label", Label.class, null); table.addContainerProperty("value", Label.class, null); table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) }, "bundle.id"); for (Map.Entry<String, String> entry : HEADERS.entrySet()) { String value = getHeader(bundle, entry.getKey()); if (value != null) { table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey()); } } table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location"); Date date = new Date(bundle.getLastModified()); table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified"); // ---------------------------------------------------- // Packages Section // ---------------------------------------------------- FilteredPackageTable exported = new FilteredPackageTable("Exported"); FilteredPackageTable imported = new FilteredPackageTable("Imported"); GridLayout packages = new GridLayout(2, 1); packages.addComponent(exported); packages.addComponent(imported); packages.setSpacing(true); packages.setWidth("100%"); Section packagesSection = new Section("Packages", packages); addComponent(packagesSection); BundleWiring wiring = bundle.adapt(BundleWiring.class); if (wiring != null) { for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) { String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); Version version = (Version) capability.getAttributes() .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE); exported.addPackage(format("%s (%s)", name, version)); } for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) { String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE); imported.addPackage(filter); } } // ---------------------------------------------------- // Services Section // ---------------------------------------------------- FilteredServiceTable registered = new FilteredServiceTable("Registered"); FilteredServiceTable used = new FilteredServiceTable("Used Services"); VerticalLayout services = new VerticalLayout(registered, used); services.setSpacing(true); services.setWidth("100%"); ServiceReference<?>[] registeredServices = bundle.getRegisteredServices(); if (registeredServices != null) { for (ServiceReference<?> reference : registeredServices) { registered.addService(reference); } } ServiceReference<?>[] inUseServices = bundle.getServicesInUse(); if (inUseServices != null) { for (ServiceReference<?> reference : inUseServices) { used.addService(reference); } } if (!registered.isEmpty() || !used.isEmpty()) { Section servicesSection = new Section("Services", services); addComponent(servicesSection); } // ---------------------------------------------------- // Raw Manifest Section // ---------------------------------------------------- Page.Styles styles = Page.getCurrent().getStyles(); styles.add(".monospaced-font {font-family: monospace !important; }"); Table manifest = new Table(); manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); manifest.setWidth("100%"); manifest.addStyleName("monospaced-font"); manifest.setPageLength(15); manifest.addContainerProperty("name", String.class, null); manifest.addContainerProperty("value", String.class, null); Dictionary<String, String> headers = bundle.getHeaders(); for (String key : Collections.list(headers.keys())) { manifest.addItem(new Object[] { key, headers.get(key) }, null); } Section manifestSection = new Section("Manifest", manifest); addComponent(manifestSection); }
From source file:com.purebred.core.MainApplication.java
License:Open Source License
/** * Open separate error Window, useful for showing stacktraces. * * @param message// ww w .j a v a 2s. c om */ public void openErrorWindow(String message) { Window errorWindow = new Window("Error"); errorWindow.addStyleName("opaque"); VerticalLayout layout = (VerticalLayout) errorWindow.getContent(); layout.setSpacing(true); layout.setWidth("100%"); errorWindow.setWidth("100%"); errorWindow.setModal(true); Label label = new Label(message); label.setContentMode(Label.CONTENT_PREFORMATTED); layout.addComponent(label); errorWindow.setClosable(true); errorWindow.setScrollable(true); MainApplication.getInstance().getMainWindow().addWindow(errorWindow); }