Source Code Cross Referenced for ParameterView.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » ihm » main » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » org.objectweb.salome_tmf.ihm.main 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.main;
0025:
0026:        import java.awt.BorderLayout;
0027:        import java.awt.Dimension;
0028:        import java.awt.GridLayout;
0029:        import java.awt.event.ActionEvent;
0030:        import java.awt.event.ActionListener;
0031:        import java.util.ArrayList;
0032:        import java.util.Vector;
0033:
0034:        import javax.swing.BorderFactory;
0035:        import javax.swing.JButton;
0036:        import javax.swing.JOptionPane;
0037:        import javax.swing.JPanel;
0038:        import javax.swing.JScrollPane;
0039:        import javax.swing.JTable;
0040:        import javax.swing.ListSelectionModel;
0041:        import javax.swing.event.ListSelectionEvent;
0042:        import javax.swing.event.ListSelectionListener;
0043:        import javax.swing.tree.DefaultMutableTreeNode;
0044:
0045:        import org.objectweb.salome_tmf.api.Api;
0046:        import org.objectweb.salome_tmf.api.Permission;
0047:        import org.objectweb.salome_tmf.api.data.ParameterWrapper;
0048:        import org.objectweb.salome_tmf.data.Action;
0049:        import org.objectweb.salome_tmf.data.Campaign;
0050:        import org.objectweb.salome_tmf.data.DataConstants;
0051:        import org.objectweb.salome_tmf.data.Environment;
0052:        import org.objectweb.salome_tmf.data.ManualTest;
0053:        import org.objectweb.salome_tmf.data.Parameter;
0054:        import org.objectweb.salome_tmf.data.Test;
0055:        import org.objectweb.salome_tmf.ihm.common.AskNameAndDescription;
0056:        import org.objectweb.salome_tmf.ihm.languages.Language;
0057:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
0058:        import org.objectweb.salome_tmf.ihm.main.plugins.PluginsTools;
0059:        import org.objectweb.salome_tmf.ihm.models.TableSorter;
0060:        import org.objectweb.salome_tmf.ihm.tools.Tools;
0061:        import org.objectweb.salome_tmf.plugins.UICompCst;
0062:
0063:        public class ParameterView extends JPanel implements  DataConstants,
0064:                ActionListener, ListSelectionListener {
0065:
0066:            JPanel paramsPanel;
0067:
0068:            JButton refreshButton;
0069:
0070:            JButton modifyParameterButton;
0071:
0072:            JButton deleteParameterButton;
0073:
0074:            JButton addParameter;
0075:
0076:            JButton useParameterButton;
0077:            //	MyTableModel manualParameterTableModel = new MyTableModel();
0078:
0079:            JTable parametersTable;
0080:
0081:            boolean usingFonctionEnable;
0082:
0083:            TableSorter sorter;
0084:
0085:            /******************************************************************************/
0086:            /** 							CONSTRUCTEUR								***/
0087:            /******************************************************************************/
0088:
0089:            /**
0090:             *
0091:             * type is use for plugin UI = AUTOMATIC_TEST or MANUAL_TEST or PARAMETER or -1 for Dynamic
0092:             */
0093:
0094:            public ParameterView(boolean use, int type) {
0095:                paramsPanel = new JPanel();
0096:
0097:                refreshButton = new JButton(Language.getInstance().getText(
0098:                        "Rafraichir"));
0099:                refreshButton.addActionListener(this );
0100:
0101:                modifyParameterButton = new JButton(Language.getInstance()
0102:                        .getText("Modifier"));
0103:                deleteParameterButton = new JButton(Language.getInstance()
0104:                        .getText("Supprimer"));
0105:                parametersTable = new JTable();
0106:
0107:                addParameter = new JButton(Language.getInstance().getText(
0108:                        "Nouveau"));
0109:                addParameter.setToolTipText(Language.getInstance().getText(
0110:                        "Ajouter_un_nouveau_paramètre"));
0111:                addParameter.addActionListener(this );
0112:
0113:                useParameterButton = new JButton(Language.getInstance()
0114:                        .getText("Utiliser"));
0115:                useParameterButton.setToolTipText(Language.getInstance()
0116:                        .getText("Utiliser_des_paramètres_existants"));
0117:                useParameterButton.addActionListener(this );
0118:
0119:                modifyParameterButton.setEnabled(false);
0120:                modifyParameterButton.setToolTipText(Language.getInstance()
0121:                        .getText("Modifier_un_paramètre"));
0122:                modifyParameterButton.addActionListener(this );
0123:
0124:                deleteParameterButton.setToolTipText(Language.getInstance()
0125:                        .getText("Supprimer_un_paramètre"));
0126:                deleteParameterButton.setEnabled(false);
0127:                deleteParameterButton.addActionListener(this );
0128:
0129:                JPanel buttonsPanel = new JPanel(new GridLayout(1, 4));
0130:                buttonsPanel.add(refreshButton);
0131:                buttonsPanel.add(addParameter);
0132:                if (use) {
0133:                    buttonsPanel.add(useParameterButton);
0134:                }
0135:
0136:                buttonsPanel.add(modifyParameterButton);
0137:                buttonsPanel.add(deleteParameterButton);
0138:                buttonsPanel.setBorder(BorderFactory.createRaisedBevelBorder());
0139:
0140:                ListSelectionModel rowSM = parametersTable.getSelectionModel();
0141:                rowSM.addListSelectionListener(this );
0142:
0143:                //sorter = new TableSorter();
0144:                if (use) {
0145:                    sorter = new TableSorter(DataModel
0146:                            .getTestParameterTableModel());
0147:                    //parametersTable.setModel(DataModel.getTestParameterTableModel());
0148:                } else {
0149:                    sorter = new TableSorter(DataModel.getParameterTableModel());
0150:                    //parametersTable.setModel(DataModel.getParameterTableModel());
0151:                }
0152:                parametersTable.setModel(sorter);
0153:                sorter.setTableHeader(parametersTable.getTableHeader());
0154:
0155:                parametersTable
0156:                        .setPreferredScrollableViewportSize(new Dimension(600,
0157:                                200));
0158:                parametersTable
0159:                        .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
0160:
0161:                JScrollPane tablePane = new JScrollPane(parametersTable);
0162:                tablePane.setBorder(BorderFactory.createRaisedBevelBorder());
0163:
0164:                initData(use);
0165:
0166:                paramsPanel.setLayout(new BorderLayout());
0167:                paramsPanel.add(buttonsPanel, BorderLayout.NORTH);
0168:                paramsPanel.add(tablePane, BorderLayout.CENTER);
0169:
0170:                this .setLayout(new BorderLayout());
0171:                this .add(paramsPanel);
0172:
0173:                mapUIComponents(paramsPanel, parametersTable, buttonsPanel,
0174:                        type);
0175:
0176:            } // Fin du constructeur ManualParameterView/0
0177:
0178:            void mapUIComponents(JPanel paramsPanel, JTable parametersTable,
0179:                    JPanel buttonsPanel, int type) {
0180:                switch (type) {
0181:                case MANUAL_TEST: {
0182:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0183:                            UICompCst.MANUAL_TEST_PARAMS_PANEL, paramsPanel);
0184:                    UICompCst.staticUIComps
0185:                            .add(UICompCst.MANUAL_TEST_PARAMS_PANEL);
0186:
0187:                    SalomeTMFContext.getInstance()
0188:                            .addToUIComponentsMap(
0189:                                    UICompCst.MANUAL_TEST_PARAMS_TABLE,
0190:                                    parametersTable);
0191:                    UICompCst.staticUIComps
0192:                            .add(UICompCst.MANUAL_TEST_PARAMS_TABLE);
0193:
0194:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0195:                            UICompCst.MANUAL_TEST_PARAMS_BUTTONS_PANEL,
0196:                            buttonsPanel);
0197:                    UICompCst.staticUIComps
0198:                            .add(UICompCst.MANUAL_TEST_PARAMS_BUTTONS_PANEL);
0199:                    break;
0200:                }
0201:                case AUTOMATIC_TEST: {
0202:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0203:                            UICompCst.AUTOMATED_TEST_PARAMS_PANEL, paramsPanel);
0204:                    UICompCst.staticUIComps
0205:                            .add(UICompCst.AUTOMATED_TEST_PARAMS_PANEL);
0206:
0207:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0208:                            UICompCst.AUTOMATED_TEST_PARAMS_TABLE,
0209:                            parametersTable);
0210:                    UICompCst.staticUIComps
0211:                            .add(UICompCst.AUTOMATED_TEST_PARAMS_TABLE);
0212:
0213:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0214:                            UICompCst.AUTOMATED_TEST_PARAMS_BUTTONS_PANEL,
0215:                            buttonsPanel);
0216:                    UICompCst.staticUIComps
0217:                            .add(UICompCst.AUTOMATED_TEST_PARAMS_BUTTONS_PANEL);
0218:                    break;
0219:                }
0220:                case PARAMETER: {
0221:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0222:                            UICompCst.DATA_PARAMS_PANEL, paramsPanel);
0223:                    UICompCst.staticUIComps.add(UICompCst.DATA_PARAMS_PANEL);
0224:
0225:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0226:                            UICompCst.DATA_PARAMS_TABLE, parametersTable);
0227:                    UICompCst.staticUIComps.add(UICompCst.DATA_PARAMS_TABLE);
0228:
0229:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0230:                            UICompCst.DATA_PARAMS_BUTTONS_PANEL, buttonsPanel);
0231:                    UICompCst.staticUIComps
0232:                            .add(UICompCst.DATA_PARAMS_BUTTONS_PANEL);
0233:                    break;
0234:                }
0235:
0236:                default: {
0237:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0238:                            UICompCst.PARAMS_PANEL, paramsPanel);
0239:                    PluginsTools.activateAssociatedPlgs(UICompCst.PARAMS_PANEL);
0240:
0241:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0242:                            UICompCst.PARAMS_TABLE, parametersTable);
0243:                    PluginsTools.activateAssociatedPlgs(UICompCst.PARAMS_TABLE);
0244:
0245:                    SalomeTMFContext.getInstance().addToUIComponentsMap(
0246:                            UICompCst.PARAMS_BUTTONS_PANEL, buttonsPanel);
0247:                    PluginsTools
0248:                            .activateAssociatedPlgs(UICompCst.PARAMS_BUTTONS_PANEL);
0249:                }
0250:                }
0251:            }
0252:
0253:            /**
0254:             *
0255:             * @param use
0256:             */
0257:            private void initData(boolean use) {
0258:                usingFonctionEnable = use;
0259:            }
0260:
0261:            /**
0262:             *
0263:             * @param use
0264:             */
0265:            public static void addNewParameter(boolean use) {
0266:                AskNewParameter askNewParameter = new AskNewParameter(null);
0267:                Parameter param = askNewParameter.getParameter();
0268:                if (param != null && param.getNameFromModel() != null
0269:                        && param.getNameFromModel() != "") {
0270:                    if (!DataModel.getCurrentProject()
0271:                            .containsParameterInModel(
0272:                                    param.getNameFromModel().trim())) {
0273:
0274:                        try {
0275:                            //param.add2DB();
0276:                            DataModel.getCurrentProject()
0277:                                    .addParameterToDBAndModel(param);
0278:                            ArrayList dataList = new ArrayList();
0279:                            dataList.add(param.getNameFromModel());
0280:                            dataList.add(param.getDescriptionFromModel());
0281:                            //ProjectData.getCurrentProject().addParameter(param);
0282:                            DataModel.getParameterTableModel().addRow(dataList);
0283:                            if (use) {
0284:                                if (Api.isConnected()) {
0285:                                    try {
0286:                                        DataModel.getCurrentTest()
0287:                                                .setUseParamInDBAndModel(param);
0288:
0289:                                        DataModel.getTestParameterTableModel()
0290:                                                .addRow(dataList);
0291:                                    } catch (Exception exception) {
0292:                                        Tools.ihmExceptionView(exception);
0293:                                    }
0294:                                }
0295:
0296:                            }
0297:
0298:                        } catch (Exception exception) {
0299:                            Tools.ihmExceptionView(exception);
0300:                        }
0301:
0302:                    } else {
0303:                        JOptionPane.showMessageDialog(null, Language
0304:                                .getInstance().getText(
0305:                                        "Ce_nom_de_paramètre_existe_déjà_!"),
0306:                                Language.getInstance().getText("Erreur_!"),
0307:                                JOptionPane.ERROR_MESSAGE);
0308:                    }
0309:                }
0310:            }
0311:
0312:            /**
0313:             *
0314:             *
0315:             */
0316:            public static void usingParameter() {
0317:                UsingDefinedParameterView usingDefinedParameterView = new UsingDefinedParameterView(
0318:                        false, false);
0319:                if (usingDefinedParameterView.getParameterList() != null) {
0320:                    for (int i = 0; i < usingDefinedParameterView
0321:                            .getParameterList().size(); i++) {
0322:                        Parameter param = (Parameter) usingDefinedParameterView
0323:                                .getParameterList().get(i);
0324:                        if (!DataModel.getCurrentTest()
0325:                                .hasUsedParameterNameFromModel(
0326:                                        param.getNameFromModel())) {
0327:
0328:                            try {
0329:                                DataModel.getCurrentTest()
0330:                                        .setUseParamInDBAndModel(param);
0331:                                ArrayList dataList = new ArrayList();
0332:                                dataList.add(param.getNameFromModel());
0333:                                dataList.add(param.getDescriptionFromModel());
0334:                                DataModel.getTestParameterTableModel().addRow(
0335:                                        dataList);
0336:                                //DataModel.getCurrentTest().addParameter(param);
0337:                            } catch (Exception exception) {
0338:                                Tools.ihmExceptionView(exception);
0339:                            }
0340:
0341:                        } else {
0342:                            JOptionPane.showMessageDialog(null, Language
0343:                                    .getInstance().getText("Le_paramètre_")
0344:                                    + param.getNameFromModel()
0345:                                    + Language.getInstance().getText(
0346:                                            "_existe_déjà_pour_ce_test_!"),
0347:                                    Language.getInstance().getText("Erreur_!"),
0348:                                    JOptionPane.ERROR_MESSAGE);
0349:                        }
0350:                    }
0351:                }
0352:            }
0353:
0354:            /**
0355:             *
0356:             * @param currentTest
0357:             * @param paramName
0358:             */
0359:            /*private static void cleanActionOfParameter(Test currentTest, String paramName) {
0360:                if (currentTest instanceof ManualTest) {
0361:                    for (int i = 0; i < ((ManualTest)currentTest).getActionList().size(); i++) {
0362:                        
0363:                        //Action action = (Action)((ManualTest)DataModel.getCurrentTest()).getActionList().get(i);
0364:                    	Action action = (Action)((ManualTest)currentTest).getActionList().get(i);
0365:                        
0366:                        try {
0367:                        	String newDesc = Tools.clearStringOfParameter(action.getDescription(), paramName);
0368:                            String newResult = Tools.clearStringOfParameter(action.getAwaitedResult(), paramName);
0369:                            
0370:                        	// DB
0371:                        	action.updateInDB(action.getName(), newDesc, newResult, action.getOrderIndex());
0372:                            
0373:                            // Data
0374:                        	
0375:                            action.getParameterHashSet().remove(DataModel.getCurrentProject().getParameter(paramName));
0376:                            
0377:                            if (DataModel.getCurrentTest() != null) {
0378:            	                if (DataModel.getCurrentTest().equals(currentTest)) {
0379:            	                    int row = DataModel.getActionTableModel().findRow(action.getName());
0380:            	                    DataModel.getActionTableModel().setValueAt(newDesc, row, 1);
0381:            	                    DataModel.getActionTableModel().setValueAt(newResult, row, 2);
0382:            	                }
0383:                            }
0384:                        } catch (Exception exception) {
0385:                            Tools.ihmExceptionView(exception.toString());
0386:                        }
0387:                    }
0388:                }
0389:            } // Fin de la m?thode cleanActionOfParameter/2
0390:             */
0391:
0392:            private static void upadateActionOfParameterView(Test currentTest,
0393:                    String paramName) {
0394:                if (currentTest instanceof  ManualTest) {
0395:                    ArrayList actionList = ((ManualTest) currentTest)
0396:                            .getActionListFromModel(false);
0397:                    for (int i = 0; i < actionList.size(); i++) {
0398:                        Action action = (Action) actionList.get(i);
0399:                        try {
0400:                            if (DataModel.getCurrentTest() != null
0401:                                    && DataModel.getCurrentTest().equals(
0402:                                            currentTest)) {
0403:                                int row = DataModel.getActionTableModel()
0404:                                        .findRow(action.getNameFromModel());
0405:                                DataModel.getActionTableModel().setValueAt(
0406:                                        action.getDescriptionFromModel(), row,
0407:                                        1);
0408:                                DataModel.getActionTableModel().setValueAt(
0409:                                        action.getAwaitedResultFromModel(),
0410:                                        row, 2);
0411:                            }
0412:                        } catch (Exception exception) {
0413:                            Tools.ihmExceptionView(exception);
0414:                        }
0415:                    }
0416:                }
0417:            } // Fin de la m?thode cleanActionOfParameter/2
0418:
0419:            /**
0420:             *
0421:             *
0422:             */
0423:            public void giveAccessToIhmParameterView() {
0424:                if (usingFonctionEnable) {
0425:                    if (!Permission.canDeleteTest()) {
0426:                        deleteParameterButton.setEnabled(false);
0427:
0428:                    }
0429:                    if (!Permission.canCreateTest()) {
0430:                        addParameter.setEnabled(false);
0431:                        useParameterButton.setEnabled(false);
0432:
0433:                    }
0434:                    if (!Permission.canUpdateTest()) {
0435:                        modifyParameterButton.setEnabled(false);
0436:
0437:                    }
0438:
0439:                } else {
0440:                    if (!Permission.canDeleteCamp()) {
0441:                        deleteParameterButton.setEnabled(false);
0442:                    }
0443:                    if (!Permission.canCreateCamp()
0444:                            && !Permission.canExecutCamp()) {
0445:                        addParameter.setEnabled(false);
0446:                        useParameterButton.setEnabled(false);
0447:                    }
0448:                    if (!Permission.canUpdateCamp()
0449:                            && !Permission.canExecutCamp()) {
0450:                        modifyParameterButton.setEnabled(false);
0451:                    }
0452:                }
0453:
0454:            }
0455:
0456:            /***************** Event Managment ************************/
0457:            public void actionPerformed(ActionEvent e) {
0458:                if (e.getSource().equals(addParameter)) {
0459:                    addParameterPerformed();
0460:                } else if (e.getSource().equals(useParameterButton)) {
0461:                    useParameterButtonPerformed();
0462:                } else if (e.getSource().equals(modifyParameterButton)) {
0463:                    modifyParameterButtonPerformed();
0464:                } else if (e.getSource().equals(deleteParameterButton)) {
0465:                    deleteParameterButtonPerformed();
0466:                } else if (e.getSource().equals(refreshButton)) {
0467:                    refreshPerformed();
0468:                }
0469:            }
0470:
0471:            void refreshPerformed() {
0472:                try {
0473:                    DataModel.reloadParameters();
0474:                    DataModel.reloadEnvironnements();
0475:                } catch (Exception e) {
0476:                    // TODO: handle exception
0477:                }
0478:            }
0479:
0480:            public void valueChanged(ListSelectionEvent e) {
0481:                if (e.getSource().equals(parametersTable.getSelectionModel())) {
0482:                    parametersTablevalueChanged(e);
0483:                }
0484:            }
0485:
0486:            public void addParameterPerformed() {
0487:                /*String message = DataModel.getCurrentProject().getCampaignWithExecResultWhereTestIsUse(DataModel.getCurrentTest());
0488:                if (!message.equals("") && usingFonctionEnable && (Api.isLockExecutedTest())) {
0489:                	JOptionPane.showMessageDialog(ParameterView.this,
0490:                			Language.getInstance().getText("Ce_test_est_utilisé_dans_les_campagnes_:_\n") + message + Language.getInstance().getText("qui_possèdent_des_résultats_d'exécutions.\nAfin_de_conserver_l'intégrité_des_résultats,_vous_ne_pouvez_pas_ajouter_un_nouveau_paramètre."),
0491:                			Language.getInstance().getText("Erreur_!"),
0492:                			JOptionPane.ERROR_MESSAGE);
0493:                } else {
0494:                	if ((!message.equals(""))&& (!Api.isLockExecutedTest())) { 
0495:                		Object[] options = {Language.getInstance().getText("Oui"), Language.getInstance().getText("Non")};
0496:                		int choice = SalomeTMFContext.getInstance().askQuestion(
0497:                				Language.getInstance().getText("Ce_test_est_utilisé_dans_les_campagnes_:_\n") + message +  Language.getInstance().getText("IntegiteCheck"),
0498:                				Language.getInstance().getText("Attention_!"),
0499:                				JOptionPane.WARNING_MESSAGE,
0500:                				options);
0501:                		if (choice == JOptionPane.NO_OPTION) {
0502:                			return;
0503:                		}
0504:                	}
0505:                	addNewParameter(usingFonctionEnable);
0506:                }*/
0507:                addNewParameter(usingFonctionEnable);
0508:            }
0509:
0510:            public void useParameterButtonPerformed() {
0511:                String message = DataModel.getCurrentProject()
0512:                        .getCampaignWithExecResultWhereTestIsUse(
0513:                                DataModel.getCurrentTest());
0514:                if (!message.equals("") && usingFonctionEnable
0515:                        && (Api.isLockExecutedTest())) {
0516:                    JOptionPane
0517:                            .showMessageDialog(
0518:                                    ParameterView.this ,
0519:                                    Language
0520:                                            .getInstance()
0521:                                            .getText(
0522:                                                    "Ce_test_est_utilisé_dans_les_campagnes_:_\n")
0523:                                            + message
0524:                                            + Language
0525:                                                    .getInstance()
0526:                                                    .getText(
0527:                                                            "qui_possèdent_des_résultats_d'exécutions.\nAfin_de_conserver_l'intégrité_des_résultats,_vous_ne_pouvez_pas_ajouter_un_paramètre_déjà_défini."),
0528:                                    Language.getInstance().getText("Erreur_!"),
0529:                                    JOptionPane.ERROR_MESSAGE);
0530:                } else {
0531:                    if ((!message.equals("")) && (!Api.isLockExecutedTest())) {
0532:                        Object[] options = {
0533:                                Language.getInstance().getText("Oui"),
0534:                                Language.getInstance().getText("Non") };
0535:                        int choice = SalomeTMFContext
0536:                                .getInstance()
0537:                                .askQuestion(
0538:                                        Language
0539:                                                .getInstance()
0540:                                                .getText(
0541:                                                        "Ce_test_est_utilisé_dans_les_campagnes_:_\n")
0542:                                                + message
0543:                                                + Language
0544:                                                        .getInstance()
0545:                                                        .getText(
0546:                                                                "IntegiteCheck"),
0547:                                        Language.getInstance().getText(
0548:                                                "Attention_!"),
0549:                                        JOptionPane.WARNING_MESSAGE, options);
0550:                        if (choice == JOptionPane.NO_OPTION) {
0551:                            return;
0552:                        }
0553:                    }
0554:                    usingParameter();
0555:                }
0556:            }
0557:
0558:            public void modifyParameterButtonPerformed() {
0559:                int selectedRowIndex = parametersTable.getSelectedRow();
0560:                if (selectedRowIndex != -1) {
0561:                    String message = DataModel.getCurrentProject()
0562:                            .getCampaignWithExecResultWhereTestIsUse(
0563:                                    DataModel.getCurrentTest());
0564:                    if (!message.equals("") && usingFonctionEnable
0565:                            && (Api.isLockExecutedTest())) {
0566:                        JOptionPane
0567:                                .showMessageDialog(
0568:                                        ParameterView.this ,
0569:                                        Language
0570:                                                .getInstance()
0571:                                                .getText(
0572:                                                        "Ce_test_est_utilisé_dans_les_campagnes_:_\n")
0573:                                                + message
0574:                                                + Language
0575:                                                        .getInstance()
0576:                                                        .getText(
0577:                                                                "qui_possèdent_des_résultats_d'exécutions.\nAfin_de_conserver_l'intégrité_des_résultats,_vous_ne_pouvez_pas_modifier_ce_paramètre."),
0578:                                        Language.getInstance().getText(
0579:                                                "Erreur_!"),
0580:                                        JOptionPane.ERROR_MESSAGE);
0581:                    } else {
0582:                        if ((!message.equals(""))
0583:                                && (!Api.isLockExecutedTest())) {
0584:                            Object[] options = {
0585:                                    Language.getInstance().getText("Oui"),
0586:                                    Language.getInstance().getText("Non") };
0587:                            int choice = SalomeTMFContext
0588:                                    .getInstance()
0589:                                    .askQuestion(
0590:                                            Language
0591:                                                    .getInstance()
0592:                                                    .getText(
0593:                                                            "Ce_test_est_utilisé_dans_les_campagnes_:_\n")
0594:                                                    + message
0595:                                                    + Language
0596:                                                            .getInstance()
0597:                                                            .getText(
0598:                                                                    "IntegiteCheck"),
0599:                                            Language.getInstance().getText(
0600:                                                    "Attention_!"),
0601:                                            JOptionPane.WARNING_MESSAGE,
0602:                                            options);
0603:                            if (choice == JOptionPane.NO_OPTION) {
0604:                                return;
0605:                            }
0606:                        }
0607:                        ArrayList paramList;
0608:                        if (usingFonctionEnable) {
0609:                            //paramList = DataModel.getTestParameterTableModel().getData(selectedRowIndex);
0610:                            paramList = DataModel
0611:                                    .getTestParameterTableModel()
0612:                                    .getData(
0613:                                            sorter.modelIndex(selectedRowIndex));
0614:
0615:                        } else {
0616:                            //paramList = DataModel.getParameterTableModel().getData(selectedRowIndex);
0617:                            paramList = DataModel
0618:                                    .getParameterTableModel()
0619:                                    .getData(
0620:                                            sorter.modelIndex(selectedRowIndex));
0621:                        }
0622:                        AskNameAndDescription askNewParameter = null;
0623:                        if (paramList != null
0624:                                && paramList.size() == parametersTable
0625:                                        .getColumnCount()) {
0626:                            askNewParameter = new AskNameAndDescription(
0627:                                    PARAMETER, Language.getInstance().getText(
0628:                                            "Modifier_un_paramètre"), Language
0629:                                            .getInstance().getText(
0630:                                                    "Nom_du_paramètre_:_"),
0631:                                    DataModel.getCurrentProject()
0632:                                            .getParameterFromModel(
0633:                                                    (String) paramList.get(0)),
0634:                                    SalomeTMFContext.getInstance().ptrFrame,
0635:                                    null);
0636:                        }
0637:                        if (askNewParameter != null) {
0638:                            Parameter param = askNewParameter.getNewParameter();
0639:                            if (param != null) {
0640:
0641:                                try {
0642:                                    // BdD
0643:                                    param.updateDescriptionInDBAndModel(param
0644:                                            .getDescriptionFromModel());
0645:
0646:                                    // IHM
0647:                                    ArrayList dataList = new ArrayList();
0648:                                    dataList.add(param.getNameFromModel());
0649:                                    dataList.add(param
0650:                                            .getDescriptionFromModel());
0651:                                    if (usingFonctionEnable) {
0652:                                        DataModel
0653:                                                .getTestParameterTableModel()
0654:                                                .modifyData(
0655:                                                        dataList,
0656:                                                        sorter
0657:                                                                .modelIndex(selectedRowIndex));
0658:                                        Parameter oldParam = ((ManualTest) DataModel
0659:                                                .getCurrentTest())
0660:                                                .getUsedParameterFromModel((String) paramList
0661:                                                        .get(0));
0662:                                        oldParam.updateNameInModel(param
0663:                                                .getNameFromModel());
0664:                                        oldParam.updateDescriptionInModel(param
0665:                                                .getDescriptionFromModel());
0666:                                    } else {
0667:                                        DataModel
0668:                                                .getParameterTableModel()
0669:                                                .modifyData(
0670:                                                        dataList,
0671:                                                        sorter
0672:                                                                .modelIndex(selectedRowIndex));
0673:                                    }
0674:                                } catch (Exception exception) {
0675:                                    Tools.ihmExceptionView(exception);
0676:                                }
0677:                            }
0678:                        }
0679:                    }
0680:                }
0681:            }
0682:
0683:            public void deleteParameterButtonPerformed() {
0684:                //int selectedRowIndex = parametersTable.getSelectedRow();
0685:                int[] selectedRows = parametersTable.getSelectedRows();
0686:                String paramName;
0687:                if (usingFonctionEnable) {
0688:                    Object[] options = { Language.getInstance().getText("Oui"),
0689:                            Language.getInstance().getText("Non") };
0690:                    int choice = -1;
0691:                    choice = JOptionPane
0692:                            .showOptionDialog(
0693:                                    ParameterView.this ,
0694:                                    Language
0695:                                            .getInstance()
0696:                                            .getText(
0697:                                                    "Etes_vous_sûr_de_vouloir_supprimer_les_paramètre_du_test_<")
0698:                                            + DataModel.getCurrentTest()
0699:                                            + "> ?", Language.getInstance()
0700:                                            .getText("Attention_!"),
0701:                                    JOptionPane.YES_NO_OPTION,
0702:                                    JOptionPane.QUESTION_MESSAGE, null,
0703:                                    options, options[1]);
0704:                    if (choice == JOptionPane.YES_OPTION) {
0705:
0706:                        String message = DataModel.getCurrentProject()
0707:                                .getCampaignWithExecResultWhereTestIsUse(
0708:                                        DataModel.getCurrentTest());
0709:                        if (!message.equals("") && usingFonctionEnable
0710:                                && (Api.isLockExecutedTest())) {
0711:                            JOptionPane
0712:                                    .showMessageDialog(
0713:                                            ParameterView.this ,
0714:                                            Language
0715:                                                    .getInstance()
0716:                                                    .getText(
0717:                                                            "Ce_test_est_utilisé_dans_les_campagnes_:_\n")
0718:                                                    + message
0719:                                                    + Language
0720:                                                            .getInstance()
0721:                                                            .getText(
0722:                                                                    "qui_possèdent_des_résultats_d'exécutions.\nAfin_de_conserver_l'intégrité_des_résultats,_vous_ne_pouvez_pas_supprimer_ce_paramètre."),
0723:                                            Language.getInstance().getText(
0724:                                                    "Erreur_!"),
0725:                                            JOptionPane.ERROR_MESSAGE);
0726:                        } else {
0727:                            if ((!message.equals(""))
0728:                                    && (!Api.isLockExecutedTest())) {
0729:                                choice = SalomeTMFContext
0730:                                        .getInstance()
0731:                                        .askQuestion(
0732:                                                Language
0733:                                                        .getInstance()
0734:                                                        .getText(
0735:                                                                "Ce_test_est_utilisé_dans_les_campagnes_:_\n")
0736:                                                        + message
0737:                                                        + Language
0738:                                                                .getInstance()
0739:                                                                .getText(
0740:                                                                        "IntegiteCheck"),
0741:                                                Language.getInstance().getText(
0742:                                                        "Attention_!"),
0743:                                                JOptionPane.WARNING_MESSAGE,
0744:                                                options);
0745:                                if (choice == JOptionPane.NO_OPTION) {
0746:                                    return;
0747:                                }
0748:                            }
0749:                            for (int selectedRowIndex = selectedRows.length - 1; selectedRowIndex >= 0; selectedRowIndex--) {
0750:                                // paramName =
0751:                                // (String)DataModel.getTestParameterTableModel().getValueAt(selectedRowIndex,
0752:                                // 0);
0753:                                paramName = (String) sorter.getValueAt(
0754:                                        selectedRows[selectedRowIndex], 0);
0755:
0756:                                try {
0757:                                    Test test = DataModel.getCurrentTest();
0758:                                    Parameter param = test
0759:                                            .getUsedParameterFromModel(paramName);
0760:
0761:                                    // BdD & Model
0762:                                    // test.deleteUseParamFromDB(param);
0763:                                    test.deleteUseParamInDBAndModel(param);
0764:                                    // DataModel.getCurrentTest().deleteParameter(paramName);
0765:                                    // IHM
0766:                                    /*DataModel.getTestParameterTableModel().removeData(
0767:                                    		sorter.modelIndex(selectedRows[selectedRowIndex]));
0768:                                    if (DataModel.getTestParameterTableModel()
0769:                                    		.getRowCount() == 0) {
0770:                                    	deleteParameterButton.setEnabled(false);
0771:                                    }
0772:                                    upadateActionOfParameterView(test, paramName);*/
0773:
0774:                                } catch (Exception exception) {
0775:                                    Tools.ihmExceptionView(exception);
0776:                                }
0777:                            }
0778:
0779:                            // IHM
0780:                            DataModel.getTestParameterTableModel().clearTable();
0781:                            Test test = DataModel.getCurrentTest();
0782:                            for (int i = 0; i < test
0783:                                    .getParameterListFromModel().size(); i++) {
0784:                                Parameter param = (Parameter) test
0785:                                        .getParameterListFromModel().get(i);
0786:                                DataModel.getTestParameterTableModel()
0787:                                        .addValueAt(param.getNameFromModel(),
0788:                                                i, 0);
0789:                                DataModel
0790:                                        .getTestParameterTableModel()
0791:                                        .addValueAt(
0792:                                                param.getDescriptionFromModel(),
0793:                                                i, 1);
0794:                                upadateActionOfParameterView(test, param
0795:                                        .getNameFromModel());
0796:                            }
0797:                            if (DataModel.getTestParameterTableModel()
0798:                                    .getRowCount() == 0) {
0799:                                deleteParameterButton.setEnabled(false);
0800:                            }
0801:                        }
0802:                    }
0803:                } else {
0804:                    Object[] options = { Language.getInstance().getText("Oui"),
0805:                            Language.getInstance().getText("Non") };
0806:                    int choice = -1;
0807:                    choice = JOptionPane
0808:                            .showOptionDialog(
0809:                                    ParameterView.this ,
0810:                                    //"Etes vous s?r de vouloir supprimer le param?tre <" +(String)DataModel.getParameterTableModel().getValueAt(selectedRowIndex, 0) + "> du projet ?",
0811:                                    Language
0812:                                            .getInstance()
0813:                                            .getText(
0814:                                                    "Etes_vous_sûr_de_vouloir_supprimer_les_paramètre"),
0815:                                    Language.getInstance().getText(
0816:                                            "Attention_!"),
0817:                                    JOptionPane.YES_NO_OPTION,
0818:                                    JOptionPane.QUESTION_MESSAGE, null,
0819:                                    options, options[1]);
0820:                    if (choice == JOptionPane.YES_OPTION) {
0821:                        for (int selectedRowIndex = selectedRows.length - 1; selectedRowIndex >= 0; selectedRowIndex--) {
0822:                            //paramName = (String)DataModel.getParameterTableModel().getValueAt(selectedRowIndex, 0);
0823:                            paramName = (String) sorter.getValueAt(
0824:                                    selectedRows[selectedRowIndex], 0);
0825:                            ArrayList testsOfParam = DataModel
0826:                                    .getCurrentProject()
0827:                                    .getTestOfParameterFromModel(paramName);
0828:                            ArrayList envOfParam = DataModel
0829:                                    .getCurrentProject()
0830:                                    .getEnvironmentOfParameterFromModel(
0831:                                            paramName);
0832:                            if (testsOfParam.size() > 0
0833:                                    || envOfParam.size() > 0) {
0834:                                choice = -1;
0835:                                //int actionCase = -1;
0836:                                String message = Language.getInstance()
0837:                                        .getText("Le_paramètre_<")
0838:                                        + paramName
0839:                                        + Language
0840:                                                .getInstance()
0841:                                                .getText(
0842:                                                        ">_est_utilisé_dans_les_tests_:\n");
0843:                                String campaignMessage = "";
0844:                                ArrayList concernedCampaign = new ArrayList();
0845:                                String testsMessage = "";
0846:                                String envMessage = "";
0847:                                //String toBeDelete = "";
0848:                                for (int i = 0; i < testsOfParam.size(); i++) {
0849:                                    testsMessage = testsMessage
0850:                                            + "* "
0851:                                            + ((Test) testsOfParam.get(i))
0852:                                                    .getTestListFromModel()
0853:                                                    .getFamilyFromModel()
0854:                                                    .getNameFromModel()
0855:                                            + "/"
0856:                                            + ((Test) testsOfParam.get(i))
0857:                                                    .getTestListFromModel()
0858:                                                    .getNameFromModel()
0859:                                            + "/"
0860:                                            + ((Test) testsOfParam.get(i))
0861:                                                    .getNameFromModel() + "\n";
0862:                                    ArrayList campaignOfTest = DataModel
0863:                                            .getCurrentProject()
0864:                                            .getCampaignOfTest(
0865:                                                    (Test) testsOfParam.get(i));
0866:                                    if (campaignOfTest.size() > 0) {
0867:                                        for (int j = 0; j < campaignOfTest
0868:                                                .size(); j++) {
0869:                                            if (!concernedCampaign
0870:                                                    .contains(campaignOfTest
0871:                                                            .get(j))) {
0872:                                                campaignMessage = campaignMessage
0873:                                                        + "* "
0874:                                                        + ((Campaign) campaignOfTest
0875:                                                                .get(j))
0876:                                                                .getNameFromModel()
0877:                                                        + "\n";
0878:                                                concernedCampaign
0879:                                                        .add(campaignOfTest
0880:                                                                .get(j));
0881:                                            }
0882:                                        }
0883:                                    }
0884:                                }
0885:                                for (int k = 0; k < envOfParam.size(); k++) {
0886:                                    if (((Environment) envOfParam.get(k))
0887:                                            .containsParameterInModel(paramName)) {
0888:                                        envMessage = envMessage
0889:                                                + "* "
0890:                                                + ((Environment) envOfParam
0891:                                                        .get(k))
0892:                                                        .getNameFromModel()
0893:                                                + "\n";
0894:                                    }
0895:                                }
0896:
0897:                                message = message
0898:                                        + testsMessage
0899:                                        + Language.getInstance().getText(
0900:                                                "dans_les_campagnes_:_\n")
0901:                                        + campaignMessage
0902:                                        + Language.getInstance().getText(
0903:                                                "dans_les_environnements_:\n")
0904:                                        + envMessage;
0905:                                message = message
0906:                                        + Language
0907:                                                .getInstance()
0908:                                                .getText(
0909:                                                        "Le_paramètre_sera_supprimé_des_tests_et_des_environnements_et_des_jeux_de_données_concernés.\nLes_résultats_d'exécutions_des_campagnes_seront_perdus.\n");
0910:                                choice = JOptionPane
0911:                                        .showOptionDialog(
0912:                                                ParameterView.this ,
0913:                                                message
0914:                                                        + Language
0915:                                                                .getInstance()
0916:                                                                .getText(
0917:                                                                        "Etes_vous_sûr_de_vouloir_supprimer_le_paramètre_<_")
0918:                                                        + paramName + " > ?",
0919:                                                Language.getInstance().getText(
0920:                                                        "Attention_!"),
0921:                                                JOptionPane.YES_NO_OPTION,
0922:                                                JOptionPane.WARNING_MESSAGE,
0923:                                                null, options, options[1]);
0924:                                if (choice == JOptionPane.YES_OPTION) {
0925:
0926:                                    try {
0927:                                        // BdD and Model
0928:                                        Parameter pParam = DataModel
0929:                                                .getCurrentProject()
0930:                                                .getParameterFromModel(
0931:                                                        paramName);
0932:                                        DataModel.getCurrentProject()
0933:                                                .deleteParamInDBndModel(pParam);
0934:
0935:                                        // IHM
0936:                                        //Suppression du param?tre des tests et action de tests (si manuel)
0937:                                        for (int j = 0; j < testsOfParam.size(); j++) {
0938:                                            Test pTest = (Test) testsOfParam
0939:                                                    .get(j);
0940:                                            // Si le test courant est trait?, on nettoie la table des param?tres
0941:                                            /*if (DataModel.getCurrentTest() != null && DataModel.getCurrentTest().equals(pTest)) {
0942:                                            		int rowIndex = DataModel.getTestParameterTableModel().findRow(paramName);
0943:                                            		if (rowIndex != -1) {
0944:                                            			DataModel.getTestParameterTableModel().removeData(sorter.modelIndex(rowIndex));
0945:                                            		}
0946:                                            }
0947:                                            
0948:                                            upadateActionOfParameterView(pTest, paramName);*/
0949:                                            //Suppression en cascade dans l'arbre des campagnes
0950:                                            for (int k = 0; k < concernedCampaign
0951:                                                    .size(); k++) {
0952:                                                Campaign campaign = (Campaign) concernedCampaign
0953:                                                        .get(k);
0954:
0955:                                                DefaultMutableTreeNode testNodeInCampaignTree = SalomeTMFPanels
0956:                                                        .getCampaignDynamicTree()
0957:                                                        .findRemoveTestNodeInCampagneTree(
0958:                                                                pTest
0959:                                                                        .getNameFromModel(),
0960:                                                                pTest
0961:                                                                        .getTestListFromModel()
0962:                                                                        .getNameFromModel(),
0963:                                                                pTest
0964:                                                                        .getTestListFromModel()
0965:                                                                        .getFamilyFromModel()
0966:                                                                        .getNameFromModel(),
0967:                                                                campaign
0968:                                                                        .getNameFromModel(),
0969:                                                                false);
0970:                                                if (testNodeInCampaignTree != null) {
0971:                                                    DefaultMutableTreeNode testListParent = (DefaultMutableTreeNode) testNodeInCampaignTree
0972:                                                            .getParent();
0973:                                                    SalomeTMFPanels
0974:                                                            .getCampaignDynamicTree()
0975:                                                            .removeNode(
0976:                                                                    testNodeInCampaignTree);
0977:                                                    if (testListParent
0978:                                                            .getChildCount() == 0) {
0979:                                                        DefaultMutableTreeNode familyParent = (DefaultMutableTreeNode) testListParent
0980:                                                                .getParent();
0981:                                                        SalomeTMFPanels
0982:                                                                .getCampaignDynamicTree()
0983:                                                                .removeNode(
0984:                                                                        testListParent);
0985:                                                        //DataModel.deleteTestListFromCampaign((TestList)testListParent.getUserObject(),campaign);
0986:                                                        if (familyParent
0987:                                                                .getChildCount() == 0) {
0988:                                                            SalomeTMFPanels
0989:                                                                    .getCampaignDynamicTree()
0990:                                                                    .removeNode(
0991:                                                                            familyParent);
0992:                                                            //DataModel.deleteFamilyFromCampaign((Family)familyParent.getUserObject(), campaign);
0993:                                                        }
0994:                                                    }
0995:                                                }
0996:                                                //Si la campagne traitée est la campagne courant, nettoyage de la table des r?sultats d'ex?cutions
0997:                                                if (DataModel
0998:                                                        .getCurrentCampaign() != null
0999:                                                        && DataModel
1000:                                                                .getCurrentCampaign()
1001:                                                                .equals(
1002:                                                                        campaign)) {
1003:                                                    DataModel
1004:                                                            .getExecutionResultTableModel()
1005:                                                            .clearTable();
1006:                                                }
1007:                                            }
1008:                                        }
1009:                                        //DataModel.getParameterTableModel().removeData(selectedRowIndex);
1010:                                        //DataModel.getParameterTableModel().removeData(sorter.modelIndex(selectedRows[selectedRowIndex]));
1011:
1012:                                    } catch (Exception exception) {
1013:                                        Tools.ihmExceptionView(exception);
1014:                                    }
1015:                                }
1016:
1017:                            } else {
1018:
1019:                                try {
1020:                                    // BdD
1021:                                    Parameter pParam = DataModel
1022:                                            .getCurrentProject()
1023:                                            .getParameterFromModel(paramName);
1024:                                    DataModel.getCurrentProject()
1025:                                            .deleteParamInDBndModel(pParam);
1026:                                    //DataModel.getCurrentProject().getParameter(paramName).deleteFromDB();
1027:
1028:                                    // IHM
1029:                                    //DataModel.getParameterTableModel().removeData(sorter.modelIndex(selectedRows[selectedRowIndex]));
1030:                                    //DataModel.getCurrentProject().removeParameter(paramName);
1031:
1032:                                } catch (Exception exception) {
1033:                                    Tools.ihmExceptionView(exception);
1034:                                }
1035:                            }
1036:                        }
1037:
1038:                        //IHM
1039:                        try {
1040:                            DataModel.getParameterTableModel().clearTable();
1041:                            Vector projectParam = DataModel.getCurrentProject()
1042:                                    .getParametersWrapperFromDB();
1043:                            for (int m = 0; m < projectParam.size(); m++) {
1044:                                ParameterWrapper paramBdd = (ParameterWrapper) projectParam
1045:                                        .get(m);
1046:                                Parameter param = new Parameter(paramBdd);
1047:                                ArrayList data = new ArrayList();
1048:                                data.add(param.getNameFromModel());
1049:                                data.add(param.getDescriptionFromModel());
1050:                                DataModel.getParameterTableModel().addRow(data);
1051:
1052:                                DataModel.getTestParameterTableModel()
1053:                                        .clearTable();
1054:                                Test test = DataModel.getCurrentTest();
1055:                                if (test != null) {
1056:                                    ArrayList testParameterList = test
1057:                                            .getParameterListFromModel();
1058:                                    for (int i = 0; i < testParameterList
1059:                                            .size(); i++) {
1060:                                        Parameter paramTest = (Parameter) test
1061:                                                .getParameterListFromModel()
1062:                                                .get(i);
1063:                                        DataModel
1064:                                                .getTestParameterTableModel()
1065:                                                .addValueAt(
1066:                                                        paramTest
1067:                                                                .getNameFromModel(),
1068:                                                        i, 0);
1069:                                        DataModel
1070:                                                .getTestParameterTableModel()
1071:                                                .addValueAt(
1072:                                                        paramTest
1073:                                                                .getDescriptionFromModel(),
1074:                                                        i, 1);
1075:                                        upadateActionOfParameterView(test,
1076:                                                paramTest.getNameFromModel());
1077:                                    }
1078:                                }
1079:                                if (DataModel.getTestParameterTableModel()
1080:                                        .getRowCount() == 0) {
1081:                                    deleteParameterButton.setEnabled(false);
1082:                                }
1083:
1084:                            }
1085:                        } catch (Exception e) {
1086:                            Tools.ihmExceptionView(e);
1087:                        }
1088:                    }
1089:                }
1090:            }
1091:
1092:            public void parametersTablevalueChanged(ListSelectionEvent e) {
1093:
1094:                if (e.getValueIsAdjusting())
1095:                    return;
1096:
1097:                int nbOfSelectedRows = parametersTable.getSelectedRowCount();
1098:                int selectedRow = parametersTable.getSelectedRow();
1099:                if (selectedRow != -1) {
1100:                    if (nbOfSelectedRows != 1) {
1101:                        if (usingFonctionEnable) {
1102:                            if (Permission.canDeleteTest())
1103:                                deleteParameterButton.setEnabled(true);
1104:                        } else {
1105:                            if (Permission.canDeleteCamp())
1106:                                deleteParameterButton.setEnabled(true);
1107:                        }
1108:                        modifyParameterButton.setEnabled(false);
1109:
1110:                    } else {
1111:                        if (usingFonctionEnable) {
1112:                            if (Permission.canUpdateTest())
1113:                                modifyParameterButton.setEnabled(true);
1114:                            if (Permission.canDeleteTest())
1115:                                deleteParameterButton.setEnabled(true);
1116:                        } else {
1117:                            if (Permission.canUpdateCamp()
1118:                                    || Permission.canExecutCamp())
1119:                                modifyParameterButton.setEnabled(true);
1120:                            if (Permission.canDeleteCamp())
1121:                                deleteParameterButton.setEnabled(true);
1122:                        }
1123:                    }
1124:                } else {
1125:                    deleteParameterButton.setEnabled(false);
1126:                    modifyParameterButton.setEnabled(false);
1127:                }
1128:
1129:            }
1130:
1131:        } // Fin de la classe ManualParameterView
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.