public class WidgetDefinitionParser
extends java.lang.Object
<slot internalSlotId="bodySlot1" slotType="ReadOnly"/>
A single value property: <widget-property name="property1" required="true" type="java.lang.Integer" value="1"/> A multi value property: <widget-property name="property1" required="true" type="java.lang.Integer" > <value>1</value> <value>2</value> </widget-property>
<widget-manager j2se="com.ibm.commerce.pagelayout.widget.manager.J2SEWidgetManager" j2ee="com.ibm.commerce.pagelayout.widget.manager.J2EEWidgetManager"/>
<suppported-device-class> <value>Web</value> </suppported-device-class>
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
Copyright field.
|
static java.lang.String | DEFINITION_ELEMENT_NAME
The tag name for the root element of the widget definition.
|
protected static java.util.List<WidgetPropertyType> | EMPTY_WIDGET_PROPERTY_LIST
An empty list of widget properties.
|
static java.lang.String | ID_ATTRIBUTE
The attribute used to define the id of the element.
|
static java.lang.String | INTERNAL_SLOT_ID_ATTRIBUTE
The name of the attribute used to define the internal slot ID for the slot.
|
static java.lang.String | NAME_ATTRIBUTE
The attribute used to define the name of the widget property.
|
static java.lang.String | POSITIONAL_PROPERTY_LEFT
The attribute name for the positional property left for slots.
|
static java.lang.String | POSITIONAL_PROPERTY_TOP
The attribute name for the positional property top for slots.
|
static java.lang.String | POSITIONAL_PROPERTY_X
The attribute name for the positional property x for slots.
|
static java.lang.String | POSITIONAL_PROPERTY_Y
The attribute name for the positional property y for slots.
|
static java.lang.String | SLOT_ELEMENT_NAME
The element name for defining the configurable slots offered by the widget.
|
static java.lang.String | SLOT_TYPE_ATTRIBUTE
The name of the attribute used to define the type of slot.
|
static java.lang.String | SUPPORTED_DEVICE_CLASS_ELEMENT_NAME
The element name for defining the device classes supported by the widget.If the widget supports a single device class, it can define a value attribute.
|
static java.lang.String | VALUE_NODE
This tag is used to define the value for the widget property.
|
static java.lang.String | WIDGET_MANAGER_ELEMENT_NAME
The tag used to define the widget's manager class name.
|
static java.lang.String | WIDGET_PROPERTY_ELEMENT_NAME
The element name for defining the properties of the widget.
|
Constructor and Description |
---|
WidgetDefinitionParser()
Default constructor
|
WidgetDefinitionParser(WidgetDefinitionType widgetDefinition)
Constructor for the parser.
|
Modifier and Type | Method and Description |
---|---|
protected void | addSlot(GenericSlotType slot)
This method adds a slot instance to the list of slots defined.
|
protected void | addWidgetProperties(java.util.List<WidgetPropertyType> properties)
This method adds to the list of widget properties.
|
protected GenericSlotType | createSlotFromElement(org.w3c.dom.Element slotElement)
This method creates a GenericSlot object from the slot element specified.
|
protected java.util.List<WidgetPropertyType> | createSupportedDeviceClassWidgetProperty(org.w3c.dom.Element supportedDeviceClass)
This method creates the widget properties that indicate the supported device classes for the widget from the supported-device-class element specified.
|
protected java.util.List<WidgetPropertyType> | createWidgetPropertyFromElement(org.w3c.dom.Element propertyElement)
This method creates the WidgetProperty from the widget-property element specified.
|
protected java.lang.String | createXML(java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.w3c.dom.Node>> dom)
This method creates the XML structure from the passed java object.
|
java.lang.String | getDataTypeForProperty(java.lang.String propertyName)
This method indicates the data type of the property specified.
|
protected org.w3c.dom.Document | getDocument(java.lang.String xml)
Given a XML, this method returns the Document representation of that XML.
|
java.util.Set<java.lang.String> | getMandatoryWidgetProperties()
This method returns all the widget property names that are marked mandatory.
|
protected PageLayoutFactory | getPageLayoutFactory()
Returns the instance of PageLayoutFactory to use for constructing SDOs.
|
java.util.List<GenericSlotType> | getSlotsDefined()
Returns the slots defined in the widget's XML definition.
|
protected WidgetDefinitionType | getWidgetDefinition()
Returns the widget definition object.
|
java.util.List<WidgetPropertyType> | getWidgetPropertiesDefined()
Returns the list of widget properties defined for the widget.
|
java.lang.Boolean | isMandatoryProperty(java.lang.String propertyName)
This method indicates if the property specified is required or not.
|
java.lang.String | mergeXML(java.lang.String xml1, java.lang.String xml2)
Given 2 XML definitions, this method merges both the XML's and returns the final merged XML.
|
void | parse()
This method parses the widget's XML definition to extract the configurable slots, widget properties and the widget manager class.
|
protected void | updateDOM(java.lang.String defXML, java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.w3c.dom.Node>> dom)
This method parses the defXML and then updates the passed java object with the result of parsing.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String SLOT_TYPE_ATTRIBUTE
public static final java.lang.String INTERNAL_SLOT_ID_ATTRIBUTE
public static final java.lang.String VALUE_NODE
public static final java.lang.String NAME_ATTRIBUTE
public static final java.lang.String ID_ATTRIBUTE
public static final java.lang.String WIDGET_MANAGER_ELEMENT_NAME
public static final java.lang.String WIDGET_PROPERTY_ELEMENT_NAME
public static final java.lang.String SLOT_ELEMENT_NAME
public static final java.lang.String SUPPORTED_DEVICE_CLASS_ELEMENT_NAME
public static final java.lang.String DEFINITION_ELEMENT_NAME
public static final java.lang.String POSITIONAL_PROPERTY_X
public static final java.lang.String POSITIONAL_PROPERTY_Y
public static final java.lang.String POSITIONAL_PROPERTY_TOP
public static final java.lang.String POSITIONAL_PROPERTY_LEFT
protected static final java.util.List<WidgetPropertyType> EMPTY_WIDGET_PROPERTY_LIST
public WidgetDefinitionParser(WidgetDefinitionType widgetDefinition)
public WidgetDefinitionParser()
public void parse() throws WidgetDefinitionException
protected org.w3c.dom.Document getDocument(java.lang.String xml) throws WidgetDefinitionException
protected void updateDOM(java.lang.String defXML, java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.w3c.dom.Node>> dom) throws WidgetDefinitionException
public java.lang.String mergeXML(java.lang.String xml1, java.lang.String xml2) throws WidgetDefinitionException
protected java.lang.String createXML(java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.w3c.dom.Node>> dom) throws WidgetDefinitionException
public java.util.List<GenericSlotType> getSlotsDefined()
public java.util.List<WidgetPropertyType> getWidgetPropertiesDefined()
public java.lang.Boolean isMandatoryProperty(java.lang.String propertyName)
public java.util.Set<java.lang.String> getMandatoryWidgetProperties()
public java.lang.String getDataTypeForProperty(java.lang.String propertyName)
protected WidgetDefinitionType getWidgetDefinition()
protected PageLayoutFactory getPageLayoutFactory()
protected void addSlot(GenericSlotType slot)
protected void addWidgetProperties(java.util.List<WidgetPropertyType> properties)
protected java.util.List<WidgetPropertyType> createWidgetPropertyFromElement(org.w3c.dom.Element propertyElement)
protected GenericSlotType createSlotFromElement(org.w3c.dom.Element slotElement)
protected java.util.List<WidgetPropertyType> createSupportedDeviceClassWidgetProperty(org.w3c.dom.Element supportedDeviceClass)