NIFI-434 putting ids on html element to facilitate CSS

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/0c5abce5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/0c5abce5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/0c5abce5

Branch: refs/heads/develop
Commit: 0c5abce5f95876320586453d1391fe2588371ec3
Parents: 0bd2784
Author: danbress <[email protected]>
Authored: Mon Mar 23 09:14:09 2015 -0400
Committer: danbress <[email protected]>
Committed: Mon Mar 23 10:29:37 2015 -0400

----------------------------------------------------------------------
 .../html/HtmlDocumentationWriter.java           | 30 ++++++++++++++++++--
 .../html/HtmlProcessorDocumentationWriter.java  |  4 +++
 2 files changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0c5abce5/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
index b1f426a..0da5bed 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
@@ -302,12 +302,13 @@ public class HtmlDocumentationWriter implements 
DocumentationWriter {
         List<PropertyDescriptor> properties = 
configurableComponent.getPropertyDescriptors();
         if (properties.size() > 0) {
             xmlStreamWriter.writeStartElement("table");
+            xmlStreamWriter.writeAttribute("id", "properties");
 
             // write the header row
             xmlStreamWriter.writeStartElement("tr");
             writeSimpleElement(xmlStreamWriter, "th", "Name");
             writeSimpleElement(xmlStreamWriter, "th", "Default Value");
-            writeSimpleElement(xmlStreamWriter, "th", "Valid Values");
+            writeSimpleElement(xmlStreamWriter, "th", "Allowable Values");
             writeSimpleElement(xmlStreamWriter, "th", "Description");
             xmlStreamWriter.writeEndElement();
 
@@ -315,6 +316,7 @@ public class HtmlDocumentationWriter implements 
DocumentationWriter {
             for (PropertyDescriptor property : properties) {
                 xmlStreamWriter.writeStartElement("tr");
                 xmlStreamWriter.writeStartElement("td");
+                xmlStreamWriter.writeAttribute("id", "name");
                 if (property.isRequired()) {
                     writeSimpleElement(xmlStreamWriter, "strong", 
property.getDisplayName());
                 } else {
@@ -322,11 +324,13 @@ public class HtmlDocumentationWriter implements 
DocumentationWriter {
                 }
 
                 xmlStreamWriter.writeEndElement();
-                writeSimpleElement(xmlStreamWriter, "td", 
property.getDefaultValue());
+                writeSimpleElement(xmlStreamWriter, "td", 
property.getDefaultValue(), false, "default-value");
                 xmlStreamWriter.writeStartElement("td");
+                xmlStreamWriter.writeAttribute("id", "allowable-values");
                 writeValidValues(xmlStreamWriter, property);
                 xmlStreamWriter.writeEndElement();
                 xmlStreamWriter.writeStartElement("td");
+                xmlStreamWriter.writeAttribute("id", "description");
                 if (property.getDescription() != null && 
property.getDescription().trim().length() > 0) {
                     xmlStreamWriter.writeCharacters(property.getDescription());
                 } else {
@@ -372,6 +376,7 @@ public class HtmlDocumentationWriter implements 
DocumentationWriter {
             xmlStreamWriter
                     .writeCharacters("Dynamic Properties allow the user to 
specify both the name and value of a property.");
             xmlStreamWriter.writeStartElement("table");
+            xmlStreamWriter.writeAttribute("id", "dynamic-properties");
             xmlStreamWriter.writeStartElement("tr");
             writeSimpleElement(xmlStreamWriter, "th", "Name");
             writeSimpleElement(xmlStreamWriter, "th", "Value");
@@ -489,7 +494,26 @@ public class HtmlDocumentationWriter implements 
DocumentationWriter {
      */
     protected final static void writeSimpleElement(final XMLStreamWriter 
writer, final String elementName,
             final String characters, boolean strong) throws XMLStreamException 
{
-        writer.writeStartElement(elementName);
+       writeSimpleElement(writer, elementName, characters, strong, null);
+    }
+    
+    /**
+     * Writes a begin element, an id attribute(if specified), then text, then 
end element for
+     * element of the users choosing.  Example: &lt;p 
id="p-id"&gt;text&lt;/p&gt;
+     * 
+     * @param writer the stream writer to use
+     * @param elementName the name of the element
+     * @param characters the text of the element
+     * @param strong whether to bold the text of the element or not
+     * @param id the id of the element.  specifying null will cause no element 
to be written.
+     * @throws XMLStreamException
+     */
+    protected final static void writeSimpleElement(final XMLStreamWriter 
writer, final String elementName,
+            final String characters, boolean strong, String id) throws 
XMLStreamException {
+       writer.writeStartElement(elementName);
+       if (id != null) {
+               writer.writeAttribute("id", id);
+       }
         if (strong) {
             writer.writeStartElement("strong");
         }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0c5abce5/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java
index f210c7a..bc355f7 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java
@@ -83,6 +83,7 @@ public class HtmlProcessorDocumentationWriter extends 
HtmlDocumentationWriter {
         writeSimpleElement(xmlStreamWriter, "h3", "Reads Attributes: ");
         if (attributesRead.size() > 0) {
             xmlStreamWriter.writeStartElement("table");
+            xmlStreamWriter.writeAttribute("id", "reads-attributes");
             xmlStreamWriter.writeStartElement("tr");
             writeSimpleElement(xmlStreamWriter, "th", "Name");
             writeSimpleElement(xmlStreamWriter, "th", "Description");
@@ -120,6 +121,7 @@ public class HtmlProcessorDocumentationWriter extends 
HtmlDocumentationWriter {
         writeSimpleElement(xmlStreamWriter, "h3", "Writes Attributes: ");
         if (attributesRead.size() > 0) {
             xmlStreamWriter.writeStartElement("table");
+            xmlStreamWriter.writeAttribute("id", "writes-attributes");
             xmlStreamWriter.writeStartElement("tr");
             writeSimpleElement(xmlStreamWriter, "th", "Name");
             writeSimpleElement(xmlStreamWriter, "th", "Description");
@@ -203,6 +205,7 @@ public class HtmlProcessorDocumentationWriter extends 
HtmlDocumentationWriter {
 
         if (processor.getRelationships().size() > 0) {
             xmlStreamWriter.writeStartElement("table");
+            xmlStreamWriter.writeAttribute("id", "relationships");
             xmlStreamWriter.writeStartElement("tr");
             writeSimpleElement(xmlStreamWriter, "th", "Name");
             writeSimpleElement(xmlStreamWriter, "th", "Description");
@@ -236,6 +239,7 @@ public class HtmlProcessorDocumentationWriter extends 
HtmlDocumentationWriter {
             xmlStreamWriter.writeStartElement("p");
             xmlStreamWriter.writeCharacters("A Dynamic Relationship may be 
created based on how the user configures the Processor.");
             xmlStreamWriter.writeStartElement("table");
+            xmlStreamWriter.writeAttribute("id", "dynamic-relationships");
             xmlStreamWriter.writeStartElement("tr");
             writeSimpleElement(xmlStreamWriter, "th", "Name");
             writeSimpleElement(xmlStreamWriter, "th", "Description");

Reply via email to