|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.dataselectors.dataitems.BaseDataItemSelectorModel
public abstract class BaseDataItemSelectorModel
This base class defines the common behaviors for the DataItem selector. This selector allows the user to assign data items to a set of specific roles (e.g. row, column). This class contains much of the common business logic, and it should be subclassed to provide behavior to a specific data source or API layer. It also implements the selector's process and commit interfaces so that it can take the place of the selector command model, allowing this selector to operate in a more consolidated manner outside of the ActionProvider framework.
Nested Class Summary | |
---|---|
protected class |
BaseDataItemSelectorModel.Role
This inner class defines the functionality of a "role", which maintains a list of items associated with each role. |
Field Summary | |
---|---|
protected java.util.Map |
_dataItemMap
|
protected java.util.Locale |
_locale
|
protected java.util.ArrayList |
_rolesList
|
protected java.lang.String |
action
|
static java.lang.String |
CANCEL_MODE
The mode key for cancelling all selector actions |
static java.lang.String |
CHANGE_QUERY_TYPE
Remote scripting action key that indicates the value for the query type changed |
static java.lang.String |
CHANGE_ROLE
Remote scripting action key that indicates the selected role changed |
static java.lang.String |
COMMIT
Remote scripting action key that indicates the OK button was clicked |
static java.lang.String |
COMMIT_MODE
The mode key for committing changes to the viewer model |
protected java.lang.String |
data
|
static java.lang.String |
MOVE_ITEM_DOWN
Remote scripting action key that indicates the down arrow was clicked to move an item down |
static java.lang.String |
MOVE_ITEM_TO_POSITION
Remote scripting action key that indicates a set of items is being moved within a role to a specific position |
static java.lang.String |
MOVE_ITEM_UP
Remote scripting action key that indicates the up arrow was clicked to move an item up |
static java.lang.String |
MOVE_ITEMS
Remote scripting action key that indicates the Move Item button was clicked |
protected java.util.List |
originalItemList
|
protected java.lang.String |
positionToMoveTo
|
static java.lang.String |
PROCESS_MODE
The mode key for interacting with the selector |
protected java.lang.String |
queryType
|
static java.lang.String |
RB_KEY
|
protected java.lang.String |
role
|
protected java.lang.String[] |
selectedItems
|
static java.lang.String |
SHOW_MODE
The mode key for initially displaying the selector |
static java.lang.String |
SORT_ITEMS
Remote scripting action key that indicates the available tree display format changed |
protected java.lang.String[] |
unselectedItems
|
static java.lang.String |
UPDATE_ITEMS
Remote scripting action key that indicates an add or delete of a data item occurred |
Fields inherited from interface com.sas.dataselectors.dataitems.DataItemSelectorInterface |
---|
DISPLAY_DETAIL_VALUES, GROUP_BY_CATEGORY_VALUES |
Fields inherited from interface com.sas.dataselectors.SelectorCommitInterface |
---|
EXCEPTION_OCCURRED |
Constructor Summary | |
---|---|
BaseDataItemSelectorModel()
|
Method Summary | |
---|---|
protected void |
addItemToRole(java.lang.Object item,
com.sas.util.RoleInterface role,
java.util.List roleList,
java.util.Map itemMap)
|
protected void |
addResultItemsToQuery(com.sas.util.RoleInterface[] rolesUsed,
java.lang.String queryType)
|
protected int |
adjustMoveToPosition(java.util.List items,
int positionIndex)
|
boolean |
allQueryItemsAreDetailUsage()
Indicates if all items selected for each role are set to detail usage. |
void |
cleanUp(java.lang.String mode)
For each added role, removes from the business model all DataItemReference objects created during processing of the selector. |
java.util.Map |
commit()
Used to commit the changes to the model. |
protected java.util.List |
createAddItemsList(java.util.Vector itemVector,
java.util.Map itemmap)
|
void |
deleteResultItemsFromQuery(com.sas.util.RoleInterface[] rolesUsed,
java.util.Map oldResultItemsMap)
|
void |
deleteSortCriteriaFromQuery()
|
protected com.sas.util.RoleInterface |
findRoleForItem(java.lang.Object thisitem)
|
java.lang.String |
getAction()
Returns the user action string. |
java.util.List |
getAllAvailableNodeIds(boolean useOriginalIds)
Returns a list of the ids for all items in the available list. |
java.util.List |
getAvailableEnabledNodeIds(java.lang.String selectedRole)
Returns a list of the item ids for the items available for selection for the selected role. |
java.util.List |
getAvailableItemInfoList(java.lang.String selectedRole)
Returns a list of DataItemTreeNodeInfo objects, representing the list of items available for the selected role. |
protected java.util.List |
getAvailableRoleItems(com.sas.util.RoleInterface role)
Return the list of items available to add to the role |
protected javax.swing.tree.TreeModel |
getAvailableTreeModel(java.util.List allItems,
java.util.List availableItems,
com.sas.util.transforms.TransformInterface transform)
|
javax.swing.tree.TreeModel |
getAvailableTreeModel(com.sas.util.transforms.TransformInterface transform,
java.lang.String selectedRole)
Creates a tree model representing the available items for the business model. |
protected java.lang.Object |
getBaseItem(java.lang.Object item)
|
java.lang.String |
getBaseItemId(java.lang.String itemid)
Returns the base item id of the DataItemReference in the stored dataItem map identified by itemid. |
java.lang.String |
getData()
Returns the user data string. |
java.util.Map |
getDataItemMap()
Returns the map of DataItems stored by their id |
java.util.List |
getDropTargetRoles()
getMoveTargetRoles() is used for disabling a move menu based on current selections. |
protected java.lang.String |
getIdFromDataItemRefList(java.lang.String itemid)
Searches through the dataitemreference lists looking for item with id itemid. |
protected java.lang.String |
getItemCategory(java.lang.Object item)
|
protected java.lang.String |
getItemDefaultImage(java.lang.Object item)
|
protected java.lang.String |
getItemDescription(java.lang.Object item)
|
protected java.lang.String |
getItemDisabledImage(java.lang.Object item)
|
java.lang.Object |
getItemFromItemMap(java.lang.String itemid)
Returns the data item in the stored itemmap that corresponds to the itemid. |
protected java.lang.Object |
getItemFromReference(java.lang.Object object)
|
protected java.lang.String |
getItemID(java.lang.Object item)
|
protected java.lang.Object |
getItemInRolePosition(com.sas.util.RoleInterface role,
int pos)
|
protected java.lang.String |
getItemLabel(java.lang.Object item)
|
protected int |
getItemPositionInRole(java.lang.Object item)
|
java.util.Locale |
getLocale()
Returns the locale object |
java.util.List |
getMoveTargetRoles()
Returns a list of RoleInterface objects that the items contained in the selectedItems parameter can be moved to. |
java.lang.String |
getPositionToMoveTo()
Returns the position index to move data items when dragging items from one role to another and putting in a specific position within target role. |
java.lang.Object |
getPropertiesBean()
|
java.lang.String |
getQueryType()
Returns the current query type |
java.lang.String |
getReason(java.lang.Object reason)
|
java.util.List |
getReasonsQueryNotValid()
|
java.lang.String |
getRole()
Returns the current working role |
protected java.lang.String |
getRoleDetailedLabel(java.lang.String role)
|
abstract java.util.List |
getRoleItems()
|
protected java.lang.String |
getRoleLabel(java.lang.String role)
|
com.sas.util.RoleInterface[] |
getRoles()
|
java.util.List |
getSelectedItemInfoList(java.lang.String selectedRole)
Returns a list of DataItemTreeNodeInfo objects, representing the list of items assigned to the selected role. |
java.lang.String[] |
getSelectedItems()
Returns the array of selected data items |
javax.swing.tree.TreeModel |
getSelectedTreeModel(com.sas.util.transforms.TransformInterface transform,
java.lang.String selectedRole)
Creates a tree model representing the selected items for the business model. |
protected javax.swing.tree.TreeNode |
getSelectedTreeNode(com.sas.util.RoleInterface role,
com.sas.util.transforms.TransformInterface transform,
java.lang.String selectedRole)
|
java.lang.String |
getStatusMessage()
Checks for basic validity/completeness of the adapter and returns a status message indicating what is wrong with the adapter. |
java.lang.String[] |
getUnselectedItems()
Returns the array of unselected data items |
boolean |
hasValidRoles()
|
protected boolean |
isCalculatedItem(java.lang.Object item)
|
boolean |
isCalculatedItemSelected()
Indicates if a calculated item is selected for any of the assigned roles. |
protected boolean |
isDetailUsageSupported(java.lang.Object item)
|
protected boolean |
isItemActionSupported(java.lang.Object item,
java.lang.String queryType)
|
protected boolean |
isItemAReference(java.lang.Object item)
|
protected boolean |
isItemFirstInRole(java.lang.Object item)
|
protected boolean |
isItemLastInRole(java.lang.Object item)
|
boolean |
isItemMoveDownValid()
Returns true if the items contained in the selectedItems parameter can be moved down in the model order. |
boolean |
isItemMoveUpValid()
Returns true if the items contained in the selectedItems parameter can be moved up in the model order. |
protected boolean |
isItemUsageDetail(java.lang.Object item)
|
protected boolean |
isMeasure(java.lang.Object object)
|
protected boolean |
isQueryActionSupported()
|
boolean |
isQueryValid()
|
boolean |
isThisItemAReferenceInItemMap(java.lang.String itemid)
Convenience method that indicates if the item in the stored dataitem map identified by the passed in id is a DataItemReference. |
boolean |
isThisItemInAvailableList(java.lang.String itemid,
com.sas.util.RoleInterface role)
Convenience method to determine if the data item identified by the passed in item id is available for selection for the indicated role. |
boolean |
isThisItemInRoleRefList(java.lang.String itemid,
com.sas.util.RoleInterface role)
Indicates if the item identified by the passed in item id is in the list of DataItemReferences created by addRoleItem for the indicated role. |
void |
mapDataSource()
Creates a map of selected items with their item id as the key. |
protected void |
moveItemsToPosition(java.util.List items,
int positionIndex)
Moves the specified items to a new position within their existing role The positionIndex is the zero based index they would move to in the list of nodes as it currently exists. |
protected void |
moveItemsToRole(java.util.List items,
com.sas.util.RoleInterface targetRole)
Moves the specified items to the specified role. |
protected void |
moveItemsUpDown(java.util.List items,
int offset)
Moves the specified items up or down in their roles by the specified offset. |
java.util.Map |
process()
Used to update the state of the model. |
boolean |
queryItemsSupportDetailUsage()
Indicates if all items selected for each role support the detail usage. |
protected java.util.List |
removeDuplicateItems(java.util.List allItems)
Convenience method to create a list of items such that each item in the list is unique. |
protected void |
removeItemFromRole(java.lang.Object item,
java.util.List roleList,
java.util.List refList)
|
protected java.util.List |
removeItemsNotSupportingDetail(java.util.List items)
Removes the items from the passed in list that do not support the detail usage. |
protected java.util.List |
removeNotUsableItems(java.util.List allDataItems)
Convenience method that removes all items in the list that are not usable in the query for some reason. |
void |
rollBackQuery(java.util.Map itemMap)
|
void |
setAction(java.lang.String actionstr)
Sets the user action string. |
void |
setData(java.lang.String datastr)
Sets the data string associated with the user action. |
void |
setDataItemMap(java.util.Map map)
|
protected void |
setItemUsage(java.lang.Object item,
java.lang.String queryType)
|
void |
setLocale(java.util.Locale locale)
Sets the locale object to ensure that all messages returned are properly translated. |
protected void |
setOriginalItemList(java.util.List allItems)
Maintains a list of item IDs for the specified items. |
void |
setPositionToMoveTo(java.lang.String datastr)
Sets the position index to move data items when dragging items from one role to another. |
void |
setQueryType(java.lang.String queryType)
Sets the value for the query type for relational queries. |
void |
setRole(java.lang.String role)
Sets the value for the current working role. |
void |
setSelectedItems(java.lang.String[] items)
Sets the array of selected data items. |
void |
setSelectedItemsQueryType(java.lang.String queryType)
Sets the DataItem usage for each of the selected items. |
void |
setUnselectedItems(java.lang.String[] items)
Sets the array of unselected data items. |
protected java.util.List |
sortItemListByRolePosition(java.util.List items)
Sorts the specified list of items by their position in their role. |
Field Detail |
---|
protected java.util.ArrayList _rolesList
protected java.util.Map _dataItemMap
protected java.util.Locale _locale
protected java.lang.String queryType
protected java.util.List originalItemList
protected java.lang.String action
protected java.lang.String data
protected java.lang.String positionToMoveTo
protected java.lang.String role
protected java.lang.String[] selectedItems
protected java.lang.String[] unselectedItems
public static final java.lang.String RB_KEY
public static final java.lang.String SHOW_MODE
public static final java.lang.String PROCESS_MODE
public static final java.lang.String CANCEL_MODE
public static final java.lang.String COMMIT_MODE
public static final java.lang.String UPDATE_ITEMS
public static final java.lang.String SORT_ITEMS
public static final java.lang.String MOVE_ITEMS
public static final java.lang.String CHANGE_ROLE
public static final java.lang.String MOVE_ITEM_UP
public static final java.lang.String MOVE_ITEM_DOWN
public static final java.lang.String MOVE_ITEM_TO_POSITION
public static final java.lang.String CHANGE_QUERY_TYPE
public static final java.lang.String COMMIT
Constructor Detail |
---|
public BaseDataItemSelectorModel()
Method Detail |
---|
public void setAction(java.lang.String actionstr)
actionstring
- The user actionpublic java.lang.String getAction()
public void setData(java.lang.String datastr)
data
- The user data stringpublic java.lang.String getData()
public void setPositionToMoveTo(java.lang.String datastr)
data
- The user data stringpublic java.lang.String getPositionToMoveTo()
public void setRole(java.lang.String role)
role
- The current rolepublic java.lang.String getRole()
public void setSelectedItems(java.lang.String[] items)
setSelectedItems
in interface DataItemSelectorInterface
items
- The array of selected itemspublic java.lang.String[] getSelectedItems()
public void setUnselectedItems(java.lang.String[] items)
items
- The array of unselected itemspublic java.lang.String[] getUnselectedItems()
public com.sas.util.RoleInterface[] getRoles()
getRoles
in interface com.sas.util.RoleProviderInterface
public abstract java.util.List getRoleItems()
getRoleItems
in interface com.sas.util.RoleProviderInterface
public javax.swing.tree.TreeModel getAvailableTreeModel(com.sas.util.transforms.TransformInterface transform, java.lang.String selectedRole)
DataItemSelectorInterface
getAvailableTreeModel
in interface DataItemSelectorInterface
transform
- - an optional transform objectselectedRole
- - the currently selected role
public java.util.List getAvailableEnabledNodeIds(java.lang.String selectedRole)
DataItemSelectorInterface
getAvailableEnabledNodeIds
in interface DataItemSelectorInterface
selectedRole
- - the currently selected role
public java.util.List getAllAvailableNodeIds(boolean useOriginalIds)
DataItemSelectorInterface
getAllAvailableNodeIds
in interface DataItemSelectorInterface
public java.util.List getAvailableItemInfoList(java.lang.String selectedRole)
DataItemSelectorInterface
getAvailableItemInfoList
in interface DataItemSelectorInterface
DataItemTreeNodeInfo
public java.util.List getSelectedItemInfoList(java.lang.String selectedRole)
DataItemSelectorInterface
getSelectedItemInfoList
in interface DataItemSelectorInterface
selectedRole
- The role of interest
DataItemTreeNodeInfo
public javax.swing.tree.TreeModel getSelectedTreeModel(com.sas.util.transforms.TransformInterface transform, java.lang.String selectedRole)
DataItemSelectorInterface
getSelectedTreeModel
in interface DataItemSelectorInterface
transform
- - an optional transform objectselectedRole
- - the currently selected role
public java.util.Map getDataItemMap()
DataItemSelectorInterface
getDataItemMap
in interface DataItemSelectorInterface
public void setDataItemMap(java.util.Map map)
public boolean hasValidRoles()
public void cleanUp(java.lang.String mode)
DataItemSelectorInterface
cleanUp
in interface DataItemSelectorInterface
mode
- - an optional mode identifier (this can be null)public void setLocale(java.util.Locale locale)
DataItemSelectorInterface
setLocale
in interface DataItemSelectorInterface
locale
- - the locale objectpublic java.util.Locale getLocale()
DataItemSelectorInterface
getLocale
in interface DataItemSelectorInterface
public java.lang.Object getItemFromItemMap(java.lang.String itemid)
DataItemSelectorInterface
getItemFromItemMap
in interface DataItemSelectorInterface
itemid
- - the id of the item to return
public java.lang.String getBaseItemId(java.lang.String itemid)
DataItemSelectorInterface
getBaseItemId
in interface DataItemSelectorInterface
itemid
- - the id of the DataItemReference to find in the map
public boolean isThisItemAReferenceInItemMap(java.lang.String itemid)
DataItemSelectorInterface
isThisItemAReferenceInItemMap
in interface DataItemSelectorInterface
itemid
- - the id of the item to search for in the dataitem map
public boolean isThisItemInAvailableList(java.lang.String itemid, com.sas.util.RoleInterface role)
DataItemSelectorInterface
isThisItemInAvailableList
in interface DataItemSelectorInterface
itemid
- - the id of the item in the available listrole
- - the role of interest
public boolean isThisItemInRoleRefList(java.lang.String itemid, com.sas.util.RoleInterface role)
DataItemSelectorInterface
isThisItemInRoleRefList
in interface DataItemSelectorInterface
itemid
- - the id of the DataItemrole
- - the role of interest
public boolean isCalculatedItemSelected()
DataItemSelectorInterface
isCalculatedItemSelected
in interface DataItemSelectorInterface
public boolean queryItemsSupportDetailUsage()
DataItemSelectorInterface
queryItemsSupportDetailUsage
in interface DataItemSelectorInterface
DataItemActionType
public boolean allQueryItemsAreDetailUsage()
DataItemSelectorInterface
allQueryItemsAreDetailUsage
in interface DataItemSelectorInterface
DataItemActionType
public void setSelectedItemsQueryType(java.lang.String queryType)
DataItemSelectorInterface
setSelectedItemsQueryType
in interface DataItemSelectorInterface
queryType
- - The query type string. This should be "group" or "detail".DataItemActionType
public void setQueryType(java.lang.String queryType)
DataItemSelectorInterface
setQueryType
in interface DataItemSelectorInterface
public java.lang.String getQueryType()
DataItemSelectorInterface
getQueryType
in interface DataItemSelectorInterface
public boolean isItemMoveUpValid()
DataItemSelectorInterface
isItemMoveUpValid
in interface DataItemSelectorInterface
public boolean isItemMoveDownValid()
DataItemSelectorInterface
isItemMoveDownValid
in interface DataItemSelectorInterface
public java.lang.String getStatusMessage()
DataItemSelectorInterface
getStatusMessage
in interface DataItemSelectorInterface
public java.util.List getMoveTargetRoles()
DataItemSelectorInterface
getMoveTargetRoles
in interface DataItemSelectorInterface
public java.util.List getDropTargetRoles()
public java.util.Map process()
SelectorProcessInterface
process
in interface SelectorProcessInterface
public java.lang.Object getPropertiesBean()
getPropertiesBean
in interface SelectorCommitInterface
public java.util.Map commit()
SelectorCommitInterface
commit
in interface SelectorCommitInterface
protected javax.swing.tree.TreeModel getAvailableTreeModel(java.util.List allItems, java.util.List availableItems, com.sas.util.transforms.TransformInterface transform)
protected javax.swing.tree.TreeNode getSelectedTreeNode(com.sas.util.RoleInterface role, com.sas.util.transforms.TransformInterface transform, java.lang.String selectedRole)
protected java.util.List removeNotUsableItems(java.util.List allDataItems)
allDataItems
- - a list of DataItems
protected java.util.List removeDuplicateItems(java.util.List allItems)
allItems
- - a list of items
protected java.util.List removeItemsNotSupportingDetail(java.util.List items)
items
- - a list of items
protected void setOriginalItemList(java.util.List allItems)
protected java.lang.String getItemID(java.lang.Object item)
protected java.lang.String getItemLabel(java.lang.Object item)
protected java.lang.String getItemDescription(java.lang.Object item)
protected java.lang.String getItemCategory(java.lang.Object item)
protected java.lang.String getItemDefaultImage(java.lang.Object item)
protected java.lang.String getItemDisabledImage(java.lang.Object item)
protected boolean isCalculatedItem(java.lang.Object item)
protected boolean isDetailUsageSupported(java.lang.Object item)
protected boolean isItemUsageDetail(java.lang.Object item)
protected boolean isItemActionSupported(java.lang.Object item, java.lang.String queryType)
protected void setItemUsage(java.lang.Object item, java.lang.String queryType)
protected boolean isItemAReference(java.lang.Object item)
protected java.lang.String getIdFromDataItemRefList(java.lang.String itemid)
itemid
- - the id of the item to search for
protected java.lang.Object getBaseItem(java.lang.Object item)
public void mapDataSource()
protected java.lang.String getRoleLabel(java.lang.String role)
protected java.lang.String getRoleDetailedLabel(java.lang.String role)
protected java.util.List getAvailableRoleItems(com.sas.util.RoleInterface role)
protected void addItemToRole(java.lang.Object item, com.sas.util.RoleInterface role, java.util.List roleList, java.util.Map itemMap)
protected void removeItemFromRole(java.lang.Object item, java.util.List roleList, java.util.List refList)
public java.lang.String getReason(java.lang.Object reason)
protected com.sas.util.RoleInterface findRoleForItem(java.lang.Object thisitem)
protected void addResultItemsToQuery(com.sas.util.RoleInterface[] rolesUsed, java.lang.String queryType) throws java.lang.Exception
java.lang.Exception
public void deleteResultItemsFromQuery(com.sas.util.RoleInterface[] rolesUsed, java.util.Map oldResultItemsMap)
protected boolean isQueryActionSupported()
protected boolean isMeasure(java.lang.Object object)
protected java.lang.Object getItemFromReference(java.lang.Object object)
protected java.util.List createAddItemsList(java.util.Vector itemVector, java.util.Map itemmap)
public boolean isQueryValid()
public java.util.List getReasonsQueryNotValid()
public void rollBackQuery(java.util.Map itemMap)
public void deleteSortCriteriaFromQuery()
protected int getItemPositionInRole(java.lang.Object item)
protected java.lang.Object getItemInRolePosition(com.sas.util.RoleInterface role, int pos)
protected boolean isItemFirstInRole(java.lang.Object item)
protected boolean isItemLastInRole(java.lang.Object item)
protected void moveItemsToRole(java.util.List items, com.sas.util.RoleInterface targetRole)
items
- The items to move.targetRole
- The role to move items into.protected int adjustMoveToPosition(java.util.List items, int positionIndex)
protected void moveItemsToPosition(java.util.List items, int positionIndex)
items
- The items to move.offset
- The integer position to move each item to.protected void moveItemsUpDown(java.util.List items, int offset)
items
- The items to move.offset
- The integer offset to move each item (e.g. 1 or -1)protected java.util.List sortItemListByRolePosition(java.util.List items)
items
- The items to be sorted
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |