Package fitnesse.html

Examples of fitnesse.html.HtmlTag


  @Override
  public String getAsText() {
    // Use HtmlTag, same as we do for fitnesse.wikitext.parser.HashTable.
    Map<Object, Object> hash = (Map) getValue();
    HtmlTag table = new HtmlTag("table");
    table.addAttribute("class", "hash_table");
    for (Map.Entry<Object, Object> entry : hash.entrySet()) {
      HtmlTag row = new HtmlTag("tr");
      row.addAttribute("class", "hash_row");
      table.add(row);
      String key = entry.getKey().toString();
      HtmlTag keyCell = new HtmlTag("td", key.trim());
      keyCell.addAttribute("class", "hash_key");
      row.add(keyCell);

      String value = entry.getValue().toString();
      HtmlTag valueCell = new HtmlTag("td", value.trim());
      valueCell.addAttribute("class", "hash_value");
      row.add(valueCell);
    }
    return table.html().trim();
  }
View Full Code Here


        }
        return content;
    }
   
    private String makeLinkToExistingWikiPage(String qualifiedName, String linkBody, String linkClass) {
        HtmlTag link = new HtmlTag("a", linkBody);
        link.addAttribute("href", qualifiedName);
        if (linkClass != null) {
          link.addAttribute("class", linkClass);
        }
        return link.htmlInline();
    }
View Full Code Here

        }
        return link.htmlInline();
    }

    private String makeLinkToNonExistentWikiPage(String text, String url) {
        HtmlTag link = new HtmlTag("a", "[?]");
        link.addAttribute("title", "create page");
        link.addAttribute("href", url+ "?edit&amp;nonExistent=true");
        return text + link.htmlInline();
    }
View Full Code Here

        wikiMatcher(new Matcher().string("---").repeat('-'));
        htmlTranslation(this);
    }
   
    public String toTarget(Translator translator, Symbol symbol) {
        HtmlTag html = new HtmlTag("hr");
        int size = symbol.getContent().length() - 3;
        if (size > 1) html.addAttribute("size", Integer.toString(size));
        return html.html();
    }
View Full Code Here

    }

    public String buildLink(Translator translator, String body, Symbol link) {
        Reference reference = new Reference(translator.translate(link.childAt(0)));
        String prefix = link.getContent();
        HtmlTag tag;
        if (link.hasProperty(Link.ImageProperty) || reference.isImage()) {
            tag = new HtmlTag("img");
            tag.addAttribute("src", reference.makeUrl(prefix));
            String imageClass = link.getProperty(Link.ImageProperty);
            if (imageClass.length() > 0) tag.addAttribute("class", imageClass);
            String width = link.getProperty(Link.WidthProperty);
            if (width.length() > 0) tag.addAttribute("width", width);
            String style = link.getProperty(Link.StyleProperty);
            if (style.length() > 0) tag.addAttribute("style", style);
        }
        else {
            tag = new HtmlTag("a", body);
            tag.addAttribute("href", reference.makeUrl(prefix));
        }
        return tag.htmlInline();
    }
View Full Code Here

        });
        return this;
    }

    public String toTarget(Translator translator, Symbol symbol) {
        HtmlTag result = new HtmlTag(tagName);
        for (TagBuilder builder: builders) {
            builder.build(translator, symbol, result);
        }
        return inline ? result.htmlInline() : result.html();
    }
View Full Code Here

        if (linkReference.childAt(0).isType(WikiWord.symbolType) || PathParser.isWikiPath(linkReference.childAt(0).getContent())) {
            return new WikiWordBuilder(translator.getPage(), linkReference.childAt(0).getContent(), linkBody)
                    .buildLink(translator.translate(linkReference.childrenAfter(0)), linkBody);
        }

        HtmlTag alias = new HtmlTag("a", linkBody);

        if (linkReference.childAt(0).isType(Link.symbolType)) {
            alias.addAttribute("href", linkReferenceString.startsWith("http://files/") ? linkReferenceString.substring(7) : linkReferenceString);
        } else {
            alias.addAttribute("href", translator.translate(linkReference));
        }

        return alias.htmlInline();
    }
View Full Code Here

        this.level = level;
        this.page = page;
    }

    public HtmlTag buildLevel(SourcePage page) {
        HtmlTag list = new HtmlTag("ul");
        list.addAttribute("class", "toc" + level);
        for (SourcePage child: getSortedChildren(page)) {
            list.add(buildListItem(child));
        }
        return list;
    }
View Full Code Here

        }
        return list;
    }

    private HtmlTag buildListItem(SourcePage child) {
        HtmlTag listItem = buildItem(child);
        if (child.getChildren().size() > 0) {
            if (level < getRecursionLimit()) {
                listItem.add(new ContentsItemBuilder(contents, level + 1, child).buildLevel(child));
            }
            else if (getRecursionLimit() > 0){
                listItem.add(contents.getVariable(Contents.MORE_SUFFIX_TOC, Contents.MORE_SUFFIX_DEFAULT));
            }
        }
        return listItem;
    }
View Full Code Here

        Collections.sort(result);
        return result;
    }

    public HtmlTag buildItem(SourcePage page) {
        HtmlTag listItem = new HtmlTag("li");
        HtmlTag link = new HtmlTag("a", buildBody(page));
        link.addAttribute("href", buildReference(page));
        link.addAttribute("class", getBooleanPropertiesClasses(page));
        listItem.add(link);
        String help = page.getProperty(PageData.PropertyHELP);
        if (help.length() > 0) {
            if (hasOption("-h", Contents.HELP_TOC)) {
                listItem.add(HtmlUtil.makeSpanTag("pageHelp", ": " + help));
            }
            else {
                link.addAttribute("title", help);
            }
        }
        return listItem;
    }
View Full Code Here

TOP

Related Classes of fitnesse.html.HtmlTag

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.