001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package gui.window;
043:
044: import org.netbeans.jellytools.PaletteOperator;
045: import org.netbeans.jellytools.TopComponentOperator;
046: import org.netbeans.jellytools.properties.PropertySheetOperator;
047: import org.netbeans.jemmy.QueueTool;
048: import org.netbeans.jemmy.TimeoutExpiredException;
049: import org.netbeans.jemmy.operators.ComponentOperator;
050:
051: /**
052: *
053: * @author mkhramov@netbeans.org, mmirilovic@netbeans.org
054: */
055: public class JSFComponentOptionsDialog extends
056: org.netbeans.performance.test.utilities.PerformanceTestCase {
057:
058: protected PaletteComponentOperator palette;
059: protected WebFormDesignerOperator surface;
060: protected String categoryName;
061: protected String componentName;
062: protected java.awt.Point addPoint;
063:
064: /** Creates a new instance of JSFComponentOptionsDialog */
065: public JSFComponentOptionsDialog(String testName) {
066: super (testName);
067: }
068:
069: /**
070: *
071: * @param testName
072: * @param performanceDataName
073: */
074: public JSFComponentOptionsDialog(String testName,
075: String performanceDataName) {
076: super (testName, performanceDataName);
077: }
078:
079: public void initialize() {
080: log("::initialize");
081:
082: PaletteOperator.invoke();
083: openPageAndAddComponent();
084: }
085:
086: private void openPageAndAddComponent() throws Error {
087: surface = gui.VWPUtilities.openedWebDesignerForJspFile(
088: "VisualWebProject", "Page1");
089: palette = new PaletteComponentOperator();
090:
091: //Select component in palette
092: palette.getCategoryListOperator(categoryName).selectItem(
093: componentName);
094:
095: //Click on design surface to add selected component on page
096: surface.clickOnSurface(new Double(addPoint.getX()).intValue(),
097: new Double(addPoint.getY()).intValue());
098:
099: long click1 = System.currentTimeMillis();
100: log(":: click on surface");
101: //Click some other surface point to make added component deselected
102:
103: new QueueTool().waitEmpty();
104: long click2 = System.currentTimeMillis();
105: surface.clickOnSurface(10, 10);
106: log(":: click on surface");
107: log(":: Delta = " + (click2 - click1));
108: waitNoEvent(5000);
109: }
110:
111: public void prepare() {
112: log("::prepare");
113: surface = WebFormDesignerOperator.findWebFormDesignerOperator(
114: "Page1", false);
115: }
116:
117: public ComponentOperator open() {
118: log("::open");
119: return null;
120: }
121:
122: protected void shutdown() {
123: log(":: shutdown");
124: surface.closeDiscard();
125: try {
126: //new TopComponentOperator(org.netbeans.jellytools.Bundle.getString("org.netbeans.modules.visualweb.ravehelp.dynamichelp.Bundle", "MSG_DynamicHelpTab_name")).close();
127: new PropertySheetOperator("Page1").close();
128:
129: } catch (TimeoutExpiredException timeoutExpiredException) {
130: //do nothing...can be not opened properties and help tabs
131: }
132: }
133:
134: }
|