water.api
Class RequestBuilders.ArrayBuilder

java.lang.Object
  extended by water.api.RequestBuilders.Builder
      extended by water.api.RequestBuilders.ArrayBuilder
Direct Known Subclasses:
RequestBuilders.PaginatedTable
Enclosing class:
RequestBuilders

public static class RequestBuilders.ArrayBuilder
extends RequestBuilders.Builder

Builds the HTML for an array. Arrays generally go to a table. Is similar to the object, but rather than a horizontal dl generally displays as a table. Can produce a header of the table and has hooks for rows.


Constructor Summary
RequestBuilders.ArrayBuilder()
           
 
Method Summary
 java.lang.String build(RequestBuilders.Response response, com.google.gson.JsonArray array, java.lang.String contextName)
          Builds the array.
 java.lang.String build(RequestBuilders.Response response, com.google.gson.JsonElement element, java.lang.String contextName)
          Calls the build method with array.
 java.lang.String caption(com.google.gson.JsonArray array, java.lang.String name)
          Caption of the table.
 RequestBuilders.Builder defaultBuilder(com.google.gson.JsonElement element)
          Default builders for the table.
 java.lang.String footer(com.google.gson.JsonArray array)
          Footer of the table, the end of table tag.
 java.lang.String header(com.google.gson.JsonArray array)
          Header of the table.
 java.lang.String header(java.lang.String key)
           
 
Methods inherited from class water.api.RequestBuilders.Builder
addToContext, elementName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestBuilders.ArrayBuilder

public RequestBuilders.ArrayBuilder()
Method Detail

caption

public java.lang.String caption(com.google.gson.JsonArray array,
                                java.lang.String name)
Caption of the table.


header

public java.lang.String header(com.google.gson.JsonArray array)
Header of the table. Produces header off the first element if it is object, or a single column header named value if it is a primitive. Also includes the table tag.


header

public java.lang.String header(java.lang.String key)

footer

public java.lang.String footer(com.google.gson.JsonArray array)
Footer of the table, the end of table tag.


defaultBuilder

public RequestBuilders.Builder defaultBuilder(com.google.gson.JsonElement element)
Default builders for the table. It is either a table row builder if the row is an object, or a row single column builder if it is a primitive or another array.

Overrides:
defaultBuilder in class RequestBuilders.Builder

build

public java.lang.String build(RequestBuilders.Response response,
                              com.google.gson.JsonArray array,
                              java.lang.String contextName)
Builds the array. Creates the caption, header, all the rows and the footer or determines that the array is empty.


build

public java.lang.String build(RequestBuilders.Response response,
                              com.google.gson.JsonElement element,
                              java.lang.String contextName)
Calls the build method with array. If not an array, displays an alert with the JSON contents of the element.

Specified by:
build in class RequestBuilders.Builder