KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jemmyI18NWizard > wizardSupport > Page2


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.jemmy.operators.JTableOperator;
23
24 import org.netbeans.test.oo.gui.jam.JamComboBox;
25 import org.netbeans.test.oo.gui.jam.Jemmy;
26 import org.netbeans.test.oo.gui.jello.JelloWizard;
27 import org.netbeans.test.oo.gui.jello.JelloBundle;
28 import org.netbeans.test.oo.gui.jello.JelloUtilities;
29
30 import org.netbeans.modules.i18n.HardCodedString;
31 import org.netbeans.modules.i18n.I18nString;
32
33
34 public class Page2 extends JelloWizard {
35
36     protected JamComboBox sourceSelectionComboBox;
37     public JTableOperator foundStringTable;
38
39     private static final String JavaDoc wizardBundle = "org.netbeans.modules.i18n.wizard.Bundle";
40     
41     public Page2() {
42         super(JelloUtilities.getForteFrame(), JelloBundle.getString(wizardBundle, "LBL_WizardTitle"));
43         sourceSelectionComboBox = this.getJamComboBox(0);
44         foundStringTable = new JTableOperator(Jemmy.getOp(this));
45     }
46     
47     public void clearTableSelection() {
48         foundStringTable.clearSelection();
49     }
50     
51     public String JavaDoc getColumnName(int index) {
52         return foundStringTable.getColumnName(index);
53     }
54     
55     private boolean isCellEditable(int rowIndex, int columnIndex) {
56         return foundStringTable.isCellEditable(rowIndex, columnIndex);
57     }
58     
59     public Object JavaDoc getCell(int rowIndex, int columnIndex) {
60         return foundStringTable.getValueAt(rowIndex, columnIndex);
61     }
62     
63     public void setCell(Object JavaDoc object, int rowIndex, int columnIndex) {
64         foundStringTable.setValueAt(object, rowIndex, columnIndex);
65     }
66     
67     public void selectRow(int index) {
68         foundStringTable.setRowSelectionInterval(index, index);
69     }
70     
71     public void selectRows(int index1, int index2) {
72         foundStringTable.setRowSelectionInterval(index1, index2);
73     }
74     
75     public int getSelectedRow() {
76         return foundStringTable.getSelectedRow();
77     }
78     
79     public int[] getSelectedRows() {
80         return foundStringTable.getSelectedRows();
81     }
82     
83     public int getSelectedColumn() {
84         return foundStringTable.getSelectedColumn();
85     }
86     
87     public void selectSource(int index) {
88         sourceSelectionComboBox.setSelectedItem(index);
89     }
90     
91     public void selectSource(String JavaDoc source) {
92         sourceSelectionComboBox.setSelectedItem(source);
93     }
94     
95     public String JavaDoc getSelectedSource() {
96         return sourceSelectionComboBox.getSelectedItem();
97     }
98     
99     public int getSelectedItemIndex() {
100         return sourceSelectionComboBox.getSelectedIndex();
101     }
102     
103     public String JavaDoc getHardcodedString(int rowIndex) {
104         HardCodedString hardcodedString = (HardCodedString)this.getCell(rowIndex,1);
105         return hardcodedString.getText();
106     }
107     
108     public String JavaDoc getKey(int rowIndex) {
109         I18nString string = (I18nString)this.getCell(rowIndex,2);
110         return string.getKey();
111     }
112     
113     public String JavaDoc getValue(int rowIndex) {
114         I18nString string = (I18nString)this.getCell(rowIndex,3);
115         return string.getValue();
116     }
117     
118     public boolean getEnabled(int rowIndex) {
119         Boolean JavaDoc enabled = (Boolean JavaDoc)this.getCell(rowIndex,0);
120         return enabled.booleanValue();
121     }
122     
123     public String JavaDoc getComment(int rowIndex) {
124         I18nString string = (I18nString)this.getCell(rowIndex,3);
125         return string.getComment();
126     }
127     
128     public void setKey(int rowIndex, String JavaDoc key) {
129         I18nString string = (I18nString)this.getCell(rowIndex,2);
130         string.setKey(key);
131     }
132     
133     public void setValue(int rowIndex, String JavaDoc value) {
134         I18nString string = (I18nString)this.getCell(rowIndex,2);
135         string.setValue(value);
136     }
137     
138     public void setEnabled(int rowIndex, boolean enabled) {
139         this.setCell(enabled ? Boolean.TRUE : Boolean.FALSE, rowIndex, 0);
140     }
141     
142     public void setComment(int rowIndex, String JavaDoc comment) {
143         I18nString string = (I18nString)this.getCell(rowIndex,3);
144         string.setComment(comment);
145     }
146     
147     /** Dummy here. */
148     protected void updatePanel(int panelIndex) {
149     }
150     
151 }
152
153
154
Popular Tags