From a9f1b0bac9c289b66028a5e9c5a6d8353edb70b7 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 5 Aug 2011 09:22:33 +0000 Subject: Make SecureViewerDialog appear always on top Set save dialog parent to secure viewer to ensure it is on top of it git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@949 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 10 +++++----- .../src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java | 2 +- .../java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java index d0ab7352..7573da2b 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java @@ -1889,7 +1889,7 @@ public class BKUGUIImpl implements BKUGUIFacade { showMessageDialog(TITLE_SIGNATURE_DATA, MESSAGE_UNSUPPORTED_MIMETYPE, new Object[] { dataToBeSigned.get(0).getMimeType() }); - SecureViewerSaveDialog.showSaveDialog(dataToBeSigned.get(0), + SecureViewerSaveDialog.showSaveDialog(contentPane, dataToBeSigned.get(0), messages, backListener, backCommand, (int) (baseFontSize * getResizeFactor())); } @@ -1914,11 +1914,11 @@ public class BKUGUIImpl implements BKUGUIFacade { // avoid AlwaysOnTop at least in applet, otherwise make secureViewer // AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) // is always on top. - Window window = SwingUtilities.getWindowAncestor(contentPane); - if (window != null && window.isAlwaysOnTop()) { + //Window window = SwingUtilities.getWindowAncestor(contentPane); + //if (window != null && window.isAlwaysOnTop()) { log.debug("Make secureViewer alwaysOnTop."); secureViewer.setAlwaysOnTop(true); - } + //} secureViewer.setContent(dataToBeSigned); log.trace("Viewer setContent returned."); @@ -1961,7 +1961,7 @@ public class BKUGUIImpl implements BKUGUIFacade { showMessageDialog(BKUGUIFacade.TITLE_SIGNATURE_DATA, BKUGUIFacade.MESSAGE_UNSUPPORTED_MIMETYPE, new Object[] { storedSelection.getMimeType() }); - SecureViewerSaveDialog.showSaveDialog(storedSelection, messages, + SecureViewerSaveDialog.showSaveDialog(contentPane, storedSelection, messages, storedBackToListListener, null, (int) (baseFontSize * getResizeFactor())); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java index 56a234a3..0eb35521 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java @@ -406,7 +406,7 @@ public class SecureViewerDialog extends JDialog { @Override public void actionPerformed(ActionEvent e) { log.trace("[{}] display secure viewer save dialog.", Thread.currentThread().getName()); - SecureViewerSaveDialog.showSaveDialog(content, messages, null, null, closeButton.getFont().getSize()); + SecureViewerSaveDialog.showSaveDialog(viewer, content, messages, null, null, closeButton.getFont().getSize()); } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java index 8ead6283..d121f3ca 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java @@ -64,7 +64,7 @@ public class SecureViewerSaveDialog { } } - public static void showSaveDialog(final HashDataInput hashDataInput, final ResourceBundle messages, + public static void showSaveDialog(final Component parent, final HashDataInput hashDataInput, final ResourceBundle messages, final ActionListener okListener, final String okCommand, final int fontSize) { final Logger log = LoggerFactory.getLogger(SecureViewerSaveDialog.class); @@ -101,14 +101,14 @@ public class SecureViewerSaveDialog { .getFont().deriveFont((float) fontSize)); // parent contentPane -> placed over applet - switch (fileDialog.showSaveDialog(fileDialog)) { + switch (fileDialog.showSaveDialog(parent)) { case JFileChooser.APPROVE_OPTION: File file = fileDialog.getSelectedFile(); String id = hashDataInput.getReferenceId(); if (file.exists()) { String msgPattern = messages .getString(BKUGUIFacade.MESSAGE_OVERWRITE); - int overwrite = JOptionPane.showConfirmDialog(fileDialog, + int overwrite = JOptionPane.showConfirmDialog(parent, MessageFormat.format(msgPattern, file), messages .getString(BKUGUIFacade.WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION); @@ -135,7 +135,7 @@ public class SecureViewerSaveDialog { log.error("Failed to write.", ex); String errPattern = messages .getString(BKUGUIFacade.ERR_WRITE_HASHDATA); - JOptionPane.showMessageDialog(fileDialog, MessageFormat.format( + JOptionPane.showMessageDialog(parent, MessageFormat.format( errPattern, ex.getMessage()), messages .getString(BKUGUIFacade.WINDOWTITLE_ERROR), JOptionPane.ERROR_MESSAGE); -- cgit v1.2.3