+++ /dev/null
-package com.axyus.signature.pes.verifier;\r
-\r
-import com.axyus.signature.utilities.Version;\r
-import com.axyus.swing.components.UnexpectedErrorDlg;\r
-import com.axyus.swing.components.UnexpectedErrorDlg.CloseWindowRequestHandler;\r
-import com.axyus.swing.components.wizard.WizardDialog;\r
-import com.axyus.swing.components.wizard.WizardProcess;\r
-import java.awt.Toolkit;\r
-import java.lang.Thread.UncaughtExceptionHandler;\r
-import java.net.URL;\r
-import javax.swing.ImageIcon;\r
-import javax.swing.JFrame;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
-/**\r
- * @author CBO\r
- */\r
-public class WizardLauncher {\r
-\r
- public static final String TITLE = "Vérification de signature PES";\r
- private static Log logger = LogFactory.getLog(WizardLauncher.class);\r
-\r
- public static void startUI(final RunContextAdapter runContextAdapter) {\r
- java.awt.EventQueue.invokeLater(new Runnable() {\r
-\r
- @Override\r
- public void run() {\r
- WizardProcess wizardProcess = new SignatureVerifierWizardProcess(runContextAdapter);\r
- WizardDialog dialog = new WizardDialog(wizardProcess, runContextAdapter.getParentFrame(), true);\r
- wizardProcess.setWizardDialog(dialog);\r
- wizardProcess.getCurrentStep().beforeDisplay();\r
- dialog.setTitle("Vérification de signature PES - " + Version.getCurrent().toString());\r
- dialog.setLogo(new ImageIcon(this.getClass().getResource("/com/axyus/signature/pes/verifier/logo.png")).getImage());\r
- Toolkit toolkit = Toolkit.getDefaultToolkit();\r
- dialog.setLocation((toolkit.getScreenSize().width - dialog.getWidth()) / 2, (toolkit.getScreenSize().height - dialog.getHeight()) / 2);\r
- dialog.addWindowListener(new java.awt.event.WindowAdapter() {\r
-\r
- @Override\r
- public void windowClosing(java.awt.event.WindowEvent e) {\r
- runContextAdapter.onCloseRequest();\r
- }\r
- });\r
- dialog.setVisible(true);\r
- }\r
- });\r
- }\r
-\r
- public static interface RunContextAdapter {\r
- boolean isPesFileImportSupported();\r
- URL getPesSchemaURL();\r
- \r
- \r
- \r
- JFrame getParentFrame();\r
-\r
- void onCloseRequest(); \r
- }\r
-\r
- static public class CustomUncaughtExceptionHandler implements UncaughtExceptionHandler {\r
-\r
- static RunContextAdapter runContextAdapter;\r
-\r
- @Override\r
- public void uncaughtException(Thread thread, Throwable throwable) {\r
- handle(throwable);\r
- }\r
-\r
- public void handle(Throwable throwable) {\r
- logger.error("Erreur inattendue", throwable);\r
- UnexpectedErrorDlg errorDlg = new UnexpectedErrorDlg(null, true, throwable, new CloseWindowRequestHandler() {\r
-\r
- @Override\r
- public void onCloseWindowRequest(UnexpectedErrorDlg unexpectedErrorDlg) {\r
- if (runContextAdapter != null) {\r
- runContextAdapter.onCloseRequest();\r
- }\r
- }\r
- });\r
- errorDlg.setVisible(true);\r
- }\r
- };\r
-}\r