List of usage examples for com.vaadin.server ExternalResource ExternalResource
public ExternalResource(String sourceURL)
From source file:com.peergreen.webconsole.scope.deployment.internal.components.DeployableWindow.java
License:Open Source License
public Component getContent() { FormLayout content = new FormLayout(); content.setSpacing(true);/*from www . j ava 2 s.com*/ content.setMargin(true); Label name = new Label(deployableEntry.getName()); name.setCaption("Name"); content.addComponent(name); Label uri = new Label(deployableEntry.getUri().toString()); uri.setCaption("URI"); content.addComponent(uri); VerticalLayout status = new VerticalLayout(); status.setCaption("Status"); content.addComponent(status); if (report == null) { // is not deployed yet status.addComponent(new Label("Ready to be deployed")); } else { if (report.getExceptions().size() == 0) { status.addComponent(new Label("<p style=\"color:#329932\">Deployed</p>", ContentMode.HTML)); } else { for (ArtifactError artifactError : report.getExceptions()) { for (ArtifactErrorDetail detail : artifactError.getDetails()) { ExceptionView exceptionView = new ExceptionView(detail); status.addComponent(exceptionView); } } } VerticalLayout endPointsLayout = new VerticalLayout(); for (Endpoint endpoint : report.getEndpoints()) { try { Link link = new Link(endpoint.getURI().toString(), new ExternalResource(endpoint.getURI().toURL())); link.setTargetName("_blank"); endPointsLayout.addComponent(link); } catch (MalformedURLException e) { endPointsLayout.addComponent(new Label(endpoint.getURI().toString())); } } if (endPointsLayout.getComponentCount() > 0) { content.addComponent(endPointsLayout); endPointsLayout.setCaption("End points"); } } return content; }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.EndPointsHomeFrame.java
License:Open Source License
private void updateEndPoints() { removeAllItems();//from w ww . ja v a 2 s . c o m int i = 0; for (URI uri : artifactModelManager.getDeployedRootURIs()) { VerticalLayout endPointsLayout = new VerticalLayout(); try { for (Endpoint endpoint : deploymentManager.getReport(uri.toString()).getEndpoints()) { Link link = new Link(endpoint.getURI().toString(), new ExternalResource(endpoint.getURI().toURL())); link.setTargetName("_blank"); endPointsLayout.addComponent(link); } } catch (ArtifactStatusReportException | MalformedURLException e) { e.printStackTrace(); } if (endPointsLayout.getComponentCount() > 0) { addItem(new Object[] { endPointsLayout, artifactModelManager.getArtifactModel(uri).getArtifact().name() }, i); i++; } } }
From source file:com.peergreen.webconsole.scope.web.documentation.PeergreenDocumentation.java
License:Open Source License
@PostConstruct public void init() { setMargin(true);//from www. j av a 2 s .com setSpacing(true); BrowserFrame browser = new BrowserFrame("", new ExternalResource( "http://docs.peergreen.com/peergreen_server/latest/reference/xhtml-single/user-guide.xhtml")); browser.setSizeFull(); addComponent(browser); setExpandRatio(browser, 1.5f); }
From source file:com.peergreen.webconsole.scope.web.website.PeergreenWebSite.java
License:Open Source License
@PostConstruct public void init() { setMargin(true);/*from w w w. j av a2 s . c om*/ setSpacing(true); BrowserFrame browser = new BrowserFrame("", new ExternalResource("http://www.peergreen.com/")); browser.setSizeFull(); addComponent(browser); setExpandRatio(browser, 1.5f); }
From source file:com.porotype.iconfont.FontAwesome.java
public static void load() { load(new ExternalResource(CDN)); }
From source file:com.skysql.manager.ui.AboutSettings.java
License:Open Source License
/** * Reads the AboutRecord from the session and populates the panel layout. *//*from www. j a v a2 s . com*/ AboutSettings(boolean extraInfo) { addStyleName("aboutTab"); setSizeFull(); setSpacing(true); setMargin(true); Label title = new Label("<h3>Welcome to MariaDB Manager<h3/>", ContentMode.HTML); title.setSizeUndefined(); addComponent(title); setComponentAlignment(title, Alignment.MIDDLE_CENTER); StringBuffer str = new StringBuffer(); str.append("<table border=0 cellspacing=3 cellpadding=3 summary=\"\">" + "<tr bgcolor=\"#ccccff\">" + "<th align=left>Component" + "<th align=left>Release"); if (extraInfo) { str.append("<th align=left>Version" + "<th align=left>Date"); } LinkedHashMap<String, Versions> versionsList = Versions.getVersionsList(); int i = 0; for (Versions component : versionsList.values()) { str.append(((i++ & 1) == 0) ? "<tr>" : "<tr bgcolor=\"#eeeeff\">"); str.append("<td><code>" + component.getName() + "</code><td>" + component.getRelease()); if (extraInfo) { str.append("<td>" + component.getVersion()); str.append("<td>" + (component.getDate() == null ? " " : component.getDate())); } } str.append("</table>"); ManagerUI.log(str.toString()); Label versionsLabel = new Label(str.toString(), ContentMode.HTML); versionsLabel.setSizeUndefined(); addComponent(versionsLabel); setComponentAlignment(versionsLabel, Alignment.MIDDLE_CENTER); if (extraInfo) { Label guiInfo = new Label("WebUI calling API " + APIrestful.apiVERSION + " @ " + APIrestful.getURI()); guiInfo.setSizeUndefined(); addComponent(guiInfo); setComponentAlignment(guiInfo, Alignment.MIDDLE_CENTER); } addComponent(new Label("")); addComponent(new Label("")); Label copyright = new Label("\u00A9 SkySQL Corporation Ab, 2014."); copyright.setSizeUndefined(); addComponent(copyright); setComponentAlignment(copyright, Alignment.MIDDLE_CENTER); Link link = new Link("MariaDB is a trademark of SkySQL Corporation Ab.", new ExternalResource("http://www.mariadb.com/about/legal/trademarks")); link.setTargetName("_blank"); addComponent(link); setComponentAlignment(link, Alignment.MIDDLE_CENTER); }
From source file:com.skysql.manager.ui.PanelTools.java
License:Open Source License
/** * Instantiates a new panel tools./*from ww w . j av a 2 s. c o m*/ */ PanelTools() { // thisTab.setSizeFull(); // thisTab.setWidth(Sizeable.SIZE_UNDEFINED, 0); // Default setHeight("200px"); setSpacing(true); // External Tools Vertical Module SystemInfo systemInfo = getSession().getAttribute(SystemInfo.class); LinkedHashMap<String, String> properties = systemInfo.getCurrentSystem().getProperties(); if (properties != null) { VerticalLayout externalsLayout = new VerticalLayout(); externalsLayout.setWidth("150px"); externalsLayout.addStyleName("externalsLayout"); externalsLayout.setSpacing(true); String EIP = properties.get(SystemInfo.PROPERTY_EIP); String MONyog = properties.get(SystemInfo.PROPERTY_MONYOG); if (EIP != null && MONyog != null) { String url = "http://" + EIP + MONyog; monyogLink = new Link("MONyog", new ExternalResource(url)); monyogLink.setTargetName("_blank"); monyogLink.setDescription("Open MONyog for the whole system"); monyogLink.setIcon(new ThemeResource("img/externalLink.png")); monyogLink.addStyleName("icon-after-caption"); externalsLayout.addComponent(monyogLink); externalsLayout.setComponentAlignment(monyogLink, Alignment.BOTTOM_CENTER); } phpUrl = properties.get(SystemInfo.PROPERTY_PHPMYADMIN); if (phpUrl != null) { phpLink = new Link("phpMyAdmin", null); phpLink.setTargetName("_blank"); phpLink.setDescription("Open phpMyAdmin for the selected node"); phpLink.setIcon(new ThemeResource("img/externalLink.png")); phpLink.addStyleName("icon-after-caption"); externalsLayout.addComponent(phpLink); externalsLayout.setComponentAlignment(phpLink, Alignment.BOTTOM_CENTER); } addComponent(externalsLayout); setComponentAlignment(externalsLayout, Alignment.MIDDLE_CENTER); } { Label spacer = new Label(); spacer.setWidth("40px"); addComponent(spacer); } // Scripting layout placeholder VerticalLayout placeholderLayout = new VerticalLayout(); placeholderLayout.addStyleName("placeholderLayout"); placeholderLayout.setSizeUndefined(); Label placeholderLabel = new Label("Links to external tools"); placeholderLabel.addStyleName("instructions"); placeholderLayout.addComponent(placeholderLabel); addComponent(placeholderLayout); setComponentAlignment(placeholderLayout, Alignment.MIDDLE_CENTER); }
From source file:com.skysql.manager.ui.PanelTools.java
License:Open Source License
/** * Refresh./*from w w w. j a va 2 s .c om*/ */ public void refresh() { ClusterComponent componentInfo = getSession().getAttribute(ClusterComponent.class); switch (componentInfo.getType()) { case system: if (phpLink != null) { phpLink.setVisible(false); } break; case node: if (phpLink != null) { NodeInfo nodeInfo = (NodeInfo) componentInfo; String url = "http://" + nodeInfo.getPublicIP() + phpUrl; phpLink.setResource(new ExternalResource(url)); phpLink.setVisible(true); } break; } }
From source file:com.validation.manager.core.image.GravatarProvider.java
License:Apache License
protected Resource getIcon(String email, int size) { try {//from ww w .j av a2 s . co m //Calculate Gravatar email hash /** * All URLs on Gravatar are based on the use of the hashed value of * an email address. Images and profiles are both accessed via the * hash of an email, and it is considered the primary way of * identifying an identity within the system. To ensure a consistent * and accurate hash, the following steps should be taken to create * a hash: * * Trim leading and trailing whitespace from an email address * * Force all characters to lower-case * * md5 hash the final string */ URL url = getURL(email, size); if (url != null) { LOG.log(Level.FINE, "Retrieving icon from: {0}", url); return new ExternalResource(url); } } catch (VMException | IOException ex) { LOG.log(Level.SEVERE, null, ex); } return null; }
From source file:de.catma.ui.CatmaApplication.java
License:Open Source License
@Override protected void init(VaadinRequest request) { backgroundService = new UIBackgroundService(true); storeParameters(request.getParameterMap()); Page.getCurrent().setTitle("CATMA 5.0 " + MINORVERSION); mainLayout = new VerticalLayout(); mainLayout.setSizeFull();//from w w w. j ava 2s .c o m menuPanel = new Panel(); menuPanel.addStyleName("menuPanel"); mainLayout.addComponent(menuPanel); contentPanel = new Panel(); contentPanel.setHeight("100%"); contentPanel.addStyleName("contentPanel"); defaultContentPanelLabel = new Label("Please log in to get started"); defaultContentPanelLabel.addStyleName("defaultContentPanelLabel"); contentPanel.setContent(defaultContentPanelLabel); mainLayout.addComponent(contentPanel); mainLayout.setExpandRatio(contentPanel, 1.0f); menuLayout = new HorizontalLayout(); menuLayout.setMargin(true); menuLayout.setSpacing(true); logoResource = new ThemeResource("catma-logo.png"); Link logoImage = new Link(null, new ExternalResource("http://www.catma.de")); logoImage.setIcon(logoResource); logoImage.setTargetName("_blank"); menuLayout.addComponent(logoImage); MenuFactory menuFactory = new MenuFactory(); try { initTempDirectory(); tagManager = new TagManager(); repositoryManagerView = new RepositoryManagerView( new RepositoryManager(this, tagManager, RepositoryProperties.INSTANCE.getProperties())); tagManagerView = new TagManagerView(tagManager); taggerManagerView = new TaggerManagerView(); analyzerManagerView = new AnalyzerManagerView(); visualizationManagerView = new VisualizationManagerView(); menu = menuFactory.createMenu(menuLayout, contentPanel, new MenuFactory.MenuEntryDefinition("Repository Manager", repositoryManagerView), new MenuFactory.MenuEntryDefinition("Tag Type Manager", tagManagerView), new MenuFactory.MenuEntryDefinition("Tagger", taggerManagerView), new MenuFactory.MenuEntryDefinition("Analyzer", analyzerManagerView), new MenuFactory.MenuEntryDefinition("Visualizer", visualizationManagerView)); addPropertyChangeListener(CatmaApplicationEvent.userChange, menu.userChangeListener); Link latestFeaturesLink = new Link("Latest Features", new ExternalResource("http://www.catma.de/latestfeatures")); latestFeaturesLink.setTargetName("_blank"); menuLayout.addComponent(latestFeaturesLink); menuLayout.setComponentAlignment(latestFeaturesLink, Alignment.TOP_RIGHT); menuLayout.setExpandRatio(latestFeaturesLink, 1.0f); Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de")); aboutLink.setTargetName("_blank"); menuLayout.addComponent(aboutLink); menuLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT); Link termsOfUseLink = new Link("Terms of Use", new ExternalResource("http://www.catma.de/termsofuse")); termsOfUseLink.setTargetName("_blank"); menuLayout.addComponent(termsOfUseLink); menuLayout.setComponentAlignment(termsOfUseLink, Alignment.TOP_RIGHT); Link manualLink = new Link("Manual", new ExternalResource(request.getContextPath() + "/manual/")); manualLink.setTargetName("_blank"); menuLayout.addComponent(manualLink); menuLayout.setComponentAlignment(manualLink, Alignment.TOP_RIGHT); Link helpLink = new Link("Helpdesk", new ExternalResource("http://www.catma.de/helpdesk/")); helpLink.setTargetName("_blank"); menuLayout.addComponent(helpLink); menuLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT); helpLink.setVisible(false); btHelp = new Button(FontAwesome.QUESTION_CIRCLE); btHelp.addStyleName("help-button"); btHelp.addStyleName("application-help-button"); menuLayout.addComponent(btHelp); btHelp.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { if (uiHelpWindow.getParent() == null) { UI.getCurrent().addWindow(uiHelpWindow); } else { UI.getCurrent().removeWindow(uiHelpWindow); } } }); LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView); Button btloginLogout = new Button("Sign in", event -> loginLogoutCommand.menuSelected(null)); btloginLogout.setStyleName(BaseTheme.BUTTON_LINK); btloginLogout.addStyleName("application-loginlink"); loginLogoutCommand.setLoginLogoutButton(btloginLogout); menuLayout.addComponent(btloginLogout); menuLayout.setComponentAlignment(btloginLogout, Alignment.TOP_RIGHT); menuLayout.setWidth("100%"); menuPanel.setContent(menuLayout); setContent(mainLayout); if (getParameter(Parameter.USER_IDENTIFIER) != null) { btloginLogout.click(); } setPollInterval(10000); if ((getParameter(Parameter.AUTOLOGIN) != null) && (getUser() == null)) { getPage().setLocation(repositoryManagerView.createAuthenticationDialog().createLogInClick(this, RepositoryPropertyKey.CATMA_oauthAuthorizationCodeRequestURL.getValue(), RepositoryPropertyKey.CATMA_oauthAccessTokenRequestURL.getValue(), RepositoryPropertyKey.CATMA_oauthClientId.getValue(), RepositoryPropertyKey.CATMA_oauthClientSecret.getValue(), URLEncoder.encode("/", "UTF-8"))); } } catch (Exception e) { showAndLogError("The system could not be initialized!", e); } }