com.taursys.xml
Class Attribute

java.lang.Object
  extended bycom.taursys.xml.Component
      extended bycom.taursys.xml.Parameter
          extended bycom.taursys.xml.Attribute
All Implemented Interfaces:
MapperComponent

public class Attribute
extends Parameter

An Attribute is a sub-component of an Element. It is rendered within the Element tag as: attribname="value". Attribute extends Parameter and thus can carry a value or be bound to a value holder. It can also receive its value from the request.

An Attribute renders itself to its parent's element (if the parent has its id property set).


Constructor Summary
Attribute()
          Constructs a new Attribute with a DefaultTextModel and a VariantValueHolder for a String data type.
Attribute(int javaDataType)
          Constructs a new Attribute with a DefaultTextModel and a VariantValueHolder for the given data type.
 
Method Summary
protected  AttributeRenderer createDefaultRenderer()
          Creates the default AttributeRenderer for this component.
 java.lang.String getAttributeName()
          Returns the name of the Element's attribute where the value should be rendered.
 AttributeRenderer getRenderer()
          Returns the renderer subcomponent used to render the value to the Document.
 void processRenderEvent(RenderEvent e)
          Responds to a render event for this component.
 void setAttributeName(java.lang.String newAttributeName)
          Sets the name of the Element's attribute where the value should be rendered.
 void setRenderer(AttributeRenderer newRenderer)
          Sets the renderer subcomponent used to render the value to the Document.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class com.taursys.xml.Parameter
createDefaultModel, createDefaultModel, getDefaultValue, getFormat, getFormatPattern, getModel, getParameter, getPropertyName, getText, getValue, getValueHolder, processParameterEvent, setDefaultValue, setFormat, setFormatPattern, setModel, setParameter, setPropertyName, setText, setValue, setValueHolder
 
Methods inherited from class com.taursys.xml.Component
addEventType, addInputListener, addNotify, addParameterListener, addRecycleListener, addRenderListener, addTriggerListener, dispatchEvent, fireActionPerformed, fireInputReceived, fireParameterReceived, fireRecycle, fireRender, getEventTypeList, getParent, isNotifySet, isVisible, lazyAddNotify, lazyRemoveNotify, processEvent, processInputEvent, processRecycleEvent, processTriggerEvent, removeEventType, removeInputListener, removeNotify, removeParameterListener, removeRecycleListener, removeRenderListener, removeTriggerListener, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute()
Constructs a new Attribute with a DefaultTextModel and a VariantValueHolder for a String data type. The default model, a DefaultTextModel, is created via the createDefaultModel method. By default, the DefaultTextModel creates and uses a VariantValueHolder of type String. The default renderer, an AttributeRenderer, is created via the createDefaultRenderer method.


Attribute

public Attribute(int javaDataType)
Constructs a new Attribute with a DefaultTextModel and a VariantValueHolder for the given data type. To specify the data type, use one of the TYPE_xxx constants defined in DataTypes.

Parameters:
javaDataType - data type for new model
See Also:
DataTypes
Method Detail

createDefaultRenderer

protected AttributeRenderer createDefaultRenderer()
Creates the default AttributeRenderer for this component. By Default this methos returns a new AttributeRenderer. Override this method to define your own AttributeRenderer.


processRenderEvent

public void processRenderEvent(RenderEvent e)
                        throws RenderException
Responds to a render event for this component. This uses the renderer subcomponent to actually render the value. It first notifies any RenderListeners of the event. It then invokes the renderer subcomponent to render the value to the document.

Overrides:
processRenderEvent in class Component
Parameters:
e - the current render event message
Throws:
RenderException - if problem rendering value to document

setRenderer

public void setRenderer(AttributeRenderer newRenderer)
Sets the renderer subcomponent used to render the value to the Document.


getRenderer

public AttributeRenderer getRenderer()
Returns the renderer subcomponent used to render the value to the Document.


setAttributeName

public void setAttributeName(java.lang.String newAttributeName)
Sets the name of the Element's attribute where the value should be rendered. The default is "value".


getAttributeName

public java.lang.String getAttributeName()
Returns the name of the Element's attribute where the value should be rendered. The default is "value".


toString

public java.lang.String toString()
Returns a string representation of this object. This contains the object identity and state information.

Overrides:
toString in class Parameter
Returns:
a string representation of this object


Copyright © 2007 Martin T Phelan. All Rights Reserved.