|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.component.UIComponent
javax.faces.component.UIComponentBase
com.sun.webui.jsf.component.EventSourceImpl
com.sun.webui.jsf.component.Menu
public class Menu
This class represents a Menu component. The class inherits from thecom.sun.webui.jsf.component.WebUIInput
and implementsjavax.faces.component.ActionSource2.
. Hence, this component acts both as an editableValueHolder and an ActionSource. A Menu contains a list of selectable options. The options to be displayed can be specified using the "items" attribute of the component. Each option should be represented by acom.sun.webui.jsf.model.Option
instance. Options can also be grouped together based on some common functionality in which case, thecom.sun.webui.jsf.model.OptionGroup
should be used for specifying the options. The menu will not be visible by default, but can be shown by calling theopen
method on the popupMenu widget when any of the components on the page is clicked. This method takes an event attribute as an argument. This "event" attribute is the event that is generated when some keyboard or mouse action happens on the web page such as the "click" of a hyperlink. In this case, if the style attribtute with menu positioning is defined, the popupMenu widget will use that to position itself on the page. If not, it will use the event attribute which is passed on as argument to the popupMenu to position itself on the page. Whenever an option is clicked, you can access the selected option through the getSelectedOption interface available on the menu's dom element. This is the default behavior of the menu element. The default behavior does not have any form of communcation with the server to inform of the selected state. If a communication needs to be made to the server to inform of the selected value of the menu component then i) Use domNode.submit() :- The menu element has a submit() function set on its dom. Invoking this function will cause the menu widget to send an asynchronous request to the server and cause the menu component to update itself. The menu widget in this case, appends an attribute called value to the dynamic faces request made. Thecom.sun.webui.jsf.renderkit.ajax.MenuRenderer
will in this case look for this particular value and update itself accordingly. ii) Set the submitForm attribute to true:- This will cause the menu component to submit the form whenever an option is selected in the menu. All the elements in the form will be submitted and all the components present in the form will go through the normal JSF processing lifecycle. The Menu widget in this case will submit the value of the selected option similar to the way the hyperlink widget submits the form. It will append the selected value as a request parameter with the key being the client id of the menu appended with a "_submittedValue" suffix. NOTE:- To obtain the value of the option that was clicked in the menu widget, use the eventListenerExpression attribute and invoke the getSelectedOption method on the ValueEvent object that is passed as an argument to this method binding
Constructor Summary | |
---|---|
Menu()
Creates a new instance of Menu The constructor also sets the appropriate renderer type and instantiates the valueTypeEvaluator. |
Method Summary | |
---|---|
java.lang.String |
getFamily()
Return the family this component belongs to. |
java.lang.String |
getHtmlTemplate()
Get alternative HTML template to be used by this component. |
java.lang.Object |
getItems()
Specifies the items that the web application user can choose from. |
java.lang.String |
getOnChange()
Scripting code executed when the element value of this component is changed. |
java.lang.String |
getOnClick()
Scripting code executed when a mouse click occurs over this component.The popupMenu element has a function called getSelectedOption which can be invoked by onClick function handlers to know which option has been selected. |
java.lang.String |
getOnDblClick()
Scripting code executed when a mouse double click occurs over this component. |
java.lang.String |
getOnKeyDown()
Scripting code executed when the user presses down on a key while the component has focus. |
java.lang.String |
getOnKeyPress()
Scripting code executed when the user presses and releases a key while the component has focus. |
java.lang.String |
getOnKeyUp()
Scripting code executed when the user releases a key while the component has focus. |
java.lang.String |
getOnMouseDown()
Scripting code executed when the user presses a mouse button while the mouse pointer is on the component. |
java.lang.String |
getOnMouseMove()
Scripting code executed when the user moves the mouse pointer while over the component. |
java.lang.String |
getOnMouseOut()
Scripting code executed when a mouse out movement occurs over this component. |
java.lang.String |
getOnMouseOver()
Scripting code executed when the user moves the mouse pointer into the boundary of this component. |
java.lang.String |
getOnMouseUp()
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component. |
Option[] |
getOptionsArray()
Processes the component's SelectItems. |
java.lang.String |
getRendererType()
Return the appropriate renderer type. |
java.lang.String |
getStyle()
CSS style or styles to be applied to the outermost HTML element when this component is rendered. |
java.lang.String |
getStyleClass()
CSS style class or classes to be applied to the outermost HTML element when this component is rendered. |
boolean |
isSubmitForm()
When set to true, the form is immediately submitted when the user changes the selection in the menu. |
boolean |
isVisible()
Use to indicate whether the component should be viewable by the user in the rendered HTML page. |
void |
processDecodes(javax.faces.context.FacesContext context)
Specialized decode behavior on top of that provided by the superclass. |
void |
restoreState(javax.faces.context.FacesContext _context,
java.lang.Object _state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext _context)
Save the state of this component. |
void |
setHtmlTemplate(java.lang.String htmlTemplate)
Set alternative HTML template to be used by this component. |
void |
setId(java.lang.String id)
The component identifier for this component. |
void |
setItems(java.lang.Object items)
Specifies the items that the web application user can choose from. |
void |
setOnChange(java.lang.String onChange)
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component. |
void |
setOnClick(java.lang.String onClick)
Scripting code executed when a mouse click occurs over this component.The Menu element has a function called getSelectedOption which can be invoked by onClick function handlers to know which option has been selected. |
void |
setOnDblClick(java.lang.String onDblClick)
Scripting code executed when a mouse double click occurs over this component. |
void |
setOnKeyDown(java.lang.String onKeyDown)
Scripting code executed when the user presses down on a key while the component has focus. |
void |
setOnKeyPress(java.lang.String onKeyPress)
Scripting code executed when the user presses and releases a key while the component has focus. |
void |
setOnKeyUp(java.lang.String onKeyUp)
Scripting code executed when the user releases a key while the component has focus. |
void |
setOnMouseDown(java.lang.String onMouseDown)
Scripting code executed when the user presses a mouse button while the mouse pointer is on the component. |
void |
setOnMouseMove(java.lang.String onMouseMove)
Scripting code executed when the user moves the mouse pointer while over the component. |
void |
setOnMouseOut(java.lang.String onMouseOut)
Scripting code executed when a mouse out movement occurs over this component. |
void |
setOnMouseOver(java.lang.String onMouseOver)
Scripting code executed when the user moves the mouse pointer into the boundary of this component. |
void |
setOnMouseUp(java.lang.String onMouseUp)
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component. |
void |
setRendered(boolean rendered)
Use the rendered attribute to indicate whether the HTML code for the component should be included in the rendered HTML page. |
void |
setStyle(java.lang.String style)
CSS style or styles to be applied to the outermost HTML element when this component is rendered. |
void |
setStyleClass(java.lang.String styleClass)
CSS style class or classes to be applied to the outermost HTML element when this component is rendered. |
void |
setSubmitForm(boolean submitForm)
When set to true, the form is immediately submitted when the user changes the selection in the menu. |
void |
setVisible(boolean visible)
Use to indicate whether the component should be viewable by the user in the rendered HTML page. |
Methods inherited from class com.sun.webui.jsf.component.EventSourceImpl |
---|
addEventListener, broadcast, getEventExpression, getEventListenerExpression, getEventListeners, getPhaseId, isImmediate, processEventExpression, queueEvent, removeEventListener, setEventExpression, setEventListenerExpression, setImmediate, setPhaseId |
Methods inherited from class javax.faces.component.UIComponentBase |
---|
decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendersChildren, getValueBinding, getValueExpression, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, processUpdates, processValidators, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, setValueBinding, setValueExpression |
Methods inherited from class javax.faces.component.UIComponent |
---|
encodeAll, getContainerClientId |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Menu()
Method Detail |
---|
public java.lang.String getFamily()
getFamily
in class javax.faces.component.UIComponent
public java.lang.String getRendererType()
getRendererType
in class javax.faces.component.UIComponentBase
public void setId(java.lang.String id)
setId
in class javax.faces.component.UIComponentBase
public void setRendered(boolean rendered)
setRendered
in class javax.faces.component.UIComponentBase
public java.lang.String getHtmlTemplate()
Get alternative HTML template to be used by this component.
public void setHtmlTemplate(java.lang.String htmlTemplate)
Set alternative HTML template to be used by this component.
public java.lang.String getStyle()
CSS style or styles to be applied to the outermost HTML element when this component is rendered.
public void setStyle(java.lang.String style)
CSS style or styles to be applied to the outermost HTML element when this component is rendered.
getStyle()
public java.lang.String getStyleClass()
CSS style class or classes to be applied to the outermost HTML element when this component is rendered.
public void setStyleClass(java.lang.String styleClass)
CSS style class or classes to be applied to the outermost HTML element when this component is rendered.
getStyleClass()
public boolean isVisible()
Use to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default,this setting is false, so HTML for the component HTML is rendered but the menu is not visible to user. Note that, even If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.
public void setVisible(boolean visible)
Use to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default,this setting is false, so HTML for the component HTML is rendered but the menu is not visible to user. Note that, even If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.
isVisible()
public java.lang.String getOnClick()
Scripting code executed when a mouse click occurs over this component.The popupMenu element has a function called getSelectedOption which can be invoked by onClick function handlers to know which option has been selected. This will return the name of the option that was clicked.
public void setOnClick(java.lang.String onClick)
Scripting code executed when a mouse click occurs over this component.The Menu element has a function called getSelectedOption which can be invoked by onClick function handlers to know which option has been selected. This will return the name of the option that was clicked.
getOnClick()
public java.lang.String getOnDblClick()
Scripting code executed when a mouse double click occurs over this component.
public void setOnDblClick(java.lang.String onDblClick)
Scripting code executed when a mouse double click occurs over this component.
getOnDblClick()
public java.lang.String getOnKeyDown()
Scripting code executed when the user presses down on a key while the component has focus.
public void setOnKeyDown(java.lang.String onKeyDown)
Scripting code executed when the user presses down on a key while the component has focus.
getOnKeyDown()
public java.lang.String getOnKeyPress()
Scripting code executed when the user presses and releases a key while the component has focus.
public void setOnKeyPress(java.lang.String onKeyPress)
Scripting code executed when the user presses and releases a key while the component has focus.
getOnKeyPress()
public java.lang.String getOnKeyUp()
Scripting code executed when the user releases a key while the component has focus.
public void setOnKeyUp(java.lang.String onKeyUp)
Scripting code executed when the user releases a key while the component has focus.
getOnKeyUp()
public java.lang.String getOnMouseDown()
Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
public void setOnMouseDown(java.lang.String onMouseDown)
Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
getOnMouseDown()
public java.lang.String getOnMouseMove()
Scripting code executed when the user moves the mouse pointer while over the component.
public void setOnMouseMove(java.lang.String onMouseMove)
Scripting code executed when the user moves the mouse pointer while over the component.
getOnMouseMove()
public java.lang.String getOnMouseOut()
Scripting code executed when a mouse out movement occurs over this component.
public void setOnMouseOut(java.lang.String onMouseOut)
Scripting code executed when a mouse out movement occurs over this component.
getOnMouseOut()
public java.lang.String getOnMouseOver()
Scripting code executed when the user moves the mouse pointer into the boundary of this component.
public void setOnMouseOver(java.lang.String onMouseOver)
Scripting code executed when the user moves the mouse pointer into the boundary of this component.
getOnMouseOver()
public java.lang.String getOnMouseUp()
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
public void setOnMouseUp(java.lang.String onMouseUp)
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
getOnMouseUp()
public java.lang.Object getItems()
Specifies the items that the web application user can choose
from. The value must be one of an array, Map or Collection
whose members are all subclasses ofcom.sun.webui.jsf.model.Option
.
public void setItems(java.lang.Object items)
Specifies the items that the web application user can choose
from. The value must be one of an array, Map or Collection
whose members are all subclasses ofcom.sun.webui.jsf.model.Option
.
getItems()
public java.lang.String getOnChange()
Scripting code executed when the element value of this component is changed.
public void setOnChange(java.lang.String onChange)
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
getOnMouseUp()
public boolean isSubmitForm()
When set to true, the form is immediately submitted when the user changes the selection in the menu.
public void setSubmitForm(boolean submitForm)
When set to true, the form is immediately submitted when the user changes the selection in the menu.
public void processDecodes(javax.faces.context.FacesContext context)
Specialized decode behavior on top of that provided by the superclass.
processDecodes
in class javax.faces.component.UIComponentBase
context
- FacesContext
for this request.public Option[] getOptionsArray()
public void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
restoreState
in interface javax.faces.component.StateHolder
restoreState
in class EventSourceImpl
public java.lang.Object saveState(javax.faces.context.FacesContext _context)
Save the state of this component.
saveState
in interface javax.faces.component.StateHolder
saveState
in class EventSourceImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |