ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package com.vci.client.portal.UI.v3.comptdesign.compt.al;
 
import java.awt.event.ActionEvent;
import java.util.List;
 
import com.vci.client.omd.btm.ui.BtmClient;
import com.vci.client.omd.btm.wrapper.BtmItemWrapper;
import com.vci.client.omd.linktype.LinkTypeStart;
import com.vci.client.omd.linktype.LinkTypeWrapper;
import com.vci.client.portal.Formdesign.FormDesignDialog;
import com.vci.client.portal.UI.v3.comptdesign.UIComptDesignDialog;
import com.vci.client.portal.UI.v3.comptdesign.compt.BaseComptPanel;
import com.vci.client.portal.UI.v3.comptdesign.compt.popupcompt.BasePopupDialog;
import com.vci.client.portal.UI.v3.comptdesign.compt.popupcompt.PortalVIPopupDialog;
import com.vci.client.portal.platformPortal.TableDialog;
import com.vci.client.portal.utility.UITools;
import com.vci.client.ui.swing.components.VCIJTextField;
import com.vci.common.portal.enums.PortalVIType;
import com.vci.common.portal.enums.PortalVITypeFlag;
import com.vci.corba.common.VCIError;
import com.vci.corba.portal.data.PortalVI;
 
public class PortalVIEditActionListener extends BaseActionListener<PortalVIPopupDialog> {
 
    /**
     * 待编辑的表单所在的 链接类型 或业务类型 txt 控件
     */
    private VCIJTextField txtBtmLinkType = null;
    /**
     * 待编辑的表单类型(表单 或 表格)
     */
    private PortalVIType portalVIType = null;
    /**
     * 待编辑的表单TypeFlag(链接类型 或 业务类型)
     */
    private PortalVITypeFlag portalVITypeFlag = null;
    
    public PortalVIEditActionListener(
            BaseComptPanel ownedComptPanel,
            UIComptDesignDialog ownedUIComptDesignDialog, 
            VCIJTextField txt,
            List<VCIJTextField> clearTxts,
 
            VCIJTextField txtBtmLinkType,
            PortalVIType portalVIType,
            PortalVITypeFlag portalVITypeFlag
            ){
        super(ownedComptPanel, ownedUIComptDesignDialog, txt, clearTxts);
        
        this.txtBtmLinkType = txtBtmLinkType;
        this.portalVIType = portalVIType;
        this.portalVITypeFlag = portalVITypeFlag;
    }
    
    
    @Override
    public void actionPerformed(ActionEvent e) {
        super.actionPerformed(e);
        
        String viName = getTxt().getText().trim();
        if("".equals(viName)){
            return;
        }
        if(txtBtmLinkType == null){
            return;
        }
        String type = txtBtmLinkType.getText().trim();
        if("".equals(type)){
            return;
        }
        
        try{
            PortalVI vi = UITools.getService().getPortalVIByTypeNameAndVIName(type, viName);
            Object treeNode = null;
             if(this.portalVITypeFlag == PortalVITypeFlag.LinkType){
                treeNode = new LinkTypeWrapper(LinkTypeStart.getService().getLinkType(type));
            } else if(this.portalVITypeFlag == PortalVITypeFlag.BtmType){
                treeNode = new BtmItemWrapper(BtmClient.getService().getBtmItemByName(type));
            }
            if(this.portalVIType == PortalVIType.Form){
                FormDesignDialog dt = new FormDesignDialog(
                        treeNode, portalVIType, vi, true, null, PortalVITypeFlag.getByIntVal(vi.typeFlag), true);
                dt.setVisible(true);
            } else if(this.portalVIType == PortalVIType.Table){
                TableDialog dialog = new TableDialog(
                        vi, treeNode, portalVIType, true, null, PortalVITypeFlag.getByIntVal(vi.typeFlag), true);
                dialog.setVisible(true);
            }
        
        } catch(VCIError ex){
            ex.printStackTrace();
        }
    }
 
 
    @Override
    protected BasePopupDialog getBtnActionShowPopupDialog() {
        // TODO Auto-generated method stub
        return null;
    }
 
    @Override
    protected Runnable getBtnActionShowPopupDialogCallback(
            PortalVIPopupDialog popupDialog) {
        // TODO Auto-generated method stub
        return null;
    }
 
    public VCIJTextField getTxtBtmLinkType() {
        return txtBtmLinkType;
    }
 
    public void setTxtBtmLinkType(VCIJTextField txtBtmLinkType) {
        this.txtBtmLinkType = txtBtmLinkType;
    }
 
    public PortalVIType getPortalVIType() {
        return portalVIType;
    }
 
    public void setPortalVIType(PortalVIType portalVIType) {
        this.portalVIType = portalVIType;
    }
 
    public PortalVITypeFlag getPortalVITypeFlag() {
        return portalVITypeFlag;
    }
 
    public void setPortalVITypeFlag(PortalVITypeFlag portalVITypeFlag) {
        this.portalVITypeFlag = portalVITypeFlag;
    }
    
}