1 | package hozo.sparql.gui;
|
---|
2 |
|
---|
3 | import javax.swing.JPanel;
|
---|
4 | import java.awt.Frame;
|
---|
5 | import javax.swing.JDialog;
|
---|
6 | import java.awt.GridBagLayout;
|
---|
7 | import javax.swing.JLabel;
|
---|
8 | import java.awt.GridBagConstraints;
|
---|
9 | import javax.swing.JTextField;
|
---|
10 | import java.awt.Insets;
|
---|
11 | import java.awt.event.ActionEvent;
|
---|
12 | import java.awt.event.ActionListener;
|
---|
13 |
|
---|
14 | import javax.swing.JButton;
|
---|
15 |
|
---|
16 | import com.ibm.icu.text.SimpleDateFormat;
|
---|
17 |
|
---|
18 | import hozo.sparql.util.Version;
|
---|
19 | import hozo.sparql.CoreVersion;
|
---|
20 |
|
---|
21 | public class VersionDialog extends JDialog {
|
---|
22 |
|
---|
23 | private static final long serialVersionUID = 1L;
|
---|
24 | private JPanel jContentPane = null;
|
---|
25 | private JLabel coreVersionLabel = null;
|
---|
26 | private JLabel guiVersionLabel = null;
|
---|
27 | private JTextField coreVersionTextField = null;
|
---|
28 | private JTextField coreVersionDateTextField = null;
|
---|
29 | private JTextField guiVersionTextField = null;
|
---|
30 | private JTextField guiVersionDateTextField = null;
|
---|
31 | private JButton okButton = null;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @param owner
|
---|
35 | */
|
---|
36 | public VersionDialog(Frame owner) {
|
---|
37 | super(owner);
|
---|
38 | initialize();
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * This method initializes this
|
---|
43 | *
|
---|
44 | * @return void
|
---|
45 | */
|
---|
46 | private void initialize() {
|
---|
47 | this.setSize(401, 151);
|
---|
48 | this.setContentPane(getJContentPane());
|
---|
49 | this.setResizable(false);
|
---|
50 | this.setModal(true);
|
---|
51 | this.setTitle("Version Info");
|
---|
52 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
---|
53 |
|
---|
54 | Version cv = new CoreVersion();
|
---|
55 |
|
---|
56 | this.getCoreVersionTextField().setText(cv.getVersion());
|
---|
57 | this.getCoreVersionDateTextField().setText(sdf.format(cv.getDate()));
|
---|
58 |
|
---|
59 | GUIVersion gv = new GUIVersion();
|
---|
60 | this.getGuiVersionTextField().setText(gv.getVersion());
|
---|
61 | this.getGuiVersionDateTextField().setText(sdf.format(gv.getDate()));
|
---|
62 |
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * This method initializes jContentPane
|
---|
68 | *
|
---|
69 | * @return javax.swing.JPanel
|
---|
70 | */
|
---|
71 | private JPanel getJContentPane() {
|
---|
72 | if (jContentPane == null) {
|
---|
73 | GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
|
---|
74 | gridBagConstraints6.gridx = 2;
|
---|
75 | gridBagConstraints6.insets = new Insets(20, 0, 0, 20);
|
---|
76 | gridBagConstraints6.anchor = GridBagConstraints.EAST;
|
---|
77 | gridBagConstraints6.gridy = 2;
|
---|
78 | GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
|
---|
79 | gridBagConstraints5.fill = GridBagConstraints.BOTH;
|
---|
80 | gridBagConstraints5.gridy = 1;
|
---|
81 | gridBagConstraints5.weightx = 1.0;
|
---|
82 | gridBagConstraints5.insets = new Insets(10, 10, 0, 10);
|
---|
83 | gridBagConstraints5.gridx = 2;
|
---|
84 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
|
---|
85 | gridBagConstraints4.fill = GridBagConstraints.BOTH;
|
---|
86 | gridBagConstraints4.gridy = 1;
|
---|
87 | gridBagConstraints4.weightx = 1.0;
|
---|
88 | gridBagConstraints4.insets = new Insets(10, 10, 0, 0);
|
---|
89 | gridBagConstraints4.gridx = 1;
|
---|
90 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
|
---|
91 | gridBagConstraints3.fill = GridBagConstraints.BOTH;
|
---|
92 | gridBagConstraints3.gridy = 0;
|
---|
93 | gridBagConstraints3.weightx = 1.0;
|
---|
94 | gridBagConstraints3.insets = new Insets(0, 10, 0, 10);
|
---|
95 | gridBagConstraints3.gridx = 2;
|
---|
96 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
|
---|
97 | gridBagConstraints2.fill = GridBagConstraints.BOTH;
|
---|
98 | gridBagConstraints2.gridy = 0;
|
---|
99 | gridBagConstraints2.weightx = 1.0;
|
---|
100 | gridBagConstraints2.insets = new Insets(0, 10, 0, 0);
|
---|
101 | gridBagConstraints2.gridx = 1;
|
---|
102 | GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
|
---|
103 | gridBagConstraints1.gridx = 0;
|
---|
104 | gridBagConstraints1.insets = new Insets(10, 10, 0, 0);
|
---|
105 | gridBagConstraints1.gridy = 1;
|
---|
106 | guiVersionLabel = new JLabel();
|
---|
107 | guiVersionLabel.setText("GUI Version");
|
---|
108 | GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
---|
109 | gridBagConstraints.gridx = 0;
|
---|
110 | gridBagConstraints.insets = new Insets(0, 10, 0, 0);
|
---|
111 | gridBagConstraints.gridy = 0;
|
---|
112 | coreVersionLabel = new JLabel();
|
---|
113 | coreVersionLabel.setText("Core Version");
|
---|
114 | jContentPane = new JPanel();
|
---|
115 | jContentPane.setLayout(new GridBagLayout());
|
---|
116 | jContentPane.add(coreVersionLabel, gridBagConstraints);
|
---|
117 | jContentPane.add(guiVersionLabel, gridBagConstraints1);
|
---|
118 | jContentPane.add(getCoreVersionTextField(), gridBagConstraints2);
|
---|
119 | jContentPane.add(getCoreVersionDateTextField(), gridBagConstraints3);
|
---|
120 | jContentPane.add(getGuiVersionTextField(), gridBagConstraints4);
|
---|
121 | jContentPane.add(getGuiVersionDateTextField(), gridBagConstraints5);
|
---|
122 | jContentPane.add(getOkButton(), gridBagConstraints6);
|
---|
123 | }
|
---|
124 | return jContentPane;
|
---|
125 | }
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * This method initializes coreVersionTextField
|
---|
129 | *
|
---|
130 | * @return javax.swing.JTextField
|
---|
131 | */
|
---|
132 | private JTextField getCoreVersionTextField() {
|
---|
133 | if (coreVersionTextField == null) {
|
---|
134 | coreVersionTextField = new JTextField();
|
---|
135 | coreVersionTextField.setEditable(false);
|
---|
136 | }
|
---|
137 | return coreVersionTextField;
|
---|
138 | }
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * This method initializes coreVersionDateTextField
|
---|
142 | *
|
---|
143 | * @return javax.swing.JTextField
|
---|
144 | */
|
---|
145 | private JTextField getCoreVersionDateTextField() {
|
---|
146 | if (coreVersionDateTextField == null) {
|
---|
147 | coreVersionDateTextField = new JTextField();
|
---|
148 | coreVersionDateTextField.setEditable(false);
|
---|
149 | }
|
---|
150 | return coreVersionDateTextField;
|
---|
151 | }
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * This method initializes guiVersionTextField
|
---|
155 | *
|
---|
156 | * @return javax.swing.JTextField
|
---|
157 | */
|
---|
158 | private JTextField getGuiVersionTextField() {
|
---|
159 | if (guiVersionTextField == null) {
|
---|
160 | guiVersionTextField = new JTextField();
|
---|
161 | guiVersionTextField.setEditable(false);
|
---|
162 | }
|
---|
163 | return guiVersionTextField;
|
---|
164 | }
|
---|
165 |
|
---|
166 | /**
|
---|
167 | * This method initializes guiVersionDateTextField
|
---|
168 | *
|
---|
169 | * @return javax.swing.JTextField
|
---|
170 | */
|
---|
171 | private JTextField getGuiVersionDateTextField() {
|
---|
172 | if (guiVersionDateTextField == null) {
|
---|
173 | guiVersionDateTextField = new JTextField();
|
---|
174 | guiVersionDateTextField.setEditable(false);
|
---|
175 | }
|
---|
176 | return guiVersionDateTextField;
|
---|
177 | }
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * This method initializes okButton
|
---|
181 | *
|
---|
182 | * @return javax.swing.JButton
|
---|
183 | */
|
---|
184 | private JButton getOkButton() {
|
---|
185 | if (okButton == null) {
|
---|
186 | okButton = new JButton("OK");
|
---|
187 | okButton.addActionListener(new ActionListener() {
|
---|
188 |
|
---|
189 | @Override
|
---|
190 | public void actionPerformed(ActionEvent e) {
|
---|
191 | close();
|
---|
192 | }
|
---|
193 | });
|
---|
194 | }
|
---|
195 | return okButton;
|
---|
196 | }
|
---|
197 |
|
---|
198 | private void close(){
|
---|
199 | this.setVisible(false);
|
---|
200 | }
|
---|
201 |
|
---|
202 | } // @jve:decl-index=0:visual-constraint="10,10"
|
---|