package com.vci.client.portal.UI; import java.awt.BorderLayout; import java.awt.Component; import java.awt.FlowLayout; 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.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.border.EmptyBorder; import javax.swing.tree.TreePath; import org.apache.commons.lang3.StringUtils; import com.vci.client.LogonApplication; import com.vci.client.framework.rightConfig.modelConfig.ModuleTreeCellRenderer; import com.vci.client.portal.NewUI.UICloneDestDialog; import com.vci.client.portal.utility.UITools; import com.vci.client.ui.swing.VCIOptionPane; import com.vci.client.ui.tree.CheckBoxTreeManager; import com.vci.client.ui.tree.VCIBaseTree; import com.vci.client.ui.tree.VCIBaseTreeModel; import com.vci.client.ui.tree.VCIBaseTreeNode; import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.VCIError; import com.vci.corba.omd.btm.BtmItem; import com.vci.corba.portal.data.PLCommandParameter; import com.vci.corba.portal.data.PLPageDefination; import com.vci.corba.portal.data.PLUILayout; import com.vci.corba.portal.data.PLTabButton; import com.vci.corba.portal.data.PLTabPage; public class CloneDialog extends JDialog { /** * */ private static final long serialVersionUID = 1L; private final JPanel contentPanel = new JPanel(); private VCIBaseTree tree; private VCIBaseTreeModel treeModel; private CheckBoxTreeManager treeManager; private VCIBaseTreeNode rootNode; private JScrollPane scrollPane ; private JTree btTree; private String btname; //add by guo //private boolean isExist = true; //private int num = 0; private String plUILayoutId= ""; List nodeList = new ArrayList(); //private boolean cloasflag = false; //by zhangxg private Object clonedestObject; private JTextField textField; private PLUILayout plUILayout; private JPanel jpanel; private JLabel label; private JTextField plcode; private JLabel label_1; private JTextField plname; private JLabel label_2; private PLUILayout[] plUILayouts; // public boolean isCloasflag() { // return cloasflag; // } // // public void setCloasflag(boolean cloasflag) { // this.cloasflag = cloasflag; // } /** * Create the dialog. */ public CloneDialog(JTree btTree, PLUILayout plUILayout) { super(LogonApplication.frame,true); this.btTree = btTree; this.plUILayout=plUILayout; init(); // initTreeNode(); initCloneView(); this.setLocationRelativeTo(null); } private void init() { setLocationRelativeTo(LogonApplication.frame); setSize(400, 150); //by zhangxg //28 getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[]{0, 0, 0, 0, 0, 0}; gbl_contentPanel.rowHeights = new int[]{0, 0, 0, 0}; gbl_contentPanel.columnWeights = new double[]{0.0, 0.0, 1.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_contentPanel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE}; contentPanel.setLayout(gbl_contentPanel); { label_2 = new JLabel("克隆目标"); GridBagConstraints gbc_label_2 = new GridBagConstraints(); gbc_label_2.insets = new Insets(0, 0, 5, 5); gbc_label_2.gridx = 1; gbc_label_2.gridy = 0; contentPanel.add(label_2, gbc_label_2); } { textField = new JTextField(); textField.setFocusable(false); textField.setEditable(false); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.fill = GridBagConstraints.HORIZONTAL; gbc_textField.insets = new Insets(0, 0, 0, 5); gbc_textField.gridx = 2; gbc_textField.gridy = 0; contentPanel.add(textField, gbc_textField); textField.setColumns(10); } { JButton clonedestbutton = new JButton("克隆目标"); clonedestbutton.setToolTipText("*如果选择克隆目标,则克隆到选择的类型下,如果没有选择克隆目标,则克隆到当前类型下"); GridBagConstraints gbc_clonedestbutton = new GridBagConstraints(); gbc_clonedestbutton.anchor = GridBagConstraints.NORTH; gbc_clonedestbutton.gridx = 3; gbc_clonedestbutton.gridy = 0; contentPanel.add(clonedestbutton, gbc_clonedestbutton); clonedestbutton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { UICloneDestDialog clonedestdia = new UICloneDestDialog(); clonedestdia.setVisible(true); clonedestObject = clonedestdia.getTreeObject(); if(clonedestObject instanceof BtmItem){ textField.setText(((BtmItem)clonedestObject).name); } } }); } { label = new JLabel("UI名称 "); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.insets = new Insets(0, 0, 5, 5); gbc_label.anchor = GridBagConstraints.EAST; gbc_label.gridx = 1; gbc_label.gridy = 1; contentPanel.add(label, gbc_label); } { plname = new JTextField(); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.fill = GridBagConstraints.HORIZONTAL; gbc_textField.insets = new Insets(0, 0, 5, 5); gbc_textField.gridx = 2; gbc_textField.gridy = 1; gbc_textField.gridwidth = 2; contentPanel.add(plname, gbc_textField); plname.setColumns(40); } { label_1 = new JLabel("UI上下文"); GridBagConstraints gbc_label_1 = new GridBagConstraints(); gbc_label_1.anchor = GridBagConstraints.EAST; gbc_label_1.insets = new Insets(0, 0, 5, 5); gbc_label_1.gridx = 1; gbc_label_1.gridy = 2; contentPanel.add(label_1, gbc_label_1); } { plcode = new JTextField(); GridBagConstraints gbc_textField_1 = new GridBagConstraints(); gbc_textField_1.insets = new Insets(0, 0, 5, 0); gbc_textField_1.fill = GridBagConstraints.HORIZONTAL; gbc_textField_1.gridx = 2; gbc_textField_1.gridy = 2; gbc_textField_1.gridwidth = 2; contentPanel.add(plcode, gbc_textField_1); plcode.setColumns(40); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("确定"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // Component[] components = contentPanel.getComponents(); // String[] nameCode =new String[components.length]; // for (int i=0;i lstCode = new ArrayList(); List lstName = new ArrayList(); for (int i =0;i