public class UILayout extends Object implements IPropertyProvider, IClipboardAware<UILayout>
| Constructor and Description |
|---|
UILayout() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the current document.
|
UIElementBase |
deserialize(UIElementBase parent)
Deserializes the layout, under the specified parent, starting from the layout origin.
|
UILayout |
fromClipboard(String data)
Converts from clipboard format.
|
String |
getName()
Returns the name of the currently loaded layout, or null if none loaded.
|
String |
getObjectName()
Returns the object name (i.e., the element tag) of the currently selected node.
|
String |
getProperty(String key)
Returns a property value as a string.
|
Class<? extends UIElementBase> |
getRootClass()
Returns the class of the element at the root of the layout.
|
String |
getVersion()
Returns the version of the layout.
|
boolean |
hasProperty(String name)
Returns true if the specified attribute exists in the current node.
|
boolean |
isEmpty()
Returns true if the layout has no content.
|
UILayout |
loadByAppId(String appId)
Load the layout associated with the specified application id.
|
UILayout |
loadFromProperty(LayoutIdentifier layoutId)
Load the layout from a stored property.
|
void |
loadFromResource(String resource)
Loads a layout from the specified resource.
|
UILayout |
loadFromText(String text)
Load the layout from a string.
|
void |
loadFromUrl(String url)
Load the layout from a file.
|
boolean |
moveDown()
Move current node down one level.
|
boolean |
moveNext()
Moves to next sibling node.
|
boolean |
moveTop()
Move to the top element in the document.
|
boolean |
moveUp()
Move up one level.
|
void |
newChild(String name)
Create a new element node as the child of the current node and make it the current node.
|
boolean |
readBoolean(String name,
boolean deflt)
Returns value of named attribute as a boolean.
|
int |
readInteger(String name,
int deflt)
Return value of named attribute as an integer;
|
String |
readString(String name,
String deflt)
Return value of named attribute as a string.
|
boolean |
saveToProperty(LayoutIdentifier layoutId)
Saves the layout as a property value using the specified identifier.
|
static UILayout |
serialize(UIElementBase parent)
Serializes the UI element hierarchy under and including the specified element.
|
void |
setName(String value)
Sets the name of the current layout.
|
void |
setVersion(String value)
Sets the version of the current layout.
|
String |
toClipboard()
Converts to clipboard format.
|
String |
toString()
Returns the layout as an xml-formatted string.
|
void |
writeBoolean(String name,
boolean value) |
void |
writeInteger(String name,
int value) |
void |
writeString(String name,
String value)
Sets an attribute value.
|
public static UILayout serialize(UIElementBase parent) throws Exception
parent - Top level element to be serialized.Exception - Unspecified exception.public UIElementBase deserialize(UIElementBase parent) throws Exception
parent - Parent UI element at this level of the hierarchy. May be null.Exception - Unspecified exception.public String getObjectName()
public String getName()
public void setName(String value)
value - New name for the layout.public String getVersion()
public void setVersion(String value)
value - Version of the layout.public void loadFromResource(String resource) throws Exception
resource - URL of the resource containing the layout configuration.
If url of format "app:xxx", then layout associated with application id "xxx" is loaded.
If url of format "shared:xxx", then shared layout named "xxx" is loaded.
If url of format "private:xxx", then user layout named "xxx" is loaded.
Otherwise, resource is assumed to be a resource url.
Exception - Unspecified exception.public void loadFromUrl(String url) throws Exception
url - Resource path.Exception - when problem retrieving resource via url.public UILayout loadFromText(String text) throws Exception
text - The XML text to parse.Exception - Unspecified exception.public UILayout loadFromProperty(LayoutIdentifier layoutId) throws Exception
layoutId - Layout identifier.Exception - Unspecified exception.public UILayout loadByAppId(String appId) throws Exception
appId - An application id.Exception - Unspecified exception.public boolean saveToProperty(LayoutIdentifier layoutId)
layoutId - Layout identifierpublic void clear()
public Class<? extends UIElementBase> getRootClass()
public boolean moveDown()
public boolean moveNext()
public boolean moveTop()
public boolean moveUp()
public boolean readBoolean(String name, boolean deflt)
name - Attribute name.deflt - Default value if not found.public int readInteger(String name, int deflt)
name - Attribute name.deflt - Default value if not found.public String readString(String name, String deflt)
name - Attribute name.deflt - Default value if not found.public void newChild(String name)
name - Tag name for the new element.public void writeBoolean(String name, boolean value)
public void writeInteger(String name, int value)
public void writeString(String name, String value)
name - Attribute name.value - Attribute value.public boolean isEmpty()
public String toString()
public String getProperty(String key)
IPropertyProvidergetProperty in interface IPropertyProviderkey - Name of the property whose value is sought.IPropertyProvider.getProperty(String)public boolean hasProperty(String name)
hasProperty in interface IPropertyProvidername - Attribute name.public String toClipboard()
toClipboard in interface IClipboardAware<UILayout>public UILayout fromClipboard(String data) throws Exception
fromClipboard in interface IClipboardAware<UILayout>data - String data from clipboard.Exception - Unspecified exception.Copyright © 2016 Regenstrief Center for Biomedical Informatics. All rights reserved.