Source Code Cross Referenced for CampainPanel.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:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package org.objectweb.salome_tmf.ihm.main;
025:
026:        import java.awt.BorderLayout;
027:        import java.awt.Cursor;
028:        import java.awt.Dimension;
029:        import java.awt.FlowLayout;
030:        import java.awt.Font;
031:        import java.awt.GridLayout;
032:        import java.awt.event.ActionEvent;
033:        import java.awt.event.ActionListener;
034:        import java.util.Vector;
035:
036:        import javax.swing.BorderFactory;
037:        import javax.swing.Box;
038:        import javax.swing.BoxLayout;
039:        import javax.swing.JButton;
040:        import javax.swing.JLabel;
041:        import javax.swing.JMenu;
042:        import javax.swing.JMenuBar;
043:        import javax.swing.JMenuItem;
044:        import javax.swing.JPanel;
045:        import javax.swing.JSplitPane;
046:        import javax.swing.JTabbedPane;
047:        import javax.swing.event.ChangeEvent;
048:        import javax.swing.event.ChangeListener;
049:
050:        import org.objectweb.salome_tmf.api.Api;
051:        import org.objectweb.salome_tmf.api.Permission;
052:        import org.objectweb.salome_tmf.api.data.UserWrapper;
053:        import org.objectweb.salome_tmf.data.DataConstants;
054:        import org.objectweb.salome_tmf.data.Project;
055:        import org.objectweb.salome_tmf.data.User;
056:        import org.objectweb.salome_tmf.ihm.filtre.CampagneTreeFiltrePanel;
057:        import org.objectweb.salome_tmf.ihm.languages.Language;
058:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
059:        import org.objectweb.salome_tmf.ihm.main.htmleditor.EkitCore;
060:        import org.objectweb.salome_tmf.ihm.models.DynamicTree;
061:        import org.objectweb.salome_tmf.plugins.UICompCst;
062:
063:        public class CampainPanel extends JPanel implements  ActionListener {
064:
065:            JTabbedPane campagneSpace;
066:            JTabbedPane campaignFamilyWorkSpace;
067:            JTabbedPane campaignTestListWorkSpace;
068:            JTabbedPane campaignTestWorkSpace;
069:
070:            JPanel workSpaceCampagne;
071:
072:            DynamicTree campaignDynamicTree;
073:            CampagneTreeFiltrePanel pCampTreeFiltrePanel;
074:
075:            JButton addTestInCampagne;
076:            JButton createCampagne;
077:            //JButton orderTest;
078:            JButton orderCampagne;
079:            JButton delCampagne;
080:            JButton renameCampaignButton;
081:
082:            JMenu campToolsMenu;
083:
084:            JLabel projetNameCampagne;
085:            JLabel campaignNameLabel;
086:            JLabel campaignDateLabel;
087:            JLabel campaignConceptorLabel;
088:
089:            EkitCore pCampagneDetailsDescription;
090:            EkitCore pCampaignFamilyDescription;
091:            EkitCore pCampaignTestListDescription;
092:            EkitCore pCampaignTestDescription;
093:
094:            /*
095:            JTextPane campagneDetailsDescription;
096:            JTextPane campaignFamilyDescription;
097:            JTextPane campaignTestListDescription;
098:            JTextPane campaignTestDescription;
099:             */
100:            AttachmentView campaignAttachmentView;
101:            AssignedCamPanel pAssignedCamPanel;
102:
103:            //changeListenerPanel campagneMultiUserChangeListenerPanel;
104:            BaseIHM pBaseIHM;
105:            SalomeTMFContext pSalomeTMFContext;
106:            int t_x = 1024;
107:            int t_y = 768;
108:            JTabbedPane tabs;
109:            private JLabel testConceptorLabel;
110:            private JLabel testNameLabel;
111:            private JLabel testDateLabel;
112:            private JLabel testAssignedLabel;
113:
114:            public CampainPanel(SalomeTMFContext m_SalomeTMFContext,
115:                    BaseIHM m_BaseIHM, JTabbedPane m_tabs, int x, int y) {
116:                super (new BorderLayout());
117:                pSalomeTMFContext = m_SalomeTMFContext;
118:                pBaseIHM = m_BaseIHM;
119:                tabs = m_tabs;
120:                t_x = x;
121:                t_y = y;
122:            }
123:
124:            public void initCoponent() {
125:                workSpaceCampagne = new JPanel();
126:
127:                campToolsMenu = new JMenu(Language.getInstance().getText(
128:                        "Outils"));
129:                pSalomeTMFContext.UIComponentsMap.put(
130:                        UICompCst.CAMP_TOOLS_MENU, campToolsMenu);
131:
132:                projetNameCampagne = new JLabel();
133:                projetNameCampagne.setFont(new Font(null, Font.BOLD, 18));
134:                JPanel namePanelCampagne = new JPanel(new FlowLayout(
135:                        FlowLayout.LEFT));
136:                namePanelCampagne.add(projetNameCampagne);
137:
138:                /*
139:                 * campagneMultiUserChangeListenerPanel = new changeListenerPanel();
140:                campagneMultiUserChangeListenerPanel.setPreferredSize(new Dimension(70,25));
141:                JPanel campagneMultiUserPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
142:                campagneMultiUserPanel.add(campagneMultiUserChangeListenerPanel);
143:                 */
144:                JPanel campagneTopPanel = new JPanel(new BorderLayout());
145:                campagneTopPanel.add(namePanelCampagne, BorderLayout.WEST);
146:                //campagneTopPanel.add(campagneMultiUserPanel, BorderLayout.EAST);
147:
148:                add(campagneTopPanel, BorderLayout.NORTH);
149:                createCampagnePlane();
150:            }
151:
152:            /**
153:             * Méthode qui crée la vue sur les campagnes
154:             */
155:            private void createCampagnePlane() {
156:
157:                //La liste des boutons de la vue (c?t? gauche de la vue)
158:                createCampagne = new JButton(Language.getInstance().getText(
159:                        "Créer_une_campagne"));
160:                createCampagne.setToolTipText(Language.getInstance().getText(
161:                        "Créer_une_campagne"));
162:                createCampagne.addActionListener(this );
163:
164:                addTestInCampagne = new JButton(Language.getInstance().getText(
165:                        "Importer"));
166:                addTestInCampagne.setEnabled(false);
167:                addTestInCampagne.setToolTipText(Language.getInstance()
168:                        .getText("Ajouter_des_tests_à_la_campagne"));
169:                addTestInCampagne.addActionListener(this );
170:
171:                orderCampagne = new JButton(Language.getInstance().getText(
172:                        "Ordonner"));
173:                orderCampagne.setToolTipText(Language.getInstance().getText(
174:                        "Ordonner_une_campagne"));
175:                orderCampagne.addActionListener(this );
176:
177:                JMenu refreshItem = new JMenu(Language.getInstance().getText(
178:                        "Rafraichir"));
179:                /*JMenuItem refreshItem = new JMenuItem(Language.getInstance().getText("Rafraichir"));
180:                refreshItem.addActionListener(new ActionListener() {
181:                    public void actionPerformed(ActionEvent e) {
182:                    	tabs.setCursor(new Cursor(Cursor.WAIT_CURSOR));
183:                    	workSpaceCampagne.removeAll();
184:                    	DataModel.reloadFromBase(true);
185:                    	tabs.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
186:                    }
187:                });
188:                 */
189:
190:                JMenuItem refreshItemAll = new JMenuItem(Language.getInstance()
191:                        .getText("Tout"));
192:                refreshItemAll.addActionListener(new ActionListener() {
193:                    public void actionPerformed(ActionEvent e) {
194:                        //TestMethods.refreshTestTree();
195:                        tabs.setCursor(new Cursor(Cursor.WAIT_CURSOR));
196:                        workSpaceCampagne.removeAll();
197:                        DataModel.reloadFromBase(true);
198:                        tabs.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
199:                    }
200:                });
201:
202:                JMenuItem refreshItemCamp = new JMenuItem(Language
203:                        .getInstance().getText("Campagnes"));
204:                refreshItemCamp.addActionListener(new ActionListener() {
205:                    public void actionPerformed(ActionEvent e) {
206:                        //TestMethods.refreshTestTree();
207:                        tabs.setCursor(new Cursor(Cursor.WAIT_CURSOR));
208:                        workSpaceCampagne.removeAll();
209:                        try {
210:                            DataModel.reloadCampainPlan();
211:                        } catch (Exception ex) {
212:                            ex.printStackTrace();
213:                            DataModel.reloadFromBase(true);
214:                        }
215:                        tabs.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
216:                    }
217:                });
218:
219:                refreshItem.add(refreshItemAll);
220:                refreshItem.add(refreshItemCamp);
221:
222:                campToolsMenu.add(refreshItem);
223:
224:                // Sous menu pour changer le mot de passe
225:                JMenuItem changePwdItem = new JMenuItem(Language.getInstance()
226:                        .getText("Changer_le_mot_de_passe"));
227:                changePwdItem.addActionListener(new ActionListener() {
228:                    public void actionPerformed(ActionEvent e) {
229:                        new ChangePwdWindow(pSalomeTMFContext.ptrFrame).show();
230:                    }
231:                });
232:
233:                campToolsMenu.add(changePwdItem);
234:
235:                JMenuBar menuBar = new JMenuBar();
236:                menuBar.add(campToolsMenu);
237:
238:                delCampagne = new JButton(Language.getInstance().getText(
239:                        "Supprimer"));
240:                delCampagne.setEnabled(false);
241:                delCampagne.setToolTipText(Language.getInstance().getText(
242:                        "Supprimer"));
243:                delCampagne.addActionListener(this );
244:
245:                renameCampaignButton = new JButton(Language.getInstance()
246:                        .getText("Renommer"));
247:                renameCampaignButton.setEnabled(false);
248:                renameCampaignButton.addActionListener(this );
249:
250:                // Panel regroupant tous les boutons
251:                JPanel listPanel = new JPanel(new GridLayout(1, 3));
252:                listPanel.add(addTestInCampagne);
253:                listPanel.add(orderCampagne);
254:                listPanel.add(renameCampaignButton);
255:                listPanel.add(delCampagne);
256:                listPanel.setBorder(BorderFactory.createRaisedBevelBorder());
257:
258:                // Mapping entre objets graphiques et constantes
259:                pSalomeTMFContext.addToUIComponentsMap(
260:                        UICompCst.CAMP_SECOND_BUTTONS_PANEL, listPanel);
261:                // Add this component as static component
262:                UICompCst.staticUIComps
263:                        .add(UICompCst.CAMP_SECOND_BUTTONS_PANEL);
264:
265:                JPanel createPanel = new JPanel(new GridLayout(1, 3));
266:                createPanel.add(createCampagne);
267:                createPanel.add(menuBar);
268:                createPanel.setBorder(BorderFactory.createRaisedBevelBorder());
269:
270:                // Mapping entre objets graphiques et constantes
271:                pSalomeTMFContext.addToUIComponentsMap(
272:                        UICompCst.CAMP_FIRST_BUTTONS_PANEL, createPanel);
273:                // Add this component as static component
274:                UICompCst.staticUIComps.add(UICompCst.CAMP_FIRST_BUTTONS_PANEL);
275:
276:                campaignDynamicTree = new DynamicTree(Language.getInstance()
277:                        .getText("Campagnes_de_tests"), DataConstants.CAMPAIGN);
278:                pSalomeTMFContext.addToUIComponentsMap(
279:                        UICompCst.CAMPAIGN_DYNAMIC_TREE, campaignDynamicTree);
280:                // Add this component as static component
281:                UICompCst.staticUIComps.add(UICompCst.CAMPAIGN_DYNAMIC_TREE);
282:
283:                JPanel southPanel = new JPanel();
284:                southPanel.setLayout(new GridLayout(2, 1));
285:                pCampTreeFiltrePanel = new CampagneTreeFiltrePanel(
286:                        campaignDynamicTree.getModel());
287:                JPanel buttonPanel = new JPanel(new FlowLayout(
288:                        FlowLayout.CENTER));
289:                JButton quitCampagneButton = new JButton(Language.getInstance()
290:                        .getText("Quitter"));
291:                quitCampagneButton.addActionListener(new ActionListener() {
292:                    public void actionPerformed(ActionEvent e) {
293:                        pBaseIHM.quit(true, true);
294:                    }
295:                });
296:                buttonPanel.add(quitCampagneButton);
297:                southPanel.add(pCampTreeFiltrePanel);
298:                southPanel.add(buttonPanel);
299:
300:                createCampagneWorkSpace();
301:                createCampaignFamily();
302:                createCampaignTestList();
303:                createCampaignTest();
304:                workSpaceCampagne.removeAll();
305:
306:                // Construction finale
307:                JPanel allButtons = new JPanel();
308:                allButtons
309:                        .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
310:
311:                allButtons.add(createPanel);
312:                allButtons.add(listPanel);
313:
314:                JPanel buttonsAndTree = new JPanel(new BorderLayout());
315:                buttonsAndTree.add(allButtons, BorderLayout.NORTH);
316:                buttonsAndTree.add(campaignDynamicTree, BorderLayout.CENTER);
317:                //buttonsAndTree.add(quitCampagneButton, BorderLayout.SOUTH);
318:                buttonsAndTree.add(southPanel, BorderLayout.SOUTH);
319:
320:                buttonsAndTree.setPreferredSize(new Dimension(t_x / 3, t_y));
321:                buttonsAndTree.setMinimumSize(new Dimension(t_x / 4, t_y));
322:
323:                workSpaceCampagne.setPreferredSize(new Dimension(t_x / 3 * 2,
324:                        t_y));
325:                workSpaceCampagne.setMinimumSize(new Dimension(t_x / 3, t_y));
326:
327:                JSplitPane splitPane = new JSplitPane(
328:                        JSplitPane.HORIZONTAL_SPLIT, buttonsAndTree,
329:                        workSpaceCampagne);
330:                splitPane.setDividerLocation(380);
331:                add(splitPane);
332:            } // fin de la méthode createCampagnePlane/0
333:
334:            /**
335:             * Méthode qui crée la vue de droite pour les campagnes
336:             */
337:            private void createCampagneWorkSpace() {
338:                workSpaceCampagne.removeAll();
339:                // Onglets
340:                campagneSpace = new JTabbedPane();
341:
342:                JPanel details = new JPanel(new BorderLayout());
343:                createCampagneDetails(details);
344:
345:                DataSetView data = new DataSetView();
346:                ExecutionView executionPanel = new ExecutionView();
347:                AnomalieView anomaliePanel = new AnomalieView(null);
348:                pAssignedCamPanel = new AssignedCamPanel();
349:                campaignAttachmentView = new AttachmentView(pBaseIHM,
350:                        DataConstants.CAMPAIGN, DataConstants.CAMPAIGN, null,
351:                        DataConstants.NORMAL_SIZE_FOR_ATTACH, null);
352:
353:                campagneSpace.addTab(Language.getInstance().getText("Détails"),
354:                        details); //0
355:                //campagneSpace.addTab(Language.getInstance().getText("Attachements"), attachment); //1
356:                campagneSpace.addTab(Language.getInstance().getText(
357:                        "Attachements"), campaignAttachmentView);
358:                campagneSpace.addTab(Language.getInstance().getText(
359:                        "Exécutions"), executionPanel); //2
360:                campagneSpace.addTab(Language.getInstance().getText(
361:                        "Jeux_de_données"), data); //3
362:                campagneSpace.addTab(Language.getInstance()
363:                        .getText("Anomalies"), anomaliePanel); //4
364:                campagneSpace.addTab(Language.getInstance()
365:                        .getText("Assigné_à"), pAssignedCamPanel); //5
366:
367:                campagneSpace.addChangeListener(new ChangeListener() {
368:                    public void stateChanged(ChangeEvent e) {
369:                        if (tabs.getModel().getSelectedIndex() == 1) {
370:                            DataModel.initAttachmentTable(DataModel
371:                                    .getCurrentCampaign()
372:                                    .getAttachmentMapFromModel().values());
373:                        } else if (tabs.getModel().getSelectedIndex() == 4) {
374:                            AnomalieView pAnomaliePanel = (AnomalieView) tabs
375:                                    .getSelectedComponent();
376:                            pAnomaliePanel.updateData(DataModel
377:                                    .getCurrentCampaign());
378:                        }
379:                    }
380:                });
381:
382:                // Mapping entre objets graphiques et constantes
383:                pSalomeTMFContext.UIComponentsMap.put(
384:                        UICompCst.CAMPAIGN_WORKSPACE_PANEL_FOR_TABS,
385:                        campagneSpace);
386:                // Add this component as static component
387:                UICompCst.staticUIComps
388:                        .add(UICompCst.CAMPAIGN_WORKSPACE_PANEL_FOR_TABS);
389:
390:                workSpaceCampagne.setLayout(new BorderLayout());
391:                workSpaceCampagne.add(campagneSpace, BorderLayout.CENTER);
392:            } // Fin de la m?thode createCampagneWorkSpace/0
393:
394:            /**
395:             * Méthode qui crée la vue de détails sur les campagnes
396:             * @param panel le panel qui contient la vue
397:             */
398:            private void createCampagneDetails(JPanel panel) {
399:                campaignNameLabel = new JLabel(Language.getInstance().getText(
400:                        "Nom_de_la_campagne")
401:                        + " : ");
402:                campaignDateLabel = new JLabel(Language.getInstance().getText(
403:                        "Date_de_création")
404:                        + " : ");
405:                campaignConceptorLabel = new JLabel(Language.getInstance()
406:                        .getText("Concepteur")
407:                        + " : ");
408:
409:                JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
410:                firstLine.add(campaignNameLabel);
411:
412:                firstLine.add(Box.createRigidArea(new Dimension(50, 20)));
413:                firstLine.add(campaignDateLabel);
414:
415:                JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
416:                secondLine.add(campaignConceptorLabel);
417:
418:                JPanel allButtons = new JPanel();
419:                allButtons
420:                        .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
421:                allButtons.add(firstLine);
422:                allButtons.add(secondLine);
423:
424:                //allButtons.add()
425:                allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
426:                        0));
427:                /*campagneDetailsDescription = new JTextPane();
428:                campagneDetailsDescription.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Description")));
429:                campagneDetailsDescription.addCaretListener(new CampaignTreeDescriptionListener());
430:                campagneDetailsDescription.addFocusListener(new CampaignDescriptionFocusListener());*/
431:                pCampagneDetailsDescription = new EkitCore(campaignDynamicTree
432:                        .getTree(), true);
433:                panel.add(allButtons, BorderLayout.NORTH);
434:                //panel.add(campagneDetailsDescription,BorderLayout.CENTER);
435:                panel.add(pCampagneDetailsDescription, BorderLayout.CENTER);
436:
437:            } // Fin de la méthode createCampagneDetails/1
438:
439:            /**
440:             * Méthode qui crée la vue sur les familles
441:             */
442:            private void createCampaignFamily() {
443:
444:                workSpaceCampagne.removeAll();
445:                /*
446:                campaignFamilyDescription = new JTextPane();
447:                campaignFamilyDescription.addCaretListener(new CampaignTreeDescriptionListener());
448:                campaignFamilyDescription.setEditable(false);
449:                 */
450:                pCampaignFamilyDescription = new EkitCore(campaignDynamicTree
451:                        .getTree(), false);
452:
453:                // Onglets 
454:                campaignFamilyWorkSpace = new JTabbedPane();
455:                //campaignFamilyWorkSpace.addTab(Language.getInstance().getText("Description"), campaignFamilyDescription);
456:                campaignFamilyWorkSpace.addTab(Language.getInstance().getText(
457:                        "Description"), pCampaignFamilyDescription);
458:
459:                workSpaceCampagne.setLayout(new BorderLayout());
460:                workSpaceCampagne.add(campaignFamilyWorkSpace,
461:                        BorderLayout.CENTER);
462:
463:                pSalomeTMFContext.addToUIComponentsMap(
464:                        UICompCst.FAMILY_CAMP_WORKSPACE_TABS_PANEL,
465:                        campaignFamilyWorkSpace);
466:                UICompCst.staticUIComps
467:                        .add(UICompCst.FAMILY_CAMP_WORKSPACE_TABS_PANEL);
468:            }
469:
470:            /**
471:             * Méthode qui cée la vue sur les suites des campagnes
472:             */
473:            private void createCampaignTestList() {
474:
475:                workSpaceCampagne.removeAll();
476:                campaignTestListWorkSpace = new JTabbedPane();
477:
478:                // Onglets
479:                /* campaignTestListDescription = new JTextPane();
480:                 campaignTestListDescription.addCaretListener(new CampaignTreeDescriptionListener());
481:                 campaignTestListDescription.setEditable(false);*/
482:                pCampaignTestListDescription = new EkitCore(campaignDynamicTree
483:                        .getTree(), false);
484:                //campaignTestListWorkSpace.addTab(Language.getInstance().getText("Description"), campaignTestListDescription);
485:                campaignTestListWorkSpace.addTab(Language.getInstance()
486:                        .getText("Description"), pCampaignTestListDescription);
487:
488:                workSpaceCampagne.setLayout(new BorderLayout());
489:                workSpaceCampagne.add(campaignTestListWorkSpace,
490:                        BorderLayout.CENTER);
491:
492:                pSalomeTMFContext.addToUIComponentsMap(
493:                        UICompCst.TESTLIST_CAMP_WORKSPACE_TABS_PANEL,
494:                        campaignTestListWorkSpace);
495:                UICompCst.staticUIComps
496:                        .add(UICompCst.TESTLIST_CAMP_WORKSPACE_TABS_PANEL);
497:            } // Fin de la méthode createCampaignTestList/0
498:
499:            /**
500:             * Méthode qui crée la vue sur les tests des campagne
501:             */
502:            private void createCampaignTest() {
503:
504:                workSpaceCampagne.removeAll();
505:
506:                // Onglets
507:                campaignTestWorkSpace = new JTabbedPane();
508:
509:                testConceptorLabel = new JLabel(Language.getInstance().getText(
510:                        "Concepteur")
511:                        + " : ");
512:                testNameLabel = new JLabel(Language.getInstance().getText(
513:                        "Nom_du_test")
514:                        + " : ");
515:                testDateLabel = new JLabel(Language.getInstance().getText(
516:                        "Date_de_création")
517:                        + " : ");
518:                testAssignedLabel = new JLabel(Language.getInstance().getText(
519:                        "Assigné_à")
520:                        + " : ");
521:
522:                JPanel firstLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
523:                firstLine.add(testNameLabel);
524:                firstLine.add(Box.createRigidArea(new Dimension(20, 20)));
525:                firstLine.add(testDateLabel);
526:
527:                JPanel secondLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
528:                secondLine.add(testConceptorLabel);
529:                secondLine.add(Box.createRigidArea(new Dimension(20, 20)));
530:                secondLine.add(testAssignedLabel);
531:
532:                JPanel allButtons = new JPanel();
533:                allButtons
534:                        .setLayout(new BoxLayout(allButtons, BoxLayout.Y_AXIS));
535:                allButtons.add(firstLine);
536:                allButtons.add(secondLine);
537:
538:                //allButtons.add()
539:                allButtons.setBorder(BorderFactory.createEmptyBorder(10, 0, 30,
540:                        0));
541:                /*
542:                campaignTestDescription = new JTextPane();
543:                campaignTestDescription.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Description")));
544:                campaignTestDescription.addCaretListener(new CampaignTreeDescriptionListener());
545:                campaignTestDescription.setEditable(false);
546:                 */
547:                pCampaignTestDescription = new EkitCore(campaignDynamicTree
548:                        .getTree(), false);
549:                JPanel panel = new JPanel(new BorderLayout());
550:                panel.add(allButtons, BorderLayout.NORTH);
551:                //panel.add(campaignTestDescription,BorderLayout.CENTER);
552:                panel.add(pCampaignTestDescription, BorderLayout.CENTER);
553:                campaignTestWorkSpace.addTab(Language.getInstance().getText(
554:                        "Détails"), panel);
555:
556:                workSpaceCampagne.setLayout(new BorderLayout());
557:                workSpaceCampagne.add(campaignTestWorkSpace,
558:                        BorderLayout.CENTER);
559:
560:                pSalomeTMFContext.addToUIComponentsMap(
561:                        UICompCst.TEST_CAMP_WORKSPACE_TABS_PANEL,
562:                        campaignTestWorkSpace);
563:                UICompCst.staticUIComps
564:                        .add(UICompCst.TEST_CAMP_WORKSPACE_TABS_PANEL);
565:            } // Fin de la méthode createCampaignTest/0
566:
567:            /********************************************************************************************************/
568:
569:            void loadModel(String strProject, String strLogin) {
570:                //campagneMultiUserChangeListenerPanel.reset();
571:                campaignDynamicTree.givePopupMenuToTree();
572:                campaignAttachmentView.giveAccessToIhmScriptView();
573:                projetNameCampagne.setText(Language.getInstance().getText(
574:                        "Projet_:_")
575:                        + DataModel.getCurrentProject().getNameFromModel()
576:                        + ", "
577:                        + Language.getInstance().getText("Utilisateurs")
578:                        + " : "
579:                        + DataModel.getCurrentUser().getLoginFromModel()
580:                        + " (V " + Api.getVersion() + ")");
581:
582:            }
583:
584:            void reloadModel() {
585:                //campagneMultiUserChangeListenerPanel.reset();
586:                campaignDynamicTree.givePopupMenuToTree();
587:                campaignAttachmentView.giveAccessToIhmScriptView();
588:                projetNameCampagne.setText(Language.getInstance().getText(
589:                        "Projet_:_")
590:                        + DataModel.getCurrentProject().getNameFromModel());
591:
592:            }
593:
594:            void giveAccessToIhm() {
595:                if (Api.isConnected()) {
596:                    if (!Permission.canUpdateTest()) {
597:                        //orderTest.setEnabled(false);
598:                        pCampaignFamilyDescription.setEditable(false);
599:                        pCampaignTestListDescription.setEditable(false);
600:                        pCampaignTestDescription.setEditable(false);
601:
602:                    }
603:                    if (!Permission.canDeleteCamp()) {
604:                        delCampagne.setEnabled(false);
605:                    }
606:                    if (!Permission.canCreateCamp()) {
607:                        createCampagne.setEnabled(false);
608:                        addTestInCampagne.setEnabled(false);
609:                    }
610:                    if (!Permission.canUpdateCamp()) {
611:                        orderCampagne.setEnabled(false);
612:                        renameCampaignButton.setEnabled(false);
613:                        campaignDynamicTree.setEnabled(false);
614:                        pCampagneDetailsDescription.setEditable(false);
615:                    }
616:                    if (!Permission.canExecutCamp()) {
617:
618:                    }
619:                }
620:            }
621:
622:            /********************************************************************************************************************************/
623:            void reValidate() {
624:                validate();
625:                repaint();
626:            }
627:
628:            void setWorkSpace(int type) {
629:                workSpaceCampagne.removeAll();
630:                if (type == DataConstants.FAMILY) {
631:                    workSpaceCampagne.add(campaignFamilyWorkSpace);
632:                } else if (type == DataConstants.TESTLIST) {
633:                    workSpaceCampagne.add(campaignTestListWorkSpace);
634:                } else if (type == DataConstants.TEST) {
635:                    workSpaceCampagne.add(campaignTestWorkSpace);
636:                } else if (type == DataConstants.CAMPAIGN) {
637:                    workSpaceCampagne.add(campagneSpace);
638:                }
639:            }
640:
641:            void setDescription(int type, String text) {
642:                if (type == DataConstants.CAMPAIGN) {
643:                    pCampagneDetailsDescription.setText(text);
644:                } else if (type == DataConstants.FAMILY) {
645:                    pCampaignFamilyDescription.setText(text);
646:                } else if (type == DataConstants.TESTLIST) {
647:                    pCampaignTestListDescription.setText(text);
648:                } else if (type == DataConstants.TEST) {
649:                    pCampaignTestDescription.setText(text);
650:                }
651:            }
652:
653:            void setTestInfo(String name, String conceptor, String date) {
654:                if (name != null) {
655:                    campaignNameLabel.setText(Language.getInstance().getText(
656:                            "Nom_de_la_campagne_:_")
657:                            + name);
658:                }
659:                if (conceptor != null) {
660:                    campaignConceptorLabel.setText(Language.getInstance()
661:                            .getText("Concepteur_:_")
662:                            + conceptor);
663:                }
664:                if (date != null) {
665:                    campaignDateLabel.setText(Language.getInstance().getText(
666:                            "Date_de_création_:_")
667:                            + date);
668:                }
669:            }
670:
671:            void setTestInfoForTestPanel(String name, String conceptor,
672:                    String date, int assigned_to_ID) {
673:                if (name != null) {
674:                    testNameLabel.setText(Language.getInstance().getText(
675:                            "Nom_du_test")
676:                            + " : " + name);
677:                }
678:                if (conceptor != null) {
679:                    testConceptorLabel.setText(Language.getInstance().getText(
680:                            "Concepteur")
681:                            + " : " + conceptor);
682:                }
683:                if (date != null) {
684:                    testDateLabel.setText(Language.getInstance().getText(
685:                            "Date_de_création")
686:                            + " : " + date);
687:                }
688:                if (assigned_to_ID > 0) {
689:                    String user_login = DataModel.getCurrentUser()
690:                            .getLoginFromModel();
691:                    Project current_project = DataModel.getCurrentProject();
692:                    try {
693:                        boolean found = false;
694:                        Vector users_wrapper = current_project
695:                                .getAllUsersWrapper();
696:                        int i = 0;
697:                        while (i < users_wrapper.size() && !found) {
698:                            User user = new User((UserWrapper) users_wrapper
699:                                    .elementAt(i));
700:                            if (user.getIdBdd() == assigned_to_ID) {
701:                                user_login = user.getLoginFromModel();
702:                                found = true;
703:                            }
704:                            i++;
705:                        }
706:                    } catch (Exception e) {
707:                        e.printStackTrace();
708:                    }
709:                    testAssignedLabel.setText(Language.getInstance().getText(
710:                            "Assigné_à")
711:                            + " : " + user_login);
712:                }
713:
714:            }
715:
716:            /********** Action Listener **************/
717:
718:            public void actionPerformed(ActionEvent e) {
719:                if (e.getSource().equals(addTestInCampagne)) {
720:                    addTestInCampagnePerformed(e);
721:                } else if (e.getSource().equals(createCampagne)) {
722:                    createCampagnePerformed(e);
723:                } else if (e.getSource().equals(orderCampagne)) {
724:                    orderCampagnePerformed(e);
725:                } else if (e.getSource().equals(delCampagne)) {
726:                    delCampagnePerformed(e);
727:                } else if (e.getSource().equals(renameCampaignButton)) {
728:                    renameCampaignPerformed(e);
729:                }
730:            }
731:
732:            void addTestInCampagnePerformed(ActionEvent e) {
733:                DataModel.importTestsToCampaign();
734:            }
735:
736:            void createCampagnePerformed(ActionEvent e) {
737:                //if (pCampTreeFiltrePanel.isActived()){
738:                pCampTreeFiltrePanel.reInit(true);
739:                //}
740:                DataModel.addNewCampagne();
741:            }
742:
743:            void orderCampagnePerformed(ActionEvent e) {
744:                new TestOrdering(campaignDynamicTree, true);
745:            }
746:
747:            void delCampagnePerformed(ActionEvent e) {
748:                DataModel.deleteInCampaignTree();
749:            }
750:
751:            void renameCampaignPerformed(ActionEvent e) {
752:                /*if (pCampTreeFiltrePanel.isActived()){
753:                	pCampTreeFiltrePanel.reInit(true);
754:                }*/
755:                DataModel.renameCampaign();
756:            }
757:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.