com.sas.servlet.tbeans.ipage
Class IMenu

com.sas.servlet.tbeans.ipage.IMenu
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, RenderableInterface, TransformationInterface, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable

public class IMenu

The IMenu is a TransformationBean™ used to produce a menu using a variety of markup languages (including WML,HDML, and HTML). This class will produce the appropriate markup language based on the requesting browser. For example, if a user accesses a JSP page containing an IMenu from their cell phone, the IMenu 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 IMenu bean would produce HTML instead.

Note that the toString() method on this class calls the write method, which may have undesirable side effects. See BaseTransformation.toString() for more information. Debuggers often use toString() to show the value of a variable, and this may cause unexpected behavior while debugging

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 the sas:IMenu custom tag.

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 int DEFAULT_MAX_ITEMS
          Default maximum number of menu items.
static java.lang.String DEFAULT_MENU_MARKER
          Default menu marker.
static java.lang.String MORE_MENU_NAME
          Name of the "more" sub menu.
 
Fields inherited from class com.sas.servlet.tbeans.ipage.BaseIPage
HTML_PROLOG, WML_PROLOG
 
Constructor Summary
IMenu()
          Construct a new Menu
IMenu(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Construct a new Menu
IMenu(java.lang.String name, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Construct a new Menu
 
Method Summary
 int getEndIndex()
          Gets the end index of the menu to be written.
 int getMaxItemsDisplayed()
          Gets the maximum number of items displayed in the menu
 javax.swing.ListModel getModel()
          Gets the model on the IMenu object.
 java.lang.String getMoreLabel()
          Gets the moreLabel for the "More ..." last item in the menu
 java.lang.String getMoreURL()
          Gets the moreURL for the "More ..." last item in the menu
 java.lang.String getPostMenuText()
          Gets the text be displayed after the menu
 java.lang.String getPreMenuText()
          Gets the text be displayed before the menu
 int getStartIndex()
          Gets the start index of the menu to be written.
 java.lang.String getURLFormat()
          Gets the URL format for a menu
 javax.swing.ListModel getURLModel()
          Gets the model to be used for the URL's of the menu items (destinations).
 void setEndIndex(int value)
          Sets the end index of the menu to be written.
 void setMaxItemsDisplayed(int value)
          Sets the maximum number of menu items that the menu will display at a time (for WML and HDML output only).
 void setModel(javax.swing.ListModel model)
          Sets the model on the IMenu object.
 void setMoreLabel(java.lang.String moreLabel)
          Sets the moreLabel for the last item in the menu.
 void setMoreURL(java.lang.String value)
          Sets the moreURL for the "More ..." last item in the menu.
 void setPostMenuText(java.lang.String value)
          Sets the text be displayed after the menu
 void setPreMenuText(java.lang.String value)
          Sets the text to be displayed before the menu
 void setStartIndex(int value)
          Sets the start index of the menu to be written.
 void setURLFormat(java.lang.String format)
          Sets the URL format for a menu.
 void setURLModel(javax.swing.ListModel URLModel)
          Sets the URL model for the menu.
 void writeBase(java.io.PrintWriter out)
          Writes the IMenu base in the appropriate markup language.
 
Methods inherited from class com.sas.servlet.tbeans.ipage.BaseIPage
addOption, getBrowserType, getCacheTimeToLive, getOptionLabel, getOptionURL, getTitle, resolveNewLine, setBrowserType, setCacheTimeToLive, setId, setName, setName, setRequest, setResponse, setStyle, setStyleClass, setTitle, toString, write, writeBase, writeBase, writeFooter, writeFooter, writeFooter, writeHeader, writeHeader, writeHeader
 
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

MORE_MENU_NAME

public static final java.lang.String MORE_MENU_NAME
Name of the "more" sub menu.

See Also:
Constant Field Values

DEFAULT_MENU_MARKER

public static final java.lang.String DEFAULT_MENU_MARKER
Default menu marker. Used in replacing Strings from the model.

See Also:
Constant Field Values

DEFAULT_MAX_ITEMS

public static final int DEFAULT_MAX_ITEMS
Default maximum number of menu items.

See Also:
Constant Field Values
Constructor Detail

IMenu

public IMenu()
Construct a new Menu


IMenu

public IMenu(javax.servlet.http.HttpServletRequest request,
             javax.servlet.http.HttpServletResponse response)
Construct a new Menu

Parameters:
request - The request object
response - The response object

IMenu

public IMenu(java.lang.String name,
             javax.servlet.http.HttpServletRequest request,
             javax.servlet.http.HttpServletResponse response)
Construct a new Menu

Parameters:
name - The name
request - The request object
response - The response object
Method Detail

setModel

public void setModel(javax.swing.ListModel model)
Sets the model on the IMenu object. Models must implement javax.swing.ListModel in order to be used by this transformation bean

Parameters:
model - The model to be passed in to the IMenu

getModel

public javax.swing.ListModel getModel()
Gets the model on the IMenu object.

Returns:
A model which implements javax.swing.ListModel.

setURLModel

public void setURLModel(javax.swing.ListModel URLModel)
Sets the URL model for the menu. The URL model is used as the destination of the corresponding menu item picked.

Parameters:
model - The collection to use for the URL model

getURLModel

public javax.swing.ListModel getURLModel()
Gets the model to be used for the URL's of the menu items (destinations).

Returns:
The collection to use for the URLModel

setPreMenuText

public void setPreMenuText(java.lang.String value)
Sets the text to be displayed before the menu

Parameters:
value - The string to set

setPostMenuText

public void setPostMenuText(java.lang.String value)
Sets the text be displayed after the menu

Parameters:
value - The string to set

getPreMenuText

public java.lang.String getPreMenuText()
Gets the text be displayed before the menu

Returns:
The pre-menu text

getPostMenuText

public java.lang.String getPostMenuText()
Gets the text be displayed after the menu

Returns:
The post-menu text

setStartIndex

public void setStartIndex(int value)
Sets the start index of the menu to be written. The default is 0 (first item)

Parameters:
value - The int start index

getStartIndex

public int getStartIndex()
Gets the start index of the menu to be written. The default is 0 (first item). setStartIndex and setEndIndex can be called to write out a section of the menu.

Returns:
The int start index

setEndIndex

public void setEndIndex(int value)
Sets the end index of the menu to be written. The default is -1 (last item) setStartIndex and setEndIndex can be called to write out a section of the menu.

Parameters:
value - The int end index

getEndIndex

public int getEndIndex()
Gets the end index of the menu to be written. The default is -1 (last item)

Returns:
The int end index

setMoreURL

public void setMoreURL(java.lang.String value)
Sets the moreURL for the "More ..." last item in the menu. The default value is null. If setMoreURL is called then the last item in the menu is a "More" item which has the URL specified by value in this method.

Parameters:
value - The URL String to be set

getMoreURL

public java.lang.String getMoreURL()
Gets the moreURL for the "More ..." last item in the menu

Returns:
The URL String

setMoreLabel

public void setMoreLabel(java.lang.String moreLabel)
Sets the moreLabel for the last item in the menu. The default value in English is "More ...".

Parameters:
moreLabel - The Label String to be set

getMoreLabel

public java.lang.String getMoreLabel()
Gets the moreLabel for the "More ..." last item in the menu

Returns:
The moreLabel String

setMaxItemsDisplayed

public void setMaxItemsDisplayed(int value)
Sets the maximum number of menu items that the menu will display at a time (for WML and HDML output only). If there are more than max items in the menu, then a link menu item will be created to a sub-menu which contains the other items(for WML and HDML output only). This number does not include the more item, if present.

Parameters:
value - The number of items

getMaxItemsDisplayed

public int getMaxItemsDisplayed()
Gets the maximum number of items displayed in the menu

Returns:
The max items

setURLFormat

public void setURLFormat(java.lang.String format)
Sets the URL format for a menu. When this format is set, this URL String is used for every menu item. The String DEFAULT_MENU_MARKER is replaced with the corresponding values from the model.

Parameters:
format - The URLFormat String

getURLFormat

public java.lang.String getURLFormat()
Gets the URL format for a menu

Returns:
The String format

writeBase

public void writeBase(java.io.PrintWriter out)
               throws java.io.IOException
Writes the IMenu base in the appropriate markup language.

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



Copyright © 2009 SAS Institute Inc. All Rights Reserved.