1 | package hozo.sparql.gui;
|
---|
2 |
|
---|
3 | import javax.swing.JPanel;
|
---|
4 |
|
---|
5 | import java.awt.FlowLayout;
|
---|
6 | import java.awt.Frame;
|
---|
7 | import java.awt.BorderLayout;
|
---|
8 | import javax.swing.JDialog;
|
---|
9 | import java.awt.GridBagLayout;
|
---|
10 |
|
---|
11 | import javax.swing.ButtonGroup;
|
---|
12 | import javax.swing.JButton;
|
---|
13 | import javax.swing.JTextField;
|
---|
14 | import java.awt.GridBagConstraints;
|
---|
15 | import javax.swing.JLabel;
|
---|
16 | import java.awt.Insets;
|
---|
17 | import java.awt.event.ActionEvent;
|
---|
18 | import java.awt.event.ActionListener;
|
---|
19 |
|
---|
20 | import javax.swing.JComboBox;
|
---|
21 |
|
---|
22 | import hozo.sparql.EndpointSettings;
|
---|
23 | import javax.swing.JRadioButton;
|
---|
24 | import javax.swing.JPasswordField;
|
---|
25 |
|
---|
26 | public class OptionDialog extends JDialog {
|
---|
27 |
|
---|
28 | private static final long serialVersionUID = 1L;
|
---|
29 | private JPanel jContentPane = null;
|
---|
30 | private JPanel footerPanel = null;
|
---|
31 | private JButton okButton = null;
|
---|
32 | private JButton cancelButton = null;
|
---|
33 | private JPanel mainPanel = null;
|
---|
34 | private JTextField queryKeyTextField = null;
|
---|
35 | private JTextField optionTextField = null;
|
---|
36 | private JLabel queryKeyLabel = null;
|
---|
37 | private JLabel optionLabel = null;
|
---|
38 | private JLabel encodingLabel = null;
|
---|
39 | private JTextField encodingTextField = null;
|
---|
40 | private JLabel resultTypeLabel = null;
|
---|
41 | private JComboBox dataFormatComboBox = null;
|
---|
42 |
|
---|
43 | private boolean isOk;
|
---|
44 | private JLabel endpointLabel = null;
|
---|
45 | private JTextField endpointTextField = null;
|
---|
46 | private JLabel queryTypeLabel = null;
|
---|
47 | private JPanel queryTypePanel = null;
|
---|
48 | private JRadioButton queryTypeDefaultRadioButton = null;
|
---|
49 | private JRadioButton queryTypeCustomRadioButton = null;
|
---|
50 | private JLabel namespacesLabel = null;
|
---|
51 | private JTextField namespacesTextField = null;
|
---|
52 | private JLabel repositoryTypeLabel = null;
|
---|
53 | private JPanel repositoryTypePanel = null;
|
---|
54 | private JRadioButton repositoryOnRadioButton = null;
|
---|
55 | private JRadioButton repositoryOffRadioButton = null;
|
---|
56 | private JLabel repositoryLabel = null;
|
---|
57 | private JTextField repositoryTextField = null;
|
---|
58 | private JLabel userLabel = null;
|
---|
59 | private JLabel passLabel = null;
|
---|
60 | private JTextField userTextField = null;
|
---|
61 | private JPasswordField passPasswordField = null;
|
---|
62 | private JLabel urlLabel = null;
|
---|
63 | private JTextField repositoryUrlTextField = null;
|
---|
64 | /**
|
---|
65 | * @param owner
|
---|
66 | */
|
---|
67 | public OptionDialog(Frame owner, String endpoint) {
|
---|
68 | super(owner);
|
---|
69 | initialize();
|
---|
70 |
|
---|
71 | this.getEndpointTextField().setText(endpoint);
|
---|
72 | }
|
---|
73 |
|
---|
74 | public OptionDialog(Frame owner, EndpointSettings setting) {
|
---|
75 | super(owner);
|
---|
76 | initialize();
|
---|
77 |
|
---|
78 | setCurrentEndpoint(setting);
|
---|
79 | }
|
---|
80 |
|
---|
81 | private void setCurrentEndpoint(EndpointSettings setting){
|
---|
82 | this.getEndpointTextField().setText(setting.getEndpoint());
|
---|
83 | this.setUseCustom(setting.isUseCustomParam());
|
---|
84 | this.setEncoding(setting.getEncoding());
|
---|
85 | this.setQueryKey(setting.getQueryKey());
|
---|
86 | this.setOption(setting.getOption());
|
---|
87 | this.setNamespaces(setting.getNamespaces());
|
---|
88 | this.setResultType(setting.getResultType());
|
---|
89 |
|
---|
90 | this.setEditable(setting.isEditable());
|
---|
91 | this.setRepositoryURL(setting.getRepositoryURL());
|
---|
92 | this.setRepository(setting.getRepository());
|
---|
93 | this.setUser(setting.getUser());
|
---|
94 | this.setPassword(setting.getPass());
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 | /**
|
---|
99 | * This method initializes this
|
---|
100 | *
|
---|
101 | * @return void
|
---|
102 | */
|
---|
103 | private void initialize() {
|
---|
104 | this.setSize(545, 631);
|
---|
105 | this.setContentPane(getJContentPane());
|
---|
106 | }
|
---|
107 |
|
---|
108 | public void setUseCustom(boolean custom){
|
---|
109 | this.getQueryTypeDefaultRadioButton().setSelected(!custom);
|
---|
110 | this.getQueryTypeCustomRadioButton().setSelected(custom);
|
---|
111 | this.setCustomEnabled(custom);
|
---|
112 | }
|
---|
113 |
|
---|
114 | public boolean isUseCustom(){
|
---|
115 | return this.getQueryTypeCustomRadioButton().isSelected();
|
---|
116 | }
|
---|
117 |
|
---|
118 | public void setQueryKey(String key){
|
---|
119 | this.getQueryKeyTextField().setText(key);
|
---|
120 | }
|
---|
121 |
|
---|
122 | public String getQueryKey(){
|
---|
123 | return this.getQueryKeyTextField().getText();
|
---|
124 | }
|
---|
125 |
|
---|
126 | public void setOption(String opt){
|
---|
127 | this.getOptionTextField().setText(opt);
|
---|
128 | }
|
---|
129 |
|
---|
130 | public String getOption(){
|
---|
131 | return this.getOptionTextField().getText();
|
---|
132 | }
|
---|
133 |
|
---|
134 | public void setNamespaces(String namespaces){
|
---|
135 | this.getNamespacesTextField().setText(namespaces);
|
---|
136 | }
|
---|
137 |
|
---|
138 | public String getNamespaces(){
|
---|
139 | return this.getNamespacesTextField().getText();
|
---|
140 | }
|
---|
141 |
|
---|
142 | public void setEncoding(String encode){
|
---|
143 | this.getEncodingTextField().setText(encode);
|
---|
144 | }
|
---|
145 |
|
---|
146 | public String getEndoding(){
|
---|
147 | return this.getEncodingTextField().getText();
|
---|
148 | }
|
---|
149 |
|
---|
150 | public void setResultType(Integer type){
|
---|
151 | this.getDataFormatComboBox().setSelectedItem(EndpointSettings.getResultDataType(type));
|
---|
152 | }
|
---|
153 |
|
---|
154 | public Integer getResultType(){
|
---|
155 | return EndpointSettings.getResultDataType((String)this.getDataFormatComboBox().getSelectedItem());
|
---|
156 | }
|
---|
157 |
|
---|
158 | public boolean isEditable(){
|
---|
159 | return this.getRepositoryOnRadioButton().isSelected();
|
---|
160 | }
|
---|
161 |
|
---|
162 | public void setEditable(boolean isEditable){
|
---|
163 | this.getRepositoryOnRadioButton().setSelected(isEditable);
|
---|
164 | this.getRepositoryOffRadioButton().setSelected(!isEditable);
|
---|
165 | this.setEditEnabled(isEditable);
|
---|
166 | }
|
---|
167 |
|
---|
168 | public String getRepositoryURL(){
|
---|
169 | return this.getRepositoryUrlTextField().getText();
|
---|
170 | }
|
---|
171 |
|
---|
172 | public void setRepositoryURL(String repo){
|
---|
173 | this.getRepositoryUrlTextField().setText(repo);
|
---|
174 | }
|
---|
175 |
|
---|
176 | public String getRepository(){
|
---|
177 | return this.getRepositoryTextField().getText();
|
---|
178 | }
|
---|
179 |
|
---|
180 | public void setRepository(String repo){
|
---|
181 | this.getRepositoryTextField().setText(repo);
|
---|
182 | }
|
---|
183 |
|
---|
184 | public String getUser(){
|
---|
185 | return this.getUserTextField().getText();
|
---|
186 | }
|
---|
187 |
|
---|
188 | public void setUser(String user){
|
---|
189 | this.getUserTextField().setText(user);
|
---|
190 | }
|
---|
191 |
|
---|
192 | public String getPassword(){
|
---|
193 | return new String(this.getPassPasswordField().getPassword());
|
---|
194 | }
|
---|
195 |
|
---|
196 | public void setPassword(String pass){
|
---|
197 | this.getPassPasswordField().setText(pass);
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | public boolean isOk(){
|
---|
202 | return this.isOk;
|
---|
203 | }
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * This method initializes jContentPane
|
---|
207 | *
|
---|
208 | * @return javax.swing.JPanel
|
---|
209 | */
|
---|
210 | private JPanel getJContentPane() {
|
---|
211 | if (jContentPane == null) {
|
---|
212 | jContentPane = new JPanel();
|
---|
213 | jContentPane.setLayout(new BorderLayout());
|
---|
214 | jContentPane.add(getFooterPanel(), BorderLayout.SOUTH);
|
---|
215 | jContentPane.add(getMainPanel(), BorderLayout.CENTER);
|
---|
216 | }
|
---|
217 | return jContentPane;
|
---|
218 | }
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * This method initializes footerPanel
|
---|
222 | *
|
---|
223 | * @return javax.swing.JPanel
|
---|
224 | */
|
---|
225 | private JPanel getFooterPanel() {
|
---|
226 | if (footerPanel == null) {
|
---|
227 | footerPanel = new JPanel();
|
---|
228 | footerPanel.setLayout(new FlowLayout());
|
---|
229 | footerPanel.add(getOkButton());
|
---|
230 | footerPanel.add(getCancelButton(), null);
|
---|
231 | }
|
---|
232 | return footerPanel;
|
---|
233 | }
|
---|
234 |
|
---|
235 | /**
|
---|
236 | * This method initializes okButton
|
---|
237 | *
|
---|
238 | * @return javax.swing.JButton
|
---|
239 | */
|
---|
240 | private JButton getOkButton() {
|
---|
241 | if (okButton == null) {
|
---|
242 | okButton = new JButton("OK");
|
---|
243 | okButton.addActionListener(new ActionListener() {
|
---|
244 | @Override
|
---|
245 | public void actionPerformed(ActionEvent arg0) {
|
---|
246 | isOk = true;
|
---|
247 | setVisible(false);
|
---|
248 | }
|
---|
249 | });
|
---|
250 | }
|
---|
251 | return okButton;
|
---|
252 | }
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * This method initializes cancelButton
|
---|
256 | *
|
---|
257 | * @return javax.swing.JButton
|
---|
258 | */
|
---|
259 | private JButton getCancelButton() {
|
---|
260 | if (cancelButton == null) {
|
---|
261 | cancelButton = new JButton("CANCEL");
|
---|
262 | cancelButton.addActionListener(new ActionListener() {
|
---|
263 | @Override
|
---|
264 | public void actionPerformed(ActionEvent arg0) {
|
---|
265 | isOk = false;
|
---|
266 | setVisible(false);
|
---|
267 | }
|
---|
268 | });
|
---|
269 | }
|
---|
270 | return cancelButton;
|
---|
271 | }
|
---|
272 |
|
---|
273 | /**
|
---|
274 | * This method initializes mainPanel
|
---|
275 | *
|
---|
276 | * @return javax.swing.JPanel
|
---|
277 | */
|
---|
278 | private JPanel getMainPanel() {
|
---|
279 | if (mainPanel == null) {
|
---|
280 | GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
|
---|
281 | gridBagConstraints10.fill = GridBagConstraints.BOTH;
|
---|
282 | gridBagConstraints10.gridy = 10;
|
---|
283 | gridBagConstraints10.weightx = 1.0;
|
---|
284 | gridBagConstraints10.insets = new Insets(10, 0, 10, 10);
|
---|
285 | gridBagConstraints10.gridx = 1;
|
---|
286 | GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
|
---|
287 | gridBagConstraints9.gridx = 0;
|
---|
288 | gridBagConstraints9.gridy = 10;
|
---|
289 | urlLabel = new JLabel();
|
---|
290 | urlLabel.setText("Repository URL");
|
---|
291 | GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
|
---|
292 | gridBagConstraints8.fill = GridBagConstraints.BOTH;
|
---|
293 | gridBagConstraints8.gridy = 13;
|
---|
294 | gridBagConstraints8.weightx = 1.0;
|
---|
295 | gridBagConstraints8.insets = new Insets(10, 0, 10, 10);
|
---|
296 | gridBagConstraints8.gridx = 1;
|
---|
297 | GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
|
---|
298 | gridBagConstraints7.fill = GridBagConstraints.BOTH;
|
---|
299 | gridBagConstraints7.gridy = 12;
|
---|
300 | gridBagConstraints7.weightx = 1.0;
|
---|
301 | gridBagConstraints7.insets = new Insets(10, 0, 10, 10);
|
---|
302 | gridBagConstraints7.gridx = 1;
|
---|
303 | GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
|
---|
304 | gridBagConstraints6.gridx = 0;
|
---|
305 | gridBagConstraints6.gridy = 13;
|
---|
306 | passLabel = new JLabel();
|
---|
307 | passLabel.setText("Password");
|
---|
308 | GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
|
---|
309 | gridBagConstraints51.gridx = 0;
|
---|
310 | gridBagConstraints51.gridy = 12;
|
---|
311 | userLabel = new JLabel();
|
---|
312 | userLabel.setText("User");
|
---|
313 | GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
|
---|
314 | gridBagConstraints41.fill = GridBagConstraints.BOTH;
|
---|
315 | gridBagConstraints41.gridy = 11;
|
---|
316 | gridBagConstraints41.weightx = 1.0;
|
---|
317 | gridBagConstraints41.insets = new Insets(10, 0, 10, 10);
|
---|
318 | gridBagConstraints41.gridx = 1;
|
---|
319 | GridBagConstraints gridBagConstraints32 = new GridBagConstraints();
|
---|
320 | gridBagConstraints32.gridx = 0;
|
---|
321 | gridBagConstraints32.insets = new Insets(0, 10, 0, 5);
|
---|
322 | gridBagConstraints32.gridy = 11;
|
---|
323 | repositoryLabel = new JLabel();
|
---|
324 | repositoryLabel.setText("Repository Name");
|
---|
325 | GridBagConstraints gridBagConstraints25 = new GridBagConstraints();
|
---|
326 | gridBagConstraints25.gridx = 1;
|
---|
327 | gridBagConstraints25.fill = GridBagConstraints.BOTH;
|
---|
328 | gridBagConstraints25.insets = new Insets(0, 0, 0, 0);
|
---|
329 | gridBagConstraints25.gridy = 9;
|
---|
330 | GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
|
---|
331 | gridBagConstraints15.gridx = 0;
|
---|
332 | gridBagConstraints15.insets = new Insets(0, 10, 0, 10);
|
---|
333 | gridBagConstraints15.gridy = 9;
|
---|
334 | repositoryTypeLabel = new JLabel();
|
---|
335 | repositoryTypeLabel.setText("Editable AllegroGraph");
|
---|
336 | GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
|
---|
337 | gridBagConstraints24.fill = GridBagConstraints.HORIZONTAL;
|
---|
338 | gridBagConstraints24.gridy = 2;
|
---|
339 | gridBagConstraints24.weightx = 1.0;
|
---|
340 | gridBagConstraints24.insets = new Insets(0, 0, 0, 10);
|
---|
341 | gridBagConstraints24.gridx = 1;
|
---|
342 | GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
|
---|
343 | gridBagConstraints14.gridx = 0;
|
---|
344 | gridBagConstraints14.insets = new Insets(15, 10, 15, 10);
|
---|
345 | gridBagConstraints14.gridy = 2;
|
---|
346 | namespacesLabel = new JLabel("Namespaces");
|
---|
347 | GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
|
---|
348 | gridBagConstraints5.gridx = 1;
|
---|
349 | gridBagConstraints5.fill = GridBagConstraints.BOTH;
|
---|
350 | gridBagConstraints5.gridy = 3;
|
---|
351 | GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
|
---|
352 | gridBagConstraints31.gridx = 0;
|
---|
353 | gridBagConstraints31.gridy = 3;
|
---|
354 | queryTypeLabel = new JLabel("Query Type");
|
---|
355 | GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
|
---|
356 | gridBagConstraints23.fill = GridBagConstraints.HORIZONTAL;
|
---|
357 | gridBagConstraints23.gridy = 1;
|
---|
358 | gridBagConstraints23.weightx = 1.0;
|
---|
359 | gridBagConstraints23.insets = new Insets(0, 0, 0, 10);
|
---|
360 | gridBagConstraints23.gridx = 1;
|
---|
361 | GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
|
---|
362 | gridBagConstraints13.gridx = 0;
|
---|
363 | gridBagConstraints13.insets = new Insets(15, 10, 15, 10);
|
---|
364 | gridBagConstraints13.gridy = 1;
|
---|
365 | endpointLabel = new JLabel("Endpoint");
|
---|
366 | GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
|
---|
367 | gridBagConstraints22.fill = GridBagConstraints.NONE;
|
---|
368 | gridBagConstraints22.gridy = 8;
|
---|
369 | gridBagConstraints22.weightx = 1.0;
|
---|
370 | gridBagConstraints22.ipadx = 0;
|
---|
371 | gridBagConstraints22.anchor = GridBagConstraints.WEST;
|
---|
372 | gridBagConstraints22.insets = new Insets(15, 0, 15, 0);
|
---|
373 | gridBagConstraints22.gridwidth = 0;
|
---|
374 | gridBagConstraints22.gridx = 1;
|
---|
375 | GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
|
---|
376 | gridBagConstraints12.gridx = 0;
|
---|
377 | gridBagConstraints12.gridy = 8;
|
---|
378 | resultTypeLabel = new JLabel("Result Format");
|
---|
379 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
|
---|
380 | gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
|
---|
381 | gridBagConstraints3.gridy = 7;
|
---|
382 | gridBagConstraints3.weightx = 1.0;
|
---|
383 | gridBagConstraints3.insets = new Insets(10, 0, 10, 10);
|
---|
384 | gridBagConstraints3.gridx = 1;
|
---|
385 | GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
|
---|
386 | gridBagConstraints21.gridx = 0;
|
---|
387 | gridBagConstraints21.gridy = 7;
|
---|
388 | encodingLabel = new JLabel("Encoding");
|
---|
389 | GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
|
---|
390 | gridBagConstraints11.gridx = 0;
|
---|
391 | gridBagConstraints11.insets = new Insets(10, 0, 10, 0);
|
---|
392 | gridBagConstraints11.gridy = 5;
|
---|
393 | optionLabel = new JLabel("Option");
|
---|
394 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
|
---|
395 | gridBagConstraints2.gridx = 0;
|
---|
396 | gridBagConstraints2.insets = new Insets(0, 10, 0, 10);
|
---|
397 | gridBagConstraints2.gridy = 4;
|
---|
398 | queryKeyLabel = new JLabel("Query Key");
|
---|
399 | GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
|
---|
400 | gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
|
---|
401 | gridBagConstraints1.gridy = 5;
|
---|
402 | gridBagConstraints1.weightx = 1.0;
|
---|
403 | gridBagConstraints1.anchor = GridBagConstraints.CENTER;
|
---|
404 | gridBagConstraints1.insets = new Insets(10, 0, 10, 10);
|
---|
405 | gridBagConstraints1.gridx = 1;
|
---|
406 | GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
---|
407 | gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
---|
408 | gridBagConstraints.gridy = 4;
|
---|
409 | gridBagConstraints.weightx = 1.0;
|
---|
410 | gridBagConstraints.gridheight = 1;
|
---|
411 | gridBagConstraints.insets = new Insets(10, 0, 10, 10);
|
---|
412 | gridBagConstraints.gridx = 1;
|
---|
413 | mainPanel = new JPanel();
|
---|
414 | mainPanel.setLayout(new GridBagLayout());
|
---|
415 | mainPanel.add(getQueryKeyTextField(), gridBagConstraints);
|
---|
416 | mainPanel.add(getOptionTextField(), gridBagConstraints1);
|
---|
417 | mainPanel.add(queryKeyLabel, gridBagConstraints2);
|
---|
418 | mainPanel.add(optionLabel, gridBagConstraints11);
|
---|
419 | mainPanel.add(encodingLabel, gridBagConstraints21);
|
---|
420 | mainPanel.add(getEncodingTextField(), gridBagConstraints3);
|
---|
421 | mainPanel.add(resultTypeLabel, gridBagConstraints12);
|
---|
422 | mainPanel.add(getDataFormatComboBox(), gridBagConstraints22);
|
---|
423 | mainPanel.add(endpointLabel, gridBagConstraints13);
|
---|
424 | mainPanel.add(getEndpointTextField(), gridBagConstraints23);
|
---|
425 | mainPanel.add(queryTypeLabel, gridBagConstraints31);
|
---|
426 | mainPanel.add(getQueryTypePanel(), gridBagConstraints5);
|
---|
427 | mainPanel.add(namespacesLabel, gridBagConstraints14);
|
---|
428 | mainPanel.add(getNamespacesTextField(), gridBagConstraints24);
|
---|
429 | mainPanel.add(repositoryTypeLabel, gridBagConstraints15);
|
---|
430 | mainPanel.add(getRepositoryTypePanel(), gridBagConstraints25);
|
---|
431 | mainPanel.add(repositoryLabel, gridBagConstraints32);
|
---|
432 | mainPanel.add(getRepositoryTextField(), gridBagConstraints41);
|
---|
433 | mainPanel.add(userLabel, gridBagConstraints51);
|
---|
434 | mainPanel.add(passLabel, gridBagConstraints6);
|
---|
435 | mainPanel.add(getUserTextField(), gridBagConstraints7);
|
---|
436 | mainPanel.add(getPassPasswordField(), gridBagConstraints8);
|
---|
437 | mainPanel.add(urlLabel, gridBagConstraints9);
|
---|
438 | mainPanel.add(getRepositoryUrlTextField(), gridBagConstraints10);
|
---|
439 |
|
---|
440 | }
|
---|
441 | return mainPanel;
|
---|
442 | }
|
---|
443 |
|
---|
444 | /**
|
---|
445 | * This method initializes queryKeyTextField
|
---|
446 | *
|
---|
447 | * @return javax.swing.JTextField
|
---|
448 | */
|
---|
449 | private JTextField getQueryKeyTextField() {
|
---|
450 | if (queryKeyTextField == null) {
|
---|
451 | queryKeyTextField = new JTextField();
|
---|
452 | }
|
---|
453 | return queryKeyTextField;
|
---|
454 | }
|
---|
455 |
|
---|
456 | /**
|
---|
457 | * This method initializes optionTextField
|
---|
458 | *
|
---|
459 | * @return javax.swing.JTextField
|
---|
460 | */
|
---|
461 | private JTextField getOptionTextField() {
|
---|
462 | if (optionTextField == null) {
|
---|
463 | optionTextField = new JTextField();
|
---|
464 | }
|
---|
465 | return optionTextField;
|
---|
466 | }
|
---|
467 |
|
---|
468 | /**
|
---|
469 | * This method initializes encodingTextField
|
---|
470 | *
|
---|
471 | * @return javax.swing.JTextField
|
---|
472 | */
|
---|
473 | private JTextField getEncodingTextField() {
|
---|
474 | if (encodingTextField == null) {
|
---|
475 | encodingTextField = new JTextField();
|
---|
476 | }
|
---|
477 | return encodingTextField;
|
---|
478 | }
|
---|
479 |
|
---|
480 | /**
|
---|
481 | * This method initializes dataFormatComboBox
|
---|
482 | *
|
---|
483 | * @return javax.swing.JComboBox
|
---|
484 | */
|
---|
485 | private JComboBox getDataFormatComboBox() {
|
---|
486 | if (dataFormatComboBox == null) {
|
---|
487 | dataFormatComboBox = new JComboBox(EndpointSettings.getResultDataTypeList());
|
---|
488 | }
|
---|
489 | return dataFormatComboBox;
|
---|
490 | }
|
---|
491 |
|
---|
492 | /**
|
---|
493 | * This method initializes endpointTextField
|
---|
494 | *
|
---|
495 | * @return javax.swing.JTextField
|
---|
496 | */
|
---|
497 | private JTextField getEndpointTextField() {
|
---|
498 | if (endpointTextField == null) {
|
---|
499 | endpointTextField = new JTextField();
|
---|
500 | endpointTextField.setEditable(false);
|
---|
501 | }
|
---|
502 | return endpointTextField;
|
---|
503 | }
|
---|
504 |
|
---|
505 | /**
|
---|
506 | * This method initializes queryTypePanel
|
---|
507 | *
|
---|
508 | * @return javax.swing.JPanel
|
---|
509 | */
|
---|
510 | private JPanel getQueryTypePanel() {
|
---|
511 | if (queryTypePanel == null) {
|
---|
512 | queryTypePanel = new JPanel();
|
---|
513 | queryTypePanel.setLayout(new FlowLayout());
|
---|
514 | queryTypePanel.add(getQueryTypeDefaultRadioButton(), null);
|
---|
515 | queryTypePanel.add(getQueryTypeCustomRadioButton(), null);
|
---|
516 | ButtonGroup bg = new ButtonGroup();
|
---|
517 | bg.add(getQueryTypeDefaultRadioButton());
|
---|
518 | bg.add(getQueryTypeCustomRadioButton());
|
---|
519 | }
|
---|
520 | return queryTypePanel;
|
---|
521 | }
|
---|
522 |
|
---|
523 | private void setCustomEnabled(boolean enabled){
|
---|
524 | this.getQueryKeyTextField().setEnabled(enabled);
|
---|
525 | this.getOptionTextField().setEnabled(enabled);
|
---|
526 | this.getEncodingTextField().setEnabled(enabled);
|
---|
527 | this.getDataFormatComboBox().setEnabled(enabled);
|
---|
528 | this.queryKeyLabel.setEnabled(enabled);
|
---|
529 | this.optionLabel.setEnabled(enabled);
|
---|
530 | this.encodingLabel.setEnabled(enabled);
|
---|
531 | this.resultTypeLabel.setEnabled(enabled);
|
---|
532 | }
|
---|
533 |
|
---|
534 | /**
|
---|
535 | * This method initializes queryTypeDefaultRadioButton
|
---|
536 | *
|
---|
537 | * @return javax.swing.JRadioButton
|
---|
538 | */
|
---|
539 | private JRadioButton getQueryTypeDefaultRadioButton() {
|
---|
540 | if (queryTypeDefaultRadioButton == null) {
|
---|
541 | queryTypeDefaultRadioButton = new JRadioButton("Default");
|
---|
542 | queryTypeDefaultRadioButton.addActionListener(new ActionListener() {
|
---|
543 |
|
---|
544 | @Override
|
---|
545 | public void actionPerformed(ActionEvent arg0) {
|
---|
546 | setCustomEnabled(false);
|
---|
547 | }
|
---|
548 | });
|
---|
549 | }
|
---|
550 | return queryTypeDefaultRadioButton;
|
---|
551 | }
|
---|
552 |
|
---|
553 | /**
|
---|
554 | * This method initializes queryTypeCustomRadioButton
|
---|
555 | *
|
---|
556 | * @return javax.swing.JRadioButton
|
---|
557 | */
|
---|
558 | private JRadioButton getQueryTypeCustomRadioButton() {
|
---|
559 | if (queryTypeCustomRadioButton == null) {
|
---|
560 | queryTypeCustomRadioButton = new JRadioButton("Custom");
|
---|
561 | queryTypeCustomRadioButton.addActionListener(new ActionListener() {
|
---|
562 |
|
---|
563 | @Override
|
---|
564 | public void actionPerformed(ActionEvent arg0) {
|
---|
565 | setCustomEnabled(true);
|
---|
566 | }
|
---|
567 | });
|
---|
568 | }
|
---|
569 | return queryTypeCustomRadioButton;
|
---|
570 | }
|
---|
571 |
|
---|
572 | /**
|
---|
573 | * This method initializes namespacesTextField
|
---|
574 | *
|
---|
575 | * @return javax.swing.JTextField
|
---|
576 | */
|
---|
577 | private JTextField getNamespacesTextField() {
|
---|
578 | if (namespacesTextField == null) {
|
---|
579 | namespacesTextField = new JTextField();
|
---|
580 | }
|
---|
581 | return namespacesTextField;
|
---|
582 | }
|
---|
583 |
|
---|
584 | private void setEditEnabled(boolean enabled){
|
---|
585 | this.getRepositoryUrlTextField().setEnabled(enabled);
|
---|
586 | this.getRepositoryTextField().setEnabled(enabled);
|
---|
587 | this.getUserTextField().setEnabled(enabled);
|
---|
588 | this.getPassPasswordField().setEnabled(enabled);
|
---|
589 | this.urlLabel.setEnabled(enabled);
|
---|
590 | this.repositoryLabel.setEnabled(enabled);
|
---|
591 | this.userLabel.setEnabled(enabled);
|
---|
592 | this.passLabel.setEnabled(enabled);
|
---|
593 | }
|
---|
594 |
|
---|
595 | /**
|
---|
596 | * This method initializes repositoryTypePanel
|
---|
597 | *
|
---|
598 | * @return javax.swing.JPanel
|
---|
599 | */
|
---|
600 | private JPanel getRepositoryTypePanel() {
|
---|
601 | if (repositoryTypePanel == null) {
|
---|
602 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
|
---|
603 | gridBagConstraints4.gridx = -1;
|
---|
604 | gridBagConstraints4.gridy = -1;
|
---|
605 | repositoryTypePanel = new JPanel();
|
---|
606 | repositoryTypePanel.setLayout(new FlowLayout());
|
---|
607 | repositoryTypePanel.add(getRepositoryOnRadioButton(), gridBagConstraints4);
|
---|
608 | repositoryTypePanel.add(getRepositoryOffRadioButton(), new GridBagConstraints());
|
---|
609 | ButtonGroup bg = new ButtonGroup();
|
---|
610 | bg.add(getRepositoryOnRadioButton());
|
---|
611 | bg.add(getRepositoryOffRadioButton());
|
---|
612 |
|
---|
613 | }
|
---|
614 | return repositoryTypePanel;
|
---|
615 | }
|
---|
616 |
|
---|
617 | /**
|
---|
618 | * This method initializes repositoryOnRadioButton
|
---|
619 | *
|
---|
620 | * @return javax.swing.JRadioButton
|
---|
621 | */
|
---|
622 | private JRadioButton getRepositoryOnRadioButton() {
|
---|
623 | if (repositoryOnRadioButton == null) {
|
---|
624 | repositoryOnRadioButton = new JRadioButton();
|
---|
625 | repositoryOnRadioButton.setText("ON");
|
---|
626 | repositoryOnRadioButton.addActionListener(new ActionListener() {
|
---|
627 |
|
---|
628 | @Override
|
---|
629 | public void actionPerformed(ActionEvent arg0) {
|
---|
630 | setEditEnabled(true);
|
---|
631 | }
|
---|
632 | });
|
---|
633 | }
|
---|
634 | return repositoryOnRadioButton;
|
---|
635 | }
|
---|
636 |
|
---|
637 | /**
|
---|
638 | * This method initializes repositoryOffRadioButton
|
---|
639 | *
|
---|
640 | * @return javax.swing.JRadioButton
|
---|
641 | */
|
---|
642 | private JRadioButton getRepositoryOffRadioButton() {
|
---|
643 | if (repositoryOffRadioButton == null) {
|
---|
644 | repositoryOffRadioButton = new JRadioButton();
|
---|
645 | repositoryOffRadioButton.setText("OFF");
|
---|
646 | repositoryOffRadioButton.addActionListener(new ActionListener() {
|
---|
647 |
|
---|
648 | @Override
|
---|
649 | public void actionPerformed(ActionEvent arg0) {
|
---|
650 | setEditEnabled(false);
|
---|
651 | }
|
---|
652 | });
|
---|
653 | }
|
---|
654 | return repositoryOffRadioButton;
|
---|
655 | }
|
---|
656 |
|
---|
657 | /**
|
---|
658 | * This method initializes repositoryTextField
|
---|
659 | *
|
---|
660 | * @return javax.swing.JTextField
|
---|
661 | */
|
---|
662 | private JTextField getRepositoryTextField() {
|
---|
663 | if (repositoryTextField == null) {
|
---|
664 | repositoryTextField = new JTextField();
|
---|
665 | }
|
---|
666 | return repositoryTextField;
|
---|
667 | }
|
---|
668 |
|
---|
669 | /**
|
---|
670 | * This method initializes userTextField
|
---|
671 | *
|
---|
672 | * @return javax.swing.JTextField
|
---|
673 | */
|
---|
674 | private JTextField getUserTextField() {
|
---|
675 | if (userTextField == null) {
|
---|
676 | userTextField = new JTextField();
|
---|
677 | }
|
---|
678 | return userTextField;
|
---|
679 | }
|
---|
680 |
|
---|
681 | /**
|
---|
682 | * This method initializes passPasswordField
|
---|
683 | *
|
---|
684 | * @return javax.swing.JPasswordField
|
---|
685 | */
|
---|
686 | private JPasswordField getPassPasswordField() {
|
---|
687 | if (passPasswordField == null) {
|
---|
688 | passPasswordField = new JPasswordField();
|
---|
689 | }
|
---|
690 | return passPasswordField;
|
---|
691 | }
|
---|
692 |
|
---|
693 | /**
|
---|
694 | * This method initializes urlTextField
|
---|
695 | *
|
---|
696 | * @return javax.swing.JTextField
|
---|
697 | */
|
---|
698 | private JTextField getRepositoryUrlTextField() {
|
---|
699 | if (repositoryUrlTextField == null) {
|
---|
700 | repositoryUrlTextField = new JTextField();
|
---|
701 | }
|
---|
702 | return repositoryUrlTextField;
|
---|
703 | }
|
---|
704 |
|
---|
705 | } // @jve:decl-index=0:visual-constraint="10,10"
|
---|