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(); } } }