com.sas.dataselectors.dataitems
Class BaseDataItemSelectorModel.Role

com.sas.dataselectors.dataitems.BaseDataItemSelectorModel.Role
All Implemented Interfaces:
com.sas.util.RoleInterface
Enclosing class:
BaseDataItemSelectorModel

protected class BaseDataItemSelectorModel.Role
implements com.sas.util.RoleInterface

This inner class defines the functionality of a "role", which maintains a list of items associated with each role.


Field Summary
 
Fields inherited from interface com.sas.util.RoleInterface
NO_MAXIMUM, NO_MINIMUM
 
Constructor Summary
BaseDataItemSelectorModel.Role(java.lang.String name, java.lang.String label, java.lang.String description, int minCount, int maxCount)
           
 
Method Summary
 void addRoleItem(java.lang.Object item)
          Assigns the given item to the role.
 void addRoleItem(java.lang.Object item, java.util.List availableRoleItems)
          Assigns the given item to the role.
 java.util.List addRoleItems(java.util.List items)
          Assigns the given items to the role.
 java.util.List getAvailableRoleItems()
          Returns all the items that are candidates for assignment to the role.
 java.util.List getDataItemReferenceList()
           
 int getMaxRoleItemCount()
          Returns the maximum number of items that can be assigned to the role.
 int getMinRoleItemCount()
          Returns the minimum number of items that must be assigned to the role.
 java.lang.String getRoleClosedIcon()
           
 java.lang.String getRoleDescription()
          Returns the role's description.
 java.lang.String getRoleDetailedLabel()
           
 java.lang.String getRoleDisabledIcon()
           
 java.util.List getRoleItems()
          Returns the items that have been assigned to the role.
 java.lang.String getRoleLabel()
          Returns the role's label.
 java.lang.String getRoleName()
           
 java.lang.String getRoleOpenedIcon()
           
 void moveRoleItem(java.lang.Object item, int offset)
           
 void removeAllRoleItems()
          Unassigns all items from the role.
 void removeRoleItem(java.lang.Object item)
          Unassigns the given item from the role.
 void setRoleClosedIcon(java.lang.String iconClosed)
           
 void setRoleDetailedLabel(java.lang.String detailedLabel)
           
 void setRoleDisabledIcon(java.lang.String iconDisabled)
           
 void setRoleLabel(java.lang.String label)
           
 void setRoleOpenedIcon(java.lang.String iconOpened)
           
 java.lang.String toString()
           
 

Constructor Detail

BaseDataItemSelectorModel.Role

public BaseDataItemSelectorModel.Role(java.lang.String name,
                                      java.lang.String label,
                                      java.lang.String description,
                                      int minCount,
                                      int maxCount)
                               throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

getDataItemReferenceList

public java.util.List getDataItemReferenceList()

getRoleName

public java.lang.String getRoleName()
Specified by:
getRoleName in interface com.sas.util.RoleInterface

getRoleLabel

public java.lang.String getRoleLabel()
Returns the role's label. The label is descriptive text that can be used, for example, to identify the role in a customizer window.

Note: implementations should return labels as localized strings.

Specified by:
getRoleLabel in interface com.sas.util.RoleInterface
Returns:
the label for the role
See Also:
getRoleName(), getRoleDescription()

setRoleLabel

public void setRoleLabel(java.lang.String label)

getRoleDetailedLabel

public java.lang.String getRoleDetailedLabel()
Specified by:
getRoleDetailedLabel in interface com.sas.util.RoleInterface

setRoleDetailedLabel

public void setRoleDetailedLabel(java.lang.String detailedLabel)

getRoleDescription

public java.lang.String getRoleDescription()
Returns the role's description. The description is a longer or more detailed version of the label that is appropriate to use for accessibility or tooltip text.

Note: implementations should return descriptions as localized strings.

Specified by:
getRoleDescription in interface com.sas.util.RoleInterface
Returns:
the description for the role
See Also:
getRoleLabel()

getMinRoleItemCount

public int getMinRoleItemCount()
Returns the minimum number of items that must be assigned to the role.

Specified by:
getMinRoleItemCount in interface com.sas.util.RoleInterface
Returns:
the required minimum or NO_MINIMUM
See Also:
RoleInterface.NO_MINIMUM, getMaxRoleItemCount()

getMaxRoleItemCount

public int getMaxRoleItemCount()
Returns the maximum number of items that can be assigned to the role.

Specified by:
getMaxRoleItemCount in interface com.sas.util.RoleInterface
Returns:
the maximum or NO_MAXIMUM
See Also:
RoleInterface.NO_MAXIMUM, getMinRoleItemCount()

getRoleOpenedIcon

public java.lang.String getRoleOpenedIcon()
Specified by:
getRoleOpenedIcon in interface com.sas.util.RoleInterface

setRoleOpenedIcon

public void setRoleOpenedIcon(java.lang.String iconOpened)

getRoleClosedIcon

public java.lang.String getRoleClosedIcon()
Specified by:
getRoleClosedIcon in interface com.sas.util.RoleInterface

setRoleClosedIcon

public void setRoleClosedIcon(java.lang.String iconClosed)

getRoleDisabledIcon

public java.lang.String getRoleDisabledIcon()
Specified by:
getRoleDisabledIcon in interface com.sas.util.RoleInterface

setRoleDisabledIcon

public void setRoleDisabledIcon(java.lang.String iconDisabled)

getAvailableRoleItems

public java.util.List getAvailableRoleItems()
Returns all the items that are candidates for assignment to the role. This list should only include an item that is already assigned if it makes sense to assign the item multiple times.

Specified by:
getAvailableRoleItems in interface com.sas.util.RoleInterface
Returns:
the available items
See Also:
getRoleItems()

getRoleItems

public java.util.List getRoleItems()
Returns the items that have been assigned to the role.

Specified by:
getRoleItems in interface com.sas.util.RoleInterface
Returns:
the assigned items
See Also:
getAvailableRoleItems()

moveRoleItem

public void moveRoleItem(java.lang.Object item,
                         int offset)
Specified by:
moveRoleItem in interface com.sas.util.RoleInterface

addRoleItem

public void addRoleItem(java.lang.Object item)
Assigns the given item to the role. Should not fail if caller has honored the information provided by getAvailableRoleItems(),getMinRoleItemCount(), and getMaxRoleItemCount(). After calling caller should recall these other methods since assigning one item may make another invalid for assignment and/or otherwise change the assignment rules. This method will create a DataItemReference for any item that is in the InformationMap but not in the dataSelection. This is necessary for persistence of item attributes since map item attribues cannot be changed at runtime.

Specified by:
addRoleItem in interface com.sas.util.RoleInterface
Parameters:
item - the item to assign
See Also:
addRoleItems(java.util.List), removeRoleItem(java.lang.Object)

addRoleItem

public void addRoleItem(java.lang.Object item,
                        java.util.List availableRoleItems)
Assigns the given item to the role. Should not fail if caller has honored the information provided by getAvailableRoleItems(), getMinRoleItemCount(), and getMaxRoleItemCount(). After calling caller should recall these other methods since assigning one item may make another invalid for assignment and/or otherwise change the assignment rules. This method will create a DataItemReference for any item that is in the InformationMap but not in the dataSelection. This is necessary for persistence of item attributes since map item attribues cannot be changed at runtime.

Parameters:
item - the item to assign
See Also:
addRoleItems(java.util.List), removeRoleItem(java.lang.Object), DataItemReference

addRoleItems

public java.util.List addRoleItems(java.util.List items)
Assigns the given items to the role.

This is a convenience method for consecutive calls to addRoleItem(), but saves the caller the trouble of requerying getAvailableRoleItems(), getMinRoleItemCount(), and getMaxRoleItemCount() and validating the returned results against the remaining items to be added.

Specified by:
addRoleItems in interface com.sas.util.RoleInterface
Parameters:
items - the items to assign
Returns:
null if all items added, otherwise a list of the items that could not be added
See Also:
addRoleItem(java.lang.Object)

removeRoleItem

public void removeRoleItem(java.lang.Object item)
Unassigns the given item from the role. After calling caller should recall getAvailableRoleItems(), getMinRoleItemCount(), and getMaxRoleItemCount() since unassigning one item may make another valid for assignment and/or otherwise change the assignment rules.

Specified by:
removeRoleItem in interface com.sas.util.RoleInterface
Parameters:
item - the item to unassign
See Also:
addRoleItem(java.lang.Object), removeAllRoleItems()

removeAllRoleItems

public void removeAllRoleItems()
Unassigns all items from the role. After calling caller should recall getAvailableRoleItems(), getMinRoleItemCount(), and getMaxRoleItemCount() since unassigning one item may make another valid for assignment and/or otherwise change the assignment rules.

Specified by:
removeAllRoleItems in interface com.sas.util.RoleInterface
See Also:
removeRoleItem(java.lang.Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object



Copyright © 2009 SAS Institute Inc. All Rights Reserved.