|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.rave.web.ui.event.TableSelectPhaseListener
public class TableSelectPhaseListener
A utility class for radiobutton and checkbox components used to select rows of a table.
Note: UI guidelines recomend that rows should be unselected when no longer in view. For example, when a user selects rows of the table and navigates to another page. Or, when a user applies a filter or sort that may hide previously selected rows from view. If a user invokes an action to delete the currently selected rows, they may inadvertently remove rows not displayed on the current page. Using TableSelectPhaseListener ensures that invalid row selections are not rendered by clearing selected state after the render response phase. That said, there are cases when maintaining state across table pages is necessary. In this scenario, use the keepSelected method to prevent state from being cleared by this instance.
Note: To see the messages logged by this class, set the following global defaults in your JDK's "jre/lib/logging.properties" file.
java.util.logging.ConsoleHandler.level = FINE com.sun.rave.web.ui.event.TableSelectPhaseListener.level = FINE
Constructor Summary | |
---|---|
TableSelectPhaseListener()
Default constructor |
|
TableSelectPhaseListener(boolean keepSelected)
Construct an instance with the given flag indicating that selected objects should not be cleared after the render response phase. |
|
TableSelectPhaseListener(java.lang.Object unselected)
Construct an instance with an unselected parameter. |
Method Summary | |
---|---|
void |
afterPhase(javax.faces.event.PhaseEvent event)
Called during the JSF Lifecycle after the RENDER_RESPONSE phase. |
void |
beforePhase(javax.faces.event.PhaseEvent event)
Called during the JSF Lifecycle before the RENDER_RESPONSE phase. |
void |
clear()
Clear all selected objects. |
javax.faces.event.PhaseId |
getPhaseId()
Get the phase id. |
java.lang.Object |
getSelected(com.sun.data.provider.RowKey rowKey)
Get the selected object from this instance. |
boolean |
isKeepSelected()
Test if the flag indicating that selected objects should be cleared after the render response phase. |
boolean |
isSelected(com.sun.data.provider.RowKey rowKey)
Test if the object associated with the given RowKey is selected. |
void |
keepSelected(boolean keepSelected)
Set the flag indicating that selected objects should be cleared after the render response phase. |
void |
setSelected(com.sun.data.provider.RowKey rowKey,
java.lang.Object object)
Set the selected object for this instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableSelectPhaseListener()
public TableSelectPhaseListener(boolean keepSelected)
keepSelected
- If true, ojects are not cleared.public TableSelectPhaseListener(java.lang.Object unselected)
The unselected parameter is only required if a primitve value is being used for the selecteValue attribute of the checkbox or radiobutton. If the selectedValue property is an Object value then unselected can be null. If however it is a primitive type then it should be the MIN_VALUE constant instance of the wrapper Object type. For example if the application is assigning int values to selectedValue then unselected should be new Integer(Integer.MIN_VALUE).
unselected
- the object to return for an unselected checkbox.Method Detail |
---|
public void afterPhase(javax.faces.event.PhaseEvent event)
afterPhase
in interface javax.faces.event.PhaseListener
event
- The PhaseEvent object.public void beforePhase(javax.faces.event.PhaseEvent event)
beforePhase
in interface javax.faces.event.PhaseListener
event
- The PhaseEvent object.public javax.faces.event.PhaseId getPhaseId()
getPhaseId
in interface javax.faces.event.PhaseListener
public void clear()
public java.lang.Object getSelected(com.sun.data.provider.RowKey rowKey)
Note: Call this method from the get method that that is bound to the selected attribute.
rowKey
- The current RowKey.
public boolean isKeepSelected()
public boolean isSelected(com.sun.data.provider.RowKey rowKey)
rowKey
- The current RowKey.
public void keepSelected(boolean keepSelected)
keepSelected
- Selected objects are kept true, cleared if false.public void setSelected(com.sun.data.provider.RowKey rowKey, java.lang.Object object)
Note: Call this method from the set method that that is bound to the selected attribute.
rowKey
- The current RowKey.object
- The selected object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |