package com.vci.client.uif.actions.client;
|
|
import java.util.Map;
|
|
import com.vci.client.common.FreeMarkerCommon;
|
import com.vci.client.common.FreemarkerParamObject;
|
import com.vci.client.logon.base.TabPanelManage;
|
import com.vci.client.uif.engine.client.UIHelper;
|
import com.vci.client.uif.engine.client.UILayoutPanel;
|
import com.vci.client.uif.engine.common.IDataNode;
|
import com.vci.mw.ClientContextVariable;
|
|
/**
|
* 浏览按钮
|
* 在新的tab页签中打开新的tab页
|
* 通过选中对象的属性值判断打开新的tab也的type 和 context
|
*/
|
public class ViewSuperAction extends ViewAction{
|
|
/**
|
* 按钮参数
|
*/
|
private Map<String, String> paramsMap = null;
|
|
public ViewSuperAction(){
|
super();
|
}
|
|
@Override
|
public String getKey() {
|
return "superview";
|
}
|
|
@Override
|
public boolean checkHasRight(){
|
// 按BO进行数据权限检查
|
setDataRightCheckType(RightCheckConstants.RIGHT_CHECK_TYPE_B);
|
return super.checkHasRight();
|
}
|
|
@Override
|
public boolean doPost() {
|
try{
|
//获得按钮参数
|
paramsMap = getButtonParams();
|
//得到打开窗口的上下文信息
|
String expression = paramsMap.get("expression");
|
if(expression == null || expression.equals("")){
|
UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.syserror.parmerror", "");
|
return false;
|
}
|
//XXX 获得用户所选数据,暂时默认选中对象一定是个BO对象
|
Object[] objs = getDataModel().getSelectObjects();
|
Map<String, FreemarkerParamObject> freeMap = getFreemarkerParamMap(((IDataNode) objs[0]).getValueMap());
|
expression = expression.replaceAll("\\.", "Ψ");
|
expression = FreeMarkerCommon.getValueByTempRule(freeMap, expression);
|
String type = paramsMap.get("type:" + expression);
|
String context = paramsMap.get("context:" + expression);
|
String oidKey = paramsMap.get("oid:" + expression);
|
String showName = paramsMap.get("showname:" + expression);
|
if(type == null || type.equals("") || context == null || context.equals("")){
|
UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.syserror.parmerror", "");
|
return false;
|
}
|
if(oidKey == null){
|
oidKey = "";
|
}
|
// 得到业务对象、设置需要显示的属性值
|
IDataNode idn = getBusinessObject(type, oidKey);
|
if(idn.getMaterObject() == null){
|
return false;
|
}
|
Map<String, String> map = idn.getValueMap();
|
|
// 从主管理界面的数据列表中跳转到数据对象明细数据展示(Navigation\MainData\TabPage)
|
map.put(UIHelper.TYPE, type);
|
map.put(UIHelper.CONTEXT, context);
|
map.put(UIHelper.OID, cbo.getBusinessObject().oid);
|
|
IDataNode inputData = (IDataNode)objs[objs.length - 1];
|
|
UILayoutPanel uipl = new UILayoutPanel(map);
|
uipl.setInputData(inputData);
|
uipl.setSourceDataNode(idn);
|
uipl.setDataValueMap(map);
|
uipl.prep();
|
uipl.initMainPanel();
|
//在按钮参数中增加一个参数 showName 用来作为tab页的名称
|
String tabName = "";
|
if(showName == null || showName.equals("")){
|
tabName = map.get("name");
|
} else {
|
if(showName.indexOf("${") != -1){
|
Map<String, FreemarkerParamObject> freeMap1 = getFreemarkerParamMap(map);
|
tabName = FreeMarkerCommon.getValueByTempRule(freeMap1, showName);
|
} else {
|
tabName = showName;
|
}
|
}
|
TabPanelManage.getInstance().addTabPanel(uipl, tabName, true);
|
return false;
|
} catch(Throwable e){
|
UIFUtils.showErrorMessage(ClientContextVariable.getFrame(), e);
|
return false;
|
}
|
}
|
}
|