com.ibm.mashups.iwidget.itemset
Interface ManagedItemSet


public ManagedItemSet

Interface to a simple abstraction of a datamodel. This provides a base from which more sofisticated datamodel can be built. There're 3 default ManagedItemSet provided in Lotus Mashups. They are attributes, userprofile and idescriptor.


Method Summary
 void save(com.ibm.mashups.iwidget.itemset.ManagedItemSetCallbackModel.postSaveCallbackFn callbackfn)
          Deprecated.  use commit(callbackfn) instead
 void commit(com.ibm.mashups.iwidget.itemset.ManagedItemSetCallbackModel.postSaveCallbackFn callbackfn)
           This method requests the queued change be processed.
 ItemSet setItemValue(String itemName, String value, Boolean readOnly)
          Deprecated.  use setItemValue(itemName,value) instead
 ItemSet setItemValue(String itemName, String value)
           This method sets an item within the ItemSet, 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.
 ItemSet removeItem(String itemName)
           Removes the named item from the set.
 ItemSet clone()
          Deprecated.  not used
 Boolean isReadOnly(String itemName)
           This method returns a Boolean indicating whether or not the item specified by the supplied name can be modified by the user.
 Object getItemSetDescription()
          Deprecated.  not used
 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

save

void save(com.ibm.mashups.iwidget.itemset.ManagedItemSetCallbackModel.postSaveCallbackFn callbackfn)
Deprecated.  use commit(callbackfn) instead

This method requests the iContext save the current state of the ManagedItemSet. The iContext MAY also choose to save the ManagedItemSet at times other than when iWidgets request a save. This method MAY operate asynchronously. The iContext MUST invoke any supplied callbackFn upon completion of the save attempt. It need to be implemented by each subclass...signiture of callback function is as follows
   function(in String managedItemSetName, in Boolean success);

Parameters:
callbackfn - optional callback function

commit

void commit(com.ibm.mashups.iwidget.itemset.ManagedItemSetCallbackModel.postSaveCallbackFn callbackfn)
This method requests the queued change be processed. This includes simultaneous changes to multiple items and any persistence or other propagation of the values. This method MAY operate asynchronously. The iContext MUST invoke any supplied callbackFn upon completion of the commit attempt. It need to be implemented by each subclass...signiture of callback function is as follows
   function(in String managedItemSetName, in Boolean success);

Parameters:
callbackfn - optional callback function

setItemValue

ItemSet setItemValue(String itemName,
                     String value,
                     Boolean readOnly)
Deprecated.  use setItemValue(itemName,value) instead

This method sets an item within the ItemSet, creates or replaces an existing entry as needed. To append a 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. Marking an item as ReadOnly indicates to the iContext that while this item maybe shared with other components on the page, the access of those components should not include changing or removing item.

Parameters:
itemName - name of the item. Must never be null.
value - value of the item. Must never be null.
readOnly - optional Boolean attribute to indicate this item is readOnly or not.Default value is false if this parameter is not provided.
Returns:
return an handle of ItemSet upon successful, null upon failure.

setItemValue

ItemSet setItemValue(String itemName,
                     String value)
This method sets an item within the ItemSet, creates or replaces an existing entry as needed. With the actual setting/processing of the change happening when commit() is invoked.As ManagedItemSet are controlled by the iContext, some items may be read only to the iwidget.

Parameters:
itemName - name of the item. Must never be null.
value - value of the item. Must never be null.
Returns:
return an handle of ItemSet 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 value of 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

ItemSet 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 ManagedItemSet upon successful, null upon failure.

clone

ItemSet clone()
Deprecated.  not used

This method returns a new ItemSet which is a duplicate of the current ItemSet.

Returns:
return a new ItemSet which contains all the data item in the current ItemSet

isReadOnly

Boolean isReadOnly(String itemName)
This method returns a Boolean indicating whether or not the item specified by the supplied name can be modified by the user.

Parameters:
itemName - name of the required Item. Must never be null.
Returns:
return a Boolean indicating whether or not the item specified by the supplied name can be modified by the user. Never null.

getItemSetDescription

Object getItemSetDescription()
Deprecated.  not used

As a limitation in Lotus Mashups, this method returns null.

Returns:
return As a limitation in Lotus Mashups, this method returns null.

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.