List of usage examples for com.vaadin.server FontAwesome WRENCH
FontAwesome WRENCH
To view the source code for com.vaadin.server FontAwesome WRENCH.
Click Source Link
From source file:com.esofthead.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%"); HorizontalLayout informBox = new HorizontalLayout(); informBox.addStyleName("trialInformBox"); informBox.setSizeFull(); informBox.addComponent(informLbl); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { private static final long serialVersionUID = 1L; @Override/*w ww . j a va 2s .c om*/ public void layoutClick(LayoutClickEvent event) { 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%"); HorizontalLayout informBox = new HorizontalLayout(); informBox.addStyleName("trialInformBox"); informBox.setSizeFull(); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addComponent(informLbl); informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(LayoutClickEvent event) { 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<br></div><div class='informBlock'>>></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)); } } } } Label accountNameLabel = new Label(AppContext.getSubDomain()); accountNameLabel.addStyleName("subdomain"); accountLayout.addComponent(accountNameLabel); if (SiteConfiguration.isCommunityEdition()) { Button buyPremiumBtn = new Button("Upgrade to Pro edition", new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new AdWindow()); } }); buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART); buyPremiumBtn.addStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { LicenseInfo licenseInfo = licenseResolver.getLicenseInfo(); if (licenseInfo != null) { if (licenseInfo.isExpired()) { Button buyPremiumBtn = new Button(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION), new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow()); } }); buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART); buyPremiumBtn.addStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } else if (licenseInfo.isTrial()) { Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate())); int days = dur.toStandardDays().getDays(); Button buyPremiumBtn = new Button( AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow()); } }); buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART); buyPremiumBtn.addStyleName("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(); Button myProfileBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); } }); myProfileBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE)); accountPopupContent.addOption(myProfileBtn); Button userMgtBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" })); } }); userMgtBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS)); accountPopupContent.addOption(userMgtBtn); Button generalSettingBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING), new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post( new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" })); } }); generalSettingBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING)); accountPopupContent.addOption(generalSettingBtn); Button themeCustomizeBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" })); } }); themeCustomizeBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE)); accountPopupContent.addOption(themeCustomizeBtn); if (!SiteConfiguration.isDemandEdition()) { Button setupBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" })); } }); setupBtn.setIcon(FontAwesome.WRENCH); accountPopupContent.addOption(setupBtn); } accountPopupContent.addSeparator(); Button helpBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_HELP)); helpBtn.setIcon(FontAwesome.MORTAR_BOARD); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); accountPopupContent.addOption(helpBtn); Button supportBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT)); supportBtn.setIcon(FontAwesome.LIFE_SAVER); ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/"); BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes); supportOpener.extend(supportBtn); accountPopupContent.addOption(supportBtn); Button translateBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE)); translateBtn.setIcon(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()) { Button myAccountBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); } }); myAccountBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING)); accountPopupContent.addOption(myAccountBtn); } accountPopupContent.addSeparator(); Button aboutBtn = new Button("About MyCollab", new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class); UI.getCurrent().addWindow(aboutWindow); } }); aboutBtn.setIcon(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); Button signoutBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null)); } }); signoutBtn.setIcon(FontAwesome.SIGN_OUT); accountPopupContent.addSeparator(); accountPopupContent.addOption(signoutBtn); accountMenu.setContent(accountPopupContent); accountLayout.addComponent(accountMenu); return accountLayout; }
From source file:com.github.moscaville.contactsdb.ValoSideBarUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { super.init(vaadinRequest); CssLayout header = new CssLayout(); MenuBar menuBar = new MenuBar(); header.addComponent(menuBar);//w ww. j ava 2s.c o m MenuBar.MenuItem settingsItem = menuBar.addItem("", FontAwesome.WRENCH, null); sideBar.setHeader(header); //categories = categoryController.loadItems(100, 0, new CategoryRecord()); //representatives = representativeController.loadItems(100, 0, new RepresentativeRecord()); }
From source file:com.hybridbpm.ui.component.development.ConnectorEditor.java
License:Apache License
public ConnectorEditor(Module Module) { super();//from w w w . j av a 2 s .com this.Module = HybridbpmUI.getDevelopmentAPI().getModuleById(Module.getId()); ; btnRun.setIcon(FontAwesome.PLAY); replaceComponent(horizontalSplitPanel, codeEditorLayout); btnParameters.setIcon(FontAwesome.WRENCH); buttonBar.addComponent(btnParameters, 0); buttonBar.addComponent(btnRun, 0); codeEditorLayout.setSizeFull(); codeEditorLayout.addStyleName("code"); codeEditorLayout.setMargin(new MarginInfo(false, false, false, true)); binder.setItemDataSource(this.Module); binder.bind(codeEditor, "code"); switch (Module.getType()) { case CONNECTOR: codeEditor.setCaption("Code"); codeEditor.setMode(AceMode.groovy); codeEditor.setTheme(AceTheme.textmate); codeEditor.setShowGutter(true); codeEditor.setSizeFull(); break; } }
From source file:com.hybridbpm.ui.component.development.FormEditor.java
License:Apache License
public FormEditor(Module module) { super();//from w ww . j a v a 2s.co m this.module = HybridbpmUI.getDevelopmentAPI().getModuleById(module.getId()); ; btnRun.setIcon(FontAwesome.PLAY); btnRun.setStyleName(ValoTheme.BUTTON_BORDERLESS); btnRun.addStyleName(ValoTheme.BUTTON_SMALL); btnParameters.setIcon(FontAwesome.WRENCH); btnParameters.setStyleName(ValoTheme.BUTTON_BORDERLESS); btnParameters.addStyleName(ValoTheme.BUTTON_SMALL); horizontalSplitPanel.addComponents(designEditorLayout, codeEditorLayout); buttonBar.addComponent(btnParameters, 0); buttonBar.addComponent(btnRun, 0); codeEditorLayout.setSizeFull(); codeEditorLayout.addStyleName("code"); codeEditorLayout.setMargin(new MarginInfo(false, false, false, true)); designEditorLayout.setSizeFull(); designEditorLayout.addStyleName("template"); designEditorLayout.setMargin(new MarginInfo(false, true, false, false)); binder.setItemDataSource(this.module); binder.bind(codeEditor, "code"); binder.bind(designEditor, "design"); switch (module.getType()) { case FORM: designEditor.setCaption("Design"); designEditor.setMode(AceMode.html); designEditor.setTheme(AceTheme.textmate); designEditor.setShowGutter(true); designEditor.setSizeFull(); codeEditor.setCaption("Code"); codeEditor.setMode(AceMode.groovy); codeEditor.setTheme(AceTheme.textmate); codeEditor.setShowGutter(true); codeEditor.setSizeFull(); horizontalSplitPanel.setSplitPosition(50, Sizeable.Unit.PERCENTAGE); btnRun.setCaption("Test"); break; } if (module.getTemplate()) { btnRun.setVisible(false); btnParameters.setVisible(false); } }
From source file:com.hybridbpm.ui.view.AdministrationView.java
License:Apache License
public AdministrationView() { Design.read(this); Responsive.makeResponsive(panelLayout); tabSheet.addTab(systemParametersLayout, "Parameters", FontAwesome.WRENCH); tabSheet.addTab(allProgressLayout, "Processes", FontAwesome.COGS); // tabSheet.addTab(viewsLayout, "Views", FontAwesome.LIST); tabSheet.addSelectedTabChangeListener(this); systemParametersLayout.refreshTable(); allProgressLayout.setTabSheet(tabSheet); }
From source file:com.hybridbpm.ui.view.DevelopmentView.java
License:Apache License
public DevelopmentView() { Design.read(this); Responsive.makeResponsive(panelLayout); moduleType.addContainerProperty("NAME", String.class, null); moduleType.addItem(Boolean.FALSE).getItemProperty("NAME").setValue("Module"); moduleType.addItem(Boolean.TRUE).getItemProperty("NAME").setValue("Template"); moduleType.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); moduleType.setItemCaptionPropertyId("NAME"); moduleType.setValue(Boolean.FALSE); moduleType.addValueChangeListener(this); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); btnAdd.addClickListener(this); btnRefresh.setIcon(FontAwesome.REFRESH); btnRefresh.addClickListener(this); btnExport.setIcon(FontAwesome.CLOUD_UPLOAD); btnExport.addClickListener(this); btnImport.setIcon(FontAwesome.CLOUD_DOWNLOAD); btnImport.addClickListener(this); btnRegenerate.setIcon(FontAwesome.WRENCH); btnRegenerate.addClickListener(this); modulesLayout.setMargin(new MarginInfo(true, false, false, false)); modulesLayout.setExpandRatio(modulesTable, 1f); modulesTable.addContainerProperty("title", Component.class, null, "Title", null, Table.Align.LEFT); modulesTable.setColumnExpandRatio("title", 1f); modulesTable.addContainerProperty("updateDate", Date.class, null, "Update Date", null, Table.Align.LEFT); modulesTable.addContainerProperty("actions", TableButtonBar.class, null, "Actions", null, Table.Align.LEFT); modulesTable.setColumnWidth("updateDate", 150); modulesTable.setColumnWidth("actions", 80); modulesTable.addGeneratedColumn("updateDate", new DateColumnGenerator()); modulesTable.setVisibleColumns("title", "updateDate", "actions"); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java
public UserDetailsWidget() { HorizontalLayout h = new HorizontalLayout(); addComponent(h);/*from w ww . j av a2 s .com*/ h.setSizeFull(); //h.setSpacing(true); Button userPhoto = new Button(); userPhoto.setIcon(FontAwesome.USER); userPhoto.setHeight("100px"); userPhoto.setWidth("100px"); h.addComponent(userPhoto); //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT); VerticalLayout v = new VerticalLayout(); //v.setStyleName("backColorBlack"); h.addComponent(v); v.setStyleName("v-layout-padding-left"); //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT); v.setHeight("106px"); v.setWidth("100px"); // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); Button editProfile = new Button("Profile"); editProfile.setStyleName("v-button-type3"); editProfile.setIcon(FontAwesome.USER); editProfile.setWidth("100px"); editProfile.setWidth("102px"); v.addComponent(editProfile); //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT); Button settings = new Button("Settings"); settings.setStyleName("v-button-type3"); settings.setIcon(FontAwesome.WRENCH); settings.setWidth("100px"); settings.setWidth("102px"); v.addComponent(settings); //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT); Button logOut = new Button("Log Out"); logOut.setStyleName("v-button-type3"); logOut.setIcon(FontAwesome.KEY); logOut.setWidth("100px"); logOut.setWidth("102px"); v.addComponent(logOut); //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT); //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); }
From source file:com.mycollab.community.shell.view.MainViewImpl.java
License:Open Source License
@Override protected MHorizontalLayout buildAccountMenuLayout() { accountLayout.removeAllComponents(); Label accountNameLabel = new Label(MyCollabUI.getSubDomain()); accountNameLabel.addStyleName("subDomain"); accountLayout.addComponent(accountNameLabel); /*MButton buyPremiumBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new AdWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad") .withDescription(UserUIContext.getMessage(LicenseI18nEnum.OPT_TRIAL_THE_PRO_EDITION)); accountLayout.addComponent(buyPremiumBtn);*/ NotificationComponent notificationComponent = new NotificationComponent(); accountLayout.addComponent(notificationComponent); if (StringUtils.isBlank(UserUIContext.getUser().getAvatarid())) { EventBusFactory.getInstance()//from w ww . ja v a 2 s . c om .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification())); } ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class); if (!mailService.isMailSetupValid()) { EventBusFactory.getInstance().post(new ShellEvent.NewNotification(this, new SmtpSetupNotification())); } SimpleUser user = UserUIContext.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(UserUIContext.getUserAvatarId(), 24); final PopupButton accountMenu = new PopupButton(""); accountMenu.setIcon(userAvatarRes); accountMenu.setDescription(UserUIContext.getUserDisplayName()); OptionPopupContent accountPopupContent = new OptionPopupContent(); MButton myProfileBtn = new MButton(UserUIContext.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(UserUIContext.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(UserUIContext.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 setupBtn = new MButton(UserUIContext.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(UserUIContext.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(UserUIContext.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(UserUIContext.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);*/ accountPopupContent.addSeparator(); /* MButton aboutBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.OPT_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(UserUIContext.getMessage(ShellI18nEnum.OPT_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(UserUIContext.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.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 www. j a va 2 s.com } } } 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:facs.components.BookAdmin.java
License:Open Source License
public BookAdmin(User user) { Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); System.out.println(ft.format(dNow) + " INFO Calendar Admin accessed! - User: " + LiferayAndVaadinUtils.getUser().getScreenName()); Label infoLabel = new Label( DBManager.getDatabaseInstance().getUserNameByUserID(LiferayAndVaadinUtils.getUser().getScreenName()) + " " + LiferayAndVaadinUtils.getUser().getScreenName()); infoLabel.addStyleName("h4"); String buttonRefreshTitle = "Refresh"; Button refresh = new Button(buttonRefreshTitle); refresh.setIcon(FontAwesome.REFRESH); refresh.setSizeFull();/* w w w. j av a 2s . c om*/ refresh.setDescription("Click here to reload the data from the database!"); refresh.addStyleName(ValoTheme.BUTTON_FRIENDLY); String buttonUpdateTitle = "Update"; Button updateUser = new Button(buttonUpdateTitle); updateUser.setIcon(FontAwesome.WRENCH); updateUser.setSizeFull(); updateUser.setDescription("Click here to update your user role and group!"); userDevice = new ListSelect("Select a device"); userDevice.addItems(DBManager.getDatabaseInstance().getDeviceNames()); userDevice.setRows(6); userDevice.setNullSelectionAllowed(false); userDevice.setSizeFull(); userDevice.setImmediate(true); /* * userDevice.addValueChangeListener(e -> Notification.show("Device:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userGroup = new ListSelect("Select a user group"); userGroup.addItems(DBManager.getDatabaseInstance().getUserGroups()); userGroup.setRows(6); userGroup.setNullSelectionAllowed(false); userGroup.setSizeFull(); userGroup.setImmediate(true); /* * userGroup.addValueChangeListener(e -> Notification.show("User Group:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userRole = new ListSelect("Select a user role"); userRole.addItems(DBManager.getDatabaseInstance().getUserRoles()); userRole.setRows(6); userRole.setNullSelectionAllowed(false); userRole.setSizeFull(); userRole.setImmediate(true); /* * userRole.addValueChangeListener(e -> Notification.show("User Role:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ refresh.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); updateUser.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496909L; @Override public void buttonClick(ClickEvent event) { try { if (userDevice.getValue().equals(null) || userRole.getValue().equals(null) || userGroup.getValue().equals(null)) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); // System.out.println("Device: "+userDevice.getValue()+" Group: "+userGroup.getValue()+" Role: "+userRole.getValue()); } else { DBManager.getDatabaseInstance().getShitDone( DBManager.getDatabaseInstance().getUserRoleIDbyDesc(userRole.getValue().toString()), DBManager.getDatabaseInstance() .getUserIDbyLDAPID(LiferayAndVaadinUtils.getUser().getScreenName()), DBManager.getDatabaseInstance() .getDeviceIDByName(userDevice.getValue().toString())); DBManager.getDatabaseInstance().getShitDoneAgain( DBManager.getDatabaseInstance() .getUserGroupIDByName(userGroup.getValue().toString()), LiferayAndVaadinUtils.getUser().getScreenName()); } } catch (Exception e) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); } refreshDataSources(); } }); // only admins are allowed to see the admin panel ;) if (!DBManager.getDatabaseInstance() .getUserAdminPanelAccessByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName()).equals("1")) { VerticalLayout errorLayout = new VerticalLayout(); infoLabel.setValue("ACCESS DENIED"); errorLayout.addComponent(infoLabel); showErrorNotification("Access Denied!", "Sorry, you're not allowed to see anything here, at least your username told us so. Do you need assistance? Please contact 'info@qbic.uni-tuebingen.de'."); setCompositionRoot(errorLayout); return; } this.setCaption("Admin"); final TabSheet bookAdmin = new TabSheet(); bookAdmin.addStyleName(ValoTheme.TABSHEET_FRAMED); bookAdmin.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS); ArrayList<String> deviceNames = new ArrayList<String>(); deviceNames = DBManager.getDatabaseInstance().getDeviceNames(); bookAdmin.addTab(awaitingRequestsGrid()); for (int i = 0; i < deviceNames.size(); i++) { bookAdmin.addTab(newDeviceGrid(deviceNames.get(i))); } bookAdmin.addTab(deletedBookingsGrid()); bookAdmin.addSelectedTabChangeListener(new SelectedTabChangeListener() { /** * */ private static final long serialVersionUID = 8987818794404251063L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { userDevice.select(bookAdmin.getSelectedTab().getCaption()); userRole.select(DBManager.getDatabaseInstance() .getUserGroupDescriptionByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName(), DBManager .getDatabaseInstance().getDeviceIDByName(bookAdmin.getSelectedTab().getCaption()))); userGroup.select(DBManager.getDatabaseInstance() .getUserRoleNameByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName())); } }); gridLayout.setWidth("100%"); // add components to the grid layout // gridLayout.addComponent(infoLabel, 0, 0, 3, 0); gridLayout.addComponent(bookAdmin, 0, 1, 5, 1); gridLayout.addComponent(refresh, 0, 2); gridLayout.addComponent(userDevice, 0, 4, 1, 4); gridLayout.addComponent(userRole, 2, 4, 3, 4); gridLayout.addComponent(userGroup, 4, 4, 5, 4); gridLayout.addComponent(updateUser, 0, 5, 5, 5); gridLayout.setSizeFull(); gridLayout.setSpacing(true); setCompositionRoot(gridLayout); /* * JavaScript to update the Grid try { JDBCConnectionPool connectionPool = new * SimpleJDBCConnectionPool("com.mysql.jdbc.Driver", * "jdbc:mysql://localhost:8889/facs_facility", "facs", "facs"); QueryDelegate qd = new * FreeformQuery("select * from facs_facility", connectionPool, "id"); final SQLContainer c = * new SQLContainer(qd); bookAdmin.setContainerDataSource(c); } * * JavaScript.getCurrent().execute("setInterval(function(){refreshTable();},5000);"); * JavaScript.getCurrent().addFunction("refreshTable", new JavaScriptFunction() { * * @Override public void call(JsonArray arguments) { // TODO Auto-generated method stub * * } }); */ }