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.JDialog ; 13 import javax.swing.JLabel ; 14 import javax.swing.JPanel ; 15 import javax.swing.JRadioButton ; 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 ExportOptionsDialog 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 JLabel _lblSelected = new JLabel (); 37 JLabel jLabel1 = new JLabel (); 38 JRadioButton _radSelected = new JRadioButton (); 39 JRadioButton _radIncludingChildren = new JRadioButton (); 40 ButtonGroup _grpSelection = new ButtonGroup (); 41 boolean _wasCanceled = true; 42 43 public ExportOptionsDialog(Frame owner) 44 { 45 super(owner, Messages.getString("ObjectExporter.Options"), true); 46 try 47 { 48 setDefaultCloseOperation(DISPOSE_ON_CLOSE); 49 jbInit(); 50 pack(); 51 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 52 Dimension frameSize = getSize(); 53 setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 54 setVisible(true); 55 56 } 57 catch (Exception x) 58 { 59 DjLogger.log(x); 60 } 61 } 62 63 public boolean wasCanceled() 64 { 65 return _wasCanceled; 66 } 67 68 public ExportOptionsDialog() 69 { 70 this(new Frame ()); 71 } 72 73 private void jbInit() throws Exception 74 { 75 panel1.setLayout(borderLayout1); 76 jPanel1.setLayout(borderLayout2); 77 _butOk.setText(Messages.getString("global.Ok")); 78 _butOk.addActionListener(new ExportOptionsDlg__butOk_actionAdapter(this)); 79 _butCancel.setText(Messages.getString("global.Cancel")); 80 _butCancel.addActionListener(new ExportOptionsDlg__butCancel_actionAdapter(this)); 81 jPanel3.setLayout(flowLayout1); 82 jPanel4.setLayout(flowLayout2); 83 _lblSelected.setText(Messages.getString("ObjectExporter.SelectedOnly")); 84 jLabel1.setText(Messages.getString("ObjectExporter.SelectedWithChildren")); 85 _radSelected.setSelected(true); 86 getContentPane().add(panel1); 87 panel1.add(jPanel1, java.awt.BorderLayout.SOUTH); 88 jPanel1.add(jPanel2, java.awt.BorderLayout.EAST); 89 jPanel2.add(_butCancel); 90 jPanel2.add(_butOk); 91 panel1.add(jPanel3, java.awt.BorderLayout.WEST); 92 jPanel3.add(_lblSelected); 93 jPanel3.add(jLabel1); 94 panel1.add(jPanel4, java.awt.BorderLayout.CENTER); 95 jPanel4.add(_radSelected); 96 jPanel4.add(_radIncludingChildren); 97 _grpSelection.add(_radSelected); 98 _grpSelection.add(_radIncludingChildren); 99 Util.sizeButtons(jPanel2); 100 Util.sizeLabels(jPanel3); 101 Util.sizeLabels(jPanel4); 102 } 103 104 public void _butOk_actionPerformed(ActionEvent e) 105 { 106 _wasCanceled = false; 107 setVisible(false); 108 } 109 110 public void _butCancel_actionPerformed(ActionEvent e) 111 { 112 setVisible(false); 113 } 114 115 public boolean isIncludingChildren() 116 { 117 return _radIncludingChildren.isSelected(); 118 } 119 } 120 121 class ExportOptionsDlg__butCancel_actionAdapter implements ActionListener 122 { 123 private ExportOptionsDialog adaptee; 124 125 ExportOptionsDlg__butCancel_actionAdapter(ExportOptionsDialog adaptee) 126 { 127 this.adaptee = adaptee; 128 } 129 130 public void actionPerformed(ActionEvent e) 131 { 132 adaptee._butCancel_actionPerformed(e); 133 } 134 } 135 136 class ExportOptionsDlg__butOk_actionAdapter implements ActionListener 137 { 138 private ExportOptionsDialog adaptee; 139 140 ExportOptionsDlg__butOk_actionAdapter(ExportOptionsDialog adaptee) 141 { 142 this.adaptee = adaptee; 143 } 144 145 public void actionPerformed(ActionEvent e) 146 { 147 adaptee._butOk_actionPerformed(e); 148 } 149 } 150 | Popular Tags |