Source Code Cross Referenced for GuiLaunchTest.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » clif » ui » 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 » salomeTMF_plug.clif.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package salomeTMF_plug.clif.ui;
002:
003:        import java.awt.BorderLayout;
004:        import java.awt.Component;
005:        import java.awt.Dimension;
006:        import java.awt.FlowLayout;
007:        import java.awt.Frame;
008:        import java.awt.event.ActionEvent;
009:        import java.awt.event.ActionListener;
010:        import java.awt.event.WindowAdapter;
011:        import java.awt.event.WindowEvent;
012:        import java.net.MalformedURLException;
013:        import java.net.URL;
014:        import java.util.HashMap;
015:        import java.util.Map;
016:
017:        import javax.swing.BorderFactory;
018:        import javax.swing.BoxLayout;
019:        import javax.swing.ButtonGroup;
020:        import javax.swing.ImageIcon;
021:        import javax.swing.JButton;
022:        import javax.swing.JCheckBox;
023:        import javax.swing.JDialog;
024:        import javax.swing.JLabel;
025:        import javax.swing.JPanel;
026:        import javax.swing.JRadioButton;
027:        import javax.swing.JScrollPane;
028:        import javax.swing.JTextArea;
029:        import javax.swing.border.TitledBorder;
030:
031:        import org.objectweb.salome_tmf.data.Execution;
032:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
033:        import org.objectweb.salome_tmf.ihm.main.plugins.PluginsTools;
034:
035:        import salomeTMF_plug.clif.languages.Language;
036:
037:        class GuiLaunchTest extends JDialog implements  ActionListener {
038:
039:            public static final int NO_TEST = 0;
040:            public static final int MANUAL_TEST = 1;
041:            public static final int SEMIAUTOMATIC_TEST = 2;
042:            public static final int AUTOMATIC_TEST = 3;
043:
044:            private static Map<String, Integer> testChoices = new HashMap<String, Integer>();
045:            //private static boolean keepChoice = false;
046:
047:            private int kindOfTest = NO_TEST;
048:
049:            private static final long serialVersionUID = 1L;
050:            private JPanel jContentPane = null;
051:            private JPanel jpTitleRBGroup = null;
052:            private JPanel jpButton = null;
053:            private JButton jbExecute = null;
054:            private JPanel jpTitle = null;
055:            private JPanel jpRBGroup = null;
056:            private JPanel JpCheckBox = null;
057:            private JLabel jlTitle = null;
058:            private JRadioButton jrbManual = null;
059:            private JRadioButton jrbSemiAuto = null;
060:            private JRadioButton jrbAuto = null;
061:            private JPanel jpRBManual = null;
062:            private JPanel jpRBSemiAuto = null;
063:            private JPanel jpRBandDesc = null;
064:            private JTextArea jtaExecutionDesc = null;
065:            private JPanel jpAuto = null;
066:            private ButtonGroup bgExecutionType = null;
067:            private JCheckBox jcbKeepChoice = null;
068:
069:            private boolean isClose = true;
070:
071:            private String testId = "";
072:
073:            private String url_txt = null;
074:
075:            GuiLaunchTest(Frame _parent) {
076:                super (_parent, true);
077:
078:                //Init url-txt
079:                String _urlSalome = SalomeTMFContext.getInstance().getUrlBase()
080:                        .toString();
081:                url_txt = _urlSalome.substring(0, _urlSalome.lastIndexOf("/"));
082:
083:                String campName = PluginsTools.getCurrentCampaign()
084:                        .getNameFromModel();
085:                Execution exec = PluginsTools.getCurrentCampExecution();
086:                testId = campName + "." + exec.getNameFromModel() + "_"
087:                        + exec.getExecutionResultListFromModel().size();
088:
089:                if (testChoices.get(testId) != null) {
090:                    kindOfTest = testChoices.get(testId);
091:
092:                    isClose = false;
093:                    this .dispose();
094:                } else {
095:                    initialize();
096:
097:                    //  window center
098:                    this .setLocationRelativeTo(this .getParent());
099:                    this .setAlwaysOnTop(true);
100:
101:                    pack();
102:                    this .setVisible(true);
103:                }
104:            }
105:
106:            public void actionPerformed(ActionEvent e) {
107:                if (e.getSource() == jbExecute) {
108:                    //keepChoice = jcbKeepChoice.isSelected();
109:                    if (jcbKeepChoice.isSelected()) {
110:                        if (jrbManual.isSelected()) {
111:                            testChoices.put(testId, MANUAL_TEST);
112:                            kindOfTest = MANUAL_TEST;
113:                        } else if (jrbSemiAuto.isSelected()) {
114:                            testChoices.put(testId, SEMIAUTOMATIC_TEST);
115:                            kindOfTest = SEMIAUTOMATIC_TEST;
116:                        } else if (jrbAuto.isSelected()) {
117:                            testChoices.put(testId, AUTOMATIC_TEST);
118:                            kindOfTest = AUTOMATIC_TEST;
119:                        }
120:                    } else {
121:                        if (jrbManual.isSelected()) {
122:                            kindOfTest = MANUAL_TEST;
123:                        } else if (jrbSemiAuto.isSelected()) {
124:                            kindOfTest = SEMIAUTOMATIC_TEST;
125:                        } else if (jrbAuto.isSelected()) {
126:                            kindOfTest = AUTOMATIC_TEST;
127:                        }
128:                    }
129:
130:                    isClose = false;
131:                    this .dispose();
132:                }
133:            }
134:
135:            /**
136:             * Launch when manual radio button check.
137:             */
138:            private void manualChoice() {
139:                jtaExecutionDesc.setText(Language.getInstance().getText(
140:                        "ManualDescription"));
141:            }
142:
143:            /**
144:             * Launch when semi automatic radio button check.
145:             */
146:            private void semiAutoChoice() {
147:                jtaExecutionDesc.setText(Language.getInstance().getText(
148:                        "SemiAutoDescription"));
149:            }
150:
151:            /**
152:             * Launch when automatic radio button check.
153:             */
154:            private void autoChoice() {
155:                jtaExecutionDesc.setText(Language.getInstance().getText(
156:                        "AutoDescription"));
157:            }
158:
159:            /**
160:             * 
161:             * @return boolean
162:             */
163:            public boolean isClose() {
164:                return (isClose);
165:            }
166:
167:            class WindowCloser extends WindowAdapter {
168:                public void windowClosing(WindowEvent e) {
169:                    GuiLaunchTest.this .dispose();
170:                }
171:            }
172:
173:            /**
174:             * This method initializes this
175:             * 
176:             * @return void
177:             */
178:            private void initialize() {
179:                this .setSize(300, 200);
180:                this .setResizable(false);
181:                this .setContentPane(getJContentPane());
182:
183:                bgExecutionType = new ButtonGroup();
184:                bgExecutionType.add(jrbManual);
185:                bgExecutionType.add(jrbSemiAuto);
186:                bgExecutionType.add(jrbAuto);
187:            }
188:
189:            /**
190:             * This method initializes jContentPane
191:             * 
192:             * @return javax.swing.JPanel
193:             */
194:            private JPanel getJContentPane() {
195:                if (jContentPane == null) {
196:                    jContentPane = new JPanel();
197:                    jContentPane.setLayout(new BorderLayout());
198:                    jContentPane.add(getJpTitleRBGroup(), BorderLayout.CENTER);
199:                    jContentPane.add(getJpButton(), BorderLayout.SOUTH);
200:                }
201:                return jContentPane;
202:            }
203:
204:            /**
205:             * This method initializes jpTitleRBGroup	
206:             * 	
207:             * @return javax.swing.JPanel	
208:             */
209:            private JPanel getJpTitleRBGroup() {
210:                if (jpTitleRBGroup == null) {
211:                    try {
212:                        jpTitleRBGroup = new JPanel();
213:                        jpTitleRBGroup.setLayout(new BoxLayout(
214:                                getJpTitleRBGroup(), BoxLayout.Y_AXIS));
215:                        jpTitleRBGroup.add(getJpTitle(), null);
216:                        jpTitleRBGroup.add(getJpRBandDesc(), null);
217:                        jpTitleRBGroup.add(getJpCheckBox(), null);
218:                    } catch (java.lang.Throwable e) {
219:                        // TODO: Something
220:                    }
221:                }
222:                return jpTitleRBGroup;
223:            }
224:
225:            /**
226:             * @return
227:             */
228:            private Component getJpCheckBox() {
229:                if (JpCheckBox == null) {
230:                    try {
231:                        JpCheckBox = new JPanel();
232:                        JpCheckBox.setLayout(new FlowLayout());
233:                        JpCheckBox.add(getCbKeepChoice(), null);
234:                    } catch (java.lang.Throwable e) {
235:                        // TODO: Something
236:                    }
237:                }
238:                return JpCheckBox;
239:            }
240:
241:            /**
242:             * @return
243:             */
244:            private Component getCbKeepChoice() {
245:                if (jcbKeepChoice == null) {
246:                    try {
247:                        jcbKeepChoice = new JCheckBox();
248:                        jcbKeepChoice.setText(Language.getInstance().getText(
249:                                "RemenberChoice"));
250:                    } catch (java.lang.Throwable e) {
251:                        // TODO: Something
252:                    }
253:                }
254:                return jcbKeepChoice;
255:            }
256:
257:            /**
258:             * This method initializes jpButton	
259:             * 	
260:             * @return javax.swing.JPanel	
261:             */
262:            private JPanel getJpButton() {
263:                if (jpButton == null) {
264:                    try {
265:                        jpButton = new JPanel();
266:                        jpButton.setLayout(new FlowLayout());
267:                        jpButton.add(getJbExecute(), null);
268:                    } catch (java.lang.Throwable e) {
269:                        // TODO: Something
270:                    }
271:                }
272:                return jpButton;
273:            }
274:
275:            /**
276:             * This method initializes jbExecute	
277:             * 	
278:             * @return javax.swing.JButton	
279:             */
280:            private JButton getJbExecute() {
281:                if (jbExecute == null) {
282:                    try {
283:                        jbExecute = new JButton();
284:                        jbExecute.setText(Language.getInstance().getText(
285:                                "ExecuteButton"));
286:                        jbExecute.setIcon(new ImageIcon(new URL(url_txt
287:                                + "/plugins/clif/resources/goOn.gif")));
288:                        jbExecute.addActionListener(this );
289:                    } catch (MalformedURLException e1) {
290:                        e1.printStackTrace();
291:                    } catch (java.lang.Throwable e) {
292:                        // TODO: Something
293:                    }
294:                }
295:                return jbExecute;
296:            }
297:
298:            /**
299:             * This method initializes jpTitle	
300:             * 	
301:             * @return javax.swing.JPanel	
302:             */
303:            private JPanel getJpTitle() {
304:                if (jpTitle == null) {
305:                    try {
306:                        FlowLayout flowLayout = new FlowLayout();
307:                        flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
308:                        jlTitle = new JLabel();
309:                        jlTitle.setText(Language.getInstance().getText(
310:                                "ExecutionChoiceTitle"));
311:                        jpTitle = new JPanel();
312:                        jpTitle.setLayout(flowLayout);
313:                        jpTitle.add(jlTitle, null);
314:                    } catch (java.lang.Throwable e) {
315:                        // TODO: Something
316:                    }
317:                }
318:                return jpTitle;
319:            }
320:
321:            /**
322:             * This method initializes jpRBGroup	
323:             * 	
324:             * @return javax.swing.JPanel	
325:             */
326:            private JPanel getJpRBandDesc() {
327:                if (jpRBandDesc == null) {
328:                    try {
329:                        jpRBandDesc = new JPanel();
330:                        JScrollPane jspDesc = new JScrollPane();
331:                        jtaExecutionDesc = new JTextArea();
332:                        jspDesc.setViewportView(jtaExecutionDesc);
333:                        jspDesc.setMinimumSize(new Dimension(200, 110));
334:                        jspDesc.setPreferredSize(new Dimension(200, 110));
335:                        jtaExecutionDesc.setLineWrap(true);
336:                        jtaExecutionDesc.setWrapStyleWord(true);
337:                        jtaExecutionDesc.setEditable(false);
338:                        jtaExecutionDesc.setText(Language.getInstance()
339:                                .getText("ManualDescription"));
340:                        jpRBandDesc.setLayout(new BorderLayout());
341:                        jpRBandDesc.add(getJpRBGroup(), BorderLayout.CENTER);
342:                        jpRBandDesc.add(jspDesc, BorderLayout.EAST);
343:                    } catch (java.lang.Throwable e) {
344:                        // TODO: Something
345:                    }
346:                }
347:                return jpRBandDesc;
348:            }
349:
350:            /**
351:             * This method initializes jpRBGroup	
352:             * 	
353:             * @return javax.swing.JPanel	
354:             */
355:            private JPanel getJpRBGroup() {
356:                if (jpRBGroup == null) {
357:                    try {
358:                        jpRBGroup = new JPanel();
359:                        jpRBGroup.setLayout(new BoxLayout(getJpRBGroup(),
360:                                BoxLayout.Y_AXIS));
361:                        jpRBGroup.setBorder(BorderFactory.createTitledBorder(
362:                                null, "", TitledBorder.DEFAULT_JUSTIFICATION,
363:                                TitledBorder.DEFAULT_POSITION, null, null));
364:                        jpRBGroup.add(getJpRBManual(), null);
365:                        jpRBGroup.add(getJpRBSemiAuto(), null);
366:                        jpRBGroup.add(getJpAuto(), null);
367:                    } catch (java.lang.Throwable e) {
368:                        // TODO: Something
369:                    }
370:                }
371:                return jpRBGroup;
372:            }
373:
374:            /**
375:             * This method initializes jrbManual	
376:             * 	
377:             * @return javax.swing.JRadioButton	
378:             */
379:            private JRadioButton getJrbManual() {
380:                if (jrbManual == null) {
381:                    try {
382:                        jrbManual = new JRadioButton();
383:                        jrbManual.setText(Language.getInstance().getText(
384:                                "ManualRB"));
385:                        jrbManual.setSelected(true);
386:                        jrbManual.addActionListener(new ActionListener() {
387:                            public void actionPerformed(ActionEvent e) {
388:                                manualChoice();
389:                            }
390:                        });
391:                    } catch (java.lang.Throwable e) {
392:                        // TODO: Something
393:                    }
394:                }
395:                return jrbManual;
396:            }
397:
398:            /**
399:             * This method initializes jrbSemiAuto	
400:             * 	
401:             * @return javax.swing.JRadioButton	
402:             */
403:            private JRadioButton getJrbSemiAuto() {
404:                if (jrbSemiAuto == null) {
405:                    try {
406:                        jrbSemiAuto = new JRadioButton();
407:                        jrbSemiAuto.setText(Language.getInstance().getText(
408:                                "SemiAutoRB"));
409:                        jrbSemiAuto.addActionListener(new ActionListener() {
410:                            public void actionPerformed(ActionEvent e) {
411:                                semiAutoChoice();
412:                            }
413:                        });
414:                    } catch (java.lang.Throwable e) {
415:                        // TODO: Something
416:                    }
417:                }
418:                return jrbSemiAuto;
419:            }
420:
421:            /**
422:             * This method initializes jrbAuto	
423:             * 	
424:             * @return javax.swing.JRadioButton	
425:             */
426:            private JRadioButton getJrbAuto() {
427:                if (jrbAuto == null) {
428:                    try {
429:                        jrbAuto = new JRadioButton();
430:                        jrbAuto.setText(Language.getInstance()
431:                                .getText("AutoRB"));
432:                        jrbAuto.addActionListener(new ActionListener() {
433:                            public void actionPerformed(ActionEvent e) {
434:                                autoChoice();
435:                            }
436:                        });
437:                    } catch (java.lang.Throwable e) {
438:                        // TODO: Something
439:                    }
440:                }
441:                return jrbAuto;
442:            }
443:
444:            /**
445:             * This method initializes jpRBManual	
446:             * 	
447:             * @return javax.swing.JPanel	
448:             */
449:            private JPanel getJpRBManual() {
450:                if (jpRBManual == null) {
451:                    try {
452:                        FlowLayout flowLayout1 = new FlowLayout();
453:                        flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
454:                        jpRBManual = new JPanel();
455:                        jpRBManual.setLayout(flowLayout1);
456:                        jpRBManual.add(getJrbManual(), null);
457:                    } catch (java.lang.Throwable e) {
458:                        // TODO: Something
459:                    }
460:                }
461:                return jpRBManual;
462:            }
463:
464:            /**
465:             * This method initializes jpRBSemiAuto	
466:             * 	
467:             * @return javax.swing.JPanel	
468:             */
469:            private JPanel getJpRBSemiAuto() {
470:                if (jpRBSemiAuto == null) {
471:                    try {
472:                        FlowLayout flowLayout2 = new FlowLayout();
473:                        flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
474:                        jpRBSemiAuto = new JPanel();
475:                        jpRBSemiAuto.setLayout(flowLayout2);
476:                        jpRBSemiAuto.add(getJrbSemiAuto(), null);
477:                    } catch (java.lang.Throwable e) {
478:                        // TODO: Something
479:                    }
480:                }
481:                return jpRBSemiAuto;
482:            }
483:
484:            /**
485:             * This method initializes jpAuto	
486:             * 	
487:             * @return javax.swing.JPanel	
488:             */
489:            private JPanel getJpAuto() {
490:                if (jpAuto == null) {
491:                    try {
492:                        FlowLayout flowLayout3 = new FlowLayout();
493:                        flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
494:                        jpAuto = new JPanel();
495:                        jpAuto.setLayout(flowLayout3);
496:                        jpAuto.add(getJrbAuto(), null);
497:                    } catch (java.lang.Throwable e) {
498:                        // TODO: Something
499:                    }
500:                }
501:                return jpAuto;
502:            }
503:
504:            public int getKindOfTest() {
505:                return kindOfTest;
506:            }
507:
508:            public void setKindOfTest(int kindOfTest) {
509:                this.kindOfTest = kindOfTest;
510:            }
511:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.