|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.taursys.xml.Component com.taursys.xml.Parameter
A Component
which receives parameter values. A
Parameter
, unlike a TextField
,
is not a DocumentComponent
. It cannot be bound to the XML
document to render its value. It is intended as a way to gather parameters
needed for opening a form (example accountNumber to open an account).
A Parameter
receives its values before a TextField
.
Values are dispatched to Parameters
immediately before the
openForm
method of the ServletForm
is invoked,
whereas values are dispatched to a TextField
immediately
after the openForm
method.
This component has one required property. It is the parameter
property. This identifies the name of the value which it should listen for
and respond to in the request.
By default, this component uses an internal DefaultTextModel
with a VariantValueHolder
and a default data type of
String
. You can specify a different data type when you invoke
the constructor of this component.
The following is an example of a Parameter
which receives a
birthdate:
Parameter birthdate = new Parameter(DataTypes.TYPE_DATE); ... private void jbInit() throws Exception { birthdate.setParameter("birthdate"); birthdate.setFormat(java.text.SimpleDateFormat.getInstance()); birthdate.setFormatPattern("MM/dd/yyyy"); ... this.add(birthdate); } protected void openForm() throws Exception { // search for record by birthdate PersonVO person = delegate.findByBirthdate( (Date)birthdate.getValue()); }
This component can also be bound to an external ValueHolder
.
An external ValueHolder
can be shared by multiple components.
The propertyName
specifies which property in the
ValueHolder
will be bound to this component. To bind this
component, set the valueHolder
and propertyName
properties. You do not need to specify a data type when you bind to a
ValueHolder
. The following is an example of binding:
Parameter latitude = new Parameter(); Parameter longitude = new Parameter(); VOValueHolder holder = new VOValueHolder(); private void jbInit() throws Exception { holder.setValueObjectClass(LocationVO.class); latitude.setParameter("latitude"); latitude.setValueHolder(holder); latitude.setPropertyName("physicalLatitude"); longitude.setParameter("longitude"); longitude.setValueHolder(holder); longitude.setPropertyName("physicalLongitude"); ... this.add(latitude); this.add(longitude); } void showOnMapButton_actionPerformed(TriggerEvent e) throws Exception { OutputStream map = delegate.getMap((LocationVO)holder.getValueObject()); ... }
ValueHolder
,
TextField
Constructor Summary | |
Parameter()
Constructs a new Parameter with a DefaultTextModel
and a VariantValueHolder for a String data type. |
|
Parameter(int javaDataType)
Constructs a new Parameter with a DefaultTextModel
and a VariantValueHolder for the given data type. |
Method Summary | |
protected TextModel |
createDefaultModel()
Creates the default model used by this component |
protected TextModel |
createDefaultModel(int javaDataType)
Creates the default model of given data type used by this component |
java.lang.String |
getDefaultValue()
Get the defaultValue to be used if no input is received. |
java.text.Format |
getFormat()
Returns the Format of the TextModel. |
java.lang.String |
getFormatPattern()
Returns the Format pattern of the TextModel. |
TextModel |
getModel()
Returns the model for this component |
java.lang.String |
getParameter()
Returns the name of the parameter this components listens for |
java.lang.String |
getPropertyName()
Returns the propertyName in the valueHolder where the model stores the value. |
java.lang.String |
getText()
Returns the model value as a String (using Format if defined). |
java.lang.Object |
getValue()
Returns the value of within the ValueHolder of the Model. |
ValueHolder |
getValueHolder()
Returns the valueHolder for the model. |
protected void |
processParameterEvent(ParameterEvent e)
Store value and fires parameter event if event has correct parameter name. |
void |
setDefaultValue(java.lang.String newDefaultValue)
Set the defaultValue to be used if no input is received. |
void |
setFormat(java.text.Format format)
Sets the Format of the TextModel. |
void |
setFormatPattern(java.lang.String newPattern)
Sets the Format patten of the TextModel. |
void |
setModel(TextModel newModel)
Sets the model used by this component. |
void |
setParameter(java.lang.String newParameter)
Sets the name of the parameter this components listens for. |
void |
setPropertyName(java.lang.String newPropertyName)
Sets the propertyName in the valueHolder where the model stores the value. |
void |
setText(java.lang.String text)
Sets the model value from the given String (using Format if defined). |
void |
setValue(java.lang.Object value)
Sets the value within the ValueHolder of the Model. |
void |
setValueHolder(ValueHolder newValueHolder)
Sets the valueHolder for the model. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Parameter()
Parameter
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
.
public Parameter(int javaDataType)
Parameter
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
.
javaDataType
- data type for new modelDataTypes
Method Detail |
public TextModel getModel()
public void setModel(TextModel newModel)
newModel
- to be used by this component.protected TextModel createDefaultModel()
protected TextModel createDefaultModel(int javaDataType)
javaDataType
- data type for new modelfor defined data type constants TYPE_XXX.
public java.lang.String getText() throws ModelException
ModelException
public void setText(java.lang.String text) throws ModelException
ModelException
public java.lang.Object getValue() throws ModelException
ModelException
public void setValue(java.lang.Object value) throws ModelException
ModelException
protected void processParameterEvent(ParameterEvent e) throws java.lang.Exception
processParameterEvent
in class Component
java.lang.Exception
public void setParameter(java.lang.String newParameter)
public java.lang.String getParameter()
public void setFormat(java.text.Format format)
public java.text.Format getFormat()
public void setFormatPattern(java.lang.String newPattern)
public java.lang.String getFormatPattern()
public void setValueHolder(ValueHolder newValueHolder)
public ValueHolder getValueHolder()
public void setPropertyName(java.lang.String newPropertyName)
public java.lang.String getPropertyName()
public void setDefaultValue(java.lang.String newDefaultValue)
newDefaultValue
- to be used if no input is received.public java.lang.String getDefaultValue()
public java.lang.String toString()
toString
in class Component
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |