+++ /dev/null
-package com.axyus.signature.pes.verifier;\r
-\r
-import com.axyus.signature.pes.verifier.PesAllerAnalyser.InvalidPesAllerFileException;\r
-import com.axyus.signature.utilities.UiUtilities;\r
-import com.axyus.swing.components.wizard.WizardProcess;\r
-import java.awt.Component;\r
-import java.net.URL;\r
-import javax.swing.JFrame;\r
-import javax.swing.JOptionPane;\r
-\r
-/**\r
- * Etape de sélection du fichier PES à analyser\r
- * @author SME\r
- */\r
-public class PesFileChooserStep extends WizardProcess.Step<SignatureVerifierWizardProcess> {\r
-private URL pesSchemaURL;\r
- private PesFileChooserUI pesFileChooserPanelUI;\r
-\r
- public PesFileChooserStep() {\r
- this.pesFileChooserPanelUI = new PesFileChooserUI();\r
- }\r
-\r
- @Override\r
- public String getTile() {\r
- return "Sélection d'un fichier PES";\r
- }\r
-\r
- @Override\r
- public void beforeDisplay() {\r
- this.pesFileChooserPanelUI.setWizardDialog(getWizardProcess().getWizardDialog());\r
- }\r
-\r
- \r
- @Override\r
- public void validate() throws StepValidationException {\r
- if (this.pesFileChooserPanelUI.getSelectedFile() == null) {\r
- throw new StepValidationException("Merci de bien vouloir sélectionner un fichier PES");\r
- } else {\r
-\r
- int reponse = 0; \r
- if (this.pesFileChooserPanelUI.getSelectedFile().length()*10 > UiUtilities.freeMemoryLeft()) {\r
- reponse = JOptionPane.showConfirmDialog(new JFrame(), "Attention le fichier sélectionner est volumineux, son traitement pourrait saturé la mémoire, voulez vous continuer?",\r
- "Fichier volumineux",\r
- JOptionPane.YES_NO_OPTION);\r
- }\r
- if (reponse == 0) {\r
- PesAllerAnalyser pesAllerAnalyser = new PesAllerAnalyser(this.pesFileChooserPanelUI.getSelectedFile());\r
- getWizardProcess().setPesAnalyser(pesAllerAnalyser);\r
- try {\r
- if(pesSchemaURL!=null){\r
- pesAllerAnalyser.setDoSchemaValidation(true);\r
- pesAllerAnalyser.setSchemaUrl(pesSchemaURL);\r
- }\r
- pesAllerAnalyser.computeSimpleInformation();\r
- } catch (InvalidPesAllerFileException ex) {\r
- throw new StepValidationException("Le fichier sélectionné ne peut être vérifié : " + ex.getMessage());\r
- }\r
-\r
- try {\r
- if (!getWizardProcess().getPesAnalyser().getSimpleInformation().isSigned()) {\r
- throw new StepValidationException("Le fichier ne comporte pas de signature");\r
- } else {\r
- getWizardProcess().getPesAnalyser().computeSignaturesVerificationResults();\r
- getWizardProcess().getPesAnalyser().computeSignaturesTypeVerification();\r
- \r
- }\r
- } catch (InvalidPesAllerFileException ipafe) {\r
- throw new StepValidationException(ipafe.getLocalizedMessage());\r
- }\r
-\r
- }else{\r
- throw new StepValidationException("Vérification annulée par l'utilisateur");\r
- }\r
- }\r
- }\r
- \r
-\r
- @Override\r
- public Component getUI() {\r
- return pesFileChooserPanelUI;\r
- }\r
-\r
- /**\r
- * @return the pesSchemaURL\r
- */\r
- public URL getPesSchemaURL() {\r
- return pesSchemaURL;\r
- }\r
-\r
- /**\r
- * @param pesSchemaURL the pesSchemaURL to set\r
- */\r
- public void setPesSchemaURL(URL pesSchemaURL) {\r
- this.pesSchemaURL = pesSchemaURL;\r
- }\r
-}\r