0001: /*
0002: * SalomeTMF is a Test Management Framework
0003: * Copyright (C) 2005 France Telecom R&D
0004: *
0005: * This library is free software; you can redistribute it and/or
0006: * modify it under the terms of the GNU Lesser General Public
0007: * License as published by the Free Software Foundation; either
0008: * version 2 of the License, or (at your option) any later version.
0009: *
0010: * This library is distributed in the hope that it will be useful,
0011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013: * Lesser General Public License for more details.
0014: *
0015: * You should have received a copy of the GNU Lesser General Public
0016: * License along with this library; if not, write to the Free Software
0017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018: *
0019: * @author Aurore PENAULT
0020: *
0021: * Contact: mikael.marche@rd.francetelecom.com
0022: */
0023:
0024: package salomeTMF_plug.gen_doc_xml;
0025:
0026: import java.awt.BorderLayout;
0027: import java.awt.Container;
0028: import java.awt.Dimension;
0029: import java.awt.FlowLayout;
0030: import java.awt.Font;
0031: import java.awt.event.ActionEvent;
0032: import java.awt.event.ActionListener;
0033: import java.io.File;
0034: import java.net.URL;
0035: import java.util.ArrayList;
0036: import java.util.Properties;
0037:
0038: import javax.swing.BorderFactory;
0039: import javax.swing.Box;
0040: import javax.swing.BoxLayout;
0041: import javax.swing.ButtonGroup;
0042: import javax.swing.JButton;
0043: import javax.swing.JCheckBox;
0044: import javax.swing.JDialog;
0045: import javax.swing.JFileChooser;
0046: import javax.swing.JLabel;
0047: import javax.swing.JOptionPane;
0048: import javax.swing.JPanel;
0049: import javax.swing.JProgressBar;
0050: import javax.swing.JRadioButton;
0051: import javax.swing.JTabbedPane;
0052: import javax.swing.JTextField;
0053: import javax.swing.border.TitledBorder;
0054: import javax.swing.tree.DefaultMutableTreeNode;
0055:
0056: import org.dom4j.Document;
0057: import org.dom4j.Element;
0058: import org.objectweb.salome_tmf.data.DataConstants;
0059: import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
0060: import org.objectweb.salome_tmf.ihm.main.SalomeTMFPanels;
0061: import org.objectweb.salome_tmf.ihm.models.ScriptFileFilter;
0062: import org.objectweb.salome_tmf.ihm.tools.Tools;
0063: import org.objectweb.salome_tmf.plugins.IPlugObject;
0064:
0065: import salomeTMF_plug.gen_doc_xml.languages.Language;
0066:
0067: /**
0068: * Classe créant l'IHM permettant à l'utilisateur de sélectionner
0069: * les différentes options pour la création de la documentation
0070: * @author vapu8214
0071: */
0072: public class GraphicDialog extends JDialog implements DataConstants {
0073:
0074: // Salome GUI
0075: static IPlugObject pIhm = null;
0076:
0077: private String fs = System.getProperties().getProperty(
0078: "file.separator");
0079:
0080: String htmlFile;
0081: int sourceType;
0082: boolean annule = false;
0083:
0084: JLabel frameMode;
0085: JCheckBox multiYes;
0086:
0087: JLabel testGraph;
0088: JCheckBox testYes;
0089:
0090: JLabel campGraph;
0091: JCheckBox campYes;
0092:
0093: JLabel execGraph;
0094: JCheckBox execYes;
0095:
0096: JLabel resGraph;
0097: JCheckBox resYes;
0098:
0099: JLabel nbLabel;
0100: JRadioButton nbYes;
0101: JLabel couleurLabel;
0102: JRadioButton couleurYes;
0103: ButtonGroup couleur;
0104:
0105: JLabel htmlLabel;
0106: JTextField htmlTextField;
0107: JButton htmlButton;
0108:
0109: JButton validationButton;
0110: JButton cancelButton;
0111:
0112: final String url_txt;
0113:
0114: JCheckBox formBox;
0115: JLabel formLabel;
0116: JCheckBox gardeBox;
0117: JLabel gardeMessage;
0118:
0119: JLabel gardeLabel;
0120: JTextField gardeTextField;
0121: JButton gardeButton;
0122: JButton formulaireButton;
0123: String gardeFile;
0124: JLabel enTeteLabel;
0125: JTextField enTeteTextField;
0126: JButton enTeteButton;
0127: String enTeteFile;
0128: JLabel piedLabel;
0129: JTextField piedTextField;
0130: JButton piedButton;
0131: String piedFile;
0132:
0133: ButtonGroup miseFormeGroup;
0134:
0135: JCheckBox execBox;
0136: JLabel execLabel;
0137: JCheckBox resExecBox;
0138: JLabel resExecLabel;
0139:
0140: /*
0141: * Barre de progression
0142: */
0143: JProgressBar progress;
0144:
0145: /*
0146: * Attributs pour l'inclusion des fichiers
0147: */
0148: JLabel inclusPhrase;
0149: JTextField inclusFormat;
0150: JCheckBox jpgBox;
0151: JCheckBox pngBox;
0152: JCheckBox gifBox;
0153: JLabel jpgLabel;
0154: JLabel pngLabel;
0155: JLabel gifLabel;
0156:
0157: Element pageGardeElement;
0158:
0159: JButton testSelectionButton;
0160: ArrayList suiteList;
0161: ArrayList familyList;
0162: ArrayList testList;
0163: JButton campSelectionButton;
0164: ArrayList campList;
0165: ArrayList execList;
0166:
0167: DefaultMutableTreeNode chosenRoot;
0168: boolean initSelection = false;
0169: boolean generation = false;
0170: URL genFic;
0171: URL urlBase;
0172:
0173: FormSave save;
0174:
0175: XmlGenerator generator;
0176:
0177: /** Creates a new instance of GraphicDialog */
0178: public GraphicDialog(int type, IPlugObject vt) {
0179: super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
0180: pIhm = vt;
0181: urlBase = SalomeTMFContext.getInstance().getUrlBase();
0182:
0183: String _urlBase = urlBase.toString();
0184: url_txt = _urlBase.substring(0, _urlBase.lastIndexOf("/"));
0185: sourceType = type;
0186:
0187: htmlLabel = new JLabel();
0188: htmlLabel.setText(Language.getInstance().getText(
0189: "Fichier_de_sauvegarde_pour_la_documentation_:"));
0190: htmlTextField = new JTextField(30);
0191: htmlButton = new JButton(Language.getInstance().getText(
0192: "Choisir..."));
0193: htmlButton.addActionListener(new ActionListener() {
0194: public void actionPerformed(ActionEvent e) {
0195: JFileChooser fileChooser = new JFileChooser();
0196: fileChooser
0197: .addChoosableFileFilter(new ScriptFileFilter(
0198: Language.getInstance().getText(
0199: "Fichier_HTML_[*.html]"),
0200: ".html"));
0201: fileChooser.setSelectedFile(new File("index.html"));
0202: int returnVal = fileChooser.showDialog(
0203: GraphicDialog.this , Language.getInstance()
0204: .getText("Sélectionner"));
0205: if (returnVal == JFileChooser.APPROVE_OPTION) {
0206: htmlFile = fileChooser.getSelectedFile()
0207: .getAbsolutePath();
0208: if (htmlFile.indexOf(".") != -1) {
0209: if (!htmlFile.substring(
0210: htmlFile.lastIndexOf(".")).equals(
0211: ".html")) {
0212: htmlFile += ".html";
0213: }
0214: } else {
0215: htmlFile += ".html";
0216: }
0217: htmlTextField.setText(htmlFile);
0218: }
0219: }
0220: });
0221:
0222: frameMode = new JLabel();
0223: frameMode.setText(Language.getInstance().getText(
0224: "Mode_multi-frames"));
0225: frameMode.setFont(new Font("TimesRoman", Font.BOLD, 13));
0226: multiYes = new JCheckBox();
0227:
0228: testGraph = new JLabel(Language.getInstance().getText(
0229: "Graphique_du_plan_de_tests"));
0230: testGraph.setFont(new Font("TimesRoman", Font.BOLD, 13));
0231: testYes = new JCheckBox();
0232:
0233: campGraph = new JLabel();
0234: campGraph.setText(Language.getInstance().getText(
0235: "Graphiques_des_campagnes"));
0236: campGraph.setFont(new Font("TimesRoman", Font.BOLD, 13));
0237: campYes = new JCheckBox();
0238:
0239: execGraph = new JLabel();
0240: execGraph.setText(Language.getInstance().getText(
0241: "Graphiques_des_exécutions"));
0242: execGraph.setFont(new Font("TimesRoman", Font.BOLD, 13));
0243: execYes = new JCheckBox();
0244:
0245: resGraph = new JLabel();
0246: resGraph.setText(Language.getInstance().getText(
0247: "Graphiques_des_résultats_d'exécutions"));
0248: resGraph.setFont(new Font("TimesRoman", Font.BOLD, 13));
0249: resYes = new JCheckBox();
0250:
0251: nbLabel = new JLabel(Language.getInstance().getText("N&B"));
0252: nbYes = new JRadioButton();
0253: nbYes.setSelected(true);
0254: couleurLabel = new JLabel(Language.getInstance().getText(
0255: "Couleur"));
0256: couleurYes = new JRadioButton();
0257: couleur = new ButtonGroup();
0258: couleur.add(nbYes);
0259: couleur.add(couleurYes);
0260:
0261: execBox = new JCheckBox();
0262: execBox.setSelected(true);
0263: resExecBox = new JCheckBox();
0264: resExecBox.setSelected(true);
0265: resExecBox.addActionListener(new ActionListener() {
0266: public void actionPerformed(ActionEvent e) {
0267: if (resExecBox.isSelected()) {
0268: execBox.setSelected(true);
0269: resGraph.setEnabled(true);
0270: resYes.setEnabled(true);
0271: execGraph.setEnabled(true);
0272: execYes.setEnabled(true);
0273: }
0274: if (!resExecBox.isSelected()) {
0275: resGraph.setEnabled(false);
0276: resYes.setEnabled(false);
0277: resYes.setSelected(false);
0278: }
0279: }
0280: });
0281: execBox.addActionListener(new ActionListener() {
0282: public void actionPerformed(ActionEvent e) {
0283: if (!execBox.isSelected()) {
0284: resExecBox.setSelected(false);
0285: resGraph.setEnabled(false);
0286: resYes.setEnabled(false);
0287: resYes.setSelected(false);
0288: execGraph.setEnabled(false);
0289: execYes.setEnabled(false);
0290: execYes.setSelected(false);
0291: }
0292: if (execBox.isSelected()) {
0293: execGraph.setEnabled(true);
0294: execYes.setEnabled(true);
0295: }
0296: }
0297: });
0298: execLabel = new JLabel(Language.getInstance().getText(
0299: "les_exécutions"));
0300: resExecLabel = new JLabel(Language.getInstance().getText(
0301: "les_résultats_d'exécutions"));
0302:
0303: inclusPhrase = new JLabel(
0304: Language
0305: .getInstance()
0306: .getText(
0307: "Extensions_des_fichiers_à_inclure_[*.txt,_*.java,_...]_:"));
0308: inclusFormat = new JTextField(30);
0309: jpgBox = new JCheckBox();
0310: pngBox = new JCheckBox();
0311: gifBox = new JCheckBox();
0312: jpgLabel = new JLabel(".jpeg");
0313: pngLabel = new JLabel(".png");
0314: gifLabel = new JLabel(".gif");
0315:
0316: validationButton = new JButton(Language.getInstance().getText(
0317: "Générer"));
0318: validationButton.addActionListener(new ActionListener() {
0319: public void actionPerformed(ActionEvent e) {
0320: Thread t = new Thread() {
0321: public void run() {
0322: // Instanciation et lancement du traitement
0323: genereDoc();
0324: }
0325: };
0326: t.start();
0327: }
0328: });
0329:
0330: cancelButton = new JButton(Language.getInstance().getText(
0331: "Annuler"));
0332: cancelButton.addActionListener(new ActionListener() {
0333: public void actionPerformed(ActionEvent e) {
0334: GraphicDialog.this .dispose();
0335: annule = true;
0336: }
0337: });
0338:
0339: formulaireButton = new JButton(Language.getInstance().getText(
0340: "Formulaire"));
0341: formulaireButton.addActionListener(new ActionListener() {
0342: public void actionPerformed(ActionEvent e) {
0343: new GardeDialog(GraphicDialog.this );
0344: }
0345: });
0346:
0347: formBox = new JCheckBox();
0348: formBox.addActionListener(new ActionListener() {
0349: public void actionPerformed(ActionEvent e) {
0350: gardeLabel.setEnabled(false);
0351: enTeteLabel.setEnabled(false);
0352: piedLabel.setEnabled(false);
0353: gardeTextField.setEnabled(false);
0354: enTeteTextField.setEnabled(false);
0355: enTeteButton.setEnabled(false);
0356: piedTextField.setEnabled(false);
0357: piedButton.setEnabled(false);
0358: gardeButton.setEnabled(false);
0359: formulaireButton.setEnabled(true);
0360: }
0361: });
0362: formBox.setSelected(true);
0363: formLabel = new JLabel(Language.getInstance().getText(
0364: "A_partir_d'un_"));
0365:
0366: gardeBox = new JCheckBox();
0367: gardeBox.addActionListener(new ActionListener() {
0368: public void actionPerformed(ActionEvent e) {
0369: gardeLabel.setEnabled(true);
0370: enTeteLabel.setEnabled(true);
0371: piedLabel.setEnabled(true);
0372: gardeTextField.setEnabled(true);
0373: enTeteTextField.setEnabled(true);
0374: enTeteButton.setEnabled(true);
0375: piedTextField.setEnabled(true);
0376: piedButton.setEnabled(true);
0377: gardeButton.setEnabled(true);
0378: formulaireButton.setEnabled(false);
0379: }
0380: });
0381: miseFormeGroup = new ButtonGroup();
0382: miseFormeGroup.add(formBox);
0383: miseFormeGroup.add(gardeBox);
0384: gardeMessage = new JLabel(Language.getInstance().getText(
0385: "A_partir_de_fichiers_html_:_"));
0386:
0387: gardeLabel = new JLabel();
0388: gardeLabel.setText(Language.getInstance().getText(
0389: "Page_de_garde_:"));
0390: gardeTextField = new JTextField(30);
0391: gardeButton = new JButton(Language.getInstance().getText(
0392: "Choisir..."));
0393: gardeButton.addActionListener(new ActionListener() {
0394: public void actionPerformed(ActionEvent e) {
0395: JFileChooser fileChooser = new JFileChooser();
0396: fileChooser
0397: .addChoosableFileFilter(new ScriptFileFilter(
0398: Language.getInstance().getText(
0399: "Fichier_HTML_[*.html]"),
0400: ".html"));
0401: int returnVal = fileChooser.showDialog(
0402: GraphicDialog.this , Language.getInstance()
0403: .getText("Sélectionner"));
0404: if (returnVal == JFileChooser.APPROVE_OPTION) {
0405: gardeFile = fileChooser.getSelectedFile()
0406: .getAbsolutePath();
0407: if (gardeFile.indexOf(".") != -1) {
0408: if (!gardeFile.substring(
0409: gardeFile.lastIndexOf(".")).equals(
0410: ".html")) {
0411: gardeFile += ".html";
0412: }
0413: } else {
0414: gardeFile += ".html";
0415: }
0416: gardeTextField.setText(gardeFile);
0417: }
0418: }
0419: });
0420:
0421: enTeteLabel = new JLabel();
0422: enTeteLabel
0423: .setText(Language.getInstance().getText("En-tête_:"));
0424: enTeteTextField = new JTextField(30);
0425: enTeteButton = new JButton(Language.getInstance().getText(
0426: "Choisir..."));
0427: enTeteButton.addActionListener(new ActionListener() {
0428: public void actionPerformed(ActionEvent e) {
0429: JFileChooser fileChooser = new JFileChooser();
0430: fileChooser
0431: .addChoosableFileFilter(new ScriptFileFilter(
0432: Language.getInstance().getText(
0433: "Fichier_HTML_[*.html]"),
0434: ".html"));
0435: int returnVal = fileChooser.showDialog(
0436: GraphicDialog.this , Language.getInstance()
0437: .getText("Sélectionner"));
0438: if (returnVal == JFileChooser.APPROVE_OPTION) {
0439: enTeteFile = fileChooser.getSelectedFile()
0440: .getAbsolutePath();
0441: if (enTeteFile.indexOf(".") != -1) {
0442: if (!enTeteFile.substring(
0443: enTeteFile.lastIndexOf(".")).equals(
0444: ".html")) {
0445: enTeteFile += ".html";
0446: }
0447: } else {
0448: enTeteFile += ".html";
0449: }
0450: enTeteTextField.setText(enTeteFile);
0451: }
0452: }
0453: });
0454:
0455: piedLabel = new JLabel();
0456: piedLabel.setText(Language.getInstance().getText(
0457: "Pied_de_page_:"));
0458: piedTextField = new JTextField(30);
0459: piedButton = new JButton(Language.getInstance().getText(
0460: "Choisir..."));
0461: piedButton.addActionListener(new ActionListener() {
0462: public void actionPerformed(ActionEvent e) {
0463: JFileChooser fileChooser = new JFileChooser();
0464: fileChooser
0465: .addChoosableFileFilter(new ScriptFileFilter(
0466: Language.getInstance().getText(
0467: "Fichier_HTML_[*.html]"),
0468: ".html"));
0469: int returnVal = fileChooser.showDialog(
0470: GraphicDialog.this , Language.getInstance()
0471: .getText("Sélectionner"));
0472: if (returnVal == JFileChooser.APPROVE_OPTION) {
0473: piedFile = fileChooser.getSelectedFile()
0474: .getAbsolutePath();
0475: if (piedFile.indexOf(".") != -1) {
0476: if (!piedFile.substring(
0477: piedFile.lastIndexOf(".")).equals(
0478: ".html")) {
0479: piedFile += ".html";
0480: }
0481: } else {
0482: piedFile += ".html";
0483: }
0484: piedTextField.setText(piedFile);
0485: }
0486: }
0487: });
0488:
0489: JPanel mode = new JPanel(new FlowLayout(FlowLayout.LEFT));
0490: TitledBorder outputTitle = BorderFactory
0491: .createTitledBorder(Language.getInstance().getText(
0492: "Sortie"));
0493: mode.setBorder(outputTitle);
0494: mode.add(multiYes);
0495: mode.add(frameMode);
0496:
0497: JPanel panelExec = new JPanel(new FlowLayout(FlowLayout.LEFT));
0498: panelExec.add(execBox);
0499: panelExec.add(execLabel);
0500: JPanel panelResExec = new JPanel(
0501: new FlowLayout(FlowLayout.LEFT));
0502: panelResExec.add(resExecBox);
0503: panelResExec.add(resExecLabel);
0504:
0505: JPanel choixCamp = new JPanel();
0506: choixCamp.setBorder(BorderFactory.createTitledBorder(Language
0507: .getInstance().getText("Inclure...")));
0508: choixCamp.setLayout(new BoxLayout(choixCamp, BoxLayout.Y_AXIS));
0509: choixCamp.add(panelExec);
0510: choixCamp.add(panelResExec);
0511:
0512: JPanel panelChoisir = new JPanel(
0513: new FlowLayout(FlowLayout.LEFT));
0514: panelChoisir.add(htmlButton);
0515: JPanel panelHtmlTF = new JPanel(new FlowLayout(FlowLayout.LEFT));
0516: panelHtmlTF.add(htmlTextField);
0517: JPanel panelHtmlLabel = new JPanel(new FlowLayout(
0518: FlowLayout.LEFT));
0519: panelHtmlLabel.add(htmlLabel);
0520:
0521: JPanel panelCenter = new JPanel();
0522: TitledBorder sauvTitle;
0523: sauvTitle = BorderFactory.createTitledBorder(Language
0524: .getInstance().getText("Sauvegarde"));
0525: panelCenter.setBorder(sauvTitle);
0526: panelCenter.setLayout(new BoxLayout(panelCenter,
0527: BoxLayout.Y_AXIS));
0528: panelCenter.add(panelHtmlLabel);
0529: panelCenter.add(panelHtmlTF);
0530: panelCenter.add(panelChoisir);
0531:
0532: JPanel buttons = new JPanel();
0533: buttons.add(validationButton);
0534: buttons.add(cancelButton);
0535:
0536: progress = new JProgressBar();
0537: JPanel progression = new JPanel(new FlowLayout(
0538: FlowLayout.CENTER));
0539: progression.add(progress);
0540:
0541: JPanel onglet1 = new JPanel();
0542: onglet1.setLayout(new BoxLayout(onglet1, BoxLayout.Y_AXIS));
0543: onglet1.add(mode);
0544: if (sourceType == CAMPAIGN) {
0545: onglet1.add(choixCamp);
0546: }
0547: onglet1.add(panelCenter);
0548: onglet1.add(Box.createRigidArea(new Dimension(1, 125)));
0549: onglet1.add(buttons);
0550: onglet1.add(Box.createRigidArea(new Dimension(1, 10)));
0551: onglet1.add(progression);
0552:
0553: JPanel panelForm = new JPanel(new FlowLayout(FlowLayout.LEFT));
0554: panelForm.add(formBox);
0555: panelForm.add(formLabel);
0556: panelForm.add(formulaireButton);
0557:
0558: JPanel ligneFic = new JPanel(new FlowLayout(FlowLayout.LEFT));
0559: ligneFic.add(gardeBox);
0560: ligneFic.add(gardeMessage);
0561:
0562: JPanel panelGardeLabel = new JPanel(new FlowLayout(
0563: FlowLayout.LEFT));
0564: panelGardeLabel.add(gardeLabel);
0565: JPanel panelGardeTF = new JPanel(
0566: new FlowLayout(FlowLayout.LEFT));
0567: panelGardeTF.add(gardeTextField);
0568: panelGardeLabel.add(gardeLabel);
0569: JPanel panelTeteLabel = new JPanel(new FlowLayout(
0570: FlowLayout.LEFT));
0571: panelTeteLabel.add(enTeteLabel);
0572: JPanel panelTeteTF = new JPanel(new FlowLayout(FlowLayout.LEFT));
0573: panelTeteTF.add(enTeteTextField);
0574: JPanel panelTeteButton = new JPanel(new FlowLayout(
0575: FlowLayout.LEFT));
0576: panelTeteButton.add(enTeteButton);
0577: JPanel panelPiedLabel = new JPanel(new FlowLayout(
0578: FlowLayout.LEFT));
0579: panelPiedLabel.add(piedLabel);
0580: JPanel panelPiedTF = new JPanel(new FlowLayout(FlowLayout.LEFT));
0581: panelPiedTF.add(piedTextField);
0582: JPanel panelPiedButton = new JPanel(new FlowLayout(
0583: FlowLayout.LEFT));
0584: panelPiedButton.add(piedButton);
0585: JPanel panelGardeChoisir = new JPanel(new FlowLayout(
0586: FlowLayout.LEFT));
0587: panelGardeChoisir.add(gardeButton);
0588: JPanel fichier = new JPanel();
0589: fichier.setLayout(new BoxLayout(fichier, BoxLayout.Y_AXIS));
0590: fichier.add(panelGardeLabel);
0591: fichier.add(panelGardeTF);
0592: fichier.add(panelGardeChoisir);
0593: fichier.add(Box.createRigidArea(new Dimension(1, 10)));
0594: fichier.add(panelTeteLabel);
0595: fichier.add(panelTeteTF);
0596: fichier.add(panelTeteButton);
0597: fichier.add(Box.createRigidArea(new Dimension(1, 10)));
0598: fichier.add(panelPiedLabel);
0599: fichier.add(panelPiedTF);
0600: fichier.add(panelPiedButton);
0601: gardeLabel.setEnabled(false);
0602: enTeteLabel.setEnabled(false);
0603: piedLabel.setEnabled(false);
0604: gardeTextField.setEnabled(false);
0605: enTeteTextField.setEnabled(false);
0606: enTeteButton.setEnabled(false);
0607: piedTextField.setEnabled(false);
0608: piedButton.setEnabled(false);
0609: gardeButton.setEnabled(false);
0610:
0611: JPanel onglet2 = new JPanel();
0612: onglet2.setLayout(new BoxLayout(onglet2, BoxLayout.Y_AXIS));
0613: onglet2.add(panelForm);
0614: onglet2.add(Box.createRigidArea(new Dimension(1, 10)));
0615: onglet2.add(ligneFic);
0616: onglet2.add(fichier);
0617:
0618: testSelectionButton = new JButton(Language.getInstance()
0619: .getText("Sélection_des_tests..."));
0620: testSelectionButton.addActionListener(new ActionListener() {
0621: public void actionPerformed(ActionEvent e) {
0622: if (!initSelection) {
0623: new TestChooser(SalomeTMFPanels
0624: .getTestDynamicTree().getRoot(),
0625: GraphicDialog.this , initSelection);
0626: } else {
0627: new TestChooser(SalomeTMFPanels
0628: .getTestDynamicTree().getRoot(),
0629: GraphicDialog.this , initSelection);
0630: }
0631: }
0632: });
0633: JPanel selectPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
0634: selectPanel.setBorder(BorderFactory.createTitledBorder(Language
0635: .getInstance().getText("Filtrage")));
0636:
0637: campSelectionButton = new JButton(Language.getInstance()
0638: .getText("Sélection_des_campagnes..."));
0639: campSelectionButton.addActionListener(new ActionListener() {
0640: public void actionPerformed(ActionEvent e) {
0641: if (!initSelection) {
0642: new TestChooser(SalomeTMFPanels
0643: .getCampaignDynamicTree().getRoot(),
0644: GraphicDialog.this , initSelection);
0645: } else {
0646: new TestChooser(SalomeTMFPanels
0647: .getCampaignDynamicTree().getRoot(),
0648: GraphicDialog.this , initSelection);
0649: }
0650: }
0651: });
0652: if (sourceType != CAMPAIGN) {
0653: selectPanel.add(testSelectionButton);
0654: } else {
0655: selectPanel.add(campSelectionButton);
0656: }
0657:
0658: JPanel testGraphPanel = new JPanel(new FlowLayout(
0659: FlowLayout.LEFT));
0660: testGraphPanel.add(testYes);
0661: testGraphPanel.add(testGraph);
0662: JPanel un = new JPanel(new FlowLayout(FlowLayout.LEFT));
0663: un.add(campYes);
0664: un.add(campGraph);
0665: JPanel deux = new JPanel(new FlowLayout(FlowLayout.LEFT));
0666: deux.add(execYes);
0667: deux.add(execGraph);
0668: JPanel trois = new JPanel(new FlowLayout(FlowLayout.LEFT));
0669: trois.add(resYes);
0670: trois.add(resGraph);
0671:
0672: JPanel couleurPanel = new JPanel(
0673: new FlowLayout(FlowLayout.LEFT));
0674: couleurPanel.setBorder(BorderFactory
0675: .createTitledBorder(Language.getInstance().getText(
0676: "Mode_d'impression")));
0677: couleurPanel.add(nbYes);
0678: couleurPanel.add(nbLabel);
0679: couleurPanel.add(couleurYes);
0680: couleurPanel.add(couleurLabel);
0681:
0682: JPanel panelGraphique = new JPanel();
0683: TitledBorder graphTitle;
0684: graphTitle = BorderFactory.createTitledBorder(Language
0685: .getInstance().getText("Gestion_des_graphiques"));
0686: panelGraphique.setBorder(graphTitle);
0687: panelGraphique.setLayout(new BoxLayout(panelGraphique,
0688: BoxLayout.Y_AXIS));
0689: if (sourceType == CAMPAIGN) {
0690: panelGraphique.add(testGraphPanel);
0691: panelGraphique.add(un);
0692: panelGraphique.add(deux);
0693: panelGraphique.add(trois);
0694: } else {
0695: panelGraphique.add(testGraphPanel);
0696: }
0697: panelGraphique.add(couleurPanel);
0698:
0699: JPanel inclusLabelPanel = new JPanel(new FlowLayout(
0700: FlowLayout.LEFT));
0701: inclusLabelPanel.add(inclusPhrase);
0702: JPanel inclusTFPanel = new JPanel(new FlowLayout(
0703: FlowLayout.LEFT));
0704: inclusTFPanel.add(inclusFormat);
0705: JPanel inclusionPanel = new JPanel();
0706: inclusionPanel.setLayout(new BoxLayout(inclusionPanel,
0707: BoxLayout.Y_AXIS));
0708: inclusionPanel.setBorder(BorderFactory
0709: .createTitledBorder(Language.getInstance().getText(
0710: "Fichiers_textes")));
0711: inclusionPanel.add(inclusLabelPanel);
0712: inclusionPanel.add(inclusTFPanel);
0713:
0714: JPanel imgJpgPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
0715: imgJpgPanel.add(jpgBox);
0716: imgJpgPanel.add(jpgLabel);
0717: JPanel imgGifPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
0718: imgGifPanel.add(gifBox);
0719: imgGifPanel.add(gifLabel);
0720: JPanel imgPngPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
0721: imgPngPanel.add(pngBox);
0722: imgPngPanel.add(pngLabel);
0723:
0724: JPanel imgPanel = new JPanel();
0725: imgPanel.setLayout(new BoxLayout(imgPanel, BoxLayout.Y_AXIS));
0726: imgPanel.setBorder(BorderFactory.createTitledBorder(Language
0727: .getInstance().getText("Fichiers_images")));
0728: imgPanel.add(imgJpgPanel);
0729: imgPanel.add(imgGifPanel);
0730: imgPanel.add(imgPngPanel);
0731:
0732: JPanel inclusTotalPanel = new JPanel();
0733: inclusTotalPanel.setLayout(new BoxLayout(inclusTotalPanel,
0734: BoxLayout.Y_AXIS));
0735: inclusTotalPanel.setBorder(BorderFactory
0736: .createTitledBorder(Language.getInstance().getText(
0737: "Inclusion_des_fichiers")));
0738: inclusTotalPanel.add(inclusionPanel);
0739: inclusTotalPanel.add(imgPanel);
0740:
0741: JPanel onglet3 = new JPanel();
0742: onglet3.setLayout(new BoxLayout(onglet3, BoxLayout.Y_AXIS));
0743: onglet3.add(selectPanel);
0744: onglet3.add(Box.createRigidArea(new Dimension(1, 10)));
0745: onglet3.add(panelGraphique);
0746: onglet3.add(Box.createRigidArea(new Dimension(1, 10)));
0747: onglet3.add(inclusTotalPanel);
0748:
0749: JTabbedPane onglets = new JTabbedPane();
0750: onglets.addTab(Language.getInstance().getText("Principal"),
0751: onglet1);
0752: onglets.addTab(Language.getInstance().getText("Mise_en_Forme"),
0753: onglet2);
0754: onglets.addTab(Language.getInstance().getText("Options"),
0755: onglet3);
0756:
0757: Container contentPaneFrame = this .getContentPane();
0758: contentPaneFrame.add(onglets, BorderLayout.CENTER);
0759: this .setLocation(400, 100);
0760: this .setTitle(Language.getInstance().getText(
0761: "Génération_de_document"));
0762: this .pack();
0763: this .setVisible(true);
0764: }
0765:
0766: /**
0767: * Génération de la documentation
0768: * Appel des méthodes de XmlGenerator
0769: */
0770: public void genereDoc() {
0771: boolean ok = true;
0772: if (htmlTextField.getText().equals("")) {
0773: JOptionPane
0774: .showMessageDialog(
0775: GraphicDialog.this ,
0776: Language
0777: .getInstance()
0778: .getText(
0779: "Vous_devez_entrez_un_nom_de_fichier_pour_le_document_généré"),
0780: Language.getInstance().getText("Erreur_!"),
0781: JOptionPane.ERROR_MESSAGE);
0782: ok = false;
0783: } else {
0784: String[] ficType = null;
0785: if (!inclusFormat.getText().equals("")) {
0786: ficType = inclusFormat.getText().split(",");
0787: }
0788: generator = new XmlGenerator(pIhm);
0789: progress.setIndeterminate(true);
0790: Properties sys = System.getProperties();
0791: // Repertoire temporaire système
0792: String tmpDir = sys.getProperty("java.io.tmpdir");
0793: String saveFileName = htmlTextField.getText().trim();
0794:
0795: String xmlDirName = saveFileName.substring(0, saveFileName
0796: .lastIndexOf(fs));
0797: URL dtdStat = null;
0798: URL dtdDyna = null;
0799: URL css = null;
0800: URL translate = null;
0801: try {
0802: css = new URL(url_txt
0803: + "/plugins/gen_doc_xml/xsl/salome.css");
0804: dtdStat = new URL(url_txt
0805: + "/plugins/gen_doc_xml/xsl/SalomeStatique.dtd");
0806: dtdDyna = new URL(
0807: url_txt
0808: + "/plugins/gen_doc_xml/xsl/SalomeDynamique.dtd");
0809: translate = new URL(url_txt
0810: + "/plugins/gen_doc_xml/xsl/translate.xml");
0811: // Cas serveur
0812: if (!annule) {
0813: try {
0814: Tools.writeFile(dtdStat.openStream(), tmpDir
0815: + fs + "SalomeStatique.dtd");
0816: Tools.writeFile(dtdStat.openStream(),
0817: xmlDirName + fs + "SalomeStatique.dtd");
0818: Tools.writeFile(dtdDyna.openStream(), tmpDir
0819: + fs + "SalomeDynamique.dtd");
0820: Tools
0821: .writeFile(dtdDyna.openStream(),
0822: xmlDirName + fs
0823: + "SalomeDynamique.dtd");
0824: Tools.writeFile(css.openStream(), xmlDirName
0825: + fs + "salome.css");
0826: Tools.writeFile(translate.openStream(), tmpDir
0827: + fs + "translate.xml");
0828: Tools.writeFile(translate.openStream(),
0829: xmlDirName + fs + "translate.xml");
0830: } catch (Exception exception) {
0831: // Cas DEBUG
0832: Tools
0833: .writeFile(
0834: GraphicDialog.class
0835: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/SalomeStatique.dtd"),
0836: tmpDir + fs
0837: + "SalomeStatique.dtd");
0838: Tools
0839: .writeFile(
0840: GraphicDialog.class
0841: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/SalomeStatique.dtd"),
0842: xmlDirName + fs
0843: + "SalomeStatique.dtd");
0844: Tools
0845: .writeFile(
0846: GraphicDialog.class
0847: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/SalomeDynamique.dtd"),
0848: tmpDir + fs
0849: + "SalomeDynamique.dtd");
0850: Tools
0851: .writeFile(
0852: GraphicDialog.class
0853: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/SalomeDynamique.dtd"),
0854: xmlDirName + fs
0855: + "SalomeDynamique.dtd");
0856: Tools
0857: .writeFile(
0858: GraphicDialog.class
0859: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/salome.css"),
0860: xmlDirName + fs + "salome.css");
0861: Tools
0862: .writeFile(
0863: GraphicDialog.class
0864: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/translate.xml"),
0865: tmpDir + fs + "translate.xml");
0866: Tools
0867: .writeFile(
0868: GraphicDialog.class
0869: .getResourceAsStream("/salome/plugins/gen_doc_xml/xsl/translate.xml"),
0870: xmlDirName + fs
0871: + "translate.xml");
0872:
0873: }
0874: }
0875: } catch (Exception e) {
0876: e.printStackTrace();
0877: Tools.ihmExceptionView(e);
0878: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_de_chargement_des_fichiers_nécessaires_à_la_transformation")+e.toString());
0879:
0880: ok = false;
0881: GraphicDialog.this .dispose();
0882: }
0883: String dirHtml = saveFileName.substring(0, saveFileName
0884: .lastIndexOf(fs));
0885: String staticHtml = saveFileName.substring(saveFileName
0886: .lastIndexOf(fs), saveFileName.lastIndexOf("."))
0887: + "static.html";
0888: if (staticHtml.startsWith(fs)) {
0889: staticHtml = staticHtml.substring(1, staticHtml
0890: .length());
0891: }
0892: //System.out.println("dir HTML = " + dirHtml);
0893: //System.out.println("Static HTML = " + staticHtml);
0894: //Génération du fichier xml pour le dossier de tests
0895: if (!annule) {
0896: Document doc = generator.toDocument(dirHtml,
0897: familyList, suiteList, testList, ficType);
0898: try {
0899: generator.documentToXML(doc, tmpDir + fs
0900: + "testSalome.xml");
0901: generator.documentToXML(doc, xmlDirName + fs
0902: + "testSalome.xml");
0903: } catch (Exception e) {
0904: e.printStackTrace();
0905: Tools.ihmExceptionView(e);
0906: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_création_du_fichier_xml")+e.toString());
0907: ok = false;
0908: GraphicDialog.this .dispose();
0909: }
0910: }
0911: if (testYes.isSelected() && !annule) {
0912: generator.createJpegFile(dirHtml, url_txt,
0913: "/plugins/gen_doc_xml/xsl/createSVG.xsl",
0914: familyList, suiteList, testList, nbYes
0915: .isSelected());
0916: }
0917: if (sourceType == CAMPAIGN && !annule) {
0918: //tableau pour la sélection des graphiques
0919: boolean[] tab = new boolean[6];
0920: tab[0] = campYes.isSelected(); //sélection du graphique des campagnes
0921: tab[1] = execYes.isSelected(); //sélection du graphique des exécutions
0922: tab[2] = resYes.isSelected(); //sélection du graphique des résultats d'exécution
0923: tab[4] = execBox.isSelected(); //inclure les exécutions dans le dossier des campagnes
0924: tab[5] = resExecBox.isSelected(); //inclure les résultats d'exécutions dans le dossier des campagnes
0925: //Génération des graphiques demandés
0926: if (!annule) {
0927: generator.createJpegFile(tab, dirHtml, url_txt,
0928: "/plugins/gen_doc_xml/xsl/createSVG.xsl",
0929: campList, execList, nbYes.isSelected());
0930: try {
0931: //Création du dossier de tests
0932: generator
0933: .transform(
0934: null,
0935: "",
0936: tmpDir + fs + "testSalome.xml",
0937: url_txt,
0938: "/plugins/gen_doc_xml/xsl/statiqueXmlToHtml.xsl",
0939: dirHtml + fs + staticHtml,
0940: jpgBox.isSelected(), gifBox
0941: .isSelected(), pngBox
0942: .isSelected(), testYes
0943: .isSelected(),
0944: xmlDirName);
0945: //Création du document contenant les exigences
0946: String requirementsFileName = dirHtml + fs
0947: + "requirements.html";
0948: generator
0949: .transform(
0950: tab,
0951: "",
0952: tmpDir + fs + "testSalome.xml",
0953: url_txt,
0954: "/plugins/gen_doc_xml/xsl/requirementsXmlToHtml.xsl",
0955: requirementsFileName, jpgBox
0956: .isSelected(), gifBox
0957: .isSelected(), pngBox
0958: .isSelected(), testYes
0959: .isSelected(),
0960: xmlDirName);
0961: } catch (Exception e) {
0962: Tools.ihmExceptionView(e);
0963: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_transformation_en_html")+e.toString());
0964: ok = false;
0965: GraphicDialog.this .dispose();
0966: }
0967: miseEnForme(dirHtml + fs + staticHtml);
0968: }
0969: //Création du fichier xml pour les campagnes
0970: if (!annule) {
0971: Document doc2 = generator.toDocumentDyna(dirHtml,
0972: campList, execList, ficType);
0973: try {
0974: generator.documentToXML(doc2, tmpDir + fs
0975: + "testSalomeDyna.xml");
0976: generator.documentToXML(doc2, xmlDirName + fs
0977: + "testSalomeDyna.xml");
0978: } catch (Exception e) {
0979: Tools.ihmExceptionView(e);
0980: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_création_du_fichier_xml")+e.toString());
0981: ok = false;
0982: GraphicDialog.this .dispose();
0983: }
0984: tab[3] = multiYes.isSelected(); //mode multi-frames
0985: if (tab[3]) {
0986: //Mode = multi-frames => création de 3 fichiers html
0987: String sommaire = saveFileName.substring(0,
0988: saveFileName.lastIndexOf("."))
0989: + "_sommaire.html";
0990: String tests = saveFileName.substring(0,
0991: saveFileName.lastIndexOf("."))
0992: + "_princ.html";
0993: try {
0994: generator
0995: .transform(
0996: tab,
0997: staticHtml,
0998: tmpDir
0999: + fs
1000: + "testSalomeDyna.xml",
1001: url_txt,
1002: "/plugins/gen_doc_xml/xsl/frameDynaXmlToHtml.xsl",
1003: saveFileName, jpgBox
1004: .isSelected(),
1005: gifBox.isSelected(), pngBox
1006: .isSelected(),
1007: testYes.isSelected(),
1008: xmlDirName);
1009: generator
1010: .transform(
1011: tab,
1012: staticHtml,
1013: tmpDir
1014: + fs
1015: + "testSalomeDyna.xml",
1016: url_txt,
1017: "/plugins/gen_doc_xml/xsl/frameSommaireDynaXmlToHtml.xsl",
1018: sommaire, jpgBox
1019: .isSelected(),
1020: gifBox.isSelected(), pngBox
1021: .isSelected(),
1022: testYes.isSelected(),
1023: xmlDirName);
1024: generator
1025: .transform(
1026: tab,
1027: staticHtml,
1028: tmpDir
1029: + fs
1030: + "testSalomeDyna.xml",
1031: url_txt,
1032: "/plugins/gen_doc_xml/xsl/frameCampDynaXmlToHtml.xsl",
1033: tests, jpgBox.isSelected(),
1034: gifBox.isSelected(), pngBox
1035: .isSelected(),
1036: testYes.isSelected(),
1037: xmlDirName);
1038: } catch (Exception e) {
1039: Tools.ihmExceptionView(e);
1040: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_transformation_en_html")+e.toString());
1041: ok = false;
1042: GraphicDialog.this .dispose();
1043: }
1044: miseEnForme(tests);
1045: } else {
1046: try {
1047: //création du fichier html pour les campages en mode simple frame
1048: generator
1049: .transform(
1050: tab,
1051: staticHtml,
1052: tmpDir
1053: + fs
1054: + "testSalomeDyna.xml",
1055: url_txt,
1056: "/plugins/gen_doc_xml/xsl/dynaXmlToHtml.xsl",
1057: saveFileName, jpgBox
1058: .isSelected(),
1059: gifBox.isSelected(), pngBox
1060: .isSelected(),
1061: testYes.isSelected(),
1062: xmlDirName);
1063: } catch (Exception e) {
1064: Tools.ihmExceptionView(e);
1065: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_transformation_en_html")+e.toString());
1066: ok = false;
1067: GraphicDialog.this .dispose();
1068: }
1069: miseEnForme(saveFileName);
1070: }
1071: }
1072: } else {
1073: //Juste le dossier de tests
1074: //mode multi-frame
1075: if (!annule) {
1076: boolean[] tab = new boolean[4];
1077: tab[3] = multiYes.isSelected();
1078: if (tab[3]) {
1079: String sommaire = saveFileName.substring(0,
1080: saveFileName.lastIndexOf("."))
1081: + "_sommaire.html";
1082: String tests = saveFileName.substring(0,
1083: saveFileName.lastIndexOf("."))
1084: + "_princ.html";
1085: try {
1086: //System.out.println("[genereDoc] transform with frameStatiqueXmlToHtml");
1087: generator
1088: .transform(
1089: tab,
1090: "",
1091: tmpDir + fs
1092: + "testSalome.xml",
1093: url_txt,
1094: "/plugins/gen_doc_xml/xsl/frameStatiqueXmlToHtml.xsl",
1095: saveFileName, jpgBox
1096: .isSelected(),
1097: gifBox.isSelected(), pngBox
1098: .isSelected(),
1099: testYes.isSelected(),
1100: xmlDirName);
1101: //System.out.println("[genereDoc] transform with frameSommaireStatiqueXmlToHtml");
1102: generator
1103: .transform(
1104: tab,
1105: "",
1106: tmpDir + fs
1107: + "testSalome.xml",
1108: url_txt,
1109: "/plugins/gen_doc_xml/xsl/frameSommaireStatiqueXmlToHtml.xsl",
1110: sommaire, jpgBox
1111: .isSelected(),
1112: gifBox.isSelected(), pngBox
1113: .isSelected(),
1114: testYes.isSelected(),
1115: xmlDirName);
1116: //System.out.println("[genereDoc] transform with frameTestsStatiqueXmlToHtml");
1117: generator
1118: .transform(
1119: tab,
1120: "",
1121: tmpDir + fs
1122: + "testSalome.xml",
1123: url_txt,
1124: "/plugins/gen_doc_xml/xsl/frameTestsStatiqueXmlToHtml.xsl",
1125: tests, jpgBox.isSelected(),
1126: gifBox.isSelected(), pngBox
1127: .isSelected(),
1128: testYes.isSelected(),
1129: xmlDirName);
1130: String indexRequirements = saveFileName
1131: .substring(0, saveFileName
1132: .lastIndexOf(fs))
1133: + fs + "requirements.html";
1134: String sommaireRequirements = saveFileName
1135: .substring(0, saveFileName
1136: .lastIndexOf(fs))
1137: + fs + "requirements_sommaire.html";
1138: String requirements = saveFileName
1139: .substring(0, saveFileName
1140: .lastIndexOf(fs))
1141: + fs + "requirements_princ.html";
1142: //System.out.println("[genereDoc] transform with requirementsIndexXmlToHtml");
1143: generator
1144: .transform(
1145: tab,
1146: "",
1147: tmpDir + fs
1148: + "testSalome.xml",
1149: url_txt,
1150: "/plugins/gen_doc_xml/xsl/requirementsIndexXmlToHtml.xsl",
1151: indexRequirements, jpgBox
1152: .isSelected(),
1153: gifBox.isSelected(), pngBox
1154: .isSelected(),
1155: testYes.isSelected(),
1156: xmlDirName);
1157: //System.out.println("[genereDoc] transform with requirementsSommaireXmlToHtml");
1158: generator
1159: .transform(
1160: tab,
1161: "",
1162: tmpDir + fs
1163: + "testSalome.xml",
1164: url_txt,
1165: "/plugins/gen_doc_xml/xsl/requirementsSommaireXmlToHtml.xsl",
1166: sommaireRequirements,
1167: jpgBox.isSelected(), gifBox
1168: .isSelected(),
1169: pngBox.isSelected(),
1170: testYes.isSelected(),
1171: xmlDirName);
1172: //System.out.println("[genereDoc] transform with requirementsPrincXmlToHtml");
1173: generator
1174: .transform(
1175: tab,
1176: "",
1177: tmpDir + fs
1178: + "testSalome.xml",
1179: url_txt,
1180: "/plugins/gen_doc_xml/xsl/requirementsPrincXmlToHtml.xsl",
1181: requirements, jpgBox
1182: .isSelected(),
1183: gifBox.isSelected(), pngBox
1184: .isSelected(),
1185: testYes.isSelected(),
1186: xmlDirName);
1187: } catch (Exception e) {
1188: Tools.ihmExceptionView(e);
1189: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_transformation_en_html")+e.toString());
1190: ok = false;
1191: GraphicDialog.this .dispose();
1192: }
1193: miseEnForme(tests);
1194: } else {
1195: try {
1196: //mode simple frame
1197: generator
1198: .transform(
1199: tab,
1200: "",
1201: tmpDir + fs
1202: + "testSalome.xml",
1203: url_txt,
1204: "/plugins/gen_doc_xml/xsl/statiqueXmlToHtml.xsl",
1205: saveFileName, jpgBox
1206: .isSelected(),
1207: gifBox.isSelected(), pngBox
1208: .isSelected(),
1209: testYes.isSelected(),
1210: xmlDirName);
1211: String requirementsFileName = saveFileName
1212: .substring(0, saveFileName
1213: .lastIndexOf(fs))
1214: + fs + "requirements.html";
1215: generator
1216: .transform(
1217: tab,
1218: "",
1219: tmpDir + fs
1220: + "testSalome.xml",
1221: url_txt,
1222: "/plugins/gen_doc_xml/xsl/requirementsXmlToHtml.xsl",
1223: requirementsFileName,
1224: jpgBox.isSelected(), gifBox
1225: .isSelected(),
1226: pngBox.isSelected(),
1227: testYes.isSelected(),
1228: xmlDirName);
1229: } catch (Exception e) {
1230: Tools.ihmExceptionView(e);
1231: //Tools.ihmExceptionView(Language.getInstance().getText("Erreur_lors_de_la_transformation_en_html")+e.toString());
1232: ok = false;
1233: GraphicDialog.this .dispose();
1234: }
1235: miseEnForme(saveFileName);
1236: }
1237: }
1238: }
1239: if (ok && !annule) {
1240: progress.setVisible(false);
1241: JOptionPane
1242: .showMessageDialog(
1243: GraphicDialog.this ,
1244: Language
1245: .getInstance()
1246: .getText(
1247: "La_génération_de_document_s'est_terminée_avec_succès."),
1248: Language.getInstance().getText(
1249: "Information..."),
1250: JOptionPane.INFORMATION_MESSAGE);
1251: GraphicDialog.this .dispose();
1252: }
1253: }
1254: }
1255:
1256: /**
1257: * Méthode qui appelle les méthodes de XmlGenerator qui permettent d'ajouter les éléments
1258: * de la mise en forme en fonction de ce qui a été rempli dans l'onglet "mise en forme" de l'IHM
1259: * @param path page html auquel on ajoute une mise en page
1260: */
1261: public void miseEnForme(String path) {
1262: try {
1263: if (gardeBox.isSelected()) {
1264: //Insertion en-tête
1265: if (!enTeteTextField.getText().equals("")) {
1266: generator.addTitlePage(path, enTeteTextField
1267: .getText().trim(), true);
1268: }
1269: //Insertion page de garde
1270: if (!gardeTextField.getText().equals("")) {
1271: generator.addTitlePage(path, gardeTextField
1272: .getText().trim(), true);
1273: }
1274: //Insertion pied de page
1275: if (!piedTextField.getText().equals("")) {
1276: generator.addTitlePage(path, piedTextField
1277: .getText().trim(), false);
1278: }
1279: } else {
1280: //Insertion page de garde et/ou Pied de page avec formulaire de création
1281: if (pageGardeElement != null) {
1282: generator
1283: .addTitlePage(path, pageGardeElement, true);
1284: }
1285: }
1286: } catch (Exception e) {
1287: Tools.ihmExceptionView(e);
1288: //Tools.ihmExceptionView(Language.getInstance().getText("Problème_lors_de_l\'insertion_de_la_mise_en_forme")+e.toString());
1289: }
1290: }
1291:
1292: public void setElement(Element e) {
1293: pageGardeElement = e;
1294: }
1295:
1296: public Element getElement() {
1297: return pageGardeElement;
1298: }
1299:
1300: public void setSuiteList(ArrayList li) {
1301: suiteList = li;
1302: }
1303:
1304: public ArrayList getFamilyList() {
1305: return familyList;
1306: }
1307:
1308: public void setFamilyList(ArrayList li) {
1309: familyList = li;
1310: }
1311:
1312: public ArrayList getSuiteList() {
1313: return suiteList;
1314: }
1315:
1316: public void setTestList(ArrayList li) {
1317: testList = li;
1318: }
1319:
1320: public ArrayList getTestList() {
1321: return testList;
1322: }
1323:
1324: public void setCampList(ArrayList camp) {
1325: campList = camp;
1326: }
1327:
1328: public ArrayList getCampList() {
1329: return campList;
1330: }
1331:
1332: public void setExecList(ArrayList exec) {
1333: execList = exec;
1334: }
1335:
1336: public ArrayList getExecList() {
1337: return execList;
1338: }
1339:
1340: public void annule() {
1341: annule = true;
1342: GraphicDialog.this .dispose();
1343: }
1344:
1345: /**
1346: * Getter for property chosenRoot.
1347: * @return Value of property chosenRoot.
1348: */
1349: public javax.swing.tree.DefaultMutableTreeNode getChosenRoot() {
1350: return chosenRoot;
1351: }
1352:
1353: /**
1354: * Setter for property chosenRoot.
1355: * @param chosenRoot New value of property chosenRoot.
1356: */
1357: public void setChosenRoot(
1358: javax.swing.tree.DefaultMutableTreeNode chosenRoot) {
1359: this .chosenRoot = chosenRoot;
1360: }
1361:
1362: /**
1363: * Getter for property initSelection.
1364: * @return Value of property initSelection.
1365: */
1366: public boolean isInitSelection() {
1367: return initSelection;
1368: }
1369:
1370: /**
1371: * Setter for property initSelection.
1372: * @param initSelection New value of property initSelection.
1373: */
1374: public void setInitSelection(boolean initSelection) {
1375: this .initSelection = initSelection;
1376: }
1377:
1378: /**
1379: * Getter for property save.
1380: * @return Value of property save.
1381: */
1382: public salomeTMF_plug.gen_doc_xml.FormSave getSave() {
1383: return save;
1384: }
1385:
1386: /**
1387: * Setter for property save.
1388: * @param save New value of property save.
1389: */
1390: public void setSave(salomeTMF_plug.gen_doc_xml.FormSave save) {
1391: this .save = save;
1392: }
1393:
1394: /**
1395: * Getter for property url_txt.
1396: * @return Value of property url_txt.
1397: */
1398: public java.lang.String getUrl_txt() {
1399: return url_txt;
1400: }
1401:
1402: /**
1403: * @return Returns the sourceType.
1404: */
1405: public int getSourceType() {
1406: return sourceType;
1407: }
1408:
1409: /**
1410: * @param sourceType The sourceType to set.
1411: */
1412: public void setSourceType(int sourceType) {
1413: this.sourceType = sourceType;
1414: }
1415: }
|