outerPanel = new JPanel();
outerPanel.setLayout(new BorderLayout());
outerPanel.add(statusBar, BorderLayout.PAGE_END);
syncDialog = new ExtendedDialog(
Main.parent,
tr("Correlate images with GPX track"),
new String[] { tr("Correlate"), tr("Cancel") },
false
);
syncDialog.setContent(panelTf, false);
syncDialog.setButtonIcons(new String[] { "ok.png", "cancel.png" });
syncDialog.setupDialog();
outerPanel.add(syncDialog.getContentPane(), BorderLayout.PAGE_START);
syncDialog.setContentPane(outerPanel);
syncDialog.pack();
syncDialog.addWindowListener(new WindowAdapter() {
static final int CANCEL = -1;
static final int DONE = 0;
static final int AGAIN = 1;
static final int NOTHING = 2;
private int checkAndSave() {
if (syncDialog.isVisible())
// nothing happened: JOSM was minimized or similar
return NOTHING;
int answer = syncDialog.getValue();
if(answer != 1)
return CANCEL;
// Parse values again, to display an error if the format is not recognized
try {
timezone = parseTimezone(tfTimezone.getText().trim());
} catch (ParseException e) {
JOptionPane.showMessageDialog(Main.parent, e.getMessage(),
tr("Invalid timezone"), JOptionPane.ERROR_MESSAGE);
return AGAIN;
}
try {
delta = parseOffset(tfOffset.getText().trim());
} catch (ParseException e) {
JOptionPane.showMessageDialog(Main.parent, e.getMessage(),
tr("Invalid offset"), JOptionPane.ERROR_MESSAGE);
return AGAIN;
}
if (lastNumMatched == 0 && new ExtendedDialog(
Main.parent,
tr("Correlate images with GPX track"),
new String[] { tr("OK"), tr("Try Again") }).
setContent(tr("No images could be matched!")).
setButtonIcons(new String[] { "ok.png", "dialogs/refresh.png"}).