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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
package com.vci.client.portal.UI.v3.comptdesign.compt;
 
import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
 
import javax.swing.ButtonGroup;
 
import com.vci.client.portal.UI.v3.comptdesign.UIComptDesignDialog;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.BtmTypeChooseActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.BtmTypeEditActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.LinkTypeChooseActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.LinkTypeEditActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.PortalVIChooseActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.PortalVIEditActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.QTChooseActionListener;
import com.vci.client.portal.UI.v3.comptdesign.compt.al.QTEditActionListener;
import com.vci.client.portal.utility.PLDefination;
import com.vci.client.ui.swing.VCISwingUtil;
import com.vci.client.ui.swing.components.VCIJButton;
import com.vci.client.ui.swing.components.VCIJLabel;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.VCIJRadioButton;
import com.vci.client.ui.swing.components.VCIJScrollPane;
import com.vci.client.ui.swing.components.VCIJTextField;
import com.vci.common.portal.enums.PortalVIType;
import com.vci.common.portal.enums.PortalVITypeFlag;
 
/**
 * 表格组件面板
 * 
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: VCI</p>
 * @author xiongchao
 * @time 2017-2-22
 * @version 1.0
 */
public class TableComptPanel extends BaseComptPanel {
 
    /**
     * 
     */
    private static final long serialVersionUID = -4327897738306488347L;
    
    private VCIJLabel lblSearchType = new VCIJLabel("搜索类型");
    private ButtonGroup searchTypeGroup = new ButtonGroup();
    private VCIJRadioButton rbtnBtmType = new VCIJRadioButton("本对象属性");
    private VCIJRadioButton rbtnLinkType = new VCIJRadioButton("关联对象属性");
 
    protected PortalVIType getPortalVIType(){
        return PortalVIType.Table;
    }
    
    /************************  关联对象 BtmType ********************************/
    private VCIJPanel palBtmType = new VCIJPanel();
    private VCIJLabel lblBtmType = new VCIJLabel("源对象");
    private VCIJTextField txtBtmType = new VCIJTextField(true);
    private VCIJButton btnBtmType = VCISwingUtil.createVCIJButton("btmType", "", "", "search.png");
    private VCIJButton btnBtmTypeEdit = VCISwingUtil.createVCIJButton("btmTypeEdit", "", "", "edit.png");
    
    private VCIJLabel lblChoosePortalVI = new VCIJLabel("选择模板");
    private VCIJTextField txtChoosePortalVI = new VCIJTextField(true);
    private VCIJButton btnChoosePortalVI = VCISwingUtil.createVCIJButton("choosePortalVI", "", "", "search.png");
    private VCIJButton btnChoosePortalVIEdit = VCISwingUtil.createVCIJButton("choosePortalVIEdit", "", "", "edit.png");
    
    private VCIJLabel lblQueryTemplateName = new VCIJLabel("查询模板");
    private VCIJTextField txtQueryTemplateName = new VCIJTextField(false);
    private VCIJButton btnChooseQT = VCISwingUtil.createVCIJButton("choosePortalVI", "", "", "search.png");
    private VCIJButton btnChooseQTEdit = VCISwingUtil.createVCIJButton("choosePortalVIEdit", "", "", "edit.png");
    
    /************************  关联对象 LinkType ********************************/
    private VCIJPanel palLinkType = new VCIJPanel();
    private VCIJLabel lblBtmTypeTarget = new VCIJLabel("目标对象");
    private VCIJTextField txtBtmTypeTarget = new VCIJTextField(true);
    private VCIJButton btnBtmTypeTarget = VCISwingUtil.createVCIJButton("btmTypeTarget", "", "", "search.png");
    private VCIJButton btnBtmTypeTargetEdit = VCISwingUtil.createVCIJButton("btmTypeTargetEdit", "", "", "edit.png");
    
    private VCIJLabel lblLinkType = new VCIJLabel("链接类型");
    private VCIJTextField txtLinkType = new VCIJTextField(true);
    private VCIJButton btnLinkType = VCISwingUtil.createVCIJButton("linkType", "", "", "search.png");
    private VCIJButton btnLinkTypeEdit = VCISwingUtil.createVCIJButton("LinkTypeTargetEdit", "", "", "edit.png");
    
    private VCIJLabel lblChoosePortalVILinkType = new VCIJLabel("选择模板");
    private VCIJTextField txtChoosePortalVILinkType = new VCIJTextField(true);
    private VCIJButton btnChoosePortalVILinkType = VCISwingUtil.createVCIJButton("choosePortalVILinkType", "", "", "search.png");
    private VCIJButton btnChoosePortalVIEditLinkType = VCISwingUtil.createVCIJButton("choosePortalVIEditLinkType", "", "", "edit.png");
    
    private VCIJLabel lblQueryTemplateNameLinkType = new VCIJLabel("查询模板");
    private VCIJTextField txtQueryTemplateNameLinkType = new VCIJTextField(false);
    private VCIJButton btnChooseQTLinkType = VCISwingUtil.createVCIJButton("chooseQTLinkType", "", "", "search.png");
    private VCIJButton btnChooseQTEditLinkType = VCISwingUtil.createVCIJButton("chooseQTEditLinkType", "", "", "edit.png");
    
    private VCIJPanel dynamicContentPanel = new VCIJPanel(new BorderLayout());
    
    public TableComptPanel(UIComptDesignDialog ownedUIComptDesignDialog){
        super(ownedUIComptDesignDialog);
    }
    
    @Override
    public boolean checkInputIsOk(){
        boolean res = false;
        if(rbtnBtmType.isSelected()){
            res = checkBtmTypeInputIsOk();
        } else if(rbtnLinkType.isSelected()){
            res = checkLinkTypeInputIsOk();
        }
        return res;
    }
    
    private boolean checkBtmTypeInputIsOk(){
        boolean res = false;
        if(!(super.checkBtmTypeTxtIsOk(lblBtmType, txtBtmType))){
            res = false;
        } else if(!(super.checkPortalVITxtIsOk(lblChoosePortalVI, txtChoosePortalVI, txtBtmType))){
            res = false;
        } else if(!(super.checkQTNameTxtIsOk(lblQueryTemplateName, txtQueryTemplateName, txtBtmType))){
            res = false;
        } else {
            res = true;
        }
        return res;
    }
    
    private boolean checkLinkTypeInputIsOk(){
        boolean res = false;
        if(!(super.checkBtmTypeTxtIsOk(lblBtmTypeTarget, txtBtmTypeTarget))){
            res = false;
        } else if(!(super.checkPortalVITxtIsOk(lblChoosePortalVILinkType, txtChoosePortalVILinkType, txtLinkType))){
            res = false;
        } else if(!(super.checkQTNameTxtIsOk(lblQueryTemplateNameLinkType, txtQueryTemplateNameLinkType, txtLinkType))){
            res = false;
        } else {
            res = true;
        }
        return res;
    }
    
    @Override
    public void buildPanel(){
        initUI();
    }
    
    private void initUI(){
        init();
    }
    private void init(){
        setLayout(new BorderLayout());
        add(getNorthSearchTypePanel(), BorderLayout.NORTH);
        add(getCenterDynamicContentPanel(), BorderLayout.CENTER);
    }
    private VCIJPanel getNorthSearchTypePanel(){
        VCIJPanel pal = new VCIJPanel(new GridBagLayout());
        
        searchTypeGroup.add(rbtnBtmType);
        searchTypeGroup.add(rbtnLinkType);
        
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.insets = new Insets(5, 10, 0, 5);
        gbc.gridx = 1;
        gbc.gridy = 0;
        pal.add(lblSearchType, gbc);
        
        gbc = new GridBagConstraints();
        gbc.insets = new Insets(5, 8, 0, 5);
        gbc.gridx = 2;
        gbc.gridy = 0;
        pal.add(rbtnBtmType, gbc);
        
        gbc = new GridBagConstraints();
        gbc.insets = new Insets(5, 0, 0, 5);
        gbc.gridx = 3;
        gbc.gridy = 0;
        pal.add(rbtnLinkType, gbc);
        
        gbc = new GridBagConstraints();
        gbc.insets = new Insets(5, 0, 0, 5);
        gbc.gridx = 4;
        gbc.gridy = 0;
        gbc.weightx = 1.0;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        pal.add(new VCIJLabel(), gbc);
 
        ActionListener al = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                rbtn_actionPerformed(e);
            }
        };
        rbtnBtmType.setObj("btm");
        rbtnLinkType.setObj("linktype");
        
        rbtnBtmType.addActionListener(al);
        rbtnLinkType.addActionListener(al);
        
        return pal;
    }
 
    private String lastRbtnType = "";
    
    private void rbtn_actionPerformed(ActionEvent e){
        VCIJRadioButton rbtn = (VCIJRadioButton)e.getSource();
        String rbtnObj = (String)rbtn.getObj();
        if(!"".equals(lastRbtnType) && rbtnObj.equals(lastRbtnType)){
            return;
        }
        super.hidePopupDialog();
        changeDyanmicContentPanel(rbtnObj);
    }
 
    private void changeDyanmicContentPanel(String rbtnObj){
        VCIJPanel pal = new VCIJPanel();
        if(rbtnBtmType.isSelected()){
            pal = palBtmType;
        } else {
            pal = palLinkType;
        }
        dynamicContentPanel.removeAll();
        dynamicContentPanel.add(pal, BorderLayout.CENTER);
        dynamicContentPanel.updateUI();
    }
    
    private VCIJPanel getCenterDynamicContentPanel(){
        dynamicContentPanel = new VCIJPanel(new BorderLayout());
        palBtmType = initBtmTypePanel();
        palLinkType = initLinkTypePanel();
        rbtnBtmType.setSelected(true);
        rbtnBtmType.doClick();
        return dynamicContentPanel;
    }
 
    private VCIJPanel initBtmTypePanel(){
        VCIJPanel pal = new VCIJPanel();
        pal.setLayout(new GridBagLayout());
        
        pal.add(lblBtmType,  new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtBtmType, new GridBagConstraints(2, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 1), 0, 0));
        pal.add(btnBtmType, new GridBagConstraints(3, 0, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnBtmTypeEdit, new GridBagConstraints(4, 0, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 5), 0, 0));
        
        pal.add(lblChoosePortalVI,  new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtChoosePortalVI, new GridBagConstraints(2, 1, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(1, 5, 0, 1), 0, 0));
        pal.add(btnChoosePortalVI, new GridBagConstraints(3, 1, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnChoosePortalVIEdit, new GridBagConstraints(4, 1, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
 
        pal.add(lblQueryTemplateName,  new GridBagConstraints(1, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtQueryTemplateName, new GridBagConstraints(2, 2, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(1, 5, 0, 1), 0, 0));
        pal.add(btnChooseQT, new GridBagConstraints(3, 2, 2, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnChooseQTEdit, new GridBagConstraints(4, 2, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        
        pal.add(new VCIJLabel(""), new GridBagConstraints(1, 15, 4, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 0, 0), 0, 0));
        VCIJPanel palRes = new VCIJPanel(new BorderLayout());
        palRes.add(new VCIJScrollPane(pal));
        return palRes;
    }
 
    private VCIJPanel initLinkTypePanel(){
        VCIJPanel pal = new VCIJPanel();
        pal.setLayout(new GridBagLayout());
 
        pal.add(lblBtmTypeTarget,  new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtBtmTypeTarget, new GridBagConstraints(2, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 1), 0, 0));
        pal.add(btnBtmTypeTarget, new GridBagConstraints(3, 0, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnBtmTypeTargetEdit, new GridBagConstraints(4, 0, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 5), 0, 0));
 
        pal.add(lblLinkType,  new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtLinkType, new GridBagConstraints(2, 1, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(1, 5, 0, 1), 0, 0));
        pal.add(btnLinkType, new GridBagConstraints(3, 1, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnLinkTypeEdit, new GridBagConstraints(4, 1, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        
        pal.add(lblChoosePortalVILinkType,  new GridBagConstraints(1, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtChoosePortalVILinkType, new GridBagConstraints(2, 2, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(1, 5, 0, 1), 0, 0));
        pal.add(btnChoosePortalVILinkType, new GridBagConstraints(3, 2, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnChoosePortalVIEditLinkType, new GridBagConstraints(4, 2, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        
        pal.add(lblQueryTemplateNameLinkType,  new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
        pal.add(txtQueryTemplateNameLinkType, new GridBagConstraints(2, 3, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(1, 5, 0, 1), 0, 0));
        pal.add(btnChooseQTLinkType, new GridBagConstraints(3, 3, 2, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        pal.add(btnChooseQTEditLinkType, new GridBagConstraints(4, 3, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 0, 0));
        
        pal.add(new VCIJLabel(""), new GridBagConstraints(1, 14, 4, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0));
        
        VCIJPanel palRes = new VCIJPanel(new BorderLayout());
        palRes.add(new VCIJScrollPane(pal));
        
        return palRes;
    }
 
    @Override
    protected void initBtmTypeActionListener(){
        BtmTypeChooseActionListener btmTypeChooseActionListener = new BtmTypeChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtBtmType, Arrays.asList(
                        txtChoosePortalVI, txtQueryTemplateName));
        btnBtmType.addActionListener(btmTypeChooseActionListener);
        super.getActions().add(btmTypeChooseActionListener);
        
        PortalVIChooseActionListener portalVIChooseActionListener = new PortalVIChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtChoosePortalVI, null,
                txtBtmType, getPortalVIType());
        btnChoosePortalVI.addActionListener(portalVIChooseActionListener);
        super.getActions().add(portalVIChooseActionListener);
        
        QTChooseActionListener qTChooseActionListener = new QTChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtQueryTemplateName,
                null, txtBtmType);
        btnChooseQT.addActionListener(qTChooseActionListener);
        super.getActions().add(qTChooseActionListener);
        
        //------------------------------------------------------------------------------
        BtmTypeEditActionListener btmTypeEditActionListener = new BtmTypeEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtBtmType, null);
        btnBtmTypeEdit.addActionListener(btmTypeEditActionListener);
        super.getActions().add(btmTypeEditActionListener);
        
        PortalVIEditActionListener portalVIEditActionListener = new PortalVIEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtChoosePortalVI, null, 
                txtBtmType, getPortalVIType(), PortalVITypeFlag.BtmType);
        btnChoosePortalVIEdit.addActionListener(portalVIEditActionListener);
        super.getActions().add(portalVIEditActionListener);
        
        QTEditActionListener qtEditAction = new QTEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtQueryTemplateName, null);
        btnChooseQTEdit.addActionListener(qtEditAction);
        super.getActions().add(qtEditAction);
    }
 
    @Override
    protected void initLinkTypeActionListener(){
        BtmTypeChooseActionListener btmTypeChooseActionListener = new BtmTypeChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtBtmTypeTarget,
                Arrays.asList(txtLinkType, txtChoosePortalVILinkType,
                        txtQueryTemplateNameLinkType));
        btnBtmTypeTarget.addActionListener(btmTypeChooseActionListener);
        super.getActions().add(btmTypeChooseActionListener);
        
        LinkTypeChooseActionListener linkTypeChooseActionListener = new LinkTypeChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtLinkType,
                Arrays.asList(txtChoosePortalVILinkType, txtQueryTemplateNameLinkType), txtBtmTypeTarget);
        btnLinkType.addActionListener(linkTypeChooseActionListener);
        super.getActions().add(linkTypeChooseActionListener);
        
        PortalVIChooseActionListener portalVIChooseActionListener = new PortalVIChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtChoosePortalVILinkType, null, 
                txtLinkType, getPortalVIType());
        btnChoosePortalVILinkType.addActionListener(portalVIChooseActionListener);
        super.getActions().add(portalVIChooseActionListener);
        
        QTChooseActionListener qTChooseActionListener = new QTChooseActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtQueryTemplateNameLinkType,
                null, txtLinkType);
        btnChooseQTLinkType.addActionListener(qTChooseActionListener);
        super.getActions().add(qTChooseActionListener);
        
        //-----------------------------------------------------------------
        BtmTypeEditActionListener btmTypeEditActionListener = new BtmTypeEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtBtmTypeTarget, null);
        btnBtmTypeTargetEdit.addActionListener(btmTypeEditActionListener);
        super.getActions().add(btmTypeEditActionListener);
        
        LinkTypeEditActionListener linkTypeEditActionListener = new LinkTypeEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtLinkType, 
                null);
        btnLinkTypeEdit.addActionListener(linkTypeEditActionListener);
        super.getActions().add(linkTypeEditActionListener);
        
        PortalVIEditActionListener portalVIEditActionListener = new PortalVIEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtChoosePortalVILinkType, null, 
                txtLinkType, getPortalVIType(), PortalVITypeFlag.LinkType);
        btnChoosePortalVIEditLinkType.addActionListener(portalVIEditActionListener);
        super.getActions().add(portalVIEditActionListener);
        
        QTEditActionListener qtEditAction = new QTEditActionListener(
                this, super.getOwnedUIComptDesignDialog(), txtQueryTemplateNameLinkType, null);
        btnChooseQTEditLinkType.addActionListener(qtEditAction);
        super.getActions().add(qtEditAction);
    }
    
    @Override
    public void setDataToUISpec(PLDefination d) {
        if("1".equals(d.getSearchTarger())){
            rbtnBtmType.setSelected(true);
            rbtnBtmType.doClick();
            
            txtBtmType.setText(d.getShowType());
            txtChoosePortalVI.setText(d.getTemplateId());
            txtQueryTemplateName.setText(d.getQueryTemplateName());
            
        } else if("2".equals(d.getSearchTarger())){
            rbtnLinkType.setSelected(true);
            rbtnLinkType.doClick();
            
            txtBtmTypeTarget.setText(d.getShowType());
            txtLinkType.setText(d.getLinkType());
            txtChoosePortalVILinkType.setText(d.getTemplateId());
            txtQueryTemplateNameLinkType.setText(d.getQueryTemplateName());
        }
    }
 
    @Override
    public PLDefination getNewPLDefination(PLDefination d) {
        if(d == null){
            d = new PLDefination();
        }
        if(rbtnBtmType.isSelected()){
            d.setSearchTarger("1");
            d.setShowType(txtBtmType.getText().toString().trim());
            d.setTemplateId(txtChoosePortalVI.getText().toString().trim());
            d.setQueryTemplateName(txtQueryTemplateName.getText().toString().trim());
            
        } else if(rbtnLinkType.isSelected()){
            d.setSearchTarger("2");
 
            d.setShowType(txtBtmTypeTarget.getText().toString());
            d.setLinkType(txtLinkType.getText().toString());
            d.setTemplateId(txtChoosePortalVILinkType.getText().toString());
            d.setQueryTemplateName(txtQueryTemplateNameLinkType.getText().toString());
        }
        
        return d;
    }
}