1 30 package com.genimen.djeneric.tools.modeler.dialogs; 31 32 import java.awt.BorderLayout ; 33 import java.awt.Dimension ; 34 import java.awt.Frame ; 35 import java.awt.Toolkit ; 36 import java.awt.event.ActionEvent ; 37 import java.util.ArrayList ; 38 import java.util.Arrays ; 39 40 import javax.swing.JButton ; 41 import javax.swing.JDialog ; 42 import javax.swing.JPanel ; 43 import javax.swing.JTabbedPane ; 44 45 import com.genimen.djeneric.language.Messages; 46 import com.genimen.djeneric.structure.EditorDefinition; 47 import com.genimen.djeneric.structure.ResourceDefinition; 48 import com.genimen.djeneric.structure.ScriptDefinition; 49 import com.genimen.djeneric.ui.Util; 50 import com.genimen.djeneric.util.DjLogger; 51 52 public class MergeViewDialog extends JDialog 53 { 54 private static final long serialVersionUID = 1L; 55 JPanel panel1 = new JPanel (); 56 BorderLayout borderLayout1 = new BorderLayout (); 57 JPanel jPanel1 = new JPanel (); 58 JButton _butOk = new JButton (); 59 JPanel jPanel4 = new JPanel (); 60 BorderLayout borderLayout2 = new BorderLayout (); 61 JButton _butCancel = new JButton (); 62 BorderLayout borderLayout3 = new BorderLayout (); 63 JPanel jPanel3 = new JPanel (); 64 boolean _canceled = true; 65 JTabbedPane jTabbedPane1 = new JTabbedPane (); 66 SelectionPanel _pnlEditors = new SelectionPanel(); 67 SelectionPanel _pnlResources = new SelectionPanel(); 68 SelectionPanel _pnlScripts = new SelectionPanel(); 69 70 public MergeViewDialog(Frame frame, EditorDefinition[] editors, ResourceDefinition[] resources, 71 ScriptDefinition[] scripts) 72 { 73 super(frame, Messages.getString("MergeViewDialog.MergeView"), true); try 75 { 76 jbInit(); 77 _pnlEditors.setAvailable(Arrays.asList(editors)); 78 _pnlResources.setAvailable(Arrays.asList(resources)); 79 _pnlScripts.setAvailable(Arrays.asList(scripts)); 80 81 setSize(new Dimension (544, 400)); 82 83 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 84 Dimension frameSize = getSize(); 85 setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 86 87 setVisible(true); 88 } 89 catch (Exception ex) 90 { 91 DjLogger.log(ex); 92 } 93 } 94 95 public ArrayList getSelectedEditors() 96 { 97 return _pnlEditors.getSelection(); 98 } 99 100 public ArrayList getSelectedResources() 101 { 102 return _pnlResources.getSelection(); 103 } 104 105 public ArrayList getSelectedScripts() 106 { 107 return _pnlScripts.getSelection(); 108 } 109 110 private void jbInit() throws Exception 111 { 112 panel1.setLayout(borderLayout1); 113 jPanel1.setLayout(borderLayout2); 114 _butOk.setText(Messages.getString("global.Ok")); _butOk.addActionListener(new java.awt.event.ActionListener () 116 { 117 public void actionPerformed(ActionEvent e) 118 { 119 _butOk_actionPerformed(e); 120 } 121 }); 122 _butCancel.setText(Messages.getString("global.Cancel")); _butCancel.addActionListener(new java.awt.event.ActionListener () 124 { 125 public void actionPerformed(ActionEvent e) 126 { 127 _butCancel_actionPerformed(e); 128 } 129 }); 130 jPanel3.setLayout(borderLayout3); 131 getContentPane().add(panel1); 132 panel1.add(jPanel1, BorderLayout.SOUTH); 133 jPanel1.add(jPanel3, BorderLayout.SOUTH); 134 jPanel3.add(jPanel4, BorderLayout.EAST); 135 jPanel4.add(_butCancel, null); 136 jPanel4.add(_butOk, null); 137 panel1.add(jTabbedPane1, BorderLayout.CENTER); 138 jTabbedPane1.add(_pnlEditors, Messages.getString("MergeViewDialog.Editors")); jTabbedPane1.add(_pnlResources, Messages.getString("MergeViewDialog.Resources")); jTabbedPane1.add(_pnlScripts, Messages.getString("MergeViewDialog.Scripts")); Util.sizeButtons(jPanel4); 142 } 143 144 public boolean wasCanceled() 145 { 146 return _canceled; 147 } 148 149 void _butCancel_actionPerformed(ActionEvent e) 150 { 151 setVisible(false); 152 } 153 154 void _butOk_actionPerformed(ActionEvent e) 155 { 156 _canceled = false; 157 setVisible(false); 158 } 159 160 } | Popular Tags |