1 package com.genimen.djeneric.tools.specifier.dialogs; 2 3 import java.awt.BorderLayout ; 4 import java.awt.Dimension ; 5 import java.awt.Frame ; 6 import java.awt.Toolkit ; 7 import java.awt.event.ActionEvent ; 8 import java.awt.event.ActionListener ; 9 10 import javax.swing.ButtonGroup ; 11 import javax.swing.JButton ; 12 import javax.swing.JCheckBox ; 13 import javax.swing.JDialog ; 14 import javax.swing.JLabel ; 15 import javax.swing.JPanel ; 16 17 import com.genimen.djeneric.language.Messages; 18 import com.genimen.djeneric.ui.DjVerticalFlowLayout; 19 import com.genimen.djeneric.ui.Util; 20 import com.genimen.djeneric.util.DjLogger; 21 22 public class ImportOptionsDialog extends JDialog 23 { 24 private static final long serialVersionUID = 1L; 25 JPanel panel1 = new JPanel (); 26 BorderLayout borderLayout1 = new BorderLayout (); 27 JPanel jPanel1 = new JPanel (); 28 BorderLayout borderLayout2 = new BorderLayout (); 29 JPanel jPanel2 = new JPanel (); 30 JButton _butOk = new JButton (); 31 JButton _butCancel = new JButton (); 32 JPanel jPanel3 = new JPanel (); 33 JPanel jPanel4 = new JPanel (); 34 DjVerticalFlowLayout flowLayout1 = new DjVerticalFlowLayout(); 35 DjVerticalFlowLayout flowLayout2 = new DjVerticalFlowLayout(); 36 ButtonGroup _grpSelection = new ButtonGroup (); 37 boolean _wasCanceled = true; 38 JLabel _lblMerge = new JLabel (); 39 JCheckBox _chkMerge = new JCheckBox (); 40 41 public ImportOptionsDialog(Frame owner) 42 { 43 super(owner, Messages.getString("ImportDialog.Options"), true); 44 try 45 { 46 setDefaultCloseOperation(DISPOSE_ON_CLOSE); 47 jbInit(); 48 pack(); 49 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 50 Dimension frameSize = getSize(); 51 setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 52 setVisible(true); 53 54 } 55 catch (Exception x) 56 { 57 DjLogger.log(x); 58 } 59 } 60 61 public boolean wasCanceled() 62 { 63 return _wasCanceled; 64 } 65 66 public ImportOptionsDialog() 67 { 68 this(new Frame ()); 69 } 70 71 private void jbInit() throws Exception 72 { 73 panel1.setLayout(borderLayout1); 74 jPanel1.setLayout(borderLayout2); 75 _butOk.setText(Messages.getString("global.Ok")); 76 _butOk.addActionListener(new ImportOptionsDlg__butOk_actionAdapter(this)); 77 _butCancel.setText(Messages.getString("global.Cancel")); 78 _butCancel.addActionListener(new ImportOptionsDlg__butCancel_actionAdapter(this)); 79 jPanel3.setLayout(flowLayout1); 80 jPanel4.setLayout(flowLayout2); 81 _lblMerge.setText(Messages.getString("ImportDialog.MergeDetails")); 82 _chkMerge.setText(""); 83 _chkMerge.setSelected(true); 84 getContentPane().add(panel1); 85 panel1.add(jPanel1, java.awt.BorderLayout.SOUTH); 86 jPanel1.add(jPanel2, java.awt.BorderLayout.EAST); 87 jPanel2.add(_butCancel); 88 jPanel2.add(_butOk); 89 panel1.add(jPanel3, java.awt.BorderLayout.WEST); 90 jPanel3.add(_lblMerge, null); 91 panel1.add(jPanel4, java.awt.BorderLayout.CENTER); 92 jPanel4.add(_chkMerge, null); 93 Util.sizeButtons(jPanel2); 94 Util.sizeLabels(jPanel3); 95 Util.sizeLabels(jPanel4); 96 } 97 98 public boolean shouldMerge() 99 { 100 return _chkMerge.isSelected(); 101 } 102 103 public void _butOk_actionPerformed(ActionEvent e) 104 { 105 _wasCanceled = false; 106 setVisible(false); 107 } 108 109 public void _butCancel_actionPerformed(ActionEvent e) 110 { 111 setVisible(false); 112 } 113 114 class ImportOptionsDlg__butCancel_actionAdapter implements ActionListener 115 { 116 private ImportOptionsDialog adaptee; 117 118 ImportOptionsDlg__butCancel_actionAdapter(ImportOptionsDialog adaptee) 119 { 120 this.adaptee = adaptee; 121 } 122 123 public void actionPerformed(ActionEvent e) 124 { 125 adaptee._butCancel_actionPerformed(e); 126 } 127 } 128 129 class ImportOptionsDlg__butOk_actionAdapter implements ActionListener 130 { 131 private ImportOptionsDialog adaptee; 132 133 ImportOptionsDlg__butOk_actionAdapter(ImportOptionsDialog adaptee) 134 { 135 this.adaptee = adaptee; 136 } 137 138 public void actionPerformed(ActionEvent e) 139 { 140 adaptee._butOk_actionPerformed(e); 141 } 142 } 143 } | Popular Tags |