List of usage examples for com.vaadin.shared Version getFullVersion
public static String getFullVersion()
From source file:annis.gui.AboutWindow.java
License:Apache License
public AboutWindow() { setSizeFull();/*from w w w. j a v a2 s. com*/ layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(true); HorizontalLayout hLayout = new HorizontalLayout(); Embedded logoAnnis = new Embedded(); logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png")); logoAnnis.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoAnnis); Embedded logoSfb = new Embedded(); logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg")); logoSfb.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoSfb); Link lnkFork = new Link(); lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS")); lnkFork.setIcon( new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")); lnkFork.setTargetName("_blank"); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT); hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); layout.addComponent(hLayout); layout.addComponent(new Label( "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">" + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Version: " + VersionInfo.getVersion())); layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion())); TextArea txtThirdParty = new TextArea(); txtThirdParty.setSizeFull(); StringBuilder sb = new StringBuilder(); sb.append("The ANNIS team wants to thank these third party software that " + "made the ANNIS GUI possible:\n"); File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY"); if (thirdPartyFolder.isDirectory()) { for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) { if (c.isFile()) { try { sb.append(FileUtils.readFileToString(c)).append("\n"); } catch (IOException ex) { log.error("Could not read file", ex); } } } } txtThirdParty.setValue(sb.toString()); txtThirdParty.setReadOnly(true); txtThirdParty.addStyleName("shared-text"); txtThirdParty.setWordwrap(false); layout.addComponent(txtThirdParty); btClose = new Button("Close"); final AboutWindow finalThis = this; btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(txtThirdParty, 1.0f); }
From source file:annis.gui.ReportBugWindow.java
License:Apache License
private boolean sendBugReport(String bugEMailAddress, byte[] screenImage, String imageMimeType) { MultiPartEmail mail = new MultiPartEmail(); try {//from w ww. j a v a 2s. c o m // server setup mail.setHostName("localhost"); // content of the mail mail.addReplyTo(form.getField("email").getValue().toString(), form.getField("name").getValue().toString()); mail.setFrom(bugEMailAddress); mail.addTo(bugEMailAddress); mail.setSubject("[ANNIS BUG] " + form.getField("summary").getValue().toString()); // TODO: add info about version etc. StringBuilder sbMsg = new StringBuilder(); sbMsg.append("Reporter: ").append(form.getField("name").getValue().toString()).append(" (") .append(form.getField("email").getValue().toString()).append(")\n"); sbMsg.append("Version: ").append(VersionInfo.getVersion()).append("\n"); sbMsg.append("Vaadin Version: ").append(Version.getFullVersion()).append("\n"); sbMsg.append("Browser: ").append(Page.getCurrent().getWebBrowser().getBrowserApplication()) .append("\n"); sbMsg.append("URL: ").append(UI.getCurrent().getPage().getLocation().toASCIIString()).append("\n"); sbMsg.append("\n"); sbMsg.append(form.getField("description").getValue().toString()); mail.setMsg(sbMsg.toString()); if (screenImage != null) { try { mail.attach(new ByteArrayDataSource(screenImage, imageMimeType), "screendump.png", "Screenshot of the browser content at time of problem report"); } catch (IOException ex) { log.error(null, ex); } } File logfile = new File(VaadinService.getCurrent().getBaseDirectory(), "/WEB-INF/log/annis-gui.log"); if (logfile.exists() && logfile.isFile() && logfile.canRead()) { mail.attach(new FileDataSource(logfile), "annis-gui.log", "Logfile of the GUI (shared by all users)"); } if (cause != null) { try { mail.attach(new ByteArrayDataSource(Helper.convertExceptionToMessage(cause), "text/plain"), "exception.txt", "Exception that caused the user to report the problem"); } catch (IOException ex) { log.error(null, ex); } } mail.send(); return true; } catch (EmailException ex) { Notification.show("E-Mail not configured on server", "If this is no Kickstarter version please ask the administrator (" + bugEMailAddress + ") of this ANNIS-instance for assistance. " + "Problem reports are not available for ANNIS Kickstarter", Notification.Type.ERROR_MESSAGE); log.error(null, ex); return false; } }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.about.AboutView.java
License:Apache License
public AboutView() { CustomLayout aboutContent = new CustomLayout("aboutview"); aboutContent.setStyleName("about-content"); // you can add Vaadin components in predefined slots in the custom // layout/* w ww . j a v a 2 s. co m*/ aboutContent.addComponent(new Label( FontAwesome.INFO_CIRCLE.getHtml() + " This application is using Vaadin " + Version.getFullVersion(), ContentMode.HTML), "info"); setSizeFull(); setStyleName("about-view"); addComponent(aboutContent); setComponentAlignment(aboutContent, Alignment.MIDDLE_CENTER); }
From source file:edu.nps.moves.mmowgli.AppMaster.java
License:Open Source License
private AppMaster(VaadinServlet vservlet, ServletContext context) { MSysOut.println(SYSTEM_LOGS, "Running Vaadin " + Version.getFullVersion()); servletContext = context;/*w ww .j a va2s . co m*/ setConstants(); appMasterMessaging = new AppMasterMessaging(this); new MmowgliEncryption(context); // initializes the singleton trustAllCerts(); mailManager = new MailManager(); }
From source file:edu.nps.moves.mmowgli.AppMaster.java
License:Open Source License
private void setConstants() { VAADIN_BUILD_VERSION = Version.getFullVersion(); // 7.3.0 String s = getInitParameter(WEB_XML_SMTP_HOST_KEY); if (s != null && s.length() > 0) MmowgliConstants.SMTP_HOST = s;//from w w w.j a va 2s . c o m //@formatter:off JMS_INTERNODE_URL = getInitParameter(WEB_XML_JMS_URL_KEY); JMS_INTERNODE_TOPIC = getInitParameter(WEB_XML_JMS_TOPIC_KEY); DEPLOYMENT_TOKEN = getInitParameter(WEB_XML_DEPLOYMENT_TOKEN_KEY); GAME_URL_TOKEN = getInitParameter(WEB_XML_GAME_URL_TOKEN_KEY); DEPLOYMENT = getInitParameter(WEB_XML_DEPLOYMENT_KEY); GAME_IMAGES_URL_RAW = getInitParameter(WEB_XML_GAME_IMAGES_URL_KEY); USER_IMAGES_URL_RAW = getInitParameter(WEB_XML_USER_IMAGES_URL_KEY); USER_IMAGES_FILESYSTEM_PATH_RAW = getInitParameter(WEB_XML_USER_IMAGES_FILESYSTEM_PATH_KEY); REPORTS_FILESYSTEM_PATH_RAW = getInitParameter(WEB_XML_REPORTS_FILESYSTEM_PATH_KEY); REPORTS_URL_RAW = getInitParameter(WEB_XML_REPORTS_URL_KEY); REPORT_TO_IMAGE_URL_PREFIX = getInitParameter(WEB_XML_REPORTS_TO_IMAGES_RELATIVE_PATH_PREFIX); //@formatter:on REPORTS_FILESYSTEM_PATH = replaceTokens(REPORTS_FILESYSTEM_PATH_RAW); new File(REPORTS_FILESYSTEM_PATH).mkdirs(); userImagesFileSystemPath = replaceTokens(USER_IMAGES_FILESYSTEM_PATH_RAW); computeUrls(); tweekPushTransport(); setClamScanConstants(servletContext); try { InputStream is = getClass().getResourceAsStream(MMOWGLI_BUILD_PROPERTIES_PATH); Properties prop = new Properties(); prop.load(is); MMOWGLI_BUILD_ID = prop.getProperty(MMOWGLI_BUILD_ID_KEY); } catch (IOException ioe) { System.err.println("Build id could not be retrieved: " + ioe.getLocalizedMessage()); } }
From source file:org.opencms.ui.CmsVaadinUtils.java
License:Open Source License
/** * Returns the Javascript code to use for initializing a Vaadin UI.<p> * * @param cms the CMS context//from ww w . ja va2s .c o m * @param elementId the id of the DOM element in which to initialize the UI * @param servicePath the UI servlet path * @return the Javascript code to initialize Vaadin * * @throws Exception if something goes wrong */ public static String getBootstrapScript(CmsObject cms, String elementId, String servicePath) throws Exception { String script = BOOTSTRAP_SCRIPT; CmsMacroResolver resolver = new CmsMacroResolver(); String context = OpenCms.getSystemInfo().getContextPath(); String vaadinDir = CmsStringUtil.joinPaths(context, "VAADIN/"); String vaadinVersion = Version.getFullVersion(); String vaadinServlet = CmsStringUtil.joinPaths(context, servicePath); String vaadinBootstrap = CmsStringUtil.joinPaths(context, "VAADIN/vaadinBootstrap.js"); resolver.addMacro("vaadinDir", vaadinDir); resolver.addMacro("vaadinVersion", vaadinVersion); resolver.addMacro("elementId", elementId); resolver.addMacro("vaadinServlet", vaadinServlet); resolver.addMacro("vaadinBootstrap", vaadinBootstrap); script = resolver.resolveMacros(script); return script; }
From source file:org.opencms.ui.error.CmsErrorUI.java
License:Open Source License
/** * Returns the error bootstrap page HTML.<p> * * @param cms the cms context//from w ww . ja va 2 s. c o m * @param throwable the throwable * @param request the current request * * @return the error bootstrap page HTML */ public static String getBootstrapPage(CmsObject cms, Throwable throwable, HttpServletRequest request) { try { setErrorAttributes(cms, throwable, request); byte[] pageBytes = CmsFileUtil.readFully(Thread.currentThread().getContextClassLoader() .getResourceAsStream("org/opencms/ui/error/error-page.html")); String page = new String(pageBytes, "UTF-8"); CmsMacroResolver resolver = new CmsMacroResolver(); String context = OpenCms.getSystemInfo().getContextPath(); String vaadinDir = CmsStringUtil.joinPaths(context, "VAADIN/"); String vaadinVersion = Version.getFullVersion(); String vaadinServlet = CmsStringUtil.joinPaths(context, "workplace/", ERROR_PAGE_PATH_FRAQUMENT); String vaadinBootstrap = CmsStringUtil.joinPaths(context, "VAADIN/vaadinBootstrap.js"); resolver.addMacro("loadingHtml", CmsVaadinConstants.LOADING_INDICATOR_HTML); resolver.addMacro("vaadinDir", vaadinDir); resolver.addMacro("vaadinVersion", vaadinVersion); resolver.addMacro("vaadinServlet", vaadinServlet); resolver.addMacro("vaadinBootstrap", vaadinBootstrap); resolver.addMacro("title", "Error page"); page = resolver.resolveMacros(page); return page; } catch (Exception e) { LOG.error("Failed to display error page.", e); return "<!--Error-->"; } }
From source file:org.opencms.ui.login.CmsLoginUI.java
License:Open Source License
/** * Returns the initial HTML for the Vaadin based login dialog.<p> * * @param request the request/*from w w w . j av a2 s . c o m*/ * @param response the response * * @return the initial page HTML for the Vaadin login dialog * * @throws IOException in case writing to the response fails * @throws CmsException in case the user has not the required role */ public static String displayVaadinLoginDialog(HttpServletRequest request, HttpServletResponse response) throws IOException, CmsException { CmsFlexController controller = CmsFlexController.getController(request); if (controller == null) { // controller not found - this request was not initialized properly throw new CmsRuntimeException(org.opencms.jsp.Messages.get() .container(org.opencms.jsp.Messages.ERR_MISSING_CMS_CONTROLLER_1, CmsLoginUI.class.getName())); } CmsObject cms = controller.getCmsObject(); if ((OpenCms.getSiteManager().getSites().size() > 1) && !OpenCms.getSiteManager().isWorkplaceRequest(request)) { // do not send any redirects to the workplace site for security reasons response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } String logout = request.getParameter(CmsLoginHelper.PARAM_ACTION_LOGOUT); if (Boolean.valueOf(logout).booleanValue()) { CmsLoginController.logout(cms, request, response); return null; } if (!cms.getRequestContext().getCurrentUser().isGuestUser()) { String target = request.getParameter(CmsGwtConstants.PARAM_LOGIN_REDIRECT); if (CmsStringUtil.isEmptyOrWhitespaceOnly(target)) { target = CmsLoginController.getLoginTarget(cms, getWorkplaceSettings(cms, request.getSession()), null); } response.sendRedirect(target); return null; } CmsLoginHelper.LoginParameters params = CmsLoginHelper.getLoginParameters(cms, request, false); request.getSession().setAttribute(CmsLoginUI.INIT_DATA_SESSION_ATTR, params); try { byte[] pageBytes = CmsFileUtil.readFully(Thread.currentThread().getContextClassLoader() .getResourceAsStream("org/opencms/ui/login/login-page.html")); String page = new String(pageBytes, "UTF-8"); CmsMacroResolver resolver = new CmsMacroResolver(); String context = OpenCms.getSystemInfo().getContextPath(); String vaadinDir = CmsStringUtil.joinPaths(context, "VAADIN/"); String vaadinVersion = Version.getFullVersion(); String vaadinServlet = CmsStringUtil.joinPaths(context, "workplace/dialogs/"); String vaadinBootstrap = CmsStringUtil.joinPaths(context, "VAADIN/vaadinBootstrap.js?v=" + OpenCms.getSystemInfo().getVersionNumber()); String autocomplete = params.isPrivatePc() ? "on" : "off"; String cmsLogo = OpenCms.getSystemInfo().getContextPath() + CmsWorkplace.RFS_PATH_RESOURCES + "commons/login_logo.png"; resolver.addMacro("loadingHtml", CmsVaadinConstants.LOADING_INDICATOR_HTML); resolver.addMacro("vaadinDir", vaadinDir); resolver.addMacro("vaadinVersion", vaadinVersion); resolver.addMacro("vaadinServlet", vaadinServlet); resolver.addMacro("vaadinBootstrap", vaadinBootstrap); resolver.addMacro("cmsLogo", cmsLogo); resolver.addMacro("autocomplete", autocomplete); resolver.addMacro("title", CmsLoginHelper.getTitle(params.getLocale())); if (params.isPrivatePc()) { resolver.addMacro("hiddenPasswordField", " <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >"); } if (params.getUsername() != null) { resolver.addMacro("predefUser", "value=\"" + CmsEncoder.escapeXml(params.getUsername()) + "\""); } page = resolver.resolveMacros(page); return page; } catch (Exception e) { LOG.error("Failed to display login dialog.", e); return "<!--Error-->"; } }