Class ElementCollection
- java.lang.Object
-
- com.cloudofficeprint.RenderElements.RenderElement
-
- com.cloudofficeprint.RenderElements.ElementCollection
-
public class ElementCollection extends RenderElement
A collection used to group multiple RenderElements together. It can contain nested `Object`s and should be used to pass multiple `RenderElements` as PrintJob data, as well as to allow for nested elements. Its name is used as a key name when nested, but ignored for all purposes when it's the outer object.
-
-
Constructor Summary
Constructors Constructor Description ElementCollection(java.lang.String name)
A collection used to group multiple RenderElements together.ElementCollection(java.lang.String name, java.util.ArrayList<RenderElement> elements)
A collection used to group multiple RenderElements together.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllRenderElements(ElementCollection collection)
Adds all the elements from the elementcollection to the elements of this collection.void
addElement(RenderElement element)
void
addFromDict(java.util.Hashtable<java.lang.String,java.lang.String> properties)
Adds the list of properties from a mapping.java.util.ArrayList<RenderElement>
getElements()
com.google.gson.JsonObject
getJSON()
java.util.Set<java.lang.String>
getTemplateTags()
static ElementCollection
makeCollectionFromJson(java.lang.String name, com.google.gson.JsonObject json)
Parses a JsonArray to an elementcollection.void
removeElement(RenderElement element)
void
removeElementByName(java.lang.String elementName)
void
setElements(java.util.ArrayList<RenderElement> elements)
static void
updateJson1WithJson2(com.google.gson.JsonObject json1, com.google.gson.JsonObject json2)
-
Methods inherited from class com.cloudofficeprint.RenderElements.RenderElement
getName, getValue, setName, setValue
-
-
-
-
Constructor Detail
-
ElementCollection
public ElementCollection(java.lang.String name, java.util.ArrayList<RenderElement> elements)
A collection used to group multiple RenderElements together.- Parameters:
name
- The name is used as a key name when the collection is nested, but ignored when it's the outer object.elements
- List of nested RenderElements.
-
ElementCollection
public ElementCollection(java.lang.String name)
A collection used to group multiple RenderElements together. The arrayList of elements isn't initialised in this constructor so setFromDict should be called.- Parameters:
name
- The name is used as a key name when the collection is nested, but ignored when it's the outer object.
-
-
Method Detail
-
getElements
public java.util.ArrayList<RenderElement> getElements()
- Returns:
- List of nested RenderElements.
-
setElements
public void setElements(java.util.ArrayList<RenderElement> elements)
- Parameters:
elements
- List of nested RenderElements.
-
addElement
public void addElement(RenderElement element)
- Parameters:
element
- Element to add to the list of elements.
-
removeElement
public void removeElement(RenderElement element)
- Parameters:
element
- Element to remove from the list of elements.
-
removeElementByName
public void removeElementByName(java.lang.String elementName)
- Parameters:
elementName
- Name of the element to remove from the list of elements.
-
addFromDict
public void addFromDict(java.util.Hashtable<java.lang.String,java.lang.String> properties)
Adds the list of properties from a mapping.- Parameters:
properties
- Hashtable of (propertyName,propertyValue).
-
makeCollectionFromJson
public static ElementCollection makeCollectionFromJson(java.lang.String name, com.google.gson.JsonObject json)
Parses a JsonArray to an elementcollection.- Parameters:
name
- Name of the elementcollection.json
- Json to parse.- Returns:
- Elementcollection of the parsed json.
-
addAllRenderElements
public void addAllRenderElements(ElementCollection collection)
Adds all the elements from the elementcollection to the elements of this collection.- Parameters:
collection
- Elementcollection.
-
updateJson1WithJson2
public static void updateJson1WithJson2(com.google.gson.JsonObject json1, com.google.gson.JsonObject json2)
- Parameters:
json1
- Json to add the data from json2 to.json2
- Json to take the data from. Cannot have nested JSON's/JsonArrays.
-
getJSON
public com.google.gson.JsonObject getJSON()
- Specified by:
getJSON
in classRenderElement
- Returns:
- JSONObject with the tags for this property for the Cloud Office Print server.
-
getTemplateTags
public java.util.Set<java.lang.String> getTemplateTags()
- Specified by:
getTemplateTags
in classRenderElement
- Returns:
- An immutable set containing all available template tags this element can replace.
-
-