public final class UIDL
extends com.google.gwt.core.client.JavaScriptObject
updateFromUIDL()
will be called with the updated ("changes") UIDL received
from the server.
UIDL is hierarchical, and there are a few methods to retrieve the children,
getChildCount()
, getChildIterator()
getChildString(int)
, getChildUIDL(int)
.
It can be helpful to keep in mind that UIDL was originally modeled in XML, so it's structure is very XML -like. For instance, the first to children in the underlying UIDL representation will contain the "tag" name and attributes, but will be skipped by the methods mentioned above.
Modifier and Type | Class and Description |
---|---|
static class |
UIDL.XML
Deprecated.
should not be used anymore
|
Modifier | Constructor and Description |
---|---|
protected |
UIDL() |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getAttributeNames()
Gets the names of the attributes available.
|
boolean |
getBooleanAttribute(String name)
Gets the named attribute as a boolean.
|
boolean |
getBooleanVariable(String name)
Gets the value of the named variable.
|
UIDL |
getChildByTagName(String tagName)
Returns the child UIDL by its name.
|
int |
getChildCount()
Returns the number of children.
|
Iterator<Object> |
getChildIterator()
Gets an iterator that can be used to iterate trough the children of this
UIDL.
|
String |
getChildrenAsXML()
Deprecated.
|
String |
getChildString(int i)
Gets the child at the given index as a String.
|
UIDL |
getChildUIDL(int i)
Gets the UIDL for the child at the given index.
|
double |
getDoubleAttribute(String name)
Gets the named attribute as a double.
|
double |
getDoubleVariable(String name)
Gets the value of the named variable.
|
float |
getFloatAttribute(String name)
Gets the named attribute as a float.
|
float |
getFloatVariable(String name)
Gets the value of the named variable.
|
String |
getId()
Shorthand for getting the attribute named "id", which for Paintables is
the essential paintableId which binds the server side component to the
client side widget.
|
int[] |
getIntArrayAttribute(String name)
Gets the named attribute as an int array.
|
int[] |
getIntArrayVariable(String name)
Gets the value of the named variable.
|
int |
getIntAttribute(String name)
Gets the named attribute as an int.
|
int |
getIntVariable(String name)
Gets the value of the named variable.
|
long |
getLongAttribute(String name)
Gets the named attribute as a long.
|
long |
getLongVariable(String name)
Gets the value of the named variable.
|
ValueMap |
getMapAttribute(String name)
Gets the named attribute as a Map of named values (key/value pairs).
|
ServerConnector |
getPaintableAttribute(String name,
ApplicationConnection connection)
Gets the Paintable with the id found in the named attributes's value.
|
ServerConnector |
getPaintableVariable(String name,
ApplicationConnection connection)
Gets the Paintable with the id found in the named variable's value.
|
String[] |
getStringArrayAttribute(String name)
Gets the named attribute as an array of Strings.
|
String[] |
getStringArrayVariable(String name)
Gets the value of the named variable.
|
Set<String> |
getStringArrayVariableAsSet(String name)
Gets the value of the named String[] variable as a Set of Strings.
|
String |
getStringAttribute(String name)
Gets the named attribute as a String.
|
String |
getStringVariable(String name)
Gets the value of the named variable.
|
String |
getTag()
Gets the name of this UIDL section, as created with
PaintTarget.startTag() in the
server-side Component.paint() or
(usually) AbstractComponent.paintContent() . |
Set<String> |
getVariableNames()
Gets the names of variables available.
|
boolean |
hasAttribute(String name)
Indicates whether or not the named attribute is available.
|
boolean |
hasVariable(String name)
Checks if the named variable is available.
|
public String getId()
public String getTag()
PaintTarget.startTag()
in the
server-side Component.paint()
or
(usually) AbstractComponent.paintContent()
. Note that if the UIDL corresponds to a
Paintable, a component identifier will be returned instead - this is used
internally and is not needed within
updateFromUIDL()
.public String getStringAttribute(String name)
name
- the name of the attribute to getpublic Set<String> getAttributeNames()
public Set<String> getVariableNames()
public int getIntAttribute(String name)
name
- the name of the attribute to getpublic long getLongAttribute(String name)
name
- the name of the attribute to getpublic float getFloatAttribute(String name)
name
- the name of the attribute to getpublic double getDoubleAttribute(String name)
name
- the name of the attribute to getpublic boolean getBooleanAttribute(String name)
name
- the name of the attribute to getpublic ValueMap getMapAttribute(String name)
name
- the name of the attribute to getpublic String[] getStringArrayAttribute(String name)
name
- the name of the attribute to getpublic int[] getIntArrayAttribute(String name)
name
- the name of the attribute to getpublic boolean hasAttribute(String name)
name
- the name of the attribute to checkpublic UIDL getChildUIDL(int i)
i
- the index of the child to getpublic String getChildString(int i)
i
- the index of the child to getpublic Iterator<Object> getChildIterator()
The Object returned by next()
will be appropriately typed -
if it's UIDL, getTag()
can be used to check which section is in
question.
The basic use case is to iterate over the children of an UIDL update, and
update the appropriate part of the widget for each child encountered, e.g
if getTag()
returns "color", one would update the widgets
color to reflect the value of the "color" section.
@Deprecated public String getChildrenAsXML()
public boolean hasVariable(String name)
name
- the name of the variable desiredpublic String getStringVariable(String name)
name
- the name of the variablepublic int getIntVariable(String name)
name
- the name of the variablepublic long getLongVariable(String name)
name
- the name of the variablepublic float getFloatVariable(String name)
name
- the name of the variablepublic double getDoubleVariable(String name)
name
- the name of the variablepublic boolean getBooleanVariable(String name)
name
- the name of the variablepublic String[] getStringArrayVariable(String name)
name
- the name of the variablepublic Set<String> getStringArrayVariableAsSet(String name)
name
- the name of the variablepublic int[] getIntArrayVariable(String name)
name
- the name of the variablepublic int getChildCount()
public ServerConnector getPaintableAttribute(String name, ApplicationConnection connection)
name
- the name of the attributepublic ServerConnector getPaintableVariable(String name, ApplicationConnection connection)
name
- the name of the variableCopyright © 2019 Vaadin Ltd. All rights reserved.