List of usage examples for com.vaadin.ui Label setHeight
@Override public void setHeight(String height)
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"); }//from w ww . j a va 2s. c om 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.shell.view.MainViewImpl.java
License:Open Source License
private MHorizontalLayout buildAccountMenuLayout() { accountLayout.removeAllComponents(); if (SiteConfiguration.isDemandEdition()) { // display trial box if user in trial mode SimpleBillingAccount billingAccount = AppContext.getBillingAccount(); if (AccountStatusConstants.TRIAL.equals(billingAccount.getStatus())) { if ("Free".equals(billingAccount.getBillingPlan().getBillingtype())) { Label informLbl = new Label( "<div class='informBlock'>FREE CHARGE<br>UPGRADE</div><div class='informBlock'>>></div>", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withFullHeight() .withStyleName("trialInformBox"); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addLayoutClickListener(layoutClickEvent -> EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }))); accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT); } else { Label informLbl = new Label("", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withStyleName("trialInformBox") .withMargin(new MarginInfo(false, true, false, false)).withFullHeight(); informBox.addLayoutClickListener(layoutClickEvent -> EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }))); accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT); Duration dur = new Duration(new DateTime(billingAccount.getCreatedtime()), new DateTime()); int daysLeft = dur.toStandardDays().getDays(); if (daysLeft > 30) { informLbl.setValue("<div class='informBlock'>Trial ended<br></div>"); AppContext.getInstance().setIsValidAccount(false); } else { informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days " + "left</div><div class='informBlock'>>></div>", 30 - daysLeft)); }/*from w w w . ja va2s . c o m*/ } } } Label accountNameLabel = new Label(AppContext.getSubDomain()); accountNameLabel.addStyleName("subdomain"); accountLayout.addComponent(accountNameLabel); if (SiteConfiguration.isCommunityEdition()) { MButton buyPremiumBtn = new MButton("Upgrade to Pro edition", clickEvent -> UI.getCurrent().addWindow(new AdWindow())).withIcon(FontAwesome.SHOPPING_CART) .withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { LicenseInfo licenseInfo = licenseResolver.getLicenseInfo(); if (licenseInfo != null) { if (licenseInfo.isExpired()) { MButton buyPremiumBtn = new MButton(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION), clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } else if (licenseInfo.isTrial()) { Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate())); int days = dur.toStandardDays().getDays(); MButton buyPremiumBtn = new MButton( AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } } } NotificationComponent notificationComponent = new NotificationComponent(); accountLayout.addComponent(notificationComponent); if (StringUtils.isBlank(AppContext.getUser().getAvatarid())) { EventBusFactory.getInstance() .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification())); } if (!SiteConfiguration.isDemandEdition()) { ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class); if (!mailService.isMailSetupValid()) { EventBusFactory.getInstance() .post(new ShellEvent.NewNotification(this, new SmtpSetupNotification())); } SimpleUser user = AppContext.getUser(); GregorianCalendar tenDaysAgo = new GregorianCalendar(); tenDaysAgo.add(Calendar.DATE, -10); if (Boolean.TRUE.equals(user.getRequestad()) && user.getRegisteredtime().before(tenDaysAgo.getTime())) { UI.getCurrent().addWindow(new AdRequestWindow(user)); } } Resource userAvatarRes = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 24); final PopupButton accountMenu = new PopupButton(""); accountMenu.setIcon(userAvatarRes); accountMenu.setDescription(AppContext.getUserDisplayName()); OptionPopupContent accountPopupContent = new OptionPopupContent(); MButton myProfileBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE)); accountPopupContent.addOption(myProfileBtn); MButton userMgtBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS)); accountPopupContent.addOption(userMgtBtn); MButton generalSettingBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING)); accountPopupContent.addOption(generalSettingBtn); MButton themeCustomizeBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE)); accountPopupContent.addOption(themeCustomizeBtn); if (!SiteConfiguration.isDemandEdition()) { MButton setupBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" })); }).withIcon(FontAwesome.WRENCH); accountPopupContent.addOption(setupBtn); } accountPopupContent.addSeparator(); MButton helpBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(FontAwesome.MORTAR_BOARD); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); accountPopupContent.addOption(helpBtn); MButton supportBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT)) .withIcon(FontAwesome.LIFE_SAVER); ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/"); BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes); supportOpener.extend(supportBtn); accountPopupContent.addOption(supportBtn); MButton translateBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE)) .withIcon(FontAwesome.PENCIL); ExternalResource translateRes = new ExternalResource( "https://community.mycollab.com/docs/developing-mycollab/translating/"); BrowserWindowOpener translateOpener = new BrowserWindowOpener(translateRes); translateOpener.extend(translateBtn); accountPopupContent.addOption(translateBtn); if (!SiteConfiguration.isCommunityEdition()) { MButton myAccountBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING)); accountPopupContent.addOption(myAccountBtn); } accountPopupContent.addSeparator(); MButton aboutBtn = new MButton("About MyCollab", clickEvent -> { accountMenu.setPopupVisible(false); Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class); UI.getCurrent().addWindow(aboutWindow); }).withIcon(FontAwesome.INFO_CIRCLE); accountPopupContent.addOption(aboutBtn); Button releaseNotesBtn = new Button("Release Notes"); ExternalResource releaseNotesRes = new ExternalResource( "https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/"); BrowserWindowOpener releaseNotesOpener = new BrowserWindowOpener(releaseNotesRes); releaseNotesOpener.extend(releaseNotesBtn); releaseNotesBtn.setIcon(FontAwesome.BULLHORN); accountPopupContent.addOption(releaseNotesBtn); MButton signoutBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null)); }).withIcon(FontAwesome.SIGN_OUT); accountPopupContent.addSeparator(); accountPopupContent.addOption(signoutBtn); accountMenu.setContent(accountPopupContent); accountLayout.addComponent(accountMenu); return accountLayout; }
From source file:com.mycollab.web.AdWindow.java
License:Open Source License
public AdWindow() { super("Buy MyCollab Pro edition"); this.setWidth("700px"); this.setModal(true); this.setResizable(false); RestTemplate restTemplate = new RestTemplate(); MVerticalLayout content = new MVerticalLayout(); try {// w ww. j a va2 s .c o m String result = restTemplate.getForObject("https://api.mycollab.com/api/storeweb", String.class); Label webPage = new Label(result, ContentMode.HTML); webPage.setHeight("600px"); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } catch (Exception e) { Div informDiv = new Div() .appendText("Can not load the store page. You can check the online edition at ") .appendChild(new A("https://www.mycollab.com/pricing/download/", "_blank").appendText("here")); Label webPage = new Label(informDiv.write(), ContentMode.HTML); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { MButton editLicenseBtn = new MButton("Enter license code", clickEvent -> { Window activateWindow = ViewManager.getCacheComponent(AbstractLicenseActivationWindow.class); UI.getCurrent().addWindow(activateWindow); close(); }).withStyleName(UIConstants.BUTTON_ACTION); content.with(editLicenseBtn).withAlign(editLicenseBtn, Alignment.MIDDLE_CENTER); } }
From source file:com.mycollab.web.BuyPremiumSoftwareWindow.java
License:Open Source License
public BuyPremiumSoftwareWindow() { super("Buy MyCollab Pro edition"); this.setWidth("700px"); this.setModal(true); this.setResizable(false); RestTemplate restTemplate = new RestTemplate(); MVerticalLayout content = new MVerticalLayout(); try {/*from www .j a va 2s. c o m*/ String result = restTemplate.getForObject("https://api.mycollab.com/api/linktobuy", String.class); Label webPage = new Label(result, ContentMode.HTML); webPage.setHeight("600px"); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } catch (Exception e) { String result = FileUtils.readFileAsPlainString("buying.html"); Label webPage = new Label(result, ContentMode.HTML); this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { MButton editLicenseBtn = new MButton("Enter license code", clickEvent -> { Window activateWindow = ViewManager.getCacheComponent(AbstractLicenseActivationWindow.class); UI.getCurrent().addWindow(activateWindow); close(); }).withStyleName(UIConstants.BUTTON_ACTION); content.with(editLicenseBtn).withAlign(editLicenseBtn, Alignment.MIDDLE_CENTER); } }
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
@Override protected void init(final VaadinRequest request) { // Listener to disconnect JMX connection on exit. addDetachListener(new DetachListener() { @Override/* www .j ava 2 s .c o m*/ public void detach(final DetachEvent event) { jmxHandler.disconnect(); } }); setPollInterval(1000); final Label labelLeft = new Label(""); final Label labelRight = new Label(""); labelLeft.setHeight("100%"); labelRight.setHeight("100%"); final HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); rootLayout.setWidth(rootLayoutWidth); rootLayout.setImmediate(true); rootLayout.addComponent(vvrManagerLayout); vvrManagerLayout.setMargin(false); vvrManagerLayout.setSpacing(true); vvrManagerLayout.setWidth(rootLayoutWidth); content.addComponent(labelLeft); content.addComponent(rootLayout); content.addComponent(labelRight); content.setExpandRatio(labelLeft, 0.5f); content.setExpandRatio(labelRight, 0.5f); content.setComponentAlignment(rootLayout, Alignment.TOP_CENTER); setContent(content); // Init Jmx Handler try { jmxHandler.connect(); // Init ui initVvrManagerUi(jmxHandler); } catch (final Exception e) { LOGGER.error("Can not connect to JMX", e); } }
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
/** * Add a VVR user interface.//from ww w .j a v a 2s.co 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.wintindustries.pfserver.interfaces.view.dashboard.ErrorView.java
public ErrorView() { setSizeUndefined(); // <-- This is the important part this.setStyleName("error-page"); setSizeFull();// w w w. j a v a 2 s. c o m errorInfo = new VerticalLayout(); this.addComponent(errorInfo); VerticalLayout errorTitle = new VerticalLayout(); Label pagetitle = new Label("500"); Label label = new Label("", Label.CONTENT_XHTML); label.setStyleName("error-page-line"); label.setWidth("400px"); pagetitle.setHeight("210px"); Label errorType = new Label("Internal Server Error"); pagetitle.setStyleName("error-page-title"); errorTitle.addComponent(pagetitle); errorTitle.addComponent(label); errorTitle.setComponentAlignment(pagetitle, Alignment.BOTTOM_LEFT); errorTitle.setWidth("90%"); errorInfo.setHeightUndefined(); errorInfo.addComponent(errorTitle); errorInfo.setComponentAlignment(errorTitle, Alignment.BOTTOM_LEFT); }
From source file:de.fzi.fhemapi.view.vaadin.ui.model.DeviceDetailEntry.java
License:Apache License
private static Label buildRichTextField(String text) { Label label = new Label(); label.setImmediate(false);/*from w w w. ja va 2 s . c o m*/ label.setWidth("-1px"); label.setHeight("-1px"); label.setValue(text); label.setContentMode(Label.CONTENT_XHTML); return label; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
private static HorizontalLayout getTitlePanel() { HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false);//from ww w . j ava 2 s . c o m titleLayout.setWidth("-1"); titleLayout.setHeight("-1"); titleLayout.setMargin(false); // deviceTitle Label title = new Label(); title.setImmediate(true); title.setWidth("100%"); title.setHeight("50"); title.setValue("<h1>Neues Gert..</h1>"); title.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(title); titleLayout.setComponentAlignment(title, Alignment.TOP_CENTER); return titleLayout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java
License:Apache License
private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); nameTextField = new TextField(); HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField); layout.addComponent(nameLay);/*ww w.j a v a 2 s.c om*/ typeComboBox = new ComboBox(); for (String type : roomTypes) { typeComboBox.addItem(type); } HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typeLay); layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER); Label devicesLabel = new Label(); devicesLabel.setImmediate(false); devicesLabel.setWidth("100%"); devicesLabel.setHeight("50"); devicesLabel.setValue("<b>Gerte</b>"); devicesLabel.setContentMode(Label.CONTENT_XHTML); layout.addComponent(devicesLabel); layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER); List<Device> deviceList = parent.server.getDeviceManager().getDevices(); devicesCheckBox = new CheckBox[deviceList.size()]; for (int i = 0; i < deviceList.size(); i++) { devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName()); layout.addComponent(devicesCheckBox[i]); layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER); } Button saveButton = new Button("Speichern"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> names = new LinkedList<String>(); for (CheckBox checkbox : devicesCheckBox) { if (checkbox.booleanValue()) names.add(checkbox.getCaption()); } Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(), names); MessageResponse response = parent.server.getStructureManager().createNewStructure(struc); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getStructureManager().rereadFromFHEM(); parent.reloadTree(); } }); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); return layout; }