com.ivata.mask.web.field.valueobject
Class ValueObjectFieldWriter

java.lang.Object
  extended bycom.ivata.mask.web.field.valueobject.ValueObjectFieldWriter
All Implemented Interfaces:
FieldWriter

public class ValueObjectFieldWriter
extends java.lang.Object
implements FieldWriter

This writer is used to display links to other value objects.

Since:
ivata masks 0.2 (2004-05-14)
Version:
$Revision: 1.8 $
Author:
Colin MacLeod colin.macleod@ivata.com

Field Summary
static java.lang.String CSS_COMBO
           This is the style class used for combo (single choice) lists.
static java.lang.String CSS_LIST
           This is the style class used for multiple choice lists.
static java.lang.String DEFAULT_DISPLAY_VALUE
           This is the value which is output as a default.
static java.lang.String DEFAULT_VALUE
           This is the value which is output as a default.
static java.lang.String NEW_DISPLAY_VALUE
           This is the value which is output as a new entry.
 
Constructor Summary
ValueObjectFieldWriter(com.ivata.mask.field.Field fieldParam, java.lang.String actionPageParam, java.util.Collection allValueObjectsParam, HTMLFormatter formatterParam, int listHeightParam, boolean multipleParam)
           Construct a field writer.
 
Method Summary
protected  java.util.Collection getAllValueObjects()
          All possible value objects to display in a list - for a choice.
protected  AttributesWriter getAttributesWriter()
           Access the attributes writer, which is responsible for converting the field attributes into text.
protected  com.ivata.mask.field.Field getField()
           Access the field to be displayed.
protected  HTMLFormatter getFormatter()
          Used to format the displayed, usually ensuring line breaks are converted into HTML.
 void removeAttribute(java.lang.String name)
          Refer to FieldWriter#clearAttribute.
 void setAttribute(java.lang.String name, java.lang.String value)
          Refer to FieldWriter.setAttribute(java.lang.String, java.lang.String).
 java.lang.String write(javax.servlet.jsp.PageContext pageContextParam, com.ivata.mask.valueobject.ValueObject valueObjectParam, boolean displayOnlyParam)
          Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).
 java.lang.String writeChoiceField(javax.servlet.jsp.PageContext pageContextParam, java.util.Collection valuesParam)
          Display a field (which is not read-only).
 java.lang.String writeDisplayOnly(javax.servlet.jsp.PageContext pageContextParam, java.util.Collection valuesParam)
          Display the correct field value from the value object - for a read-only field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSS_COMBO

public static final java.lang.String CSS_COMBO

This is the style class used for combo (single choice) lists.

See Also:
Constant Field Values

CSS_LIST

public static final java.lang.String CSS_LIST

This is the style class used for multiple choice lists.

See Also:
Constant Field Values

DEFAULT_DISPLAY_VALUE

public static final java.lang.String DEFAULT_DISPLAY_VALUE

This is the value which is output as a default. TODO: i18n

See Also:
Constant Field Values

DEFAULT_VALUE

public static final java.lang.String DEFAULT_VALUE

This is the value which is output as a default. TODO: i18n

See Also:
Constant Field Values

NEW_DISPLAY_VALUE

public static final java.lang.String NEW_DISPLAY_VALUE

This is the value which is output as a new entry. TODO: i18n

See Also:
Constant Field Values
Constructor Detail

ValueObjectFieldWriter

public ValueObjectFieldWriter(com.ivata.mask.field.Field fieldParam,
                              java.lang.String actionPageParam,
                              java.util.Collection allValueObjectsParam,
                              HTMLFormatter formatterParam,
                              int listHeightParam,
                              boolean multipleParam)

Construct a field writer.

Parameters:
fieldParam - defines the field to be displayed.
actionPageParam - Refer to DefaultFieldWriter#getActionPage.
allValueObjectsParam - Refer to getAllValueObjects().
formatterParam - Refer to getFormatter().
listHeightParam - set as the size attribute in the field.
multipleParam - if true, then the user can make more than one selection.
Method Detail

getAllValueObjects

protected final java.util.Collection getAllValueObjects()
All possible value objects to display in a list - for a choice. The user will be given the chance to choose from only these values.

Returns:
Returns the all value objects as a Collection of ValueObject instances.

getAttributesWriter

protected final AttributesWriter getAttributesWriter()

Access the attributes writer, which is responsible for converting the field attributes into text.

Returns:
attributes writer.

getField

protected final com.ivata.mask.field.Field getField()

Access the field to be displayed.

Returns:
field to be displayed.

getFormatter

protected final HTMLFormatter getFormatter()
Used to format the displayed, usually ensuring line breaks are converted into HTML.

Returns:
Returns the formatter.

removeAttribute

public void removeAttribute(java.lang.String name)
Refer to FieldWriter#clearAttribute.

Specified by:
removeAttribute in interface FieldWriter
Parameters:
name - Refer to FieldWriter#clearAttribute.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Refer to FieldWriter.setAttribute(java.lang.String, java.lang.String).

Specified by:
setAttribute in interface FieldWriter
Parameters:
name - Refer to FieldWriter.setAttribute(java.lang.String, java.lang.String).
value - Refer to FieldWriter.setAttribute(java.lang.String, java.lang.String).

write

public final java.lang.String write(javax.servlet.jsp.PageContext pageContextParam,
                                    com.ivata.mask.valueobject.ValueObject valueObjectParam,
                                    boolean displayOnlyParam)
Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).

Specified by:
write in interface FieldWriter
Parameters:
pageContextParam - Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).
valueObjectParam - Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).
displayOnlyParam - Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).
Returns:
Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).

writeChoiceField

public final java.lang.String writeChoiceField(javax.servlet.jsp.PageContext pageContextParam,
                                               java.util.Collection valuesParam)
Display a field (which is not read-only).

Parameters:
pageContextParam - Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).
valuesParam - contains all the possible values as strings.
Returns:
string representing the combo box.

writeDisplayOnly

public final java.lang.String writeDisplayOnly(javax.servlet.jsp.PageContext pageContextParam,
                                               java.util.Collection valuesParam)
Display the correct field value from the value object - for a read-only field.

Parameters:
pageContextParam - Refer to FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean).
valuesParam - Refer to writeChoiceField(javax.servlet.jsp.PageContext, java.util.Collection).
Returns:
Refer to writeChoiceField(javax.servlet.jsp.PageContext, java.util.Collection).
See Also:
FieldWriter.write(javax.servlet.jsp.PageContext, com.ivata.mask.valueobject.ValueObject, boolean)


Copyright © 2001-2005 ivata limited. All Rights Reserved.