KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > tools > specifier > dialogs > ExportOptionsDialog


1 package com.genimen.djeneric.tools.specifier.dialogs;
2
3 import java.awt.BorderLayout JavaDoc;
4 import java.awt.Dimension JavaDoc;
5 import java.awt.Frame JavaDoc;
6 import java.awt.Toolkit JavaDoc;
7 import java.awt.event.ActionEvent JavaDoc;
8 import java.awt.event.ActionListener JavaDoc;
9
10 import javax.swing.ButtonGroup JavaDoc;
11 import javax.swing.JButton JavaDoc;
12 import javax.swing.JDialog JavaDoc;
13 import javax.swing.JLabel JavaDoc;
14 import javax.swing.JPanel JavaDoc;
15 import javax.swing.JRadioButton JavaDoc;
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 JavaDoc
23 {
24   private static final long serialVersionUID = 1L;
25   JPanel JavaDoc panel1 = new JPanel JavaDoc();
26   BorderLayout JavaDoc borderLayout1 = new BorderLayout JavaDoc();
27   JPanel JavaDoc jPanel1 = new JPanel JavaDoc();
28   BorderLayout JavaDoc borderLayout2 = new BorderLayout JavaDoc();
29   JPanel JavaDoc jPanel2 = new JPanel JavaDoc();
30   JButton JavaDoc _butOk = new JButton JavaDoc();
31   JButton JavaDoc _butCancel = new JButton JavaDoc();
32   JPanel JavaDoc jPanel3 = new JPanel JavaDoc();
33   JPanel JavaDoc jPanel4 = new JPanel JavaDoc();
34   DjVerticalFlowLayout flowLayout1 = new DjVerticalFlowLayout();
35   DjVerticalFlowLayout flowLayout2 = new DjVerticalFlowLayout();
36   JLabel JavaDoc _lblSelected = new JLabel JavaDoc();
37   JLabel JavaDoc jLabel1 = new JLabel JavaDoc();
38   JRadioButton JavaDoc _radSelected = new JRadioButton JavaDoc();
39   JRadioButton JavaDoc _radIncludingChildren = new JRadioButton JavaDoc();
40   ButtonGroup JavaDoc _grpSelection = new ButtonGroup JavaDoc();
41   boolean _wasCanceled = true;
42
43   public ExportOptionsDialog(Frame JavaDoc owner)
44   {
45     super(owner, Messages.getString("ObjectExporter.Options"), true);
46     try
47     {
48       setDefaultCloseOperation(DISPOSE_ON_CLOSE);
49       jbInit();
50       pack();
51       Dimension JavaDoc screenSize = Toolkit.getDefaultToolkit().getScreenSize();
52       Dimension JavaDoc frameSize = getSize();
53       setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
54       setVisible(true);
55
56     }
57     catch (Exception JavaDoc 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 JavaDoc());
71   }
72
73   private void jbInit() throws Exception JavaDoc
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 JavaDoc e)
105   {
106     _wasCanceled = false;
107     setVisible(false);
108   }
109
110   public void _butCancel_actionPerformed(ActionEvent JavaDoc 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 JavaDoc
122 {
123   private ExportOptionsDialog adaptee;
124
125   ExportOptionsDlg__butCancel_actionAdapter(ExportOptionsDialog adaptee)
126   {
127     this.adaptee = adaptee;
128   }
129
130   public void actionPerformed(ActionEvent JavaDoc e)
131   {
132     adaptee._butCancel_actionPerformed(e);
133   }
134 }
135
136 class ExportOptionsDlg__butOk_actionAdapter implements ActionListener JavaDoc
137 {
138   private ExportOptionsDialog adaptee;
139
140   ExportOptionsDlg__butOk_actionAdapter(ExportOptionsDialog adaptee)
141   {
142     this.adaptee = adaptee;
143   }
144
145   public void actionPerformed(ActionEvent JavaDoc e)
146   {
147     adaptee._butOk_actionPerformed(e);
148   }
149 }
150
Popular Tags