src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
changeset 54060 53a95878619f
parent 53562 0d9dee001667
child 54444 259b40b4d473
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Mon Mar 11 11:23:09 2019 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Mon Mar 11 12:59:45 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
     public HtmlTree(HtmlTag tag, Content... contents) {
         this(tag);
         for (Content c: contents)
-            addContent(c);
+            add(c);
     }
 
     /**
@@ -87,7 +87,7 @@
     public HtmlTree(HtmlTag tag, List<Content> contents) {
         this(tag);
         for (Content c: contents)
-            addContent(c);
+            add(c);
     }
 
     /**
@@ -97,7 +97,7 @@
      * @param attrValue value of the attribute
      * @return this object
      */
-    public HtmlTree addAttr(HtmlAttr attrName, String attrValue) {
+    public HtmlTree put(HtmlAttr attrName, String attrValue) {
         if (attrs.isEmpty())
             attrs = new LinkedHashMap<>(3);
         attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
@@ -112,7 +112,7 @@
      * @return this object
      */
     public HtmlTree setTitle(Content body) {
-        addAttr(HtmlAttr.TITLE, stripHtml(body));
+        put(HtmlAttr.TITLE, stripHtml(body));
         return this;
     }
 
@@ -123,7 +123,7 @@
      * @return this object
      */
     public HtmlTree setRole(Role role) {
-        addAttr(HtmlAttr.ROLE, role.toString());
+        put(HtmlAttr.ROLE, role.toString());
         return this;
     }
 
@@ -134,7 +134,7 @@
      * @return this object
      */
     public HtmlTree setStyle(HtmlStyle style) {
-        addAttr(HtmlAttr.CLASS, style.toString());
+        put(HtmlAttr.CLASS, style.toString());
         return this;
     }
 
@@ -144,10 +144,10 @@
      * @param tagContent tag content to be added
      */
     @Override
-    public void addContent(Content tagContent) {
+    public void add(Content tagContent) {
         if (tagContent instanceof ContentBuilder) {
             for (Content c: ((ContentBuilder)tagContent).contents) {
-                addContent(c);
+                add(c);
             }
         }
         else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
@@ -165,16 +165,16 @@
      * @param stringContent string content that needs to be added
      */
     @Override
-    public void addContent(CharSequence stringContent) {
+    public void add(CharSequence stringContent) {
         if (!content.isEmpty()) {
             Content lastContent = content.get(content.size() - 1);
             if (lastContent instanceof StringContent)
-                lastContent.addContent(stringContent);
+                lastContent.add(stringContent);
             else
-                addContent(new StringContent(stringContent));
+                add(new StringContent(stringContent));
         }
         else
-            addContent(new StringContent(stringContent));
+            add(new StringContent(stringContent));
     }
 
     /**
@@ -294,7 +294,7 @@
      */
     public static HtmlTree A(String ref, Content body) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
-        htmltree.addAttr(HtmlAttr.HREF, encodeURL(ref));
+        htmltree.put(HtmlAttr.HREF, encodeURL(ref));
         return htmltree;
     }
 
@@ -307,8 +307,8 @@
      */
     public static HtmlTree A_ID(String id, Content body) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.A);
-        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
-        htmltree.addContent(nullCheck(body));
+        htmltree.put(HtmlAttr.ID, nullCheck(id));
+        htmltree.add(nullCheck(body));
         return htmltree;
     }
 
@@ -497,7 +497,7 @@
      */
     public static HtmlTree HTML(String lang, Content head, Content body) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.HTML, nullCheck(head), nullCheck(body));
-        htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
+        htmltree.put(HtmlAttr.LANG, nullCheck(lang));
         return htmltree;
     }
 
@@ -511,9 +511,9 @@
      */
     public static HtmlTree IFRAME(String src, String name, String title) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
-        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
-        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
-        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
+        htmltree.put(HtmlAttr.SRC, nullCheck(src));
+        htmltree.put(HtmlAttr.NAME, nullCheck(name));
+        htmltree.put(HtmlAttr.TITLE, nullCheck(title));
         return htmltree;
     }
 
@@ -527,10 +527,10 @@
      */
     public static HtmlTree INPUT(String type, String id, String value) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT);
-        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
-        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
-        htmltree.addAttr(HtmlAttr.VALUE, nullCheck(value));
-        htmltree.addAttr(HtmlAttr.DISABLED, "disabled");
+        htmltree.put(HtmlAttr.TYPE, nullCheck(type));
+        htmltree.put(HtmlAttr.ID, nullCheck(id));
+        htmltree.put(HtmlAttr.VALUE, nullCheck(value));
+        htmltree.put(HtmlAttr.DISABLED, "disabled");
         return htmltree;
     }
 
@@ -543,7 +543,7 @@
      */
     public static HtmlTree LABEL(String forLabel, Content body) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.LABEL, nullCheck(body));
-        htmltree.addAttr(HtmlAttr.FOR, nullCheck(forLabel));
+        htmltree.put(HtmlAttr.FOR, nullCheck(forLabel));
         return htmltree;
     }
 
@@ -582,10 +582,10 @@
      */
     public static HtmlTree LINK(String rel, String type, String href, String title) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
-        htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
-        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
-        htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
-        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
+        htmltree.put(HtmlAttr.REL, nullCheck(rel));
+        htmltree.put(HtmlAttr.TYPE, nullCheck(type));
+        htmltree.put(HtmlAttr.HREF, nullCheck(href));
+        htmltree.put(HtmlAttr.TITLE, nullCheck(title));
         return htmltree;
     }
 
@@ -638,8 +638,8 @@
     public static HtmlTree META(String httpEquiv, String content, String charSet) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.META);
         String contentCharset = content + "; charset=" + charSet;
-        htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
-        htmltree.addAttr(HtmlAttr.CONTENT, contentCharset);
+        htmltree.put(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
+        htmltree.put(HtmlAttr.CONTENT, contentCharset);
         return htmltree;
     }
 
@@ -652,8 +652,8 @@
      */
     public static HtmlTree META(String name, String content) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.META);
-        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
-        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
+        htmltree.put(HtmlAttr.NAME, nullCheck(name));
+        htmltree.put(HtmlAttr.CONTENT, nullCheck(content));
         return htmltree;
     }
 
@@ -711,8 +711,8 @@
      */
     public static HtmlTree SCRIPT(String src) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
-        htmltree.addAttr(HtmlAttr.TYPE, "text/javascript");
-        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
+        htmltree.put(HtmlAttr.TYPE, "text/javascript");
+        htmltree.put(HtmlAttr.SRC, nullCheck(src));
         return htmltree;
     }
 
@@ -785,7 +785,7 @@
      */
     public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
-        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
+        htmltree.put(HtmlAttr.ID, nullCheck(id));
         if (styleClass != null)
             htmltree.setStyle(styleClass);
         return htmltree;
@@ -803,7 +803,7 @@
         HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
         if (styleClass != null)
             htmltree.setStyle(styleClass);
-        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
+        htmltree.put(HtmlAttr.SUMMARY, nullCheck(summary));
         return htmltree;
     }
 
@@ -858,7 +858,7 @@
         HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body));
         if (styleClass != null)
             htmltree.setStyle(styleClass);
-        htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
+        htmltree.put(HtmlAttr.SCOPE, nullCheck(scope));
         return htmltree;
     }
 
@@ -916,9 +916,9 @@
      */
     public static HtmlTree UL(HtmlStyle styleClass, Content first, Content... more) {
         HtmlTree htmlTree = new HtmlTree(HtmlTag.UL);
-        htmlTree.addContent(nullCheck(first));
+        htmlTree.add(nullCheck(first));
         for (Content c : more) {
-            htmlTree.addContent(nullCheck(c));
+            htmlTree.add(nullCheck(c));
         }
         htmlTree.setStyle(nullCheck(styleClass));
         return htmlTree;