KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jemmyI18NWizard > wizardSupport > SelectSourcesDialog


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package jemmyI18NWizard.wizardSupport;
21
22 import org.netbeans.test.oo.gui.jam.Jemmy;
23 import org.netbeans.test.oo.gui.jello.JelloOKCancelDialog;
24 import org.netbeans.test.oo.gui.jam.JamComboBox;
25 import org.netbeans.jemmy.operators.JTreeOperator;
26 import javax.swing.tree.TreePath JavaDoc;
27
28
29 public class SelectSourcesDialog extends JelloOKCancelDialog {
30
31     protected JamComboBox filesystemCombo;
32     protected JTreeOperator treeOperator;
33
34     /** Creates new SelectSourcesDialog */
35     public SelectSourcesDialog(String JavaDoc title) {
36         super(title);
37         filesystemCombo = this.getJamComboBox(0);
38         treeOperator = new JTreeOperator(Jemmy.getOp(this));
39     }
40     
41     public void expandRow(int index) { //index beginning witgh 1
42
treeOperator.expandRow(index);
43     }
44     
45     public void selectRow(int index) {
46         treeOperator.setSelectionRow(index);
47     }
48     
49     public void collapseRow(int index) {
50         treeOperator.collapseRow(index);
51     }
52     
53     public boolean selectFilesystem(String JavaDoc name) {
54         for(int i=0;i<filesystemCombo.getItemCount();i++) {
55             String JavaDoc selectedName = filesystemCombo.getItemAt(i).toString();
56             StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(selectedName);
57             int startingAt = selectedName.indexOf("displayName=");
58             buffer.delete(0, startingAt+"displayName=".length());
59             buffer.deleteCharAt(buffer.length()-1);
60             if(name.equals(buffer.toString())) {
61                 filesystemCombo.setSelectedItem(i);
62                 return true;
63             }
64         }
65         return false;
66     }
67     
68     public void setSelectedItem(int index) {
69         filesystemCombo.setSelectedItem(index);
70     }
71     
72     public String JavaDoc getSelectedFilesystem() {
73         return filesystemCombo.getSelectedItem();
74     }
75     
76     public String JavaDoc findPath(String JavaDoc name) {
77         return null;
78     }
79     
80     public void expandPath(String JavaDoc[] pathString) {
81         TreePath JavaDoc path = treeOperator.findPath(pathString, false, false);
82         treeOperator.expandPath(path);
83     }
84     
85     public void selectPath(String JavaDoc[] pathString) {
86         TreePath JavaDoc path = treeOperator.findPath(pathString, false, false);
87         treeOperator.selectPath(path);
88     }
89     
90 }
91
Popular Tags