|
|
发表于 2007/10/23 12:34:07
|
显示全部楼层
我的一点浅见
<dialog id="selectParentClassification" label="选择父类" >
<tree mb id="selectParentClassification_tree" beanclass="psdi.webclient.beans.assetcat.SelectParentClassificationBean" width="600" height="250" >
........
注意 dialog id的值 和 下面的beanclass 指定的类 他们对你的问题的解决非常重要 从你开始点击
“灰色箭头” 然后 系统会根据拟的 menutype 的类型 到 MaxPresentation 表中查找 app='MENUS'的记录项 然后找到 你在配置当中指定的菜单类型 ,然后你就会看到 在在界面上弹出来的一个选择菜单
其中有 “选择父类”
然后 鼠标点击 该项 系统会在 webclient 段这样处理
系统会记录dialog 的id 即selectParentClassification
在 maximo.js 文件中 有一个
sendevent(“selectParentClassification”,数据源)方法 ,然后maximo到LOOKUPS或LIBRARY(都在MaxPresentation 表中)去查找同名的 dialog 也就是你上面给出的这段xml代码
接下来 出现一个树形的结构 选中一个节点 系统就去此时指定的beanclass 中利用反射的方法 去调用 selectrecord 方法
源代码如下
public class SelectParentClassificationBean extends TreeControlBean
{
public SelectParentClassificationBean()
{
}
/ ************************************/
/ *这个方法就是选中树节点后调用的方法*/
/ ************************************/
public int selectrecord()
throws MXException
{
WebClientEvent webclientevent = sessionContext.getCurrentEvent();
try
{
//调用父类的方法
super.selectrecord();
updateMainRecord();
}
catch(MXException mxexception)
{
Utility.sendEvent(new WebClientEvent("dialogclose", app.getCurrentPageId(), null, sessionContext));
Utility.showMessageBox(webclientevent, mxexception);
}
catch(RemoteException remoteexception)
{
Utility.sendEvent(new WebClientEvent("dialogclose", app.getCurrentPageId(), null, sessionContext));
Utility.showMessageBox(webclientevent, remoteexception);
}
return 1;
}
TreeControlBean 中的代码分析:
public int selectrecord()
throws MXException, RemoteException
{
super.selectrecord();
//关键调用方法
selectnode();
return 1;
}
public int selectnode()
throws MXException, RemoteException
{
WebClientEvent webclientevent = sessionContext.getCurrentEvent();
String s = sessionContext.getRequest().getParameter("property");
//s为表名或对象名,s1 为选中记录的id
String s1 = webclientevent.getValueString();
if(!Utility.isNull(s))
objectname = s;
uniqueidvalue = s1;
try
{
//将选中记录的id 转化为数值类型
long l = NumberFormat.getInstance().parse(uniqueidvalue).longValue();
根据此id去查询它的整个mbo对象的内容
MboRemote mboremote=getMboForUniqueId(l);
System.out.println(this.getClass().getName());
}
catch(ParseException parseexception) { }
return 1;
}
至此 选择中部分就结束了,但是只选中了不行,还没有设置到主页面的mbo上面的字段里去了,这里就不给你分析了
因为maximo在实现不同的属性都有针对性的用了不同的方式,没有通用的。 |
|