EAS自定义F7的设置

   原文地址 http://blog.csdn.net/fei_lv/article/details/8695683


package com.kingdee.eas.crmsp.cmsp.client;  
      
    import java.util.Map;  
      
    import com.kingdee.bos.BOSException;  
    import com.kingdee.bos.ctrl.extendcontrols.BizDataFormat;  
    import com.kingdee.bos.ctrl.extendcontrols.KDBizPromptBox;  
    import com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor;  
    import com.kingdee.bos.ctrl.kdf.table.KDTable;  
    import com.kingdee.bos.ctrl.kdf.util.render.ObjectValueRender;  
    import com.kingdee.bos.ctrl.swing.event.SelectorEvent;  
    import com.kingdee.bos.ctrl.swing.event.SelectorListener;  
    import com.kingdee.bos.ui.face.IUIWindow;  
    import com.kingdee.bos.ui.face.UIException;  
    import com.kingdee.bos.ui.face.UIFactory;  
    import com.kingdee.eas.common.EASBizException;  
    import com.kingdee.eas.common.client.OprtState;  
    import com.kingdee.eas.common.client.UIContext;  
    import com.kingdee.eas.common.client.UIFactoryName;  
    import com.kingdee.eas.crmsp.cmsp.DynamicTableItemInfo;  
    import com.kingdee.eas.framework.client.CoreUI;  
      
    public class F7Util  
    {  
            public static void model_show(KDTable kdtAssEntrys, String colName, CoreUI coreUI, KDBizPromptBox promptBox) throws EASBizException, BOSException  
            {  
                    int rowIndex = kdtAssEntrys.getSelectManager().getActiveRowIndex();  
                    Object value = kdtAssEntrys.getCell(rowIndex, colName).getValue();  
      
                    String UICLASSNAME = "com.kingdee.eas.crmsp.cmsp.client.DynamicItemF7UI";  
                    Map map = new UIContext();  
                    map.put(UIContext.OWNER, coreUI);  
                    String type = OprtState.ADDNEW;  
                    if (value != null)  
                    {  
                            DynamicTableItemInfo info = (DynamicTableItemInfo) value;  
                            map.put(UIContext.ID, info.getId().toString());  
                            type = OprtState.EDIT;  
                    }  
                    else  
                    {  
                            type = OprtState.ADDNEW;  
                    }  
                    try  
                    {  
                            IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(UICLASSNAME, map, null, type);  
                            promptBox.setSelector((DynamicItemF7UI) uiWindow.getUIObject());  
                            uiWindow.show();  
                            Object returnData = ((DynamicItemF7UI) uiWindow.getUIObject()).getData();  
                            if(returnData!=null && ((DynamicTableItemInfo)returnData).getId()!=null)  
                                    kdtAssEntrys.getCell(rowIndex, colName).setValue(((DynamicItemF7UI) uiWindow.getUIObject()).getData());  
                    }  
                    catch (UIException e)  
                    {  
                            e.printStackTrace();  
                    }  
            }  
      
            public static void initPromptBoxF7(final KDTable kdtAssEntrys, final String colName, final CoreUI coreUI)  
            {  
                    final KDBizPromptBox standardPromptBox = new KDBizPromptBox();  
                    standardPromptBox.setQueryInfo("com.kingdee.eas.crmsp.cmsp.app.DynamicTableItemQuery");  
                    standardPromptBox.setVisible(true);  
                    standardPromptBox.setEditable(false);  
                    standardPromptBox.setDisplayFormat("$name$");  
                    standardPromptBox.setEditFormat("$name$");  
                    standardPromptBox.setCommitFormat("$number$");  
      
                    KDTDefaultCellEditor standardCellEditor = new KDTDefaultCellEditor(standardPromptBox);  
                    kdtAssEntrys.getColumn(colName).setEditor(standardCellEditor);  
                    ObjectValueRender kdtBjEntry_marketAvg_OVR = new ObjectValueRender();  
                    kdtBjEntry_marketAvg_OVR.setFormat(new BizDataFormat("$name$"));  
                    kdtAssEntrys.getColumn(colName).setRenderer(kdtBjEntry_marketAvg_OVR);  
      
                    standardPromptBox.addSelectorListener(new SelectorListener()  
                    {  
                            public void willShow(SelectorEvent arg0)  
                            {  
                                    try  
                                    {  
                                            model_show(kdtAssEntrys, colName, coreUI, standardPromptBox);  
                                    }  
                                    catch (EASBizException e)  
                                    {  
                                            e.printStackTrace();  
                                    }  
                                    catch (BOSException e)  
                                    {  
                                            e.printStackTrace();  
                                    }  
                            }  
                    });  
            }  
    }  


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值