01: /*
02: DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03:
04: Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05:
06:
07: The contents of this file are subject to the terms of either the GNU
08: General Public License Version 2 only ("GPL") or the Common
09: Development and Distribution License("CDDL") (collectively, the
10: "License"). You may not use this file except in compliance with the
11: License. You can obtain a copy of the License at
12: http://www.netbeans.org/cddl-gplv2.html
13: or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14: specific language governing permissions and limitations under the
15: License. When distributing the software, include this License Header
16: Notice in each file and include the License file at
17: nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
18: particular file as subject to the "Classpath" exception as provided
19: by Sun in the GPL Version 2 section of the License file that
20: accompanied this code. If applicable, add the following below the
21: License Header, with the fields enclosed by brackets [] replaced by
22: your own identifying information:
23: "Portions Copyrighted [year] [name of copyright owner]"
24:
25: Contributor(s):
26:
27: The Original Software is NetBeans. The Initial Developer of the Original
28: Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
29: Microsystems, Inc. All Rights Reserved.
30:
31: If you wish your version of this file to be governed by only the CDDL
32: or only the GPL Version 2, indicate your decision by adding
33: "[Contributor] elects to include this software in this distribution
34: under the [CDDL or GPL Version 2] license." If you do not indicate a
35: single choice of license, a recipient has the option to distribute
36: your version of this file under either the CDDL, the GPL Version 2 or
37: to extend the choice of license to its licensees as provided above.
38: However, if you add GPL Version 2 code and therefore, elected the GPL
39: Version 2 license, then the option applies only if the new code is
40: made subject to such option by the copyright holder.
41: */
42: package org.netbeans.test.dataprovider.cachedrowsetdataprovider;
43:
44: import java.awt.*;
45: import javax.swing.tree.*;
46: import org.netbeans.jemmy.*;
47: import org.netbeans.modules.visualweb.gravy.*;
48: import org.netbeans.modules.visualweb.gravy.designer.*;
49: import org.netbeans.modules.visualweb.gravy.toolbox.*;
50: import org.netbeans.test.dataprovider.common.*;
51:
52: public class TextFieldPageBeanDataProvider extends JSFComponent {
53: public TextFieldPageBeanDataProvider() {
54: this ("textField1"); // default Text Field id
55: }
56:
57: public TextFieldPageBeanDataProvider(String componentID) {
58: componentName = COMPONENT_TEXT_FIELD_NAME;
59: this .componentID = componentID;
60: dbTableName = DB_TABLE_PERSON;
61: }
62:
63: public String makeTextField() {
64: String errMsg = null;
65: try {
66: putVisualComponentOnDesigner(250, 25);
67: // now jSF component is selected in Navigator
68: String newID = TestPropertiesHandler
69: .getTestProperty("ID_TextField_DataBinding");
70: changeComponentID(newID); // component should be selected
71: componentPoint = getComponentPoint(); // component should be selected
72: Utils.doSaveAll();
73: putDBTableOnComponent();
74: Utils.doSaveAll();
75: } catch (Exception e) {
76: e.printStackTrace(Utils.logStream);
77: errMsg = (e.getMessage() == null ? e.toString() : e
78: .getMessage());
79: }
80: return errMsg;
81: }
82:
83: @Override
84: protected void putDBTableOnComponent() {
85: String dbURL = TestPropertiesHandler
86: .getDatabaseProperty("DB_URL"), rowSetName = TestPropertiesHandler
87: .getTestProperty("ID_RowSet_TextField_DataBinding"), dataProviderName = TestPropertiesHandler
88: .getTestProperty("ID_DataProvider_TextField_DataBinding");
89:
90: Utils.putDBTableOnComponent(dbURL, dbTableName, componentPoint,
91: rowSetName, 3, 2);
92: checkRowSetAppearance(NAVIGATOR_TREE_NODE_SESSION_PREFIX
93: + rowSetName);
94: checkDataProviderAppearance(NAVIGATOR_TREE_NODE_PAGE_PREFIX
95: + dataProviderName);
96: }
97: }
|