List of usage examples for com.vaadin.server ExternalResource ExternalResource
public ExternalResource(String sourceURL)
From source file:org.opencms.workplace.tools.git.ui.CmsGitAppConfiguration.java
License:Open Source License
/** * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getIcon() *///ww w . j av a 2 s . c o m public Resource getIcon() { return new ExternalResource(OpenCmsTheme.getImageLink("apps/git.png")); }
From source file:org.opennms.features.pluginmgr.vaadin.config.karaf.PluginManagerAdminApplication.java
License:Apache License
@Override public void init(VaadinRequest request) { m_request = request;//from w ww . ja v a2 s . co m m_rootLayout = new VerticalLayout(); m_rootLayout.setSizeFull(); m_rootLayout.addStyleName("root-layout"); setContent(m_rootLayout); // dynamically inject style for non write borders - avoids changing themes css // Get the stylesheet of the page Styles styles = Page.getCurrent().getStyles(); // inject the new font size as a style. We need .v-app to override Vaadin's default styles here styles.add(".v-app .v-textfield-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none; }"); styles.add(".v-app .v-textarea-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none; }"); // add header if provided if (headerComponent != null) m_rootLayout.addComponent(headerComponent); //add additional header page links if provided if (headerLinks != null) { // defining 2 horizontal layouts to force links to stay together HorizontalLayout horizontalLayout1 = new HorizontalLayout(); horizontalLayout1.setWidth("100%"); horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT); HorizontalLayout horizontalLayout2 = new HorizontalLayout(); horizontalLayout1.addComponent(horizontalLayout2); for (String name : headerLinks.keySet()) { String urlStr = headerLinks.get(name); ExternalResource urlResource = new ExternalResource(urlStr); Link link = new Link(name, urlResource); Label label = new Label(" ", ContentMode.HTML); // adds space between links horizontalLayout2.addComponent(link); horizontalLayout2.addComponent(label); } m_rootLayout.addComponent(horizontalLayout1); } PluginManagerUIMainPanel pluginManagerUIMainPanel = new PluginManagerUIMainPanel(sessionPluginManager); m_rootLayout.addComponent(pluginManagerUIMainPanel); // this forces the UI panel to use up all the available space below the header m_rootLayout.setExpandRatio(pluginManagerUIMainPanel, 1.0f); }
From source file:org.opennms.features.pluginmgr.vaadin.config.karaf.SimpleIframeApplication.java
License:Apache License
@Override public void init(VaadinRequest request) { if (iframePageUrl == null) throw new RuntimeException("iframePageUrl must not be null"); m_request = request;/*from www .ja v a 2 s .c o m*/ m_rootLayout = new VerticalLayout(); m_rootLayout = new VerticalLayout(); m_rootLayout.setSizeFull(); m_rootLayout.addStyleName("root-layout"); setContent(m_rootLayout); // add header if provided if (headerComponent != null) m_rootLayout.addComponent(headerComponent); //add additional header page links if provided if (headerLinks != null) { // defining 2 horizontal layouts to force links to stay together HorizontalLayout horizontalLayout1 = new HorizontalLayout(); horizontalLayout1.setWidth("100%"); horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT); HorizontalLayout horizontalLayout2 = new HorizontalLayout(); horizontalLayout1.addComponent(horizontalLayout2); for (String name : headerLinks.keySet()) { String urlStr = headerLinks.get(name); ExternalResource urlResource = new ExternalResource(urlStr); Link link = new Link(name, urlResource); Label label = new Label(" ", ContentMode.HTML); // adds space between links horizontalLayout2.addComponent(link); horizontalLayout2.addComponent(label); } m_rootLayout.addComponent(horizontalLayout1); } ExternalResource iframPageResource = new ExternalResource(iframePageUrl); BrowserFrame browser = new BrowserFrame("", iframPageResource); browser.setWidth("100%"); browser.setHeight("100%"); m_rootLayout.addComponent(browser); // this forces the UI panel to use up all the available space below the header m_rootLayout.setExpandRatio(browser, 1.0f); }
From source file:org.opennms.features.pluginmgr.vaadin.config.opennms.PluginManagerAdminApplication.java
License:Open Source License
@Override public void init(VaadinRequest request) { m_rootLayout = new VerticalLayout(); m_rootLayout.setSizeFull();// w w w.ja v a 2 s .c om m_rootLayout.addStyleName("root-layout"); setContent(m_rootLayout); // dynamically inject style for non write borders - avoids changing themes css // Get the stylesheet of the page Styles styles = Page.getCurrent().getStyles(); // inject the new font size as a style. We need .v-app to override Vaadin's default styles here styles.add(".v-app .v-textfield-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none; }"); styles.add(".v-app .v-textarea-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none; }"); addHeader(request); //add diagnostic page links if (headerLinks != null) { // defining 2 horizontal layouts to force links to stay together HorizontalLayout horizontalLayout1 = new HorizontalLayout(); horizontalLayout1.setWidth("100%"); horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT); HorizontalLayout horizontalLayout2 = new HorizontalLayout(); horizontalLayout1.addComponent(horizontalLayout2); for (String name : headerLinks.keySet()) { String urlStr = headerLinks.get(name); ExternalResource urlResource = new ExternalResource(urlStr); Link link = new Link(name, urlResource); Label label = new Label(" ", ContentMode.HTML); // adds space between links horizontalLayout2.addComponent(link); horizontalLayout2.addComponent(label); } m_rootLayout.addComponent(horizontalLayout1); } PluginManagerUIMainPanel pluginManagerUIMainPanel = new PluginManagerUIMainPanel(sessionPluginManager); m_rootLayout.addComponent(pluginManagerUIMainPanel); // this forces the UI panel to use up all the available space below the header m_rootLayout.setExpandRatio(pluginManagerUIMainPanel, 1.0f); }
From source file:org.opennms.features.pluginmgr.vaadin.config.opennms.SimpleIframeInVaadinApplication.java
License:Open Source License
@Override public void init(VaadinRequest request) { if (iframePageUrl == null) throw new RuntimeException("iframePageUrl must not be null"); m_rootLayout = new VerticalLayout(); m_rootLayout.setSizeFull();//from ww w. ja v a 2s.co m m_rootLayout.addStyleName("root-layout"); setContent(m_rootLayout); addHeader(request); //add diagnostic page links if (headerLinks != null) { // defining 2 horizontal layouts to force links to stay together HorizontalLayout horizontalLayout1 = new HorizontalLayout(); horizontalLayout1.setWidth("100%"); horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT); HorizontalLayout horizontalLayout2 = new HorizontalLayout(); horizontalLayout1.addComponent(horizontalLayout2); for (String name : headerLinks.keySet()) { String urlStr = headerLinks.get(name); ExternalResource urlResource = new ExternalResource(urlStr); Link link = new Link(name, urlResource); Label label = new Label(" ", ContentMode.HTML); // adds space between links horizontalLayout2.addComponent(link); horizontalLayout2.addComponent(label); } m_rootLayout.addComponent(horizontalLayout1); } ExternalResource iframPageResource = new ExternalResource(iframePageUrl); BrowserFrame browser = new BrowserFrame("", iframPageResource); browser.setWidth("100%"); browser.setHeight("100%"); m_rootLayout.addComponent(browser); // this forces the UI panel to use up all the available space below the header m_rootLayout.setExpandRatio(browser, 1.0f); }
From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel.java
License:Apache License
public void updateDisplayValues() { try {//from ww w . java 2 s .co m // update/add available instances without throwing value change event Set<String> instanceNames = sessionPluginManager.getKarafInstances().keySet(); for (String instanceName : instanceNames) { if (!karafListSelect.containsId(instanceName)) karafListSelect.addItem(instanceName); } ; List<Object> itemIds = new ArrayList<Object>(karafListSelect.getItemIds()); for (Object itemid : itemIds) { if (!instanceNames.contains(itemid)) karafListSelect.removeItem(itemid); } String karafInstanceSelected = (sessionPluginManager.getKarafInstance() == null) ? "" : sessionPluginManager.getKarafInstance().toString(); karafInstanceSelectedTextField.setReadOnly(false); karafInstanceSelectedTextField.setValue(karafInstanceSelected); karafInstanceSelectedTextField.setReadOnly(true); String karafInstanceUrl = (sessionPluginManager.getKarafUrl() == null) ? "" : sessionPluginManager.getKarafUrl().toString(); currentKarafUrlTextField.setReadOnly(false); currentKarafUrlTextField.setValue(karafInstanceUrl); currentKarafUrlTextField.setReadOnly(true); remoteIsAccessibleCheckBox.setValue(sessionPluginManager.getRemoteIsAccessible()); allowUpdateMessagesCheckBox.setValue(sessionPluginManager.getAllowUpdateMessages()); Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String karaflastupdate = (sessionPluginManager.getKarafInstanceLastUpdated() == null) ? "never updated" : formatter.format(sessionPluginManager.getKarafInstanceLastUpdated()); karafLastUpdatedTextField.setReadOnly(false); karafLastUpdatedTextField.setValue(karaflastupdate); karafLastUpdatedTextField.setReadOnly(true); String pluginslastupdate = (sessionPluginManager.getAvailablePluginsLastUpdated() == null) ? "never updated" : formatter.format(sessionPluginManager.getAvailablePluginsLastUpdated()); availablepluginsLastUpdatedTextField.setReadOnly(false); availablepluginsLastUpdatedTextField.setValue(pluginslastupdate); availablepluginsLastUpdatedTextField.setReadOnly(true); ProductSpecList availablePluginsList = sessionPluginManager.getAvailablePlugins(); availablePluginsPanel.addProductList(availablePluginsList); ProductSpecList installedPluginsList = sessionPluginManager.getInstalledPlugins(); installedPluginsPanel.addProductList(installedPluginsList); ProductSpecList pluginsManifestList = sessionPluginManager.getPluginsManifest(); pluginsManifestPanel.addProductList(pluginsManifestList); LicenceList licencelist = sessionPluginManager.getInstalledLicenceList(); licenceDescriptorTablePanel.addLicenceList(licencelist); systemIdTxtField.setReadOnly(false); systemIdTxtField.setValue(sessionPluginManager.getSystemId()); systemIdTxtField.setReadOnly(true); manifestSystemIdTextField.setValue(sessionPluginManager.getManifestSystemId()); pluginServerPasswordTxtField.setValue(sessionPluginManager.getPluginServerPassword()); pluginServerUsernameTxtField.setValue(sessionPluginManager.getPluginServerUsername()); pluginServerUrlTxtField.setValue(sessionPluginManager.getPluginServerUrl()); licenceShoppingCartUrlTxtField.setValue(sessionPluginManager.getLicenceShoppingCartUrl()); ExternalResource resource = new ExternalResource(sessionPluginManager.getLicenceShoppingCartUrl()); openShoppingCartLink.setResource(resource); } catch (Exception e) { systemMessages.error("Problem refreshing display values for " + sessionPluginManager.getKarafInstance(), e); } mainLayout.markAsDirty(); }
From source file:org.opennms.features.topology.api.support.InfoWindow.java
License:Open Source License
public InfoWindow(final URL embeddedURL, LabelCreator labelCreator) { infoBrowser = new Embedded("", new ExternalResource(embeddedURL)); String label = labelCreator == null ? "" : labelCreator.getLabel(); setCaption(label);//from w w w. j a v a 2 s . c o m setImmediate(true); setResizable(false); setModal(true); /*Adds the browser to the main layout*/ VerticalLayout layout = new VerticalLayout(); layout.addComponent(infoBrowser); setContent(layout); }
From source file:org.opennms.features.topology.netutils.internal.EventsAlarmsWindow.java
License:Open Source License
/** * The EventsAlarmsWindow method constructs a sub-window instance which can be added to a * main window. The sub-window contains two embedded browsers which are directed at the Events * and Alarms page of the selected node//from w w w .jav a 2 s . co m * @param node Selected node * @param width Width of main window * @param height Height of main window * @throws MalformedURLException */ public EventsAlarmsWindow(final Node node, final URL eventsURL, final URL alarmsURL) throws MalformedURLException { super("Events & Alarms" + makeLabel(node)); eventsBrowser = new Embedded("", new ExternalResource(eventsURL)); eventsBrowser.setSizeFull(); alarmsBrowser = new Embedded("", new ExternalResource(alarmsURL)); alarmsBrowser.setSizeFull(); setImmediate(true); setResizable(false); /*Adds the two browsers to separate tabs in a tabsheet layout*/ m_tabSheet = new TabSheet(); m_tabSheet.setSizeFull(); m_tabSheet.addTab(eventsBrowser, "Events"); m_tabSheet.addTab(alarmsBrowser, "Alarms"); /*Adds tabsheet component to the main layout of the sub-window*/ VerticalLayout layout = new VerticalLayout(); layout.addComponent(m_tabSheet); layout.setSizeFull(); setContent(layout); }
From source file:org.opennms.features.topology.netutils.internal.ResourceGraphsWindow.java
License:Open Source License
/** * The ResourceGraphsWindow method constructs a sub-window instance which can be added to a * main window. The sub-window contains an embedded browser which displays the Resource Graphs * page of the currently selected node/*w ww . j av a 2 s . c om*/ * @param node Selected node * @param nodeURL Node URL * @throws MalformedURLException */ public ResourceGraphsWindow(final Node node, final URL nodeURL) throws MalformedURLException { rgBrowser = new Embedded("", new ExternalResource(nodeURL)); String label = node == null ? "" : node.getLabel(); /*Sets up window settings*/ if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) { label = ""; } else { label = " - " + label; } setCaption("Resource Graphs" + label); setImmediate(true); setResizable(false); /*Adds the browser component to the main layout*/ VerticalLayout layout = new VerticalLayout(); layout.addComponent(rgBrowser); setContent(layout); }
From source file:org.opennms.features.topology.netutils.internal.TracerouteWindow.java
License:Open Source License
/** * The changeBrowserURL method changes the address of the results browser whenever a new * traceroute request form is submitted and refreshes the browser. * @param url New web address/*from w w w . java 2s. com*/ */ private void changeBrowserURL(URL url) { if (url != null) { /* This setVisible(false/true) toggle is used to refresh the browser. * Due to to the fact that the updates to the client require a call to * the server, this is currently one of the only ways to accomplish the * the needed update. */ resultsBrowser.setVisible(false); resultsBrowser.setSource(new ExternalResource(url)); resultsBrowser.setVisible(true); } }