com.ibm.mashups.iwidget.itemset
Interface ShareableItemSet


public ShareableItemSet

Interface to a simple abstraction of a datamodel which is shared across different components.


Method Summary
 ShareableItemSet setItemValue(String itemName, String value)
           This method sets an item within the ShareableItemSet, creates or replaces an existing entry as needed.
 String getItemValue(String itemName)
           This method returns the value for the named item from the set.
 String[] getAllNames()
           This method returns an array of Strings, providing the name of each item.
 ShareableItemSet removeItem(String itemName)
           Removes the named item from the set.
 void commit()
           This funtions commits all the changes that's applied to ShareableItemSet.
 String addListener(Function listener)
           This function adds listener to this ShareableItemSet.
 Boolean removeListener(String listenerId)
           This function removes the listener from this ShareableItemSet.
 

Method Detail

setItemValue

ShareableItemSet setItemValue(String itemName,
                              String value)
This method sets an item within the ShareableItemSet, creates or replaces an existing entry as needed. To add an additional value to any existing item, suggest to get the current value of this item and append the new value to the list and supply the result to this method.

Parameters:
itemName - name of the item. Must never be null.
value - value of the item. Must never be null.
Returns:
return an handle of ShareableItemSet upon successful, null upon failure.

getItemValue

String getItemValue(String itemName)
This method returns the value for the named item from the set.

Parameters:
itemName - name of the item. Must never be null.
Returns:
return the named item for the set, null upon failure.

getAllNames

String[] getAllNames()
This method returns an array of Strings, providing the name of each item.

Returns:
return an array of items names and return null if the set contains no item

removeItem

ShareableItemSet removeItem(String itemName)
Removes the named item from the set.

Parameters:
itemName - name of the item that needs to be removed. Must never be null.
Returns:
return the handle to the ShareableItemSet upon successful, null upon failure.

commit

void commit()
This funtions commits all the changes that's applied to ShareableItemSet. Any udpates should be distributed to client side components that has registered listener on this ShareableItemSet.


addListener

String addListener(Function listener)
This function adds listener to this ShareableItemSet. So it will gets notified when this ShareableItemSet is updated.

Parameters:
listener - js function that should already be properly scoped. Must never be null.
Returns:
return listener id if listener is registered successfully, return null if it's not.

removeListener

Boolean removeListener(String listenerId)
This function removes the listener from this ShareableItemSet.

Parameters:
listenerId - listener id that's returned by the system when listener is added. Must never be null.
Returns:
return true if listener is removed successfully.


Copyright IBM Corp. 2010 All Rights Reserved.