com.flexive.shared.structure
Class FxSelectList

java.lang.Object
  extended by com.flexive.shared.structure.FxSelectList
All Implemented Interfaces:
ObjectWithLabel, java.io.Serializable
Direct Known Subclasses:
FxSelectListEdit

public class FxSelectList
extends java.lang.Object
implements java.io.Serializable, ObjectWithLabel

Select list

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
protected  boolean allowDynamicItemCreation
           
protected  java.lang.String breadcrumbSeparator
           
static java.lang.String COUNTRIES
          A select list containing all countries and their codes.
protected  ACL createItemACL
           
protected  FxSelectListItem defaultItem
           
protected  long defaultItemId
           
protected  FxString description
           
protected  long id
           
protected  java.util.Map<java.lang.Long,FxSelectListItem> items
           
protected  FxString label
           
protected  java.lang.String name
           
protected  ACL newItemACL
           
protected  boolean onlySameLevelSelect
           
protected  FxSelectList parentList
           
protected  long parentListId
           
protected  boolean sortEntries
           
 
Constructor Summary
FxSelectList(long id, long parentListId, java.lang.String name, FxString label, FxString description, boolean allowDynamicItemCreation, ACL createItemACL, ACL newItemACL, long defaultItemId, java.lang.String breadcrumbSeparator, boolean onlySameLevelSelect, boolean sortEntries)
          Internal(!) Constructor to be used while loading from storage
FxSelectList(java.lang.String name)
          Create a new in-memory select list.
 
Method Summary
protected  void _setDefaultItem(FxSelectListItem defaultItem)
          Set a new default item, setting null will clear the default item To be used internally from FxSelectListEdit only(!)
 void _synchronize(FxEnvironment env)
          Internal method to synchronize/load parent lists and items
 FxSelectListEdit asEditable()
          Get this FxSelectList as editable
 boolean containsItem(long id)
          Check if this list contains an selectlist item with the requested id
 boolean containsItem(java.lang.String name)
          Check if this list contains an selectlist item with the requested name
static FxSelectList createList(java.lang.String name, java.util.List<? extends SelectableObjectWithLabel> items)
          Factory method to create a select list based on a collection of SelectableObjectWithLabel objects.
static FxSelectList createListWithName(java.lang.String name, java.util.List<? extends SelectableObjectWithName> items)
          Factory method to create a select list based on a collection of SelectableObjectWithName objects.
 java.lang.String getBreadcrumbSeparator()
          Get the separator for breadcrumbs
 java.util.List<FxSelectListItem> getChildItems(long listItemId)
          Get a list of all children of the given list item
 ACL getCreateItemACL()
          Get the ACL used to check if a user is allowed to create new items for this list dynamically
 FxSelectListItem getDefaultItem()
          Get the (optional!) default item for this list
 FxString getDescription()
          Get the description
 boolean getHasChildItems(long listItemId)
          Does a child list item exist for the given list item?
 long getId()
          Get the internal id
 FxSelectListItem getItem(long id)
          Get the selectlist item with the given id
 FxSelectListItem getItem(java.lang.String name)
          Get the selectlist item with the given id
 FxSelectListItem getItemByData(java.lang.String data)
          Get the (first) selectlist item with the given data
 int getItemCount()
          Get the number of items in this SelectList
protected  java.util.Map<java.lang.Long,FxSelectListItem> getItemMap()
          Getter for the map containing items.
 java.util.List<FxSelectListItem> getItems()
           
 java.util.List<FxSelectListItem> getItemsSortedByLabel()
           
 FxString getLabel()
          Get the label
 java.lang.String getName()
          Get the name
 ACL getNewItemACL()
          Get the default ACL assigned to newly created items
 FxSelectList getParentList()
          Get the parent list
 boolean hasDefaultItem()
          Is a default item set for this list?
 boolean hasParentList()
          Is a parent list set for this list?
 boolean isAllowDynamicItemCreation()
          May items be created dynamically? (in UI's other than backends!)
 boolean isCascaded()
          Does this list contain cascaded items?
 boolean isOnlySameLevelSelect()
          For multi selects: is only a multi selection within the same hierarchy level allowed?
 boolean isSortEntries()
          Should entries be sorted by the label in the current users language or by the defined order?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNTRIES

public static final java.lang.String COUNTRIES
A select list containing all countries and their codes.

See Also:
Constant Field Values

id

protected long id

parentList

protected FxSelectList parentList

parentListId

protected long parentListId

name

protected java.lang.String name

label

protected FxString label

description

protected FxString description

allowDynamicItemCreation

protected boolean allowDynamicItemCreation

createItemACL

protected ACL createItemACL

newItemACL

protected ACL newItemACL

items

protected java.util.Map<java.lang.Long,FxSelectListItem> items

defaultItem

protected FxSelectListItem defaultItem

defaultItemId

protected long defaultItemId

breadcrumbSeparator

protected java.lang.String breadcrumbSeparator

onlySameLevelSelect

protected boolean onlySameLevelSelect

sortEntries

protected boolean sortEntries
Constructor Detail

FxSelectList

public FxSelectList(long id,
                    long parentListId,
                    java.lang.String name,
                    FxString label,
                    FxString description,
                    boolean allowDynamicItemCreation,
                    ACL createItemACL,
                    ACL newItemACL,
                    long defaultItemId,
                    java.lang.String breadcrumbSeparator,
                    boolean onlySameLevelSelect,
                    boolean sortEntries)
Internal(!) Constructor to be used while loading from storage

Parameters:
id - internal id
parentListId - parent list if >= 0
name - name (unique)
label - label
description - description
allowDynamicItemCreation - is dynamic item creation allowed?
createItemACL - ACL whose create flag is checked against for creating new list items
newItemACL - ACL assigned to new items
defaultItemId - the id of the default selected item, optional, can be null
breadcrumbSeparator - separator for breadcrumbs
onlySameLevelSelect - only selections within the same level are allowed (applies only to multi select lists)
sortEntries - sort entries by label or in the defined sort order?

FxSelectList

public FxSelectList(java.lang.String name)
Create a new in-memory select list. Not suitable for creating select lists that will be stored in the database!

Parameters:
name - the select list name
Method Detail

_synchronize

public void _synchronize(FxEnvironment env)
Internal method to synchronize/load parent lists and items

Parameters:
env - environment

getId

public long getId()
Get the internal id

Returns:
internal id

getParentList

public FxSelectList getParentList()
Get the parent list

Returns:
parent list

hasParentList

public boolean hasParentList()
Is a parent list set for this list?

Returns:
if a parent list is set for this list

getDefaultItem

public FxSelectListItem getDefaultItem()
Get the (optional!) default item for this list

Returns:
the (optional!) default item for this list, can be null

hasDefaultItem

public boolean hasDefaultItem()
Is a default item set for this list?

Returns:
if a default item is set for this list

getName

public java.lang.String getName()
Get the name

Returns:
name

getLabel

public FxString getLabel()
Get the label

Specified by:
getLabel in interface ObjectWithLabel
Returns:
label

getDescription

public FxString getDescription()
Get the description

Returns:
description

isAllowDynamicItemCreation

public boolean isAllowDynamicItemCreation()
May items be created dynamically? (in UI's other than backends!)

Returns:
if items may be created dynamically

getCreateItemACL

public ACL getCreateItemACL()
Get the ACL used to check if a user is allowed to create new items for this list dynamically

Returns:
ACL used to check if a user is allowed to create new items for this list dynamically

getNewItemACL

public ACL getNewItemACL()
Get the default ACL assigned to newly created items

Returns:
default ACL assigned to newly created items

getItem

public FxSelectListItem getItem(long id)
Get the selectlist item with the given id

Parameters:
id - requested select list item id
Returns:
select list item

getItem

public FxSelectListItem getItem(java.lang.String name)
Get the selectlist item with the given id

Parameters:
name - requested select list item name
Returns:
select list item

getItemByData

public FxSelectListItem getItemByData(java.lang.String data)
Get the (first) selectlist item with the given data

Parameters:
data - requested select list item data
Returns:
select list item

getItemMap

protected final java.util.Map<java.lang.Long,FxSelectListItem> getItemMap()
Getter for the map containing items. Used by FxSelectListItem to "add" itself to a list during construction.

Returns:
map of all items of this list

getItems

public final java.util.List<FxSelectListItem> getItems()

getItemsSortedByLabel

public final java.util.List<FxSelectListItem> getItemsSortedByLabel()
Returns:
all items sorted by the label in the calling user's language.
Since:
3.1.5

getItemCount

public int getItemCount()
Get the number of items in this SelectList

Returns:
number of items in this SelectList

asEditable

public FxSelectListEdit asEditable()
Get this FxSelectList as editable

Returns:
FxSelectListEdit

containsItem

public boolean containsItem(long id)
Check if this list contains an selectlist item with the requested id

Parameters:
id - requested item id
Returns:
if the requested item is contained in this list

containsItem

public boolean containsItem(java.lang.String name)
Check if this list contains an selectlist item with the requested name

Parameters:
name - requested item name
Returns:
if the requested item is contained in this list

createList

public static FxSelectList createList(java.lang.String name,
                                      java.util.List<? extends SelectableObjectWithLabel> items)
Factory method to create a select list based on a collection of SelectableObjectWithLabel objects. This select list cannot be persisted to the DB, but may used e.g. for UI input components.

Parameters:
name - name of the select list to be created
items - selectable objects with label
Returns:
a new select list

createListWithName

public static FxSelectList createListWithName(java.lang.String name,
                                              java.util.List<? extends SelectableObjectWithName> items)
Factory method to create a select list based on a collection of SelectableObjectWithName objects. This select list cannot be persisted to the DB, but may used e.g. for UI input components.

Parameters:
name - name of the select list to be created
items - selectable objects
Returns:
a new select list

_setDefaultItem

protected void _setDefaultItem(FxSelectListItem defaultItem)
Set a new default item, setting null will clear the default item To be used internally from FxSelectListEdit only(!)

Parameters:
defaultItem - a new default item, setting null will clear the default item

getHasChildItems

public boolean getHasChildItems(long listItemId)
Does a child list item exist for the given list item?

Parameters:
listItemId - list item to check for children
Returns:
if child items exist

getChildItems

public java.util.List<FxSelectListItem> getChildItems(long listItemId)
Get a list of all children of the given list item

Parameters:
listItemId - list item to get children for
Returns:
all children of the given list item

isCascaded

public boolean isCascaded()
Does this list contain cascaded items?

Returns:
list contains cascaded items

getBreadcrumbSeparator

public java.lang.String getBreadcrumbSeparator()
Get the separator for breadcrumbs

Returns:
separator for breadcrumbs

isOnlySameLevelSelect

public boolean isOnlySameLevelSelect()
For multi selects: is only a multi selection within the same hierarchy level allowed?

Returns:
only selections within the same level allowed

isSortEntries

public boolean isSortEntries()
Should entries be sorted by the label in the current users language or by the defined order?

Returns:
if entries should be sorted by the label in the current users language or by the defined order
Since:
3.1.5