Package javax.jnlp

Examples of javax.jnlp.BasicService


          }
        }
      });
    this.findModelsButton = new JButton(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "findModelsButton.text"));
    BasicService basicService = null;
    try {
      // Lookup the javax.jnlp.BasicService object
      basicService = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
      // Ignore the basic service, if it doesn't support web browser
      if (!basicService.isWebBrowserSupported()) {
        basicService = null;
      }
    } catch (UnavailableServiceException ex) {
      // Too bad : service is unavailable
    }
    final BasicService service = basicService;
    this.findModelsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
          boolean documentShown = false;
          if (service != null) {
            try {
              // Display Find models page in browser
              final URL findModelsUrl = new URL(preferences.getLocalizedString(
                  ImportedFurnitureWizardStepsPanel.class, "findModelsButton.url"));
              documentShown = service.showDocument(findModelsUrl);
            } catch (MalformedURLException ex) {
              // Document isn't shown
            }
          }
          if (!documentShown) {
View Full Code Here


   */
  @Override
  public void help() {
    try {
      // Lookup the javax.jnlp.BasicService object
      final BasicService service = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
      String helpIndex = this.application.getUserPreferences().getLocalizedString(HomeAppletController.class, "helpIndex");
      service.showDocument(new URL(helpIndex));
    } catch (UnavailableServiceException ex) {
      // Too bad : service is unavailable            
    } catch (MalformedURLException ex) {
      ex.printStackTrace();
    }
View Full Code Here

    JEditorPane messagePane = new JEditorPane("text/html", message);
    messagePane.setOpaque(false);
    messagePane.setEditable(false);
    try {
      // Lookup the javax.jnlp.BasicService object
      final BasicService service = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
      // If basic service supports  web browser
      if (service.isWebBrowserSupported()) {
        // Add a listener that displays hyperlinks content in browser
        messagePane.addHyperlinkListener(new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent ev) {
            if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              service.showDocument(ev.getURL());
            }
          }
        });
      }
    } catch (UnavailableServiceException ex) {
View Full Code Here

  protected void loadFromPersistenceService() throws UnavailableServiceException {
    persistenceService = (PersistenceService)
    ServiceManager.lookup("javax.jnlp.PersistenceService");

    BasicService basicService = (BasicService)
    ServiceManager.lookup("javax.jnlp.BasicService");
   
    FileContents contents = null;
    try {
      url = new URL(basicService.getCodeBase(), "configuration.xml");
      contents = persistenceService.get(url);
    } catch (MalformedURLException e1) {
      e1.printStackTrace();
    } catch (FileNotFoundException e1) {
      try {
View Full Code Here

     * @return the url to the webapp ending with a slash
     */
    public String getWebAppContextUrl() {
        String webAppContextUrl;
        try {
            BasicService basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
            String codeBase = basicService.getCodeBase().toExternalForm();
            if (!codeBase.endsWith("/")) {
                codeBase += "/";
            }
            int webAppContextUrlLength = codeBase.lastIndexOf(jnlpRelativeDirectoryPathFromWebAppContext);
            webAppContextUrl = codeBase.substring(0, webAppContextUrlLength + 1);
View Full Code Here

        }

        boolean open = false;       

        try {
            BasicService bs = (BasicService) ServiceManager.lookup(
                    "javax.jnlp.BasicService");

            open = bs.showDocument(
                    new URL((String) urls.get(ContactUtil.BASE_URL)));
            Log.debug(CLASS_NAME, "showBrowser is " + open);
        } catch (UnavailableServiceException e) {
            Log.error(CLASS_NAME, "", e);
            DialogFactory.showErrMsg(getParent(),
View Full Code Here

            desktop.browse(uri);

            return true;
        } catch (SecurityException e) {
//             Running in sandbox, try using WebStart service
            BasicService basicService =
                    (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");

            if (basicService.isWebBrowserSupported()) {
                return basicService.showDocument(uri.toURL());
            }
        }

        return false;
    }
View Full Code Here

                // claim agent so no new build can start
                claim();
            }
        }

        final BasicService basicService;
        try {
            basicService = (BasicService) ServiceManager.lookup(BasicService.class.getName());
        } catch (UnavailableServiceException e) {
            final String errMsg = "Couldn't find webstart Basic Service. Is Agent running outside of webstart?";
            LOG.error(errMsg, e);
            throw new RuntimeException(errMsg, e);
        }
        final URL codeBaseURL = basicService.getCodeBase();
        LOG.info("basicService.getCodeBase()=" + codeBaseURL.toString());

        // relaunch via new browser session
        // @todo How to close the browser after jnlp is relaunched?
        final URL relaunchURL;
        try {
            relaunchURL = new URL(codeBaseURL, "agent.jnlp");
        } catch (MalformedURLException e) {
            final String errMsg = "Error building webstart relaunch URL from " + codeBaseURL.toString();
            LOG.error(errMsg, e);
            throw new RuntimeException(errMsg, e);
        }
        if (basicService.showDocument(relaunchURL)) {
            LOG.info("Relaunched agent via URL: " + relaunchURL.toString() + ". Will kill current agent now.");
            doKill(); // don't wait for build finish, since we've already relaunched at this point.
        } else {
            final String errMsg = "Failed to relaunch agent via URL: " + relaunchURL.toString();
            LOG.error(errMsg);
View Full Code Here

   */
  public static URL getCodeBase()
  {
    try
    {
      BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
      URL url = bs.getCodeBase();
          return url;
    }
    catch(UnavailableServiceException ue)
    {
      return null;
View Full Code Here

    public void loadMuffins()
    {
        ui.debug("Loading muffins"); //$NON-NLS-1$

        PersistenceService ps = null;
        BasicService bs = null;

        try
        {
            ps = (PersistenceService) ServiceManager.lookup("javax.jnlp.PersistenceService")//$NON-NLS-1$
            bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService")//$NON-NLS-1$
        }
        catch (UnavailableServiceException e)
        {
            ui.error(Messages.getString("error.failedToLoadSavedSettings"), e); //$NON-NLS-1$
            return;
        }

        // We store a properties file in the "configuration" address.
        try
        {
            URL config = new URL(bs.getCodeBase(), "configuration"); //$NON-NLS-1$
            FileContents contents = getOrCreateFile(ps, config);
            if (contents == null)
            {
                return;
            }
View Full Code Here

TOP

Related Classes of javax.jnlp.BasicService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.