com.sun.slamd.parameter
Class MultiLineTextParameter

java.lang.Object
  extended bycom.sun.slamd.parameter.Parameter
      extended bycom.sun.slamd.parameter.MultiLineTextParameter
All Implemented Interfaces:
java.lang.Cloneable

public class MultiLineTextParameter
extends Parameter

This class defines a parameter that may contain multiple lines of text. Each line may be treated as an individual string.


Field Summary
 
Fields inherited from class com.sun.slamd.parameter.Parameter
description, displayName, isRequired, name, value
 
Constructor Summary
MultiLineTextParameter()
          Creates a new instance of the Parameter to be used when decoding values transported over the network, and should not be used by jobs to create parameters.
MultiLineTextParameter(java.lang.String name)
          Creates a new multi-line text parameter with the specified name.
MultiLineTextParameter(java.lang.String name, boolean isRequired)
          Creates a new multi-line text parameter with the specified name and required/optional indicator.
MultiLineTextParameter(java.lang.String name, java.lang.String displayName)
          Creates a new multi-line parameter with the specified name and display name.
MultiLineTextParameter(java.lang.String name, java.lang.String[] lines)
          Creates a new multi-line text parameter with the specified name and set of lines.
MultiLineTextParameter(java.lang.String name, java.lang.String[] lines, boolean isRequired)
          Creates a new multi-line text parameter with the specified name, set of lines, and required/optional indicator.
MultiLineTextParameter(java.lang.String name, java.lang.String displayName, boolean isRequired)
          Creates a new multi-line parameter with the specified name, display name, and required/optional indicator.
MultiLineTextParameter(java.lang.String name, java.lang.String displayName, java.lang.String[] lines)
          Creates a new multi-line parameter with the specified name, display name, and set of lines.
MultiLineTextParameter(java.lang.String name, java.lang.String displayName, java.lang.String[] lines, boolean isRequired)
          Creates a new multi-line parameter with the specified name, display name, set of lines, and required/optional indicator.
MultiLineTextParameter(java.lang.String name, java.lang.String displayName, java.lang.String description, java.lang.String[] lines)
          Creates a new multi-line parameter with the specified name, display name, description, and set of lines.
MultiLineTextParameter(java.lang.String name, java.lang.String displayName, java.lang.String description, java.lang.String[] lines, boolean isRequired)
          Creates a new multi-line parameter with the specified name, display name, description, set of lines, and required/optional indicator.
 
Method Summary
static java.lang.String[] breakString(java.lang.String multilineText)
          Breaks up a single string containing line breaks into an array of strings separated into lines.
 java.lang.Object clone()
          Creates a clone of this parameter.
 java.lang.String getDisplayValue()
          Retrieves the value in a form that may be displayed to the end user.
 java.lang.String getHTMLDisplayValue()
          Retrieves the value in a form that may be displayed to the end user as part of an HTML document.
 java.lang.String getHTMLInputForm(java.lang.String prefix)
          Retrieves a string of text that can be used to request a value for this parameter using an HTML form.
 java.lang.String getInvalidReason(java.lang.Object value)
          Retrieves the reason that the specified value is not valid.
 java.lang.String[] getLines()
          Retrieves the set of lines associated with this parameter.
 java.lang.String[] getNonBlankLines()
          Retrieves the set of non-blank lines associated with this parameter.
 java.lang.Object getValue()
          Retrieves the value for this parameter.
 java.lang.String getValueString()
          Retrieves the value of this parameter as a single string (containing line breaks).
 int getVisibleColumns()
          Retrieves the number of columns that will be visible when setting the value through the HTML interface.
 int getVisibleRows()
          Retrieves the number of rows that will be visible when setting the value through the HTML interface.
 void htmlInputFormToValue(java.lang.String[] values)
          Specifies the value of this parameter based on the provided text that would be returned from posting an HTML form.
 void setValue(java.lang.Object value)
          Specifies the value to use for this parameter.
 void setValueFrom(Parameter parameter)
          Sets the value for this parameter from the information in the provided parameter.
 void setValueFromString(java.lang.String valueString)
          Specifies the value to use for this parameter from the provided String.
 void setVisibleColumns(int visibleColumns)
          Specifies the number of columns that will be visible when setting the value through the HTML interface.
 void setVisibleRows(int visibleRows)
          Specifies the number of rows that will be visible when setting the value through the HTML interface.
 
Methods inherited from class com.sun.slamd.parameter.Parameter
decode, encode, getDescription, getDisplayName, getHTMLPostValue, getInvalidReason, getName, hasValue, isRequired, isValid, isValid, setDescription, setDisplayName, setName, setRequired, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiLineTextParameter

public MultiLineTextParameter()
Creates a new instance of the Parameter to be used when decoding values transported over the network, and should not be used by jobs to create parameters. If any initialization is needed that will not be covered by calls to the setName, setDisplayName, setDescription, or setValueFromString, then it should be done here.


MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name)
Creates a new multi-line text parameter with the specified name. The display name will be the same as the name, it will not have a description or set of lines, and it will not be required.

Parameters:
name - The name to use for this parameter.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              boolean isRequired)
Creates a new multi-line text parameter with the specified name and required/optional indicator. The display name will be the same as the name, and it will not have a description or set of lines.

Parameters:
name - The name to use for this parameter.
isRequired - Indicates whether this parameter is required to have a value.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String[] lines)
Creates a new multi-line text parameter with the specified name and set of lines. The display name will be the same as the name, it will not have a description, and it will not be required.

Parameters:
name - The name to use for this parameter.
lines - The set of lines associated with this parameter.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String[] lines,
                              boolean isRequired)
Creates a new multi-line text parameter with the specified name, set of lines, and required/optional indicator. The display name will be the same as the name and it will not have a description.

Parameters:
name - The name to use for this parameter.
lines - The set of lines associated with this parameter.
isRequired - Indicates whether this parameter is required to have a value.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String displayName)
Creates a new multi-line parameter with the specified name and display name. It will not have a description or set of lines, and it will not be required.

Parameters:
name - The name to use for this parameter.
displayName - The display name to use for this parameter.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String displayName,
                              boolean isRequired)
Creates a new multi-line parameter with the specified name, display name, and required/optional indicator. It will not have a description or set of lines.

Parameters:
name - The name to use for this parameter.
displayName - The display name to use for this parameter.
isRequired - Indicates whether this parameter is required to have a value.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String displayName,
                              java.lang.String[] lines)
Creates a new multi-line parameter with the specified name, display name, and set of lines. It will not have a description, and it will not be required.

Parameters:
name - The name to use for this parameter.
displayName - The display name to use for this parameter.
lines - The set of lines associated with this parameter.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String displayName,
                              java.lang.String[] lines,
                              boolean isRequired)
Creates a new multi-line parameter with the specified name, display name, set of lines, and required/optional indicator. It will not have a description.

Parameters:
name - The name to use for this parameter.
displayName - The display name to use for this parameter.
lines - The set of lines associated with this parameter.
isRequired - Indicates whether this parameter is required to have a value.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String displayName,
                              java.lang.String description,
                              java.lang.String[] lines)
Creates a new multi-line parameter with the specified name, display name, description, and set of lines. It will not be required.

Parameters:
name - The name to use for this parameter.
displayName - The display name to use for this parameter.
description - The description to use for this parameter.
lines - The set of lines associated with this parameter.

MultiLineTextParameter

public MultiLineTextParameter(java.lang.String name,
                              java.lang.String displayName,
                              java.lang.String description,
                              java.lang.String[] lines,
                              boolean isRequired)
Creates a new multi-line parameter with the specified name, display name, description, set of lines, and required/optional indicator.

Parameters:
name - The name to use for this parameter.
displayName - The display name to use for this parameter.
description - The description to use for this parameter.
lines - The set of lines associated with this parameter.
isRequired - Indicates whether this parameter is required to have a value.
Method Detail

getLines

public java.lang.String[] getLines()
Retrieves the set of lines associated with this parameter.

Returns:
The set of lines associated with this parameter.

getNonBlankLines

public java.lang.String[] getNonBlankLines()
Retrieves the set of non-blank lines associated with this parameter.

Returns:
The set of non-blank lines associated with this parameter.

breakString

public static java.lang.String[] breakString(java.lang.String multilineText)
Breaks up a single string containing line breaks into an array of strings separated into lines.

Parameters:
multilineText - The text to be broken up by line.
Returns:
An array of strings representing the lines in the text provided.

getValue

public java.lang.Object getValue()
Retrieves the value for this parameter.

Overrides:
getValue in class Parameter
Returns:
The value for this parameter.

setValue

public void setValue(java.lang.Object value)
              throws InvalidValueException
Specifies the value to use for this parameter. The provided value must either be an array of strings or a single string with line breaks.

Overrides:
setValue in class Parameter
Parameters:
value - The value to use for this parameter.
Throws:
InvalidValueException - If the provided value is of an invalid type or if there is no value and the parameter is required.

setValueFrom

public void setValueFrom(Parameter parameter)
Sets the value for this parameter from the information in the provided parameter. Note that the provided parameter must be of the same type as this parameter or no action will be taken.

Specified by:
setValueFrom in class Parameter
Parameters:
parameter - The parameter from which to take the value for this parameter.

getVisibleRows

public int getVisibleRows()
Retrieves the number of rows that will be visible when setting the value through the HTML interface.

Returns:
The number of rows that will be visible when setting the value through the HTML interface.

setVisibleRows

public void setVisibleRows(int visibleRows)
Specifies the number of rows that will be visible when setting the value through the HTML interface.

Parameters:
visibleRows - The number of rows that will be visible when setting the value through the HTML interface.

getVisibleColumns

public int getVisibleColumns()
Retrieves the number of columns that will be visible when setting the value through the HTML interface.

Returns:
The number of columns that will be visible when setting the value through the HTML interface.

setVisibleColumns

public void setVisibleColumns(int visibleColumns)
Specifies the number of columns that will be visible when setting the value through the HTML interface.

Parameters:
visibleColumns - The number of columns that will be visible when setting the value through the HTML interface.

getValueString

public java.lang.String getValueString()
Retrieves the value of this parameter as a single string (containing line breaks).

Specified by:
getValueString in class Parameter
Returns:
The value of this parameter as a single string.

setValueFromString

public void setValueFromString(java.lang.String valueString)
                        throws InvalidValueException
Specifies the value to use for this parameter from the provided String. Note that no validation is performed with this method.

Specified by:
setValueFromString in class Parameter
Parameters:
valueString - The string representation of the value to use for this parameter.
Throws:
InvalidValueException - If the provided value cannot be used to provide a value for this parameter.

getInvalidReason

public java.lang.String getInvalidReason(java.lang.Object value)
Retrieves the reason that the specified value is not valid.

Specified by:
getInvalidReason in class Parameter
Parameters:
value - The value for which to make the determination.
Returns:
The reason that the value is not valid, or null if it is valid.

getDisplayValue

public java.lang.String getDisplayValue()
Retrieves the value in a form that may be displayed to the end user.

Specified by:
getDisplayValue in class Parameter
Returns:
The value in a form that may be displayed to the end user.

getHTMLDisplayValue

public java.lang.String getHTMLDisplayValue()
Retrieves the value in a form that may be displayed to the end user as part of an HTML document.

Overrides:
getHTMLDisplayValue in class Parameter
Returns:
The value in a form that may be displayed to the end user as part of an HTML document.

getHTMLInputForm

public java.lang.String getHTMLInputForm(java.lang.String prefix)
Retrieves a string of text that can be used to request a value for this parameter using an HTML form. Note that this should just be for the input field itself and should not use the display name or have any special marker to indicate whether the value is required or not, as those are to be added by whatever is generating the HTML page.

Specified by:
getHTMLInputForm in class Parameter
Parameters:
prefix - The prefix that should be placed in front of the parameter name as the name of the form element.
Returns:
A string of text that can be used to request a value for this parameter using an HTML form.

htmlInputFormToValue

public void htmlInputFormToValue(java.lang.String[] values)
                          throws InvalidValueException
Specifies the value of this parameter based on the provided text that would be returned from posting an HTML form.

Specified by:
htmlInputFormToValue in class Parameter
Parameters:
values - The set of values for this parameter contained in the servlet request.
Throws:
InvalidValueException - If the specified value is not acceptable for this parameter.

clone

public java.lang.Object clone()
Creates a clone of this parameter.

Specified by:
clone in class Parameter
Returns:
A clone of this parameter.