com.sas.servlet.tbeans.ipage
Class BaseIPage

com.sas.servlet.tbeans.ipage.BaseIPage
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, RenderableInterface, TransformationInterface, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable
Direct Known Subclasses:
BaseIFormElement, IForm, IMenu, IText

public abstract class BaseIPage

The base object for all IPage Transformation Beans. "IPage Bean" is the name given to a Java component which consumes data from either a model or via property sets and transforms the data into a different representation that will be streamed to a client (or other consumer).

Unlike other TransformationBeans™, the IPage Beans generate an entire JSP page for the appropriate markup language, such as WML, HDML, or HTML, rather than a code snippet. These beans will check the response object and will determine what type of content needs to be sent back to the requesting device or browser. For example, if a user accesses the JSP page from their cell phone, the IPage bean will produce either WML or HDML based on the type of browser the cell phone contained. If another user accesses the same JSP page using Internet Explorer, the IPage bean would produce HTML instead.

For More Information:

Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.

Examples for this class may be found on the Examples Site.

JSP custom tags provide an alternative to using the TransformationBeans™. Visit the Custom Tag Library Reference for additional information on these custom tags.

Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .

See Also:
Serialized Form

Field Summary
static java.lang.String HTML_PROLOG
          HTML document type declaration.
static java.lang.String WML_PROLOG
          Wireless Markup Language document type declaration.
 
Constructor Summary
BaseIPage()
          The default constructor.
 
Method Summary
 void addOption(java.lang.String optionLabel, java.lang.String optionURL)
          Adds an option with the specified label.
 int getBrowserType()
          Gets the Browser type.
 int getCacheTimeToLive()
          Gets the cache time to live for this IPage
 java.lang.String getOptionLabel()
          Returns the label of the option.
 java.lang.String getOptionURL()
          Returns the URL of the option.
 java.lang.String getTitle()
          Gets the title for the bean
 java.lang.String resolveNewLine(java.lang.String s, java.lang.String newLine)
          Replaces occurences of newLine with the appropriate newline string (<br>, or <br/>), depending on the markup language.
 void setBrowserType(int browserType)
          Sets the Browser type.
 void setCacheTimeToLive(int seconds)
          Sets the cache time to live for this IPage.
 void setId(java.lang.String value)
          Sets the id.
 void setName(java.lang.String value)
          Deprecated. Use setId method instead
 void setName(java.lang.String value, boolean replace)
          Deprecated.  
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Sets the request object.
 void setResponse(javax.servlet.http.HttpServletResponse response)
          Sets the response object.
 void setStyle(java.lang.String style)
          Overrides BaseTransformation's setStyle.
 void setStyleClass(java.lang.String styleClass)
          Overrides BaseTransformation's setStyleClass.
 void setTitle(java.lang.String value)
          Sets the title for the bean
 java.lang.String toString()
          Returns a string representation of this transformation bean.
 void write(java.io.PrintWriter out)
          Writes the transformed representation of the object, including writing the header, base, and footer.
 void writeBase(java.io.OutputStream out)
          Writes the IPage objects base.
 void writeBase(java.io.PrintWriter out)
          Writes the main base section of the IPage bean.
 void writeBase(java.io.Writer out)
          Writes the IPage objects base.
 void writeFooter(java.io.OutputStream out)
          Writes the footer.
 void writeFooter(java.io.PrintWriter out)
          Writes the footer.
 void writeFooter(java.io.Writer out)
          Writes the footer.
 void writeHeader(java.io.OutputStream out)
          Writes the header.
 void writeHeader(java.io.PrintWriter out)
          Writes the header.
 void writeHeader(java.io.Writer out)
          Writes the header.
 
Methods inherited from class com.sas.servlet.tbeans.BaseTransformation
addPropertyChangeListener, addPropertyChangeListener, cleanUpResources, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCustomAttributes, getDescription, getId, getInputTransform, getLocale, getName, getObjectData, getObjectDataProperty, getOutputTransform, getRequest, getResponse, getTagEpilog, getTagProlog, hasListeners, isCleanUpResourcesOn, isVisible, removePropertyChangeListener, removePropertyChangeListener, setCleanUpResourcesOn, setCustomAttributes, setDescription, setInputTransform, setLocale, setLocaleDependentProperties, setObjectData, setObjectDataProperty, setOutputTransform, setTagEpilog, setTagProlog, setVisible, write, write, write
 

Field Detail

WML_PROLOG

public static final java.lang.String WML_PROLOG
Wireless Markup Language document type declaration.

See Also:
Constant Field Values

HTML_PROLOG

public static final java.lang.String HTML_PROLOG
HTML document type declaration.

See Also:
Constant Field Values
Constructor Detail

BaseIPage

public BaseIPage()
The default constructor.

Method Detail

setId

public void setId(java.lang.String value)
Sets the id. The id's value should not contain any whitespace. This method will replace white space with uderscores.

Specified by:
setId in interface TransformationInterface
Overrides:
setId in class BaseTransformation
Parameters:
value - The id

setName

public void setName(java.lang.String value)
Deprecated. Use setId method instead

Sets the name. The name's value should not contain any whitespace. Makes a call to setName(value, true) which replaces whitespace.

Specified by:
setName in interface TransformationInterface
Overrides:
setName in class BaseTransformation
Parameters:
value - The name
See Also:
setId(java.lang.String)

setName

public void setName(java.lang.String value,
                    boolean replace)
Deprecated. 

Sets the name and replaces spaces and tabs if replace boolean value is true.

Parameters:
value - The name
replace - True indicates that tabs and spaces will be replaces with underscores.

setBrowserType

public void setBrowserType(int browserType)
Sets the Browser type. This is set automatically by the setRequest method and is based on information from the request's headers. Possible values are ClientInfo.WML_UP_BROWSER, ClientInfo.WML_OTHER_BROWSER, ClientInfo.HDML_BROWSER, ClientInfo.HTML_BROWSER (default)

Parameters:
browserType - The browser Type

getBrowserType

public int getBrowserType()
Gets the Browser type. Possible values are ClientInfo.WML_UP_BROWSER, ClientInfo.WML_OTHER_BROWSER, ClientInfo.HDML_BROWSER, ClientInfo.HTML_BROWSER (default)

Returns:
The Browser Type

setStyle

public void setStyle(java.lang.String style)
Overrides BaseTransformation's setStyle. Performs a noop for the IPage beans.

Overrides:
setStyle in class BaseTransformation
Parameters:
style - the style to be used

setStyleClass

public void setStyleClass(java.lang.String styleClass)
Overrides BaseTransformation's setStyleClass. Performs a noop for the IPage beans.

Overrides:
setStyleClass in class BaseTransformation
Parameters:
styleClass - the style class to be used

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request)
Sets the request object. Calls the super setRequest from BaseTransformation and sets browserType of the client.

Specified by:
setRequest in interface TransformationInterface
Overrides:
setRequest in class BaseTransformation
Parameters:
request - The request object

setResponse

public void setResponse(javax.servlet.http.HttpServletResponse response)
Sets the response object. Calls the super setResponse from BaseTransformation and sets the content type

Specified by:
setResponse in interface TransformationInterface
Overrides:
setResponse in class BaseTransformation
Parameters:
request - The request object

resolveNewLine

public java.lang.String resolveNewLine(java.lang.String s,
                                       java.lang.String newLine)
Replaces occurences of newLine with the appropriate newline string (<br>, or <br/>), depending on the markup language.

Parameters:
s - The string we search
newLine - The string we want to replace (i.e. "\n");
Returns:
The String with all occurences of newLine replaced with a line break.

writeBase

public void writeBase(java.io.Writer out)
               throws java.io.IOException
Writes the IPage objects base. This overloaded version of 'writeBase' will create a new PrintWriter using the given Writer and call the writeBase(PrintWriter) method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeBase

public void writeBase(java.io.PrintWriter out)
               throws java.io.IOException
Writes the main base section of the IPage bean. Should be overridden in subclass. The writeHeader method should be called before this method and writeFooter should be called after this method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeBase

public void writeBase(java.io.OutputStream out)
               throws java.io.IOException
Writes the IPage objects base. This overloaded version of 'writeBase' will create a new PrintWriter using the given OutputStream and call the writeBase(PrintWriter) method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeHeader

public void writeHeader(java.io.Writer out)
                 throws java.io.IOException
Writes the header. This overloaded version of 'writeHeader' will create a new PrintWriter using the given Writer and call the writeHeader(PrintWriter) method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeHeader

public void writeHeader(java.io.PrintWriter out)
                 throws java.io.IOException
Writes the header. Writes the beans prolog and additional header information.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeHeader

public void writeHeader(java.io.OutputStream out)
                 throws java.io.IOException
Writes the header. This overloaded version of 'writeHeader' will create a new PrintWriter using the given OutputStream and call the writeHeader(PrintWriter) method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeFooter

public void writeFooter(java.io.Writer out)
                 throws java.io.IOException
Writes the footer. This overloaded version of 'writeFooter' will create a new PrintWriter using the given Writer and call the writeFooter(PrintWriter) method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeFooter

public void writeFooter(java.io.PrintWriter out)
                 throws java.io.IOException
Writes the footer. Writes the beans epilog and additional footer information. This is normally the last information written.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

writeFooter

public void writeFooter(java.io.OutputStream out)
                 throws java.io.IOException
Writes the footer. This overloaded version of 'writeFooter' will create a new PrintWriter using the given OutputStream and call the writeFooter(PrintWriter) method.

Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

write

public void write(java.io.PrintWriter out)
           throws java.io.IOException

Writes the transformed representation of the object, including writing the header, base, and footer.

This method calls the cleanUpResources method at the end to reset the request and response back to null.

Specified by:
write in interface TransformationInterface
Specified by:
write in interface com.sas.util.WriteToPrintWriterInterface
Overrides:
write in class BaseTransformation
Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

toString

public java.lang.String toString()
Returns a string representation of this transformation bean. A new StringWriter will be created and the writeBase(StringWriter) method will be invoked. The contents of the StringWriter will be returned.

Overrides:
toString in class BaseTransformation
Returns:
A string representation of the object

setTitle

public void setTitle(java.lang.String value)
Sets the title for the bean

Parameters:
value - The title

getTitle

public java.lang.String getTitle()
Gets the title for the bean

Returns:
The title

setCacheTimeToLive

public void setCacheTimeToLive(int seconds)
Sets the cache time to live for this IPage. The default for HDML and WML is 2592000 (30 days).

Parameters:
value - The time to live in seconds

getCacheTimeToLive

public int getCacheTimeToLive()
Gets the cache time to live for this IPage

Returns:
The The time to live in seconds

addOption

public void addOption(java.lang.String optionLabel,
                      java.lang.String optionURL)
Adds an option with the specified label. For phones, this will be displayed as a soft key with a label specified by optionLabel and a link specified by optionURL. The URL can also be the name of a card in the current deck. For example, an IForm with a password field labeled "password" could be used as the URL by passing the element's name, "#password". An IMenu can refer can specify another URL in the same deck by using the same format, "#menuName". Elements added to an IForm and IMenu sub menus inherit this option.

Parameters:
label - The label of the option, such as a phone soft key label.
optionURL - The String for the option's URL.

getOptionLabel

public java.lang.String getOptionLabel()
Returns the label of the option.

Returns:
The String for the option's label.

getOptionURL

public java.lang.String getOptionURL()
Returns the URL of the option.

Returns:
The String for the option's URL.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.