Package freenet.client.filter.HTMLFilter

Examples of freenet.client.filter.HTMLFilter.ParsedTag


    }
    if(name != null) {
      attributes.put("alt", name);
      attributes.put("title", name);
    }
    return new ImageElement(tracker,key,maxSize,ctx,new ParsedTag("img", attributes), pushed);
  }
View Full Code Here


        String sizePart = "";
        if (attr.containsKey("width") && attr.containsKey("height")) {
          sizePart = "&width=" + attr.get("width") + "&height=" + attr.get("height");
        }
        attr.put("src", "/imagecreator/?text=+"+FProxyToadlet.l10n("imageinitializing")+"+" + sizePart);
        whenJsEnabled.addChild(makeHtmlNodeForParsedTag(new ParsedTag(originalImg, attr)));
        whenJsEnabled.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "fetchedBlocks", String.valueOf(0) });
        whenJsEnabled.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "requiredBlocks", String.valueOf(1) });

      }
    } else {
      FProxyFetchResult fr = null;
      FProxyFetchWaiter waiter = null;
      try {
        try {
          waiter = tracker.makeFetcher(key, maxSize, null, REFILTER_POLICY.RE_FILTER);
          fr = waiter.getResultFast();
        } catch (FetchException fe) {
          whenJsEnabled.addChild("div", "error");
        }
        if (fr == null) {
          whenJsEnabled.addChild("div", "No fetcher found");
        } else {

          if (fr.isFinished() && fr.hasData()) {
            if (logMINOR) {
              Logger.minor(this, "ImageElement is completed");
            }
            whenJsEnabled.addChild(makeHtmlNodeForParsedTag(originalImg));
          } else if (fr.failed != null) {
            if (logMINOR) {
              Logger.minor(this, "ImageElement is errorous");
            }
            whenJsEnabled.addChild(makeHtmlNodeForParsedTag(originalImg));
          } else {
            if (logMINOR) {
              Logger.minor(this, "ImageElement is still in progress");
            }
            int total = fr.requiredBlocks;
            int fetchedPercent = (int) (fr.fetchedBlocks / (double) total * 100);
            Map<String, String> attr = originalImg.getAttributesAsMap();
            String sizePart = new String();
            if (attr.containsKey("width") && attr.containsKey("height")) {
              sizePart = "&width=" + attr.get("width") + "&height=" + attr.get("height");
            }
            attr.put("src", "/imagecreator/?text=" + fetchedPercent + "%25" + sizePart);
            whenJsEnabled.addChild(makeHtmlNodeForParsedTag(new ParsedTag(originalImg, attr)));
            whenJsEnabled.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "fetchedBlocks", String.valueOf(fr.fetchedBlocks) });
            whenJsEnabled.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "requiredBlocks", String.valueOf(fr.requiredBlocks) });
          }
        }
      } finally {
View Full Code Here

TOP

Related Classes of freenet.client.filter.HTMLFilter.ParsedTag

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.