yuxc
2025-01-15 c09f81131e8b7c83937206d7cf76f34d2020be75
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
package com.vci.client.workflow.editor.ui;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.InvocationTargetException;
 
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
 
import com.vci.common.resource.CommonProperties;
 
/**
 * 任务描述
 * @author liudi
 *
 * 2012-7-12
 */
public class TrainsitionDescPanel extends JPanel {
    private static final long serialVersionUID = 1300418480939892949L;
    
    private JLabel taskDesLab ;
    private JTextArea taskDesArea;
    
    private JLabel urlLb ;
    private JTextArea urlTextArea;
    
    public JTextArea getUrlTextArea() {
        return urlTextArea;
    }
 
    public void setUrlTextArea(String value) {
        urlTextArea.setText(value);
    }
 
    public String getTaskDesArea() {
        return taskDesArea.getText();
    }
 
    public void setTaskDesArea(String value) {
        taskDesArea.setText(value);
    }
 
    public TrainsitionDescPanel() {
        initUI();
    }
 
    private void initUI() {
        setLayout(new BorderLayout());
        JPanel northPanel = new JPanel();
        urlLb =  new JLabel("功能:");
        urlLb.setPreferredSize(new Dimension(100,25));
        northPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        urlTextArea = new JTextArea();
        urlTextArea.setLineWrap(true);
        JScrollPane urlJsp = new JScrollPane();
        urlJsp.getViewport().add(urlTextArea);
        urlJsp.setPreferredSize(new Dimension(800,50));
        northPanel.add(urlLb);
        northPanel.add(urlJsp);
        
//        JPanel centerPanel = new JPanel();
//        centerPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
//        taskDesLab = new JLabel("功能描述:");
//        taskDesLab.setPreferredSize(new Dimension(100,25));
//        taskDesArea = new JTextArea();
//        taskDesArea.setLineWrap(true);
//        JScrollPane jsp = new JScrollPane();
//        jsp.getViewport().add(taskDesArea);
//        jsp.setPreferredSize(new Dimension(800,50));
//        centerPanel.add(taskDesLab);
//        centerPanel.add(jsp);
        
        final String urlDialogControl = CommonProperties.getStringProperty("workflow.trainsitionUrlDialog");
        if(urlDialogControl!=null&&!"".equals(urlDialogControl)){
            JButton addBtn = new JButton("添加");
            addBtn.addActionListener(new ActionListener() {
                
                public void actionPerformed(ActionEvent actionEvent) {
                    selectUrlDialog(urlDialogControl);
                }
 
                
            });
            northPanel.add(addBtn);
        }
        add(northPanel,BorderLayout.NORTH);
//        add(centerPanel,BorderLayout.CENTER);
    }
    
    private void selectUrlDialog(final String urlDialogControl) {
        Class<?> cls;
        try {
            cls = Class.forName(urlDialogControl);
            JDialog res;
            try {
                res = (JDialog) cls.getConstructor(TrainsitionDescPanel.class).newInstance(this);
                res.setLocationRelativeTo(null);
                res.setVisible(true);
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}