コード例 #1
0
ファイル: Main.java プロジェクト: sidwubf/java-config
 /** Remove data component data JAR from cache */
 public static void removeInstallerComponent() {
   DownloadService downloadService = Config.getDownloadService();
   if (downloadService != null) {
     String component = Config.getInstallerLocation();
     String version = Config.getInstallerVersion();
     try {
       URL codebase = Config.getBasicService().getCodeBase();
       URL url = new URL(codebase, component);
       component = url.toString();
       Config.trace("Removing: " + component + "/" + version);
       downloadService.removeResource(url, version);
     } catch (IOException ioe) {
       Config.trace("Unable to remove " + component + "/" + version);
     }
   } else {
     Config.trace("No download service found");
   }
 }
コード例 #2
0
ファイル: Main.java プロジェクト: sidwubf/java-config
  /** Download data component JAR */
  public static boolean downloadInstallerComponent() {
    DownloadService downloadService = Config.getDownloadService();
    DownloadServiceListener listener = downloadService.getDefaultProgressWindow();
    String compName = Config.getInstallerLocation();
    String compVer = Config.getInstallerVersion();
    try {
      URL codebase = Config.getBasicService().getCodeBase();
      URL url = new URL(codebase, compName);
      String urlstr = url.toString();

      if (!downloadService.isResourceCached(url, compVer)) {
        // The installFailed string is only for debugging. No localization needed
        Config.trace("Downloading: " + urlstr);
        // Do download
        downloadService.loadResource(url, compVer, listener);
      }
    } catch (IOException ioe) {
      Config.trace("Unable to download: " + compName + "/" + compVer);
      return false;
    }
    return true;
  }
コード例 #3
0
ファイル: BrowserFrame.java プロジェクト: haleyjd/Browsar
  // implemented for HyperlinkListener
  public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      JEditorPane ep = (JEditorPane) (e.getSource());

      // handle frame events properly
      if (e instanceof HTMLFrameHyperlinkEvent) {
        HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
        HTMLDocument doc = (HTMLDocument) (ep.getDocument());
        doc.processHTMLFrameHyperlinkEvent(evt);
      } else // handle normal links
      {
        try {
          URL currentLoc = new URL(location);
          URL newLoc = new URL(currentLoc, e.getDescription());

          setBrowserLocation(newLoc.toString());
        } catch (MalformedURLException malUrl) {
          JOptionPane.showMessageDialog(
              this, "Malformed URL", "Browser Error", JOptionPane.ERROR_MESSAGE);
          return;
        }
      }
    }
  }