Source Code Cross Referenced for TestPanel.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) 


001:        package org.objectweb.salome_tmf.ihm.main;
002:
003:        import java.awt.BorderLayout;
004:        import java.awt.Cursor;
005:        import java.awt.Dimension;
006:        import java.awt.FlowLayout;
007:        import java.awt.Font;
008:        import java.awt.GridLayout;
009:        import java.awt.event.ActionEvent;
010:        import java.awt.event.ActionListener;
011:
012:        import javax.swing.BorderFactory;
013:        import javax.swing.Box;
014:        import javax.swing.BoxLayout;
015:        import javax.swing.JButton;
016:        import javax.swing.JLabel;
017:        import javax.swing.JMenu;
018:        import javax.swing.JMenuBar;
019:        import javax.swing.JMenuItem;
020:        import javax.swing.JPanel;
021:        import javax.swing.JScrollPane;
022:        import javax.swing.JSplitPane;
023:        import javax.swing.JTabbedPane;
024:
025:        import org.objectweb.salome_tmf.api.Api;
026:        import org.objectweb.salome_tmf.api.Permission;
027:        import org.objectweb.salome_tmf.data.DataConstants;
028:        import org.objectweb.salome_tmf.data.Test;
029:        import org.objectweb.salome_tmf.ihm.filtre.TestTreeFiltrePanel;
030:        import org.objectweb.salome_tmf.ihm.languages.Language;
031:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
032:        import org.objectweb.salome_tmf.ihm.main.htmleditor.EkitCore;
033:        import org.objectweb.salome_tmf.ihm.models.DynamicTree;
034:        import org.objectweb.salome_tmf.ihm.tools.Tools;
035:        import org.objectweb.salome_tmf.plugins.UICompCst;
036:
037:        public class TestPanel extends JPanel implements  ActionListener {
038:            JPanel workSpaceTest;
039:            JPanel testTopPanel;
040:
041:            JLabel projetName;
042:            JLabel automaticTestNameLabel;
043:            JLabel automaticTestDateLabel;
044:            JLabel automaticTestConceptorLabel;
045:            JLabel automaticTestExecutedLabel;
046:            JLabel manualTestConceptorLabel;
047:            JLabel manualTestNameLabel;
048:            JLabel manualTestDateLabel;
049:            JLabel manualTestExecutedLabel;
050:
051:            JTabbedPane listWorkSpace;
052:            JTabbedPane familyWorkSpace;
053:            JTabbedPane automaticTest;
054:            JTabbedPane manualTest;
055:
056:            DynamicTree testDynamicTree;
057:            TestTreeFiltrePanel pTestTreeFiltrePanel;
058:
059:            //changeListenerPanel testMultiUserChangeListenerPanel;
060:            ParameterView automaticTestParameterView;
061:            ParameterView testParameterView;
062:
063:            JButton addList;
064:            JButton addTest;
065:            JButton addFamily;
066:            JButton orderTest;
067:            JButton delTestOrTestList;
068:            JButton renameTestButton;
069:            JButton automaticButtonCampaignDetails;
070:            JButton manualButtonCampaignDetails;
071:
072:            JMenu testToolsMenu;
073:
074:            //JTextPane familyDescription;
075:            EkitCore pfamilyDescription;
076:            EkitCore pTestListDescription;
077:            EkitCore pAutomaticDetailsDescription;
078:            EkitCore pManualDetailsDescription;
079:            //JTextPane testListDescription;
080:            //JTextPane automaticDetailsDescription;
081:            //JTextPane manualDetailsDescription;
082:
083:            AttachmentView automaticTestAttachmentView;
084:            AttachmentView manualTestAttachmentView;
085:            AttachmentView testListAttachmentView;
086:            AttachmentView familyAttachmentView;
087:
088:            BaseIHM pBaseIHM;
089:
090:            SalomeTMFContext pSalomeTMFContext;
091:            int t_x = 1024;
092:            int t_y = 768;
093:            JTabbedPane tabs;
094:
095:            public TestPanel(SalomeTMFContext m_SalomeTMFContext,
096:                    BaseIHM m_BaseIHM, JTabbedPane m_tabs, int x, int y) {
097:                super (new BorderLayout());
098:                pSalomeTMFContext = m_SalomeTMFContext;
099:                pBaseIHM = m_BaseIHM;
100:                tabs = m_tabs;
101:                t_x = x;
102:                t_y = y;
103:            }
104:
105:            public void initCoponent() {
106:                familyWorkSpace = new JTabbedPane();
107:                listWorkSpace = new JTabbedPane();
108:                workSpaceTest = new JPanel();
109:
110:                projetName = new JLabel();
111:                projetName.setFont(new Font(null, Font.BOLD, 18));
112:                JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
113:                namePanel.add(projetName);
114:
115:                /*
116:                 * testMultiUserChangeListenerPanel = new changeListenerPanel();
117:                testMultiUserChangeListenerPanel.setPreferredSize(new Dimension(70,25));
118:                JPanel testMultiUserPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
119:                testMultiUserPanel.add(testMultiUserChangeListenerPanel);
120:                 */
121:                testTopPanel = new JPanel(new BorderLayout());
122:                testTopPanel.add(namePanel, BorderLayout.WEST);
123:                //testTopPanel.add(testMultiUserPanel, BorderLayout.EAST);
124:
125:                testToolsMenu = new JMenu(Language.getInstance().getText(
126:                        "Outils"));
127:                pSalomeTMFContext.UIComponentsMap.put(
128:                        UICompCst.TEST_TOOLS_MENU, testToolsMenu);
129:
130:                add(testTopPanel, BorderLayout.NORTH);
131:                createTestsPlane();
132:            }
133:
134:            /************************************************************************************************************/
135:
136:            /**
137:             * Méthode qui crée la vue sur les tests
138:             */
139:            private void createTestsPlane() {
140:
141:                addList = new JButton(Language.getInstance().getText(
142:                        "Ajouter_une_suite"));
143:                addList.setToolTipText(Language.getInstance().getText(
144:                        "Ajouter_une_suite_de_tests"));
145:
146:                addList.addActionListener(this );
147:
148:                addFamily = new JButton(Language.getInstance().getText(
149:                        "Ajouter_une_famille"));
150:                addFamily.setToolTipText(Language.getInstance().getText(
151:                        "Ajouter_une_famille"));
152:
153:                addFamily.addActionListener(this );
154:
155:                addTest = new JButton(Language.getInstance().getText(
156:                        "Ajouter_un_test"));
157:                addTest.setToolTipText(Language.getInstance().getText(
158:                        "Ajouter_un_test"));
159:
160:                addTest.addActionListener(this );
161:
162:                JPanel listPanel = new JPanel(new GridLayout(1, 3));
163:                listPanel.add(addFamily);
164:                listPanel.add(addList);
165:                listPanel.add(addTest);
166:                listPanel.setBorder(BorderFactory.createRaisedBevelBorder());
167:
168:                orderTest = new JButton(Language.getInstance().getText(
169:                        "Ordonner"));
170:                orderTest.setToolTipText(Language.getInstance().getText(
171:                        "Ordonner_l'arbre_des_suites_de_tests"));
172:                orderTest.addActionListener(new ActionListener() {
173:                    public void actionPerformed(ActionEvent e) {
174:                        new TestOrdering(testDynamicTree, false);
175:                    }
176:                });
177:
178:                delTestOrTestList = new JButton(Language.getInstance().getText(
179:                        "Supprimer"));
180:                delTestOrTestList.setToolTipText(Language.getInstance()
181:                        .getText("Supprimer"));
182:                delTestOrTestList.setEnabled(false);
183:                delTestOrTestList.addActionListener(new ActionListener() {
184:                    public void actionPerformed(ActionEvent e) {
185:                        try {
186:                            DataModel.deleteInTestTree();
187:                        } catch (Exception ex) {
188:                            ex.printStackTrace();
189:                            Tools.ihmExceptionView(ex);
190:                        }
191:                    }
192:                });
193:
194:                //JMenuItem refreshItem = new JMenuItem(Language.getInstance().getText("Rafraichir"));
195:                JMenu refreshItem = new JMenu(Language.getInstance().getText(
196:                        "Rafraichir"));
197:
198:                /*refreshItem.addActionListener(new ActionListener() {
199:                	public void actionPerformed(ActionEvent e) {
200:                		//TestMethods.refreshTestTree();
201:                		tabs.setCursor(new Cursor(Cursor.WAIT_CURSOR));
202:                		workSpaceTest.removeAll();
203:                		DataModel.reloadFromBase(true);
204:                		tabs.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
205:                	}
206:                });*/
207:
208:                JMenuItem refreshItemAll = new JMenuItem(Language.getInstance()
209:                        .getText("Tout"));
210:                refreshItemAll.addActionListener(new ActionListener() {
211:                    public void actionPerformed(ActionEvent e) {
212:                        //TestMethods.refreshTestTree();
213:                        tabs.setCursor(new Cursor(Cursor.WAIT_CURSOR));
214:                        workSpaceTest.removeAll();
215:                        DataModel.reloadFromBase(true);
216:                        tabs.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
217:                    }
218:                });
219:
220:                JMenuItem refreshItemTest = new JMenuItem(Language
221:                        .getInstance().getText("Plan_de_tests"));
222:                refreshItemTest.addActionListener(new ActionListener() {
223:                    public void actionPerformed(ActionEvent e) {
224:                        //TestMethods.refreshTestTree();
225:                        tabs.setCursor(new Cursor(Cursor.WAIT_CURSOR));
226:                        workSpaceTest.removeAll();
227:                        try {
228:                            DataModel.reloadTestPlan();
229:                        } catch (Exception ex) {
230:                            ex.printStackTrace();
231:                            DataModel.reloadFromBase(true);
232:                        }
233:                        tabs.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
234:                    }
235:                });
236:
237:                refreshItem.add(refreshItemAll);
238:                refreshItem.add(refreshItemTest);
239:
240:                testToolsMenu.add(refreshItem);
241:
242:                JMenuItem changePwdItem = new JMenuItem(Language.getInstance()
243:                        .getText("Changer_le_mot_de_passe"));
244:                changePwdItem.addActionListener(new ActionListener() {
245:                    public void actionPerformed(ActionEvent e) {
246:                        new ChangePwdWindow(pSalomeTMFContext.ptrFrame).show();
247:                    }
248:                });
249:
250:                testToolsMenu.add(changePwdItem);
251:
252:                JMenuBar refreshMenuBar = new JMenuBar();
253:                refreshMenuBar.add(testToolsMenu);
254:
255:                renameTestButton = new JButton(Language.getInstance().getText(
256:                        "Renommer"));
257:                renameTestButton.setEnabled(false);
258:                renameTestButton.addActionListener(new ActionListener() {
259:                    public void actionPerformed(ActionEvent e) {
260:                        DataModel.renameTest();
261:                    }
262:                });
263:
264:                JPanel testPanel = new JPanel(new GridLayout(1, 3));
265:                testPanel.add(orderTest);
266:                testPanel.add(renameTestButton);
267:                testPanel.add(delTestOrTestList);
268:                testPanel.add(refreshMenuBar);
269:                testPanel.setBorder(BorderFactory.createRaisedBevelBorder());
270:
271:                testDynamicTree = new DynamicTree(Language.getInstance()
272:                        .getText("Plan_de_tests"), DataConstants.TESTLIST);
273:
274:                createFamily();
275:                createTestList();
276:                createAutomaticTest();
277:                createManualTest();
278:                workSpaceTest.removeAll();
279:
280:                // Construction finale
281:                JPanel allButtons = new JPanel();
282:                allButtons
283:                        .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
284:                allButtons.add(listPanel);
285:                allButtons.add(testPanel);
286:
287:                // Mapping entre composants graphiques et constantes
288:                pSalomeTMFContext.addToUIComponentsMap(
289:                        UICompCst.TEST_DYNAMIC_TREE, testDynamicTree);
290:                // Add this component as static component
291:                UICompCst.staticUIComps.add(UICompCst.TEST_DYNAMIC_TREE);
292:
293:                JPanel southPanel = new JPanel();
294:                southPanel.setLayout(new GridLayout(2, 1));
295:                pTestTreeFiltrePanel = new TestTreeFiltrePanel(testDynamicTree
296:                        .getModel());
297:                JPanel buttonPanel = new JPanel(new FlowLayout(
298:                        FlowLayout.CENTER));
299:                JButton quitTestButton = new JButton(Language.getInstance()
300:                        .getText("Quitter"));
301:                quitTestButton.addActionListener(new ActionListener() {
302:                    public void actionPerformed(ActionEvent e) {
303:                        pBaseIHM.quit(true, true);
304:                    }
305:                });
306:                buttonPanel.add(quitTestButton);
307:                southPanel.add(pTestTreeFiltrePanel);
308:                southPanel.add(buttonPanel);
309:
310:                JPanel buttonsAndTree = new JPanel(new BorderLayout());
311:                buttonsAndTree.add(allButtons, BorderLayout.NORTH);
312:                buttonsAndTree.add(testDynamicTree, BorderLayout.CENTER);
313:                //buttonsAndTree.add(quitTestButton, BorderLayout.SOUTH);
314:                buttonsAndTree.add(southPanel, BorderLayout.SOUTH);
315:                buttonsAndTree.setPreferredSize(new Dimension(t_x / 3, t_y));
316:                buttonsAndTree.setMinimumSize(new Dimension(t_x / 4, t_y));
317:
318:                workSpaceTest.setPreferredSize(new Dimension(t_x / 3 * 2, t_y));
319:                workSpaceTest.setMinimumSize(new Dimension(t_x / 3, t_y));
320:
321:                JSplitPane splitPane = new JSplitPane(
322:                        JSplitPane.HORIZONTAL_SPLIT, buttonsAndTree,
323:                        workSpaceTest);
324:                if (Api.isIDE_DEV()) {
325:                    splitPane.setDividerLocation(3);
326:                } else {
327:                    splitPane.setDividerLocation(380);
328:                }
329:                add(splitPane);
330:
331:                // Mapping entre comosants graphiques et constantes
332:                pSalomeTMFContext.addToUIComponentsMap(
333:                        UICompCst.TEST_SECOND_BUTTONS_PANEL, testPanel);
334:                // Add this component as static component
335:                UICompCst.staticUIComps
336:                        .add(UICompCst.TEST_SECOND_BUTTONS_PANEL);
337:
338:            } // Fin de la m?thode createTestsPlane/0
339:
340:            /**
341:             * Méthode qui crée la vue sur les familles
342:             */
343:            private void createFamily() {
344:
345:                workSpaceTest.removeAll();
346:                //pfamilyDescription = new PanelDescription();
347:                pfamilyDescription = new EkitCore(testDynamicTree.getTree(),
348:                        true);
349:                /*familyDescription = new JTextPane();
350:                familyDescription.addCaretListener(new TestTreeDescriptionListener());
351:                familyDescription.addFocusListener(new TestDescriptionFocusListener());
352:                
353:                JScrollPane familyDescrScrollPane = new JScrollPane(familyDescription);
354:                 */
355:
356:                // Onglets
357:                familyAttachmentView = new AttachmentView(pBaseIHM,
358:                        DataConstants.FAMILY, DataConstants.FAMILY, null,
359:                        DataConstants.NORMAL_SIZE_FOR_ATTACH, null);
360:                //familyWorkSpace.addTab(Language.getInstance().getText("Description"),	familyDescrScrollPane);
361:                familyWorkSpace.addTab(Language.getInstance().getText(
362:                        "Description"), pfamilyDescription);
363:
364:                familyWorkSpace.addTab(Language.getInstance().getText(
365:                        "Attachements"), familyAttachmentView);
366:
367:                // Mapping entre objets graphiques et constantes
368:                pSalomeTMFContext.addToUIComponentsMap(
369:                        UICompCst.FAMILY_WORKSPACE_PANEL_FOR_TABS,
370:                        familyWorkSpace);
371:                // Add this component as static component
372:                UICompCst.staticUIComps
373:                        .add(UICompCst.FAMILY_WORKSPACE_PANEL_FOR_TABS);
374:
375:                workSpaceTest.setLayout(new BorderLayout());
376:                workSpaceTest.add(familyWorkSpace, BorderLayout.CENTER);
377:            } // Fin de la m?thode createAttachments/0
378:
379:            /**
380:             * Méthode qui crée la vue sur la description et les attachements 
381:             * (utilisée pour le suites de test)
382:             *
383:             */
384:            private void createTestList() {
385:
386:                workSpaceTest.removeAll();
387:
388:                // Onglets
389:                /*testListDescription = new JTextPane();
390:                testListDescription.addCaretListener(new TestTreeDescriptionListener());
391:                testListDescription.addFocusListener(new TestDescriptionFocusListener());*/
392:                pTestListDescription = new EkitCore(testDynamicTree.getTree(),
393:                        true);
394:                testListAttachmentView = new AttachmentView(pBaseIHM,
395:                        DataConstants.TESTLIST, DataConstants.TESTLIST, null,
396:                        DataConstants.NORMAL_SIZE_FOR_ATTACH, null);
397:
398:                //JScrollPane testListDescrSrollPane = new JScrollPane(testListDescription);
399:                JScrollPane testListDescrSrollPane = new JScrollPane(
400:                        pTestListDescription);
401:                listWorkSpace.addTab(Language.getInstance().getText(
402:                        "Description"), testListDescrSrollPane);
403:                listWorkSpace.addTab(Language.getInstance().getText(
404:                        "Attachements"), testListAttachmentView);
405:
406:                // Mapping entre objets graphiques et constantes
407:                pSalomeTMFContext.addToUIComponentsMap(
408:                        UICompCst.TESTLIST_WORKSPACE_PANEL_FOR_TABS,
409:                        listWorkSpace);
410:                // Add this component as static component
411:                UICompCst.staticUIComps
412:                        .add(UICompCst.TESTLIST_WORKSPACE_PANEL_FOR_TABS);
413:
414:                workSpaceTest.setLayout(new BorderLayout());
415:                workSpaceTest.add(listWorkSpace, BorderLayout.CENTER);
416:
417:            } // Fin de la m?thode createTestList/0
418:
419:            /**
420:             * Méthode qui crée la vue pour les tests automatiques
421:             */
422:            private void createAutomaticTest() {
423:                workSpaceTest.removeAll();
424:
425:                JPanel detailsPanel = new JPanel(new BorderLayout());
426:                JPanel scriptPanel = new AutomaticTestScriptView();
427:                JPanel parametersPanel = new JPanel();
428:
429:                automaticTestAttachmentView = new AttachmentView(pBaseIHM,
430:                        DataConstants.AUTOMATIC_TEST, DataConstants.TEST, null,
431:                        DataConstants.NORMAL_SIZE_FOR_ATTACH, null);
432:                automaticTestParameterView = new ParameterView(true,
433:                        DataConstants.AUTOMATIC_TEST);
434:                automaticTestParameterView.setName(Language.getInstance()
435:                        .getText("Vue_automatique"));
436:
437:                automaticTest = new JTabbedPane();
438:                automaticTest.addTab(Language.getInstance().getText("Détails"),
439:                        detailsPanel);
440:                automaticTest.addTab(Language.getInstance().getText("Script"),
441:                        scriptPanel);
442:                //automaticTest.addTab(Language.getInstance().getText("Attachements"), attachmentPanel);
443:                automaticTest.addTab(Language.getInstance().getText(
444:                        "Attachements"), automaticTestAttachmentView);
445:                automaticTest.addTab(Language.getInstance().getText(
446:                        "Paramètres"), automaticTestParameterView);
447:
448:                createAutomaticTestDetails(detailsPanel);
449:
450:                // Mapping entre objets graphiques et constantes
451:                pSalomeTMFContext.addToUIComponentsMap(
452:                        UICompCst.AUTOMATED_TEST_WORKSPACE_PANEL_FOR_TABS,
453:                        automaticTest);
454:                // Add this component as static component
455:                UICompCst.staticUIComps
456:                        .add(UICompCst.AUTOMATED_TEST_WORKSPACE_PANEL_FOR_TABS);
457:
458:                workSpaceTest.setLayout(new BorderLayout());
459:                workSpaceTest.add(automaticTest, BorderLayout.CENTER);
460:
461:                // Mapping entre composants graphiques et constantes
462:                pSalomeTMFContext.addToUIComponentsMap(
463:                        UICompCst.AUTOMATED_TEST_SCRIPT_PANEL, scriptPanel);
464:                // Add this component as static component
465:                UICompCst.staticUIComps
466:                        .add(UICompCst.AUTOMATED_TEST_SCRIPT_PANEL);
467:
468:            } // Fin de la méthode createAutomaticTest/0
469:
470:            /**
471:             * M?thode qui cr?e l'?cran des d?tails sur un test
472:             * @param panel le panel qui contient la vue
473:             */
474:            private void createAutomaticTestDetails(JPanel panel) {
475:
476:                automaticTestNameLabel = new JLabel(Language.getInstance()
477:                        .getText("Nom_du_test")
478:                        + " : ");
479:                automaticTestDateLabel = new JLabel(Language.getInstance()
480:                        .getText("Date_de_création")
481:                        + " : ");
482:                automaticTestConceptorLabel = new JLabel(Language.getInstance()
483:                        .getText("Concepteur")
484:                        + " : ");
485:                automaticTestExecutedLabel = new JLabel(Language.getInstance()
486:                        .getText("Exécute")
487:                        + " : ");
488:                automaticButtonCampaignDetails = new JButton(Language
489:                        .getInstance().getText("Campagne"));
490:                automaticButtonCampaignDetails.addActionListener(this );
491:                JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
492:                firstLine.add(automaticTestNameLabel);
493:                firstLine.add(Box.createRigidArea(new Dimension(20, 20)));
494:                firstLine.add(automaticTestDateLabel);
495:                firstLine.add(Box.createRigidArea(new Dimension(20, 20)));
496:                firstLine.add(automaticTestExecutedLabel);
497:                firstLine.add(Box.createRigidArea(new Dimension(10, 20)));
498:                firstLine.add(automaticButtonCampaignDetails);
499:
500:                JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
501:                secondLine.add(automaticTestConceptorLabel);
502:
503:                JPanel allButtons = new JPanel();
504:                allButtons
505:                        .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
506:                allButtons.add(firstLine);
507:                allButtons.add(secondLine);
508:
509:                //allButtons.add()
510:                allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
511:                        0));
512:                /*
513:                automaticDetailsDescription = new JTextPane();
514:                automaticDetailsDescription.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Description")));
515:                automaticDetailsDescription.addCaretListener(new TestTreeDescriptionListener());
516:                automaticDetailsDescription.addFocusListener(new TestDescriptionFocusListener());
517:                 */
518:                pAutomaticDetailsDescription = new EkitCore(testDynamicTree
519:                        .getTree(), true);
520:                panel.add(allButtons, BorderLayout.NORTH);
521:                //JScrollPane automaticDetailsDescrSrollPane = new JScrollPane(automaticDetailsDescription);
522:                JScrollPane automaticDetailsDescrSrollPane = new JScrollPane(
523:                        pAutomaticDetailsDescription);
524:
525:                panel.add(automaticDetailsDescrSrollPane, BorderLayout.CENTER);
526:            } // Fin de la m?thode createAutomaticTestDetails/1
527:
528:            /**
529:             * Méthode qui crée la vue pour les tests manuels
530:             */
531:            private void createManualTest() {
532:                workSpaceTest.removeAll();
533:                // Onglets
534:
535:                JPanel detailsPanel = new JPanel(new BorderLayout());
536:                //JPanel actionsPanel = new JPanel();
537:                //JPanel attachmentPanel = new JPanel();
538:                //JPanel manualParameter = new JPanel();
539:
540:                testParameterView = new ParameterView(true,
541:                        DataConstants.PARAMETER);
542:                testParameterView.setName(Language.getInstance().getText(
543:                        "Vue_des_données"));
544:
545:                manualTestAttachmentView = new AttachmentView(pBaseIHM,
546:                        DataConstants.MANUAL_TEST, DataConstants.TEST, null,
547:                        DataConstants.NORMAL_SIZE_FOR_ATTACH, null);
548:
549:                manualTest = new JTabbedPane();
550:                manualTest.addTab(Language.getInstance().getText("Détails"),
551:                        detailsPanel);
552:                manualTest.addTab(Language.getInstance().getText("Actions"),
553:                        new ManualActionView());
554:                manualTest.addTab(Language.getInstance()
555:                        .getText("Attachements"), manualTestAttachmentView);
556:                /* manualTest.addChangeListener(new ChangeListener() {
557:                	public void stateChanged(ChangeEvent e) {
558:                		if (((JTabbedPane)e.getSource()).getSelectedIndex() == 1){
559:                			ManualActionView pManualActionView = (ManualActionView) ((JTabbedPane)e.getSource()).getSelectedComponent();
560:                			pManualActionView.setColumnSize();
561:                		}
562:                	}
563:                });*/
564:                manualTest.addTab(Language.getInstance().getText("Paramètres"),
565:                        testParameterView);
566:
567:                createManualTestDetails(detailsPanel);
568:
569:                // Mapping entre objets graphiques et constantes
570:                pSalomeTMFContext.addToUIComponentsMap(
571:                        UICompCst.MANUAL_TEST_WORKSPACE_PANEL_FOR_TABS,
572:                        manualTest);
573:                // Add this component as static component
574:                UICompCst.staticUIComps
575:                        .add(UICompCst.MANUAL_TEST_WORKSPACE_PANEL_FOR_TABS);
576:
577:                workSpaceTest.setLayout(new BorderLayout());
578:                workSpaceTest.add(manualTest, BorderLayout.CENTER);
579:
580:            } // Fin de la m?thode createManualTest/0
581:
582:            /**
583:             * M?thode qui cr?e l'?cran des d?tails sur un test
584:             * @param panel le panel qui contient la vue
585:             */
586:            private void createManualTestDetails(JPanel panel) {
587:
588:                manualTestConceptorLabel = new JLabel(Language.getInstance()
589:                        .getText("Concepteur")
590:                        + " : ");
591:                manualTestNameLabel = new JLabel(Language.getInstance()
592:                        .getText("Nom_du_test")
593:                        + " : ");
594:                manualTestDateLabel = new JLabel(Language.getInstance()
595:                        .getText("Date_de_création")
596:                        + " : ");
597:                manualTestExecutedLabel = new JLabel(Language.getInstance()
598:                        .getText("Exécute")
599:                        + " : ");
600:
601:                manualButtonCampaignDetails = new JButton(Language
602:                        .getInstance().getText("Campagne"));
603:                manualButtonCampaignDetails.addActionListener(this );
604:
605:                JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
606:                firstLine.add(manualTestNameLabel);
607:                firstLine.add(Box.createRigidArea(new Dimension(20, 20)));
608:                firstLine.add(manualTestDateLabel);
609:                firstLine.add(Box.createRigidArea(new Dimension(20, 20)));
610:                firstLine.add(manualTestExecutedLabel);
611:                firstLine.add(Box.createRigidArea(new Dimension(10, 20)));
612:                firstLine.add(manualButtonCampaignDetails);
613:
614:                JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
615:                secondLine.add(manualTestConceptorLabel);
616:
617:                JPanel allButtons = new JPanel();
618:                allButtons
619:                        .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
620:                allButtons.add(firstLine);
621:                allButtons.add(secondLine);
622:
623:                //allButtons.add()
624:                allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
625:                        0));
626:                /*
627:                manualDetailsDescription = new JTextPane();
628:                manualDetailsDescription.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Description")));
629:                manualDetailsDescription.addCaretListener(new TestTreeDescriptionListener());
630:                manualDetailsDescription.addFocusListener(new TestDescriptionFocusListener()); */
631:                pManualDetailsDescription = new EkitCore(testDynamicTree
632:                        .getTree(), true);
633:                panel.add(allButtons, BorderLayout.NORTH);
634:                //JScrollPane manualDetailsDescrSrollPane = new JScrollPane(manualDetailsDescription);
635:                JScrollPane manualDetailsDescrSrollPane = new JScrollPane(
636:                        pManualDetailsDescription);
637:
638:                panel.add(manualDetailsDescrSrollPane, BorderLayout.CENTER);
639:            } // Fin de la m?thode createManualTestDetails/1  
640:
641:            public void actionPerformed(ActionEvent e) {
642:                if (e.getSource().equals(automaticButtonCampaignDetails)) {
643:                    Test pTest = DataModel.getCurrentTest();
644:                    if (pTest != null) {
645:                        new ViewCampaignOfTest(pTest);
646:                    }
647:                } else if (e.getSource().equals(manualButtonCampaignDetails)) {
648:                    Test pTest = DataModel.getCurrentTest();
649:                    if (pTest != null) {
650:                        new ViewCampaignOfTest(pTest);
651:                    }
652:                }
653:                if (e.getSource().equals(addFamily)) {
654:                    addFamilyPerformed(e);
655:                } else if (e.getSource().equals(addList)) {
656:                    addListPerformed(e);
657:                } else if (e.getSource().equals(addTest)) {
658:                    addTestPerformed(e);
659:                }
660:            }
661:
662:            void addFamilyPerformed(ActionEvent e) {
663:                if (pTestTreeFiltrePanel.getFiltreType() != -1) {
664:                    pTestTreeFiltrePanel.reInit(true);
665:                }
666:                DataModel.addNewFamily();
667:            }
668:
669:            void addListPerformed(ActionEvent e) {
670:                if (pTestTreeFiltrePanel.getFiltreType() == DataConstants.TESTLIST
671:                        || pTestTreeFiltrePanel.getFiltreType() == DataConstants.TEST) {
672:                    pTestTreeFiltrePanel.reInit(true);
673:                }
674:                DataModel.addNewTestList();
675:            }
676:
677:            void addTestPerformed(ActionEvent e) {
678:                if (pTestTreeFiltrePanel.getFiltreType() == DataConstants.TEST) {
679:                    pTestTreeFiltrePanel.reInit(true);
680:                }
681:                DataModel.addNewTest();
682:            }
683:
684:            void loadModel(String strProject, String strLogin) {
685:                //testMultiUserChangeListenerPanel.reset();
686:                testListAttachmentView.giveAccessToIhmScriptView();
687:                familyAttachmentView.giveAccessToIhmScriptView();
688:                testParameterView.giveAccessToIhmParameterView();
689:                manualTestAttachmentView.giveAccessToIhmScriptView();
690:                automaticTestParameterView.giveAccessToIhmParameterView();
691:                automaticTestAttachmentView.giveAccessToIhmScriptView();
692:                projetName.setText(Language.getInstance().getText("Projet_:_")
693:                        + DataModel.getCurrentProject().getNameFromModel()
694:                        + ", " + Language.getInstance().getText("Utilisateurs")
695:                        + " : "
696:                        + DataModel.getCurrentUser().getLoginFromModel()
697:                        + " (V " + Api.getVersion() + ")");
698:                testDynamicTree.givePopupMenuToTree();
699:            }
700:
701:            void reloadModel() {
702:                //testMultiUserChangeListenerPanel.reset();
703:                testListAttachmentView.giveAccessToIhmScriptView();
704:                familyAttachmentView.giveAccessToIhmScriptView();
705:                testParameterView.giveAccessToIhmParameterView();
706:                manualTestAttachmentView.giveAccessToIhmScriptView();
707:                automaticTestParameterView.giveAccessToIhmParameterView();
708:                automaticTestAttachmentView.giveAccessToIhmScriptView();
709:                projetName.setText(Language.getInstance().getText("Projet_:_")
710:                        + DataModel.getCurrentProject().getNameFromModel()
711:                        + ", " + Language.getInstance().getText("Utilisateurs")
712:                        + " : "
713:                        + DataModel.getCurrentUser().getLoginFromModel()
714:                        + " (V " + Api.getVersion() + ")");
715:                testDynamicTree.givePopupMenuToTree();
716:            }
717:
718:            void giveAccessToIhm() {
719:                if (Api.isConnected()) {
720:                    if (!Permission.canDeleteTest()) {
721:                        delTestOrTestList.setEnabled(false);
722:                    }
723:                    if (!Permission.canCreateTest()) {
724:
725:                        addTest.setEnabled(false);
726:                        addList.setEnabled(false);
727:                        addFamily.setEnabled(false);
728:                    }
729:                    if (!Permission.canUpdateTest()) {
730:                        renameTestButton.setEnabled(false);
731:                        orderTest.setEnabled(false);
732:                        //familyDescription.setEditable(false);
733:                        pfamilyDescription.setEditable(false);
734:                        pTestListDescription.setEditable(false);
735:                        pManualDetailsDescription.setEditable(false);
736:                        pAutomaticDetailsDescription.setEditable(false);
737:                        testDynamicTree.setEnabled(false);
738:                        pTestListDescription.setEditable(false);
739:                        pManualDetailsDescription.setEditable(false);
740:                        pAutomaticDetailsDescription.setEditable(false);
741:                        //familyDescription.setEditable(false);
742:                        pfamilyDescription.setEditable(false);
743:                    }
744:
745:                }
746:            }
747:
748:            /********************************************************************************************************************************/
749:            void reValidate() {
750:                validate();
751:                repaint();
752:            }
753:
754:            void removeTestWorkSpace() {
755:                workSpaceTest.removeAll();
756:            }
757:
758:            void setWorkSpace(int type) {
759:                workSpaceTest.removeAll();
760:                if (type == DataConstants.FAMILY) {
761:                    workSpaceTest.add(familyWorkSpace);
762:                } else if (type == DataConstants.TESTLIST) {
763:                    workSpaceTest.add(listWorkSpace);
764:                } else if (type == DataConstants.MANUAL_TEST) {
765:                    workSpaceTest.add(manualTest, BorderLayout.CENTER);
766:                } else if (type == DataConstants.AUTOMATIC_TEST) {
767:                    workSpaceTest.add(automaticTest, BorderLayout.CENTER);
768:                }
769:            }
770:
771:            void setDescription(int type, String text) {
772:                if (type == DataConstants.FAMILY) {
773:                    //familyDescription.setText(text);
774:                    pfamilyDescription.setText(text);
775:                } else if (type == DataConstants.TESTLIST) {
776:                    pTestListDescription.setText(text);
777:                } else if (type == DataConstants.MANUAL_TEST) {
778:                    pManualDetailsDescription.setText(text);
779:                } else if (type == DataConstants.AUTOMATIC_TEST) {
780:                    pAutomaticDetailsDescription.setText(text);
781:                }
782:            }
783:
784:            void setTestInfo(int type, String name, String conceptor,
785:                    String date) {
786:                if (type == DataConstants.MANUAL_TEST) {
787:                    if (name != null) {
788:                        manualTestNameLabel.setText(Language.getInstance()
789:                                .getText("Nom_du_test_:_")
790:                                + name);
791:                    }
792:                    if (conceptor != null) {
793:                        manualTestConceptorLabel.setText(Language.getInstance()
794:                                .getText("Concepteur_:_")
795:                                + conceptor);
796:                    }
797:                    if (date != null) {
798:                        manualTestDateLabel.setText(Language.getInstance()
799:                                .getText("Date_de_création_:_")
800:                                + date);
801:                    }
802:                } else if (type == DataConstants.AUTOMATIC_TEST) {
803:                    if (name != null) {
804:                        automaticTestNameLabel.setText(Language.getInstance()
805:                                .getText("Nom_du_test_:_")
806:                                + name);
807:                    }
808:                    if (conceptor != null) {
809:                        automaticTestConceptorLabel.setText(Language
810:                                .getInstance().getText("Concepteur_:_")
811:                                + conceptor);
812:                    }
813:                    if (date != null) {
814:                        automaticTestDateLabel.setText(Language.getInstance()
815:                                .getText("Concepteur_:_")
816:                                + date);
817:                    }
818:                }
819:
820:            }
821:
822:            void TestExecutedInfo(int type, String execcuted) {
823:                if (type == DataConstants.MANUAL_TEST) {
824:                    if (execcuted != null) {
825:                        manualTestExecutedLabel.setText(Language.getInstance()
826:                                .getText("Exécute")
827:                                + " : " + execcuted);
828:                    }
829:
830:                } else if (type == DataConstants.AUTOMATIC_TEST) {
831:                    if (execcuted != null) {
832:                        automaticTestExecutedLabel.setText(Language
833:                                .getInstance().getText("Exécute")
834:                                + " : " + execcuted);
835:                    }
836:                }
837:            }
838:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.