public class ListRhnSetHelper extends ListHelper
It is important to note that the exact set specified at instantiation may not be where
the items selected in the page are stored. For more information, see
setup(RhnSetDecl)
and
the Spacewalk wiki.
If the user selected items should be stored in a session rather than the database,
use ListSessionSetHelper
instead.
ListSessionSetHelper
DATA_SET, LIST
Constructor and Description |
---|
ListRhnSetHelper(Listable inp,
javax.servlet.http.HttpServletRequest request,
RhnSetDecl declIn)
Creates a new
ListRhnSetHelper that will store its selected items
in an RhnSet retrieved from the given RhnSetDecl . |
ListRhnSetHelper(Listable inp,
javax.servlet.http.HttpServletRequest request,
RhnSetDecl declIn,
java.util.Map params)
Creates a new
ListRhnSetHelper that will store its selected items
in a custom RhnSet determined by the given RhnSetDecl
plus the parameters in params |
Modifier and Type | Method and Description |
---|---|
protected void |
add(java.util.Set c)
Add elements to a set.
|
protected void |
clear()
clear the set
|
void |
destroy()
Obliterates the set from Session or Database
|
void |
execute()
Setup the appropriate data bindings.
|
protected void |
execute(java.util.List dataSet)
Perform the execute step of the helpers
basicall handles the selectall updateset etc..
|
java.util.Collection |
getAddedKeys()
Returns a list of items that were added
to the initial set
|
java.lang.String |
getDecl()
gets the declaration associated to this set
|
protected java.util.Set |
getPreSelected() |
java.util.Collection |
getRemovedKeys()
Returns a list of items that were removed
from the initial set (basically list of unselected items)
|
protected java.util.Map |
getSelections()
returns the selections map.
|
RhnSet |
getSet()
Returns the actual
RhnSet that was used to persist the user
selected items. |
void |
ignoreEmptySelection()
Asks the helper to ignore reporting
errors if no checkbox was selected
and the dispatch action was pressed.
|
boolean |
isDispatched() |
protected boolean |
isParentAnElement() |
boolean |
isPreSelectAll() |
boolean |
isWillClearSet() |
static java.lang.String |
makeSelectionsName(java.lang.String listName)
Returns the name of the selections key.
|
void |
preSelect(java.util.Set set) |
void |
resync(javax.servlet.http.HttpServletRequest request)
resync the selected objects in case you have added anything to set after
it was executed
|
void |
setPreSelectAll(boolean preSelectAllIn) |
void |
setWillClearSet(boolean willClearSetIn)
If set to true the associated set will be cleared when setting up the page
For something like SystemSetManager we don't want this, so set this to false.
|
protected int |
size()
return the size of the set
|
protected void |
syncSelections(java.util.List dataSet)
sync the selections of rhn or session set to dataset.
|
protected void |
update()
Update the set getting data
from List, basically perform
the RhnListSetHelper.updateSet
|
getContext, getDataSet, getDataSetName, getListable, getListName, getParamMap, getParentUrl, getUniqueName, setDataSetName, setListName, setParamMap, setParentUrl
public ListRhnSetHelper(Listable inp, javax.servlet.http.HttpServletRequest request, RhnSetDecl declIn, java.util.Map params)
ListRhnSetHelper
that will store its selected items
in a custom RhnSet
determined by the given RhnSetDecl
plus the parameters in params
Using a combination of the RhnSetDecl
and parameters helps to scope
this instance for a dynamic page. For instance, if the page is scoped to a particular
channel, having the channel ID in this parameter map will allow the user to work
with in the same section of two different channels without the selections in each
list interfering with each other.
inp
- the listablerequest
- the servlet requestdeclIn
- declarationparams
- the parameter map for this requestpublic ListRhnSetHelper(Listable inp, javax.servlet.http.HttpServletRequest request, RhnSetDecl declIn)
ListRhnSetHelper
that will store its selected items
in an RhnSet
retrieved from the given RhnSetDecl
. Care
should be taken in using this call to ensure there will only be one set of data
in this list at a time (see
ListRhnSetHelper(Listable, HttpServletRequest, RhnSetDecl, Map)
for a
use case in which this constructor would not be applicable).inp
- the listablerequest
- the servlet requestdeclIn
- declarationpublic RhnSet getSet()
RhnSet
that was used to persist the user
selected items.null
public void destroy()
public java.lang.String getDecl()
public java.util.Collection getAddedKeys()
public java.util.Collection getRemovedKeys()
protected void execute(java.util.List dataSet)
dataSet
- the input data setprotected java.util.Map getSelections()
protected int size()
protected void syncSelections(java.util.List dataSet)
dataSet
- the result set.protected void update()
protected void add(java.util.Set c)
c
- set to add.protected void clear()
public void ignoreEmptySelection()
public boolean isDispatched()
protected boolean isParentAnElement()
public void execute()
execute
in class ListHelper
public void resync(javax.servlet.http.HttpServletRequest request)
request
- the requestpublic static java.lang.String makeSelectionsName(java.lang.String listName)
listName
- the name of the list
i.e. the value specifided in <rl:list name=>protected java.util.Set getPreSelected()
public void preSelect(java.util.Set set)
set
- the initial set of items to prepopulatepublic boolean isWillClearSet()
public void setWillClearSet(boolean willClearSetIn)
willClearSetIn
- the willClearSet to setpublic boolean isPreSelectAll()
public void setPreSelectAll(boolean preSelectAllIn)
preSelectAllIn
- The preSelectAll to set.