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 Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
0020: *
0021: * Contact: mikael.marche@rd.francetelecom.com
0022: */
0023:
0024: package org.objectweb.salome_tmf.ihm;
0025:
0026: import java.awt.BorderLayout;
0027: import java.awt.Color;
0028: import java.awt.Container;
0029: import java.awt.Cursor;
0030: import java.awt.Dimension;
0031: import java.awt.FlowLayout;
0032: import java.awt.Font;
0033: import java.awt.Frame;
0034: import java.awt.GridLayout;
0035: import java.awt.event.ActionEvent;
0036: import java.awt.event.ActionListener;
0037: import java.net.MalformedURLException;
0038: import java.net.URL;
0039: import java.util.HashMap;
0040: import java.util.Hashtable;
0041: import java.util.Iterator;
0042: import java.util.Locale;
0043: import java.util.Map;
0044: import java.util.Observable;
0045: import java.util.Observer;
0046: import java.util.Vector;
0047:
0048: import javax.swing.BorderFactory;
0049: import javax.swing.Box;
0050: import javax.swing.BoxLayout;
0051: import javax.swing.JApplet;
0052: import javax.swing.JButton;
0053: import javax.swing.JLabel;
0054: import javax.swing.JMenu;
0055: import javax.swing.JMenuBar;
0056: import javax.swing.JMenuItem;
0057: import javax.swing.JOptionPane;
0058: import javax.swing.JPanel;
0059: import javax.swing.JScrollPane;
0060: import javax.swing.JTabbedPane;
0061: import javax.swing.JTextPane;
0062: import javax.swing.LookAndFeel;
0063: import javax.swing.UIManager;
0064: import javax.swing.event.ChangeEvent;
0065: import javax.swing.event.ChangeListener;
0066:
0067: import org.java.plugin.Extension;
0068: import org.java.plugin.ExtensionPoint;
0069: import org.java.plugin.PluginManager;
0070: import org.objectweb.salome_tmf.api.Api;
0071: import org.objectweb.salome_tmf.api.api2ihm.AdminProject;
0072: import org.objectweb.salome_tmf.data.ConnectionData;
0073: import org.objectweb.salome_tmf.data.DataConstants;
0074: import org.objectweb.salome_tmf.data.Element;
0075: import org.objectweb.salome_tmf.data.Family;
0076: import org.objectweb.salome_tmf.data.ProjectData;
0077: import org.objectweb.salome_tmf.data.Test;
0078: import org.objectweb.salome_tmf.data.TestList;
0079: import org.objectweb.salome_tmf.ihm.datawrapper.DataModel;
0080: import org.objectweb.salome_tmf.ihm.languages.Language;
0081: import org.objectweb.salome_tmf.ihm.models.CampaignDescriptionFocusListener;
0082: import org.objectweb.salome_tmf.ihm.models.CampaignTreeDescriptionListener;
0083: import org.objectweb.salome_tmf.ihm.models.DynamicTree;
0084: import org.objectweb.salome_tmf.ihm.models.TestDescriptionFocusListener;
0085: import org.objectweb.salome_tmf.ihm.models.TestTreeDescriptionListener;
0086: import org.objectweb.salome_tmf.ihm.tools.Tools;
0087: import org.objectweb.salome_tmf.plugins.JPFManager;
0088: import org.objectweb.salome_tmf.plugins.core.Common;
0089:
0090: //import salome.plugins.gen_doc_xml.GenDocXMLPlugin;
0091:
0092: /**
0093: * Applet repr?sentant l'outil de gestion de tests Voice Testing.
0094: * @author teaml039
0095: * @version 0.1
0096: */
0097: public class SalomeTMF extends JApplet implements DataConstants,
0098: Observer {
0099:
0100: boolean problemURL = false;
0101:
0102: /**
0103: * Les onglets principaux
0104: */
0105: JTabbedPane tabs;
0106:
0107: // LES 4 ECRANS
0108:
0109: /**
0110: * Le panel des tests
0111: */
0112: static JPanel tests;
0113:
0114: /**
0115: * Le panel des campagnes
0116: */
0117: static JPanel campagne;
0118:
0119: /**
0120: * Le panel des donn?es
0121: */
0122: JPanel data;
0123:
0124: /**
0125: * Le panel des outils
0126: */
0127: JPanel tools;
0128:
0129: /**
0130: * Le panel des plugins
0131: */
0132: JPanel plugins;
0133:
0134: // LES ESPACES DE TRAVAIL
0135:
0136: /**
0137: * L'espace de travail (? droite de la vue) pour les tests
0138: */
0139: static JPanel workSpaceTest;
0140:
0141: /**
0142: * L'espace de travail (? droite de la vue) pour les campagnes
0143: */
0144: static JPanel workSpaceCampagne;
0145:
0146: /**
0147: * Onglets pour les tests automatiques
0148: */
0149: static JTabbedPane automaticTest;
0150:
0151: /**
0152: * Onglets pour les tests manuels
0153: */
0154: static JTabbedPane manualTest;
0155:
0156: /**
0157: * Onglets pour les campagnes
0158: */
0159: static JTabbedPane campagneSpace;
0160:
0161: /**
0162: * Onglets pour la gestion des donn?es
0163: */
0164: static JTabbedPane dataSpace;
0165:
0166: /**
0167: * Onglets pour les suites de tests
0168: */
0169: static JTabbedPane listWorkSpace;
0170:
0171: /**
0172: * Onglets pour les familles
0173: */
0174: static JTabbedPane familyWorkSpace;
0175:
0176: /**
0177: * Panel pour la vue des suites de tests dans les campagnes
0178: */
0179: static JTabbedPane campaignTestListWorkSpace;
0180:
0181: /**
0182: * Panel pour la vue des tests dans les campagnes
0183: */
0184: static JTabbedPane campaignTestWorkSpace;
0185:
0186: /**
0187: * Panel pour la vue des familles dans les campagnes
0188: */
0189: static JTabbedPane campaignFamilyWorkSpace;
0190:
0191: /**
0192: * Panel pour les changements en multi-user des tests
0193: */
0194: static changeListenerPanel testMultiUserChangeListenerPanel;
0195:
0196: /**
0197: * Panel pour les changements en multi-users des campagnes
0198: */
0199: static changeListenerPanel campagneMultiUserChangeListenerPanel;
0200:
0201: /**
0202: * Panel pour les changements en multi-users des datas
0203: */
0204: static changeListenerPanel dataMultiUserChangeListenerPanel;
0205:
0206: // LES 2 ARBRES
0207: /**
0208: * Arbre regroupant les tests (vue des tests)
0209: */
0210: static DynamicTree testDynamicTree;
0211:
0212: /**
0213: * Arbre regroupant les campagnes (vue des campagnes)
0214: */
0215: static DynamicTree campaignDynamicTree;
0216:
0217: // LES BOUTONS
0218: /**
0219: * Boutton pour supprimer un test ou une suite
0220: */
0221: static JButton delTestOrTestList;
0222:
0223: /**
0224: * Bouton pour supprimer une campagne
0225: */
0226: static JButton delCampagne;
0227:
0228: /**
0229: * Bouton pour ordonner les campagnes
0230: */
0231: static JButton orderCampagne;
0232:
0233: /**
0234: * Bouton pour ajouter des tests, des suites ou des familles ? une campagne
0235: */
0236: static JButton addTestInCampagne;
0237:
0238: /**
0239: * Bouton pour le renommage
0240: */
0241: static JButton renameTestButton;
0242:
0243: /**
0244: * Bouton pour ajouter un test
0245: */
0246: JButton addTest;
0247:
0248: /**
0249: * Bouton pour ajouter une famille
0250: */
0251: JButton addFamily;
0252:
0253: /**
0254: * Bouton pour ajouter une suite de tests
0255: */
0256: JButton addList;
0257: /**
0258: * Bouton pour le renommage des campagnes
0259: */
0260: static JButton renameCampaignButton;
0261:
0262: /**
0263: * Bouton pour ordonner les suites de tests
0264: */
0265: JButton orderTest;
0266:
0267: /**
0268: * Bouton pour cr?er une campagne
0269: */
0270: JButton createCampagne;
0271:
0272: // LES COMPTEURS
0273:
0274: /**
0275: * Compteur permettant d'instancier les noms des campagnes lorsqu'elles ne
0276: * sont pas d?finies par l'utilisateur
0277: */
0278: static int defaultCampagneNumber;
0279:
0280: // LES CHAMPS
0281:
0282: /**
0283: * Champ description pour la vue des d?tails des tests manuels
0284: */
0285: static JTextPane manualDetailsDescription;
0286:
0287: /**
0288: * Champ description pour la vue des d?tails des tests automatiques
0289: */
0290: static JTextPane automaticDetailsDescription;
0291:
0292: /**
0293: * Champ description pour la vue des d?tails des campagnes
0294: */
0295: static JTextPane campagneDetailsDescription;
0296:
0297: /**
0298: * Champ description d'une famille
0299: */
0300: static JTextPane familyDescription;
0301:
0302: /**
0303: * Champ description d'une suite de tests
0304: */
0305: static JTextPane testListDescription;
0306:
0307: /**
0308: * Champ description d'une famille quand on clic dans l'arbre des campagnes
0309: */
0310: static JTextPane campaignFamilyDescription;
0311:
0312: /**
0313: * Champ description d'une suite de tests quand on clic dans l'arbre des campagnes
0314: */
0315: static JTextPane campaignTestListDescription;
0316:
0317: /**
0318: * Champ description d'une campagne quand on clic dans l'arbre des campagnes
0319: */
0320: static JTextPane campaignTestDescription;
0321:
0322: // LES LABELS
0323:
0324: /**
0325: * Nom du concepteur de la campagne
0326: */
0327: static JLabel campaignConceptorLabel;
0328:
0329: /**
0330: * Nom de la campagne
0331: */
0332: static JLabel campaignNameLabel;
0333:
0334: /**
0335: * Date de cr?ation de la campagne
0336: */
0337: static JLabel campaignDateLabel;
0338:
0339: /**
0340: * Nom du concepteur d'un test manuel
0341: */
0342: static JLabel manualTestConceptorLabel;
0343:
0344: /**
0345: * Date de cr?ation d'un test manuel
0346: */
0347: static JLabel manualTestDateLabel;
0348:
0349: /**
0350: * Nom du projet courant pour l'?cran des tests
0351: */
0352: JLabel projetName;
0353:
0354: JLabel projetNameCampagne;
0355:
0356: JLabel projetNameData;
0357:
0358: /**
0359: * Nom d'un test manuel
0360: */
0361: static JLabel manualTestNameLabel;
0362:
0363: /**
0364: * Nom d'un test automatique
0365: */
0366: static JLabel automaticTestNameLabel;
0367:
0368: /**
0369: * Date de cr?ation d'un test automatique
0370: */
0371: static JLabel automaticTestDateLabel;
0372:
0373: /**
0374: * Concepteur d'un test automatique
0375: */
0376: static JLabel automaticTestConceptorLabel;
0377:
0378: /**
0379: * Tools menu for tests
0380: */
0381: JMenu testToolsMenu;
0382:
0383: /**
0384: * Tools menu for campaigns
0385: */
0386: JMenu campToolsMenu;
0387:
0388: /**
0389: * Tools menu for data management
0390: */
0391: JMenu dataToolsMenu;
0392:
0393: /**
0394: * Mapping between UI components and constants defined in org.objectweb.salome_tmf.ihm.UICompCst
0395: */
0396: static Map UIComponentsMap;
0397:
0398: /**
0399: * Associated plugins to UI components
0400: * key = associated constante to UI Component , value = List of associated plugins
0401: */
0402: static Map associatedPlgsToCompsMap;
0403:
0404: /**
0405: *
0406: */
0407: public static Hashtable associatedTestDriver;
0408: public static Hashtable associatedScriptEngine;
0409: public static Hashtable associatedExtension;
0410: /**
0411: * JPF Parameters
0412: */
0413: static PluginManager pluginManager;
0414: static ExtensionPoint CommonExtPoint;
0415: static ExtensionPoint testDriverExtPoint;
0416: static ExtensionPoint scriptEngineExtPoint;
0417: public static JPFManager jpf;
0418:
0419: /**
0420: * Thread de l'applet
0421: */
0422: //private boolean active = false;
0423: ParameterView testParameterView;
0424: ParameterView dataParameterView;
0425: ParameterView automaticTestParameterView;
0426:
0427: AttachmentView automaticTestAttachmentView;
0428: AttachmentView manualTestAttachmentView;
0429: AttachmentView campaignAttachmentView;
0430: AttachmentView testListAttachmentView;
0431:
0432: public static URL urlSalome = null;
0433:
0434: PluginsView pluginsView;
0435:
0436: /******************************************************************************/
0437: /******************************************************************************/
0438: /** INTERFACE ***/
0439: /******************************************************************************/
0440: /******************************************************************************/
0441:
0442: public static Frame ptrFrame;
0443:
0444: public static JApplet ptrSalomeTMF;
0445:
0446: /* dbClosed = true if connection to database is close normaly (no reload or back from browser) */
0447: boolean dbClosed = true;
0448: /* reload = true if applet is start again from same JVM (reload or back from browser) */
0449: static boolean reload = false;
0450:
0451: /**
0452: * M?thode d'initialisation de l'applet
0453: */
0454: public void init() {
0455: System.runFinalization();
0456: System.gc();
0457: if (reload) {
0458: Api.closeConnection();
0459: dbClosed = true;
0460: } else {
0461: reload = true;
0462: try {
0463: Class lnfClass = Class.forName(UIManager
0464: .getSystemLookAndFeelClassName());
0465: LookAndFeel newLAF = (LookAndFeel) (lnfClass
0466: .newInstance());
0467: UIManager.setLookAndFeel(newLAF);
0468: } catch (Exception exc) {
0469: System.err.println("Error loading L&F: " + exc);
0470: }
0471: }
0472: Api.setUrlBase(getDocumentBase());
0473: Language.getInstance().setLocale(
0474: new Locale(Api.getUsedLocale()));
0475: ptrFrame = javax.swing.JOptionPane
0476: .getFrameForComponent(SalomeTMF.this );
0477: ptrSalomeTMF = SalomeTMF.this ;
0478:
0479: WaitView waitView = new WaitView();
0480:
0481: try {
0482: Cursor c = new Cursor(Cursor.WAIT_CURSOR);
0483: this .setCursor(c);
0484: } catch (Exception e) {
0485: e.printStackTrace();
0486: }
0487:
0488: associatedTestDriver = new Hashtable();
0489: associatedScriptEngine = new Hashtable();
0490: associatedExtension = new Hashtable();
0491: // Mapping between UI components and constants
0492: UIComponentsMap = new HashMap();
0493:
0494: // Mapping between UI components and associated plugins
0495: associatedPlgsToCompsMap = new HashMap();
0496:
0497: /**
0498: * Les onglets principaux
0499: */
0500: tabs = new JTabbedPane();
0501:
0502: // LES 4 ECRANS
0503:
0504: /**
0505: * Le panel des tests
0506: */
0507: tests = new JPanel(new BorderLayout());
0508:
0509: /**
0510: * Le panel des campagnes
0511: */
0512: campagne = new JPanel(new BorderLayout());
0513:
0514: /**
0515: * Le panel des donn?es
0516: */
0517: data = new JPanel(new BorderLayout());
0518:
0519: /**
0520: * Le panel des plugins
0521: */
0522: plugins = new JPanel(new BorderLayout());
0523:
0524: // LES ESPACES DE TRAVAIL
0525:
0526: /**
0527: * L'espace de travail (? droite de la vue) pour les tests
0528: */
0529: workSpaceTest = new JPanel();
0530:
0531: /**
0532: * L'espace de travail (? droite de la vue) pour les campagnes
0533: */
0534: workSpaceCampagne = new JPanel();
0535:
0536: /**
0537: * Onglets pour les tests automatiques
0538: */
0539: automaticTest = new JTabbedPane();
0540:
0541: /**
0542: * Onglets pour les tests manuels
0543: */
0544: manualTest = new JTabbedPane();
0545:
0546: /**
0547: * Onglets pour les campagnes
0548: */
0549: campagneSpace = new JTabbedPane();
0550:
0551: /**
0552: * Onglets pour la gestion des donn?es
0553: */
0554: dataSpace = new JTabbedPane();
0555:
0556: /**
0557: * Onglets pour les suites de tests
0558: */
0559: listWorkSpace = new JTabbedPane();
0560:
0561: /**
0562: * Onglets pour les familles
0563: */
0564: familyWorkSpace = new JTabbedPane();
0565:
0566: /**
0567: * Panel pour la vue des suites de tests dans les campagnes
0568: */
0569: campaignTestListWorkSpace = new JTabbedPane();
0570:
0571: /**
0572: * Panel pour la vue des tests dans les campagnes
0573: */
0574: campaignTestWorkSpace = new JTabbedPane();
0575:
0576: /**
0577: * Panel pour la vue des familles dans les campagnes
0578: */
0579: campaignFamilyWorkSpace = new JTabbedPane();
0580:
0581: /**
0582: * Arbre regroupant les campagnes (vue des campagnes)
0583: */
0584: campaignDynamicTree = new DynamicTree(Language.getInstance()
0585: .getText("Campagnes_de_tests"), CAMPAIGN);
0586:
0587: // Mapping entre objets graphiques et constantes
0588: UIComponentsMap.put(UICompCst.CAMPAIGN_DYNAMIC_TREE,
0589: campaignDynamicTree);
0590: // Add this component as static component
0591: UICompCst.staticUIComps.add(UICompCst.CAMPAIGN_DYNAMIC_TREE);
0592:
0593: // LES COMPTEURS
0594:
0595: /**
0596: * Compteur permettant d'instancier les noms des campagnes lorsqu'elles ne
0597: * sont pas d?finies par l'utilisateur
0598: */
0599: defaultCampagneNumber = 1;
0600:
0601: // LES CHAMPS
0602:
0603: /**
0604: * Champ description pour la vue des d?tails des tests manuels
0605: */
0606: manualDetailsDescription = new JTextPane();
0607:
0608: /**
0609: * Champ description pour la vue des d?tails des tests automatiques
0610: */
0611: automaticDetailsDescription = new JTextPane();
0612:
0613: /**
0614: * Champ description pour la vue des d?tails des campagnes
0615: */
0616: campagneDetailsDescription = new JTextPane();
0617:
0618: /**
0619: * Champ description d'une famille
0620: */
0621: familyDescription = new JTextPane();
0622:
0623: /**
0624: * Champ description d'une suite de tests
0625: */
0626: testListDescription = new JTextPane();
0627:
0628: // Onglets
0629: //tabs.addTab("Gestion des tests", tests);
0630: //tabs.addTab("Gestion des campagnes", campagne);
0631: //tabs.addTab("Gestion des données", data);
0632: tabs.addTab(
0633: Language.getInstance().getText("Gestion_des_tests"),
0634: tests);
0635: tabs.addTab(Language.getInstance().getText(
0636: "Gestion_des_campagnes"), campagne);
0637: tabs.addTab(Language.getInstance().getText(
0638: "Gestion_des_données"), data);
0639:
0640: // Mapping entre objets graphiques et constantes
0641: UIComponentsMap.put(UICompCst.MAIN_TABBED_PANE, tabs);
0642: // Add this component as static component
0643: UICompCst.staticUIComps.add(UICompCst.MAIN_TABBED_PANE);
0644:
0645: projetName = new JLabel();
0646: projetName.setFont(new Font(null, Font.BOLD, 18));
0647: JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
0648: namePanel.add(projetName);
0649:
0650: testMultiUserChangeListenerPanel = new changeListenerPanel();
0651: testMultiUserChangeListenerPanel
0652: .setPreferredSize(new Dimension(70, 25));
0653: JPanel testMultiUserPanel = new JPanel(new FlowLayout(
0654: FlowLayout.RIGHT));
0655: testMultiUserPanel.add(testMultiUserChangeListenerPanel);
0656:
0657: JPanel testTopPanel = new JPanel(new BorderLayout());
0658: testTopPanel.add(namePanel, BorderLayout.WEST);
0659: testTopPanel.add(testMultiUserPanel, BorderLayout.EAST);
0660:
0661: projetNameCampagne = new JLabel();
0662: projetNameCampagne.setFont(new Font(null, Font.BOLD, 18));
0663: JPanel namePanelCampagne = new JPanel(new FlowLayout(
0664: FlowLayout.LEFT));
0665: namePanelCampagne.add(projetNameCampagne);
0666:
0667: campagneMultiUserChangeListenerPanel = new changeListenerPanel();
0668: campagneMultiUserChangeListenerPanel
0669: .setPreferredSize(new Dimension(70, 25));
0670: JPanel campagneMultiUserPanel = new JPanel(new FlowLayout(
0671: FlowLayout.RIGHT));
0672: campagneMultiUserPanel
0673: .add(campagneMultiUserChangeListenerPanel);
0674:
0675: JPanel campagneTopPanel = new JPanel(new BorderLayout());
0676: campagneTopPanel.add(namePanelCampagne, BorderLayout.WEST);
0677: campagneTopPanel.add(campagneMultiUserPanel, BorderLayout.EAST);
0678:
0679: projetNameData = new JLabel();
0680: projetNameData.setFont(new Font(null, Font.BOLD, 18));
0681: JPanel namePanelData = new JPanel(new FlowLayout(
0682: FlowLayout.LEFT));
0683: namePanelData.add(projetNameData);
0684:
0685: dataMultiUserChangeListenerPanel = new changeListenerPanel();
0686: dataMultiUserChangeListenerPanel
0687: .setPreferredSize(new Dimension(70, 25));
0688: JPanel dataMultiUserPanel = new JPanel(new FlowLayout(
0689: FlowLayout.RIGHT));
0690: dataMultiUserPanel.add(dataMultiUserChangeListenerPanel);
0691:
0692: JPanel dataTopPanel = new JPanel(new BorderLayout());
0693: dataTopPanel.add(namePanelData, BorderLayout.WEST);
0694: dataTopPanel.add(dataMultiUserPanel, BorderLayout.EAST);
0695:
0696: tests.add(testTopPanel, BorderLayout.NORTH);
0697: campagne.add(campagneTopPanel, BorderLayout.NORTH);
0698: data.add(dataTopPanel, BorderLayout.NORTH);
0699:
0700: tabs.addChangeListener(new ChangeListener() {
0701: public void stateChanged(ChangeEvent e) {
0702: if (tabs.getModel().getSelectedIndex() == 0) {
0703: // Onglet des tests
0704: if (getTestDynamicTree().getSelectedNode() != null) {
0705: if (getTestDynamicTree().getSelectedNode()
0706: .getUserObject() instanceof Test) {
0707: DataModel
0708: .initAttachmentTable(((Test) getTestDynamicTree()
0709: .getSelectedNode()
0710: .getUserObject())
0711: .getAttachmentMap()
0712: .values());
0713: DataModel
0714: .setCurrentTest((Test) getTestDynamicTree()
0715: .getSelectedNode()
0716: .getUserObject());
0717: } else if (getTestDynamicTree()
0718: .getSelectedNode().getUserObject() instanceof TestList) {
0719: DataModel
0720: .initAttachmentTable(((TestList) getTestDynamicTree()
0721: .getSelectedNode()
0722: .getUserObject())
0723: .getAttachmentMap()
0724: .values());
0725: DataModel
0726: .setCurrentTestList((TestList) getTestDynamicTree()
0727: .getSelectedNode()
0728: .getUserObject());
0729: } else if (getTestDynamicTree()
0730: .getSelectedNode().getUserObject() instanceof Family) {
0731: DataModel
0732: .setCurrentFamily((Family) getTestDynamicTree()
0733: .getSelectedNode()
0734: .getUserObject());
0735: }
0736: }
0737: } else if (tabs.getModel().getSelectedIndex() == 1) {
0738: // Onglet des campagnes
0739: if (DataModel.getCurrentCampaign() != null) {
0740: DataModel.initAttachmentTable(DataModel
0741: .getCurrentCampaign()
0742: .getAttachmentMap().values());
0743: }
0744: if (getTestDynamicTree().getSelectedNode() != null
0745: && getCampaignDynamicTree()
0746: .getSelectedNode() != null
0747: && getTestDynamicTree().getSelectedNode()
0748: .getUserObject().equals(
0749: getCampaignDynamicTree()
0750: .getSelectedNode()
0751: .getUserObject())) {
0752: if (getTestDynamicTree().getSelectedNode()
0753: .getUserObject() instanceof Family) {
0754: campaignFamilyDescription
0755: .setText(((Element) getTestDynamicTree()
0756: .getSelectedNode()
0757: .getUserObject())
0758: .getDescription());
0759: DataModel
0760: .setCurrentFamily((Family) getTestDynamicTree()
0761: .getSelectedNode()
0762: .getUserObject());
0763: } else if (getTestDynamicTree()
0764: .getSelectedNode().getUserObject() instanceof TestList) {
0765: campaignTestListDescription
0766: .setText(((Element) getTestDynamicTree()
0767: .getSelectedNode()
0768: .getUserObject())
0769: .getDescription());
0770: DataModel
0771: .setCurrentTestList((TestList) getTestDynamicTree()
0772: .getSelectedNode()
0773: .getUserObject());
0774: } else if (getTestDynamicTree()
0775: .getSelectedNode().getUserObject() instanceof Test) {
0776: campaignTestDescription
0777: .setText(((Element) getTestDynamicTree()
0778: .getSelectedNode()
0779: .getUserObject())
0780: .getDescription());
0781: DataModel
0782: .setCurrentTest((Test) getTestDynamicTree()
0783: .getSelectedNode()
0784: .getUserObject());
0785: }
0786: }
0787: } else if ((Api.ALLOW_PLUGINS)
0788: && (tabs.getModel().getSelectedIndex() == tabs
0789: .indexOfTab(Language.getInstance()
0790: .getText("Plugins")))) {
0791: pluginsView.refreshPluginsActivation();
0792: }
0793: }
0794: });
0795:
0796: /**
0797: * Tools menu for tests, campaigns and data management
0798: */
0799: //testToolsMenu = new JMenu("Outils");
0800: //campToolsMenu = new JMenu("Outils");
0801: //dataToolsMenu = new JMenu("Outils");
0802: testToolsMenu = new JMenu(Language.getInstance().getText(
0803: "Outils"));
0804: campToolsMenu = new JMenu(Language.getInstance().getText(
0805: "Outils"));
0806: dataToolsMenu = new JMenu(Language.getInstance().getText(
0807: "Outils"));
0808: /**
0809: * Mapping between UI components and constants defined in org.objectweb.salome_tmf.ihm.UICompCst
0810: */
0811: UIComponentsMap.put(UICompCst.TEST_TOOLS_MENU, testToolsMenu);
0812: UIComponentsMap.put(UICompCst.CAMP_TOOLS_MENU, campToolsMenu);
0813: UIComponentsMap.put(UICompCst.DATA_TOOLS_MENU, dataToolsMenu);
0814:
0815: DataModel.initData();
0816: //DataModel.clear();
0817: createTestsPlane();
0818: createCampagnePlane();
0819: createDataPlane();
0820:
0821: Container cp = this .getContentPane();
0822: cp.add(tabs);
0823:
0824: waitView.dispose();
0825: try {
0826: Cursor c = new Cursor(Cursor.DEFAULT_CURSOR);
0827: this .setCursor(c);
0828: } catch (Exception e) {
0829: e.printStackTrace();
0830: }
0831:
0832: } // Fin de la m?thode init/0
0833:
0834: /**
0835: * M?thode appel?e ? chaque chargement de la page
0836: */
0837: public void start() {
0838: Api.log("Applet start");
0839: urlSalome = getDocumentBase();
0840: if (Api.isAlreadyConnected) {
0841: JOptionPane
0842: .showMessageDialog(
0843: SalomeTMF.this ,
0844: Language
0845: .getInstance()
0846: .getText(
0847: "Vous_avez_déjà_une_session_Salomé_ouverte_avec_ce_navigateur.\n")
0848: + Language
0849: .getInstance()
0850: .getText(
0851: "Une_seule_session_est_autorisée_par_navigateur_afin_d'éviter_les_conflits_!"),
0852: Language.getInstance().getText("Erreur_!"),
0853: JOptionPane.ERROR_MESSAGE);
0854: quit(false);
0855: Api.isAlreadyConnected = true;
0856: } else {
0857: /*if (active == false){
0858: Api.log("\tApplet start active est false");
0859: //t = new Thread();
0860: //t.start();
0861: active = true;
0862: super.start();
0863: }*/
0864: //super.start();
0865: Api.openConnection(getDocumentBase());
0866: String[] tab;
0867: if (Api.IDE_DEV) {
0868: tab = new String[2];
0869: tab[0] = "projet_vpa";
0870: tab[1] = "vpa";
0871: } else {
0872: tab = Tools.chooseProjectAndUser(getDocumentBase());
0873: }
0874: if ((tab[0] == null) || (tab[0].equals(""))) {
0875: JOptionPane.showMessageDialog(SalomeTMF.this , Language
0876: .getInstance().getText(
0877: "Probleme_dans_l'URL_saisie_!"),
0878: Language.getInstance().getText("Erreur_!"),
0879: JOptionPane.ERROR_MESSAGE);
0880: problemURL = true;
0881: //Api.closeConnection();
0882: quit(true);
0883: } else {
0884:
0885: DataModel.loadFromBase(tab[0], tab[1], this );
0886: //initDataTests(tab[0], tab[1], this);
0887: Api.addObservers(this );
0888: Api.addWatchListener(this , ProjectData
0889: .getCurrentProject().getName());
0890: testMultiUserChangeListenerPanel.reset();
0891: campagneMultiUserChangeListenerPanel.reset();
0892: dataMultiUserChangeListenerPanel.reset();
0893: giveAccessToIhm();
0894: testParameterView.giveAccessToIhmParameterView();
0895: dataParameterView.giveAccessToIhmParameterView();
0896: automaticTestParameterView
0897: .giveAccessToIhmParameterView();
0898: ManualActionView.giveAccessToIhmManualActionView();
0899: EnvironmentView.giveAccessToIhmEnvironmentView();
0900: DataSetView.giveAccessToIhmDataSetView();
0901: ExecutionView.giveAccessToIhmExecutionView();
0902: AutomaticTestScriptView.giveAccessToIhmScriptView();
0903: automaticTestAttachmentView.giveAccessToIhmScriptView();
0904: manualTestAttachmentView.giveAccessToIhmScriptView();
0905: campaignAttachmentView.giveAccessToIhmScriptView();
0906: testListAttachmentView.giveAccessToIhmScriptView();
0907: projetName.setText(Language.getInstance().getText(
0908: "Projet_:_")
0909: + ProjectData.getCurrentProject().getName());
0910: projetNameCampagne.setText(Language.getInstance()
0911: .getText("Projet_:_")
0912: + ProjectData.getCurrentProject().getName());
0913: projetNameData.setText(Language.getInstance().getText(
0914: "Projet_:_")
0915: + ProjectData.getCurrentProject().getName());
0916: campaignDynamicTree.givePopupMenuToTree();
0917: testDynamicTree.givePopupMenuToTree();
0918:
0919: // JPF initialization
0920: if (Api.ALLOW_PLUGINS) {
0921: jpf = new JPFManager();
0922: jpf.startJPF(this .getDocumentBase(), this ,
0923: UIComponentsMap);
0924:
0925: tabs.addTab(Language.getInstance().getText(
0926: "Plugins"), plugins);
0927: createPluginsPlane();
0928: }
0929:
0930: }
0931: }
0932:
0933: } // Fin de la m?thode start();
0934:
0935: // La m?thode stop() est appel?e lorsque la page contenant l'applet
0936: // dispara?t de l'?cran. L'impl?mentation initiale de l'Assistant Applet
0937: // pour cette m?thode arr?te l'ex?cution de la thread de l'applet.
0938: //--------------------------------------------------------------------------
0939: public void stop() {
0940: Api.log("Applet stop");
0941: /*
0942: if (active == true) {
0943: Api.log("\tApllet stop active est true");
0944: super.stop();
0945:
0946: active = false;
0947:
0948: }*/
0949: }
0950:
0951: // Ins?rez ici des lignes de code suppl?mentaires de l'applet destin?es ? quitter proprement le syst?me. La m?thode destroy() est appel?e
0952: // lorsque votre applet se termine et est d?charg?e.
0953: //-------------------------------------------------------------------------
0954: public void destroy() {
0955:
0956: Api.log("Applet destroy");
0957: // TODO: Insèrez ici le code de l'applet destiné à quitter proprement le système
0958: //se d?connecter de la base !!!
0959: Api.isAlreadyConnected = false;
0960: if (ConnectionData.isConnected() && !dbClosed) {
0961: Api.closeConnection();
0962: }
0963:
0964: }
0965:
0966: /**
0967: * M?thode qui cr?e la vue sur les donn?es
0968: */
0969: public void createDataPlane() {
0970:
0971: JPanel parameters = new JPanel();
0972: JPanel context = new JPanel();
0973:
0974: //JMenuItem refreshItem = new JMenuItem("Rafraichir");
0975: JMenuItem refreshItem = new JMenuItem(Language.getInstance()
0976: .getText("Rafraichir"));
0977: refreshItem.addActionListener(new ActionListener() {
0978: public void actionPerformed(ActionEvent e) {
0979: DataModel.reloadFromBase();
0980: //TestMethods.refreshFromBase();
0981: }
0982: });
0983:
0984: // Mapping entre objets graphiques et constantes
0985: UIComponentsMap.put(UICompCst.DATA_MANAGEMENT_REFRESH_ITEM,
0986: refreshItem);
0987: // Add this component as static component
0988: UICompCst.staticUIComps
0989: .add(UICompCst.DATA_MANAGEMENT_REFRESH_ITEM);
0990:
0991: dataToolsMenu.add(refreshItem);
0992:
0993: // Sous menu pour changer le mot de passe
0994: //JMenuItem changePwdItem = new JMenuItem("Changer le mot de passe");
0995: JMenuItem changePwdItem = new JMenuItem(Language.getInstance()
0996: .getText("Changer_le_mot_de_passe"));
0997: changePwdItem.addActionListener(new ActionListener() {
0998: public void actionPerformed(ActionEvent e) {
0999: new ChangePwdWindow(ptrFrame).show();
1000: }
1001: });
1002:
1003: dataToolsMenu.add(changePwdItem);
1004:
1005: JMenuBar menuBar = new JMenuBar();
1006: menuBar.add(dataToolsMenu);
1007:
1008: //JButton quitTestButton = new JButton("Quitter");
1009: JButton quitTestButton = new JButton(Language.getInstance()
1010: .getText("Quitter"));
1011: quitTestButton.addActionListener(new ActionListener() {
1012: public void actionPerformed(ActionEvent e) {
1013: quit(true);
1014: //Api.closeConnection();
1015: }
1016: });
1017:
1018: JPanel upButtonsPanel = new JPanel(new FlowLayout(
1019: FlowLayout.LEFT));
1020: upButtonsPanel.add(menuBar);
1021: upButtonsPanel.setBorder(BorderFactory
1022: .createRaisedBevelBorder());
1023: JPanel pnl = new JPanel();
1024: pnl.setBackground(Color.WHITE);
1025:
1026: // Mapping entre objets graphiques et constantes
1027: UIComponentsMap.put(UICompCst.DATA_MANAGEMENT_BUTTONS_PANEL,
1028: upButtonsPanel);
1029: // Add this component as static component
1030: UICompCst.staticUIComps
1031: .add(UICompCst.DATA_MANAGEMENT_BUTTONS_PANEL);
1032:
1033: JPanel buttons = new JPanel(new BorderLayout());
1034: buttons.add(upButtonsPanel, BorderLayout.NORTH);
1035: buttons.add(pnl, BorderLayout.CENTER);
1036: buttons.add(quitTestButton, BorderLayout.SOUTH);
1037:
1038: dataSpace.addTab(Language.getInstance().getText(
1039: "Environnements"), context);
1040: dataSpace.addTab(Language.getInstance().getText("Paramètres"),
1041: parameters);
1042:
1043: createEnvironment(context);
1044: createManualTestParameter(parameters, false);
1045:
1046: data.add(dataSpace, BorderLayout.CENTER);
1047: data.add(buttons, BorderLayout.WEST);
1048: }
1049:
1050: /**
1051: * Creates "plugins" view
1052: */
1053: private void createPluginsPlane() {
1054:
1055: Vector commonExtensions = new Vector();
1056: Vector testDriverExtensions = new Vector();
1057: Vector scriptEngineExtensions = new Vector();
1058:
1059: // Extensions "Common"
1060: for (Iterator it = CommonExtPoint.getConnectedExtensions()
1061: .iterator(); it.hasNext();) {
1062: Extension commonExt = (Extension) it.next();
1063: commonExtensions.add(commonExt);
1064: }
1065:
1066: // Extensions de type "TestDriver"
1067: for (Iterator it = testDriverExtPoint.getConnectedExtensions()
1068: .iterator(); it.hasNext();) {
1069: Extension testDriverExt = (Extension) it.next();
1070: testDriverExtensions.add(testDriverExt);
1071: }
1072:
1073: // Extensions de type "ScriptEngine"
1074: for (Iterator it = scriptEngineExtPoint
1075: .getConnectedExtensions().iterator(); it.hasNext();) {
1076: Extension scriptEngineExt = (Extension) it.next();
1077: scriptEngineExtensions.add(scriptEngineExt);
1078: }
1079:
1080: pluginsView = new PluginsView(commonExtensions,
1081: testDriverExtensions, scriptEngineExtensions,
1082: pluginManager);
1083:
1084: plugins.add(pluginsView);
1085: }
1086:
1087: /**
1088: * M?thode qui cr?e la vue sur les tests
1089: */
1090: private void createTestsPlane() {
1091:
1092: //addList = new JButton("Ajouter une suite");
1093: //addList.setToolTipText("Ajouter une suite");
1094: addList = new JButton(Language.getInstance().getText(
1095: "Ajouter_une_suite"));
1096: addList.setToolTipText(Language.getInstance().getText(
1097: "Ajouter_une_suite_de_tests"));
1098:
1099: addList.addActionListener(new ActionListener() {
1100: public void actionPerformed(ActionEvent e) {
1101: DataModel.addNewTestList();
1102: }
1103: });
1104:
1105: //addFamily = new JButton("Ajouter une famille");
1106: //addFamily.setToolTipText("Ajouter une famille");
1107: addFamily = new JButton(Language.getInstance().getText(
1108: "Ajouter_une_famille"));
1109: addFamily.setToolTipText(Language.getInstance().getText(
1110: "Ajouter_une_famille"));
1111:
1112: addFamily.addActionListener(new ActionListener() {
1113: public void actionPerformed(ActionEvent e) {
1114: DataModel.addNewFamily();
1115: }
1116: });
1117:
1118: //addTest = new JButton("Ajouter un test");
1119: //addTest.setToolTipText("Ajouter un test");
1120: addTest = new JButton(Language.getInstance().getText(
1121: "Ajouter_un_test"));
1122: addTest.setToolTipText(Language.getInstance().getText(
1123: "Ajouter_un_test"));
1124:
1125: addTest.addActionListener(new ActionListener() {
1126: public void actionPerformed(ActionEvent e) {
1127: DataModel.addNewTest();
1128: }
1129: });
1130:
1131: //JPanel listPanel = new JPanel(new FlowLayout(FlowLayout.LEFT ));
1132: JPanel listPanel = new JPanel(new GridLayout(1, 3));
1133: listPanel.add(addFamily);
1134: listPanel.add(addList);
1135: listPanel.add(addTest);
1136: /*listPanel.add(new JButton("prend place"));
1137: listPanel.add(new JButton("prend place2"));
1138: listPanel.add(new JButton("prend place3"));
1139: listPanel.add(new JButton("prend place4"));*/
1140: //listPanel.setMaximumSize(new Dimension(380,0));
1141: listPanel.setBorder(BorderFactory.createRaisedBevelBorder());
1142:
1143: //orderTest = new JButton("Ordonner");
1144: //orderTest.setToolTipText("Ordonner l'arbre des suites de tests");
1145: orderTest = new JButton(Language.getInstance().getText(
1146: "Ordonner"));
1147: orderTest.setToolTipText(Language.getInstance().getText(
1148: "Ordonner_l'arbre_des_suites_de_tests"));
1149: orderTest.addActionListener(new ActionListener() {
1150: public void actionPerformed(ActionEvent e) {
1151: new TestOrdering(testDynamicTree.getModel(), false);
1152: }
1153: });
1154:
1155: //delTestOrTestList = new JButton("Supprimer");
1156: //delTestOrTestList.setToolTipText("Supprimer un test ou une suite de test");
1157: delTestOrTestList = new JButton(Language.getInstance().getText(
1158: "Supprimer"));
1159: delTestOrTestList.setToolTipText(Language.getInstance()
1160: .getText("Supprimer"));
1161: delTestOrTestList.setEnabled(false);
1162: delTestOrTestList.addActionListener(new ActionListener() {
1163: public void actionPerformed(ActionEvent e) {
1164: DataModel.deleteInTestTree();
1165: }
1166: });
1167:
1168: //JMenuItem refreshItem = new JMenuItem("Rafraichir");
1169: JMenuItem refreshItem = new JMenuItem(Language.getInstance()
1170: .getText("Rafraichir"));
1171: refreshItem.addActionListener(new ActionListener() {
1172: public void actionPerformed(ActionEvent e) {
1173: //TestMethods.refreshTestTree();
1174: workSpaceTest.removeAll();
1175: DataModel.reloadFromBase();
1176: }
1177: });
1178:
1179: testToolsMenu.add(refreshItem);
1180:
1181: // Sous menu pour changer le mot de passe
1182: //JMenuItem changePwdItem = new JMenuItem("Changer le mot de passe");
1183: JMenuItem changePwdItem = new JMenuItem(Language.getInstance()
1184: .getText("Changer_le_mot_de_passe"));
1185: changePwdItem.addActionListener(new ActionListener() {
1186: public void actionPerformed(ActionEvent e) {
1187: new ChangePwdWindow(ptrFrame).show();
1188: }
1189: });
1190:
1191: testToolsMenu.add(changePwdItem);
1192:
1193: JMenuBar refreshMenuBar = new JMenuBar();
1194: refreshMenuBar.add(testToolsMenu);
1195:
1196: renameTestButton = new JButton(Language.getInstance().getText(
1197: "Renommer"));
1198: renameTestButton.setEnabled(false);
1199: renameTestButton.addActionListener(new ActionListener() {
1200: public void actionPerformed(ActionEvent e) {
1201: DataModel.renameTest();
1202: }
1203: });
1204:
1205: JButton quitTestButton = new JButton(Language.getInstance()
1206: .getText("Quitter"));
1207: quitTestButton.addActionListener(new ActionListener() {
1208: public void actionPerformed(ActionEvent e) {
1209: quit(true);
1210: //Api.closeConnection();
1211: }
1212: });
1213:
1214: //JPanel testPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
1215: JPanel testPanel = new JPanel(new GridLayout(1, 3));
1216: //testPanel.setMaximumSize(new Dimension(380,0));
1217: //testPanel.setLayout(new BoxLayout(testPanel,BoxLayout.X_AXIS));
1218: testPanel.add(orderTest);
1219: testPanel.add(renameTestButton);
1220: testPanel.add(delTestOrTestList);
1221: testPanel.add(refreshMenuBar);
1222: //testPanel.setMaximumSize(new Dimension(380,0));
1223: testPanel.setBorder(BorderFactory.createRaisedBevelBorder());
1224:
1225: createFamily();
1226: createTestList();
1227: createAutomaticTest();
1228: createManualTest();
1229: workSpaceTest.removeAll();
1230:
1231: // Construction finale
1232: JPanel allButtons = new JPanel();
1233: allButtons
1234: .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
1235: allButtons.add(listPanel);
1236: allButtons.add(testPanel);
1237:
1238: //testDynamicTree = new DynamicTree("Suites de tests", TESTLIST);
1239: testDynamicTree = new DynamicTree(Language.getInstance()
1240: .getText("Plan_de_tests"), TESTLIST);
1241:
1242: // Mapping entre composants graphiques et constantes
1243: UIComponentsMap.put(UICompCst.TEST_DYNAMIC_TREE,
1244: testDynamicTree);
1245: // Add this component as static component
1246: UICompCst.staticUIComps.add(UICompCst.TEST_DYNAMIC_TREE);
1247:
1248: JPanel buttonsAndTree = new JPanel(new BorderLayout());
1249: buttonsAndTree.add(allButtons, BorderLayout.NORTH);
1250: buttonsAndTree.add(testDynamicTree, BorderLayout.CENTER);
1251: buttonsAndTree.add(quitTestButton, BorderLayout.SOUTH);
1252: buttonsAndTree.setPreferredSize(new Dimension(380, 380));
1253:
1254: tests.add(workSpaceTest, BorderLayout.CENTER);
1255: tests.add(buttonsAndTree, BorderLayout.WEST);
1256:
1257: // Mapping entre comosants graphiques et constantes
1258: UIComponentsMap.put(UICompCst.TEST_SECOND_BUTTONS_PANEL,
1259: testPanel);
1260: // Add this component as static component
1261: UICompCst.staticUIComps
1262: .add(UICompCst.TEST_SECOND_BUTTONS_PANEL);
1263:
1264: } // Fin de la m?thode createTestsPlane/0
1265:
1266: /**
1267: * M?thode qui cr?e la vue sur les familles
1268: */
1269: private void createFamily() {
1270:
1271: workSpaceTest.removeAll();
1272:
1273: familyDescription
1274: .addCaretListener(new TestTreeDescriptionListener());
1275: familyDescription
1276: .addFocusListener(new TestDescriptionFocusListener());
1277:
1278: JScrollPane familyDescrScrollPane = new JScrollPane(
1279: familyDescription);
1280:
1281: // Onglets
1282: familyWorkSpace.addTab(Language.getInstance().getText(
1283: "Description"), familyDescrScrollPane);
1284:
1285: // Mapping entre objets graphiques et constantes
1286: UIComponentsMap.put(UICompCst.FAMILY_WORKSPACE_PANEL_FOR_TABS,
1287: familyWorkSpace);
1288: // Add this component as static component
1289: UICompCst.staticUIComps
1290: .add(UICompCst.FAMILY_WORKSPACE_PANEL_FOR_TABS);
1291:
1292: workSpaceTest.setLayout(new BorderLayout());
1293: workSpaceTest.add(familyWorkSpace, BorderLayout.CENTER);
1294: } // Fin de la m?thode createAttachments/0
1295:
1296: /**
1297: * M?thode qui cr?e la vue sur la description et les attachements (utilis?e
1298: * pour le suites de test)
1299: *
1300: */
1301: private void createTestList() {
1302:
1303: workSpaceTest.removeAll();
1304:
1305: // Onglets
1306: JPanel attachment = new JPanel();
1307:
1308: testListDescription
1309: .addCaretListener(new TestTreeDescriptionListener());
1310: testListDescription
1311: .addFocusListener(new TestDescriptionFocusListener());
1312: listWorkSpace.addTab(Language.getInstance().getText(
1313: "Description"), testListDescription);
1314: listWorkSpace.addTab(Language.getInstance().getText(
1315: "Attachements"), attachment);
1316:
1317: createAttachmentView(attachment, TESTLIST);
1318:
1319: // Mapping entre objets graphiques et constantes
1320: UIComponentsMap.put(
1321: UICompCst.TESTLIST_WORKSPACE_PANEL_FOR_TABS,
1322: listWorkSpace);
1323: // Add this component as static component
1324: UICompCst.staticUIComps
1325: .add(UICompCst.TESTLIST_WORKSPACE_PANEL_FOR_TABS);
1326:
1327: workSpaceTest.setLayout(new BorderLayout());
1328: workSpaceTest.add(listWorkSpace, BorderLayout.CENTER);
1329:
1330: } // Fin de la m?thode createTestList/0
1331:
1332: /**************************************************************************/
1333: /** TESTS AUTOMATIQUES ***/
1334: /**************************************************************************/
1335:
1336: /**
1337: * M?thode qui cr?e la vue pour les tests automatiques
1338: */
1339: private void createAutomaticTest() {
1340: workSpaceTest.removeAll();
1341:
1342: JPanel detailsPanel = new JPanel(new BorderLayout());
1343: JPanel scriptPanel = new JPanel();
1344: JPanel attachmentPanel = new JPanel();
1345: JPanel parametersPanel = new JPanel();
1346:
1347: automaticTest.addTab(Language.getInstance().getText("Détails"),
1348: detailsPanel);
1349: automaticTest.addTab(Language.getInstance().getText("Script"),
1350: scriptPanel);
1351: automaticTest.addTab(Language.getInstance().getText(
1352: "Attachements"), attachmentPanel);
1353: automaticTest.addTab(Language.getInstance().getText(
1354: "Paramètres"), parametersPanel);
1355:
1356: createAutomaticTestDetails(detailsPanel);
1357: createAutomaticTestScript(scriptPanel);
1358: createAttachmentView(attachmentPanel, AUTOMATIC_TEST);
1359: createAutomaticTestParameter(parametersPanel, true);
1360:
1361: // Mapping entre objets graphiques et constantes
1362: UIComponentsMap.put(
1363: UICompCst.AUTOMATED_TEST_WORKSPACE_PANEL_FOR_TABS,
1364: automaticTest);
1365: // Add this component as static component
1366: UICompCst.staticUIComps
1367: .add(UICompCst.AUTOMATED_TEST_WORKSPACE_PANEL_FOR_TABS);
1368:
1369: workSpaceTest.setLayout(new BorderLayout());
1370: workSpaceTest.add(automaticTest, BorderLayout.CENTER);
1371:
1372: // Mapping entre composants graphiques et constantes
1373: UIComponentsMap.put(UICompCst.AUTOMATED_TEST_SCRIPT_PANEL,
1374: scriptPanel);
1375: // Add this component as static component
1376: UICompCst.staticUIComps
1377: .add(UICompCst.AUTOMATED_TEST_SCRIPT_PANEL);
1378:
1379: } // Fin de la m?thode createAutomaticTest/0
1380:
1381: /**
1382: * M?thode qui cr?e l'?cran des d?tails sur un test
1383: * @param panel le panel qui contient la vue
1384: */
1385: private void createAutomaticTestDetails(JPanel panel) {
1386:
1387: automaticTestNameLabel = new JLabel(Language.getInstance()
1388: .getText("Nom_du_test")
1389: + " : ");
1390: automaticTestDateLabel = new JLabel(Language.getInstance()
1391: .getText("Date_de_création")
1392: + " : ");
1393: automaticTestConceptorLabel = new JLabel(Language.getInstance()
1394: .getText("Concepteur")
1395: + " : ");
1396:
1397: JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
1398: firstLine.add(automaticTestNameLabel);
1399: firstLine.add(Box.createRigidArea(new Dimension(50, 20)));
1400: firstLine.add(automaticTestDateLabel);
1401:
1402: JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
1403: secondLine.add(automaticTestConceptorLabel);
1404:
1405: JPanel allButtons = new JPanel();
1406: allButtons
1407: .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
1408: allButtons.add(firstLine);
1409: allButtons.add(secondLine);
1410:
1411: //allButtons.add()
1412: allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
1413: 0));
1414: automaticDetailsDescription.setBorder(BorderFactory
1415: .createTitledBorder(BorderFactory
1416: .createLineBorder(Color.BLACK), Language
1417: .getInstance().getText("Description")));
1418: automaticDetailsDescription
1419: .addCaretListener(new TestTreeDescriptionListener());
1420: automaticDetailsDescription
1421: .addFocusListener(new TestDescriptionFocusListener());
1422:
1423: panel.add(allButtons, BorderLayout.NORTH);
1424: panel.add(automaticDetailsDescription, BorderLayout.CENTER);
1425: } // Fin de la m?thode createAutomaticTestDetails/1
1426:
1427: /**
1428: * M?thode qui cr?e la vue sur le script
1429: * @param panel le panel qui contient la vue
1430: */
1431: private void createAutomaticTestScript(JPanel panel) {
1432:
1433: AutomaticTestScriptView view = new AutomaticTestScriptView();
1434: panel.setLayout(new BorderLayout());
1435: panel.add(view, BorderLayout.CENTER);
1436:
1437: } // Fin de la m?thode createAutomaticTestScript/1
1438:
1439: /**
1440: * M?thode qui cr?e la vue pour les attachements des tests automatiques
1441: * @param panel le panel qui contient la vue
1442: */
1443: private void createAttachmentView(JPanel panel, int type) {
1444: panel.setLayout(new BorderLayout());
1445: int realType;
1446: if (type == MANUAL_TEST || type == AUTOMATIC_TEST) {
1447: realType = TEST;
1448: } else {
1449: realType = type;
1450: }
1451: AttachmentView view = new AttachmentView(this , type, realType,
1452: null, NORMAL_SIZE_FOR_ATTACH, null, null, null);
1453: switch (type) {
1454: case MANUAL_TEST: {
1455: manualTestAttachmentView = view;
1456: break;
1457: }
1458: case AUTOMATIC_TEST: {
1459: automaticTestAttachmentView = view;
1460: break;
1461: }
1462: case TESTLIST: {
1463: testListAttachmentView = view;
1464: break;
1465: }
1466: case CAMPAIGN: {
1467: campaignAttachmentView = view;
1468: }
1469: }
1470: panel.add(view, BorderLayout.CENTER);
1471:
1472: } // Fin de la m?thode createAutomaticTestAttachment/1
1473:
1474: /**
1475: * M?thode qui cr?e la vue sur les param?tres des test automatiques.
1476: * @param panel le panel qui contient la vue.
1477: */
1478: private void createAutomaticTestParameter(JPanel panel, boolean use) {
1479:
1480: ParameterView view = new ParameterView(use, AUTOMATIC_TEST);
1481: automaticTestParameterView = view;
1482: automaticTestParameterView.setName(Language.getInstance()
1483: .getText("Vue_automatique"));
1484: panel.setLayout(new BorderLayout());
1485: panel.add(view, BorderLayout.CENTER);
1486:
1487: } // Fin de la m?thode createAutomaticTestParameter/1
1488:
1489: /**************************************************************************/
1490: /** TESTS MANUELS ***/
1491: /**************************************************************************/
1492:
1493: /**
1494: * M?thode qui cr?e la vue pour les tests manuels
1495: */
1496: private void createManualTest() {
1497: workSpaceTest.removeAll();
1498: // Onglets
1499:
1500: JPanel detailsPanel = new JPanel(new BorderLayout());
1501: JPanel actionsPanel = new JPanel();
1502: JPanel attachmentPanel = new JPanel();
1503: JPanel manualParameter = new JPanel();
1504:
1505: manualTest.addTab(Language.getInstance().getText("Détails"),
1506: detailsPanel);
1507: manualTest.addTab(Language.getInstance().getText("Actions"),
1508: actionsPanel);
1509: manualTest.addTab(Language.getInstance()
1510: .getText("Attachements"), attachmentPanel);
1511: manualTest.addTab(Language.getInstance().getText("Paramètres"),
1512: manualParameter);
1513:
1514: createManualTestDetails(detailsPanel);
1515: createManualTestActions(actionsPanel);
1516: createAttachmentView(attachmentPanel, MANUAL_TEST);
1517: createManualTestParameter(manualParameter, true);
1518:
1519: // Mapping entre objets graphiques et constantes
1520: UIComponentsMap.put(
1521: UICompCst.MANUAL_TEST_WORKSPACE_PANEL_FOR_TABS,
1522: manualTest);
1523: // Add this component as static component
1524: UICompCst.staticUIComps
1525: .add(UICompCst.MANUAL_TEST_WORKSPACE_PANEL_FOR_TABS);
1526:
1527: workSpaceTest.setLayout(new BorderLayout());
1528: workSpaceTest.add(manualTest, BorderLayout.CENTER);
1529:
1530: } // Fin de la m?thode createManualTest/0
1531:
1532: /**
1533: * M?thode qui cr?e l'?cran des d?tails sur un test
1534: * @param panel le panel qui contient la vue
1535: */
1536: private void createManualTestDetails(JPanel panel) {
1537:
1538: manualTestConceptorLabel = new JLabel(Language.getInstance()
1539: .getText("Concepteur")
1540: + " : ");
1541: manualTestNameLabel = new JLabel(Language.getInstance()
1542: .getText("Nom_du_test")
1543: + " : ");
1544: manualTestDateLabel = new JLabel(Language.getInstance()
1545: .getText("Date_de_création")
1546: + " : ");
1547: JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
1548: firstLine.add(manualTestNameLabel);
1549: firstLine.add(Box.createRigidArea(new Dimension(50, 20)));
1550: firstLine.add(manualTestDateLabel);
1551:
1552: JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
1553: secondLine.add(manualTestConceptorLabel);
1554:
1555: JPanel allButtons = new JPanel();
1556: allButtons
1557: .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
1558: allButtons.add(firstLine);
1559: allButtons.add(secondLine);
1560:
1561: //allButtons.add()
1562: allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
1563: 0));
1564: manualDetailsDescription.setBorder(BorderFactory
1565: .createTitledBorder(BorderFactory
1566: .createLineBorder(Color.BLACK), Language
1567: .getInstance().getText("Description")));
1568: manualDetailsDescription
1569: .addCaretListener(new TestTreeDescriptionListener());
1570: manualDetailsDescription
1571: .addFocusListener(new TestDescriptionFocusListener());
1572: panel.add(allButtons, BorderLayout.NORTH);
1573: panel.add(manualDetailsDescription, BorderLayout.CENTER);
1574: } // Fin de la m?thode createManualTestDetails/1
1575:
1576: /**
1577: * M?thode qui cr?e la vue pour les actions associ?es aux tests manuels
1578: * @param panel le panel qui contient la vue
1579: */
1580: private void createManualTestActions(JPanel panel) {
1581:
1582: ManualActionView view = new ManualActionView();
1583: panel.setLayout(new BorderLayout());
1584: panel.add(view, BorderLayout.CENTER);
1585:
1586: } // Fin de la m?thode createManualTestActions/1
1587:
1588: /**
1589: * M?thode qui cr?e la vue sur les param?tres des test manuels.
1590: * @param panel le panel qui contient la vue.
1591: */
1592: private void createManualTestParameter(JPanel panel, boolean use) {
1593: ParameterView view;
1594: if (use) {
1595: view = new ParameterView(use, MANUAL_TEST);
1596: testParameterView = view;
1597: testParameterView.setName(Language.getInstance().getText(
1598: "Tests_manuels"));
1599: } else {
1600: view = new ParameterView(use, PARAMETER);
1601: dataParameterView = view;
1602: dataParameterView.setName(Language.getInstance().getText(
1603: "Vue_des_données"));
1604: }
1605:
1606: panel.setLayout(new BorderLayout());
1607: panel.add(view, BorderLayout.CENTER);
1608:
1609: } // Fin de la m?thode createManualTestParameter/1
1610:
1611: /**************************************************************************/
1612: /** CAMPAGNES ***/
1613: /**************************************************************************/
1614:
1615: /**
1616: * M?thode qui cr?e la vue sur les campagnes
1617: */
1618: private void createCampagnePlane() {
1619:
1620: //La liste des boutons de la vue (c?t? gauche de la vue)
1621: createCampagne = new JButton(Language.getInstance().getText(
1622: "Créer_une_campagne"));
1623: createCampagne.setToolTipText(Language.getInstance().getText(
1624: "Créer_une_campagne"));
1625: createCampagne.addActionListener(new ActionListener() {
1626: public void actionPerformed(ActionEvent e) {
1627: DataModel.addNewCampagne();
1628: }
1629: });
1630:
1631: addTestInCampagne = new JButton(Language.getInstance().getText(
1632: "Importer"));
1633: addTestInCampagne.setEnabled(false);
1634: addTestInCampagne.setToolTipText(Language.getInstance()
1635: .getText("Ajouter_des_tests_à_la_campagne"));
1636: addTestInCampagne.addActionListener(new ActionListener() {
1637: public void actionPerformed(ActionEvent e) {
1638: DataModel.importTestsToCampaign();
1639: }
1640: });
1641:
1642: orderCampagne = new JButton(Language.getInstance().getText(
1643: "Ordonner"));
1644: orderCampagne.setToolTipText(Language.getInstance().getText(
1645: "Ordonner_une_campagne"));
1646: orderCampagne.addActionListener(new ActionListener() {
1647: public void actionPerformed(ActionEvent e) {
1648: new TestOrdering(campaignDynamicTree.getModel(), true);
1649: }
1650: });
1651:
1652: JMenuItem refreshItem = new JMenuItem(Language.getInstance()
1653: .getText("Rafraichir"));
1654: refreshItem.addActionListener(new ActionListener() {
1655: public void actionPerformed(ActionEvent e) {
1656: workSpaceCampagne.removeAll();
1657: DataModel.reloadFromBase();
1658: }
1659: });
1660:
1661: campToolsMenu.add(refreshItem);
1662:
1663: // Sous menu pour changer le mot de passe
1664: JMenuItem changePwdItem = new JMenuItem(Language.getInstance()
1665: .getText("Changer_le_mot_de_passe"));
1666: changePwdItem.addActionListener(new ActionListener() {
1667: public void actionPerformed(ActionEvent e) {
1668: new ChangePwdWindow(ptrFrame).show();
1669: }
1670: });
1671:
1672: campToolsMenu.add(changePwdItem);
1673:
1674: JMenuBar menuBar = new JMenuBar();
1675: menuBar.add(campToolsMenu);
1676:
1677: delCampagne = new JButton(Language.getInstance().getText(
1678: "Supprimer"));
1679: delCampagne.setEnabled(false);
1680: delCampagne.setToolTipText(Language.getInstance().getText(
1681: "Supprimer"));
1682: delCampagne.addActionListener(new ActionListener() {
1683: public void actionPerformed(ActionEvent e) {
1684: DataModel.deleteInCampaignTree();
1685: }
1686: });
1687:
1688: renameCampaignButton = new JButton(Language.getInstance()
1689: .getText("Renommer"));
1690: renameCampaignButton.setEnabled(false);
1691: renameCampaignButton.addActionListener(new ActionListener() {
1692: public void actionPerformed(ActionEvent e) {
1693: DataModel.renameCampaign();
1694: }
1695: });
1696:
1697: JButton quitCampagneButton = new JButton(Language.getInstance()
1698: .getText("Quitter"));
1699: quitCampagneButton.addActionListener(new ActionListener() {
1700: public void actionPerformed(ActionEvent e) {
1701: quit(true);
1702: }
1703: });
1704:
1705: // Panel regroupant tous les boutons
1706: //JPanel listPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
1707: JPanel listPanel = new JPanel(new GridLayout(1, 3));
1708: listPanel.add(addTestInCampagne);
1709: listPanel.add(orderCampagne);
1710: listPanel.add(renameCampaignButton);
1711: listPanel.add(delCampagne);
1712: listPanel.setBorder(BorderFactory.createRaisedBevelBorder());
1713:
1714: // Mapping entre objets graphiques et constantes
1715: UIComponentsMap.put(UICompCst.CAMP_SECOND_BUTTONS_PANEL,
1716: listPanel);
1717: // Add this component as static component
1718: UICompCst.staticUIComps
1719: .add(UICompCst.CAMP_SECOND_BUTTONS_PANEL);
1720:
1721: //JPanel createPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
1722: JPanel createPanel = new JPanel(new GridLayout(1, 3));
1723: createPanel.add(createCampagne);
1724: //createPanel.add(Box.createRigidArea(new Dimension(50,1)));
1725: createPanel.add(menuBar);
1726: createPanel.setBorder(BorderFactory.createRaisedBevelBorder());
1727:
1728: // Mapping entre objets graphiques et constantes
1729: UIComponentsMap.put(UICompCst.CAMP_FIRST_BUTTONS_PANEL,
1730: createPanel);
1731: // Add this component as static component
1732: UICompCst.staticUIComps.add(UICompCst.CAMP_FIRST_BUTTONS_PANEL);
1733:
1734: campaignDynamicTree = new DynamicTree(Language.getInstance()
1735: .getText("Campagnes_de_tests"), CAMPAIGN);
1736:
1737: createCampagneWorkSpace();
1738: createCampaignFamily();
1739: createCampaignTestList();
1740: createCampaignTest();
1741: workSpaceCampagne.removeAll();
1742:
1743: // Construction finale
1744: JPanel allButtons = new JPanel();
1745: allButtons
1746: .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
1747:
1748: allButtons.add(createPanel);
1749: allButtons.add(listPanel);
1750:
1751: JPanel buttonsAndTree = new JPanel(new BorderLayout());
1752: buttonsAndTree.add(allButtons, BorderLayout.NORTH);
1753: buttonsAndTree.add(campaignDynamicTree, BorderLayout.CENTER);
1754: buttonsAndTree.add(quitCampagneButton, BorderLayout.SOUTH);
1755: buttonsAndTree.setPreferredSize(new Dimension(380, 380));
1756:
1757: campagne.add(workSpaceCampagne, BorderLayout.CENTER);
1758: campagne.add(buttonsAndTree, BorderLayout.WEST);
1759:
1760: } // fin de la m?thode createCampagnePlane/0
1761:
1762: /**
1763: * M?thode qui cr?e la vue de droite pour les campagnes
1764: */
1765: private void createCampagneWorkSpace() {
1766: workSpaceCampagne.removeAll();
1767: // Onglets
1768:
1769: JPanel details = new JPanel(new BorderLayout());
1770: JPanel data = new JPanel();
1771: JPanel attachment = new JPanel();
1772: JPanel executionPanel = new JPanel();
1773:
1774: campagneSpace.addTab(Language.getInstance().getText("Détails"),
1775: details);
1776: campagneSpace.addTab(Language.getInstance().getText(
1777: "Attachements"), attachment);
1778: campagneSpace.addTab(Language.getInstance().getText(
1779: "Exécutions"), executionPanel);
1780: campagneSpace.addTab(Language.getInstance().getText(
1781: "Jeux_de_données"), data);
1782: campagneSpace.addChangeListener(new ChangeListener() {
1783: public void stateChanged(ChangeEvent e) {
1784: if (tabs.getModel().getSelectedIndex() == 1) {
1785: DataModel.initAttachmentTable(DataModel
1786: .getCurrentCampaign().getAttachmentMap()
1787: .values());
1788: }
1789: }
1790: });
1791:
1792: createCampagneDetails(details);
1793: createCampagneAttachments(attachment);
1794: createExecution(executionPanel);
1795: createData(data);
1796:
1797: // Mapping entre objets graphiques et constantes
1798: UIComponentsMap.put(
1799: UICompCst.CAMPAIGN_WORKSPACE_PANEL_FOR_TABS,
1800: campagneSpace);
1801: // Add this component as static component
1802: UICompCst.staticUIComps
1803: .add(UICompCst.CAMPAIGN_WORKSPACE_PANEL_FOR_TABS);
1804:
1805: workSpaceCampagne.setLayout(new BorderLayout());
1806: workSpaceCampagne.add(campagneSpace, BorderLayout.CENTER);
1807: } // Fin de la m?thode createCampagneWorkSpace/0
1808:
1809: /**
1810: * M?thode qui cr?e la vue sur les familles
1811: */
1812: private void createCampaignFamily() {
1813:
1814: workSpaceCampagne.removeAll();
1815:
1816: campaignFamilyDescription = new JTextPane();
1817: campaignFamilyDescription
1818: .addCaretListener(new CampaignTreeDescriptionListener());
1819: campaignFamilyDescription.setEditable(false);
1820: // Onglets
1821: campaignFamilyWorkSpace.addTab(Language.getInstance().getText(
1822: "Description"), campaignFamilyDescription);
1823:
1824: workSpaceCampagne.setLayout(new BorderLayout());
1825: workSpaceCampagne.add(campaignFamilyWorkSpace,
1826: BorderLayout.CENTER);
1827:
1828: addToUIComponentsMap(
1829: UICompCst.FAMILY_CAMP_WORKSPACE_TABS_PANEL,
1830: campaignFamilyWorkSpace);
1831: UICompCst.staticUIComps
1832: .add(UICompCst.FAMILY_CAMP_WORKSPACE_TABS_PANEL);
1833: } // Fin de la m?thode createAttachments/0
1834:
1835: /**
1836: * M?thode qui cr?e la vue sur les familles
1837: */
1838: private void createCampaignTestList() {
1839:
1840: workSpaceCampagne.removeAll();
1841:
1842: // Onglets
1843: campaignTestListDescription = new JTextPane();
1844: campaignTestListDescription
1845: .addCaretListener(new CampaignTreeDescriptionListener());
1846: campaignTestListDescription.setEditable(false);
1847: campaignTestListWorkSpace.addTab(Language.getInstance()
1848: .getText("Description"), campaignTestListDescription);
1849:
1850: workSpaceCampagne.setLayout(new BorderLayout());
1851: workSpaceCampagne.add(campaignTestListWorkSpace,
1852: BorderLayout.CENTER);
1853:
1854: addToUIComponentsMap(
1855: UICompCst.TESTLIST_CAMP_WORKSPACE_TABS_PANEL,
1856: campaignTestListWorkSpace);
1857: UICompCst.staticUIComps
1858: .add(UICompCst.TESTLIST_CAMP_WORKSPACE_TABS_PANEL);
1859: } // Fin de la m?thode createAttachments/0
1860:
1861: /**
1862: * M?thode qui cr?e la vue sur les familles
1863: */
1864: private void createCampaignTest() {
1865:
1866: workSpaceCampagne.removeAll();
1867:
1868: // Onglets
1869: campaignTestDescription = new JTextPane();
1870: campaignTestDescription
1871: .addCaretListener(new CampaignTreeDescriptionListener());
1872: campaignTestDescription.setEditable(false);
1873: campaignTestWorkSpace.addTab(Language.getInstance().getText(
1874: "Description"), campaignTestDescription);
1875:
1876: workSpaceCampagne.setLayout(new BorderLayout());
1877: workSpaceCampagne.add(campaignTestWorkSpace,
1878: BorderLayout.CENTER);
1879:
1880: addToUIComponentsMap(UICompCst.TEST_CAMP_WORKSPACE_TABS_PANEL,
1881: campaignTestWorkSpace);
1882: UICompCst.staticUIComps
1883: .add(UICompCst.TEST_CAMP_WORKSPACE_TABS_PANEL);
1884: } // Fin de la m?thode createAttachments/0
1885:
1886: /**
1887: * M?thode qui cr?e la vue de d?tails sur les campagnes
1888: * @param panel le panel qui contient la vue
1889: */
1890: private void createCampagneDetails(JPanel panel) {
1891: campaignNameLabel = new JLabel(Language.getInstance().getText(
1892: "Nom_de_la_campagne")
1893: + " : ");
1894: campaignDateLabel = new JLabel(Language.getInstance().getText(
1895: "Date_de_création")
1896: + " : ");
1897: campaignConceptorLabel = new JLabel(Language.getInstance()
1898: .getText("Concepteur")
1899: + " : ");
1900:
1901: JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
1902: firstLine.add(campaignNameLabel);
1903:
1904: firstLine.add(Box.createRigidArea(new Dimension(50, 20)));
1905: firstLine.add(campaignDateLabel);
1906:
1907: JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
1908: secondLine.add(campaignConceptorLabel);
1909:
1910: JPanel allButtons = new JPanel();
1911: allButtons
1912: .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
1913: allButtons.add(firstLine);
1914: allButtons.add(secondLine);
1915:
1916: //allButtons.add()
1917: allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
1918: 0));
1919: campagneDetailsDescription.setBorder(BorderFactory
1920: .createTitledBorder(BorderFactory
1921: .createLineBorder(Color.BLACK), Language
1922: .getInstance().getText("Description")));
1923: campagneDetailsDescription
1924: .addCaretListener(new CampaignTreeDescriptionListener());
1925: campagneDetailsDescription
1926: .addFocusListener(new CampaignDescriptionFocusListener());
1927:
1928: panel.add(allButtons, BorderLayout.NORTH);
1929: panel.add(campagneDetailsDescription, BorderLayout.CENTER);
1930: } // Fin de la m?thode createCampagneDetails/1
1931:
1932: /**
1933: * M?thode qui cr?e la vue sur les attachments des campagnes
1934: * @param panel le panel qui contient la vue
1935: */
1936: private void createCampagneAttachments(JPanel panel) {
1937: createAttachmentView(panel, CAMPAIGN);
1938: } // Fin de la m?thode createCampagneAttachments/1
1939:
1940: /**
1941: * M?thode qui cr?e la vue sur les ex?cutions
1942: * @param panel le panel qui contient la vue
1943: */
1944: private void createExecution(JPanel panel) {
1945: ExecutionView view = new ExecutionView();
1946: panel.setLayout(new BorderLayout());
1947: panel.add(view, BorderLayout.CENTER);
1948: } // Fin de la m?thode createExecution/1
1949:
1950: /**
1951: * M?thode qui cr?e la vue sur les jeux de donn?es
1952: * @param panel le panel qui contient la vue
1953: */
1954: private void createData(JPanel panel) {
1955: DataSetView view = new DataSetView();
1956: panel.setLayout(new BorderLayout());
1957: panel.add(view, BorderLayout.CENTER);
1958: } // Fin de la m?thode createData/1
1959:
1960: /**
1961: * M?thode qui cr?e la vue sur les environnements
1962: *@param panel le panel qui contient la vue
1963: */
1964: public void createEnvironment(JPanel panel) {
1965:
1966: EnvironmentView view = new EnvironmentView();
1967: panel.setLayout(new BorderLayout());
1968: panel.add(view, BorderLayout.CENTER);
1969: } // Fin de la m?thode
1970:
1971: /******************************************************************************/
1972: /******************************************************************************/
1973: /** METHODES ***/
1974: /******************************************************************************/
1975: /******************************************************************************/
1976: /**
1977: * M?thode appel? lorsque l'utilisateur quitte l'application.
1978: */
1979: public void quit(boolean do_recup) {
1980:
1981: if (ConnectionData.isConnected()) {
1982: if ((!problemURL) && (!Api.IDE_DEV)) {
1983: String[] tab = getDocumentBase().toString().split(
1984: "[?=]");
1985: int idConn = Integer.parseInt(tab[2]);
1986: Api.deleteConnection(idConn);
1987: }
1988: Api.closeConnection();
1989: dbClosed = true;
1990: }
1991:
1992: URL recup;
1993: try {
1994: if (do_recup) {
1995: /* r?cup?re l'URL ? partir du document courant et "page.html" */
1996: recup = new URL(getDocumentBase(), "index.html");
1997: /* Affiche le document apr?s avoir recup?rer le contexte courant */
1998: getAppletContext().showDocument(recup);
1999: repaint();
2000: } else {
2001: getAppletContext()
2002: .showDocument(
2003: new URL(
2004: "http://wiki.objectweb.org/salome-tmf"));
2005: }
2006: } catch (MalformedURLException me) {
2007: me.printStackTrace();
2008: }
2009: // stop();
2010: //destroy();
2011: } // Fin de la m?thode quit();
2012:
2013: /******************************************************************************/
2014: /** ACCESSEURS ***/
2015: /******************************************************************************/
2016:
2017: /**
2018: *
2019: * @return
2020: */
2021: public static DynamicTree getTestDynamicTree() {
2022: return testDynamicTree;
2023: }
2024:
2025: /**
2026: *
2027: * @return
2028: */
2029: public static DynamicTree getCampaignDynamicTree() {
2030: return campaignDynamicTree;
2031: }
2032:
2033: /**
2034: * @return
2035: */
2036: public static JPanel getCampagne() {
2037: return campagne;
2038: }
2039:
2040: /**
2041: * @return
2042: */
2043: public static JPanel getTests() {
2044: return tests;
2045: }
2046:
2047: /**
2048: * @return
2049: */
2050: public static JPanel getWorkSpaceCampagne() {
2051: return workSpaceCampagne;
2052: }
2053:
2054: /**
2055: * @return
2056: */
2057: public static JPanel getWorkSpaceTest() {
2058: return workSpaceTest;
2059: }
2060:
2061: /**
2062: * @return
2063: */
2064: public static JTextPane getCampagneDetailsDescription() {
2065: return campagneDetailsDescription;
2066: }
2067:
2068: /**
2069: * @return
2070: */
2071: public static JTextPane getFamilyDescription() {
2072: return familyDescription;
2073: }
2074:
2075: /**
2076: * @return
2077: */
2078: public static JTextPane getTestListDescription() {
2079: return testListDescription;
2080: }
2081:
2082: /**
2083: * @return
2084: */
2085: public static JTextPane getAutomaticDetailsDescription() {
2086: return automaticDetailsDescription;
2087: }
2088:
2089: /**
2090: * @return
2091: */
2092: public static int getDefaultCampagneNumber() {
2093: return defaultCampagneNumber;
2094: }
2095:
2096: /**
2097: * @return
2098: */
2099: public static JTextPane getManualDetailsDescription() {
2100: return manualDetailsDescription;
2101: }
2102:
2103: /**
2104: * @return
2105: */
2106: public static JTabbedPane getAutomaticTest() {
2107: return automaticTest;
2108: }
2109:
2110: /**
2111: * @return
2112: */
2113: public static JTabbedPane getCampagneSpace() {
2114: return campagneSpace;
2115: }
2116:
2117: /**
2118: * @return
2119: */
2120: public static JTabbedPane getCampaignTestListWorkSpace() {
2121: return campaignTestListWorkSpace;
2122: }
2123:
2124: /**
2125: * @return
2126: */
2127: public static JTabbedPane getDataSpace() {
2128: return dataSpace;
2129: }
2130:
2131: /**
2132: * @return
2133: */
2134: public static JButton getDelCampagne() {
2135: return delCampagne;
2136: }
2137:
2138: /**
2139: * @return
2140: */
2141: public static JButton getDelTestOrTestList() {
2142: return delTestOrTestList;
2143: }
2144:
2145: /**
2146: * @return
2147: */
2148: public static JTabbedPane getFamilyWorkSpace() {
2149: return familyWorkSpace;
2150: }
2151:
2152: /**
2153: * @return
2154: */
2155: public static JTabbedPane getListWorkSpace() {
2156: return listWorkSpace;
2157: }
2158:
2159: /**
2160: * @return
2161: */
2162: public static JButton getOrderCampagne() {
2163: return orderCampagne;
2164: }
2165:
2166: /**
2167: * @return
2168: */
2169: public static JButton getAddTestInCampagne() {
2170: return addTestInCampagne;
2171: }
2172:
2173: /**
2174: * @return
2175: */
2176: public static JTextPane getCampaignTestDescription() {
2177: return campaignTestDescription;
2178: }
2179:
2180: /**
2181: * @return
2182: */
2183: public static JTextPane getCampaignFamilyDescription() {
2184: return campaignFamilyDescription;
2185: }
2186:
2187: /**
2188: * @return
2189: */
2190: public static JTextPane getCampaignTestListDescription() {
2191: return campaignTestListDescription;
2192: }
2193:
2194: /**
2195: * @return
2196: */
2197: public static JTabbedPane getManualTest() {
2198: return manualTest;
2199: }
2200:
2201: /**
2202: * @return
2203: */
2204: public static JTabbedPane getCampaignFamilyWorkSpace() {
2205: return campaignFamilyWorkSpace;
2206: }
2207:
2208: /**
2209: * @return
2210: */
2211: public static JTabbedPane getCampaignTestWorkSpace() {
2212: return campaignTestWorkSpace;
2213: }
2214:
2215: /**
2216: * @return
2217: */
2218: public static JLabel getAutomaticTestConceptorLabel() {
2219: return automaticTestConceptorLabel;
2220: }
2221:
2222: /**
2223: * @return
2224: */
2225: public static JLabel getAutomaticTestDateLabel() {
2226: return automaticTestDateLabel;
2227: }
2228:
2229: /**
2230: * @return
2231: */
2232: public static JLabel getAutomaticTestNameLabel() {
2233: return automaticTestNameLabel;
2234: }
2235:
2236: /**
2237: * @return
2238: */
2239: public static JLabel getManualTestNameLabel() {
2240: return manualTestNameLabel;
2241: }
2242:
2243: /**
2244: * @return
2245: */
2246: public static JLabel getManualTestConceptorLabel() {
2247: return manualTestConceptorLabel;
2248: }
2249:
2250: /**
2251: * @return
2252: */
2253: public static JLabel getManualTestDateLabel() {
2254: return manualTestDateLabel;
2255: }
2256:
2257: /**
2258: * @return
2259: */
2260: public static JButton getRenameTestButton() {
2261: return renameTestButton;
2262: }
2263:
2264: /**
2265: * @return
2266: */
2267: public static JButton getRenameCampaignButton() {
2268: return renameCampaignButton;
2269: }
2270:
2271: /**
2272: * @return
2273: */
2274: public static JLabel getCampaignConceptorLabel() {
2275: return campaignConceptorLabel;
2276: }
2277:
2278: /**
2279: * @return
2280: */
2281: public static JLabel getCampaignDateLabel() {
2282: return campaignDateLabel;
2283: }
2284:
2285: /**
2286: * @return
2287: */
2288: public static JLabel getCampaignNameLabel() {
2289: return campaignNameLabel;
2290: }
2291:
2292: public static void clearTrees() {
2293: testDynamicTree.clear();
2294: campaignDynamicTree.clear();
2295: }
2296:
2297: /**
2298: *
2299: *
2300: */
2301: private void giveAccessToIhm() {
2302: if (ConnectionData.isConnected()) {
2303:
2304: if (!AdminProject.canDeleteTest()) {
2305:
2306: delTestOrTestList.setEnabled(false);
2307:
2308: }
2309: if (!AdminProject.canCreateTest()) {
2310:
2311: addTest.setEnabled(false);
2312: addList.setEnabled(false);
2313: addFamily.setEnabled(false);
2314:
2315: }
2316: if (!AdminProject.canUpdateTest()) {
2317:
2318: renameTestButton.setEnabled(false);
2319: orderTest.setEnabled(false);
2320: familyDescription.setEditable(false);
2321: testListDescription.setEditable(false);
2322: manualDetailsDescription.setEditable(false);
2323: automaticDetailsDescription.setEditable(false);
2324: campaignFamilyDescription.setEditable(false);
2325: campaignTestListDescription.setEditable(false);
2326: campaignTestDescription.setEditable(false);
2327:
2328: testDynamicTree.setEnabled(false);
2329: testListDescription.setEditable(false);
2330: manualDetailsDescription.setEditable(false);
2331: automaticDetailsDescription.setEditable(false);
2332: familyDescription.setEditable(false);
2333: }
2334: if (!AdminProject.canDeleteCamp()) {
2335: delCampagne.setEnabled(false);
2336:
2337: }
2338: if (!AdminProject.canCreateCamp()) {
2339: createCampagne.setEnabled(false);
2340: addTestInCampagne.setEnabled(false);
2341:
2342: }
2343: if (!AdminProject.canUpdateCamp()) {
2344: orderCampagne.setEnabled(false);
2345: renameCampaignButton.setEnabled(false);
2346:
2347: campaignDynamicTree.setEnabled(false);
2348: campagneDetailsDescription.setEditable(false);
2349: }
2350: if (!AdminProject.canExecutCamp()) {
2351:
2352: }
2353: }
2354: }
2355:
2356: public void update(Observable observable, Object obj) {
2357: Api.log(Language.getInstance().getText(
2358: "On_entre_dans_update_observer"));
2359: if (obj instanceof Vector) {
2360: if (((Vector) obj).size() > 0)
2361: DataModel.apiExceptionView((Vector) obj);
2362: }
2363: if (obj instanceof Integer) {
2364: int code = ((Integer) obj).intValue();
2365: Api.log("Valeur de Integer : " + code);
2366: if (code >= 100 && code < 105) {
2367: testMultiUserChangeListenerPanel.addDelete();
2368: } else if (code >= 105 && code < 110) {
2369: campagneMultiUserChangeListenerPanel.addDelete();
2370: } else if (code >= 110 && code < 112) {
2371: dataMultiUserChangeListenerPanel.addDelete();
2372: } else if (code >= 200 && code < 205) {
2373: testMultiUserChangeListenerPanel.addUInsert();
2374: } else if (code >= 205 && code < 211) {
2375: campagneMultiUserChangeListenerPanel.addUInsert();
2376: } else if (code >= 211 && code < 214) {
2377: dataMultiUserChangeListenerPanel.addUInsert();
2378: } else if (code >= 300 && code < 304) {
2379: testMultiUserChangeListenerPanel.addUpdate();
2380: } else if (code >= 304 && code < 307) {
2381: campagneMultiUserChangeListenerPanel.addUpdate();
2382: } else if (code >= 307 && code < 309) {
2383: dataMultiUserChangeListenerPanel.addUpdate();
2384: }
2385: // DataModel.addModification(obj);
2386: }
2387: }
2388:
2389: /**
2390: * @return
2391: */
2392: public static changeListenerPanel getCampagneMultiUserChangeListenerPanel() {
2393: return campagneMultiUserChangeListenerPanel;
2394: }
2395:
2396: /**
2397: * @return
2398: */
2399: public static changeListenerPanel getDataMultiUserChangeListenerPanel() {
2400: return dataMultiUserChangeListenerPanel;
2401: }
2402:
2403: /**
2404: * @return
2405: */
2406: public static changeListenerPanel getTestMultiUserChangeListenerPanel() {
2407: return testMultiUserChangeListenerPanel;
2408: }
2409:
2410: /**
2411: * M?thode invoqu?e par le "CorePlugin"
2412: * @param pM
2413: * @param common
2414: */
2415: public static void init_Component(PluginManager pM,
2416: ExtensionPoint common, ExtensionPoint testDriver,
2417: ExtensionPoint scriptEngine) {
2418:
2419: pluginManager = pM;
2420: CommonExtPoint = common;
2421: testDriverExtPoint = testDriver;
2422: scriptEngineExtPoint = scriptEngine;
2423: }
2424:
2425: /**
2426: * M?thode utilis?e par les autres classes de l'IHM pour remplir la table
2427: * de hachage pour le mapping entre composants graphiques et constantes
2428: * @param uiConst
2429: * @param uiComp
2430: */
2431: public static void addToUIComponentsMap(Integer uiConst,
2432: Object uiComp) {
2433: if (UIComponentsMap != null)
2434: UIComponentsMap.put(uiConst, uiComp);
2435: }
2436:
2437: /**
2438: * Methode qui renvoie l'objet graphique associ? ? une constante
2439: * @return
2440: * @param uiConst
2441: */
2442: public static Object getUIComponent(Integer uiConst) {
2443: Object comp = null;
2444: if (UIComponentsMap != null)
2445: comp = UIComponentsMap.get(uiConst);
2446: return comp;
2447: }
2448:
2449: /**
2450: * Methode qui remplie la table de hachage pour le mapping entre objets graphiques
2451: * et les plugins associ?s
2452: * @param commonPlg
2453: * @param
2454: */
2455: public static void addPlgToUICompList(Integer uiConst,
2456: Common commonPlg) {
2457:
2458: if (associatedPlgsToCompsMap != null) {
2459: Object listPlgs = associatedPlgsToCompsMap.get(uiConst);
2460:
2461: if (listPlgs == null) {
2462: java.util.LinkedList list = new java.util.LinkedList();
2463: list.add(commonPlg);
2464: associatedPlgsToCompsMap.put(uiConst, list);
2465: } else {
2466: ((java.util.LinkedList) listPlgs).add(commonPlg);
2467: }
2468: }
2469: }
2470:
2471: /**
2472: * Methode qui retourne la liste des plugins associ? ? un composant graphique
2473: * @param uiConst
2474: * @return
2475: */
2476: public static java.util.LinkedList getAssociatedPluginsToUIComp(
2477: Integer uiConst) {
2478: java.util.LinkedList associatedPlgs = null;
2479: if (associatedPlgsToCompsMap != null)
2480: associatedPlgs = (java.util.LinkedList) associatedPlgsToCompsMap
2481: .get(uiConst);
2482: return associatedPlgs;
2483: }
2484:
2485: } // Fin de la classe SalomeTMF
|