+ public void showDialog()
+ {
+ // Make dialog window including whether to compress to kmz (and include pictures) or not
+ if (_dialog == null)
+ {
+ _dialog = new JDialog(_parentFrame, I18nManager.getText("dialog.exportkml.title"), true);
+ _dialog.setLocationRelativeTo(_parentFrame);
+ _dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ _dialog.getContentPane().add(makeDialogComponents());
+ _dialog.pack();
+ }
+ enableCheckboxes();
+ _progressBar.setVisible(false);
+ _dialog.show();
+ }
+
+
+ /**
+ * Create dialog components
+ * @return Panel containing all gui elements in dialog
+ */
+ private Component makeDialogComponents()
+ {
+ JPanel dialogPanel = new JPanel();
+ dialogPanel.setLayout(new BorderLayout());
+ JPanel mainPanel = new JPanel();
+ mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+ // Make a central panel with the text box and checkboxes
+ JPanel descPanel = new JPanel();
+ descPanel.setLayout(new FlowLayout());
+ descPanel.add(new JLabel(I18nManager.getText("dialog.exportkml.text")));
+ _descriptionField = new JTextField(20);
+ descPanel.add(_descriptionField);
+ mainPanel.add(descPanel);
+ dialogPanel.add(mainPanel, BorderLayout.CENTER);
+ // Checkbox for altitude export
+ _altitudesCheckbox = new JCheckBox(I18nManager.getText("dialog.exportkml.altitude"));
+ _altitudesCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
+ mainPanel.add(_altitudesCheckbox);
+ // Checkboxes for kmz export and image export
+ _kmzCheckbox = new JCheckBox(I18nManager.getText("dialog.exportkml.kmz"));
+ _kmzCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
+ _kmzCheckbox.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ // enable image checkbox if kmz activated
+ enableCheckboxes();
+ }
+ });
+ mainPanel.add(_kmzCheckbox);
+ _exportImagesCheckbox = new JCheckBox(I18nManager.getText("dialog.exportkml.exportimages"));
+ _exportImagesCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
+ mainPanel.add(_exportImagesCheckbox);
+ mainPanel.add(Box.createVerticalStrut(10));
+ _progressBar = new JProgressBar(0, 100);
+ _progressBar.setVisible(false);
+ mainPanel.add(_progressBar);
+ mainPanel.add(Box.createVerticalStrut(10));
+ // button panel at bottom
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
+ JButton okButton = new JButton(I18nManager.getText("button.ok"));
+ ActionListener okListener = new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ startExport();
+ }
+ };
+ okButton.addActionListener(okListener);
+ _descriptionField.addActionListener(okListener);
+ buttonPanel.add(okButton);
+ JButton cancelButton = new JButton(I18nManager.getText("button.cancel"));
+ cancelButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ _dialog.dispose();
+ }
+ });
+ buttonPanel.add(cancelButton);
+ dialogPanel.add(buttonPanel, BorderLayout.SOUTH);
+ return dialogPanel;
+ }
+
+
+ /**
+ * Enable the checkboxes according to data
+ */
+ private void enableCheckboxes()