maximo 自定义高级数据选择对话框(非表域实现)
1.定义弹出式窗口页面控制类
继承自 psdi.webclient.system.beans.DataBean类
在其,实现两个方法
package cust.app.beans;
import java.rmi.RemoteException;
import cust.app.fuelverify.XXXRemote;
import cust.app.po.PONewServiceRemote;
import psdi.mbo.MboSetRemote;
import psdi.util.MXException;
import psdi.util.MXSession;
import psdi.webclient.system.beans.DataBean;
public class POLineBean extends DataBean {
public int execute() throws MXException, RemoteException
{
// TODO Auto-generated method stub
XXXRemote mbo = null;
mbo = (XXXRemote)app.getAppBean().getMbo(0);
if(mbo != null)
{
mbo.selectpoline(getMboSet().getMbo(0)); //对选择数据进行处理
mbo.getThisMboSet().save();
}
return 1;
}
//返回数据
protected MboSetRemote getMboSetRemote() throws MXException, RemoteException {
System.out.println("POLineBean getMboSetRemote");
MboSetRemote polineset = null;
MXSession s = getMXSession();
PONewServiceRemote poService = (PONewServiceRemote)s.lookup("PO");
polineset=poService.getPOLinesForXXXX(app.getAppBean().getMbo(0));
return polineset;
}
}
2.修改对像,增加数据处理方法
在cust.app.fuelverify.XXXRemote 中定义方法
public int selectpoline(MboRemote mboRemote) throws MXException, RemoteException
在 cust.app.fuelverify.XXX 中实现方法
public int selectpoline(MboRemote mboRemote) throws MXException, RemoteException {
// TODO Auto-generated method stub
if (mboRemote!=null)
{
setValue("PONUM",mboRemote.getString("PONUM"));
setValue("POLINENUM",mboRemote.getString("POLINENUM"));
save();
}
return 0;
}
编译,上传类文件,生成stub等
3.定义弹出式窗口布局
在应用程序设计器中,找到应用,导出XML文件,
在导出的XML文件中,添加窗口定义
<dialog id="flexdialog" label="XXX window caption" relationship="ralationship" beanclass="classname" >
id="flexdialog" 此属性表示dialog ID名,也是界面事件调用事件名称
label="XXX window caption" 此属性表示窗口名
relationship="ralationship" 表示关系名
beanclass="classname" 页面控制类名
<table id="table_name" startrow="0" selectmode="multiple" inputmode="readonly" width="800" label="XXX tablename" >
selectmode="multiple" 表示多选 single 表示单选
<tablebody id="table_name_tablebody" displayrowsperpage="20" filterexpanded="true" filterable="true" >
<tablecol id="table_name_tablebody_1" type="event" mxevent="toggleselectrow" sortable="false" filterable="false" hidden="false" />
<tablecol id="table_name_tablebody_2" dataattribute="显示字段名" sortable="true" />
<tablecol id="table_name_tablebody_3" dataattribute="显示字段名" sortable="true" />
</tablebody>
</table>
<buttongroup id="buttongroup_table" >
<pushbutton id="buttongroup_table1" label="确定" default="true" mxevent="dialogok" />
<pushbutton id="buttongroup_table2" label="取消" mxevent="dialogcancel" />
</buttongroup>
</dialog>
加入上面XML定义后,导入系统中。
4.在页上面添加一button 用来触发事件。
在其事故中,写上对第二步中的dialog id="flexdialog" 中的内容,本例中flexdialog
保存
5.修改或增加一个服务
在服务中,增加一个返回值为数据集(MboSetRemote)的方法
如:
定义:
package cust.app.po;
import psdi.mbo.*;
import psdi.util.MXException;
import java.rmi.RemoteException;
public interface PONewServiceRemote extends psdi.app.po.POServiceRemote
{
public MboSetRemote getPOLineForXXX(MboRemote mboRemote)
throws MXException,RemoteException;
}
实现:
package cust.app.po;
import java.rmi.RemoteException;
import java.util.Hashtable;
import java.util.Vector;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.SqlFormat;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXException;
import psdi.app.po.POService;
public class PONewService extends POService implements PONewServiceRemote
{
public PONewService(MXServer arg0) throws RemoteException {
super(arg0);
// TODO Auto-generated constructor stub
}
private static final long serialVersionUID = 1L;
public MboSetRemote getPOLinesForXXXX(MboRemote mboRemote)throws MXException,RemoteException{
MboSetRemote poLineSetRemote = getMboSet("POLINE", mboRemote.getUserInfo());
String poLines = "";//sql条件
SqlFormat whereStatement = new SqlFormat(mboRemote.getUserInfo(), poLines);
poLineSetRemote.setWhere(whereStatement.format());
poLineSetRemote.setOrderBy("ponum, polinenum");
poLineSetRemote.reset();
return poLineSetRemote;
}
}
编译不出错后,生成stub
将class上传至相关目录
6.修改服务
登录数据中,打开maxservice表
找到PO服务,修改服务类名指向我们新建的类
7.打包,发布
继承自 psdi.webclient.system.beans.DataBean类
在其,实现两个方法
package cust.app.beans;
import java.rmi.RemoteException;
import cust.app.fuelverify.XXXRemote;
import cust.app.po.PONewServiceRemote;
import psdi.mbo.MboSetRemote;
import psdi.util.MXException;
import psdi.util.MXSession;
import psdi.webclient.system.beans.DataBean;
public class POLineBean extends DataBean {
public int execute() throws MXException, RemoteException
{
// TODO Auto-generated method stub
XXXRemote mbo = null;
mbo = (XXXRemote)app.getAppBean().getMbo(0);
if(mbo != null)
{
mbo.selectpoline(getMboSet().getMbo(0)); //对选择数据进行处理
mbo.getThisMboSet().save();
}
return 1;
}
//返回数据
protected MboSetRemote getMboSetRemote() throws MXException, RemoteException {
System.out.println("POLineBean getMboSetRemote");
MboSetRemote polineset = null;
MXSession s = getMXSession();
PONewServiceRemote poService = (PONewServiceRemote)s.lookup("PO");
polineset=poService.getPOLinesForXXXX(app.getAppBean().getMbo(0));
return polineset;
}
}
2.修改对像,增加数据处理方法
在cust.app.fuelverify.XXXRemote 中定义方法
public int selectpoline(MboRemote mboRemote) throws MXException, RemoteException
在 cust.app.fuelverify.XXX 中实现方法
public int selectpoline(MboRemote mboRemote) throws MXException, RemoteException {
// TODO Auto-generated method stub
if (mboRemote!=null)
{
setValue("PONUM",mboRemote.getString("PONUM"));
setValue("POLINENUM",mboRemote.getString("POLINENUM"));
save();
}
return 0;
}
编译,上传类文件,生成stub等
3.定义弹出式窗口布局
在应用程序设计器中,找到应用,导出XML文件,
在导出的XML文件中,添加窗口定义
<dialog id="flexdialog" label="XXX window caption" relationship="ralationship" beanclass="classname" >
id="flexdialog" 此属性表示dialog ID名,也是界面事件调用事件名称
label="XXX window caption" 此属性表示窗口名
relationship="ralationship" 表示关系名
beanclass="classname" 页面控制类名
<table id="table_name" startrow="0" selectmode="multiple" inputmode="readonly" width="800" label="XXX tablename" >
selectmode="multiple" 表示多选 single 表示单选
<tablebody id="table_name_tablebody" displayrowsperpage="20" filterexpanded="true" filterable="true" >
<tablecol id="table_name_tablebody_1" type="event" mxevent="toggleselectrow" sortable="false" filterable="false" hidden="false" />
<tablecol id="table_name_tablebody_2" dataattribute="显示字段名" sortable="true" />
<tablecol id="table_name_tablebody_3" dataattribute="显示字段名" sortable="true" />
</tablebody>
</table>
<buttongroup id="buttongroup_table" >
<pushbutton id="buttongroup_table1" label="确定" default="true" mxevent="dialogok" />
<pushbutton id="buttongroup_table2" label="取消" mxevent="dialogcancel" />
</buttongroup>
</dialog>
加入上面XML定义后,导入系统中。
4.在页上面添加一button 用来触发事件。
在其事故中,写上对第二步中的dialog id="flexdialog" 中的内容,本例中flexdialog
保存
5.修改或增加一个服务
在服务中,增加一个返回值为数据集(MboSetRemote)的方法
如:
定义:
package cust.app.po;
import psdi.mbo.*;
import psdi.util.MXException;
import java.rmi.RemoteException;
public interface PONewServiceRemote extends psdi.app.po.POServiceRemote
{
public MboSetRemote getPOLineForXXX(MboRemote mboRemote)
throws MXException,RemoteException;
}
实现:
package cust.app.po;
import java.rmi.RemoteException;
import java.util.Hashtable;
import java.util.Vector;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.SqlFormat;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXException;
import psdi.app.po.POService;
public class PONewService extends POService implements PONewServiceRemote
{
public PONewService(MXServer arg0) throws RemoteException {
super(arg0);
// TODO Auto-generated constructor stub
}
private static final long serialVersionUID = 1L;
public MboSetRemote getPOLinesForXXXX(MboRemote mboRemote)throws MXException,RemoteException{
MboSetRemote poLineSetRemote = getMboSet("POLINE", mboRemote.getUserInfo());
String poLines = "";//sql条件
SqlFormat whereStatement = new SqlFormat(mboRemote.getUserInfo(), poLines);
poLineSetRemote.setWhere(whereStatement.format());
poLineSetRemote.setOrderBy("ponum, polinenum");
poLineSetRemote.reset();
return poLineSetRemote;
}
}
编译不出错后,生成stub
将class上传至相关目录
6.修改服务
登录数据中,打开maxservice表
找到PO服务,修改服务类名指向我们新建的类
7.打包,发布