|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vaadin.terminal.gwt.server.JsonPaintTarget
public class JsonPaintTarget
User Interface Description Language Target. TODO document better: role of this class, UIDL format, attributes, variables, etc.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.vaadin.terminal.PaintTarget |
---|
PaintTarget.PaintStatus |
Constructor Summary | |
---|---|
JsonPaintTarget(AbstractCommunicationManager manager,
PrintWriter outWriter,
boolean cachingRequired)
Creates a new JsonPaintTarget. |
Method Summary | |
---|---|
void |
addAttribute(String name,
boolean value)
Adds a boolean attribute to component. |
void |
addAttribute(String name,
Component value)
Adds a Paintable type attribute. |
void |
addAttribute(String name,
double value)
Adds a double attribute to component. |
void |
addAttribute(String name,
float value)
Adds a float attribute to component. |
void |
addAttribute(String name,
int value)
Adds a integer attribute to component. |
void |
addAttribute(String name,
long value)
Adds a long attribute to component. |
void |
addAttribute(String name,
Map<?,?> value)
TODO |
void |
addAttribute(String name,
Object[] values)
|
void |
addAttribute(String name,
Resource value)
Adds a resource attribute to component. |
void |
addAttribute(String name,
String value)
Adds a string attribute to component. |
void |
addCharacterData(String text)
Adds CDATA node to target UIDL-tree. |
void |
addSection(String sectionTagName,
String sectionData)
Prints the single text section. |
void |
addText(String str)
Prints XML-escaped text. |
void |
addUIDL(String xml)
Adds XML directly to UIDL. |
void |
addUploadStreamVariable(VariableOwner owner,
String name)
Adds a upload stream type variable. |
void |
addVariable(VariableOwner owner,
String name,
boolean value)
Adds a boolean type variable. |
void |
addVariable(VariableOwner owner,
String name,
Component value)
Adds a Paintable type variable. |
void |
addVariable(VariableOwner owner,
String name,
double value)
Adds a double type variable. |
void |
addVariable(VariableOwner owner,
String name,
float value)
Adds a float type variable. |
void |
addVariable(VariableOwner owner,
String name,
int value)
Adds a int type variable. |
void |
addVariable(VariableOwner owner,
String name,
long value)
Adds a long type variable. |
void |
addVariable(VariableOwner owner,
String name,
StreamVariable value)
Adds details about StreamVariable to the UIDL stream. |
void |
addVariable(VariableOwner owner,
String name,
String value)
Adds a string type variable. |
void |
addVariable(VariableOwner owner,
String name,
String[] value)
Adds a string array type variable. |
void |
addXMLSection(String sectionTagName,
String sectionData,
String namespace)
Adds XML section with namespace. |
void |
close()
Closes the paint target. |
void |
endPaintable(Component paintable)
Prints paintable element end tag. |
void |
endTag(String tagName)
Prints the element end tag. |
static String |
escapeJSON(String s)
Escapes the given string so it can safely be used as a JSON string. |
static String |
escapeXML(String xml)
Substitutes the XML sensitive characters with predefined XML entities. |
String |
getTag(ClientConnector clientConnector)
|
String |
getUIDL()
Gets the UIDL already printed to stream. |
Set<Object> |
getUsedResources()
|
boolean |
isFullRepaint()
|
PaintTarget.PaintStatus |
startPaintable(Component connector,
String tagName)
Prints element start tag of a paintable section. |
void |
startTag(String tagName)
Prints element start tag. |
void |
startTag(String tagName,
boolean isChildNode)
Prints the element start tag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsonPaintTarget(AbstractCommunicationManager manager, PrintWriter outWriter, boolean cachingRequired) throws PaintException
manager
- outWriter
- A character-output stream.cachingRequired
- true if this is not a full repaint, i.e. caches are to be
used.
PaintException
- if the paint operation failed.Method Detail |
---|
public void startTag(String tagName) throws PaintException
PaintTarget
Todo: Checking of input values
startTag
in interface PaintTarget
tagName
- the name of the start tag.
PaintException
- if the paint operation failed.public void startTag(String tagName, boolean isChildNode) throws PaintException
Todo: Checking of input values
tagName
- the name of the start tag.
PaintException
- if the paint operation failed.public void endTag(String tagName) throws PaintException
endTag
in interface PaintTarget
tag
- the name of the end tag.
Paintexception
- if the paint operation failed.
PaintException
- if the paint operation failed.public static String escapeXML(String xml)
xml
- the String to be substituted.
public static String escapeJSON(String s)
s
- The string to escape
public void addText(String str) throws PaintException
addText
in interface PaintTarget
str
-
PaintException
- if the paint operation failed.public void addAttribute(String name, boolean value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Attribute name.value
- the Attribute value.
PaintException
- if the paint operation failed.public void addAttribute(String name, Resource value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Attribute namevalue
- the Attribute value
PaintException
- if the paint operation failed.public void addAttribute(String name, int value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Attribute name.value
- the Attribute value.
PaintException
- if the paint operation failed.public void addAttribute(String name, long value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Attribute name.value
- the Attribute value.
PaintException
- if the paint operation failed.public void addAttribute(String name, float value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Attribute name.value
- the Attribute value.
PaintException
- if the paint operation failed.public void addAttribute(String name, double value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Attribute name.value
- the Attribute value.
PaintException
- if the paint operation failed.public void addAttribute(String name, String value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the Boolean attribute name.value
- the Boolean attribute value.
PaintException
- if the paint operation failed.public void addAttribute(String name, Component value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
name
- the name of the attributevalue
- the Paintable to be referenced on client side
PaintException
public void addAttribute(String name, Map<?,?> value) throws PaintException
PaintTarget
addAttribute
in interface PaintTarget
PaintException
public void addAttribute(String name, Object[] values)
addAttribute
in interface PaintTarget
public void addVariable(VariableOwner owner, String name, String value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addVariable(VariableOwner owner, String name, Component value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changesname
- the name of the variablevalue
- the initial value of the variable
PaintException
- if the paint oparation failspublic void addVariable(VariableOwner owner, String name, int value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addVariable(VariableOwner owner, String name, long value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addVariable(VariableOwner owner, String name, float value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addVariable(VariableOwner owner, String name, double value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addVariable(VariableOwner owner, String name, boolean value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addVariable(VariableOwner owner, String name, String[] value) throws PaintException
PaintTarget
addVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.value
- the Variable initial value.
PaintException
- if the paint operation failed.public void addUploadStreamVariable(VariableOwner owner, String name) throws PaintException
addUploadStreamVariable
in interface PaintTarget
owner
- the Listener for variable changes.name
- the Variable name.
PaintException
- if the paint operation failed.public void addSection(String sectionTagName, String sectionData) throws PaintException
addSection
in interface PaintTarget
sectionTagName
- the name of the tag.sectionData
- the section data to be printed.
PaintException
- if the paint operation failed.public void addUIDL(String xml) throws PaintException
addUIDL
in interface PaintTarget
xml
- the Xml to be added.
PaintException
- if the paint operation failed.public void addXMLSection(String sectionTagName, String sectionData, String namespace) throws PaintException
addXMLSection
in interface PaintTarget
sectionTagName
- the name of the tag.sectionData
- the section data.namespace
- the namespace to be added.
PaintException
- if the paint operation failed.PaintTarget.addXMLSection(String, String,
String)
public String getUIDL()
getUIDL
can be called.
public void close() throws PaintException
getUIDL
can be called. Subsequent attempts to write to paint
target. If the target was already closed, call to this function is
ignored. will generate an exception.
PaintException
- if the paint operation failed.public PaintTarget.PaintStatus startPaintable(Component connector, String tagName) throws PaintException
PaintTarget
If the Paintable is found in cache and this function returns true it may omit the content and close the tag, in which case cached content should be used.
This method may also add only a reference to the paintable and queue the paintable to be painted separately.
Each paintable being painted should be closed by a matching
PaintTarget.endPaintable(Component)
regardless of the PaintTarget.PaintStatus
returned.
startPaintable
in interface PaintTarget
connector
- the paintable to start.tagName
- the name of the start tag.
PaintTarget.PaintStatus
- ready to paint or already cached on the
client (also used for sub paintables that are painted later
separately)
PaintException
- if the paint operation failed.PaintTarget.startTag(String)
public void endPaintable(Component paintable) throws PaintException
PaintTarget
PaintTarget.startPaintable(Component, String)
should be matched by
PaintTarget.endPaintable(Component)
. If the parent tag is closed before
every child tag is closed a PaintException is raised.
endPaintable
in interface PaintTarget
paintable
- the paintable to close.
PaintException
- if the paint operation failed.public void addCharacterData(String text) throws PaintException
PaintTarget
addCharacterData
in interface PaintTarget
text
- the Character data to add
PaintException
- if the paint operation failed.public Set<Object> getUsedResources()
public String getTag(ClientConnector clientConnector)
getTag
in interface PaintTarget
ClientConnector
type. Terminal may define how to present
the connector.public void addVariable(VariableOwner owner, String name, StreamVariable value) throws PaintException
PaintTarget
StreamVariable
to the UIDL stream. Eg. in web
terminals Receivers are typically rendered for the client side as URLs,
where the client side implementation can do an http post request.
The urls in UIDL message may use Vaadin specific protocol. Before
actually using the urls on the client side, they should be passed via
ApplicationConnection.translateVaadinUri(String)
.
Note that in current terminal implementation StreamVariables are cleaned from the terminal only when:
StreamVariable.StreamingStartEvent.disposeStreamVariable()
addVariable
in interface PaintTarget
owner
- the ReceiverOwner that can track the progress of streaming to
the given StreamVariablename
- an identifying name for the StreamVariablevalue
- the StreamVariable to paint
PaintException
- if the paint operation failed.public boolean isFullRepaint()
isFullRepaint
in interface PaintTarget
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |