自定义portlet需要实现portletEdit.js和portlet.js二个接口实现类,并在Portlet.xml文件中进行相关定义。 portletEdit.js接口类 bof.decisionpanel.Portal.Dashlet.Portlet.portletEdit接口类主要用于自定义portlet编辑界面的参数定义。
代码块 | ||||||
---|---|---|---|---|---|---|
| ||||||
/**
* abstract方法
* 打开portlet编辑界面时执行的方法
* @param contentString 界面配置信息,
* 同getContentString的返回值一样
*/
PortletEdit.prototype.render = function(contentString) {
this.contentString = contentString;
}
/*
* abstract方法
* 验证界面配置输入数据是否合法
* @return true/false;
*/
PortletEdit.prototype.validateInput = function() {
}
/*
* abstract方法
* 判断界面配置信息输入数据是否合法
* @return 界面配置信息组成的字符串;
*/
PortletEdit.prototype.getContentString = function() {
}
/**
* abstract方法
* @return 参数对象列表
* 参数对象:bof.decisionpanel.Portal.Dashlet.Portlet.ParamBean
*/
PortletEdit.prototype.getParams = function() {
}
/**
* abstract方法
* 关闭/注销portlet编辑界面时执行的方法
*/
PortletEdit.prototype.destroy = function() {
delete this.height;
delete this.width;
delete this.title;
delete this.contentString;
PortletEdit.superclass.destroy.call(this);
}
/**
* abstract方法
* 关闭按钮动作
*/
PortletEdit.prototype.doClose = function() {
}
/**
* abstract方法
* 最小化窗口
*/
PortletEdit.prototype.maximizeWindow = function() {
}
/**
* abstract方法
* 最大化窗口
*/
PortletEdit.prototype.minimizeWindow = function() {
}
/**
* abstract方法
* 还原窗口
*/
PortletEdit.prototype.restoreWindow = function() {
} |
portlet.js接口类 bof.decisionpanel.Portal.Dashlet.Portlet.portlet.js 接口类主要用于自定义portlet在仪表盘前端展现的对象。
代码块 | ||||||
---|---|---|---|---|---|---|
| ||||||
/**
* abstract方法
* 打开portlet时执行的方法
*/
Portlet.prototype.render = function() {
//资源需定义onClick事件,并抛出该事件,可以在此处接收.
}
/**
* abstract方法
* 注销portlet时执行的方法
* 子类需继承实现并执行该方法.
*/
Portlet.prototype.destroy = function() {
delete this.parentDiv;
delete this.params;
Portlet.superclass.destroy.call(this);
}
/**
* abstract
* 刷新portlet信息
*/
Portlet.prototype.refresh = function() {
}
/**
* abstract方法
* 获取portlet对象的参数值
* @return 参数对象列表.
* 参数对象:bof.decisionpanel.Portal.Dashlet.Portlet.ParamBean
*/
Portlet.prototype.getParams = function() {
}
/**
* abstract方法
* 设置参数值给portlet对象
* @param params 参数对象列表
* 参数对象:bof.decisionpanel.Portal.Dashlet.Portlet.ParamBean
*/
Portlet.prototype.setParamsValue = function(params) {
}
/**
* abstract方法
* 根据参数名称设置参数值到portlet对象.
* @param pName 参数名称
* @param pValue 参数真实值
* @param pDisplayValue 参数显示值
*/
Portlet.prototype.setParamValueByName = function(pName, pValue,pDisplayValue) {
}
/**
* abstract方法
* 最小化窗口
*/
Portlet.prototype.maximizeWindow = function() {
}
/**
* abstract方法
* 最大化窗口
*/
Portlet.prototype.minimizeWindow = function() {
}
/**
* abstract方法
* 还原窗口
*/
Portlet.prototype.restoreWindow = function() {
}
/**
* abstract方法
* portlet窗口大小变化时触发的动作
*/
Portlet.prototype.onSize = function(){
}
/**
* abstract方法
* 获取portlet的类型名称
* @return 类型名称字符串 同portlet.xml中的portlet-name节点值相同
*/
Portlet.prototype.getPortletType = function() {
}
/**
* abstract方法
* 切换公共参数触发的方法
* @param paramPanel 参数面板对象,自定义资源为空
* @param param 参数对象 bof.decisionpanel.Portal.Dashlet.Portlet.ParamBean
* @param pValue 新的参数真实值
* @param pDisplayValue 新的参数显示值 onParamChanged
*/
Portlet.prototype.onParamChange = function(paramPanel,param,pValue,pDisplayValue) {
}
/**
* abstract方法
* 获取portlet资源中的chart图形信息
* @return 根据chart图形id,通过getChartFromId(flashId)获取的对象列表(数组)
*/
Portlet.prototype.getExportChartObj = function(ignoreExportAtServer, NeedImageSaveURLInfo) {
}
/**
* abstract方法
* 获取导出portlet时需要的信息
* @return portlet信息对象
* 对象包含type:类型名称字符串 同portlet.xml中的portlet-name节点值相同;
* portletId:portlet资源id
*/
Portlet.prototype.getExportBean = function() {
} |
2.示例说明
自定义Portlet对象,允许在Portlet定义中设置URL网页搜索地址如({+}http://www.baidu.com+)。在展现页面中,使用系统的文本公共参数来输入搜索内容,在portlet中显示查询结果。
有关Portlet使用的更多说明,请见portlet资源。
提示 |
---|