- Manipulate portlet preferences
- Manipulate user profile
- Manipulate portlet state
- Portlet Mode
- Window State
The Enabler API provides functions that are equivalent to the Portlet client side API and there is one set of functions that can be used from iWidget and other set that can be used from portlet code.
Ex. In WPS 6.0 this is how we use to set portlet preferences
var _portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");
_portletWindow.getPortletPreferences(setPreference);
function setPreference(){
portletPrefs.setValue(preferenceName,preferenceValue);
portletWindow.setPortletPreferences(portletPrefs,printPreferencesCallback);
}
But now you will have to use code like this inside the Portlet
var navigationModel = com.ibm.mashups.enabler.navigation.Factory.getNavigationModel();
var selectedNode = navigationModel.find().start();
var layoutModel = navigationModel.getLayoutModel(selectedNode);
var layoutControl = layoutModel.find().start();
var widgetInstance = widgetModel.getWidgetWindow(layoutControl).start();
// set preferences
var modifiablePreferences = widgetModel.getHierarchicalPreferences(widgetInstance).start();
modifiablePreferences.setValues(key, values);
// commit
this.widgetModel.commit().start();
This is the code that you can use inside the iWidget
var result = iContext.getiWidgetAttributes();
result.setItemValue(itemName, itemValue);
Important Note: IBM deprecates the client side programming model from the previous versions. Although the old model still works, developers are encouraged to write new code to comply with the new Enabler APIs. with the old API.
1 comment:
Thanks for info
Web Design Company in Bangalore
Website development in Bangalore
Post a Comment