1.1 --- a/visualweb.dataprovider/build.xml Thu Jul 10 04:29:52 2008 -0700
1.2 +++ b/visualweb.dataprovider/build.xml Thu Jul 10 04:32:50 2008 -0700
1.3 @@ -58,7 +58,9 @@
1.4 </target>
1.5
1.6 <target name="javadoc-zip-init">
1.7 - <ant dir="library" target="javadoc-zip" inheritAll="false"/>
1.8 + <ant dir="library" target="javadoc-zip" inheritAll="false">
1.9 + <property name="no.javadoc.preview" value="true"/>
1.10 + </ant>
1.11 </target>
1.12
1.13 <target name="netbeans-extra" depends="init">
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/visualweb.gravy/build.xml Thu Jul 10 04:32:50 2008 -0700
2.3 @@ -0,0 +1,46 @@
2.4 +<?xml version="1.0" encoding="UTF-8"?>
2.5 +<!--
2.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.7 +
2.8 +Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
2.9 +
2.10 +
2.11 +The contents of this file are subject to the terms of either the GNU
2.12 +General Public License Version 2 only ("GPL") or the Common
2.13 +Development and Distribution License("CDDL") (collectively, the
2.14 +"License"). You may not use this file except in compliance with the
2.15 +License. You can obtain a copy of the License at
2.16 +http://www.netbeans.org/cddl-gplv2.html
2.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.18 +specific language governing permissions and limitations under the
2.19 +License. When distributing the software, include this License Header
2.20 +Notice in each file and include the License file at
2.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
2.22 +particular file as subject to the "Classpath" exception as provided
2.23 +by Sun in the GPL Version 2 section of the License file that
2.24 +accompanied this code. If applicable, add the following below the
2.25 +License Header, with the fields enclosed by brackets [] replaced by
2.26 +your own identifying information:
2.27 +"Portions Copyrighted [year] [name of copyright owner]"
2.28 +
2.29 +Contributor(s):
2.30 +
2.31 +The Original Software is NetBeans. The Initial Developer of the Original
2.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
2.33 +Microsystems, Inc. All Rights Reserved.
2.34 +
2.35 +If you wish your version of this file to be governed by only the CDDL
2.36 +or only the GPL Version 2, indicate your decision by adding
2.37 +"[Contributor] elects to include this software in this distribution
2.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
2.39 +single choice of license, a recipient has the option to distribute
2.40 +your version of this file under either the CDDL, the GPL Version 2 or
2.41 +to extend the choice of license to its licensees as provided above.
2.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
2.43 +Version 2 license, then the option applies only if the new code is
2.44 +made subject to such option by the copyright holder.
2.45 +-->
2.46 +<project basedir="." default="netbeans" name="visualweb.gravy">
2.47 + <description>Builds, tests, and runs the project org.netbeans.modules.visualweb.gravy</description>
2.48 + <import file="../nbbuild/templates/projectized.xml"/>
2.49 +</project>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/visualweb.gravy/manifest.mf Thu Jul 10 04:32:50 2008 -0700
3.3 @@ -0,0 +1,5 @@
3.4 +Manifest-Version: 1.0
3.5 +OpenIDE-Module: org.netbeans.modules.visualweb.gravy
3.6 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visualweb/gravy/Bundle.properties
3.7 +OpenIDE-Module-Specification-Version: 1.0
3.8 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/visualweb.gravy/nbproject/project.properties Thu Jul 10 04:32:50 2008 -0700
4.3 @@ -0,0 +1,42 @@
4.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.5 +#
4.6 +# Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
4.7 +#
4.8 +# The contents of this file are subject to the terms of either the GNU
4.9 +# General Public License Version 2 only ("GPL") or the Common
4.10 +# Development and Distribution License("CDDL") (collectively, the
4.11 +# "License"). You may not use this file except in compliance with the
4.12 +# License. You can obtain a copy of the License at
4.13 +# http://www.netbeans.org/cddl-gplv2.html
4.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.15 +# specific language governing permissions and limitations under the
4.16 +# License. When distributing the software, include this License Header
4.17 +# Notice in each file and include the License file at
4.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
4.19 +# particular file as subject to the "Classpath" exception as provided
4.20 +# by Sun in the GPL Version 2 section of the License file that
4.21 +# accompanied this code. If applicable, add the following below the
4.22 +# License Header, with the fields enclosed by brackets [] replaced by
4.23 +# your own identifying information:
4.24 +# "Portions Copyrighted [year] [name of copyright owner]"
4.25 +#
4.26 +# Contributor(s):
4.27 +#
4.28 +# The Original Software is NetBeans. The Initial Developer of the Original
4.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
4.30 +# Microsystems, Inc. All Rights Reserved.
4.31 +#
4.32 +# If you wish your version of this file to be governed by only the CDDL
4.33 +# or only the GPL Version 2, indicate your decision by adding
4.34 +# "[Contributor] elects to include this software in this distribution
4.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
4.36 +# single choice of license, a recipient has the option to distribute
4.37 +# your version of this file under either the CDDL, the GPL Version 2 or
4.38 +# to extend the choice of license to its licensees as provided above.
4.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
4.40 +# Version 2 license, then the option applies only if the new code is
4.41 +# made subject to such option by the copyright holder.
4.42 +
4.43 +is.autoload=true
4.44 +javac.source=1.5
4.45 +javac.compilerargs=-Xlint -Xlint:-serial
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/visualweb.gravy/nbproject/project.xml Thu Jul 10 04:32:50 2008 -0700
5.3 @@ -0,0 +1,314 @@
5.4 +<?xml version="1.0" encoding="UTF-8"?>
5.5 +<!--
5.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.7 +
5.8 +Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
5.9 +
5.10 +
5.11 +The contents of this file are subject to the terms of either the GNU
5.12 +General Public License Version 2 only ("GPL") or the Common
5.13 +Development and Distribution License("CDDL") (collectively, the
5.14 +"License"). You may not use this file except in compliance with the
5.15 +License. You can obtain a copy of the License at
5.16 +http://www.netbeans.org/cddl-gplv2.html
5.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.18 +specific language governing permissions and limitations under the
5.19 +License. When distributing the software, include this License Header
5.20 +Notice in each file and include the License file at
5.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
5.22 +particular file as subject to the "Classpath" exception as provided
5.23 +by Sun in the GPL Version 2 section of the License file that
5.24 +accompanied this code. If applicable, add the following below the
5.25 +License Header, with the fields enclosed by brackets [] replaced by
5.26 +your own identifying information:
5.27 +"Portions Copyrighted [year] [name of copyright owner]"
5.28 +
5.29 +Contributor(s):
5.30 +
5.31 +The Original Software is NetBeans. The Initial Developer of the Original
5.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
5.33 +Microsystems, Inc. All Rights Reserved.
5.34 +
5.35 +If you wish your version of this file to be governed by only the CDDL
5.36 +or only the GPL Version 2, indicate your decision by adding
5.37 +"[Contributor] elects to include this software in this distribution
5.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
5.39 +single choice of license, a recipient has the option to distribute
5.40 +your version of this file under either the CDDL, the GPL Version 2 or
5.41 +to extend the choice of license to its licensees as provided above.
5.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
5.43 +Version 2 license, then the option applies only if the new code is
5.44 +made subject to such option by the copyright holder.
5.45 +-->
5.46 +<project xmlns="http://www.netbeans.org/ns/project/1">
5.47 + <type>org.netbeans.modules.apisupport.project</type>
5.48 + <configuration>
5.49 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
5.50 + <code-name-base>org.netbeans.modules.visualweb.gravy</code-name-base>
5.51 + <module-dependencies>
5.52 + <dependency>
5.53 + <code-name-base>org.netbeans.core.windows</code-name-base>
5.54 + <build-prerequisite/>
5.55 + <compile-dependency/>
5.56 + <run-dependency>
5.57 + <release-version>2</release-version>
5.58 + <implementation-version/>
5.59 + </run-dependency>
5.60 + </dependency>
5.61 + <dependency>
5.62 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
5.63 + <build-prerequisite/>
5.64 + <compile-dependency/>
5.65 + <run-dependency>
5.66 + <specification-version>1.0</specification-version>
5.67 + </run-dependency>
5.68 + </dependency>
5.69 + <dependency>
5.70 + <code-name-base>org.netbeans.modules.db.sql.visualeditor</code-name-base>
5.71 + <build-prerequisite/>
5.72 + <compile-dependency/>
5.73 + <run-dependency>
5.74 + <release-version>1</release-version>
5.75 + <implementation-version/>
5.76 + </run-dependency>
5.77 + </dependency>
5.78 + <dependency>
5.79 + <code-name-base>org.netbeans.modules.editor.completion</code-name-base>
5.80 + <build-prerequisite/>
5.81 + <compile-dependency/>
5.82 + <run-dependency>
5.83 + <release-version>1</release-version>
5.84 + <specification-version>1.12</specification-version>
5.85 + </run-dependency>
5.86 + </dependency>
5.87 + <dependency>
5.88 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
5.89 + <build-prerequisite/>
5.90 + <compile-dependency/>
5.91 + <run-dependency>
5.92 + <release-version>1</release-version>
5.93 + <specification-version>1.27</specification-version>
5.94 + </run-dependency>
5.95 + </dependency>
5.96 + <dependency>
5.97 + <code-name-base>org.netbeans.modules.jellytools</code-name-base>
5.98 + <build-prerequisite/>
5.99 + <compile-dependency/>
5.100 + <run-dependency>
5.101 + <release-version>2</release-version>
5.102 + <specification-version>2.0</specification-version>
5.103 + </run-dependency>
5.104 + </dependency>
5.105 + <dependency>
5.106 + <code-name-base>org.netbeans.modules.jemmy</code-name-base>
5.107 + <build-prerequisite/>
5.108 + <compile-dependency/>
5.109 + <run-dependency>
5.110 + <release-version>3</release-version>
5.111 + <specification-version>3.0</specification-version>
5.112 + </run-dependency>
5.113 + </dependency>
5.114 + <dependency>
5.115 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
5.116 + <build-prerequisite/>
5.117 + <compile-dependency/>
5.118 + <run-dependency>
5.119 + <release-version>1</release-version>
5.120 + <specification-version>1.52</specification-version>
5.121 + </run-dependency>
5.122 + </dependency>
5.123 + <dependency>
5.124 + <code-name-base>org.netbeans.modules.utilities</code-name-base>
5.125 + <build-prerequisite/>
5.126 + <compile-dependency/>
5.127 + <run-dependency>
5.128 + <release-version>1</release-version>
5.129 + <implementation-version/>
5.130 + </run-dependency>
5.131 + </dependency>
5.132 + <dependency>
5.133 + <code-name-base>org.netbeans.modules.visualweb.dataconnectivity</code-name-base>
5.134 + <build-prerequisite/>
5.135 + <compile-dependency/>
5.136 + <run-dependency>
5.137 + <release-version>1</release-version>
5.138 + <implementation-version/>
5.139 + </run-dependency>
5.140 + </dependency>
5.141 + <dependency>
5.142 + <code-name-base>org.netbeans.modules.visualweb.designer</code-name-base>
5.143 + <build-prerequisite/>
5.144 + <compile-dependency/>
5.145 + <run-dependency>
5.146 + <release-version>1</release-version>
5.147 + <implementation-version/>
5.148 + </run-dependency>
5.149 + </dependency>
5.150 + <dependency>
5.151 + <code-name-base>org.netbeans.modules.visualweb.designer.html</code-name-base>
5.152 + <build-prerequisite/>
5.153 + <compile-dependency/>
5.154 + <run-dependency>
5.155 + <implementation-version/>
5.156 + </run-dependency>
5.157 + </dependency>
5.158 + <dependency>
5.159 + <code-name-base>org.netbeans.modules.visualweb.designer.jsf</code-name-base>
5.160 + <build-prerequisite/>
5.161 + <compile-dependency/>
5.162 + <run-dependency>
5.163 + <implementation-version/>
5.164 + </run-dependency>
5.165 + </dependency>
5.166 + <dependency>
5.167 + <code-name-base>org.netbeans.modules.visualweb.designer.markup</code-name-base>
5.168 + <build-prerequisite/>
5.169 + <compile-dependency/>
5.170 + <run-dependency>
5.171 + <release-version>1</release-version>
5.172 + <implementation-version/>
5.173 + </run-dependency>
5.174 + </dependency>
5.175 + <dependency>
5.176 + <code-name-base>org.netbeans.modules.visualweb.designtime</code-name-base>
5.177 + <build-prerequisite/>
5.178 + <compile-dependency/>
5.179 + <run-dependency>
5.180 + <release-version>1</release-version>
5.181 + <implementation-version/>
5.182 + </run-dependency>
5.183 + </dependency>
5.184 + <dependency>
5.185 + <code-name-base>org.netbeans.modules.visualweb.insync</code-name-base>
5.186 + <build-prerequisite/>
5.187 + <compile-dependency/>
5.188 + <run-dependency>
5.189 + <release-version>1</release-version>
5.190 + <implementation-version/>
5.191 + </run-dependency>
5.192 + </dependency>
5.193 + <dependency>
5.194 + <code-name-base>org.netbeans.modules.visualweb.jsfsupport.components</code-name-base>
5.195 + <build-prerequisite/>
5.196 + <compile-dependency/>
5.197 + <run-dependency>
5.198 + <implementation-version/>
5.199 + </run-dependency>
5.200 + </dependency>
5.201 + <dependency>
5.202 + <code-name-base>org.netbeans.modules.visualweb.navigation</code-name-base>
5.203 + <run-dependency>
5.204 + <specification-version>1.3</specification-version>
5.205 + </run-dependency>
5.206 + </dependency>
5.207 + <dependency>
5.208 + <code-name-base>org.netbeans.modules.visualweb.outline</code-name-base>
5.209 + <build-prerequisite/>
5.210 + <compile-dependency/>
5.211 + <run-dependency>
5.212 + <implementation-version/>
5.213 + </run-dependency>
5.214 + </dependency>
5.215 + <dependency>
5.216 + <code-name-base>org.netbeans.modules.visualweb.xhtml</code-name-base>
5.217 + <build-prerequisite/>
5.218 + <compile-dependency/>
5.219 + <run-dependency>
5.220 + <implementation-version/>
5.221 + </run-dependency>
5.222 + </dependency>
5.223 + <dependency>
5.224 + <code-name-base>org.netbeans.soa.libs.httpunit</code-name-base>
5.225 + <build-prerequisite/>
5.226 + <compile-dependency/>
5.227 + <run-dependency>
5.228 + <release-version>1</release-version>
5.229 + <implementation-version/>
5.230 + </run-dependency>
5.231 + </dependency>
5.232 + <dependency>
5.233 + <code-name-base>org.netbeans.spi.palette</code-name-base>
5.234 + <build-prerequisite/>
5.235 + <compile-dependency/>
5.236 + <run-dependency>
5.237 + <release-version>1</release-version>
5.238 + <specification-version>1.14</specification-version>
5.239 + </run-dependency>
5.240 + </dependency>
5.241 + <dependency>
5.242 + <code-name-base>org.netbeans.swing.tabcontrol</code-name-base>
5.243 + <build-prerequisite/>
5.244 + <compile-dependency/>
5.245 + <run-dependency>
5.246 + <specification-version>1.13</specification-version>
5.247 + </run-dependency>
5.248 + </dependency>
5.249 + <dependency>
5.250 + <code-name-base>org.openide.awt</code-name-base>
5.251 + <build-prerequisite/>
5.252 + <compile-dependency/>
5.253 + <run-dependency>
5.254 + <specification-version>7.2</specification-version>
5.255 + </run-dependency>
5.256 + </dependency>
5.257 + <dependency>
5.258 + <code-name-base>org.openide.explorer</code-name-base>
5.259 + <build-prerequisite/>
5.260 + <compile-dependency/>
5.261 + <run-dependency>
5.262 + <specification-version>6.15</specification-version>
5.263 + </run-dependency>
5.264 + </dependency>
5.265 + <dependency>
5.266 + <code-name-base>org.openide.filesystems</code-name-base>
5.267 + <build-prerequisite/>
5.268 + <compile-dependency/>
5.269 + <run-dependency>
5.270 + <specification-version>7.9</specification-version>
5.271 + </run-dependency>
5.272 + </dependency>
5.273 + <dependency>
5.274 + <code-name-base>org.openide.loaders</code-name-base>
5.275 + <build-prerequisite/>
5.276 + <compile-dependency/>
5.277 + <run-dependency>
5.278 + <specification-version>7.1</specification-version>
5.279 + </run-dependency>
5.280 + </dependency>
5.281 + <dependency>
5.282 + <code-name-base>org.openide.nodes</code-name-base>
5.283 + <build-prerequisite/>
5.284 + <compile-dependency/>
5.285 + <run-dependency>
5.286 + <specification-version>7.5</specification-version>
5.287 + </run-dependency>
5.288 + </dependency>
5.289 + <dependency>
5.290 + <code-name-base>org.openide.text</code-name-base>
5.291 + <build-prerequisite/>
5.292 + <compile-dependency/>
5.293 + <run-dependency>
5.294 + <specification-version>6.20</specification-version>
5.295 + </run-dependency>
5.296 + </dependency>
5.297 + <dependency>
5.298 + <code-name-base>org.openide.util</code-name-base>
5.299 + <build-prerequisite/>
5.300 + <compile-dependency/>
5.301 + <run-dependency>
5.302 + <specification-version>7.15</specification-version>
5.303 + </run-dependency>
5.304 + </dependency>
5.305 + <dependency>
5.306 + <code-name-base>org.openide.windows</code-name-base>
5.307 + <build-prerequisite/>
5.308 + <compile-dependency/>
5.309 + <run-dependency>
5.310 + <specification-version>6.23</specification-version>
5.311 + </run-dependency>
5.312 + </dependency>
5.313 + </module-dependencies>
5.314 + <public-packages/>
5.315 + </data>
5.316 + </configuration>
5.317 +</project>
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/Action.java Thu Jul 10 04:32:50 2008 -0700
6.3 @@ -0,0 +1,774 @@
6.4 +/*
6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 + *
6.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6.8 + *
6.9 + * The contents of this file are subject to the terms of either the GNU
6.10 + * General Public License Version 2 only ("GPL") or the Common
6.11 + * Development and Distribution License("CDDL") (collectively, the
6.12 + * "License"). You may not use this file except in compliance with the
6.13 + * License. You can obtain a copy of the License at
6.14 + * http://www.netbeans.org/cddl-gplv2.html
6.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.16 + * specific language governing permissions and limitations under the
6.17 + * License. When distributing the software, include this License Header
6.18 + * Notice in each file and include the License file at
6.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
6.20 + * particular file as subject to the "Classpath" exception as provided
6.21 + * by Sun in the GPL Version 2 section of the License file that
6.22 + * accompanied this code. If applicable, add the following below the
6.23 + * License Header, with the fields enclosed by brackets [] replaced by
6.24 + * your own identifying information:
6.25 + * "Portions Copyrighted [year] [name of copyright owner]"
6.26 + *
6.27 + * Contributor(s):
6.28 + *
6.29 + * The Original Software is NetBeans. The Initial Developer of the Original
6.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
6.31 + * Microsystems, Inc. All Rights Reserved.
6.32 + *
6.33 + * If you wish your version of this file to be governed by only the CDDL
6.34 + * or only the GPL Version 2, indicate your decision by adding
6.35 + * "[Contributor] elects to include this software in this distribution
6.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.37 + * single choice of license, a recipient has the option to distribute
6.38 + * your version of this file under either the CDDL, the GPL Version 2 or
6.39 + * to extend the choice of license to its licensees as provided above.
6.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
6.41 + * Version 2 license, then the option applies only if the new code is
6.42 + * made subject to such option by the copyright holder.
6.43 + */
6.44 +package org.netbeans.modules.visualweb.gravy;
6.45 +
6.46 +import java.awt.Component;
6.47 +import java.awt.Container;
6.48 +import java.awt.EventQueue;
6.49 +import java.awt.event.ActionEvent;
6.50 +import java.awt.event.KeyEvent;
6.51 +import javax.swing.tree.TreePath;
6.52 +
6.53 +import org.netbeans.jellytools.JellyVersion;
6.54 +import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
6.55 +import org.netbeans.jellytools.nodes.Node;
6.56 +import org.netbeans.jemmy.EventTool;
6.57 +import org.netbeans.jemmy.JemmyException;
6.58 +import org.netbeans.jemmy.JemmyProperties;
6.59 +import org.netbeans.jemmy.Timeouts;
6.60 +import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
6.61 +import org.netbeans.jemmy.operators.ComponentOperator;
6.62 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
6.63 +import org.netbeans.jemmy.operators.Operator;
6.64 +import org.netbeans.jemmy.operators.Operator.ComponentVisualizer;
6.65 +import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
6.66 +import org.netbeans.jemmy.operators.Operator.StringComparator;
6.67 +import org.netbeans.jemmy.util.EmptyVisualizer;
6.68 +import org.openide.util.actions.SystemAction;
6.69 +
6.70 +
6.71 +/** Ancestor class for all blocking actions.<p>
6.72 + * It handles performing action through main menu (MENU_MODE), popup menu
6.73 + * (POPUP_MODE), IDE SystemAction API call (API_MODE) or through keyboard shortcut
6.74 + * (SHORTCUT_MODE).<p>
6.75 + * Action can be performed in exact mode by calling performMenu(...),
6.76 + * performPopup(...), performAPI(...) or performShortcut(...).<p>
6.77 + * If exact mode is not supported by the action it throws
6.78 + * UnsupportedOperationException.<p>
6.79 + * Current implementation supports MENU_MODE when menuPath is defined, POPUP_MODE
6.80 + * when popupPath is defined, API_MODE when systemActionClass is defined and
6.81 + * SHORTCUT_MODE when shorcut is defined (see Action constructors).<p>
6.82 + * Action also can be performed using runtime default mode by calling perform(...).<p>
6.83 + * When default mode is not support by the action other modes are tried till
6.84 + * supported mode found and action is performed.
6.85 + *
6.86 + * <BR>Timeouts used: <BR>
6.87 + * Action.WaitAfterShortcutTimeout - time to sleep between shortcuts in sequence (default 0) <BR>
6.88 + *
6.89 + * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
6.90 +public class Action {
6.91 +
6.92 + /** through menu action performing mode */
6.93 + public static final int MENU_MODE = 0;
6.94 + /** through popup menu action performing mode */
6.95 + public static final int POPUP_MODE = 1;
6.96 + /** through API action performing mode */
6.97 + public static final int API_MODE = 2;
6.98 + /** through shortcut action performing mode */
6.99 + public static final int SHORTCUT_MODE = 3;
6.100 +
6.101 + /** sleep time between nodes selection and action execution */
6.102 + protected static final long SELECTION_WAIT_TIME = 300;
6.103 + /** sleep time after action execution */
6.104 + protected static final long AFTER_ACTION_WAIT_TIME = 0;
6.105 + /** sleep time between sequence of shortcuts */
6.106 + protected static final long WAIT_AFTER_SHORTCUT_TIMEOUT = 0;
6.107 +
6.108 + private static final int sequence[][] = {{MENU_MODE, POPUP_MODE, SHORTCUT_MODE, API_MODE},
6.109 + {POPUP_MODE, MENU_MODE, SHORTCUT_MODE, API_MODE},
6.110 + {API_MODE, POPUP_MODE, MENU_MODE, SHORTCUT_MODE},
6.111 + {SHORTCUT_MODE, POPUP_MODE, MENU_MODE, API_MODE}};
6.112 +
6.113 + /** menu path of current action or null when MENU_MODE is not supported */
6.114 + protected String menuPath;
6.115 + /** popup menu path of current action or null when POPUP_MODE is not supported */
6.116 + protected String popupPath;
6.117 + /** SystemAction class of current action or null when API_MODE is not supported */
6.118 + protected Class systemActionClass;
6.119 + /** array of shortcuts of current action or null when SHORTCUT_MODE is not supported */
6.120 + protected Shortcut[] shortcuts;
6.121 +
6.122 + /** Comparator used as default for all Action instances. It is set in static clause. */
6.123 + private static StringComparator defaultComparator;
6.124 + /** Comparator used for this action instance. */
6.125 + private StringComparator comparator;
6.126 +
6.127 + /** creates new Action instance without API_MODE and SHORTCUT_MODE support
6.128 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
6.129 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
6.130 + public Action(String menuPath, String popupPath) {
6.131 + this(menuPath, popupPath, null, (Shortcut[])null);
6.132 + }
6.133 +
6.134 + /** creates new Action instance without SHORTCUT_MODE support
6.135 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
6.136 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
6.137 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
6.138 + public Action(String menuPath, String popupPath, String systemActionClass) {
6.139 + this(menuPath, popupPath, systemActionClass, (Shortcut[])null);
6.140 + }
6.141 +
6.142 + /** creates new Action instance without API_MODE support
6.143 + * @param shortcuts array of Shortcut instances (use null value if shorcut mode is not supported)
6.144 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
6.145 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
6.146 + public Action(String menuPath, String popupPath, Shortcut[] shortcuts) {
6.147 + this(menuPath, popupPath, null, shortcuts);
6.148 + }
6.149 +
6.150 + /** creates new Action instance without API_MODE support
6.151 + * @param shortcut Shortcut (use null value if menu mode is not supported)
6.152 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
6.153 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
6.154 + public Action(String menuPath, String popupPath, Shortcut shortcut) {
6.155 + this(menuPath, popupPath, null, new Shortcut[] {shortcut});
6.156 + }
6.157 +
6.158 + /** creates new Action instance
6.159 + * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
6.160 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
6.161 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
6.162 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
6.163 + public Action(String menuPath, String popupPath, String systemActionClass, Shortcut[] shortcuts) {
6.164 + this.menuPath = menuPath;
6.165 + this.popupPath = popupPath;
6.166 + if (systemActionClass==null) {
6.167 + this.systemActionClass = null;
6.168 + } else try {
6.169 + this.systemActionClass = Class.forName(systemActionClass);
6.170 + } catch (ClassNotFoundException e) {
6.171 + this.systemActionClass = null;
6.172 + }
6.173 + this.shortcuts = shortcuts;
6.174 + }
6.175 +
6.176 + /** creates new Action instance
6.177 + * @param shortcut Shortcut String (use null value if menu mode is not supported)
6.178 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
6.179 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
6.180 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
6.181 + public Action(String menuPath, String popupPath, String systemActionClass, Shortcut shortcut) {
6.182 + this(menuPath, popupPath, systemActionClass, new Shortcut[] {shortcut});
6.183 + }
6.184 +
6.185 + static {
6.186 + // Checks if you run on correct jemmy version. Writes message to jemmy log if not.
6.187 + JellyVersion.checkJemmyVersion();
6.188 +
6.189 + if (JemmyProperties.getCurrentProperty("Action.DefaultMode")==null)
6.190 + JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(POPUP_MODE));
6.191 + Timeouts.initDefault("Action.WaitAfterShortcutTimeout", WAIT_AFTER_SHORTCUT_TIMEOUT);
6.192 + // Set case sensitive comparator as default because of
6.193 + // very often clash between Cut and Execute menu items.
6.194 + // Substring criterion is set according to default string comparator
6.195 + boolean compareExactly = !Operator.getDefaultStringComparator().equals("abc", "a"); // NOI18N
6.196 + defaultComparator = new DefaultStringComparator(compareExactly, true);
6.197 + }
6.198 +
6.199 + private void perform(int mode) {
6.200 + switch (mode) {
6.201 + case POPUP_MODE: performPopup(); break;
6.202 + case MENU_MODE: performMenu(); break;
6.203 + case API_MODE: performAPI(); break;
6.204 + case SHORTCUT_MODE: performShortcut(); break;
6.205 + default: throw new IllegalArgumentException("Wrong Action.MODE");
6.206 + }
6.207 + }
6.208 +
6.209 + private void perform(Node node, int mode) {
6.210 + switch (mode) {
6.211 + case POPUP_MODE: performPopup(node); break;
6.212 + case MENU_MODE: performMenu(node); break;
6.213 + case API_MODE: performAPI(node); break;
6.214 + case SHORTCUT_MODE: performShortcut(node); break;
6.215 + default: throw new IllegalArgumentException("Wrong Action.MODE");
6.216 + }
6.217 + }
6.218 +
6.219 + private void perform(Node[] nodes, int mode) {
6.220 + switch (mode) {
6.221 + case POPUP_MODE: performPopup(nodes); break;
6.222 + case MENU_MODE: performMenu(nodes); break;
6.223 + case API_MODE: performAPI(nodes); break;
6.224 + case SHORTCUT_MODE: performShortcut(nodes); break;
6.225 + default: throw new IllegalArgumentException("Wrong Action.MODE");
6.226 + }
6.227 + }
6.228 +
6.229 + private void perform(ComponentOperator component, int mode) {
6.230 + switch (mode) {
6.231 + case POPUP_MODE: performPopup(component); break;
6.232 + case MENU_MODE: performMenu(component); break;
6.233 + case API_MODE: performAPI(component); break;
6.234 + case SHORTCUT_MODE: performShortcut(component); break;
6.235 + default: throw new IllegalArgumentException("Wrong Action.MODE");
6.236 + }
6.237 + }
6.238 +
6.239 +
6.240 + /** performs action depending on default mode,<br>
6.241 + * calls performPopup(), performMenu() or performAPI(),<br>
6.242 + * when default mode is not supported, others are tried */
6.243 + public void perform() {
6.244 + int modes[] = sequence[getDefaultMode()];
6.245 + for (int i=0; i<modes.length; i++) try {
6.246 + perform(modes[i]);
6.247 + return;
6.248 + } catch (UnsupportedOperationException e) {}
6.249 + }
6.250 +
6.251 + /** performs action depending on default mode,<br>
6.252 + * calls performPopup(), performMenu() or performAPI(),<br>
6.253 + * when default mode is not supported, others are tried
6.254 + * @param node node to be action performed on */
6.255 + public void perform(Node node) {
6.256 + int modes[] = sequence[getDefaultMode()];
6.257 + for (int i=0; i<modes.length; i++) try {
6.258 + perform(node, modes[i]);
6.259 + return;
6.260 + } catch (UnsupportedOperationException e) {}
6.261 + }
6.262 +
6.263 + /** performs action depending on default mode,<br>
6.264 + * calls performPopup(), performMenu() or performAPI(),<br>
6.265 + * when default mode is not supported, others are tried
6.266 + * @param nodes nodes to be action performed on */
6.267 + public void perform(Node[] nodes) {
6.268 + int modes[] = sequence[getDefaultMode()];
6.269 + for (int i=0; i<modes.length; i++) try {
6.270 + perform(nodes, modes[i]);
6.271 + return;
6.272 + } catch (UnsupportedOperationException e) {}
6.273 + }
6.274 +
6.275 + /** performs action depending on default mode,<br>
6.276 + * calls performPopup(), performMenu() or performAPI(),<br>
6.277 + * when default mode is not supported, others are tried
6.278 + * @param component component to be action performed on */
6.279 + public void perform(ComponentOperator component) {
6.280 + int modes[] = sequence[getDefaultMode()];
6.281 + for (int i=0; i<modes.length; i++) try {
6.282 + perform(component, modes[i]);
6.283 + return;
6.284 + } catch (UnsupportedOperationException e) {}
6.285 + }
6.286 +
6.287 + /** performs action through main menu
6.288 + * @throws UnsupportedOperationException when action does not support menu mode */
6.289 + public void performMenu() {
6.290 + if (menuPath==null) {
6.291 + throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
6.292 + }
6.293 + // Need to wait here to be more reliable.
6.294 + // TBD - It can be removed after issue 23663 is solved.
6.295 + new EventTool().waitNoEvent(500);
6.296 + Util.getMainMenu().pushMenu(menuPath);
6.297 + try {
6.298 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
6.299 + } catch (Exception e) {
6.300 + throw new JemmyException("Sleeping interrupted", e);
6.301 + }
6.302 + }
6.303 +
6.304 + /** performs action through main menu
6.305 + * @param node node to be action performed on
6.306 + * @throws UnsupportedOperationException when action does not support menu mode */
6.307 + public void performMenu(Node node) {
6.308 + performMenu(new Node[]{node});
6.309 + }
6.310 +
6.311 + /** performs action through main menu
6.312 + * @param nodes nodes to be action performed on
6.313 + * @throws UnsupportedOperationException when action does not support menu mode */
6.314 + public void performMenu(Node[] nodes) {
6.315 + if (menuPath==null)
6.316 + throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
6.317 + testNodes(nodes);
6.318 + nodes[0].select();
6.319 + for (int i=1; i<nodes.length; i++)
6.320 + nodes[i].addSelectionPath();
6.321 + try {
6.322 + Thread.sleep(SELECTION_WAIT_TIME);
6.323 + } catch (Exception e) {
6.324 + throw new JemmyException("Sleeping interrupted", e);
6.325 + }
6.326 + performMenu();
6.327 + }
6.328 +
6.329 + /** performs action through main menu
6.330 + * @param component component to be action performed on
6.331 + * @throws UnsupportedOperationException when action does not support menu mode */
6.332 + public void performMenu(ComponentOperator component) {
6.333 + component.getFocus();
6.334 + try {
6.335 + Thread.sleep(SELECTION_WAIT_TIME);
6.336 + } catch (Exception e) {
6.337 + throw new JemmyException("Sleeping interrupted", e);
6.338 + }
6.339 + performMenu();
6.340 + }
6.341 +
6.342 + /** performs action through popup menu
6.343 + * @throws UnsupportedOperationException */
6.344 + public void performPopup() {
6.345 + throw new UnsupportedOperationException(getClass().toString()+" does not implement performPopup()");
6.346 + }
6.347 +
6.348 + /** performs action through popup menu
6.349 + * @param node node to be action performed on
6.350 + * @throws UnsupportedOperationException when action does not support popup mode */
6.351 + public void performPopup(Node node) {
6.352 + performPopup(new Node[]{node});
6.353 + }
6.354 +
6.355 + /** performs action through popup menu
6.356 + * @param nodes nodes to be action performed on
6.357 + * @throws UnsupportedOperationException when action does not support popup mode */
6.358 + public void performPopup(Node[] nodes) {
6.359 + if (popupPath==null) {
6.360 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
6.361 + }
6.362 + testNodes(nodes);
6.363 + TreePath paths[]=new TreePath[nodes.length];
6.364 + for (int i=0; i<nodes.length; i++) {
6.365 + paths[i]=nodes[i].getTreePath();
6.366 + }
6.367 + ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
6.368 + ComponentVisualizer oldVisualizer = null;
6.369 + // If visualizer of JTreeOperator is EmptyVisualizer, we need
6.370 + // to avoid making tree component visible in callPopup method.
6.371 + // So far only known case is tree from TreeTableOperator.
6.372 + if(treeVisualizer instanceof EmptyVisualizer) {
6.373 + oldVisualizer = Operator.getDefaultComponentVisualizer();
6.374 + Operator.setDefaultComponentVisualizer(treeVisualizer);
6.375 + }
6.376 + // Need to wait here to be more reliable.
6.377 + // TBD - It can be removed after issue 23663 is solved.
6.378 + new EventTool().waitNoEvent(500);
6.379 + JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
6.380 + // restore previously used default visualizer
6.381 + if(oldVisualizer != null) {
6.382 + Operator.setDefaultComponentVisualizer(oldVisualizer);
6.383 + }
6.384 + popup.pushMenu(popupPath, "|", getComparator());
6.385 + try {
6.386 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
6.387 + } catch (Exception e) {
6.388 + throw new JemmyException("Sleeping interrupted", e);
6.389 + }
6.390 + }
6.391 +
6.392 + /** performs action through popup menu
6.393 + * @param component component to be action performed on
6.394 + * @throws UnsupportedOperationException when action does not support popup mode */
6.395 + public void performPopup(ComponentOperator component) {
6.396 + if (popupPath==null) {
6.397 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
6.398 + }
6.399 + // Need to wait here to be more reliable.
6.400 + // TBD - It can be removed after issue 23663 is solved.
6.401 + new EventTool().waitNoEvent(500);
6.402 + component.clickForPopup();
6.403 + new JPopupMenuOperator(component).pushMenu(popupPath, "|", getComparator());
6.404 + try {
6.405 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
6.406 + } catch (Exception e) {
6.407 + throw new JemmyException("Sleeping interrupted", e);
6.408 + }
6.409 + }
6.410 +
6.411 + /** performs action through API
6.412 + * @throws UnsupportedOperationException when action does not support API mode */
6.413 + public void performAPI() {
6.414 + if (systemActionClass==null) {
6.415 + throw new UnsupportedOperationException(getClass().toString()+" does not support API call.");
6.416 + }
6.417 + try {
6.418 + // actions has to be invoked in dispatch thread (see http://www.netbeans.org/issues/show_bug.cgi?id=35755)
6.419 + EventQueue.invokeAndWait(new Runnable() {
6.420 + public void run() {
6.421 + if(SystemAction.class.isAssignableFrom(systemActionClass)) {
6.422 + // SystemAction used in IDE
6.423 + SystemAction.get(systemActionClass).actionPerformed(
6.424 + new ActionEvent(new Container(), 0, null));
6.425 + } else {
6.426 + // action implements javax.swing.Action
6.427 + try {
6.428 + ((javax.swing.Action)systemActionClass.newInstance()).actionPerformed(null);
6.429 + } catch (Exception e) {
6.430 + throw new JemmyException("Exception when trying to create instance of action \""+systemActionClass.getName()+"\".", e);
6.431 + }
6.432 + }
6.433 + }
6.434 + });
6.435 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
6.436 + } catch (Exception e) {
6.437 + throw new JemmyException("Interrupted", e);
6.438 + }
6.439 + }
6.440 +
6.441 + /** performs action through API
6.442 + * @param node node to be action performed on
6.443 + * @throws UnsupportedOperationException when action does not support API mode */
6.444 + public void performAPI(Node node) {
6.445 + performAPI(new Node[]{node});
6.446 + }
6.447 +
6.448 + /** performs action through API
6.449 + * @param nodes nodes to be action performed on
6.450 + * @throws UnsupportedOperationException when action does not support API mode */
6.451 + public void performAPI(Node[] nodes) {
6.452 + if (systemActionClass==null)
6.453 + throw new UnsupportedOperationException(getClass().toString()+" does not define SystemAction");
6.454 + testNodes(nodes);
6.455 + nodes[0].select();
6.456 + for (int i=1; i<nodes.length; i++)
6.457 + nodes[i].addSelectionPath();
6.458 + try {
6.459 + Thread.sleep(SELECTION_WAIT_TIME);
6.460 + } catch (Exception e) {
6.461 + throw new JemmyException("Sleeping interrupted", e);
6.462 + }
6.463 + performAPI();
6.464 + }
6.465 +
6.466 + /** performs action through API
6.467 + * @param component component to be action performed on
6.468 + * @throws UnsupportedOperationException when action does not support API mode */
6.469 + public void performAPI(ComponentOperator component) {
6.470 + component.getFocus();
6.471 + try {
6.472 + Thread.sleep(SELECTION_WAIT_TIME);
6.473 + } catch (Exception e) {
6.474 + throw new JemmyException("Sleeping interrupted", e);
6.475 + }
6.476 + performAPI();
6.477 + }
6.478 +
6.479 + /** performs action through shortcut
6.480 + * @throws UnsupportedOperationException if no shortcut is defined */
6.481 + public void performShortcut() {
6.482 + if (shortcuts == null) {
6.483 + throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
6.484 + }
6.485 + for(int i=0; i<shortcuts.length; i++) {
6.486 + new KeyRobotDriver(null).pushKey(null, shortcuts[i].getKeyCode(), shortcuts[i].getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
6.487 + JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
6.488 + }
6.489 + try {
6.490 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
6.491 + } catch (Exception e) {
6.492 + throw new JemmyException("Sleeping interrupted", e);
6.493 + }
6.494 + }
6.495 +
6.496 + /** performs action through shortcut
6.497 + * @param node node to be action performed on
6.498 + * @throws UnsupportedOperationException when action does not support shortcut mode */
6.499 + public void performShortcut(Node node) {
6.500 + performShortcut(new Node[]{node});
6.501 + }
6.502 +
6.503 + /** performs action through shortcut
6.504 + * @param nodes nodes to be action performed on
6.505 + * @throws UnsupportedOperationException when action does not support shortcut mode */
6.506 + public void performShortcut(Node[] nodes) {
6.507 + if (shortcuts == null) {
6.508 + throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
6.509 + }
6.510 + testNodes(nodes);
6.511 + nodes[0].select();
6.512 + for (int i=1; i<nodes.length; i++)
6.513 + nodes[i].addSelectionPath();
6.514 + try {
6.515 + Thread.sleep(SELECTION_WAIT_TIME);
6.516 + } catch (Exception e) {
6.517 + throw new JemmyException("Sleeping interrupted", e);
6.518 + }
6.519 + performShortcut();
6.520 + }
6.521 +
6.522 + /** performs action through shortcut
6.523 + * @param component component to be action performed on
6.524 + * @throws UnsupportedOperationException when action does not support shortcut mode */
6.525 + public void performShortcut(ComponentOperator component) {
6.526 + component.getFocus();
6.527 + try {
6.528 + Thread.sleep(SELECTION_WAIT_TIME);
6.529 + } catch (Exception e) {
6.530 + throw new JemmyException("Sleeping interrupted", e);
6.531 + }
6.532 + performShortcut();
6.533 + }
6.534 +
6.535 + /** tests if nodes are all from the same tree
6.536 + * @param nodes nodes
6.537 + * @throws IllegalArgumentException when given nodes does not pass */
6.538 + protected void testNodes(Node[] nodes) {
6.539 + if ((nodes==null)||(nodes.length==0))
6.540 + throw new IllegalArgumentException("argument nodes is null or empty");
6.541 + Class myClass = getClass();
6.542 + Component nodesTree=nodes[0].tree().getSource();
6.543 + for (int i=0; i<nodes.length; i++) {
6.544 +// if (!nodes[i].hasAction(myClass))
6.545 +// throw new IllegalArgumentException(this.toString()+" could not be performed on "+nodes[i].toString());
6.546 + if (nodes[i]==null)
6.547 + throw new IllegalArgumentException("argument nodes contains null value");
6.548 + if (!nodesTree.equals(nodes[i].tree().getSource()))
6.549 + throw new IllegalArgumentException(nodes[i].toString()+" is from different tree");
6.550 + }
6.551 + }
6.552 +
6.553 + /** Returns default mode in which actions are performed.
6.554 + * @return default mode in which actions are performed
6.555 + * @see #POPUP_MODE
6.556 + * @see #MENU_MODE
6.557 + * @see #API_MODE
6.558 + * @see #SHORTCUT_MODE
6.559 + */
6.560 + public int getDefaultMode() {
6.561 + int mode=(((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
6.562 + if (mode<0 || mode>3)
6.563 + return POPUP_MODE;
6.564 + return mode;
6.565 + }
6.566 +
6.567 + /** Sets default mode in which actions are performed. If given mode value
6.568 + * is not valid, it sets {@link #POPUP_MODE} as default.
6.569 + * @param mode mode to be set
6.570 + * @return previous value
6.571 + * @see #POPUP_MODE
6.572 + * @see #MENU_MODE
6.573 + * @see #API_MODE
6.574 + * @see #SHORTCUT_MODE
6.575 + */
6.576 + public int setDefaultMode(int mode) {
6.577 + int oldMode = (((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
6.578 + if (mode<0 || mode>3) {
6.579 + mode = POPUP_MODE;
6.580 + }
6.581 + JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(mode));
6.582 + return oldMode;
6.583 + }
6.584 +
6.585 +
6.586 + /** Sets comparator fot this action. Comparator is used for all actions
6.587 + * after this method is called.
6.588 + * @param comparator new comparator to be set (e.g.
6.589 + * new Operator.DefaultStringComparator(true, true);
6.590 + * to search string item exactly and case sensitive)
6.591 + */
6.592 + public void setComparator(StringComparator comparator) {
6.593 + this.comparator = comparator;
6.594 + }
6.595 +
6.596 + /** Gets comparator set for this action instance.
6.597 + * @return comparator set for this action instance.
6.598 + */
6.599 + public StringComparator getComparator() {
6.600 + if(comparator == null) {
6.601 + comparator = defaultComparator;
6.602 + }
6.603 + return comparator;
6.604 + }
6.605 +
6.606 + /** getter for popup menu path
6.607 + * @return String popup menu path (or null if not suported)
6.608 + */
6.609 + public String getPopupPath() {
6.610 + return popupPath;
6.611 + }
6.612 +
6.613 + /** getter for main menu path
6.614 + * @return String main menu path (or null if not suported)
6.615 + */
6.616 + public String getMenuPath() {
6.617 + return menuPath;
6.618 + }
6.619 +
6.620 + /** getter for system action class
6.621 + * @return Class of system action (or null if not suported)
6.622 + */
6.623 + public Class getSystemActionClass() {
6.624 + return systemActionClass;
6.625 + }
6.626 +
6.627 + /** getter for array of shortcuts
6.628 + * @return Shortcut[] (or null if not suported)
6.629 + */
6.630 + public Shortcut[] getShortcuts() {
6.631 + return shortcuts;
6.632 + }
6.633 +
6.634 + /** Checks whether this action is enabled. If IDE system action class
6.635 + * is defined, it calls its isEnabled() method else if main menu path is
6.636 + * defined, it checks menu item is enabled. Otherwise it throws
6.637 + * UnsupportedOperationException.
6.638 + * @return true if this action is enabled; false otherwise
6.639 + */
6.640 + public boolean isEnabled() {
6.641 + if(systemActionClass != null) {
6.642 + return SystemAction.get(systemActionClass).isEnabled();
6.643 + } else if(menuPath != null) {
6.644 + return Util.getMainMenu().showMenuItem(
6.645 + menuPath, "|", getComparator()).isEnabled();
6.646 + } else {
6.647 + throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
6.648 + }
6.649 + }
6.650 +
6.651 + /** Checks whether this action on given nodes is enabled. If IDE system action class
6.652 + * is defined, it calls its isEnabled() method. Nodes are selected first.
6.653 + * Else if popup menu path is defined, it checks menu item is enabled.
6.654 + * Otherwise it throws UnsupportedOperationException.
6.655 + * @param nodes array of nodes to be selected before a check
6.656 + * @return true if this action is enabled; false otherwise
6.657 + */
6.658 + public boolean isEnabled(Node[] nodes) {
6.659 + testNodes(nodes);
6.660 + if(systemActionClass != null) {
6.661 + nodes[0].select();
6.662 + for (int i=1; i<nodes.length; i++)
6.663 + nodes[i].addSelectionPath();
6.664 + try {
6.665 + Thread.sleep(SELECTION_WAIT_TIME);
6.666 + } catch (Exception e) {
6.667 + throw new JemmyException("Sleeping interrupted", e);
6.668 + }
6.669 + return SystemAction.get(systemActionClass).isEnabled();
6.670 + } else if(popupPath != null) {
6.671 + TreePath paths[]=new TreePath[nodes.length];
6.672 + for (int i=0; i<nodes.length; i++) {
6.673 + paths[i]=nodes[i].getTreePath();
6.674 + }
6.675 + ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
6.676 + ComponentVisualizer oldVisualizer = null;
6.677 + // If visualizer of JTreeOperator is EmptyVisualizer, we need
6.678 + // to avoid making tree component visible in callPopup method.
6.679 + // So far only known case is tree from TreeTableOperator.
6.680 + if(treeVisualizer instanceof EmptyVisualizer) {
6.681 + oldVisualizer = Operator.getDefaultComponentVisualizer();
6.682 + Operator.setDefaultComponentVisualizer(treeVisualizer);
6.683 + }
6.684 + // Need to wait here to be more reliable.
6.685 + // TBD - It can be removed after issue 23663 is solved.
6.686 + new EventTool().waitNoEvent(500);
6.687 + JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
6.688 + // restore previously used default visualizer
6.689 + if(oldVisualizer != null) {
6.690 + Operator.setDefaultComponentVisualizer(oldVisualizer);
6.691 + }
6.692 + return popup.showMenuItem(popupPath, "|", getComparator()).isEnabled();
6.693 + } else {
6.694 + throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
6.695 + }
6.696 + }
6.697 +
6.698 + /** Checks whether this action on given node is enabled. If IDE system action class
6.699 + * is defined, it calls its isEnabled() method. Node is selected first.
6.700 + * Else if popup menu path is defined, it checks menu item is enabled.
6.701 + * Otherwise it throws UnsupportedOperationException.
6.702 + * @param node node to be selected before a check
6.703 + * @return true if this action is enabled; false otherwise
6.704 + */
6.705 + public boolean isEnabled(Node node) {
6.706 + return isEnabled(new Node[] {node});
6.707 + }
6.708 +
6.709 + /** Checks whether this action is enabled for given ComponentOperator.
6.710 + * First it makes component visible and focused.
6.711 + * If IDE system action class is defined, it calls its isEnabled() method.
6.712 + * Else if main menu path is defined, it checks menu item is enabled.
6.713 + * Otherwise it throws UnsupportedOperationException.
6.714 + * @param componentOperator instance of ComponentOperator
6.715 + * @return true if this action is enabled; false otherwise
6.716 + */
6.717 + public boolean isEnabled(ComponentOperator componentOperator) {
6.718 + componentOperator.makeComponentVisible();
6.719 + componentOperator.getFocus();
6.720 + if(systemActionClass != null) {
6.721 + return SystemAction.get(systemActionClass).isEnabled();
6.722 + } else if(popupPath != null) {
6.723 + // Need to wait here to be more reliable.
6.724 + // TBD - It can be removed after issue 23663 is solved.
6.725 + new EventTool().waitNoEvent(500);
6.726 + componentOperator.clickForPopup();
6.727 + return new JPopupMenuOperator(componentOperator).showMenuItem(
6.728 + popupPath, "|", getComparator()).isEnabled();
6.729 + } else if(menuPath != null) {
6.730 + return Util.getMainMenu().showMenuItem(
6.731 + menuPath, "|", getComparator()).isEnabled();
6.732 + } else {
6.733 + throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
6.734 + }
6.735 + }
6.736 +
6.737 + /** This class defines keyboard shortcut for action execution */
6.738 + public static class Shortcut extends Object {
6.739 + /** key code of shortcut (see KeyEvent) */
6.740 + protected int keyCode;
6.741 + /** key modifiers of shortcut (see KeyEvent) */
6.742 + protected int keyModifiers;
6.743 +
6.744 + /** creates new shortcut
6.745 + * @param keyCode int key code (see KeyEvent) */
6.746 + public Shortcut(int keyCode) {
6.747 + this(keyCode, 0);
6.748 + }
6.749 +
6.750 + /** creates new shortcut
6.751 + * @param keyCode int key code (see KeyEvent)
6.752 + * @param keyModifiers int key modifiers (see KeyEvent) */
6.753 + public Shortcut(int keyCode, int keyModifiers) {
6.754 + this.keyCode=keyCode;
6.755 + this.keyModifiers=keyModifiers;
6.756 + }
6.757 +
6.758 + /** getter for key code
6.759 + * @return int key code */
6.760 + public int getKeyCode() {
6.761 + return keyCode;
6.762 + }
6.763 +
6.764 + /** getter for key modifiers
6.765 + * @return int key modifiers */
6.766 + public int getKeyModifiers() {
6.767 + return keyModifiers;
6.768 + }
6.769 +
6.770 + /** returns String representation of shortcut
6.771 + * @return String representation of shortcut */
6.772 + public String toString() {
6.773 + String s=KeyEvent.getKeyModifiersText(getKeyModifiers());
6.774 + return s+(s.length()>0?"+":"")+KeyEvent.getKeyText(getKeyCode());
6.775 + }
6.776 + }
6.777 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/Bundle.java Thu Jul 10 04:32:50 2008 -0700
7.3 @@ -0,0 +1,210 @@
7.4 +/*
7.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.6 + *
7.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7.8 + *
7.9 + * The contents of this file are subject to the terms of either the GNU
7.10 + * General Public License Version 2 only ("GPL") or the Common
7.11 + * Development and Distribution License("CDDL") (collectively, the
7.12 + * "License"). You may not use this file except in compliance with the
7.13 + * License. You can obtain a copy of the License at
7.14 + * http://www.netbeans.org/cddl-gplv2.html
7.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.16 + * specific language governing permissions and limitations under the
7.17 + * License. When distributing the software, include this License Header
7.18 + * Notice in each file and include the License file at
7.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
7.20 + * particular file as subject to the "Classpath" exception as provided
7.21 + * by Sun in the GPL Version 2 section of the License file that
7.22 + * accompanied this code. If applicable, add the following below the
7.23 + * License Header, with the fields enclosed by brackets [] replaced by
7.24 + * your own identifying information:
7.25 + * "Portions Copyrighted [year] [name of copyright owner]"
7.26 + *
7.27 + * Contributor(s):
7.28 + *
7.29 + * The Original Software is NetBeans. The Initial Developer of the Original
7.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
7.31 + * Microsystems, Inc. All Rights Reserved.
7.32 + *
7.33 + * If you wish your version of this file to be governed by only the CDDL
7.34 + * or only the GPL Version 2, indicate your decision by adding
7.35 + * "[Contributor] elects to include this software in this distribution
7.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
7.37 + * single choice of license, a recipient has the option to distribute
7.38 + * your version of this file under either the CDDL, the GPL Version 2 or
7.39 + * to extend the choice of license to its licensees as provided above.
7.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
7.41 + * Version 2 license, then the option applies only if the new code is
7.42 + * made subject to such option by the copyright holder.
7.43 + */
7.44 +
7.45 +package org.netbeans.modules.visualweb.gravy;
7.46 +
7.47 +import java.util.MissingResourceException;
7.48 +import java.util.ResourceBundle;
7.49 +import org.netbeans.jemmy.JemmyException;
7.50 +import org.openide.util.NbBundle;
7.51 +
7.52 +/** Helper class to get strings from NetBeans Bundle.properties files.
7.53 + * <br>
7.54 + * Everytime someone wants to identify a component by its title, label, caption or whatever,
7.55 + * he should not use hard coded string in his test case but he should use
7.56 + * <code>Bundle.getString(bundleName, key)</code> to obtain string from bundle.
7.57 + * Then test cases can be executed on different than English locale because
7.58 + * <code>getString()</code> methods returns string according to current locale.
7.59 + * <br><br>
7.60 + * Usage:
7.61 + * <br><pre>
7.62 + * // "OK"
7.63 + * Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION");
7.64 + * // "Properties of AnObject"
7.65 + * Bundle.getString("org.netbeans.core.Bundle", "CTL_FMT_LocalProperties", new Object[] {new Integer(1), "AnObject"});
7.66 + * // "View"
7.67 + * Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View");
7.68 + * </pre>
7.69 + */
7.70 +public class Bundle {
7.71 +
7.72 + /** Placeholder to disallow creating of instances. */
7.73 + private Bundle() {
7.74 + throw new Error("Bundle is just a container for static methods");
7.75 + }
7.76 +
7.77 + /** Returns ResourceBundle from specified path.
7.78 + * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
7.79 + * @return ResourceBundle instance
7.80 + */
7.81 + public static ResourceBundle getBundle(String bundle) {
7.82 + try {
7.83 + return NbBundle.getBundle(bundle);
7.84 + } catch (NullPointerException e) {
7.85 + throw new JemmyException("\"" + bundle + "\" bundle has not been found", e);
7.86 + } catch (MissingResourceException e) {
7.87 + throw new JemmyException("\"" + bundle + "\" bundle has not been found", e);
7.88 + }
7.89 + }
7.90 +
7.91 + /** Gets string from specified ResourceBundle.
7.92 + * @param bundle instance of ResourceBundle
7.93 + * @param key key of requested string
7.94 + * @return string from bundle in current locale
7.95 + */
7.96 + public static String getString(ResourceBundle bundle, String key) {
7.97 + try {
7.98 + return bundle.getString(key);
7.99 + } catch (MissingResourceException e) {
7.100 + throw new JemmyException("\"" + key + "\" key has not been found", e);
7.101 + } catch (NullPointerException npe) {
7.102 + throw new JemmyException("Cannot accept null parameter.", npe);
7.103 + }
7.104 + }
7.105 +
7.106 + /** Gets string from bundle specified by path to bundle and format it.
7.107 + * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
7.108 + * @param key key of requested string
7.109 + * @param params parameters to be formatted
7.110 + * @return string from bundle in current locale with formatted parameters
7.111 + */
7.112 + public static String getString(ResourceBundle bundle, String key, Object[] params) {
7.113 + return java.text.MessageFormat.format(getString(bundle, key), params);
7.114 + }
7.115 +
7.116 + /** Gets string from bundle specified by path to bundle.
7.117 + * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
7.118 + * @param key key of requested string
7.119 + * @return string from bundle in current locale
7.120 + */
7.121 + public static String getString(String bundle, String key) {
7.122 + return getString(getBundle(bundle), key);
7.123 + }
7.124 +
7.125 + /** Gets string from bundle, removes mnemonic (i.e. '&' or '(&X)') from it
7.126 + * and cuts parameters like {0} from the end.
7.127 + * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
7.128 + * @param key key of requested string
7.129 + * @return string from bundle in current locale. Mnemonic (i.e. '&' or '(&X)')
7.130 + * is removed and parameter patterns are also removed starting by first '{'.
7.131 + */
7.132 + public static String getStringTrimmed(String bundle, String key) {
7.133 + return trim(getString(getBundle(bundle), key));
7.134 + }
7.135 +
7.136 + /** Gets string from bundle specified by path to bundle and format it.
7.137 + * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
7.138 + * @param key key of requested string
7.139 + * @param params parameter to be formatted
7.140 + * @return string from bundle in current locale with formatted parameters
7.141 + */
7.142 + public static String getString(String bundle, String key, Object[] params) {
7.143 + return java.text.MessageFormat.format(getString(bundle, key), params);
7.144 + }
7.145 +
7.146 + /** Gets string from bundle and formats it. It removes mnemonic (i.e. '&' or '(&X)')
7.147 + * from it and cuts parameters like {0} from the end if any.
7.148 + * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
7.149 + * @param key key of requested string
7.150 + * @param params parameter to be formatted
7.151 + * @return string from bundle in current locale. Mnemonic and parameters
7.152 + * like {0} removed from the end.
7.153 + */
7.154 + public static String getStringTrimmed(String bundle, String key, Object[] params) {
7.155 + return trim(getString(getBundle(bundle), key, params));
7.156 + }
7.157 +
7.158 + /** Removes mnemonic (i.e. '&' or '(&X)') and cut parameters like {0} from the end.
7.159 + * @param value string to modify
7.160 + * @return string with removed mnemonic and parameters like {0} from the end.
7.161 + */
7.162 + private static String trim(String value) {
7.163 + // remove mnemonic, i.e. '&' or '(&X)'
7.164 + value = cutAmpersand(value);
7.165 + // cut parameters like {0} from string
7.166 + if(value.indexOf('{')!=-1) {
7.167 + value = value.substring(0, value.indexOf('{'));
7.168 + }
7.169 + return value;
7.170 + }
7.171 +
7.172 + /**
7.173 + * Removes an ampersand from a text string; commonly used to strip out unneeded mnemonics.
7.174 + * Replaces the first occurence of <samp>&?</samp> by <samp>?</samp> or <samp>(&??</samp> by the empty string
7.175 + * where <samp>?</samp> is a wildcard for any character.
7.176 + * <samp>&?</samp> is a shortcut in English locale.
7.177 + * <samp>(&?)</samp> is a shortcut in Japanese locale.
7.178 + * Used to remove shortcuts from workspace names (or similar) when shortcuts are not supported.
7.179 + * <p>The current implementation behaves in the same way regardless of locale.
7.180 + * In case of a conflict it would be necessary to change the
7.181 + * behavior based on the current locale.
7.182 + * @param text a localized label that may have mnemonic information in it
7.183 + * @return string without first <samp>&</samp> if there was any
7.184 + */
7.185 + private static String cutAmpersand(String text) {
7.186 + // modified code of org.openide.awt.Actions.cutAmpersand
7.187 + // see also org.openide.awt.Mnemonics
7.188 + int i;
7.189 + String result = text;
7.190 + /* First check of occurence of '(&'. If not found check
7.191 + * for '&' itself.
7.192 + * If '(&' is found then remove '(&??' and rest of line.
7.193 + */
7.194 + i = text.indexOf("(&"); // NOI18N
7.195 + if (i >= 0 && i + 3 < text.length() && /* #31093 */text.charAt(i + 3) == ')') { // NOI18N
7.196 + result = text.substring(0, i);
7.197 + } else {
7.198 + //Sequence '(&?)' not found look for '&' itself
7.199 + i = text.indexOf('&');
7.200 + if (i < 0) {
7.201 + //No ampersand
7.202 + result = text;
7.203 + } else if (i == (text.length() - 1)) {
7.204 + //Ampersand is last character, wrong shortcut but we remove it anyway
7.205 + result = text.substring(0, i);
7.206 + } else {
7.207 + //Remove ampersand from middle of string
7.208 + result = text.substring(0, i) + text.substring(i + 1);
7.209 + }
7.210 + }
7.211 + return result;
7.212 + }
7.213 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/Bundle.properties Thu Jul 10 04:32:50 2008 -0700
8.3 @@ -0,0 +1,64 @@
8.4 +#DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.5 +#
8.6 +#Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
8.7 +#
8.8 +#The contents of this file are subject to the terms of either the GNU
8.9 +#General Public License Version 2 only ("GPL") or the Common
8.10 +#Development and Distribution License("CDDL") (collectively, the
8.11 +#"License"). You may not use this file except in compliance with the
8.12 +#License. You can obtain a copy of the License at
8.13 +#http://www.netbeans.org/cddl-gplv2.html
8.14 +#or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.15 +#specific language governing permissions and limitations under the
8.16 +#License. When distributing the software, include this License Header
8.17 +#Notice in each file and include the License file at
8.18 +#nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
8.19 +#particular file as subject to the "Classpath" exception as provided
8.20 +#by Sun in the GPL Version 2 section of the License file that
8.21 +#accompanied this code. If applicable, add the following below the
8.22 +#License Header, with the fields enclosed by brackets [] replaced by
8.23 +#your own identifying information:
8.24 +#"Portions Copyrighted [year] [name of copyright owner]"
8.25 +#
8.26 +#Contributor(s):
8.27 +#
8.28 +#The Original Software is NetBeans. The Initial Developer of the Original
8.29 +#Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
8.30 +#Microsystems, Inc. All Rights Reserved.
8.31 +#
8.32 +#If you wish your version of this file to be governed by only the CDDL
8.33 +#or only the GPL Version 2, indicate your decision by adding
8.34 +#"[Contributor] elects to include this software in this distribution
8.35 +#under the [CDDL or GPL Version 2] license." If you do not indicate a
8.36 +#single choice of license, a recipient has the option to distribute
8.37 +#your version of this file under either the CDDL, the GPL Version 2 or
8.38 +#to extend the choice of license to its licensees as provided above.
8.39 +#However, if you add GPL Version 2 code and therefore, elected the GPL
8.40 +#Version 2 license, then the option applies only if the new code is
8.41 +#made subject to such option by the copyright holder.
8.42 +
8.43 +OpenIDE-Module-Display-Category=Testing Tools
8.44 +OpenIDE-Module-Long-Description=\
8.45 + The Gravy library contains various drivers for Jemmy-based GUI tests specific to NetBeans Visual Web GUI objects.
8.46 +OpenIDE-Module-Name=Gravy
8.47 +
8.48 +OpenIDE-Module-Short-Description=A library used for GUI-testing NetBeans IDE Visual Web features.
8.49 +# Project Navigation Window
8.50 +ProjectNode_WebPages=Web Pages
8.51 +ProjectMenuItem_New=New
8.52 +ProjectMenuItem_Open=Open
8.53 +ProjectMenuItem_Page=Visual Web JSF Page...
8.54 +Dialog_NewPage=New Visual Web JSF Page
8.55 +WebPage_extension=.jsp
8.56 +
8.57 +
8.58 +#Designer Panel
8.59 +DesignerMenuItem_SetImage=Set Image...
8.60 +Dialog_ImageCustomizer=Image Customizer -
8.61 +
8.62 +# Property Sheet Window
8.63 +PropertySheet_AddFile=Add File
8.64 +
8.65 +#General
8.66 +Button_Finish=Finish
8.67 +Button_OK=OK
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/CompletionPaneOperator.java Thu Jul 10 04:32:50 2008 -0700
9.3 @@ -0,0 +1,67 @@
9.4 +/*
9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 + *
9.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
9.8 + *
9.9 + * The contents of this file are subject to the terms of either the GNU
9.10 + * General Public License Version 2 only ("GPL") or the Common
9.11 + * Development and Distribution License("CDDL") (collectively, the
9.12 + * "License"). You may not use this file except in compliance with the
9.13 + * License. You can obtain a copy of the License at
9.14 + * http://www.netbeans.org/cddl-gplv2.html
9.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.16 + * specific language governing permissions and limitations under the
9.17 + * License. When distributing the software, include this License Header
9.18 + * Notice in each file and include the License file at
9.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
9.20 + * particular file as subject to the "Classpath" exception as provided
9.21 + * by Sun in the GPL Version 2 section of the License file that
9.22 + * accompanied this code. If applicable, add the following below the
9.23 + * License Header, with the fields enclosed by brackets [] replaced by
9.24 + * your own identifying information:
9.25 + * "Portions Copyrighted [year] [name of copyright owner]"
9.26 + *
9.27 + * Contributor(s):
9.28 + *
9.29 + * The Original Software is NetBeans. The Initial Developer of the Original
9.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
9.31 + * Microsystems, Inc. All Rights Reserved.
9.32 + *
9.33 + * If you wish your version of this file to be governed by only the CDDL
9.34 + * or only the GPL Version 2, indicate your decision by adding
9.35 + * "[Contributor] elects to include this software in this distribution
9.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.37 + * single choice of license, a recipient has the option to distribute
9.38 + * your version of this file under either the CDDL, the GPL Version 2 or
9.39 + * to extend the choice of license to its licensees as provided above.
9.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
9.41 + * Version 2 license, then the option applies only if the new code is
9.42 + * made subject to such option by the copyright holder.
9.43 + */
9.44 +
9.45 +package org.netbeans.modules.visualweb.gravy;
9.46 +
9.47 +import java.awt.Component;
9.48 +import org.netbeans.editor.ext.*;
9.49 +import org.netbeans.jemmy.ComponentChooser;
9.50 +import org.netbeans.jemmy.operators.*;
9.51 +
9.52 +/**
9.53 + * CompletionPaneOperator class
9.54 + */
9.55 +public class CompletionPaneOperator extends JScrollPaneOperator {
9.56 +
9.57 + public CompletionPaneOperator(ContainerOperator contOper) {
9.58 + super(contOper, new CompletionPaneChooser());
9.59 +
9.60 + }
9.61 + public static class CompletionPaneChooser implements ComponentChooser {
9.62 + public boolean checkComponent(Component comp) {
9.63 + //return(comp instanceof org.netbeans.editor.ext.ScrollCompletionPane);
9.64 + return(comp instanceof javax.swing.JScrollPane);
9.65 + }
9.66 + public String getDescription() {
9.67 + return("Completion Pane Operator");
9.68 + }
9.69 + }
9.70 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/DNDDriver.java Thu Jul 10 04:32:50 2008 -0700
10.3 @@ -0,0 +1,110 @@
10.4 +/*
10.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 +*
10.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
10.8 +*
10.9 +* The contents of this file are subject to the terms of either the GNU
10.10 +* General Public License Version 2 only ("GPL") or the Common
10.11 +* Development and Distribution License("CDDL") (collectively, the
10.12 +* "License"). You may not use this file except in compliance with the
10.13 +* License. You can obtain a copy of the License at
10.14 +* http://www.netbeans.org/cddl-gplv2.html
10.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.16 +* specific language governing permissions and limitations under the
10.17 +* License. When distributing the software, include this License Header
10.18 +* Notice in each file and include the License file at
10.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
10.20 +* particular file as subject to the "Classpath" exception as provided
10.21 +* by Sun in the GPL Version 2 section of the License file that
10.22 +* accompanied this code. If applicable, add the following below the
10.23 +* License Header, with the fields enclosed by brackets [] replaced by
10.24 +* your own identifying information:
10.25 +* "Portions Copyrighted [year] [name of copyright owner]"
10.26 +*
10.27 +* Contributor(s):
10.28 +*
10.29 +* The Original Software is NetBeans. The Initial Developer of the Original
10.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
10.31 +* Microsystems, Inc. All Rights Reserved.
10.32 +*
10.33 +* If you wish your version of this file to be governed by only the CDDL
10.34 +* or only the GPL Version 2, indicate your decision by adding
10.35 +* "[Contributor] elects to include this software in this distribution
10.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
10.37 +* single choice of license, a recipient has the option to distribute
10.38 +* your version of this file under either the CDDL, the GPL Version 2 or
10.39 +* to extend the choice of license to its licensees as provided above.
10.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
10.41 +* Version 2 license, then the option applies only if the new code is
10.42 +* made subject to such option by the copyright holder.
10.43 +*/
10.44 +
10.45 +package org.netbeans.modules.visualweb.gravy;
10.46 +
10.47 +import java.awt.Point;
10.48 +import org.netbeans.jemmy.Timeout;
10.49 +import org.netbeans.jemmy.drivers.input.MouseRobotDriver;
10.50 +import org.netbeans.jemmy.operators.ComponentOperator;
10.51 +import org.netbeans.jemmy.operators.Operator;
10.52 +
10.53 +/**
10.54 + * This class allows tester to imitate "drag-and-drop" action (the appropriate
10.55 + * sequence of events), as if a mouse is being used in an automated test by hand.
10.56 + */
10.57 +public class DNDDriver {
10.58 + MouseRobotDriver mDriver;
10.59 + Timeout beforeDragSleep, afterDragSleep;
10.60 +
10.61 + /**
10.62 + * Creates a new instance of DNDDriver
10.63 + */
10.64 + public DNDDriver() {
10.65 + mDriver = new MouseRobotDriver(new Timeout("", 10));
10.66 + beforeDragSleep = new Timeout("", 100);
10.67 + afterDragSleep = new Timeout("", 10);
10.68 + }
10.69 +
10.70 + /**
10.71 + * Performs "drag-and-drop" action.
10.72 + * @param source an component, which should be moved
10.73 + * @param from a point inside the source component, where mouse cursor should be placed
10.74 + * @param target an component, on which the source component should be dropped
10.75 + * @param to a point inside the target component, where mouse cursor should be placed finally
10.76 + * @param button defines, which mouse button should be used (left, right,...)
10.77 + * @param modifiers defines, which additional keyboard keys (Ctrl, Alt,...) should be used
10.78 + */
10.79 + public void dnd(ComponentOperator source, Point from, ComponentOperator target, Point to, int button, int modifiers) {
10.80 + mDriver.moveMouse(source, from.x, from.y);
10.81 + mDriver.pressMouse(source, from.x, from.y, button, modifiers);
10.82 + beforeDragSleep.sleep();
10.83 + mDriver.moveMouse(source, from.x, from.y);
10.84 + mDriver.moveMouse(source, from.x + 1, from.y + 1);
10.85 + mDriver.moveMouse(target, to.x + 1, to.y + 1);
10.86 + mDriver.moveMouse(target, to.x, to.y);
10.87 + afterDragSleep.sleep();
10.88 + mDriver.releaseMouse(target, to.x, to.y, button, modifiers);
10.89 + }
10.90 +
10.91 + /**
10.92 + * Performs "drag-and-drop" action.
10.93 + * @param source an component, which should be moved
10.94 + * @param from a point inside the source component, where mouse cursor should be placed
10.95 + * @param target an component, on which the source component should be dropped
10.96 + * @param to a point inside the target component, where mouse cursor should be placed finally
10.97 + */
10.98 + public void dnd(ComponentOperator source, Point from, ComponentOperator target, Point to) {
10.99 + dnd(source, from, target, to, Operator.getDefaultMouseButton(), 0);
10.100 + }
10.101 +
10.102 + /**
10.103 + * Performs "drag-and-drop" action.
10.104 + * @param source an component, which should be moved
10.105 + * @param target an component, on which the source component should be dropped
10.106 + */
10.107 + public void dnd(ComponentOperator source, ComponentOperator target) {
10.108 + dnd(source, new Point(source.getCenterXForClick(),
10.109 + source.getCenterYForClick()),
10.110 + target, new Point(target.getCenterXForClick(),
10.111 + target.getCenterYForClick()));
10.112 + }
10.113 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/DeploymentDialogOperator.java Thu Jul 10 04:32:50 2008 -0700
11.3 @@ -0,0 +1,141 @@
11.4 +/*
11.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
11.6 + *
11.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
11.8 + *
11.9 + * The contents of this file are subject to the terms of either the GNU
11.10 + * General Public License Version 2 only ("GPL") or the Common
11.11 + * Development and Distribution License("CDDL") (collectively, the
11.12 + * "License"). You may not use this file except in compliance with the
11.13 + * License. You can obtain a copy of the License at
11.14 + * http://www.netbeans.org/cddl-gplv2.html
11.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
11.16 + * specific language governing permissions and limitations under the
11.17 + * License. When distributing the software, include this License Header
11.18 + * Notice in each file and include the License file at
11.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
11.20 + * particular file as subject to the "Classpath" exception as provided
11.21 + * by Sun in the GPL Version 2 section of the License file that
11.22 + * accompanied this code. If applicable, add the following below the
11.23 + * License Header, with the fields enclosed by brackets [] replaced by
11.24 + * your own identifying information:
11.25 + * "Portions Copyrighted [year] [name of copyright owner]"
11.26 + *
11.27 + * Contributor(s):
11.28 + *
11.29 + * The Original Software is NetBeans. The Initial Developer of the Original
11.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
11.31 + * Microsystems, Inc. All Rights Reserved.
11.32 + *
11.33 + * If you wish your version of this file to be governed by only the CDDL
11.34 + * or only the GPL Version 2, indicate your decision by adding
11.35 + * "[Contributor] elects to include this software in this distribution
11.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
11.37 + * single choice of license, a recipient has the option to distribute
11.38 + * your version of this file under either the CDDL, the GPL Version 2 or
11.39 + * to extend the choice of license to its licensees as provided above.
11.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
11.41 + * Version 2 license, then the option applies only if the new code is
11.42 + * made subject to such option by the copyright holder.
11.43 + */
11.44 +
11.45 +/*
11.46 + * DeploymentDialogOperator.java
11.47 + *
11.48 + * Created on November 11, 2003, 9:35 PM
11.49 + */
11.50 +
11.51 +package org.netbeans.modules.visualweb.gravy;
11.52 +
11.53 +import java.awt.Component;
11.54 +import java.awt.Container;
11.55 +import javax.swing.JDialog;
11.56 +import javax.swing.JFrame;
11.57 +
11.58 +import org.netbeans.jemmy.ComponentChooser;
11.59 +import org.netbeans.jemmy.ComponentSearcher;
11.60 +import org.netbeans.jemmy.JemmyProperties;
11.61 +import org.netbeans.jemmy.operators.JCheckBoxOperator;
11.62 +import org.netbeans.jemmy.operators.JDialogOperator;
11.63 +import org.netbeans.jemmy.operators.JLabelOperator;
11.64 +
11.65 +public class DeploymentDialogOperator extends JDialogOperator {
11.66 +
11.67 + JCheckBoxOperator autoHide;
11.68 +
11.69 + /** Creates a new instance of DeploymentDialogOperator */
11.70 + public DeploymentDialogOperator() {
11.71 + super(new DeploymentDialogFinder());
11.72 + copyEnvironment(Util.getMainWindow());
11.73 + getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 600000);
11.74 + getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 600000);
11.75 + }
11.76 +
11.77 + /**
11.78 + * Creates a new instance of DeploymentDialogOperator
11.79 + */
11.80 + public static DeploymentDialogOperator deploy() {
11.81 + return(Util.getMainWindow().deploy());
11.82 + }
11.83 +
11.84 + /**
11.85 + * Get checkbox for autoHide deployment dialog.
11.86 + * @return JCheckBoxOperator
11.87 + */
11.88 + public JCheckBoxOperator chbAutoHide() {
11.89 + if(autoHide == null) {
11.90 + autoHide = new JCheckBoxOperator(this, "Automatically close this window when finished");
11.91 + }
11.92 + return(autoHide);
11.93 + }
11.94 +
11.95 + /**
11.96 + * Check or uncheck checkbox for autoHide deployment dialog.
11.97 + * @param isAutoHide Boolean value for checkbox's state.
11.98 + */
11.99 + public void setAutoHide(boolean isAutoHide) {
11.100 + chbAutoHide().changeSelection(isAutoHide);
11.101 + }
11.102 +
11.103 + /**
11.104 + * Wait specified status.
11.105 + * @param status Status which will be waited.
11.106 + * @return JLabelOperator Label with specified state.
11.107 + */
11.108 + public JLabelOperator waitStatus(String status) {
11.109 + return(new JLabelOperator(this, status));
11.110 + }
11.111 +
11.112 + /**
11.113 + * Wait state "Completed".
11.114 + * @return JLabelOperator Label with state "Completed".
11.115 + */
11.116 + public JLabelOperator waitCompleted() {
11.117 + return(waitStatus("Completed"));
11.118 + }
11.119 +
11.120 + public static class DeploymentDialogFinder implements
11.121 + ComponentChooser {
11.122 + public boolean checkComponent(Component comp) {
11.123 + ComponentSearcher searcher = new
11.124 + ComponentSearcher((Container)comp);
11.125 +
11.126 + searcher.setOutput(JemmyProperties.getCurrentOutput().createErrorOutput());
11.127 + /* return(comp instanceof JFrame &&
11.128 + searcher.findComponent(new ComponentChooser() {
11.129 + public boolean checkComponent(Component comp) {
11.130 +
11.131 + return(comp.getClass().getName().endsWith("ProgressUI"));
11.132 + }
11.133 + public String getDescription() {
11.134 + return("ProgressUI");
11.135 + }
11.136 + }) != null);*/
11.137 + return(comp instanceof JDialog);
11.138 + }
11.139 + public String getDescription() {
11.140 + return("Deployment dialog");
11.141 + }
11.142 + }
11.143 +}
11.144 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/DeploymentUtils.java Thu Jul 10 04:32:50 2008 -0700
12.3 @@ -0,0 +1,739 @@
12.4 +/*
12.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.6 + *
12.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
12.8 + *
12.9 + * The contents of this file are subject to the terms of either the GNU
12.10 + * General Public License Version 2 only ("GPL") or the Common
12.11 + * Development and Distribution License("CDDL") (collectively, the
12.12 + * "License"). You may not use this file except in compliance with the
12.13 + * License. You can obtain a copy of the License at
12.14 + * http://www.netbeans.org/cddl-gplv2.html
12.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.16 + * specific language governing permissions and limitations under the
12.17 + * License. When distributing the software, include this License Header
12.18 + * Notice in each file and include the License file at
12.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
12.20 + * particular file as subject to the "Classpath" exception as provided
12.21 + * by Sun in the GPL Version 2 section of the License file that
12.22 + * accompanied this code. If applicable, add the following below the
12.23 + * License Header, with the fields enclosed by brackets [] replaced by
12.24 + * your own identifying information:
12.25 + * "Portions Copyrighted [year] [name of copyright owner]"
12.26 + *
12.27 + * Contributor(s):
12.28 + *
12.29 + * The Original Software is NetBeans. The Initial Developer of the Original
12.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
12.31 + * Microsystems, Inc. All Rights Reserved.
12.32 + *
12.33 + * If you wish your version of this file to be governed by only the CDDL
12.34 + * or only the GPL Version 2, indicate your decision by adding
12.35 + * "[Contributor] elects to include this software in this distribution
12.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
12.37 + * single choice of license, a recipient has the option to distribute
12.38 + * your version of this file under either the CDDL, the GPL Version 2 or
12.39 + * to extend the choice of license to its licensees as provided above.
12.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
12.41 + * Version 2 license, then the option applies only if the new code is
12.42 + * made subject to such option by the copyright holder.
12.43 + */
12.44 +
12.45 +package org.netbeans.modules.visualweb.gravy;
12.46 +
12.47 +import java.io.IOException;
12.48 +
12.49 +import com.meterware.httpunit.*;
12.50 +
12.51 +import junit.framework.TestCase;
12.52 +
12.53 +/**
12.54 + * RemoteDeploymentUtils class
12.55 + */
12.56 +
12.57 +public class DeploymentUtils
12.58 +{
12.59 + /**
12.60 + * Check if project was deployed.
12.61 + * @param deploy_string String to execute.
12.62 + * @return True if project works well, in other way retuirn false.
12.63 + */
12.64 + public static boolean testProject(String deploy_string)
12.65 + {
12.66 + try
12.67 + {
12.68 + Process oasp = Runtime.getRuntime().exec(deploy_string);
12.69 + System.out.println(deploy_string+" execute.");
12.70 + try
12.71 + {
12.72 + if (oasp.waitFor() == 0) System.out.println("Project has been deployed successfully!");
12.73 + else
12.74 + {
12.75 + System.out.println("Project has not been deployed!");
12.76 + TestCase.fail("Cannot run application.");
12.77 + }
12.78 + }
12.79 + catch (InterruptedException ie)
12.80 + {
12.81 + TestCase.fail("Exception in waitFor() : " + ie);
12.82 + return false;
12.83 + }
12.84 + oasp.destroy();
12.85 + }
12.86 + catch (IOException e)
12.87 + {
12.88 + TestCase.fail("Cannot run application.");
12.89 + return false;
12.90 + }
12.91 + TestUtils.wait(20000);
12.92 + return true;
12.93 + }
12.94 +
12.95 + /**
12.96 + * Check project with page navigation.
12.97 + * @param checkURL Project's URL.
12.98 + * @return True if project works well, in other way retuirn false.
12.99 + */
12.100 + public static boolean httpVerifySimpleNavigation(String checkURL)
12.101 + {
12.102 + try
12.103 + {
12.104 + WebConversation conversation = new WebConversation();
12.105 + WebResponse response = null;
12.106 + response = conversation.getResponse(checkURL);
12.107 + WebForm addContainer = response.getForms()[0];
12.108 +
12.109 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.110 + response = addContainer.submit(btn);
12.111 + System.out.println("Response text after page commit: " + response.getText());
12.112 + if (!response.getTitle().equals("Page2 Title"))
12.113 + {
12.114 + TestCase.fail("Cannot find Page2 in response");
12.115 + return false;
12.116 + }
12.117 + }
12.118 + catch (Exception e)
12.119 + {
12.120 + System.out.println("Exception occured: ");
12.121 + e.printStackTrace();
12.122 + TestCase.fail("Exception in HTTP check : " + e);
12.123 + return false;
12.124 + }
12.125 + return true;
12.126 + }
12.127 +
12.128 + /**
12.129 + * Check project with web service.
12.130 + * @param checkURL Project's URL.
12.131 + * @return True if project works well, in other way retuirn false.
12.132 + */
12.133 + public static boolean httpVerifyWebService(String checkURL)
12.134 + {
12.135 + try
12.136 + {
12.137 + String webOutput;
12.138 + WebConversation conversation = new WebConversation();
12.139 + WebResponse response = null;
12.140 + response = conversation.getResponse(checkURL);
12.141 + WebForm addContainer = response.getForms()[0];
12.142 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.143 + response = addContainer.submit(btn);
12.144 + webOutput = response.getText();
12.145 + System.out.println("Response text : " + webOutput);
12.146 + if (((response.getText()).indexOf("Kent") == -1) ||
12.147 + ((response.getText()).indexOf("Richard") == -1) ||
12.148 + ((response.getText()).indexOf("Cancel by 6pm local time 24 hours prior to avoid no-show billing.") == -1))
12.149 + {
12.150 + TestCase.fail("Cannot find strings according to chosen WebService in response");
12.151 + return false;
12.152 + }
12.153 + }
12.154 + catch (Exception e)
12.155 + {
12.156 + System.out.println("Exception occured: ");
12.157 + e.printStackTrace();
12.158 + TestCase.fail("Exception in HTTP check : " + e);
12.159 + return false;
12.160 + }
12.161 + return true;
12.162 + }
12.163 +
12.164 + /**
12.165 + * Check "Intro" project.
12.166 + * @param checkURL Project's URL.
12.167 + * @return True if project works well, in other way retuirn false.
12.168 + */
12.169 + public static boolean httpVerifyIntro(String checkURL)
12.170 + {
12.171 + try
12.172 + {
12.173 + WebConversation conversation = new WebConversation();
12.174 + WebResponse response = null;
12.175 + response = conversation.getResponse(checkURL);
12.176 + com.meterware.httpunit.WebForm addContainer = response.getForms()[0];
12.177 + WebRequest request = addContainer.getRequest();
12.178 + System.out.println("Response text : " + response.getText());
12.179 + addContainer.setParameter("form1:dropdown1", "Chen, Larry");
12.180 + response = conversation.getResponse(request);
12.181 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.182 + response = addContainer.submit(btn);
12.183 + addContainer = response.getForms()[0];
12.184 + System.out.println("Response text after page commit: " + response.getText());
12.185 + if ((response.getText()).indexOf("Hello, Larry!") == -1)
12.186 + {
12.187 + TestCase.fail("Cannot find \" Hello, Larry! \" string in response after submit");
12.188 + return false;
12.189 + }
12.190 + }
12.191 + catch (Exception e)
12.192 + {
12.193 + System.out.println("Exception occured: ");
12.194 + e.printStackTrace();
12.195 + TestCase.fail("Exception in HTTP check : " + e);
12.196 + return false;
12.197 + }
12.198 + return true;
12.199 + }
12.200 +
12.201 + /**
12.202 + * Check project with validaton.
12.203 + * @param checkURL Project's URL.
12.204 + * @return True if project works well, in other way retuirn false.
12.205 + */
12.206 + public static boolean httpVerifyValidation(String checkURL)
12.207 + {
12.208 + try
12.209 + {
12.210 + WebConversation conversation = new WebConversation();
12.211 + WebResponse response = null;
12.212 + response = conversation.getResponse(checkURL);
12.213 + WebForm addContainer = response.getForms()[0];
12.214 + WebRequest request = addContainer.getRequest();
12.215 + System.out.println("Set textField value = 500, expected result = 932");
12.216 + addContainer.setParameter("form1:textField1", "500");
12.217 + response = conversation.getResponse(request);
12.218 + System.out.println("Response text after 1st page commit: " + response.getText());
12.219 + if ((response.getText()).indexOf("932") == -1)
12.220 + {
12.221 + TestCase.fail("Cannot find value \"932:\" string in response");
12.222 + return false;
12.223 + }
12.224 + TestUtils.wait(5000);
12.225 + addContainer = response.getForms()[0];
12.226 + request = addContainer.getRequest();
12.227 + System.out.println("Set textField value = -1000, expected result = Validation Error");
12.228 + addContainer.setParameter("form1:textField1", "-1000");
12.229 + response = conversation.getResponse(request);
12.230 + System.out.println("Response text after 2st page commit: " + response.getText());
12.231 + if ((response.getText()).indexOf("Validation Error") == -1)
12.232 + {
12.233 + TestCase.fail("Cannot find \"Validation Error:\" string in response");
12.234 + return false;
12.235 + }
12.236 + }
12.237 + catch (Exception e)
12.238 + {
12.239 + System.out.println("Exception occured: ");
12.240 + e.printStackTrace();
12.241 + TestCase.fail("Exception in HTTP check : " + e);
12.242 + return false;
12.243 + }
12.244 + return true;
12.245 + }
12.246 +
12.247 + /**
12.248 + * Check project with dynamic navigation.
12.249 + * @param checkURL Project's URL.
12.250 + * @return True if project works well, in other way retuirn false.
12.251 + */
12.252 + public static boolean httpVerifyDynamicNavigation(String checkURL)
12.253 + {
12.254 + try
12.255 + {
12.256 + WebConversation conversation = new WebConversation();
12.257 + WebResponse response = null;
12.258 + response = conversation.getResponse(checkURL);
12.259 + WebForm addContainer = response.getForms()[0];
12.260 + addContainer.setParameter("form1:dropdown1", "Emerald City");
12.261 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.262 + response = addContainer.submit(btn);
12.263 + System.out.println("Response text after form1 submit: " + response.getText());
12.264 + if (!response.getTitle().equals("Page2 Title"))
12.265 + {
12.266 + TestCase.fail("Wrong webform responce after WebForm1 submit action");
12.267 + return false;
12.268 + }
12.269 + addContainer = response.getForms()[0];
12.270 + btn = addContainer.getSubmitButtons()[0];
12.271 + response = addContainer.submit(btn);
12.272 + System.out.println("Response text after 1 form2 submit: " + response.getText());
12.273 + if (response.getTitle().equals("Page1 Title"))
12.274 + {
12.275 + TestCase.fail("Wrong webform responce after WebForm2 first submit action");
12.276 + return false;
12.277 + }
12.278 + response = addContainer.submit(btn);
12.279 + System.out.println("Response text after 2 Page2 submit: " + response.getText());
12.280 + response = addContainer.submit(btn);
12.281 + System.out.println("Response text after 3 Page2 submit: " + response.getText());
12.282 +
12.283 + if (!response.getTitle().equals("Page1 Title"))
12.284 + {
12.285 + TestCase.fail("Wrong page responce after Page2 third submit action");
12.286 + return false;
12.287 + }
12.288 + }
12.289 + catch (Exception e)
12.290 + {
12.291 + System.out.println("Exception occured: ");
12.292 + e.printStackTrace();
12.293 + TestCase.fail("Excetion in HTTP check : " + e);
12.294 + return false;
12.295 + }
12.296 + return true;
12.297 + }
12.298 +
12.299 + /**
12.300 + * Check project which send email.
12.301 + * @param checkURL Project's URL.
12.302 + * @return True if project works well, in other way retuirn false.
12.303 + */
12.304 + public static boolean httpVerifyEmail(String checkURL)
12.305 + {
12.306 + try
12.307 + {
12.308 + WebConversation conversation = new WebConversation();
12.309 + WebResponse response = null;
12.310 + response = conversation.getResponse(checkURL);
12.311 + WebForm addContainer = response.getForms()[0];
12.312 + addContainer.setParameter("form1:txtComments", "Hello world!");
12.313 + TestUtils.wait(2000);
12.314 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.315 + response = addContainer.submit(btn);
12.316 + TestUtils.wait(2000);
12.317 + System.out.println("Response text after page commit: " + response.getText());
12.318 + if ((response.getText()).indexOf("Your comments have been successfully sent") == -1)
12.319 + {
12.320 + TestCase.fail("Cannot find \"Your comments have been successfully sent\" string in response");
12.321 + return false;
12.322 + }
12.323 + }
12.324 + catch (Exception e)
12.325 + {
12.326 + System.out.println("Exception occured: ");
12.327 + e.printStackTrace();
12.328 + System.out.println("Check your mail settings, it can be cause of failing.");
12.329 + TestCase.fail("Excetion in HTTP check : " + e);
12.330 + return false;
12.331 + }
12.332 + return true;
12.333 + }
12.334 +
12.335 + /**
12.336 + * Check project which DB access.
12.337 + * @param checkURL Project's URL.
12.338 + * @return True if project works well, in other way retuirn false.
12.339 + */
12.340 + public static boolean httpVerifyDBAccess(String checkURL)
12.341 + {
12.342 + try
12.343 + {
12.344 + String webOutput;
12.345 + WebConversation conversation = new WebConversation();
12.346 + WebResponse response = null;
12.347 + response = conversation.getResponse(checkURL); //
12.348 + WebForm addContainer = response.getForms()[0];
12.349 + addContainer.setParameter("form1:dropdown1", "2");
12.350 + TestUtils.wait(5000);
12.351 + WebRequest request = addContainer.getRequest();
12.352 + TestUtils.wait(5000);
12.353 + response = conversation.getResponse(request);
12.354 + webOutput = response.getText();
12.355 + System.out.println("Response text : " + webOutput);
12.356 + }
12.357 + catch (Exception e)
12.358 + {
12.359 + System.out.println("Exception occured: ");
12.360 + e.printStackTrace();
12.361 + TestCase.fail("Exception in HTTP check : " + e);
12.362 + return false;
12.363 + }
12.364 + return true;
12.365 + }
12.366 +
12.367 + /**
12.368 + * Check project with number converter.
12.369 + * @param checkURL Project's URL.
12.370 + * @return True if project works well, in other way retuirn false.
12.371 + */
12.372 + public static boolean httpVerifyNumberConverter(String checkURL)
12.373 + {
12.374 + try
12.375 + {
12.376 + WebConversation conversation = new WebConversation();
12.377 + WebResponse response = null;
12.378 + response = conversation.getResponse(checkURL);
12.379 + WebForm addContainer = response.getForms()[0];
12.380 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.381 + System.out.println("Set textField value = 125, expected result = class.java.Long");
12.382 + addContainer.setParameter("form1:textField1", "125");
12.383 + response = addContainer.submit(btn);
12.384 + System.out.println("Response text after 1st page commit: " + response.getText());
12.385 + if ((response.getText()).indexOf("java.lang.Long") == -1)
12.386 + {
12.387 + TestCase.fail("Cannot find value \"java.lang.Long\" string in response");
12.388 + return false;
12.389 + }
12.390 + TestUtils.wait(5000);
12.391 + addContainer = response.getForms()[0];
12.392 + btn = addContainer.getSubmitButtons()[0];
12.393 + System.out.println("Set textField value = 125.3, expected result = class.java.Double");
12.394 + addContainer.setParameter("form1:textField1", "125.3");
12.395 + response = addContainer.submit(btn);
12.396 + System.out.println("Response text after 2st page commit: " + response.getText());
12.397 + if ((response.getText()).indexOf("java.lang.Double") == -1)
12.398 + {
12.399 + TestCase.fail("Cannot find \"java.lang.Double\" string in response");
12.400 + return false;
12.401 + }
12.402 + }
12.403 + catch (Exception e)
12.404 + {
12.405 + System.out.println("Exception occured: ");
12.406 + e.printStackTrace();
12.407 + TestCase.fail("Exception in HTTP check : " + e);
12.408 + return false;
12.409 + }
12.410 + return true;
12.411 + }
12.412 +
12.413 + /**
12.414 + * Check project with currency converter.
12.415 + * @param checkURL Project's URL.
12.416 + * @return True if project works well, in other way retuirn false.
12.417 + */
12.418 + public static boolean httpVerifyCurrencyConverter(String checkURL)
12.419 + {
12.420 + try
12.421 + {
12.422 + WebConversation conversation = new WebConversation();
12.423 + WebResponse response = null;
12.424 + response = conversation.getResponse(checkURL);
12.425 + WebForm addContainer = response.getForms()[0];
12.426 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.427 + System.out.println("Set textField value = $1,234.00");
12.428 + addContainer.setParameter("form1:textField1", "$1,234.00");
12.429 + response = addContainer.submit(btn);
12.430 + System.out.println("Response text after 1st page commit: " + response.getText());
12.431 + if (((response.getText()).indexOf("£822.67") == -1) ||
12.432 + ((response.getText()).indexOf("E 1.028,33") == -1))
12.433 + {
12.434 + TestCase.fail("Cannot find value \"£822.67\" or \"E 1.028,33\" string in response");
12.435 + return false;
12.436 + }
12.437 + }
12.438 + catch (Exception e)
12.439 + {
12.440 + System.out.println("Exception occured: ");
12.441 + e.printStackTrace();
12.442 + TestCase.fail("Exception in HTTP check : " + e);
12.443 + return false;
12.444 + }
12.445 + return true;
12.446 + }
12.447 +
12.448 + /**
12.449 + * Check project with date converter.
12.450 + * @param checkURL Project's URL.
12.451 + * @return True if project works well, in other way retuirn false.
12.452 + */
12.453 + public static boolean httpVerifyDateConverter(String checkURL)
12.454 + {
12.455 + try
12.456 + {
12.457 + WebConversation conversation = new WebConversation();
12.458 + WebResponse response = null;
12.459 + response = conversation.getResponse(checkURL);
12.460 + WebForm addContainer = response.getForms()[0];
12.461 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.462 + response = addContainer.submit(btn);
12.463 + System.out.println("Response text after 1st page commit: " + response.getText());
12.464 + if (((response.getText()).indexOf("Greenwich Mean Time") == -1) ||
12.465 + ((response.getText()).indexOf("GMT") == -1) ||
12.466 + (((response.getText()).indexOf("Pacific Daylight Time") == -1) &&
12.467 + ((response.getText()).indexOf("Pacific Standard Time") == -1)))
12.468 + {
12.469 + TestCase.fail("Cannot find date time strings in response");
12.470 + return false;
12.471 + }
12.472 + }
12.473 + catch (Exception e)
12.474 + {
12.475 + System.out.println("Exception occured: ");
12.476 + e.printStackTrace();
12.477 + TestCase.fail("Exception in HTTP check : " + e);
12.478 + return false;
12.479 + }
12.480 + return true;
12.481 + }
12.482 +
12.483 + /**
12.484 + * Check project with "List" component.
12.485 + * @param checkURL Project's URL.
12.486 + * @return True if project works well, in other way retuirn false.
12.487 + */
12.488 + public static boolean httpVerifyList(String checkURL)
12.489 + {
12.490 + try
12.491 + {
12.492 + WebConversation conversation = new WebConversation();
12.493 + WebResponse response = null;
12.494 + response = conversation.getResponse(checkURL);
12.495 + com.meterware.httpunit.WebForm addContainer = response.getForms()[0];
12.496 + System.out.println("Response : " + response.getText());
12.497 + String[] valArray = {"choice1", "choice2"};
12.498 + addContainer.setParameter("form1:multiSelectListbox1", valArray);
12.499 + SubmitButton btm = addContainer.getSubmitButton("form1:button1");
12.500 + response = addContainer.submit(btm);
12.501 + addContainer = response.getForms()[0];
12.502 + System.out.println("Response text after page commit: " + response.getText());
12.503 + if ((response.getText()).indexOf("Values chosen:\nchoice1\nchoice2") == -1)
12.504 + {
12.505 + TestCase.fail("Cannot find result string in response after submit");
12.506 + return false;
12.507 + }
12.508 + TestUtils.wait(5000);
12.509 + btm = addContainer.getSubmitButton("form1:button2");
12.510 + TestUtils.wait(3000);
12.511 + response = addContainer.submit(btm);
12.512 + TestUtils.wait(3000);
12.513 + addContainer = response.getForms()[0];
12.514 + btm = addContainer.getSubmitButton("form1:button2");
12.515 + response = addContainer.submit(btm);
12.516 + TestUtils.wait(3000);
12.517 + addContainer = response.getForms()[0];
12.518 + TestUtils.wait(3000);
12.519 + System.out.println("Response text after 1 page commit: " + response.getText());
12.520 + String[] valArray1 = {"testChoice5", "testChoice6"};
12.521 + addContainer.setParameter("form1:multiSelectListbox1", valArray1);
12.522 + btm = addContainer.getSubmitButton("form1:button1");
12.523 + response = addContainer.submit(btm);
12.524 + addContainer = response.getForms()[0];
12.525 + System.out.println("Response text after 2 page commit: " + response.getText());
12.526 + if ((response.getText()).indexOf("Values chosen:\ntestChoice5\ntestChoice6") == -1)
12.527 + {
12.528 + TestCase.fail("Cannot find result string in response after submit");
12.529 + return false;
12.530 + }
12.531 + TestUtils.wait(5000);
12.532 + btm = addContainer.getSubmitButton("form1:button3");
12.533 + TestUtils.wait(3000);
12.534 + response = addContainer.submit(btm);
12.535 + TestUtils.wait(3000);
12.536 + addContainer = response.getForms()[0];
12.537 + System.out.println("Response text after 3 page commit: " + response.getText());
12.538 + if (((response.getText()).indexOf("testChoice5") != -1) ||
12.539 + ((response.getText()).indexOf("testChoice6") != -1))
12.540 + {
12.541 + TestCase.fail("Wrong list items left after removing in response after submit");
12.542 + return false;
12.543 + }
12.544 + }
12.545 + catch (Exception e)
12.546 + {
12.547 + System.out.println("Exception occured: ");
12.548 + e.printStackTrace();
12.549 + TestCase.fail("Excetion in HTTP check : " + e);
12.550 + return false;
12.551 + }
12.552 + return true;
12.553 + }
12.554 +
12.555 + /**
12.556 + * Check project with property binding.
12.557 + * @param checkURL Project's URL.
12.558 + * @return True if project works well, in other way retuirn false.
12.559 + */
12.560 + public static boolean httpVerifyLinking(String checkURL)
12.561 + {
12.562 + try
12.563 + {
12.564 + WebConversation conversation = new WebConversation();
12.565 + WebResponse response = null;
12.566 + response = conversation.getResponse(checkURL);
12.567 + WebForm addContainer = response.getForms()[0];
12.568 + WebRequest request = addContainer.getRequest();
12.569 + System.out.println("Response text : " + response.getText());
12.570 + addContainer.setParameter("form1:dropdown1", "Chen, Larry");
12.571 + response = conversation.getResponse(request);
12.572 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.573 + response = addContainer.submit(btn);
12.574 + addContainer = response.getForms()[0];
12.575 + System.out.println("Response text after page commit: " + response.getText());
12.576 + if ((response.getText()).indexOf("Hello, Larry!") == -1)
12.577 + {
12.578 + TestCase.fail("Cannot find \" Hello, Larry! \" string in response after submit");
12.579 + return false;
12.580 + }
12.581 + }
12.582 + catch (Exception e)
12.583 + {
12.584 + System.out.println("Exception occured: ");
12.585 + e.printStackTrace();
12.586 + TestCase.fail("Exception in HTTP check : " + e);
12.587 + return false;
12.588 + }
12.589 + return true;
12.590 + }
12.591 +
12.592 + /**
12.593 + * Check project with ancillary library.
12.594 + * @param checkURL Project's URL.
12.595 + * @return True if project works well, in other way retuirn false.
12.596 + */
12.597 + public static boolean httpVerifyLibrary(String checkURL)
12.598 + {
12.599 + try
12.600 + {
12.601 + WebConversation conversation = new WebConversation();
12.602 + WebResponse response = null;
12.603 + response = conversation.getResponse(checkURL);
12.604 + com.meterware.httpunit.WebForm addContainer = response.getForms()[0];
12.605 + System.out.println("Response : " + response.getText());
12.606 + if ((response.getText()).indexOf("Hello, world.") == -1)
12.607 + {
12.608 + TestCase.fail("Cannot find \"Hello, world.\" string in response.");
12.609 + return false;
12.610 + }
12.611 + }
12.612 + catch (Exception e)
12.613 + {
12.614 + System.out.println("Exception occured: " + e);
12.615 + e.printStackTrace();
12.616 + TestCase.fail("Exception in HTTP check : " + e);
12.617 + return false;
12.618 + }
12.619 + return true;
12.620 + }
12.621 +
12.622 + /**
12.623 + * Check project with "Message" component.
12.624 + * @param checkURL Project's URL.
12.625 + * @return True if project works well, in other way retuirn false.
12.626 + */
12.627 + public static boolean httpVerifyMessage(String checkURL)
12.628 + {
12.629 + try
12.630 + {
12.631 + WebConversation conversation = new WebConversation();
12.632 + WebResponse response = null;
12.633 + response = conversation.getResponse(checkURL);
12.634 + WebForm addContainer = response.getForms()[0];
12.635 + WebRequest request = addContainer.getRequest();
12.636 + System.out.println("Response text : " + response.getText());
12.637 + SubmitButton btn = addContainer.getSubmitButtons()[0];
12.638 + response = addContainer.submit(btn);
12.639 + addContainer = response.getForms()[0];
12.640 + System.out.println("Response text after page commit: " + response.getText());
12.641 + if ((response.getText()).indexOf("Validation Error: Value is required.") == -1 || (response.getText()).indexOf("Validation Error: Value is required.") == -1)
12.642 + {
12.643 + TestCase.fail("Cannot find \"Validation Error: Value is required.\" string in response after submit");
12.644 + return false;
12.645 + }
12.646 + TestUtils.wait(1000);
12.647 + addContainer.setParameter("form1:textField1", "abc");
12.648 + addContainer.setParameter("form1:textField2", "abc");
12.649 + btn = addContainer.getSubmitButtons()[0];
12.650 + response = addContainer.submit(btn);
12.651 + addContainer = response.getForms()[0];
12.652 + System.out.println("Response text after page commit: " + response.getText());
12.653 + if ((response.getText()).indexOf("Conversion error occurred.") == -1)
12.654 + {
12.655 + TestCase.fail("Cannot find \"Conversion error occurred.\" string in response after submit");
12.656 + return false;
12.657 + }
12.658 + TestUtils.wait(1000);
12.659 + addContainer.setParameter("form1:textField1", "10");
12.660 + addContainer.setParameter("form1:textField2", "abc");
12.661 + btn = addContainer.getSubmitButtons()[0];
12.662 + response = addContainer.submit(btn);
12.663 + addContainer = response.getForms()[0];
12.664 + System.out.println("Response text after page commit: " + response.getText());
12.665 + if ((response.getText()).indexOf("Validation Error: Specified attribute is not between the expected values of 1 and 5.") == -1)
12.666 + {
12.667 + TestCase.fail("Cannot find \"Validation Error: Specified attribute is not between the expected values of 1 and 5.\" string in response after submit");
12.668 + return false;
12.669 + }
12.670 + TestUtils.wait(1000);
12.671 + addContainer.setParameter("form1:textField1", "4");
12.672 + addContainer.setParameter("form1:textField2", "abc");
12.673 + btn = addContainer.getSubmitButtons()[0];
12.674 + response = addContainer.submit(btn);
12.675 + addContainer = response.getForms()[0];
12.676 + System.out.println("Response text after page commit: " + response.getText());
12.677 + if ((response.getText()).indexOf("Form Message: Processing Complete.") == -1)
12.678 + {
12.679 + TestCase.fail("Cannot find \"Form Message: Processing Complete.\" string in response after submit");
12.680 + return false;
12.681 + }
12.682 + }
12.683 + catch (Exception e)
12.684 + {
12.685 + System.out.println("Exception occured: ");
12.686 + e.printStackTrace();
12.687 + TestCase.fail("Exception in HTTP check : " + e);
12.688 + return false;
12.689 + }
12.690 + return true;
12.691 + }
12.692 +
12.693 + /**
12.694 + * Check CRUD project.
12.695 + * @param checkURL Project's URL.
12.696 + * @return True if project works well, in other way retuirn false.
12.697 + */
12.698 + public static boolean httpVerifyCRUD(String checkURL)
12.699 + {
12.700 + try
12.701 + {
12.702 + WebConversation conversation = new WebConversation();
12.703 + WebResponse response = conversation.getResponse(checkURL);
12.704 + System.out.println("Start page: " + response.getText());
12.705 + WebForm form = response.getForms()[0];
12.706 + SubmitButton addBtn=(SubmitButton)form.getButtonWithID("form1:addTrip");
12.707 + response = form.submit(addBtn);
12.708 + System.out.println("Details screen for add = " + response.getText());
12.709 + form = response.getForms()[0];
12.710 + form.setParameter("form1:depDate","16.06.2004 0:23:09");
12.711 + form.setParameter("form1:fromCity","Hobbiton");
12.712 + form.setParameter("form1:toCity","Rivendell");
12.713 + form.setParameter("form1:tripTypeId","3");
12.714 + SubmitButton saveBtn=(SubmitButton)form.getButtonWithID("form1:save");
12.715 + response = form.submit(saveBtn);
12.716 + System.out.println("After adding travel: " + response.getText());
12.717 + form = response.getForms()[0];
12.718 + SubmitButton updateBtn=(SubmitButton)form.getButtonWithID("form1:dataTable1:0:update");
12.719 + response = form.submit(updateBtn);
12.720 + System.out.println("Details screen for update = " + response.getText());
12.721 + form = response.getForms()[0];
12.722 + form.setParameter("form1:depDate","16.07.2004 0:23:09");
12.723 + form.setParameter("form1:fromCity","Rivendell");
12.724 + form.setParameter("form1:toCity","Orodruin");
12.725 + form.setParameter("form1:tripTypeId","4");
12.726 + saveBtn=(SubmitButton)form.getButtonWithID("form1:save");
12.727 + response = form.submit(saveBtn);
12.728 + System.out.println("After updating travel: " + response.getText());
12.729 + form = response.getForms()[0];
12.730 + SubmitButton deleteBtn=(SubmitButton)form.getButtonWithID("form1:dataTable1:0:delete");
12.731 + response = form.submit(deleteBtn);
12.732 + }
12.733 + catch (Exception e)
12.734 + {
12.735 + System.out.println("Exception occured: ");
12.736 + e.printStackTrace();
12.737 + TestCase.fail("Exception in HTTP check : " + e);
12.738 + return false;
12.739 + }
12.740 + return true;
12.741 + }
12.742 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/DocumentOutlineOperator.java Thu Jul 10 04:32:50 2008 -0700
13.3 @@ -0,0 +1,228 @@
13.4 +/*
13.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.6 + *
13.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
13.8 + *
13.9 + * The contents of this file are subject to the terms of either the GNU
13.10 + * General Public License Version 2 only ("GPL") or the Common
13.11 + * Development and Distribution License("CDDL") (collectively, the
13.12 + * "License"). You may not use this file except in compliance with the
13.13 + * License. You can obtain a copy of the License at
13.14 + * http://www.netbeans.org/cddl-gplv2.html
13.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.16 + * specific language governing permissions and limitations under the
13.17 + * License. When distributing the software, include this License Header
13.18 + * Notice in each file and include the License file at
13.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
13.20 + * particular file as subject to the "Classpath" exception as provided
13.21 + * by Sun in the GPL Version 2 section of the License file that
13.22 + * accompanied this code. If applicable, add the following below the
13.23 + * License Header, with the fields enclosed by brackets [] replaced by
13.24 + * your own identifying information:
13.25 + * "Portions Copyrighted [year] [name of copyright owner]"
13.26 + *
13.27 + * Contributor(s):
13.28 + *
13.29 + * The Original Software is NetBeans. The Initial Developer of the Original
13.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
13.31 + * Microsystems, Inc. All Rights Reserved.
13.32 + *
13.33 + * If you wish your version of this file to be governed by only the CDDL
13.34 + * or only the GPL Version 2, indicate your decision by adding
13.35 + * "[Contributor] elects to include this software in this distribution
13.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
13.37 + * single choice of license, a recipient has the option to distribute
13.38 + * your version of this file under either the CDDL, the GPL Version 2 or
13.39 + * to extend the choice of license to its licensees as provided above.
13.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
13.41 + * Version 2 license, then the option applies only if the new code is
13.42 + * made subject to such option by the copyright holder.
13.43 + */
13.44 +
13.45 +package org.netbeans.modules.visualweb.gravy;
13.46 +
13.47 +import java.awt.*;
13.48 +import java.util.*;
13.49 +import com.sun.rave.designtime.DesignBean;
13.50 +import org.netbeans.jemmy.ComponentChooser;
13.51 +import org.netbeans.jemmy.operators.*;
13.52 +import javax.swing.tree.*;
13.53 +
13.54 +/**
13.55 + * Operator for Outline window.
13.56 + */
13.57 +public class DocumentOutlineOperator extends JComponentOperator {
13.58 + private JTreeOperator structureTree;
13.59 +
13.60 + public DocumentOutlineOperator(ContainerOperator contOper) {
13.61 + super(contOper, new DocumentOutlineChooser());
13.62 + }
13.63 +
13.64 + /** Performs verification by accessing all sub-components */
13.65 + public void verify() {
13.66 + getStructTreeOperator();
13.67 + }
13.68 +
13.69 + /**
13.70 + * Find specified tree path.
13.71 + * @param strTreePath String which represents tree path.
13.72 + * @return TreePath Specified path.
13.73 + */
13.74 + public TreePath findPath(String strTreePath) {
13.75 + verify();
13.76 + return (structureTree.findPath(strTreePath));
13.77 + }
13.78 +
13.79 + /**
13.80 + * Find specified tree path with specified comparator.
13.81 + * @param strTreePath String which represents tree path.
13.82 + * @param nodeIndexes Array of nodes indexes.
13.83 + * @param comparator Comparator to compare tree path with specified string.
13.84 + * @return TreePath Specified path.
13.85 + */
13.86 + public TreePath findPath(String strTreePath, int[] nodeIndexes,
13.87 + Operator.StringComparator comparator) {
13.88 + verify();
13.89 + String[] nodeNames = new Operator.DefaultPathParser("|").parse(strTreePath);
13.90 + if (nodeIndexes == null) {
13.91 + nodeIndexes = new int[nodeNames.length]; // fill the array in with zero values
13.92 + }
13.93 + System.out.println("+++ DocumentOutlineOperator.findPath(...): nodeNames = " +
13.94 + Arrays.asList(nodeNames));
13.95 + System.out.print("+++ DocumentOutlineOperator.findPath(...): nodeIndexes = [");
13.96 + for (int i = 0; i < nodeIndexes.length; ++i) {
13.97 + System.out.print(nodeIndexes[i] +
13.98 + (i < nodeIndexes.length - 1 ? ", " : ""));
13.99 + }
13.100 + System.out.println("]");
13.101 + TreePath treePath = structureTree.findPath(nodeNames, nodeIndexes,
13.102 + comparator);
13.103 + return treePath;
13.104 + }
13.105 +
13.106 + /**
13.107 + * Click on specified tree path.
13.108 + * @param strTreePath String which represents tree path.
13.109 + */
13.110 + public void clickOnPath(String strTreePath) {
13.111 + structureTree.clickOnPath(findPath(strTreePath));
13.112 + }
13.113 +
13.114 + /**
13.115 + * Expand specified tree path.
13.116 + * @param strTreePath String which represents tree path.
13.117 + */
13.118 + public void expandPath(String strTreePath) {
13.119 + structureTree.expandPath(findPath(strTreePath));
13.120 + }
13.121 +
13.122 + /**
13.123 + * Select specified tree path.
13.124 + * @param strTreePath String which represents tree path.
13.125 + */
13.126 + public void selectPath(String strTreePath) {
13.127 + structureTree.selectPath(findPath(strTreePath));
13.128 + }
13.129 +
13.130 + /**
13.131 + * Click for popup with specified mouse button.
13.132 + * @param i Number of mouse button.
13.133 + */
13.134 + public void clickForPopup(int i) {
13.135 + verify();
13.136 + structureTree.clickForPopup(i);
13.137 + }
13.138 +
13.139 + /**
13.140 + * Get tree which represents structure.
13.141 + * @return JTreeOperator JTree which represents structure.
13.142 + */
13.143 + public JTreeOperator getStructTreeOperator() {
13.144 + if (structureTree == null) {
13.145 + structureTree = new JTreeOperator(this);
13.146 + }
13.147 + return structureTree;
13.148 + }
13.149 +
13.150 + /**
13.151 + * Press button with given title.
13.152 + * @param btName Name of button.
13.153 + */
13.154 + public void pressButton(String btName){
13.155 + new JButtonOperator(this, btName).pushNoBlock();
13.156 + }
13.157 +
13.158 + /**
13.159 + * Find child with specified name in specified parent.
13.160 + * @param parent Bean where child will be searched.
13.161 + * @param componentName Name of child.
13.162 + * @return DesignBean Found child.
13.163 + */
13.164 + private DesignBean findChild(DesignBean parent, String componentName){
13.165 + DesignBean lb;
13.166 + if (parent.getInstanceName().equals(componentName)){
13.167 + return parent;
13.168 + }
13.169 + for (int i = 0; i < parent.getChildBeanCount(); i++) {
13.170 + if ((lb=findChild(parent.getChildBean(i),componentName))!=null){
13.171 + return lb;
13.172 + }
13.173 + }
13.174 + return null;
13.175 + }
13.176 +
13.177 + /**
13.178 + * Select component with specified name.
13.179 + * @param componentName Name of component.
13.180 + * @return True if component selected.
13.181 + */
13.182 + public boolean selectComponent(String componentName) {
13.183 + DesignBean[] lbs = null;
13.184 + Object rootChild = structureTree.getChildren(structureTree.getRoot())[0];
13.185 + for (int i = 0; i < structureTree.getChildCount(rootChild); i++) {
13.186 + DesignBean lb = (DesignBean)structureTree.getChildren(rootChild)[i];
13.187 + DesignBean res=findChild(lb,componentName);
13.188 + if (res!=null) {
13.189 + lbs = new DesignBean[] {res};
13.190 + break;
13.191 + }
13.192 + }
13.193 + if (lbs != null) {
13.194 + TestUtils.wait(500);
13.195 + return true;
13.196 + } else {
13.197 + return false;
13.198 + }
13.199 + }
13.200 +
13.201 + /**
13.202 + * Open page with specified name.
13.203 + * @param page Name of page.
13.204 + */
13.205 + public void openPage(String page){
13.206 + new JButtonOperator(this,page).clickForPopup();
13.207 + new JPopupMenuOperator().pushMenu(
13.208 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.outline.Bundle","Open"));
13.209 + }
13.210 +
13.211 + /**
13.212 + * Open source code of page with specified name.
13.213 + * @param page Name of page.
13.214 + */
13.215 + public void openPageSource(String page){
13.216 + new JButtonOperator(this,page).clickForPopup();
13.217 + new JPopupMenuOperator().pushMenu(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.outline.Bundle","ViewBF",
13.218 + new String[]{page})
13.219 + );
13.220 + }
13.221 +
13.222 + public static class DocumentOutlineChooser implements ComponentChooser {
13.223 + public boolean checkComponent(Component comp) {
13.224 + return comp.getClass().getName().equalsIgnoreCase("org.netbeans.modules.visualweb.outline.OutlinePanel");
13.225 + }
13.226 +
13.227 + public String getDescription() {
13.228 + return "Document Outline Operator";
13.229 + }
13.230 + }
13.231 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/EditorOperator.java Thu Jul 10 04:32:50 2008 -0700
14.3 @@ -0,0 +1,829 @@
14.4 +/*
14.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.6 + *
14.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
14.8 + *
14.9 + * The contents of this file are subject to the terms of either the GNU
14.10 + * General Public License Version 2 only ("GPL") or the Common
14.11 + * Development and Distribution License("CDDL") (collectively, the
14.12 + * "License"). You may not use this file except in compliance with the
14.13 + * License. You can obtain a copy of the License at
14.14 + * http://www.netbeans.org/cddl-gplv2.html
14.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.16 + * specific language governing permissions and limitations under the
14.17 + * License. When distributing the software, include this License Header
14.18 + * Notice in each file and include the License file at
14.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
14.20 + * particular file as subject to the "Classpath" exception as provided
14.21 + * by Sun in the GPL Version 2 section of the License file that
14.22 + * accompanied this code. If applicable, add the following below the
14.23 + * License Header, with the fields enclosed by brackets [] replaced by
14.24 + * your own identifying information:
14.25 + * "Portions Copyrighted [year] [name of copyright owner]"
14.26 + *
14.27 + * Contributor(s):
14.28 + *
14.29 + * The Original Software is NetBeans. The Initial Developer of the Original
14.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
14.31 + * Microsystems, Inc. All Rights Reserved.
14.32 + *
14.33 + * If you wish your version of this file to be governed by only the CDDL
14.34 + * or only the GPL Version 2, indicate your decision by adding
14.35 + * "[Contributor] elects to include this software in this distribution
14.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
14.37 + * single choice of license, a recipient has the option to distribute
14.38 + * your version of this file under either the CDDL, the GPL Version 2 or
14.39 + * to extend the choice of license to its licensees as provided above.
14.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
14.41 + * Version 2 license, then the option applies only if the new code is
14.42 + * made subject to such option by the copyright holder.
14.43 + */
14.44 +
14.45 +package org.netbeans.modules.visualweb.gravy;
14.46 +
14.47 +import java.awt.Component;
14.48 +import java.awt.Container;
14.49 +import java.awt.event.KeyEvent;
14.50 +import java.lang.reflect.Method;
14.51 +import java.util.ArrayList;
14.52 +import java.util.Iterator;
14.53 +import java.util.List;
14.54 +import javax.swing.JComponent;
14.55 +import javax.swing.JToolBar;
14.56 +import javax.swing.text.BadLocationException;
14.57 +import javax.swing.text.Document;
14.58 +import javax.swing.text.StyledDocument;
14.59 +import org.netbeans.modules.visualweb.gravy.actions.SaveAction;
14.60 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
14.61 +
14.62 +import org.netbeans.jemmy.*;
14.63 +import org.netbeans.jemmy.operators.*;
14.64 +
14.65 +import org.openide.cookies.LineCookie;
14.66 +import org.openide.loaders.DataObject;
14.67 +import org.openide.text.Annotatable;
14.68 +import org.openide.text.Annotation;
14.69 +import org.openide.text.CloneableEditor;
14.70 +import org.openide.text.Line;
14.71 +import org.openide.text.NbDocument;
14.72 +import org.openide.text.Line.Set;
14.73 +import org.openide.windows.TopComponent;
14.74 +
14.75 +/**
14.76 + * Handle an editor top component in NetBeans IDE. It enables to get, select, insert or
14.77 + * delete text, move caret, work with annotations and with toolbar buttons.
14.78 + * Majority of operations is done by JEditorPane API calls. If you want
14.79 + * to do operations by key navigation, use methods of JEditorPaneOperator
14.80 + * instance by {@link #txtEditorPane()}. For example, call
14.81 + * <code>txtEditorPane().changeCaretPosition(int)</code> instead of
14.82 + * <code>{@link #setCaretPosition(int)}</code>.
14.83 + * <p>
14.84 + * Usage:<br>
14.85 + * <pre>
14.86 + EditorOperator eo = new EditorOperator(filename);
14.87 + eo.setCaretPositionToLine(10);
14.88 + eo.insert("// My new comment\n");
14.89 + eo.select("// My new comment");
14.90 + eo.deleteLine(10);
14.91 + eo.getToolbarButton("Toggle Bookmark").push();
14.92 + // discard changes and close
14.93 + eo.close(false);
14.94 + // save changes and close
14.95 + eo.close(true);
14.96 + // try to close all opened documents (confirmation dialog may appear)
14.97 + eo.closeAllDocuments();
14.98 + // close all opened documents and discard all changes
14.99 + eo.closeDiscardAll();
14.100 + * </pre>
14.101 + *
14.102 + * @author Jiri.Skrivanek@sun.com
14.103 + */
14.104 +public class EditorOperator extends TopComponentOperator {
14.105 +
14.106 + private static int WAIT_TIME = 60000;
14.107 +
14.108 + static {
14.109 + Timeouts.initDefault("EditorOperator.WaitModifiedTimeout", WAIT_TIME);
14.110 + }
14.111 +
14.112 + /** Components operators. */
14.113 + private JEditorPaneOperator _txtEditorPane;
14.114 + private JLabelOperator _lblRowColumn;
14.115 + private JLabelOperator _lblInputMode;
14.116 + private JLabelOperator _lblStatusBar;
14.117 + private JComboBoxOperator _cboQuickBrowse;
14.118 +
14.119 + /** Waits for the first opened editor with given name.
14.120 + * If not active, it is activated.
14.121 + * @param filename name of file showed in the editor (it used to be label of tab)
14.122 + */
14.123 + public EditorOperator(String filename) {
14.124 + this(filename, 0);
14.125 + }
14.126 +
14.127 + /** Waits for index-th opened editor with given name.
14.128 + * If not active, it is activated.
14.129 + * @param filename name of file showed in the editor (it used to be label of tab)
14.130 + * @param index index of editor to be find
14.131 + */
14.132 + public EditorOperator(String filename, int index) {
14.133 + super(waitTopComponent(null, filename, index, new EditorSubchooser(filename)));
14.134 +// super(filename, new EditorSubchooser());
14.135 + this.requestFocus(); // needed for pushKey() methods
14.136 + }
14.137 +
14.138 +
14.139 +/* public EditorOperator(ContainerOperator contOper) {
14.140 + super(contOper, new EditorSubchooser());
14.141 + this.requestFocus(); // needed for pushKey() methods
14.142 + }
14.143 +*/
14.144 + /** Waits for first open editor with given name in specified container.
14.145 + * If not active, it is activated.
14.146 + * @param contOper container where to search
14.147 + * @param filename name of file showed in the editor (it used to be label of tab)
14.148 + */
14.149 + public EditorOperator(ContainerOperator contOper, String filename) {
14.150 +// this(contOper, filename, 0);
14.151 + super(contOper, new EditorSubchooser(filename));
14.152 + this.requestFocus(); // needed for pushKey() methods
14.153 +
14.154 + }
14.155 +
14.156 + /** Waits for index-th opened editor with given name in specified container.
14.157 + * If not active, it is activated.
14.158 + * @param contOper container where to search
14.159 + * @param filename name of file showed in the editor (it used to be label of tab)
14.160 + * @param index index of editor to be find
14.161 + */
14.162 + public EditorOperator(ContainerOperator contOper, String filename, int index) {
14.163 + super(waitTopComponent(contOper, filename, index, new EditorSubchooser(filename)));
14.164 + copyEnvironment(contOper);
14.165 + this.requestFocus(); // needed for pushKey() methods
14.166 + }
14.167 +
14.168 + /** Closes all opened documents and discards all changes by IDE API calls.
14.169 + * It works also if no file is modified, so it is a safe way how to close
14.170 + * documents and no block further execution.
14.171 + */
14.172 + public static void closeDiscardAll() {
14.173 + // run in dispatch thread
14.174 + // TODO: workaround for compilation
14.175 + JTabbedPaneOperator tabbed = new JTabbedPaneOperator(RaveWindowOperator.getDefault());
14.176 + for (int i=0; i<tabbed.getTabCount();i++){
14.177 + EditorOperator.close((TopComponent)tabbed.getComponent(i),false);
14.178 + }
14.179 +/* TODO: doesn't work; rewrite it
14.180 + ModeImpl mode = (ModeImpl)new QueueTool().invokeSmoothly(new QueueTool.QueueAction("findMode") { // NOI18N
14.181 + public Object launch() {
14.182 + return WindowManagerImpl.getInstance().findMode("editor"); //NOI18N
14.183 + }
14.184 + });
14.185 + Iterator iter = mode.getOpenedTopComponents().iterator();
14.186 +
14.187 + while(iter.hasNext()) {
14.188 + EditorOperator.close((TopComponent)iter.next(), false);
14.189 + }
14.190 + */
14.191 + }
14.192 +
14.193 + /** Closes this editor by IDE API call and depending on given flag
14.194 + * it saves or discards changes.
14.195 + * @param save true - save changes, false - discard changes
14.196 + */
14.197 + public void close(boolean save) {
14.198 + if(save) {
14.199 + super.save();
14.200 + close();
14.201 + } else {
14.202 + closeDiscard();
14.203 + }
14.204 + }
14.205 +
14.206 + /** Closes top component. It saves it or not depending on given flag.
14.207 + * Other top components like VCS outputs are closed directly.
14.208 + * It is package private because it is also used by EditorWindowOperator.
14.209 + */
14.210 + static void close(TopComponent tc, boolean save) {
14.211 + TopComponentOperator tco = new TopComponentOperator(tc);
14.212 + if(save) {
14.213 + tco.save();
14.214 + tco.close();
14.215 + } else {
14.216 + tco.closeDiscard();
14.217 + }
14.218 + }
14.219 +
14.220 + /** Returns operator of currently shown editor pane.
14.221 + * @return JTabbedPaneOperator instance of editor pane
14.222 + */
14.223 + public JEditorPaneOperator txtEditorPane() {
14.224 + if(_txtEditorPane == null) {
14.225 + _txtEditorPane = new JEditorPaneOperator(this);
14.226 + }
14.227 + return _txtEditorPane;
14.228 + }
14.229 +
14.230 + /** Returns operator of label showing current row and column at the left
14.231 + * corner of the Source Editor window.
14.232 + * @return JLabelOperator instance of row:column label
14.233 + */
14.234 + public JLabelOperator lblRowColumn() {
14.235 + if(_lblRowColumn == null) {
14.236 + _lblRowColumn = new JLabelOperator(this, 0);
14.237 + }
14.238 + return _lblRowColumn;
14.239 + }
14.240 +
14.241 + /** Returns operator of label showing current input mode (INS/OVR -
14.242 + * insert/overwrite).
14.243 + * @return JLabelOperator instance of input mode label
14.244 + */
14.245 + public JLabelOperator lblInputMode() {
14.246 + if(_lblInputMode == null) {
14.247 + _lblInputMode = new JLabelOperator(this, 1);
14.248 + }
14.249 + return _lblInputMode;
14.250 + }
14.251 +
14.252 + /** Returns operator of status bar at the bottom of the Source Editor.
14.253 + * @return JLabelOperator instance of status bar
14.254 + */
14.255 + public JLabelOperator lblStatusBar() {
14.256 + if(_lblStatusBar == null) {
14.257 + _lblStatusBar = new JLabelOperator(this, 2);
14.258 + }
14.259 + return _lblStatusBar;
14.260 + }
14.261 +
14.262 + /** Returns operator of combo box showing members of the class. It
14.263 + * is applicable only for Java objects.
14.264 + * @return JComboBoxOperator instance of members combo box
14.265 + */
14.266 + public JComboBoxOperator cboQuickBrowse() {
14.267 + if (_cboQuickBrowse == null) {
14.268 + _cboQuickBrowse = new JComboBoxOperator(this);
14.269 + }
14.270 + return _cboQuickBrowse;
14.271 + }
14.272 +
14.273 + /** Selects item in quick browse combo box.
14.274 + * @param item itme to be selected
14.275 + */
14.276 + public void setQuickBrowse(String item) {
14.277 + cboQuickBrowse().selectItem(item);
14.278 + }
14.279 +
14.280 + /************** Get, select, delete, insert text ************************/
14.281 +
14.282 + /** Gets text from the currently opened Editor window.
14.283 + * @return a string representing whole content of the Editor window
14.284 + * (including new line characters)
14.285 + */
14.286 + public String getText() {
14.287 + return txtEditorPane().getText();
14.288 + }
14.289 +
14.290 + /** Gets text from specified line.
14.291 + * It might fail on the last line of a file because of issues
14.292 + * http://www.netbeans.org/issues/show_bug.cgi?id=24434 and
14.293 + * http://www.netbeans.org/issues/show_bug.cgi?id=24433.
14.294 + * @param lineNumber number of line (beggining from 1)
14.295 + * @return a string representing content of the line including new line
14.296 + * character
14.297 + */
14.298 + public String getText(int lineNumber) {
14.299 + return ((Line)getLine(lineNumber)).getText();
14.300 + }
14.301 +
14.302 + /** Returns instance of org.openide.text.Line for given line number.
14.303 + * @param lineNumber number of line (beggining at 1)
14.304 + * @return org.openide.text.Line instance
14.305 + */
14.306 + private Object getLine(int lineNumber) {
14.307 + Document doc = txtEditorPane().getDocument();
14.308 + DataObject od = (DataObject)doc.getProperty(Document.StreamDescriptionProperty);
14.309 + Set set = ((LineCookie)od.getCookie(LineCookie.class)).getLineSet();
14.310 + try {
14.311 + return set.getCurrent(lineNumber-1);
14.312 + } catch (IndexOutOfBoundsException e) {
14.313 + throw new JemmyException("Index must be > 0", e);
14.314 + }
14.315 + }
14.316 +
14.317 + /** Checks if editor window contains text specified as parameter text.
14.318 + * @param text text to compare to
14.319 + * @return true if text was found, false otherwise
14.320 + */
14.321 + public boolean contains(String text) {
14.322 + return getText().indexOf(text) != -1;
14.323 + }
14.324 +
14.325 + /** Selects whole line specified by its number. Caret will stand at the
14.326 + * next available line.
14.327 + * @param lineNumber number of line (beggining from 1)
14.328 + */
14.329 + public void select(int lineNumber) {
14.330 + int lineOffset = getLineOffset(lineNumber);
14.331 + setCaretPosition(lineOffset);
14.332 + txtEditorPane().moveCaretPosition(lineOffset+getText(lineNumber).length());
14.333 + }
14.334 +
14.335 + /** Selects text between line1 and line2 (both are included). Caret will
14.336 + * stand behing the selection (at the next line if available).
14.337 + * @param line1 number of line where to begin (beggining from 1)
14.338 + * @param line2 number of line where to finish (beggining from 1)
14.339 + */
14.340 + public void select(int line1, int line2) {
14.341 + setCaretPosition(getLineOffset(line1));
14.342 + txtEditorPane().moveCaretPosition(getLineOffset(line2)+getText(line2).length());
14.343 + }
14.344 +
14.345 + /** Selects text in specified line on position defined by column1
14.346 + * and column2 (both are included). Caret will stand at the end of
14.347 + * the selection.
14.348 + * @param lineNumber number of line (beggining from 1)
14.349 + * @param column1 column position where selection starts (beggining from 1)
14.350 + * @param column2 column position where selection ends (beggining from 1) */
14.351 + public void select(int lineNumber, int column1, int column2) {
14.352 + int lineOffset = getLineOffset(lineNumber);
14.353 + setCaretPosition(lineOffset+column1-1);
14.354 + txtEditorPane().moveCaretPosition(lineOffset+column2);
14.355 + }
14.356 +
14.357 + /** Selects index-th occurence of given text.
14.358 + * @param text text to be selected
14.359 + * @param index index of text occurence (first occurence has index 0)
14.360 + * @see #select(String)
14.361 + */
14.362 + public void select(String text, int index) {
14.363 + int position = txtEditorPane().getPositionByText(text, index);
14.364 + if(position == -1) {
14.365 + throw new JemmyException(index+"-th occurence of \""+text+"\" not found.");
14.366 + }
14.367 + setCaretPosition(position);
14.368 + txtEditorPane().moveCaretPosition(position+text.length());
14.369 + }
14.370 +
14.371 + /** Selects first occurence of given text.
14.372 + * @param text text to be selected
14.373 + * @see #select(String, int)
14.374 + */
14.375 + public void select(String text) {
14.376 + select(text, 0);
14.377 + }
14.378 +
14.379 + /** Replaces first occurence of oldText by newText.
14.380 + * @param oldText text to be replaced
14.381 + * @param newText text to write instead
14.382 + */
14.383 + public void replace(String oldText, String newText) {
14.384 + replace(oldText, newText, 0);
14.385 + }
14.386 +
14.387 + /** Replaced index-th occurence of oldText by newText.
14.388 + * @param oldText text to be replaced
14.389 + * @param newText text to write instead
14.390 + * @param index index of oldText occurence (first occurence has index 0)
14.391 + */
14.392 + public void replace(String oldText, String newText, int index) {
14.393 + select(oldText, index);
14.394 + txtEditorPane().replaceSelection(newText);
14.395 + }
14.396 +
14.397 + /** Inserts text to current position. Caret will stand at the end
14.398 + * of newly inserted text.
14.399 + * @param text a string to be inserted
14.400 + */
14.401 + public void insert(final String text) {
14.402 + final int offset = txtEditorPane().getCaretPosition();
14.403 + runMapping(new MapVoidAction("insertString") {
14.404 + public void map() {
14.405 + try {
14.406 + txtEditorPane().getDocument().insertString(offset, text, null);
14.407 + } catch (BadLocationException e) {
14.408 + throw new JemmyException("Cannot insert \""+text+"\" to position "+offset+".", e);
14.409 + }
14.410 + }
14.411 + });
14.412 + }
14.413 +
14.414 + /** Inserts text to position specified by line number and column.
14.415 + * Caret will stand at the end of newly inserted text.
14.416 + * @param text a string to be inserted
14.417 + * @param lineNumber number of line (beggining from 1)
14.418 + * @param column column position (beggining from 1)
14.419 + */
14.420 + public void insert(String text, int lineNumber, int column) {
14.421 + setCaretPosition(lineNumber, column);
14.422 + insert(text);
14.423 + }
14.424 +
14.425 + /** Deletes given number of characters from specified possition.
14.426 + * Position of caret will not change.
14.427 + * @param offset position inside document (0 means the beginning)
14.428 + * @param length number of characters to be deleted
14.429 + */
14.430 + public void delete(int offset, int length) {
14.431 + try {
14.432 + txtEditorPane().getDocument().remove(offset, length);
14.433 + } catch (BadLocationException e) {
14.434 + throw new JemmyException("Cannot delete "+length+" characters from position "
14.435 + +offset+".", e);
14.436 + }
14.437 + }
14.438 +
14.439 + /** Deletes given number of characters from current caret possition.
14.440 + * Position of caret will not change.
14.441 + * @param length number of characters to be deleted
14.442 + */
14.443 + public void delete(int length) {
14.444 + delete(txtEditorPane().getCaretPosition(), length);
14.445 + }
14.446 +
14.447 + /** Delete specified line.
14.448 + * Position of caret will not change.
14.449 + * @param line number of line (beggining from 1)
14.450 + */
14.451 + public void deleteLine(int line) {
14.452 + delete(getLineOffset(line), getText(line).length());
14.453 + }
14.454 +
14.455 + /** Deletes characters between column1 and column2 (both are included)
14.456 + * on the specified line.
14.457 + * @param lineNumber number of line (beggining from 1)
14.458 + * @param column1 column position where to start deleting (beggining from 1)
14.459 + * @param column2 column position where to stop deleting (beggining from 1) */
14.460 + public void delete(int lineNumber, int column1, int column2) {
14.461 + delete(getLineOffset(lineNumber)+column1-1, column2-column1+1);
14.462 + }
14.463 +
14.464 + /********************** Caret manipulation ************************/
14.465 +
14.466 + /** Returns current line number.
14.467 + * @return number of line where the caret stays (first line == 1)
14.468 + */
14.469 + public int getLineNumber() {
14.470 + StyledDocument doc = (StyledDocument)txtEditorPane().getDocument();
14.471 + int offset = txtEditorPane().getCaretPosition();
14.472 + return NbDocument.findLineNumber(doc, offset) + 1;
14.473 + }
14.474 +
14.475 + /** Pushes key of requested key code. */
14.476 + public void pushKey(int keyCode) {
14.477 + // need to request focus before any key push
14.478 + this.requestFocus();
14.479 + txtEditorPane().pushKey(keyCode);
14.480 + }
14.481 +
14.482 + /** Pushes Home key (KeyEvent.VK_HOME) */
14.483 + public void pushHomeKey() {
14.484 + pushKey(KeyEvent.VK_HOME);
14.485 + }
14.486 +
14.487 + /** Pushes End key (KeyEvent.VK_END) */
14.488 + public void pushEndKey() {
14.489 + pushKey(KeyEvent.VK_END);
14.490 + }
14.491 +
14.492 + /** Pushes Tab key (KeyEvent.VK_TAB) */
14.493 + public void pushTabKey() {
14.494 + pushKey(KeyEvent.VK_TAB);
14.495 + }
14.496 +
14.497 + /** Pushes Down key (KeyEvent.VK_DOWN) */
14.498 + public void pushDownArrowKey() {
14.499 + pushKey(KeyEvent.VK_DOWN);
14.500 + }
14.501 +
14.502 + /** Pushes Up key (KeyEvent.VK_UP) */
14.503 + public void pushUpArrowKey() {
14.504 + pushKey(KeyEvent.VK_UP);
14.505 + }
14.506 +
14.507 + /** Returns offset of the beginning of a line.
14.508 + * @param lineNumber number of line (starts at 1)
14.509 + * @return offset offset of line from the beginning of a file
14.510 + */
14.511 + private int getLineOffset(int lineNumber) {
14.512 + try {
14.513 + StyledDocument doc = (StyledDocument)txtEditorPane().getDocument();
14.514 + return NbDocument.findLineOffset(doc, lineNumber-1);
14.515 + } catch (IndexOutOfBoundsException e) {
14.516 + throw new JemmyException("Invalid line number "+lineNumber, e);
14.517 + }
14.518 + }
14.519 +
14.520 + /** Sets caret position relatively to current position.
14.521 + * @param relativeMove count of charaters to move caret
14.522 + */
14.523 + public void setCaretPositionRelative(int relativeMove) {
14.524 + setCaretPosition(txtEditorPane().getCaretPosition()+relativeMove);
14.525 + }
14.526 +
14.527 + /** Sets caret position to the beginning of specified line.
14.528 + * Lines are numbered from 1, so setCaretPosition(1) will set caret
14.529 + * to the beginning of the first line.
14.530 + * @param lineNumber number of line (beggining from 1)
14.531 + */
14.532 + public void setCaretPositionToLine(int lineNumber) {
14.533 + txtEditorPane().setCaretPosition(getLineOffset(lineNumber));
14.534 + }
14.535 +
14.536 + /** Sets caret position to the end of specified line.
14.537 + * Lines are numbered from 1, so setCaretPosition(1) will set caret
14.538 + * to the end of the first line.
14.539 + * @param lineNumber number of line (beggining from 1)
14.540 + */
14.541 + public void setCaretPositionToEndOfLine(int lineNumber) {
14.542 + // getText returns contents of line plus \n, that's why we use length()-1
14.543 + txtEditorPane().setCaretPosition(getLineOffset(lineNumber)+
14.544 + getText(lineNumber).length()-1);
14.545 + }
14.546 +
14.547 + /** Sets caret position to specified line and column
14.548 + * @param lineNumber line number where to set caret
14.549 + * @param column column where to set caret (1 means beginning of the row)
14.550 + */
14.551 + public void setCaretPosition(int lineNumber, int column) {
14.552 + setCaretPosition(getLineOffset(lineNumber)+column-1);
14.553 + }
14.554 +
14.555 + /** Sets caret to desired position.
14.556 + * @param position a position to set caret to (number of characters from
14.557 + * the beggining of the file - 0 means beginning of the file).
14.558 + */
14.559 + public void setCaretPosition(int position) {
14.560 + if(position < 0 || position > getText().length()) {
14.561 + throw new JemmyException("Invalid caret position "+position);
14.562 + }
14.563 + txtEditorPane().setCaretPosition(position);
14.564 + }
14.565 +
14.566 + /** Sets caret position before or after index-th occurence of given string.
14.567 + * @param text text to be searched
14.568 + * @param index index of text occurence (first occurence has index 0)
14.569 + * @param before if true put caret before text, otherwise after.
14.570 + */
14.571 + public void setCaretPosition(String text, int index, boolean before) {
14.572 + setCaretPosition(txtEditorPane().getPositionByText(text, index)
14.573 + +(before ? 0:text.length()));
14.574 + }
14.575 +
14.576 + /** Sets caret position before or after first occurence of given string.
14.577 + * @param text text to be searched
14.578 + * @param before if true put caret before text, otherwise after.
14.579 + */
14.580 + public void setCaretPosition(String text, boolean before) {
14.581 + setCaretPosition(text, 0, before);
14.582 + }
14.583 +
14.584 + /**************************** Annotations ******************************/
14.585 + /************** thanks to Jan Lahoda for valuable input ***************/
14.586 +
14.587 + /** Gets an array of annotations attached to given line.
14.588 + * @param lineNumber number of line (beggining from 1)
14.589 + * @return an array of org.openide.text.Annotation instances
14.590 + * @see #getAnnotationShortDescription
14.591 + * @see #getAnnotationType
14.592 + */
14.593 + public Object[] getAnnotations(int lineNumber) {
14.594 + return getAnnotations(getLine(lineNumber)).toArray(new Annotation[0]);
14.595 + }
14.596 +
14.597 + /** Gets annotations from given Line object
14.598 + * @param line instance of org.openide.text.Line
14.599 + * @return list of annotations
14.600 + */
14.601 + private List getAnnotations(Object line) {
14.602 + try {
14.603 + Method getAnnotations = Annotatable.class.getDeclaredMethod("getAnnotations", null);
14.604 + getAnnotations.setAccessible(true);
14.605 + return (List)getAnnotations.invoke(line, null);
14.606 + } catch (Exception e) {
14.607 + throw new JemmyException("getAnnotations() by reflection failed.", e);
14.608 + }
14.609 + }
14.610 +
14.611 + /**Gets all annotations for current editor (Document).
14.612 + * @return array of org.openide.text.Annotation containing all annotations
14.613 + * attached to this editor.
14.614 + * @see #getAnnotationShortDescription
14.615 + * @see #getAnnotationType
14.616 + */
14.617 + public Object[] getAnnotations() {
14.618 + Document doc = txtEditorPane().getDocument();
14.619 + DataObject dob = (DataObject)doc.getProperty(Document.StreamDescriptionProperty);
14.620 +
14.621 + // get line annotations
14.622 + Set set = ((LineCookie)dob.getCookie(LineCookie.class)).getLineSet();
14.623 + Iterator iter = set.getLines().iterator();
14.624 + ArrayList result = new ArrayList();
14.625 + while(iter.hasNext()) {
14.626 + result.addAll(getAnnotations((Line)iter.next()));
14.627 + }
14.628 + // get error and override parser annotations
14.629 + Class javaEditorClass = null;
14.630 + try {
14.631 + javaEditorClass = Class.forName("org.netbeans.modules.java.JavaEditor");
14.632 + } catch (ClassNotFoundException e) {
14.633 + // print only warning. Class JavaEditor don't need to be present when
14.634 + // java module is uninstalled.
14.635 + getOutput().printLine("WARNING: Class org.netbeans.modules.java.JavaEditor not found.");
14.636 + }
14.637 + Object javaEditorInstance = dob.getCookie(javaEditorClass);
14.638 + if(javaEditorInstance != null) {
14.639 + ArrayList errorAnnotations;
14.640 + try {
14.641 + java.lang.reflect.Field annot = javaEditorClass.getDeclaredField("errorAnnotations");
14.642 + annot.setAccessible(true);
14.643 + errorAnnotations = (ArrayList)annot.get(javaEditorInstance);
14.644 + } catch (Exception e) {
14.645 + throw new JemmyException("Get errorAnnotations field failed.", e);
14.646 + }
14.647 + result.addAll(errorAnnotations);
14.648 + ArrayList overrideAnnotations;
14.649 + try {
14.650 + java.lang.reflect.Field annot = javaEditorClass.getDeclaredField("overrideAnnotations");
14.651 + annot.setAccessible(true);
14.652 + overrideAnnotations = (ArrayList)annot.get(javaEditorInstance);
14.653 + } catch (Exception e) {
14.654 + throw new JemmyException("Get overrideAnnotations field failed.", e);
14.655 + }
14.656 + result.addAll(overrideAnnotations);
14.657 + }
14.658 + // return all line and parser annotations together
14.659 + return result.toArray(new Annotation[result.size()]);
14.660 + }
14.661 +
14.662 + /** Returns a string uniquely identifying annotation. For editor bookmark
14.663 + * it is for example
14.664 + * org.netbeans.modules.editor.NbEditorKit.BOOKMARK_ANNOTATION_TYPE.
14.665 + * @param annotation instance of org.openide.text.Annotation
14.666 + * @return a string uniquely identifying annotation
14.667 + * @see #getAnnotations()
14.668 + *@see #getAnnotations(int)
14.669 + */
14.670 + public static String getAnnotationType(Object annotation) {
14.671 + return ((Annotation)annotation).getAnnotationType();
14.672 + }
14.673 +
14.674 + /** Returns a short description of annotation. It is localized.
14.675 + * @param annotation instance of org.openide.text.Annotation
14.676 + * @return a short description of annotation according to current locale
14.677 + */
14.678 + public static String getAnnotationShortDescription(Object annotation) {
14.679 + return ((Annotation)annotation).getShortDescription();
14.680 + }
14.681 +
14.682 + /***************** Methods for toolbar manipulation *******************/
14.683 +
14.684 + /** Return JButtonOperator representing a toolbar button found by given
14.685 + * tooltip within the Source Editor.
14.686 + * @param buttonTooltip tooltip of toolbar button
14.687 + * @return JButtonOperator instance of found toolbar button
14.688 + */
14.689 + public JButtonOperator getToolbarButton(String buttonTooltip) {
14.690 + ToolbarButtonChooser chooser = new ToolbarButtonChooser(buttonTooltip, getComparator());
14.691 + return new JButtonOperator(JButtonOperator.waitJButton(
14.692 + (Container)this.getSource(), chooser));
14.693 + }
14.694 +
14.695 + /** Return JButtonOperator representing index-th toolbar button within
14.696 + * the Source Editor.
14.697 + * @param index index of toolbar button to find
14.698 + * @return JButtonOperator instance of found toolbar button
14.699 + */
14.700 + public JButtonOperator getToolbarButton(int index) {
14.701 + // finds JToolbar
14.702 + ComponentChooser chooser = new ComponentChooser() {
14.703 + public boolean checkComponent(Component comp) {
14.704 + return comp instanceof JToolBar;
14.705 + }
14.706 + public String getDescription() {
14.707 + return "javax.swing.JToolBar";
14.708 + }
14.709 + };
14.710 + Container toolbar = (Container)findComponent((Container)getSource(), chooser);
14.711 + if(toolbar == null) {
14.712 + throw new JemmyException("Toolbar not present.");
14.713 + }
14.714 + // if "quick browse" combo box is present, skip first button (MetalComboBoxButton usualy)
14.715 + Component combo = JComboBoxOperator.findJComboBox(toolbar,
14.716 + ComponentSearcher.getTrueChooser("JComboBox"));
14.717 + if(combo != null) {
14.718 + index++;
14.719 + }
14.720 + return new JButtonOperator(JButtonOperator.waitJButton((Container)toolbar,
14.721 + ComponentSearcher.getTrueChooser("JButton"), index));
14.722 + }
14.723 +
14.724 + /** Pushes popup menu on toolbar. It doesn't matter on which position it is
14.725 + * invoked, everytime it is the same. That's why popup menu is invoked on
14.726 + * the toolbar button with index 0. To switch toolbar on use Options ->
14.727 + * Editing -> Editor Settings -> Toolbar Visible -> true.
14.728 + * @param popupPath path to menu item (e.g. "Toolbar Visible")
14.729 + */
14.730 + public void pushToolbarPopupMenu(String popupPath) {
14.731 + getToolbarButton(0).clickForPopup();
14.732 + new JPopupMenuOperator().pushMenu(popupPath, "|");
14.733 + }
14.734 +
14.735 + /** Chooser which can be used to find a component with given tooltip,
14.736 + * in this case a toolbar button.
14.737 + */
14.738 + private static class ToolbarButtonChooser implements ComponentChooser {
14.739 + private String buttonTooltip;
14.740 + private StringComparator comparator;
14.741 +
14.742 + public ToolbarButtonChooser(String buttonTooltip, StringComparator comparator) {
14.743 + this.buttonTooltip = buttonTooltip;
14.744 + this.comparator = comparator;
14.745 + }
14.746 +
14.747 + public boolean checkComponent(Component comp) {
14.748 + return comparator.equals(((JComponent)comp).getToolTipText(), buttonTooltip);
14.749 + }
14.750 +
14.751 + public String getDescription() {
14.752 + return "Toolbar button with tooltip \""+buttonTooltip+"\".";
14.753 + }
14.754 + }
14.755 +
14.756 + /** Returns current modify state of edited source
14.757 + * @return boolean true when edited source is modified
14.758 + */
14.759 + public boolean isModified() {
14.760 + return getName().endsWith("*");
14.761 + }
14.762 +
14.763 + /** Waits for given modified state of edited source.
14.764 + * @param modified boolean true waits for file state change to modified, false for change to
14.765 + * unmodified (saved).
14.766 + * Throws TimeoutExpiredException when EditorOperator.WaitModifiedTimeout expires.
14.767 + */
14.768 + public void waitModified(final boolean modified) {
14.769 + try {
14.770 + Waiter waiter = new Waiter(new Waitable() {
14.771 + public Object actionProduced(Object obj) {
14.772 + return isModified()==modified?new Object():null;
14.773 + }
14.774 + public String getDescription() {
14.775 + return("Wait Modified State");
14.776 + }
14.777 + });
14.778 + Timeouts times = getTimeouts().cloneThis();
14.779 + times.setTimeout("Waiter.WaitingTime", times.getTimeout("EditorOperator.WaitModifiedTimeout"));
14.780 + waiter.setTimeouts(times);
14.781 + waiter.setOutput(getOutput());
14.782 + waiter.waitAction(null);
14.783 + } catch(InterruptedException e) {}
14.784 + }
14.785 +
14.786 + /** Performs save action with optional verification. */
14.787 + public void save() {
14.788 + new SaveAction().perform(this);
14.789 + if (getVerification())
14.790 + waitModified(false);
14.791 + }
14.792 +
14.793 + public void closeAndCancelByPopup() {
14.794 + this.clickForPopup();
14.795 + new JPopupMenuOperator().pushMenu("Close");
14.796 + new EventTool().waitNoEvent(500);
14.797 +
14.798 + try {
14.799 + JDialogOperator qDialog = new JDialogOperator("Question");
14.800 + new QueueTool().waitEmpty(100);
14.801 + new JButtonOperator(qDialog, "Cancel").push();
14.802 + }catch(Exception e) {}
14.803 + }
14.804 +
14.805 +
14.806 + /** Performs verification by accessing all sub-components */
14.807 + public void verify() {
14.808 + txtEditorPane();
14.809 + cboQuickBrowse();
14.810 + lblInputMode();
14.811 + lblRowColumn();
14.812 + lblStatusBar();
14.813 + }
14.814 +
14.815 + /** SubChooser to determine Editor TopComponent
14.816 + * Used in findTopComponent method.
14.817 + */
14.818 + private static final class EditorSubchooser implements ComponentChooser {
14.819 + String ID;
14.820 + public EditorSubchooser(String ID) {
14.821 + this.ID = ID;
14.822 + }
14.823 + public boolean checkComponent(Component comp) {
14.824 + return(comp instanceof CloneableEditor &&
14.825 + ((CloneableEditor)comp).getName().indexOf(ID) != -1 && comp.isShowing());
14.826 + }
14.827 +
14.828 + public String getDescription() {
14.829 + return "org.openide.text.CloneableEditor";
14.830 + }
14.831 + }
14.832 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/Flasher.java Thu Jul 10 04:32:50 2008 -0700
15.3 @@ -0,0 +1,225 @@
15.4 +/*
15.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.6 + *
15.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
15.8 + *
15.9 + * The contents of this file are subject to the terms of either the GNU
15.10 + * General Public License Version 2 only ("GPL") or the Common
15.11 + * Development and Distribution License("CDDL") (collectively, the
15.12 + * "License"). You may not use this file except in compliance with the
15.13 + * License. You can obtain a copy of the License at
15.14 + * http://www.netbeans.org/cddl-gplv2.html
15.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15.16 + * specific language governing permissions and limitations under the
15.17 + * License. When distributing the software, include this License Header
15.18 + * Notice in each file and include the License file at
15.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
15.20 + * particular file as subject to the "Classpath" exception as provided
15.21 + * by Sun in the GPL Version 2 section of the License file that
15.22 + * accompanied this code. If applicable, add the following below the
15.23 + * License Header, with the fields enclosed by brackets [] replaced by
15.24 + * your own identifying information:
15.25 + * "Portions Copyrighted [year] [name of copyright owner]"
15.26 + *
15.27 + * Contributor(s):
15.28 + *
15.29 + * The Original Software is NetBeans. The Initial Developer of the Original
15.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
15.31 + * Microsystems, Inc. All Rights Reserved.
15.32 + *
15.33 + * If you wish your version of this file to be governed by only the CDDL
15.34 + * or only the GPL Version 2, indicate your decision by adding
15.35 + * "[Contributor] elects to include this software in this distribution
15.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
15.37 + * single choice of license, a recipient has the option to distribute
15.38 + * your version of this file under either the CDDL, the GPL Version 2 or
15.39 + * to extend the choice of license to its licensees as provided above.
15.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
15.41 + * Version 2 license, then the option applies only if the new code is
15.42 + * made subject to such option by the copyright holder.
15.43 + */
15.44 +
15.45 +/**
15.46 + *
15.47 + * $Id$ $Revision$ $Date$
15.48 + *
15.49 + */
15.50 +package org.netbeans.modules.visualweb.gravy;
15.51 +
15.52 +import java.awt.Color;
15.53 +import java.awt.Dimension;
15.54 +import java.awt.Graphics;
15.55 +import java.awt.Component;
15.56 +import java.awt.Point;
15.57 +import javax.swing.JDialog;
15.58 +import javax.swing.JFrame;
15.59 +import javax.swing.JLayeredPane;
15.60 +import javax.swing.JPanel;
15.61 +import javax.swing.SwingUtilities;
15.62 +
15.63 +import org.netbeans.jemmy.operators.ComponentOperator;
15.64 +import org.netbeans.jemmy.JemmyException;
15.65 +import org.netbeans.jemmy.JemmyProperties;
15.66 +import org.netbeans.jemmy.Timeoutable;
15.67 +import org.netbeans.jemmy.Timeouts;
15.68 +
15.69 +/**
15.70 + * Flasher is a utility class allowing to highlight special point by drawing a cross with
15.71 + * this point as center. It can be useful when it's necessary to see where is given point situated
15.72 + * @version 1.0 Mar 15, 2005
15.73 + */
15.74 +public class Flasher implements Timeoutable{
15.75 +
15.76 + /**
15.77 + * Default color of the cross. Now it's red.
15.78 + */
15.79 + public static final Color DEFAULT_COLOR=new Color(255,0,0);
15.80 + protected static final int len=30;
15.81 + protected Color color=DEFAULT_COLOR;
15.82 + protected static long WAIT_TIME=1000;
15.83 +
15.84 + /**
15.85 + * By default, flash is executed in the main thread
15.86 + */
15.87 + protected boolean separateThread=false;
15.88 + protected Timeouts timeouts;
15.89 +
15.90 + static {
15.91 + Timeouts.initDefault("Flasher.FlashTimeout", WAIT_TIME);
15.92 + }
15.93 +
15.94 + public void setTimeouts(Timeouts timeouts) {
15.95 + this.timeouts = timeouts;
15.96 + }
15.97 +
15.98 + public Timeouts getTimeouts() {
15.99 + return timeouts;
15.100 + }
15.101 +
15.102 + /**
15.103 + * Constructs new object ready for flashing
15.104 + */
15.105 + public Flasher(){
15.106 + this(false);
15.107 + }
15.108 +
15.109 + /**
15.110 + * Constructs new object ready for flashing
15.111 + * @param separateThread If true, flash will be started in separate thread
15.112 + * and test execution continues without delay
15.113 + */
15.114 + public Flasher(boolean separateThread){
15.115 + this.separateThread=separateThread;
15.116 + setTimeouts(JemmyProperties.getProperties().getTimeouts());
15.117 + }
15.118 +
15.119 + /**
15.120 + * Sets color of the cross. Must be used before flash() call
15.121 + * @param color New color
15.122 + */
15.123 + public void setColor(Color color){
15.124 + this.color=color;
15.125 + }
15.126 +
15.127 + /**
15.128 + * Draws a cross with center in specified point of component
15.129 + * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
15.130 + * @param p Center of the cross
15.131 + * @param op Operator for parent component of the point
15.132 + */
15.133 + public void flash(ComponentOperator op, Point p){
15.134 + flash(op.getSource(),p);
15.135 + }
15.136 +
15.137 + /**
15.138 + * Draws a cross with center in specified point of component
15.139 + * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
15.140 + * @param x x-coordinate of center of the cross
15.141 + * @param y x-coordinate of center of the cross
15.142 + * @param op Operator for parent component of the point
15.143 + */
15.144 + public void flash(ComponentOperator op, int x, int y){
15.145 + flash(op.getSource(),x,y);
15.146 + }
15.147 +
15.148 + /**
15.149 + * Draws a cross with center in specified point of component
15.150 + * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
15.151 + * @param x x-coordinate of center of the cross
15.152 + * @param y x-coordinate of center of the cross
15.153 + * @param comp Parent component of the point
15.154 + */
15.155 + public void flash(Component comp, int x, int y){
15.156 + flash(comp,new Point(x,y));
15.157 + }
15.158 +
15.159 + /**
15.160 + * Draws a cross with center in specified point of component
15.161 + * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
15.162 + * @param p Center of the cross
15.163 + * @param comp Parent component of the point
15.164 + */
15.165 + public void flash(final Component comp, final Point p){
15.166 +
15.167 + if (separateThread){
15.168 + new Thread(new Runnable() {
15.169 + public void run() {
15.170 + doFlash(comp,p);
15.171 + }
15.172 + }).start();
15.173 + }else{
15.174 + doFlash(comp,p);
15.175 + }
15.176 + }
15.177 +
15.178 + /**
15.179 + * Draws a cross. Called from flash() in the main thread or in a
15.180 + * separate thread depending on separateThread field value
15.181 + */
15.182 + protected void doFlash(Component comp, Point p){
15.183 +
15.184 + // we need to find JDialog or JFrame ancestor to use JLayeredPane
15.185 + JFrame f;
15.186 + JDialog d;
15.187 + JLayeredPane lpane=null;
15.188 + if (comp instanceof JDialog){
15.189 + lpane=((JDialog)comp).getLayeredPane();
15.190 + }else if (comp instanceof JFrame){
15.191 + lpane=((JFrame)comp).getLayeredPane();
15.192 + }else if ((d=(JDialog)SwingUtilities.getAncestorOfClass(JDialog.class, comp))!=null){
15.193 + lpane=d.getLayeredPane();
15.194 + }else if ((f=(JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, comp))!=null){
15.195 + lpane=f.getLayeredPane();
15.196 + }else{
15.197 + throw new JemmyException("Containing dialog or frame not found");
15.198 + }
15.199 + Point p1= new Point (p.x+comp.getLocationOnScreen().x-lpane.getLocationOnScreen().x,
15.200 + p.y+comp.getLocationOnScreen().y-lpane.getLocationOnScreen().y);
15.201 + JPanel flash=new FlashPane(p1,lpane.getSize());
15.202 + lpane.add(flash, JLayeredPane.DRAG_LAYER);
15.203 + lpane.repaint();
15.204 + try{
15.205 + Thread.currentThread().sleep(timeouts.getTimeout("Flasher.FlashTimeout"));
15.206 + }catch(InterruptedException e) {}
15.207 + lpane.remove(flash);
15.208 + lpane.repaint();
15.209 + }
15.210 +
15.211 + protected class FlashPane extends JPanel{
15.212 +
15.213 + private Point p;
15.214 + public FlashPane(Point p, Dimension d){
15.215 + super();
15.216 + this.p=p;
15.217 + setSize(d);
15.218 + setOpaque(false);
15.219 + }
15.220 +
15.221 + public synchronized void paint(Graphics g){
15.222 + super.paint(g);
15.223 + g.setColor(color);
15.224 + g.drawLine(p.x-len,p.y,p.x+len,p.y);
15.225 + g.drawLine(p.x,p.y-len,p.x,p.y+len);
15.226 + }
15.227 + }
15.228 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/HelpOperator.java Thu Jul 10 04:32:50 2008 -0700
16.3 @@ -0,0 +1,410 @@
16.4 +/*
16.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
16.6 + *
16.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
16.8 + *
16.9 + * The contents of this file are subject to the terms of either the GNU
16.10 + * General Public License Version 2 only ("GPL") or the Common
16.11 + * Development and Distribution License("CDDL") (collectively, the
16.12 + * "License"). You may not use this file except in compliance with the
16.13 + * License. You can obtain a copy of the License at
16.14 + * http://www.netbeans.org/cddl-gplv2.html
16.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16.16 + * specific language governing permissions and limitations under the
16.17 + * License. When distributing the software, include this License Header
16.18 + * Notice in each file and include the License file at
16.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
16.20 + * particular file as subject to the "Classpath" exception as provided
16.21 + * by Sun in the GPL Version 2 section of the License file that
16.22 + * accompanied this code. If applicable, add the following below the
16.23 + * License Header, with the fields enclosed by brackets [] replaced by
16.24 + * your own identifying information:
16.25 + * "Portions Copyrighted [year] [name of copyright owner]"
16.26 + *
16.27 + * Contributor(s):
16.28 + *
16.29 + * The Original Software is NetBeans. The Initial Developer of the Original
16.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
16.31 + * Microsystems, Inc. All Rights Reserved.
16.32 + *
16.33 + * If you wish your version of this file to be governed by only the CDDL
16.34 + * or only the GPL Version 2, indicate your decision by adding
16.35 + * "[Contributor] elects to include this software in this distribution
16.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
16.37 + * single choice of license, a recipient has the option to distribute
16.38 + * your version of this file under either the CDDL, the GPL Version 2 or
16.39 + * to extend the choice of license to its licensees as provided above.
16.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
16.41 + * Version 2 license, then the option applies only if the new code is
16.42 + * made subject to such option by the copyright holder.
16.43 + */
16.44 +
16.45 +package org.netbeans.modules.visualweb.gravy;
16.46 +
16.47 +import java.awt.Component;
16.48 +import java.awt.Dialog;
16.49 +import java.awt.Frame;
16.50 +import java.awt.Window;
16.51 +import org.netbeans.modules.visualweb.gravy.actions.HelpAction;
16.52 +import org.netbeans.jemmy.ComponentChooser;
16.53 +import org.netbeans.jemmy.TestOut;
16.54 +import org.netbeans.jemmy.operators.JButtonOperator;
16.55 +import org.netbeans.jemmy.operators.JEditorPaneOperator;
16.56 +import org.netbeans.jemmy.operators.JSplitPaneOperator;
16.57 +import org.netbeans.jemmy.operators.JTabbedPaneOperator;
16.58 +import org.netbeans.jemmy.operators.JTextFieldOperator;
16.59 +import org.netbeans.jemmy.operators.JTreeOperator;
16.60 +import org.netbeans.jemmy.operators.WindowOperator;
16.61 +
16.62 +/** Class implementing all necessary methods for handling "IDE Help" Frame.
16.63 + * Normally the Help window is a JFrame.
16.64 + * But the Help window can be transformed to a JDialog
16.65 + * when another modal dialog is shown. This operator can handle both states.
16.66 + *
16.67 + * @see HelpAction
16.68 + */
16.69 +public class HelpOperator extends WindowOperator {
16.70 +
16.71 + /** Creates new HelpOperator that can handle it. It tries to find a window
16.72 + * which contains some javax.help.JHelp* sub component.
16.73 + * It throws TimeoutExpiredException when window is not found
16.74 + */
16.75 + public HelpOperator() {
16.76 + super(WindowOperator.waitWindow(new HelpWindowChooser()));
16.77 + }
16.78 +
16.79 + /** Creates new HelpOperator that can handle it. It tries to find a window
16.80 + * which contains some javax.help.JHelp* sub component and the window
16.81 + * has given title.
16.82 + * It throws TimeoutExpiredException when JFrame not found
16.83 + * @param title String help frame title
16.84 + */
16.85 + public HelpOperator(String title) {
16.86 + super(WindowOperator.waitWindow(new HelpWindowChooser(title)));
16.87 + }
16.88 +
16.89 + private static final HelpAction helpAction = new HelpAction();
16.90 +
16.91 + private JButtonOperator _btBack;
16.92 + private JButtonOperator _btNext;
16.93 + private JButtonOperator _btPrint;
16.94 + private JButtonOperator _btPageSetup;
16.95 + private JSplitPaneOperator _splpHelpSplitPane;
16.96 + private JTabbedPaneOperator _tbpHelpTabPane;
16.97 + private JTreeOperator _treeContents;
16.98 + private JTreeOperator _treeIndex;
16.99 + private JTextFieldOperator _txtIndexFind;
16.100 + private JTreeOperator _treeSearch;
16.101 + private JTextFieldOperator _txtSearchFind;
16.102 + private JEditorPaneOperator _txtContentViewer;
16.103 +
16.104 + /** Returns title of help window. The help window can be either JFrame
16.105 + * or JDialog.
16.106 + * @return title of help window
16.107 + */
16.108 + public String getTitle() {
16.109 + if(getSource() instanceof Frame) {
16.110 + return ((Frame)getSource()).getTitle();
16.111 + } else {
16.112 + return ((Dialog)getSource()).getTitle();
16.113 + }
16.114 + }
16.115 +
16.116 + /** invokes default help
16.117 + * @return HelpOperator for invoked help */
16.118 + public static HelpOperator invoke() {
16.119 + helpAction.perform();
16.120 + return new HelpOperator();
16.121 + }
16.122 +
16.123 + /** invokes help with defined help set
16.124 + * @param helpSet String help set name
16.125 + * @return HelpOperator for invoked help */
16.126 + public static HelpOperator invoke(String helpSet) {
16.127 + new HelpAction(helpSet).perform();
16.128 + return new HelpOperator(helpSet);
16.129 + }
16.130 +
16.131 + /** Tries to find "" JButton in this dialog.
16.132 + * It throws TimeoutExpiredException when component not found
16.133 + * @return JButtonOperator
16.134 + */
16.135 + public JButtonOperator btBack() {
16.136 + if (_btBack==null) {
16.137 + _btBack = new JButtonOperator(this, helpButtonChooser, 0);
16.138 + }
16.139 + return _btBack;
16.140 + }
16.141 +
16.142 + /** Tries to find "" JButton in this dialog.
16.143 + * It throws TimeoutExpiredException when component not found
16.144 + * @return JButtonOperator
16.145 + */
16.146 + public JButtonOperator btNext() {
16.147 + if (_btNext==null) {
16.148 + _btNext = new JButtonOperator(this, helpButtonChooser, 1);
16.149 + }
16.150 + return _btNext;
16.151 + }
16.152 +
16.153 + /** Tries to find "" JButton in this dialog.
16.154 + * It throws TimeoutExpiredException when component not found
16.155 + * @return JButtonOperator
16.156 + */
16.157 + public JButtonOperator btPrint() {
16.158 + if (_btPrint==null) {
16.159 + _btPrint = new JButtonOperator(this, helpButtonChooser, 3);
16.160 + }
16.161 + return _btPrint;
16.162 + }
16.163 +
16.164 + /** Tries to find "" JSplitPaneOperator in this dialog.
16.165 + * It throws TimeoutExpiredException when component not found
16.166 + * @return JButtonOperator
16.167 + */
16.168 + public JSplitPaneOperator splpHelpSplitPane() {
16.169 + if (_splpHelpSplitPane==null) {
16.170 + _splpHelpSplitPane = new JSplitPaneOperator( this );
16.171 + }
16.172 + return _splpHelpSplitPane;
16.173 + }
16.174 +
16.175 + /** Tries to find "" JTabbedPane in this dialog.
16.176 + * It throws TimeoutExpiredException when component not found
16.177 + * @return JButtonOperator
16.178 + */
16.179 + public JTabbedPaneOperator tbpHelpTabPane() {
16.180 + if (_tbpHelpTabPane==null) {
16.181 + _tbpHelpTabPane = new JTabbedPaneOperator( splpHelpSplitPane() );
16.182 + }
16.183 + return _tbpHelpTabPane;
16.184 + }
16.185 +
16.186 + /** Tries to find "" JButton in this dialog.
16.187 + * It throws TimeoutExpiredException when component not found
16.188 + * @return JButtonOperator
16.189 + */
16.190 + public JButtonOperator btPageSetup() {
16.191 + if (_btPageSetup==null) {
16.192 + _btPageSetup = new JButtonOperator(this, helpButtonChooser, 4);
16.193 + }
16.194 + return _btPageSetup;
16.195 + }
16.196 +
16.197 + /** Tries to find JTree in Contents tab of this dialog.
16.198 + * It throws TimeoutExpiredException when component not found
16.199 + * @return JTreeOperator
16.200 + */
16.201 + public JTreeOperator treeContents() {
16.202 + selectPageContents();
16.203 + if (_treeContents==null) {
16.204 + _treeContents = new JTreeOperator( tbpHelpTabPane(), 0 );
16.205 + }
16.206 + return _treeContents;
16.207 + }
16.208 +
16.209 + /** Tries to find JTree in Index tab of this dialog.
16.210 + * It throws TimeoutExpiredException when component not found
16.211 + * @return JTreeOperator
16.212 + */
16.213 + public JTreeOperator treeIndex() {
16.214 + selectPageIndex();
16.215 + if (_treeIndex==null) {
16.216 + _treeIndex = new JTreeOperator( tbpHelpTabPane(), 0 );
16.217 + }
16.218 + return _treeIndex;
16.219 + }
16.220 +
16.221 + /** Tries to find JTextField Find in Index tab of this dialog.
16.222 + * It throws TimeoutExpiredException when component not found
16.223 + * @return JTextFieldOperator
16.224 + */
16.225 + public JTextFieldOperator txtIndexFind() {
16.226 + selectPageIndex();
16.227 + if (_txtIndexFind==null) {
16.228 + _txtIndexFind = new JTextFieldOperator( tbpHelpTabPane(), 0 );
16.229 + }
16.230 + return _txtIndexFind;
16.231 + }
16.232 +
16.233 + /** Tries to find JTree in Search tab of this dialog.
16.234 + * It throws TimeoutExpiredException when component not found
16.235 + * @return JTreeOperator
16.236 + */
16.237 + public JTreeOperator treeSearch() {
16.238 + selectPageSearch();
16.239 + if (_treeSearch==null) {
16.240 + _treeSearch = new JTreeOperator( tbpHelpTabPane(), 0 );
16.241 + }
16.242 + return _treeSearch;
16.243 + }
16.244 +
16.245 + /** Tries to find JTextField Find in Search tab of this dialog.
16.246 + * It throws TimeoutExpiredException when component not found
16.247 + * @return JTextFieldOperator
16.248 + */
16.249 + public JTextFieldOperator txtSearchFind() {
16.250 + selectPageSearch();
16.251 + if (_txtSearchFind==null) {
16.252 + _txtSearchFind = new JTextFieldOperator( tbpHelpTabPane(), 0 );
16.253 + }
16.254 + return _txtSearchFind;
16.255 + }
16.256 +
16.257 + /** Tries to find null BasicContentViewerUI$JHEditorPane in this dialog.
16.258 + * It throws TimeoutExpiredException when component not found
16.259 + * @return JEditorPaneOperator
16.260 + */
16.261 + public JEditorPaneOperator txtContentViewer() {
16.262 + if (_txtContentViewer==null) {
16.263 + _txtContentViewer = new JEditorPaneOperator( splpHelpSplitPane(), 0 );
16.264 + }
16.265 + return _txtContentViewer;
16.266 + }
16.267 +
16.268 + /** clicks on "Back" JButton
16.269 + * It throws TimeoutExpiredException when MetalSplitPaneDivider$1 not found
16.270 + */
16.271 + public void back() {
16.272 + btBack().push();
16.273 + }
16.274 +
16.275 + /** clicks on "Next" JButton
16.276 + * It throws TimeoutExpiredException when JButton not found
16.277 + */
16.278 + public void next() {
16.279 + btNext().push();
16.280 + }
16.281 +
16.282 + /** clicks on "Print" JButton
16.283 + * It throws TimeoutExpiredException when JButton not found
16.284 + */
16.285 + public void print() {
16.286 + btPrint().push();
16.287 + }
16.288 +
16.289 + /** clicks on "Page Setup" JButton
16.290 + * It throws TimeoutExpiredException when JButton not found
16.291 + */
16.292 + public void pageSetup() {
16.293 + btPageSetup().pushNoBlock();
16.294 + }
16.295 +
16.296 + /** selects page Contents */
16.297 + public void selectPageContents() {
16.298 + tbpHelpTabPane().selectPage(0);
16.299 + }
16.300 +
16.301 + /** selects page Index */
16.302 + public void selectPageIndex() {
16.303 + tbpHelpTabPane().selectPage(1);
16.304 + }
16.305 +
16.306 + /** selects page Search */
16.307 + public void selectPageSearch() {
16.308 + tbpHelpTabPane().selectPage(2);
16.309 + }
16.310 +
16.311 + /** tries to find and set text of txtIndexFind
16.312 + * @param text String text
16.313 + */
16.314 + public void indexFind( String text ) {
16.315 + txtIndexFind().enterText(text);
16.316 + }
16.317 +
16.318 + /** tries to find and set text of txtSearchFind
16.319 + * @param text String text
16.320 + */
16.321 + public void searchFind( String text ) {
16.322 + txtSearchFind().enterText(text);
16.323 + }
16.324 +
16.325 + /** returns help content in plain text form
16.326 + * @return String text of help
16.327 + */
16.328 + public String getContentText() {
16.329 + return txtContentViewer().getText();
16.330 + }
16.331 +
16.332 + /** Performs verification by accessing all sub-components */
16.333 + public void verify() {
16.334 + btBack();
16.335 + btNext();
16.336 + btPageSetup();
16.337 + btPrint();
16.338 + treeContents();
16.339 + txtContentViewer();
16.340 + treeIndex();
16.341 + txtIndexFind();
16.342 + treeSearch();
16.343 + txtSearchFind();
16.344 + }
16.345 +
16.346 + /** Implementation of ComponentChooser to choose component which
16.347 + * is instance of javax.help.JHelp*. */
16.348 + private static final ComponentChooser jHelpChooser = new ComponentChooser() {
16.349 + public boolean checkComponent(Component comp) {
16.350 + return comp.getClass().getName().startsWith("javax.help.JHelp");
16.351 + }
16.352 + public String getDescription() {
16.353 + return("any javax.help");
16.354 + }
16.355 + };
16.356 +
16.357 + /** Compare title of window with given pattern. */
16.358 + private static boolean compareTitle(WindowOperator oper, String expectedTitle) {
16.359 + String title;
16.360 + if(oper.getSource() instanceof Frame) {
16.361 + title = ((Frame)oper.getSource()).getTitle();
16.362 + } else {
16.363 + title = ((Dialog)oper.getSource()).getTitle();
16.364 + }
16.365 + return oper.getComparator().equals(title, expectedTitle);
16.366 + }
16.367 +
16.368 + /** SubChooser to determine Window which contains some
16.369 + * javax.help.JHelp* sub component.
16.370 + */
16.371 + private static final class HelpWindowChooser implements ComponentChooser {
16.372 +
16.373 + private String title;
16.374 +
16.375 + public HelpWindowChooser() {
16.376 + }
16.377 +
16.378 + public HelpWindowChooser(String title) {
16.379 + this.title = title;
16.380 + }
16.381 +
16.382 + public boolean checkComponent(Component comp) {
16.383 + WindowOperator winOper = new WindowOperator((Window)comp);
16.384 + winOper.setOutput(TestOut.getNullOutput());
16.385 + if(winOper.findSubComponent(jHelpChooser) != null) {
16.386 + if(title != null) {
16.387 + return compareTitle(winOper, title);
16.388 + } else {
16.389 + return true;
16.390 + }
16.391 + }
16.392 + return false;
16.393 + }
16.394 +
16.395 + public String getDescription() {
16.396 + return "containing any javax.help.JHelp component"+
16.397 + (title == null ? "" : " and with title '"+title+"'");
16.398 + }
16.399 + }
16.400 +
16.401 + /** SubChooser to find HelpButton in help window. */
16.402 + private static final ComponentChooser helpButtonChooser = new ComponentChooser() {
16.403 +
16.404 + public boolean checkComponent(Component comp) {
16.405 + return comp.getClass().getName().endsWith("HelpButton");
16.406 + }
16.407 +
16.408 + public String getDescription() {
16.409 + return "HelpButton";
16.410 + }
16.411 + };
16.412 +}
16.413 +
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/HttpTestCase.java Thu Jul 10 04:32:50 2008 -0700
17.3 @@ -0,0 +1,156 @@
17.4 +/*
17.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.6 +*
17.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
17.8 +*
17.9 +* The contents of this file are subject to the terms of either the GNU
17.10 +* General Public License Version 2 only ("GPL") or the Common
17.11 +* Development and Distribution License("CDDL") (collectively, the
17.12 +* "License"). You may not use this file except in compliance with the
17.13 +* License. You can obtain a copy of the License at
17.14 +* http://www.netbeans.org/cddl-gplv2.html
17.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.16 +* specific language governing permissions and limitations under the
17.17 +* License. When distributing the software, include this License Header
17.18 +* Notice in each file and include the License file at
17.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17.20 +* particular file as subject to the "Classpath" exception as provided
17.21 +* by Sun in the GPL Version 2 section of the License file that
17.22 +* accompanied this code. If applicable, add the following below the
17.23 +* License Header, with the fields enclosed by brackets [] replaced by
17.24 +* your own identifying information:
17.25 +* "Portions Copyrighted [year] [name of copyright owner]"
17.26 +*
17.27 +* Contributor(s):
17.28 +*
17.29 +* The Original Software is NetBeans. The Initial Developer of the Original
17.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17.31 +* Microsystems, Inc. All Rights Reserved.
17.32 +*
17.33 +* If you wish your version of this file to be governed by only the CDDL
17.34 +* or only the GPL Version 2, indicate your decision by adding
17.35 +* "[Contributor] elects to include this software in this distribution
17.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
17.37 +* single choice of license, a recipient has the option to distribute
17.38 +* your version of this file under either the CDDL, the GPL Version 2 or
17.39 +* to extend the choice of license to its licensees as provided above.
17.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
17.41 +* Version 2 license, then the option applies only if the new code is
17.42 +* made subject to such option by the copyright holder.
17.43 +*/
17.44 +
17.45 +package org.netbeans.modules.visualweb.gravy;
17.46 +
17.47 +import com.meterware.httpunit.*;
17.48 +import junit.framework.Test;
17.49 +import junit.framework.TestCase;
17.50 +import junit.framework.TestSuite;
17.51 +import java.io.File;
17.52 +import org.netbeans.junit.NbTestCase;
17.53 +
17.54 +/**
17.55 + * This class allows to check a real execution of deployed web-application
17.56 + * inside running automated test.
17.57 + */
17.58 +public class HttpTestCase extends NbTestCase implements Test {
17.59 + private WebConversation conversation;
17.60 + private WebRequest request;
17.61 + private WebResponse response;
17.62 + private long waitTime = 10000;
17.63 + private long waitDelta = 100;
17.64 + TestProperties props;
17.65 +
17.66 + /**
17.67 + * Creates a new instance of this class.
17.68 + * @param testName a name of new created test.
17.69 + */
17.70 + public HttpTestCase(String testName) {
17.71 + super(testName);
17.72 + conversation = new WebConversation();
17.73 + props = new TestProperties();
17.74 + }
17.75 +
17.76 + /**
17.77 + * Initializes an instance of class WebConversation, which will
17.78 + * check an execution of web-application.
17.79 + * @return the created instance of WebConversation
17.80 + */
17.81 + public WebConversation initConversation() {
17.82 + getLog().println("Creating WebConversation");
17.83 + conversation = new WebConversation();
17.84 + return(conversation);
17.85 + }
17.86 +
17.87 + /**
17.88 + * Returns an instance of initialized WebConversation.
17.89 + * @return the instance of WebConversation
17.90 + */
17.91 + public WebConversation getConversation() {
17.92 + return(conversation);
17.93 + }
17.94 +
17.95 + /**
17.96 + * Initializes an instance of http-request.
17.97 + * @param path an absolute URL to a deployed web-application
17.98 + * @return the instance of http-request
17.99 + */
17.100 + public WebRequest initRequest(String path) {
17.101 + getLog().println("Creating request for \"" + path + "\"");
17.102 + request = new GetMethodWebRequest(path);
17.103 + return(request);
17.104 + }
17.105 +
17.106 + /**
17.107 + * Returns an instance of initialized http-request.
17.108 + * @return the instance of http-request
17.109 + */
17.110 + public WebRequest getRequest() {
17.111 + return(request);
17.112 + }
17.113 +
17.114 + /**
17.115 + * Returns a http-response from web-server.
17.116 + * @return the instance of http-response
17.117 + */
17.118 + public WebResponse getResponse() throws Exception {
17.119 + getLog().println("Getting response for " + request);
17.120 + Exception exc = null;
17.121 + long startTime = System.currentTimeMillis();
17.122 + do {
17.123 + try {
17.124 + response = conversation.getResponse(request);
17.125 + } catch(Exception e) {
17.126 + exc = e;
17.127 + Thread.sleep(waitDelta);
17.128 + }
17.129 + } while(exc != null && (System.currentTimeMillis() - startTime) < waitTime);
17.130 + if(exc != null) {
17.131 + System.out.println("WebRequest.getResponse() did not succed in 1 minute");
17.132 + System.out.println("Ended up with exception:");
17.133 + exc.printStackTrace();
17.134 + throw(exc);
17.135 + }
17.136 + return(response);
17.137 + }
17.138 +
17.139 + /**
17.140 + * Returns the last received web-response or waits, until the first web-response
17.141 + * is received, and returns it.
17.142 + * @return the instance of WebResponse
17.143 + */
17.144 + public WebResponse lastResponse() throws Exception {
17.145 + if(response == null) {
17.146 + return(getResponse());
17.147 + } else {
17.148 + return(response);
17.149 + }
17.150 + }
17.151 +
17.152 + /**
17.153 + * Returns test properties (TestProperties object).
17.154 + * @return test properties
17.155 + */
17.156 + protected TestProperties getTestProperties() {
17.157 + return(props);
17.158 + }
17.159 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/LineDiff.java Thu Jul 10 04:32:50 2008 -0700
18.3 @@ -0,0 +1,213 @@
18.4 +/*
18.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18.6 +*
18.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
18.8 +*
18.9 +* The contents of this file are subject to the terms of either the GNU
18.10 +* General Public License Version 2 only ("GPL") or the Common
18.11 +* Development and Distribution License("CDDL") (collectively, the
18.12 +* "License"). You may not use this file except in compliance with the
18.13 +* License. You can obtain a copy of the License at
18.14 +* http://www.netbeans.org/cddl-gplv2.html
18.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18.16 +* specific language governing permissions and limitations under the
18.17 +* License. When distributing the software, include this License Header
18.18 +* Notice in each file and include the License file at
18.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
18.20 +* particular file as subject to the "Classpath" exception as provided
18.21 +* by Sun in the GPL Version 2 section of the License file that
18.22 +* accompanied this code. If applicable, add the following below the
18.23 +* License Header, with the fields enclosed by brackets [] replaced by
18.24 +* your own identifying information:
18.25 +* "Portions Copyrighted [year] [name of copyright owner]"
18.26 +*
18.27 +* Contributor(s):
18.28 +*
18.29 +* The Original Software is NetBeans. The Initial Developer of the Original
18.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
18.31 +* Microsystems, Inc. All Rights Reserved.
18.32 +*
18.33 +* If you wish your version of this file to be governed by only the CDDL
18.34 +* or only the GPL Version 2, indicate your decision by adding
18.35 +* "[Contributor] elects to include this software in this distribution
18.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
18.37 +* single choice of license, a recipient has the option to distribute
18.38 +* your version of this file under either the CDDL, the GPL Version 2 or
18.39 +* to extend the choice of license to its licensees as provided above.
18.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
18.41 +* Version 2 license, then the option applies only if the new code is
18.42 +* made subject to such option by the copyright holder.
18.43 +*/
18.44 +
18.45 +package org.netbeans.modules.visualweb.gravy;
18.46 +
18.47 +import org.netbeans.junit.diff.Diff;
18.48 +import java.io.File;
18.49 +import java.io.FileOutputStream;
18.50 +import java.io.LineNumberReader;
18.51 +import java.io.FileReader;
18.52 +import java.io.FileWriter;
18.53 +import java.io.PrintStream;
18.54 +import java.io.PrintWriter;
18.55 +import java.util.ArrayList;
18.56 +
18.57 +/**
18.58 + * Compares 2 text files and finds lines, which are different.
18.59 + */
18.60 +public class LineDiff implements Diff {
18.61 + private static boolean ignoreCase;
18.62 +
18.63 + /** Creates a new instance of LineDiff */
18.64 + public LineDiff(boolean ignoreCase) {
18.65 + this.ignoreCase = ignoreCase;
18.66 + }
18.67 +
18.68 + /**
18.69 + * Returns true or false depending on mode of file comparison.
18.70 + * @return true, if file comparison is not case-sensitive, otherwise - false.
18.71 + */
18.72 + public static boolean getIgnoreCase() {
18.73 + return ignoreCase;
18.74 + }
18.75 +
18.76 + /**
18.77 + * @param l1 first line to compare
18.78 + * @param l2 second line to compare
18.79 + * @return true if lines equal
18.80 + */
18.81 + private boolean compareLines(String l1,String l2) {
18.82 + if (getIgnoreCase()) {
18.83 + if (l1.equalsIgnoreCase(l2))
18.84 + return true;
18.85 + } else {
18.86 + if (l1.equals(l2))
18.87 + return true;
18.88 + }
18.89 + return false;
18.90 + }
18.91 +
18.92 + /**
18.93 + * @param first first file to compare
18.94 + * @param second second file to compare
18.95 + * @param diff difference file, caller can pass null value, when results are not needed.
18.96 + * @return true iff files differ
18.97 + */
18.98 + public boolean diff(String first, String second, String diff) throws java.io.IOException {
18.99 + File fFirst = new File(first);
18.100 + File fSecond = new File(second);
18.101 + File fDiff = null != diff ? new File(diff) : null;
18.102 + return diff(fFirst, fSecond, fDiff);
18.103 + }
18.104 +
18.105 + /**
18.106 + * @param first first file to compare
18.107 + * @param second second file to compare
18.108 + * @param diff difference file, caller can pass null value, when results are not needed.
18.109 + * @return true iff files differ
18.110 + */
18.111 + public boolean diff(java.io.File firstFile, java.io.File secondFile, java.io.File diffFile) throws java.io.IOException {
18.112 + LineNumberReader first = new LineNumberReader(new FileReader(firstFile));
18.113 + LineNumberReader second = new LineNumberReader(new FileReader(secondFile));
18.114 + String firstLine;
18.115 + String secondLine;
18.116 +
18.117 + if (diffFile == null) {
18.118 + while ((firstLine = first.readLine()) != null) {
18.119 + secondLine = second.readLine();
18.120 + if (secondLine == null) {
18.121 + first.close();
18.122 + second.close();
18.123 + return true;
18.124 + }
18.125 + if (!compareLines(firstLine,secondLine)) {
18.126 + first.close();
18.127 + second.close();
18.128 + return true;
18.129 + }
18.130 + }
18.131 + } else {
18.132 + ArrayList a1,a2,newLines,missingLines;
18.133 +
18.134 + a1=new ArrayList();
18.135 + while ((firstLine = first.readLine()) != null) {
18.136 + a1.add(firstLine);
18.137 + }
18.138 + a2=new ArrayList();
18.139 + while ((secondLine = second.readLine()) != null) {
18.140 + a2.add(secondLine);
18.141 + }
18.142 + first.close();
18.143 + second.close();
18.144 + newLines=new ArrayList();
18.145 + missingLines=new ArrayList();
18.146 +
18.147 + int j=0,bj;
18.148 + boolean found;
18.149 +
18.150 + for (int i=0;i < a1.size();i++) {
18.151 + if (j >= a2.size()) {
18.152 + for (int k=i;k < a1.size();k++) {
18.153 + missingLines.add(k+"> "+a1.get(k));
18.154 + }
18.155 + break;
18.156 + }
18.157 + firstLine=(String)(a1.get(i));
18.158 + secondLine=(String)(a2.get(j));
18.159 + if (!compareLines(firstLine,secondLine)) {
18.160 + found=false;
18.161 + for (int k=j;k < a2.size();k++) {
18.162 + secondLine = (String)(a2.get(k));
18.163 + if (compareLines(firstLine,secondLine)) {
18.164 + for (int l=j;l < k;l++) {
18.165 + newLines.add(l+"> "+a2.get(l));
18.166 + }
18.167 + j=k;
18.168 + found=true;
18.169 + break;
18.170 + }
18.171 + }
18.172 + if (!found) {
18.173 + missingLines.add(i+"> "+firstLine);
18.174 + j--;
18.175 + }
18.176 + }
18.177 + j++;
18.178 + }
18.179 + if (j < a2.size()) {
18.180 + for (int i=j;i < a2.size();i++) {
18.181 + newLines.add(i+"> "+a2.get(i));
18.182 + }
18.183 + }
18.184 +
18.185 + if (missingLines.size() > 0 || newLines.size() > 0) {
18.186 + PrintStream pw=null;
18.187 + pw=new PrintStream(new FileOutputStream(diffFile));
18.188 + //pw=System.out;
18.189 + if (missingLines.size() > 0) {
18.190 + pw.println("-----------------------------Missing Lines:-----");
18.191 + for (int i=0;i < missingLines.size();i++) {
18.192 + pw.println(missingLines.get(i));
18.193 + }
18.194 + }
18.195 + if (newLines.size() > 0) {
18.196 + pw.println("-----------------------------New Lines:---------");
18.197 + for (int i=0;i < newLines.size();i++) {
18.198 + pw.println(newLines.get(i));
18.199 + }
18.200 + }
18.201 + pw.close();
18.202 + return true;
18.203 + }
18.204 + }
18.205 + return false;
18.206 + }
18.207 +
18.208 + public static void main(String[] argv) {
18.209 + try {
18.210 + LineDiff diff=new LineDiff(true);
18.211 + diff.diff("/tmp/diff/test.pass","/tmp/diff/test.ref","/tmp/diff/test.diff");
18.212 + } catch (Exception ex) {
18.213 + ex.printStackTrace();
18.214 + }
18.215 + }
18.216 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/MainWindowOperator.java Thu Jul 10 04:32:50 2008 -0700
19.3 @@ -0,0 +1,531 @@
19.4 +/*
19.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
19.6 + *
19.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
19.8 + *
19.9 + * The contents of this file are subject to the terms of either the GNU
19.10 + * General Public License Version 2 only ("GPL") or the Common
19.11 + * Development and Distribution License("CDDL") (collectively, the
19.12 + * "License"). You may not use this file except in compliance with the
19.13 + * License. You can obtain a copy of the License at
19.14 + * http://www.netbeans.org/cddl-gplv2.html
19.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
19.16 + * specific language governing permissions and limitations under the
19.17 + * License. When distributing the software, include this License Header
19.18 + * Notice in each file and include the License file at
19.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
19.20 + * particular file as subject to the "Classpath" exception as provided
19.21 + * by Sun in the GPL Version 2 section of the License file that
19.22 + * accompanied this code. If applicable, add the following below the
19.23 + * License Header, with the fields enclosed by brackets [] replaced by
19.24 + * your own identifying information:
19.25 + * "Portions Copyrighted [year] [name of copyright owner]"
19.26 + *
19.27 + * Contributor(s):
19.28 + *
19.29 + * The Original Software is NetBeans. The Initial Developer of the Original
19.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
19.31 + * Microsystems, Inc. All Rights Reserved.
19.32 + *
19.33 + * If you wish your version of this file to be governed by only the CDDL
19.34 + * or only the GPL Version 2, indicate your decision by adding
19.35 + * "[Contributor] elects to include this software in this distribution
19.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
19.37 + * single choice of license, a recipient has the option to distribute
19.38 + * your version of this file under either the CDDL, the GPL Version 2 or
19.39 + * to extend the choice of license to its licensees as provided above.
19.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
19.41 + * Version 2 license, then the option applies only if the new code is
19.42 + * made subject to such option by the copyright holder.
19.43 + */
19.44 +
19.45 +package org.netbeans.modules.visualweb.gravy;
19.46 +
19.47 +import java.awt.Component;
19.48 +import java.awt.Container;
19.49 +import java.io.PrintStream;
19.50 +import java.util.ArrayList;
19.51 +
19.52 +import javax.swing.*;
19.53 +import javax.swing.event.ChangeListener;
19.54 +import javax.swing.event.ChangeEvent;
19.55 +
19.56 +import org.netbeans.jemmy.ComponentChooser;
19.57 +import org.netbeans.jemmy.JemmyProperties;
19.58 +import org.netbeans.jemmy.JemmyException;
19.59 +import org.netbeans.jemmy.Waitable;
19.60 +import org.netbeans.jemmy.Waiter;
19.61 +
19.62 +import org.netbeans.jemmy.operators.ContainerOperator;
19.63 +import org.netbeans.jemmy.operators.ComponentOperator;
19.64 +import org.netbeans.jemmy.operators.DialogOperator;
19.65 +import org.netbeans.jemmy.operators.JButtonOperator;
19.66 +import org.netbeans.jemmy.operators.JComponentOperator.JComponentByTipFinder;
19.67 +import org.netbeans.jemmy.operators.JFrameOperator;
19.68 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
19.69 +import org.openide.awt.Toolbar;
19.70 +
19.71 +import org.openide.awt.StatusDisplayer;
19.72 +
19.73 +/**
19.74 + *
19.75 + * @author shura
19.76 + */
19.77 +public class MainWindowOperator extends JFrameOperator {
19.78 +
19.79 + JButtonOperator deployButton;
19.80 +
19.81 + /** Creates a new instance of MainWindowOperator */
19.82 + public MainWindowOperator() {
19.83 + super((JFrame) RaveWindowOperator.getDefaultRave().getSource());
19.84 + copyEnvironment(RaveWindowOperator.getDefaultRave());
19.85 + }
19.86 +
19.87 + /** Pushes Save All Button in Main Toolbar
19.88 + */
19.89 + public void saveAll() {
19.90 + new JButtonOperator(this, new JComponentByTipFinder("Save All")).push();
19.91 + }
19.92 +
19.93 + /** Pushes Deploy button from Main Toolbar and waits some timeout
19.94 + */
19.95 + public DeploymentDialogOperator deploy() {
19.96 + btDeploy().push();
19.97 + DeploymentDialogOperator dlg = null;
19.98 + long oldWaitTime = Util.getMainWindow().getTimeouts().getTimeout("DialogWaiter.WaitDialogTimeout");
19.99 + try {
19.100 + Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", 100000);
19.101 + dlg = new DeploymentDialogOperator();
19.102 + } catch(Exception e) {
19.103 + e.printStackTrace();
19.104 + Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", oldWaitTime);
19.105 + }
19.106 + return(dlg);
19.107 + }
19.108 +
19.109 + /** Deploy project and waits until deployment completed */
19.110 + public void deployProject() {
19.111 + DeploymentDialogOperator dlg=deploy();
19.112 + dlg.setAutoHide(false);
19.113 + dlg.waitCompleted();
19.114 + Util.wait(1000);
19.115 + dlg.close();
19.116 + }
19.117 +
19.118 + /** Pushes deploy button from Main Toolbar
19.119 + */
19.120 + public JButtonOperator btDeploy() {
19.121 + if(deployButton == null) {
19.122 + deployButton = new JButtonOperator(this, new JComponentByTipFinder(
19.123 + Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle",
19.124 + "LBL_RunMainProjectAction_Name")));
19.125 + deployButton.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
19.126 + }
19.127 + return(deployButton);
19.128 + }
19.129 + private static StatusTextTracer statusTextTracer = null;
19.130 +
19.131 + /** Returns text from status bar.
19.132 + * @return currently displayed text
19.133 + */
19.134 + public String getStatusText() {
19.135 + return org.openide.awt.StatusDisplayer.getDefault().getStatusText();
19.136 + }
19.137 +
19.138 +
19.139 + /** Sets given text to main window's status bar.
19.140 + * @param newStatusText string to be displayed in status bar
19.141 + */
19.142 + public void setStatusText(String newStatusText) {
19.143 + org.openide.awt.StatusDisplayer.getDefault().setStatusText(newStatusText);
19.144 + }
19.145 +
19.146 + /** Returns singleton instance of StatusTextTracer.
19.147 + * @return singleton instance of StatusTextTracer
19.148 + */
19.149 + public synchronized StatusTextTracer getStatusTextTracer() {
19.150 + if(statusTextTracer == null) {
19.151 + statusTextTracer = new StatusTextTracer();
19.152 + }
19.153 + return statusTextTracer;
19.154 + }
19.155 +
19.156 + /** Waits until given text appears in the main window status bar.
19.157 + * If you want to trace status messages during an operation is proceed,
19.158 + * use {@link StatusTextTracer}.
19.159 + * @param text a text to wait for
19.160 + */
19.161 + public void waitStatusText(final String text) {
19.162 + getStatusTextTracer().start();
19.163 + try {
19.164 + // not wait in case status text was already printed out
19.165 + if(!getComparator().equals(getStatusText(), text)) {
19.166 + getStatusTextTracer().waitText(text);
19.167 + }
19.168 + } finally {
19.169 + getStatusTextTracer().stop();
19.170 + }
19.171 + }
19.172 +
19.173 +
19.174 + /** Class to trace messages printed to status bar of the Main Window.
19.175 + * <p>
19.176 + * Usage:<br>
19.177 + * <pre>
19.178 + * MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer();
19.179 + * // start tracing
19.180 + * stt.start();
19.181 + * // compile action will produce at least two messages: "Compiling ...",
19.182 + * // "Finished ..."
19.183 + * new CompileAction().performAPI();
19.184 + *
19.185 + * // waits for "Compiling" status text
19.186 + * stt.waitText("Compiling");
19.187 + * // waits for "Finished" status text
19.188 + * stt.waitText("Finished");
19.189 + *
19.190 + * // order is not significant => following works as well
19.191 + * stt.waitText("Finished");
19.192 + * stt.waitText("Compiling");
19.193 + *
19.194 + * // to be order significant, set removedCompared parameter to true
19.195 + * stt.waitText("Compiling", true);
19.196 + * stt.waitText("Finished", true);
19.197 + *
19.198 + * // history was removed by above methods => need to produce a new messages
19.199 + * new CompileAction().performAPI();
19.200 + *
19.201 + * // order is significant if removedCompared parameter is true =>
19.202 + * // => following fails because Finished is shown as second
19.203 + * stt.waitText("Finished", true);
19.204 + * stt.waitText("Compiling", true);
19.205 + *
19.206 + * // stop tracing
19.207 + * stt.stop();
19.208 + * </pre>
19.209 + */
19.210 + public class StatusTextTracer implements ChangeListener {
19.211 + /** List of all messages */
19.212 + private ArrayList statusTextHistory;
19.213 +
19.214 + /** Creates new instance. */
19.215 + public StatusTextTracer() {
19.216 + this.statusTextHistory = new ArrayList();
19.217 + }
19.218 +
19.219 + /** Starts to register all status messages into history array.
19.220 + * Exactly, it adds the listener to org.openide.awt.StatusDisplayer.
19.221 + * It clears possible previously filled history array before.
19.222 + */
19.223 + public void start() {
19.224 + stop();
19.225 + clear();
19.226 + StatusDisplayer.getDefault().addChangeListener(this);
19.227 + }
19.228 +
19.229 + /** Stops registering of status messages. Exactly, it removes the
19.230 + * listener from org.openide.awt.StatusDisplayer.
19.231 + */
19.232 + public void stop() {
19.233 + StatusDisplayer.getDefault().removeChangeListener(this);
19.234 + }
19.235 +
19.236 + /** Called when status text was changed. It adds status text to history
19.237 + * array.
19.238 + * @param evt change event - not used
19.239 + */
19.240 + public void stateChanged(ChangeEvent evt) {
19.241 + synchronized (this) {
19.242 + statusTextHistory.add(StatusDisplayer.getDefault().getStatusText());
19.243 + // print message to jemmy output stream
19.244 + JemmyProperties.getCurrentOutput().printTrace("Status text changed to: \""+
19.245 + StatusDisplayer.getDefault().getStatusText()+"\"");
19.246 + }
19.247 + }
19.248 +
19.249 + /** Clears status text history array. */
19.250 + public void clear() {
19.251 + synchronized (this) {
19.252 + statusTextHistory.clear();
19.253 + }
19.254 + }
19.255 +
19.256 + /** Checks whether given text equals to any of messages in the history
19.257 + * array. Comparator of this MainWindowOperator instance is used.
19.258 + * If <tt>removeCompared</tt> parameter is set to <tt>true</tt>,
19.259 + * messages already compared are removed from history array. Otherwise
19.260 + * messages are not removed until {@link #clear} or {@link #start} are
19.261 + * called.
19.262 + * @param text a text to be compared
19.263 + * @param removeCompared whether to remove already compared messages from
19.264 + * history array
19.265 + * @return true if text matches any of messages in the history array;
19.266 + * false otherwise
19.267 + */
19.268 + public boolean contains(String text, boolean removeCompared) {
19.269 + StringComparator comparator = getComparator();
19.270 + synchronized (this) {
19.271 + if(removeCompared) {
19.272 + while(!statusTextHistory.isEmpty()) {
19.273 + String status = (String)statusTextHistory.remove(0);
19.274 + if(comparator.equals(status, text)) {
19.275 + return true;
19.276 + }
19.277 + }
19.278 + } else {
19.279 + for (int i = 0; i < statusTextHistory.size(); i ++) {
19.280 + if(comparator.equals((String)statusTextHistory.get(i), text)) {
19.281 + return true;
19.282 + }
19.283 + }
19.284 + }
19.285 + return false;
19.286 + }
19.287 + }
19.288 +
19.289 + /** Waits for text to be shown in the Main Window status bar not
19.290 + * removing any message from history.
19.291 + * Comparator of this MainWindowOperator instance is used.
19.292 + * It throws TimeoutExpiredException if timeout expires.
19.293 + * @param text a text to wait for
19.294 + */
19.295 + public void waitText(final String text) {
19.296 + waitText(text, false);
19.297 + }
19.298 +
19.299 + /** Waits for text to be shown in the Main Window status bar.
19.300 + * Comparator of this MainWindowOperator instance is used.
19.301 + * If <tt>removeCompared</tt> parameter is set to <tt>true</tt>,
19.302 + * messages already compared are removed from history array. It satisfies
19.303 + * that order of messages is significant when this method is called
19.304 + * more than once.
19.305 + * If <tt>removeCompared</tt> parameter is set to <tt>false</tt>,
19.306 + * messages are not removed until {@link #clear} or {@link #start} are
19.307 + * called and its order is not taken into account.
19.308 + * @param text a text to wait for
19.309 + * @param removeCompared whether to remove already compared messages from
19.310 + * history array
19.311 + */
19.312 + public void waitText(final String text, final boolean removeCompared) {
19.313 + try {
19.314 + new Waiter(new Waitable() {
19.315 + public Object actionProduced(Object anObject) {
19.316 + return contains(text, removeCompared) ? Boolean.TRUE : null;
19.317 + }
19.318 + public String getDescription() {
19.319 + return("Wait status text equals to "+text);
19.320 + }
19.321 + }).waitAction(null);
19.322 + } catch (InterruptedException e) {
19.323 + throw new JemmyException("Interrupted.", e);
19.324 + }
19.325 + }
19.326 +
19.327 + /** Calls {@link #stop} at the end of life cycle of this class. */
19.328 + public void finalize() {
19.329 + stop();
19.330 + }
19.331 +
19.332 + /** Returns list of elements collected from the moment method
19.333 + * {@link #start} was called. Remember, if <tt>removeCompared</tt>
19.334 + * parameter is set to <tt>true</tt> in some of methods,
19.335 + * messages already compared are removed from history array.
19.336 + * @return ArrayList of elements representing status text messages
19.337 + */
19.338 + public ArrayList getStatusTextHistory() {
19.339 + return statusTextHistory;
19.340 + }
19.341 +
19.342 + /** Prints list of elements collected from the moment method
19.343 + * {@link #start} was called. Remember, if <tt>removeCompared</tt>
19.344 + * parameter is set to <tt>true</tt> in some of methods,
19.345 + * messages already compared are removed from history array.
19.346 + * @param outputPrintStream stream to print output in
19.347 + */
19.348 + public void printStatusTextHistory(PrintStream outputPrintStream) {
19.349 + for (int i = 0; i < statusTextHistory.size(); i ++) {
19.350 + outputPrintStream.println(statusTextHistory.get(i).toString());
19.351 + }
19.352 + }
19.353 + }
19.354 +
19.355 +
19.356 + /***************** methods for toolbars manipulation *******************/
19.357 +
19.358 + /** Returns ContainerOperator representing index-th floating toolbar in
19.359 + * IDE main window. Toolbars are NOT indexed from left to right.
19.360 + * @param index index of toolbar to find
19.361 + * @return ContainerOperator instance representing a toolbar
19.362 + */
19.363 + public ContainerOperator getToolbar(int index) {
19.364 + ComponentChooser chooser = new ToolbarChooser();
19.365 + return new ContainerOperator((Container)waitComponent((Container)getSource(),
19.366 + chooser, index));
19.367 + }
19.368 +
19.369 + /** Returns ContainerOperator representing floating toolbar with given name.
19.370 + * @param toolbarName toolbar's display name. It is shown in its tooltip.
19.371 + * @return ContainerOperator instance representing a toolbar
19.372 + */
19.373 + public ContainerOperator getToolbar(String toolbarName) {
19.374 + ComponentChooser chooser = new ToolbarChooser(toolbarName, getComparator());
19.375 + return new ContainerOperator((Container)waitComponent((Container)getSource(), chooser));
19.376 + }
19.377 +
19.378 + /** Returns number of toolbars currently shown in IDE.
19.379 + * @return number of toolbars
19.380 + */
19.381 + public int getToolbarCount() {
19.382 + ToolbarChooser chooser = new ToolbarChooser("Non sense name - @#$%^&*", //NOI18N
19.383 + getComparator());
19.384 + findComponent((Container)getSource(), chooser);
19.385 + return chooser.getCount();
19.386 + }
19.387 +
19.388 + /** Returns display name of toolbar with given index. Toolbars are NOT
19.389 + * indexed from left to right.
19.390 + * @param index index of toolbar
19.391 + * @return display name of toolbar
19.392 + */
19.393 + public String getToolbarName(int index) {
19.394 + return ((Toolbar)getToolbar(index).getSource()).getDisplayName();
19.395 + }
19.396 +
19.397 + /** Return JButtonOperator representing a toolbar button found by given
19.398 + * tooltip within given toolbar operator.
19.399 + * @param toolbarOper ContainerOperator of a toolbar.
19.400 + * Use {@link #getToolbar(String)} or {@link #getToolbar(int)}
19.401 + * to obtain an operator.
19.402 + * @param buttonTooltip tooltip of toolbar button
19.403 + * @return JButtonOperator instance of found toolbar button
19.404 + */
19.405 + public JButtonOperator getToolbarButton(ContainerOperator toolbarOper, String buttonTooltip) {
19.406 + ToolbarButtonChooser chooser = new ToolbarButtonChooser(buttonTooltip, getComparator());
19.407 + return new JButtonOperator(JButtonOperator.waitJButton(
19.408 + (Container)toolbarOper.getSource(), chooser));
19.409 + }
19.410 +
19.411 + /** Return JButtonOperator representing index-th toolbar button within given
19.412 + * toolbar operator.
19.413 + * @param toolbarOper ContainerOperator of a toolbar.
19.414 + * Use {@link #getToolbar(String)} or {@link #getToolbar(int)}
19.415 + * to obtain an operator.
19.416 + * @param index index of toolbar button to find
19.417 + * @return JButtonOperator instance of found toolbar button
19.418 + */
19.419 + public JButtonOperator getToolbarButton(ContainerOperator toolbarOper, int index) {
19.420 + return new JButtonOperator(toolbarOper, index);
19.421 + }
19.422 +
19.423 + /** Pushes popup menu on toolbars. It doesn't matter on which toolbar it is
19.424 + * invoked, everytime it is the same. That's why popup menu is invoked on
19.425 + * the right side of toolbar with index 0.
19.426 + * @param popupPath path to menu item (e.g. "Edit")
19.427 + */
19.428 + public void pushToolbarPopupMenu(String popupPath) {
19.429 + ContainerOperator contOper = getToolbar(0);
19.430 + contOper.clickForPopup(contOper.getWidth()-1, contOper.getHeight()/2);
19.431 + new JPopupMenuOperator().pushMenu(popupPath, "|");
19.432 + }
19.433 +
19.434 + /** Pushes popup menu on toolbars - no block further execution.
19.435 + * It doesn't matter on which toolbar it is
19.436 + * invoked, everytime it is the same. That's why popup menu is invoked on
19.437 + * the right side of toolbar with index 0.
19.438 + * @param popupPath path to menu item (e.g. "Save Configuration...")
19.439 + */
19.440 + public void pushToolbarPopupMenuNoBlock(String popupPath) {
19.441 + ContainerOperator contOper = getToolbar(0);
19.442 + contOper.clickForPopup(contOper.getWidth()-1, contOper.getHeight()/2);
19.443 + new JPopupMenuOperator().pushMenuNoBlock(popupPath, "|");
19.444 + }
19.445 +
19.446 + /** Drags a toolbar to a new position determined by [x, y] relatively.
19.447 + * @param toolbarOper ContainerOperator of a toolbar.
19.448 + * Use {@link #getToolbar(String)} or {@link #getToolbar(int)}
19.449 + * to obtain an operator.
19.450 + * @param x relative move along x direction
19.451 + * @param y relative move along y direction
19.452 + */
19.453 + public void dragNDropToolbar(ContainerOperator toolbarOper, int x, int y) {
19.454 + ComponentChooser chooser = new ComponentChooser() {
19.455 + public boolean checkComponent(Component comp) {
19.456 + if(comp instanceof JPanel) {
19.457 + String className = comp.getClass().getName();
19.458 + return className.equals("org.openide.awt.Toolbar$ToolbarBump") ||
19.459 + // used in Windows L&F
19.460 + className.equals("org.openide.awt.Toolbar$ToolbarGrip");
19.461 + }
19.462 + return false;
19.463 + }
19.464 + public String getDescription() {
19.465 + return "org.openide.awt.Toolbar$ToolbarBump or org.openide.awt.Toolbar$ToolbarGrip";
19.466 + }
19.467 + };
19.468 + Component comp = findComponent((Container)toolbarOper.getSource(), chooser);
19.469 + new ComponentOperator(comp).dragNDrop(comp.getWidth()/2, comp.getHeight()/2, x, y);
19.470 + }
19.471 +
19.472 +
19.473 + /** Chooser which can be used to find a org.openide.awt.Toolbar component or
19.474 + * count a number of such components in given container.
19.475 + */
19.476 + private static class ToolbarChooser implements ComponentChooser {
19.477 + private String toolbarName;
19.478 + private StringComparator comparator;
19.479 + private int count = 0;
19.480 +
19.481 + /** Use this to find org.openide.awt.Toolbar component with given name. */
19.482 + public ToolbarChooser(String toolbarName, StringComparator comparator) {
19.483 + this.toolbarName = toolbarName;
19.484 + this.comparator = comparator;
19.485 + }
19.486 +
19.487 + /** Use this to count org.openide.awt.Toolbar components in given container. */
19.488 + public ToolbarChooser() {
19.489 + this.comparator = null;
19.490 + }
19.491 +
19.492 + public boolean checkComponent(Component comp) {
19.493 + if(comp instanceof org.openide.awt.Toolbar) {
19.494 + count++;
19.495 + if(comparator != null) {
19.496 + return comparator.equals(((Toolbar)comp).getDisplayName(), toolbarName);
19.497 + } else {
19.498 + return true;
19.499 + }
19.500 + }
19.501 + return false;
19.502 + }
19.503 +
19.504 + public String getDescription() {
19.505 + return "org.openide.awt.Toolbar";
19.506 + }
19.507 +
19.508 + public int getCount() {
19.509 + return count;
19.510 + }
19.511 + }
19.512 +
19.513 + /** Chooser which can be used to find a component with given tooltip,
19.514 + * for example a toolbar button.
19.515 + */
19.516 + private static class ToolbarButtonChooser implements ComponentChooser {
19.517 + private String buttonTooltip;
19.518 + private StringComparator comparator;
19.519 +
19.520 + public ToolbarButtonChooser(String buttonTooltip, StringComparator comparator) {
19.521 + this.buttonTooltip = buttonTooltip;
19.522 + this.comparator = comparator;
19.523 + }
19.524 +
19.525 + public boolean checkComponent(Component comp) {
19.526 + return comparator.equals(((JComponent)comp).getToolTipText(), buttonTooltip);
19.527 + }
19.528 +
19.529 + public String getDescription() {
19.530 + return "Toolbar button with tooltip \""+buttonTooltip+"\".";
19.531 + }
19.532 + }
19.533 +
19.534 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/NbDialogOperator.java Thu Jul 10 04:32:50 2008 -0700
20.3 @@ -0,0 +1,172 @@
20.4 +/*
20.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
20.6 + *
20.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
20.8 + *
20.9 + * The contents of this file are subject to the terms of either the GNU
20.10 + * General Public License Version 2 only ("GPL") or the Common
20.11 + * Development and Distribution License("CDDL") (collectively, the
20.12 + * "License"). You may not use this file except in compliance with the
20.13 + * License. You can obtain a copy of the License at
20.14 + * http://www.netbeans.org/cddl-gplv2.html
20.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
20.16 + * specific language governing permissions and limitations under the
20.17 + * License. When distributing the software, include this License Header
20.18 + * Notice in each file and include the License file at
20.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
20.20 + * particular file as subject to the "Classpath" exception as provided
20.21 + * by Sun in the GPL Version 2 section of the License file that
20.22 + * accompanied this code. If applicable, add the following below the
20.23 + * License Header, with the fields enclosed by brackets [] replaced by
20.24 + * your own identifying information:
20.25 + * "Portions Copyrighted [year] [name of copyright owner]"
20.26 + *
20.27 + * Contributor(s):
20.28 + *
20.29 + * The Original Software is NetBeans. The Initial Developer of the Original
20.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
20.31 + * Microsystems, Inc. All Rights Reserved.
20.32 + *
20.33 + * If you wish your version of this file to be governed by only the CDDL
20.34 + * or only the GPL Version 2, indicate your decision by adding
20.35 + * "[Contributor] elects to include this software in this distribution
20.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
20.37 + * single choice of license, a recipient has the option to distribute
20.38 + * your version of this file under either the CDDL, the GPL Version 2 or
20.39 + * to extend the choice of license to its licensees as provided above.
20.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
20.41 + * Version 2 license, then the option applies only if the new code is
20.42 + * made subject to such option by the copyright holder.
20.43 + */
20.44 +
20.45 +package org.netbeans.modules.visualweb.gravy;
20.46 +
20.47 +import javax.swing.JDialog;
20.48 +import org.netbeans.jemmy.operators.JButtonOperator;
20.49 +import org.netbeans.jemmy.operators.JDialogOperator;
20.50 +
20.51 +/**
20.52 + * Handle generic NetBeans dialog. The dialog can include Yes, No, OK,
20.53 + * Cancel, Close or Help buttons. The dialog is identified by its title.
20.54 + */
20.55 +public class NbDialogOperator extends JDialogOperator {
20.56 +
20.57 + private JButtonOperator _btYes;
20.58 + private JButtonOperator _btNo;
20.59 + private JButtonOperator _btOK;
20.60 + private JButtonOperator _btCancel;
20.61 + private JButtonOperator _btClose;
20.62 + private JButtonOperator _btHelp;
20.63 + /** Waits until dialog with requested title is found. Title is compared
20.64 + * on partial match and case non-sensitive. If dialog is not found, runtime
20.65 + * exception is thrown.
20.66 + * @param title title of window
20.67 + */
20.68 + public NbDialogOperator(String title) {
20.69 + super(title);
20.70 + }
20.71 +
20.72 + /** Created NbDialogOperator with given dialog
20.73 + * @param dialog JDialog instance */
20.74 + public NbDialogOperator(JDialog dialog) {
20.75 + super(dialog);
20.76 + }
20.77 +
20.78 + /** Returns operator of "Yes" button.
20.79 + * @return JButtonOperator instance of "Yes" button
20.80 + */
20.81 + public JButtonOperator btYes() {
20.82 + if (_btYes == null) {
20.83 + String yesCaption = Bundle.getString("org.netbeans.core.Bundle", "YES_OPTION_CAPTION");
20.84 + _btYes = new JButtonOperator(this, yesCaption);
20.85 + }
20.86 + return _btYes;
20.87 + }
20.88 +
20.89 + /** Returns operator of "No" button.
20.90 + * @return JButtonOperator instance of "No" button
20.91 + */
20.92 + public JButtonOperator btNo() {
20.93 + if (_btNo == null) {
20.94 + String noCaption = Bundle.getString("org.netbeans.core.Bundle", "NO_OPTION_CAPTION");
20.95 + _btNo = new JButtonOperator(this, noCaption);
20.96 + }
20.97 + return _btNo;
20.98 + }
20.99 +
20.100 + /** Returns operator of "OK" button.
20.101 + * @return JButtonOperator instance of "OK" button
20.102 + */
20.103 + public JButtonOperator btOK() {
20.104 + if (_btOK == null) {
20.105 + String oKCaption = Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION");
20.106 + _btOK = new JButtonOperator(this, oKCaption);
20.107 + }
20.108 + return _btOK;
20.109 + }
20.110 +
20.111 + /** Returns operator of "Cancel" button.
20.112 + * @return JButtonOperator instance of "Cancel" button
20.113 + */
20.114 + public JButtonOperator btCancel() {
20.115 + if (_btCancel == null) {
20.116 + String cancelCaption = Bundle.getString("org.netbeans.core.Bundle", "CANCEL_OPTION_CAPTION");
20.117 + _btCancel = new JButtonOperator(this, cancelCaption);
20.118 + }
20.119 + return _btCancel;
20.120 + }
20.121 +
20.122 + /** Returns operator of "Close" button.
20.123 + * @return JButtonOperator instance of "Close" button
20.124 + */
20.125 + public JButtonOperator btClose() {
20.126 + if (_btClose == null) {
20.127 + String closeCaption = Bundle.getString("org.netbeans.core.Bundle", "CLOSED_OPTION_CAPTION");
20.128 + _btClose = new JButtonOperator(this, closeCaption);
20.129 + }
20.130 + return _btClose;
20.131 + }
20.132 +
20.133 + /** Returns operator of "Help" button.
20.134 + * @return JButtonOperator instance of "Help" button
20.135 + */
20.136 + public JButtonOperator btHelp() {
20.137 + if (_btHelp == null) {
20.138 + String helpCaption = Bundle.getString("org.netbeans.core.Bundle", "HELP_OPTION_CAPTION");
20.139 + _btHelp = new JButtonOperator(this, helpCaption);
20.140 + }
20.141 + return _btHelp;
20.142 + }
20.143 +
20.144 + /** Pushes "Yes" button. */
20.145 + public void yes() {
20.146 + btYes().push();
20.147 + }
20.148 +
20.149 + /** Pushes "No" button. */
20.150 + public void no() {
20.151 + btNo().push();
20.152 + }
20.153 +
20.154 + /** Pushes "OK" button. */
20.155 + public void ok() {
20.156 + btOK().push();
20.157 + }
20.158 +
20.159 + /** Pushes "Cancel" button. */
20.160 + public void cancel() {
20.161 + btCancel().push();
20.162 + }
20.163 +
20.164 + /** Pushes "Close" button. Using {@link JDialogOperator#close() close()}
20.165 + * will close dialog default way like on demand of a window manager.
20.166 + */
20.167 + public void closeByButton() {
20.168 + btClose().push();
20.169 + }
20.170 +
20.171 + /** Pushes "Help" button. */
20.172 + public void help() {
20.173 + btHelp().push();
20.174 + }
20.175 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/OptionsOperator.java Thu Jul 10 04:32:50 2008 -0700
21.3 @@ -0,0 +1,434 @@
21.4 +/*
21.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
21.6 + *
21.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
21.8 + *
21.9 + * The contents of this file are subject to the terms of either the GNU
21.10 + * General Public License Version 2 only ("GPL") or the Common
21.11 + * Development and Distribution License("CDDL") (collectively, the
21.12 + * "License"). You may not use this file except in compliance with the
21.13 + * License. You can obtain a copy of the License at
21.14 + * http://www.netbeans.org/cddl-gplv2.html
21.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
21.16 + * specific language governing permissions and limitations under the
21.17 + * License. When distributing the software, include this License Header
21.18 + * Notice in each file and include the License file at
21.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
21.20 + * particular file as subject to the "Classpath" exception as provided
21.21 + * by Sun in the GPL Version 2 section of the License file that
21.22 + * accompanied this code. If applicable, add the following below the
21.23 + * License Header, with the fields enclosed by brackets [] replaced by
21.24 + * your own identifying information:
21.25 + * "Portions Copyrighted [year] [name of copyright owner]"
21.26 + *
21.27 + * Contributor(s):
21.28 + *
21.29 + * The Original Software is NetBeans. The Initial Developer of the Original
21.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
21.31 + * Microsystems, Inc. All Rights Reserved.
21.32 + *
21.33 + * If you wish your version of this file to be governed by only the CDDL
21.34 + * or only the GPL Version 2, indicate your decision by adding
21.35 + * "[Contributor] elects to include this software in this distribution
21.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
21.37 + * single choice of license, a recipient has the option to distribute
21.38 + * your version of this file under either the CDDL, the GPL Version 2 or
21.39 + * to extend the choice of license to its licensees as provided above.
21.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
21.41 + * Version 2 license, then the option applies only if the new code is
21.42 + * made subject to such option by the copyright holder.
21.43 + */
21.44 +
21.45 +package org.netbeans.modules.visualweb.gravy;
21.46 +
21.47 +import java.awt.Rectangle;
21.48 +import java.lang.reflect.InvocationTargetException;
21.49 +import javax.swing.table.JTableHeader;
21.50 +import javax.swing.tree.TreePath;
21.51 +import org.netbeans.modules.visualweb.gravy.Util;
21.52 +import org.netbeans.jemmy.EventTool;
21.53 +import org.netbeans.jemmy.JemmyException;
21.54 +import org.netbeans.jemmy.Timeouts;
21.55 +import org.netbeans.jemmy.operators.ComponentOperator;
21.56 +import org.netbeans.jemmy.operators.JButtonOperator;
21.57 +import org.netbeans.jemmy.operators.JComboBoxOperator;
21.58 +import org.netbeans.jemmy.operators.Operator;
21.59 +import org.netbeans.jemmy.operators.JRadioButtonOperator;
21.60 +
21.61 +/**
21.62 + * Provides access to the Options window and it's subcomponents.
21.63 + * Use PropertySheet class to access properties.
21.64 + * treeTable() method returns TreeTable operator for
21.65 + * options list accessing.
21.66 + */
21.67 +public class OptionsOperator extends NbDialogOperator {
21.68 +
21.69 + /**
21.70 + * Constant used for indication of project property definition level
21.71 + * (first column after ">>").
21.72 + */
21.73 + public static final int PROJECT_LEVEL = 2;
21.74 +
21.75 + /**
21.76 + * Constant used for indication of user property definition level
21.77 + * (second column after ">>").
21.78 + */
21.79 + public static final int USER_LEVEL = 3;
21.80 +
21.81 + /**
21.82 + * Constant used for indication of default property definition level
21.83 + * (third column after ">>").
21.84 + */
21.85 + public static final int DEFAULT_LEVEL = 4;
21.86 +
21.87 +
21.88 + private static final long BEFORE_EDITING_TIMEOUT = 2000;
21.89 +
21.90 + private static int DEFINE_HERE = 0;
21.91 +
21.92 +
21.93 + private JRadioButtonOperator _rbBasic;
21.94 + private JButtonOperator _btAdvanced;
21.95 + private JButtonOperator _btClose;
21.96 + private JButtonOperator _btHelp;
21.97 + private TreeTableOperator _treeTable;
21.98 +
21.99 + /**
21.100 + * Waits for the Options window opened
21.101 + */
21.102 + public OptionsOperator() {
21.103 + super(getTitleToFind());
21.104 + setComparator(oldComparator);
21.105 + setDefaultStringComparator(oldComparator);
21.106 + }
21.107 +
21.108 + private static StringComparator oldComparator;
21.109 +
21.110 + /** Method to set exactly matching comparator to be used in constructor.
21.111 + * @return "Options" - title of window to be found
21.112 + */
21.113 + private static String getTitleToFind() {
21.114 + oldComparator = Operator.getDefaultStringComparator();
21.115 + DefaultStringComparator comparator = new DefaultStringComparator(true, true);
21.116 + setDefaultStringComparator(comparator);
21.117 + return Bundle.getString("org.netbeans.core.Bundle", "UI/Services");
21.118 + }
21.119 + /**
21.120 + * Invoces Options window by the menu operation.
21.121 + * @return OptionsOperator instance
21.122 + */
21.123 + public static OptionsOperator invoke() {
21.124 +// invokeAction.perform();
21.125 + Util.getMainMenu().pushMenu("Tools|Options");
21.126 + return new OptionsOperator();
21.127 + }
21.128 +
21.129 + static {
21.130 + Timeouts.initDefault("OptionsOperator.BeforeEditingTimeout", BEFORE_EDITING_TIMEOUT);
21.131 + }
21.132 +
21.133 + //subcomponents
21.134 +
21.135 + //******************************
21.136 + // Subcomponents definition part
21.137 + //******************************
21.138 +
21.139 + /** Tries to find " Basic" JRadioButton in this dialog.
21.140 + * @return JRadioButtonOperator
21.141 + */
21.142 + public JRadioButtonOperator rbBasic() {
21.143 + if (_rbBasic==null) {
21.144 + _rbBasic = new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("com.sun.rave.extension.core.actions.Bundle").getString("CTL_basic_button").trim());
21.145 + }
21.146 + return _rbBasic;
21.147 + }
21.148 +
21.149 + /** Tries to find " Advanced" JRadioButton in this dialog.
21.150 + * @return JRadioButtonOperator
21.151 + */
21.152 + public JButtonOperator rbAdvanced() {
21.153 + if (_btAdvanced==null) {
21.154 + _btAdvanced = new JButtonOperator(this, "Advanced Options");
21.155 + //new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("com.sun.rave.extension.core.actions.Bundle").getString("CTL_advanced_button").trim());
21.156 + }
21.157 + return _btAdvanced;
21.158 + }
21.159 +
21.160 + /** Tries to find "Close" JButton in this dialog.
21.161 + * @return JButtonOperator
21.162 + */
21.163 + public JButtonOperator btClose() {
21.164 + if (_btClose==null) {
21.165 + _btClose = new JButtonOperator(this, Bundle.getStringTrimmed(
21.166 + "org.netbeans.core.actions.Bundle", "CTL_close_button"));
21.167 + }
21.168 + return _btClose;
21.169 + }
21.170 +
21.171 + /** Tries to find "Help" JButton in this dialog.
21.172 + * @return JButtonOperator
21.173 + */
21.174 + public JButtonOperator btHelp() {
21.175 + if (_btHelp==null) {
21.176 + _btHelp = new JButtonOperator(this, "Help"
21.177 + /* TODO: change literal string to Bundle.getStringTrimmed(
21.178 + "org.netbeans.core.actions.Bundle", "CTL_help_button")*/);
21.179 + }
21.180 + return _btHelp;
21.181 + }
21.182 +
21.183 + //****************************************
21.184 + // Low-level functionality definition part
21.185 + //****************************************
21.186 +
21.187 + /** Implements switching to Basic mode
21.188 + * clicks on " Basic" JRadioButton
21.189 + */
21.190 + public void basic() {
21.191 + rbBasic().push();
21.192 + }
21.193 +
21.194 + /** Implements switching to Basic mode
21.195 + * clicks on " Advanced" JRadioButton
21.196 + */
21.197 + public void advanced() {
21.198 + rbAdvanced().push();
21.199 + }
21.200 +
21.201 + /** clicks on "Close" JButton
21.202 + */
21.203 + public void close() {
21.204 + btClose().pushNoBlock();
21.205 + }
21.206 +
21.207 + /** clicks on "Help" JButton
21.208 + */
21.209 + public void help() {
21.210 + btHelp().push();
21.211 + }
21.212 +
21.213 +
21.214 + /** Getter for table containing property list and
21.215 + * property definition levels.
21.216 + * @return TreeTableOperator instance
21.217 + */
21.218 + public TreeTableOperator treeTable() {
21.219 + if(_treeTable == null) {
21.220 + _treeTable = new TreeTableOperator(this);
21.221 + }
21.222 + return _treeTable;
21.223 + }
21.224 +
21.225 + //shortcuts
21.226 + /** Selects an option in the options tree.
21.227 + * @param optionPath Path to the option in left (tree-like) column.
21.228 + * @return row index of selected node (starts at 0)
21.229 + */
21.230 + public int selectOption(String optionPath) {
21.231 + TreePath path = treeTable().tree().findPath(optionPath, "|");
21.232 + if(!treeTable().tree().isPathSelected(path)) {
21.233 + treeTable().tree().selectPath(path);
21.234 + }
21.235 + int result = treeTable().tree().getRowForPath(path);
21.236 + treeTable().scrollToCell(result, 0);
21.237 + new EventTool().waitNoEvent(500);
21.238 + return(result);
21.239 + }
21.240 +
21.241 + /** Selects an option in the options tree, waits for property sheet
21.242 + * corresponding to selected node and returns instance of PropertySheetOperator.
21.243 + * @param optionPath Path to the option in left (tree-like) column.
21.244 + * @return PropertySheetOperator of selected option
21.245 + */
21.246 + /*public PropertySheetOperator getPropertySheet(String optionPath) {
21.247 + selectOption(optionPath);
21.248 + // wait for property sheet corresponding with selected node
21.249 + final String nodeName = treeTable().tree().getSelectionPath().getLastPathComponent().toString();
21.250 + try {
21.251 + return (PropertySheetOperator)new Waiter(new Waitable() {
21.252 + public Object actionProduced(Object optionsOper) {
21.253 + PropertySheetOperator pso = new PropertySheetOperator((OptionsOperator)optionsOper);//this);
21.254 + return pso.getDescriptionHeader().equals(nodeName) ? pso: null;
21.255 + }
21.256 + public String getDescription() {
21.257 + return("Wait Property sheet for \""+nodeName+"\" is showing.");
21.258 + }
21.259 + }
21.260 + ).waitAction(this);
21.261 + } catch (InterruptedException e) {
21.262 + throw new JemmyException("Interrupted.", e);
21.263 + }
21.264 + }*/
21.265 +
21.266 + //definition levels
21.267 +
21.268 + /**
21.269 + * Shows definition levels column by clicking on the "<<" table
21.270 + * column title.
21.271 + */
21.272 + public void showLevels() {
21.273 + if(treeTable().getColumnCount() == 2) {
21.274 + clickOnSecondHeader();
21.275 + }
21.276 + }
21.277 +
21.278 + /**
21.279 + * Hides definition levels column by clicking on the ">>" table
21.280 + * column title.
21.281 + */
21.282 + public void hideLevels() {
21.283 + if(treeTable().getColumnCount() > 2) {
21.284 + clickOnSecondHeader();
21.285 + }
21.286 + }
21.287 +
21.288 + /**
21.289 + * Sets definition level for the option.
21.290 + * @param optionPath Path to the option in left (tree-like) column.
21.291 + * @param level One of the PROJECT_LEVEL, USER_LEVEL or DEFAULT_LEVEL
21.292 + */
21.293 + /*public void setLevel(String optionPath, final int level) {
21.294 + showLevels();
21.295 + int curLevel = getLevel(optionPath);
21.296 + getOutput().printLine("Setting " + level + " level for \"" +
21.297 + optionPath + "\" option. \nCurrent level: " + curLevel);
21.298 + final int row = selectOption(optionPath);
21.299 + if(level > curLevel) {
21.300 + produceNoBlocking(new NoBlockingAction("Setting property definition level") {
21.301 + public Object doAction(Object param) {
21.302 + setLevel(row, level);
21.303 + return(null);
21.304 + }
21.305 + });
21.306 + JDialogOperator question = new JDialogOperator(Bundle.getString("org.openide.Bundle",
21.307 + "NTF_QuestionTitle"));
21.308 + new JButtonOperator(question, Bundle.getString("org.openide.Bundle",
21.309 + "CTL_YES")).push();
21.310 + } else if(level < curLevel) {
21.311 + setLevel(row, level);
21.312 + }
21.313 + }*/
21.314 +
21.315 + /**
21.316 + * Gets definition level for the option.
21.317 + * @param optionPath Path to the option in left (tree-like) column.
21.318 + * @return level One of the PROJECT_LEVEL, USER_LEVEL or DEFAULT_LEVEL
21.319 + */
21.320 + public int getLevel(String optionPath) {
21.321 + int row = selectOption(optionPath);
21.322 + if (getValue(row, PROJECT_LEVEL) == DEFINE_HERE) {
21.323 + return PROJECT_LEVEL;
21.324 + } else if(getValue(row, USER_LEVEL) == DEFINE_HERE) {
21.325 + return USER_LEVEL;
21.326 + } else if(getValue(row, DEFAULT_LEVEL) == DEFINE_HERE) {
21.327 + return DEFAULT_LEVEL;
21.328 + }
21.329 + return -1;
21.330 + }
21.331 +
21.332 + /** Make an option to be difined on the project level.
21.333 + * @param optionPath Path to the option in left (tree-like) column.
21.334 + */
21.335 + /*public void setProjectLevel(String optionPath) {
21.336 + setLevel(optionPath, PROJECT_LEVEL);
21.337 + }*/
21.338 +
21.339 + /** Make an option to be difined on the user level.
21.340 + * @param optionPath Path to the option in left (tree-like) column.
21.341 + */
21.342 + /*public void setUserLevel(String optionPath) {
21.343 + setLevel(optionPath, USER_LEVEL);
21.344 + }*/
21.345 +
21.346 + /** Make an option to be difined on the default level.
21.347 + * @param optionPath Path to the option in left (tree-like) column.
21.348 + */
21.349 + /*public void setDefaultLevel(String optionPath) {
21.350 + setLevel(optionPath, DEFAULT_LEVEL);
21.351 + }*/
21.352 +
21.353 + //protected
21.354 +
21.355 + /** Sets a level for the row index.
21.356 + * @param row row index in the table
21.357 + * @param level level value
21.358 + */
21.359 + protected void setLevel(int row, int level) {
21.360 + if (level == PROJECT_LEVEL) {
21.361 + defineHere(row, level);
21.362 + } else if(level == USER_LEVEL) {
21.363 + defineHere(row, level);
21.364 + } else if(level == DEFAULT_LEVEL) {
21.365 + revertLevel(row, level);
21.366 + }
21.367 + }
21.368 +
21.369 + /** Gets a value of the level definition mark.
21.370 + * @param row row index in the table
21.371 + * @param column column index in the table
21.372 + * @return value of the level definition mark
21.373 + */
21.374 + protected int getValue(int row, int column) {
21.375 + /* TODO: ab153207, commented FileStateProperty was not found
21.376 + try {
21.377 + FileStateProperty property = ((FileStateProperty)treeTable().getValueAt(row, column));
21.378 + return(((Integer)property.getValue()).intValue());
21.379 + } catch(IllegalAccessException e) {
21.380 + throw new JemmyException("Can not access value!", e);
21.381 + } catch(InvocationTargetException e) {
21.382 + throw new JemmyException("Can not access value!", e);
21.383 + }*/
21.384 + return 0;
21.385 + }
21.386 +
21.387 + /** Chooses "Revert Def" from the combobox.
21.388 + * @param row row index in the table
21.389 + * @param colIndex column index in the table
21.390 + */
21.391 + protected void revertLevel(final int row, final int colIndex) {
21.392 + editLevel(row, colIndex, Bundle.getString("org.netbeans.core.projects.Bundle",
21.393 + "LBL_action_revert"));
21.394 + }
21.395 +
21.396 + /** Chooses "Define Here" from the combobox.
21.397 + * @param row row index in the table
21.398 + * @param colIndex column index in the table
21.399 + */
21.400 + protected void defineHere(int row, int colIndex) {
21.401 + editLevel(row, colIndex, Bundle.getString("org.netbeans.core.projects.Bundle",
21.402 + "LBL_action_define"));
21.403 + }
21.404 +
21.405 + /**
21.406 + * Causes table editing and chooses a value in the combobox.
21.407 + * @param rowIndex Row index.
21.408 + * @param colIndex Column index. One of the columns containing
21.409 + * level definition marks.
21.410 + * @param value String value to be choosed in the combobox.
21.411 + */
21.412 + protected void editLevel(int rowIndex, int colIndex, String value) {
21.413 + //Point pnt = treeTable().getPointToClick(rowIndex, colIndex);
21.414 + treeTable().clickOnCell(rowIndex, colIndex);
21.415 + JComboBoxOperator combo = new JComboBoxOperator(treeTable());
21.416 + getTimeouts().sleep("OptionsOperator.BeforeEditingTimeout");
21.417 + combo.selectItem(value);
21.418 + }
21.419 +
21.420 + /**
21.421 + * Clicks on "<<" column header.
21.422 + */
21.423 + protected void clickOnSecondHeader() {
21.424 + JTableHeader header = treeTable().getTableHeader();
21.425 + Rectangle rect = header.getHeaderRect(1);
21.426 + new ComponentOperator(header).clickMouse(rect.x + rect.width/2,
21.427 + rect.y + rect.height/2,
21.428 + 1);
21.429 + }
21.430 +
21.431 + /** Performs verification by accessing all sub-components */
21.432 + public void verify() {
21.433 + btClose();
21.434 + btHelp();
21.435 + treeTable().verify();
21.436 + }
21.437 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/PageTopComponentOperator.java Thu Jul 10 04:32:50 2008 -0700
22.3 @@ -0,0 +1,104 @@
22.4 +/*
22.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
22.6 + *
22.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
22.8 + *
22.9 + * The contents of this file are subject to the terms of either the GNU
22.10 + * General Public License Version 2 only ("GPL") or the Common
22.11 + * Development and Distribution License("CDDL") (collectively, the
22.12 + * "License"). You may not use this file except in compliance with the
22.13 + * License. You can obtain a copy of the License at
22.14 + * http://www.netbeans.org/cddl-gplv2.html
22.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
22.16 + * specific language governing permissions and limitations under the
22.17 + * License. When distributing the software, include this License Header
22.18 + * Notice in each file and include the License file at
22.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
22.20 + * particular file as subject to the "Classpath" exception as provided
22.21 + * by Sun in the GPL Version 2 section of the License file that
22.22 + * accompanied this code. If applicable, add the following below the
22.23 + * License Header, with the fields enclosed by brackets [] replaced by
22.24 + * your own identifying information:
22.25 + * "Portions Copyrighted [year] [name of copyright owner]"
22.26 + *
22.27 + * Contributor(s):
22.28 + *
22.29 + * The Original Software is NetBeans. The Initial Developer of the Original
22.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
22.31 + * Microsystems, Inc. All Rights Reserved.
22.32 + *
22.33 + * If you wish your version of this file to be governed by only the CDDL
22.34 + * or only the GPL Version 2, indicate your decision by adding
22.35 + * "[Contributor] elects to include this software in this distribution
22.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
22.37 + * single choice of license, a recipient has the option to distribute
22.38 + * your version of this file under either the CDDL, the GPL Version 2 or
22.39 + * to extend the choice of license to its licensees as provided above.
22.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
22.41 + * Version 2 license, then the option applies only if the new code is
22.42 + * made subject to such option by the copyright holder.
22.43 + */
22.44 +
22.45 +package org.netbeans.modules.visualweb.gravy;
22.46 +
22.47 +import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
22.48 +import org.netbeans.modules.visualweb.gravy.EditorOperator;
22.49 +import org.netbeans.jellytools.TopComponentOperator;
22.50 +import org.netbeans.jemmy.util.Dumper;
22.51 +import java.awt.Component;
22.52 +
22.53 +/**
22.54 + * Provides access to the Page and it's subcomponents.
22.55 + */
22.56 +public class PageTopComponentOperator extends TopComponentOperator {
22.57 +
22.58 + /**
22.59 + * Name of the page.
22.60 + */
22.61 + String name = "";
22.62 +
22.63 + /**
22.64 + * Create operator, which represents page.
22.65 + * @param name Name of the page.
22.66 + */
22.67 + public PageTopComponentOperator(String name) {
22.68 + super(name);
22.69 + this.name = name;
22.70 + }
22.71 +
22.72 + /**
22.73 + * Create operator, which represents page.
22.74 + * @param name Name of the page.
22.75 + */
22.76 + public PageTopComponentOperator(String name, int index) {
22.77 + super(name, index);
22.78 + this.name = name;
22.79 + }
22.80 +
22.81 + /**
22.82 + * Get page designer.
22.83 + * @return DesignerPaneOperator Designer for this page.
22.84 + */
22.85 + public DesignerPaneOperator getDesigner() {
22.86 + DesignerPaneOperator.switchToDesignerPane();
22.87 + return new DesignerPaneOperator(this);
22.88 + }
22.89 +
22.90 + /**
22.91 + * Get JSP editor.
22.92 + * @return EditorOperator JSP editor for this page.
22.93 + */
22.94 + public EditorOperator getJSPEditor() {
22.95 + DesignerPaneOperator.switchToJSPSource();
22.96 + return new EditorOperator(this, name);
22.97 + }
22.98 +
22.99 + /**
22.100 + * Get Java editor.
22.101 + * @return EditorOperator Java editor for this page.
22.102 + */
22.103 + public EditorOperator getJavaEditor() {
22.104 + DesignerPaneOperator.switchToJavaSource();
22.105 + return new EditorOperator(this, name);
22.106 + }
22.107 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/ProjectNavigatorOperator.java Thu Jul 10 04:32:50 2008 -0700
23.3 @@ -0,0 +1,207 @@
23.4 +/*
23.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
23.6 + *
23.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
23.8 + *
23.9 + * The contents of this file are subject to the terms of either the GNU
23.10 + * General Public License Version 2 only ("GPL") or the Common
23.11 + * Development and Distribution License("CDDL") (collectively, the
23.12 + * "License"). You may not use this file except in compliance with the
23.13 + * License. You can obtain a copy of the License at
23.14 + * http://www.netbeans.org/cddl-gplv2.html
23.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
23.16 + * specific language governing permissions and limitations under the
23.17 + * License. When distributing the software, include this License Header
23.18 + * Notice in each file and include the License file at
23.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
23.20 + * particular file as subject to the "Classpath" exception as provided
23.21 + * by Sun in the GPL Version 2 section of the License file that
23.22 + * accompanied this code. If applicable, add the following below the
23.23 + * License Header, with the fields enclosed by brackets [] replaced by
23.24 + * your own identifying information:
23.25 + * "Portions Copyrighted [year] [name of copyright owner]"
23.26 + *
23.27 + * Contributor(s):
23.28 + *
23.29 + * The Original Software is NetBeans. The Initial Developer of the Original
23.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
23.31 + * Microsystems, Inc. All Rights Reserved.
23.32 + *
23.33 + * If you wish your version of this file to be governed by only the CDDL
23.34 + * or only the GPL Version 2, indicate your decision by adding
23.35 + * "[Contributor] elects to include this software in this distribution
23.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
23.37 + * single choice of license, a recipient has the option to distribute
23.38 + * your version of this file under either the CDDL, the GPL Version 2 or
23.39 + * to extend the choice of license to its licensees as provided above.
23.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
23.41 + * Version 2 license, then the option applies only if the new code is
23.42 + * made subject to such option by the copyright holder.
23.43 + */
23.44 +
23.45 +package org.netbeans.modules.visualweb.gravy;
23.46 +
23.47 +import javax.swing.tree.TreePath;
23.48 +
23.49 +import org.netbeans.jemmy.operators.*;
23.50 +import org.netbeans.jemmy.*;
23.51 +import org.netbeans.jellytools.*;
23.52 +import org.netbeans.modules.visualweb.gravy.actions.ShowFilesAction;
23.53 +import org.netbeans.modules.visualweb.gravy.actions.ShowProjectsAction;
23.54 +import org.netbeans.modules.visualweb.gravy.actions.BuildProjectAction;
23.55 +
23.56 +import java.awt.*;
23.57 +
23.58 +/** Provides access to Projects window and it's components
23.59 + * @author Alexey Butenko
23.60 + *
23.61 + */
23.62 +public class ProjectNavigatorOperator extends org.netbeans.jellytools.ProjectsTabOperator {
23.63 +
23.64 + public ProjectNavigatorOperator() {
23.65 + super();
23.66 + }
23.67 +
23.68 + /** Select Path
23.69 + * @param treePath - String path to select
23.70 + */
23.71 + public void selectPath(String treePath) {
23.72 + makeComponentVisible();
23.73 + TreePath path = tree().findPath(treePath);
23.74 + tree().selectPath(path);
23.75 + }
23.76 +
23.77 + /** Opens Projects window
23.78 + */
23.79 + public static ProjectNavigatorOperator showProjectNavigator() {
23.80 + new ShowProjectsAction().perform();
23.81 + new QueueTool().waitEmpty();
23.82 + Util.wait(500);
23.83 + return(new ProjectNavigatorOperator());
23.84 + }
23.85 + /**
23.86 + * Select Node
23.87 + * @param node - Node to select
23.88 + */
23.89 + public static void selectNode(String node){
23.90 + ProjectNavigatorOperator projectNav = ProjectNavigatorOperator.showProjectNavigator();
23.91 + projectNav.makeComponentVisible();
23.92 + JTreeOperator tree = projectNav.tree();
23.93 + tree.selectPath(tree.findPath(node));
23.94 + }
23.95 +
23.96 + /** Build Project
23.97 + * @param prjName - Name of the project to build
23.98 + */
23.99 + public void buildProject(String prjName) {
23.100 + makeComponentVisible();
23.101 + pressPopupItemOnNode(prjName, Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_BuildProject"));
23.102 + }
23.103 +
23.104 + /** Opens Files Tab
23.105 + */
23.106 + public static JTreeOperator switchToFiles() {
23.107 + new ShowFilesAction().perform();
23.108 +
23.109 + ContainerOperator containerOperator = new ContainerOperator(
23.110 + waitTopComponent(null,
23.111 + Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle",
23.112 + "LBL_projectTab_tc"), 0,
23.113 + new ComponentChooser() {
23.114 + public boolean checkComponent(Component comp) {
23.115 + return comp.getClass().getName().endsWith("ProjectTab");
23.116 + }
23.117 + public String getDescription() {
23.118 + return "org.netbeans.modules.projects.ui.ProjectTab";
23.119 + }
23.120 + }));
23.121 + Util.wait(1000);
23.122 + JTreeOperator treeOperator = new JTreeOperator(containerOperator);
23.123 + return (treeOperator);
23.124 + }
23.125 +
23.126 + /** Opens Projects Tab
23.127 + */
23.128 + public static ProjectNavigatorOperator switchToProjects() {
23.129 + new ShowProjectsAction().perform();
23.130 + return(new ProjectNavigatorOperator());
23.131 + }
23.132 +
23.133 + /** Press popup item on node
23.134 + * @param path - click for popup on
23.135 + * @param menuItem - item to click in popup window
23.136 + * @param comparator - StringComparator
23.137 + */
23.138 + public static ProjectNavigatorOperator pressPopupItemOnNode(String path, String menuItem,
23.139 + StringComparator comparator) {
23.140 + try{
23.141 + ProjectNavigatorOperator projectNav = ProjectNavigatorOperator.showProjectNavigator();
23.142 + TestUtils.wait(4000);
23.143 + //projectNav.makeComponentVisible();
23.144 + JTreeOperator tree = projectNav.tree();
23.145 + JPopupMenuOperator popup;
23.146 + if (path.equals("ROOT")) {
23.147 + popup = new JPopupMenuOperator(tree.callPopupOnPath(new TreePath(tree.getRoot())));
23.148 + } else {
23.149 + popup = new JPopupMenuOperator(tree.callPopupOnPath(tree.findPath(path, "|")));
23.150 + }
23.151 + new QueueTool().waitEmpty();
23.152 + Util.wait(1000);
23.153 +
23.154 + if (comparator != null) {
23.155 + popup.setComparator(comparator);
23.156 + }
23.157 +
23.158 + popup.pushMenuNoBlock(menuItem, "|");
23.159 + new QueueTool().waitEmpty();
23.160 + Util.wait(1000);
23.161 + return projectNav;
23.162 + } catch(Exception e) {
23.163 + System.out.println("Exception occured in pressPopupItemOnPath function");
23.164 + e.printStackTrace();
23.165 + return null;
23.166 + }
23.167 + }
23.168 +
23.169 + /** Press popup item on node
23.170 + * @param path - click for popup on
23.171 + * @param menuItem - item to click in popup window
23.172 + */
23.173 + public static ProjectNavigatorOperator pressPopupItemOnNode(String path, String menuItem) {
23.174 + return pressPopupItemOnNode(path, menuItem, null);
23.175 + }
23.176 +
23.177 + /**
23.178 + * Add a new page
23.179 + * @param projectName project that a page will be created at
23.180 + * @param pageName page will be created
23.181 + */
23.182 + public void addWebPage(String projectName, String pageName){
23.183 + String treeNodePath = projectName + "|" + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle",
23.184 + "ProjectNode_WebPages");
23.185 + String popupMenuItem = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","ProjectMenuItem_New")
23.186 + +"|"+ Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","ProjectMenuItem_Page");
23.187 + pressPopupItemOnNode(treeNodePath, popupMenuItem);
23.188 +
23.189 + JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","Dialog_NewPage"));
23.190 + Util.wait(1000);
23.191 +
23.192 + JTextFieldOperator textfieldFolderName = new JTextFieldOperator(dialog, 0);
23.193 + textfieldFolderName.setText(pageName);
23.194 + new JButtonOperator(dialog, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","Button_Finish")).pushNoBlock();
23.195 + //dialog.waitClosed();
23.196 + Util.wait(1000);
23.197 +
23.198 + }
23.199 +
23.200 + /**
23.201 + * Open a jsp page of current project
23.202 + * @param webPageName
23.203 + */
23.204 + public void openWebPage(String projectName, String webPageName) {
23.205 + String treeNodePath = projectName + "|" + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "ProjectNode_WebPages") + "|" +
23.206 + webPageName + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "WebPage_extension");
23.207 + String popupMenuItem = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "ProjectMenuItem_Open");
23.208 + pressPopupItemOnNode(treeNodePath, popupMenuItem);
23.209 + }
23.210 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/RaveTestCase.java Thu Jul 10 04:32:50 2008 -0700
24.3 @@ -0,0 +1,214 @@
24.4 +/*
24.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
24.6 +
24.7 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
24.8 +
24.9 +The contents of this file are subject to the terms of either the GNU
24.10 +General Public License Version 2 only ("GPL") or the Common
24.11 +Development and Distribution License("CDDL") (collectively, the
24.12 +"License"). You may not use this file except in compliance with the
24.13 +License. You can obtain a copy of the License at
24.14 +http://www.netbeans.org/cddl-gplv2.html
24.15 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
24.16 +specific language governing permissions and limitations under the
24.17 +License. When distributing the software, include this License Header
24.18 +Notice in each file and include the License file at
24.19 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
24.20 +particular file as subject to the "Classpath" exception as provided
24.21 +by Sun in the GPL Version 2 section of the License file that
24.22 +accompanied this code. If applicable, add the following below the
24.23 +License Header, with the fields enclosed by brackets [] replaced by
24.24 +your own identifying information:
24.25 +"Portions Copyrighted [year] [name of copyright owner]"
24.26 +
24.27 +Contributor(s):
24.28 +
24.29 +The Original Software is NetBeans. The Initial Developer of the Original
24.30 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
24.31 +Microsystems, Inc. All Rights Reserved.
24.32 +
24.33 +If you wish your version of this file to be governed by only the CDDL
24.34 +or only the GPL Version 2, indicate your decision by adding
24.35 +"[Contributor] elects to include this software in this distribution
24.36 +under the [CDDL or GPL Version 2] license." If you do not indicate a
24.37 +single choice of license, a recipient has the option to distribute
24.38 +your version of this file under either the CDDL, the GPL Version 2 or
24.39 +to extend the choice of license to its licensees as provided above.
24.40 +However, if you add GPL Version 2 code and therefore, elected the GPL
24.41 +Version 2 license, then the option applies only if the new code is
24.42 +made subject to such option by the copyright holder.
24.43 +*/
24.44 +
24.45 +package org.netbeans.modules.visualweb.gravy;
24.46 +
24.47 +import org.netbeans.jellytools.JellyTestCase;
24.48 +import org.netbeans.junit.*;
24.49 +import org.netbeans.jemmy.*;
24.50 +import org.netbeans.jemmy.util.PNGEncoder;
24.51 +import org.netbeans.jemmy.util.Dumper;
24.52 +
24.53 +//import com.sun.rave.gravy.winsys.DockablePaneOperator;
24.54 +
24.55 +import java.awt.*;
24.56 +import java.awt.event.HierarchyEvent;
24.57 +import java.awt.event.AWTEventListener;
24.58 +import java.awt.event.HierarchyListener;
24.59 +
24.60 +import java.io.*;
24.61 +
24.62 +import java.util.Properties;
24.63 +
24.64 +/**
24.65 + *
24.66 + * @author Alexandre (Shura) Iline (alexandre.iline@sun.com)
24.67 + */
24.68 +public class RaveTestCase extends JellyTestCase {
24.69 +
24.70 + TestProperties props;
24.71 +
24.72 + public RaveTestCase(String testName) {
24.73 + super(testName);
24.74 + props = new TestProperties();
24.75 + dumpScreen = true;
24.76 + }
24.77 +
24.78 + protected TestProperties getTestProperties() {
24.79 + return(props);
24.80 + }
24.81 +
24.82 +//@todo
24.83 +
24.84 + protected boolean waitNoEvent = true;
24.85 +
24.86 +// all code until end of class should be removed after JellyTestCase corresponding change - adding waitNoEvent member
24.87 +
24.88 + /** Overriden method from JUnit framework execution to perform conditional
24.89 + * screen shot and conversion from TimeoutExpiredException to AssertionFailedError. <br>
24.90 + * Waits a second before test execution.
24.91 + * @throws Throwable Throwable
24.92 + */
24.93 + public void runBare() throws Throwable {
24.94 +
24.95 + //close the damn window
24.96 +// if(Util.getMainWindow().
24.97 +// findSubComponent(new DockablePaneOperator.DockablePaneFinder("JUnitTestRunnerExecutor"))
24.98 +// != null) {
24.99 +// new DockablePaneOperator("JUnitTestRunnerExecutor").hide();
24.100 +// }
24.101 + // workaround for JDK bug 4924516 (see below)
24.102 + Toolkit.getDefaultToolkit().addAWTEventListener(distributingHierarchyListener,
24.103 + HierarchyEvent.HIERARCHY_EVENT_MASK);
24.104 + // wait
24.105 + if(waitNoEvent) {
24.106 + new EventTool().waitNoEvent(1000);
24.107 + }
24.108 + try {
24.109 + super.runBare();
24.110 + } catch (ThreadDeath td) {
24.111 + // ThreadDead must be re-throwed immediately
24.112 + throw td;
24.113 + } catch (Throwable th) {
24.114 + // suite is notified about test failure so it can do some debug actions
24.115 + try {
24.116 + failNotify(th);
24.117 + } catch (Exception e3) {}
24.118 + // screen capture is performed when test fails and in dependency on system property
24.119 + if (captureScreen) {
24.120 + try {
24.121 + PNGEncoder.captureScreen(getWorkDir().getAbsolutePath()+File.separator+"screen.png");
24.122 + } catch (Exception e1) {}
24.123 + }
24.124 + // XML dump is performed when test fails and in dependency on system property
24.125 + if (dumpScreen) {
24.126 + try {
24.127 + Dumper.dumpAll(getWorkDir().getAbsolutePath()+File.separator+"screen.xml");
24.128 + } catch (Exception e2) {}
24.129 + }
24.130 + // closes all modal dialogs in dependency on systems property
24.131 + if (closeAllModal) try {
24.132 + closeAllModal();
24.133 + } catch (Exception e) {}
24.134 + if (th instanceof JemmyException) {
24.135 + // all instancies of JemmyException are re-throwed as AssertionError (test failed)
24.136 + throw new AssertionFailedErrorException(th.getMessage(), th);
24.137 + } else {
24.138 + throw th;
24.139 + }
24.140 + } finally {
24.141 + // workaround for JDK bug 4924516 (see below)
24.142 + Toolkit.getDefaultToolkit().removeAWTEventListener(distributingHierarchyListener);
24.143 + }
24.144 + }
24.145 +
24.146 + public static Properties getDeploymentTargetProperties(String path_to_file) {
24.147 + Properties properties = new Properties();
24.148 + try {
24.149 + System.out.println("path to file is \"" + path_to_file + "\".");
24.150 + properties.load(new FileInputStream(path_to_file));
24.151 + } catch(Exception e) {
24.152 + System.out.println("Properties can not be loaded!");
24.153 + System.out.println("e=" + e.toString());
24.154 + return null;
24.155 + }
24.156 + return properties;
24.157 + }
24.158 +
24.159 + public static Properties getDeploymentTargetProperties() {
24.160 + String sep = File.separator;
24.161 + String path = System.getProperty("xtest.data.dir");
24.162 + path = path + sep + "DeploymentTargets.properties";
24.163 + return getDeploymentTargetProperties(path);
24.164 + }
24.165 +
24.166 + public static Properties getDefaultDeploymentTargetProperties() {
24.167 + String sep = File.separator;
24.168 + String path = System.getProperty("xtest.data.dir");
24.169 + path = path + sep + "DefaultDeploymentTargets.properties";
24.170 + return getDeploymentTargetProperties(path);
24.171 + }
24.172 +
24.173 + /* Workaround for JDK bug http://developer.java.sun.com/developer/bugParade/bugs/4924516.html.
24.174 + * Also see issue http://www.netbeans.org/issues/show_bug.cgi?id=32466.
24.175 + * ------------------------------------------------------------------------------------------
24.176 + * It can be removed when it is fixed (probably in JDK1.5.0). The following
24.177 + * listener is added to Toolkit at runBare() method and removed when it finishes.
24.178 + * It distributes HierarchyEvent to all listening components and its subcomponents.
24.179 + */
24.180 + private static final RaveTestCase.DistributingHierarchyListener
24.181 + distributingHierarchyListener = new RaveTestCase.DistributingHierarchyListener();
24.182 +
24.183 + private static class DistributingHierarchyListener implements AWTEventListener {
24.184 +
24.185 + public DistributingHierarchyListener() {
24.186 + }
24.187 +
24.188 + public void eventDispatched(java.awt.AWTEvent aWTEvent) {
24.189 + HierarchyEvent hevt = null;
24.190 + if (aWTEvent instanceof HierarchyEvent) {
24.191 + hevt = (HierarchyEvent) aWTEvent;
24.192 + }
24.193 + if (hevt != null && ((HierarchyEvent.SHOWING_CHANGED & hevt.getChangeFlags()) != 0)) {
24.194 + distributeShowingEvent(hevt.getComponent(), hevt);
24.195 + }
24.196 + }
24.197 +
24.198 + private static void distributeShowingEvent(Component c, HierarchyEvent hevt) {
24.199 + //HierarchyListener[] hierarchyListeners = c.getHierarchyListeners();
24.200 + // Need to use component.getListeners because it is not synchronized
24.201 + // and it not cause deadlock
24.202 + HierarchyListener[] hierarchyListeners = (HierarchyListener[])(c.getListeners(HierarchyListener.class));
24.203 + if (hierarchyListeners != null) {
24.204 + for (int i = 0; i < hierarchyListeners.length; i++) {
24.205 + hierarchyListeners[i].hierarchyChanged(hevt);
24.206 + }
24.207 + }
24.208 + if (c instanceof Container) {
24.209 + Container cont = (Container) c;
24.210 + int n = cont.getComponentCount();
24.211 + for (int i = 0; i < n; i++) {
24.212 + distributeShowingEvent(cont.getComponent(i), hevt);
24.213 + }
24.214 + }
24.215 + }
24.216 + }
24.217 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/RaveWindowOperator.java Thu Jul 10 04:32:50 2008 -0700
25.3 @@ -0,0 +1,85 @@
25.4 +/*
25.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
25.6 + *
25.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
25.8 + *
25.9 + * The contents of this file are subject to the terms of either the GNU
25.10 + * General Public License Version 2 only ("GPL") or the Common
25.11 + * Development and Distribution License("CDDL") (collectively, the
25.12 + * "License"). You may not use this file except in compliance with the
25.13 + * License. You can obtain a copy of the License at
25.14 + * http://www.netbeans.org/cddl-gplv2.html
25.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
25.16 + * specific language governing permissions and limitations under the
25.17 + * License. When distributing the software, include this License Header
25.18 + * Notice in each file and include the License file at
25.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
25.20 + * particular file as subject to the "Classpath" exception as provided
25.21 + * by Sun in the GPL Version 2 section of the License file that
25.22 + * accompanied this code. If applicable, add the following below the
25.23 + * License Header, with the fields enclosed by brackets [] replaced by
25.24 + * your own identifying information:
25.25 + * "Portions Copyrighted [year] [name of copyright owner]"
25.26 + *
25.27 + * Contributor(s):
25.28 + *
25.29 + * The Original Software is NetBeans. The Initial Developer of the Original
25.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
25.31 + * Microsystems, Inc. All Rights Reserved.
25.32 + *
25.33 + * If you wish your version of this file to be governed by only the CDDL
25.34 + * or only the GPL Version 2, indicate your decision by adding
25.35 + * "[Contributor] elects to include this software in this distribution
25.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
25.37 + * single choice of license, a recipient has the option to distribute
25.38 + * your version of this file under either the CDDL, the GPL Version 2 or
25.39 + * to extend the choice of license to its licensees as provided above.
25.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
25.41 + * Version 2 license, then the option applies only if the new code is
25.42 + * made subject to such option by the copyright holder.
25.43 + */
25.44 +
25.45 +package org.netbeans.modules.visualweb.gravy;
25.46 +
25.47 +
25.48 +import org.netbeans.jemmy.operators.JButtonOperator;
25.49 +
25.50 +/**
25.51 + * @author Alexey Butenko
25.52 + */
25.53 +public class RaveWindowOperator extends org.netbeans.jellytools.MainWindowOperator{
25.54 + /** Singleton instance of MainWindowOperator. */
25.55 + private static RaveWindowOperator defaultMainWindowOperator;
25.56 + JButtonOperator deployButton, buttonSaveAll;
25.57 +
25.58 + public RaveWindowOperator() {
25.59 + super();
25.60 + }
25.61 +
25.62 + /** Returns instance of MainWindowOperator. It is singleton, so this method
25.63 + * is only way how to obtain instance. If instance not exists, it creates one.
25.64 + * @return instance of MainWindowOperator
25.65 + */
25.66 + public static synchronized RaveWindowOperator getDefaultRave() {
25.67 + if(defaultMainWindowOperator == null) {
25.68 + defaultMainWindowOperator = new RaveWindowOperator();
25.69 + }
25.70 + return (defaultMainWindowOperator);
25.71 + }
25.72 +
25.73 + public JButtonOperator btDeploy() {
25.74 + if (deployButton == null) {
25.75 + deployButton = getToolbarButton(this, "Run Main Project");
25.76 + deployButton.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
25.77 + }
25.78 + return(deployButton);
25.79 + }
25.80 +
25.81 + public JButtonOperator btSaveAll() {
25.82 + if (buttonSaveAll == null) {
25.83 + buttonSaveAll = getToolbarButton(this, "Save All");
25.84 + buttonSaveAll.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
25.85 + }
25.86 + return (buttonSaveAll);
25.87 + }
25.88 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/Repeater.java Thu Jul 10 04:32:50 2008 -0700
26.3 @@ -0,0 +1,136 @@
26.4 +/*
26.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
26.6 +*
26.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
26.8 +*
26.9 +* The contents of this file are subject to the terms of either the GNU
26.10 +* General Public License Version 2 only ("GPL") or the Common
26.11 +* Development and Distribution License("CDDL") (collectively, the
26.12 +* "License"). You may not use this file except in compliance with the
26.13 +* License. You can obtain a copy of the License at
26.14 +* http://www.netbeans.org/cddl-gplv2.html
26.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
26.16 +* specific language governing permissions and limitations under the
26.17 +* License. When distributing the software, include this License Header
26.18 +* Notice in each file and include the License file at
26.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
26.20 +* particular file as subject to the "Classpath" exception as provided
26.21 +* by Sun in the GPL Version 2 section of the License file that
26.22 +* accompanied this code. If applicable, add the following below the
26.23 +* License Header, with the fields enclosed by brackets [] replaced by
26.24 +* your own identifying information:
26.25 +* "Portions Copyrighted [year] [name of copyright owner]"
26.26 +*
26.27 +* Contributor(s):
26.28 +*
26.29 +* The Original Software is NetBeans. The Initial Developer of the Original
26.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
26.31 +* Microsystems, Inc. All Rights Reserved.
26.32 +*
26.33 +* If you wish your version of this file to be governed by only the CDDL
26.34 +* or only the GPL Version 2, indicate your decision by adding
26.35 +* "[Contributor] elects to include this software in this distribution
26.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
26.37 +* single choice of license, a recipient has the option to distribute
26.38 +* your version of this file under either the CDDL, the GPL Version 2 or
26.39 +* to extend the choice of license to its licensees as provided above.
26.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
26.41 +* Version 2 license, then the option applies only if the new code is
26.42 +* made subject to such option by the copyright holder.
26.43 +*/
26.44 +
26.45 +package org.netbeans.modules.visualweb.gravy;
26.46 +import org.netbeans.jemmy.JemmyProperties;
26.47 +import org.netbeans.jemmy.Timeout;
26.48 +
26.49 +/**
26.50 + * This class is intended to be used as a base for anonymous classes
26.51 + * aimed on several repeating of some action which is possible to failed
26.52 + * from first (second, third..) attempt
26.53 + */
26.54 +public class Repeater {
26.55 +
26.56 + private int repeatCount = 3;
26.57 + private long repeatTimeout = 2000;
26.58 +
26.59 + /** Creates a new instance of Repeater
26.60 + * Uses default of 3 attempts with 2 sec timeout
26.61 + */
26.62 + public Repeater() {
26.63 + }
26.64 +
26.65 + /** Creates a new instance of Repeater
26.66 + * Uses default 2 sec timeout
26.67 + * @param repeatCount Number of attempts to try
26.68 + */
26.69 + public Repeater(int repeatCount) {
26.70 + this.repeatCount = repeatCount;
26.71 + }
26.72 +
26.73 + /** Creates a new instance of Repeater
26.74 + * @param repeatCount Number of attempts to try
26.75 + * @param repeatTimout Timeout between attempts
26.76 + */
26.77 + public Repeater(int repeatCount, long repeatTimeout) {
26.78 + this.repeatCount = repeatCount;
26.79 + this.repeatTimeout = repeatTimeout;
26.80 + }
26.81 +
26.82 + /**
26.83 + * Trys to perform action() several attempts, if any errors are
26.84 + * thrown, tryis to repeat it until specified repeat number of
26.85 + * attempts is reached
26.86 + */
26.87 + public void tryAction() {
26.88 + boolean success = false;
26.89 + for(int i = 0; !success && i < repeatCount; i++) {
26.90 + try {
26.91 + action();
26.92 + success = true;
26.93 + } catch (Error e) {
26.94 + JemmyProperties.getCurrentOutput().printTrace("Attempt = " + (i + 1) + " failed with the following error:");
26.95 + e.printStackTrace(JemmyProperties.getCurrentOutput().getOutput());
26.96 + // We re-throw exception if this is the last attempt
26.97 + if (i == repeatCount - 1) throw e;
26.98 + new Timeout("repeatTimeout", repeatTimeout).sleep();
26.99 + } catch (RuntimeException re) {
26.100 + JemmyProperties.getCurrentOutput().printTrace("Attempt = " + (i + 1) + " failed with the following exception:");
26.101 + re.printStackTrace(JemmyProperties.getCurrentOutput().getOutput());
26.102 + // We re-throw exception if this is the last attempt
26.103 + if (i == repeatCount - 1) throw re;
26.104 + new Timeout("repeatTimeout", repeatTimeout).sleep();
26.105 + }
26.106 + }
26.107 + }
26.108 +
26.109 + /**
26.110 + * Trys to perform action() several attempts, if any errors are
26.111 + * thrown, tryis to repeat it until specified repeatCount number of
26.112 + * attempts is reached
26.113 + * @param repeatCount Number of attempts to perform
26.114 + */
26.115 + public void tryAction(int repeatCount) {
26.116 + this.repeatCount = repeatCount;
26.117 + tryAction();
26.118 + }
26.119 +
26.120 + /**
26.121 + * Trys to perform action() several attempts, if any errors are
26.122 + * thrown, tryis to repeat it until specified repeatCount number of
26.123 + * attempts is reached. Uses specified repeatTimeout between attempts
26.124 + * @param repeatCount Number of attempts to perform
26.125 + * @param repeatTimeout Timeout between attempts
26.126 + */
26.127 + public void tryAction(int repeatCount, long repeatTimeout) {
26.128 + this.repeatCount = repeatCount;
26.129 + this.repeatTimeout = repeatTimeout;
26.130 + tryAction();
26.131 + }
26.132 +
26.133 + /**
26.134 + * Action to perform. Implement it in your anonymous class
26.135 + */
26.136 + public void action() {
26.137 + JemmyProperties.getCurrentOutput().printTrace("Repeater: Nothing set to do!");
26.138 + }
26.139 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/StartStopDialogOperator.java Thu Jul 10 04:32:50 2008 -0700
27.3 @@ -0,0 +1,149 @@
27.4 +/*
27.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
27.6 +*
27.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
27.8 +*
27.9 +* The contents of this file are subject to the terms of either the GNU
27.10 +* General Public License Version 2 only ("GPL") or the Common
27.11 +* Development and Distribution License("CDDL") (collectively, the
27.12 +* "License"). You may not use this file except in compliance with the
27.13 +* License. You can obtain a copy of the License at
27.14 +* http://www.netbeans.org/cddl-gplv2.html
27.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
27.16 +* specific language governing permissions and limitations under the
27.17 +* License. When distributing the software, include this License Header
27.18 +* Notice in each file and include the License file at
27.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
27.20 +* particular file as subject to the "Classpath" exception as provided
27.21 +* by Sun in the GPL Version 2 section of the License file that
27.22 +* accompanied this code. If applicable, add the following below the
27.23 +* License Header, with the fields enclosed by brackets [] replaced by
27.24 +* your own identifying information:
27.25 +* "Portions Copyrighted [year] [name of copyright owner]"
27.26 +*
27.27 +* Contributor(s):
27.28 +*
27.29 +* The Original Software is NetBeans. The Initial Developer of the Original
27.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
27.31 +* Microsystems, Inc. All Rights Reserved.
27.32 +*
27.33 +* If you wish your version of this file to be governed by only the CDDL
27.34 +* or only the GPL Version 2, indicate your decision by adding
27.35 +* "[Contributor] elects to include this software in this distribution
27.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
27.37 +* single choice of license, a recipient has the option to distribute
27.38 +* your version of this file under either the CDDL, the GPL Version 2 or
27.39 +* to extend the choice of license to its licensees as provided above.
27.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
27.41 +* Version 2 license, then the option applies only if the new code is
27.42 +* made subject to such option by the copyright holder.
27.43 +*/
27.44 +
27.45 +package org.netbeans.modules.visualweb.gravy;
27.46 +
27.47 +import java.awt.Component;
27.48 +import java.awt.Container;
27.49 +import javax.swing.JFrame;
27.50 +import org.netbeans.jemmy.ComponentChooser;
27.51 +import org.netbeans.jemmy.ComponentSearcher;
27.52 +import org.netbeans.jemmy.JemmyProperties;
27.53 +import org.netbeans.jemmy.operators.JCheckBoxOperator;
27.54 +import org.netbeans.jemmy.operators.JFrameOperator;
27.55 +import org.netbeans.jemmy.operators.JLabelOperator;
27.56 +import org.netbeans.jemmy.operators.JButtonOperator;
27.57 +
27.58 +/**
27.59 + * This class is used in automated tests, developed for Creator 2.0/2.1, for launching
27.60 + * and shutting down of an application server, included into these products.
27.61 + */
27.62 +public class StartStopDialogOperator extends JFrameOperator {
27.63 + JCheckBoxOperator autoHide;
27.64 +
27.65 + /**
27.66 + * Creates a new instance of this class.
27.67 + */
27.68 + public StartStopDialogOperator() {
27.69 + super(new StartStopDialogFinder());
27.70 + copyEnvironment(Util.getMainWindow());
27.71 + getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 600000);
27.72 + getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 600000);
27.73 + }
27.74 +
27.75 + /**
27.76 + * Initializes and returns a checkbox "Autohide"
27.77 + * @return an object JCheckBoxOperator
27.78 + */
27.79 + public JCheckBoxOperator chbAutoHide() {
27.80 + if(autoHide == null) {
27.81 + autoHide = new JCheckBoxOperator(this, "Automatically close this window when finished");
27.82 + }
27.83 + return(autoHide);
27.84 + }
27.85 +
27.86 + /**
27.87 + * Marks or unmarks a checkbox "Auto Hide".
27.88 + * @param isAutoHide boolean value, which defines if a checkbox "Auto Hide"
27.89 + * is marked or not.
27.90 + */
27.91 + public void setAutoHide(boolean isAutoHide) {
27.92 + chbAutoHide().changeSelection(isAutoHide);
27.93 + }
27.94 +
27.95 + /**
27.96 + * Waits until the required string appears in the dialog.
27.97 + * @param status string, which is waited in the dialog
27.98 + * @return an object JLabelOperator
27.99 + */
27.100 + public JLabelOperator waitStatus(String status) {
27.101 + return(new JLabelOperator(this, status));
27.102 + }
27.103 +
27.104 + /**
27.105 + * Waits until the string "Completed" appears in the dialog.
27.106 + * @return an object JLabelOperator
27.107 + */
27.108 + public JLabelOperator waitCompleted() {
27.109 + return(waitStatus("Completed"));
27.110 + }
27.111 +
27.112 + /**
27.113 + * Launches an application server.
27.114 + */
27.115 + public void start(String action) {
27.116 + new JButtonOperator(this, "Start Server").push();
27.117 + }
27.118 +
27.119 + /**
27.120 + * Shuts an application server down.
27.121 + */
27.122 + public void stop(String action) {
27.123 + new JButtonOperator(this, "Stop Server").push();
27.124 + }
27.125 +
27.126 + /**
27.127 + * Inner class, which is used for searching of a "Start/Stop-dialog" in
27.128 + * Creator's IDE.
27.129 + */
27.130 + public static class StartStopDialogFinder implements ComponentChooser {
27.131 + /**
27.132 + * Searches a component "Start/Stop-dialog" in Creator's IDE
27.133 + * @return true if dialog is found, otherwise - false.
27.134 + */
27.135 + public boolean checkComponent(Component comp) {
27.136 + ComponentSearcher searcher = new ComponentSearcher((Container)comp);
27.137 + searcher.setOutput(JemmyProperties.getCurrentOutput().createErrorOutput());
27.138 + return(comp instanceof JFrame &&
27.139 + searcher.findComponent(new ComponentChooser() {
27.140 + public boolean checkComponent(Component comp) {
27.141 + return(comp.getClass().getName().startsWith("Server Status"));
27.142 + }
27.143 + public String getDescription() {
27.144 + return("ProgressUI");
27.145 + }
27.146 + }) != null);
27.147 + }
27.148 + public String getDescription() {
27.149 + return("StartStop dialog");
27.150 + }
27.151 + }
27.152 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/StatusWaitable.java Thu Jul 10 04:32:50 2008 -0700
28.3 @@ -0,0 +1,168 @@
28.4 +/*
28.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
28.6 +*
28.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
28.8 +*
28.9 +* The contents of this file are subject to the terms of either the GNU
28.10 +* General Public License Version 2 only ("GPL") or the Common
28.11 +* Development and Distribution License("CDDL") (collectively, the
28.12 +* "License"). You may not use this file except in compliance with the
28.13 +* License. You can obtain a copy of the License at
28.14 +* http://www.netbeans.org/cddl-gplv2.html
28.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
28.16 +* specific language governing permissions and limitations under the
28.17 +* License. When distributing the software, include this License Header
28.18 +* Notice in each file and include the License file at
28.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
28.20 +* particular file as subject to the "Classpath" exception as provided
28.21 +* by Sun in the GPL Version 2 section of the License file that
28.22 +* accompanied this code. If applicable, add the following below the
28.23 +* License Header, with the fields enclosed by brackets [] replaced by
28.24 +* your own identifying information:
28.25 +* "Portions Copyrighted [year] [name of copyright owner]"
28.26 +*
28.27 +* Contributor(s):
28.28 +*
28.29 +* The Original Software is NetBeans. The Initial Developer of the Original
28.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
28.31 +* Microsystems, Inc. All Rights Reserved.
28.32 +*
28.33 +* If you wish your version of this file to be governed by only the CDDL
28.34 +* or only the GPL Version 2, indicate your decision by adding
28.35 +* "[Contributor] elects to include this software in this distribution
28.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
28.37 +* single choice of license, a recipient has the option to distribute
28.38 +* your version of this file under either the CDDL, the GPL Version 2 or
28.39 +* to extend the choice of license to its licensees as provided above.
28.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
28.41 +* Version 2 license, then the option applies only if the new code is
28.42 +* made subject to such option by the copyright holder.
28.43 +*/
28.44 +
28.45 +package org.netbeans.modules.visualweb.gravy;
28.46 +
28.47 +import org.netbeans.jemmy.Waitable;
28.48 +import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
28.49 +
28.50 +/**
28.51 + * This class is used for observation of status of some component.
28.52 + */
28.53 +public class StatusWaitable implements Waitable {
28.54 + private String[] variants;
28.55 + private String valid;
28.56 + private boolean exactMatch;
28.57 + private boolean thread;
28.58 +
28.59 + /**
28.60 + * Creates an instance of this class.
28.61 + * @param variants an array of Strings, which could appear in an observable component.
28.62 + */
28.63 + public StatusWaitable(String[] variants) {
28.64 + this.variants = variants;
28.65 + this.exactMatch = true;
28.66 + this.thread = false;
28.67 + }
28.68 +
28.69 + /**
28.70 + * Creates an instance of this class.
28.71 + * @param variants an array of Strings, which could appear in an observable component.
28.72 + * @param isExact a boolean value, which defines a mode of String comparison:
28.73 + * true means using of the method equals(), false means using of the method indexOf().
28.74 + */
28.75 + public StatusWaitable(String[] variants, boolean isExact) {
28.76 + this.variants = variants;
28.77 + this.exactMatch = isExact;
28.78 + this.thread = false;
28.79 + }
28.80 +
28.81 + /**
28.82 + * Creates an instance of this class.
28.83 + * @param variant1 a string, which could appear in an observable component.
28.84 + * @param variant2 a string, which could appear in an observable component.
28.85 + */
28.86 + public StatusWaitable(String variant1, String variant2) {
28.87 + this.variants = new String[] {variant1, variant2};
28.88 + this.exactMatch = false;
28.89 + this.thread = true;
28.90 + }
28.91 +
28.92 + /**
28.93 + * Creates an instance of this class.
28.94 + * @param variant1 a string, which could appear in an observable component.
28.95 + * @param variant2 a string, which could appear in an observable component.
28.96 + * @param variant3 a string, which could appear in an observable component.
28.97 + */
28.98 + public StatusWaitable(String variant1, String variant2, String variant3) {
28.99 + this.variants = new String[] {variant1, variant2, variant3};
28.100 + this.exactMatch = false;
28.101 + this.thread = true;
28.102 + }
28.103 +
28.104 + /**
28.105 + * Checks if wait criteria have been met.
28.106 + * @param o optional waiting parameter.
28.107 + * @return null if criteria has not been met.
28.108 + */
28.109 + public Object actionProduced(Object o) {
28.110 + if(exactMatch){
28.111 + for(int i=0;i<variants.length;i++) {
28.112 + if (variants[i].equals(getStatusText())) {
28.113 + valid = variants[i];
28.114 + return Boolean.TRUE;
28.115 + }
28.116 + }
28.117 + }else{
28.118 + if(thread){
28.119 + String status = getStatusText();
28.120 + if(status.startsWith(variants[0])){
28.121 + int index = status.lastIndexOf(variants[1]);
28.122 + int index1 = 0;
28.123 + if(variants.length==3) index1 = status.lastIndexOf(variants[2]);
28.124 + if(index+variants[1].length() == status.length()){
28.125 + return Boolean.TRUE;
28.126 + }
28.127 + if(variants.length==3) if(index1+variants[2].length() == status.length()){
28.128 + return Boolean.TRUE;
28.129 + }
28.130 + }
28.131 + }else{
28.132 + for(int i=0;i<variants.length;i++) {
28.133 + if (getStatusText().indexOf(variants[i])!=-1) {
28.134 + valid = variants[i];
28.135 + return Boolean.TRUE;
28.136 + }
28.137 + }
28.138 + }
28.139 + }
28.140 + return null;
28.141 + }
28.142 +
28.143 + /**
28.144 + * Returns description.
28.145 + * @return a text description of the wait criteria.
28.146 + */
28.147 + public String getDescription() {
28.148 + String dsc = "";
28.149 + for(int i=0;i<variants.length;i++) {
28.150 + dsc+=variants[i] + "|";
28.151 + }
28.152 + return "Variants = " + dsc;
28.153 + }
28.154 +
28.155 + /**
28.156 + * Returns current status of an observable component.
28.157 + * @return a text corresponding to current status.
28.158 + */
28.159 + public String getStatus() {
28.160 + return valid;
28.161 + }
28.162 +
28.163 + /**
28.164 + * Returns current text from status line of the IDE's main window.
28.165 + * @return a text from IDE's status line.
28.166 + */
28.167 + private String getStatusText() {
28.168 + String s = (Util.getMainWindow()).getStatusText();
28.169 + return (s == null) ? "" : s;
28.170 + }
28.171 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/TestProperties.java Thu Jul 10 04:32:50 2008 -0700
29.3 @@ -0,0 +1,113 @@
29.4 +/*
29.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
29.6 +*
29.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
29.8 +*
29.9 +* The contents of this file are subject to the terms of either the GNU
29.10 +* General Public License Version 2 only ("GPL") or the Common
29.11 +* Development and Distribution License("CDDL") (collectively, the
29.12 +* "License"). You may not use this file except in compliance with the
29.13 +* License. You can obtain a copy of the License at
29.14 +* http://www.netbeans.org/cddl-gplv2.html
29.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
29.16 +* specific language governing permissions and limitations under the
29.17 +* License. When distributing the software, include this License Header
29.18 +* Notice in each file and include the License file at
29.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
29.20 +* particular file as subject to the "Classpath" exception as provided
29.21 +* by Sun in the GPL Version 2 section of the License file that
29.22 +* accompanied this code. If applicable, add the following below the
29.23 +* License Header, with the fields enclosed by brackets [] replaced by
29.24 +* your own identifying information:
29.25 +* "Portions Copyrighted [year] [name of copyright owner]"
29.26 +*
29.27 +* Contributor(s):
29.28 +*
29.29 +* The Original Software is NetBeans. The Initial Developer of the Original
29.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
29.31 +* Microsystems, Inc. All Rights Reserved.
29.32 +*
29.33 +* If you wish your version of this file to be governed by only the CDDL
29.34 +* or only the GPL Version 2, indicate your decision by adding
29.35 +* "[Contributor] elects to include this software in this distribution
29.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
29.37 +* single choice of license, a recipient has the option to distribute
29.38 +* your version of this file under either the CDDL, the GPL Version 2 or
29.39 +* to extend the choice of license to its licensees as provided above.
29.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
29.41 +* Version 2 license, then the option applies only if the new code is
29.42 +* made subject to such option by the copyright holder.
29.43 +*/
29.44 +
29.45 +package org.netbeans.modules.visualweb.gravy;
29.46 +
29.47 +import java.io.*;
29.48 +import java.util.Properties;
29.49 +
29.50 +/**
29.51 + * This class is used as storage of various test properties, which can be loaded
29.52 + * from a file and saved to a file.
29.53 + */
29.54 +public class TestProperties {
29.55 + Properties props;
29.56 + String propFile;
29.57 +
29.58 + /**
29.59 + * Creates a new instance of this class and loads properties from a file.
29.60 + */
29.61 + public TestProperties() {
29.62 + props = new Properties();
29.63 + loadProps();
29.64 + }
29.65 +
29.66 + /**
29.67 + * Returns current set of test properties.
29.68 + * @return an object Properties
29.69 + */
29.70 + protected Properties getTestProperties() {
29.71 + return(props);
29.72 + }
29.73 +
29.74 + /**
29.75 + * Returns a value of required property.
29.76 + * @param key a name of required property
29.77 + * @return a value of required property (an object String)
29.78 + */
29.79 + public String getTestProperty(String key) {
29.80 + return(props.getProperty(key));
29.81 + }
29.82 +
29.83 + /**
29.84 + * Returns a value of required property.
29.85 + * @param key a name of required property
29.86 + * @return a value of required property (an object String)
29.87 + */
29.88 + public Object setTestProperty(String key, String value) {
29.89 + Object retValue = props.setProperty(key, value);
29.90 + saveProps();
29.91 + return(retValue);
29.92 + }
29.93 +
29.94 + /**
29.95 + * Loads test properties from file.
29.96 + */
29.97 + private void loadProps() {
29.98 + try{
29.99 + propFile = System.getProperty("xtest.workdir") + File.separator + "TestProperties";
29.100 + props.load(new FileInputStream(propFile));
29.101 + } catch(IOException e) {
29.102 + //do nothing
29.103 + }
29.104 + }
29.105 +
29.106 + /**
29.107 + * Stores all test properties to file.
29.108 + */
29.109 + private void saveProps() {
29.110 + try{
29.111 + props.store(new FileOutputStream(propFile), "Rave test properties");
29.112 + } catch(IOException e) {
29.113 + //do nothing
29.114 + }
29.115 + }
29.116 +}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/TestUtils.java Thu Jul 10 04:32:50 2008 -0700
30.3 @@ -0,0 +1,1351 @@
30.4 +/*
30.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
30.6 + *
30.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
30.8 + *
30.9 + * The contents of this file are subject to the terms of either the GNU
30.10 + * General Public License Version 2 only ("GPL") or the Common
30.11 + * Development and Distribution License("CDDL") (collectively, the
30.12 + * "License"). You may not use this file except in compliance with the
30.13 + * License. You can obtain a copy of the License at
30.14 + * http://www.netbeans.org/cddl-gplv2.html
30.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
30.16 + * specific language governing permissions and limitations under the
30.17 + * License. When distributing the software, include this License Header
30.18 + * Notice in each file and include the License file at
30.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
30.20 + * particular file as subject to the "Classpath" exception as provided
30.21 + * by Sun in the GPL Version 2 section of the License file that
30.22 + * accompanied this code. If applicable, add the following below the
30.23 + * License Header, with the fields enclosed by brackets [] replaced by
30.24 + * your own identifying information:
30.25 + * "Portions Copyrighted [year] [name of copyright owner]"
30.26 + *
30.27 + * Contributor(s):
30.28 + *
30.29 + * The Original Software is NetBeans. The Initial Developer of the Original
30.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
30.31 + * Microsystems, Inc. All Rights Reserved.
30.32 + *
30.33 + * If you wish your version of this file to be governed by only the CDDL
30.34 + * or only the GPL Version 2, indicate your decision by adding
30.35 + * "[Contributor] elects to include this software in this distribution
30.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
30.37 + * single choice of license, a recipient has the option to distribute
30.38 + * your version of this file under either the CDDL, the GPL Version 2 or
30.39 + * to extend the choice of license to its licensees as provided above.
30.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
30.41 + * Version 2 license, then the option applies only if the new code is
30.42 + * made subject to such option by the copyright holder.
30.43 + */
30.44 +
30.45 +package org.netbeans.modules.visualweb.gravy;
30.46 +
30.47 +import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
30.48 +import java.nio.charset.MalformedInputException;
30.49 +import javax.swing.tree.TreePath;
30.50 +import org.netbeans.jellytools.Bundle;
30.51 +import org.netbeans.jellytools.NewProjectWizardOperator;
30.52 +import org.netbeans.jellytools.TopComponentOperator;
30.53 +import org.netbeans.modules.visualweb.gravy.debugger.BuildOutputOperator;
30.54 +import org.netbeans.modules.visualweb.gravy.welcome.WelcomeOperator;
30.55 +import org.netbeans.modules.visualweb.gravy.actions.CloseProjectAction;
30.56 +import java.awt.*;
30.57 +import java.awt.event.*;
30.58 +import java.io.*;
30.59 +import java.util.Date;
30.60 +import java.util.Properties;
30.61 +import java.text.SimpleDateFormat;
30.62 +import java.net.URL;
30.63 +import org.netbeans.modules.visualweb.gravy.properties.Property;
30.64 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetTabOperator;
30.65 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
30.66 +import org.netbeans.modules.visualweb.gravy.designer.*;
30.67 +import javax.swing.*;
30.68 +import org.netbeans.jemmy.*;
30.69 +import org.netbeans.jemmy.drivers.*;
30.70 +import org.netbeans.jemmy.drivers.input.*;
30.71 +import org.netbeans.jemmy.operators.*;
30.72 +import com.meterware.httpunit.*;
30.73 +import java.util.Enumeration;
30.74 +import java.util.zip.ZipEntry;
30.75 +import java.util.zip.ZipFile;
30.76 +import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
30.77 +import org.netbeans.jellytools.OutputOperator;
30.78 +import org.openide.windows.TopComponent;
30.79 +
30.80 +/**
30.81 + * TestUtils class
30.82 + * @author Vladimir Strigun (sva@sparc.spb.su)
30.83 + */
30.84 +
30.85 +public class TestUtils {
30.86 +
30.87 + public static final String KEY_STRING_AFTER_PRJ_NAME_J2EE = "src",
30.88 + KEY_STRING_AFTER_PRJ_NAME_JSF = "web";
30.89 + private static final String SAVE_DIALOG_TITLE = "Save";
30.90 + private static final String SAVE_ALL = "Save All";
30.91 + //public static final String SAVE_ALL = Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_SaveAllAction");
30.92 + private static final String CLOSE_PROJECT = "Close";
30.93 + //public static final String CLOSE_PROJECT = Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_CloseProjectAction");
30.94 +
30.95 + private static String delim = "|";
30.96 + private static String fSep = System.getProperty("file.separator");
30.97 +
30.98 + private static String pathLastCreatedProject;
30.99 +
30.100 + private static final String LBL_VWJSF = "Visual Web JavaServer Faces";
30.101 +
30.102 + /** Create new Project with given name
30.103 + * @param projectName - Project's name
30.104 + */
30.105 + public static void createNewProject(String projectName){
30.106 +
30.107 + createNewProjectAbsoluteLocation(null,projectName);
30.108 + }
30.109 +
30.110 + /** Create new Project with name included time stamp
30.111 + * @param projectName - Project's name
30.112 + */
30.113 + public static void createNewProjectTimeStamped(String projectName){
30.114 + createNewProject( projectName+"_"+getCurrentDateAndTimeAsString());
30.115 + }
30.116 +
30.117 + /** Create new Project with given name and relative location
30.118 + * @param location - relative location
30.119 + * @param projectName - Project's name
30.120 + */
30.121 +
30.122 + public static void createNewProjectLocation(String location, String projectName){
30.123 +
30.124 + createNewProjectLoc(location,projectName,false);
30.125 + }
30.126 +
30.127 + /** Create new Project with given name and absolute location
30.128 + * @param location - absolute location
30.129 + * @param projectName - Project's name
30.130 + */
30.131 +
30.132 + public static void createNewProjectAbsoluteLocation(String location, String projectName){
30.133 +
30.134 + createNewProjectLoc(location,projectName,true);
30.135 + }
30.136 +
30.137 + public static String createNewPortletProjectLoc(String location, String projectName,
30.138 + boolean absoluteLocation, String projectCategory, String projectType) {
30.139 + NewProjectWizardOperator po=NewProjectWizardOperator.invoke();
30.140 +
30.141 + //need to wait for a list containing project
30.142 + Waiter projectListWaiter = new Waiter(new Waitable() {
30.143 + public Object actionProduced(Object po) {
30.144 + JList projList =
30.145 + (JList)((ContainerOperator)po).
30.146 + findSubComponent(new JListOperator.JListFinder(), 1);
30.147 + JListOperator projListOper = new JListOperator(projList);
30.148 + projListOper.copyEnvironment((ComponentOperator)po);
30.149 + /*return((projListOper.findItemIndex(Bundle.getString(
30.150 + "com.sun.rave.project.nbbridge.Bundle",
30.151 + "Templates/Project/Web/raveform.xml")) == -1) ? null : "");*/
30.152 + //return((projListOper.findItemIndex("Application") == -1) ? null : "");
30.153 + if ((projListOper.findItemIndex("Application") == -1)&&(projListOper.findItemIndex("Travel") == -1))
30.154 + return null;
30.155 + else return "";
30.156 + }
30.157 + public String getDescription() {
30.158 + return("Project list to be displayed");
30.159 + }
30.160 + });
30.161 + wait(1000);
30.162 +
30.163 + /* select the categroy */
30.164 + po.selectCategory(projectCategory);
30.165 + projectListWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 180000);
30.166 + try {
30.167 + projectListWaiter.waitAction(po);
30.168 + } catch(InterruptedException e) {}
30.169 + /* Select project type */
30.170 + //po.selectProject(Bundle.getString("com.sun.rave.project.nbbridge.Bundle", "Templates/Project/Web/raveform.xml"));
30.171 + po.selectProject(projectType);
30.172 + wait(1000);
30.173 + po.next();
30.174 + wait(2000);
30.175 + if (projectName != null) {
30.176 + new JTextFieldOperator(po).setText(projectName);
30.177 + } else {
30.178 + projectName = new JTextFieldOperator(po).getText();
30.179 + }
30.180 + if (location != null) {
30.181 + if (!absoluteLocation){
30.182 + location=new JTextFieldOperator(po, 1).getText() + "/" + location;
30.183 + }
30.184 + new JTextFieldOperator(po,1).setText(location);
30.185 + } else {
30.186 + location = new JTextFieldOperator(po, 1).getText();
30.187 + }
30.188 + pathLastCreatedProject = location;
30.189 +
30.190 + wait(1000);
30.191 + po.next();
30.192 + wait(2000);
30.193 +
30.194 + po.finish();
30.195 +
30.196 + String timeoutName = "DialogWaiter.WaitDialogTimeout";
30.197 + long timeoutValue = JemmyProperties.getCurrentTimeout(timeoutName);
30.198 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, 8000);
30.199 + try {
30.200 + new JButtonOperator(new JDialogOperator("Question"), "Yes").pushNoBlock();
30.201 + } catch(Exception e) {
30.202 + } finally {
30.203 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
30.204 + timeoutValue);
30.205 + }
30.206 +
30.207 + Util.getMainWindow().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 60000);//project creation time
30.208 + //disableBrowser(projectName, true);
30.209 +
30.210 + disableBrowser(projectName, location, true);
30.211 + return projectName;
30.212 + }
30.213 + @Deprecated
30.214 + public static String createNewJSFProject() {
30.215 + return createNewJSFProject(null); // use default name
30.216 + }
30.217 + @Deprecated
30.218 + public static String createNewJSFProject(String projectName) {
30.219 + return createNewProjectLoc(null, projectName, true,
30.220 + "Web"/*Bundle.getStringTrimmed("com.sun.rave.jsf.project.Bundle",
30.221 + "OpenIDE-Module-Display-Category")*/,
30.222 + "Web Application"/*Bundle.getStringTrimmed("com.sun.rave.jsf.project.ui.wizards.Bundle",
30.223 + "Templates/Project/Web/emptyJsf.xml")*/);
30.224 + }
30.225 +
30.226 + /**
30.227 + * Creates project with J2EE 1.4 and default source structure
30.228 + * @param location Project's location, if null then default location used
30.229 + * @param projectName Project's name, if null then default name used
30.230 + * @param absoluteLocation absolute or relative location
30.231 + * @param projectCategory Category of the project (General, Web, etc.)
30.232 + * @param projectType Type of the project of the given category
30.233 + * @return Name of the Created project
30.234 + *
30.235 + */
30.236 + public static String createNewProjectLoc(String location, String projectName,
30.237 + boolean absoluteLocation, String projectCategory, String projectType) {
30.238 + projectName = createNewProject(location, projectName, absoluteLocation, projectCategory, projectType, null, "J2EE 1.4");
30.239 + return projectName;
30.240 + }
30.241 +
30.242 + /**
30.243 + * Creates JAVA EE 5 project with default source level
30.244 + * @param location Project's location, if null then default location used
30.245 + * @param projectName Project's name, if null then default name used
30.246 + * @param absoluteLocation absolute or relative location
30.247 + * @param projectCategory Category of the project (General, Web, etc.)
30.248 + * @param projectType Type of the project of the given category
30.249 + * @return Name of the Created project
30.250 + */
30.251 + public static String createJavaEE5ProjectLoc(String location, String projectName,
30.252 + boolean absoluteLocation, String projectCategory, String projectType) {
30.253 + projectName = createNewProject(location, projectName, absoluteLocation, projectCategory, projectType, null, "Java EE 5");
30.254 + return projectName;
30.255 + }
30.256 +
30.257 + /**
30.258 + * Creating project
30.259 + * @param location Project's location, if null then default location used
30.260 + * @param projectName Project's name, if null then default name used
30.261 + * @param absoluteLocation absolute or relative location
30.262 + * @param projectCategory Category of the project (General, Web, etc.)
30.263 + * @param projectType Type of the project of the given category, i.e. Web Application
30.264 + * @param sourceStructure source structure (Java BluePrints, Jakarta), if null
30.265 + * then currently selected used
30.266 + * @param J2EELevel (Java EE 5, J2EE 1.4, J2EE 1.3), if null then currently selected used
30.267 + * @return Name of the Created project
30.268 + */
30.269 + public static String createNewProject(
30.270 + String location,
30.271 + String projectName,
30.272 + boolean absoluteLocation,
30.273 + String projectCategory,
30.274 + String projectType,
30.275 + String sourceStructure,
30.276 + String J2EELevel) {
30.277 + projectName = createNewProject(location, projectName, absoluteLocation,
30.278 + projectCategory, projectType, sourceStructure, J2EELevel, null);
30.279 + return projectName;
30.280 + }
30.281 +
30.282 + /**
30.283 + * Creating project
30.284 + * @param location Project's location, if null then default location used
30.285 + * @param projectName Project's name, if null then default name used
30.286 + * @param absoluteLocation absolute or relative location
30.287 + * @param projectCategory Category of the project (General, Web, etc.)
30.288 + * @param projectType Type of the project of the given category, i.e. Web Application
30.289 + * @param sourceStructure source structure (Java BluePrints, Jakarta), if null
30.290 + * then currently selected used
30.291 + * @param J2EELevel (Java EE 5, J2EE 1.4, J2EE 1.3), if null then currently selected used
30.292 + * @param server deployment target, if null then default application server used
30.293 + * @return Name of the Created project
30.294 + */
30.295 + public static String createNewProject(
30.296 + String location,
30.297 + String projectName,
30.298 + boolean absoluteLocation,
30.299 + String projectCategory,
30.300 + String projectType,
30.301 + String sourceStructure,
30.302 + String J2EELevel,
30.303 + String server) {
30.304 + new Operator.DefaultStringComparator(true, true);
30.305 + NewProjectWizardOperator po=NewProjectWizardOperator.invoke();
30.306 +
30.307 + //need to wait for a list containing project
30.308 + Waiter projectListWaiter = new Waiter(new Waitable() {
30.309 + public Object actionProduced(Object po) {
30.310 + JList projList =
30.311 + (JList)((ContainerOperator)po).
30.312 + findSubComponent(new JListOperator.JListFinder(), 1);
30.313 + JListOperator projListOper = new JListOperator(projList);
30.314 + projListOper.copyEnvironment((ComponentOperator)po);
30.315 + /*return((projListOper.findItemIndex(Bundle.getString(
30.316 + "com.sun.rave.project.nbbridge.Bundle",
30.317 + "Templates/Project/Web/raveform.xml")) == -1) ? null : "");*/
30.318 + //return((projListOper.findItemIndex("Application") == -1) ? null : "");
30.319 + if ((projListOper.findItemIndex("Application") == -1)&&(projListOper.findItemIndex("Travel") == -1))
30.320 + return null;
30.321 + else return "";
30.322 + }
30.323 + public String getDescription() {
30.324 + return("Project list to be displayed");
30.325 + }
30.326 + });
30.327 + wait(1000);
30.328 +
30.329 + /* select Web categroy */
30.330 + po.selectCategory(projectCategory);
30.331 + projectListWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 180000);
30.332 + try {
30.333 + projectListWaiter.waitAction(po);
30.334 + } catch(InterruptedException e) {}
30.335 + /* Select project type */
30.336 + //po.selectProject(Bundle.getString("com.sun.rave.project.nbbridge.Bundle", "Templates/Project/Web/raveform.xml"));
30.337 + Operator.StringComparator comparator = po.getComparator();
30.338 + Operator.StringComparator stringComparator = new Operator.DefaultStringComparator(true, true);
30.339 + po.setComparator(stringComparator);
30.340 + wait(1000);
30.341 + po.selectProject(projectType);
30.342 + wait(2000);
30.343 + po.setComparator(comparator);
30.344 + wait(1000);
30.345 +
30.346 + po.next();
30.347 + wait(2000);
30.348 + if (projectName != null) {
30.349 + new JTextFieldOperator(po, 0).typeText(projectName);
30.350 + } else {
30.351 + projectName = new JTextFieldOperator(po, 0).getText();
30.352 + }
30.353 + if (location != null) {
30.354 + if (!absoluteLocation){
30.355 + location=new JTextFieldOperator(po, 2).getText() + "/" + location;
30.356 + }
30.357 + new JTextFieldOperator(po, 2).setText(location);
30.358 + } else {
30.359 + location = new JTextFieldOperator(po, 2).getText();
30.360 + }
30.361 + pathLastCreatedProject = location;
30.362 +
30.363 + //Setting source structure (Blue Prints or Jakarta)
30.364 + //if (sourceStructure!=null) {
30.365 + // new JComboBoxOperator(po, 0).selectItem(sourceStructure);
30.366 + //}
30.367 +
30.368 + po.next();
30.369 + wait(2000);
30.370 + //Setting Server
30.371 + if (server != null) {
30.372 + new JComboBoxOperator(po, 0).selectItem(server);
30.373 + }
30.374 +
30.375 + wait(1000);
30.376 + //Setting level of J2EE
30.377 + if (J2EELevel != null) {
30.378 + new JComboBoxOperator(po, 1).selectItem(J2EELevel);
30.379 + }
30.380 + wait(1000);
30.381 + if (new JButtonOperator(po, "Next").isEnabled()) {
30.382 + po.next();
30.383 + wait(1000);
30.384 + //Setting "Visual Web JavaServer Faces" framework
30.385 + JTableOperator tlbFrameworks = new JTableOperator(po);
30.386 + Point VWcell = tlbFrameworks.findCell(LBL_VWJSF, 1);
30.387 + tlbFrameworks.selectCell(VWcell.y, VWcell.x);
30.388 + wait(2000);
30.389 + }
30.390 + po.finish();
30.391 + String timeoutName = "DialogWaiter.WaitDialogTimeout";
30.392 + long timeoutValue = JemmyProperties.getCurrentTimeout(timeoutName);
30.393 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, 10000);
30.394 + Waiter waitProjectPropertiesDialog = new Waiter(new Waitable() {
30.395 + public Object actionProduced(Object obj) {
30.396 + try {
30.397 + new JButtonOperator(new JDialogOperator("Edit Project Properties"), "Regenerate").push();
30.398 + return null;
30.399 + }catch(TimeoutExpiredException e) {
30.400 + return true;
30.401 + }
30.402 +
30.403 + }
30.404 +
30.405 + public String getDescription() {
30.406 + return "Wait all dialogs";
30.407 + }
30.408 + });
30.409 + waitProjectPropertiesDialog.getTimeouts().setTimeout("Waiter.WaitingTime", 60000);
30.410 + try {
30.411 + waitProjectPropertiesDialog.waitAction(null);
30.412 + } catch(Exception e) {
30.413 + e.printStackTrace();
30.414 + } finally {
30.415 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
30.416 + timeoutValue);
30.417 + }
30.418 + /*
30.419 + try {
30.420 + for (int i = 0 ;i<5; i++) {
30.421 + new JButtonOperator(new JDialogOperator("Edit Project Properties"), "Cancel").pushNoBlock();
30.422 + }
30.423 + } catch(Exception e) {
30.424 + } finally {
30.425 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
30.426 + timeoutValue);
30.427 + }
30.428 + */
30.429 + //wait(20000);
30.430 + //Util.getMainWindow().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 60000);//project creation time
30.431 +
30.432 +
30.433 + //new TopComponentOperator("Page1");
30.434 + disableBrowser(projectName, location, true);
30.435 +
30.436 + Waiter projectCreationWaiter = new Waiter(new Waitable() {
30.437 + public Object actionProduced(Object po) {
30.438 + try {
30.439 + int i = 0;
30.440 + PageTopComponentOperator page;
30.441 + while (((String) (page = new PageTopComponentOperator("Page1", i++)).getDump().get("Tooltip text")).indexOf("web" + File.separator + "Page1.jsp") == -1);
30.442 + new DesignerPaneOperator(page);
30.443 + return "";
30.444 + }catch(TimeoutExpiredException e) {
30.445 + return null;
30.446 + }
30.447 + }
30.448 + public String getDescription() {
30.449 + return("Project list to be displayed");
30.450 + }
30.451 + });
30.452 + wait(1000);
30.453 + projectCreationWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 600000);
30.454 + System.out.println("TRACE: Start waiting: "+ getCurrentDateAndTimeAsString());
30.455 + try {
30.456 + projectCreationWaiter.waitAction(null);
30.457 + }catch (Exception e) {
30.458 + // e.printStackTrace();
30.459 + throw new JemmyException("Exception when waiting Page1 opened", e);
30.460 + }
30.461 + System.out.println("TRACE: Stop waiting: "+ getCurrentDateAndTimeAsString());
30.462 + return projectName;
30.463 + }
30.464 +
30.465 +
30.466 + public static String getPathLastCreatedProject() {
30.467 + return pathLastCreatedProject;
30.468 + }
30.469 +
30.470 + public static void openProject(String projectPath, boolean welcomeOperator){
30.471 + if(welcomeOperator) WelcomeOperator.getWelcomeButton(Bundle.getStringTrimmed("com.sun.rave.welcome.Bundle", "LBL_OpenProject")).pushNoBlock();
30.472 + else Util.getMainMenu().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|"
30.473 + + Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_OpenProjectAction"));
30.474 + // String workDir = System.getProperty("scratch.dir").replace('/',File.separatorChar);
30.475 + // workDir+=File.separatorChar+"Creator"+File.separatorChar+projectPath;
30.476 + Util.wait(3000);
30.477 + // (new JTextFieldOperator(new JDialogOperator("Open"))).typeText(workDir);
30.478 + // (new JButtonOperator(new JDialogOperator("Open"), "Open")).push();
30.479 + (new JTextFieldOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), 1)).typeText(projectPath);
30.480 + (new JButtonOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "BTN_PrjChooser_ApproveButtonText"))).push();
30.481 + // DesignerPaneOperator des = new DesignerPaneOperator(Util.getMainTab());
30.482 + // DesignerPaneOperator des = new DesignerPaneOperator();
30.483 + Util.wait(3000);
30.484 + }
30.485 +
30.486 + public static void openProject(String projectPath){
30.487 + /*
30.488 + Util.getMainMenu().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.core.Bundle",
30.489 + "Menu/File")+"|"
30.490 + +Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle",
30.491 + "LBL_OpenProjectAction"));
30.492 + */
30.493 + Util.getMainMenu().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.core.Bundle",
30.494 + "Menu/File")+"|"
30.495 + +"Open Project");
30.496 +
30.497 + Util.wait(3000);
30.498 + //(new JTextFieldOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), 1)).typeText(projectPath);
30.499 + JDialogOperator openPrjDialog = new JDialogOperator("Open Project");
30.500 +// if (System.getProperty("os.name").equals("Mac OS X")) {
30.501 +// String[] splittedPath = projectPath.substring(1, projectPath.length()).split(File.separator);
30.502 +// TestUtils.wait(1000);
30.503 +// JComboBoxOperator cbRoot = new JComboBoxOperator(openPrjDialog);
30.504 +// for (int i = 0; i < cbRoot.getItemCount(); i++) {
30.505 +// System.out.println("cbRoot.getItemAt(i).toString()=" + cbRoot.getItemAt(i).toString());
30.506 +// TestUtils.wait(500);
30.507 +// if (cbRoot.getItemAt(i).toString().equals(File.separator)) {
30.508 +// cbRoot.setSelectedIndex(i);
30.509 +// break;
30.510 +// }
30.511 +// }
30.512 +// String toCompare = "";
30.513 +// for (int i = 0; i < splittedPath.length; i++) {
30.514 +// JTableOperator jtoPath = new JTableOperator(openPrjDialog);
30.515 +// toCompare += "/" + splittedPath[i];
30.516 +// System.out.println("toComapre="+toCompare);
30.517 +// TestUtils.wait(500);
30.518 +// Point cell = jtoPath.findCell(toCompare, new Operator.DefaultStringComparator(true, true), 0);
30.519 +// jtoPath.clickOnCell((int) cell.getY(), (int) cell.getX());
30.520 +// TestUtils.wait(500);
30.521 +// if (i != splittedPath.length - 1) jtoPath.clickOnCell((int) cell.getY(), (int) cell.getX(), 2);
30.522 +// else new JButtonOperator(openPrjDialog, "Open Project Folder").pushNoBlock();
30.523 +// TestUtils.wait(500);
30.524 +// }
30.525 +// } else {
30.526 + new JTextFieldOperator(openPrjDialog, 1).setText(projectPath);
30.527 + new JButtonOperator(openPrjDialog, "Open Project").push();
30.528 +// }
30.529 + // (new JButtonOperator(new JDialogOperator("Open"), "Open")).push();
30.530 + //(new JButtonOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "BTN_PrjChooser_ApproveButtonText"))).push();
30.531 + //(new JButtonOperator(openPrjDialog, "Open Project Folder")).push();
30.532 + // DesignerPaneOperator des = new DesignerPaneOperator(Util.getMainTab());
30.533 + // DesignerPaneOperator des = new DesignerPaneOperator();
30.534 + Util.wait(3000);
30.535 + }
30.536 +
30.537 + public static void openWebFormJavaFile(String projectName){
30.538 + // Util.getMainMenu().pushMenu(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View")+delim+Bundle.getStringTrimmed("com.sun.rave.project.Bundle", "LBL_Projects"));
30.539 + Util.getMainMenu().pushMenu(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View")+delim+Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Projects"));
30.540 + final JTreeOperator tree = new JTreeOperator(new ProjectNavigatorOperator());
30.541 + // TreePath treePath = tree.findPath(projectName, "|");
30.542 + // tree.expandPath(treePath);
30.543 + String path = projectName + "|Java Sources|"+projectName.toLowerCase()+"|Page1.java";
30.544 + TreePath treePath = tree.findPath(path, "|");
30.545 + (new JPopupMenuOperator(tree.callPopupOnPath(treePath))).pushMenu("Open");
30.546 + }
30.547 +
30.548 + public static void closeCurrentProject(){
30.549 + try{
30.550 + Util.getMainMenu().pushMenu(
30.551 + Bundle.getStringTrimmed("org.netbeans.core.Bundle",
30.552 + "Menu/File")
30.553 + +delim
30.554 + +CLOSE_PROJECT);
30.555 + }catch(TimeoutExpiredException e){
30.556 + System.out.println("Can't close current project. May be project doesn't exist");
30.557 + e.printStackTrace();
30.558 + }
30.559 + }
30.560 +
30.561 + public static void closeCurrentProjectSaveAll(){
30.562 + try{
30.563 + try {
30.564 + /*
30.565 + Util.getMainMenu().pushMenu(
30.566 + Bundle.getStringTrimmed("org.netbeans.core.Bundle",
30.567 + "Menu/File")
30.568 + +delim
30.569 + + CLOSE_PROJECT);
30.570 + */
30.571 + new CloseProjectAction().perform();
30.572 + } catch (TimeoutExpiredException e) {}
30.573 + JDialogOperator saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
30.574 + new JButtonOperator(saveAll,
30.575 + SAVE_ALL).pushNoBlock();
30.576 + }catch(TimeoutExpiredException e){
30.577 + System.out.println("Can't close current project. May be project doesn't exist");
30.578 + e.printStackTrace();
30.579 + }
30.580 + }
30.581 +
30.582 + /**
30.583 + * Closes project <code>prjName</code> if it is currently selected
30.584 + * @param prjName Project Name
30.585 + * @deprecated Use closeCurrentProject or closeProjectByName instead
30.586 + */
30.587 + public static void closeProject(String prjName) {
30.588 + try{
30.589 + try {
30.590 + Util.getMainMenu().pushMenu(
30.591 + Bundle.getStringTrimmed("org.netbeans.core.Bundle",
30.592 + "Menu/File")
30.593 + +delim
30.594 + +CLOSE_PROJECT
30.595 + +" \""+prjName+"\"");
30.596 + } catch (TimeoutExpiredException e) {}
30.597 + JDialogOperator saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
30.598 + new JButtonOperator(saveAll, SAVE_ALL).pushNoBlock();
30.599 + }catch(org.netbeans.jemmy.TimeoutExpiredException e){
30.600 + System.out.println("Can't close current project. May be project doesn't exist");
30.601 + e.printStackTrace();
30.602 + }
30.603 + }
30.604 +
30.605 + /**
30.606 + * Closes project <code>prjName</code>. Saves all if Save Dialog is shown
30.607 + * @param prjName Project Name
30.608 + */
30.609 + public static void closeProjectByName(String prjName) {
30.610 +
30.611 + try {
30.612 + ProjectNavigatorOperator pno = new ProjectNavigatorOperator().switchToProjects();
30.613 + pno.pressPopupItemOnNode(prjName, "Close");
30.614 + } catch (TimeoutExpiredException e) {
30.615 + throw new RuntimeException("Failed to close project", e);
30.616 + }
30.617 +
30.618 + JDialogOperator saveAll = null;
30.619 +
30.620 + try {
30.621 + saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
30.622 + new JButtonOperator(saveAll, SAVE_ALL).pushNoBlock();
30.623 + } catch (org.netbeans.jemmy.TimeoutExpiredException e) {
30.624 + if (saveAll == null) System.out.println("No Save Dialog is shown");
30.625 + else {
30.626 + System.out.println("Failed to save all");
30.627 + e.printStackTrace();
30.628 + }
30.629 + }
30.630 + }
30.631 +
30.632 + /**
30.633 + * Checks whether project <code>prjName</code> is opened
30.634 + * @param prjName Project Name to check
30.635 + * @return Returns true if project name is shown in Projects tree
30.636 + */
30.637 + public static boolean isProjectOpened(String prjName) {
30.638 + ProjectNavigatorOperator pno = null;
30.639 + try {
30.640 + pno = new ProjectNavigatorOperator().switchToProjects();
30.641 + JTreeOperator jto = pno.tree();
30.642 + Timeouts timeouts = jto.getTimeouts().cloneThis();
30.643 + jto.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 3000);
30.644 + try {
30.645 + jto.findPath(prjName);
30.646 + } finally {
30.647 + jto.setTimeouts(timeouts);
30.648 + }
30.649 + } catch (TimeoutExpiredException e) {
30.650 + if (pno == null) {
30.651 + // e.printStackTrace();
30.652 + throw new RuntimeException("Failed to open Project Navigator", e);
30.653 + } else {
30.654 + return false;
30.655 + }
30.656 + }
30.657 + return true;
30.658 + }
30.659 +
30.660 + public static void closeProjectSaveAll(String prjName){
30.661 + try{
30.662 + try {
30.663 + /*
30.664 + Util.getMainMenu().pushMenu(
30.665 + Bundle.getStringTrimmed("org.netbeans.core.Bundle",
30.666 + "Menu/File") + delim
30.667 + + CLOSE_PROJECT
30.668 + + " \"" + prjName + "\"");
30.669 + */
30.670 + new CloseProjectAction().perform();
30.671 + } catch (TimeoutExpiredException e) {}
30.672 + JDialogOperator saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
30.673 + new JButtonOperator(saveAll, SAVE_ALL).push();
30.674 + }catch(org.netbeans.jemmy.TimeoutExpiredException e){
30.675 + System.out.println("Can't close current project. May be project doesn't exist");
30.676 + e.printStackTrace();
30.677 + }
30.678 + }
30.679 +
30.680 + public static void closeProjectAfterSaveAll(String prjName) {
30.681 + try{
30.682 + Util.getMainMenu().pushMenu(
30.683 + Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + delim
30.684 + + SAVE_ALL);
30.685 + Util.getMainMenu().pushMenu(
30.686 + Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + delim
30.687 + + CLOSE_PROJECT
30.688 + + " \"" + prjName + "\"");
30.689 + } catch(Exception e) {
30.690 + e.printStackTrace();
30.691 + }
30.692 + }
30.693 +
30.694 + public static void pushPopupMenuItemOnMainDesignerTab(
30.695 + DesignerPaneOperator designerOperator, String menuItem) {
30.696 + clickMainDesignerTabForPopup(designerOperator);
30.697 + JPopupMenuOperator popupMenu = new JPopupMenuOperator();
30.698 + Util.wait(1000);
30.699 + popupMenu.setComparator(new ComponentOperator.DefaultStringComparator(
30.700 + false, false));
30.701 + popupMenu.pushMenu(menuItem);
30.702 + Util.wait(2000);
30.703 + }
30.704 +
30.705 + public static void createNewProjectLoc(String location, String projectName, boolean absoluteLocation){
30.706 +
30.707 + createNewProjectLoc(location, projectName, absoluteLocation, "Web", "Visual Web Application");
30.708 + }
30.709 +
30.710 + private static void clickMainDesignerTabForPopup(
30.711 + DesignerPaneOperator designerOperator) {
30.712 + TabbedAdapter tabbedAdapter = getTabbedAdapter(designerOperator);
30.713 +
30.714 + int selectedIndex = tabbedAdapter.getSelectionModel().getSelectedIndex();
30.715 + Rectangle tabRect = tabbedAdapter.getTabBounds(selectedIndex);
30.716 + int clickX = tabRect.x + (tabRect.width / 2),
30.717 + clickY = tabRect.y + (tabRect.height / 2);
30.718 +
30.719 + ComponentOperator componentOperator = new ComponentOperator((Component)tabbedAdapter);
30.720 + MouseDriver mouseDriver = new MouseRobotDriver(new Timeout("", 300));
30.721 + mouseDriver.clickMouse(componentOperator, clickX, clickY, 1,
30.722 + InputEvent.BUTTON3_MASK, 0, new Timeout("", 10));
30.723 + Util.wait(1000);
30.724 + }
30.725 +
30.726 + public static String getCurrentProjectName() {
30.727 + // JSF-project is used by default
30.728 + return getCurrentProjectName(KEY_STRING_AFTER_PRJ_NAME_JSF);
30.729 + }
30.730 +
30.731 + public static String getCurrentProjectName(String keyStringAfterPrjName) {
30.732 + DesignerPaneOperator designerOperator = new DesignerPaneOperator();
30.733 + TopComponent topComponent = getSelectedTopComponent(designerOperator);
30.734 + String toolTip = topComponent.getToolTipText();
30.735 +
30.736 + System.out.println();
30.737 + System.out.println("+++ TopComconent's tooltip = [" + toolTip + "]");
30.738 +
30.739 + String prjName = toolTip.replace(File.separatorChar, '/');
30.740 + int substrIndex = prjName.lastIndexOf("/" + keyStringAfterPrjName);
30.741 + prjName = prjName.substring(0, substrIndex);
30.742 +
30.743 + substrIndex = prjName.lastIndexOf("/");
30.744 + prjName = prjName.substring(substrIndex + 1);
30.745 +
30.746 + System.out.println("+++ Current project name = " + prjName);
30.747 + System.out.println();
30.748 +
30.749 + return prjName;
30.750 + }
30.751 +
30.752 + public static boolean isMainTabOfDesignerSelected(
30.753 + DesignerPaneOperator designerOperator, String tabTitle) {
30.754 + TopComponent topComponent = getSelectedTopComponent(designerOperator);
30.755 + String name = getTopComponentName(topComponent).trim();
30.756 +
30.757 + System.out.println("+++ Tab Title = [" + tabTitle + "]");
30.758 + System.out.println("+++ TopComconent name = [" + name + "]");
30.759 + System.out.println();
30.760 +
30.761 + return (name.equals(tabTitle.trim()));
30.762 + }
30.763 +
30.764 + private static TabbedAdapter getTabbedAdapter(ContainerOperator containerOperator) {
30.765 + if (containerOperator == null) return null;
30.766 + Container container = containerOperator.getParent();
30.767 + while (container != null) {
30.768 + if (container instanceof TabbedAdapter) {
30.769 + System.out.println();
30.770 + System.out.println("+++ Tabbed Adapter found = " + container);
30.771 + System.out.println();
30.772 + return ((TabbedAdapter) container);
30.773 + }
30.774 + container = container.getParent();
30.775 + }
30.776 + return null;
30.777 + }
30.778 +
30.779 + public static TopComponent[] getTabTopComponents(ContainerOperator containerOperator) {
30.780 + TabbedAdapter tabbedAdapter = getTabbedAdapter(containerOperator);
30.781 + if (tabbedAdapter == null) {
30.782 + return null;
30.783 + }
30.784 + TopComponent[] topComponents = tabbedAdapter.getTopComponents();
30.785 + return topComponents;
30.786 + }
30.787 +
30.788 + public static TopComponent getTabSelectedTopComponent(ContainerOperator containerOperator) {
30.789 + TabbedAdapter tabbedAdapter = getTabbedAdapter(containerOperator);
30.790 + if (tabbedAdapter == null) {
30.791 + return null;
30.792 + }
30.793 + int selectedIndex = tabbedAdapter.getSelectionModel().getSelectedIndex();
30.794 + TopComponent topComponent = tabbedAdapter.getSelectedTopComponent();
30.795 + return topComponent;
30.796 + }
30.797 +
30.798 + private static TopComponent getSelectedTopComponent(DesignerPaneOperator designerOperator) {
30.799 + TopComponent topComponent = getTabSelectedTopComponent(designerOperator);
30.800 +
30.801 + System.out.println();
30.802 + System.out.println("+++ TopComconent found = " + topComponent);
30.803 + System.out.println();
30.804 + return topComponent;
30.805 + }
30.806 +
30.807 + public static String getTopComponentName(TopComponent topComponent) {
30.808 + String name = topComponent.getDisplayName();
30.809 + if ((name == null) || (name.length() < 1)) {
30.810 + name = topComponent.getName();
30.811 + }
30.812 + return name;
30.813 + }
30.814 +
30.815 + public static boolean checkProjectBuilded(){
30.816 + BuildOutputOperator console = new BuildOutputOperator();
30.817 + if((console.getTextOutput()).indexOf("BUILD SUCCESSFUL")!=-1) return true;
30.818 + return false;
30.819 + }
30.820 +
30.821 + public static void wait(int millisec){
30.822 + Util.wait(millisec);
30.823 + //System.out.println("sleep to "+millisec/1000+" seconds");
30.824 + //try { Thread.sleep(millisec); } catch(Exception e) {}
30.825 + }
30.826 +
30.827 + public static void waitStatusText(String line) {
30.828 + String[] variants = {line};
30.829 + StatusWaitable csw = new StatusWaitable(variants, false);
30.830 + String result = waitStatus(csw);
30.831 + if(result!=null){
30.832 + System.out.println("Error while waiting status text: "+result);
30.833 + }
30.834 + }
30.835 +
30.836 + public static String waitStatus(StatusWaitable csw){
30.837 + Waiter w = new Waiter(csw);
30.838 + try {
30.839 + w.waitAction(csw);
30.840 + } catch (InterruptedException e) {
30.841 + e.printStackTrace();
30.842 + return("Exception while waiting status text:" + e);
30.843 + } catch (TimeoutExpiredException e1) {
30.844 + e1.printStackTrace();
30.845 + return("Exception while waiting status text:" + e1);
30.846 + }
30.847 + return null;
30.848 + }
30.849 +
30.850 + public static void waitDeployed(OutputOperator output, int maxTimeout) throws InterruptedException {
30.851 + Waiter deploymentWaiter = new Waiter(new Waitable() {
30.852 + public Object actionProduced(Object output) {
30.853 + String text = ((OutputOperator)output).getText();
30.854 + if (text.indexOf("BUILD FAILED")!=-1)
30.855 + throw new RuntimeException(new InterruptedException("BUILD FAILED String found in Output Window"));
30.856 + if (text.indexOf("BUILD SUCCESSFUL")!=-1)
30.857 + return "true";
30.858 + return null;
30.859 +
30.860 + }
30.861 + public String getDescription() {
30.862 + return("Waiting Project Deployed");
30.863 + }
30.864 + });
30.865 + //Waiter deploymentWaiter = new Waiter(new WaitDeploymentCompleted());
30.866 + deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", maxTimeout);
30.867 + deploymentWaiter.waitAction(output);
30.868 + output.close();
30.869 + }
30.870 +
30.871 + /** getting coords of selected component from "style" property
30.872 + *
30.873 + *
30.874 + */
30.875 +
30.876 + public static Point getComponentCoords() {
30.877 + PropertySheetOperator pso = new PropertySheetOperator(Util.getMainWindow());
30.878 + PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
30.879 + psto.setComparator(new Operator.DefaultStringComparator(true, true));
30.880 + Property pr = new Property(psto, "style");
30.881 + String propValue = pr.getValue();
30.882 +
30.883 +
30.884 + int xLoc = new Integer(propValue.substring(propValue.indexOf("left: ") + 6, propValue.indexOf("px", propValue.indexOf("left: ")))).intValue();
30.885 + int yLoc = new Integer(propValue.substring(propValue.indexOf("top: ") + 5, propValue.indexOf("px", propValue.indexOf("top: ")))).intValue();
30.886 +
30.887 + return new Point(xLoc, yLoc);
30.888 + }
30.889 +
30.890 + /** getting current Date and Time as one string ( YYYYMMDDHHMMSS )
30.891 + *
30.892 + *
30.893 + */
30.894 + public static String getCurrentDateAndTimeAsString(){
30.895 + return (new SimpleDateFormat("yyyyMMddHHmmss")).format(new Date());
30.896 + }
30.897 +
30.898 + /** export WAR file
30.899 + *
30.900 + *
30.901 + */
30.902 + public static void exportWAR(String projectName, String pathToWAR, boolean platform){
30.903 + // ProjectNavigatorOperator.pressPopupItemOnNode("ROOT", "Export WAR File");
30.904 + ProjectNavigatorOperator.pressPopupItemOnNode(projectName, "Export WAR File");
30.905 + wait(2000);
30.906 + JDialogOperator newWF = new JDialogOperator("Export WAR");
30.907 + new JTextFieldOperator(newWF, 0).setText(pathToWAR+fSep+projectName+".war");
30.908 + wait(1000);
30.909 + new JRadioButtonOperator(newWF, platform?0:1).setSelected(true);
30.910 + wait(1000);
30.911 + new JButtonOperator(newWF, "OK").pushNoBlock();
30.912 + newWF.waitClosed();
30.913 + wait(2000);
30.914 + long oldWaitTime = Util.getMainWindow().getTimeouts().getTimeout("DialogWaiter.WaitDialogTimeout");
30.915 + try {
30.916 + Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", 5000);
30.917 + JDialogOperator owdo = new JDialogOperator("Question");
30.918 + new JButtonOperator(owdo, "Yes").pushNoBlock();
30.919 + Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", oldWaitTime);
30.920 + } catch(Exception e) {
30.921 + Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", oldWaitTime);
30.922 + }
30.923 + System.out.println("WAR File exported in "+pathToWAR+fSep+projectName+".war");
30.924 + while (new JLabelOperator(Util.getMainWindow(), 0).getText().indexOf("Finished") == -1 &&
30.925 + new JLabelOperator(Util.getMainWindow(), 0).getText().indexOf("(export.war)") == -1) {}
30.926 + wait(2000);
30.927 + }
30.928 +
30.929 + public static void exportWAR(String projectName, String pathToWAR){
30.930 + exportWAR(projectName, pathToWAR, true);
30.931 + }
30.932 +
30.933 + /**
30.934 + * Prints list of all child components of container
30.935 + * @param op - container
30.936 + */
30.937 + public static void printComponentList(ComponentOperator op) {
30.938 + Component cmp=op.getSource();
30.939 + if (cmp instanceof Container){
30.940 + printComponentList((Container)cmp);
30.941 + }else {
30.942 + System.out.println("Not a container");
30.943 + }
30.944 + }
30.945 +
30.946 + public static void printComponentList(Container container) {
30.947 + printComponentList(container, 0);
30.948 + }
30.949 +
30.950 + private static void printComponentList(Container container, int tabCount) {
30.951 + printComponentList(System.out, container, tabCount);
30.952 + }
30.953 +
30.954 + public static void printComponentList(String fileName, Container container) {
30.955 + PrintStream printOut = null;
30.956 + try {
30.957 + printOut = new PrintStream(new FileOutputStream(fileName, true));
30.958 + printComponentList(printOut, container, 0);
30.959 + } catch(Exception e) {
30.960 + e.printStackTrace();
30.961 + } finally {
30.962 + try {
30.963 + printOut.flush();
30.964 + printOut.close();
30.965 + } catch(Exception e) {e.printStackTrace();}
30.966 + }
30.967 + }
30.968 +
30.969 + private static void printComponentList(PrintStream out, Container container,
30.970 + int tabCount) {
30.971 + Component[] components = container.getComponents();
30.972 + for (int i = 0; i < components.length; i++) {
30.973 + Component component = components[i];
30.974 +
30.975 + out.println();
30.976 + out.println();
30.977 + for (int j = 0; j < tabCount; j++) {
30.978 + out.print("\t");
30.979 + }
30.980 + out.print("+++ COMPONENT = " + component);
30.981 + out.println();
30.982 + // print next level
30.983 + if (component instanceof Container) {
30.984 + printComponentList(out, (Container) component, tabCount + 1);
30.985 + }
30.986 + }
30.987 + }
30.988 +
30.989 + private static final String
30.990 + CREATOR_SYSTEM_DIR = "visualweb1" + File.separator + "config",
30.991 + CREATOR_INSTALL_PROPERTIES_FILE_NAME = "com-sun-rave-install.properties";
30.992 + // CREATOR_SYSTEM_DIR = "system",
30.993 + // CREATOR_INSTALL_PROPERTIES_FILE_NAME = "install.properties";
30.994 +
30.995 + private static final String
30.996 + HTTP_PROTOCOL = "http",
30.997 + WEB_PORT_PROPERTY_NAME = "webPort",
30.998 + ADMIN_PORT_PROPERTY_NAME = "adminPort",
30.999 + LOCALHOST="localhost";
30.1000 +
30.1001 + public static URL getJ2EEApplicationURL(String projectName) {
30.1002 + String webPort = getWebPortFromProperties(),
30.1003 + unsensitiveProjectName = projectName.toLowerCase();
30.1004 + try {
30.1005 + return (new URL(HTTP_PROTOCOL, LOCALHOST,
30.1006 + Integer.parseInt(webPort), File.separator + unsensitiveProjectName));
30.1007 + } catch (Exception e) {
30.1008 + e.printStackTrace();
30.1009 + return null;
30.1010 + }
30.1011 + }
30.1012 +
30.1013 + public static String getWebPortFromProperties() {
30.1014 + Properties installProperties = getCreatorInstallProperties();
30.1015 + return ((installProperties == null) ? null :
30.1016 + installProperties.getProperty(WEB_PORT_PROPERTY_NAME));
30.1017 + }
30.1018 +
30.1019 + public static String getAdminPortFromProperties() {
30.1020 + Properties installProperties = getCreatorInstallProperties();
30.1021 + return ((installProperties == null) ? null :
30.1022 + installProperties.getProperty(ADMIN_PORT_PROPERTY_NAME));
30.1023 + }
30.1024 +
30.1025 + public static Properties getCreatorInstallProperties() {
30.1026 + // ak153254: Fixed the name of installation properties file due to the fact
30.1027 + // that netbeans.dest.dir property doesn't exist any more
30.1028 + String installPropertiesFileName = System.getProperty("netbeans.home") +
30.1029 + File.separator + ".." + File.separator + CREATOR_SYSTEM_DIR +
30.1030 + File.separator + CREATOR_INSTALL_PROPERTIES_FILE_NAME;
30.1031 + try {
30.1032 + Properties installProperties = new Properties();
30.1033 + installProperties.load(new FileInputStream(installPropertiesFileName));
30.1034 + return installProperties;
30.1035 + } catch (Exception e) {
30.1036 + e.printStackTrace();
30.1037 + return null;
30.1038 + }
30.1039 + }
30.1040 +
30.1041 + public static void outMsg(String msg) {
30.1042 + outMsg(msg, true, true);
30.1043 + }
30.1044 +
30.1045 + public static void outMsg(String msg, boolean spaceBefore, boolean spaceAfter) {
30.1046 + outMsg(System.out, msg, spaceBefore, spaceAfter);
30.1047 + }
30.1048 +
30.1049 + public static void outMsg(String fileName, String msg) {
30.1050 + outMsg(fileName, msg, true, true);
30.1051 + }
30.1052 +
30.1053 + public static void outMsg(String fileName, String msg, boolean spaceBefore,
30.1054 + boolean spaceAfter) {
30.1055 + PrintStream printOut = null;
30.1056 + try {
30.1057 + printOut = new PrintStream(new FileOutputStream(fileName, true));
30.1058 + outMsg(printOut, msg, spaceBefore, spaceAfter);
30.1059 + } catch(Exception e) {
30.1060 + e.printStackTrace();
30.1061 + } finally {
30.1062 + try {
30.1063 + printOut.flush();
30.1064 + printOut.close();
30.1065 + } catch(Exception e) {e.printStackTrace();}
30.1066 + }
30.1067 + }
30.1068 +
30.1069 + private static void outMsg(PrintStream out, String msg, boolean spaceBefore,
30.1070 + boolean spaceAfter) {
30.1071 + if (spaceBefore) {
30.1072 + out.println();
30.1073 + }
30.1074 + out.println(msg);
30.1075 + if (spaceAfter) {
30.1076 + out.println();
30.1077 + }
30.1078 + }
30.1079 +
30.1080 + public static boolean isServerStarted() {
30.1081 + String adminPort = "24848";//getAdminPortFromProperties();
30.1082 + System.out.println("adminPort = " + adminPort);
30.1083 + return isServerStarted(LOCALHOST, adminPort);
30.1084 + }
30.1085 +
30.1086 + public static boolean isServerStarted(String host, String port) {
30.1087 + return isServerStarted(host, port, null, null);
30.1088 + }
30.1089 +
30.1090 + public static boolean isServerStarted(String host, String port,
30.1091 + String userName, String userPassword) {
30.1092 + try {
30.1093 + WebConversation conversation = new WebConversation();
30.1094 + HttpUnitOptions.setExceptionsThrownOnErrorStatus(false);
30.1095 + HttpUnitOptions.setExceptionsThrownOnScriptError(false);
30.1096 + if ((userName != null) && (userPassword != null)) {
30.1097 + conversation.setAuthorization(userName, userPassword);
30.1098 + }
30.1099 + String url = HTTP_PROTOCOL + "://" + host + ":" + port;
30.1100 + try {
30.1101 + WebResponse response = conversation.getResponse(url);
30.1102 + } catch(java.io.EOFException e) {
30.1103 + // workaround: handle an exception from Web Server 6.1
30.1104 + outMsg("+++ Method [isServerStarted(...)]: an exception [" + e +
30.1105 + "] after attempt to receive a response " +
30.1106 + "from server [" + url + "]");
30.1107 + e.printStackTrace();
30.1108 + }
30.1109 + } catch (Throwable t) {
30.1110 + t.printStackTrace();
30.1111 + System.out.println("Exception in HTTP check : " + t);
30.1112 + return false;
30.1113 + }
30.1114 + return true;
30.1115 + }
30.1116 +
30.1117 + public static String getRequestPrefix(long timeout) {
30.1118 + Waiter waiter = new Waiter(new Waitable() {
30.1119 + public Object actionProduced(Object p) {
30.1120 + String _requestPrefix = "";
30.1121 + _requestPrefix = System.getProperty("test.netbeans.j2eeserver.clienturl");
30.1122 + if(_requestPrefix != null &&
30.1123 + _requestPrefix.length() > 0) {
30.1124 + return(_requestPrefix);
30.1125 + } else {
30.1126 + return(null);
30.1127 + }
30.1128 + }
30.1129 + public String getDescription() {
30.1130 + return("URL to be set");
30.1131 + }
30.1132 + });
30.1133 + waiter.getTimeouts().setTimeout("Waiter.WaitingTime", timeout);
30.1134 + try {
30.1135 + return((String)waiter.waitAction(null));
30.1136 + } catch(java.lang.InterruptedException e) {
30.1137 + return("");
30.1138 + }
30.1139 + }
30.1140 +
30.1141 + public static void disableBrowser(String prjName, boolean dis) {
30.1142 + ProjectNavigatorOperator.pressPopupItemOnNode(prjName, "Properties");
30.1143 + JDialogOperator propertiesDialog = new JDialogOperator("Project Properties - "+prjName);
30.1144 + wait(1000);
30.1145 + JTreeOperator tree = new JTreeOperator(propertiesDialog);
30.1146 + tree.selectPath(tree.findPath("Run"));
30.1147 + wait(2000);
30.1148 + JCheckBoxOperator checkBox = new JCheckBoxOperator(propertiesDialog);
30.1149 + checkBox.setSelected(!dis);
30.1150 + wait(1000);
30.1151 + new JButtonOperator(propertiesDialog, "OK").pushNoBlock();
30.1152 + wait(1000);
30.1153 + }
30.1154 +
30.1155 + public static void disableBrowser(String prjName, String prjLoc, boolean dis) {
30.1156 + final String propFileStr = prjLoc+File.separator + prjName + File.separator+"nbproject"
30.1157 + +File.separator+"project.properties";
30.1158 + FileInputStream propIn = null;
30.1159 +
30.1160 + //need to wait property file to be created
30.1161 + Waiter propertyFileWaiter = new Waiter(new Waitable() {
30.1162 + public Object actionProduced(Object path) {
30.1163 + File file = new File((String)path);
30.1164 + if (file.exists()) {
30.1165 + return file;
30.1166 + } else return null;
30.1167 + }
30.1168 + public String getDescription() {
30.1169 + return("\"" + propFileStr + "\" property file to be created");
30.1170 + }
30.1171 + });
30.1172 +
30.1173 + propertyFileWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 20000);
30.1174 + File propFile = null;
30.1175 + try {
30.1176 + propFile = (File)propertyFileWaiter.waitAction(propFileStr);
30.1177 + } catch(InterruptedException e) {}
30.1178 +
30.1179 +
30.1180 + wait(1000);
30.1181 + try {
30.1182 + Properties prop = new Properties();
30.1183 + wait(1000);
30.1184 + propIn = new FileInputStream(propFile);
30.1185 + wait(1000);
30.1186 + prop.load(propIn);
30.1187 + //wait(2000);
30.1188 + Boolean newVal = new Boolean(!dis);
30.1189 + prop.setProperty("display.browser", newVal.toString());
30.1190 + //System.out.println("TRACE Property set : display.browser = "+prop.getProperty("display.browser"));
30.1191 + //wait(2000);
30.1192 + prop.store(new FileOutputStream(propFileStr), null);
30.1193 + //wait(5000);
30.1194 + }catch (Exception e) {
30.1195 + e.printStackTrace();
30.1196 + System.out.println("Exception occured "+ e);
30.1197 + }
30.1198 + }
30.1199 +
30.1200 + public static JMenuItem findPopupMenuItemByLabel(JPopupMenuOperator menuOperator,
30.1201 + String menuItemLabel) {
30.1202 + return findPopupMenuItemByLabel(menuOperator, menuItemLabel, true, false);
30.1203 + }
30.1204 +
30.1205 + public static JMenuItem findPopupMenuItemByLabel(JPopupMenuOperator menuOperator,
30.1206 + String menuItemLabel, boolean equalsMode, boolean ignoreCaseMode) {
30.1207 + String labelText = (ignoreCaseMode ? menuItemLabel.toUpperCase() : menuItemLabel);
30.1208 +
30.1209 + MenuElement[] menuItems = menuOperator.getSubElements();
30.1210 + for (int i = 0; i < menuItems.length; i++) {
30.1211 + JMenuItem menuItem = (JMenuItem) menuItems[i];
30.1212 + String menuItemText = (ignoreCaseMode ?
30.1213 + menuItem.getText().toUpperCase() : menuItem.getText());
30.1214 + if (equalsMode) {
30.1215 + if (menuItemText.equals(labelText)) {
30.1216 + return menuItem;
30.1217 + }
30.1218 + } else {
30.1219 + if (menuItemText.indexOf(labelText) > -1) {
30.1220 + return menuItem;
30.1221 + }
30.1222 + }
30.1223 + }
30.1224 + return null;
30.1225 + }
30.1226 + /**
30.1227 + * @param destinationUrl - url with zip file
30.1228 + * @param srcFile - file in which downloaded file will be saved
30.1229 + */
30.1230 +
30.1231 + public static void downloadFile(String destinationUrl, String srcFile)
30.1232 + throws MalformedInputException, IOException {
30.1233 +
30.1234 + // try {
30.1235 + // Create an URL instance
30.1236 + URL url = new URL(destinationUrl);
30.1237 +
30.1238 + // Get an input stream for reading
30.1239 + InputStream in = url.openStream();
30.1240 +
30.1241 + // Create a buffered input stream for efficency
30.1242 + BufferedInputStream bufIn = new BufferedInputStream(in);
30.1243 + OutputStream outStr = new FileOutputStream(srcFile);
30.1244 +
30.1245 + // Repeat until end of file
30.1246 + for (;;) {
30.1247 + int data = bufIn.read();
30.1248 +
30.1249 + // Check for EOF
30.1250 + if (data == -1)
30.1251 + break;
30.1252 + else
30.1253 + outStr.write(data);
30.1254 + //System.out.print ( (char) data);
30.1255 + }
30.1256 + outStr.close();
30.1257 + /*
30.1258 + } catch(MalformedURLException mue) {
30.1259 + System.err.println("Invalid URL");
30.1260 + System.out.println("Invalid URL :" + mue);
30.1261 + fail("Invalid URL");
30.1262 + } catch (IOException ioe) {
30.1263 + System.err.println("I/O Error - " + ioe);
30.1264 + fail("I/O Error - " + ioe);
30.1265 + }
30.1266 + */
30.1267 + }
30.1268 +
30.1269 + public static String unzip(String file) throws IOException {
30.1270 + String projectName;
30.1271 + Enumeration entries;
30.1272 + ZipFile zipFile;
30.1273 + //try {
30.1274 + zipFile = new ZipFile(file);
30.1275 + entries = zipFile.entries();
30.1276 + System.out.println("Extracting from: " + zipFile.getName());
30.1277 + //TODO:
30.1278 + String firstEntry = ((ZipEntry)zipFile.entries().nextElement()).getName();
30.1279 + System.out.println("FIRST ENTRY = " + firstEntry);
30.1280 + String startDir = firstEntry;
30.1281 + if (firstEntry.indexOf('/') != -1) {
30.1282 + startDir = firstEntry.substring(0, firstEntry.indexOf('/'));
30.1283 + System.out.println("dir = " + startDir);
30.1284 + (new File(startDir)).mkdir();
30.1285 + }
30.1286 + projectName = startDir;
30.1287 + //_projectPath = (new File(startDir)).getAbsolutePath();
30.1288 + while(entries.hasMoreElements()) {
30.1289 + ZipEntry entry = (ZipEntry)entries.nextElement();
30.1290 +
30.1291 +
30.1292 + if(entry.isDirectory()) {
30.1293 + // Assume directories are stored parents first then children.
30.1294 + System.out.println("Extracting directory: " + entry.getName());
30.1295 + // This is not robust, just for demonstration purposes.
30.1296 + (new File(entry.getName())).mkdir();
30.1297 + //continue;
30.1298 + } else {
30.1299 + System.out.println("Extracting file: " + entry.getName());
30.1300 + copyInputStream(zipFile.getInputStream(entry),
30.1301 + new BufferedOutputStream(new FileOutputStream(entry.getName())));
30.1302 + }
30.1303 +
30.1304 + }
30.1305 + zipFile.close();
30.1306 + return projectName;
30.1307 + /*
30.1308 + } catch (IOException ioe) {
30.1309 + System.err.println("Unhandled exception:");
30.1310 + ioe.printStackTrace();
30.1311 + fail();
30.1312 + }
30.1313 + */
30.1314 + }
30.1315 + protected static final void copyInputStream(InputStream in, OutputStream out)
30.1316 + throws IOException {
30.1317 + byte[] buffer = new byte[1024];
30.1318 + int len;
30.1319 +
30.1320 + while((len = in.read(buffer)) >= 0)
30.1321 + out.write(buffer, 0, len);
30.1322 +
30.1323 + in.close();
30.1324 + out.close();
30.1325 + }
30.1326 +
30.1327 + /**
30.1328 + * Parse logs for exceptions
30.1329 + *
30.1330 + */
30.1331 + public static String parseLogs(String pathToFile, String strToFind) throws IOException {
30.1332 + String lineSep = System.getProperty("line.separator");
30.1333 + BufferedReader br = new BufferedReader(new FileReader(pathToFile));
30.1334 + String nextLine = "";
30.1335 + StringBuffer sb = new StringBuffer();
30.1336 + while ((nextLine = br.readLine()) != null) {
30.1337 + if (nextLine.indexOf(strToFind)!=-1) {
30.1338 + sb.append(nextLine);
30.1339 + sb.append(lineSep);
30.1340 + }
30.1341 + }
30.1342 + return sb.toString();
30.1343 + }
30.1344 +
30.1345 + public static void setHTTPProxy(String proxyHost, String proxyPort) {
30.1346 + OptionsOperator opOper = OptionsOperator.invoke();
30.1347 + opOper.selectOption("General Settings|System Settings");
30.1348 + SheetTableOperator props = new SheetTableOperator(opOper);
30.1349 + props.setComboBoxValue("Type of proxy configuration", "Use HTTP Proxy");
30.1350 + props.setTextValue("Proxy Host", proxyHost);
30.1351 + props.setTextValue("Proxy Port", proxyPort);
30.1352 + opOper.close();
30.1353 + }
30.1354 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/TopComponentByIdChooser.java Thu Jul 10 04:32:50 2008 -0700
31.3 @@ -0,0 +1,71 @@
31.4 +/*
31.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
31.6 + *
31.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
31.8 + *
31.9 + * The contents of this file are subject to the terms of either the GNU
31.10 + * General Public License Version 2 only ("GPL") or the Common
31.11 + * Development and Distribution License("CDDL") (collectively, the
31.12 + * "License"). You may not use this file except in compliance with the
31.13 + * License. You can obtain a copy of the License at
31.14 + * http://www.netbeans.org/cddl-gplv2.html
31.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
31.16 + * specific language governing permissions and limitations under the
31.17 + * License. When distributing the software, include this License Header
31.18 + * Notice in each file and include the License file at
31.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
31.20 + * particular file as subject to the "Classpath" exception as provided
31.21 + * by Sun in the GPL Version 2 section of the License file that
31.22 + * accompanied this code. If applicable, add the following below the
31.23 + * License Header, with the fields enclosed by brackets [] replaced by
31.24 + * your own identifying information:
31.25 + * "Portions Copyrighted [year] [name of copyright owner]"
31.26 + *
31.27 + * Contributor(s):
31.28 + *
31.29 + * The Original Software is NetBeans. The Initial Developer of the Original
31.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31.31 + * Microsystems, Inc. All Rights Reserved.
31.32 + *
31.33 + * If you wish your version of this file to be governed by only the CDDL
31.34 + * or only the GPL Version 2, indicate your decision by adding
31.35 + * "[Contributor] elects to include this software in this distribution
31.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
31.37 + * single choice of license, a recipient has the option to distribute
31.38 + * your version of this file under either the CDDL, the GPL Version 2 or
31.39 + * to extend the choice of license to its licensees as provided above.
31.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
31.41 + * Version 2 license, then the option applies only if the new code is
31.42 + * made subject to such option by the copyright holder.
31.43 + */
31.44 +
31.45 +package org.netbeans.modules.visualweb.gravy;
31.46 +
31.47 +import java.awt.Component;
31.48 +import org.netbeans.jemmy.ComponentChooser;
31.49 +import org.netbeans.jemmy.operators.Operator;
31.50 +import org.openide.windows.TopComponent;
31.51 +import org.openide.windows.WindowManager;
31.52 +
31.53 +/**
31.54 + * Chooser for finding TopComponent by it's ID.
31.55 + */
31.56 +public class TopComponentByIdChooser implements ComponentChooser {
31.57 + private String id;
31.58 +
31.59 + public TopComponentByIdChooser(String theID) {
31.60 + id = theID;
31.61 + }
31.62 + public boolean checkComponent(Component comp) {
31.63 + if (comp instanceof TopComponent) {
31.64 + return(Operator.getDefaultStringComparator().equals(
31.65 + WindowManager.getDefault().findTopComponentID((TopComponent)comp),
31.66 + id));
31.67 + } else {
31.68 + return(false);
31.69 + }
31.70 + }
31.71 + public String getDescription() {
31.72 + return("TopComponent with \"" + id + "\" preffered id");
31.73 + }
31.74 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/TopComponentOperator.java Thu Jul 10 04:32:50 2008 -0700
32.3 @@ -0,0 +1,294 @@
32.4 +/*
32.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
32.6 + *
32.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
32.8 + *
32.9 + * The contents of this file are subject to the terms of either the GNU
32.10 + * General Public License Version 2 only ("GPL") or the Common
32.11 + * Development and Distribution License("CDDL") (collectively, the
32.12 + * "License"). You may not use this file except in compliance with the
32.13 + * License. You can obtain a copy of the License at
32.14 + * http://www.netbeans.org/cddl-gplv2.html
32.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
32.16 + * specific language governing permissions and limitations under the
32.17 + * License. When distributing the software, include this License Header
32.18 + * Notice in each file and include the License file at
32.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
32.20 + * particular file as subject to the "Classpath" exception as provided
32.21 + * by Sun in the GPL Version 2 section of the License file that
32.22 + * accompanied this code. If applicable, add the following below the
32.23 + * License Header, with the fields enclosed by brackets [] replaced by
32.24 + * your own identifying information:
32.25 + * "Portions Copyrighted [year] [name of copyright owner]"
32.26 + *
32.27 + * Contributor(s):
32.28 + *
32.29 + * The Original Software is NetBeans. The Initial Developer of the Original
32.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
32.31 + * Microsystems, Inc. All Rights Reserved.
32.32 + *
32.33 + * If you wish your version of this file to be governed by only the CDDL
32.34 + * or only the GPL Version 2, indicate your decision by adding
32.35 + * "[Contributor] elects to include this software in this distribution
32.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
32.37 + * single choice of license, a recipient has the option to distribute
32.38 + * your version of this file under either the CDDL, the GPL Version 2 or
32.39 + * to extend the choice of license to its licensees as provided above.
32.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
32.41 + * Version 2 license, then the option applies only if the new code is
32.42 + * made subject to such option by the copyright holder.
32.43 + */
32.44 +
32.45 +package org.netbeans.modules.visualweb.gravy;
32.46 +
32.47 +import java.awt.Component;
32.48 +import java.io.IOException;
32.49 +import org.netbeans.jemmy.ComponentChooser;
32.50 +
32.51 +import org.netbeans.jemmy.*;
32.52 +
32.53 +import org.netbeans.jemmy.operators.JComponentOperator;
32.54 +import org.netbeans.jemmy.operators.ContainerOperator;
32.55 +import org.netbeans.jemmy.operators.Operator;
32.56 +
32.57 +import org.openide.windows.*;
32.58 +import org.openide.cookies.SaveCookie;
32.59 +import org.openide.loaders.DataObject;
32.60 +
32.61 +import javax.swing.*;
32.62 +
32.63 +/**
32.64 + * Class for TopComponents.
32.65 + */
32.66 +public class TopComponentOperator extends JComponentOperator {
32.67 +
32.68 + /**
32.69 + * Create TopComponentOperator with specified name in given container.
32.70 + * @param parent Container where TopComponent will be looking for.
32.71 + * @param ID Name of the TopComponent.
32.72 + */
32.73 + public TopComponentOperator(ContainerOperator parent, String ID) {
32.74 + super(parent, new TopComponentChooser(ID));
32.75 + }
32.76 +
32.77 + /**
32.78 + * Create TopComponentOperator with chooser in given container.
32.79 + * @param parent Container where TopComponent will be looking for.
32.80 + * @param chooser Chooser for finding.
32.81 + */
32.82 + public TopComponentOperator(ContainerOperator parent, ComponentChooser chooser) {
32.83 + super(parent, chooser);
32.84 + }
32.85 +
32.86 + /**
32.87 + * Create TopComponentOperator from given JComponent.
32.88 + * @param component JComponent from which TopComponentOperator will be created.
32.89 + */
32.90 + public TopComponentOperator(JComponent component) {
32.91 + super(component);
32.92 + }
32.93 +
32.94 + public static class TopComponentChooser implements ComponentChooser {
32.95 + String ID;
32.96 + public TopComponentChooser(String ID) {
32.97 + this.ID = ID;
32.98 + }
32.99 + public boolean checkComponent(Component comp) {
32.100 + return(comp instanceof TopComponent && comp != null &&
32.101 + ((TopComponent)comp).getName() != null &&
32.102 + ((TopComponent)comp).getName().indexOf(ID) != -1);
32.103 + }
32.104 + public String getDescription() {
32.105 + return("A TopComponent with \"" + ID + "\" ID");
32.106 + }
32.107 + }
32.108 +
32.109 +
32.110 + /**
32.111 + * Find TopComponent with specified name in given container with given subchooser.
32.112 + * @param cont Container where TopComponent will be looking for.
32.113 + * @param name Name of the TopComponent.
32.114 + * @param subchooser Subchooser for finding.
32.115 + * @return JComponent Found component.
32.116 + */
32.117 + protected static JComponent findTopComponent(ContainerOperator cont, String name, int index, ComponentChooser subchooser) {
32.118 + Object tc[]=TopComponent.getRegistry().getOpened().toArray();
32.119 + StringComparator comparator=cont==null?Operator.getDefaultStringComparator():cont.getComparator();
32.120 + TopComponent c;
32.121 + for (int i=0; i<tc.length; i++) {
32.122 + c=(TopComponent)tc[i];
32.123 + if (c.isShowing() && comparator.equals(c.getName(), name) && isUnder(cont, c) && (subchooser==null || subchooser.checkComponent(c))) {
32.124 + index--;
32.125 + if (index<0)
32.126 + return c;
32.127 + }
32.128 + }
32.129 + for (int i=0; i<tc.length; i++) {
32.130 + c=(TopComponent)tc[i];
32.131 + if ((!c.isShowing()) && isParentShowing(c) && comparator.equals(c.getName(), name) && isUnder(cont, c) && (subchooser==null || subchooser.checkComponent(c))) {
32.132 + index--;
32.133 + if (index<0)
32.134 + return c;
32.135 + }
32.136 + }
32.137 + return null;
32.138 + }
32.139 +
32.140 + /**
32.141 + * Check if component's parent is showing.
32.142 + * @param c Component for verification.
32.143 + * @return True if component's parent is showing.
32.144 + */
32.145 + private static boolean isParentShowing(Component c) {
32.146 + while (c!=null) {
32.147 + if (c.isShowing()) return true;
32.148 + c=c.getParent();
32.149 + }
32.150 + return false;
32.151 + }
32.152 +
32.153 + /**
32.154 + * Check if component is under given container.
32.155 + * @param cont Container.
32.156 + * @param c Component for verification.
32.157 + * @return True if component is under given container.
32.158 + */
32.159 + private static boolean isUnder(ContainerOperator cont, Component c) {
32.160 + if (cont==null) return true;
32.161 + Component comp=cont.getSource();
32.162 + while (comp!=c && c!=null) c=c.getParent();
32.163 + return (comp==c);
32.164 + }
32.165 +
32.166 + /** Closes this TopComponent instance by IDE API call and wait until
32.167 + * it is not closed. If this TopComponent is modified (e.g. editor top
32.168 + * component), question dialog is shown and you have to close it. To close
32.169 + * this TopComponent and discard possible changes use {@link #closeDiscard}
32.170 + * method.
32.171 + */
32.172 + public void close() {
32.173 + // run in a new thread because question may block further execution
32.174 + new Thread(new Runnable() {
32.175 + public void run() {
32.176 + // run in dispatch thread
32.177 + runMapping(new MapVoidAction("close") {
32.178 + public void map() {
32.179 + ((TopComponent)getSource()).close();
32.180 + }
32.181 + });
32.182 + }
32.183 + }, "thread to close TopComponent").start();
32.184 + // wait to be away
32.185 + waitComponentShowing(false);
32.186 + }
32.187 +
32.188 + /**
32.189 + * Waits the topcomponent to be closed.
32.190 + */
32.191 + public void waitClosed() {
32.192 + getOutput().printLine("Wait topcomponent to be closed \n : "+
32.193 + getSource().toString());
32.194 + getOutput().printGolden("Wait topcomponent to be closed");
32.195 + waitState(new ComponentChooser() {
32.196 + public boolean checkComponent(Component comp) {
32.197 + return(!comp.isVisible());
32.198 + }
32.199 + public String getDescription() {
32.200 + return("Closed topcomponent");
32.201 + }
32.202 + });
32.203 + }
32.204 +
32.205 + /** Saves content of this TopComponent. If it is not applicable or content
32.206 + * of TopComponent is not modified, it does nothing.
32.207 + */
32.208 + public void save() {
32.209 + // should be just one node
32.210 + org.openide.nodes.Node[] nodes = ((TopComponent)getSource()).getActivatedNodes();
32.211 + // TopComponent like Execution doesn't have any nodes associated
32.212 + if(nodes != null) {
32.213 + for(int i=0;i<nodes.length;i++) {
32.214 + SaveCookie sc = (SaveCookie)nodes[i].getCookie(SaveCookie.class);
32.215 + if(sc != null) {
32.216 + try {
32.217 + sc.save();
32.218 + } catch (IOException e) {
32.219 + throw new JemmyException("Exception while saving this TopComponent.", e);
32.220 + }
32.221 + }
32.222 + }
32.223 + }
32.224 + }
32.225 +
32.226 + /** Closes this TopComponent instance by IDE API call and wait until
32.227 + * it is not closed. If this TopComponent is modified (e.g. editor top
32.228 + * component), it discards possible changes.
32.229 + * @see #close
32.230 + */
32.231 + public void closeDiscard() {
32.232 + setUnmodified();
32.233 + close();
32.234 + }
32.235 +
32.236 + /** Finds DataObject for the content of this TopComponent and set it
32.237 + * unmodified. Used in closeDiscard method.
32.238 + */
32.239 + private void setUnmodified() {
32.240 + // should be just one node
32.241 + org.openide.nodes.Node[] nodes = ((TopComponent)getSource()).getActivatedNodes();
32.242 + // TopComponent like Execution doesn't have any nodes associated
32.243 + if(nodes != null) {
32.244 + for(int i=0;i<nodes.length;i++) {
32.245 + DataObject dob = (DataObject)nodes[i].getCookie(DataObject.class);
32.246 + dob.setModified(false);
32.247 + }
32.248 + }
32.249 + }
32.250 +
32.251 + /** Waits for index-th TopComponent with given name in IDE registry.
32.252 + * It throws JemmyException when TopComponent is not find until timeout
32.253 + * expires.
32.254 + * @param name name of TopComponent
32.255 + * @param index index of TopComponent
32.256 + * @return TopComponent instance or throws JemmyException if not found
32.257 + * @see #findTopComponent
32.258 + */
32.259 + protected static JComponent waitTopComponent(final String name, final int index) {
32.260 + return waitTopComponent(null, name, index, null);
32.261 + }
32.262 +
32.263 + /** Waits for index-th TopComponent with given name in IDE registry.
32.264 + * It throws JemmyException when TopComponent is not find until timeout
32.265 + * expires.
32.266 + * @param cont container where to search
32.267 + * @param name name of TopComponent
32.268 + * @param index index of TopComponent
32.269 + * @param subchooser ComponentChooser to determine exact TopComponent
32.270 + * @return TopComponent instance or throws JemmyException if not found
32.271 + * @see #findTopComponent
32.272 + */
32.273 + protected static JComponent waitTopComponent(final ContainerOperator cont, final String name, final int index, final ComponentChooser subchooser) {
32.274 + try {
32.275 + Waiter waiter = new Waiter(new Waitable() {
32.276 + public Object actionProduced(Object obj) {
32.277 + return findTopComponent(cont, name, index, subchooser);
32.278 + }
32.279 + public String getDescription() {
32.280 + return("Wait TopComponent with name="+name+
32.281 + " index="+String.valueOf(index)+
32.282 + (subchooser == null ? "" : " subchooser="+subchooser.getDescription())+
32.283 + " loaded");
32.284 + }
32.285 + });
32.286 + Timeouts times = JemmyProperties.getCurrentTimeouts().cloneThis();
32.287 + times.setTimeout("Waiter.WaitingTime", times.getTimeout("ComponentOperator.WaitComponentTimeout"));
32.288 + waiter.setTimeouts(times);
32.289 + waiter.setOutput(JemmyProperties.getCurrentOutput());
32.290 + return((JComponent)waiter.waitAction(null));
32.291 + } catch(InterruptedException e) {
32.292 + return(null);
32.293 + }
32.294 + }
32.295 +
32.296 +
32.297 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/TreeTableOperator.java Thu Jul 10 04:32:50 2008 -0700
33.3 @@ -0,0 +1,357 @@
33.4 +/*
33.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33.6 +*
33.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
33.8 +*
33.9 +* The contents of this file are subject to the terms of either the GNU
33.10 +* General Public License Version 2 only ("GPL") or the Common
33.11 +* Development and Distribution License("CDDL") (collectively, the
33.12 +* "License"). You may not use this file except in compliance with the
33.13 +* License. You can obtain a copy of the License at
33.14 +* http://www.netbeans.org/cddl-gplv2.html
33.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
33.16 +* specific language governing permissions and limitations under the
33.17 +* License. When distributing the software, include this License Header
33.18 +* Notice in each file and include the License file at
33.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
33.20 +* particular file as subject to the "Classpath" exception as provided
33.21 +* by Sun in the GPL Version 2 section of the License file that
33.22 +* accompanied this code. If applicable, add the following below the
33.23 +* License Header, with the fields enclosed by brackets [] replaced by
33.24 +* your own identifying information:
33.25 +* "Portions Copyrighted [year] [name of copyright owner]"
33.26 +*
33.27 +* Contributor(s):
33.28 +*
33.29 +* The Original Software is NetBeans. The Initial Developer of the Original
33.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
33.31 +* Microsystems, Inc. All Rights Reserved.
33.32 +*
33.33 +* If you wish your version of this file to be governed by only the CDDL
33.34 +* or only the GPL Version 2, indicate your decision by adding
33.35 +* "[Contributor] elects to include this software in this distribution
33.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
33.37 +* single choice of license, a recipient has the option to distribute
33.38 +* your version of this file under either the CDDL, the GPL Version 2 or
33.39 +* to extend the choice of license to its licensees as provided above.
33.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
33.41 +* Version 2 license, then the option applies only if the new code is
33.42 +* made subject to such option by the copyright holder.
33.43 +*/
33.44 +
33.45 +package org.netbeans.modules.visualweb.gravy;
33.46 +
33.47 +import java.awt.Component;
33.48 +import java.awt.Point;
33.49 +import java.awt.Rectangle;
33.50 +import javax.swing.JPopupMenu;
33.51 +import javax.swing.JScrollPane;
33.52 +import javax.swing.JTable;
33.53 +import javax.swing.JTree;
33.54 +import javax.swing.tree.TreePath;
33.55 +import org.netbeans.jemmy.ComponentChooser;
33.56 +import org.netbeans.jemmy.ComponentSearcher;
33.57 +import org.netbeans.jemmy.Timeout;
33.58 +import org.netbeans.jemmy.drivers.DriverManager;
33.59 +import org.netbeans.jemmy.drivers.MouseDriver;
33.60 +import org.netbeans.jemmy.drivers.SupportiveDriver;
33.61 +import org.netbeans.jemmy.operators.ComponentOperator;
33.62 +import org.netbeans.jemmy.operators.ContainerOperator;
33.63 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
33.64 +import org.netbeans.jemmy.operators.JScrollPaneOperator;
33.65 +import org.netbeans.jemmy.operators.JTableOperator;
33.66 +import org.netbeans.jemmy.operators.JTreeOperator;
33.67 +import org.netbeans.jemmy.util.EmptyVisualizer;
33.68 +
33.69 +/**
33.70 + * This class is used for dealing with IDE's TreeTable component,
33.71 + * used instead of JTree in some dialogs: Options, SetupWizard, ...
33.72 + */
33.73 +public class TreeTableOperator extends JTableOperator {
33.74 + private JTreeOperator _tree;
33.75 +
33.76 + /**
33.77 + * Creates new instance.
33.78 + * @param view JTable representing requested TreeTable
33.79 + */
33.80 + public TreeTableOperator(JTable view) {
33.81 + super(view);
33.82 + }
33.83 +
33.84 + /**
33.85 + * Creates new instance for the first TreeTable in container.
33.86 + * @param contOper container where to find TreeTable
33.87 + */
33.88 + public TreeTableOperator(ContainerOperator contOper) {
33.89 + this(contOper, 0);
33.90 + }
33.91 + /**
33.92 + * Creates new instance for the first TreeTable in container.
33.93 + * @param contOper container where to find TreeTable
33.94 + * @param index int index
33.95 + */
33.96 + public TreeTableOperator(ContainerOperator contOper, int index) {
33.97 + this((JTable)
33.98 + waitComponent(contOper,
33.99 + new TreeTableFinder(ComponentSearcher.
33.100 + getTrueChooser("Any TreeTable")),
33.101 + index));
33.102 + copyEnvironment(contOper);
33.103 + }
33.104 +
33.105 + /**
33.106 + * Returns operator for a tree which is showed as a part of the table.
33.107 + * @return JTreeOperator instance
33.108 + */
33.109 + public JTreeOperator tree() {
33.110 + if(_tree == null) {
33.111 + // cell renderer component for first column is JTree
33.112 + Object value = getValueAt(0, 0);
33.113 + JTree jTree = (JTree)getCellRenderer(0, 0).getTableCellRendererComponent((JTable)this.getSource(), value, false, false, 0, 0);
33.114 + // Need to set EmptyVisualizer because found JTree doesn't have any parent Container
33.115 + // and calling makeComponentVisible() throws NPE
33.116 +// _tree = new JTreeOperator(jTree);
33.117 + _tree = new RenderedTreeOperator(this, jTree);
33.118 + _tree.setVisualizer(new EmptyVisualizer());
33.119 + }
33.120 + // Everytime make parent container visible because tree has EmptyVisualizer
33.121 + // and it is need for example for popup menu operations on JTree
33.122 + makeComponentVisible();
33.123 + return _tree;
33.124 + }
33.125 +
33.126 + /** Registers RenderedMouseDriver to be used by RenderedTreeOperator. */
33.127 + static {
33.128 + DriverManager.setDriver(DriverManager.MOUSE_DRIVER_ID, new RenderedMouseDriver(), RenderedTreeOperator.class);
33.129 + }
33.130 +
33.131 + /**
33.132 + * This inner class is a finder, which helps to search a component TreeTable.
33.133 + */
33.134 + static class TreeTableFinder implements ComponentChooser {
33.135 + ComponentChooser subFinder;
33.136 + public TreeTableFinder(ComponentChooser sf) {
33.137 + subFinder = sf;
33.138 + }
33.139 + public boolean checkComponent(Component comp) {
33.140 + Class cls = comp.getClass();
33.141 + do {
33.142 + if(cls.getName().equals("org.openide.explorer.view.TreeTable")) {
33.143 + return(subFinder.checkComponent(comp));
33.144 + }
33.145 + } while((cls = cls.getSuperclass()) != null);
33.146 + return(false);
33.147 + }
33.148 + public String getDescription() {
33.149 + return(subFinder.getDescription());
33.150 + }
33.151 + }
33.152 +
33.153 + /**
33.154 + * MouseDriver used to process events not on JTree but on TreeTable
33.155 + * component which is used to handle events in real.
33.156 + */
33.157 + public static class RenderedMouseDriver extends SupportiveDriver implements MouseDriver {
33.158 +
33.159 + /**
33.160 + * Creates new instance of RenderedMouseDriver.
33.161 + */
33.162 + public RenderedMouseDriver() {
33.163 + super(new Class[] {RenderedTreeOperator.class});
33.164 + }
33.165 +
33.166 + /**
33.167 + * Presses mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.168 + * @param oper operator which delegates events on an real operator
33.169 + * @param x x position of mouse operation
33.170 + * @param y y position of mouse operation
33.171 + * @param mouseButton mouse button identification
33.172 + * @param modifiers modifiers pressed during mouse click
33.173 + */
33.174 + public void pressMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers) {
33.175 + checkSupported(oper);
33.176 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.177 + DriverManager.getMouseDriver(realOper).pressMouse(realOper, x, y, mouseButton, modifiers);
33.178 + }
33.179 +
33.180 + /**
33.181 + * Releases mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.182 + * @param oper operator which delegates events on an real operator
33.183 + * @param x x position of mouse operation
33.184 + * @param y y position of mouse operation
33.185 + * @param mouseButton mouse button identification
33.186 + * @param modifiers modifiers pressed during mouse click
33.187 + */
33.188 + public void releaseMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers) {
33.189 + checkSupported(oper);
33.190 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.191 + DriverManager.getMouseDriver(realOper).releaseMouse(realOper, x, y, mouseButton, modifiers);
33.192 + }
33.193 +
33.194 + /**
33.195 + * Clicks mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.196 + * @param oper operator which delegates events on an real operator
33.197 + * @param x x position of mouse operation
33.198 + * @param y y position of mouse operation
33.199 + * @param clickCount how many times to be clicked
33.200 + * @param mouseButton mouse button identification
33.201 + * @param modifiers modifiers pressed during mouse click
33.202 + * @param mouseClick timeout of mouse click
33.203 + */
33.204 + public void clickMouse(ComponentOperator oper, int x, int y, int clickCount, int mouseButton,
33.205 + int modifiers, Timeout mouseClick) {
33.206 + checkSupported(oper);
33.207 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.208 + DriverManager.getMouseDriver(realOper).clickMouse(realOper, x, y, clickCount, mouseButton, modifiers, mouseClick);
33.209 + }
33.210 +
33.211 + /**
33.212 + * Moves mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.213 + * @param oper operator which delegates events on an real operator
33.214 + * @param x x position of mouse operation
33.215 + * @param y y position of mouse operation
33.216 + */
33.217 + public void moveMouse(ComponentOperator oper, int x, int y) {
33.218 + checkSupported(oper);
33.219 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.220 + DriverManager.getMouseDriver(realOper).moveMouse(realOper, x, y);
33.221 + }
33.222 +
33.223 + /**
33.224 + * Drags mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.225 + * @param oper operator which delegates events on an real operator
33.226 + * @param x x position of mouse operation
33.227 + * @param y y position of mouse operation
33.228 + * @param mouseButton mouse button identification
33.229 + * @param modifiers modifiers pressed during mouse click
33.230 + */
33.231 + public void dragMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers) {
33.232 + checkSupported(oper);
33.233 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.234 + DriverManager.getMouseDriver(realOper).dragMouse(realOper, x, y, mouseButton, modifiers);
33.235 + }
33.236 +
33.237 + /**
33.238 + * Provides drag and drop operation on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.239 + * @param oper operator which delegates events on an real operator
33.240 + * @param start_x x position where to drag
33.241 + * @param start_y y position where to drag
33.242 + * @param end_x x position where to drop
33.243 + * @param end_y y position where to drop
33.244 + * @param mouseButton mouse button identification
33.245 + * @param modifiers modifiers pressed during mouse click
33.246 + * @param before timeout before drag
33.247 + * @param after timeout after drop
33.248 + */
33.249 + public void dragNDrop(ComponentOperator oper, int start_x, int start_y, int end_x, int end_y,
33.250 + int mouseButton, int modifiers, Timeout before, Timeout after) {
33.251 + checkSupported(oper);
33.252 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.253 + DriverManager.getMouseDriver(realOper).dragNDrop(realOper, start_x, start_y, end_x, end_y,
33.254 + mouseButton, modifiers, before, after);
33.255 + }
33.256 +
33.257 + /**
33.258 + * Enters mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.259 + * @param oper operator which delegates events on an real operator
33.260 + */
33.261 + public void enterMouse(ComponentOperator oper){
33.262 + checkSupported(oper);
33.263 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.264 + DriverManager.getMouseDriver(realOper).enterMouse(realOper);
33.265 + }
33.266 +
33.267 + /**
33.268 + * Exits mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
33.269 + * @param oper operator which delegates events on an real operator
33.270 + */
33.271 + public void exitMouse(ComponentOperator oper) {
33.272 + checkSupported(oper);
33.273 + ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
33.274 + DriverManager.getMouseDriver(realOper).exitMouse(realOper);
33.275 + }
33.276 + }
33.277 +
33.278 + /**
33.279 + * Operator used to process events not on JTree but on TreeTable
33.280 + * component which is used to handle events in real.
33.281 + */
33.282 + public static class RenderedTreeOperator extends JTreeOperator {
33.283 + TreeTableOperator oper;
33.284 +
33.285 + /**
33.286 + * Creates new instance of RenderedTreeOperator.
33.287 + * @param oper TreeTable operator to handle events
33.288 + * @param tree JTree representing nodes
33.289 + */
33.290 + public RenderedTreeOperator(TreeTableOperator oper, JTree tree) {
33.291 + super(tree);
33.292 + this.oper = oper;
33.293 + }
33.294 +
33.295 + /**
33.296 + * Returns TreeTableOperator instance which is used to handle events.
33.297 + * @return TreeTableOperator instance
33.298 + */
33.299 + public ComponentOperator getRealOperator() {
33.300 + return(oper);
33.301 + }
33.302 +
33.303 + /**
33.304 + * Calls popup menu on specified tree paths.
33.305 + * @param paths an array of TreePath instances
33.306 + * @param mouseButton mouse button identification
33.307 + * @return JPopupMenu instance opened by this method
33.308 + */
33.309 + public JPopupMenu callPopupOnPaths(TreePath[] paths, int mouseButton) {
33.310 + oper.makeComponentVisible();
33.311 + for(int i = 0; i < paths.length; i++) {
33.312 + if(paths[i].getParentPath() != null) {
33.313 + expandPath(paths[i].getParentPath());
33.314 + }
33.315 + }
33.316 + selectPaths(paths);
33.317 + scrollToPath(paths[paths.length - 1]);
33.318 + Point point = getPointToClick(paths[paths.length - 1]);
33.319 + return(JPopupMenuOperator.callPopup(oper.getSource(),
33.320 + (int)point.getX(),
33.321 + (int)point.getY(),
33.322 + mouseButton));
33.323 + }
33.324 +
33.325 + /**
33.326 + * Scrolls to a path if the tree is on a JScrollPane component.
33.327 + * @param path TreePath where to scroll
33.328 + */
33.329 + public void scrollToPath(TreePath path) {
33.330 + makeComponentVisible();
33.331 + //try to find JScrollPane under.
33.332 + JScrollPane scroll = (JScrollPane)getContainer(new JScrollPaneOperator.
33.333 + JScrollPaneFinder(ComponentSearcher.
33.334 + getTrueChooser("JScrollPane")));
33.335 + if(scroll == null) {
33.336 + return;
33.337 + }
33.338 + JScrollPaneOperator scroller = new JScrollPaneOperator(scroll);
33.339 + scroller.copyEnvironment(this);
33.340 + scroller.setVisualizer(new EmptyVisualizer());
33.341 + Rectangle rect = getPathBounds(path);
33.342 + if(rect != null) {
33.343 + scroller.scrollToComponentRectangle(getRealOperator().getSource(),
33.344 + (int)rect.getX(),
33.345 + (int)rect.getY(),
33.346 + (int)rect.getWidth(),
33.347 + (int)rect.getHeight());
33.348 + } else {
33.349 + throw(new NoSuchPathException(path));
33.350 + }
33.351 + }
33.352 + }
33.353 +
33.354 + /**
33.355 + * Performs verification by accessing all sub-components
33.356 + */
33.357 + public void verify() {
33.358 + tree();
33.359 + }
33.360 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/Util.java Thu Jul 10 04:32:50 2008 -0700
34.3 @@ -0,0 +1,322 @@
34.4 +/*
34.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
34.6 + *
34.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
34.8 + *
34.9 + * The contents of this file are subject to the terms of either the GNU
34.10 + * General Public License Version 2 only ("GPL") or the Common
34.11 + * Development and Distribution License("CDDL") (collectively, the
34.12 + * "License"). You may not use this file except in compliance with the
34.13 + * License. You can obtain a copy of the License at
34.14 + * http://www.netbeans.org/cddl-gplv2.html
34.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
34.16 + * specific language governing permissions and limitations under the
34.17 + * License. When distributing the software, include this License Header
34.18 + * Notice in each file and include the License file at
34.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
34.20 + * particular file as subject to the "Classpath" exception as provided
34.21 + * by Sun in the GPL Version 2 section of the License file that
34.22 + * accompanied this code. If applicable, add the following below the
34.23 + * License Header, with the fields enclosed by brackets [] replaced by
34.24 + * your own identifying information:
34.25 + * "Portions Copyrighted [year] [name of copyright owner]"
34.26 + *
34.27 + * Contributor(s):
34.28 + *
34.29 + * The Original Software is NetBeans. The Initial Developer of the Original
34.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
34.31 + * Microsystems, Inc. All Rights Reserved.
34.32 + *
34.33 + * If you wish your version of this file to be governed by only the CDDL
34.34 + * or only the GPL Version 2, indicate your decision by adding
34.35 + * "[Contributor] elects to include this software in this distribution
34.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
34.37 + * single choice of license, a recipient has the option to distribute
34.38 + * your version of this file under either the CDDL, the GPL Version 2 or
34.39 + * to extend the choice of license to its licensees as provided above.
34.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
34.41 + * Version 2 license, then the option applies only if the new code is
34.42 + * made subject to such option by the copyright holder.
34.43 + */
34.44 +
34.45 +package org.netbeans.modules.visualweb.gravy;
34.46 +
34.47 +import java.util.*;
34.48 +import java.awt.*;
34.49 +import org.netbeans.jemmy.operators.*;
34.50 +import org.netbeans.jemmy.util.DefaultVisualizer;
34.51 +import org.netbeans.jemmy.util.NameComponentChooser;
34.52 +import org.netbeans.jemmy.Waiter;
34.53 +import org.netbeans.jemmy.Waitable;
34.54 +import org.netbeans.jemmy.EventTool;
34.55 +import org.netbeans.jemmy.QueueTool;
34.56 +import java.awt.event.*;
34.57 +import org.netbeans.junit.NbTestCase;
34.58 +import org.netbeans.jellytools.*;
34.59 +import org.netbeans.jellytools.Bundle;
34.60 +import org.netbeans.jemmy.EventDispatcher;
34.61 +
34.62 +/**
34.63 + * Class with different ancillary utils.
34.64 + */
34.65 +public class Util {
34.66 + public static final String
34.67 + WINDOWS_OS_FAMILY_NAME = "Windows",
34.68 + LINUX_OS_FAMILY_NAME = "Linux",
34.69 + SUN_OS_FAMILY_NAME = "SunOS",
34.70 + MAC_OS_FAMILY_NAME = "Mac";
34.71 +
34.72 + static MainWindowOperator mainWindow;
34.73 + static JMenuBarOperator mainMenu;
34.74 +
34.75 + /**
34.76 + * Get delay scale for tests.
34.77 + * @return double Value of delay scale.
34.78 + */
34.79 + public static double getDelayScale(){
34.80 + String s=System.getProperty("Env-RaveTestsDelayScale","1");
34.81 + try{
34.82 + return Double.parseDouble(s);
34.83 + }catch(NumberFormatException e){
34.84 + return 1;
34.85 + }
34.86 + }
34.87 +
34.88 + /**
34.89 + * Get operation system's name.
34.90 + * @return String Name of operation system.
34.91 + */
34.92 + public static String getOperatingSystemName() {
34.93 + return System.getProperty("os.name");
34.94 + }
34.95 +
34.96 + /**
34.97 + * @return True if operation system is from Windows family.
34.98 + */
34.99 + public static boolean isWindowsOS() {
34.100 + String osName = getOperatingSystemName();
34.101 + return (osName.toUpperCase().indexOf(
34.102 + WINDOWS_OS_FAMILY_NAME.toUpperCase()) > -1);
34.103 + }
34.104 +
34.105 + /**
34.106 + * @return True if operation system is from Sun (Solaris) family.
34.107 + */
34.108 + public static boolean isSunOS() {
34.109 + String osName = getOperatingSystemName();
34.110 + return (osName.toUpperCase().indexOf(
34.111 + SUN_OS_FAMILY_NAME.toUpperCase()) > -1);
34.112 + }
34.113 +
34.114 + /**
34.115 + * @return True if operation system is from MAC OS X family.
34.116 + */
34.117 + public static boolean isMacOS() {
34.118 + String osName = getOperatingSystemName();
34.119 + return (osName.toUpperCase().indexOf(
34.120 + MAC_OS_FAMILY_NAME.toUpperCase()) > -1);
34.121 + }
34.122 +
34.123 + /**
34.124 + * Get main window.
34.125 + * @return MainWindowOperator.
34.126 + */
34.127 + public static MainWindowOperator getMainWindow() {
34.128 + if(mainWindow == null) {
34.129 + Operator.setDefaultComponentVisualizer(new DefaultVisualizer());
34.130 + mainWindow = new MainWindowOperator();
34.131 + }
34.132 + return(mainWindow);
34.133 + }
34.134 +
34.135 + /**
34.136 + * Get main menu.
34.137 + * @return JMenuBarOperator Main menu.
34.138 + */
34.139 + public static JMenuBarOperator getMainMenu() {
34.140 + if(mainMenu == null) {
34.141 + mainMenu = new JMenuBarOperator(getMainWindow());
34.142 + }
34.143 + return(mainMenu);
34.144 + }
34.145 +
34.146 + /**
34.147 + * Get main tab.
34.148 + * @return JTabbedPaneOperator Main tab.
34.149 + */
34.150 + public static JTabbedPaneOperator getMainTab() {
34.151 + return(new JTabbedPaneOperator(new ContainerOperator(getMainWindow(),
34.152 + new NameComponentChooser("mainTab"))));
34.153 + }
34.154 +
34.155 + /**
34.156 + * Select tab with specified name.
34.157 + * @param tabName Name of the tab.
34.158 + */
34.159 + public static void selectTab(String tabName){
34.160 + new org.netbeans.jellytools.TopComponentOperator(tabName);
34.161 + }
34.162 +
34.163 + /**
34.164 + * Generate time stamp.
34.165 + * @return String Time stamp.
34.166 + */
34.167 + public static String generateTimeStamp() {
34.168 + Calendar calendar = Calendar.getInstance();
34.169 + return("" +
34.170 + calendar.get(Calendar.YEAR) +
34.171 + calendar.get(Calendar.MONTH) +
34.172 + calendar.get(Calendar.DAY_OF_MONTH) +
34.173 + calendar.get(Calendar.HOUR_OF_DAY) +
34.174 + calendar.get(Calendar.MINUTE) +
34.175 + calendar.get(Calendar.SECOND));
34.176 + }
34.177 +
34.178 + /**
34.179 + * Close main window.
34.180 + */
34.181 + public static void closeWindow(){
34.182 + (new org.netbeans.jellytools.actions.Action(
34.183 + Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Window").substring(1)/*Menu/Window=&Window*/
34.184 + + "|" +
34.185 + Bundle.getStringTrimmed("org.netbeans.core.windows.actions.Bundle", "LBL_CloseWindowAction"), /*Close Window*/
34.186 + null)).performMenu();
34.187 + }
34.188 +
34.189 + /**
34.190 + * Save all that is opened and changed with main menu.
34.191 + */
34.192 + public static void saveAll(){
34.193 + // find item "Save all"
34.194 + JMenuItemOperator saveAll= Util.getMainMenu().showMenuItem(new String[]{"File","Save All"});
34.195 + if (saveAll.isEnabled()){
34.196 + Util.getMainMenu().pushMenu(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File")+"|"+Bundle.getStringTrimmed("com.sun.rave.gravy.project.actions.Bundle", "LBL_SaveAllAction"));
34.197 + }
34.198 + }
34.199 +
34.200 + /**
34.201 + * Save all that is opened and changed with API function.
34.202 + */
34.203 + public static void saveAllAPICall() {
34.204 + ((org.openide.actions.SaveAllAction)org.openide.actions.SaveAllAction.
34.205 + findObject(org.openide.actions.SaveAllAction.class, true)).performAction();
34.206 + }
34.207 +
34.208 + /**
34.209 + * Get time of execution.
34.210 + * @return long Time in format long.
34.211 + */
34.212 + public static long getExecutionTime() {
34.213 + String execTime = System.getProperty("xtest.ide.execution.time");
34.214 + if(execTime != null) {
34.215 + System.out.println("Property = " + execTime);
34.216 + int comps[] = new int[6];
34.217 + StringTokenizer token = new StringTokenizer(execTime, ":");
34.218 + for(int i = 0; i<6; i++) {
34.219 + comps[i] = Integer.parseInt(token.nextToken());
34.220 + }
34.221 + Calendar calend = Calendar.getInstance();
34.222 + calend.set(comps[0], comps[1] - 1, comps[2], comps[3], comps[4], comps[5]);
34.223 + long result = calend.getTimeInMillis();
34.224 + System.out.print("Execution time: " + calend.toString());
34.225 + System.out.println(" = " + result);
34.226 + return(result);
34.227 + } else {
34.228 + throw(new RuntimeException("xtest.ide.execution.time property is empty"));
34.229 + }
34.230 + }
34.231 +
34.232 + /**
34.233 + * Get current time .
34.234 + * @return long Time in format long.
34.235 + */
34.236 + public static long getCurrentTime() {
34.237 + Calendar calend = Calendar.getInstance();
34.238 + long result = calend.getTimeInMillis();
34.239 + System.out.print("Current time: " + calend.toString());
34.240 + System.out.println(" = " + result);
34.241 + return(result);
34.242 + }
34.243 +
34.244 + /**
34.245 + * Save performance data.
34.246 + */
34.247 + public static void savePerformanceData(NbTestCase test, String id, long startTime, long endTime) {
34.248 + System.out.println("Time diff is " + (endTime - startTime));
34.249 + System.out.println("Saving it into " + test.getName() + ".perfdata");
34.250 + test.getLog(test.getName() + ".perfdata").print(test.getName() + "." + id + " = ");
34.251 + test.getLog(test.getName() + ".perfdata").println(endTime - startTime);
34.252 + }
34.253 +
34.254 + /**
34.255 + * Save performance data.
34.256 + */
34.257 + public static void savePerformanceData(NbTestCase test, String id, long startTime) {
34.258 + savePerformanceData(test, id, startTime, getCurrentTime());
34.259 + }
34.260 +
34.261 + /**
34.262 + * Wait for specified time.
34.263 + * @param millisec Amount of milliseconds.
34.264 + */
34.265 + public static void wait(int millisec){
34.266 + millisec = new Double(millisec*getDelayScale()).intValue();
34.267 + System.out.println("Delay scale() = " + getDelayScale());
34.268 + System.out.println("Sleep to "+millisec/1000+" seconds");
34.269 + EventDispatcher.waitQueueEmpty();
34.270 + try { Thread.sleep(millisec); } catch(Exception e) {}
34.271 + EventDispatcher.waitQueueEmpty();
34.272 + }
34.273 +
34.274 + /**
34.275 + * Wait for any keyboard event.
34.276 + */
34.277 + public static void waitKeyboardEvent() {
34.278 + waitKeyboardEvent(1200000);
34.279 + }
34.280 +
34.281 + /**
34.282 + * Wait for any keyboard event with specified delay.
34.283 + * @param delay Time for delay in long format
34.284 + */
34.285 + public static void waitKeyboardEvent(long delay) {
34.286 + String interactiveTestMode = System.getProperty("interactive.test.mode");
34.287 + if ((interactiveTestMode == null) || (!interactiveTestMode.equalsIgnoreCase("Yes"))) {
34.288 + return;
34.289 + }
34.290 + Waiter kbdWaiter = getKeyboardEventWaiter();
34.291 + kbdWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", delay);
34.292 + try {
34.293 + kbdWaiter.waitAction(null);
34.294 + } catch(Exception e) {
34.295 + e.printStackTrace();
34.296 + }
34.297 + }
34.298 +
34.299 + private static Waiter getKeyboardEventWaiter() {
34.300 + final String msgKeyWasPressed = "Key was pressed";
34.301 + Waiter kbdWaiter = new Waiter(new Waitable() {
34.302 + public Object actionProduced(Object obj) {
34.303 + AWTEvent awtEvent = null;
34.304 + try {
34.305 + awtEvent = EventTool.getLastEvent();
34.306 + } catch(Exception e) {
34.307 + TestUtils.outMsg("+++ Exception was thrown = " + e.getMessage());
34.308 + e.printStackTrace();
34.309 + return e.getMessage();
34.310 + }
34.311 + Util.wait(1000);
34.312 + new QueueTool().waitEmpty();
34.313 + if (awtEvent.getID() == KeyEvent.KEY_RELEASED) {
34.314 + TestUtils.outMsg("+++ " + msgKeyWasPressed);
34.315 + return msgKeyWasPressed;
34.316 + }
34.317 + return null;
34.318 + }
34.319 + public String getDescription() {
34.320 + return "Waiting for key press...";
34.321 + }
34.322 + });
34.323 + return kbdWaiter;
34.324 + }
34.325 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/Action.java Thu Jul 10 04:32:50 2008 -0700
35.3 @@ -0,0 +1,777 @@
35.4 +/*
35.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
35.6 + *
35.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
35.8 + *
35.9 + * The contents of this file are subject to the terms of either the GNU
35.10 + * General Public License Version 2 only ("GPL") or the Common
35.11 + * Development and Distribution License("CDDL") (collectively, the
35.12 + * "License"). You may not use this file except in compliance with the
35.13 + * License. You can obtain a copy of the License at
35.14 + * http://www.netbeans.org/cddl-gplv2.html
35.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
35.16 + * specific language governing permissions and limitations under the
35.17 + * License. When distributing the software, include this License Header
35.18 + * Notice in each file and include the License file at
35.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
35.20 + * particular file as subject to the "Classpath" exception as provided
35.21 + * by Sun in the GPL Version 2 section of the License file that
35.22 + * accompanied this code. If applicable, add the following below the
35.23 + * License Header, with the fields enclosed by brackets [] replaced by
35.24 + * your own identifying information:
35.25 + * "Portions Copyrighted [year] [name of copyright owner]"
35.26 + *
35.27 + * Contributor(s):
35.28 + *
35.29 + * The Original Software is NetBeans. The Initial Developer of the Original
35.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
35.31 + * Microsystems, Inc. All Rights Reserved.
35.32 + *
35.33 + * If you wish your version of this file to be governed by only the CDDL
35.34 + * or only the GPL Version 2, indicate your decision by adding
35.35 + * "[Contributor] elects to include this software in this distribution
35.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
35.37 + * single choice of license, a recipient has the option to distribute
35.38 + * your version of this file under either the CDDL, the GPL Version 2 or
35.39 + * to extend the choice of license to its licensees as provided above.
35.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
35.41 + * Version 2 license, then the option applies only if the new code is
35.42 + * made subject to such option by the copyright holder.
35.43 + */
35.44 +
35.45 +package org.netbeans.modules.visualweb.gravy.actions;
35.46 +
35.47 +import java.awt.Component;
35.48 +import java.awt.Container;
35.49 +import java.awt.EventQueue;
35.50 +import java.awt.event.ActionEvent;
35.51 +import java.awt.event.KeyEvent;
35.52 +import javax.swing.tree.TreePath;
35.53 +
35.54 +import org.netbeans.jellytools.JellyVersion;
35.55 +import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
35.56 +import org.netbeans.modules.visualweb.gravy.Util;
35.57 +// mdk import org.netbeans.jellytools.nodes.Node;
35.58 +import org.netbeans.modules.visualweb.gravy.nodes.Node;
35.59 +import org.netbeans.jemmy.EventTool;
35.60 +import org.netbeans.jemmy.JemmyException;
35.61 +import org.netbeans.jemmy.JemmyProperties;
35.62 +import org.netbeans.jemmy.Timeouts;
35.63 +import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
35.64 +import org.netbeans.jemmy.operators.ComponentOperator;
35.65 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
35.66 +import org.netbeans.jemmy.operators.Operator;
35.67 +import org.netbeans.jemmy.operators.Operator.ComponentVisualizer;
35.68 +import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
35.69 +import org.netbeans.jemmy.operators.Operator.StringComparator;
35.70 +import org.netbeans.jemmy.util.EmptyVisualizer;
35.71 +import org.openide.util.actions.SystemAction;
35.72 +
35.73 +
35.74 +/** Ancestor class for all blocking actions.<p>
35.75 + * It handles performing action through main menu (MENU_MODE), popup menu
35.76 + * (POPUP_MODE), IDE SystemAction API call (API_MODE) or through keyboard shortcut
35.77 + * (SHORTCUT_MODE).<p>
35.78 + * Action can be performed in exact mode by calling performMenu(...),
35.79 + * performPopup(...), performAPI(...) or performShortcut(...).<p>
35.80 + * If exact mode is not supported by the action it throws
35.81 + * UnsupportedOperationException.<p>
35.82 + * Current implementation supports MENU_MODE when menuPath is defined, POPUP_MODE
35.83 + * when popupPath is defined, API_MODE when systemActionClass is defined and
35.84 + * SHORTCUT_MODE when shorcut is defined (see Action constructors).<p>
35.85 + * Action also can be performed using runtime default mode by calling perform(...).<p>
35.86 + * When default mode is not support by the action other modes are tried till
35.87 + * supported mode found and action is performed.
35.88 + *
35.89 + * <BR>Timeouts used: <BR>
35.90 + * Action.WaitAfterShortcutTimeout - time to sleep between shortcuts in sequence (default 0) <BR>
35.91 + *
35.92 + * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
35.93 +public class Action {
35.94 +
35.95 + /** through menu action performing mode */
35.96 + public static final int MENU_MODE = 0;
35.97 + /** through popup menu action performing mode */
35.98 + public static final int POPUP_MODE = 1;
35.99 + /** through API action performing mode */
35.100 + public static final int API_MODE = 2;
35.101 + /** through shortcut action performing mode */
35.102 + public static final int SHORTCUT_MODE = 3;
35.103 +
35.104 + /** sleep time between nodes selection and action execution */
35.105 + protected static final long SELECTION_WAIT_TIME = 300;
35.106 + /** sleep time after action execution */
35.107 + protected static final long AFTER_ACTION_WAIT_TIME = 0;
35.108 + /** sleep time between sequence of shortcuts */
35.109 + protected static final long WAIT_AFTER_SHORTCUT_TIMEOUT = 0;
35.110 +
35.111 + private static final int sequence[][] = {{MENU_MODE, POPUP_MODE, SHORTCUT_MODE, API_MODE},
35.112 + {POPUP_MODE, MENU_MODE, SHORTCUT_MODE, API_MODE},
35.113 + {API_MODE, POPUP_MODE, MENU_MODE, SHORTCUT_MODE},
35.114 + {SHORTCUT_MODE, POPUP_MODE, MENU_MODE, API_MODE}};
35.115 +
35.116 + /** menu path of current action or null when MENU_MODE is not supported */
35.117 + protected String menuPath;
35.118 + /** popup menu path of current action or null when POPUP_MODE is not supported */
35.119 + protected String popupPath;
35.120 + /** SystemAction class of current action or null when API_MODE is not supported */
35.121 + protected Class systemActionClass;
35.122 + /** array of shortcuts of current action or null when SHORTCUT_MODE is not supported */
35.123 + protected Shortcut[] shortcuts;
35.124 +
35.125 + /** Comparator used as default for all Action instances. It is set in static clause. */
35.126 + private static StringComparator defaultComparator;
35.127 + /** Comparator used for this action instance. */
35.128 + private StringComparator comparator;
35.129 +
35.130 + /** creates new Action instance without API_MODE and SHORTCUT_MODE support
35.131 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
35.132 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
35.133 + public Action(String menuPath, String popupPath) {
35.134 + this(menuPath, popupPath, null, (Shortcut[])null);
35.135 + }
35.136 +
35.137 + /** creates new Action instance without SHORTCUT_MODE support
35.138 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
35.139 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
35.140 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
35.141 + public Action(String menuPath, String popupPath, String systemActionClass) {
35.142 + this(menuPath, popupPath, systemActionClass, (Shortcut[])null);
35.143 + }
35.144 +
35.145 + /** creates new Action instance without API_MODE support
35.146 + * @param shortcuts array of Shortcut instances (use null value if shorcut mode is not supported)
35.147 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
35.148 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
35.149 + public Action(String menuPath, String popupPath, Shortcut[] shortcuts) {
35.150 + this(menuPath, popupPath, null, shortcuts);
35.151 + }
35.152 +
35.153 + /** creates new Action instance without API_MODE support
35.154 + * @param shortcut Shortcut (use null value if menu mode is not supported)
35.155 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
35.156 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
35.157 + public Action(String menuPath, String popupPath, Shortcut shortcut) {
35.158 + this(menuPath, popupPath, null, new Shortcut[] {shortcut});
35.159 + }
35.160 +
35.161 + /** creates new Action instance
35.162 + * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
35.163 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
35.164 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
35.165 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
35.166 + public Action(String menuPath, String popupPath, String systemActionClass, Shortcut[] shortcuts) {
35.167 + this.menuPath = menuPath;
35.168 + this.popupPath = popupPath;
35.169 + if (systemActionClass==null) {
35.170 + this.systemActionClass = null;
35.171 + } else try {
35.172 + this.systemActionClass = Class.forName(systemActionClass);
35.173 + } catch (ClassNotFoundException e) {
35.174 + this.systemActionClass = null;
35.175 + }
35.176 + this.shortcuts = shortcuts;
35.177 + }
35.178 +
35.179 + /** creates new Action instance
35.180 + * @param shortcut Shortcut String (use null value if menu mode is not supported)
35.181 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
35.182 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
35.183 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
35.184 + public Action(String menuPath, String popupPath, String systemActionClass, Shortcut shortcut) {
35.185 + this(menuPath, popupPath, systemActionClass, new Shortcut[] {shortcut});
35.186 + }
35.187 +
35.188 + static {
35.189 + // Checks if you run on correct jemmy version. Writes message to jemmy log if not.
35.190 + JellyVersion.checkJemmyVersion();
35.191 +
35.192 + if (JemmyProperties.getCurrentProperty("Action.DefaultMode")==null)
35.193 + JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(POPUP_MODE));
35.194 + Timeouts.initDefault("Action.WaitAfterShortcutTimeout", WAIT_AFTER_SHORTCUT_TIMEOUT);
35.195 + // Set case sensitive comparator as default because of
35.196 + // very often clash between Cut and Execute menu items.
35.197 + // Substring criterion is set according to default string comparator
35.198 + boolean compareExactly = !Operator.getDefaultStringComparator().equals("abc", "a"); // NOI18N
35.199 + defaultComparator = new DefaultStringComparator(compareExactly, true);
35.200 + }
35.201 +
35.202 + private void perform(int mode) {
35.203 + switch (mode) {
35.204 + case POPUP_MODE: performPopup(); break;
35.205 + case MENU_MODE: performMenu(); break;
35.206 + case API_MODE: performAPI(); break;
35.207 + case SHORTCUT_MODE: performShortcut(); break;
35.208 + default: throw new IllegalArgumentException("Wrong Action.MODE");
35.209 + }
35.210 + }
35.211 +
35.212 + private void perform(Node node, int mode) {
35.213 + switch (mode) {
35.214 + case POPUP_MODE: performPopup(node); break;
35.215 + case MENU_MODE: performMenu(node); break;
35.216 + case API_MODE: performAPI(node); break;
35.217 + case SHORTCUT_MODE: performShortcut(node); break;
35.218 + default: throw new IllegalArgumentException("Wrong Action.MODE");
35.219 + }
35.220 + }
35.221 +
35.222 + private void perform(Node[] nodes, int mode) {
35.223 + switch (mode) {
35.224 + case POPUP_MODE: performPopup(nodes); break;
35.225 + case MENU_MODE: performMenu(nodes); break;
35.226 + case API_MODE: performAPI(nodes); break;
35.227 + case SHORTCUT_MODE: performShortcut(nodes); break;
35.228 + default: throw new IllegalArgumentException("Wrong Action.MODE");
35.229 + }
35.230 + }
35.231 +
35.232 + private void perform(ComponentOperator component, int mode) {
35.233 + switch (mode) {
35.234 + case POPUP_MODE: performPopup(component); break;
35.235 + case MENU_MODE: performMenu(component); break;
35.236 + case API_MODE: performAPI(component); break;
35.237 + case SHORTCUT_MODE: performShortcut(component); break;
35.238 + default: throw new IllegalArgumentException("Wrong Action.MODE");
35.239 + }
35.240 + }
35.241 +
35.242 +
35.243 + /** performs action depending on default mode,<br>
35.244 + * calls performPopup(), performMenu() or performAPI(),<br>
35.245 + * when default mode is not supported, others are tried */
35.246 + public void perform() {
35.247 + int modes[] = sequence[getDefaultMode()];
35.248 + for (int i=0; i<modes.length; i++) try {
35.249 + perform(modes[i]);
35.250 + return;
35.251 + } catch (UnsupportedOperationException e) {}
35.252 + }
35.253 +
35.254 + /** performs action depending on default mode,<br>
35.255 + * calls performPopup(), performMenu() or performAPI(),<br>
35.256 + * when default mode is not supported, others are tried
35.257 + * @param node node to be action performed on */
35.258 + public void perform(Node node) {
35.259 + int modes[] = sequence[getDefaultMode()];
35.260 + for (int i=0; i<modes.length; i++) try {
35.261 + perform(node, modes[i]);
35.262 + return;
35.263 + } catch (UnsupportedOperationException e) {}
35.264 + }
35.265 +
35.266 + /** performs action depending on default mode,<br>
35.267 + * calls performPopup(), performMenu() or performAPI(),<br>
35.268 + * when default mode is not supported, others are tried
35.269 + * @param nodes nodes to be action performed on */
35.270 + public void perform(Node[] nodes) {
35.271 + int modes[] = sequence[getDefaultMode()];
35.272 + for (int i=0; i<modes.length; i++) try {
35.273 + perform(nodes, modes[i]);
35.274 + return;
35.275 + } catch (UnsupportedOperationException e) {}
35.276 + }
35.277 +
35.278 + /** performs action depending on default mode,<br>
35.279 + * calls performPopup(), performMenu() or performAPI(),<br>
35.280 + * when default mode is not supported, others are tried
35.281 + * @param component component to be action performed on */
35.282 + public void perform(ComponentOperator component) {
35.283 + int modes[] = sequence[getDefaultMode()];
35.284 + for (int i=0; i<modes.length; i++) try {
35.285 + perform(component, modes[i]);
35.286 + return;
35.287 + } catch (UnsupportedOperationException e) {}
35.288 + }
35.289 +
35.290 + /** performs action through main menu
35.291 + * @throws UnsupportedOperationException when action does not support menu mode */
35.292 + public void performMenu() {
35.293 + if (menuPath==null) {
35.294 + throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
35.295 + }
35.296 + // Need to wait here to be more reliable.
35.297 + // TBD - It can be removed after issue 23663 is solved.
35.298 + new EventTool().waitNoEvent(500);
35.299 + Util.getMainMenu().pushMenu(menuPath);
35.300 + try {
35.301 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
35.302 + } catch (Exception e) {
35.303 + throw new JemmyException("Sleeping interrupted", e);
35.304 + }
35.305 + }
35.306 +
35.307 + /** performs action through main menu
35.308 + * @param node node to be action performed on
35.309 + * @throws UnsupportedOperationException when action does not support menu mode */
35.310 + public void performMenu(Node node) {
35.311 + performMenu(new Node[]{node});
35.312 + }
35.313 +
35.314 + /** performs action through main menu
35.315 + * @param nodes nodes to be action performed on
35.316 + * @throws UnsupportedOperationException when action does not support menu mode */
35.317 + public void performMenu(Node[] nodes) {
35.318 + if (menuPath==null)
35.319 + throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
35.320 + testNodes(nodes);
35.321 + nodes[0].select();
35.322 + for (int i=1; i<nodes.length; i++)
35.323 + nodes[i].addSelectionPath();
35.324 + try {
35.325 + Thread.sleep(SELECTION_WAIT_TIME);
35.326 + } catch (Exception e) {
35.327 + throw new JemmyException("Sleeping interrupted", e);
35.328 + }
35.329 + performMenu();
35.330 + }
35.331 +
35.332 + /** performs action through main menu
35.333 + * @param component component to be action performed on
35.334 + * @throws UnsupportedOperationException when action does not support menu mode */
35.335 + public void performMenu(ComponentOperator component) {
35.336 + component.getFocus();
35.337 + try {
35.338 + Thread.sleep(SELECTION_WAIT_TIME);
35.339 + } catch (Exception e) {
35.340 + throw new JemmyException("Sleeping interrupted", e);
35.341 + }
35.342 + performMenu();
35.343 + }
35.344 +
35.345 + /** performs action through popup menu
35.346 + * @throws UnsupportedOperationException */
35.347 + public void performPopup() {
35.348 + throw new UnsupportedOperationException(getClass().toString()+" does not implement performPopup()");
35.349 + }
35.350 +
35.351 + /** performs action through popup menu
35.352 + * @param node node to be action performed on
35.353 + * @throws UnsupportedOperationException when action does not support popup mode */
35.354 + public void performPopup(Node node) {
35.355 + performPopup(new Node[]{node});
35.356 + }
35.357 +
35.358 + /** performs action through popup menu
35.359 + * @param nodes nodes to be action performed on
35.360 + * @throws UnsupportedOperationException when action does not support popup mode */
35.361 + public void performPopup(Node[] nodes) {
35.362 + if (popupPath==null) {
35.363 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
35.364 + }
35.365 + testNodes(nodes);
35.366 + TreePath paths[]=new TreePath[nodes.length];
35.367 + for (int i=0; i<nodes.length; i++) {
35.368 + paths[i]=nodes[i].getTreePath();
35.369 + }
35.370 + ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
35.371 + ComponentVisualizer oldVisualizer = null;
35.372 + // If visualizer of JTreeOperator is EmptyVisualizer, we need
35.373 + // to avoid making tree component visible in callPopup method.
35.374 + // So far only known case is tree from TreeTableOperator.
35.375 + if(treeVisualizer instanceof EmptyVisualizer) {
35.376 + oldVisualizer = Operator.getDefaultComponentVisualizer();
35.377 + Operator.setDefaultComponentVisualizer(treeVisualizer);
35.378 + }
35.379 + // Need to wait here to be more reliable.
35.380 + // TBD - It can be removed after issue 23663 is solved.
35.381 + new EventTool().waitNoEvent(500);
35.382 + JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
35.383 + // restore previously used default visualizer
35.384 + if(oldVisualizer != null) {
35.385 + Operator.setDefaultComponentVisualizer(oldVisualizer);
35.386 + }
35.387 + popup.pushMenu(popupPath, "|", getComparator());
35.388 + try {
35.389 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
35.390 + } catch (Exception e) {
35.391 + throw new JemmyException("Sleeping interrupted", e);
35.392 + }
35.393 + }
35.394 +
35.395 + /** performs action through popup menu
35.396 + * @param component component to be action performed on
35.397 + * @throws UnsupportedOperationException when action does not support popup mode */
35.398 + public void performPopup(ComponentOperator component) {
35.399 + if (popupPath==null) {
35.400 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
35.401 + }
35.402 + // Need to wait here to be more reliable.
35.403 + // TBD - It can be removed after issue 23663 is solved.
35.404 + new EventTool().waitNoEvent(500);
35.405 + component.clickForPopup();
35.406 + new JPopupMenuOperator(component).pushMenu(popupPath, "|", getComparator());
35.407 + try {
35.408 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
35.409 + } catch (Exception e) {
35.410 + throw new JemmyException("Sleeping interrupted", e);
35.411 + }
35.412 + }
35.413 +
35.414 + /** performs action through API
35.415 + * @throws UnsupportedOperationException when action does not support API mode */
35.416 + public void performAPI() {
35.417 + if (systemActionClass==null) {
35.418 + throw new UnsupportedOperationException(getClass().toString()+" does not support API call.");
35.419 + }
35.420 + try {
35.421 + // actions has to be invoked in dispatch thread (see http://www.netbeans.org/issues/show_bug.cgi?id=35755)
35.422 + EventQueue.invokeAndWait(new Runnable() {
35.423 + public void run() {
35.424 + if(SystemAction.class.isAssignableFrom(systemActionClass)) {
35.425 + // SystemAction used in IDE
35.426 + SystemAction.get(systemActionClass).actionPerformed(
35.427 + new ActionEvent(new Container(), 0, null));
35.428 + } else {
35.429 + // action implements javax.swing.Action
35.430 + try {
35.431 + ((javax.swing.Action)systemActionClass.newInstance()).actionPerformed(null);
35.432 + } catch (Exception e) {
35.433 + throw new JemmyException("Exception when trying to create instance of action \""+systemActionClass.getName()+"\".", e);
35.434 + }
35.435 + }
35.436 + }
35.437 + });
35.438 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
35.439 + } catch (Exception e) {
35.440 + throw new JemmyException("Interrupted", e);
35.441 + }
35.442 + }
35.443 +
35.444 + /** performs action through API
35.445 + * @param node node to be action performed on
35.446 + * @throws UnsupportedOperationException when action does not support API mode */
35.447 + public void performAPI(Node node) {
35.448 + performAPI(new Node[]{node});
35.449 + }
35.450 +
35.451 + /** performs action through API
35.452 + * @param nodes nodes to be action performed on
35.453 + * @throws UnsupportedOperationException when action does not support API mode */
35.454 + public void performAPI(Node[] nodes) {
35.455 + if (systemActionClass==null)
35.456 + throw new UnsupportedOperationException(getClass().toString()+" does not define SystemAction");
35.457 + testNodes(nodes);
35.458 + nodes[0].select();
35.459 + for (int i=1; i<nodes.length; i++)
35.460 + nodes[i].addSelectionPath();
35.461 + try {
35.462 + Thread.sleep(SELECTION_WAIT_TIME);
35.463 + } catch (Exception e) {
35.464 + throw new JemmyException("Sleeping interrupted", e);
35.465 + }
35.466 + performAPI();
35.467 + }
35.468 +
35.469 + /** performs action through API
35.470 + * @param component component to be action performed on
35.471 + * @throws UnsupportedOperationException when action does not support API mode */
35.472 + public void performAPI(ComponentOperator component) {
35.473 + component.getFocus();
35.474 + try {
35.475 + Thread.sleep(SELECTION_WAIT_TIME);
35.476 + } catch (Exception e) {
35.477 + throw new JemmyException("Sleeping interrupted", e);
35.478 + }
35.479 + performAPI();
35.480 + }
35.481 +
35.482 + /** performs action through shortcut
35.483 + * @throws UnsupportedOperationException if no shortcut is defined */
35.484 + public void performShortcut() {
35.485 + if (shortcuts == null) {
35.486 + throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
35.487 + }
35.488 + for(int i=0; i<shortcuts.length; i++) {
35.489 + new KeyRobotDriver(null).pushKey(null, shortcuts[i].getKeyCode(), shortcuts[i].getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
35.490 + JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
35.491 + }
35.492 + try {
35.493 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
35.494 + } catch (Exception e) {
35.495 + throw new JemmyException("Sleeping interrupted", e);
35.496 + }
35.497 + }
35.498 +
35.499 + /** performs action through shortcut
35.500 + * @param node node to be action performed on
35.501 + * @throws UnsupportedOperationException when action does not support shortcut mode */
35.502 + public void performShortcut(Node node) {
35.503 + performShortcut(new Node[]{node});
35.504 + }
35.505 +
35.506 + /** performs action through shortcut
35.507 + * @param nodes nodes to be action performed on
35.508 + * @throws UnsupportedOperationException when action does not support shortcut mode */
35.509 + public void performShortcut(Node[] nodes) {
35.510 + if (shortcuts == null) {
35.511 + throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
35.512 + }
35.513 + testNodes(nodes);
35.514 + nodes[0].select();
35.515 + for (int i=1; i<nodes.length; i++)
35.516 + nodes[i].addSelectionPath();
35.517 + try {
35.518 + Thread.sleep(SELECTION_WAIT_TIME);
35.519 + } catch (Exception e) {
35.520 + throw new JemmyException("Sleeping interrupted", e);
35.521 + }
35.522 + performShortcut();
35.523 + }
35.524 +
35.525 + /** performs action through shortcut
35.526 + * @param component component to be action performed on
35.527 + * @throws UnsupportedOperationException when action does not support shortcut mode */
35.528 + public void performShortcut(ComponentOperator component) {
35.529 + component.getFocus();
35.530 + try {
35.531 + Thread.sleep(SELECTION_WAIT_TIME);
35.532 + } catch (Exception e) {
35.533 + throw new JemmyException("Sleeping interrupted", e);
35.534 + }
35.535 + performShortcut();
35.536 + }
35.537 +
35.538 + /** tests if nodes are all from the same tree
35.539 + * @param nodes nodes
35.540 + * @throws IllegalArgumentException when given nodes does not pass */
35.541 + protected void testNodes(Node[] nodes) {
35.542 + if ((nodes==null)||(nodes.length==0))
35.543 + throw new IllegalArgumentException("argument nodes is null or empty");
35.544 + Class myClass = getClass();
35.545 + Component nodesTree=nodes[0].tree().getSource();
35.546 + for (int i=0; i<nodes.length; i++) {
35.547 +// if (!nodes[i].hasAction(myClass))
35.548 +// throw new IllegalArgumentException(this.toString()+" could not be performed on "+nodes[i].toString());
35.549 + if (nodes[i]==null)
35.550 + throw new IllegalArgumentException("argument nodes contains null value");
35.551 + if (!nodesTree.equals(nodes[i].tree().getSource()))
35.552 + throw new IllegalArgumentException(nodes[i].toString()+" is from different tree");
35.553 + }
35.554 + }
35.555 +
35.556 + /** Returns default mode in which actions are performed.
35.557 + * @return default mode in which actions are performed
35.558 + * @see #POPUP_MODE
35.559 + * @see #MENU_MODE
35.560 + * @see #API_MODE
35.561 + * @see #SHORTCUT_MODE
35.562 + */
35.563 + public int getDefaultMode() {
35.564 + int mode=(((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
35.565 + if (mode<0 || mode>3)
35.566 + return POPUP_MODE;
35.567 + return mode;
35.568 + }
35.569 +
35.570 + /** Sets default mode in which actions are performed. If given mode value
35.571 + * is not valid, it sets {@link #POPUP_MODE} as default.
35.572 + * @param mode mode to be set
35.573 + * @return previous value
35.574 + * @see #POPUP_MODE
35.575 + * @see #MENU_MODE
35.576 + * @see #API_MODE
35.577 + * @see #SHORTCUT_MODE
35.578 + */
35.579 + public int setDefaultMode(int mode) {
35.580 + int oldMode = (((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
35.581 + if (mode<0 || mode>3) {
35.582 + mode = POPUP_MODE;
35.583 + }
35.584 + JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(mode));
35.585 + return oldMode;
35.586 + }
35.587 +
35.588 +
35.589 + /** Sets comparator fot this action. Comparator is used for all actions
35.590 + * after this method is called.
35.591 + * @param comparator new comparator to be set (e.g.
35.592 + * new Operator.DefaultStringComparator(true, true);
35.593 + * to search string item exactly and case sensitive)
35.594 + */
35.595 + public void setComparator(StringComparator comparator) {
35.596 + this.comparator = comparator;
35.597 + }
35.598 +
35.599 + /** Gets comparator set for this action instance.
35.600 + * @return comparator set for this action instance.
35.601 + */
35.602 + public StringComparator getComparator() {
35.603 + if(comparator == null) {
35.604 + comparator = defaultComparator;
35.605 + }
35.606 + return comparator;
35.607 + }
35.608 +
35.609 + /** getter for popup menu path
35.610 + * @return String popup menu path (or null if not suported)
35.611 + */
35.612 + public String getPopupPath() {
35.613 + return popupPath;
35.614 + }
35.615 +
35.616 + /** getter for main menu path
35.617 + * @return String main menu path (or null if not suported)
35.618 + */
35.619 + public String getMenuPath() {
35.620 + return menuPath;
35.621 + }
35.622 +
35.623 + /** getter for system action class
35.624 + * @return Class of system action (or null if not suported)
35.625 + */
35.626 + public Class getSystemActionClass() {
35.627 + return systemActionClass;
35.628 + }
35.629 +
35.630 + /** getter for array of shortcuts
35.631 + * @return Shortcut[] (or null if not suported)
35.632 + */
35.633 + public Shortcut[] getShortcuts() {
35.634 + return shortcuts;
35.635 + }
35.636 +
35.637 + /** Checks whether this action is enabled. If IDE system action class
35.638 + * is defined, it calls its isEnabled() method else if main menu path is
35.639 + * defined, it checks menu item is enabled. Otherwise it throws
35.640 + * UnsupportedOperationException.
35.641 + * @return true if this action is enabled; false otherwise
35.642 + */
35.643 + public boolean isEnabled() {
35.644 + if(systemActionClass != null) {
35.645 + return SystemAction.get(systemActionClass).isEnabled();
35.646 + } else if(menuPath != null) {
35.647 + return Util.getMainMenu().showMenuItem(
35.648 + menuPath, "|", getComparator()).isEnabled();
35.649 + } else {
35.650 + throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
35.651 + }
35.652 + }
35.653 +
35.654 + /** Checks whether this action on given nodes is enabled. If IDE system action class
35.655 + * is defined, it calls its isEnabled() method. Nodes are selected first.
35.656 + * Else if popup menu path is defined, it checks menu item is enabled.
35.657 + * Otherwise it throws UnsupportedOperationException.
35.658 + * @param nodes array of nodes to be selected before a check
35.659 + * @return true if this action is enabled; false otherwise
35.660 + */
35.661 + public boolean isEnabled(Node[] nodes) {
35.662 + testNodes(nodes);
35.663 + if(systemActionClass != null) {
35.664 + nodes[0].select();
35.665 + for (int i=1; i<nodes.length; i++)
35.666 + nodes[i].addSelectionPath();
35.667 + try {
35.668 + Thread.sleep(SELECTION_WAIT_TIME);
35.669 + } catch (Exception e) {
35.670 + throw new JemmyException("Sleeping interrupted", e);
35.671 + }
35.672 + return SystemAction.get(systemActionClass).isEnabled();
35.673 + } else if(popupPath != null) {
35.674 + TreePath paths[]=new TreePath[nodes.length];
35.675 + for (int i=0; i<nodes.length; i++) {
35.676 + paths[i]=nodes[i].getTreePath();
35.677 + }
35.678 + ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
35.679 + ComponentVisualizer oldVisualizer = null;
35.680 + // If visualizer of JTreeOperator is EmptyVisualizer, we need
35.681 + // to avoid making tree component visible in callPopup method.
35.682 + // So far only known case is tree from TreeTableOperator.
35.683 + if(treeVisualizer instanceof EmptyVisualizer) {
35.684 + oldVisualizer = Operator.getDefaultComponentVisualizer();
35.685 + Operator.setDefaultComponentVisualizer(treeVisualizer);
35.686 + }
35.687 + // Need to wait here to be more reliable.
35.688 + // TBD - It can be removed after issue 23663 is solved.
35.689 + new EventTool().waitNoEvent(500);
35.690 + JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
35.691 + // restore previously used default visualizer
35.692 + if(oldVisualizer != null) {
35.693 + Operator.setDefaultComponentVisualizer(oldVisualizer);
35.694 + }
35.695 + return popup.showMenuItem(popupPath, "|", getComparator()).isEnabled();
35.696 + } else {
35.697 + throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
35.698 + }
35.699 + }
35.700 +
35.701 + /** Checks whether this action on given node is enabled. If IDE system action class
35.702 + * is defined, it calls its isEnabled() method. Node is selected first.
35.703 + * Else if popup menu path is defined, it checks menu item is enabled.
35.704 + * Otherwise it throws UnsupportedOperationException.
35.705 + * @param node node to be selected before a check
35.706 + * @return true if this action is enabled; false otherwise
35.707 + */
35.708 + public boolean isEnabled(Node node) {
35.709 + return isEnabled(new Node[] {node});
35.710 + }
35.711 +
35.712 + /** Checks whether this action is enabled for given ComponentOperator.
35.713 + * First it makes component visible and focused.
35.714 + * If IDE system action class is defined, it calls its isEnabled() method.
35.715 + * Else if main menu path is defined, it checks menu item is enabled.
35.716 + * Otherwise it throws UnsupportedOperationException.
35.717 + * @param componentOperator instance of ComponentOperator
35.718 + * @return true if this action is enabled; false otherwise
35.719 + */
35.720 + public boolean isEnabled(ComponentOperator componentOperator) {
35.721 + componentOperator.makeComponentVisible();
35.722 + componentOperator.getFocus();
35.723 + if(systemActionClass != null) {
35.724 + return SystemAction.get(systemActionClass).isEnabled();
35.725 + } else if(popupPath != null) {
35.726 + // Need to wait here to be more reliable.
35.727 + // TBD - It can be removed after issue 23663 is solved.
35.728 + new EventTool().waitNoEvent(500);
35.729 + componentOperator.clickForPopup();
35.730 + return new JPopupMenuOperator(componentOperator).showMenuItem(
35.731 + popupPath, "|", getComparator()).isEnabled();
35.732 + } else if(menuPath != null) {
35.733 + return Util.getMainMenu().showMenuItem(
35.734 + menuPath, "|", getComparator()).isEnabled();
35.735 + } else {
35.736 + throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
35.737 + }
35.738 + }
35.739 +
35.740 + /** This class defines keyboard shortcut for action execution */
35.741 + public static class Shortcut extends Object {
35.742 + /** key code of shortcut (see KeyEvent) */
35.743 + protected int keyCode;
35.744 + /** key modifiers of shortcut (see KeyEvent) */
35.745 + protected int keyModifiers;
35.746 +
35.747 + /** creates new shortcut
35.748 + * @param keyCode int key code (see KeyEvent) */
35.749 + public Shortcut(int keyCode) {
35.750 + this(keyCode, 0);
35.751 + }
35.752 +
35.753 + /** creates new shortcut
35.754 + * @param keyCode int key code (see KeyEvent)
35.755 + * @param keyModifiers int key modifiers (see KeyEvent) */
35.756 + public Shortcut(int keyCode, int keyModifiers) {
35.757 + this.keyCode=keyCode;
35.758 + this.keyModifiers=keyModifiers;
35.759 + }
35.760 +
35.761 + /** getter for key code
35.762 + * @return int key code */
35.763 + public int getKeyCode() {
35.764 + return keyCode;
35.765 + }
35.766 +
35.767 + /** getter for key modifiers
35.768 + * @return int key modifiers */
35.769 + public int getKeyModifiers() {
35.770 + return keyModifiers;
35.771 + }
35.772 +
35.773 + /** returns String representation of shortcut
35.774 + * @return String representation of shortcut */
35.775 + public String toString() {
35.776 + String s=KeyEvent.getKeyModifiersText(getKeyModifiers());
35.777 + return s+(s.length()>0?"+":"")+KeyEvent.getKeyText(getKeyCode());
35.778 + }
35.779 + }
35.780 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/ActionNoBlock.java Thu Jul 10 04:32:50 2008 -0700
36.3 @@ -0,0 +1,241 @@
36.4 +/*
36.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
36.6 + *
36.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
36.8 + *
36.9 + * The contents of this file are subject to the terms of either the GNU
36.10 + * General Public License Version 2 only ("GPL") or the Common
36.11 + * Development and Distribution License("CDDL") (collectively, the
36.12 + * "License"). You may not use this file except in compliance with the
36.13 + * License. You can obtain a copy of the License at
36.14 + * http://www.netbeans.org/cddl-gplv2.html
36.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
36.16 + * specific language governing permissions and limitations under the
36.17 + * License. When distributing the software, include this License Header
36.18 + * Notice in each file and include the License file at
36.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
36.20 + * particular file as subject to the "Classpath" exception as provided
36.21 + * by Sun in the GPL Version 2 section of the License file that
36.22 + * accompanied this code. If applicable, add the following below the
36.23 + * License Header, with the fields enclosed by brackets [] replaced by
36.24 + * your own identifying information:
36.25 + * "Portions Copyrighted [year] [name of copyright owner]"
36.26 + *
36.27 + * Contributor(s):
36.28 + *
36.29 + * The Original Software is NetBeans. The Initial Developer of the Original
36.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
36.31 + * Microsystems, Inc. All Rights Reserved.
36.32 + *
36.33 + * If you wish your version of this file to be governed by only the CDDL
36.34 + * or only the GPL Version 2, indicate your decision by adding
36.35 + * "[Contributor] elects to include this software in this distribution
36.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
36.37 + * single choice of license, a recipient has the option to distribute
36.38 + * your version of this file under either the CDDL, the GPL Version 2 or
36.39 + * to extend the choice of license to its licensees as provided above.
36.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
36.41 + * Version 2 license, then the option applies only if the new code is
36.42 + * made subject to such option by the copyright holder.
36.43 + */
36.44 +
36.45 +package org.netbeans.modules.visualweb.gravy.actions;
36.46 +
36.47 +import java.awt.Container;
36.48 +import java.awt.EventQueue;
36.49 +import java.awt.event.ActionEvent;
36.50 +import javax.swing.tree.TreePath;
36.51 +// mdk import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
36.52 +import org.netbeans.modules.visualweb.gravy.Util;
36.53 +import org.netbeans.modules.visualweb.gravy.nodes.Node;
36.54 +import org.netbeans.jemmy.EventTool;
36.55 +import org.netbeans.jemmy.JemmyException;
36.56 +import org.netbeans.jemmy.JemmyProperties;
36.57 +import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
36.58 +import org.netbeans.jemmy.operators.ComponentOperator;
36.59 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
36.60 +import org.netbeans.jemmy.operators.Operator;
36.61 +import org.netbeans.jemmy.util.EmptyVisualizer;
36.62 +import org.openide.util.actions.SystemAction;
36.63 +
36.64 +/** Ancestor class for all non-blocking actions.<p>
36.65 + * This class re-implements all blocking calls from parent Action class to
36.66 + * non-blocking call.<p>
36.67 + * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a>
36.68 + * @see Action */
36.69 +public class ActionNoBlock extends Action {
36.70 +
36.71 + /** creates new non-blocking Action instance without API_MODE support
36.72 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
36.73 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
36.74 + public ActionNoBlock(String menuPath, String popupPath) {
36.75 + super(menuPath, popupPath);
36.76 + }
36.77 +
36.78 + /** creates new non-blocking Action instance
36.79 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
36.80 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
36.81 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
36.82 + public ActionNoBlock(String menuPath, String popupPath, String systemActionClass) {
36.83 + super(menuPath, popupPath, systemActionClass);
36.84 + }
36.85 +
36.86 + /** creates new Action instance without API_MODE support
36.87 + * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
36.88 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
36.89 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
36.90 + public ActionNoBlock(String menuPath, String popupPath, Shortcut[] shortcuts) {
36.91 + super(menuPath, popupPath, shortcuts);
36.92 + }
36.93 +
36.94 + /** creates new Action instance without API_MODE support
36.95 + * @param shortcut Shortcut (use null value if shortcut mode is not supported)
36.96 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
36.97 + * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
36.98 + public ActionNoBlock(String menuPath, String popupPath, Shortcut shortcut) {
36.99 + super(menuPath, popupPath, shortcut);
36.100 + }
36.101 +
36.102 + /** creates new Action instance
36.103 + * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
36.104 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
36.105 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
36.106 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
36.107 + public ActionNoBlock(String menuPath, String popupPath, String systemActionClass, Shortcut[] shortcuts) {
36.108 + super(menuPath, popupPath, systemActionClass, shortcuts);
36.109 + }
36.110 +
36.111 + /** creates new Action instance
36.112 + * @param shortcut Shortcut String (use null value if menu mode is not supported)
36.113 + * @param menuPath action path in main menu (use null value if menu mode is not supported)
36.114 + * @param popupPath action path in popup menu (use null value if popup mode is not supported)
36.115 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
36.116 + public ActionNoBlock(String menuPath, String popupPath, String systemActionClass, Shortcut shortcut) {
36.117 + super(menuPath, popupPath, systemActionClass, shortcut);
36.118 + }
36.119 +
36.120 + /** performs action through main menu
36.121 + * @throws UnsupportedOperationException when action does not support menu mode */
36.122 + public void performMenu() {
36.123 + if (menuPath==null) {
36.124 + throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
36.125 + }
36.126 + // Need to wait here to be more reliable.
36.127 + // TBD - It can be removed after issue 23663 is solved.
36.128 + new EventTool().waitNoEvent(500);
36.129 +// mdk MainWindowOperator.getDefault().menuBar().pushMenuNoBlock(menuPath, "|");
36.130 + Util.getMainMenu().pushMenuNoBlock(menuPath, "|");
36.131 + try {
36.132 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
36.133 + } catch (Exception e) {
36.134 + throw new JemmyException("Sleeping interrupted", e);
36.135 + }
36.136 + }
36.137 +
36.138 + /** performs action through popup menu
36.139 + * @param nodes nodes to be action performed on
36.140 + * @throws UnsupportedOperationException when action does not support popup mode */
36.141 + public void performPopup(Node[] nodes) {
36.142 + if (popupPath==null)
36.143 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
36.144 + testNodes(nodes);
36.145 + TreePath paths[]=new TreePath[nodes.length];
36.146 + for (int i=0; i<nodes.length; i++) {
36.147 + paths[i]=nodes[i].getTreePath();
36.148 + }
36.149 + Operator.ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
36.150 + Operator.ComponentVisualizer oldVisualizer = null;
36.151 + // If visualizer of JTreeOperator is EmptyVisualizer, we need
36.152 + // to avoid making tree component visible in callPopup method.
36.153 + // So far only known case is tree from TreeTableOperator.
36.154 + if(treeVisualizer instanceof EmptyVisualizer) {
36.155 + oldVisualizer = Operator.getDefaultComponentVisualizer();
36.156 + Operator.setDefaultComponentVisualizer(treeVisualizer);
36.157 + }
36.158 + // Need to wait here to be more reliable.
36.159 + // TBD - It can be removed after issue 23663 is solved.
36.160 + new EventTool().waitNoEvent(500);
36.161 + JPopupMenuOperator popup = new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
36.162 + // restore previously used default visualizer
36.163 + if(oldVisualizer != null) {
36.164 + Operator.setDefaultComponentVisualizer(oldVisualizer);
36.165 + }
36.166 + popup.setComparator(getComparator());
36.167 + popup.pushMenuNoBlock(popupPath, "|");
36.168 + try {
36.169 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
36.170 + } catch (Exception e) {
36.171 + throw new JemmyException("Sleeping interrupted", e);
36.172 + }
36.173 + }
36.174 +
36.175 + /** performs action through popup menu
36.176 + * @param component component to be action performed on
36.177 + * @throws UnsupportedOperationException when action does not support popup mode */
36.178 + public void performPopup(ComponentOperator component) {
36.179 + if (popupPath==null)
36.180 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
36.181 + // Need to wait here to be more reliable.
36.182 + // TBD - It can be removed after issue 23663 is solved.
36.183 + new EventTool().waitNoEvent(500);
36.184 + component.clickForPopup();
36.185 + JPopupMenuOperator popup=new JPopupMenuOperator(component);
36.186 + popup.setComparator(getComparator());
36.187 + popup.pushMenuNoBlock(popupPath, "|");
36.188 + try {
36.189 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
36.190 + } catch (Exception e) {
36.191 + throw new JemmyException("Sleeping interrupted", e);
36.192 + }
36.193 + }
36.194 +
36.195 + /** performs action through API
36.196 + * @throws UnsupportedOperationException when action does not support API mode */
36.197 + public void performAPI() {
36.198 + if (systemActionClass==null) {
36.199 + throw new UnsupportedOperationException(getClass().toString()+" does not define SystemAction");
36.200 + }
36.201 + new Thread(new Runnable() {
36.202 + public void run() {
36.203 + try {
36.204 + // Actions have to be invoked in dispatch thread
36.205 + // (see http://www.netbeans.org/issues/show_bug.cgi?id=35755)
36.206 + EventQueue.invokeAndWait(new Runnable() {
36.207 + public void run() {
36.208 + SystemAction.get(systemActionClass).actionPerformed(
36.209 + new ActionEvent(new Container(), 0, null));
36.210 + }
36.211 + });
36.212 + } catch (Exception e) {
36.213 + throw new JemmyException("Exception while performing action in dispatch thread", e);
36.214 + }
36.215 + }
36.216 + }, "thread performing action through API").start();
36.217 + try {
36.218 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
36.219 + } catch (Exception e) {
36.220 + throw new JemmyException("Interrupted", e);
36.221 + }
36.222 + }
36.223 +
36.224 + /** performs action through shortcut
36.225 + * @throws UnsupportedOperationException when action does not support shortcut mode */
36.226 + public void performShortcut() {
36.227 + if (shortcuts == null) {
36.228 + throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
36.229 + }
36.230 + new Thread(new Runnable() {
36.231 + public void run() {
36.232 + for(int i=0; i<shortcuts.length; i++) {
36.233 + new KeyRobotDriver(null).pushKey(null, shortcuts[i].getKeyCode(), shortcuts[i].getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
36.234 + JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
36.235 + }
36.236 + }
36.237 + }, "thread performing action through shortcut").start();
36.238 + try {
36.239 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
36.240 + } catch (Exception e) {
36.241 + throw new JemmyException("Sleeping interrupted", e);
36.242 + }
36.243 + }
36.244 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/BuildProjectAction.java Thu Jul 10 04:32:50 2008 -0700
37.3 @@ -0,0 +1,60 @@
37.4 +/*
37.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
37.6 + *
37.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
37.8 + *
37.9 + * The contents of this file are subject to the terms of either the GNU
37.10 + * General Public License Version 2 only ("GPL") or the Common
37.11 + * Development and Distribution License("CDDL") (collectively, the
37.12 + * "License"). You may not use this file except in compliance with the
37.13 + * License. You can obtain a copy of the License at
37.14 + * http://www.netbeans.org/cddl-gplv2.html
37.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
37.16 + * specific language governing permissions and limitations under the
37.17 + * License. When distributing the software, include this License Header
37.18 + * Notice in each file and include the License file at
37.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
37.20 + * particular file as subject to the "Classpath" exception as provided
37.21 + * by Sun in the GPL Version 2 section of the License file that
37.22 + * accompanied this code. If applicable, add the following below the
37.23 + * License Header, with the fields enclosed by brackets [] replaced by
37.24 + * your own identifying information:
37.25 + * "Portions Copyrighted [year] [name of copyright owner]"
37.26 + *
37.27 + * Contributor(s):
37.28 + *
37.29 + * The Original Software is NetBeans. The Initial Developer of the Original
37.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
37.31 + * Microsystems, Inc. All Rights Reserved.
37.32 + *
37.33 + * If you wish your version of this file to be governed by only the CDDL
37.34 + * or only the GPL Version 2, indicate your decision by adding
37.35 + * "[Contributor] elects to include this software in this distribution
37.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
37.37 + * single choice of license, a recipient has the option to distribute
37.38 + * your version of this file under either the CDDL, the GPL Version 2 or
37.39 + * to extend the choice of license to its licensees as provided above.
37.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
37.41 + * Version 2 license, then the option applies only if the new code is
37.42 + * made subject to such option by the copyright holder.
37.43 + */
37.44 +
37.45 +package org.netbeans.modules.visualweb.gravy.actions;
37.46 +
37.47 +import org.netbeans.jellytools.Bundle;
37.48 +
37.49 +/** Used to call Build Project popup menu, "Run|Build Main Project" main menu item
37.50 + * "org.openide.actions.BuildProjectAction" or Ctrl+Shift+B shortcut.
37.51 + * @see Action
37.52 + * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
37.53 +public class BuildProjectAction extends Action{
37.54 + private static final String menuString = Bundle.getStringTrimmed("org.netbeans.core.Bundle","Menu/Run")
37.55 + + "|"+Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle","LBL_BuildMainProjectAction_Name");
37.56 + private static final String popup = Bundle.getString("com.sun.rave.project.actions.Bundle",
37.57 + "LBL_BuildProject");
37.58 + private static final Action.Shortcut shortcut = null;
37.59 +
37.60 + public BuildProjectAction() {
37.61 + super(menuString, popup, null, shortcut);
37.62 + }
37.63 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/CloseProjectAction.java Thu Jul 10 04:32:50 2008 -0700
38.3 @@ -0,0 +1,61 @@
38.4 +/*
38.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
38.6 + *
38.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
38.8 + *
38.9 + * The contents of this file are subject to the terms of either the GNU
38.10 + * General Public License Version 2 only ("GPL") or the Common
38.11 + * Development and Distribution License("CDDL") (collectively, the
38.12 + * "License"). You may not use this file except in compliance with the
38.13 + * License. You can obtain a copy of the License at
38.14 + * http://www.netbeans.org/cddl-gplv2.html
38.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
38.16 + * specific language governing permissions and limitations under the
38.17 + * License. When distributing the software, include this License Header
38.18 + * Notice in each file and include the License file at
38.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
38.20 + * particular file as subject to the "Classpath" exception as provided
38.21 + * by Sun in the GPL Version 2 section of the License file that
38.22 + * accompanied this code. If applicable, add the following below the
38.23 + * License Header, with the fields enclosed by brackets [] replaced by
38.24 + * your own identifying information:
38.25 + * "Portions Copyrighted [year] [name of copyright owner]"
38.26 + *
38.27 + * Contributor(s):
38.28 + *
38.29 + * The Original Software is NetBeans. The Initial Developer of the Original
38.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
38.31 + * Microsystems, Inc. All Rights Reserved.
38.32 + *
38.33 + * If you wish your version of this file to be governed by only the CDDL
38.34 + * or only the GPL Version 2, indicate your decision by adding
38.35 + * "[Contributor] elects to include this software in this distribution
38.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
38.37 + * single choice of license, a recipient has the option to distribute
38.38 + * your version of this file under either the CDDL, the GPL Version 2 or
38.39 + * to extend the choice of license to its licensees as provided above.
38.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
38.41 + * Version 2 license, then the option applies only if the new code is
38.42 + * made subject to such option by the copyright holder.
38.43 + */
38.44 +
38.45 +package org.netbeans.modules.visualweb.gravy.actions;
38.46 +
38.47 +import org.netbeans.jellytools.Bundle;
38.48 +
38.49 +import java.awt.event.KeyEvent;
38.50 +/** Used to call "Close Project" popup menu item,
38.51 + * or File/Close Project menu,
38.52 + * or CTRL-W shortcut.
38.53 + * @see Action
38.54 + * @author Alexey.Butenko@sun.com
38.55 + */
38.56 +public class CloseProjectAction extends Action {
38.57 + private static final String closePopup = "Close";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete");
38.58 + private static final String closeMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + closePopup;
38.59 + private static final Shortcut closeShortcut = new Shortcut(KeyEvent.VK_W, KeyEvent.CTRL_MASK);
38.60 +
38.61 + public CloseProjectAction(){
38.62 + super(closeMenu, closePopup, null, closeShortcut);
38.63 + }
38.64 +}
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/DeleteAction.java Thu Jul 10 04:32:50 2008 -0700
39.3 @@ -0,0 +1,104 @@
39.4 +/*
39.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
39.6 + *
39.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
39.8 + *
39.9 + * The contents of this file are subject to the terms of either the GNU
39.10 + * General Public License Version 2 only ("GPL") or the Common
39.11 + * Development and Distribution License("CDDL") (collectively, the
39.12 + * "License"). You may not use this file except in compliance with the
39.13 + * License. You can obtain a copy of the License at
39.14 + * http://www.netbeans.org/cddl-gplv2.html
39.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
39.16 + * specific language governing permissions and limitations under the
39.17 + * License. When distributing the software, include this License Header
39.18 + * Notice in each file and include the License file at
39.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
39.20 + * particular file as subject to the "Classpath" exception as provided
39.21 + * by Sun in the GPL Version 2 section of the License file that
39.22 + * accompanied this code. If applicable, add the following below the
39.23 + * License Header, with the fields enclosed by brackets [] replaced by
39.24 + * your own identifying information:
39.25 + * "Portions Copyrighted [year] [name of copyright owner]"
39.26 + *
39.27 + * Contributor(s):
39.28 + *
39.29 + * The Original Software is NetBeans. The Initial Developer of the Original
39.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
39.31 + * Microsystems, Inc. All Rights Reserved.
39.32 + *
39.33 + * If you wish your version of this file to be governed by only the CDDL
39.34 + * or only the GPL Version 2, indicate your decision by adding
39.35 + * "[Contributor] elects to include this software in this distribution
39.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
39.37 + * single choice of license, a recipient has the option to distribute
39.38 + * your version of this file under either the CDDL, the GPL Version 2 or
39.39 + * to extend the choice of license to its licensees as provided above.
39.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
39.41 + * Version 2 license, then the option applies only if the new code is
39.42 + * made subject to such option by the copyright holder.
39.43 + */
39.44 +
39.45 +package org.netbeans.modules.visualweb.gravy.actions;
39.46 +
39.47 +
39.48 +import org.netbeans.jellytools.Bundle;
39.49 +import org.netbeans.modules.visualweb.gravy.nodes.Node;
39.50 +import javax.swing.tree.TreePath;
39.51 +import org.netbeans.jemmy.EventTool;
39.52 +import org.netbeans.jemmy.JemmyException;
39.53 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
39.54 +import org.netbeans.jemmy.operators.Operator;
39.55 +import org.netbeans.jemmy.operators.Operator.ComponentVisualizer;
39.56 +import org.netbeans.jemmy.util.EmptyVisualizer;
39.57 +
39.58 +import java.awt.event.KeyEvent;
39.59 +
39.60 +/** Used to call "Delete" popup menu item,
39.61 + * "org.openide.actions.SaveAction" or DEL shortcut.
39.62 + * @see Action
39.63 + * @author Alexey.Butenko@sun.com
39.64 + */
39.65 +public class DeleteAction extends Action {
39.66 + private static final String deletePopup = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete");
39.67 + private static final String deleteMenu = null; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
39.68 + private static final Shortcut deleteShortcut = new Shortcut(KeyEvent.VK_DELETE);
39.69 +
39.70 + public DeleteAction(){
39.71 + super(deleteMenu, deletePopup, "org.openide.actions.DeleteAction", deleteShortcut);
39.72 + }
39.73 +
39.74 + public void performPopup(Node[] nodes) {
39.75 + if (popupPath==null) {
39.76 + throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
39.77 + }
39.78 + testNodes(nodes);
39.79 + TreePath paths[]=new TreePath[nodes.length];
39.80 + for (int i=0; i<nodes.length; i++) {
39.81 + paths[i]=nodes[i].getTreePath();
39.82 + }
39.83 + ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
39.84 + ComponentVisualizer oldVisualizer = null;
39.85 + // If visualizer of JTreeOperator is EmptyVisualizer, we need
39.86 + // to avoid making tree component visible in callPopup method.
39.87 + // So far only known case is tree from TreeTableOperator.
39.88 + if(treeVisualizer instanceof EmptyVisualizer) {
39.89 + oldVisualizer = Operator.getDefaultComponentVisualizer();
39.90 + Operator.setDefaultComponentVisualizer(treeVisualizer);
39.91 + }
39.92 + // Need to wait here to be more reliable.
39.93 + // TBD - It can be removed after issue 23663 is solved.
39.94 + new EventTool().waitNoEvent(500);
39.95 + JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
39.96 + // restore previously used default visualizer
39.97 + if(oldVisualizer != null) {
39.98 + Operator.setDefaultComponentVisualizer(oldVisualizer);
39.99 + }
39.100 + popup.pushMenuNoBlock(popupPath, "|", getComparator());
39.101 + try {
39.102 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
39.103 + } catch (Exception e) {
39.104 + throw new JemmyException("Sleeping interrupted", e);
39.105 + }
39.106 + }
39.107 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/FindAction.java Thu Jul 10 04:32:50 2008 -0700
40.3 @@ -0,0 +1,82 @@
40.4 +/*
40.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
40.6 + *
40.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
40.8 + *
40.9 + * The contents of this file are subject to the terms of either the GNU
40.10 + * General Public License Version 2 only ("GPL") or the Common
40.11 + * Development and Distribution License("CDDL") (collectively, the
40.12 + * "License"). You may not use this file except in compliance with the
40.13 + * License. You can obtain a copy of the License at
40.14 + * http://www.netbeans.org/cddl-gplv2.html
40.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
40.16 + * specific language governing permissions and limitations under the
40.17 + * License. When distributing the software, include this License Header
40.18 + * Notice in each file and include the License file at
40.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
40.20 + * particular file as subject to the "Classpath" exception as provided
40.21 + * by Sun in the GPL Version 2 section of the License file that
40.22 + * accompanied this code. If applicable, add the following below the
40.23 + * License Header, with the fields enclosed by brackets [] replaced by
40.24 + * your own identifying information:
40.25 + * "Portions Copyrighted [year] [name of copyright owner]"
40.26 + *
40.27 + * Contributor(s):
40.28 + *
40.29 + * The Original Software is NetBeans. The Initial Developer of the Original
40.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
40.31 + * Microsystems, Inc. All Rights Reserved.
40.32 + *
40.33 + * If you wish your version of this file to be governed by only the CDDL
40.34 + * or only the GPL Version 2, indicate your decision by adding
40.35 + * "[Contributor] elects to include this software in this distribution
40.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
40.37 + * single choice of license, a recipient has the option to distribute
40.38 + * your version of this file under either the CDDL, the GPL Version 2 or
40.39 + * to extend the choice of license to its licensees as provided above.
40.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
40.41 + * Version 2 license, then the option applies only if the new code is
40.42 + * made subject to such option by the copyright holder.
40.43 + */
40.44 +
40.45 +package org.netbeans.modules.visualweb.gravy.actions;
40.46 +
40.47 +import org.netbeans.modules.visualweb.gravy.Util;
40.48 +import org.netbeans.jellytools.Bundle;
40.49 +
40.50 +import java.awt.event.KeyEvent;
40.51 +import org.netbeans.jemmy.JemmyException;
40.52 +import org.netbeans.jemmy.JemmyProperties;
40.53 +import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
40.54 +
40.55 +/** Used to call "Edit|Find" main menu item or Ctrl+F shortcut.
40.56 + * @see Action
40.57 + * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
40.58 +public class FindAction extends Action{
40.59 + private static final String findPopup = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Find");
40.60 + private static final String findMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Edit") + "|" + findPopup;
40.61 + private static final Action.Shortcut findShortcut = Util.isMacOS() ?
40.62 + new Action.Shortcut(KeyEvent.VK_F, KeyEvent.META_MASK) : new Action.Shortcut(KeyEvent.VK_F, KeyEvent.CTRL_MASK);
40.63 + /** Creates a new instance of FindAction */
40.64 + public FindAction() {
40.65 + super(findMenu, findPopup, "org.openide.actions.FindAction", findShortcut);
40.66 + }
40.67 +
40.68 + /** performs action through shortcut
40.69 + * @throws UnsupportedOperationException if no shortcut is defined */
40.70 + public void performShortcut() {
40.71 + if (shortcuts == null) {
40.72 + throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
40.73 + }
40.74 + for(int i=0; i<shortcuts.length; i++) {
40.75 + new KeyRobotDriver(null).pushKey(null, findShortcut.getKeyCode(), findShortcut.getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
40.76 + JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
40.77 + }
40.78 + try {
40.79 + Thread.sleep(AFTER_ACTION_WAIT_TIME);
40.80 + } catch (Exception e) {
40.81 + throw new JemmyException("Sleeping interrupted", e);
40.82 + }
40.83 + }
40.84 +
40.85 +}
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/HelpAction.java Thu Jul 10 04:32:50 2008 -0700
41.3 @@ -0,0 +1,83 @@
41.4 +/*
41.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
41.6 + *
41.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
41.8 + *
41.9 + * The contents of this file are subject to the terms of either the GNU
41.10 + * General Public License Version 2 only ("GPL") or the Common
41.11 + * Development and Distribution License("CDDL") (collectively, the
41.12 + * "License"). You may not use this file except in compliance with the
41.13 + * License. You can obtain a copy of the License at
41.14 + * http://www.netbeans.org/cddl-gplv2.html
41.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
41.16 + * specific language governing permissions and limitations under the
41.17 + * License. When distributing the software, include this License Header
41.18 + * Notice in each file and include the License file at
41.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
41.20 + * particular file as subject to the "Classpath" exception as provided
41.21 + * by Sun in the GPL Version 2 section of the License file that
41.22 + * accompanied this code. If applicable, add the following below the
41.23 + * License Header, with the fields enclosed by brackets [] replaced by
41.24 + * your own identifying information:
41.25 + * "Portions Copyrighted [year] [name of copyright owner]"
41.26 + *
41.27 + * Contributor(s):
41.28 + *
41.29 + * The Original Software is NetBeans. The Initial Developer of the Original
41.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
41.31 + * Microsystems, Inc. All Rights Reserved.
41.32 + *
41.33 + * If you wish your version of this file to be governed by only the CDDL
41.34 + * or only the GPL Version 2, indicate your decision by adding
41.35 + * "[Contributor] elects to include this software in this distribution
41.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
41.37 + * single choice of license, a recipient has the option to distribute
41.38 + * your version of this file under either the CDDL, the GPL Version 2 or
41.39 + * to extend the choice of license to its licensees as provided above.
41.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
41.41 + * Version 2 license, then the option applies only if the new code is
41.42 + * made subject to such option by the copyright holder.
41.43 + */
41.44 +
41.45 +package org.netbeans.modules.visualweb.gravy.actions;
41.46 +
41.47 +import java.awt.event.KeyEvent;
41.48 +
41.49 +import org.netbeans.jellytools.Bundle;
41.50 +
41.51 +/** Used to call "Help|Contents" or "Help|Help Sets|{help_set} main menu item,
41.52 + * "org.openide.actions.HelpAction" or F1 shortcut. It can also be used
41.53 + * to invoke help on a property sheet from popup menu.
41.54 + * @see Action
41.55 + * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
41.56 +public class HelpAction extends Action {
41.57 +
41.58 + // String used in property sheets
41.59 + private static final String popupPath =
41.60 + Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_Help");
41.61 + private static final String helpMenu =
41.62 + Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Help");
41.63 +/* mdk - Help|Core IDE Help
41.64 + private static final String helpMenu =
41.65 + Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Help") + "|" +
41.66 + Bundle.getStringTrimmed("org.netbeans.modules.usersguide.Bundle", "Menu/Help/org-netbeans-modules-usersguide-master.xml");
41.67 +*/
41.68 + private static final String helpSetsMenu =
41.69 + Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Help") + "|" +
41.70 + Bundle.getStringTrimmed("org.netbeans.modules.javahelp.resources.Bundle", "Menu/Help/HelpShortcuts") + "|";
41.71 + private static final Shortcut helpShortcut = new Shortcut(KeyEvent.VK_F1);
41.72 +
41.73 + /** Creates new HelpAction instance for specific help set.
41.74 + * @param helpSet menu item of help set to be showed (e.g. "Core IDE Help")
41.75 + */
41.76 + public HelpAction(String helpSet) {
41.77 + super(helpSetsMenu + helpSet, null);
41.78 + }
41.79 +
41.80 + /** Creates new HelpAction instance for master help set (Help|Contents)
41.81 + * or for generic use e.g. in property sheets.
41.82 + */
41.83 + public HelpAction() {
41.84 + super(helpMenu, popupPath, "org.openide.actions.HelpAction", helpShortcut);
41.85 + }
41.86 +}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/OptionsViewAction.java Thu Jul 10 04:32:50 2008 -0700
42.3 @@ -0,0 +1,63 @@
42.4 +/*
42.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
42.6 + *
42.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
42.8 + *
42.9 + * The contents of this file are subject to the terms of either the GNU
42.10 + * General Public License Version 2 only ("GPL") or the Common
42.11 + * Development and Distribution License("CDDL") (collectively, the
42.12 + * "License"). You may not use this file except in compliance with the
42.13 + * License. You can obtain a copy of the License at
42.14 + * http://www.netbeans.org/cddl-gplv2.html
42.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
42.16 + * specific language governing permissions and limitations under the
42.17 + * License. When distributing the software, include this License Header
42.18 + * Notice in each file and include the License file at
42.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
42.20 + * particular file as subject to the "Classpath" exception as provided
42.21 + * by Sun in the GPL Version 2 section of the License file that
42.22 + * accompanied this code. If applicable, add the following below the
42.23 + * License Header, with the fields enclosed by brackets [] replaced by
42.24 + * your own identifying information:
42.25 + * "Portions Copyrighted [year] [name of copyright owner]"
42.26 + *
42.27 + * Contributor(s):
42.28 + *
42.29 + * The Original Software is NetBeans. The Initial Developer of the Original
42.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
42.31 + * Microsystems, Inc. All Rights Reserved.
42.32 + *
42.33 + * If you wish your version of this file to be governed by only the CDDL
42.34 + * or only the GPL Version 2, indicate your decision by adding
42.35 + * "[Contributor] elects to include this software in this distribution
42.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
42.37 + * single choice of license, a recipient has the option to distribute
42.38 + * your version of this file under either the CDDL, the GPL Version 2 or
42.39 + * to extend the choice of license to its licensees as provided above.
42.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
42.41 + * Version 2 license, then the option applies only if the new code is
42.42 + * made subject to such option by the copyright holder.
42.43 + */
42.44 +
42.45 +package org.netbeans.modules.visualweb.gravy.actions;
42.46 +
42.47 +import java.awt.event.KeyEvent;
42.48 +import org.netbeans.jellytools.Bundle;
42.49 +
42.50 +/** Used to call "Tools|Options" main menu item or
42.51 + * "org.netbeans.core.actions.OptionsAction".
42.52 + * @see Action
42.53 + */
42.54 +public class OptionsViewAction extends Action {
42.55 + private static final String menu =
42.56 + Bundle.getStringTrimmed("org.netbeans.core.Bundle",
42.57 + "Menu/Tools") +
42.58 + "|" +
42.59 + Bundle.getStringTrimmed("org.netbeans.core.actions.Bundle",
42.60 + "Options");
42.61 +
42.62 + /** Creates new instance. */
42.63 + public OptionsViewAction() {
42.64 + super(menu, null, "org.netbeans.core.actions.OptionsAction");
42.65 + }
42.66 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/PropertiesAction.java Thu Jul 10 04:32:50 2008 -0700
43.3 @@ -0,0 +1,62 @@
43.4 +/*
43.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
43.6 + *
43.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
43.8 + *
43.9 + * The contents of this file are subject to the terms of either the GNU
43.10 + * General Public License Version 2 only ("GPL") or the Common
43.11 + * Development and Distribution License("CDDL") (collectively, the
43.12 + * "License"). You may not use this file except in compliance with the
43.13 + * License. You can obtain a copy of the License at
43.14 + * http://www.netbeans.org/cddl-gplv2.html
43.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
43.16 + * specific language governing permissions and limitations under the
43.17 + * License. When distributing the software, include this License Header
43.18 + * Notice in each file and include the License file at
43.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
43.20 + * particular file as subject to the "Classpath" exception as provided
43.21 + * by Sun in the GPL Version 2 section of the License file that
43.22 + * accompanied this code. If applicable, add the following below the
43.23 + * License Header, with the fields enclosed by brackets [] replaced by
43.24 + * your own identifying information:
43.25 + * "Portions Copyrighted [year] [name of copyright owner]"
43.26 + *
43.27 + * Contributor(s):
43.28 + *
43.29 + * The Original Software is NetBeans. The Initial Developer of the Original
43.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
43.31 + * Microsystems, Inc. All Rights Reserved.
43.32 + *
43.33 + * If you wish your version of this file to be governed by only the CDDL
43.34 + * or only the GPL Version 2, indicate your decision by adding
43.35 + * "[Contributor] elects to include this software in this distribution
43.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
43.37 + * single choice of license, a recipient has the option to distribute
43.38 + * your version of this file under either the CDDL, the GPL Version 2 or
43.39 + * to extend the choice of license to its licensees as provided above.
43.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
43.41 + * Version 2 license, then the option applies only if the new code is
43.42 + * made subject to such option by the copyright holder.
43.43 + */
43.44 +
43.45 +package org.netbeans.modules.visualweb.gravy.actions;
43.46 +
43.47 +import java.awt.event.KeyEvent;
43.48 +import org.netbeans.jellytools.Bundle;
43.49 +
43.50 +/** Used to call "Properties" popup menu item, "View|Properties" main menu item,
43.51 + * "org.openide.actions.PropertiesAction" or Ctrl+1 shortcut.
43.52 + * @see Action
43.53 + * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
43.54 +public class PropertiesAction extends Action {
43.55 +
43.56 + private static final String propertiesPopup = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Properties");
43.57 + private static final String propertiesMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Window")
43.58 + + "|" + propertiesPopup;
43.59 + private static final Shortcut propertiesShortcut = new Shortcut(KeyEvent.VK_1, KeyEvent.CTRL_MASK);
43.60 +
43.61 + /** creates new PropertiesAction instance */
43.62 + public PropertiesAction() {
43.63 + super(propertiesMenu, propertiesPopup, "org.openide.actions.PropertiesAction", propertiesShortcut);
43.64 + }
43.65 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/SaveAction.java Thu Jul 10 04:32:50 2008 -0700
44.3 @@ -0,0 +1,80 @@
44.4 +/*
44.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
44.6 + *
44.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
44.8 + *
44.9 + * The contents of this file are subject to the terms of either the GNU
44.10 + * General Public License Version 2 only ("GPL") or the Common
44.11 + * Development and Distribution License("CDDL") (collectively, the
44.12 + * "License"). You may not use this file except in compliance with the
44.13 + * License. You can obtain a copy of the License at
44.14 + * http://www.netbeans.org/cddl-gplv2.html
44.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
44.16 + * specific language governing permissions and limitations under the
44.17 + * License. When distributing the software, include this License Header
44.18 + * Notice in each file and include the License file at
44.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
44.20 + * particular file as subject to the "Classpath" exception as provided
44.21 + * by Sun in the GPL Version 2 section of the License file that
44.22 + * accompanied this code. If applicable, add the following below the
44.23 + * License Header, with the fields enclosed by brackets [] replaced by
44.24 + * your own identifying information:
44.25 + * "Portions Copyrighted [year] [name of copyright owner]"
44.26 + *
44.27 + * Contributor(s):
44.28 + *
44.29 + * The Original Software is NetBeans. The Initial Developer of the Original
44.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
44.31 + * Microsystems, Inc. All Rights Reserved.
44.32 + *
44.33 + * If you wish your version of this file to be governed by only the CDDL
44.34 + * or only the GPL Version 2, indicate your decision by adding
44.35 + * "[Contributor] elects to include this software in this distribution
44.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
44.37 + * single choice of license, a recipient has the option to distribute
44.38 + * your version of this file under either the CDDL, the GPL Version 2 or
44.39 + * to extend the choice of license to its licensees as provided above.
44.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
44.41 + * Version 2 license, then the option applies only if the new code is
44.42 + * made subject to such option by the copyright holder.
44.43 + */
44.44 +
44.45 +package org.netbeans.modules.visualweb.gravy.actions;
44.46 +
44.47 +import java.awt.event.KeyEvent;
44.48 +import org.netbeans.jellytools.Bundle;
44.49 +import org.netbeans.modules.visualweb.gravy.nodes.Node;
44.50 +
44.51 +/** Used to call "Save" popup menu item, "File|Save" main menu item,
44.52 + * "org.openide.actions.SaveAction" or Ctrl+S shortcut.
44.53 + * @see Action
44.54 + * @author Jiri.Skrivanek@sun.com
44.55 + */
44.56 +public class SaveAction extends Action {
44.57 +
44.58 + private static final String savePopup = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Save"); by ois
44.59 + private static final String saveMenu = ""; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
44.60 + private static final Shortcut saveShortcut = new Shortcut(KeyEvent.VK_S, KeyEvent.CTRL_MASK);
44.61 +
44.62 + /** Creates new SaveAction instance. */
44.63 + public SaveAction() {
44.64 + super(saveMenu, savePopup, "org.openide.actions.SaveAction", saveShortcut);
44.65 + }
44.66 +
44.67 + /** Throws UnsupportedOperationException because SaveAction doesn't have
44.68 + * popup representation on nodes.
44.69 + * @param nodes array of nodes
44.70 + */
44.71 + public void performPopup(Node[] nodes) {
44.72 + throw new UnsupportedOperationException("SaveAction doesn't have popup representation on node.");
44.73 + }
44.74 +
44.75 + /** Throws UnsupportedOperationException because SaveAction doesn't have
44.76 + * popup representation on node.
44.77 + * @param node a node
44.78 + */
44.79 + public void performPopup(Node node) {
44.80 + throw new UnsupportedOperationException("SaveAction doesn't have popup representation on node.");
44.81 + }
44.82 +
44.83 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/ShowDescriptionAreaAction.java Thu Jul 10 04:32:50 2008 -0700
45.3 @@ -0,0 +1,58 @@
45.4 +/*
45.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
45.6 + *
45.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
45.8 + *
45.9 + * The contents of this file are subject to the terms of either the GNU
45.10 + * General Public License Version 2 only ("GPL") or the Common
45.11 + * Development and Distribution License("CDDL") (collectively, the
45.12 + * "License"). You may not use this file except in compliance with the
45.13 + * License. You can obtain a copy of the License at
45.14 + * http://www.netbeans.org/cddl-gplv2.html
45.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
45.16 + * specific language governing permissions and limitations under the
45.17 + * License. When distributing the software, include this License Header
45.18 + * Notice in each file and include the License file at
45.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
45.20 + * particular file as subject to the "Classpath" exception as provided
45.21 + * by Sun in the GPL Version 2 section of the License file that
45.22 + * accompanied this code. If applicable, add the following below the
45.23 + * License Header, with the fields enclosed by brackets [] replaced by
45.24 + * your own identifying information:
45.25 + * "Portions Copyrighted [year] [name of copyright owner]"
45.26 + *
45.27 + * Contributor(s):
45.28 + *
45.29 + * The Original Software is NetBeans. The Initial Developer of the Original
45.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
45.31 + * Microsystems, Inc. All Rights Reserved.
45.32 + *
45.33 + * If you wish your version of this file to be governed by only the CDDL
45.34 + * or only the GPL Version 2, indicate your decision by adding
45.35 + * "[Contributor] elects to include this software in this distribution
45.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
45.37 + * single choice of license, a recipient has the option to distribute
45.38 + * your version of this file under either the CDDL, the GPL Version 2 or
45.39 + * to extend the choice of license to its licensees as provided above.
45.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
45.41 + * Version 2 license, then the option applies only if the new code is
45.42 + * made subject to such option by the copyright holder.
45.43 + */
45.44 +
45.45 +package org.netbeans.modules.visualweb.gravy.actions;
45.46 +
45.47 +import org.netbeans.jellytools.Bundle;
45.48 +
45.49 +/** Used to call "Show Description Area" popup menu item on a property sheet.
45.50 + * @see Action
45.51 + * @author Jiri.Skrivanek@sun.com
45.52 + */
45.53 +public class ShowDescriptionAreaAction extends Action {
45.54 +
45.55 + private static final String popupPath = Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_ShowDescription");
45.56 +
45.57 + /** creates new ShowDescriptionAreaAction instance */
45.58 + public ShowDescriptionAreaAction() {
45.59 + super(null, popupPath);
45.60 + }
45.61 +}
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/ShowFilesAction.java Thu Jul 10 04:32:50 2008 -0700
46.3 @@ -0,0 +1,66 @@
46.4 +/*
46.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
46.6 + *
46.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
46.8 + *
46.9 + * The contents of this file are subject to the terms of either the GNU
46.10 + * General Public License Version 2 only ("GPL") or the Common
46.11 + * Development and Distribution License("CDDL") (collectively, the
46.12 + * "License"). You may not use this file except in compliance with the
46.13 + * License. You can obtain a copy of the License at
46.14 + * http://www.netbeans.org/cddl-gplv2.html
46.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
46.16 + * specific language governing permissions and limitations under the
46.17 + * License. When distributing the software, include this License Header
46.18 + * Notice in each file and include the License file at
46.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
46.20 + * particular file as subject to the "Classpath" exception as provided
46.21 + * by Sun in the GPL Version 2 section of the License file that
46.22 + * accompanied this code. If applicable, add the following below the
46.23 + * License Header, with the fields enclosed by brackets [] replaced by
46.24 + * your own identifying information:
46.25 + * "Portions Copyrighted [year] [name of copyright owner]"
46.26 + *
46.27 + * Contributor(s):
46.28 + *
46.29 + * The Original Software is NetBeans. The Initial Developer of the Original
46.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
46.31 + * Microsystems, Inc. All Rights Reserved.
46.32 + *
46.33 + * If you wish your version of this file to be governed by only the CDDL
46.34 + * or only the GPL Version 2, indicate your decision by adding
46.35 + * "[Contributor] elects to include this software in this distribution
46.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
46.37 + * single choice of license, a recipient has the option to distribute
46.38 + * your version of this file under either the CDDL, the GPL Version 2 or
46.39 + * to extend the choice of license to its licensees as provided above.
46.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
46.41 + * Version 2 license, then the option applies only if the new code is
46.42 + * made subject to such option by the copyright holder.
46.43 + */
46.44 +
46.45 +package org.netbeans.modules.visualweb.gravy.actions;
46.46 +
46.47 +import org.netbeans.modules.visualweb.gravy.*;
46.48 +import org.netbeans.jellytools.Bundle;
46.49 +import org.netbeans.jemmy.*;
46.50 +
46.51 +/** Used to call "View|Files" main menu item or Ctrl+2 shortcut.
46.52 + * @see Action
46.53 + * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
46.54 +public class ShowFilesAction extends Action{
46.55 + private static final String popup = null;
46.56 + private static final String menuString = Bundle.getStringTrimmed("org.netbeans.core.Bundle","Menu/Window") + "|Files";
46.57 + private static final Action.Shortcut shortcut = new Action.Shortcut(java.awt.event.KeyEvent.VK_2, java.awt.event.KeyEvent.CTRL_MASK);
46.58 +
46.59 + /** creates new CopyAction instance */
46.60 + public ShowFilesAction() {
46.61 + super(menuString, popup, null, shortcut);
46.62 + }
46.63 +
46.64 + public void perform() {
46.65 + Util.getMainMenu().pushMenuNoBlock(menuString);
46.66 + new QueueTool().waitEmpty();
46.67 + Util.wait(800);
46.68 + }
46.69 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/ShowProjectsAction.java Thu Jul 10 04:32:50 2008 -0700
47.3 @@ -0,0 +1,66 @@
47.4 +/*
47.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
47.6 + *
47.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
47.8 + *
47.9 + * The contents of this file are subject to the terms of either the GNU
47.10 + * General Public License Version 2 only ("GPL") or the Common
47.11 + * Development and Distribution License("CDDL") (collectively, the
47.12 + * "License"). You may not use this file except in compliance with the
47.13 + * License. You can obtain a copy of the License at
47.14 + * http://www.netbeans.org/cddl-gplv2.html
47.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
47.16 + * specific language governing permissions and limitations under the
47.17 + * License. When distributing the software, include this License Header
47.18 + * Notice in each file and include the License file at
47.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
47.20 + * particular file as subject to the "Classpath" exception as provided
47.21 + * by Sun in the GPL Version 2 section of the License file that
47.22 + * accompanied this code. If applicable, add the following below the
47.23 + * License Header, with the fields enclosed by brackets [] replaced by
47.24 + * your own identifying information:
47.25 + * "Portions Copyrighted [year] [name of copyright owner]"
47.26 + *
47.27 + * Contributor(s):
47.28 + *
47.29 + * The Original Software is NetBeans. The Initial Developer of the Original
47.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
47.31 + * Microsystems, Inc. All Rights Reserved.
47.32 + *
47.33 + * If you wish your version of this file to be governed by only the CDDL
47.34 + * or only the GPL Version 2, indicate your decision by adding
47.35 + * "[Contributor] elects to include this software in this distribution
47.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
47.37 + * single choice of license, a recipient has the option to distribute
47.38 + * your version of this file under either the CDDL, the GPL Version 2 or
47.39 + * to extend the choice of license to its licensees as provided above.
47.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
47.41 + * Version 2 license, then the option applies only if the new code is
47.42 + * made subject to such option by the copyright holder.
47.43 + */
47.44 +
47.45 +package org.netbeans.modules.visualweb.gravy.actions;
47.46 +
47.47 +import org.netbeans.jellytools.Bundle;
47.48 +import org.netbeans.jemmy.*;
47.49 +import org.netbeans.modules.visualweb.gravy.*;
47.50 +
47.51 +/** Used to call "View|Projects" main menu item or Ctrl+1 shortcut.
47.52 + * @see Action
47.53 + * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
47.54 +public class ShowProjectsAction extends Action{
47.55 + private static final String popup = null;
47.56 + private static final String menuString = Bundle.getStringTrimmed("org.netbeans.core.windows.resources.Bundle","Menu/Window")+"|"+Bundle.getStringTrimmed("org.netbeans.modules.compapp.projects.wizard.Bundle","LBL_projectTabLogical_tc");
47.57 + private static final Action.Shortcut shortcut = new Action.Shortcut(java.awt.event.KeyEvent.VK_1, java.awt.event.KeyEvent.CTRL_MASK);
47.58 +
47.59 + /** creates new CopyAction instance */
47.60 + public ShowProjectsAction() {
47.61 + super(menuString, popup, null, shortcut);
47.62 + }
47.63 +
47.64 + public void perform() {
47.65 + Util.getMainMenu().pushMenuNoBlock(menuString);
47.66 + new QueueTool().waitEmpty();
47.67 + Util.wait(800);
47.68 + }
47.69 +}
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/SortByCategoryAction.java Thu Jul 10 04:32:50 2008 -0700
48.3 @@ -0,0 +1,58 @@
48.4 +/*
48.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
48.6 + *
48.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
48.8 + *
48.9 + * The contents of this file are subject to the terms of either the GNU
48.10 + * General Public License Version 2 only ("GPL") or the Common
48.11 + * Development and Distribution License("CDDL") (collectively, the
48.12 + * "License"). You may not use this file except in compliance with the
48.13 + * License. You can obtain a copy of the License at
48.14 + * http://www.netbeans.org/cddl-gplv2.html
48.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
48.16 + * specific language governing permissions and limitations under the
48.17 + * License. When distributing the software, include this License Header
48.18 + * Notice in each file and include the License file at
48.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
48.20 + * particular file as subject to the "Classpath" exception as provided
48.21 + * by Sun in the GPL Version 2 section of the License file that
48.22 + * accompanied this code. If applicable, add the following below the
48.23 + * License Header, with the fields enclosed by brackets [] replaced by
48.24 + * your own identifying information:
48.25 + * "Portions Copyrighted [year] [name of copyright owner]"
48.26 + *
48.27 + * Contributor(s):
48.28 + *
48.29 + * The Original Software is NetBeans. The Initial Developer of the Original
48.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
48.31 + * Microsystems, Inc. All Rights Reserved.
48.32 + *
48.33 + * If you wish your version of this file to be governed by only the CDDL
48.34 + * or only the GPL Version 2, indicate your decision by adding
48.35 + * "[Contributor] elects to include this software in this distribution
48.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
48.37 + * single choice of license, a recipient has the option to distribute
48.38 + * your version of this file under either the CDDL, the GPL Version 2 or
48.39 + * to extend the choice of license to its licensees as provided above.
48.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
48.41 + * Version 2 license, then the option applies only if the new code is
48.42 + * made subject to such option by the copyright holder.
48.43 + */
48.44 +
48.45 +package org.netbeans.modules.visualweb.gravy.actions;
48.46 +
48.47 +import org.netbeans.jellytools.Bundle;
48.48 +
48.49 +/** Used to call "Sort by Category" popup menu item on a property sheet.
48.50 + * @see Action
48.51 + * @author Jiri.Skrivanek@sun.com
48.52 + */
48.53 +public class SortByCategoryAction extends Action {
48.54 +
48.55 + private static final String popupPath = Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_NoSort");
48.56 +
48.57 + /** creates new SortByCategoryAction instance */
48.58 + public SortByCategoryAction() {
48.59 + super(null, popupPath);
48.60 + }
48.61 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/actions/SortByNameAction.java Thu Jul 10 04:32:50 2008 -0700
49.3 @@ -0,0 +1,58 @@
49.4 +/*
49.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
49.6 + *
49.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
49.8 + *
49.9 + * The contents of this file are subject to the terms of either the GNU
49.10 + * General Public License Version 2 only ("GPL") or the Common
49.11 + * Development and Distribution License("CDDL") (collectively, the
49.12 + * "License"). You may not use this file except in compliance with the
49.13 + * License. You can obtain a copy of the License at
49.14 + * http://www.netbeans.org/cddl-gplv2.html
49.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
49.16 + * specific language governing permissions and limitations under the
49.17 + * License. When distributing the software, include this License Header
49.18 + * Notice in each file and include the License file at
49.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
49.20 + * particular file as subject to the "Classpath" exception as provided
49.21 + * by Sun in the GPL Version 2 section of the License file that
49.22 + * accompanied this code. If applicable, add the following below the
49.23 + * License Header, with the fields enclosed by brackets [] replaced by
49.24 + * your own identifying information:
49.25 + * "Portions Copyrighted [year] [name of copyright owner]"
49.26 + *
49.27 + * Contributor(s):
49.28 + *
49.29 + * The Original Software is NetBeans. The Initial Developer of the Original
49.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
49.31 + * Microsystems, Inc. All Rights Reserved.
49.32 + *
49.33 + * If you wish your version of this file to be governed by only the CDDL
49.34 + * or only the GPL Version 2, indicate your decision by adding
49.35 + * "[Contributor] elects to include this software in this distribution
49.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
49.37 + * single choice of license, a recipient has the option to distribute
49.38 + * your version of this file under either the CDDL, the GPL Version 2 or
49.39 + * to extend the choice of license to its licensees as provided above.
49.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
49.41 + * Version 2 license, then the option applies only if the new code is
49.42 + * made subject to such option by the copyright holder.
49.43 + */
49.44 +
49.45 +package org.netbeans.modules.visualweb.gravy.actions;
49.46 +
49.47 +import org.netbeans.jellytools.Bundle;
49.48 +
49.49 +/** Used to call "Sort by Name" popup menu item on a property sheet.
49.50 + * @see Action
49.51 + * @author Jiri.Skrivanek@sun.com
49.52 + */
49.53 +public class SortByNameAction extends Action {
49.54 +
49.55 + private static final String popupPath = Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_AlphaSort");
49.56 +
49.57 + /** creates new SortByNameAction instance */
49.58 + public SortByNameAction() {
49.59 + super(null, popupPath);
49.60 + }
49.61 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/AddDataSourceOperator.java Thu Jul 10 04:32:50 2008 -0700
50.3 @@ -0,0 +1,246 @@
50.4 +/*
50.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
50.6 +*
50.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
50.8 +*
50.9 +* The contents of this file are subject to the terms of either the GNU
50.10 +* General Public License Version 2 only ("GPL") or the Common
50.11 +* Development and Distribution License("CDDL") (collectively, the
50.12 +* "License"). You may not use this file except in compliance with the
50.13 +* License. You can obtain a copy of the License at
50.14 +* http://www.netbeans.org/cddl-gplv2.html
50.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
50.16 +* specific language governing permissions and limitations under the
50.17 +* License. When distributing the software, include this License Header
50.18 +* Notice in each file and include the License file at
50.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
50.20 +* particular file as subject to the "Classpath" exception as provided
50.21 +* by Sun in the GPL Version 2 section of the License file that
50.22 +* accompanied this code. If applicable, add the following below the
50.23 +* License Header, with the fields enclosed by brackets [] replaced by
50.24 +* your own identifying information:
50.25 +* "Portions Copyrighted [year] [name of copyright owner]"
50.26 +*
50.27 +* Contributor(s):
50.28 +*
50.29 +* The Original Software is NetBeans. The Initial Developer of the Original
50.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
50.31 +* Microsystems, Inc. All Rights Reserved.
50.32 +*
50.33 +* If you wish your version of this file to be governed by only the CDDL
50.34 +* or only the GPL Version 2, indicate your decision by adding
50.35 +* "[Contributor] elects to include this software in this distribution
50.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
50.37 +* single choice of license, a recipient has the option to distribute
50.38 +* your version of this file under either the CDDL, the GPL Version 2 or
50.39 +* to extend the choice of license to its licensees as provided above.
50.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
50.41 +* Version 2 license, then the option applies only if the new code is
50.42 +* made subject to such option by the copyright holder.
50.43 +*/
50.44 +
50.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
50.46 +
50.47 +import org.netbeans.jemmy.operators.JButtonOperator;
50.48 +import org.netbeans.jemmy.operators.JComboBoxOperator;
50.49 +import org.netbeans.jemmy.operators.JTextFieldOperator;
50.50 +import org.netbeans.jemmy.JemmyException;
50.51 +import org.netbeans.jellytools.Bundle;
50.52 +import org.netbeans.jellytools.NbDialogOperator;
50.53 +
50.54 +/**
50.55 + * This class implements test functionality for "Add Data Source" dialog
50.56 + */
50.57 +public class AddDataSourceOperator extends NbDialogOperator{
50.58 + private JButtonOperator _btEdit, _btTestConnection, _btAdd,_btSelectTable;
50.59 + private JComboBoxOperator _cboServerType, _cboURL;
50.60 + private JTextFieldOperator _txtDSName, _txtDBName, _txtHostName,
50.61 + _txtUser, _txtPassword, _txtValidationTable;
50.62 +
50.63 + /**
50.64 + * Creates new instance of this class.
50.65 + */
50.66 + public AddDataSourceOperator(){
50.67 + super(getBundleString("New Database Connection"));
50.68 + }
50.69 +
50.70 + /**
50.71 + * Initializes (if necessary) and returns an object JButtonOperator
50.72 + * for the dialog button "Configure".
50.73 + * @return the appropriate object JButtonOperator
50.74 + */
50.75 + public JButtonOperator btEdit() {
50.76 + if (_btEdit==null) {
50.77 + _btEdit = new JButtonOperator(this, getBundleString("LBL_CONFIGURE"));
50.78 + }
50.79 + return _btEdit;
50.80 + }
50.81 +
50.82 + /**
50.83 + * Initializes (if necessary) and returns an object JButtonOperator
50.84 + * for the dialog button "Connection".
50.85 + * @return the appropriate object JButtonOperator
50.86 + */
50.87 + public JButtonOperator btTestConnection() {
50.88 + if (_btTestConnection==null) {
50.89 + _btTestConnection = new JButtonOperator(this, getBundleString("TEST_CONNECTION"));
50.90 + }
50.91 + return _btTestConnection;
50.92 + }
50.93 +
50.94 + /**
50.95 + * Initializes (if necessary) and returns an object JButtonOperator
50.96 + * for the dialog button "Add".
50.97 + * @return the appropriate object JButtonOperator
50.98 + */
50.99 + public JButtonOperator btAdd() {
50.100 + if (_btAdd==null) {
50.101 + _btAdd = new JButtonOperator(this, getBundleString("ADD"));
50.102 + }
50.103 + return _btAdd;
50.104 + }
50.105 +
50.106 + /**
50.107 + * Initializes (if necessary) and returns an object JButtonOperator
50.108 + * for the dialog button "Select".
50.109 + * @return the appropriate object JButtonOperator
50.110 + */
50.111 + public JButtonOperator btSelectTable() {
50.112 + if (_btSelectTable==null) {
50.113 + _btSelectTable = new JButtonOperator(this, getBundleString("SelectValTable_SelectBtn_label"));
50.114 + }
50.115 + return _btSelectTable;
50.116 + }
50.117 +
50.118 + /**
50.119 + * Initializes (if necessary) and returns an object JComboBoxOperator
50.120 + * for the dialog drop-down list "Server Type".
50.121 + * @return the appropriate object JComboBoxOperator
50.122 + */
50.123 + public JComboBoxOperator cboServerType() {
50.124 + if (_cboServerType==null) {
50.125 + _cboServerType = new JComboBoxOperator(this);
50.126 + }
50.127 + return _cboServerType;
50.128 + }
50.129 +
50.130 + /**
50.131 + * Initializes (if necessary) and returns an object JComboBoxOperator
50.132 + * for the dialog drop-down list "URL".
50.133 + * @return the appropriate object JComboBoxOperator
50.134 + */
50.135 + public JComboBoxOperator cboURL() {
50.136 + if (_cboURL==null) {
50.137 + _cboURL = new JComboBoxOperator(this,1);
50.138 + }
50.139 + return _cboURL;
50.140 + }
50.141 +
50.142 + /**
50.143 + * Initializes (if necessary) and returns an object JTextFieldOperator
50.144 + * for the dialog text field "Datasource Name".
50.145 + * @return the appropriate object JTextFieldOperator
50.146 + */
50.147 + public JTextFieldOperator txtDSName() {
50.148 + if (_txtDSName==null) {
50.149 + _txtDSName = new JTextFieldOperator(this, 4);
50.150 + }
50.151 + return _txtDSName;
50.152 + }
50.153 +
50.154 + /**
50.155 + * Initializes (if necessary) and returns an object JTextFieldOperator
50.156 + * for the dialog text field "Database Name".
50.157 + * @return the appropriate object JTextFieldOperator
50.158 + */
50.159 + public JTextFieldOperator txtDBName() {
50.160 + if (_txtDBName==null) {
50.161 + _txtDBName = new JTextFieldOperator(this, 0);
50.162 + }
50.163 + return _txtDBName;
50.164 + }
50.165 +
50.166 + /**
50.167 + * Initializes (if necessary) and returns an object JTextFieldOperator
50.168 + * for the dialog text field "Host Name".
50.169 + * @return the appropriate object JTextFieldOperator
50.170 + */
50.171 + public JTextFieldOperator txtHostName() {
50.172 + if (_txtHostName==null) {
50.173 + _txtHostName = new JTextFieldOperator(this, 1);
50.174 + }
50.175 + return _txtHostName;
50.176 + }
50.177 +
50.178 + /**
50.179 + * Initializes (if necessary) and returns an object JTextFieldOperator
50.180 + * for the dialog text field "User".
50.181 + * @return the appropriate object JTextFieldOperator
50.182 + */
50.183 + public JTextFieldOperator txtUser() {
50.184 + if (_txtUser==null) {
50.185 + _txtUser = new JTextFieldOperator(this, 2);
50.186 + }
50.187 + return _txtUser;
50.188 + }
50.189 +
50.190 + /**
50.191 + * Initializes (if necessary) and returns an object JTextFieldOperator
50.192 + * for the dialog text field "Password".
50.193 + * @return the appropriate object JTextFieldOperator
50.194 + */
50.195 + public JTextFieldOperator txtPassword() {
50.196 + if (_txtPassword==null) {
50.197 + _txtPassword = new JTextFieldOperator(this, 3);
50.198 + }
50.199 + return _txtPassword;
50.200 + }
50.201 +
50.202 + /**
50.203 + * Initializes (if necessary) and returns an object JTextFieldOperator
50.204 + * for the dialog text field "Validation Table".
50.205 + * @return the appropriate object JTextFieldOperator
50.206 + */
50.207 + public JTextFieldOperator txtValidationTable() {
50.208 + if (_txtValidationTable==null) {
50.209 + _txtValidationTable = new JTextFieldOperator(this, 7);
50.210 + }
50.211 + return _txtValidationTable;
50.212 + }
50.213 +
50.214 + /**
50.215 + * Initializes all necessary controls.
50.216 + */
50.217 + public void verify() {
50.218 + btOK();
50.219 + btCancel();
50.220 +// btHelp();
50.221 +// btEdit();
50.222 +// btTestConnection();
50.223 +// btSelectTable();
50.224 +// txtDSName();
50.225 +// txtDBName();
50.226 +// txtHostName();
50.227 + txtPassword();
50.228 + cboURL();
50.229 + txtUser();
50.230 +// txtValidationTable();
50.231 + cboServerType();
50.232 + }
50.233 +
50.234 + /**
50.235 + * Finds in a bundle file and returns an actual text of control component.
50.236 + * @param p_text string-key corresponding to required control component.
50.237 + * @return actual text of control component
50.238 + */
50.239 + public static String getBundleString(String p_text) {
50.240 +/* System.out.println("Getting bundle for " + p_text);
50.241 + try {
50.242 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
50.243 + } catch (JemmyException e) {}
50.244 + return null;
50.245 +*/
50.246 + //stub
50.247 + return p_text;
50.248 + }
50.249 +}
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/AddQueryCriteriaOperator.java Thu Jul 10 04:32:50 2008 -0700
51.3 @@ -0,0 +1,150 @@
51.4 +/*
51.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
51.6 +*
51.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
51.8 +*
51.9 +* The contents of this file are subject to the terms of either the GNU
51.10 +* General Public License Version 2 only ("GPL") or the Common
51.11 +* Development and Distribution License("CDDL") (collectively, the
51.12 +* "License"). You may not use this file except in compliance with the
51.13 +* License. You can obtain a copy of the License at
51.14 +* http://www.netbeans.org/cddl-gplv2.html
51.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
51.16 +* specific language governing permissions and limitations under the
51.17 +* License. When distributing the software, include this License Header
51.18 +* Notice in each file and include the License file at
51.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
51.20 +* particular file as subject to the "Classpath" exception as provided
51.21 +* by Sun in the GPL Version 2 section of the License file that
51.22 +* accompanied this code. If applicable, add the following below the
51.23 +* License Header, with the fields enclosed by brackets [] replaced by
51.24 +* your own identifying information:
51.25 +* "Portions Copyrighted [year] [name of copyright owner]"
51.26 +*
51.27 +* Contributor(s):
51.28 +*
51.29 +* The Original Software is NetBeans. The Initial Developer of the Original
51.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
51.31 +* Microsystems, Inc. All Rights Reserved.
51.32 +*
51.33 +* If you wish your version of this file to be governed by only the CDDL
51.34 +* or only the GPL Version 2, indicate your decision by adding
51.35 +* "[Contributor] elects to include this software in this distribution
51.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
51.37 +* single choice of license, a recipient has the option to distribute
51.38 +* your version of this file under either the CDDL, the GPL Version 2 or
51.39 +* to extend the choice of license to its licensees as provided above.
51.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
51.41 +* Version 2 license, then the option applies only if the new code is
51.42 +* made subject to such option by the copyright holder.
51.43 +*/
51.44 +
51.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
51.46 +
51.47 +import org.netbeans.jemmy.operators.JButtonOperator;
51.48 +import org.netbeans.jemmy.operators.JComboBoxOperator;
51.49 +import org.netbeans.jemmy.operators.JTextFieldOperator;
51.50 +import org.netbeans.jemmy.operators.JRadioButtonOperator;
51.51 +import org.netbeans.jemmy.JemmyException;
51.52 +import org.netbeans.jellytools.Bundle;
51.53 +import org.netbeans.jellytools.NbDialogOperator;
51.54 +
51.55 +/**
51.56 + * This class implements test functionality for "Add Query Criteria" dialog
51.57 + */
51.58 +public class AddQueryCriteriaOperator extends NbDialogOperator{
51.59 + private JComboBoxOperator _cboCompareType;
51.60 + private JTextFieldOperator _txtValue, _txtParameter;
51.61 + private JRadioButtonOperator _rbtValue, _rbtParameter;
51.62 +
51.63 + /**
51.64 + * Creates new instance of this class.
51.65 + */
51.66 + public AddQueryCriteriaOperator(){
51.67 + super(getBundleString("ADD_QUERY_CRITERIA_TITLE"));
51.68 + }
51.69 +
51.70 + /**
51.71 + * Initializes (if necessary) and returns an object JComboBoxOperator
51.72 + * for the dialog drop-down list "Compare Type".
51.73 + * @return the appropriate object JComboBoxOperator
51.74 + */
51.75 + public JComboBoxOperator cboCompareType() {
51.76 + if (_cboCompareType==null) {
51.77 + _cboCompareType = new JComboBoxOperator(this);
51.78 + }
51.79 + return _cboCompareType;
51.80 + }
51.81 +
51.82 + /**
51.83 + * Initializes (if necessary) and returns an object JTextFieldOperator
51.84 + * for the dialog text field "Value".
51.85 + * @return the appropriate object JTextFieldOperator
51.86 + */
51.87 + public JTextFieldOperator txtValue() {
51.88 + if (_txtValue==null) {
51.89 + _txtValue = new JTextFieldOperator(this, 0);
51.90 + }
51.91 + return _txtValue;
51.92 + }
51.93 +
51.94 + /**
51.95 + * Initializes (if necessary) and returns an object JTextFieldOperator
51.96 + * for the dialog text field "Parameter".
51.97 + * @return the appropriate object JTextFieldOperator
51.98 + */
51.99 + public JTextFieldOperator txtParameter() {
51.100 + if (_txtParameter==null) {
51.101 + _txtParameter = new JTextFieldOperator(this, 1);
51.102 + }
51.103 + return _txtParameter;
51.104 + }
51.105 +
51.106 + /**
51.107 + * Initializes (if necessary) and returns an object JRadioButtonOperator
51.108 + * for the dialog radio-button "Value".
51.109 + * @return the appropriate object JRadioButtonOperator
51.110 + */
51.111 + public JRadioButtonOperator rbtValue() {
51.112 + if (_rbtValue == null) {
51.113 + _rbtValue = new JRadioButtonOperator(this, 0);
51.114 + }
51.115 + return _rbtValue;
51.116 + }
51.117 +
51.118 + /**
51.119 + * Initializes (if necessary) and returns an object JRadioButtonOperator
51.120 + * for the dialog radio-button "Parameter".
51.121 + * @return the appropriate object JRadioButtonOperator
51.122 + */
51.123 + public JRadioButtonOperator rbtParameter() {
51.124 + if (_rbtParameter == null) {
51.125 + _rbtParameter = new JRadioButtonOperator(this, 1);
51.126 + }
51.127 + return _rbtParameter;
51.128 + }
51.129 +
51.130 + /**
51.131 + * Initializes all necessary controls.
51.132 + */
51.133 + public void verify() {
51.134 + btOK();
51.135 + btCancel();
51.136 + btHelp();
51.137 + txtValue();
51.138 + txtParameter();
51.139 + cboCompareType();
51.140 + rbtValue();
51.141 + rbtParameter();
51.142 + }
51.143 +
51.144 + /**
51.145 + * Finds in a bundle file and returns an actual text of control component.
51.146 + * @param p_text string-key corresponding to required control component.
51.147 + * @return actual text of control component
51.148 + */
51.149 + public static String getBundleString(String p_text) {
51.150 + return QueryBuilderOperator.getBundleString(p_text);
51.151 + }
51.152 +
51.153 +}
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/DataSource.java Thu Jul 10 04:32:50 2008 -0700
52.3 @@ -0,0 +1,253 @@
52.4 +/*
52.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
52.6 +*
52.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
52.8 +*
52.9 +* The contents of this file are subject to the terms of either the GNU
52.10 +* General Public License Version 2 only ("GPL") or the Common
52.11 +* Development and Distribution License("CDDL") (collectively, the
52.12 +* "License"). You may not use this file except in compliance with the
52.13 +* License. You can obtain a copy of the License at
52.14 +* http://www.netbeans.org/cddl-gplv2.html
52.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
52.16 +* specific language governing permissions and limitations under the
52.17 +* License. When distributing the software, include this License Header
52.18 +* Notice in each file and include the License file at
52.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
52.20 +* particular file as subject to the "Classpath" exception as provided
52.21 +* by Sun in the GPL Version 2 section of the License file that
52.22 +* accompanied this code. If applicable, add the following below the
52.23 +* License Header, with the fields enclosed by brackets [] replaced by
52.24 +* your own identifying information:
52.25 +* "Portions Copyrighted [year] [name of copyright owner]"
52.26 +*
52.27 +* Contributor(s):
52.28 +*
52.29 +* The Original Software is NetBeans. The Initial Developer of the Original
52.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
52.31 +* Microsystems, Inc. All Rights Reserved.
52.32 +*
52.33 +* If you wish your version of this file to be governed by only the CDDL
52.34 +* or only the GPL Version 2, indicate your decision by adding
52.35 +* "[Contributor] elects to include this software in this distribution
52.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
52.37 +* single choice of license, a recipient has the option to distribute
52.38 +* your version of this file under either the CDDL, the GPL Version 2 or
52.39 +* to extend the choice of license to its licensees as provided above.
52.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
52.41 +* Version 2 license, then the option applies only if the new code is
52.42 +* made subject to such option by the copyright holder.
52.43 +*/
52.44 +
52.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
52.46 +
52.47 +/**
52.48 + * This class implements an object DataSource, which is used for storing
52.49 + * of various parameters of a datasource.
52.50 + */
52.51 +public class DataSource {
52.52 + private String dbType="", dbUrl="", dbHost="", dbName="", hostName="",
52.53 + user="", password="", port="", validationTable=null;
52.54 +
52.55 + /**
52.56 + * Returns a type of database.
52.57 + * @return string with a type of database.
52.58 + */
52.59 + public String getDbType() {
52.60 + return dbType;
52.61 + }
52.62 +
52.63 + /**
52.64 + * Returns a database URL.
52.65 + * @return string with a database URL.
52.66 + */
52.67 + public String getDbUrl() {
52.68 + return dbUrl;
52.69 + }
52.70 +
52.71 + /**
52.72 + * Returns a database host.
52.73 + * @return string with a database host.
52.74 + */
52.75 + public String getDbHost() {
52.76 + return dbHost;
52.77 + }
52.78 +
52.79 + /**
52.80 + * Returns a database name.
52.81 + * @return string with a database name.
52.82 + */
52.83 + public String getDbName() {
52.84 + return dbName;
52.85 + }
52.86 +
52.87 + /**
52.88 + * Returns a host name.
52.89 + * @return string with a host name.
52.90 + */
52.91 + public String getHostName() {
52.92 + return hostName;
52.93 + }
52.94 +
52.95 + /**
52.96 + * Returns an user name.
52.97 + * @return string with an user name.
52.98 + */
52.99 + public String getUser() {
52.100 + return user;
52.101 + }
52.102 +
52.103 + /**
52.104 + * Returns a password.
52.105 + * @return string with a password.
52.106 + */
52.107 + public String getPassword() {
52.108 + return password;
52.109 + }
52.110 +
52.111 + /**
52.112 + * Returns a database port number.
52.113 + * @return string with a port number.
52.114 + */
52.115 + public String getPort() {
52.116 + return port;
52.117 + }
52.118 +
52.119 + /**
52.120 + * Returns a database host.
52.121 + * @return string with a database host.
52.122 + */
52.123 + public String getValidationTable() {
52.124 + return validationTable;
52.125 + }
52.126 +
52.127 + /**
52.128 + * Creates an instance of this class.
52.129 + * @param p_dbHost string with a database host
52.130 + * @param p_dbName string with a database name
52.131 + * @param p_user string with an user name
52.132 + * @param p_password string with an user password
52.133 + * @param p_port string with a database port
52.134 + */
52.135 + public DataSource(String p_dbHost, String p_dbName, String p_user, String p_password, String p_port){
52.136 + this("",p_dbHost,p_dbName,p_user,p_password,p_port);
52.137 + }
52.138 +
52.139 + /**
52.140 + * Creates an instance of this class.
52.141 + * @param p_dbType string with a database type
52.142 + * @param p_dbHost string with a database host
52.143 + * @param p_dbName string with a database name
52.144 + * @param p_user string with an user name
52.145 + * @param p_password string with an user password
52.146 + * @param p_port string with a database port
52.147 + */
52.148 + public DataSource(String p_dbType, String p_dbHost, String p_dbName, String p_user, String p_password, String p_port){
52.149 + this(p_dbType,p_dbHost,p_dbName,p_user,p_password,p_port,null);
52.150 + }
52.151 +
52.152 + /**
52.153 + * Creates an instance of this class.
52.154 + * @param p_dbType string with a database type
52.155 + * @param p_dbHost string with a database host
52.156 + * @param p_dbName string with a database name
52.157 + * @param p_user string with an user name
52.158 + * @param p_password string with an user password
52.159 + * @param p_port string with a database port
52.160 + * @param p_validationTable
52.161 + */
52.162 + public DataSource(String p_dbType, String p_dbHost, String p_dbName, String p_user, String p_password, String p_port, String p_validationTable){
52.163 + setDbType(p_dbType);
52.164 + setDbHost(p_dbHost);
52.165 + setDbName(p_dbName);
52.166 + setUser(p_user);
52.167 + setPassword(p_password);
52.168 + setPort(p_port);
52.169 + setValidationTable(p_validationTable);
52.170 + setDbUrl("");
52.171 + //@todo parse dbUrl
52.172 + }
52.173 +
52.174 + /**
52.175 + * Creates an instance of this class.
52.176 + * @param p_ds an another DataSource object (a prototype of new datasource)
52.177 + */
52.178 + public DataSource(DataSource p_ds){
52.179 + setDbType(p_ds.getDbType());
52.180 + setDbHost(p_ds.getDbHost());
52.181 + setDbName(p_ds.getDbName());
52.182 + setUser(p_ds.getUser());
52.183 + setPassword(p_ds.getPassword());
52.184 + setPort(p_ds.getPort());
52.185 + setDbUrl(p_ds.getDbUrl());
52.186 + setValidationTable(p_ds.getValidationTable());
52.187 + }
52.188 +
52.189 + /**
52.190 + * Changes a database type for a datasource.
52.191 + * @param dbType string with a database type
52.192 + */
52.193 + public void setDbType(String dbType) {
52.194 + this.dbType = dbType;
52.195 + }
52.196 +
52.197 + /**
52.198 + * Changes a database URL for a datasource.
52.199 + * @param dbUrl string with a database URL
52.200 + */
52.201 + public void setDbUrl(String dbUrl) {
52.202 + this.dbUrl = dbUrl;
52.203 + }
52.204 +
52.205 + /**
52.206 + * Changes a database host for a datasource.
52.207 + * @param dbHost string with a database host
52.208 + */
52.209 + public void setDbHost(String dbHost) {
52.210 + this.dbHost = dbHost;
52.211 + }
52.212 +
52.213 + /**
52.214 + * Changes a database name for a datasource.
52.215 + * @param dbName string with a database name
52.216 + */
52.217 + public void setDbName(String dbName) {
52.218 + this.dbName = dbName;
52.219 + }
52.220 +
52.221 + /**
52.222 + * Changes a host name for a datasource.
52.223 + * @param hostName string with a host name
52.224 + */
52.225 + public void setHostName(String hostName) {
52.226 + this.hostName = hostName;
52.227 + }
52.228 +
52.229 + /**
52.230 + * Changes an user name for a datasource.
52.231 + * @param user an user name
52.232 + */
52.233 + public void setUser(String user) {
52.234 + this.user = user;
52.235 + }
52.236 +
52.237 + /**
52.238 + * Changes a password for a datasource.
52.239 + * @param password an user password
52.240 + */
52.241 + public void setPassword(String password) {
52.242 + this.password = password;
52.243 + }
52.244 +
52.245 + /**
52.246 + * Changes a database port number for a datasource.
52.247 + * @param port a database port number
52.248 + */
52.249 + public void setPort(String port) {
52.250 + this.port = port;
52.251 + }
52.252 +
52.253 + public void setValidationTable(String validationTable) {
52.254 + this.validationTable = validationTable;
52.255 + }
52.256 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/EditServerTypesOperator.java Thu Jul 10 04:32:50 2008 -0700
53.3 @@ -0,0 +1,230 @@
53.4 +/*
53.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
53.6 +*
53.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
53.8 +*
53.9 +* The contents of this file are subject to the terms of either the GNU
53.10 +* General Public License Version 2 only ("GPL") or the Common
53.11 +* Development and Distribution License("CDDL") (collectively, the
53.12 +* "License"). You may not use this file except in compliance with the
53.13 +* License. You can obtain a copy of the License at
53.14 +* http://www.netbeans.org/cddl-gplv2.html
53.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
53.16 +* specific language governing permissions and limitations under the
53.17 +* License. When distributing the software, include this License Header
53.18 +* Notice in each file and include the License file at
53.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
53.20 +* particular file as subject to the "Classpath" exception as provided
53.21 +* by Sun in the GPL Version 2 section of the License file that
53.22 +* accompanied this code. If applicable, add the following below the
53.23 +* License Header, with the fields enclosed by brackets [] replaced by
53.24 +* your own identifying information:
53.25 +* "Portions Copyrighted [year] [name of copyright owner]"
53.26 +*
53.27 +* Contributor(s):
53.28 +*
53.29 +* The Original Software is NetBeans. The Initial Developer of the Original
53.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
53.31 +* Microsystems, Inc. All Rights Reserved.
53.32 +*
53.33 +* If you wish your version of this file to be governed by only the CDDL
53.34 +* or only the GPL Version 2, indicate your decision by adding
53.35 +* "[Contributor] elects to include this software in this distribution
53.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
53.37 +* single choice of license, a recipient has the option to distribute
53.38 +* your version of this file under either the CDDL, the GPL Version 2 or
53.39 +* to extend the choice of license to its licensees as provided above.
53.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
53.41 +* Version 2 license, then the option applies only if the new code is
53.42 +* made subject to such option by the copyright holder.
53.43 +*/
53.44 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
53.45 +
53.46 +import org.netbeans.jellytools.NbDialogOperator;
53.47 +import org.netbeans.jellytools.Bundle;
53.48 +import org.netbeans.jemmy.JemmyException;
53.49 +import org.netbeans.jemmy.operators.JButtonOperator;
53.50 +import org.netbeans.jemmy.operators.JListOperator;
53.51 +import org.netbeans.jemmy.operators.JTextFieldOperator;
53.52 +import org.netbeans.jemmy.operators.JComboBoxOperator;
53.53 +
53.54 +/**
53.55 + * This class implements test functionality for "Edit Server Types" dialog
53.56 + */
53.57 +public class EditServerTypesOperator extends NbDialogOperator{
53.58 + /**
53.59 + * Creates new instance of this class.
53.60 + */
53.61 + public EditServerTypesOperator(){
53.62 + super(getBundleString("New JDBC Driver"));
53.63 + }
53.64 +
53.65 + private JButtonOperator _btAdd;
53.66 + private JButtonOperator _btRemove;
53.67 + private JButtonOperator _btNew;
53.68 + private JButtonOperator _btDelete;
53.69 + private JButtonOperator _btFind;
53.70 + private JListOperator _lstServerTypes;
53.71 + private JListOperator _lstJars;
53.72 + private JTextFieldOperator _txtName;
53.73 + private JTextFieldOperator _txtTemplate;
53.74 + private JComboBoxOperator _cboDriver;
53.75 +
53.76 + /**
53.77 + * Initializes (if necessary) and returns an object JButtonOperator
53.78 + * for the dialog button "Add".
53.79 + * @return the appropriate object JButtonOperator
53.80 + */
53.81 + public JButtonOperator btAdd() {
53.82 + if (_btAdd==null) {
53.83 + _btAdd = new JButtonOperator(this, getBundleString("Add..."));
53.84 + }
53.85 + return _btAdd;
53.86 + }
53.87 +
53.88 + /**
53.89 + * Initializes (if necessary) and returns an object JButtonOperator
53.90 + * for the dialog button "Remove".
53.91 + * @return the appropriate object JButtonOperator
53.92 + */
53.93 + public JButtonOperator btRemove() {
53.94 + if (_btRemove==null) {
53.95 + _btRemove = new JButtonOperator(this, getBundleString("Remove"));
53.96 + }
53.97 + return _btRemove;
53.98 + }
53.99 +
53.100 + /**
53.101 + * Initializes (if necessary) and returns an object JButtonOperator
53.102 + * for the dialog button "New".
53.103 + * @return the appropriate object JButtonOperator
53.104 + */
53.105 + public JButtonOperator btNew() {
53.106 + if (_btNew==null) {
53.107 + _btNew = new JButtonOperator(this, getBundleString("Add..."));
53.108 + }
53.109 + return _btNew;
53.110 + }
53.111 +
53.112 + /**
53.113 + * Initializes (if necessary) and returns an object JButtonOperator
53.114 + * for the dialog button "Delete".
53.115 + * @return the appropriate object JButtonOperator
53.116 + */
53.117 + public JButtonOperator btDelete() {
53.118 + if (_btDelete==null) {
53.119 + _btDelete = new JButtonOperator(this, getBundleString("LBL_REMOVE_DRIVER"));
53.120 + }
53.121 + return _btDelete;
53.122 + }
53.123 +
53.124 + /**
53.125 + * Initializes (if necessary) and returns an object JButtonOperator
53.126 + * for the dialog button "Find".
53.127 + * @return the appropriate object JButtonOperator
53.128 + */
53.129 + public JButtonOperator btFind() {
53.130 + if (_btFind==null) {
53.131 + _btFind = new JButtonOperator(this, getBundleString("Find"));
53.132 + }
53.133 + return _btFind;
53.134 + }
53.135 +
53.136 + /**
53.137 + * Initializes (if necessary) and returns an object JTextFieldOperator
53.138 + * for the dialog text field "Name".
53.139 + * @return the appropriate object JTextFieldOperator
53.140 + */
53.141 + public JTextFieldOperator txtName() {
53.142 + if (_txtName==null) {
53.143 + _txtName = new JTextFieldOperator(this, 0);
53.144 + }
53.145 + return _txtName;
53.146 + }
53.147 +
53.148 + /**
53.149 + * Initializes (if necessary) and returns an object JTextFieldOperator
53.150 + * for the dialog text field "Template".
53.151 + * @return the appropriate object JTextFieldOperator
53.152 + */
53.153 + public JTextFieldOperator txtTemplate() {
53.154 + if (_txtTemplate==null) {
53.155 + _txtTemplate = new JTextFieldOperator(this, 1);
53.156 + }
53.157 + return _txtTemplate;
53.158 + }
53.159 +
53.160 + /**
53.161 + * Initializes (if necessary) and returns an object JComboBoxOperator
53.162 + * for the dialog drop-down list "Driver".
53.163 + * @return the appropriate object JComboBoxOperator
53.164 + */
53.165 + public JComboBoxOperator cboDriver() {
53.166 + if (_cboDriver==null) {
53.167 + _cboDriver = new JComboBoxOperator(this);
53.168 + }
53.169 + return _cboDriver;
53.170 + }
53.171 +
53.172 + /**
53.173 + * Initializes (if necessary) and returns an object JListOperator
53.174 + * for the dialog list "Server Types".
53.175 + * @return the appropriate object JListOperator
53.176 + */
53.177 + public JListOperator lstServerTypes() {
53.178 + if (_lstServerTypes==null) {
53.179 + _lstServerTypes = new JListOperator(this,0);
53.180 + }
53.181 + return _lstServerTypes;
53.182 + }
53.183 +
53.184 + /**
53.185 + * Initializes (if necessary) and returns an object JListOperator
53.186 + * for the dialog list "Jars".
53.187 + * @return the appropriate object JListOperator
53.188 + */
53.189 + public JListOperator lstJars() {
53.190 + if (_lstJars==null) {
53.191 + _lstJars = new JListOperator(this,1);
53.192 + }
53.193 + return _lstJars;
53.194 + }
53.195 +
53.196 + /**
53.197 + * Initializes all necessary controls.
53.198 + */
53.199 + public void verify() {
53.200 + btAdd();
53.201 + btRemove();
53.202 + btNew();
53.203 +// btDelete();
53.204 + btFind();
53.205 +// btClose();
53.206 +// btHelp();
53.207 + txtName();
53.208 + txtTemplate();
53.209 + cboDriver();
53.210 +// lstServerTypes();
53.211 +// lstJars();
53.212 + btOK();
53.213 + btCancel();
53.214 + }
53.215 +
53.216 + /**
53.217 + * Finds in a bundle file and returns an actual text of control component.
53.218 + * @param p_text string-key corresponding to required control component.
53.219 + * @return actual text of control component
53.220 + */
53.221 + public static String getBundleString(String p_text) {
53.222 + System.out.println("Getting bundle for " + p_text);
53.223 +/* try {
53.224 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.actions.Bundle", p_text);
53.225 + } catch (JemmyException e) {}
53.226 + try {
53.227 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
53.228 + } catch (JemmyException e) {}
53.229 +*/
53.230 + return p_text;
53.231 + }
53.232 +
53.233 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ExportDataSourcesOperator.java Thu Jul 10 04:32:50 2008 -0700
54.3 @@ -0,0 +1,93 @@
54.4 +/*
54.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
54.6 +*
54.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
54.8 +*
54.9 +* The contents of this file are subject to the terms of either the GNU
54.10 +* General Public License Version 2 only ("GPL") or the Common
54.11 +* Development and Distribution License("CDDL") (collectively, the
54.12 +* "License"). You may not use this file except in compliance with the
54.13 +* License. You can obtain a copy of the License at
54.14 +* http://www.netbeans.org/cddl-gplv2.html
54.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
54.16 +* specific language governing permissions and limitations under the
54.17 +* License. When distributing the software, include this License Header
54.18 +* Notice in each file and include the License file at
54.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
54.20 +* particular file as subject to the "Classpath" exception as provided
54.21 +* by Sun in the GPL Version 2 section of the License file that
54.22 +* accompanied this code. If applicable, add the following below the
54.23 +* License Header, with the fields enclosed by brackets [] replaced by
54.24 +* your own identifying information:
54.25 +* "Portions Copyrighted [year] [name of copyright owner]"
54.26 +*
54.27 +* Contributor(s):
54.28 +*
54.29 +* The Original Software is NetBeans. The Initial Developer of the Original
54.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
54.31 +* Microsystems, Inc. All Rights Reserved.
54.32 +*
54.33 +* If you wish your version of this file to be governed by only the CDDL
54.34 +* or only the GPL Version 2, indicate your decision by adding
54.35 +* "[Contributor] elects to include this software in this distribution
54.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
54.37 +* single choice of license, a recipient has the option to distribute
54.38 +* your version of this file under either the CDDL, the GPL Version 2 or
54.39 +* to extend the choice of license to its licensees as provided above.
54.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
54.41 +* Version 2 license, then the option applies only if the new code is
54.42 +* made subject to such option by the copyright holder.
54.43 +*/
54.44 +
54.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
54.46 +
54.47 +import org.netbeans.jemmy.operators.JCheckBoxOperator;
54.48 +
54.49 +/**
54.50 + * This class implements test functionality for a dialog "Export Data Sources"
54.51 + */
54.52 +public class ExportDataSourcesOperator extends ExportImportDataSourcesOperator{
54.53 + private JCheckBoxOperator _cbIncludeUser;
54.54 + private JCheckBoxOperator _cbIncludePassword;
54.55 +
54.56 + /**
54.57 + * Creates new instance of this class.
54.58 + */
54.59 + public ExportDataSourcesOperator(){
54.60 + super(getBundleString("EXPORT_DLG_NAME"));
54.61 + }
54.62 +
54.63 + /**
54.64 + * Initializes (if necessary) and returns an object JCheckBoxOperator
54.65 + * for the dialog check-box "Include User".
54.66 + * @return the appropriate object JCheckBoxOperator
54.67 + */
54.68 + public JCheckBoxOperator cbIncludeUser() {
54.69 + if (_cbIncludeUser==null) {
54.70 + _cbIncludeUser = new JCheckBoxOperator(this, 0);
54.71 + }
54.72 + return _cbIncludeUser;
54.73 + }
54.74 +
54.75 + /**
54.76 + * Initializes (if necessary) and returns an object JCheckBoxOperator
54.77 + * for the dialog check-box "Include Password".
54.78 + * @return the appropriate object JCheckBoxOperator
54.79 + */
54.80 + public JCheckBoxOperator cbIncludePassword() {
54.81 + if (_cbIncludePassword==null) {
54.82 + _cbIncludePassword = new JCheckBoxOperator(this, 1);
54.83 + }
54.84 + return _cbIncludePassword;
54.85 + }
54.86 +
54.87 + /**
54.88 + * Initializes all necessary controls.
54.89 + */
54.90 + public void verify(){
54.91 + super.verify();
54.92 + cbIncludeUser();
54.93 + cbIncludePassword();
54.94 + }
54.95 +
54.96 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ExportImportDataSourcesOperator.java Thu Jul 10 04:32:50 2008 -0700
55.3 @@ -0,0 +1,242 @@
55.4 +/*
55.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
55.6 +*
55.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
55.8 +*
55.9 +* The contents of this file are subject to the terms of either the GNU
55.10 +* General Public License Version 2 only ("GPL") or the Common
55.11 +* Development and Distribution License("CDDL") (collectively, the
55.12 +* "License"). You may not use this file except in compliance with the
55.13 +* License. You can obtain a copy of the License at
55.14 +* http://www.netbeans.org/cddl-gplv2.html
55.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
55.16 +* specific language governing permissions and limitations under the
55.17 +* License. When distributing the software, include this License Header
55.18 +* Notice in each file and include the License file at
55.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
55.20 +* particular file as subject to the "Classpath" exception as provided
55.21 +* by Sun in the GPL Version 2 section of the License file that
55.22 +* accompanied this code. If applicable, add the following below the
55.23 +* License Header, with the fields enclosed by brackets [] replaced by
55.24 +* your own identifying information:
55.25 +* "Portions Copyrighted [year] [name of copyright owner]"
55.26 +*
55.27 +* Contributor(s):
55.28 +*
55.29 +* The Original Software is NetBeans. The Initial Developer of the Original
55.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
55.31 +* Microsystems, Inc. All Rights Reserved.
55.32 +*
55.33 +* If you wish your version of this file to be governed by only the CDDL
55.34 +* or only the GPL Version 2, indicate your decision by adding
55.35 +* "[Contributor] elects to include this software in this distribution
55.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
55.37 +* single choice of license, a recipient has the option to distribute
55.38 +* your version of this file under either the CDDL, the GPL Version 2 or
55.39 +* to extend the choice of license to its licensees as provided above.
55.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
55.41 +* Version 2 license, then the option applies only if the new code is
55.42 +* made subject to such option by the copyright holder.
55.43 +*/
55.44 +
55.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
55.46 +
55.47 +import org.netbeans.jellytools.NbDialogOperator;
55.48 +import org.netbeans.jellytools.Bundle;
55.49 +import org.netbeans.jemmy.JemmyException;
55.50 +import org.netbeans.jemmy.operators.JButtonOperator;
55.51 +import org.netbeans.jemmy.operators.JTextFieldOperator;
55.52 +import org.netbeans.jemmy.operators.JListOperator;
55.53 +
55.54 +/**
55.55 + * This class is used as abstract ancestor of classes ExportDataSourcesOperator
55.56 + * and ImportDataSourcesOperator.
55.57 + */
55.58 +public abstract class ExportImportDataSourcesOperator extends NbDialogOperator{
55.59 +
55.60 + /**
55.61 + * This constructor is used by inherited classes for
55.62 + * creation of their new instances.
55.63 + */
55.64 + public ExportImportDataSourcesOperator(String p_title){
55.65 + super(p_title);
55.66 + }
55.67 +
55.68 + private JButtonOperator _btSelectAll;
55.69 + private JButtonOperator _btClear;
55.70 + private JButtonOperator _btBrowse;
55.71 + private JTextFieldOperator _txtDSName;
55.72 + private JTextFieldOperator _txtValidationQuery;
55.73 + private JTextFieldOperator _txtDriverClass;
55.74 + private JTextFieldOperator _txtUser;
55.75 + private JTextFieldOperator _txtPassword;
55.76 + private JTextFieldOperator _txtURL;
55.77 + private JTextFieldOperator _txtFileName;
55.78 + private JListOperator _lstDataSources;
55.79 +
55.80 + /**
55.81 + * Initializes (if necessary) and returns an object JButtonOperator
55.82 + * for the dialog button "Select All".
55.83 + * @return the appropriate object JButtonOperator
55.84 + */
55.85 + public JButtonOperator btSelectAll() {
55.86 + if (_btSelectAll==null) {
55.87 + _btSelectAll = new JButtonOperator(this, getBundleString("SCHEMA_SELECT_ALL_BTN_LABEL"));
55.88 + }
55.89 + return _btSelectAll;
55.90 + }
55.91 +
55.92 + /**
55.93 + * Initializes (if necessary) and returns an object JButtonOperator
55.94 + * for the dialog button "Clear".
55.95 + * @return the appropriate object JButtonOperator
55.96 + */
55.97 + public JButtonOperator btClear() {
55.98 + if (_btClear==null) {
55.99 + _btClear = new JButtonOperator(this, getBundleString("SCHEMA_CLEAR_BTN_LABEL"));
55.100 + }
55.101 + return _btClear;
55.102 + }
55.103 +
55.104 + /**
55.105 + * Initializes (if necessary) and returns an object JButtonOperator
55.106 + * for the dialog button "Browse".
55.107 + * @return the appropriate object JButtonOperator
55.108 + */
55.109 + public JButtonOperator btBrowse() {
55.110 + if (_btBrowse==null) {
55.111 + _btBrowse = new JButtonOperator(this, getBundleString("BROWSE_BUTTON_LABEL"));
55.112 + }
55.113 + return _btBrowse;
55.114 + }
55.115 +
55.116 + /**
55.117 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.118 + * for the dialog text field "Datasource Name".
55.119 + * @return the appropriate object JTextFieldOperator
55.120 + */
55.121 + public JTextFieldOperator txtDSName() {
55.122 + if (_txtDSName==null) {
55.123 + _txtDSName = new JTextFieldOperator(this, 2);
55.124 + }
55.125 + return _txtDSName;
55.126 + }
55.127 +
55.128 + /**
55.129 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.130 + * for the dialog text field "Validation Query".
55.131 + * @return the appropriate object JTextFieldOperator
55.132 + */
55.133 + public JTextFieldOperator txtValidationQuery() {
55.134 + if (_txtValidationQuery==null) {
55.135 + _txtValidationQuery = new JTextFieldOperator(this, 1);
55.136 + }
55.137 + return _txtValidationQuery;
55.138 + }
55.139 +
55.140 + /**
55.141 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.142 + * for the dialog text field "Driver Class".
55.143 + * @return the appropriate object JTextFieldOperator
55.144 + */
55.145 + public JTextFieldOperator txtDriverClass() {
55.146 + if (_txtDriverClass==null) {
55.147 + _txtDriverClass = new JTextFieldOperator(this, 0);
55.148 + }
55.149 + return _txtDriverClass;
55.150 + }
55.151 +
55.152 + /**
55.153 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.154 + * for the dialog text field "User".
55.155 + * @return the appropriate object JTextFieldOperator
55.156 + */
55.157 + public JTextFieldOperator txtUser() {
55.158 + if (_txtUser==null) {
55.159 + _txtUser = new JTextFieldOperator(this, 3);
55.160 + }
55.161 + return _txtUser;
55.162 + }
55.163 +
55.164 + /**
55.165 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.166 + * for the dialog text field "Password".
55.167 + * @return the appropriate object JTextFieldOperator
55.168 + */
55.169 + public JTextFieldOperator txtPassword() {
55.170 + if (_txtPassword==null) {
55.171 + _txtPassword = new JTextFieldOperator(this, 4);
55.172 + }
55.173 + return _txtPassword;
55.174 + }
55.175 +
55.176 + /**
55.177 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.178 + * for the dialog text field "Database URL".
55.179 + * @return the appropriate object JTextFieldOperator
55.180 + */
55.181 + public JTextFieldOperator txtURL() {
55.182 + if (_txtURL==null) {
55.183 + _txtURL = new JTextFieldOperator(this, 5);
55.184 + }
55.185 + return _txtURL;
55.186 + }
55.187 +
55.188 + /**
55.189 + * Initializes (if necessary) and returns an object JTextFieldOperator
55.190 + * for the dialog text field "File Name".
55.191 + * @return the appropriate object JTextFieldOperator
55.192 + */
55.193 + public JTextFieldOperator txtFileName() {
55.194 + if (_txtFileName==null) {
55.195 + _txtFileName = new JTextFieldOperator(this, 2);
55.196 + }
55.197 + return _txtFileName;
55.198 + }
55.199 +
55.200 + /**
55.201 + * Initializes (if necessary) and returns an object JListOperator
55.202 + * for the dialog list "Data Sources".
55.203 + * @return the appropriate object JListOperator
55.204 + */
55.205 + public JListOperator lstDataSources() {
55.206 + if (_lstDataSources==null) {
55.207 + _lstDataSources = new JListOperator(this);
55.208 + }
55.209 + return _lstDataSources;
55.210 + }
55.211 +
55.212 + /**
55.213 + * Initializes all necessary controls.
55.214 + */
55.215 + public void verify(){
55.216 + btOK();
55.217 + btCancel();
55.218 + btHelp();
55.219 + btSelectAll();
55.220 + btClear();
55.221 + btBrowse();
55.222 + txtDSName();
55.223 + txtDriverClass();
55.224 + txtUser();
55.225 + txtPassword();
55.226 + txtURL();
55.227 + txtValidationQuery();
55.228 + txtFileName();
55.229 + lstDataSources();
55.230 + }
55.231 +
55.232 + /**
55.233 + * Finds in a bundle file and returns an actual text of control component.
55.234 + * @param p_text string-key corresponding to required control component.
55.235 + * @return actual text of control component
55.236 + */
55.237 + public static String getBundleString(String p_text) {
55.238 + System.out.println("Getting bundle for " + p_text);
55.239 + try {
55.240 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
55.241 + } catch (JemmyException e) {}
55.242 + return null;
55.243 + }
55.244 +
55.245 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ImportDataSourcesOperator.java Thu Jul 10 04:32:50 2008 -0700
56.3 @@ -0,0 +1,54 @@
56.4 +/*
56.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
56.6 +*
56.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
56.8 +*
56.9 +* The contents of this file are subject to the terms of either the GNU
56.10 +* General Public License Version 2 only ("GPL") or the Common
56.11 +* Development and Distribution License("CDDL") (collectively, the
56.12 +* "License"). You may not use this file except in compliance with the
56.13 +* License. You can obtain a copy of the License at
56.14 +* http://www.netbeans.org/cddl-gplv2.html
56.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
56.16 +* specific language governing permissions and limitations under the
56.17 +* License. When distributing the software, include this License Header
56.18 +* Notice in each file and include the License file at
56.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
56.20 +* particular file as subject to the "Classpath" exception as provided
56.21 +* by Sun in the GPL Version 2 section of the License file that
56.22 +* accompanied this code. If applicable, add the following below the
56.23 +* License Header, with the fields enclosed by brackets [] replaced by
56.24 +* your own identifying information:
56.25 +* "Portions Copyrighted [year] [name of copyright owner]"
56.26 +*
56.27 +* Contributor(s):
56.28 +*
56.29 +* The Original Software is NetBeans. The Initial Developer of the Original
56.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
56.31 +* Microsystems, Inc. All Rights Reserved.
56.32 +*
56.33 +* If you wish your version of this file to be governed by only the CDDL
56.34 +* or only the GPL Version 2, indicate your decision by adding
56.35 +* "[Contributor] elects to include this software in this distribution
56.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
56.37 +* single choice of license, a recipient has the option to distribute
56.38 +* your version of this file under either the CDDL, the GPL Version 2 or
56.39 +* to extend the choice of license to its licensees as provided above.
56.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
56.41 +* Version 2 license, then the option applies only if the new code is
56.42 +* made subject to such option by the copyright holder.
56.43 +*/
56.44 +
56.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
56.46 +
56.47 +/**
56.48 + * This class implements test functionality for a dialog "Import Data Sources"
56.49 + */
56.50 +public class ImportDataSourcesOperator extends ExportImportDataSourcesOperator{
56.51 + /**
56.52 + * Creates new instance of this class.
56.53 + */
56.54 + public ImportDataSourcesOperator(){
56.55 + super(getBundleString("IMPORT_DLG_NAME"));
56.56 + }
56.57 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ModifyDataSourceOperator.java Thu Jul 10 04:32:50 2008 -0700
57.3 @@ -0,0 +1,284 @@
57.4 +/*
57.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
57.6 +*
57.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
57.8 +*
57.9 +* The contents of this file are subject to the terms of either the GNU
57.10 +* General Public License Version 2 only ("GPL") or the Common
57.11 +* Development and Distribution License("CDDL") (collectively, the
57.12 +* "License"). You may not use this file except in compliance with the
57.13 +* License. You can obtain a copy of the License at
57.14 +* http://www.netbeans.org/cddl-gplv2.html
57.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
57.16 +* specific language governing permissions and limitations under the
57.17 +* License. When distributing the software, include this License Header
57.18 +* Notice in each file and include the License file at
57.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
57.20 +* particular file as subject to the "Classpath" exception as provided
57.21 +* by Sun in the GPL Version 2 section of the License file that
57.22 +* accompanied this code. If applicable, add the following below the
57.23 +* License Header, with the fields enclosed by brackets [] replaced by
57.24 +* your own identifying information:
57.25 +* "Portions Copyrighted [year] [name of copyright owner]"
57.26 +*
57.27 +* Contributor(s):
57.28 +*
57.29 +* The Original Software is NetBeans. The Initial Developer of the Original
57.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
57.31 +* Microsystems, Inc. All Rights Reserved.
57.32 +*
57.33 +* If you wish your version of this file to be governed by only the CDDL
57.34 +* or only the GPL Version 2, indicate your decision by adding
57.35 +* "[Contributor] elects to include this software in this distribution
57.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
57.37 +* single choice of license, a recipient has the option to distribute
57.38 +* your version of this file under either the CDDL, the GPL Version 2 or
57.39 +* to extend the choice of license to its licensees as provided above.
57.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
57.41 +* Version 2 license, then the option applies only if the new code is
57.42 +* made subject to such option by the copyright holder.
57.43 +*/
57.44 +
57.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
57.46 +
57.47 +import org.netbeans.jemmy.operators.*;
57.48 +import org.netbeans.jemmy.JemmyException;
57.49 +import org.netbeans.jellytools.Bundle;
57.50 +import org.netbeans.jellytools.NbDialogOperator;
57.51 +
57.52 +/**
57.53 + * This class implements test functionality for "Modify Data Source" dialog
57.54 + */
57.55 +public class ModifyDataSourceOperator extends NbDialogOperator{
57.56 + /**
57.57 + * Creates new instance of this class.
57.58 + */
57.59 + public ModifyDataSourceOperator(){
57.60 + super(getBundleString("MODIFY_DATASOURCE"));
57.61 + }
57.62 +
57.63 + private JButtonOperator _btGetSchemas;
57.64 + private JButtonOperator _btTestConnection;
57.65 + private JButtonOperator _btModify;
57.66 + private JButtonOperator _btCancel;
57.67 + private JButtonOperator _btHelp;
57.68 + private JButtonOperator _btSelectAll;
57.69 + private JButtonOperator _btClear;
57.70 + private JListOperator _lstSchemas;
57.71 + private JTextFieldOperator _txtDSName;
57.72 + private JTextFieldOperator _txtValidationQuery;
57.73 + private JTextFieldOperator _txtDriverClass;
57.74 + private JTextFieldOperator _txtUser;
57.75 + private JTextFieldOperator _txtPassword;
57.76 + private JTextFieldOperator _txtURL;
57.77 + private JTabbedPaneOperator _tbpMainTabPane;
57.78 +
57.79 + public JTabbedPaneOperator tbpMainTabPane() {
57.80 + if (_tbpMainTabPane==null) {
57.81 + _tbpMainTabPane = new JTabbedPaneOperator( this );
57.82 + }
57.83 + return _tbpMainTabPane;
57.84 + }
57.85 +
57.86 + /**
57.87 + * Initializes (if necessary) and returns an object JButtonOperator
57.88 + * for the dialog button "Get Schemas".
57.89 + * @return the appropriate object JButtonOperator
57.90 + */
57.91 + public JButtonOperator btGetSchemas() {
57.92 + if (_btGetSchemas==null) {
57.93 + _btGetSchemas = new JButtonOperator(this, getBundleString("GET_SCHEMAS_BTN_LABEL"));
57.94 + }
57.95 + return _btGetSchemas;
57.96 + }
57.97 +
57.98 + /**
57.99 + * Initializes (if necessary) and returns an object JButtonOperator
57.100 + * for the dialog button "Test Connection".
57.101 + * @return the appropriate object JButtonOperator
57.102 + */
57.103 + public JButtonOperator btTestConnection() {
57.104 + if (_btTestConnection==null) {
57.105 + _btTestConnection = new JButtonOperator(this, getBundleString("TEST_CONNECTION"));
57.106 + }
57.107 + return _btTestConnection;
57.108 + }
57.109 +
57.110 + /**
57.111 + * Initializes (if necessary) and returns an object JButtonOperator
57.112 + * for the dialog button "Modify".
57.113 + * @return the appropriate object JButtonOperator
57.114 + */
57.115 + public JButtonOperator btModify() {
57.116 + if (_btModify==null) {
57.117 + _btModify = new JButtonOperator(this, getBundleString("MODIFY"));
57.118 + }
57.119 + return _btModify;
57.120 + }
57.121 +
57.122 + /**
57.123 + * Initializes (if necessary) and returns an object JButtonOperator
57.124 + * for the dialog button "Cancel".
57.125 + * @return the appropriate object JButtonOperator
57.126 + */
57.127 + public JButtonOperator btCancel() {
57.128 + if (_btCancel==null) {
57.129 + _btCancel = new JButtonOperator(this, getBundleString("CANCEL"));
57.130 + }
57.131 + return _btCancel;
57.132 + }
57.133 +
57.134 + /**
57.135 + * Initializes (if necessary) and returns an object JButtonOperator
57.136 + * for the dialog button "Help".
57.137 + * @return the appropriate object JButtonOperator
57.138 + */
57.139 + public JButtonOperator btHelp() {
57.140 + if (_btHelp==null) {
57.141 + _btHelp = new JButtonOperator(this, getBundleString("HELP"));
57.142 + }
57.143 + return _btHelp;
57.144 + }
57.145 +
57.146 + /**
57.147 + * Initializes (if necessary) and returns an object JButtonOperator
57.148 + * for the dialog button "Select All".
57.149 + * @return the appropriate object JButtonOperator
57.150 + */
57.151 + public JButtonOperator btSelectAll() {
57.152 + if (_btSelectAll==null) {
57.153 + _btSelectAll = new JButtonOperator(this, getBundleString("SCHEMA_SELECT_ALL_BTN_LABEL"));
57.154 + }
57.155 + return _btSelectAll;
57.156 + }
57.157 +
57.158 + /**
57.159 + * Initializes (if necessary) and returns an object JButtonOperator
57.160 + * for the dialog button "Clear".
57.161 + * @return the appropriate object JButtonOperator
57.162 + */
57.163 + public JButtonOperator btClear() {
57.164 + if (_btClear==null) {
57.165 + _btClear = new JButtonOperator(this, getBundleString("SCHEMA_CLEAR_BTN_LABEL"));
57.166 + }
57.167 + return _btClear;
57.168 + }
57.169 +
57.170 + /**
57.171 + * Initializes (if necessary) and returns an object JListOperator
57.172 + * for the dialog list "Schemas".
57.173 + * @return the appropriate object JListOperator
57.174 + */
57.175 + public JListOperator lstSchemas() {
57.176 + if (_lstSchemas==null) {
57.177 + _lstSchemas = new JListOperator(this);
57.178 + }
57.179 + return _lstSchemas;
57.180 + }
57.181 +
57.182 + /**
57.183 + * Initializes (if necessary) and returns an object JTextFieldOperator
57.184 + * for the dialog text field "Data Source Name".
57.185 + * @return the appropriate object JTextFieldOperator
57.186 + */
57.187 + public JTextFieldOperator txtDSName() {
57.188 + if (_txtDSName==null) {
57.189 + _txtDSName = new JTextFieldOperator(this, 2);
57.190 + }
57.191 + return _txtDSName;
57.192 + }
57.193 +
57.194 + /**
57.195 + * Initializes (if necessary) and returns an object JTextFieldOperator
57.196 + * for the dialog text field "Validation Query".
57.197 + * @return the appropriate object JTextFieldOperator
57.198 + */
57.199 + public JTextFieldOperator txtValidationQuery() {
57.200 + if (_txtValidationQuery==null) {
57.201 + _txtValidationQuery = new JTextFieldOperator(this, 1);
57.202 + }
57.203 + return _txtValidationQuery;
57.204 + }
57.205 +
57.206 + /**
57.207 + * Initializes (if necessary) and returns an object JTextFieldOperator
57.208 + * for the dialog text field "Driver Class".
57.209 + * @return the appropriate object JTextFieldOperator
57.210 + */
57.211 + public JTextFieldOperator txtDriverClass() {
57.212 + if (_txtDriverClass==null) {
57.213 + _txtDriverClass = new JTextFieldOperator(this, 0);
57.214 + }
57.215 + return _txtDriverClass;
57.216 + }
57.217 +
57.218 + /**
57.219 + * Initializes (if necessary) and returns an object JTextFieldOperator
57.220 + * for the dialog text field "User".
57.221 + * @return the appropriate object JTextFieldOperator
57.222 + */
57.223 + public JTextFieldOperator txtUser() {
57.224 + if (_txtUser==null) {
57.225 + _txtUser = new JTextFieldOperator(this, 3);
57.226 + }
57.227 + return _txtUser;
57.228 + }
57.229 +
57.230 + /**
57.231 + * Initializes (if necessary) and returns an object JTextFieldOperator
57.232 + * for the dialog text field "Password".
57.233 + * @return the appropriate object JTextFieldOperator
57.234 + */
57.235 + public JTextFieldOperator txtPassword() {
57.236 + if (_txtPassword==null) {
57.237 + _txtPassword = new JTextFieldOperator(this, 4);
57.238 + }
57.239 + return _txtPassword;
57.240 + }
57.241 +
57.242 + /**
57.243 + * Initializes (if necessary) and returns an object JTextFieldOperator
57.244 + * for the dialog text field "URL".
57.245 + * @return the appropriate object JTextFieldOperator
57.246 + */
57.247 + public JTextFieldOperator txtURL() {
57.248 + if (_txtURL==null) {
57.249 + _txtURL = new JTextFieldOperator(this, 5);
57.250 + }
57.251 + return _txtURL;
57.252 + }
57.253 +
57.254 + /**
57.255 + * Initializes all necessary controls.
57.256 + */
57.257 + public void verify() {
57.258 + btModify();
57.259 + btCancel();
57.260 + btHelp();
57.261 + btGetSchemas();
57.262 + btSelectAll();
57.263 + btClear();
57.264 + btTestConnection();
57.265 + txtDSName();
57.266 + txtDriverClass();
57.267 + txtPassword();
57.268 + txtURL();
57.269 + txtUser();
57.270 + txtValidationQuery();
57.271 + lstSchemas();
57.272 + }
57.273 +
57.274 + /**
57.275 + * Finds in a bundle file and returns an actual text of control component.
57.276 + * @param p_text string-key corresponding to required control component.
57.277 + * @return actual text of control component
57.278 + */
57.279 + public static String getBundleString(String p_text) {
57.280 + System.out.println("Getting bundle for " + p_text);
57.281 + try {
57.282 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
57.283 + } catch (JemmyException e) {}
57.284 + return null;
57.285 + }
57.286 +
57.287 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/QueryBuilderOperator.java Thu Jul 10 04:32:50 2008 -0700
58.3 @@ -0,0 +1,887 @@
58.4 +/*
58.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
58.6 + *
58.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
58.8 + *
58.9 + * The contents of this file are subject to the terms of either the GNU
58.10 + * General Public License Version 2 only ("GPL") or the Common
58.11 + * Development and Distribution License("CDDL") (collectively, the
58.12 + * "License"). You may not use this file except in compliance with the
58.13 + * License. You can obtain a copy of the License at
58.14 + * http://www.netbeans.org/cddl-gplv2.html
58.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
58.16 + * specific language governing permissions and limitations under the
58.17 + * License. When distributing the software, include this License Header
58.18 + * Notice in each file and include the License file at
58.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
58.20 + * particular file as subject to the "Classpath" exception as provided
58.21 + * by Sun in the GPL Version 2 section of the License file that
58.22 + * accompanied this code. If applicable, add the following below the
58.23 + * License Header, with the fields enclosed by brackets [] replaced by
58.24 + * your own identifying information:
58.25 + * "Portions Copyrighted [year] [name of copyright owner]"
58.26 + *
58.27 + * Contributor(s):
58.28 + *
58.29 + * The Original Software is NetBeans. The Initial Developer of the Original
58.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
58.31 + * Microsystems, Inc. All Rights Reserved.
58.32 + *
58.33 + * If you wish your version of this file to be governed by only the CDDL
58.34 + * or only the GPL Version 2, indicate your decision by adding
58.35 + * "[Contributor] elects to include this software in this distribution
58.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
58.37 + * single choice of license, a recipient has the option to distribute
58.38 + * your version of this file under either the CDDL, the GPL Version 2 or
58.39 + * to extend the choice of license to its licensees as provided above.
58.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
58.41 + * Version 2 license, then the option applies only if the new code is
58.42 + * made subject to such option by the copyright holder.
58.43 + */
58.44 +
58.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
58.46 +
58.47 +import org.netbeans.modules.visualweb.gravy.Util;
58.48 +import org.netbeans.modules.db.sql.visualeditor.querybuilder.*;
58.49 +import java.awt.*;
58.50 +import java.util.*;
58.51 +import javax.swing.*;
58.52 +import java.awt.event.*;
58.53 +import org.netbeans.jemmy.*;
58.54 +import org.netbeans.jemmy.operators.*;
58.55 +import org.netbeans.jellytools.Bundle;
58.56 +
58.57 +/**
58.58 + * This class implements test functionality for a window "QueryBuilder".
58.59 + */
58.60 +public class QueryBuilderOperator extends ContainerOperator{
58.61 + ComponentOperator desktop = null;
58.62 + JTextComponentOperator query = null;
58.63 + public static final String SORT_TYPE = "Sort Type";
58.64 + public static final String SORT_ORDER = "Sort Order";
58.65 + public static final String DESCENDING = "Descending";
58.66 + public static final String ASCENDING = "Ascending";
58.67 +
58.68 + static final String ADD_QUERY_CRITERIA = "Add Query Criteria";
58.69 + public static final String CRITERIA = "Criteria";
58.70 + private static final String COLUMN = "Column";
58.71 + static final String POPUP_MENU_ITEM_PARSE_QUERY = "Parse Query";
58.72 + static final String POPUP_MENU_ITEM_RUN_QUERY = "Run Query";
58.73 + public static final String POPUP_MENU_ITEM_ADD_TABLE = "Add Table"; // "Add Table...";
58.74 + public static final String DIALOG_TITLE_ADD_TABLE = "Select Table"; // "Select Table(s) to Add";
58.75 + public final static String CANCEL = "Cancel";
58.76 + public final static String GROUP_BY="Group By";
58.77 + public static final String POPUP_MENU_ITEM_REMOVE_FROM_QUERY="Remove from Query";
58.78 + public final static String EQUALS = "Equals";
58.79 + public final static String NOT_EQUALS = "Not Equals";
58.80 + public final static String LESS_THAN = "Less Than";
58.81 + public final static String LESS_THAN_EQUALS = "Less Than Equals";
58.82 + public final static String GREATER_THAN = "Greater Than";
58.83 + public final static String GREATER_THAN_EQUALS = "Greater Than Equals";
58.84 + /**
58.85 + * @param tableName looking for given table to choose correct QueryBuilder instance
58.86 + * @return Container instanceof QueryBuilder
58.87 + */
58.88 + private static Container findQueryBuilder(String tableName) {
58.89 + java.awt.Container container = new org.netbeans.jemmy.operators.JTableOperator(
58.90 + Util.getMainWindow(),
58.91 + new QueryBuilderInputTableChooser(tableName)).getParent();
58.92 + while (!(container instanceof QueryBuilder)) {
58.93 + //System.out.println("TRACE: findQueryBuilder: " + container.getClass().getName());
58.94 + container = container.getParent();
58.95 + }
58.96 + return container;
58.97 + }
58.98 +
58.99 + /**
58.100 + * Creates new instance of this class.
58.101 + * @param parent an object ContainerOperator related to container, which includes created Query Builder
58.102 + * @param tabId a name of required tab
58.103 + */
58.104 + public QueryBuilderOperator(ContainerOperator parent, String tabId) {
58.105 + //super(parent, new QueryBuilderChooser(tabId));
58.106 + super(findQueryBuilder(tabId));
58.107 + this.setComparator(new Operator.DefaultStringComparator(true, true));
58.108 + }
58.109 +
58.110 + /**
58.111 + * Creates new instance of this class.
58.112 + * @param tabId a name of required tab
58.113 + */
58.114 + public QueryBuilderOperator(String tabId) {
58.115 + this(Util.getMainWindow(), tabId);
58.116 + }
58.117 +
58.118 + /**
58.119 + * Creates new instance of this class.
58.120 + * @param parent an object ContainerOperator related to container, which includes created Query Builder
58.121 + */
58.122 + public QueryBuilderOperator(ContainerOperator parent) {
58.123 + super(parent, new QueryBuilderChooser());
58.124 + this.setComparator(new Operator.DefaultStringComparator(true, true));
58.125 + }
58.126 +
58.127 + /**
58.128 + * Creates new instance of this class.
58.129 + */
58.130 + public QueryBuilderOperator() {
58.131 + this(Util.getMainWindow());
58.132 + }
58.133 +
58.134 + /**
58.135 + * Closes a window of Query Builder.
58.136 + */
58.137 + public void close(){
58.138 + Util.closeWindow();
58.139 + }
58.140 +
58.141 + /**
58.142 + * TODO: Fix it
58.143 + * Returns an object QueryBuilderGraphFrameOperator
58.144 + * @return QueryBuilderGraphFrameOperator
58.145 + */
58.146 + public QueryBuilderPaneOperator getGraphFrame() {
58.147 + return(new QueryBuilderPaneOperator());
58.148 + }
58.149 +
58.150 + /**
58.151 + * Returns an object TableFrameOperator
58.152 + * Represent Operator for Table with given name in Graph Frame of the QueryBuilder
58.153 + * @param tableName
58.154 + * @return TableFrameOperator
58.155 + *
58.156 + */
58.157 + public TableFrameOperator getTableFrame(String tableName) {
58.158 + return(new TableFrameOperator(tableName));
58.159 + }
58.160 +
58.161 + /**
58.162 + * Returns an object InputTableOperator
58.163 + * @return InputTableOperator
58.164 + */
58.165 + public InputTableOperator getInputTable() {
58.166 + return(new InputTableOperator());
58.167 + }
58.168 + /**
58.169 + * TODO: Fix it
58.170 + */
58.171 + private ComponentOperator getDesktop() {
58.172 + if(desktop == null) {
58.173 + //desktop = new ComponentOperator(new QueryBuilderOperator().getGraphFrame(),
58.174 + // new Operator.Finder(JDesktopPane.class));
58.175 + desktop = new QueryBuilderOperator().getGraphFrame();
58.176 + }
58.177 + return(desktop);
58.178 + }
58.179 +
58.180 + /**
58.181 + * Initializes (if necessary) and returns an object JTextComponentOperator (query text).
58.182 + * @return JTextComponentOperator
58.183 + */
58.184 + public JTextComponentOperator getQueryTextComponent() {
58.185 + if(query == null) {
58.186 + //query = new JTextComponentOperator(this);
58.187 + query = new JEditorPaneOperator(this);
58.188 + }
58.189 + return(query);
58.190 + }
58.191 +
58.192 + /**
58.193 + * Returns an object JTableOperator (result table of a query)
58.194 + * @return JTableOperator
58.195 + */
58.196 + public JTableOperator getResultTable() {
58.197 + return(new JTableOperator(this, new Operator.Finder(QueryBuilderResultTable.class)));
58.198 + }
58.199 +
58.200 + /**
58.201 + * Clicks an item of a popup menu.
58.202 + * @param menuText a menu item
58.203 + */
58.204 + public void pushPopup(String menuText) {
58.205 + getDesktop().clickForPopup(10, 10);
58.206 + new JPopupMenuOperator().pushMenuNoBlock(menuText);
58.207 + }
58.208 +
58.209 + /**
58.210 + * Returns JComponentOperator, which wraps component, presenting
58.211 + * Graph Panel of Query Editor
58.212 + */
58.213 + public JComponentOperator getGraphComponent() {
58.214 + JComponent jComponent = (JComponent) findComponent((Container) this.getSource(),
58.215 + new ComponentChooser() {
58.216 + public boolean checkComponent(Component comp) {
58.217 + return (comp.getClass().getName().endsWith("SceneComponent") ?
58.218 + true : false);
58.219 + }
58.220 + public String getDescription() {
58.221 + return ("Graph component [SceneComponent] is being found...");
58.222 + }
58.223 + });
58.224 + return (new JComponentOperator(jComponent));
58.225 + }
58.226 +
58.227 + /**
58.228 + * Returns JScrollPaneOperator, which wraps a scroll pane
58.229 + * of Graph Panel of Query Editor
58.230 + */
58.231 + public JScrollPaneOperator getGraphScrollPane() {
58.232 + Component component = getGraphComponent().getSource();
58.233 + do {
58.234 + component = component.getParent();
58.235 + } while (!(component instanceof JScrollPane));
58.236 + return (new JScrollPaneOperator((JScrollPane) component));
58.237 + }
58.238 +
58.239 + //========================================================================//
58.240 + /**
58.241 + * Class for component, presenting DB Table on Graph Panel of Query Editor
58.242 + */
58.243 + private static class DBTableGraphComponent {
58.244 + private QueryBuilderOperator queryBuilder;
58.245 + private Container dbTableGraphObject;
58.246 + private JTable structureTable;
58.247 +
58.248 + private DBTableGraphComponent(QueryBuilderOperator queryBuilder,
58.249 + Container dbTableGraphObject) {
58.250 + this.queryBuilder = queryBuilder;
58.251 + this.dbTableGraphObject = dbTableGraphObject;
58.252 + structureTable = (JTable) ComponentOperator.findComponent(dbTableGraphObject,
58.253 + new ComponentChooser() {
58.254 + public boolean checkComponent(Component comp) {
58.255 + return (comp instanceof JTable ? true : false);
58.256 + }
58.257 + public String getDescription() {
58.258 + return "DB table component on Query Editor Graph Panel";
58.259 + }
58.260 + });
58.261 + }
58.262 +
58.263 + private String getDBTableName() {
58.264 + QueryBuilderTableModel tableModel = (QueryBuilderTableModel) structureTable.getModel();
58.265 + return tableModel.getTableName();
58.266 + }
58.267 +
58.268 + public JTable getStructureTable() {
58.269 + return structureTable;
58.270 + }
58.271 +
58.272 + private void callPopupMenu(String popupMenuItem) {
58.273 + new ComponentOperator(dbTableGraphObject).makeComponentVisible();
58.274 + Util.wait(1000);
58.275 + new QueueTool().waitEmpty();
58.276 +
58.277 + JComponentOperator graphComponentOp = queryBuilder.getGraphComponent();
58.278 + Point pointGraphComponent = graphComponentOp.getLocationOnScreen(),
58.279 + pointDBTableObj = dbTableGraphObject.getLocationOnScreen();
58.280 + int dx = pointDBTableObj.x - pointGraphComponent.x + 3,
58.281 + dy = pointDBTableObj.y - pointGraphComponent.y - 3;
58.282 +
58.283 + graphComponentOp.clickForPopup(dx, dy);
58.284 + Util.wait(1000);
58.285 + new QueueTool().waitEmpty();
58.286 +
58.287 + new JPopupMenuOperator().pushMenuNoBlock(popupMenuItem);
58.288 + Util.wait(1000);
58.289 + new QueueTool().waitEmpty();
58.290 + }
58.291 +
58.292 + @Override
58.293 + public String toString() {
58.294 + return getDBTableName();
58.295 + }
58.296 +
58.297 + @Override
58.298 + public boolean equals(Object obj) {
58.299 + if (obj == null) return false;
58.300 + if (obj instanceof String) return (getDBTableName().equals(obj.toString()));
58.301 +
58.302 + if (getClass() != obj.getClass()) return false;
58.303 +
58.304 + DBTableGraphComponent other = (DBTableGraphComponent) obj;
58.305 + return (getDBTableName().equals(other.getDBTableName()));
58.306 + }
58.307 +
58.308 + @Override
58.309 + public int hashCode() {
58.310 + return getDBTableName().hashCode();
58.311 + }
58.312 +
58.313 + private static java.util.List<DBTableGraphComponent> getDBTableGraphComponentList(
58.314 + QueryBuilderOperator queryBuilder) {
58.315 + java.util.List<DBTableGraphComponent> componentList = new ArrayList<DBTableGraphComponent>();
58.316 + Container container = (Container) queryBuilder.getGraphComponent().getSource();
58.317 + Component[] components = container.getComponents();
58.318 + for (Component component : components) {
58.319 + if (component.getClass().getName().endsWith("QBNodeComponent")) {
58.320 + componentList.add(new DBTableGraphComponent(queryBuilder,
58.321 + (Container) component));
58.322 + }
58.323 + }
58.324 + return componentList;
58.325 + }
58.326 +
58.327 + private static DBTableGraphComponent findDBTable(QueryBuilderOperator queryBuilder,
58.328 + String dbTableName) {
58.329 + return findDBTable(getDBTableGraphComponentList(queryBuilder), dbTableName);
58.330 + }
58.331 + private static DBTableGraphComponent findDBTable(
58.332 + java.util.List<DBTableGraphComponent> dbTableList, String dbTableName) {
58.333 + for (DBTableGraphComponent dbTable : dbTableList) {
58.334 + if (dbTable.equals(dbTableName)) return dbTable;
58.335 + }
58.336 + return null;
58.337 + }
58.338 + }
58.339 + //========================================================================//
58.340 +
58.341 + public JTableOperator getStructureTableOfDBTableOnGraphPanel(String dbTableName) {
58.342 + DBTableGraphComponent graphComponent = DBTableGraphComponent.findDBTable(this, dbTableName);
58.343 + if (graphComponent == null) return null;
58.344 + return (new JTableOperator(graphComponent.getStructureTable()));
58.345 + }
58.346 +
58.347 + public boolean isDBTableOpenedOnGraphPanel(String dbTableName) {
58.348 + return (DBTableGraphComponent.findDBTable(this, dbTableName) != null);
58.349 + }
58.350 +
58.351 + /**
58.352 + * Adds a database table into a query.
58.353 + * @param dbTableName name of a database table
58.354 + */
58.355 + public void addTable(String dbTableName) {
58.356 + DBTableGraphComponent dbTable = DBTableGraphComponent.findDBTable(this, dbTableName);
58.357 + if (dbTable != null) return; // DB table is already opened in Graph Pane of Query Editor
58.358 +
58.359 + JComponentOperator jCompOp = getGraphComponent();
58.360 + Util.wait(1000);
58.361 + new QueueTool().waitEmpty();
58.362 +
58.363 + //pushPopup(getBundleString("Add_Table"));
58.364 + jCompOp.clickForPopup(2, 2);
58.365 + Util.wait(1000);
58.366 + new QueueTool().waitEmpty();
58.367 +
58.368 + new JPopupMenuOperator().pushMenuNoBlock(POPUP_MENU_ITEM_ADD_TABLE);
58.369 + Util.wait(1000);
58.370 + new QueueTool().waitEmpty();
58.371 +
58.372 + //JDialogOperator addTableDialog = new JDialogOperator(getBundleString("Add_Table_Title"));
58.373 + JDialogOperator addTableDialog = new JDialogOperator(DIALOG_TITLE_ADD_TABLE);
58.374 + Util.wait(1000);
58.375 + new QueueTool().waitEmpty();
58.376 +
58.377 + new JListOperator(addTableDialog).selectItem(dbTableName);
58.378 + Util.wait(1000);
58.379 + new QueueTool().waitEmpty();
58.380 +
58.381 + new JButtonOperator(addTableDialog, "OK").pushNoBlock();
58.382 + Util.wait(1000);
58.383 + new QueueTool().waitEmpty();
58.384 + }
58.385 +
58.386 + /**
58.387 + * Removes a database table from a query.
58.388 + * @param dbTableName name of a database table
58.389 + */
58.390 + public void removeTable(String dbTableName) {
58.391 + DBTableGraphComponent dbTable = DBTableGraphComponent.findDBTable(this, dbTableName);
58.392 + dbTable.callPopupMenu(POPUP_MENU_ITEM_REMOVE_FROM_QUERY);
58.393 + Util.wait(1000);
58.394 + new QueueTool().waitEmpty();
58.395 + }
58.396 +
58.397 + /**
58.398 + * Updates text of a query.
58.399 + * @param newQuery text of query
58.400 + */
58.401 + public void retypeQuery(String newQuery) {
58.402 + // this.getQueryTextComponent().clearText();
58.403 + // Util.wait(500);
58.404 + // this.getQueryTextComponent().typeText(newQuery);
58.405 + this.getQueryTextComponent().setText(newQuery);
58.406 + Util.wait(1500);
58.407 + new QueueTool().waitEmpty();
58.408 + }
58.409 +
58.410 + /**
58.411 + * Changes text of a query.
58.412 + * @param substring a part of query text, which should be changed
58.413 + * @param newSubstring new text, which will replace a part of query text
58.414 + */
58.415 + public void changeQuery(String substring, String newSubstring) {
58.416 + getQueryTextComponent().selectText(substring);
58.417 + getQueryTextComponent().replaceSelection(newSubstring);
58.418 + }
58.419 +
58.420 + /**
58.421 + * Performs a query.
58.422 + * @return object JTableOperator
58.423 + */
58.424 + public JTableOperator runQuery() {
58.425 + getQueryTextComponent().clickForPopup(2, 2);
58.426 + Util.wait(1000);
58.427 + new QueueTool().waitEmpty();
58.428 +
58.429 + new JPopupMenuOperator().pushMenuNoBlock(POPUP_MENU_ITEM_RUN_QUERY);
58.430 + Util.wait(1000);
58.431 + new QueueTool().waitEmpty();
58.432 + return(getResultTable());
58.433 + }
58.434 +
58.435 + /**
58.436 + * Parses a query.
58.437 + */
58.438 + public void parseQuery() {
58.439 + getQueryTextComponent().clickForPopup(2, 2);
58.440 + Util.wait(1000);
58.441 + new QueueTool().waitEmpty();
58.442 +
58.443 + new JPopupMenuOperator().pushMenuNoBlock(POPUP_MENU_ITEM_PARSE_QUERY);
58.444 + Util.wait(1000);
58.445 + new QueueTool().waitEmpty();
58.446 + }
58.447 +
58.448 + /**
58.449 + * Invokes a dialog "Add query criteria".
58.450 + * @param column a name of a required column
58.451 + * @return an object AddQueryCriteriaOperator
58.452 + */
58.453 + public AddQueryCriteriaOperator invokeAddCriteria(String column) {
58.454 + return invokeAddCriteria(getInputTable().findCellRow(column));
58.455 + }
58.456 +
58.457 + /**
58.458 + * Invokes a dialog "Add query criteria".
58.459 + * @param column a number of a required column
58.460 + * @return an object AddQueryCriteriaOperator
58.461 + */
58.462 + public AddQueryCriteriaOperator invokeAddCriteria(int column) {
58.463 + JTableOperator inputTable = getInputTable();
58.464 + //Point p = inputTable.getPointToClick(column, inputTable.findColumn(getBundleString("CRITERIA")));
58.465 + //Point p = inputTable.getPointToClick(column, inputTable.findColumn(CRITERIA));
58.466 + Point p = inputTable.getPointToClick(column, inputTable.findColumn(COLUMN));
58.467 + Util.wait(500);
58.468 + new QueueTool().waitEmpty();
58.469 +
58.470 + inputTable.clickForPopup(p.x, p.y);
58.471 + JPopupMenuOperator popup = new JPopupMenuOperator();
58.472 + Util.wait(500);
58.473 + new QueueTool().waitEmpty();
58.474 +
58.475 + //popup.pushMenuNoBlock(getBundleString("ADD_QUERY_CRITERIA"));
58.476 + popup.pushMenuNoBlock(ADD_QUERY_CRITERIA);
58.477 + Util.wait(500);
58.478 + new QueueTool().waitEmpty();
58.479 +
58.480 + return new AddQueryCriteriaOperator();
58.481 + }
58.482 +
58.483 + /**
58.484 + * Adds query criteria to a column of a database table.
58.485 + * @param column a name of a required column
58.486 + * @param value text of criteria value
58.487 + * @param operatorValue string with a comparison operator or a statement,
58.488 + * which is used in criteria (for example, "=")
58.489 + */
58.490 + public void addSimpleCriteria(String column, String value, String operatorValue) {
58.491 + // invoke add query criteria dialog
58.492 + AddQueryCriteriaOperator dialog = invokeAddCriteria(column);
58.493 +
58.494 + if (operatorValue != null)
58.495 + dialog.cboCompareType().selectItem(operatorValue);
58.496 +
58.497 + dialog.txtValue().setText(value);
58.498 + Util.wait(1000);
58.499 + new QueueTool().waitEmpty();
58.500 +
58.501 + dialog.btOK().pushNoBlock();
58.502 + Util.wait(1000);
58.503 + new QueueTool().waitEmpty();
58.504 + }
58.505 +
58.506 + /**
58.507 + * Adds a new parameter to a query criteria.
58.508 + * @param column a name of a required column
58.509 + */
58.510 + public void addParamCriteria(String column) {
58.511 + AddQueryCriteriaOperator dialog = invokeAddCriteria(column);
58.512 +
58.513 + dialog.rbtParameter().setSelected(true);
58.514 + Util.wait(1000);
58.515 + new QueueTool().waitEmpty();
58.516 +
58.517 + dialog.btOK().pushNoBlock();
58.518 + Util.wait(1500);
58.519 + new QueueTool().waitEmpty();
58.520 + }
58.521 +
58.522 + /**
58.523 + * Adds a new parameter to a query criteria.
58.524 + * @param column a number of a required column
58.525 + */
58.526 + public void addParamCriteria(int column) {
58.527 + AddQueryCriteriaOperator dialog = invokeAddCriteria(column);
58.528 +
58.529 + dialog.rbtParameter().setSelected(true);
58.530 + Util.wait(1000);
58.531 + new QueueTool().waitEmpty();
58.532 +
58.533 + dialog.btOK().pushNoBlock();
58.534 + Util.wait(1500);
58.535 + new QueueTool().waitEmpty();
58.536 + }
58.537 +
58.538 + /**
58.539 + * Selects "graphical join" of database tables (an arrow between 2 tables)
58.540 + * on graphical diagram.
58.541 + * @param table1 the 1st database table
58.542 + * @param table2 the 2nd database table
58.543 + * @deprecated Uses old graph library
58.544 + */
58.545 + public void selectJoin(String table1, String table2) {
58.546 + QueryBuilderGraphFrame gframe = (QueryBuilderGraphFrame) getGraphFrame().getSource();
58.547 +
58.548 + QueryBuilderInternalFrame fr1 = (QueryBuilderInternalFrame) getTableFrame(table1).getSource();
58.549 + QueryBuilderInternalFrame fr2 = (QueryBuilderInternalFrame) getTableFrame(table2).getSource();
58.550 +/* TODO: jgraph remnoed
58.551 + DefaultGraphCell cell1 = fr1.getGraphCell();
58.552 + DefaultGraphCell cell2 = fr2.getGraphCell();
58.553 +
58.554 + for(int i=0;i<gframe.getGraph().getModel().getRootCount();i++) {
58.555 + Object o = gframe.getGraph().getModel().getRootAt(i);
58.556 +
58.557 + if(gframe.getGraph().getModel().isEdge(o)) {
58.558 +
58.559 + DefaultEdge e = (DefaultEdge) o;
58.560 +
58.561 + DefaultPort sourcePort = (DefaultPort)e.getSource();
58.562 + DefaultPort targetPort = (DefaultPort)e.getTarget();
58.563 +
58.564 + DefaultGraphCell sourceCell = (DefaultGraphCell) sourcePort.getParent();
58.565 + DefaultGraphCell targetCell = (DefaultGraphCell) targetPort.getParent();
58.566 +
58.567 + if(sourceCell == cell2 && targetCell == cell1 ||
58.568 + sourceCell == cell1 && targetCell == cell2) {
58.569 + Rectangle rect = gframe.getGraph().getCellBounds(o);
58.570 + ComponentOperator desktop = ComponentOperator.createOperator(gframe.getGraph());
58.571 + desktop.clickMouse((int) rect.getCenterX(), (int) rect.getCenterY(), 1);
58.572 + Util.wait(2000);
58.573 + break;
58.574 + }
58.575 + }
58.576 +
58.577 + }
58.578 + */
58.579 + }
58.580 +
58.581 + /**
58.582 + * Find Container consist Table with given tableName
58.583 + */
58.584 + private Container findTableFrame(String tableName) {
58.585 + java.awt.Container container = new JTableOperator(this,
58.586 + new QueryBuilderTableChooser(tableName)).getParent();
58.587 + while (!(container instanceof QBNodeComponent)) {
58.588 + container = container.getParent();
58.589 + System.out.println("TRACE: findTableFrame: "+ container.getClass().getName());
58.590 + }
58.591 + return container;
58.592 + }
58.593 +
58.594 + /**
58.595 + * This internal class handles a frame with a "graphical table"
58.596 + * on graphical diagram.
58.597 + */
58.598 + public class TableFrameOperator extends /*JComponentOperator*/ ContainerOperator {
58.599 + JTableOperator table = null;
58.600 + String tableName;
58.601 +
58.602 + /**
58.603 + * Creates new instance of this class.
58.604 + * @param tableName a name of database table
58.605 + */
58.606 + public TableFrameOperator(String tableName) {
58.607 + super(findTableFrame(tableName));
58.608 + //super(QueryBuilderOperator.this, new TableFrameChooser(tableName));
58.609 + this.tableName = tableName;
58.610 + //super(QueryBuilderOperator.this, tableName);
58.611 + }
58.612 + /*
58.613 + public TableFrameOperator(ContainerOperator cont) {
58.614 + super(cont, new TableFrameChooser());
58.615 + }
58.616 + */
58.617 +
58.618 + public String getTitle() {
58.619 + return tableName;
58.620 + }
58.621 +
58.622 + public ContainerOperator getTitleOperator() {
58.623 + Container cont = this.getTable().getParent();
58.624 + cont = cont.getParent();
58.625 + //cont = cont.getParent();
58.626 + return new ContainerOperator(cont);
58.627 + }
58.628 +
58.629 + /**
58.630 + * Returns an object JTableOperator, related to a database table,
58.631 + * included into graphical frame.
58.632 + * @return an object JTableOperator
58.633 + */
58.634 + public JTableOperator getTable() {
58.635 + if(table == null) {
58.636 + table = new JTableOperator(this, new QueryBuilderTableChooser());
58.637 + this.getQueueTool().waitEmpty(100);
58.638 + }
58.639 + return(table);
58.640 + }
58.641 +
58.642 + /**
58.643 + * Reversible selection changing of a single field of "graphical table".
58.644 + * @param fieldName a name of table field
58.645 + */
58.646 + public void changeFieldSelection(String fieldName) {
58.647 + System.out.println(fieldName);
58.648 + System.out.println(getTable().findCell(fieldName, 0));
58.649 + int row = getTable().findCell(fieldName, 0).y;
58.650 + if(row == -1) {
58.651 + throw(new JemmyException("Can not find \"" + fieldName +
58.652 + "\" in \"\" table"));
58.653 + }
58.654 + getTable().clickOnCell(row, 0);
58.655 + }
58.656 + /**
58.657 + * Chooser for Table in Graph View Frame
58.658 + *
58.659 + */
58.660 + public class QueryBuilderTableChooser implements ComponentChooser {
58.661 +
58.662 + public boolean checkComponent(Component comp) {
58.663 + boolean res = comp instanceof QueryBuilderTable;
58.664 + if (res) {
58.665 + String firstValue = ((QueryBuilderTable)comp).getValueAt(0, 2).toString();
58.666 + String secondValue = ((QueryBuilderTable)comp).getValueAt(1, 2).toString();
58.667 + //System.out.println("TRACE: QueryBuilderTableChooser: firstValue = "+
58.668 + // ((QueryBuilderTable)comp).getValueAt(0, 2));
58.669 + //System.out.println("TRACE: QueryBuilderTableChooser: secondValue = " +secondValue);
58.670 + boolean firstFound = false;
58.671 + boolean secondFound = false;
58.672 + JTableOperator inputTable = QueryBuilderOperator.this.getInputTable();
58.673 + int rowCout = inputTable.getRowCount();
58.674 + for (int i=0;i<rowCout;i++) {
58.675 + if ((inputTable.getValueAt(i, 0).toString().equals(firstValue)) &&
58.676 + (inputTable.getValueAt(i, 2).toString().indexOf(TableFrameOperator.this.tableName)!=-1)) {
58.677 + firstFound = true;
58.678 + break;
58.679 + }
58.680 + }
58.681 + for (int i=0;i<rowCout;i++) {
58.682 + if ((inputTable.getValueAt(i, 0).toString().equals(secondValue)) &&
58.683 + (inputTable.getValueAt(i, 2).toString().indexOf(TableFrameOperator.this.tableName)!=-1)) {
58.684 + secondFound = true;
58.685 + break;
58.686 + }
58.687 + }
58.688 + return firstFound && secondFound;
58.689 + }
58.690 + return false;
58.691 + }
58.692 +
58.693 + public String getDescription() {
58.694 + return "Chooser for QueryBuilderTable";
58.695 + }
58.696 +
58.697 + }
58.698 + }
58.699 +
58.700 + public class QueryBuilderTableChooser implements ComponentChooser {
58.701 + String tableName;
58.702 +
58.703 + public QueryBuilderTableChooser(String tableName) {
58.704 + this.tableName = tableName;
58.705 + }
58.706 +
58.707 + public boolean checkComponent(Component comp) {
58.708 + boolean res = comp instanceof QueryBuilderTable;
58.709 + if (res) {
58.710 + String firstValue = ((QueryBuilderTable)comp).getValueAt(0, 2).toString();
58.711 + String secondValue = ((QueryBuilderTable)comp).getValueAt(1, 2).toString();
58.712 + //System.out.println("TRACE: QueryBuilderTableChooser: firstValue = "+
58.713 + // ((QueryBuilderTable)comp).getValueAt(0, 2));
58.714 + //System.out.println("TRACE: QueryBuilderTableChooser: secondValue = " +secondValue);
58.715 + boolean firstFound = false;
58.716 + boolean secondFound = false;
58.717 + JTableOperator inputTable = QueryBuilderOperator.this.getInputTable();
58.718 + int rowCout = inputTable.getRowCount();
58.719 + for (int i=0;i<rowCout;i++) {
58.720 + if ((inputTable.getValueAt(i, 0).toString().equals(firstValue)) &&
58.721 + (inputTable.getValueAt(i, 2).toString().indexOf(tableName)!=-1)) {
58.722 + firstFound = true;
58.723 + break;
58.724 + }
58.725 + }
58.726 + for (int i=0;i<rowCout;i++) {
58.727 + if ((inputTable.getValueAt(i, 0).toString().equals(secondValue)) &&
58.728 + (inputTable.getValueAt(i, 2).toString().indexOf(tableName)!=-1)) {
58.729 + secondFound = true;
58.730 + break;
58.731 + }
58.732 + }
58.733 + return firstFound && secondFound;
58.734 + }
58.735 + return false;
58.736 + }
58.737 +
58.738 + public String getDescription() {
58.739 + return "Chooser for QueryBuilderTable";
58.740 + }
58.741 +
58.742 + }
58.743 + /**
58.744 + * TableFrameChooser
58.745 + * @deprecated TODO: Need to choose correct table name
58.746 + */
58.747 + public class TableFrameChooser implements ComponentChooser {
58.748 + String tableName;
58.749 + public TableFrameChooser(String tableName) {
58.750 + this.tableName = tableName;
58.751 + }
58.752 + public boolean checkComponent(Component comp) {
58.753 + if (comp instanceof QueryBuilderPane) {
58.754 + return true;
58.755 + }
58.756 + return false;
58.757 + }
58.758 +
58.759 + public String getDescription() {
58.760 + return "TableFrameChooser";
58.761 + }
58.762 +
58.763 + }
58.764 +
58.765 +
58.766 + /**
58.767 + *
58.768 + *
58.769 + */
58.770 + public class QueryBuilderPaneOperator extends ContainerOperator {
58.771 + public QueryBuilderPaneOperator() {
58.772 + super(QueryBuilderOperator.this, new QueryBuilderPaneChooser());
58.773 + }
58.774 + }
58.775 +
58.776 + public class QueryBuilderPaneChooser implements ComponentChooser {
58.777 + public boolean checkComponent(Component comp) {
58.778 + return comp instanceof QueryBuilderPane;
58.779 + }
58.780 + public String getDescription() {
58.781 + return "QueryBuilderPane Component";
58.782 + }
58.783 + }
58.784 +
58.785 + /**
58.786 + * @deprecated
58.787 + */
58.788 + public class QueryBuilderGraphFrameOperator extends ContainerOperator {
58.789 + public QueryBuilderGraphFrameOperator() {
58.790 + super(QueryBuilderOperator.this, new QueryBuilderGraphFrameChooser());
58.791 + }
58.792 + }
58.793 + /**
58.794 + *
58.795 + */
58.796 + public class QueryBuilderGraphFrameChooser implements ComponentChooser {
58.797 + public boolean checkComponent(Component comp) {
58.798 + return(comp instanceof QueryBuilderGraphFrame);
58.799 + }
58.800 + public String getDescription() {
58.801 + return(QueryBuilderGraphFrame.class.getName());
58.802 + }
58.803 + }
58.804 +
58.805 + public class InputTableOperator extends JTableOperator {
58.806 + public InputTableOperator() {
58.807 + super(QueryBuilderOperator.this, new Operator.Finder(QueryBuilderInputTable.class));
58.808 + }
58.809 +
58.810 + }
58.811 +
58.812 + /**
58.813 + * Looking for QueryBuilderInputTable by searching its instances and choosing one
58.814 + * which contains tableName Tabke
58.815 + */
58.816 + public static class QueryBuilderInputTableChooser implements ComponentChooser {
58.817 + String tableName;
58.818 +
58.819 + /**
58.820 + *
58.821 + * @param tableName Name of the Table in QueryBuilderInputTable
58.822 + */
58.823 + public QueryBuilderInputTableChooser(String tableName) {
58.824 + this.tableName = tableName;
58.825 + }
58.826 +
58.827 +
58.828 + public boolean checkComponent(Component comp) {
58.829 + if (comp instanceof QueryBuilderInputTable) {
58.830 + JTableOperator table = new JTableOperator((QueryBuilderInputTable)comp);
58.831 + //System.out.println("TRACE: QueryBuilderInputTableChooser table = "+ table.getValueAt(0, 2).toString());
58.832 + if (table.getValueAt(0, 2).toString().indexOf(tableName)!=-1)
58.833 + return true;
58.834 + }
58.835 + return false;
58.836 + }
58.837 +
58.838 + public String getDescription() {
58.839 + return "QueryInputTable with name: " + tableName;
58.840 + }
58.841 +
58.842 + }
58.843 +
58.844 + /**
58.845 + * TODO: Doesn't work properly, not used anymore
58.846 + * @deprecated
58.847 + */
58.848 + public static class QueryBuilderChooser implements ComponentChooser {
58.849 + private String tabId = null;
58.850 +
58.851 + public QueryBuilderChooser() {
58.852 + }
58.853 +
58.854 + public QueryBuilderChooser(String _tabId) {
58.855 + tabId = _tabId;
58.856 + }
58.857 +
58.858 + public boolean checkComponent(Component comp) {
58.859 + boolean res = comp instanceof QueryBuilder;
58.860 + if(tabId != null && res) {
58.861 + String name = new JTableOperator(new ContainerOperator(ContainerOperator.findContainerUnder(comp)),
58.862 + new QueryBuilderInputTableChooser(tabId)).getValueAt(0, 2).toString();
58.863 + if (name.equalsIgnoreCase(tabId)) {
58.864 + return true;
58.865 + }
58.866 + return false;
58.867 + } else {
58.868 + return res;
58.869 + }
58.870 + }
58.871 +
58.872 + public String getDescription() {
58.873 + return(QueryBuilder.class.getName());
58.874 + }
58.875 + }
58.876 +
58.877 + /**
58.878 + * Finds in a bundle file and returns an actual text of control component.
58.879 + * @param p_text string-key corresponding to required control component.
58.880 + * @return actual text of control component
58.881 + * @deprecated No Bundle present
58.882 + */
58.883 + public static String getBundleString(String p_text) {
58.884 + System.out.println("Getting bundle for " + p_text);
58.885 + try {
58.886 + return Bundle.getStringTrimmed("com.sun.rave.dataconnectivity.querybuilder.Bundle", p_text);
58.887 + } catch (JemmyException e) {}
58.888 + return null;
58.889 + }
58.890 +}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ServerExplorerOperator.java Thu Jul 10 04:32:50 2008 -0700
59.3 @@ -0,0 +1,790 @@
59.4 +/*
59.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
59.6 +*
59.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
59.8 +*
59.9 +* The contents of this file are subject to the terms of either the GNU
59.10 +* General Public License Version 2 only ("GPL") or the Common
59.11 +* Development and Distribution License("CDDL") (collectively, the
59.12 +* "License"). You may not use this file except in compliance with the
59.13 +* License. You can obtain a copy of the License at
59.14 +* http://www.netbeans.org/cddl-gplv2.html
59.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
59.16 +* specific language governing permissions and limitations under the
59.17 +* License. When distributing the software, include this License Header
59.18 +* Notice in each file and include the License file at
59.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
59.20 +* particular file as subject to the "Classpath" exception as provided
59.21 +* by Sun in the GPL Version 2 section of the License file that
59.22 +* accompanied this code. If applicable, add the following below the
59.23 +* License Header, with the fields enclosed by brackets [] replaced by
59.24 +* your own identifying information:
59.25 +* "Portions Copyrighted [year] [name of copyright owner]"
59.26 +*
59.27 +* Contributor(s):
59.28 +*
59.29 +* The Original Software is NetBeans. The Initial Developer of the Original
59.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
59.31 +* Microsystems, Inc. All Rights Reserved.
59.32 +*
59.33 +* If you wish your version of this file to be governed by only the CDDL
59.34 +* or only the GPL Version 2, indicate your decision by adding
59.35 +* "[Contributor] elects to include this software in this distribution
59.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
59.37 +* single choice of license, a recipient has the option to distribute
59.38 +* your version of this file under either the CDDL, the GPL Version 2 or
59.39 +* to extend the choice of license to its licensees as provided above.
59.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
59.41 +* Version 2 license, then the option applies only if the new code is
59.42 +* made subject to such option by the copyright holder.
59.43 +*/
59.44 +
59.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
59.46 +
59.47 +import org.netbeans.modules.visualweb.gravy.DNDDriver;
59.48 +import org.netbeans.modules.visualweb.gravy.TestUtils;
59.49 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
59.50 +import org.netbeans.modules.visualweb.gravy.Util;
59.51 +import org.netbeans.modules.visualweb.gravy.websvc.AddWebServiceOperator;
59.52 +import org.netbeans.modules.visualweb.gravy.nodes.WebServicesNode;
59.53 +import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
59.54 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
59.55 +import org.netbeans.modules.visualweb.gravy.model.deployment.DeploymentTargetDescriptor;
59.56 +import org.netbeans.jellytools.Bundle;
59.57 +import org.netbeans.jellytools.NbDialogOperator;
59.58 +import org.netbeans.jellytools.WizardOperator;
59.59 +import org.netbeans.jemmy.JemmyProperties;
59.60 +import org.netbeans.jemmy.QueueTool;
59.61 +import org.netbeans.jemmy.TimeoutExpiredException;
59.62 +import org.netbeans.jemmy.operators.*;
59.63 +import javax.swing.*;
59.64 +import javax.swing.tree.TreePath;
59.65 +import javax.swing.tree.TreeNode;
59.66 +import java.awt.*;
59.67 +import java.awt.event.KeyEvent;
59.68 +import org.netbeans.jemmy.Waitable;
59.69 +import org.netbeans.jemmy.Waiter;
59.70 +import java.util.Hashtable;
59.71 +
59.72 +/**
59.73 + * This class implements test functionality for the window "ServerExplorer".
59.74 + */
59.75 +public class ServerExplorerOperator extends TopComponentOperator {
59.76 +
59.77 + public static final String
59.78 + STR_NAME_WEBLOGIC = "BEA WebLogic Server",
59.79 + STR_NAME_JBOSS = "JBoss Application Server",
59.80 + STR_NAME_APPSERVER = "Sun Java System Application Server",
59.81 + STR_NAME_GLASSFISH_V1 = "GlassFish V1",
59.82 + STR_NAME_GLASSFISH_V2 = "GlassFish V2",
59.83 + STR_NAME_TOMCAT50 = "Tomcat 5.0",
59.84 + STR_NAME_TOMCAT55 = "Tomcat 5.5",
59.85 + STR_NAME_TOMCAT60 = "Tomcat 6.0",
59.86 + STR_MENU_ITEM_SERVER_MANAGER = "Tools|Servers",
59.87 + STR_DIALOG_TITLE_SERVER_MANAGER = "Servers",
59.88 + STR_WIZARD_TITLE_ADD_SERVER = "Add Server Instance",
59.89 + STR_BUTTON_TITLE_ADD_SERVER = "Add Server...",
59.90 + STR_BUTTON_TITLE_CLOSE = "Close",
59.91 + STR_BUTTON_TITLE_CHOOSE = "Choose",
59.92 + STR_MENU_ITEM_START = "Start",
59.93 + STR_MENU_ITEM_STOP = "Stop",
59.94 + STR_SERVERS_PATH = "Servers|",
59.95 + STR_SERVER_START = "Starting ",
59.96 + STR_SERVER_STOP = "Stopping ";
59.97 +
59.98 + JTreeOperator tree = null;
59.99 +
59.100 + /**
59.101 + * Creates a new instance of this class
59.102 + * @param parent an object ContainerOperator related to container, which
59.103 + * includes window "Server Explorer".
59.104 + */
59.105 + public ServerExplorerOperator(ContainerOperator parent) {
59.106 + super(parent, "Services");
59.107 + }
59.108 +
59.109 + /**
59.110 + * Creates a new instance of this class
59.111 + */
59.112 + public ServerExplorerOperator() {
59.113 + this(Util.getMainWindow());
59.114 + }
59.115 +
59.116 + /**
59.117 + * Returns a tree, which is contained in the window "Server Explorer".
59.118 + * @return an object JTreeOperator
59.119 + */
59.120 + public JTreeOperator getTree() {
59.121 + if (tree == null) {
59.122 + makeComponentVisible();
59.123 + tree = new JTreeOperator(this);
59.124 + }
59.125 + return (tree);
59.126 + }
59.127 +
59.128 + /**
59.129 + * Selects a tree node according to a required tree path.
59.130 + * @param treePath a path of required tree node
59.131 + */
59.132 + public void selectPath(String treePath) {
59.133 + makeComponentVisible();
59.134 + TestUtils.wait(500);
59.135 + TreePath path = getTree().findPath(treePath);
59.136 + TestUtils.wait(500);
59.137 + tree.selectPath(path);
59.138 + }
59.139 +
59.140 + /**
59.141 + * Clicks an item of popup menu, related to required tree node.
59.142 + * @param treePath a path of required tree node
59.143 + * @param menu a name of menu item
59.144 + */
59.145 + public void pushPopup(String treePath, String menu) {
59.146 + pushPopup(getTree(), treePath, menu);
59.147 + }
59.148 +
59.149 + /**
59.150 + * Clicks an item of popup menu, related to required tree node.
59.151 + * @param tree an object JTreeOperator, related to a tree
59.152 + * @param treePath a path of required tree node
59.153 + * @param menu a name of menu item
59.154 + */
59.155 + public void pushPopup(JTreeOperator tree, String treePath, String menu) {
59.156 + new JPopupMenuOperator(getTree().callPopupOnPath(getTree().findPath(treePath))).pushMenuNoBlock(menu);
59.157 + new QueueTool().waitEmpty();
59.158 + TestUtils.wait(100);
59.159 + }
59.160 +
59.161 + /**
59.162 + * Clicks an item of popup menu, related to required tree node.
59.163 + * @param treePath a string array with path of required tree node
59.164 + * (sequence of node names from the root node to a required node)
59.165 + * @param menu a name of menu item
59.166 + */
59.167 + public void pushPopup(String[] treePath, String menu) {
59.168 + new JPopupMenuOperator(getTree().callPopupOnPath(getTree().findPath(treePath))).pushMenuNoBlock(menu);
59.169 + new QueueTool().waitEmpty();
59.170 + TestUtils.wait(100);
59.171 + }
59.172 +
59.173 + /**
59.174 + * Adds database table on Design View via popup menu, related to its tree node.
59.175 + * @param treePath a path of required tree node
59.176 + */
59.177 + public void addTable(String treePath) {
59.178 + selectPath(treePath);
59.179 + pushPopup(getTree(), treePath, "Add to Form");
59.180 + }
59.181 +
59.182 + /**
59.183 + * Adds database table on Design View via popup menu, related to its tree node.
59.184 + * @param treePath a path of required tree node
59.185 + * @param designer an object DesignerPaneOperator
59.186 + */
59.187 + public void addTable(String treePath, DesignerPaneOperator designer) {
59.188 + addTable(treePath, designer, new Point(1,1));
59.189 + }
59.190 +
59.191 + /**
59.192 + * Adds database table on Design View via popup menu, related to its tree node.
59.193 + * @param treePath a path of required tree node as object TreePath
59.194 + * @param designer an object DesignerPaneOperator
59.195 + */
59.196 + public void addTable(TreePath treePath, DesignerPaneOperator designer) {
59.197 + addTable(treePath, designer, new Point(1,1));
59.198 + }
59.199 +
59.200 + /**
59.201 + * Adds database table on Design View via popup menu, related to its tree node.
59.202 + * @param treePath a path of required tree node
59.203 + * @param designer an object DesignerPaneOperator
59.204 + * @param location a point on Design View for mouse clicking
59.205 + */
59.206 + public void addTable(String treePath, DesignerPaneOperator designer, Point location) {
59.207 + addTable(tree.findPath(treePath), designer, location);
59.208 + }
59.209 +
59.210 + /**
59.211 + * Adds database table on Design View via popup menu, related to its tree node.
59.212 + * @param treePath a path of required tree node as object TreePath
59.213 + * @param designer an object DesignerPaneOperator
59.214 + * @param location a point on Design View for mouse clicking
59.215 + */
59.216 + public void addTable(TreePath treePath, DesignerPaneOperator designer, Point location) {
59.217 + makeComponentVisible();
59.218 + TestUtils.wait(2000);
59.219 + //ServerNavigatorOperator.showNavigatorOperator();
59.220 + TestUtils.wait(500);
59.221 + tree.selectPath(treePath);
59.222 + TestUtils.wait(3000);
59.223 + new DNDDriver().dnd(tree, tree.getPointToClick(treePath), designer, location);
59.224 + TestUtils.wait(3000);
59.225 + }
59.226 +
59.227 + /**
59.228 + * Undeploys a project from an application server.
59.229 + * @param server a name of application server
59.230 + * @param prj a name of project
59.231 + * @param parse boolean parameter: true - only the first 2 chars of the
59.232 + * project name are considered, false - full project name is valuable
59.233 + */
59.234 + public static void undeployProject(String server, String prj, boolean parse) {
59.235 +
59.236 + String serverPath = null;
59.237 +
59.238 + serverPath = "Deployment Server";
59.239 +
59.240 +
59.241 + System.out.println("default is " + serverPath);
59.242 +
59.243 + // Select the Server Navigator and set the JTreeOperator
59.244 + new QueueTool().waitEmpty(100);
59.245 + ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
59.246 + explorer.makeComponentVisible();
59.247 + JTreeOperator tree = explorer.getTree();
59.248 +
59.249 + // Sleep 4 secs to make sure Server Navigator is in focus
59.250 + Util.wait(4000);
59.251 +
59.252 + // Need to refresh J2EE AppServer node
59.253 + explorer.pushPopup(tree, serverPath, "Refresh");
59.254 +
59.255 + // Increase timeout for tree to redisplay after refresh
59.256 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
59.257 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
59.258 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
59.259 +
59.260 + TestUtils.wait(1000);
59.261 + explorer.selectPath(serverPath+"|Deployed Components");
59.262 + explorer.getTree().expandPath(explorer.getTree().findPath(serverPath+"|Deployed Components"));
59.263 + System.out.println("TRACE: Path =" + serverPath+"|Deployed Components");
59.264 + TestUtils.wait(1000);
59.265 +
59.266 + // TODO delete workaround
59.267 + // ************* workaround *************
59.268 + explorer.pushPopup(tree, serverPath, "Refresh");
59.269 + TestUtils.wait(1000);
59.270 + explorer.selectPath(serverPath+"|Deployed Components");
59.271 + explorer.getTree().expandPath(explorer.getTree().findPath(serverPath+"|Deployed Components"));
59.272 + System.out.println("TRACE: Path =" + serverPath+"|Deployed Components");
59.273 + TestUtils.wait(1000);
59.274 + // ************* workaround *************
59.275 +
59.276 + explorer.selectPath(serverPath+"|Deployed Components|/"+prj);
59.277 + System.out.println("TRACE: Path =" + serverPath+"|Deployed Components|/"+prj);
59.278 + TestUtils.wait(1000);
59.279 + System.out.println("TRACE: Push Menu Undeploy...");
59.280 + explorer.pushPopup(explorer.getTree(), serverPath+"|Deployed Components|/"+prj, "Undeploy");
59.281 + }
59.282 +
59.283 + /**
59.284 + * Checks undeployment of a project from an application server.
59.285 + * @param server a name of application server
59.286 + * @param prj a name of project
59.287 + * @param parse boolean parameter: true - only the first 2 chars of the
59.288 + * project name are considered, false - full project name is valuable
59.289 + */
59.290 + public static boolean verifyUndeployment(String server, String prj, boolean parse) {
59.291 +
59.292 + System.out.println("Started!");
59.293 +
59.294 + String serverPath = null;
59.295 + String pePath = "Deployment Server";
59.296 + String deploymentPath = null;
59.297 + String defaultServer = null;
59.298 +
59.299 + serverPath = pePath;
59.300 + serverPath = "Deployment Server";
59.301 +
59.302 +
59.303 + // Select the Server Navigator and set the JTreeOperator
59.304 + new QueueTool().waitEmpty(100);
59.305 + ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
59.306 + explorer.makeComponentVisible();
59.307 + JTreeOperator tree = explorer.getTree();
59.308 +
59.309 +
59.310 + // Need to refresh J2EE AppServer node
59.311 + explorer.pushPopup(tree, serverPath, "Refresh");
59.312 +
59.313 + // Increase timeout for tree to redisplay after refresh
59.314 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
59.315 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
59.316 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
59.317 +
59.318 + // Get treepath of the parent node of Deployed components
59.319 + //recreate operator (just in case - to avoid caching)
59.320 + JTreeOperator oldTree = tree;
59.321 + tree = new JTreeOperator((JTree) tree.getSource());
59.322 + tree.copyEnvironment(oldTree);
59.323 + //do it two times 'cause refresh is delayed.
59.324 + TreePath deployedComps;
59.325 +
59.326 + try {
59.327 + deployedComps = tree.findPath(serverPath + "|Deployed Components");
59.328 + } catch (TimeoutExpiredException e) {
59.329 + deployedComps = tree.findPath(serverPath + "|Deployed Components");
59.330 + }
59.331 +
59.332 + // Expand the SN to the Deployed Components node
59.333 + explorer.getTree().selectPath(deployedComps);
59.334 + explorer.getTree().expandPath(deployedComps);
59.335 +
59.336 + Util.wait(1000);
59.337 + new QueueTool().waitEmpty(100);
59.338 +
59.339 + // Get a TreePath array of the deployed components
59.340 + TreePath[] aDeployedComps = tree.getChildPaths(deployedComps);
59.341 +
59.342 + boolean undeployed = true;
59.343 + // Search for a project matching prj if matches then undeploy
59.344 + for (int i = 0; i < aDeployedComps.length; i++) {
59.345 +
59.346 + // Get the index (position) of the project in the TreePath
59.347 + String prjNode = aDeployedComps[i].getLastPathComponent().toString();
59.348 + if (parse) prjNode = prjNode.substring(0, 3);
59.349 +
59.350 + JemmyProperties.getCurrentOutput().printLine(aDeployedComps[i].toString());
59.351 + JemmyProperties.getCurrentOutput().printLine(aDeployedComps[i].getLastPathComponent().toString());
59.352 +
59.353 + if (prjNode.equals("/" + prj)) {
59.354 + Util.wait(1000);
59.355 + undeployed = false;
59.356 + new QueueTool().waitEmpty(100);
59.357 + }
59.358 + } // end for
59.359 +
59.360 + return undeployed;
59.361 + }
59.362 +
59.363 + /**
59.364 + * Removes a resource from an application server.
59.365 + * @param resource a name of resource (tree node)
59.366 + */
59.367 + public static void deleteResource(String resource) {
59.368 +
59.369 + System.out.println("Started!");
59.370 +
59.371 + String serverPath = null;
59.372 + String pePath = "Deployment Server";
59.373 + TreePath resourcePath = null;
59.374 + String defaultServer = null;
59.375 +
59.376 + serverPath = pePath;
59.377 + serverPath = "Deployment Server";
59.378 +
59.379 +
59.380 + // Select the Server Navigator and set the JTreeOperator
59.381 + new QueueTool().waitEmpty(100);
59.382 + ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
59.383 + explorer.makeComponentVisible();
59.384 + JTreeOperator tree = explorer.getTree();
59.385 +
59.386 +
59.387 + // Need to refresh J2EE AppServer node
59.388 + explorer.pushPopup(tree, serverPath, "Refresh");
59.389 +
59.390 + // Increase timeout for tree to redisplay after refresh
59.391 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
59.392 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
59.393 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
59.394 +
59.395 + // Get treepath of the parent node of Deployed components
59.396 + //recreate operator (just in case - to avoid caching)
59.397 + JTreeOperator oldTree = tree;
59.398 + tree = new JTreeOperator((JTree) tree.getSource());
59.399 + tree.copyEnvironment(oldTree);
59.400 + //do it two times 'cause refresh is delayed.
59.401 +
59.402 +
59.403 + try {
59.404 + explorer.makeComponentVisible();
59.405 + TestUtils.wait(500);
59.406 + resourcePath = tree.findPath(serverPath + "|Resources");
59.407 + } catch (TimeoutExpiredException e) {
59.408 + explorer.makeComponentVisible();
59.409 + TestUtils.wait(500);
59.410 + resourcePath = tree.findPath(serverPath + "|Resources");
59.411 + }
59.412 +
59.413 + TestUtils.wait(500);
59.414 + // Expand the SN to the Deployed Components node
59.415 + explorer.getTree().selectPath(resourcePath);
59.416 + explorer.getTree().expandPath(resourcePath);
59.417 +
59.418 + try {
59.419 + Thread.sleep(1000);
59.420 + } catch (Exception e) {
59.421 + }
59.422 + new QueueTool().waitEmpty(100);
59.423 +
59.424 + // Get a TreePath array of the deployed components
59.425 + TreePath[] aResources = tree.getChildPaths(resourcePath);
59.426 +
59.427 + // Search for a project matching prj if matches then undeploy
59.428 + for (int i = 0; i < aResources.length; i++) {
59.429 + // Get the index (position) of the project in the TreePath
59.430 + String resNode = aResources[i].getLastPathComponent().toString();
59.431 +
59.432 + JemmyProperties.getCurrentOutput().printLine(aResources[i].toString());
59.433 + JemmyProperties.getCurrentOutput().printLine(aResources[i].getLastPathComponent().toString());
59.434 +
59.435 + if (resNode.equals(resource)) {
59.436 + Util.wait(1000);
59.437 + new QueueTool().waitEmpty(100);
59.438 + //Remove resource
59.439 + explorer.pushPopup(tree, serverPath + "|Resources|" + resource, "Delete");
59.440 + new QueueTool().waitEmpty(100);
59.441 + }
59.442 + } // end for
59.443 + }
59.444 +
59.445 + /**
59.446 + * Stops an application server.
59.447 + * @param server a name of an application server (name of tree node)
59.448 + */
59.449 + public static void stopServer(String server) {
59.450 + // Select the Runtime and set the JTreeOperator
59.451 + new QueueTool().waitEmpty(100);
59.452 + ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
59.453 + TestUtils.wait(2000);
59.454 + JTreeOperator tree = explorer.getTree();
59.455 + TestUtils.wait(1000);
59.456 +
59.457 + // Select the requested server node
59.458 + tree.selectPath(tree.findPath(STR_SERVERS_PATH + server));
59.459 + TestUtils.wait(5000);
59.460 + // open context menu on the requested server node
59.461 + new QueueTool().waitEmpty(100);
59.462 + tree.callPopupOnPath(tree.findPath(STR_SERVERS_PATH + server));
59.463 + TestUtils.wait(500);
59.464 + JPopupMenuOperator snpm = new JPopupMenuOperator();
59.465 + TestUtils.wait(1000);
59.466 + if (!(new JMenuItemOperator(snpm, STR_MENU_ITEM_STOP).isEnabled()))
59.467 + tree.pushKey(KeyEvent.VK_ESCAPE);
59.468 + else {
59.469 + JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), 1);
59.470 + new JMenuItemOperator(snpm, STR_MENU_ITEM_STOP).push();
59.471 + while (jlo.getText() == null || !jlo.getText().equals(STR_SERVER_STOP + server)) {
59.472 + jlo = new JLabelOperator(Util.getMainWindow(), 1);
59.473 + System.out.println("label in first cycle = " + jlo.getText());
59.474 + TestUtils.wait(1000);
59.475 + }
59.476 + while (jlo.getText() != null && jlo.getText().equals(STR_SERVER_STOP + server)) {
59.477 + jlo = new JLabelOperator(Util.getMainWindow(), 1);
59.478 + TestUtils.wait(1000);
59.479 + }
59.480 + TestUtils.wait(1000);
59.481 + }
59.482 + new QueueTool().waitEmpty(100);
59.483 + TestUtils.wait(5000);
59.484 + }
59.485 +
59.486 + /**
59.487 + * Checks if an application server is started or not.
59.488 + * @param server a name of an application server (name of tree node)
59.489 + * @return true - server is running, false - otherwise.
59.490 + */
59.491 + public static boolean isServerStarted(String server) throws Exception {
59.492 + String serverPath = null;
59.493 + String pePath = "Deployment Server";
59.494 + String deploymentPath = null;
59.495 +
59.496 + // Select the Server Navigator and set the JTreeOperator
59.497 + new QueueTool().waitEmpty(100);
59.498 + ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
59.499 + explorer.makeComponentVisible();
59.500 + JTreeOperator tree = explorer.getTree();
59.501 +
59.502 + // Sleep 4 secs to make sure Server Navigator is in focus
59.503 + Util.wait(1000);
59.504 +
59.505 + serverPath = pePath;
59.506 +
59.507 + // Select the requested server node
59.508 + TreePath serverNode = tree.findPath(serverPath);
59.509 + explorer.getTree().selectPath(serverNode);
59.510 + explorer.getTree().expandPath(serverNode);
59.511 + TreePath serverSubNode = tree.findPath(serverPath);
59.512 + explorer.getTree().selectPath(serverSubNode);
59.513 +
59.514 + // open context menu on the requested server node
59.515 + new QueueTool().waitEmpty(100);
59.516 +
59.517 + explorer.pushPopup(tree, serverPath,
59.518 + Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.actions.Bundle",
59.519 + "LBL_StartStopServer"));
59.520 + JDialogOperator serverStatusDialog = new JDialogOperator("Server Status");
59.521 + // "Server Status - deployer:Sun:AppServer::localhost:14848");
59.522 + new JCheckBoxOperator(serverStatusDialog,
59.523 + Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.Bundle",
59.524 + "LBL_Close_When_Finished")).changeSelection(true);
59.525 + final JButtonOperator buttonStart = new JButtonOperator(serverStatusDialog,
59.526 + "Start Server");
59.527 + final JButtonOperator buttonStop = new JButtonOperator(serverStatusDialog,
59.528 + "Stop Server");
59.529 +
59.530 + new Waiter(new Waitable() {
59.531 + public Object actionProduced(Object obj) {
59.532 + return (((buttonStart != null && buttonStart.isEnabled()) ||
59.533 + (buttonStop != null && buttonStop.isEnabled())) ? this : null);
59.534 + }
59.535 + public String getDescription() {
59.536 + return "One of Start/Stop buttons to enable";
59.537 + }
59.538 + }).waitAction(null);
59.539 +
59.540 + boolean started = !((buttonStart != null) && (buttonStart.isEnabled()));
59.541 +
59.542 + serverStatusDialog.close();
59.543 + serverStatusDialog.dispose();
59.544 +
59.545 + new QueueTool().waitEmpty(100);
59.546 + return started;
59.547 + }
59.548 +
59.549 + /**
59.550 + * Starts an application server.
59.551 + * @param server a name of an application server (name of tree node)
59.552 + */
59.553 + public static void startServer(String server) throws Exception {
59.554 + // Select the Runtime and set the JTreeOperator
59.555 + new QueueTool().waitEmpty(100);
59.556 + ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
59.557 + TestUtils.wait(2000);
59.558 + JTreeOperator tree = explorer.getTree();
59.559 + TestUtils.wait(1000);
59.560 +
59.561 + // Select the requested server node
59.562 + tree.selectPath(tree.findPath(STR_SERVERS_PATH + server));
59.563 + TestUtils.wait(5000);
59.564 + // open context menu on the requested server node
59.565 + new QueueTool().waitEmpty(100);
59.566 + tree.callPopupOnPath(tree.findPath(STR_SERVERS_PATH + server));
59.567 + TestUtils.wait(500);
59.568 + JPopupMenuOperator snpm = new JPopupMenuOperator();
59.569 + TestUtils.wait(1000);
59.570 + if (!(new JMenuItemOperator(snpm, STR_MENU_ITEM_START).isEnabled()))
59.571 + tree.pushKey(KeyEvent.VK_ESCAPE);
59.572 + else {
59.573 + JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), 1);
59.574 + new JMenuItemOperator(snpm, STR_MENU_ITEM_START).push();
59.575 + while (jlo.getText() == null || !jlo.getText().equals(STR_SERVER_START + server)) {
59.576 + jlo = new JLabelOperator(Util.getMainWindow(), 1);
59.577 + System.out.println("label in first cycle = " + jlo.getText());
59.578 + TestUtils.wait(1000);
59.579 + }
59.580 + while (jlo.getText() != null && jlo.getText().equals(STR_SERVER_START + server)) {
59.581 + jlo = new JLabelOperator(Util.getMainWindow(), 1);
59.582 + TestUtils.wait(1000);
59.583 + }
59.584 + TestUtils.wait(1000);
59.585 + }
59.586 + new QueueTool().waitEmpty(100);
59.587 + TestUtils.wait(5000);
59.588 + }
59.589 +
59.590 + /**
59.591 + * Adds a deployment target.
59.592 + * @param DTDescriptor object DeploymentTargetDescriptor, describing
59.593 + * properties of deployment target
59.594 + */
59.595 + public static void addDeploymentTarget(DeploymentTargetDescriptor DTDescriptor) {
59.596 + Hashtable properties = (Hashtable) DTDescriptor.getProperties();
59.597 +
59.598 + String serverType = properties.get(DeploymentTargetDescriptor.SERVER_TYPE_KEY).toString();
59.599 +
59.600 + //log("Open Server manager");
59.601 + ActionNoBlock srv = new ActionNoBlock(STR_MENU_ITEM_SERVER_MANAGER, "", "");
59.602 + srv.performMenu();
59.603 + TestUtils.wait(500);
59.604 +
59.605 + //log("Find Server manager dialog");
59.606 + NbDialogOperator serverManager = new NbDialogOperator(STR_DIALOG_TITLE_SERVER_MANAGER);
59.607 +
59.608 + // Is server in list?
59.609 + // We want to use here public API
59.610 + JTreeOperator jto = new JTreeOperator(serverManager);
59.611 + Object[] treeNodes = jto.getChildren(jto.getRoot());
59.612 + int length = treeNodes.length;
59.613 + String addServerName = properties.get(DeploymentTargetDescriptor.NAME_KEY + serverType).toString();
59.614 + for (int i = 0; i < length; i++) {
59.615 + String currentServerName = treeNodes[i].toString();
59.616 + if (currentServerName.equals(addServerName)) {
59.617 + //log("press close for server manager");
59.618 + JButtonOperator close = new JButtonOperator(serverManager, STR_BUTTON_TITLE_CLOSE);
59.619 + close.pushNoBlock();
59.620 + TestUtils.wait(500);
59.621 + return;
59.622 + }
59.623 + }
59.624 +
59.625 + //log("Press add server button");
59.626 + JButtonOperator addServer = new JButtonOperator(serverManager, STR_BUTTON_TITLE_ADD_SERVER);
59.627 + addServer.pushNoBlock();
59.628 + TestUtils.wait(500);
59.629 +
59.630 + //log("locate server instance wizard");
59.631 + WizardOperator serverInstance = new WizardOperator(STR_WIZARD_TITLE_ADD_SERVER);
59.632 +
59.633 + //log("Chose Server");
59.634 + //JComboBoxOperator cbServerType = new JComboBoxOperator(serverInstance);
59.635 + //cbServerType.selectItem(serverType);
59.636 + JListOperator jlo = new JListOperator(serverInstance, 1);
59.637 + jlo.selectItem(serverType);
59.638 + TestUtils.wait(500);
59.639 +
59.640 + //log("Enter Name");
59.641 + JTextFieldOperator tfName = new JTextFieldOperator(serverInstance);
59.642 + tfName.setText(properties.get(DeploymentTargetDescriptor.NAME_KEY + serverType).toString());
59.643 + TestUtils.wait(500);
59.644 +
59.645 + //log("Go to next wizard page");
59.646 + serverInstance.next();
59.647 + TestUtils.wait(500);
59.648 +
59.649 + //log("Set location");
59.650 + String projectPath = properties.get(DeploymentTargetDescriptor.PATH_KEY + serverType).toString();
59.651 + JTextFieldOperator fileName;
59.652 + if (serverType.equals(STR_NAME_TOMCAT50) || serverType.equals(STR_NAME_TOMCAT55) || serverType.equals(STR_NAME_TOMCAT60))
59.653 + fileName = new JTextFieldOperator(serverInstance, 1);
59.654 + else
59.655 + fileName = new JTextFieldOperator(serverInstance, 0);
59.656 + fileName.setText(projectPath);
59.657 +
59.658 + TestUtils.wait(5000);
59.659 +
59.660 + if (serverType.equals(STR_NAME_WEBLOGIC)) addWebLogic(serverType, properties, serverInstance);
59.661 + if (serverType.equals(STR_NAME_JBOSS)) addJBoss(serverType, properties, serverInstance);
59.662 + if (serverType.equals(STR_NAME_APPSERVER) || serverType.equals(STR_NAME_GLASSFISH_V1) || serverType.equals(STR_NAME_GLASSFISH_V2)) addAppServer(serverType, properties, serverInstance);
59.663 + if (serverType.equals(STR_NAME_TOMCAT50) || serverType.equals(STR_NAME_TOMCAT55) || serverType.equals(STR_NAME_TOMCAT60)) addTomcat(serverType, properties, serverInstance);
59.664 +
59.665 + //log("finish wizard");
59.666 + serverInstance.finish();
59.667 + TestUtils.wait(500);
59.668 +
59.669 + //log("press close for server manager");
59.670 + JButtonOperator close = new JButtonOperator(serverManager, STR_BUTTON_TITLE_CLOSE);
59.671 + close.pushNoBlock();
59.672 + TestUtils.wait(5000);
59.673 + }
59.674 +
59.675 + private static void addWebLogic(String serverType, Hashtable properties, WizardOperator serverInstance) {
59.676 + //workaround
59.677 + serverInstance.pushKey(KeyEvent.VK_LEFT);
59.678 +
59.679 + //log("Go to next wizard page");
59.680 + serverInstance.next();
59.681 + TestUtils.wait(500);
59.682 +
59.683 + //log("Choose Instance");
59.684 + JComboBoxOperator cbInstance = new JComboBoxOperator(serverInstance);
59.685 + cbInstance.selectItem(properties.get(DeploymentTargetDescriptor.DOMAIN_KEY + serverType).toString());
59.686 + TestUtils.wait(500);
59.687 +
59.688 + //log("Enter Login");
59.689 + JTextFieldOperator tfLogin = new JTextFieldOperator(serverInstance, 3);
59.690 + tfLogin.setText(properties.get(DeploymentTargetDescriptor.LOGIN_KEY + serverType).toString());
59.691 + TestUtils.wait(500);
59.692 +
59.693 + //log("Enter Password");
59.694 + JTextFieldOperator tfPassword = new JTextFieldOperator(serverInstance, 4);
59.695 + tfPassword.setText(properties.get(DeploymentTargetDescriptor.PASSWORD_KEY + serverType).toString());
59.696 + TestUtils.wait(500);
59.697 + }
59.698 +
59.699 + private static void addJBoss(String serverType, Hashtable properties, WizardOperator serverInstance) {
59.700 + //log("Go to next wizard page");
59.701 + serverInstance.next();
59.702 + TestUtils.wait(500);
59.703 + //log("Wizard step = " + serverInstance.stepsGetSelectedIndex() + ": " + serverInstance.stepsGetSelectedValue());
59.704 +
59.705 + //log("Choose Instance");
59.706 + JComboBoxOperator cbInstance = new JComboBoxOperator(serverInstance);
59.707 + cbInstance.selectItem(properties.get(DeploymentTargetDescriptor.DOMAIN_KEY + serverType).toString());
59.708 + TestUtils.wait(500);
59.709 + }
59.710 +
59.711 + private static void addAppServer(String serverType, Hashtable properties, WizardOperator serverInstance) {
59.712 + //log("Choose Instance");
59.713 + JComboBoxOperator cbInstance = new JComboBoxOperator(serverInstance);
59.714 +// cbInstance.selectItem(properties.get(PROP_PREFIX_DOMAIN + serverType).toString());
59.715 + TestUtils.wait(500);
59.716 +
59.717 + //log("Go to next wizard page");
59.718 + serverInstance.next();
59.719 + TestUtils.wait(2000);
59.720 +
59.721 + //log("Enter Login");
59.722 + JTextFieldOperator tfLogin = new JTextFieldOperator(serverInstance, 0);
59.723 + tfLogin.setText(properties.get(DeploymentTargetDescriptor.LOGIN_KEY + serverType).toString());
59.724 + TestUtils.wait(500);
59.725 +
59.726 + //log("Enter Password");
59.727 + JTextFieldOperator tfPassword = new JTextFieldOperator(serverInstance, 1);
59.728 + tfPassword.setText(properties.get(DeploymentTargetDescriptor.PASSWORD_KEY + serverType).toString());
59.729 + TestUtils.wait(500);
59.730 + }
59.731 +
59.732 + private static void addTomcat(String serverType, Hashtable properties, WizardOperator serverInstance) {
59.733 + //log("Enter Login");
59.734 + JTextFieldOperator tfLogin = new JTextFieldOperator(serverInstance, 3);
59.735 + tfLogin.setText(properties.get(DeploymentTargetDescriptor.LOGIN_KEY + serverType).toString());
59.736 + TestUtils.wait(500);
59.737 +
59.738 + //log("Enter Password");
59.739 + JTextFieldOperator tfPassword = new JTextFieldOperator(serverInstance, 2);
59.740 + tfPassword.setText(properties.get(DeploymentTargetDescriptor.PASSWORD_KEY + serverType).toString());
59.741 + TestUtils.wait(500);
59.742 + }
59.743 +
59.744 + /**
59.745 + * Adds an URL of Web Service
59.746 + * @param url URL of a Web Service WSDL file
59.747 + * @return name of added Web Service
59.748 + */
59.749 + public String addWebServiceUrl(String url) {
59.750 + new WebServicesNode(this.getTree(), "Web Services").addWebService();
59.751 + AddWebServiceOperator addWs = new AddWebServiceOperator();
59.752 + //if (addWs.isProxySet()) addWs.clearProxy();
59.753 + String wsName = addWs.addWebService(url);
59.754 + addWs.btAdd().pushNoBlock();
59.755 + TestUtils.wait(1000);
59.756 + //new JButtonOperator(new JDialogOperator("Configure web servcie methods"), "OK").doClick();
59.757 + return wsName;
59.758 + }
59.759 +
59.760 + /**
59.761 + * Adds an URL of Web Service
59.762 + * @param url URL of a Web Service WSDL file
59.763 + * @param proxyHost a proxy server host
59.764 + * @param proxyPort a proxy server port
59.765 + * @return name of added Web Service
59.766 + */
59.767 + public String addWebServiceUrl(String url, String proxyHost, String proxyPort) {
59.768 + new WebServicesNode(this.getTree(), "Web Services").addWebService();
59.769 + AddWebServiceOperator addWs = new AddWebServiceOperator();
59.770 + addWs.setProxy(proxyHost, proxyPort);
59.771 + String wsName = addWs.addWebService(url);
59.772 + addWs.btAdd().pushNoBlock();
59.773 + TestUtils.wait(1000);
59.774 + //new JButtonOperator(new JDialogOperator("Configure web servcie methods"), "OK").doClick();
59.775 + return wsName;
59.776 + }
59.777 +
59.778 + /**
59.779 + * Adds a Web Service by using a local file.
59.780 + * @param wsName a local WSDL file
59.781 + * @return name of added Web Service
59.782 + */
59.783 + public String addWebServiceLocal(String wsName) {
59.784 + new WebServicesNode(this.getTree(), "Web Services").addWebService();
59.785 + AddWebServiceOperator addWs = new AddWebServiceOperator();
59.786 + String wsDisplayName = addWs.addLocalWebService(wsName);
59.787 + addWs.btAdd().pushNoBlock();
59.788 + TestUtils.wait(1000);
59.789 + //new JButtonOperator(new JDialogOperator("Configure web servcie methods"), "OK").doClick();
59.790 + return wsDisplayName;
59.791 +
59.792 + }
59.793 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ServerNavigatorOperator.java Thu Jul 10 04:32:50 2008 -0700
60.3 @@ -0,0 +1,594 @@
60.4 +/*
60.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
60.6 + *
60.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
60.8 + *
60.9 + * The contents of this file are subject to the terms of either the GNU
60.10 + * General Public License Version 2 only ("GPL") or the Common
60.11 + * Development and Distribution License("CDDL") (collectively, the
60.12 + * "License"). You may not use this file except in compliance with the
60.13 + * License. You can obtain a copy of the License at
60.14 + * http://www.netbeans.org/cddl-gplv2.html
60.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
60.16 + * specific language governing permissions and limitations under the
60.17 + * License. When distributing the software, include this License Header
60.18 + * Notice in each file and include the License file at
60.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
60.20 + * particular file as subject to the "Classpath" exception as provided
60.21 + * by Sun in the GPL Version 2 section of the License file that
60.22 + * accompanied this code. If applicable, add the following below the
60.23 + * License Header, with the fields enclosed by brackets [] replaced by
60.24 + * your own identifying information:
60.25 + * "Portions Copyrighted [year] [name of copyright owner]"
60.26 + *
60.27 + * Contributor(s):
60.28 + *
60.29 + * The Original Software is NetBeans. The Initial Developer of the Original
60.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
60.31 + * Microsystems, Inc. All Rights Reserved.
60.32 + *
60.33 + * If you wish your version of this file to be governed by only the CDDL
60.34 + * or only the GPL Version 2, indicate your decision by adding
60.35 + * "[Contributor] elects to include this software in this distribution
60.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
60.37 + * single choice of license, a recipient has the option to distribute
60.38 + * your version of this file under either the CDDL, the GPL Version 2 or
60.39 + * to extend the choice of license to its licensees as provided above.
60.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
60.41 + * Version 2 license, then the option applies only if the new code is
60.42 + * made subject to such option by the copyright holder.
60.43 + */
60.44 +
60.45 +package org.netbeans.modules.visualweb.gravy.dataconnectivity;
60.46 +
60.47 +import java.awt.Point;
60.48 +import org.netbeans.jemmy.*;
60.49 +import org.netbeans.jemmy.operators.*;
60.50 +import org.netbeans.jellytools.Bundle;
60.51 +import javax.swing.tree.TreePath;
60.52 +import java.awt.event.KeyEvent;
60.53 +import java.io.File;
60.54 +import java.text.MessageFormat;
60.55 +import org.netbeans.modules.visualweb.gravy.*;
60.56 +import junit.framework.*;
60.57 +
60.58 +/**
60.59 + * This class implements test functionality for the window "Server Navigator".
60.60 + */
60.61 +public class ServerNavigatorOperator extends ServerExplorerOperator {
60.62 + private static final String pointbaseName = "Bundled Database";
60.63 + private static final String[] pbParams = new String[] {"", pointbaseName};
60.64 +
60.65 + JTreeOperator tree = null;
60.66 +
60.67 + /**
60.68 + * Creates a new instance of this class
60.69 + * @param parent an object ContainerOperator related to container, which
60.70 + * includes window "Server Navigator".
60.71 + */
60.72 + public ServerNavigatorOperator(ContainerOperator parent) {
60.73 + super(parent);
60.74 + getTree();
60.75 + }
60.76 +
60.77 + /**
60.78 + * Creates a new instance of this class
60.79 + */
60.80 + public ServerNavigatorOperator() {
60.81 + this(Util.getMainWindow());
60.82 + }
60.83 +
60.84 + /**
60.85 + * Makes the window "Server Navigator" visible.
60.86 + * @return an object ServerNavigatorOperator
60.87 + */
60.88 + public static ServerNavigatorOperator showNavigatorOperator() {
60.89 + // Util.getMainMenu().pushMenuNoBlock("Window|"+Bundle.getStringTrimmed("com.sun.rave.servernav.Bundle", "LBL_ServerNavigator"));
60.90 + Util.getMainMenu().pushMenuNoBlock("Window|Services");
60.91 + Util.wait(1000);
60.92 + new QueueTool().waitEmpty();
60.93 + return (new ServerNavigatorOperator());
60.94 + }
60.95 +
60.96 + /**
60.97 + * Adds database table on Design View via popup menu, related to its tree node.
60.98 + * @param p_path a path of required tree node as an object TreePath
60.99 + */
60.100 + public void addTable(TreePath p_path) {
60.101 + JPopupMenuOperator popup = new JPopupMenuOperator(getTree().callPopupOnPath(p_path));
60.102 + popup.pushMenu(getBundleString("Add_to_Form"));
60.103 + }
60.104 +
60.105 + /**
60.106 + * Adds a data source into window "Server Navigator".
60.107 + * @param p_dsname a name of data source
60.108 + * @param p_ds an object DataSource with properties of data source
60.109 + * @return true if data source was added successfully
60.110 + */
60.111 + public boolean addDataSource(String p_dsname, DataSource p_ds) {
60.112 +
60.113 + pushPopup(getBundleString("Databases"),getBundleString("New connection..."));
60.114 +
60.115 + AddDataSourceOperator a_dlg = new AddDataSourceOperator();
60.116 +
60.117 + JComboBoxOperator a_cbo = a_dlg.cboServerType();
60.118 + System.out.println("DBType=" + p_ds.getDbType());
60.119 +
60.120 + // Following line don't work :( Imitating...
60.121 + System.out.println("DBType now=" + a_cbo.getSelectedItem());
60.122 + if(p_ds.getDbType()!=null && p_ds.getDbType().length()>0){
60.123 + a_cbo.selectItem(p_ds.getDbType());
60.124 + }
60.125 +/* int ind = -1;
60.126 + for (int i = 0; i < a_cbo.getItemCount(); i++) {
60.127 + if ((((JdbcDriverInfo) a_cbo.getItemAt(i)).getDisplayName()).equals(p_ds.getDbType())) {
60.128 + ind = i;
60.129 + }
60.130 + }
60.131 + a_cbo.selectItem(ind);
60.132 + */
60.133 + Util.wait(1000);
60.134 +/*
60.135 + a_dlg.txtDSName().clearText();
60.136 + a_dlg.txtDSName().typeText(p_dsname);
60.137 + Util.wait(500);
60.138 +
60.139 + if (a_dlg.txtHostName().isEditable()) {
60.140 + a_dlg.txtHostName().clearText();
60.141 + a_dlg.txtHostName().typeText(p_ds.getDbHost());
60.142 + }
60.143 + Util.wait(500);
60.144 +
60.145 + if (a_dlg.txtDBName().isEditable()) {
60.146 + a_dlg.txtDBName().clearText();
60.147 + a_dlg.txtDBName().typeText(p_ds.getDbName());
60.148 + }
60.149 + Util.wait(500);
60.150 + */
60.151 + System.out.println("DB URL=" + p_ds.getDbUrl());
60.152 + if(p_ds.getDbUrl()!=null && p_ds.getDbUrl().length()>0){
60.153 + a_dlg.cboURL().clearText();
60.154 + a_dlg.cboURL().typeText(p_ds.getDbUrl());
60.155 + }
60.156 + Util.wait(500);
60.157 +
60.158 + a_dlg.txtUser().clearText();
60.159 + a_dlg.txtUser().typeText(p_ds.getUser());
60.160 + Util.wait(500);
60.161 +
60.162 + a_dlg.txtPassword().clearText();
60.163 + a_dlg.txtPassword().typeText(p_ds.getPassword());
60.164 + Util.wait(500);
60.165 +/*
60.166 + if (p_ds.getValidationTable()!=null){
60.167 + a_dlg.txtValidationTable().clearText();
60.168 + a_dlg.txtValidationTable().typeText(p_ds.getValidationTable());
60.169 + }else try {
60.170 + //select first table of schema as validation table
60.171 + a_dlg.btSelectTable().push();
60.172 + JDialogOperator selectDlg=new JDialogOperator();
60.173 + new JListOperator(selectDlg).selectItem(0);
60.174 + new JButtonOperator(selectDlg,0).push();
60.175 + }catch (org.netbeans.jemmy.TimeoutExpiredException e){
60.176 + // exception appears if connection isn't successful at all
60.177 + }
60.178 + Util.wait(1000);
60.179 +
60.180 + //a_dlg.txtURL().clearText();
60.181 + //a_dlg.txtURL().typeText(p_ds.getDbUrl());
60.182 +
60.183 + new QueueTool().waitEmpty();
60.184 +
60.185 + // Test connection
60.186 +
60.187 + a_dlg.btTestConnection().push();
60.188 + JDialogOperator a_dlg1 = new JDialogOperator(a_dlg);
60.189 + Util.wait(1000);
60.190 +
60.191 + boolean success = !(new JTextFieldOperator(a_dlg1).getText().equals("Failed") ||
60.192 + new JTextFieldOperator(a_dlg1,1).getText().equals("Failed")
60.193 + );
60.194 + */
60.195 + new JButtonOperator(a_dlg, getBundleString("OK")).push();
60.196 +
60.197 + // Add data source, if connection is OK
60.198 +
60.199 + Util.wait(10000);
60.200 + if (p_ds.getDbType().equalsIgnoreCase("mysql")) {
60.201 + new JButtonOperator(a_dlg, getBundleString("OK")).push();
60.202 + }
60.203 + return true;
60.204 + }
60.205 +
60.206 + /**
60.207 + * Opens connection with a data source.
60.208 + * @param p_dsname a name of data source
60.209 + * @param p_ds an object DataSource with properties of data source
60.210 + */
60.211 + public void connectToDataSource(String p_dsname, DataSource p_ds){
60.212 +
60.213 +
60.214 + String[] a_ss = {getBundleString("Databases"), p_dsname};
60.215 + pushPopup(a_ss,getBundleString("Connect..."));
60.216 + Util.wait(1000);
60.217 +
60.218 + JDialogOperator a_dlg = new JDialogOperator();
60.219 + Util.wait(1000);
60.220 +
60.221 + JTextFieldOperator tfUser = new JTextFieldOperator(a_dlg, 0);
60.222 + tfUser.clearText();
60.223 + tfUser.typeText(p_ds.getUser());
60.224 + Util.wait(500);
60.225 +
60.226 + JTextFieldOperator tfPassword = new JTextFieldOperator(a_dlg, 1);
60.227 + tfPassword.clearText();
60.228 + tfPassword.typeText(p_ds.getPassword());
60.229 + Util.wait(500);
60.230 +
60.231 + JCheckBoxOperator chkRemember = new JCheckBoxOperator(a_dlg);
60.232 + chkRemember.setSelected(true);
60.233 +
60.234 + new JButtonOperator(a_dlg, getBundleString("OK")).pushNoBlock();
60.235 +
60.236 + // Add data source, if connection is OK
60.237 +
60.238 + Util.wait(2000);
60.239 + try {
60.240 + new org.netbeans.jellytools.TopComponentOperator("Output").close();
60.241 + }catch(Exception e) {
60.242 + e.printStackTrace();
60.243 + }
60.244 + //new JButtonOperator(a_dlg, getBundleString("OK")).pushNoBlock();
60.245 +
60.246 + }
60.247 +
60.248 + /**
60.249 + * Changes parameters of a data source.
60.250 + * @param p_dsname a name of data source
60.251 + * @param p_ds an object DataSource with properties of data source
60.252 + * @return true if data source was modified successfully
60.253 + */
60.254 + public boolean modifyDataSource(String p_dsname, DataSource p_ds) {
60.255 +
60.256 + String[] a_ss = {getBundleString("Databases"), p_dsname};
60.257 + pushPopup(a_ss,getBundleString("MODIFY_DATASOURCE"));
60.258 +
60.259 + ModifyDataSourceOperator a_dlg = new ModifyDataSourceOperator();
60.260 +
60.261 + JTextFieldOperator a_tfo = a_dlg.txtDSName();
60.262 + a_tfo.clearText();
60.263 + a_tfo.typeText(p_dsname);
60.264 + Util.wait(500);
60.265 +
60.266 + a_tfo = a_dlg.txtUser();
60.267 + a_tfo.clearText();
60.268 + a_tfo.typeText(p_ds.getUser());
60.269 + Util.wait(500);
60.270 +
60.271 + a_tfo = a_dlg.txtPassword();
60.272 + a_tfo.clearText();
60.273 + a_tfo.typeText(p_ds.getPassword());
60.274 + Util.wait(500);
60.275 +
60.276 + a_tfo = a_dlg.txtURL();
60.277 + a_tfo.clearText();
60.278 + a_tfo.typeText(p_ds.getDbUrl());
60.279 + Util.wait(2000);
60.280 +
60.281 + //a_tf=(JTextField)a_dlg.waitSubComponent(new TextFieldChooser(6));
60.282 + //a_tf.setText(p_ds.getDbUrl());
60.283 +
60.284 + new QueueTool().waitEmpty();
60.285 +
60.286 + // Test connection
60.287 +
60.288 + a_dlg.btTestConnection().push();
60.289 + JDialogOperator a_dlg1 = new JDialogOperator(a_dlg, 0);
60.290 +
60.291 + boolean success = a_dlg1.getTitle().equals("Information");
60.292 + new JButtonOperator(a_dlg1, getBundleString("OK")).push();
60.293 +
60.294 + // Modify data source, if connection is OK
60.295 +
60.296 + new JButtonOperator(a_dlg, getBundleString(success ? "MODIFY" : "CANCEL")).push();
60.297 +
60.298 + return success;
60.299 + }
60.300 +
60.301 + /**
60.302 + * Removes a data source.
60.303 + * @param p_dsname a name of data source
60.304 + * @return true if data source was removed successfully
60.305 + */
60.306 + public boolean removeDataSource(String p_dsname) {
60.307 +
60.308 + String[] a_ss = {getBundleString("Databases"), p_dsname};
60.309 +
60.310 + pushPopup(a_ss,getBundleString("REMOVE_CONNECTION"));
60.311 +
60.312 + Util.wait(1000);
60.313 +
60.314 + return true;
60.315 + }
60.316 +
60.317 + /**
60.318 + * Adds new type of DB server into Server Navigator.
60.319 + * @param p_typeName a name of server type
60.320 + * @param p_template not used
60.321 + * @param p_iniDrivers drivers, needed for this DB server
60.322 + */
60.323 + public void addNewServerType(String p_typeName, String p_template, String p_iniDrivers) {
60.324 + addNewServerType(p_typeName, p_template, p_iniDrivers, "");
60.325 + }
60.326 +
60.327 + /**
60.328 + * Adds new type of DB server into Server Navigator.
60.329 + * @param p_typeName a name of server type
60.330 + * @param p_template not used
60.331 + * @param p_iniDrivers drivers, needed for this DB server
60.332 + * @param p_addDrivers additional drivers, which should be added
60.333 + */
60.334 + public void addNewServerType(String p_typeName, String p_template, String p_iniDrivers, String p_addDrivers) {
60.335 +
60.336 + pushPopup(new String[]{getBundleString("Databases"),getBundleString("Drivers")}, getBundleString("New driver..."));
60.337 +
60.338 + EditServerTypesOperator a_dlg = new EditServerTypesOperator();
60.339 + Util.wait(1000);
60.340 +
60.341 + a_dlg.btNew().pushNoBlock();
60.342 + JDialogOperator a_dlg1 = new JDialogOperator(getBundleString("Select Driver"));
60.343 +
60.344 + if (System.getProperty("os.name").equals("Mac OS X")) {
60.345 + String[] splittedPath = p_iniDrivers.substring(1, p_iniDrivers.length()).split(File.separator);
60.346 + TestUtils.wait(1000);
60.347 + JComboBoxOperator cbRoot = new JComboBoxOperator(a_dlg1);
60.348 + for (int i = 0; i < cbRoot.getItemCount(); i++)
60.349 + if (cbRoot.getItemAt(i).toString().equals(File.separator)) {
60.350 + cbRoot.setSelectedIndex(i);
60.351 + break;
60.352 + }
60.353 + String toCompare = "";
60.354 + for (int i = 0; i < splittedPath.length; i++) {
60.355 + JTableOperator jtoPath = new JTableOperator(a_dlg1);
60.356 + toCompare += "/" + splittedPath[i];
60.357 + System.out.println("toComapre="+toCompare);
60.358 + Point cell = jtoPath.findCell(toCompare, new Operator.DefaultStringComparator(true, true), 0);
60.359 + TestUtils.wait(1000);
60.360 + jtoPath.clickOnCell((int) cell.getY(), (int) cell.getX(),2);
60.361 + TestUtils.wait(1000);
60.362 + }
60.363 + } else {
60.364 +
60.365 + JTextFieldOperator a_tf1 = new JTextFieldOperator(a_dlg1);
60.366 + a_tf1.typeText(p_iniDrivers);
60.367 + Util.wait(500);
60.368 + new JButtonOperator(a_dlg1, "Open").push();
60.369 + Util.wait(1000);
60.370 + }
60.371 +/*Case when more then one file commented
60.372 + if (!(p_addDrivers == null) && !(p_addDrivers.equals(""))) {
60.373 +
60.374 + new JButtonOperator(a_dlg, getBundleString("Add...")).pushNoBlock();
60.375 + a_dlg1 = new JDialogOperator(getBundleString("Select driver"));
60.376 +
60.377 + a_tf1 = new JTextFieldOperator(a_dlg1);
60.378 + a_tf1.typeText(p_addDrivers);
60.379 +
60.380 + new JButtonOperator(a_dlg1, "Open").push();
60.381 + Util.wait(1000);
60.382 + }
60.383 +
60.384 + a_tf1 = a_dlg.txtName();
60.385 + a_tf1.clearText();
60.386 + a_tf1.typeText(p_typeName);
60.387 + Util.wait(1000);
60.388 + */
60.389 +/*
60.390 + a_tf1 = a_dlg.txtTemplate();
60.391 + a_tf1.clearText();
60.392 + a_tf1.typeText(p_template);
60.393 + Util.wait(1000);
60.394 +
60.395 +
60.396 + // try to close window without choosing driver class. Error message should appear
60.397 + a_dlg.btOK().push();
60.398 + a_dlg1 = new JDialogOperator("Information");
60.399 + Util.wait(1000);
60.400 + new JButtonOperator(a_dlg1, getBundleString("OK")).push();
60.401 + */
60.402 + // choose driver class and close window
60.403 + //a_dlg.btFind().push();
60.404 + //a_dlg.cboDriver().setSelectedIndex(0);
60.405 +
60.406 + Util.wait(1000);
60.407 + a_dlg.btOK().push();
60.408 +
60.409 + }
60.410 +
60.411 + /**
60.412 + * Deletes a type of DB server from Server Navigator.
60.413 + * @param p_typeName a name of server type
60.414 + */
60.415 + public void deleteServerType(String p_typeName) {
60.416 +
60.417 + pushPopup(getBundleString("Databases"), getBundleString("CONFIGURE_JDBC_DRIVER"));
60.418 +
60.419 + EditServerTypesOperator a_dlg = new EditServerTypesOperator();
60.420 + Util.wait(1000);
60.421 +
60.422 + a_dlg.lstServerTypes().setSelectedValue(p_typeName, true);
60.423 + a_dlg.btRemove().pushNoBlock();
60.424 +
60.425 + // JDialogOperator a_dlg1=new JDialogOperator("Question");
60.426 + // a_dlg1.pressKey(KeyEvent.VK_ENTER);
60.427 +
60.428 + Util.wait(1000);
60.429 +
60.430 + a_dlg.closeByButton();
60.431 + }
60.432 +
60.433 + /**
60.434 + * Opens a window "View Data" for some database table/view.
60.435 + * @param p_path a path of required tree node
60.436 + */
60.437 + public void viewData(String p_path) {
60.438 + pushPopup(p_path, getBundleString("VIEW_DATA"));
60.439 + }
60.440 +
60.441 + /**
60.442 + * Opens a window "View Data" for some database table/view.
60.443 + * @param p_path a string array with path of required tree node
60.444 + * (sequence of node names from the root node to a required node)
60.445 + */
60.446 + public void viewData(String[] p_path) {
60.447 + pushPopup(p_path, getBundleString("VIEW_DATA"));
60.448 + }
60.449 +
60.450 + // public void viewData(TreePath p_path) {
60.451 + //
60.452 + // JPopupMenuOperator popup = new JPopupMenuOperator(tree.callPopupOnPath(p_path));
60.453 + // popup.pushMenu(getBundleString("VIEW_DATA"));
60.454 + // }
60.455 +
60.456 + /**
60.457 + * Closes an opened window "View Data".
60.458 + */
60.459 + public void closeDataView() {
60.460 + Util.closeWindow();
60.461 + }
60.462 +
60.463 + /**
60.464 + * Opens a window "View Data" for a schema of some database table/view.
60.465 + * @param p_ds a name of required data source
60.466 + * @param p_schema not used
60.467 + */
60.468 + public void showSchema(String p_ds, String[] p_schema) {
60.469 + pushPopup(getBundleString("Databases") + "/" + p_ds, getBundleString("VIEW_DATA"));
60.470 + }
60.471 +
60.472 + /**
60.473 + * Finds in a bundle file and returns an actual text of control component.
60.474 + * @param p_text string-key corresponding to required control component.
60.475 + * @return actual text of control component
60.476 + */
60.477 + public static String getBundleString(String p_text) {
60.478 + System.out.println("Getting bundle for " + p_text);
60.479 +/* try {
60.480 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.actions.Bundle", p_text);
60.481 + } catch (JemmyException e) {}
60.482 + try {
60.483 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
60.484 + } catch (JemmyException e) {}
60.485 + return null;
60.486 + */
60.487 +
60.488 + // stub
60.489 + return p_text;
60.490 + }
60.491 +
60.492 + /**
60.493 + * Checks, whether built-in database server PointBase is running or not.
60.494 + * @return true - DB server ir running, false - otherwise
60.495 + */
60.496 + public static boolean isPBRunning() {
60.497 + boolean result = true;
60.498 + JPopupMenuOperator pointbasePopupMenu = getTreeNodePopupMenu(
60.499 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
60.500 + "Bundled_DB_ServerNav_NodeName", pbParams));
60.501 + if (pointbasePopupMenu != null) {
60.502 + result = !(TestUtils.findPopupMenuItemByLabel(pointbasePopupMenu,
60.503 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
60.504 + "Bundled_DB_Start", pbParams)).isEnabled());
60.505 + } else {
60.506 + Assert.fail("Popup menu for bundled server not found");
60.507 + }
60.508 + pointbasePopupMenu.pressKey(KeyEvent.VK_ESCAPE);
60.509 + new QueueTool().waitEmpty();
60.510 + Util.wait(500);
60.511 + return result;
60.512 + }
60.513 +
60.514 + /**
60.515 + * Shuts a built-in database server PointBase down.
60.516 + */
60.517 + public static void stopPB(){
60.518 + JPopupMenuOperator pointbasePopupMenu = getTreeNodePopupMenu(
60.519 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
60.520 + "Bundled_DB_ServerNav_NodeName", pbParams));
60.521 + if (pointbasePopupMenu != null) {
60.522 + pointbasePopupMenu.pushMenuNoBlock(
60.523 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
60.524 + "Bundled_DB_Stop", pbParams));
60.525 + new QueueTool().waitEmpty();
60.526 + Util.wait(2000);
60.527 + System.out.println("Pointbase Database Server has been stopped.");
60.528 + }
60.529 + new QueueTool().waitEmpty();
60.530 + Util.wait(1000);
60.531 + }
60.532 +
60.533 + /**
60.534 + * Launches a built-in database server PointBase.
60.535 + */
60.536 + public static void startPB(){
60.537 + JPopupMenuOperator pointbasePopupMenu = getTreeNodePopupMenu(
60.538 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
60.539 + "Bundled_DB_ServerNav_NodeName", pbParams));
60.540 + if (pointbasePopupMenu != null) {
60.541 + pointbasePopupMenu.pushMenuNoBlock(
60.542 + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
60.543 + "Bundled_DB_Start", pbParams));
60.544 + new QueueTool().waitEmpty();
60.545 + Util.wait(2000);
60.546 + System.out.println("Pointbase Database Server has started.");
60.547 + }
60.548 + new QueueTool().waitEmpty();
60.549 + Util.wait(1000);
60.550 + }
60.551 +
60.552 + private static JTreeOperator selectTreeNode(String nodeName) {
60.553 + try {
60.554 + // select the Server Navigator and set the JTreeOperator
60.555 + QueueTool queueTool = new QueueTool();
60.556 + queueTool.waitEmpty(100);
60.557 + ServerNavigatorOperator serverExplorer = showNavigatorOperator();
60.558 + serverExplorer.makeComponentVisible();
60.559 +
60.560 + JTreeOperator tree = serverExplorer.getTree();
60.561 +
60.562 + // Increase timeout for tree to redisplay after refresh
60.563 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
60.564 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
60.565 + tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
60.566 +
60.567 + TreePath serverNode = tree.findPath(nodeName);
60.568 + serverExplorer.getTree().selectPath(serverNode);
60.569 + queueTool.waitEmpty(100);
60.570 +
60.571 + return tree;
60.572 + } catch (Exception e) {
60.573 + e.printStackTrace();
60.574 + return null;
60.575 + }
60.576 + }
60.577 +
60.578 + private static JPopupMenuOperator getTreeNodePopupMenu(String nodeName) {
60.579 + try {
60.580 + QueueTool queueTool = new QueueTool();
60.581 + JTreeOperator tree = selectTreeNode(nodeName);
60.582 +
60.583 + TreePath serverNode = tree.findPath(nodeName);
60.584 + queueTool.waitEmpty(100);
60.585 +
60.586 + JPopupMenuOperator popupMenu = new JPopupMenuOperator(
60.587 + tree.callPopupOnPath(serverNode));
60.588 + queueTool.waitEmpty(100);
60.589 + Util.wait(100);
60.590 +
60.591 + return popupMenu;
60.592 + } catch (Exception e) {
60.593 + e.printStackTrace();
60.594 + return null;
60.595 + }
60.596 + }
60.597 +}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/BuildOutputOperator.java Thu Jul 10 04:32:50 2008 -0700
61.3 @@ -0,0 +1,117 @@
61.4 +/*
61.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
61.6 + *
61.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
61.8 + *
61.9 + * The contents of this file are subject to the terms of either the GNU
61.10 + * General Public License Version 2 only ("GPL") or the Common
61.11 + * Development and Distribution License("CDDL") (collectively, the
61.12 + * "License"). You may not use this file except in compliance with the
61.13 + * License. You can obtain a copy of the License at
61.14 + * http://www.netbeans.org/cddl-gplv2.html
61.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
61.16 + * specific language governing permissions and limitations under the
61.17 + * License. When distributing the software, include this License Header
61.18 + * Notice in each file and include the License file at
61.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
61.20 + * particular file as subject to the "Classpath" exception as provided
61.21 + * by Sun in the GPL Version 2 section of the License file that
61.22 + * accompanied this code. If applicable, add the following below the
61.23 + * License Header, with the fields enclosed by brackets [] replaced by
61.24 + * your own identifying information:
61.25 + * "Portions Copyrighted [year] [name of copyright owner]"
61.26 + *
61.27 + * Contributor(s):
61.28 + *
61.29 + * The Original Software is NetBeans. The Initial Developer of the Original
61.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
61.31 + * Microsystems, Inc. All Rights Reserved.
61.32 + *
61.33 + * If you wish your version of this file to be governed by only the CDDL
61.34 + * or only the GPL Version 2, indicate your decision by adding
61.35 + * "[Contributor] elects to include this software in this distribution
61.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
61.37 + * single choice of license, a recipient has the option to distribute
61.38 + * your version of this file under either the CDDL, the GPL Version 2 or
61.39 + * to extend the choice of license to its licensees as provided above.
61.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
61.41 + * Version 2 license, then the option applies only if the new code is
61.42 + * made subject to such option by the copyright holder.
61.43 + */
61.44 +
61.45 +package org.netbeans.modules.visualweb.gravy.debugger;
61.46 +
61.47 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
61.48 +import org.netbeans.modules.visualweb.gravy.Util;
61.49 +
61.50 +import java.awt.Component;
61.51 +
61.52 +import javax.swing.JDesktopPane;
61.53 +
61.54 +import org.netbeans.jemmy.ComponentChooser;
61.55 +import org.netbeans.jemmy.JemmyException;
61.56 +import org.netbeans.jemmy.operators.JTextComponentOperator;
61.57 +import org.netbeans.jemmy.operators.JComponentOperator;
61.58 +import org.netbeans.jemmy.operators.JTextPaneOperator;
61.59 +import org.netbeans.jemmy.operators.Operator;
61.60 +import org.netbeans.jemmy.operators.ContainerOperator;
61.61 +
61.62 +/**
61.63 + * BuildOutputOperator class
61.64 + */
61.65 +public class BuildOutputOperator extends TopComponentOperator{
61.66 + JTextComponentOperator textComponent = null;
61.67 + TermOperator termOper = null;
61.68 +
61.69 + public BuildOutputOperator(ContainerOperator parent) {
61.70 + super(parent, new BuildOutputChooser("Build Output Window"));
61.71 + }
61.72 +
61.73 + public BuildOutputOperator() {
61.74 + this(Util.getMainWindow());
61.75 + }
61.76 +
61.77 + /** Show build output window.
61.78 + */
61.79 + public static BuildOutputOperator show() {
61.80 + return(new BuildOutputOperator(Util.getMainWindow()));
61.81 + }
61.82 +
61.83 + /** Return text area of the build output window.
61.84 + */
61.85 + public JTextComponentOperator getTextComponent() {
61.86 + if(textComponent == null) {
61.87 + textComponent = new JTextComponentOperator(this);
61.88 + }
61.89 + return(textComponent);
61.90 + }
61.91 +
61.92 + /** Get text from build output.
61.93 + */
61.94 + public String getTextOutput(){
61.95 + if(termOper == null) {
61.96 + termOper = new TermOperator(this);
61.97 + }
61.98 + return termOper.getText();
61.99 + }
61.100 +
61.101 + public static class BuildOutputChooser implements ComponentChooser {
61.102 + String ID;
61.103 + private Operator.StringComparator comparator;
61.104 + public BuildOutputChooser(String ID) {
61.105 + this(ID, new Operator.DefaultStringComparator(false, false));
61.106 + }
61.107 + public BuildOutputChooser(String ID, Operator.StringComparator comparator){
61.108 + this.ID = ID;
61.109 + this.comparator = comparator;
61.110 + }
61.111 + public boolean checkComponent(Component comp) {
61.112 + if(comp !=null && ((Component)comp).getName()!=null)
61.113 + return(comp instanceof Component && ((Component)comp).getName().startsWith(ID) );
61.114 + else return false;
61.115 + }
61.116 + public String getDescription() {
61.117 + return("A Component with \"" + ID + "\" ID");
61.118 + }
61.119 + }
61.120 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/DebuggerConsoleOperator.java Thu Jul 10 04:32:50 2008 -0700
62.3 @@ -0,0 +1,107 @@
62.4 +/*
62.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
62.6 + *
62.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
62.8 + *
62.9 + * The contents of this file are subject to the terms of either the GNU
62.10 + * General Public License Version 2 only ("GPL") or the Common
62.11 + * Development and Distribution License("CDDL") (collectively, the
62.12 + * "License"). You may not use this file except in compliance with the
62.13 + * License. You can obtain a copy of the License at
62.14 + * http://www.netbeans.org/cddl-gplv2.html
62.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
62.16 + * specific language governing permissions and limitations under the
62.17 + * License. When distributing the software, include this License Header
62.18 + * Notice in each file and include the License file at
62.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
62.20 + * particular file as subject to the "Classpath" exception as provided
62.21 + * by Sun in the GPL Version 2 section of the License file that
62.22 + * accompanied this code. If applicable, add the following below the
62.23 + * License Header, with the fields enclosed by brackets [] replaced by
62.24 + * your own identifying information:
62.25 + * "Portions Copyrighted [year] [name of copyright owner]"
62.26 + *
62.27 + * Contributor(s):
62.28 + *
62.29 + * The Original Software is NetBeans. The Initial Developer of the Original
62.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
62.31 + * Microsystems, Inc. All Rights Reserved.
62.32 + *
62.33 + * If you wish your version of this file to be governed by only the CDDL
62.34 + * or only the GPL Version 2, indicate your decision by adding
62.35 + * "[Contributor] elects to include this software in this distribution
62.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
62.37 + * single choice of license, a recipient has the option to distribute
62.38 + * your version of this file under either the CDDL, the GPL Version 2 or
62.39 + * to extend the choice of license to its licensees as provided above.
62.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
62.41 + * Version 2 license, then the option applies only if the new code is
62.42 + * made subject to such option by the copyright holder.
62.43 + */
62.44 +
62.45 +package org.netbeans.modules.visualweb.gravy.debugger;
62.46 +
62.47 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
62.48 +import org.netbeans.modules.visualweb.gravy.Util;
62.49 +
62.50 +import java.awt.Component;
62.51 +
62.52 +import javax.swing.JDesktopPane;
62.53 +
62.54 +import org.netbeans.jemmy.ComponentChooser;
62.55 +import org.netbeans.jemmy.JemmyException;
62.56 +import org.netbeans.jemmy.operators.JTextComponentOperator;
62.57 +import org.netbeans.jemmy.operators.JTextPaneOperator;
62.58 +import org.netbeans.jemmy.operators.ContainerOperator;
62.59 +import org.netbeans.jemmy.operators.Operator;
62.60 +
62.61 +/**
62.62 + * DebuggerConsoleOperator class
62.63 + */
62.64 +public class DebuggerConsoleOperator extends TopComponentOperator{
62.65 + TermOperator termOper = null;
62.66 +
62.67 + public DebuggerConsoleOperator(ContainerOperator parent) {
62.68 + super(parent, new DebuggerConsoleChooser("Debugger Console"));
62.69 + }
62.70 +
62.71 + public DebuggerConsoleOperator() {
62.72 + this(Util.getMainWindow());
62.73 + }
62.74 +
62.75 + /** Show debugger console window.
62.76 + */
62.77 + public static DebuggerConsoleOperator show() {
62.78 + return(new DebuggerConsoleOperator(Util.getMainWindow()));
62.79 + }
62.80 +
62.81 + /** Get text from debugger console.
62.82 + */
62.83 + public String getTextOutput(){
62.84 + if(termOper == null) {
62.85 + termOper = new TermOperator(this);
62.86 + }
62.87 + return termOper.getText();
62.88 + }
62.89 +
62.90 + public static class DebuggerConsoleChooser implements ComponentChooser {
62.91 + String ID;
62.92 + private Operator.StringComparator comparator;
62.93 + public DebuggerConsoleChooser(String ID) {
62.94 + this(ID, new Operator.DefaultStringComparator(false, false));
62.95 + }
62.96 + public DebuggerConsoleChooser(String ID, Operator.StringComparator comparator){
62.97 + this.ID = ID;
62.98 + this.comparator = comparator;
62.99 + }
62.100 + public boolean checkComponent(Component comp) {
62.101 + if(comp !=null && ((Component)comp).getName()!=null)
62.102 + return(comp instanceof Component && ((Component)comp).getName().startsWith(ID) );
62.103 + else return false;
62.104 + }
62.105 + public String getDescription() {
62.106 + return("A Component with \"" + ID + "\" ID");
62.107 + }
62.108 + }
62.109 +
62.110 +}
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/DebuggerWindowOperator.java Thu Jul 10 04:32:50 2008 -0700
63.3 @@ -0,0 +1,486 @@
63.4 +/*
63.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
63.6 + *
63.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
63.8 + *
63.9 + * The contents of this file are subject to the terms of either the GNU
63.10 + * General Public License Version 2 only ("GPL") or the Common
63.11 + * Development and Distribution License("CDDL") (collectively, the
63.12 + * "License"). You may not use this file except in compliance with the
63.13 + * License. You can obtain a copy of the License at
63.14 + * http://www.netbeans.org/cddl-gplv2.html
63.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
63.16 + * specific language governing permissions and limitations under the
63.17 + * License. When distributing the software, include this License Header
63.18 + * Notice in each file and include the License file at
63.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
63.20 + * particular file as subject to the "Classpath" exception as provided
63.21 + * by Sun in the GPL Version 2 section of the License file that
63.22 + * accompanied this code. If applicable, add the following below the
63.23 + * License Header, with the fields enclosed by brackets [] replaced by
63.24 + * your own identifying information:
63.25 + * "Portions Copyrighted [year] [name of copyright owner]"
63.26 + *
63.27 + * Contributor(s):
63.28 + *
63.29 + * The Original Software is NetBeans. The Initial Developer of the Original
63.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
63.31 + * Microsystems, Inc. All Rights Reserved.
63.32 + *
63.33 + * If you wish your version of this file to be governed by only the CDDL
63.34 + * or only the GPL Version 2, indicate your decision by adding
63.35 + * "[Contributor] elects to include this software in this distribution
63.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
63.37 + * single choice of license, a recipient has the option to distribute
63.38 + * your version of this file under either the CDDL, the GPL Version 2 or
63.39 + * to extend the choice of license to its licensees as provided above.
63.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
63.41 + * Version 2 license, then the option applies only if the new code is
63.42 + * made subject to such option by the copyright holder.
63.43 + */
63.44 +
63.45 +package org.netbeans.modules.visualweb.gravy.debugger;
63.46 +
63.47 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
63.48 +import org.netbeans.modules.visualweb.gravy.Util;
63.49 +
63.50 +import java.awt.Component;
63.51 +
63.52 +import javax.swing.JDesktopPane;
63.53 +
63.54 +import org.netbeans.jemmy.ComponentChooser;
63.55 +import org.netbeans.jemmy.JemmyException;
63.56 +
63.57 +import org.netbeans.jemmy.operators.ComponentOperator;
63.58 +import org.netbeans.jemmy.operators.ContainerOperator;
63.59 +import org.netbeans.jemmy.operators.JButtonOperator;
63.60 +import org.netbeans.jemmy.operators.JDialogOperator;
63.61 +import org.netbeans.jemmy.operators.JInternalFrameOperator;
63.62 +import org.netbeans.jemmy.operators.JListOperator;
63.63 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
63.64 +import org.netbeans.jemmy.operators.JTableOperator;
63.65 +import org.netbeans.jemmy.operators.JToggleButtonOperator;
63.66 +import org.netbeans.jemmy.operators.JTextComponentOperator;
63.67 +import org.netbeans.jemmy.operators.Operator;
63.68 +
63.69 +/**
63.70 + * DebuggerWindowOperator class
63.71 + */
63.72 +public class DebuggerWindowOperator extends TopComponentOperator{
63.73 + ComponentOperator desktop = null;
63.74 + JTextComponentOperator query = null;
63.75 +
63.76 + private JToggleButtonOperator _tbSessions;
63.77 + private JToggleButtonOperator _tbThreads;
63.78 + private JToggleButtonOperator _tbCallStack;
63.79 + private JToggleButtonOperator _tbLocalVariables;
63.80 + private JToggleButtonOperator _tbAllInOne;
63.81 + private JToggleButtonOperator _tbWatches;
63.82 + private JToggleButtonOperator _tbClasses;
63.83 + private JToggleButtonOperator _tbBreakpoints;
63.84 + private JToggleButtonOperator _tbProperties;
63.85 + private JToggleButtonOperator _tbPublic;
63.86 + private JToggleButtonOperator _tbProtected;
63.87 + private JToggleButtonOperator _tbPrivate;
63.88 + private JToggleButtonOperator _tbPackagePrivate;
63.89 + private JToggleButtonOperator _tbStatic;
63.90 + private JToggleButtonOperator _tbInherited;
63.91 +
63.92 + private JTableOperator _tabTreeTable;
63.93 +
63.94 + private String [] views = {"Sessions", "Threads", "CallStack", "LocalVariables", "AllInOne", "Watches", "Classes", "Breakpoints", "Properties"};
63.95 +
63.96 + public DebuggerWindowOperator(ContainerOperator parent) {
63.97 + super(parent, new DebuggerWindowChooser("Debugger"));
63.98 + }
63.99 +
63.100 + public DebuggerWindowOperator() {
63.101 + this(Util.getMainWindow());
63.102 + }
63.103 +
63.104 + /** Show debugger window
63.105 + */
63.106 + public DebuggerWindowOperator show() {
63.107 + this.setComparator(new Operator.DefaultStringComparator(false, true));
63.108 + Util.getMainTab().setSelectedIndex(Util.getMainTab().findPage("Debugger"));
63.109 + return(new DebuggerWindowOperator(Util.getMainWindow()));
63.110 + }
63.111 +
63.112 +
63.113 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.114 + * @return JToggleButtonOperator
63.115 + */
63.116 + public JToggleButtonOperator tbSessions() {
63.117 + _tbSessions = new JToggleButtonOperator(this, "", 0);
63.118 + return _tbSessions;
63.119 + }
63.120 +
63.121 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.122 + * @return JToggleButtonOperator
63.123 + */
63.124 + public JToggleButtonOperator tbThreads() {
63.125 + _tbThreads = new JToggleButtonOperator(this, "", 1);
63.126 + return _tbThreads;
63.127 + }
63.128 +
63.129 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.130 + * @return JToggleButtonOperator
63.131 + */
63.132 + public JToggleButtonOperator tbCallStack() {
63.133 + _tbCallStack = new JToggleButtonOperator(this, "", 2);
63.134 + return _tbCallStack;
63.135 + }
63.136 +
63.137 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.138 + * @return JToggleButtonOperator
63.139 + */
63.140 + public JToggleButtonOperator tbLocalVariables() {
63.141 + _tbLocalVariables = new JToggleButtonOperator(this, "", 3);
63.142 + return _tbLocalVariables;
63.143 + }
63.144 +
63.145 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.146 + * @return JToggleButtonOperator
63.147 + */
63.148 + public JToggleButtonOperator tbAllInOne() {
63.149 + _tbAllInOne = new JToggleButtonOperator(this, "", 4);
63.150 + return _tbAllInOne;
63.151 + }
63.152 +
63.153 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.154 + * @return JToggleButtonOperator
63.155 + */
63.156 + public JToggleButtonOperator tbWatches() {
63.157 + _tbWatches = new JToggleButtonOperator(this, "", 5);
63.158 + return _tbWatches;
63.159 + }
63.160 +
63.161 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.162 + * @return JToggleButtonOperator
63.163 + */
63.164 + public JToggleButtonOperator tbClasses() {
63.165 + _tbClasses = new JToggleButtonOperator(this, "", 6);
63.166 + return _tbClasses;
63.167 + }
63.168 +
63.169 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.170 + * @return JToggleButtonOperator
63.171 + */
63.172 + public JToggleButtonOperator tbBreakpoints() {
63.173 + _tbBreakpoints = new JToggleButtonOperator(this, "", 7);
63.174 + return _tbBreakpoints;
63.175 + }
63.176 +
63.177 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.178 + * @return JToggleButtonOperator
63.179 + */
63.180 + public JToggleButtonOperator tbProperties() {
63.181 + _tbProperties = new JToggleButtonOperator(this, "", 8);
63.182 + return _tbProperties;
63.183 + }
63.184 +
63.185 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.186 + * @return JToggleButtonOperator
63.187 + */
63.188 + public JToggleButtonOperator tbPublic() {
63.189 + _tbPublic = new JToggleButtonOperator(this, "", 9);
63.190 + return _tbPublic;
63.191 + }
63.192 +
63.193 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.194 + * @return JToggleButtonOperator
63.195 + */
63.196 + public JToggleButtonOperator tbProtected() {
63.197 + _tbProtected = new JToggleButtonOperator(this, "", 10);
63.198 + return _tbProtected;
63.199 + }
63.200 +
63.201 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.202 + * @return JToggleButtonOperator
63.203 + */
63.204 + public JToggleButtonOperator tbPrivate() {
63.205 + _tbPrivate = new JToggleButtonOperator(this, "", 11);
63.206 + return _tbPrivate;
63.207 + }
63.208 +
63.209 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.210 + * @return JToggleButtonOperator
63.211 + */
63.212 + public JToggleButtonOperator tbPackagePrivate() {
63.213 + _tbPackagePrivate = new JToggleButtonOperator(this, "", 12);
63.214 + return _tbPackagePrivate;
63.215 + }
63.216 +
63.217 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.218 + * @return JToggleButtonOperator
63.219 + */
63.220 + public JToggleButtonOperator tbStatic() {
63.221 + _tbStatic = new JToggleButtonOperator(this, "", 13);
63.222 + return _tbStatic;
63.223 + }
63.224 +
63.225 + /** Tries to find "" ToolbarToggleButton in this dialog.
63.226 + * @return JToggleButtonOperator
63.227 + */
63.228 + public JToggleButtonOperator tbInherited() {
63.229 + _tbInherited = new JToggleButtonOperator(this, "", 14);
63.230 + return _tbInherited;
63.231 + }
63.232 +
63.233 +
63.234 + /** checks or unchecks given ToolbarToggleButton
63.235 + * @param state boolean requested state
63.236 + */
63.237 + public void checkBreakpoints(boolean state) {
63.238 + if (tbBreakpoints().isSelected()!=state) {
63.239 + tbBreakpoints().push();
63.240 + }
63.241 + }
63.242 +
63.243 + /** Get state of the given ToolbarToggleButton
63.244 + */
63.245 + public boolean getBreakpointsState() {
63.246 + return tbBreakpoints().isSelected();
63.247 + }
63.248 +
63.249 +
63.250 + /** checks or unchecks given ToolbarToggleButton
63.251 + * @param state boolean requested state
63.252 + */
63.253 + public void checkSessions(boolean state) {
63.254 + if (tbSessions().isSelected()!=state) {
63.255 + tbSessions().push();
63.256 + }
63.257 + }
63.258 +
63.259 + /** Get state of the given ToolbarToggleButton
63.260 + */
63.261 + public boolean getSessionsState() {
63.262 + return tbSessions().isSelected();
63.263 + }
63.264 +
63.265 + /** checks or unchecks given ToolbarToggleButton
63.266 + * @param state boolean requested state
63.267 + */
63.268 + public void checkThreads(boolean state) {
63.269 + if (tbThreads().isSelected()!=state) {
63.270 + tbThreads().push();
63.271 + }
63.272 + }
63.273 +
63.274 + /** Get state of the given ToolbarToggleButton
63.275 + */
63.276 + public boolean getThreadsState() {
63.277 + return tbThreads().isSelected();
63.278 + }
63.279 +
63.280 + /** checks or unchecks given ToolbarToggleButton
63.281 + * @param state boolean requested state
63.282 + */
63.283 + public void checkCallStack(boolean state) {
63.284 + if (tbCallStack().isSelected()!=state) {
63.285 + tbCallStack().push();
63.286 + }
63.287 + }
63.288 +
63.289 + /** Get state of the given ToolbarToggleButton
63.290 + */
63.291 + public boolean getCallStackState() {
63.292 + return tbCallStack().isSelected();
63.293 + }
63.294 +
63.295 + /** checks or unchecks given ToolbarToggleButton
63.296 + * @param state boolean requested state
63.297 + */
63.298 + public void checkLocalVariables(boolean state) {
63.299 + if (tbLocalVariables().isSelected()!=state) {
63.300 + tbLocalVariables().push();
63.301 + }
63.302 + }
63.303 +
63.304 + /** Get state of the given ToolbarToggleButton
63.305 + */
63.306 + public boolean getLocalVariablesState() {
63.307 + return tbLocalVariables().isSelected();
63.308 + }
63.309 +
63.310 + /** checks or unchecks given ToolbarToggleButton
63.311 + * @param state boolean requested state
63.312 + */
63.313 + public void checkAllInOne(boolean state) {
63.314 + if (tbAllInOne().isSelected()!=state) {
63.315 + tbAllInOne().push();
63.316 + }
63.317 + }
63.318 +
63.319 + /** Get state of the given ToolbarToggleButton
63.320 + */
63.321 + public boolean getAllInOneState() {
63.322 + return tbAllInOne().isSelected();
63.323 + }
63.324 +
63.325 + /** checks or unchecks given ToolbarToggleButton
63.326 + * @param state boolean requested state
63.327 + */
63.328 + public void checkWatches(boolean state) {
63.329 + if (tbWatches().isSelected()!=state) {
63.330 + tbWatches().push();
63.331 + }
63.332 + }
63.333 +
63.334 + /** Get state of the given ToolbarToggleButton
63.335 + */
63.336 + public boolean getWatchesState() {
63.337 + return tbWatches().isSelected();
63.338 + }
63.339 +
63.340 + /** checks or unchecks given ToolbarToggleButton
63.341 + * @param state boolean requested state
63.342 + */
63.343 + public void checkClasses(boolean state) {
63.344 + if (tbClasses().isSelected()!=state) {
63.345 + tbClasses().push();
63.346 + }
63.347 + }
63.348 +
63.349 + /** Get state of the given ToolbarToggleButton
63.350 + */
63.351 + public boolean getClassesState() {
63.352 + return tbClasses().isSelected();
63.353 + }
63.354 +
63.355 + /** checks or unchecks given ToolbarToggleButton
63.356 + * @param state boolean requested state
63.357 + */
63.358 + public void checkProperties(boolean state) {
63.359 + if (tbProperties().isSelected()!=state) {
63.360 + tbProperties().push();
63.361 + }
63.362 + }
63.363 +
63.364 + /** Get state of the given ToolbarToggleButton
63.365 + */
63.366 + public boolean getPropertiesState() {
63.367 + return tbProperties().isSelected();
63.368 + }
63.369 +
63.370 +
63.371 + /** Tries to find null TreeTable in this dialog.
63.372 + * @return JTableOperator
63.373 + */
63.374 + public JTableOperator getJTableOperator(String view) {
63.375 + int viewNumber = -1;
63.376 + int displayedViews = -1;
63.377 + do {
63.378 + viewNumber++;
63.379 + switch (viewNumber) {
63.380 + case 0: {
63.381 + if (views[viewNumber].equals(view)) {
63.382 + checkSessions(true);
63.383 + displayedViews++;
63.384 + } else if (getSessionsState()) {
63.385 + displayedViews++;
63.386 + }
63.387 + break;
63.388 + }
63.389 + case 1: {
63.390 + if (views[viewNumber].equals(view)) {
63.391 + checkThreads(true);
63.392 + displayedViews++;
63.393 + } else if (getThreadsState()) {
63.394 + displayedViews++;
63.395 + }
63.396 + break;
63.397 + }
63.398 + case 2: {
63.399 + if (views[viewNumber].equals(view)) {
63.400 + checkCallStack(true);
63.401 + displayedViews++;
63.402 + } else if (getCallStackState()) {
63.403 + displayedViews++;
63.404 + }
63.405 + break;
63.406 + }
63.407 + case 3: {
63.408 + if (views[viewNumber].equals(view)) {
63.409 + checkLocalVariables(true);
63.410 + displayedViews++;
63.411 + } else if (getLocalVariablesState()) {
63.412 + displayedViews++;
63.413 + }
63.414 + break;
63.415 + }
63.416 + case 4: {
63.417 + if (views[viewNumber].equals(view)) {
63.418 + checkAllInOne(true);
63.419 + displayedViews++;
63.420 + } else if (getAllInOneState()) {
63.421 + displayedViews++;
63.422 + }
63.423 + break;
63.424 + }
63.425 + case 5: {
63.426 + if (views[viewNumber].equals(view)) {
63.427 + checkWatches(true);
63.428 + displayedViews++;
63.429 + } else if (getWatchesState()) {
63.430 + displayedViews++;
63.431 + }
63.432 + break;
63.433 + }
63.434 + case 6: {
63.435 + if (views[viewNumber].equals(view)) {
63.436 + checkClasses(true);
63.437 + displayedViews++;
63.438 + } else if (getClassesState()) {
63.439 + displayedViews++;
63.440 + }
63.441 + break;
63.442 + }
63.443 + case 7: {
63.444 + if (views[viewNumber].equals(view)) {
63.445 + checkBreakpoints(true);
63.446 + displayedViews++;
63.447 + } else if (getBreakpointsState()) {
63.448 + displayedViews++;
63.449 + }
63.450 + break;
63.451 + }
63.452 + case 8: {
63.453 + if (views[viewNumber].equals(view)) {
63.454 + checkProperties(true);
63.455 + displayedViews++;
63.456 + } else if (getPropertiesState()) {
63.457 + displayedViews++;
63.458 + }
63.459 + break;
63.460 + }
63.461 + }
63.462 +
63.463 + } while (!views[viewNumber].equals(view));
63.464 + _tabTreeTable = new JTableOperator(this, displayedViews);
63.465 + return _tabTreeTable;
63.466 + }
63.467 +
63.468 + public static class DebuggerWindowChooser implements ComponentChooser {
63.469 + String ID;
63.470 + private Operator.StringComparator comparator;
63.471 + public DebuggerWindowChooser(String ID) {
63.472 + this(ID, new Operator.DefaultStringComparator(false, false));
63.473 + }
63.474 + public DebuggerWindowChooser(String ID, Operator.StringComparator comparator){
63.475 + this.ID = ID;
63.476 + this.comparator = comparator;
63.477 + }
63.478 + public boolean checkComponent(Component comp) {
63.479 + if(comp !=null && ((Component)comp).getName()!=null)
63.480 + return(comp instanceof Component && ((Component)comp).getName().equals(ID) );
63.481 + else return false;
63.482 + }
63.483 + public String getDescription() {
63.484 + return("A Component with \"" + ID + "\" ID");
63.485 + }
63.486 + }
63.487 +
63.488 +
63.489 +}
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/TermOperator.java Thu Jul 10 04:32:50 2008 -0700
64.3 @@ -0,0 +1,559 @@
64.4 +/*
64.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
64.6 + *
64.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
64.8 + *
64.9 + * The contents of this file are subject to the terms of either the GNU
64.10 + * General Public License Version 2 only ("GPL") or the Common
64.11 + * Development and Distribution License("CDDL") (collectively, the
64.12 + * "License"). You may not use this file except in compliance with the
64.13 + * License. You can obtain a copy of the License at
64.14 + * http://www.netbeans.org/cddl-gplv2.html
64.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
64.16 + * specific language governing permissions and limitations under the
64.17 + * License. When distributing the software, include this License Header
64.18 + * Notice in each file and include the License file at
64.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
64.20 + * particular file as subject to the "Classpath" exception as provided
64.21 + * by Sun in the GPL Version 2 section of the License file that
64.22 + * accompanied this code. If applicable, add the following below the
64.23 + * License Header, with the fields enclosed by brackets [] replaced by
64.24 + * your own identifying information:
64.25 + * "Portions Copyrighted [year] [name of copyright owner]"
64.26 + *
64.27 + * Contributor(s):
64.28 + *
64.29 + * The Original Software is NetBeans. The Initial Developer of the Original
64.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
64.31 + * Microsystems, Inc. All Rights Reserved.
64.32 + *
64.33 + * If you wish your version of this file to be governed by only the CDDL
64.34 + * or only the GPL Version 2, indicate your decision by adding
64.35 + * "[Contributor] elects to include this software in this distribution
64.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
64.37 + * single choice of license, a recipient has the option to distribute
64.38 + * your version of this file under either the CDDL, the GPL Version 2 or
64.39 + * to extend the choice of license to its licensees as provided above.
64.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
64.41 + * Version 2 license, then the option applies only if the new code is
64.42 + * made subject to such option by the copyright holder.
64.43 + */
64.44 +
64.45 +//The class is invalid: terminalemulator was replaced by core/output2
64.46 +//so, removing all the meet from it
64.47 +package org.netbeans.modules.visualweb.gravy.debugger;
64.48 +
64.49 +import java.awt.Component;
64.50 +import java.awt.Container;
64.51 +import java.awt.event.InputEvent;
64.52 +import java.awt.event.KeyEvent;
64.53 +import javax.swing.JComponent;
64.54 +import javax.swing.JTabbedPane;
64.55 +import org.netbeans.jellytools.actions.*;
64.56 +
64.57 +import org.netbeans.jemmy.ComponentChooser;
64.58 +import org.netbeans.jemmy.operators.ComponentOperator;
64.59 +import org.netbeans.jemmy.operators.ContainerOperator;
64.60 +import org.netbeans.jemmy.operators.JTabbedPaneOperator;
64.61 +import org.netbeans.jemmy.operators.Operator;
64.62 +
64.63 +/** Operator for Output pane containing one (normal output)
64.64 + * or more (for example JavaDoc output) output terminals
64.65 + * (org.netbeans.lib.terminalemulator.Term component).
64.66 + * <p>
64.67 + * Usage:<br>
64.68 + * <pre>
64.69 + * // find term with given name
64.70 + * TermOperator to = new TermOperator("MyClass - I/O");
64.71 + * // wait for a message appears in output
64.72 + * to.waitText("my message");
64.73 + * // get the text
64.74 + * String wholeOutput = to.getText();
64.75 + * to.clearOutput();
64.76 + * to.waitText("your message");
64.77 + * // close this output either way
64.78 + * to.close(); // or to.discard();
64.79 + * </pre>
64.80 + *
64.81 + */
64.82 +public class TermOperator extends ComponentOperator {
64.83 +
64.84 + // only first 5 Terms and 5 Screens are to be cached
64.85 + ComponentOperator[] _screen=new ComponentOperator[5];
64.86 + JComponent[] _term=new JComponent[5];
64.87 +
64.88 + // Actions used only in TermOperator.
64.89 + private static final Action findNextAction =
64.90 + new Action(null,
64.91 + "Find Next");//,
64.92 + //null,
64.93 + //new Shortcut(KeyEvent.VK_F3));
64.94 +
64.95 + private static final Action selectAllAction =
64.96 + new Action(null,
64.97 + "Select All");//,
64.98 + //null,
64.99 + //new Shortcut(KeyEvent.VK_A, InputEvent.CTRL_MASK));
64.100 +
64.101 + private static final Action clearAction =
64.102 + new Action(null,
64.103 + "Clear Output");
64.104 +
64.105 + private static final Action startRedirectionAction =
64.106 + new Action(null,
64.107 + "Start Redirection of This View to File");
64.108 +
64.109 + private static final Action stopRedirectionAction =
64.110 + new Action(null,
64.111 + "Stop Redirection of This View to File");
64.112 +
64.113 + private static final CopyAction copyAction = new CopyAction();
64.114 + private static final FindAction findAction = new FindAction();
64.115 +
64.116 +
64.117 + /** Create new instance of TermOperator from given component.
64.118 + * @param source TopComponent instance with Term
64.119 + */
64.120 + public TermOperator(JComponent source) {
64.121 + // used in OutputOperator
64.122 + super(source);
64.123 + }
64.124 +
64.125 + /** Waits for output term with given name.
64.126 + * It is activated by defalt.
64.127 + * @param name name of output term to look for
64.128 + *
64.129 + public TermOperator(String name) {
64.130 + this(name, 0);
64.131 + }
64.132 +
64.133 + /** Waits for index-th output term with given name.
64.134 + * It is activated by defalt.
64.135 + * @param name name of output term to look for
64.136 + * @param index index of requested output term with given name
64.137 + */
64.138 +
64.139 + /*public TermOperator(String name, int index) {
64.140 + super(new OutputOperator().waitSubComponent(new InnerTabSubchooser(name), index));
64.141 + makeComponentVisible();
64.142 + }*/
64.143 +
64.144 + /** Waits for output term with given name in specified container.
64.145 + * It is activated by defalt.
64.146 + * @param contOper container where to search
64.147 + * @param name name of output term to look for
64.148 + * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
64.149 + * because term can only be placed inside Output top component
64.150 + */
64.151 + public TermOperator(ContainerOperator contOper, String name) {
64.152 + this(contOper, name, 0);
64.153 + }
64.154 +
64.155 + /** Creates TermOperator instance
64.156 + * @param contOper container where to search
64.157 + * @param index int index of requested output term with given name
64.158 + * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
64.159 + * because term can only be placed inside Output top component
64.160 + */
64.161 + public TermOperator(ContainerOperator contOper, int index) {
64.162 + this(contOper, null, index);
64.163 + }
64.164 +
64.165 + /** Creates TermOperator instance
64.166 + * @param contOper container where to search
64.167 + * @param name String name of output term to look for
64.168 + * @param index int index of requested output term with given name
64.169 + * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
64.170 + * because term can only be placed inside Output top component
64.171 + */
64.172 + public TermOperator(ContainerOperator contOper, String name, int index) {
64.173 + super(contOper.waitSubComponent(new InnerTabSubchooser(name), index));
64.174 + makeComponentVisible();
64.175 + copyEnvironment(contOper);
64.176 + }
64.177 +
64.178 + /** Creates TermOperator instance
64.179 + * @param contOper container where to search
64.180 + * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
64.181 + * because term can only be placed inside Output top component
64.182 + */
64.183 + public TermOperator(ContainerOperator contOper) {
64.184 + super(contOper);
64.185 + }
64.186 +
64.187 + /** Activates this term. If this term is in tabbed pane, it is selected. If
64.188 + * it is only term in the Output top component, the Output top component
64.189 + * is activated.
64.190 + */
64.191 + /*public void makeComponentVisible() {
64.192 + if(getParent() instanceof JTabbedPane) {
64.193 + super.makeComponentVisible();
64.194 + // Term is a tab of JTabbedPane
64.195 + new JTabbedPaneOperator((JTabbedPane)getParent()).setSelectedComponent(getSource());
64.196 + } else {
64.197 + // term is sub component of Output top component
64.198 + new OutputOperator().makeComponentVisible();
64.199 + }
64.200 + }*/
64.201 +
64.202 + /** Getter for Term object
64.203 + * @return instance of Term
64.204 + */
64.205 + public JComponent getTermSource() {
64.206 + return getTermSource(0);
64.207 + }
64.208 +
64.209 + /** Getter for Term object
64.210 + * @return instance of Term
64.211 + * @param termIndex index of Term inside (usualy 0, Javadoc Output has two Terms: 0 and 1).
64.212 + */
64.213 + public JComponent getTermSource(int termIndex) {
64.214 + if (termIndex>=_term.length)
64.215 + return (JComponent)ComponentOperator.waitComponent((Container)getSource(), new TermFinder(), termIndex);
64.216 + if (_term[termIndex]==null) {
64.217 + _term[termIndex]=(JComponent)ComponentOperator.waitComponent((Container)getSource(), new TermFinder(), termIndex);
64.218 + }
64.219 + return _term[termIndex];
64.220 + }
64.221 +
64.222 + /** Finds a row by text in the first Term.
64.223 + * @param rowText String row text
64.224 + * @return row number of specified text; -1 if text not found
64.225 + */
64.226 + public int findRow(String rowText) {
64.227 + return findRow(rowText, 0);
64.228 + }
64.229 +
64.230 + /** Finds a row by text.
64.231 + * @param rowText String row text
64.232 + * @param termIndex int Term index
64.233 + * @return row number of specified text; -1 if text not found
64.234 + */
64.235 + public int findRow(String rowText, int termIndex) {
64.236 + for(int i = 0; i < getLineCount(termIndex); i++) {
64.237 + if(getComparator().equals(getRowText(i, termIndex), rowText)) {
64.238 + return i;
64.239 + }
64.240 + }
64.241 + return -1;
64.242 + }
64.243 +
64.244 + /** Invokes <code>flush</code> and returns text from the first Term.
64.245 + * @return text from the first Term.
64.246 + */
64.247 + public String getText() {
64.248 + return getText(0);
64.249 + }
64.250 +
64.251 + /** Invokes <code>flush</code> and returns text.
64.252 + * @param termIndex int Term index
64.253 + * @return text from termIndex-th Term
64.254 + */
64.255 + public String getText(int termIndex) {
64.256 + flush(termIndex);
64.257 + return getText(0, getLineCount(termIndex) - 1, termIndex);
64.258 + }
64.259 +
64.260 + /** Get text between <code>startRow</code> and <code>endRow</code> from the first Term
64.261 + * @param startRow first row to be included
64.262 + * @param endRow last row to be included
64.263 + * @return text between <code>startRow</code> and <code>endRow</code> from the first Term
64.264 + */
64.265 + public String getText(int startRow, int endRow) {
64.266 + return getText(startRow, endRow);
64.267 + }
64.268 +
64.269 + /** Get text between <code>startRow</code> and <code>endRow</code>
64.270 + * @param startRow first row to be included
64.271 + * @param endRow last row to be included
64.272 + * @param termIndex int Term index
64.273 + * @return text between <code>startRow</code> and <code>endRow</code>
64.274 + */
64.275 + public String getText(int startRow, int endRow, int termIndex) {
64.276 + flush(termIndex);
64.277 + String result = "";
64.278 + for(int i = startRow; i < endRow; i++) {
64.279 + result = result + getRowText(i, termIndex) + "\n";
64.280 + }
64.281 + return(result);
64.282 + }
64.283 +
64.284 + /** Waits for text to be displayed in output term.
64.285 + * @param text text to wait for
64.286 + */
64.287 + public void waitText(String text) {
64.288 + waitText(text, 0);
64.289 + }
64.290 +
64.291 + /** Waits for text to be displayed in termIndex-th term.
64.292 + * @param text text to wait for
64.293 + * @param termIndex Term index
64.294 + */
64.295 + public void waitText(final String text, final int termIndex) {
64.296 + getOutput().printLine("Wait \"" + text + "\" text in component \n : "+
64.297 + getTermSource(termIndex).toString());
64.298 + getOutput().printGolden("Wait \"" + text + "\" text");
64.299 + waitState(new ComponentChooser() {
64.300 + public boolean checkComponent(Component comp) {
64.301 + return(findRow(text, termIndex) > -1);
64.302 + }
64.303 + public String getDescription() {
64.304 + return("\"" + text + "\" text");
64.305 + }
64.306 + });
64.307 + }
64.308 +
64.309 + /** Returns count of filled lines of the first Term.
64.310 + * @return count of filled lines of the first Term.
64.311 + */
64.312 + public int getLineCount() {
64.313 + return getLineCount(0);
64.314 + }
64.315 +
64.316 + /** Returns count of filled lines.
64.317 + * @param termIndex int Term index
64.318 + * @return count of filled lines.
64.319 + */
64.320 + public int getLineCount(int termIndex) {
64.321 + flush(termIndex);
64.322 + return(getCursorRow(termIndex) + 1);
64.323 + }
64.324 +
64.325 + /** Returns the topmost component lying on the first Term.
64.326 + * All events should be dispatched to this component.
64.327 + * @return the topmost component lying on the first Term.
64.328 + */
64.329 + public ComponentOperator screen() {
64.330 + return screen(0);
64.331 + }
64.332 +
64.333 + /** Returns the topmost component lying on the term.
64.334 + * All events should be dispatched to this component.
64.335 + * @param termIndex int Term index
64.336 + * @return the topmost component lying on the termIndex-throws Term.
64.337 + */
64.338 + public ComponentOperator screen(int termIndex) {
64.339 + ComponentOperator sc;
64.340 + if (termIndex>=_screen.length || _screen[termIndex] == null) {
64.341 + sc = ComponentOperator.createOperator(ComponentOperator.waitComponent(getTermSource(termIndex), new ScreenFinder()));
64.342 + sc.copyEnvironment(this);
64.343 + if (termIndex<_screen.length)
64.344 + _screen[termIndex] = sc;
64.345 + return sc;
64.346 + }
64.347 + return _screen[termIndex];
64.348 + }
64.349 +
64.350 + ////////////////////////////////////////////////////////
64.351 + //Mapping //
64.352 + /** Returns text from specified row.
64.353 + * Maps <code>Term.getRowText(int)</code> through queue for the first Term.
64.354 + * @param row row number to get text from
64.355 + * @return text from the specified row
64.356 + */
64.357 + public String getRowText(int row) {
64.358 + return getRowText(row, 0);
64.359 + }
64.360 +
64.361 + /** Returns text from specified row of termIndex-th term.
64.362 + * Maps <code>Term.getRowText(int)</code> through queue
64.363 + * @param row row number to get text from
64.364 + * @param termIndex int Term index
64.365 + * @return text from the specified row
64.366 + */
64.367 + public String getRowText(final int row, final int termIndex) {
64.368 + return((String)runMapping(new MapAction("getRowText") {
64.369 + public Object map() {
64.370 + return(null);
64.371 + //return(((Term)getTermSource(termIndex)).getRowText(row));
64.372 + }}));}
64.373 +
64.374 + /** Returns text within given coordinates.
64.375 + * Maps <code>Term.textWithin(...)</code> through queue for the first Term.
64.376 + * @param beginRow starting row
64.377 + * @param beginCol starting column
64.378 + * @param endRow ending row
64.379 + * @param endCol ending column
64.380 + * @return text within begin and end coordinates
64.381 + */
64.382 + public String textWithin(int beginRow, int beginCol, int endRow, int endCol) {
64.383 + return textWithin(beginRow, beginCol, endRow, endCol, 0);
64.384 + }
64.385 +
64.386 + /** Returns text within given coordinates of termIndex-th term.
64.387 + * Maps <code>Term.textWithin(...)</code> through queue
64.388 + * @param beginRow starting row
64.389 + * @param beginCol starting column
64.390 + * @param endRow ending row
64.391 + * @param endCol ending column
64.392 + * @param termIndex int Term index
64.393 + * @return text within begin and end coordinates
64.394 + */
64.395 + public String textWithin(int beginRow, int beginCol, int endRow, int endCol, final int termIndex) {
64.396 + //final Coord begin = Coord.make(beginRow, beginCol);
64.397 + //final Coord end = Coord.make(endRow, endCol);
64.398 + final Object begin=null;
64.399 + final Object end=null;
64.400 + return((String)runMapping(new MapAction("textWithin") {
64.401 + public Object map() {
64.402 + return(null);
64.403 + //return(((Term)getTermSource(termIndex)).textWithin(begin, end));
64.404 + }}));}
64.405 +
64.406 + /* commented to avoid confusing.
64.407 + public int getRows() {
64.408 + return(runMapping(new MapIntegerAction("getRows") {
64.409 + public int map() {
64.410 + return(((Term)getTerm()).getRows());
64.411 + }}));}
64.412 + */
64.413 +
64.414 + /** Returns row where the cursor stands.
64.415 + * Maps <code>Term.getCursorRow()</code> through queue for the first Term
64.416 + * @return int cursor row
64.417 + */
64.418 + public int getCursorRow() {
64.419 + return getCursorRow(0);
64.420 + }
64.421 +
64.422 + /** Returns row where the cursor stands.
64.423 + * Maps <code>Term.getCursorRow()</code> through queue
64.424 + * @param termIndex int Term index
64.425 + * @return int cursor row
64.426 + */
64.427 + public int getCursorRow(final int termIndex) {
64.428 + return(runMapping(new MapIntegerAction("getCursorRow") {
64.429 + public int map() {
64.430 + return(0);
64.431 + //return(((Term)getTermSource(termIndex)).getCursorRow());
64.432 + }}));}
64.433 +
64.434 + /** Flushes buffer.
64.435 + * Maps <code>Term.flush()</code> through queue for the first Term */
64.436 + public void flush() {
64.437 + flush(0);
64.438 + }
64.439 +
64.440 + /** Flushes buffer.
64.441 + * Maps <code>Term.flush()</code> through queue
64.442 + * @param termIndex int Term index
64.443 + */
64.444 + public void flush(final int termIndex) {
64.445 + runMapping(new MapVoidAction("flush") {
64.446 + public void map() {
64.447 + //((Term)getTermSource(termIndex)).flush();
64.448 + }});}
64.449 +
64.450 + //End of mapping //
64.451 + ////////////////////////////////////////////////////////
64.452 +
64.453 + static class ScreenFinder implements ComponentChooser {
64.454 + public boolean checkComponent(Component comp) {
64.455 + Class cls = comp.getClass();
64.456 + do {
64.457 + if(cls.getName().equals("org.netbeans.lib.terminalemulator.Screen")) {
64.458 + return(true);
64.459 + }
64.460 + } while((cls = cls.getSuperclass()) != null);
64.461 + return(false);
64.462 + }
64.463 + public String getDescription() {
64.464 + return("Screen component");
64.465 + }
64.466 + }
64.467 +
64.468 + static class TermFinder implements ComponentChooser {
64.469 + public boolean checkComponent(Component comp) {
64.470 + return false;
64.471 + //return comp instanceof Term;
64.472 + }
64.473 + public String getDescription() {
64.474 + return "org.netbeans.lib.terminalemulator.Term";
64.475 + }
64.476 + }
64.477 +
64.478 + /** SubChooser to determine Term TopComponent
64.479 + * Used in findTopComponent method.
64.480 + */
64.481 + private static final class InnerTabSubchooser implements ComponentChooser {
64.482 +
64.483 + /** Name of term to search for. */
64.484 + private String termName;
64.485 +
64.486 + public InnerTabSubchooser() {
64.487 + }
64.488 +
64.489 + public InnerTabSubchooser(String termName) {
64.490 + this.termName = termName;
64.491 + }
64.492 +
64.493 + public boolean checkComponent(Component comp) {
64.494 + if(comp.getClass().getName().endsWith("OutputTabInner")) { // NOI18N
64.495 + return Operator.getDefaultStringComparator().equals(comp.getName(), termName);
64.496 + } else {
64.497 + return false;
64.498 + }
64.499 + }
64.500 +
64.501 + public String getDescription() {
64.502 + return "org.netbeans.core.output.OutputTabInner"; // NOI18N
64.503 + }
64.504 + }
64.505 +
64.506 + /** Performs verification by accessing all sub-components */
64.507 + public void verify() {
64.508 + screen();
64.509 + }
64.510 +
64.511 + /****************************** Actions *****************************/
64.512 +
64.513 + /** Performs copy action. */
64.514 + public void copy() {
64.515 + //copyAction.perform(screen());
64.516 + }
64.517 +
64.518 + /** Performs find action. */
64.519 + public void find() {
64.520 + //findAction.perform(screen());
64.521 + }
64.522 +
64.523 + /** Performs find next action. */
64.524 + public void findNext() {
64.525 + //findNextAction.perform(screen());
64.526 + }
64.527 +
64.528 + /** Performs select all action. */
64.529 + public void selectAll() {
64.530 + //selectAllAction.perform(screen());
64.531 + }
64.532 +
64.533 + /** Performs clear output action. */
64.534 + public void clearOutput() {
64.535 + //clearAction.perform(screen());
64.536 + }
64.537 +
64.538 + /** Performs start redirection action. */
64.539 + public void startRedirection() {
64.540 + //startRedirectionAction.perform(screen());
64.541 + }
64.542 +
64.543 + /** Performs stop redirection action. */
64.544 + public void stopRedirection() {
64.545 + //stopRedirectionAction.perform(screen());
64.546 + }
64.547 +
64.548 + /** Performs discard action. */
64.549 + public void discard() {
64.550 + //new DiscardOutputAction().perform(this);
64.551 + }
64.552 +
64.553 + /** Performs discard all action. */
64.554 + public void discardAll() {
64.555 + //new DiscardAllOutputsAction().perform(this);
64.556 + }
64.557 +
64.558 + /** Closes output teby by API. */
64.559 + public void close() {
64.560 + //new DiscardOutputAction().performAPI(this);
64.561 + }
64.562 +}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/AddBreakpointAction.java Thu Jul 10 04:32:50 2008 -0700
65.3 @@ -0,0 +1,61 @@
65.4 +/*
65.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
65.6 + *
65.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
65.8 + *
65.9 + * The contents of this file are subject to the terms of either the GNU
65.10 + * General Public License Version 2 only ("GPL") or the Common
65.11 + * Development and Distribution License("CDDL") (collectively, the
65.12 + * "License"). You may not use this file except in compliance with the
65.13 + * License. You can obtain a copy of the License at
65.14 + * http://www.netbeans.org/cddl-gplv2.html
65.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
65.16 + * specific language governing permissions and limitations under the
65.17 + * License. When distributing the software, include this License Header
65.18 + * Notice in each file and include the License file at
65.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
65.20 + * particular file as subject to the "Classpath" exception as provided
65.21 + * by Sun in the GPL Version 2 section of the License file that
65.22 + * accompanied this code. If applicable, add the following below the
65.23 + * License Header, with the fields enclosed by brackets [] replaced by
65.24 + * your own identifying information:
65.25 + * "Portions Copyrighted [year] [name of copyright owner]"
65.26 + *
65.27 + * Contributor(s):
65.28 + *
65.29 + * The Original Software is NetBeans. The Initial Developer of the Original
65.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
65.31 + * Microsystems, Inc. All Rights Reserved.
65.32 + *
65.33 + * If you wish your version of this file to be governed by only the CDDL
65.34 + * or only the GPL Version 2, indicate your decision by adding
65.35 + * "[Contributor] elects to include this software in this distribution
65.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
65.37 + * single choice of license, a recipient has the option to distribute
65.38 + * your version of this file under either the CDDL, the GPL Version 2 or
65.39 + * to extend the choice of license to its licensees as provided above.
65.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
65.41 + * Version 2 license, then the option applies only if the new code is
65.42 + * made subject to such option by the copyright holder.
65.43 + */
65.44 +
65.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
65.46 +
65.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
65.48 +import org.netbeans.jellytools.Bundle;
65.49 +import java.awt.event.KeyEvent;
65.50 +
65.51 +/** AddBreakpointAction class
65.52 + */
65.53 +public class AddBreakpointAction extends ActionNoBlock {
65.54 +
65.55 + private static final String addBreakpointMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
65.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Breakpoint_Title");
65.57 + private static final Shortcut addBreakpointShortcut = new Shortcut(KeyEvent.VK_B, KeyEvent.CTRL_MASK);
65.58 +
65.59 +
65.60 + /** creates new AddBreakpointAction instance */
65.61 + public AddBreakpointAction() {
65.62 + super(addBreakpointMenu, null, "org.netbeans.modules.debugger.support.actions.AddBreakpointAction", addBreakpointShortcut);
65.63 + }
65.64 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/AddWatchAction.java Thu Jul 10 04:32:50 2008 -0700
66.3 @@ -0,0 +1,61 @@
66.4 +/*
66.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
66.6 + *
66.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
66.8 + *
66.9 + * The contents of this file are subject to the terms of either the GNU
66.10 + * General Public License Version 2 only ("GPL") or the Common
66.11 + * Development and Distribution License("CDDL") (collectively, the
66.12 + * "License"). You may not use this file except in compliance with the
66.13 + * License. You can obtain a copy of the License at
66.14 + * http://www.netbeans.org/cddl-gplv2.html
66.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
66.16 + * specific language governing permissions and limitations under the
66.17 + * License. When distributing the software, include this License Header
66.18 + * Notice in each file and include the License file at
66.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
66.20 + * particular file as subject to the "Classpath" exception as provided
66.21 + * by Sun in the GPL Version 2 section of the License file that
66.22 + * accompanied this code. If applicable, add the following below the
66.23 + * License Header, with the fields enclosed by brackets [] replaced by
66.24 + * your own identifying information:
66.25 + * "Portions Copyrighted [year] [name of copyright owner]"
66.26 + *
66.27 + * Contributor(s):
66.28 + *
66.29 + * The Original Software is NetBeans. The Initial Developer of the Original
66.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
66.31 + * Microsystems, Inc. All Rights Reserved.
66.32 + *
66.33 + * If you wish your version of this file to be governed by only the CDDL
66.34 + * or only the GPL Version 2, indicate your decision by adding
66.35 + * "[Contributor] elects to include this software in this distribution
66.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
66.37 + * single choice of license, a recipient has the option to distribute
66.38 + * your version of this file under either the CDDL, the GPL Version 2 or
66.39 + * to extend the choice of license to its licensees as provided above.
66.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
66.41 + * Version 2 license, then the option applies only if the new code is
66.42 + * made subject to such option by the copyright holder.
66.43 + */
66.44 +
66.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
66.46 +
66.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
66.48 +import org.netbeans.jellytools.Bundle;
66.49 +import java.awt.event.KeyEvent;
66.50 +
66.51 +/** AddWatchAction class
66.52 + */
66.53 +public class AddWatchAction extends ActionNoBlock {
66.54 +
66.55 + private static final String addWatchMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
66.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Watch_Title");
66.57 + private static final Shortcut addWatchShortcut = new Shortcut(KeyEvent.VK_W, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK );
66.58 +
66.59 +
66.60 + /** creates new AddWatchAction instance */
66.61 + public AddWatchAction() {
66.62 + super(addWatchMenu, null, "org.netbeans.modules.debugger.support.actions.AddWatchAction", addWatchShortcut);
66.63 + }
66.64 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/ContinueDebugAction.java Thu Jul 10 04:32:50 2008 -0700
67.3 @@ -0,0 +1,60 @@
67.4 +/*
67.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
67.6 + *
67.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
67.8 + *
67.9 + * The contents of this file are subject to the terms of either the GNU
67.10 + * General Public License Version 2 only ("GPL") or the Common
67.11 + * Development and Distribution License("CDDL") (collectively, the
67.12 + * "License"). You may not use this file except in compliance with the
67.13 + * License. You can obtain a copy of the License at
67.14 + * http://www.netbeans.org/cddl-gplv2.html
67.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
67.16 + * specific language governing permissions and limitations under the
67.17 + * License. When distributing the software, include this License Header
67.18 + * Notice in each file and include the License file at
67.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
67.20 + * particular file as subject to the "Classpath" exception as provided
67.21 + * by Sun in the GPL Version 2 section of the License file that
67.22 + * accompanied this code. If applicable, add the following below the
67.23 + * License Header, with the fields enclosed by brackets [] replaced by
67.24 + * your own identifying information:
67.25 + * "Portions Copyrighted [year] [name of copyright owner]"
67.26 + *
67.27 + * Contributor(s):
67.28 + *
67.29 + * The Original Software is NetBeans. The Initial Developer of the Original
67.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
67.31 + * Microsystems, Inc. All Rights Reserved.
67.32 + *
67.33 + * If you wish your version of this file to be governed by only the CDDL
67.34 + * or only the GPL Version 2, indicate your decision by adding
67.35 + * "[Contributor] elects to include this software in this distribution
67.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
67.37 + * single choice of license, a recipient has the option to distribute
67.38 + * your version of this file under either the CDDL, the GPL Version 2 or
67.39 + * to extend the choice of license to its licensees as provided above.
67.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
67.41 + * Version 2 license, then the option applies only if the new code is
67.42 + * made subject to such option by the copyright holder.
67.43 + */
67.44 +
67.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
67.46 +
67.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
67.48 +import org.netbeans.jellytools.Bundle;
67.49 +import java.awt.event.KeyEvent;
67.50 +
67.51 +/** ConinueDebugAction class
67.52 + */
67.53 +public class ContinueDebugAction extends ActionNoBlock {
67.54 +
67.55 + private static final String continueDebugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
67.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Continue_action_name");
67.57 + private static final Shortcut continueDebugShortcut = new Shortcut(KeyEvent.VK_F5, KeyEvent.ALT_MASK);
67.58 +
67.59 + /** creates new ContinueDebugAction instance */
67.60 + public ContinueDebugAction() {
67.61 + super(continueDebugMenu, null, "org.netbeans.modules.debugger.support.actions.ContinueAction", continueDebugShortcut);
67.62 + }
67.63 +}
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/DebuggerWindowAction.java Thu Jul 10 04:32:50 2008 -0700
68.3 @@ -0,0 +1,63 @@
68.4 +/*
68.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
68.6 + *
68.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
68.8 + *
68.9 + * The contents of this file are subject to the terms of either the GNU
68.10 + * General Public License Version 2 only ("GPL") or the Common
68.11 + * Development and Distribution License("CDDL") (collectively, the
68.12 + * "License"). You may not use this file except in compliance with the
68.13 + * License. You can obtain a copy of the License at
68.14 + * http://www.netbeans.org/cddl-gplv2.html
68.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
68.16 + * specific language governing permissions and limitations under the
68.17 + * License. When distributing the software, include this License Header
68.18 + * Notice in each file and include the License file at
68.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
68.20 + * particular file as subject to the "Classpath" exception as provided
68.21 + * by Sun in the GPL Version 2 section of the License file that
68.22 + * accompanied this code. If applicable, add the following below the
68.23 + * License Header, with the fields enclosed by brackets [] replaced by
68.24 + * your own identifying information:
68.25 + * "Portions Copyrighted [year] [name of copyright owner]"
68.26 + *
68.27 + * Contributor(s):
68.28 + *
68.29 + * The Original Software is NetBeans. The Initial Developer of the Original
68.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
68.31 + * Microsystems, Inc. All Rights Reserved.
68.32 + *
68.33 + * If you wish your version of this file to be governed by only the CDDL
68.34 + * or only the GPL Version 2, indicate your decision by adding
68.35 + * "[Contributor] elects to include this software in this distribution
68.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
68.37 + * single choice of license, a recipient has the option to distribute
68.38 + * your version of this file under either the CDDL, the GPL Version 2 or
68.39 + * to extend the choice of license to its licensees as provided above.
68.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
68.41 + * Version 2 license, then the option applies only if the new code is
68.42 + * made subject to such option by the copyright holder.
68.43 + */
68.44 +
68.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
68.46 +
68.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
68.48 +import java.awt.event.KeyEvent;
68.49 +import org.netbeans.jellytools.Bundle;
68.50 +
68.51 +/** Used to call "View|Debugger Window" main menu item
68.52 + */
68.53 +public class DebuggerWindowAction extends ActionNoBlock {
68.54 + private static final String menu =
68.55 + Bundle.getStringTrimmed("org.netbeans.core.Bundle",
68.56 + "Menu/View") +
68.57 + "|" +
68.58 + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle",
68.59 + "CTL_Debugger_Window_action_name");
68.60 + private static final Shortcut debuggerWindowShortcut = new Shortcut(KeyEvent.VK_D, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK);
68.61 +
68.62 + /** Creates new DebuggerWindowAction instance. */
68.63 + public DebuggerWindowAction() {
68.64 + super(menu, null, "org.netbeans.core.actions.OptionsAction", debuggerWindowShortcut);
68.65 + }
68.66 +}
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/FinishDebugAction.java Thu Jul 10 04:32:50 2008 -0700
69.3 @@ -0,0 +1,60 @@
69.4 +/*
69.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
69.6 + *
69.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
69.8 + *
69.9 + * The contents of this file are subject to the terms of either the GNU
69.10 + * General Public License Version 2 only ("GPL") or the Common
69.11 + * Development and Distribution License("CDDL") (collectively, the
69.12 + * "License"). You may not use this file except in compliance with the
69.13 + * License. You can obtain a copy of the License at
69.14 + * http://www.netbeans.org/cddl-gplv2.html
69.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
69.16 + * specific language governing permissions and limitations under the
69.17 + * License. When distributing the software, include this License Header
69.18 + * Notice in each file and include the License file at
69.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
69.20 + * particular file as subject to the "Classpath" exception as provided
69.21 + * by Sun in the GPL Version 2 section of the License file that
69.22 + * accompanied this code. If applicable, add the following below the
69.23 + * License Header, with the fields enclosed by brackets [] replaced by
69.24 + * your own identifying information:
69.25 + * "Portions Copyrighted [year] [name of copyright owner]"
69.26 + *
69.27 + * Contributor(s):
69.28 + *
69.29 + * The Original Software is NetBeans. The Initial Developer of the Original
69.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
69.31 + * Microsystems, Inc. All Rights Reserved.
69.32 + *
69.33 + * If you wish your version of this file to be governed by only the CDDL
69.34 + * or only the GPL Version 2, indicate your decision by adding
69.35 + * "[Contributor] elects to include this software in this distribution
69.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
69.37 + * single choice of license, a recipient has the option to distribute
69.38 + * your version of this file under either the CDDL, the GPL Version 2 or
69.39 + * to extend the choice of license to its licensees as provided above.
69.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
69.41 + * Version 2 license, then the option applies only if the new code is
69.42 + * made subject to such option by the copyright holder.
69.43 + */
69.44 +
69.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
69.46 +
69.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
69.48 +import org.netbeans.jellytools.Bundle;
69.49 +import java.awt.event.KeyEvent;
69.50 +
69.51 +/** FinishDebugAction class
69.52 + */
69.53 +public class FinishDebugAction extends ActionNoBlock {
69.54 +
69.55 + private static final String finishDebugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
69.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Finish_action_name");
69.57 + private static final Shortcut finishDebugShortcut = new Shortcut(KeyEvent.VK_F5, KeyEvent.SHIFT_MASK );
69.58 +
69.59 + /** creates new FinishDebugAction instance */
69.60 + public FinishDebugAction() {
69.61 + super(finishDebugMenu, null, "org.openide.actions.FinishDebuggerAction", finishDebugShortcut);
69.62 + }
69.63 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/PauseDebugAction.java Thu Jul 10 04:32:50 2008 -0700
70.3 @@ -0,0 +1,59 @@
70.4 +/*
70.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
70.6 + *
70.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
70.8 + *
70.9 + * The contents of this file are subject to the terms of either the GNU
70.10 + * General Public License Version 2 only ("GPL") or the Common
70.11 + * Development and Distribution License("CDDL") (collectively, the
70.12 + * "License"). You may not use this file except in compliance with the
70.13 + * License. You can obtain a copy of the License at
70.14 + * http://www.netbeans.org/cddl-gplv2.html
70.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
70.16 + * specific language governing permissions and limitations under the
70.17 + * License. When distributing the software, include this License Header
70.18 + * Notice in each file and include the License file at
70.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
70.20 + * particular file as subject to the "Classpath" exception as provided
70.21 + * by Sun in the GPL Version 2 section of the License file that
70.22 + * accompanied this code. If applicable, add the following below the
70.23 + * License Header, with the fields enclosed by brackets [] replaced by
70.24 + * your own identifying information:
70.25 + * "Portions Copyrighted [year] [name of copyright owner]"
70.26 + *
70.27 + * Contributor(s):
70.28 + *
70.29 + * The Original Software is NetBeans. The Initial Developer of the Original
70.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
70.31 + * Microsystems, Inc. All Rights Reserved.
70.32 + *
70.33 + * If you wish your version of this file to be governed by only the CDDL
70.34 + * or only the GPL Version 2, indicate your decision by adding
70.35 + * "[Contributor] elects to include this software in this distribution
70.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
70.37 + * single choice of license, a recipient has the option to distribute
70.38 + * your version of this file under either the CDDL, the GPL Version 2 or
70.39 + * to extend the choice of license to its licensees as provided above.
70.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
70.41 + * Version 2 license, then the option applies only if the new code is
70.42 + * made subject to such option by the copyright holder.
70.43 + */
70.44 +
70.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
70.46 +
70.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
70.48 +import org.netbeans.jellytools.Bundle;
70.49 +import java.awt.event.KeyEvent;
70.50 +
70.51 +/** PauseDebugAction class
70.52 + */
70.53 +public class PauseDebugAction extends ActionNoBlock {
70.54 +
70.55 + private static final String pauseDebugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
70.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Pause_action_name");
70.57 +
70.58 + /** creates new PauseDebugAction instance */
70.59 + public PauseDebugAction() {
70.60 + super(pauseDebugMenu, null, "org.netbeans.modules.debugger.support.actions.PauseAction");
70.61 + }
70.62 +}
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/RunToCursorAction.java Thu Jul 10 04:32:50 2008 -0700
71.3 @@ -0,0 +1,60 @@
71.4 +/*
71.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
71.6 + *
71.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
71.8 + *
71.9 + * The contents of this file are subject to the terms of either the GNU
71.10 + * General Public License Version 2 only ("GPL") or the Common
71.11 + * Development and Distribution License("CDDL") (collectively, the
71.12 + * "License"). You may not use this file except in compliance with the
71.13 + * License. You can obtain a copy of the License at
71.14 + * http://www.netbeans.org/cddl-gplv2.html
71.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
71.16 + * specific language governing permissions and limitations under the
71.17 + * License. When distributing the software, include this License Header
71.18 + * Notice in each file and include the License file at
71.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
71.20 + * particular file as subject to the "Classpath" exception as provided
71.21 + * by Sun in the GPL Version 2 section of the License file that
71.22 + * accompanied this code. If applicable, add the following below the
71.23 + * License Header, with the fields enclosed by brackets [] replaced by
71.24 + * your own identifying information:
71.25 + * "Portions Copyrighted [year] [name of copyright owner]"
71.26 + *
71.27 + * Contributor(s):
71.28 + *
71.29 + * The Original Software is NetBeans. The Initial Developer of the Original
71.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
71.31 + * Microsystems, Inc. All Rights Reserved.
71.32 + *
71.33 + * If you wish your version of this file to be governed by only the CDDL
71.34 + * or only the GPL Version 2, indicate your decision by adding
71.35 + * "[Contributor] elects to include this software in this distribution
71.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
71.37 + * single choice of license, a recipient has the option to distribute
71.38 + * your version of this file under either the CDDL, the GPL Version 2 or
71.39 + * to extend the choice of license to its licensees as provided above.
71.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
71.41 + * Version 2 license, then the option applies only if the new code is
71.42 + * made subject to such option by the copyright holder.
71.43 + */
71.44 +
71.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
71.46 +
71.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
71.48 +import org.netbeans.jellytools.Bundle;
71.49 +import java.awt.event.KeyEvent;
71.50 +
71.51 +/** RunToCursorAction class
71.52 + */
71.53 +public class RunToCursorAction extends ActionNoBlock {
71.54 +
71.55 + private static final String runToCursorMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
71.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Run_to_cursor_action_name");
71.57 + private static final Shortcut runToCursorShortcut = new Shortcut(KeyEvent.VK_F10, KeyEvent.CTRL_MASK);
71.58 +
71.59 + /** creates new RunToCursorAction instance */
71.60 + public RunToCursorAction() {
71.61 + super(runToCursorMenu, null, "org.netbeans.modules.debugger.support.actions.RunToCursorAction", runToCursorShortcut);
71.62 + }
71.63 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StartDebugAction.java Thu Jul 10 04:32:50 2008 -0700
72.3 @@ -0,0 +1,60 @@
72.4 +/*
72.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
72.6 + *
72.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
72.8 + *
72.9 + * The contents of this file are subject to the terms of either the GNU
72.10 + * General Public License Version 2 only ("GPL") or the Common
72.11 + * Development and Distribution License("CDDL") (collectively, the
72.12 + * "License"). You may not use this file except in compliance with the
72.13 + * License. You can obtain a copy of the License at
72.14 + * http://www.netbeans.org/cddl-gplv2.html
72.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
72.16 + * specific language governing permissions and limitations under the
72.17 + * License. When distributing the software, include this License Header
72.18 + * Notice in each file and include the License file at
72.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
72.20 + * particular file as subject to the "Classpath" exception as provided
72.21 + * by Sun in the GPL Version 2 section of the License file that
72.22 + * accompanied this code. If applicable, add the following below the
72.23 + * License Header, with the fields enclosed by brackets [] replaced by
72.24 + * your own identifying information:
72.25 + * "Portions Copyrighted [year] [name of copyright owner]"
72.26 + *
72.27 + * Contributor(s):
72.28 + *
72.29 + * The Original Software is NetBeans. The Initial Developer of the Original
72.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
72.31 + * Microsystems, Inc. All Rights Reserved.
72.32 + *
72.33 + * If you wish your version of this file to be governed by only the CDDL
72.34 + * or only the GPL Version 2, indicate your decision by adding
72.35 + * "[Contributor] elects to include this software in this distribution
72.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
72.37 + * single choice of license, a recipient has the option to distribute
72.38 + * your version of this file under either the CDDL, the GPL Version 2 or
72.39 + * to extend the choice of license to its licensees as provided above.
72.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
72.41 + * Version 2 license, then the option applies only if the new code is
72.42 + * made subject to such option by the copyright holder.
72.43 + */
72.44 +
72.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
72.46 +
72.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
72.48 +import org.netbeans.jellytools.Bundle;
72.49 +import java.awt.event.KeyEvent;
72.50 +
72.51 +/** StartDebugAction class
72.52 + */
72.53 +public class StartDebugAction extends ActionNoBlock {
72.54 +
72.55 + private static final String debugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
72.56 + + "|" + Bundle.getStringTrimmed("com.sun.rave.gravy.project.actions.Bundle", "LBL_DebugProject");
72.57 + private static final Shortcut debugShortcut = new Shortcut(KeyEvent.VK_F5);
72.58 +
72.59 + /** creates new StartDebugAction instance */
72.60 + public StartDebugAction() {
72.61 + super(debugMenu, null, "org.netbeans.modules.debugger.support.actions.StartAction");
72.62 + }
72.63 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
73.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StepIntoAction.java Thu Jul 10 04:32:50 2008 -0700
73.3 @@ -0,0 +1,61 @@
73.4 +/*
73.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
73.6 + *
73.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
73.8 + *
73.9 + * The contents of this file are subject to the terms of either the GNU
73.10 + * General Public License Version 2 only ("GPL") or the Common
73.11 + * Development and Distribution License("CDDL") (collectively, the
73.12 + * "License"). You may not use this file except in compliance with the
73.13 + * License. You can obtain a copy of the License at
73.14 + * http://www.netbeans.org/cddl-gplv2.html
73.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
73.16 + * specific language governing permissions and limitations under the
73.17 + * License. When distributing the software, include this License Header
73.18 + * Notice in each file and include the License file at
73.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
73.20 + * particular file as subject to the "Classpath" exception as provided
73.21 + * by Sun in the GPL Version 2 section of the License file that
73.22 + * accompanied this code. If applicable, add the following below the
73.23 + * License Header, with the fields enclosed by brackets [] replaced by
73.24 + * your own identifying information:
73.25 + * "Portions Copyrighted [year] [name of copyright owner]"
73.26 + *
73.27 + * Contributor(s):
73.28 + *
73.29 + * The Original Software is NetBeans. The Initial Developer of the Original
73.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
73.31 + * Microsystems, Inc. All Rights Reserved.
73.32 + *
73.33 + * If you wish your version of this file to be governed by only the CDDL
73.34 + * or only the GPL Version 2, indicate your decision by adding
73.35 + * "[Contributor] elects to include this software in this distribution
73.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
73.37 + * single choice of license, a recipient has the option to distribute
73.38 + * your version of this file under either the CDDL, the GPL Version 2 or
73.39 + * to extend the choice of license to its licensees as provided above.
73.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
73.41 + * Version 2 license, then the option applies only if the new code is
73.42 + * made subject to such option by the copyright holder.
73.43 + */
73.44 +
73.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
73.46 +
73.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
73.48 +import org.netbeans.jellytools.Bundle;
73.49 +import java.awt.event.KeyEvent;
73.50 +
73.51 +/** StepIntoAction class
73.52 + */
73.53 +public class StepIntoAction extends ActionNoBlock {
73.54 +
73.55 + private static final String stepIntoMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
73.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Step_into_action_name");
73.57 + private static final Shortcut stepIntoShortcut = new Shortcut(KeyEvent.VK_F11);
73.58 +
73.59 +
73.60 + /** creates new StepIntoAction instance */
73.61 + public StepIntoAction() {
73.62 + super(stepIntoMenu, null, "org.netbeans.modules.debugger.actions.StepIntoAction", stepIntoShortcut);
73.63 + }
73.64 +}
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StepOutAction.java Thu Jul 10 04:32:50 2008 -0700
74.3 @@ -0,0 +1,61 @@
74.4 +/*
74.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
74.6 + *
74.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
74.8 + *
74.9 + * The contents of this file are subject to the terms of either the GNU
74.10 + * General Public License Version 2 only ("GPL") or the Common
74.11 + * Development and Distribution License("CDDL") (collectively, the
74.12 + * "License"). You may not use this file except in compliance with the
74.13 + * License. You can obtain a copy of the License at
74.14 + * http://www.netbeans.org/cddl-gplv2.html
74.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
74.16 + * specific language governing permissions and limitations under the
74.17 + * License. When distributing the software, include this License Header
74.18 + * Notice in each file and include the License file at
74.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
74.20 + * particular file as subject to the "Classpath" exception as provided
74.21 + * by Sun in the GPL Version 2 section of the License file that
74.22 + * accompanied this code. If applicable, add the following below the
74.23 + * License Header, with the fields enclosed by brackets [] replaced by
74.24 + * your own identifying information:
74.25 + * "Portions Copyrighted [year] [name of copyright owner]"
74.26 + *
74.27 + * Contributor(s):
74.28 + *
74.29 + * The Original Software is NetBeans. The Initial Developer of the Original
74.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
74.31 + * Microsystems, Inc. All Rights Reserved.
74.32 + *
74.33 + * If you wish your version of this file to be governed by only the CDDL
74.34 + * or only the GPL Version 2, indicate your decision by adding
74.35 + * "[Contributor] elects to include this software in this distribution
74.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
74.37 + * single choice of license, a recipient has the option to distribute
74.38 + * your version of this file under either the CDDL, the GPL Version 2 or
74.39 + * to extend the choice of license to its licensees as provided above.
74.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
74.41 + * Version 2 license, then the option applies only if the new code is
74.42 + * made subject to such option by the copyright holder.
74.43 + */
74.44 +
74.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
74.46 +
74.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
74.48 +import org.netbeans.jellytools.Bundle;
74.49 +import java.awt.event.KeyEvent;
74.50 +
74.51 +/** StepOutAction class
74.52 + */
74.53 +public class StepOutAction extends ActionNoBlock {
74.54 +
74.55 + private static final String stepOutMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
74.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Step_out_action_name");
74.57 + private static final Shortcut stepOutShortcut = new Shortcut(KeyEvent.VK_F11, KeyEvent.SHIFT_MASK);
74.58 +
74.59 +
74.60 + /** creates new StepOutAction instance */
74.61 + public StepOutAction() {
74.62 + super(stepOutMenu, null, "org.netbeans.modules.debugger.actions.StepOutAction", stepOutShortcut);
74.63 + }
74.64 +}
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
75.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StepOverAction.java Thu Jul 10 04:32:50 2008 -0700
75.3 @@ -0,0 +1,61 @@
75.4 +/*
75.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
75.6 + *
75.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
75.8 + *
75.9 + * The contents of this file are subject to the terms of either the GNU
75.10 + * General Public License Version 2 only ("GPL") or the Common
75.11 + * Development and Distribution License("CDDL") (collectively, the
75.12 + * "License"). You may not use this file except in compliance with the
75.13 + * License. You can obtain a copy of the License at
75.14 + * http://www.netbeans.org/cddl-gplv2.html
75.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
75.16 + * specific language governing permissions and limitations under the
75.17 + * License. When distributing the software, include this License Header
75.18 + * Notice in each file and include the License file at
75.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
75.20 + * particular file as subject to the "Classpath" exception as provided
75.21 + * by Sun in the GPL Version 2 section of the License file that
75.22 + * accompanied this code. If applicable, add the following below the
75.23 + * License Header, with the fields enclosed by brackets [] replaced by
75.24 + * your own identifying information:
75.25 + * "Portions Copyrighted [year] [name of copyright owner]"
75.26 + *
75.27 + * Contributor(s):
75.28 + *
75.29 + * The Original Software is NetBeans. The Initial Developer of the Original
75.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
75.31 + * Microsystems, Inc. All Rights Reserved.
75.32 + *
75.33 + * If you wish your version of this file to be governed by only the CDDL
75.34 + * or only the GPL Version 2, indicate your decision by adding
75.35 + * "[Contributor] elects to include this software in this distribution
75.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
75.37 + * single choice of license, a recipient has the option to distribute
75.38 + * your version of this file under either the CDDL, the GPL Version 2 or
75.39 + * to extend the choice of license to its licensees as provided above.
75.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
75.41 + * Version 2 license, then the option applies only if the new code is
75.42 + * made subject to such option by the copyright holder.
75.43 + */
75.44 +
75.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
75.46 +
75.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
75.48 +import org.netbeans.jellytools.Bundle;
75.49 +import java.awt.event.KeyEvent;
75.50 +
75.51 +/** StepOverAction class
75.52 + */
75.53 +public class StepOverAction extends ActionNoBlock {
75.54 +
75.55 + private static final String stepOverMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
75.56 + + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Step_over_action_name");
75.57 + private static final Shortcut stepOverShortcut = new Shortcut(KeyEvent.VK_F8);
75.58 +
75.59 +
75.60 + /** creates new StepOverAction instance */
75.61 + public StepOverAction() {
75.62 + super(stepOverMenu, null, "org.netbeans.modules.debugger.actions.StepOverAction", stepOverShortcut);
75.63 + }
75.64 +}
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
76.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/ToggleBreakpointAction.java Thu Jul 10 04:32:50 2008 -0700
76.3 @@ -0,0 +1,62 @@
76.4 +/*
76.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
76.6 + *
76.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
76.8 + *
76.9 + * The contents of this file are subject to the terms of either the GNU
76.10 + * General Public License Version 2 only ("GPL") or the Common
76.11 + * Development and Distribution License("CDDL") (collectively, the
76.12 + * "License"). You may not use this file except in compliance with the
76.13 + * License. You can obtain a copy of the License at
76.14 + * http://www.netbeans.org/cddl-gplv2.html
76.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
76.16 + * specific language governing permissions and limitations under the
76.17 + * License. When distributing the software, include this License Header
76.18 + * Notice in each file and include the License file at
76.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
76.20 + * particular file as subject to the "Classpath" exception as provided
76.21 + * by Sun in the GPL Version 2 section of the License file that
76.22 + * accompanied this code. If applicable, add the following below the
76.23 + * License Header, with the fields enclosed by brackets [] replaced by
76.24 + * your own identifying information:
76.25 + * "Portions Copyrighted [year] [name of copyright owner]"
76.26 + *
76.27 + * Contributor(s):
76.28 + *
76.29 + * The Original Software is NetBeans. The Initial Developer of the Original
76.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
76.31 + * Microsystems, Inc. All Rights Reserved.
76.32 + *
76.33 + * If you wish your version of this file to be governed by only the CDDL
76.34 + * or only the GPL Version 2, indicate your decision by adding
76.35 + * "[Contributor] elects to include this software in this distribution
76.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
76.37 + * single choice of license, a recipient has the option to distribute
76.38 + * your version of this file under either the CDDL, the GPL Version 2 or
76.39 + * to extend the choice of license to its licensees as provided above.
76.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
76.41 + * Version 2 license, then the option applies only if the new code is
76.42 + * made subject to such option by the copyright holder.
76.43 + */
76.44 +
76.45 +package org.netbeans.modules.visualweb.gravy.debugger.actions;
76.46 +
76.47 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
76.48 +import org.netbeans.jellytools.Bundle;
76.49 +import java.awt.event.KeyEvent;
76.50 +
76.51 +/** ToggleBreakpointAction class
76.52 + */
76.53 +public class ToggleBreakpointAction extends ActionNoBlock {
76.54 +
76.55 + private static final String toggleBreakpointMenu = "Run|" +
76.56 + Bundle.getStringTrimmed("org.netbeans.modules.debugger.ui.actions.Bundle", "CTL_Toggle_breakpoint");
76.57 + private static final Shortcut toggleBreakpointShortcut = new Shortcut(KeyEvent.VK_F8, KeyEvent.SHIFT_MASK);
76.58 +
76.59 + private static final String toggleBreakpointPopup = Bundle.getStringTrimmed("org.netbeans.editor.Bundle", "toggle-breakpoint");
76.60 +
76.61 + /** creates new ToggleBreakpointAction instance */
76.62 + public ToggleBreakpointAction() {
76.63 + super(null, toggleBreakpointPopup, "org.netbeans.modules.debugger.support.actions.ToggleBreakpointAction", toggleBreakpointShortcut);
76.64 + }
76.65 +}
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/designer/BHTableLayoutOperator.java Thu Jul 10 04:32:50 2008 -0700
77.3 @@ -0,0 +1,378 @@
77.4 +/*
77.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
77.6 +*
77.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
77.8 +*
77.9 +* The contents of this file are subject to the terms of either the GNU
77.10 +* General Public License Version 2 only ("GPL") or the Common
77.11 +* Development and Distribution License("CDDL") (collectively, the
77.12 +* "License"). You may not use this file except in compliance with the
77.13 +* License. You can obtain a copy of the License at
77.14 +* http://www.netbeans.org/cddl-gplv2.html
77.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
77.16 +* specific language governing permissions and limitations under the
77.17 +* License. When distributing the software, include this License Header
77.18 +* Notice in each file and include the License file at
77.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
77.20 +* particular file as subject to the "Classpath" exception as provided
77.21 +* by Sun in the GPL Version 2 section of the License file that
77.22 +* accompanied this code. If applicable, add the following below the
77.23 +* License Header, with the fields enclosed by brackets [] replaced by
77.24 +* your own identifying information:
77.25 +* "Portions Copyrighted [year] [name of copyright owner]"
77.26 +*
77.27 +* Contributor(s):
77.28 +*
77.29 +* The Original Software is NetBeans. The Initial Developer of the Original
77.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
77.31 +* Microsystems, Inc. All Rights Reserved.
77.32 +*
77.33 +* If you wish your version of this file to be governed by only the CDDL
77.34 +* or only the GPL Version 2, indicate your decision by adding
77.35 +* "[Contributor] elects to include this software in this distribution
77.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
77.37 +* single choice of license, a recipient has the option to distribute
77.38 +* your version of this file under either the CDDL, the GPL Version 2 or
77.39 +* to extend the choice of license to its licensees as provided above.
77.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
77.41 +* Version 2 license, then the option applies only if the new code is
77.42 +* made subject to such option by the copyright holder.
77.43 +*/
77.44 +
77.45 +package org.netbeans.modules.visualweb.gravy.designer;
77.46 +
77.47 +import org.netbeans.jellytools.Bundle;
77.48 +import org.netbeans.jellytools.NbDialogOperator;
77.49 +import org.netbeans.jemmy.JemmyException;
77.50 +import org.netbeans.jemmy.operators.*;
77.51 +import org.netbeans.modules.visualweb.gravy.Util;
77.52 +
77.53 +/**
77.54 + * This class implements test functionality for the dialog "Table Layout",
77.55 + * related to the component "Table" from the palette "Basic".
77.56 + */
77.57 +public class BHTableLayoutOperator extends GeneralTableLayoutOperator{
77.58 + /**
77.59 + * Creates an instance of this class.
77.60 + */
77.61 + public BHTableLayoutOperator(){
77.62 + super();
77.63 + }
77.64 +
77.65 + /**
77.66 + * Creates and returns an instance of this class via using
77.67 + * the appropriate item of a poup menu.
77.68 + * @param menu a popup menu, related to a table
77.69 + * @return a new created object BHTableLayoutOperator
77.70 + */
77.71 + public static BHTableLayoutOperator invoke(JPopupMenuOperator menu){
77.72 + Util.wait(300);
77.73 + menu.pushMenuNoBlock(getBundleString("tblLayoutEllipse"));
77.74 + return new BHTableLayoutOperator();
77.75 + }
77.76 +
77.77 + private JButtonOperator _btBrowseFirst;
77.78 + private JButtonOperator _btBrowsePrevious;
77.79 + private JButtonOperator _btBrowseNext;
77.80 + private JButtonOperator _btBrowseLast;
77.81 + private JTextFieldOperator _txtPageSize;
77.82 + private JTextFieldOperator _txtFirst;
77.83 + private JTextFieldOperator _txtPrevious;
77.84 + private JTextFieldOperator _txtNext;
77.85 + private JTextFieldOperator _txtLast;
77.86 + private JComboBoxOperator _cboPosition;
77.87 + private JComboBoxOperator _cboAlignment;
77.88 + private JComboBoxOperator _cboNavigation;
77.89 + private JCheckBoxOperator _cbEnable;
77.90 + private JCheckBoxOperator _cbFirst;
77.91 + private JCheckBoxOperator _cbPrevious;
77.92 + private JCheckBoxOperator _cbNext;
77.93 + private JCheckBoxOperator _cbLast;
77.94 +
77.95 + /**
77.96 + * Initializes (if necessary) and returns an object JButtonOperator
77.97 + * for the dialog button "<<".
77.98 + * @return the appropriate object JButtonOperator
77.99 + */
77.100 + public JButtonOperator btBrowseFirst() {
77.101 + if (_btBrowseFirst==null) {
77.102 + _btBrowseFirst = new JButtonOperator(this, getBundleString("browseEllipse"),0);
77.103 + }
77.104 + return _btBrowseFirst;
77.105 + }
77.106 +
77.107 + /**
77.108 + * Initializes (if necessary) and returns an object JButtonOperator
77.109 + * for the dialog button "<".
77.110 + * @return the appropriate object JButtonOperator
77.111 + */
77.112 + public JButtonOperator btBrowsePrevious() {
77.113 + if (_btBrowsePrevious==null) {
77.114 + _btBrowsePrevious = new JButtonOperator(this, getBundleString("browseEllipse"),1);
77.115 + }
77.116 + return _btBrowsePrevious;
77.117 + }
77.118 +
77.119 + /**
77.120 + * Initializes (if necessary) and returns an object JButtonOperator
77.121 + * for the dialog button ">".
77.122 + * @return the appropriate object JButtonOperator
77.123 + */
77.124 + public JButtonOperator btBrowseNext() {
77.125 + if (_btBrowseNext==null) {
77.126 + _btBrowseNext = new JButtonOperator(this, getBundleString("browseEllipse"),2);
77.127 + }
77.128 + return _btBrowseNext;
77.129 + }
77.130 +
77.131 + /**
77.132 + * Initializes (if necessary) and returns an object JButtonOperator
77.133 + * for the dialog button ">>".
77.134 + * @return the appropriate object JButtonOperator
77.135 + */
77.136 + public JButtonOperator btBrowseLast() {
77.137 + if (_btBrowseLast==null) {
77.138 + _btBrowseLast = new JButtonOperator(this, getBundleString("browseEllipse"),3);
77.139 + }
77.140 + return _btBrowseLast;
77.141 + }
77.142 +
77.143 + /**
77.144 + * Initializes (if necessary) and returns an object JTextFieldOperator
77.145 + * for the dialog text field "Page Size".
77.146 + * @return the appropriate object JTextFieldOperator
77.147 + */
77.148 + public JTextFieldOperator txtPageSize() {
77.149 + if (_txtPageSize==null) {
77.150 + _txtPageSize = new JTextFieldOperator(this, 0);
77.151 + }
77.152 + return _txtPageSize;
77.153 + }
77.154 +
77.155 + /**
77.156 + * Initializes (if necessary) and returns an object JTextFieldOperator
77.157 + * for the dialog text field "First".
77.158 + * @return the appropriate object JTextFieldOperator
77.159 + */
77.160 + public JTextFieldOperator txtFirst() {
77.161 + if (_txtFirst==null) {
77.162 + _txtFirst = new JTextFieldOperator(this, 1);
77.163 + }
77.164 + return _txtFirst;
77.165 + }
77.166 +
77.167 + /**
77.168 + * Initializes (if necessary) and returns an object JTextFieldOperator
77.169 + * for the dialog text field "Previous".
77.170 + * @return the appropriate object JTextFieldOperator
77.171 + */
77.172 + public JTextFieldOperator txtPrevious() {
77.173 + if (_txtPrevious==null) {
77.174 + _txtPrevious = new JTextFieldOperator(this, 2);
77.175 + }
77.176 + return _txtPrevious;
77.177 + }
77.178 +
77.179 + /**
77.180 + * Initializes (if necessary) and returns an object JTextFieldOperator
77.181 + * for the dialog text field "Next".
77.182 + * @return the appropriate object JTextFieldOperator
77.183 + */
77.184 + public JTextFieldOperator txtNext() {
77.185 + if (_txtNext==null) {
77.186 + _txtNext = new JTextFieldOperator(this, 3);
77.187 + }
77.188 + return _txtNext;
77.189 + }
77.190 +
77.191 + /**
77.192 + * Initializes (if necessary) and returns an object JTextFieldOperator
77.193 + * for the dialog text field "Last".
77.194 + * @return the appropriate object JTextFieldOperator
77.195 + */
77.196 + public JTextFieldOperator txtLast() {
77.197 + if (_txtLast==null) {
77.198 + _txtLast = new JTextFieldOperator(this, 4);
77.199 + }
77.200 + return _txtLast;
77.201 + }
77.202 +
77.203 + /**
77.204 + * Initializes (if necessary) and returns an object JCheckBoxOperator
77.205 + * for the dialog check-box "Enable".
77.206 + * @return the appropriate object JCheckBoxOperator
77.207 + */
77.208 + public JCheckBoxOperator cbEnable() {
77.209 + if (_cbEnable==null) {
77.210 + _cbEnable = new JCheckBoxOperator(this, getBundleString("enablePaging"));
77.211 + }
77.212 + return _cbEnable;
77.213 + }
77.214 +
77.215 + /**
77.216 + * Initializes (if necessary) and returns an object JCheckBoxOperator
77.217 + * for the dialog check-box "First".
77.218 + * @return the appropriate object JCheckBoxOperator
77.219 + */
77.220 + public JCheckBoxOperator cbFirst() {
77.221 + if (_cbFirst==null) {
77.222 + _cbFirst = new JCheckBoxOperator(this, getBundleString("firstPage"));
77.223 + }
77.224 + return _cbFirst;
77.225 + }
77.226 +
77.227 + /**
77.228 + * Initializes (if necessary) and returns an object JCheckBoxOperator
77.229 + * for the dialog check-box "Previous".
77.230 + * @return the appropriate object JCheckBoxOperator
77.231 + */
77.232 + public JCheckBoxOperator cbPrevious() {
77.233 + if (_cbPrevious==null) {
77.234 + _cbPrevious = new JCheckBoxOperator(this, getBundleString("prevPage"));
77.235 + }
77.236 + return _cbPrevious;
77.237 + }
77.238 +
77.239 + /**
77.240 + * Initializes (if necessary) and returns an object JCheckBoxOperator
77.241 + * for the dialog check-box "Next".
77.242 + * @return the appropriate object JCheckBoxOperator
77.243 + */
77.244 + public JCheckBoxOperator cbNext() {
77.245 + if (_cbNext==null) {
77.246 + _cbNext = new JCheckBoxOperator(this, getBundleString("nextPage"));
77.247 + }
77.248 + return _cbNext;
77.249 + }
77.250 +
77.251 + /**
77.252 + * Initializes (if necessary) and returns an object JCheckBoxOperator
77.253 + * for the dialog check-box "Last".
77.254 + * @return the appropriate object JCheckBoxOperator
77.255 + */
77.256 + public JCheckBoxOperator cbLast() {
77.257 + if (_cbLast==null) {
77.258 + _cbLast = new JCheckBoxOperator(this, getBundleString("lastPage"));
77.259 + }
77.260 + return _cbLast;
77.261 + }
77.262 +
77.263 + /**
77.264 + * Initializes (if necessary) and returns an object JComboBoxOperator
77.265 + * for the dialog drop-down list "Navigation".
77.266 + * @return the appropriate object JComboBoxOperator
77.267 + */
77.268 + public JComboBoxOperator cboNavigation() {
77.269 + if (_cboNavigation==null) {
77.270 + _cboNavigation = new JComboBoxOperator(this,0);
77.271 + }
77.272 + return _cboNavigation;
77.273 + }
77.274 +
77.275 + /**
77.276 + * Initializes (if necessary) and returns an object JComboBoxOperator
77.277 + * for the dialog drop-down list "Source".
77.278 + * @return the appropriate object JComboBoxOperator
77.279 + */
77.280 + public JComboBoxOperator cboSource() {
77.281 + if (_cboSource==null) {
77.282 + _cboSource = new JComboBoxOperator(this,0);
77.283 + }
77.284 + return _cboSource;
77.285 + }
77.286 +
77.287 + /**
77.288 + * Initializes (if necessary) and returns an object JComboBoxOperator
77.289 + * for the dialog drop-down list "Component Type".
77.290 + * @return the appropriate object JComboBoxOperator
77.291 + */
77.292 + public JComboBoxOperator cboComponentType() {
77.293 + if (_cboComponentType==null) {
77.294 + _cboComponentType = new JComboBoxOperator(this,2);
77.295 + }
77.296 + return _cboComponentType;
77.297 + }
77.298 +
77.299 + /**
77.300 + * Initializes (if necessary) and returns an object JComboBoxOperator
77.301 + * for the dialog drop-down list "Position".
77.302 + * @return the appropriate object JComboBoxOperator
77.303 + */
77.304 + public JComboBoxOperator cboPosition() {
77.305 + if (_cboPosition==null) {
77.306 + _cboPosition = new JComboBoxOperator(this,1);
77.307 + }
77.308 + return _cboPosition;
77.309 + }
77.310 +
77.311 + /**
77.312 + * Initializes (if necessary) and returns an object JComboBoxOperator
77.313 + * for the dialog drop-down list "Alignment".
77.314 + * @return the appropriate object JComboBoxOperator
77.315 + */
77.316 + public JComboBoxOperator cboAlignment() {
77.317 + if (_cboAlignment==null) {
77.318 + _cboAlignment = new JComboBoxOperator(this,3);
77.319 + }
77.320 + return _cboAlignment;
77.321 + }
77.322 +
77.323 + /**
77.324 + * Select the tab "Columns" in the tabbed pane.
77.325 + */
77.326 + public void selectColumnsTab(){
77.327 + tbpLayout().selectPage(getBundleString("cols"));
77.328 + }
77.329 +
77.330 + /**
77.331 + * Select the tab "Options" in the tabbed pane.
77.332 + */
77.333 + public void selectOptionsTab(){
77.334 + tbpLayout().selectPage(getBundleString("paging"));
77.335 + }
77.336 +
77.337 + /**
77.338 + * Initializes all necessary controls.
77.339 + */
77.340 + public void verify() {
77.341 +
77.342 + super.verify();
77.343 +
77.344 + selectOptionsTab();
77.345 +
77.346 + btBrowseFirst();
77.347 + btBrowsePrevious();
77.348 + btBrowseNext();
77.349 + btBrowseLast();
77.350 + cboNavigation();
77.351 + cboPosition();
77.352 + cboAlignment();
77.353 + cbEnable();
77.354 + cbFirst();
77.355 + cbPrevious();
77.356 + cbNext();
77.357 + cbLast();
77.358 + txtPageSize();
77.359 + txtFirst();
77.360 + txtPrevious();
77.361 + txtNext();
77.362 + txtLast();
77.363 +
77.364 + selectColumnsTab();
77.365 + }
77.366 +
77.367 + /**
77.368 + * Finds in a bundle file and returns an actual text of control component.
77.369 + * @param p_text string-key corresponding to required control component.
77.370 + * @return actual text of control component
77.371 + */
77.372 + public static String getBundleString(String p_text) {
77.373 + System.out.println("Getting bundle for " + p_text);
77.374 + try {
77.375 + return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.faces.dt.std.table.Bundle", p_text);
77.376 + } catch (JemmyException e) {
77.377 + System.out.println(e.getMessage());
77.378 + }
77.379 + return null;
77.380 + }
77.381 +}
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
78.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/designer/DesignerPaneOperator.java Thu Jul 10 04:32:50 2008 -0700
78.3 @@ -0,0 +1,452 @@
78.4 +/*
78.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
78.6 +*
78.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
78.8 +*
78.9 +* The contents of this file are subject to the terms of either the GNU
78.10 +* General Public License Version 2 only ("GPL") or the Common
78.11 +* Development and Distribution License("CDDL") (collectively, the
78.12 +* "License"). You may not use this file except in compliance with the
78.13 +* License. You can obtain a copy of the License at
78.14 +* http://www.netbeans.org/cddl-gplv2.html
78.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
78.16 +* specific language governing permissions and limitations under the
78.17 +* License. When distributing the software, include this License Header
78.18 +* Notice in each file and include the License file at
78.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
78.20 +* particular file as subject to the "Classpath" exception as provided
78.21 +* by Sun in the GPL Version 2 section of the License file that
78.22 +* accompanied this code. If applicable, add the following below the
78.23 +* License Header, with the fields enclosed by brackets [] replaced by
78.24 +* your own identifying information:
78.25 +* "Portions Copyrighted [year] [name of copyright owner]"
78.26 +*
78.27 +* Contributor(s):
78.28 +*
78.29 +* The Original Software is NetBeans. The Initial Developer of the Original
78.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
78.31 +* Microsystems, Inc. All Rights Reserved.
78.32 +*
78.33 +* If you wish your version of this file to be governed by only the CDDL
78.34 +* or only the GPL Version 2, indicate your decision by adding
78.35 +* "[Contributor] elects to include this software in this distribution
78.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
78.37 +* single choice of license, a recipient has the option to distribute
78.38 +* your version of this file under either the CDDL, the GPL Version 2 or
78.39 +* to extend the choice of license to its licensees as provided above.
78.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
78.41 +* Version 2 license, then the option applies only if the new code is
78.42 +* made subject to such option by the copyright holder.
78.43 +*/
78.44 +
78.45 +package org.netbeans.modules.visualweb.gravy.designer;
78.46 +
78.47 +import org.netbeans.modules.visualweb.css2.ModelViewMapper;
78.48 +import org.netbeans.modules.visualweb.designer.WebForm;
78.49 +import org.netbeans.modules.visualweb.gravy.Util;
78.50 +import org.netbeans.modules.visualweb.css2.CssBox;
78.51 +import org.netbeans.modules.visualweb.designer.*;
78.52 +import org.netbeans.modules.visualweb.designer.jsf.*;
78.53 +import org.netbeans.modules.visualweb.designer.jsf.ui.*;
78.54 +import org.netbeans.modules.visualweb.gravy.properties.*;
78.55 +import java.awt.*;
78.56 +import org.netbeans.jemmy.ComponentChooser;
78.57 +import org.netbeans.jemmy.operators.*;
78.58 +import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
78.59 +import org.netbeans.jellytools.Bundle;
78.60 +import org.netbeans.modules.visualweb.designer.html.HtmlAttribute;
78.61 +import com.sun.rave.designtime.DesignBean;
78.62 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
78.63 +import org.openide.windows.TopComponent;
78.64 +import org.netbeans.jemmy.QueueTool;
78.65 +import org.netbeans.modules.visualweb.api.designer.DomProvider;
78.66 +
78.67 +/**
78.68 + * This class implements test functionality for the Design View of a project web-page.
78.69 + */
78.70 +public class DesignerPaneOperator extends JComponentOperator {
78.71 + private static final String
78.72 + DESIGNER_BUTTON_DESIGN = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.project.jsfloader.Bundle", "CTL_DesignerTabCaption"),//"Design"
78.73 + DESIGNER_BUTTON_JSP = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.project.jsfloader.Bundle","CTL_JspTabCaption"),//"JSP",
78.74 + DESIGNER_BUTTON_JAVA = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.project.jsfloader.Bundle","CTL_JavaTabCaption");//"Java";
78.75 +
78.76 + protected static String defaultPalette="JSFSTD";
78.77 + protected String currentPalette=defaultPalette;
78.78 +
78.79 + /**
78.80 + * Creates a new instance of this class
78.81 + * @param cont an object ContainerOperator related to container, which
78.82 + * includes window of web-page.
78.83 + */
78.84 + public DesignerPaneOperator(ContainerOperator cont) {
78.85 + super(cont, new DesignerPaneChooser());
78.86 + }
78.87 +
78.88 + /**
78.89 + * Creates a new instance of this class
78.90 + * @param cont an object ContainerOperator related to container, which
78.91 + * includes window of web-page.
78.92 + * @param index a number of desired component if container includes several
78.93 + * similar components
78.94 + */
78.95 + public DesignerPaneOperator(ContainerOperator cont, int index) {
78.96 + super(cont, new DesignerPaneChooser(), index);
78.97 + }
78.98 +
78.99 + /**
78.100 + * Creates a new instance of this class
78.101 + */
78.102 + public DesignerPaneOperator() {
78.103 + this(RaveWindowOperator.getDefaultRave());
78.104 + }
78.105 +
78.106 + /**
78.107 + * Returns a Design View of a project web-page.
78.108 + * @return an object ContainerOperator
78.109 + */
78.110 + public ContainerOperator getDesignerView() {
78.111 + return(new ContainerOperator(getContainer(new Operator.Finder(JsfTopComponent.class))));
78.112 + }
78.113 +
78.114 + /**
78.115 + * Returns a center coordinate of component, placed on Design View.
78.116 + * @param comp_id a component identifier
78.117 + * @return an object Point
78.118 + */
78.119 + public Point getComponentCenter(String comp_id) {
78.120 + CssBox box = getCssBox(getDesignBean(comp_id));
78.121 + if (box != null) {
78.122 + return (new Point(box.getAbsoluteX(), box.getAbsoluteY()));
78.123 + }
78.124 + return null;
78.125 + }
78.126 +
78.127 + /**
78.128 + * Returns a coordinate of component top-left corner, placed on Design View.
78.129 + * @param componentID a component identifier
78.130 + * @return an object Point
78.131 + */
78.132 + public Point getComponentLocation(String componentID) {
78.133 + Rectangle compRect = getComponentRectangle(componentID);
78.134 + if (compRect != null) {
78.135 + return (compRect.getLocation());
78.136 + }
78.137 + return null;
78.138 + }
78.139 +
78.140 + /**
78.141 + * Returns measurements of a component, placed on Design View.
78.142 + * @param componentID a component identifier
78.143 + * @return an object Rectangle
78.144 + */
78.145 + public Rectangle getComponentRectangle(String componentID) {
78.146 + CssBox box = getCssBox(getDesignBean(componentID));
78.147 + if (box != null) {
78.148 + return (box.getExtentsRectangle());
78.149 + }
78.150 + return null;
78.151 + }
78.152 +
78.153 + private DesignBean getDesignBean(String componentID) {
78.154 + if ((componentID == null) || (componentID.length() < 1)) return null;
78.155 +
78.156 + DesignerPane designerPane = (DesignerPane) getSource();
78.157 +// DesignBean bean =
78.158 +// designerPane.getWebForm().getModel().getLiveUnit().getBeanByName(
78.159 +// componentID);
78.160 +// org.openide.filesystems.FileObject jspFileObject = designerPane.getWebForm().getJspDataObject().getPrimaryFile();
78.161 + WebForm webForm = designerPane.getWebForm();
78.162 + DomProvider domProvider = webForm.getDomProvider();
78.163 + JsfForm jsfForm = JsfForm.findJsfFormForDomProvider(domProvider);
78.164 + org.openide.filesystems.FileObject jspFileObject = jsfForm.getJspDataObject().getPrimaryFile();
78.165 + org.netbeans.modules.visualweb.insync.models.FacesModel facesModel = org.netbeans.modules.visualweb.insync.models.FacesModel.getInstance(jspFileObject);
78.166 + DesignBean bean = facesModel.getLiveUnit().getBeanByName(componentID);
78.167 + return bean;
78.168 + }
78.169 +
78.170 + private CssBox getCssBox(DesignBean designBean) {
78.171 + if (designBean == null) return null;
78.172 + DesignerPane designerPane = (DesignerPane) getSource();
78.173 + /*
78.174 + CssBox cssBox = ModelViewMapper.findBox(designerPane.getPageBox(), designBean);
78.175 + //designerPane.getWebForm().getMapper().findBox(designBean);
78.176 + */
78.177 + WebForm webForm = designerPane.getWebForm();
78.178 + CssBox cssBox = ModelViewMapper.findBox(webForm.getPane().getPageBox(),
78.179 + webForm.getSelection().getSelectedComponentRootElements()[0]);
78.180 + return cssBox;
78.181 + }
78.182 +
78.183 + /**
78.184 + * Invokes a popup menu, related to a component, placed on Design View.
78.185 + * @param comp_id a component identifier
78.186 + */
78.187 + public void clickForPopup(String comp_id){
78.188 + Point p=getComponentCenter(comp_id);
78.189 + clickForPopup(p.x,p.y);
78.190 + }
78.191 +
78.192 + /**
78.193 + * Clicks mouse on a component, placed on Design View.
78.194 + * @param comp_id a component identifier
78.195 + * @param clickCount a number of clicks
78.196 + */
78.197 + public void clickMouse(String comp_id, int clickCount){
78.198 + Point p=getComponentCenter(comp_id);
78.199 + clickMouse(p.x,p.y,clickCount);
78.200 + }
78.201 +
78.202 + /**
78.203 + * Selects a component on Design View.
78.204 + * @param comp_id a component identifier
78.205 + */
78.206 + public void select(String comp_id){
78.207 + Point p=getComponentCenter(comp_id);
78.208 + clickMouse(p.x,p.y,1);
78.209 + }
78.210 +
78.211 + public static class DesignerPaneChooser implements ComponentChooser {
78.212 + public boolean checkComponent(Component comp) {
78.213 + return(comp instanceof org.netbeans.modules.visualweb.designer.DesignerPane);
78.214 + }
78.215 + public String getDescription() {
78.216 + return(DesignerPane.class.getName());
78.217 + }
78.218 + }
78.219 +
78.220 + /**
78.221 + * Adds a component on Design View.
78.222 + * @param component a component name
78.223 + * @param x coordinate x of top-left component corner on Design View
78.224 + * @param y coordinate y of top-left component corner on Design View
78.225 + */
78.226 + public void addComponent(String component, int x, int y) {
78.227 + addComponent(component,x,y,null,null);
78.228 + }
78.229 +
78.230 + /**
78.231 + * Adds a component on Design View.
78.232 + * @param component a component name
78.233 + * @param x coordinate x of top-left component corner on Design View
78.234 + * @param y coordinate y of top-left component corner on Design View
78.235 + * @param id a name of modified component property
78.236 + * @param value a value of modified component property
78.237 + */
78.238 + public void addComponent(String component, int x, int y, String id, String value) {
78.239 + addComponentFromPalette(component,x,y,id,value,currentPalette);
78.240 + }
78.241 +
78.242 + /**
78.243 + * Sets a component palette used by default.
78.244 + * @param palName a palette name
78.245 + */
78.246 + public static void setDefaultPalette(String palName){
78.247 + defaultPalette=palName;
78.248 + }
78.249 +
78.250 + /**
78.251 + * Sets a component palette "BraveHeart" as a default palette.
78.252 + */
78.253 + public static void setDefaultBraveHeartPalette(){
78.254 + defaultPalette="Basic";
78.255 + }
78.256 +
78.257 + /**
78.258 + * Sets a component palette "Standard" as a default palette.
78.259 + */
78.260 + public static void setDefaultStandardPalette(){
78.261 + defaultPalette="JSFSTD";
78.262 + }
78.263 +
78.264 + /**
78.265 + * Sets a current component palette.
78.266 + * @param palName a palette name
78.267 + */
78.268 + public void setPalette(String palName){
78.269 + currentPalette=palName;
78.270 + }
78.271 +
78.272 + /**
78.273 + * Sets a component palette "BraveHeart" as a current palette.
78.274 + */
78.275 + public void setBraveHeartPalette(){
78.276 + setPalette("Basic");
78.277 + }
78.278 +
78.279 + /**
78.280 + * Sets a component palette "Standard" as a current palette.
78.281 + */
78.282 + public void setStandardPalette(){
78.283 + setPalette("JSFSTD");
78.284 + }
78.285 +
78.286 + /**
78.287 + * Adds a component on Design View.
78.288 + * @param component a component name
78.289 + * @param x coordinate x of top-left component corner on Design View
78.290 + * @param y coordinate y of top-left component corner on Design View
78.291 + * @param id a name of modified component property
78.292 + * @param value a value of modified component property
78.293 + * @param palName a palette name
78.294 + */
78.295 + public void addComponentFromPalette(String component, int x, int y, String id, String value, String palName) {
78.296 +
78.297 + // Wait for the Portfolio to appear
78.298 + Util.wait(2000);
78.299 + PaletteContainerOperator palette = PaletteContainerOperator.showPalette(Bundle.getStringTrimmed("com.sun.rave.toolbox.Bundle", "COMPONENTS"), palName);
78.300 +
78.301 + System.out.println("======================================================================");
78.302 + System.out.println(palName + " Components");
78.303 + System.out.println("======================================================================");
78.304 + // workaround for CR 6258411
78.305 + Point clickPoint = palette.getClickPoint(component);
78.306 + new QueueTool().waitEmpty();
78.307 + palette.getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
78.308 + Util.wait(300);
78.309 +
78.310 + palette.addComponent(component, this, new Point(x, y));
78.311 +
78.312 + //@todo This is temporary - remove after Rave bug will be fixed
78.313 + //select component
78.314 + //clickMouse(1,1,1);
78.315 + //clickMouse(x,y,1);
78.316 +
78.317 + Util.wait(1000);
78.318 +
78.319 + // Change properties
78.320 +
78.321 + SheetTableOperator props = new SheetTableOperator();
78.322 + if (id!=null){
78.323 + props.setTextValue("id",id);
78.324 + Util.wait(1000);
78.325 + }
78.326 + if (value!=null){
78.327 + props.setTextValue("value",value);
78.328 + Util.wait(1000);
78.329 + }
78.330 +
78.331 + }
78.332 +
78.333 + /**
78.334 + * Switch to JSP Editor of web-page.
78.335 + */
78.336 + public static void switchToJSPSource() {
78.337 + switchToSource(DESIGNER_BUTTON_JSP);
78.338 + }
78.339 +
78.340 + /**
78.341 + * Switch to Java Editor of web-page.
78.342 + */
78.343 + public static void switchToJavaSource() {
78.344 + switchToSource(DESIGNER_BUTTON_JAVA);
78.345 + }
78.346 +
78.347 + /**
78.348 + * Switch to Design View of web-page.
78.349 + */
78.350 + public static void switchToDesignerPane() {
78.351 + switchToSource(DESIGNER_BUTTON_DESIGN);
78.352 + }
78.353 +
78.354 + private static void switchToSource(String toggleButtonText) {
78.355 + //org.netbeans.jellytools.TopComponentOperator topComponent =
78.356 + //new org.netbeans.jellytools.TopComponentOperator("Page1.jsp");
78.357 + // new org.netbeans.jellytools.TopComponentOperator(Util.getMainWindow());
78.358 + //Util.wait(1000);
78.359 + JToggleButtonOperator toggleButton = new JToggleButtonOperator(Util.getMainWindow(),
78.360 + toggleButtonText);
78.361 + Util.wait(1000);
78.362 + toggleButton.setSelected(true);
78.363 + Util.wait(1000);
78.364 + }
78.365 +
78.366 + /**
78.367 + * Extracts and returns a coordinate of a component from a window "Properties".
78.368 + * @return an object Point
78.369 + */
78.370 + public Point getCoords() {
78.371 +
78.372 + PropertySheetOperator pso = new PropertySheetOperator(Util.getMainWindow());
78.373 + PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
78.374 + // set a new comparator which should find the required property by performing
78.375 + // a strictly comparison of a property name with a given pattern
78.376 + psto.setComparator(new Operator.DefaultStringComparator(true, true));
78.377 +
78.378 + // Name of the property is style
78.379 + Property pr = new Property(psto, "style" /* Bundle.getResourceString("CSS_Style") */);
78.380 + String propValue = pr.getValue();
78.381 +
78.382 + //value of style property (example) = position: absolute; left: 288px; top: 96px
78.383 +
78.384 + int xLoc = HtmlAttribute.parseInt(propValue.substring(propValue.indexOf("left: ") + 6));
78.385 + int yLoc = HtmlAttribute.parseInt(propValue.substring(propValue.indexOf("top: ") + 5));
78.386 + // int xLoc = new Integer(propValue.substring(propValue.indexOf("left: ")+6,propValue.indexOf("px;"))).intValue();
78.387 + // int yLoc = new Integer(propValue.substring(propValue.indexOf("top: ")+5,propValue.indexOf("px; position:"))).intValue();
78.388 +
78.389 + return new Point(xLoc, yLoc);
78.390 + }
78.391 +
78.392 + public void makeComponentVisible() {
78.393 + TopComponent theComponent = (TopComponent)findContainerUnder(getSource(), new ComponentChooser() {
78.394 + public boolean checkComponent(Component comp) {
78.395 + return(comp instanceof TopComponent);
78.396 + }
78.397 + public String getDescription() {
78.398 + return("TopComponent");
78.399 + }
78.400 + });
78.401 +
78.402 + final TopComponent topComponent = theComponent;
78.403 + try {
78.404 + javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
78.405 + public void run() {
78.406 + String topComponentString =
78.407 + org.openide.windows.WindowManager.getDefault().findTopComponentID(topComponent);
78.408 + System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++");
78.409 + System.out.println(topComponentString);
78.410 + System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++");
78.411 + }
78.412 + });
78.413 + } catch (Exception e) {
78.414 + e.printStackTrace();
78.415 + }
78.416 + new org.netbeans.jellytools.TopComponentOperator(theComponent).makeComponentVisible();
78.417 + super.makeComponentVisible();
78.418 + }
78.419 +
78.420 + /**
78.421 + * Sets an image to a component via Image customizer.
78.422 + * @param componentID a component identifier
78.423 + * @param imagePath a path to an image file
78.424 + */
78.425 + public void setImage(String componentID, String imagePath) {
78.426 + clickForPopup(componentID); // this api not working 6/1/06
78.427 + Util.wait(500);
78.428 + new JPopupMenuOperator().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "DesignerMenuItem_SetImage"));
78.429 + JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "DesignerMenuItem_SetImage" ));
78.430 + JTextFieldOperator tf_Name = new JTextFieldOperator(dialog, 0);
78.431 + tf_Name.setText(imagePath);
78.432 + Util.wait(1000);
78.433 + new JButtonOperator(dialog, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "OK")).pushNoBlock();
78.434 + dialog.waitClosed();
78.435 + Util.wait(1000);
78.436 + }
78.437 +
78.438 + /**
78.439 + * Sets an image to a component via Image customizer.
78.440 + * @param x coordinate x of top-left component corner on Design View
78.441 + * @param y coordinate y of top-left component corner on Design View
78.442 + * @param imagePath a path to an image file
78.443 + */
78.444 + public void setImage(int x, int y, String imagePath) {
78.445 + clickForPopup(x, y);
78.446 + Util.wait(500);
78.447 + new JPopupMenuOperator().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "DesignerMenuItem_SetImage"));
78.448 + JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "Dialog_ImageCustomizer" ));
78.449 + (new JTextFieldOperator(dialog, 0)).enterText(imagePath);
78.450 + Util.wait(1000);
78.451 + new JButtonOperator(dialog, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "Button_OK")).pushNoBlock();
78.452 + dialog.waitClosed();
78.453 + Util.wait(1000);
78.454 + }
78.455 +}
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/designer/GeneralTableLayoutOperator.java Thu Jul 10 04:32:50 2008 -0700
79.3 @@ -0,0 +1,326 @@
79.4 +/*
79.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
79.6 +*
79.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
79.8 +*
79.9 +* The contents of this file are subject to the terms of either the GNU
79.10 +* General Public License Version 2 only ("GPL") or the Common
79.11 +* Development and Distribution License("CDDL") (collectively, the
79.12 +* "License"). You may not use this file except in compliance with the
79.13 +* License. You can obtain a copy of the License at
79.14 +* http://www.netbeans.org/cddl-gplv2.html
79.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
79.16 +* specific language governing permissions and limitations under the
79.17 +* License. When distributing the software, include this License Header
79.18 +* Notice in each file and include the License file at
79.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
79.20 +* particular file as subject to the "Classpath" exception as provided
79.21 +* by Sun in the GPL Version 2 section of the License file that
79.22 +* accompanied this code. If applicable, add the following below the
79.23 +* License Header, with the fields enclosed by brackets [] replaced by
79.24 +* your own identifying information:
79.25 +* "Portions Copyrighted [year] [name of copyright owner]"
79.26 +*
79.27 +* Contributor(s):
79.28 +*
79.29 +* The Original Software is NetBeans. The Initial Developer of the Original
79.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
79.31 +* Microsystems, Inc. All Rights Reserved.
79.32 +*
79.33 +* If you wish your version of this file to be governed by only the CDDL
79.34 +* or only the GPL Version 2, indicate your decision by adding
79.35 +* "[Contributor] elects to include this software in this distribution
79.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
79.37 +* single choice of license, a recipient has the option to distribute
79.38 +* your version of this file under either the CDDL, the GPL Version 2 or
79.39 +* to extend the choice of license to its licensees as provided above.
79.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
79.41 +* Version 2 license, then the option applies only if the new code is
79.42 +* made subject to such option by the copyright holder.
79.43 +*/
79.44 +
79.45 +package org.netbeans.modules.visualweb.gravy.designer;
79.46 +
79.47 +import org.netbeans.jellytools.Bundle;
79.48 +import org.netbeans.jellytools.NbDialogOperator;
79.49 +import org.netbeans.jemmy.JemmyException;
79.50 +import org.netbeans.jemmy.operators.*;
79.51 +
79.52 +/**
79.53 + * This abstract class implements test functionality for the dialog "Table Layout".
79.54 + */
79.55 +public abstract class GeneralTableLayoutOperator extends NbDialogOperator{
79.56 + /**
79.57 + * Constructor of this class.
79.58 + */
79.59 + public GeneralTableLayoutOperator(){
79.60 + super(getBundleString("tblLayout"));
79.61 + }
79.62 +
79.63 + private JTabbedPaneOperator _tbpLayout;
79.64 +
79.65 + private JButtonOperator _btApply;
79.66 + private JButtonOperator _btNew;
79.67 + private JButtonOperator _btUp;
79.68 + private JButtonOperator _btDown;
79.69 + private JButtonOperator _btAdd;
79.70 + private JButtonOperator _btRemove;
79.71 + private JButtonOperator _btRemoveAll;
79.72 + private JListOperator _lstAvailable;
79.73 + private JListOperator _lstDisplayed;
79.74 + private JTextFieldOperator _txtHeader;
79.75 + private JTextFieldOperator _txtFooter;
79.76 + private JTextFieldOperator _txtValue;
79.77 + protected JComboBoxOperator _cboSource;
79.78 + protected JComboBoxOperator _cboComponentType;
79.79 +
79.80 + /**
79.81 + * Initializes (if necessary) and returns an object JTabbedPaneOperator
79.82 + * for the dialog tabbed pane.
79.83 + * @return the appropriate object JTabbedPaneOperator
79.84 + */
79.85 + public JTabbedPaneOperator tbpLayout() {
79.86 + if (_tbpLayout==null) {
79.87 + _tbpLayout = new JTabbedPaneOperator(this);
79.88 + }
79.89 + return _tbpLayout;
79.90 + }
79.91 +
79.92 + /**
79.93 + * Initializes (if necessary) and returns an object JButtonOperator
79.94 + * for the dialog button "Apply".
79.95 + * @return the appropriate object JButtonOperator
79.96 + */
79.97 + public JButtonOperator btApply() {
79.98 + if (_btApply==null) {
79.99 + _btApply = new JButtonOperator(this, Bundle.getStringTrimmed("com.sun.jsfcl.binding.Bundle", "apply"));
79.100 + }
79.101 + return _btApply;
79.102 + }
79.103 +
79.104 + /**
79.105 + * Initializes (if necessary) and returns an object JButtonOperator
79.106 + * for the dialog button "New".
79.107 + * @return the appropriate object JButtonOperator
79.108 + */
79.109 + public JButtonOperator btNew() {
79.110 + if (_btNew==null) {
79.111 + _btNew = new JButtonOperator(this, getBundleString("new"));
79.112 + }
79.113 + return _btNew;
79.114 + }
79.115 +
79.116 + /**
79.117 + * Initializes (if necessary) and returns an object JButtonOperator
79.118 + * for the dialog button "Up".
79.119 + * @return the appropriate object JButtonOperator
79.120 + */
79.121 + public JButtonOperator btUp() {
79.122 + if (_btUp==null) {
79.123 + _btUp = new JButtonOperator(this, getBundleString("up"));
79.124 + }
79.125 + return _btUp;
79.126 + }
79.127 +
79.128 + /**
79.129 + * Initializes (if necessary) and returns an object JButtonOperator
79.130 + * for the dialog button "Down".
79.131 + * @return the appropriate object JButtonOperator
79.132 + */
79.133 + public JButtonOperator btDown() {
79.134 + if (_btDown==null) {
79.135 + _btDown = new JButtonOperator(this, getBundleString("down"));
79.136 + }
79.137 + return _btDown;
79.138 + }
79.139 +
79.140 + /**
79.141 + * Initializes (if necessary) and returns an object JButtonOperator
79.142 + * for the dialog button "Add".
79.143 + * @return the appropriate object JButtonOperator
79.144 + */
79.145 + public JButtonOperator btAdd() {
79.146 + if (_btAdd==null) {
79.147 + _btAdd = new JButtonOperator(this, ">");
79.148 + }
79.149 + return _btAdd;
79.150 + }
79.151 +
79.152 + /**
79.153 + * Initializes (if necessary) and returns an object JButtonOperator
79.154 + * for the dialog button "<".
79.155 + * @return the appropriate object JButtonOperator
79.156 + */
79.157 + public JButtonOperator btRemove() {
79.158 + if (_btRemove==null) {
79.159 + _btRemove = new JButtonOperator(this, "<");
79.160 + }
79.161 + return _btRemove;
79.162 + }
79.163 +
79.164 + /**
79.165 + * Initializes (if necessary) and returns an object JButtonOperator
79.166 + * for the dialog button "<<".
79.167 + * @return the appropriate object JButtonOperator
79.168 + */
79.169 + public JButtonOperator btRemoveAll() {
79.170 + if (_btRemoveAll==null) {
79.171 + _btRemoveAll = new JButtonOperator(this, "<<");
79.172 + }
79.173 + return _btRemoveAll;
79.174 + }
79.175 +
79.176 + /**
79.177 + * Initializes (if necessary) and returns an object JListOperator
79.178 + * for the dialog list "Available".
79.179 + * @return the appropriate object JListOperator
79.180 + */
79.181 + public JListOperator lstAvailable() {
79.182 + if (_lstAvailable==null) {
79.183 + _lstAvailable = new JListOperator(this,0);
79.184 + }
79.185 + return _lstAvailable;
79.186 + }
79.187 +
79.188 + /**
79.189 + * Initializes (if necessary) and returns an object JListOperator
79.190 + * for the dialog list "Displayed".
79.191 + * @return the appropriate object JListOperator
79.192 + */
79.193 + public JListOperator lstDisplayed() {
79.194 + if (_lstDisplayed==null) {
79.195 + _lstDisplayed = new JListOperator(this,1);
79.196 + }
79.197 + return _lstDisplayed;
79.198 + }
79.199 +
79.200 + /**
79.201 + * Initializes (if necessary) and returns an object JTextFieldOperator
79.202 + * for the dialog text field "Header".
79.203 + * @return the appropriate object JTextFieldOperator
79.204 + */
79.205 + public JTextFieldOperator txtHeader() {
79.206 + if (_txtHeader==null) {
79.207 + _txtHeader = new JTextFieldOperator(this, 0);
79.208 + }
79.209 + return _txtHeader;
79.210 + }
79.211 +
79.212 + /**
79.213 + * Initializes (if necessary) and returns an object JTextFieldOperator
79.214 + * for the dialog text field "Footer".
79.215 + * @return the appropriate object JTextFieldOperator
79.216 + */
79.217 + public JTextFieldOperator txtFooter() {
79.218 + if (_txtFooter==null) {
79.219 + _txtFooter = new JTextFieldOperator(this, 1);
79.220 + }
79.221 + return _txtFooter;
79.222 + }
79.223 +
79.224 + /**
79.225 + * Initializes (if necessary) and returns an object JTextFieldOperator
79.226 + * for the dialog text field "Value".
79.227 + * @return the appropriate object JTextFieldOperator
79.228 + */
79.229 + public JTextFieldOperator txtValue() {
79.230 + if (_txtValue==null) {
79.231 + _txtValue = new JTextFieldOperator(this, 2);
79.232 + }
79.233 + return _txtValue;
79.234 + }
79.235 +
79.236 + /**
79.237 + * Initializes (if necessary) and returns an object JComboBoxOperator
79.238 + * for the dialog drop-down list "Source".
79.239 + * @return the appropriate object JComboBoxOperator
79.240 + */
79.241 + public JComboBoxOperator cboSource() {
79.242 + if (_cboSource==null) {
79.243 + _cboSource = new JComboBoxOperator(this,0);
79.244 + }
79.245 + return _cboSource;
79.246 + }
79.247 +
79.248 + /**
79.249 + * Initializes (if necessary) and returns an object JComboBoxOperator
79.250 + * for the dialog drop-down list "Component Type".
79.251 + * @return the appropriate object JComboBoxOperator
79.252 + */
79.253 + public JComboBoxOperator cboComponentType() {
79.254 + if (_cboComponentType==null) {
79.255 + _cboComponentType = new JComboBoxOperator(this,1);
79.256 + }
79.257 + return _cboComponentType;
79.258 + }
79.259 +
79.260 + /**
79.261 + * Select the tab "Columns" in the tabbed pane.
79.262 + */
79.263 + public void selectColumnsTab(){
79.264 + tbpLayout().selectPage(getBundleString("cols"));
79.265 + }
79.266 +
79.267 + /**
79.268 + * Finds in a bundle file and returns an actual text of control component.
79.269 + * @param p_text string-key corresponding to required control component.
79.270 + * @return actual text of control component
79.271 + */
79.272 + public static String getBundleString(String p_text) {
79.273 + System.out.println("Getting bundle for " + p_text);
79.274 + try {
79.275 + return Bundle.getStringTrimmed("com.sun.jsfcl.std.table.Bundle", p_text);
79.276 + } catch (JemmyException e) {}
79.277 + return null;
79.278 + }
79.279 +
79.280 + /**
79.281 + * Initializes all necessary controls.
79.282 + */
79.283 + public void verify() {
79.284 + btOK();
79.285 + btApply();
79.286 + btCancel();
79.287 + btHelp();
79.288 +
79.289 + selectColumnsTab();
79.290 +
79.291 + btUp();
79.292 + btDown();
79.293 + btNew();
79.294 + btAdd();
79.295 + btRemove();
79.296 + btRemoveAll();
79.297 + lstAvailable();
79.298 + lstDisplayed();
79.299 + txtFooter();
79.300 + txtValue();
79.301 + cboSource();
79.302 + cboComponentType();
79.303 + }
79.304 +
79.305 + /**
79.306 + * Adds new column to the table.
79.307 + * @param column a column name
79.308 + */
79.309 + public void addColumn(String column){
79.310 + lstAvailable().selectItem(column);
79.311 + btAdd().push();
79.312 + }
79.313 +
79.314 + /**
79.315 + * Removes a column from the table.
79.316 + * @param column a column name
79.317 + */
79.318 + public void removeColumn(String column){
79.319 + lstDisplayed().selectItem(column);
79.320 + btRemove().push();
79.321 + }
79.322 +
79.323 + /**
79.324 + * Removes all columns from the table.
79.325 + */
79.326 + public void removeAllColumns(){
79.327 + btRemoveAll().push();
79.328 + }
79.329 +}
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/designer/TableLayoutOperator.java Thu Jul 10 04:32:50 2008 -0700
80.3 @@ -0,0 +1,342 @@
80.4 +/*
80.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
80.6 +*
80.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
80.8 +*
80.9 +* The contents of this file are subject to the terms of either the GNU
80.10 +* General Public License Version 2 only ("GPL") or the Common
80.11 +* Development and Distribution License("CDDL") (collectively, the
80.12 +* "License"). You may not use this file except in compliance with the
80.13 +* License. You can obtain a copy of the License at
80.14 +* http://www.netbeans.org/cddl-gplv2.html
80.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
80.16 +* specific language governing permissions and limitations under the
80.17 +* License. When distributing the software, include this License Header
80.18 +* Notice in each file and include the License file at
80.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
80.20 +* particular file as subject to the "Classpath" exception as provided
80.21 +* by Sun in the GPL Version 2 section of the License file that
80.22 +* accompanied this code. If applicable, add the following below the
80.23 +* License Header, with the fields enclosed by brackets [] replaced by
80.24 +* your own identifying information:
80.25 +* "Portions Copyrighted [year] [name of copyright owner]"
80.26 +*
80.27 +* Contributor(s):
80.28 +*
80.29 +* The Original Software is NetBeans. The Initial Developer of the Original
80.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
80.31 +* Microsystems, Inc. All Rights Reserved.
80.32 +*
80.33 +* If you wish your version of this file to be governed by only the CDDL
80.34 +* or only the GPL Version 2, indicate your decision by adding
80.35 +* "[Contributor] elects to include this software in this distribution
80.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
80.37 +* single choice of license, a recipient has the option to distribute
80.38 +* your version of this file under either the CDDL, the GPL Version 2 or
80.39 +* to extend the choice of license to its licensees as provided above.
80.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
80.41 +* Version 2 license, then the option applies only if the new code is
80.42 +* made subject to such option by the copyright holder.
80.43 +*/
80.44 +
80.45 +package org.netbeans.modules.visualweb.gravy.designer;
80.46 +
80.47 +import org.netbeans.jellytools.Bundle;
80.48 +import org.netbeans.jellytools.NbDialogOperator;
80.49 +import org.netbeans.jemmy.JemmyException;
80.50 +import org.netbeans.jemmy.operators.*;
80.51 +
80.52 +/**
80.53 + * This class implements test functionality for the dialog "Table Layout".
80.54 + */
80.55 +public class TableLayoutOperator extends GeneralTableLayoutOperator{
80.56 + /**
80.57 + * Creates an instance of this class.
80.58 + */
80.59 + public TableLayoutOperator(){
80.60 + super();
80.61 + }
80.62 +
80.63 + /**
80.64 + * Creates and returns an instance of this class via using
80.65 + * the appropriate item of a poup menu.
80.66 + * @param menu a popup menu, related to a table
80.67 + * @return a new created object TableLayoutOperator
80.68 + */
80.69 + public static TableLayoutOperator invoke(JPopupMenuOperator menu){
80.70 + menu.pushMenuNoBlock("tblLayoutEllipse");
80.71 + return new TableLayoutOperator();
80.72 + }
80.73 +
80.74 + private JButtonOperator _btBrowseFirst;
80.75 + private JButtonOperator _btBrowsePrevious;
80.76 + private JButtonOperator _btBrowseNext;
80.77 + private JButtonOperator _btBrowseLast;
80.78 + private JTextFieldOperator _txtPageSize;
80.79 + private JTextFieldOperator _txtFirst;
80.80 + private JTextFieldOperator _txtPrevious;
80.81 + private JTextFieldOperator _txtNext;
80.82 + private JTextFieldOperator _txtLast;
80.83 + private JComboBoxOperator _cboPosition;
80.84 + private JComboBoxOperator _cboAlignment;
80.85 + private JComboBoxOperator _cboNavigation;
80.86 + private JCheckBoxOperator _cbEnable;
80.87 + private JCheckBoxOperator _cbFirst;
80.88 + private JCheckBoxOperator _cbPrevious;
80.89 + private JCheckBoxOperator _cbNext;
80.90 + private JCheckBoxOperator _cbLast;
80.91 +
80.92 + /**
80.93 + * Initializes (if necessary) and returns an object JButtonOperator
80.94 + * for the dialog button "<<".
80.95 + * @return the appropriate object JButtonOperator
80.96 + */
80.97 + public JButtonOperator btBrowseFirst() {
80.98 + if (_btBrowseFirst==null) {
80.99 + _btBrowseFirst = new JButtonOperator(this, getBundleString("browseEllipse"),0);
80.100 + }
80.101 + return _btBrowseFirst;
80.102 + }
80.103 +
80.104 + /**
80.105 + * Initializes (if necessary) and returns an object JButtonOperator
80.106 + * for the dialog button "<".
80.107 + * @return the appropriate object JButtonOperator
80.108 + */
80.109 + public JButtonOperator btBrowsePrevious() {
80.110 + if (_btBrowsePrevious==null) {
80.111 + _btBrowsePrevious = new JButtonOperator(this, getBundleString("browseEllipse"),1);
80.112 + }
80.113 + return _btBrowsePrevious;
80.114 + }
80.115 +
80.116 + /**
80.117 + * Initializes (if necessary) and returns an object JButtonOperator
80.118 + * for the dialog button ">".
80.119 + * @return the appropriate object JButtonOperator
80.120 + */
80.121 + public JButtonOperator btBrowseNext() {
80.122 + if (_btBrowseNext==null) {
80.123 + _btBrowseNext = new JButtonOperator(this, getBundleString("browseEllipse"),2);
80.124 + }
80.125 + return _btBrowseNext;
80.126 + }
80.127 +
80.128 + /**
80.129 + * Initializes (if necessary) and returns an object JButtonOperator
80.130 + * for the dialog button ">>".
80.131 + * @return the appropriate object JButtonOperator
80.132 + */
80.133 + public JButtonOperator btBrowseLast() {
80.134 + if (_btBrowseLast==null) {
80.135 + _btBrowseLast = new JButtonOperator(this, getBundleString("browseEllipse"),3);
80.136 + }
80.137 + return _btBrowseLast;
80.138 + }
80.139 +
80.140 + /**
80.141 + * Initializes (if necessary) and returns an object JTextFieldOperator
80.142 + * for the dialog text field "Page Size".
80.143 + * @return the appropriate object JTextFieldOperator
80.144 + */
80.145 + public JTextFieldOperator txtPageSize() {
80.146 + if (_txtPageSize==null) {
80.147 + _txtPageSize = new JTextFieldOperator(this, 0);
80.148 + }
80.149 + return _txtPageSize;
80.150 + }
80.151 +
80.152 + /**
80.153 + * Initializes (if necessary) and returns an object JTextFieldOperator
80.154 + * for the dialog text field "First".
80.155 + * @return the appropriate object JTextFieldOperator
80.156 + */
80.157 + public JTextFieldOperator txtFirst() {
80.158 + if (_txtFirst==null) {
80.159 + _txtFirst = new JTextFieldOperator(this, 1);
80.160 + }
80.161 + return _txtFirst;
80.162 + }
80.163 +
80.164 + /**
80.165 + * Initializes (if necessary) and returns an object JTextFieldOperator
80.166 + * for the dialog text field "Previous".
80.167 + * @return the appropriate object JTextFieldOperator
80.168 + */
80.169 + public JTextFieldOperator txtPrevious() {
80.170 + if (_txtPrevious==null) {
80.171 + _txtPrevious = new JTextFieldOperator(this, 2);
80.172 + }
80.173 + return _txtPrevious;
80.174 + }
80.175 +
80.176 + /**
80.177 + * Initializes (if necessary) and returns an object JTextFieldOperator
80.178 + * for the dialog text field "Next".
80.179 + * @return the appropriate object JTextFieldOperator
80.180 + */
80.181 + public JTextFieldOperator txtNext() {
80.182 + if (_txtNext==null) {
80.183 + _txtNext = new JTextFieldOperator(this, 3);
80.184 + }
80.185 + return _txtNext;
80.186 + }
80.187 +
80.188 + /**
80.189 + * Initializes (if necessary) and returns an object JTextFieldOperator
80.190 + * for the dialog text field "Last".
80.191 + * @return the appropriate object JTextFieldOperator
80.192 + */
80.193 + public JTextFieldOperator txtLast() {
80.194 + if (_txtLast==null) {
80.195 + _txtLast = new JTextFieldOperator(this, 4);
80.196 + }
80.197 + return _txtLast;
80.198 + }
80.199 +
80.200 + /**
80.201 + * Initializes (if necessary) and returns an object JCheckBoxOperator
80.202 + * for the dialog check-box "Enable".
80.203 + * @return the appropriate object JCheckBoxOperator
80.204 + */
80.205 + public JCheckBoxOperator cbEnable() {
80.206 + if (_cbEnable==null) {
80.207 + _cbEnable = new JCheckBoxOperator(this, getBundleString("enablePaging"));
80.208 + }
80.209 + return _cbEnable;
80.210 + }
80.211 +
80.212 + /**
80.213 + * Initializes (if necessary) and returns an object JCheckBoxOperator
80.214 + * for the dialog check-box "First".
80.215 + * @return the appropriate object JCheckBoxOperator
80.216 + */
80.217 + public JCheckBoxOperator cbFirst() {
80.218 + if (_cbFirst==null) {
80.219 + _cbFirst = new JCheckBoxOperator(this, getBundleString("firstPage"));
80.220 + }
80.221 + return _cbFirst;
80.222 + }
80.223 +
80.224 + /**
80.225 + * Initializes (if necessary) and returns an object JCheckBoxOperator
80.226 + * for the dialog check-box "Previous".
80.227 + * @return the appropriate object JCheckBoxOperator
80.228 + */
80.229 + public JCheckBoxOperator cbPrevious() {
80.230 + if (_cbPrevious==null) {
80.231 + _cbPrevious = new JCheckBoxOperator(this, getBundleString("prevPage"));
80.232 + }
80.233 + return _cbPrevious;
80.234 + }
80.235 +
80.236 + /**
80.237 + * Initializes (if necessary) and returns an object JCheckBoxOperator
80.238 + * for the dialog check-box "Next".
80.239 + * @return the appropriate object JCheckBoxOperator
80.240 + */
80.241 + public JCheckBoxOperator cbNext() {
80.242 + if (_cbNext==null) {
80.243 + _cbNext = new JCheckBoxOperator(this, getBundleString("nextPage"));
80.244 + }
80.245 + return _cbNext;
80.246 + }
80.247 +
80.248 + /**
80.249 + * Initializes (if necessary) and returns an object JCheckBoxOperator
80.250 + * for the dialog check-box "Last".
80.251 + * @return the appropriate object JCheckBoxOperator
80.252 + */
80.253 + public JCheckBoxOperator cbLast() {
80.254 + if (_cbLast==null) {
80.255 + _cbLast = new JCheckBoxOperator(this, getBundleString("lastPage"));
80.256 + }
80.257 + return _cbLast;
80.258 + }
80.259 +
80.260 + /**
80.261 + * Initializes (if necessary) and returns an object JComboBoxOperator
80.262 + * for the dialog drop-down list "Navigation".
80.263 + * @return the appropriate object JComboBoxOperator
80.264 + */
80.265 + public JComboBoxOperator cboNavigation() {
80.266 + if (_cboNavigation==null) {
80.267 + _cboNavigation = new JComboBoxOperator(this,0);
80.268 + }
80.269 + return _cboNavigation;
80.270 + }
80.271 +
80.272 + /**
80.273 + * Initializes (if necessary) and returns an object JComboBoxOperator
80.274 + * for the dialog drop-down list "Position".
80.275 + * @return the appropriate object JComboBoxOperator
80.276 + */
80.277 + public JComboBoxOperator cboPosition() {
80.278 + if (_cboPosition==null) {
80.279 + _cboPosition = new JComboBoxOperator(this,1);
80.280 + }
80.281 + return _cboPosition;
80.282 + }
80.283 +
80.284 + /**
80.285 + * Initializes (if necessary) and returns an object JComboBoxOperator
80.286 + * for the dialog drop-down list "Alignment".
80.287 + * @return the appropriate object JComboBoxOperator
80.288 + */
80.289 + public JComboBoxOperator cboAlignment() {
80.290 + if (_cboAlignment==null) {
80.291 + _cboAlignment = new JComboBoxOperator(this,2);
80.292 + }
80.293 + return _cboAlignment;
80.294 + }
80.295 +
80.296 + /**
80.297 + * Select the tab "Paging" in the tabbed pane.
80.298 + */
80.299 + public void selectPagingTab(){
80.300 + tbpLayout().selectPage(getBundleString("paging"));
80.301 + }
80.302 +
80.303 + /**
80.304 + * Initializes all necessary controls.
80.305 + */
80.306 + public void verify() {
80.307 +
80.308 + super.verify();
80.309 +
80.310 + selectPagingTab();
80.311 +
80.312 + btBrowseFirst();
80.313 + btBrowsePrevious();
80.314 + btBrowseNext();
80.315 + btBrowseLast();
80.316 + cboNavigation();
80.317 + cboPosition();
80.318 + cboAlignment();
80.319 + cbEnable();
80.320 + cbFirst();
80.321 + cbPrevious();
80.322 + cbNext();
80.323 + cbLast();
80.324 + txtPageSize();
80.325 + txtFirst();
80.326 + txtPrevious();
80.327 + txtNext();
80.328 + txtLast();
80.329 +
80.330 + selectColumnsTab();
80.331 + }
80.332 +
80.333 + /**
80.334 + * Finds in a bundle file and returns an actual text of control component.
80.335 + * @param p_text string-key corresponding to required control component.
80.336 + * @return actual text of control component
80.337 + */
80.338 + public static String getBundleString(String p_text) {
80.339 + System.out.println("Getting bundle for " + p_text);
80.340 + try {
80.341 + return Bundle.getStringTrimmed("com.sun.jsfcl.std.table.Bundle", p_text);
80.342 + } catch (JemmyException e) {}
80.343 + return null;
80.344 + }
80.345 +}
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/designer/TrayOperator.java Thu Jul 10 04:32:50 2008 -0700
81.3 @@ -0,0 +1,145 @@
81.4 +/*
81.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
81.6 +*
81.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
81.8 +*
81.9 +* The contents of this file are subject to the terms of either the GNU
81.10 +* General Public License Version 2 only ("GPL") or the Common
81.11 +* Development and Distribution License("CDDL") (collectively, the
81.12 +* "License"). You may not use this file except in compliance with the
81.13 +* License. You can obtain a copy of the License at
81.14 +* http://www.netbeans.org/cddl-gplv2.html
81.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
81.16 +* specific language governing permissions and limitations under the
81.17 +* License. When distributing the software, include this License Header
81.18 +* Notice in each file and include the License file at
81.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
81.20 +* particular file as subject to the "Classpath" exception as provided
81.21 +* by Sun in the GPL Version 2 section of the License file that
81.22 +* accompanied this code. If applicable, add the following below the
81.23 +* License Header, with the fields enclosed by brackets [] replaced by
81.24 +* your own identifying information:
81.25 +* "Portions Copyrighted [year] [name of copyright owner]"
81.26 +*
81.27 +* Contributor(s):
81.28 +*
81.29 +* The Original Software is NetBeans. The Initial Developer of the Original
81.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
81.31 +* Microsystems, Inc. All Rights Reserved.
81.32 +*
81.33 +* If you wish your version of this file to be governed by only the CDDL
81.34 +* or only the GPL Version 2, indicate your decision by adding
81.35 +* "[Contributor] elects to include this software in this distribution
81.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
81.37 +* single choice of license, a recipient has the option to distribute
81.38 +* your version of this file under either the CDDL, the GPL Version 2 or
81.39 +* to extend the choice of license to its licensees as provided above.
81.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
81.41 +* Version 2 license, then the option applies only if the new code is
81.42 +* made subject to such option by the copyright holder.
81.43 +*/
81.44 +
81.45 +package org.netbeans.modules.visualweb.gravy.designer;
81.46 +
81.47 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
81.48 +import org.netbeans.jemmy.operators.JLabelOperator;
81.49 +import org.netbeans.jemmy.operators.JButtonOperator;
81.50 +import org.netbeans.jemmy.operators.JTreeOperator;
81.51 +import org.netbeans.jemmy.TimeoutExpiredException;
81.52 +import java.awt.*;
81.53 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
81.54 +import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
81.55 +import org.netbeans.modules.visualweb.gravy.TestUtils;
81.56 +import org.netbeans.modules.visualweb.gravy.Util;
81.57 +import org.netbeans.modules.visualweb.gravy.nodes.Node;
81.58 +
81.59 +/**
81.60 + * This class implements test functionality for the window "Tray".
81.61 + */
81.62 +public class TrayOperator extends DocumentOutlineOperator{
81.63 + /**
81.64 + * Creates an instance of this class.
81.65 + */
81.66 + public TrayOperator(){
81.67 + super(RaveWindowOperator.getDefaultRave());
81.68 + }
81.69 +
81.70 + private JTreeOperator rowsetTreeOperator=null;
81.71 +
81.72 + /**
81.73 + * Initializes (if necessary) and returns an object JTreeOperator
81.74 + * for the rowset tree.
81.75 + * @return the appropriate object JTreeOperator
81.76 + */
81.77 + public JTreeOperator getRowsetTreeOperator() {
81.78 + if (rowsetTreeOperator == null) {
81.79 + rowsetTreeOperator = new JTreeOperator(this,1);
81.80 + }
81.81 + return rowsetTreeOperator;
81.82 + }
81.83 +
81.84 + private void clickSessionBean(){
81.85 + JTreeOperator tree = getStructTreeOperator();
81.86 + tree.expandPath(tree.findPath("SessionBean1"));
81.87 + }
81.88 +
81.89 + private void pushRowSetPopup_(String rowSetName, String menu) {
81.90 + getRowsetTreeOperator().callPopupOnPath(getRowsetTreeOperator().findPath(new String[]{rowSetName},false,false));
81.91 + new JPopupMenuOperator().pushMenuNoBlock(menu);
81.92 + }
81.93 +
81.94 + private void selectRowSet_(String rowSetName){
81.95 + getRowsetTreeOperator().selectPath(getRowsetTreeOperator().findPath(new String[]{rowSetName},false,false));
81.96 + }
81.97 +
81.98 + private void openRowSet_(String rowSetName){
81.99 + DocumentOutlineOperator doo = new DocumentOutlineOperator(Util.getMainWindow());
81.100 + doo.makeComponentVisible();
81.101 + Node node = new Node(doo.getStructTreeOperator(), "SessionBean1|"+rowSetName);
81.102 + node.callPopup().pushMenu("Edit SQL Statement");
81.103 + Util.wait(3000);
81.104 +
81.105 + //getRowsetTreeOperator().clickOnPath(getRowsetTreeOperator().findPath(new String[]{rowSetName},false,false),2);
81.106 + }
81.107 +
81.108 + /**
81.109 + * Clicks an item of a popup menu, related to a row set.
81.110 + * @param rowSetName a name of row set
81.111 + * @param menu a name of popup menu item
81.112 + */
81.113 + public void pushRowSetPopup(String rowSetName, String menu) {
81.114 + TestUtils.printComponentList(this);
81.115 + try{
81.116 + pushRowSetPopup_(rowSetName, menu);
81.117 + return;
81.118 + }catch (TimeoutExpiredException ex){}
81.119 + clickSessionBean();
81.120 + pushRowSetPopup_(rowSetName, menu);
81.121 + }
81.122 +
81.123 + /**
81.124 + * Selects a row set.
81.125 + * @param rowSetName a name of row set
81.126 + */
81.127 + public void selectRowSet(String rowSetName){
81.128 + try{
81.129 + selectRowSet_(rowSetName);
81.130 + return;
81.131 + }catch (TimeoutExpiredException ex){}
81.132 + clickSessionBean();
81.133 + selectRowSet_(rowSetName);
81.134 + }
81.135 +
81.136 + /**
81.137 + * Opens a row set.
81.138 + * @param rowSetName a name of row set
81.139 + */
81.140 + public void openRowSet(String rowSetName){
81.141 + try{
81.142 + openRowSet_(rowSetName);
81.143 + return;
81.144 + }catch (TimeoutExpiredException ex){}
81.145 + clickSessionBean();
81.146 + openRowSet_(rowSetName);
81.147 + }
81.148 +}
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/Descriptor.java Thu Jul 10 04:32:50 2008 -0700
82.3 @@ -0,0 +1,62 @@
82.4 +/*
82.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
82.6 + *
82.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
82.8 + *
82.9 + * The contents of this file are subject to the terms of either the GNU
82.10 + * General Public License Version 2 only ("GPL") or the Common
82.11 + * Development and Distribution License("CDDL") (collectively, the
82.12 + * "License"). You may not use this file except in compliance with the
82.13 + * License. You can obtain a copy of the License at
82.14 + * http://www.netbeans.org/cddl-gplv2.html
82.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
82.16 + * specific language governing permissions and limitations under the
82.17 + * License. When distributing the software, include this License Header
82.18 + * Notice in each file and include the License file at
82.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
82.20 + * particular file as subject to the "Classpath" exception as provided
82.21 + * by Sun in the GPL Version 2 section of the License file that
82.22 + * accompanied this code. If applicable, add the following below the
82.23 + * License Header, with the fields enclosed by brackets [] replaced by
82.24 + * your own identifying information:
82.25 + * "Portions Copyrighted [year] [name of copyright owner]"
82.26 + *
82.27 + * Contributor(s):
82.28 + *
82.29 + * The Original Software is NetBeans. The Initial Developer of the Original
82.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
82.31 + * Microsystems, Inc. All Rights Reserved.
82.32 + *
82.33 + * If you wish your version of this file to be governed by only the CDDL
82.34 + * or only the GPL Version 2, indicate your decision by adding
82.35 + * "[Contributor] elects to include this software in this distribution
82.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
82.37 + * single choice of license, a recipient has the option to distribute
82.38 + * your version of this file under either the CDDL, the GPL Version 2 or
82.39 + * to extend the choice of license to its licensees as provided above.
82.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
82.41 + * Version 2 license, then the option applies only if the new code is
82.42 + * made subject to such option by the copyright holder.
82.43 + */
82.44 +
82.45 +package org.netbeans.modules.visualweb.gravy.model;
82.46 +
82.47 +/**
82.48 + * Common interface for all descriptor types.
82.49 + */
82.50 +
82.51 +public interface Descriptor {
82.52 +
82.53 + /**
82.54 + * Get properties.
82.55 + * @return Object of properties.
82.56 + */
82.57 + public Object getProperties();
82.58 +
82.59 + /**
82.60 + * Get value of specified property.
82.61 + * @param propertyName Name of necessary property.
82.62 + * @return Object value of property.
82.63 + */
82.64 + public Object getProperty(String propertyName);
82.65 +}
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/ExternalProcess.java Thu Jul 10 04:32:50 2008 -0700
83.3 @@ -0,0 +1,59 @@
83.4 +/*
83.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
83.6 + *
83.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
83.8 + *
83.9 + * The contents of this file are subject to the terms of either the GNU
83.10 + * General Public License Version 2 only ("GPL") or the Common
83.11 + * Development and Distribution License("CDDL") (collectively, the
83.12 + * "License"). You may not use this file except in compliance with the
83.13 + * License. You can obtain a copy of the License at
83.14 + * http://www.netbeans.org/cddl-gplv2.html
83.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
83.16 + * specific language governing permissions and limitations under the
83.17 + * License. When distributing the software, include this License Header
83.18 + * Notice in each file and include the License file at
83.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
83.20 + * particular file as subject to the "Classpath" exception as provided
83.21 + * by Sun in the GPL Version 2 section of the License file that
83.22 + * accompanied this code. If applicable, add the following below the
83.23 + * License Header, with the fields enclosed by brackets [] replaced by
83.24 + * your own identifying information:
83.25 + * "Portions Copyrighted [year] [name of copyright owner]"
83.26 + *
83.27 + * Contributor(s):
83.28 + *
83.29 + * The Original Software is NetBeans. The Initial Developer of the Original
83.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
83.31 + * Microsystems, Inc. All Rights Reserved.
83.32 + *
83.33 + * If you wish your version of this file to be governed by only the CDDL
83.34 + * or only the GPL Version 2, indicate your decision by adding
83.35 + * "[Contributor] elects to include this software in this distribution
83.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
83.37 + * single choice of license, a recipient has the option to distribute
83.38 + * your version of this file under either the CDDL, the GPL Version 2 or
83.39 + * to extend the choice of license to its licensees as provided above.
83.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
83.41 + * Version 2 license, then the option applies only if the new code is
83.42 + * made subject to such option by the copyright holder.
83.43 + */
83.44 +
83.45 +package org.netbeans.modules.visualweb.gravy.model;
83.46 +
83.47 +/**
83.48 + * Common interface for all external processes.
83.49 + */
83.50 +
83.51 +public interface ExternalProcess {
83.52 +
83.53 + /**
83.54 + * Start external process.
83.55 + */
83.56 + public void start();
83.57 +
83.58 + /**
83.59 + * Stop external process.
83.60 + */
83.61 + public void stop();
83.62 +}
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
84.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/IDE.java Thu Jul 10 04:32:50 2008 -0700
84.3 @@ -0,0 +1,147 @@
84.4 +/*
84.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
84.6 + *
84.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
84.8 + *
84.9 + * The contents of this file are subject to the terms of either the GNU
84.10 + * General Public License Version 2 only ("GPL") or the Common
84.11 + * Development and Distribution License("CDDL") (collectively, the
84.12 + * "License"). You may not use this file except in compliance with the
84.13 + * License. You can obtain a copy of the License at
84.14 + * http://www.netbeans.org/cddl-gplv2.html
84.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
84.16 + * specific language governing permissions and limitations under the
84.17 + * License. When distributing the software, include this License Header
84.18 + * Notice in each file and include the License file at
84.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
84.20 + * particular file as subject to the "Classpath" exception as provided
84.21 + * by Sun in the GPL Version 2 section of the License file that
84.22 + * accompanied this code. If applicable, add the following below the
84.23 + * License Header, with the fields enclosed by brackets [] replaced by
84.24 + * your own identifying information:
84.25 + * "Portions Copyrighted [year] [name of copyright owner]"
84.26 + *
84.27 + * Contributor(s):
84.28 + *
84.29 + * The Original Software is NetBeans. The Initial Developer of the Original
84.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
84.31 + * Microsystems, Inc. All Rights Reserved.
84.32 + *
84.33 + * If you wish your version of this file to be governed by only the CDDL
84.34 + * or only the GPL Version 2, indicate your decision by adding
84.35 + * "[Contributor] elects to include this software in this distribution
84.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
84.37 + * single choice of license, a recipient has the option to distribute
84.38 + * your version of this file under either the CDDL, the GPL Version 2 or
84.39 + * to extend the choice of license to its licensees as provided above.
84.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
84.41 + * Version 2 license, then the option applies only if the new code is
84.42 + * made subject to such option by the copyright holder.
84.43 + */
84.44 +
84.45 +package org.netbeans.modules.visualweb.gravy.model;
84.46 +
84.47 +import org.netbeans.modules.visualweb.gravy.model.components.*;
84.48 +import org.netbeans.modules.visualweb.gravy.model.deployment.*;
84.49 +import org.netbeans.modules.visualweb.gravy.model.project.*;
84.50 +import org.netbeans.modules.visualweb.gravy.Util;
84.51 +import org.netbeans.modules.visualweb.gravy.TestUtils;
84.52 +
84.53 +import org.netbeans.jemmy.JemmyException;
84.54 +
84.55 +import java.util.List;
84.56 +
84.57 +/**
84.58 + * Representing IDE itself.
84.59 + */
84.60 +
84.61 +public class IDE {
84.62 +
84.63 + /**
84.64 + * Variable representing IDE.
84.65 + */
84.66 + private static IDE ide;
84.67 +
84.68 + /**
84.69 + * Add default depoyment targets.
84.70 + */
84.71 + private IDE() {
84.72 + DeploymentTargetDescriptor dtd = new DeploymentTargetDescriptor();
84.73 + dtd.loadDefault();
84.74 + if (dtd.getProperties()!=null) {
84.75 + DefaultDeploymentTargetFactory.getFactory().create(dtd);
84.76 + }
84.77 + }
84.78 +
84.79 + /**
84.80 + * Create instance of IDE or return it, if it is already exist.
84.81 + * Singleton.
84.82 + * @return IDE.
84.83 + */
84.84 + public static IDE getIDE() {
84.85 + if (ide != null) return ide;
84.86 + else return (ide = new IDE());
84.87 + }
84.88 +
84.89 + /**
84.90 + * Get deployment targets.
84.91 + * @return List of deployment targets.
84.92 + */
84.93 + public List getDeploymentTargets() {
84.94 + return DeploymentTargetList.getList();
84.95 + }
84.96 +
84.97 + /**
84.98 + * Add deployment target to IDE.
84.99 + * @param DTDescriptor Descriptor of deployment target.
84.100 + * @return added deployment target.
84.101 + */
84.102 + public DeploymentTarget addDeploymentTarget(DeploymentTargetDescriptor DTDescriptor) {
84.103 + return DefaultDeploymentTargetFactory.getFactory().create(DTDescriptor);
84.104 + }
84.105 +
84.106 + /**
84.107 + * Get projects.
84.108 + * @return List of projects.
84.109 + */
84.110 + public List getProjects() {
84.111 + return ProjectList.getList();
84.112 + }
84.113 +
84.114 + /**
84.115 + * Create new project.
84.116 + * @param projectDescriptor Descriptor of project.
84.117 + * @return created project.
84.118 + */
84.119 + public Project createProject(ProjectDescriptor projectDescriptor) {
84.120 + return DefaultProjectFactory.getFactory().create(projectDescriptor);
84.121 + }
84.122 +
84.123 + /**
84.124 + * Open existing project.
84.125 + * @param pathToProject Path to project's folder.
84.126 + * @return existing project.
84.127 + */
84.128 + public Project openProject(String pathToProject) {
84.129 + return DefaultProjectFactory.getFactory().open(pathToProject);
84.130 + }
84.131 +
84.132 + /**
84.133 + * Deploy main project.
84.134 + */
84.135 + public void deploy(){
84.136 + try {
84.137 + Util.getMainWindow().btDeploy().push();
84.138 + } catch(Exception e) {
84.139 + throw new JemmyException("IDE can't deploy Application!", e);
84.140 + }
84.141 + TestUtils.wait(20000);
84.142 + }
84.143 +
84.144 + /**
84.145 + * Return default component set.
84.146 + */
84.147 + public ComponentSet getDefaultComponentSet() {
84.148 + return BasicComponentSet.getBasicComponentSet();
84.149 + }
84.150 +}
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
85.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/BasicComponentSet.java Thu Jul 10 04:32:50 2008 -0700
85.3 @@ -0,0 +1,84 @@
85.4 +/*
85.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
85.6 + *
85.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
85.8 + *
85.9 + * The contents of this file are subject to the terms of either the GNU
85.10 + * General Public License Version 2 only ("GPL") or the Common
85.11 + * Development and Distribution License("CDDL") (collectively, the
85.12 + * "License"). You may not use this file except in compliance with the
85.13 + * License. You can obtain a copy of the License at
85.14 + * http://www.netbeans.org/cddl-gplv2.html
85.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
85.16 + * specific language governing permissions and limitations under the
85.17 + * License. When distributing the software, include this License Header
85.18 + * Notice in each file and include the License file at
85.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
85.20 + * particular file as subject to the "Classpath" exception as provided
85.21 + * by Sun in the GPL Version 2 section of the License file that
85.22 + * accompanied this code. If applicable, add the following below the
85.23 + * License Header, with the fields enclosed by brackets [] replaced by
85.24 + * your own identifying information:
85.25 + * "Portions Copyrighted [year] [name of copyright owner]"
85.26 + *
85.27 + * Contributor(s):
85.28 + *
85.29 + * The Original Software is NetBeans. The Initial Developer of the Original
85.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
85.31 + * Microsystems, Inc. All Rights Reserved.
85.32 + *
85.33 + * If you wish your version of this file to be governed by only the CDDL
85.34 + * or only the GPL Version 2, indicate your decision by adding
85.35 + * "[Contributor] elects to include this software in this distribution
85.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
85.37 + * single choice of license, a recipient has the option to distribute
85.38 + * your version of this file under either the CDDL, the GPL Version 2 or
85.39 + * to extend the choice of license to its licensees as provided above.
85.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
85.41 + * Version 2 license, then the option applies only if the new code is
85.42 + * made subject to such option by the copyright holder.
85.43 + */
85.44 +
85.45 +package org.netbeans.modules.visualweb.gravy.model.components;
85.46 +
85.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
85.48 +
85.49 +/**
85.50 + * Representing Basic Component set of the Pallette.
85.51 + */
85.52 +
85.53 +public final class BasicComponentSet extends ComponentSet {
85.54 +
85.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
85.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
85.57 + private final static String BASIC_CS_ID = Bundle.getStringTrimmed(ravePaletteBundle,
85.58 + Bundle.getStringTrimmed(bundle, "PaletteGroup"));
85.59 +
85.60 + /**
85.61 + * Variable representing component set "Basic".
85.62 + */
85.63 + private static BasicComponentSet bcs;
85.64 +
85.65 + /**
85.66 + * Creates a new instance of BasicComponentSet.
85.67 + */
85.68 + private BasicComponentSet() {
85.69 + super(BASIC_CS_ID);
85.70 + components.put(ButtonComponent.BUTTON_ID, new ButtonComponent(this));
85.71 + components.put(TextFieldComponent.TEXTFIELD_ID, new TextFieldComponent(this));
85.72 + components.put(LabelComponent.LABEL_ID, new LabelComponent(this));
85.73 + components.put(TableComponent.TABLE_ID, new TableComponent(this));
85.74 + components.put(DropDownListComponent.DROP_DOWN_LIST_ID, new DropDownListComponent(this));
85.75 + components.put(StaticTextComponent.STATIC_TEXT_ID, new StaticTextComponent(this));
85.76 + }
85.77 +
85.78 + /**
85.79 + * Create instance of BasicComponentSet or return it, if it is already exist.
85.80 + * Singleton.
85.81 + * @return BasicComponentSet.
85.82 + */
85.83 + public static BasicComponentSet getBasicComponentSet() {
85.84 + if (bcs != null) return bcs;
85.85 + else return (bcs = new BasicComponentSet());
85.86 + }
85.87 +}
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
86.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/Bundle.properties Thu Jul 10 04:32:50 2008 -0700
86.3 @@ -0,0 +1,68 @@
86.4 +/*
86.5 +
86.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
86.7 + *
86.8 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
86.9 +
86.10 + *
86.11 + * The contents of this file are subject to the terms of either the GNU
86.12 + * General Public License Version 2 only ("GPL") or the Common
86.13 + * Development and Distribution License("CDDL") (collectively, the
86.14 + * "License"). You may not use this file except in compliance with the
86.15 + * License. You can obtain a copy of the License at
86.16 + * http://www.netbeans.org/cddl-gplv2.html
86.17 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
86.18 + * specific language governing permissions and limitations under the
86.19 + * License. When distributing the software, include this License Header
86.20 + * Notice in each file and include the License file at
86.21 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
86.22 + * particular file as subject to the "Classpath" exception as provided
86.23 + * by Sun in the GPL Version 2 section of the License file that
86.24 + * accompanied this code. If applicable, add the following below the
86.25 + * License Header, with the fields enclosed by brackets [] replaced by
86.26 + * your own identifying information:
86.27 + * "Portions Copyrighted [year] [name of copyright owner]"
86.28 + *
86.29 + * Contributor(s):
86.30 +
86.31 + *
86.32 +
86.33 + * The Original Software is NetBeans. The Initial Developer of the Original
86.34 +
86.35 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
86.36 +
86.37 + * Microsystems, Inc. All Rights Reserved.
86.38 + *
86.39 + * If you wish your version of this file to be governed by only the CDDL
86.40 + * or only the GPL Version 2, indicate your decision by adding
86.41 + * "[Contributor] elects to include this software in this distribution
86.42 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
86.43 + * single choice of license, a recipient has the option to distribute
86.44 + * your version of this file under either the CDDL, the GPL Version 2 or
86.45 + * to extend the choice of license to its licensees as provided above.
86.46 + * However, if you add GPL Version 2 code and therefore, elected the GPL
86.47 + * Version 2 license, then the option applies only if the new code is
86.48 + * made subject to such option by the copyright holder.
86.49 +
86.50 + */
86.51 +
86.52 +
86.53 +
86.54 +#properties for rave webui.designtime bundle
86.55 +
86.56 +RavePaletteBundle=org.netbeans.modules.visualweb.webui.designtime.resources.Bundle
86.57 +
86.58 +ButtonComponent=NAME_vweb-ui-component-Button
86.59 +
86.60 +LabelComponent=NAME_vweb-ui-component-Label
86.61 +
86.62 +TextFieldComponent=NAME_vweb-ui-component-TextField
86.63 +
86.64 +TableComponent=NAME_vweb-ui-component-Table
86.65 +
86.66 +DropDownListComponent=NAME_vweb-ui-component-DropDown
86.67 +
86.68 +StaticTextComponent=NAME_vweb-ui-component-StaticText
86.69 +
86.70 +PaletteGroup=CreatorDesignerPalette/Basic
86.71 +
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
87.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/ButtonComponent.java Thu Jul 10 04:32:50 2008 -0700
87.3 @@ -0,0 +1,62 @@
87.4 +/*
87.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
87.6 + *
87.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
87.8 + *
87.9 + * The contents of this file are subject to the terms of either the GNU
87.10 + * General Public License Version 2 only ("GPL") or the Common
87.11 + * Development and Distribution License("CDDL") (collectively, the
87.12 + * "License"). You may not use this file except in compliance with the
87.13 + * License. You can obtain a copy of the License at
87.14 + * http://www.netbeans.org/cddl-gplv2.html
87.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
87.16 + * specific language governing permissions and limitations under the
87.17 + * License. When distributing the software, include this License Header
87.18 + * Notice in each file and include the License file at
87.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
87.20 + * particular file as subject to the "Classpath" exception as provided
87.21 + * by Sun in the GPL Version 2 section of the License file that
87.22 + * accompanied this code. If applicable, add the following below the
87.23 + * License Header, with the fields enclosed by brackets [] replaced by
87.24 + * your own identifying information:
87.25 + * "Portions Copyrighted [year] [name of copyright owner]"
87.26 + *
87.27 + * Contributor(s):
87.28 + *
87.29 + * The Original Software is NetBeans. The Initial Developer of the Original
87.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
87.31 + * Microsystems, Inc. All Rights Reserved.
87.32 + *
87.33 + * If you wish your version of this file to be governed by only the CDDL
87.34 + * or only the GPL Version 2, indicate your decision by adding
87.35 + * "[Contributor] elects to include this software in this distribution
87.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
87.37 + * single choice of license, a recipient has the option to distribute
87.38 + * your version of this file under either the CDDL, the GPL Version 2 or
87.39 + * to extend the choice of license to its licensees as provided above.
87.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
87.41 + * Version 2 license, then the option applies only if the new code is
87.42 + * made subject to such option by the copyright holder.
87.43 + */
87.44 +
87.45 +package org.netbeans.modules.visualweb.gravy.model.components;
87.46 +
87.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
87.48 +
87.49 +/**
87.50 + * Button components.
87.51 + */
87.52 +
87.53 +public class ButtonComponent extends WebComponent {
87.54 +
87.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
87.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
87.57 + public final static String BUTTON_ID = Bundle.getStringTrimmed(ravePaletteBundle,
87.58 + Bundle.getStringTrimmed(bundle, "ButtonComponent"));
87.59 +
87.60 + public ButtonComponent(ComponentSet set) {
87.61 + super(set, BUTTON_ID);
87.62 + isVisual = true;
87.63 + isEventHadling = true;
87.64 + }
87.65 +}
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
88.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/CodeClipComponent.java Thu Jul 10 04:32:50 2008 -0700
88.3 @@ -0,0 +1,53 @@
88.4 +/*
88.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
88.6 + *
88.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
88.8 + *
88.9 + * The contents of this file are subject to the terms of either the GNU
88.10 + * General Public License Version 2 only ("GPL") or the Common
88.11 + * Development and Distribution License("CDDL") (collectively, the
88.12 + * "License"). You may not use this file except in compliance with the
88.13 + * License. You can obtain a copy of the License at
88.14 + * http://www.netbeans.org/cddl-gplv2.html
88.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
88.16 + * specific language governing permissions and limitations under the
88.17 + * License. When distributing the software, include this License Header
88.18 + * Notice in each file and include the License file at
88.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
88.20 + * particular file as subject to the "Classpath" exception as provided
88.21 + * by Sun in the GPL Version 2 section of the License file that
88.22 + * accompanied this code. If applicable, add the following below the
88.23 + * License Header, with the fields enclosed by brackets [] replaced by
88.24 + * your own identifying information:
88.25 + * "Portions Copyrighted [year] [name of copyright owner]"
88.26 + *
88.27 + * Contributor(s):
88.28 + *
88.29 + * The Original Software is NetBeans. The Initial Developer of the Original
88.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
88.31 + * Microsystems, Inc. All Rights Reserved.
88.32 + *
88.33 + * If you wish your version of this file to be governed by only the CDDL
88.34 + * or only the GPL Version 2, indicate your decision by adding
88.35 + * "[Contributor] elects to include this software in this distribution
88.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
88.37 + * single choice of license, a recipient has the option to distribute
88.38 + * your version of this file under either the CDDL, the GPL Version 2 or
88.39 + * to extend the choice of license to its licensees as provided above.
88.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
88.41 + * Version 2 license, then the option applies only if the new code is
88.42 + * made subject to such option by the copyright holder.
88.43 + */
88.44 +
88.45 +package org.netbeans.modules.visualweb.gravy.model.components;
88.46 +
88.47 +/**
88.48 + * Common class for code clip components in palette.
88.49 + */
88.50 +
88.51 +public class CodeClipComponent extends PaletteComponent {
88.52 +
88.53 + public CodeClipComponent(ComponentSet set, String ID) {
88.54 + super(set, ID);
88.55 + }
88.56 +}
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
89.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/ComponentSet.java Thu Jul 10 04:32:50 2008 -0700
89.3 @@ -0,0 +1,95 @@
89.4 +/*
89.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
89.6 + *
89.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
89.8 + *
89.9 + * The contents of this file are subject to the terms of either the GNU
89.10 + * General Public License Version 2 only ("GPL") or the Common
89.11 + * Development and Distribution License("CDDL") (collectively, the
89.12 + * "License"). You may not use this file except in compliance with the
89.13 + * License. You can obtain a copy of the License at
89.14 + * http://www.netbeans.org/cddl-gplv2.html
89.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
89.16 + * specific language governing permissions and limitations under the
89.17 + * License. When distributing the software, include this License Header
89.18 + * Notice in each file and include the License file at
89.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
89.20 + * particular file as subject to the "Classpath" exception as provided
89.21 + * by Sun in the GPL Version 2 section of the License file that
89.22 + * accompanied this code. If applicable, add the following below the
89.23 + * License Header, with the fields enclosed by brackets [] replaced by
89.24 + * your own identifying information:
89.25 + * "Portions Copyrighted [year] [name of copyright owner]"
89.26 + *
89.27 + * Contributor(s):
89.28 + *
89.29 + * The Original Software is NetBeans. The Initial Developer of the Original
89.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
89.31 + * Microsystems, Inc. All Rights Reserved.
89.32 + *
89.33 + * If you wish your version of this file to be governed by only the CDDL
89.34 + * or only the GPL Version 2, indicate your decision by adding
89.35 + * "[Contributor] elects to include this software in this distribution
89.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
89.37 + * single choice of license, a recipient has the option to distribute
89.38 + * your version of this file under either the CDDL, the GPL Version 2 or
89.39 + * to extend the choice of license to its licensees as provided above.
89.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
89.41 + * Version 2 license, then the option applies only if the new code is
89.42 + * made subject to such option by the copyright holder.
89.43 + */
89.44 +
89.45 +package org.netbeans.modules.visualweb.gravy.model.components;
89.46 +
89.47 +import java.util.Hashtable;
89.48 +
89.49 +/**
89.50 + * Set for Components.
89.51 + */
89.52 +
89.53 +public class ComponentSet {
89.54 +
89.55 + protected Hashtable components = new Hashtable();
89.56 +
89.57 + private String ID;
89.58 +
89.59 + /**
89.60 + * Create New ComponentsSet with specified ID.
89.61 + */
89.62 + public ComponentSet(String ID) {
89.63 + this.ID = ID;
89.64 + }
89.65 +
89.66 + /**
89.67 + * Get Components of the Set.
89.68 + * @return Hashtable of the Components.
89.69 + */
89.70 + public Hashtable getComponents() {
89.71 + return components;
89.72 + }
89.73 +
89.74 + /**
89.75 + * Get component with specified ID.
89.76 + * @param ID Component's ID.
89.77 + * @return Component with given ID.
89.78 + */
89.79 + public PaletteComponent getComponent(String ID) {
89.80 + return ((PaletteComponent) components.get(ID));
89.81 + }
89.82 +
89.83 + /**
89.84 + * Get Component Set ID.
89.85 + * @return ComponentSet ID.
89.86 + */
89.87 + public String getID() {
89.88 + return ID;
89.89 + }
89.90 +
89.91 + /**
89.92 + * Set ID for ComponentSet.
89.93 + * @param ID Component Set ID.
89.94 + */
89.95 + private void setID(String ID) {
89.96 + this.ID = ID;
89.97 + }
89.98 +}
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
90.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/DropDownListComponent.java Thu Jul 10 04:32:50 2008 -0700
90.3 @@ -0,0 +1,62 @@
90.4 +/*
90.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
90.6 + *
90.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
90.8 + *
90.9 + * The contents of this file are subject to the terms of either the GNU
90.10 + * General Public License Version 2 only ("GPL") or the Common
90.11 + * Development and Distribution License("CDDL") (collectively, the
90.12 + * "License"). You may not use this file except in compliance with the
90.13 + * License. You can obtain a copy of the License at
90.14 + * http://www.netbeans.org/cddl-gplv2.html
90.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
90.16 + * specific language governing permissions and limitations under the
90.17 + * License. When distributing the software, include this License Header
90.18 + * Notice in each file and include the License file at
90.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
90.20 + * particular file as subject to the "Classpath" exception as provided
90.21 + * by Sun in the GPL Version 2 section of the License file that
90.22 + * accompanied this code. If applicable, add the following below the
90.23 + * License Header, with the fields enclosed by brackets [] replaced by
90.24 + * your own identifying information:
90.25 + * "Portions Copyrighted [year] [name of copyright owner]"
90.26 + *
90.27 + * Contributor(s):
90.28 + *
90.29 + * The Original Software is NetBeans. The Initial Developer of the Original
90.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
90.31 + * Microsystems, Inc. All Rights Reserved.
90.32 + *
90.33 + * If you wish your version of this file to be governed by only the CDDL
90.34 + * or only the GPL Version 2, indicate your decision by adding
90.35 + * "[Contributor] elects to include this software in this distribution
90.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
90.37 + * single choice of license, a recipient has the option to distribute
90.38 + * your version of this file under either the CDDL, the GPL Version 2 or
90.39 + * to extend the choice of license to its licensees as provided above.
90.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
90.41 + * Version 2 license, then the option applies only if the new code is
90.42 + * made subject to such option by the copyright holder.
90.43 + */
90.44 +
90.45 +package org.netbeans.modules.visualweb.gravy.model.components;
90.46 +
90.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
90.48 +
90.49 +/**
90.50 + * Button components.
90.51 + */
90.52 +
90.53 +public class DropDownListComponent extends WebComponent {
90.54 +
90.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
90.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
90.57 + public final static String DROP_DOWN_LIST_ID = Bundle.getStringTrimmed(ravePaletteBundle,
90.58 + Bundle.getStringTrimmed(bundle, "DropDownListComponent"));
90.59 +
90.60 + public DropDownListComponent(ComponentSet set) {
90.61 + super(set, DROP_DOWN_LIST_ID);
90.62 + isVisual = true;
90.63 + isEventHadling = true;
90.64 + }
90.65 +}
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
91.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/LabelComponent.java Thu Jul 10 04:32:50 2008 -0700
91.3 @@ -0,0 +1,62 @@
91.4 +/*
91.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
91.6 + *
91.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
91.8 + *
91.9 + * The contents of this file are subject to the terms of either the GNU
91.10 + * General Public License Version 2 only ("GPL") or the Common
91.11 + * Development and Distribution License("CDDL") (collectively, the
91.12 + * "License"). You may not use this file except in compliance with the
91.13 + * License. You can obtain a copy of the License at
91.14 + * http://www.netbeans.org/cddl-gplv2.html
91.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
91.16 + * specific language governing permissions and limitations under the
91.17 + * License. When distributing the software, include this License Header
91.18 + * Notice in each file and include the License file at
91.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
91.20 + * particular file as subject to the "Classpath" exception as provided
91.21 + * by Sun in the GPL Version 2 section of the License file that
91.22 + * accompanied this code. If applicable, add the following below the
91.23 + * License Header, with the fields enclosed by brackets [] replaced by
91.24 + * your own identifying information:
91.25 + * "Portions Copyrighted [year] [name of copyright owner]"
91.26 + *
91.27 + * Contributor(s):
91.28 + *
91.29 + * The Original Software is NetBeans. The Initial Developer of the Original
91.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
91.31 + * Microsystems, Inc. All Rights Reserved.
91.32 + *
91.33 + * If you wish your version of this file to be governed by only the CDDL
91.34 + * or only the GPL Version 2, indicate your decision by adding
91.35 + * "[Contributor] elects to include this software in this distribution
91.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
91.37 + * single choice of license, a recipient has the option to distribute
91.38 + * your version of this file under either the CDDL, the GPL Version 2 or
91.39 + * to extend the choice of license to its licensees as provided above.
91.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
91.41 + * Version 2 license, then the option applies only if the new code is
91.42 + * made subject to such option by the copyright holder.
91.43 + */
91.44 +
91.45 +package org.netbeans.modules.visualweb.gravy.model.components;
91.46 +
91.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
91.48 +
91.49 +/**
91.50 + * Label component.
91.51 + */
91.52 +
91.53 +public class LabelComponent extends WebComponent {
91.54 +
91.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
91.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
91.57 + public final static String LABEL_ID = Bundle.getStringTrimmed(ravePaletteBundle,
91.58 + Bundle.getStringTrimmed(bundle, "LabelComponent"));
91.59 +
91.60 + public LabelComponent(ComponentSet set) {
91.61 + super(set, LABEL_ID);
91.62 + isVisual = true;
91.63 + isEventHadling = false;
91.64 + }
91.65 +}
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
92.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/PaletteComponent.java Thu Jul 10 04:32:50 2008 -0700
92.3 @@ -0,0 +1,104 @@
92.4 +/*
92.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
92.6 + *
92.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
92.8 + *
92.9 + * The contents of this file are subject to the terms of either the GNU
92.10 + * General Public License Version 2 only ("GPL") or the Common
92.11 + * Development and Distribution License("CDDL") (collectively, the
92.12 + * "License"). You may not use this file except in compliance with the
92.13 + * License. You can obtain a copy of the License at
92.14 + * http://www.netbeans.org/cddl-gplv2.html
92.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
92.16 + * specific language governing permissions and limitations under the
92.17 + * License. When distributing the software, include this License Header
92.18 + * Notice in each file and include the License file at
92.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
92.20 + * particular file as subject to the "Classpath" exception as provided
92.21 + * by Sun in the GPL Version 2 section of the License file that
92.22 + * accompanied this code. If applicable, add the following below the
92.23 + * License Header, with the fields enclosed by brackets [] replaced by
92.24 + * your own identifying information:
92.25 + * "Portions Copyrighted [year] [name of copyright owner]"
92.26 + *
92.27 + * Contributor(s):
92.28 + *
92.29 + * The Original Software is NetBeans. The Initial Developer of the Original
92.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
92.31 + * Microsystems, Inc. All Rights Reserved.
92.32 + *
92.33 + * If you wish your version of this file to be governed by only the CDDL
92.34 + * or only the GPL Version 2, indicate your decision by adding
92.35 + * "[Contributor] elects to include this software in this distribution
92.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
92.37 + * single choice of license, a recipient has the option to distribute
92.38 + * your version of this file under either the CDDL, the GPL Version 2 or
92.39 + * to extend the choice of license to its licensees as provided above.
92.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
92.41 + * Version 2 license, then the option applies only if the new code is
92.42 + * made subject to such option by the copyright holder.
92.43 + */
92.44 +
92.45 +package org.netbeans.modules.visualweb.gravy.model.components;
92.46 +
92.47 +/**
92.48 + * Common class for all components in palette.
92.49 + */
92.50 +
92.51 +public class PaletteComponent {
92.52 +
92.53 + private ComponentSet set;
92.54 + private String ID;
92.55 +
92.56 + /**
92.57 + * Create Component with specified ID for specified ComponentSet.
92.58 + * @param set ComponentSet.
92.59 + * @param ID Component ID.
92.60 + */
92.61 + public PaletteComponent(ComponentSet set, String ID) {
92.62 + setID(ID);
92.63 + setComponentSet(set);
92.64 + }
92.65 +
92.66 + /**
92.67 + * Return true if Component belongs to the specified ComponentSet.
92.68 + * @param set ComponentSet.
92.69 + * @return true if Component belongs to the specified ComponentSet.
92.70 + */
92.71 + public boolean isBelongsTo(ComponentSet set) {
92.72 + if (this.set.getID().equals(set.getID())) return true;
92.73 + else return false;
92.74 + }
92.75 +
92.76 + /**
92.77 + * Get Component ID.
92.78 + * @return Component ID.
92.79 + */
92.80 + public String getID() {
92.81 + return ID;
92.82 + }
92.83 +
92.84 + /**
92.85 + * Set ID for Component.
92.86 + * @param ID Component ID.
92.87 + */
92.88 + private void setID(String ID) {
92.89 + this.ID = ID;
92.90 + }
92.91 +
92.92 + /**
92.93 + * Get ComponentSet which component belong to.
92.94 + * @return ComponentSet ComponentSet which component belongs to.
92.95 + */
92.96 + public ComponentSet getComponentSet() {
92.97 + return set;
92.98 + }
92.99 +
92.100 + /**
92.101 + * Set ComponentSet for Component.
92.102 + * @param ComponentSet ComponentSet which component should belong to.
92.103 + */
92.104 + private void setComponentSet(ComponentSet set) {
92.105 + this.set = set;
92.106 + }
92.107 +}
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
93.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/StaticTextComponent.java Thu Jul 10 04:32:50 2008 -0700
93.3 @@ -0,0 +1,62 @@
93.4 +/*
93.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
93.6 + *
93.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
93.8 + *
93.9 + * The contents of this file are subject to the terms of either the GNU
93.10 + * General Public License Version 2 only ("GPL") or the Common
93.11 + * Development and Distribution License("CDDL") (collectively, the
93.12 + * "License"). You may not use this file except in compliance with the
93.13 + * License. You can obtain a copy of the License at
93.14 + * http://www.netbeans.org/cddl-gplv2.html
93.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
93.16 + * specific language governing permissions and limitations under the
93.17 + * License. When distributing the software, include this License Header
93.18 + * Notice in each file and include the License file at
93.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
93.20 + * particular file as subject to the "Classpath" exception as provided
93.21 + * by Sun in the GPL Version 2 section of the License file that
93.22 + * accompanied this code. If applicable, add the following below the
93.23 + * License Header, with the fields enclosed by brackets [] replaced by
93.24 + * your own identifying information:
93.25 + * "Portions Copyrighted [year] [name of copyright owner]"
93.26 + *
93.27 + * Contributor(s):
93.28 + *
93.29 + * The Original Software is NetBeans. The Initial Developer of the Original
93.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
93.31 + * Microsystems, Inc. All Rights Reserved.
93.32 + *
93.33 + * If you wish your version of this file to be governed by only the CDDL
93.34 + * or only the GPL Version 2, indicate your decision by adding
93.35 + * "[Contributor] elects to include this software in this distribution
93.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
93.37 + * single choice of license, a recipient has the option to distribute
93.38 + * your version of this file under either the CDDL, the GPL Version 2 or
93.39 + * to extend the choice of license to its licensees as provided above.
93.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
93.41 + * Version 2 license, then the option applies only if the new code is
93.42 + * made subject to such option by the copyright holder.
93.43 + */
93.44 +
93.45 +package org.netbeans.modules.visualweb.gravy.model.components;
93.46 +
93.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
93.48 +
93.49 +/**
93.50 + * Label component.
93.51 + */
93.52 +
93.53 +public class StaticTextComponent extends WebComponent {
93.54 +
93.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
93.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
93.57 + public final static String STATIC_TEXT_ID = Bundle.getStringTrimmed(ravePaletteBundle,
93.58 + Bundle.getStringTrimmed(bundle, "StaticTextComponent"));
93.59 +
93.60 + public StaticTextComponent(ComponentSet set) {
93.61 + super(set, STATIC_TEXT_ID);
93.62 + isVisual = true;
93.63 + isEventHadling = false;
93.64 + }
93.65 +}
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
94.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/TableComponent.java Thu Jul 10 04:32:50 2008 -0700
94.3 @@ -0,0 +1,62 @@
94.4 +/*
94.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
94.6 + *
94.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
94.8 + *
94.9 + * The contents of this file are subject to the terms of either the GNU
94.10 + * General Public License Version 2 only ("GPL") or the Common
94.11 + * Development and Distribution License("CDDL") (collectively, the
94.12 + * "License"). You may not use this file except in compliance with the
94.13 + * License. You can obtain a copy of the License at
94.14 + * http://www.netbeans.org/cddl-gplv2.html
94.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
94.16 + * specific language governing permissions and limitations under the
94.17 + * License. When distributing the software, include this License Header
94.18 + * Notice in each file and include the License file at
94.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
94.20 + * particular file as subject to the "Classpath" exception as provided
94.21 + * by Sun in the GPL Version 2 section of the License file that
94.22 + * accompanied this code. If applicable, add the following below the
94.23 + * License Header, with the fields enclosed by brackets [] replaced by
94.24 + * your own identifying information:
94.25 + * "Portions Copyrighted [year] [name of copyright owner]"
94.26 + *
94.27 + * Contributor(s):
94.28 + *
94.29 + * The Original Software is NetBeans. The Initial Developer of the Original
94.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
94.31 + * Microsystems, Inc. All Rights Reserved.
94.32 + *
94.33 + * If you wish your version of this file to be governed by only the CDDL
94.34 + * or only the GPL Version 2, indicate your decision by adding
94.35 + * "[Contributor] elects to include this software in this distribution
94.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
94.37 + * single choice of license, a recipient has the option to distribute
94.38 + * your version of this file under either the CDDL, the GPL Version 2 or
94.39 + * to extend the choice of license to its licensees as provided above.
94.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
94.41 + * Version 2 license, then the option applies only if the new code is
94.42 + * made subject to such option by the copyright holder.
94.43 + */
94.44 +
94.45 +package org.netbeans.modules.visualweb.gravy.model.components;
94.46 +
94.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
94.48 +
94.49 +/**
94.50 + * Label component.
94.51 + */
94.52 +
94.53 +public class TableComponent extends WebComponent {
94.54 +
94.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
94.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
94.57 + public final static String TABLE_ID = Bundle.getStringTrimmed(ravePaletteBundle,
94.58 + Bundle.getStringTrimmed(bundle, "TableComponent"));
94.59 +
94.60 + public TableComponent(ComponentSet set) {
94.61 + super(set, TABLE_ID);
94.62 + isVisual = true;
94.63 + isEventHadling = false;
94.64 + }
94.65 +}
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
95.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/TextFieldComponent.java Thu Jul 10 04:32:50 2008 -0700
95.3 @@ -0,0 +1,62 @@
95.4 +/*
95.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
95.6 + *
95.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
95.8 + *
95.9 + * The contents of this file are subject to the terms of either the GNU
95.10 + * General Public License Version 2 only ("GPL") or the Common
95.11 + * Development and Distribution License("CDDL") (collectively, the
95.12 + * "License"). You may not use this file except in compliance with the
95.13 + * License. You can obtain a copy of the License at
95.14 + * http://www.netbeans.org/cddl-gplv2.html
95.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
95.16 + * specific language governing permissions and limitations under the
95.17 + * License. When distributing the software, include this License Header
95.18 + * Notice in each file and include the License file at
95.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
95.20 + * particular file as subject to the "Classpath" exception as provided
95.21 + * by Sun in the GPL Version 2 section of the License file that
95.22 + * accompanied this code. If applicable, add the following below the
95.23 + * License Header, with the fields enclosed by brackets [] replaced by
95.24 + * your own identifying information:
95.25 + * "Portions Copyrighted [year] [name of copyright owner]"
95.26 + *
95.27 + * Contributor(s):
95.28 + *
95.29 + * The Original Software is NetBeans. The Initial Developer of the Original
95.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
95.31 + * Microsystems, Inc. All Rights Reserved.
95.32 + *
95.33 + * If you wish your version of this file to be governed by only the CDDL
95.34 + * or only the GPL Version 2, indicate your decision by adding
95.35 + * "[Contributor] elects to include this software in this distribution
95.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
95.37 + * single choice of license, a recipient has the option to distribute
95.38 + * your version of this file under either the CDDL, the GPL Version 2 or
95.39 + * to extend the choice of license to its licensees as provided above.
95.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
95.41 + * Version 2 license, then the option applies only if the new code is
95.42 + * made subject to such option by the copyright holder.
95.43 + */
95.44 +
95.45 +package org.netbeans.modules.visualweb.gravy.model.components;
95.46 +
95.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
95.48 +
95.49 +/**
95.50 + * Text Field components.
95.51 + */
95.52 +
95.53 +public class TextFieldComponent extends WebComponent {
95.54 +
95.55 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
95.56 + private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
95.57 + public final static String TEXTFIELD_ID = Bundle.getStringTrimmed(ravePaletteBundle,
95.58 + Bundle.getStringTrimmed(bundle, "TextFieldComponent"));
95.59 +
95.60 + public TextFieldComponent(ComponentSet set) {
95.61 + super(set, TEXTFIELD_ID);
95.62 + isVisual = true;
95.63 + isEventHadling = true;
95.64 + }
95.65 +}
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
96.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/components/WebComponent.java Thu Jul 10 04:32:50 2008 -0700
96.3 @@ -0,0 +1,72 @@
96.4 +/*
96.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
96.6 + *
96.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
96.8 + *
96.9 + * The contents of this file are subject to the terms of either the GNU
96.10 + * General Public License Version 2 only ("GPL") or the Common
96.11 + * Development and Distribution License("CDDL") (collectively, the
96.12 + * "License"). You may not use this file except in compliance with the
96.13 + * License. You can obtain a copy of the License at
96.14 + * http://www.netbeans.org/cddl-gplv2.html
96.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
96.16 + * specific language governing permissions and limitations under the
96.17 + * License. When distributing the software, include this License Header
96.18 + * Notice in each file and include the License file at
96.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
96.20 + * particular file as subject to the "Classpath" exception as provided
96.21 + * by Sun in the GPL Version 2 section of the License file that
96.22 + * accompanied this code. If applicable, add the following below the
96.23 + * License Header, with the fields enclosed by brackets [] replaced by
96.24 + * your own identifying information:
96.25 + * "Portions Copyrighted [year] [name of copyright owner]"
96.26 + *
96.27 + * Contributor(s):
96.28 + *
96.29 + * The Original Software is NetBeans. The Initial Developer of the Original
96.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
96.31 + * Microsystems, Inc. All Rights Reserved.
96.32 + *
96.33 + * If you wish your version of this file to be governed by only the CDDL
96.34 + * or only the GPL Version 2, indicate your decision by adding
96.35 + * "[Contributor] elects to include this software in this distribution
96.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
96.37 + * single choice of license, a recipient has the option to distribute
96.38 + * your version of this file under either the CDDL, the GPL Version 2 or
96.39 + * to extend the choice of license to its licensees as provided above.
96.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
96.41 + * Version 2 license, then the option applies only if the new code is
96.42 + * made subject to such option by the copyright holder.
96.43 + */
96.44 +
96.45 +package org.netbeans.modules.visualweb.gravy.model.components;
96.46 +
96.47 +/**
96.48 + * Common class for web components in palette.
96.49 + */
96.50 +
96.51 +public class WebComponent extends PaletteComponent {
96.52 +
96.53 + protected boolean isVisual;
96.54 + protected boolean isEventHadling;
96.55 +
96.56 + public WebComponent(ComponentSet set, String ID) {
96.57 + super(set, ID);
96.58 + }
96.59 +
96.60 + /**
96.61 + * Is component visual or not.
96.62 + * @return True if component is visual and false if non visual.
96.63 + */
96.64 + public boolean isVisual() {
96.65 + return isVisual;
96.66 + }
96.67 +
96.68 + /**
96.69 + * Is component action or not.
96.70 + * @return True if component is visual and false if non visual.
96.71 + */
96.72 + public boolean isEventHadling() {
96.73 + return isEventHadling;
96.74 + }
96.75 +}
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
97.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/ApplicationServer.java Thu Jul 10 04:32:50 2008 -0700
97.3 @@ -0,0 +1,185 @@
97.4 +/*
97.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
97.6 + *
97.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
97.8 + *
97.9 + * The contents of this file are subject to the terms of either the GNU
97.10 + * General Public License Version 2 only ("GPL") or the Common
97.11 + * Development and Distribution License("CDDL") (collectively, the
97.12 + * "License"). You may not use this file except in compliance with the
97.13 + * License. You can obtain a copy of the License at
97.14 + * http://www.netbeans.org/cddl-gplv2.html
97.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
97.16 + * specific language governing permissions and limitations under the
97.17 + * License. When distributing the software, include this License Header
97.18 + * Notice in each file and include the License file at
97.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
97.20 + * particular file as subject to the "Classpath" exception as provided
97.21 + * by Sun in the GPL Version 2 section of the License file that
97.22 + * accompanied this code. If applicable, add the following below the
97.23 + * License Header, with the fields enclosed by brackets [] replaced by
97.24 + * your own identifying information:
97.25 + * "Portions Copyrighted [year] [name of copyright owner]"
97.26 + *
97.27 + * Contributor(s):
97.28 + *
97.29 + * The Original Software is NetBeans. The Initial Developer of the Original
97.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
97.31 + * Microsystems, Inc. All Rights Reserved.
97.32 + *
97.33 + * If you wish your version of this file to be governed by only the CDDL
97.34 + * or only the GPL Version 2, indicate your decision by adding
97.35 + * "[Contributor] elects to include this software in this distribution
97.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
97.37 + * single choice of license, a recipient has the option to distribute
97.38 + * your version of this file under either the CDDL, the GPL Version 2 or
97.39 + * to extend the choice of license to its licensees as provided above.
97.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
97.41 + * Version 2 license, then the option applies only if the new code is
97.42 + * made subject to such option by the copyright holder.
97.43 + */
97.44 +
97.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
97.46 +
97.47 +import org.netbeans.jemmy.JemmyException;
97.48 +import org.netbeans.modules.visualweb.gravy.Util;
97.49 +import org.netbeans.modules.visualweb.gravy.TestUtils;
97.50 +import org.netbeans.modules.visualweb.gravy.model.ExternalProcess;
97.51 +import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
97.52 +
97.53 +/**
97.54 + * Common class for all application servers.
97.55 + */
97.56 +
97.57 +public class ApplicationServer implements DeploymentTarget, ExternalProcess {
97.58 +
97.59 + public final static String SERVER_START = "Start";
97.60 + public final static String SERVER_START_DEBUG = "Start in Debug Mode";
97.61 + public final static String SERVER_RESTART = "Restart";
97.62 + public final static String SERVER_STOP = "Stop";
97.63 + public final static String SERVER_REMOVE = "Remove";
97.64 + public final static String SERVER_CUSTOMIZE = "Customize";
97.65 + public final static String SERVER_VIEW_CONSOLE = "View Admin Console";
97.66 + public final static String PROPERTIES = "Properties";
97.67 + public final static String REFRESH = "Refresh";
97.68 + public final static String APPLICATION_UNDEPLOY = "Undeploy";
97.69 +
97.70 + public String SERVER_VIEW_LOG;
97.71 + public String APPLICATION_DISABLE;
97.72 + public String APPLICATION_ENABLE;
97.73 +
97.74 + /**
97.75 + * Prefix before application node in the list of web applications.
97.76 + */
97.77 + public String app_pref;
97.78 +
97.79 + /**
97.80 + * Path to web applications.
97.81 + */
97.82 + public String web_applications_path;
97.83 +
97.84 + /**
97.85 + * Path to JDBC resources.
97.86 + */
97.87 + public String jdbc_resources_path;
97.88 +
97.89 + /**
97.90 + * Array of items of Application Server's popup menu.
97.91 + */
97.92 + public String[][] server_popup;
97.93 +
97.94 + /**
97.95 + * Array of items of application's popup menu.
97.96 + */
97.97 + public String[] application_popup;
97.98 +
97.99 + /**
97.100 + * Array of items of resource's popup menu.
97.101 + */
97.102 + public String[] resource_popup;
97.103 +
97.104 + /**
97.105 + * Prefix for request to load application in browser.
97.106 + */
97.107 + public String requestPrefix;
97.108 +
97.109 + /**
97.110 + * Descriptor of deployment target.
97.111 + */
97.112 + private DeploymentTargetDescriptor DTDescriptor;
97.113 +
97.114 + /**
97.115 + * Get descriptor of Application Server.
97.116 + * @return descriptor of Application Server.
97.117 + */
97.118 + public DeploymentTargetDescriptor getDescriptor() {
97.119 + return DTDescriptor;
97.120 + }
97.121 +
97.122 + /**
97.123 + * Set descriptor of Application Server.
97.124 + * @param DTDescriptor New descriptor of Application Server.
97.125 + */
97.126 + protected void setDescriptor(DeploymentTargetDescriptor DTDescriptor) {
97.127 + this.DTDescriptor = DTDescriptor;
97.128 + }
97.129 +
97.130 + /**
97.131 + * Deploy project to this server.
97.132 + * @param project Project to deploy.
97.133 + */
97.134 + public void deploy(Object project) {
97.135 + try {
97.136 + Util.getMainWindow().btDeploy().push();
97.137 + }
97.138 + catch(Exception e) {
97.139 + throw new JemmyException("Application can't be deployed to " + getName() + "!", e);
97.140 + }
97.141 + TestUtils.wait(20000);
97.142 + }
97.143 +
97.144 + /**
97.145 + * Start Application Server.
97.146 + */
97.147 + public void start() {
97.148 + try {
97.149 + ServerNavigatorOperator.startServer(getName());
97.150 + }
97.151 + catch(Exception e) {
97.152 + throw new JemmyException(getName() + " can't be started!", e);
97.153 + }
97.154 + }
97.155 +
97.156 + /**
97.157 + * Stop Application Server.
97.158 + */
97.159 + public void stop() {
97.160 + try {
97.161 + ServerNavigatorOperator.stopServer(getName());
97.162 + }
97.163 + catch(Exception e) {
97.164 + throw new JemmyException(getName() + " can't be stopped!", e);
97.165 + }
97.166 + }
97.167 +
97.168 + /**
97.169 + * Instance of Application Server is compared with deployment target, passed with parameter.
97.170 + * @param dt Object for comparison.
97.171 + * @return true if Object equals to ApplicationServer.
97.172 + */
97.173 + public boolean equals(Object dt) {
97.174 + if ((dt instanceof DeploymentTarget) && ((DeploymentTarget) dt).getName().equals(this.getName())) {
97.175 + return true;
97.176 + }
97.177 + return false;
97.178 + }
97.179 +
97.180 + /**
97.181 + * Get name of Application Server.
97.182 + * @return name.
97.183 + */
97.184 + public String getName() {
97.185 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
97.186 + return DTDescriptor.getProperty(DTDescriptor.NAME_KEY + serverType);
97.187 + }
97.188 +}
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
98.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DefaultDeploymentTargetFactory.java Thu Jul 10 04:32:50 2008 -0700
98.3 @@ -0,0 +1,99 @@
98.4 +/*
98.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
98.6 + *
98.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
98.8 + *
98.9 + * The contents of this file are subject to the terms of either the GNU
98.10 + * General Public License Version 2 only ("GPL") or the Common
98.11 + * Development and Distribution License("CDDL") (collectively, the
98.12 + * "License"). You may not use this file except in compliance with the
98.13 + * License. You can obtain a copy of the License at
98.14 + * http://www.netbeans.org/cddl-gplv2.html
98.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
98.16 + * specific language governing permissions and limitations under the
98.17 + * License. When distributing the software, include this License Header
98.18 + * Notice in each file and include the License file at
98.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
98.20 + * particular file as subject to the "Classpath" exception as provided
98.21 + * by Sun in the GPL Version 2 section of the License file that
98.22 + * accompanied this code. If applicable, add the following below the
98.23 + * License Header, with the fields enclosed by brackets [] replaced by
98.24 + * your own identifying information:
98.25 + * "Portions Copyrighted [year] [name of copyright owner]"
98.26 + *
98.27 + * Contributor(s):
98.28 + *
98.29 + * The Original Software is NetBeans. The Initial Developer of the Original
98.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
98.31 + * Microsystems, Inc. All Rights Reserved.
98.32 + *
98.33 + * If you wish your version of this file to be governed by only the CDDL
98.34 + * or only the GPL Version 2, indicate your decision by adding
98.35 + * "[Contributor] elects to include this software in this distribution
98.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
98.37 + * single choice of license, a recipient has the option to distribute
98.38 + * your version of this file under either the CDDL, the GPL Version 2 or
98.39 + * to extend the choice of license to its licensees as provided above.
98.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
98.41 + * Version 2 license, then the option applies only if the new code is
98.42 + * made subject to such option by the copyright holder.
98.43 + */
98.44 +
98.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
98.46 +
98.47 +import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
98.48 +
98.49 +import org.netbeans.jemmy.JemmyException;
98.50 +
98.51 +/**
98.52 + * Default factory for creation of deployment targets.
98.53 + */
98.54 +
98.55 +public class DefaultDeploymentTargetFactory extends DeploymentTargetFactory {
98.56 +
98.57 + /**
98.58 + * Default deployment target factory.
98.59 + */
98.60 + private static DefaultDeploymentTargetFactory defaultDTFactory;
98.61 +
98.62 + /**
98.63 + * Create new DefaultDeploymentTargetFactory.
98.64 + */
98.65 + public DefaultDeploymentTargetFactory() {
98.66 + }
98.67 +
98.68 + /**
98.69 + * Create instance of DefaultDeploymentTargetFactory or return it, if it is already exist.
98.70 + * Singleton.
98.71 + * @return DefaultDeploymentTargetFactory.
98.72 + */
98.73 + public static DefaultDeploymentTargetFactory getFactory() {
98.74 + if (defaultDTFactory != null) return defaultDTFactory;
98.75 + else return (defaultDTFactory = new DefaultDeploymentTargetFactory());
98.76 + }
98.77 +
98.78 + /**
98.79 + * Create new deployment target.
98.80 + * Return server's type in accordance with PROP_NAME_SERVER_TYPE variable.
98.81 + * @param DTDescriptor Descriptor of deployment target.
98.82 + * @return created deployment target.
98.83 + */
98.84 + protected DeploymentTarget createInstance(DeploymentTargetDescriptor DTDescriptor) {
98.85 + try {
98.86 + ServerNavigatorOperator.addDeploymentTarget(DTDescriptor);
98.87 + }
98.88 + catch(Exception e) {
98.89 + throw new JemmyException("Deployment Target can't be added!", e);
98.90 + }
98.91 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
98.92 + if (serverType.equals(ServerNavigatorOperator.STR_NAME_WEBLOGIC)) return new WebLogic9(DTDescriptor);
98.93 + if (serverType.equals(ServerNavigatorOperator.STR_NAME_JBOSS)) return new JBoss4(DTDescriptor);
98.94 + if (serverType.equals(ServerNavigatorOperator.STR_NAME_GLASSFISH_V1) ||
98.95 + serverType.equals(ServerNavigatorOperator.STR_NAME_GLASSFISH_V2) ||
98.96 + serverType.equals(ServerNavigatorOperator.STR_NAME_APPSERVER)) return new SunApplicationServer(DTDescriptor);
98.97 + if (serverType.equals(ServerNavigatorOperator.STR_NAME_TOMCAT50)) return new Tomcat50(DTDescriptor);
98.98 + if (serverType.equals(ServerNavigatorOperator.STR_NAME_TOMCAT55)) return new Tomcat55(DTDescriptor);
98.99 + if (serverType.equals(ServerNavigatorOperator.STR_NAME_TOMCAT60)) return new Tomcat60(DTDescriptor);
98.100 + return null;
98.101 + }
98.102 +}
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
99.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTarget.java Thu Jul 10 04:32:50 2008 -0700
99.3 @@ -0,0 +1,67 @@
99.4 +/*
99.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
99.6 + *
99.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
99.8 + *
99.9 + * The contents of this file are subject to the terms of either the GNU
99.10 + * General Public License Version 2 only ("GPL") or the Common
99.11 + * Development and Distribution License("CDDL") (collectively, the
99.12 + * "License"). You may not use this file except in compliance with the
99.13 + * License. You can obtain a copy of the License at
99.14 + * http://www.netbeans.org/cddl-gplv2.html
99.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
99.16 + * specific language governing permissions and limitations under the
99.17 + * License. When distributing the software, include this License Header
99.18 + * Notice in each file and include the License file at
99.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
99.20 + * particular file as subject to the "Classpath" exception as provided
99.21 + * by Sun in the GPL Version 2 section of the License file that
99.22 + * accompanied this code. If applicable, add the following below the
99.23 + * License Header, with the fields enclosed by brackets [] replaced by
99.24 + * your own identifying information:
99.25 + * "Portions Copyrighted [year] [name of copyright owner]"
99.26 + *
99.27 + * Contributor(s):
99.28 + *
99.29 + * The Original Software is NetBeans. The Initial Developer of the Original
99.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
99.31 + * Microsystems, Inc. All Rights Reserved.
99.32 + *
99.33 + * If you wish your version of this file to be governed by only the CDDL
99.34 + * or only the GPL Version 2, indicate your decision by adding
99.35 + * "[Contributor] elects to include this software in this distribution
99.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
99.37 + * single choice of license, a recipient has the option to distribute
99.38 + * your version of this file under either the CDDL, the GPL Version 2 or
99.39 + * to extend the choice of license to its licensees as provided above.
99.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
99.41 + * Version 2 license, then the option applies only if the new code is
99.42 + * made subject to such option by the copyright holder.
99.43 + */
99.44 +
99.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
99.46 +
99.47 +/**
99.48 + * Common interface for all deployment targets, describing all general actions and methods.
99.49 + */
99.50 +
99.51 +public interface DeploymentTarget {
99.52 +
99.53 + /**
99.54 + * Deploy project to deployment target.
99.55 + * @param project for deployment.
99.56 + */
99.57 + public void deploy(Object project);
99.58 +
99.59 + /**
99.60 + * Get name of deployment target.
99.61 + * @return String value.
99.62 + */
99.63 + public String getName();
99.64 +
99.65 + /**
99.66 + * Get descriptor of of deployment target.
99.67 + * @return descriptor of deployment target.
99.68 + */
99.69 + public DeploymentTargetDescriptor getDescriptor();
99.70 +}
100.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
100.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTargetDescriptor.java Thu Jul 10 04:32:50 2008 -0700
100.3 @@ -0,0 +1,142 @@
100.4 +/*
100.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
100.6 + *
100.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
100.8 + *
100.9 + * The contents of this file are subject to the terms of either the GNU
100.10 + * General Public License Version 2 only ("GPL") or the Common
100.11 + * Development and Distribution License("CDDL") (collectively, the
100.12 + * "License"). You may not use this file except in compliance with the
100.13 + * License. You can obtain a copy of the License at
100.14 + * http://www.netbeans.org/cddl-gplv2.html
100.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
100.16 + * specific language governing permissions and limitations under the
100.17 + * License. When distributing the software, include this License Header
100.18 + * Notice in each file and include the License file at
100.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
100.20 + * particular file as subject to the "Classpath" exception as provided
100.21 + * by Sun in the GPL Version 2 section of the License file that
100.22 + * accompanied this code. If applicable, add the following below the
100.23 + * License Header, with the fields enclosed by brackets [] replaced by
100.24 + * your own identifying information:
100.25 + * "Portions Copyrighted [year] [name of copyright owner]"
100.26 + *
100.27 + * Contributor(s):
100.28 + *
100.29 + * The Original Software is NetBeans. The Initial Developer of the Original
100.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
100.31 + * Microsystems, Inc. All Rights Reserved.
100.32 + *
100.33 + * If you wish your version of this file to be governed by only the CDDL
100.34 + * or only the GPL Version 2, indicate your decision by adding
100.35 + * "[Contributor] elects to include this software in this distribution
100.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
100.37 + * single choice of license, a recipient has the option to distribute
100.38 + * your version of this file under either the CDDL, the GPL Version 2 or
100.39 + * to extend the choice of license to its licensees as provided above.
100.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
100.41 + * Version 2 license, then the option applies only if the new code is
100.42 + * made subject to such option by the copyright holder.
100.43 + */
100.44 +
100.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
100.46 +
100.47 +import org.netbeans.modules.visualweb.gravy.model.Descriptor;
100.48 +import org.netbeans.modules.visualweb.gravy.RaveTestCase;
100.49 +
100.50 +import java.util.Hashtable;
100.51 +
100.52 +/**
100.53 + * Descriptor for deployment targets.
100.54 + */
100.55 +
100.56 +public class DeploymentTargetDescriptor implements Descriptor{
100.57 +
100.58 + /**
100.59 + * Key for getting deployment target's name from properties.
100.60 + */
100.61 + public static final String NAME_KEY = "deployment.target.name.";
100.62 +
100.63 + /**
100.64 + * Key for getting deployment target's type from properties.
100.65 + */
100.66 + public static final String SERVER_TYPE_KEY = "deployment.target.type";
100.67 +
100.68 + /**
100.69 + * Key for getting deployment target's web request prefix from properties.
100.70 + */
100.71 + public static final String REQUEST_PREFIX_KEY = "deployment.target.prefix.";
100.72 +
100.73 + /**
100.74 + * Key for getting path to deployment target from properties.
100.75 + */
100.76 + public static final String PATH_KEY = "deployment.target.path.";
100.77 +
100.78 + /**
100.79 + * Key for getting deployment target's domain from properties.
100.80 + */
100.81 + public static final String DOMAIN_KEY = "deployment.target.domain.";
100.82 +
100.83 + /**
100.84 + * Key for getting login for deployment target from properties.
100.85 + */
100.86 + public static final String LOGIN_KEY = "deployment.target.login.";
100.87 +
100.88 + /**
100.89 + * Key for getting password for deployment target from properties.
100.90 + */
100.91 + public static final String PASSWORD_KEY = "deployment.target.password.";
100.92 +
100.93 + /**
100.94 + * Deployment target's properties.
100.95 + */
100.96 + private Hashtable properties = new Hashtable();
100.97 +
100.98 + /**
100.99 + * Return deployment target's properties.
100.100 + * @return Hashtable of properties.
100.101 + */
100.102 + public Hashtable getProperties() {
100.103 + return properties;
100.104 + }
100.105 +
100.106 + /**
100.107 + * Get value of specified deployment target's property.
100.108 + * @param propertyName Name of necessary property.
100.109 + * @return String value of property.
100.110 + */
100.111 + public String getProperty(String propertyName) {
100.112 + return properties.get(propertyName).toString();
100.113 + }
100.114 +
100.115 + /**
100.116 + * Set value for specified deployment target's property.
100.117 + * @param propertyName Name of necessary property.
100.118 + * @param propertyValue Value for necessary property.
100.119 + */
100.120 + public void setProperty(String propertyName, String propertyValue) {
100.121 + properties.put(propertyName, propertyValue);
100.122 + }
100.123 +
100.124 + /**
100.125 + * Load deployment target's properties.
100.126 + */
100.127 + public void load() {
100.128 + properties = RaveTestCase.getDeploymentTargetProperties();
100.129 + }
100.130 +
100.131 + /**
100.132 + * Load deployment target's properties from specified file.
100.133 + * @param path_to_file Path to file with properties.
100.134 + */
100.135 + public void load(String path_to_file) {
100.136 + properties = RaveTestCase.getDeploymentTargetProperties(path_to_file);
100.137 + }
100.138 +
100.139 + /**
100.140 + * Load default deployment target's properties.
100.141 + */
100.142 + public void loadDefault() {
100.143 + properties = RaveTestCase.getDefaultDeploymentTargetProperties();
100.144 + }
100.145 +}
101.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
101.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTargetFactory.java Thu Jul 10 04:32:50 2008 -0700
101.3 @@ -0,0 +1,68 @@
101.4 +/*
101.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
101.6 + *
101.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
101.8 + *
101.9 + * The contents of this file are subject to the terms of either the GNU
101.10 + * General Public License Version 2 only ("GPL") or the Common
101.11 + * Development and Distribution License("CDDL") (collectively, the
101.12 + * "License"). You may not use this file except in compliance with the
101.13 + * License. You can obtain a copy of the License at
101.14 + * http://www.netbeans.org/cddl-gplv2.html
101.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
101.16 + * specific language governing permissions and limitations under the
101.17 + * License. When distributing the software, include this License Header
101.18 + * Notice in each file and include the License file at
101.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
101.20 + * particular file as subject to the "Classpath" exception as provided
101.21 + * by Sun in the GPL Version 2 section of the License file that
101.22 + * accompanied this code. If applicable, add the following below the
101.23 + * License Header, with the fields enclosed by brackets [] replaced by
101.24 + * your own identifying information:
101.25 + * "Portions Copyrighted [year] [name of copyright owner]"
101.26 + *
101.27 + * Contributor(s):
101.28 + *
101.29 + * The Original Software is NetBeans. The Initial Developer of the Original
101.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
101.31 + * Microsystems, Inc. All Rights Reserved.
101.32 + *
101.33 + * If you wish your version of this file to be governed by only the CDDL
101.34 + * or only the GPL Version 2, indicate your decision by adding
101.35 + * "[Contributor] elects to include this software in this distribution
101.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
101.37 + * single choice of license, a recipient has the option to distribute
101.38 + * your version of this file under either the CDDL, the GPL Version 2 or
101.39 + * to extend the choice of license to its licensees as provided above.
101.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
101.41 + * Version 2 license, then the option applies only if the new code is
101.42 + * made subject to such option by the copyright holder.
101.43 + */
101.44 +
101.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
101.46 +
101.47 +/**
101.48 + * Factory for creation deployment targets.
101.49 + */
101.50 +
101.51 +public abstract class DeploymentTargetFactory {
101.52 +
101.53 + /**
101.54 + * Create new deployment target.
101.55 + * Add created deployment target to List, if deployemnt target isn't contained in it.
101.56 + * @param DTDescriptor Descriptor of deployment target.
101.57 + * @return created deployment target.
101.58 + */
101.59 + public final DeploymentTarget create(DeploymentTargetDescriptor DTDescriptor){
101.60 + DeploymentTarget dt = createInstance(DTDescriptor);
101.61 + if (!DeploymentTargetList.getList().contains(dt)) DeploymentTargetList.add(dt);
101.62 + return dt;
101.63 + }
101.64 +
101.65 + /**
101.66 + * Create new deployment target.
101.67 + * @param DTDescriptor Descriptor of deployment target.
101.68 + * @return created deployment target.
101.69 + */
101.70 + abstract protected DeploymentTarget createInstance(DeploymentTargetDescriptor DTDescriptor);
101.71 +}
102.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
102.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTargetList.java Thu Jul 10 04:32:50 2008 -0700
102.3 @@ -0,0 +1,108 @@
102.4 +/*
102.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
102.6 + *
102.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
102.8 + *
102.9 + * The contents of this file are subject to the terms of either the GNU
102.10 + * General Public License Version 2 only ("GPL") or the Common
102.11 + * Development and Distribution License("CDDL") (collectively, the
102.12 + * "License"). You may not use this file except in compliance with the
102.13 + * License. You can obtain a copy of the License at
102.14 + * http://www.netbeans.org/cddl-gplv2.html
102.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
102.16 + * specific language governing permissions and limitations under the
102.17 + * License. When distributing the software, include this License Header
102.18 + * Notice in each file and include the License file at
102.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
102.20 + * particular file as subject to the "Classpath" exception as provided
102.21 + * by Sun in the GPL Version 2 section of the License file that
102.22 + * accompanied this code. If applicable, add the following below the
102.23 + * License Header, with the fields enclosed by brackets [] replaced by
102.24 + * your own identifying information:
102.25 + * "Portions Copyrighted [year] [name of copyright owner]"
102.26 + *
102.27 + * Contributor(s):
102.28 + *
102.29 + * The Original Software is NetBeans. The Initial Developer of the Original
102.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
102.31 + * Microsystems, Inc. All Rights Reserved.
102.32 + *
102.33 + * If you wish your version of this file to be governed by only the CDDL
102.34 + * or only the GPL Version 2, indicate your decision by adding
102.35 + * "[Contributor] elects to include this software in this distribution
102.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
102.37 + * single choice of license, a recipient has the option to distribute
102.38 + * your version of this file under either the CDDL, the GPL Version 2 or
102.39 + * to extend the choice of license to its licensees as provided above.
102.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
102.41 + * Version 2 license, then the option applies only if the new code is
102.42 + * made subject to such option by the copyright holder.
102.43 + */
102.44 +
102.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
102.46 +
102.47 +import java.util.List;
102.48 +import java.util.ArrayList;
102.49 +
102.50 +/**
102.51 + * List of deployment targets.
102.52 + */
102.53 +
102.54 +public class DeploymentTargetList {
102.55 +
102.56 + /**
102.57 + * Default deployment target.
102.58 + */
102.59 + private DeploymentTarget defaultDT;
102.60 +
102.61 + /**
102.62 + * List of deployment targets.
102.63 + */
102.64 + private static List DTList = new ArrayList();;
102.65 +
102.66 + /**
102.67 + * Create new DeploymentTargetList.
102.68 + */
102.69 + public DeploymentTargetList() {
102.70 + }
102.71 +
102.72 + /**
102.73 + * Get list of deployment targets.
102.74 + * @return List of deployment targets.
102.75 + */
102.76 + public static List getList() {
102.77 + return DTList;
102.78 + }
102.79 +
102.80 + /**
102.81 + * Add deployment target to List.
102.82 + * @param dt Deployment Target for add.
102.83 + */
102.84 + public static void add(DeploymentTarget dt) {
102.85 + DTList.add(dt);
102.86 + }
102.87 +
102.88 + /**
102.89 + * Remove deployment target from List.
102.90 + * @param dt Deployment Target for remove.
102.91 + */
102.92 + public static void remove(DeploymentTarget dt) {
102.93 + DTList.remove(dt);
102.94 + }
102.95 +
102.96 + /**
102.97 + * Return default deployment target.
102.98 + * @return defaultDT variable.
102.99 + */
102.100 + public DeploymentTarget getDefaultDT() {
102.101 + return defaultDT;
102.102 + }
102.103 +
102.104 + /**
102.105 + * Set default deployment target.
102.106 + * @param dt Deployment Target to be set as default.
102.107 + */
102.108 + public void setDefaultDT(DeploymentTarget dt) {
102.109 + defaultDT = dt;
102.110 + }
102.111 +}
103.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
103.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/JBoss4.java Thu Jul 10 04:32:50 2008 -0700
103.3 @@ -0,0 +1,79 @@
103.4 +/*
103.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
103.6 + *
103.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
103.8 + *
103.9 + * The contents of this file are subject to the terms of either the GNU
103.10 + * General Public License Version 2 only ("GPL") or the Common
103.11 + * Development and Distribution License("CDDL") (collectively, the
103.12 + * "License"). You may not use this file except in compliance with the
103.13 + * License. You can obtain a copy of the License at
103.14 + * http://www.netbeans.org/cddl-gplv2.html
103.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
103.16 + * specific language governing permissions and limitations under the
103.17 + * License. When distributing the software, include this License Header
103.18 + * Notice in each file and include the License file at
103.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
103.20 + * particular file as subject to the "Classpath" exception as provided
103.21 + * by Sun in the GPL Version 2 section of the License file that
103.22 + * accompanied this code. If applicable, add the following below the
103.23 + * License Header, with the fields enclosed by brackets [] replaced by
103.24 + * your own identifying information:
103.25 + * "Portions Copyrighted [year] [name of copyright owner]"
103.26 + *
103.27 + * Contributor(s):
103.28 + *
103.29 + * The Original Software is NetBeans. The Initial Developer of the Original
103.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
103.31 + * Microsystems, Inc. All Rights Reserved.
103.32 + *
103.33 + * If you wish your version of this file to be governed by only the CDDL
103.34 + * or only the GPL Version 2, indicate your decision by adding
103.35 + * "[Contributor] elects to include this software in this distribution
103.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
103.37 + * single choice of license, a recipient has the option to distribute
103.38 + * your version of this file under either the CDDL, the GPL Version 2 or
103.39 + * to extend the choice of license to its licensees as provided above.
103.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
103.41 + * Version 2 license, then the option applies only if the new code is
103.42 + * made subject to such option by the copyright holder.
103.43 + */
103.44 +
103.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
103.46 +
103.47 +/**
103.48 + * Class representing JBoss Application Servers.
103.49 + */
103.50 +
103.51 +public class JBoss4 extends ApplicationServer {
103.52 +
103.53 + public final static String SERVER_START_PROFILE = "Start in Profile Mode";
103.54 + public final static String SERVER_VIEW_JMX = "View JMX Console";
103.55 + public final static String APPLICATION_OPEN = "Open in Browser";
103.56 + public final static String applications_node = "Applications";
103.57 + public final static String web_applications_node = "Web Applications";
103.58 +
103.59 + {
103.60 + this.SERVER_VIEW_LOG = "View Server Log";
103.61 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
103.62 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
103.63 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
103.64 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
103.65 + {PROPERTIES, "true", "true"},*/ {SERVER_VIEW_CONSOLE, "true", "true"},
103.66 + {SERVER_VIEW_JMX, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
103.67 + {PROPERTIES, "true", "true"}};
103.68 + this.application_popup = new String[] {APPLICATION_OPEN, APPLICATION_UNDEPLOY};
103.69 + this.app_pref = "";
103.70 + }
103.71 +
103.72 + /**
103.73 + * Creates JBoss4 with specified descriptor.
103.74 + * @param DTDescriptor Descriptor of JBoss Application Server.
103.75 + */
103.76 + public JBoss4(DeploymentTargetDescriptor DTDescriptor) {
103.77 + setDescriptor(DTDescriptor);
103.78 + this.web_applications_path = getName() + "|" + applications_node + "|" + web_applications_node;
103.79 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
103.80 + this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
103.81 + }
103.82 +}
104.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
104.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/SunApplicationServer.java Thu Jul 10 04:32:50 2008 -0700
104.3 @@ -0,0 +1,83 @@
104.4 +/*
104.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
104.6 + *
104.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
104.8 + *
104.9 + * The contents of this file are subject to the terms of either the GNU
104.10 + * General Public License Version 2 only ("GPL") or the Common
104.11 + * Development and Distribution License("CDDL") (collectively, the
104.12 + * "License"). You may not use this file except in compliance with the
104.13 + * License. You can obtain a copy of the License at
104.14 + * http://www.netbeans.org/cddl-gplv2.html
104.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
104.16 + * specific language governing permissions and limitations under the
104.17 + * License. When distributing the software, include this License Header
104.18 + * Notice in each file and include the License file at
104.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
104.20 + * particular file as subject to the "Classpath" exception as provided
104.21 + * by Sun in the GPL Version 2 section of the License file that
104.22 + * accompanied this code. If applicable, add the following below the
104.23 + * License Header, with the fields enclosed by brackets [] replaced by
104.24 + * your own identifying information:
104.25 + * "Portions Copyrighted [year] [name of copyright owner]"
104.26 + *
104.27 + * Contributor(s):
104.28 + *
104.29 + * The Original Software is NetBeans. The Initial Developer of the Original
104.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
104.31 + * Microsystems, Inc. All Rights Reserved.
104.32 + *
104.33 + * If you wish your version of this file to be governed by only the CDDL
104.34 + * or only the GPL Version 2, indicate your decision by adding
104.35 + * "[Contributor] elects to include this software in this distribution
104.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
104.37 + * single choice of license, a recipient has the option to distribute
104.38 + * your version of this file under either the CDDL, the GPL Version 2 or
104.39 + * to extend the choice of license to its licensees as provided above.
104.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
104.41 + * Version 2 license, then the option applies only if the new code is
104.42 + * made subject to such option by the copyright holder.
104.43 + */
104.44 +
104.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
104.46 +
104.47 +/**
104.48 + * Class representing Sun Application Servers.
104.49 + */
104.50 +
104.51 +public class SunApplicationServer extends ApplicationServer {
104.52 +
104.53 + public final static String SERVER_START_PROFILE = "Start in Profile Mode";
104.54 + public final static String RESOURCE_DELETE = "Delete Resource";
104.55 + public final static String applications_node = "Applications";
104.56 + public final static String web_applications_node = "Web Applications";
104.57 + public final static String resources_node = "Resources";
104.58 + public final static String jdbc_node = "JDBC";
104.59 + public final static String jdbc_resources_node = "JDBC Resources";
104.60 +
104.61 + {
104.62 + this.SERVER_VIEW_LOG = "View Server Log";
104.63 + this.APPLICATION_DISABLE = "Disable";
104.64 + this.APPLICATION_ENABLE = "Enable";
104.65 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
104.66 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
104.67 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
104.68 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
104.69 + {PROPERTIES, "true", "true"},*/ {SERVER_VIEW_CONSOLE, "true", "true"},
104.70 + {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
104.71 + this.application_popup = new String[] {APPLICATION_UNDEPLOY, APPLICATION_DISABLE, PROPERTIES};
104.72 + this.app_pref = "";
104.73 + }
104.74 +
104.75 + /**
104.76 + * Creates SunApplicationServer with specified descriptor.
104.77 + * @param DTDescriptor Descriptor of Sun Application Server.
104.78 + */
104.79 + public SunApplicationServer(DeploymentTargetDescriptor DTDescriptor) {
104.80 + setDescriptor(DTDescriptor);
104.81 + this.web_applications_path = getName() + "|" + applications_node + "|" + web_applications_node;
104.82 + this.jdbc_resources_path = getName() + "|" + resources_node + "|" + jdbc_node + "|" + jdbc_resources_node;
104.83 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
104.84 + this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
104.85 + }
104.86 +}
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
105.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/Tomcat50.java Thu Jul 10 04:32:50 2008 -0700
105.3 @@ -0,0 +1,93 @@
105.4 +/*
105.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
105.6 + *
105.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
105.8 + *
105.9 + * The contents of this file are subject to the terms of either the GNU
105.10 + * General Public License Version 2 only ("GPL") or the Common
105.11 + * Development and Distribution License("CDDL") (collectively, the
105.12 + * "License"). You may not use this file except in compliance with the
105.13 + * License. You can obtain a copy of the License at
105.14 + * http://www.netbeans.org/cddl-gplv2.html
105.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
105.16 + * specific language governing permissions and limitations under the
105.17 + * License. When distributing the software, include this License Header
105.18 + * Notice in each file and include the License file at
105.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
105.20 + * particular file as subject to the "Classpath" exception as provided
105.21 + * by Sun in the GPL Version 2 section of the License file that
105.22 + * accompanied this code. If applicable, add the following below the
105.23 + * License Header, with the fields enclosed by brackets [] replaced by
105.24 + * your own identifying information:
105.25 + * "Portions Copyrighted [year] [name of copyright owner]"
105.26 + *
105.27 + * Contributor(s):
105.28 + *
105.29 + * The Original Software is NetBeans. The Initial Developer of the Original
105.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
105.31 + * Microsystems, Inc. All Rights Reserved.
105.32 + *
105.33 + * If you wish your version of this file to be governed by only the CDDL
105.34 + * or only the GPL Version 2, indicate your decision by adding
105.35 + * "[Contributor] elects to include this software in this distribution
105.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
105.37 + * single choice of license, a recipient has the option to distribute
105.38 + * your version of this file under either the CDDL, the GPL Version 2 or
105.39 + * to extend the choice of license to its licensees as provided above.
105.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
105.41 + * Version 2 license, then the option applies only if the new code is
105.42 + * made subject to such option by the copyright holder.
105.43 + */
105.44 +
105.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
105.46 +
105.47 +/**
105.48 + * Class representing Tomcat 5.0 Application Servers.
105.49 + */
105.50 +
105.51 +public class Tomcat50 extends ApplicationServer {
105.52 +
105.53 + public final static String SERVER_START_PROFILE = "Start in Profile Mode";
105.54 + public final static String SERVER_EDIT_XML = "Edit server.xml";
105.55 + public final static String SERVER_VIEW_CONTEXT_LOG = "View Shared Context Log";
105.56 + public final static String SERVER_TERMINATE = "Terminate";
105.57 + public final static String APPLICATION_OPEN = "Open in Browser";
105.58 + public final static String APPLICATION_VIEW_LOG = "View Context Log";
105.59 + public final static String web_applications_node = "Web Applications";
105.60 +
105.61 + {
105.62 + this.SERVER_VIEW_LOG = "View Server Output";
105.63 + this.APPLICATION_DISABLE = "Stop";
105.64 + this.APPLICATION_ENABLE = "Start";
105.65 + if (System.getProperty("os.name").indexOf("Windows") == -1)
105.66 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
105.67 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
105.68 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
105.69 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
105.70 + {PROPERTIES, "true", "true"},*/ {SERVER_TERMINATE, "true", "false"},
105.71 + {SERVER_EDIT_XML, "true", "true"}, {SERVER_VIEW_CONSOLE, "true", "true"},
105.72 + {SERVER_VIEW_CONTEXT_LOG, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
105.73 + {PROPERTIES, "true", "true"}};
105.74 + else
105.75 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
105.76 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
105.77 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
105.78 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
105.79 + {PROPERTIES, "true", "true"},*/ {SERVER_EDIT_XML, "true", "true"},
105.80 + {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_CONTEXT_LOG, "true", "true"},
105.81 + {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
105.82 + this.application_popup = new String[] {APPLICATION_ENABLE, APPLICATION_DISABLE, APPLICATION_OPEN, APPLICATION_VIEW_LOG, APPLICATION_UNDEPLOY};
105.83 + this.app_pref = "/";
105.84 + }
105.85 +
105.86 + /**
105.87 + * Creates Tomcat50 with specified descriptor.
105.88 + * @param DTDescriptor Descriptor of Tomcat 5.0 Application Server.
105.89 + */
105.90 + public Tomcat50(DeploymentTargetDescriptor DTDescriptor) {
105.91 + setDescriptor(DTDescriptor);
105.92 + this.web_applications_path = getName() + "|" + web_applications_node;
105.93 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
105.94 + this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
105.95 + }
105.96 +}
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
106.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/Tomcat55.java Thu Jul 10 04:32:50 2008 -0700
106.3 @@ -0,0 +1,93 @@
106.4 +/*
106.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
106.6 + *
106.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
106.8 + *
106.9 + * The contents of this file are subject to the terms of either the GNU
106.10 + * General Public License Version 2 only ("GPL") or the Common
106.11 + * Development and Distribution License("CDDL") (collectively, the
106.12 + * "License"). You may not use this file except in compliance with the
106.13 + * License. You can obtain a copy of the License at
106.14 + * http://www.netbeans.org/cddl-gplv2.html
106.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
106.16 + * specific language governing permissions and limitations under the
106.17 + * License. When distributing the software, include this License Header
106.18 + * Notice in each file and include the License file at
106.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
106.20 + * particular file as subject to the "Classpath" exception as provided
106.21 + * by Sun in the GPL Version 2 section of the License file that
106.22 + * accompanied this code. If applicable, add the following below the
106.23 + * License Header, with the fields enclosed by brackets [] replaced by
106.24 + * your own identifying information:
106.25 + * "Portions Copyrighted [year] [name of copyright owner]"
106.26 + *
106.27 + * Contributor(s):
106.28 + *
106.29 + * The Original Software is NetBeans. The Initial Developer of the Original
106.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
106.31 + * Microsystems, Inc. All Rights Reserved.
106.32 + *
106.33 + * If you wish your version of this file to be governed by only the CDDL
106.34 + * or only the GPL Version 2, indicate your decision by adding
106.35 + * "[Contributor] elects to include this software in this distribution
106.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
106.37 + * single choice of license, a recipient has the option to distribute
106.38 + * your version of this file under either the CDDL, the GPL Version 2 or
106.39 + * to extend the choice of license to its licensees as provided above.
106.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
106.41 + * Version 2 license, then the option applies only if the new code is
106.42 + * made subject to such option by the copyright holder.
106.43 + */
106.44 +
106.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
106.46 +
106.47 +/**
106.48 + * Class representing Tomcat 5.5 Application Servers.
106.49 + */
106.50 +
106.51 +public class Tomcat55 extends ApplicationServer {
106.52 +
106.53 + public final static String SERVER_START_PROFILE = "Start in Profile Mode";
106.54 + public final static String SERVER_EDIT_XML = "Edit server.xml";
106.55 + public final static String SERVER_VIEW_CONTEXT_LOG = "View Server Log";
106.56 + public final static String SERVER_TERMINATE = "Terminate";
106.57 + public final static String APPLICATION_OPEN = "Open in Browser";
106.58 + public final static String web_applications_node = "Web Applications";
106.59 +
106.60 +
106.61 + {
106.62 + this.SERVER_VIEW_LOG = "View Server Output";
106.63 + this.APPLICATION_DISABLE = "Stop";
106.64 + this.APPLICATION_ENABLE = "Start";
106.65 + if (System.getProperty("os.name").indexOf("Windows") == -1)
106.66 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
106.67 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
106.68 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
106.69 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
106.70 + {PROPERTIES, "true", "true"},*/ {SERVER_TERMINATE, "true", "false"},
106.71 + {SERVER_EDIT_XML, "true", "true"}, {SERVER_VIEW_CONSOLE, "true", "true"},
106.72 + {SERVER_VIEW_CONTEXT_LOG, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
106.73 + {PROPERTIES, "true", "true"}};
106.74 + else
106.75 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
106.76 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
106.77 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
106.78 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
106.79 + {PROPERTIES, "true", "true"},*/ {SERVER_EDIT_XML, "true", "true"},
106.80 + {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_CONTEXT_LOG, "true", "true"},
106.81 + {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
106.82 + this.application_popup = new String[] {APPLICATION_ENABLE, APPLICATION_DISABLE, APPLICATION_OPEN, APPLICATION_UNDEPLOY};
106.83 + this.app_pref = "/";
106.84 + }
106.85 +
106.86 + /**
106.87 + * Creates Tomcat55 with specified descriptor.
106.88 + * @param DTDescriptor Descriptor of Tomcat 5.5 Application Server.
106.89 + */
106.90 + public Tomcat55(DeploymentTargetDescriptor DTDescriptor) {
106.91 + setDescriptor(DTDescriptor);
106.92 + this.web_applications_path = getName() + "|" + web_applications_node;
106.93 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
106.94 + this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
106.95 + }
106.96 +}
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
107.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/Tomcat60.java Thu Jul 10 04:32:50 2008 -0700
107.3 @@ -0,0 +1,90 @@
107.4 +/*
107.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
107.6 + *
107.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
107.8 + *
107.9 + * The contents of this file are subject to the terms of either the GNU
107.10 + * General Public License Version 2 only ("GPL") or the Common
107.11 + * Development and Distribution License("CDDL") (collectively, the
107.12 + * "License"). You may not use this file except in compliance with the
107.13 + * License. You can obtain a copy of the License at
107.14 + * http://www.netbeans.org/cddl-gplv2.html
107.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
107.16 + * specific language governing permissions and limitations under the
107.17 + * License. When distributing the software, include this License Header
107.18 + * Notice in each file and include the License file at
107.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
107.20 + * particular file as subject to the "Classpath" exception as provided
107.21 + * by Sun in the GPL Version 2 section of the License file that
107.22 + * accompanied this code. If applicable, add the following below the
107.23 + * License Header, with the fields enclosed by brackets [] replaced by
107.24 + * your own identifying information:
107.25 + * "Portions Copyrighted [year] [name of copyright owner]"
107.26 + *
107.27 + * Contributor(s):
107.28 + *
107.29 + * The Original Software is NetBeans. The Initial Developer of the Original
107.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
107.31 + * Microsystems, Inc. All Rights Reserved.
107.32 + *
107.33 + * If you wish your version of this file to be governed by only the CDDL
107.34 + * or only the GPL Version 2, indicate your decision by adding
107.35 + * "[Contributor] elects to include this software in this distribution
107.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
107.37 + * single choice of license, a recipient has the option to distribute
107.38 + * your version of this file under either the CDDL, the GPL Version 2 or
107.39 + * to extend the choice of license to its licensees as provided above.
107.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
107.41 + * Version 2 license, then the option applies only if the new code is
107.42 + * made subject to such option by the copyright holder.
107.43 + */
107.44 +
107.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
107.46 +
107.47 +/**
107.48 + * Class representing Tomcat 6.0 Application Servers.
107.49 + */
107.50 +
107.51 +public class Tomcat60 extends ApplicationServer {
107.52 +
107.53 + public final static String SERVER_START_PROFILE = "Start in Profile Mode";
107.54 + public final static String SERVER_EDIT_XML = "Edit server.xml";
107.55 + public final static String SERVER_TERMINATE = "Terminate";
107.56 + public final static String APPLICATION_OPEN = "Open in Browser";
107.57 + public final static String web_applications_node = "Web Applications";
107.58 +
107.59 + {
107.60 + this.SERVER_VIEW_LOG = "View Server Output";
107.61 + this.APPLICATION_DISABLE = "Stop";
107.62 + this.APPLICATION_ENABLE = "Start";
107.63 + if (System.getProperty("os.name").indexOf("Windows") == -1)
107.64 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
107.65 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
107.66 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
107.67 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
107.68 + {PROPERTIES, "true", "true"},*/ {SERVER_TERMINATE, "true", "false"},
107.69 + {SERVER_EDIT_XML, "true", "true"}, {SERVER_VIEW_CONSOLE, "true", "true"},
107.70 + {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
107.71 + else
107.72 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
107.73 + {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
107.74 + {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
107.75 + {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
107.76 + {PROPERTIES, "true", "true"},*/ {SERVER_EDIT_XML, "true", "true"},
107.77 + {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
107.78 + {PROPERTIES, "true", "true"}};
107.79 + this.application_popup = new String[] {APPLICATION_ENABLE, APPLICATION_DISABLE, APPLICATION_OPEN, APPLICATION_UNDEPLOY};
107.80 + this.app_pref = "/";
107.81 + }
107.82 +
107.83 + /**
107.84 + * Creates Tomcat55 with specified descriptor.
107.85 + * @param DTDescriptor Descriptor of Tomcat 5.5 Application Server.
107.86 + */
107.87 + public Tomcat60(DeploymentTargetDescriptor DTDescriptor) {
107.88 + setDescriptor(DTDescriptor);
107.89 + this.web_applications_path = getName() + "|" + web_applications_node;
107.90 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
107.91 + this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
107.92 + }
107.93 +}
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
108.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/WebLogic9.java Thu Jul 10 04:32:50 2008 -0700
108.3 @@ -0,0 +1,69 @@
108.4 +/*
108.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
108.6 + *
108.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
108.8 + *
108.9 + * The contents of this file are subject to the terms of either the GNU
108.10 + * General Public License Version 2 only ("GPL") or the Common
108.11 + * Development and Distribution License("CDDL") (collectively, the
108.12 + * "License"). You may not use this file except in compliance with the
108.13 + * License. You can obtain a copy of the License at
108.14 + * http://www.netbeans.org/cddl-gplv2.html
108.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
108.16 + * specific language governing permissions and limitations under the
108.17 + * License. When distributing the software, include this License Header
108.18 + * Notice in each file and include the License file at
108.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
108.20 + * particular file as subject to the "Classpath" exception as provided
108.21 + * by Sun in the GPL Version 2 section of the License file that
108.22 + * accompanied this code. If applicable, add the following below the
108.23 + * License Header, with the fields enclosed by brackets [] replaced by
108.24 + * your own identifying information:
108.25 + * "Portions Copyrighted [year] [name of copyright owner]"
108.26 + *
108.27 + * Contributor(s):
108.28 + *
108.29 + * The Original Software is NetBeans. The Initial Developer of the Original
108.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
108.31 + * Microsystems, Inc. All Rights Reserved.
108.32 + *
108.33 + * If you wish your version of this file to be governed by only the CDDL
108.34 + * or only the GPL Version 2, indicate your decision by adding
108.35 + * "[Contributor] elects to include this software in this distribution
108.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
108.37 + * single choice of license, a recipient has the option to distribute
108.38 + * your version of this file under either the CDDL, the GPL Version 2 or
108.39 + * to extend the choice of license to its licensees as provided above.
108.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
108.41 + * Version 2 license, then the option applies only if the new code is
108.42 + * made subject to such option by the copyright holder.
108.43 + */
108.44 +
108.45 +package org.netbeans.modules.visualweb.gravy.model.deployment;
108.46 +
108.47 +/**
108.48 + * Class representing BEA WebLogic Application Servers.
108.49 + */
108.50 +
108.51 +public class WebLogic9 extends ApplicationServer {
108.52 +
108.53 + {
108.54 + this.SERVER_VIEW_LOG = "View Server Log";
108.55 + this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
108.56 + {SERVER_RESTART, "true", "false"}, {SERVER_STOP, "true", "false"},
108.57 + {REFRESH, "true", "true"}, {SERVER_REMOVE, "true", "true"},/*
108.58 + {SERVER_CUSTOMIZE, "true", "true"}, {PROPERTIES, "true", "true"},*/
108.59 + {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
108.60 + {PROPERTIES, "true", "true"}};
108.61 + }
108.62 +
108.63 + /**
108.64 + * Creates WebLogic9 with specified descriptor.
108.65 + * @param DTDescriptor Descriptor of WebLogic Application Server.
108.66 + */
108.67 + public WebLogic9(DeploymentTargetDescriptor DTDescriptor) {
108.68 + setDescriptor(DTDescriptor);
108.69 + String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
108.70 + this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
108.71 + }
108.72 +}
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
109.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/Bundle.properties Thu Jul 10 04:32:50 2008 -0700
109.3 @@ -0,0 +1,58 @@
109.4 +/*
109.5 +
109.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
109.7 + *
109.8 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
109.9 +
109.10 + *
109.11 + * The contents of this file are subject to the terms of either the GNU
109.12 + * General Public License Version 2 only ("GPL") or the Common
109.13 + * Development and Distribution License("CDDL") (collectively, the
109.14 + * "License"). You may not use this file except in compliance with the
109.15 + * License. You can obtain a copy of the License at
109.16 + * http://www.netbeans.org/cddl-gplv2.html
109.17 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
109.18 + * specific language governing permissions and limitations under the
109.19 + * License. When distributing the software, include this License Header
109.20 + * Notice in each file and include the License file at
109.21 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
109.22 + * particular file as subject to the "Classpath" exception as provided
109.23 + * by Sun in the GPL Version 2 section of the License file that
109.24 + * accompanied this code. If applicable, add the following below the
109.25 + * License Header, with the fields enclosed by brackets [] replaced by
109.26 + * your own identifying information:
109.27 + * "Portions Copyrighted [year] [name of copyright owner]"
109.28 + *
109.29 + * Contributor(s):
109.30 +
109.31 + *
109.32 +
109.33 + * The Original Software is NetBeans. The Initial Developer of the Original
109.34 +
109.35 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
109.36 +
109.37 + * Microsystems, Inc. All Rights Reserved.
109.38 + *
109.39 + * If you wish your version of this file to be governed by only the CDDL
109.40 + * or only the GPL Version 2, indicate your decision by adding
109.41 + * "[Contributor] elects to include this software in this distribution
109.42 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
109.43 + * single choice of license, a recipient has the option to distribute
109.44 + * your version of this file under either the CDDL, the GPL Version 2 or
109.45 + * to extend the choice of license to its licensees as provided above.
109.46 + * However, if you add GPL Version 2 code and therefore, elected the GPL
109.47 + * Version 2 license, then the option applies only if the new code is
109.48 + * made subject to such option by the copyright holder.
109.49 +
109.50 + */
109.51 +
109.52 +
109.53 +
109.54 +#properties for navigation and rave navigation bundle
109.55 +
109.56 +NavigationBundle=org.netbeans.modules.visualweb.project.navigationloader.Bundle
109.57 +
109.58 +PageNavigation=CTL_NavigationTCDisplayName
109.59 +
109.60 +OpenPopupItem=Open
109.61 +
110.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
110.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/Link.java Thu Jul 10 04:32:50 2008 -0700
110.3 @@ -0,0 +1,83 @@
110.4 +/*
110.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
110.6 + *
110.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
110.8 + *
110.9 + * The contents of this file are subject to the terms of either the GNU
110.10 + * General Public License Version 2 only ("GPL") or the Common
110.11 + * Development and Distribution License("CDDL") (collectively, the
110.12 + * "License"). You may not use this file except in compliance with the
110.13 + * License. You can obtain a copy of the License at
110.14 + * http://www.netbeans.org/cddl-gplv2.html
110.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
110.16 + * specific language governing permissions and limitations under the
110.17 + * License. When distributing the software, include this License Header
110.18 + * Notice in each file and include the License file at
110.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
110.20 + * particular file as subject to the "Classpath" exception as provided
110.21 + * by Sun in the GPL Version 2 section of the License file that
110.22 + * accompanied this code. If applicable, add the following below the
110.23 + * License Header, with the fields enclosed by brackets [] replaced by
110.24 + * your own identifying information:
110.25 + * "Portions Copyrighted [year] [name of copyright owner]"
110.26 + *
110.27 + * Contributor(s):
110.28 + *
110.29 + * The Original Software is NetBeans. The Initial Developer of the Original
110.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
110.31 + * Microsystems, Inc. All Rights Reserved.
110.32 + *
110.33 + * If you wish your version of this file to be governed by only the CDDL
110.34 + * or only the GPL Version 2, indicate your decision by adding
110.35 + * "[Contributor] elects to include this software in this distribution
110.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
110.37 + * single choice of license, a recipient has the option to distribute
110.38 + * your version of this file under either the CDDL, the GPL Version 2 or
110.39 + * to extend the choice of license to its licensees as provided above.
110.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
110.41 + * Version 2 license, then the option applies only if the new code is
110.42 + * made subject to such option by the copyright holder.
110.43 + */
110.44 +
110.45 +package org.netbeans.modules.visualweb.gravy.model.navigation;
110.46 +
110.47 +/**
110.48 + * Class for links.
110.49 + */
110.50 +
110.51 +public class Link {
110.52 +
110.53 + String name;
110.54 + LinkableSource source;
110.55 + LinkableTarget target;
110.56 +
110.57 + /**
110.58 + * Create new link from source to target with specified name.
110.59 + */
110.60 + Link(LinkableSource source, LinkableTarget target, String name) {
110.61 + this.source = source;
110.62 + this.target = target;
110.63 + this.name = name;
110.64 + }
110.65 +
110.66 + /**
110.67 + * Get link name.
110.68 + */
110.69 + public String getName() {
110.70 + return name;
110.71 + }
110.72 +
110.73 + /**
110.74 + * Get link source.
110.75 + */
110.76 + public LinkableSource getSource() {
110.77 + return source;
110.78 + }
110.79 +
110.80 + /**
110.81 + * Get link target.
110.82 + */
110.83 + public LinkableTarget getTarget() {
110.84 + return target;
110.85 + }
110.86 +}
111.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
111.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/LinkManager.java Thu Jul 10 04:32:50 2008 -0700
111.3 @@ -0,0 +1,180 @@
111.4 +/*
111.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
111.6 + *
111.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
111.8 + *
111.9 + * The contents of this file are subject to the terms of either the GNU
111.10 + * General Public License Version 2 only ("GPL") or the Common
111.11 + * Development and Distribution License("CDDL") (collectively, the
111.12 + * "License"). You may not use this file except in compliance with the
111.13 + * License. You can obtain a copy of the License at
111.14 + * http://www.netbeans.org/cddl-gplv2.html
111.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
111.16 + * specific language governing permissions and limitations under the
111.17 + * License. When distributing the software, include this License Header
111.18 + * Notice in each file and include the License file at
111.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
111.20 + * particular file as subject to the "Classpath" exception as provided
111.21 + * by Sun in the GPL Version 2 section of the License file that
111.22 + * accompanied this code. If applicable, add the following below the
111.23 + * License Header, with the fields enclosed by brackets [] replaced by
111.24 + * your own identifying information:
111.25 + * "Portions Copyrighted [year] [name of copyright owner]"
111.26 + *
111.27 + * Contributor(s):
111.28 + *
111.29 + * The Original Software is NetBeans. The Initial Developer of the Original
111.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
111.31 + * Microsystems, Inc. All Rights Reserved.
111.32 + *
111.33 + * If you wish your version of this file to be governed by only the CDDL
111.34 + * or only the GPL Version 2, indicate your decision by adding
111.35 + * "[Contributor] elects to include this software in this distribution
111.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
111.37 + * single choice of license, a recipient has the option to distribute
111.38 + * your version of this file under either the CDDL, the GPL Version 2 or
111.39 + * to extend the choice of license to its licensees as provided above.
111.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
111.41 + * Version 2 license, then the option applies only if the new code is
111.42 + * made subject to such option by the copyright holder.
111.43 + */
111.44 +
111.45 +package org.netbeans.modules.visualweb.gravy.model.navigation;
111.46 +
111.47 +import org.netbeans.modules.visualweb.gravy.model.project.*;
111.48 +import org.netbeans.modules.visualweb.gravy.Bundle;
111.49 +import org.netbeans.modules.visualweb.gravy.TestUtils;
111.50 +import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
111.51 +import org.netbeans.modules.visualweb.gravy.navigation.NavigatorOperator;
111.52 +
111.53 +import org.netbeans.jemmy.operators.Operator;
111.54 +import org.netbeans.jemmy.JemmyException;
111.55 +
111.56 +import java.util.ArrayList;
111.57 +import java.util.Hashtable;
111.58 +
111.59 +/**
111.60 + * Class for link managers.
111.61 + */
111.62 +
111.63 +public class LinkManager {
111.64 +
111.65 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.navigation.Bundle";
111.66 + private final static String navigationBundle = Bundle.getStringTrimmed(bundle, "NavigationBundle");
111.67 + private final static String nodeNavigation = Bundle.getStringTrimmed(navigationBundle,
111.68 + Bundle.getStringTrimmed(bundle, "PageNavigation"));
111.69 + private final static String popupOpen = Bundle.getStringTrimmed(bundle, "OpenPopupItem");
111.70 +
111.71 + private Project project;
111.72 + private Hashtable links = new Hashtable();
111.73 +
111.74 + /**
111.75 + * Create new LinkManager for the project.
111.76 + */
111.77 + public LinkManager(Project project) {
111.78 + this.project = project;
111.79 + }
111.80 +
111.81 + /**
111.82 + * Create link with specified parameters.
111.83 + * @param source LinkableSource which link link to.
111.84 + * @param target LinkableTaget which link link from.
111.85 + * @param name Link's name.
111.86 + * @return Created link.
111.87 + */
111.88 + public Link createLink(LinkableSource source, LinkableTarget target, String name) {
111.89 + ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
111.90 + TestUtils.wait(1000);
111.91 + try {
111.92 + prjNav.pressPopupItemOnNode(project.getName() + "|" + nodeNavigation, popupOpen, new Operator.DefaultStringComparator(true, true));
111.93 + }
111.94 + catch(Exception e) {
111.95 + throw new JemmyException(popupOpen + " item in popup menu of " + nodeNavigation + " node can't be found!", e);
111.96 + }
111.97 + TestUtils.wait(1000);
111.98 + NavigatorOperator no = new NavigatorOperator();
111.99 + TestUtils.wait(1000);
111.100 + try {
111.101 + no.linkUsingXmlSource(source.getLinkableSourceName(), target.getLinkableTargetName(), name);
111.102 + }
111.103 + catch(Exception e) {
111.104 + throw new JemmyException("Link can't be created!", e);
111.105 + }
111.106 + TestUtils.wait(1000);
111.107 + Link newLink = new Link(source, target, name);
111.108 + links.put(name, newLink);
111.109 + return newLink;
111.110 + }
111.111 +
111.112 + /**
111.113 + * Change link's source.
111.114 + * @param link Link for modification.
111.115 + * @param source New LinkableSource which link should link to.
111.116 + */
111.117 + public void changeSource(Link link, LinkableSource source) {
111.118 + link.source = source;
111.119 + }
111.120 +
111.121 + /**
111.122 + * Change link's target.
111.123 + * @param link Link for modification.
111.124 + * @param target New LinkableTarget which link should link from.
111.125 + */
111.126 + public void changeTarget(Link link, LinkableTarget target) {
111.127 + link.target = target;
111.128 + }
111.129 +
111.130 + /**
111.131 + * Change link's name.
111.132 + * @param link Link for modification.
111.133 + * @param name New link's name.
111.134 + */
111.135 + public void changeName(Link link, String name) {
111.136 + link.name = name;
111.137 + }
111.138 +
111.139 + /**
111.140 + * Remove link.
111.141 + * @param link Link which should be removed.
111.142 + */
111.143 + public void deleteLink(Link link) {
111.144 + links.remove(link.getName());
111.145 + }
111.146 +
111.147 + /**
111.148 + * Return all links.
111.149 + */
111.150 + public Link[] getLinks() {
111.151 + return ((Link[]) links.values().toArray(new Link[links.size()]));
111.152 + }
111.153 +
111.154 + /**
111.155 + * Return all links with specified source.
111.156 + * @param source LinkableSource which links link to.
111.157 + * @return Array of links.
111.158 + */
111.159 + public Link[] getFromLinks(LinkableSource source) {
111.160 + ArrayList srcLinks = new ArrayList();
111.161 + Link[] tmpLinks = ((Link[]) links.values().toArray(new Link[links.size()]));
111.162 + for (int i = 0; i < tmpLinks.length; i++) {
111.163 + if (tmpLinks[i].getSource().equals(source))
111.164 + srcLinks.add(tmpLinks[i]);
111.165 + }
111.166 + return ((Link[]) srcLinks.toArray(new Link[srcLinks.size()]));
111.167 + }
111.168 +
111.169 + /**
111.170 + * Return all links with specified target.
111.171 + * @param target LinkableTarget which links link from.
111.172 + * @return Array of links.
111.173 + */
111.174 + public Link[] getToLinks(LinkableTarget target) {
111.175 + ArrayList trgLinks = new ArrayList();
111.176 + Link[] tmpLinks = ((Link[]) links.values().toArray(new Link[links.size()]));
111.177 + for (int i = 0; i < tmpLinks.length; i++) {
111.178 + if (tmpLinks[i].getTarget().equals(target))
111.179 + trgLinks.add(tmpLinks[i]);
111.180 + }
111.181 + return ((Link[]) trgLinks.toArray(new Link[trgLinks.size()]));
111.182 + }
111.183 +}
112.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
112.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/LinkableSource.java Thu Jul 10 04:32:50 2008 -0700
112.3 @@ -0,0 +1,55 @@
112.4 +/*
112.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
112.6 + *
112.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
112.8 + *
112.9 + * The contents of this file are subject to the terms of either the GNU
112.10 + * General Public License Version 2 only ("GPL") or the Common
112.11 + * Development and Distribution License("CDDL") (collectively, the
112.12 + * "License"). You may not use this file except in compliance with the
112.13 + * License. You can obtain a copy of the License at
112.14 + * http://www.netbeans.org/cddl-gplv2.html
112.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
112.16 + * specific language governing permissions and limitations under the
112.17 + * License. When distributing the software, include this License Header
112.18 + * Notice in each file and include the License file at
112.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
112.20 + * particular file as subject to the "Classpath" exception as provided
112.21 + * by Sun in the GPL Version 2 section of the License file that
112.22 + * accompanied this code. If applicable, add the following below the
112.23 + * License Header, with the fields enclosed by brackets [] replaced by
112.24 + * your own identifying information:
112.25 + * "Portions Copyrighted [year] [name of copyright owner]"
112.26 + *
112.27 + * Contributor(s):
112.28 + *
112.29 + * The Original Software is NetBeans. The Initial Developer of the Original
112.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
112.31 + * Microsystems, Inc. All Rights Reserved.
112.32 + *
112.33 + * If you wish your version of this file to be governed by only the CDDL
112.34 + * or only the GPL Version 2, indicate your decision by adding
112.35 + * "[Contributor] elects to include this software in this distribution
112.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
112.37 + * single choice of license, a recipient has the option to distribute
112.38 + * your version of this file under either the CDDL, the GPL Version 2 or
112.39 + * to extend the choice of license to its licensees as provided above.
112.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
112.41 + * Version 2 license, then the option applies only if the new code is
112.42 + * made subject to such option by the copyright holder.
112.43 + */
112.44 +
112.45 +package org.netbeans.modules.visualweb.gravy.model.navigation;
112.46 +
112.47 +/**
112.48 + * Common interface for linkable source objects.
112.49 + */
112.50 +
112.51 +public interface LinkableSource {
112.52 +
112.53 + /**
112.54 + * Get name of linkable source.
112.55 + * @return Name of linkable source.
112.56 + */
112.57 + public String getLinkableSourceName();
112.58 +}
113.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
113.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/LinkableTarget.java Thu Jul 10 04:32:50 2008 -0700
113.3 @@ -0,0 +1,55 @@
113.4 +/*
113.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
113.6 + *
113.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
113.8 + *
113.9 + * The contents of this file are subject to the terms of either the GNU
113.10 + * General Public License Version 2 only ("GPL") or the Common
113.11 + * Development and Distribution License("CDDL") (collectively, the
113.12 + * "License"). You may not use this file except in compliance with the
113.13 + * License. You can obtain a copy of the License at
113.14 + * http://www.netbeans.org/cddl-gplv2.html
113.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
113.16 + * specific language governing permissions and limitations under the
113.17 + * License. When distributing the software, include this License Header
113.18 + * Notice in each file and include the License file at
113.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
113.20 + * particular file as subject to the "Classpath" exception as provided
113.21 + * by Sun in the GPL Version 2 section of the License file that
113.22 + * accompanied this code. If applicable, add the following below the
113.23 + * License Header, with the fields enclosed by brackets [] replaced by
113.24 + * your own identifying information:
113.25 + * "Portions Copyrighted [year] [name of copyright owner]"
113.26 + *
113.27 + * Contributor(s):
113.28 + *
113.29 + * The Original Software is NetBeans. The Initial Developer of the Original
113.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
113.31 + * Microsystems, Inc. All Rights Reserved.
113.32 + *
113.33 + * If you wish your version of this file to be governed by only the CDDL
113.34 + * or only the GPL Version 2, indicate your decision by adding
113.35 + * "[Contributor] elects to include this software in this distribution
113.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
113.37 + * single choice of license, a recipient has the option to distribute
113.38 + * your version of this file under either the CDDL, the GPL Version 2 or
113.39 + * to extend the choice of license to its licensees as provided above.
113.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
113.41 + * Version 2 license, then the option applies only if the new code is
113.42 + * made subject to such option by the copyright holder.
113.43 + */
113.44 +
113.45 +package org.netbeans.modules.visualweb.gravy.model.navigation;
113.46 +
113.47 +/**
113.48 + * Common interface for linkable target objects.
113.49 + */
113.50 +
113.51 +public interface LinkableTarget {
113.52 +
113.53 + /**
113.54 + * Get name of linkable target.
113.55 + * @return Name of linkable target.
113.56 + */
113.57 + public String getLinkableTargetName();
113.58 +}
114.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
114.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/Bundle.properties Thu Jul 10 04:32:50 2008 -0700
114.3 @@ -0,0 +1,96 @@
114.4 +/*
114.5 +
114.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
114.7 + *
114.8 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
114.9 +
114.10 + *
114.11 + * The contents of this file are subject to the terms of either the GNU
114.12 + * General Public License Version 2 only ("GPL") or the Common
114.13 + * Development and Distribution License("CDDL") (collectively, the
114.14 + * "License"). You may not use this file except in compliance with the
114.15 + * License. You can obtain a copy of the License at
114.16 + * http://www.netbeans.org/cddl-gplv2.html
114.17 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
114.18 + * specific language governing permissions and limitations under the
114.19 + * License. When distributing the software, include this License Header
114.20 + * Notice in each file and include the License file at
114.21 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
114.22 + * particular file as subject to the "Classpath" exception as provided
114.23 + * by Sun in the GPL Version 2 section of the License file that
114.24 + * accompanied this code. If applicable, add the following below the
114.25 + * License Header, with the fields enclosed by brackets [] replaced by
114.26 + * your own identifying information:
114.27 + * "Portions Copyrighted [year] [name of copyright owner]"
114.28 + *
114.29 + * Contributor(s):
114.30 +
114.31 + *
114.32 +
114.33 + * The Original Software is NetBeans. The Initial Developer of the Original
114.34 +
114.35 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
114.36 +
114.37 + * Microsystems, Inc. All Rights Reserved.
114.38 + *
114.39 + * If you wish your version of this file to be governed by only the CDDL
114.40 + * or only the GPL Version 2, indicate your decision by adding
114.41 + * "[Contributor] elects to include this software in this distribution
114.42 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
114.43 + * single choice of license, a recipient has the option to distribute
114.44 + * your version of this file under either the CDDL, the GPL Version 2 or
114.45 + * to extend the choice of license to its licensees as provided above.
114.46 + * However, if you add GPL Version 2 code and therefore, elected the GPL
114.47 + * Version 2 license, then the option applies only if the new code is
114.48 + * made subject to such option by the copyright holder.
114.49 +
114.50 + */
114.51 +
114.52 +
114.53 +
114.54 +#properties for Projects window and rave bundle
114.55 +
114.56 +NBProjectsBundle=org.netbeans.modules.project.ui.actions.Bundle
114.57 +
114.58 +ProjectWizardBundle=org.netbeans.modules.web.project.ui.wizards.Bundle
114.59 +
114.60 +CustomizerBundle=org.netbeans.modules.web.project.ui.customizer.Bundle
114.61 +
114.62 +WebProjectsBundle=org.netbeans.modules.web.project.ui.Bundle
114.63 +
114.64 +JSFResBundle=org.netbeans.modules.visualweb.project.jsf.resources.Bundle
114.65 +
114.66 +J2EEProjectsBundle=org.netbeans.modules.j2ee.common.project.ui.Bundle
114.67 +
114.68 +New=New
114.69 +
114.70 +FinishButton=Finish
114.71 +
114.72 +CancelButton=Cancel
114.73 +
114.74 +CloseProjectPopupItem=LBL_CloseProjectAction_Popup_Name
114.75 +
114.76 +RunProjectPopupItem=LBL_RunAction_Name
114.77 +
114.78 +ProjectType=Templates/Project/Web
114.79 +
114.80 +ProjectCategory=TXT_NewWebApp
114.81 +
114.82 +JavaBluePrints=SourceStructure_0
114.83 +
114.84 +Jakarta=SourceStructure_1
114.85 +
114.86 +JavaEE5=JavaEESpecLevel_50
114.87 +
114.88 +J2EE14=J2EESpecLevel_14
114.89 +
114.90 +J2EE13=J2EESpecLevel_13
114.91 +
114.92 +SourcePackages=LBL_Node_Sources
114.93 +
114.94 +WebPages=LBL_Node_DocBase
114.95 +
114.96 +Page=Templates/JSF/Page.jsp
114.97 +
114.98 +Folder=Folder
114.99 +
115.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
115.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/DefaultProjectFactory.java Thu Jul 10 04:32:50 2008 -0700
115.3 @@ -0,0 +1,156 @@
115.4 +/*
115.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
115.6 + *
115.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
115.8 + *
115.9 + * The contents of this file are subject to the terms of either the GNU
115.10 + * General Public License Version 2 only ("GPL") or the Common
115.11 + * Development and Distribution License("CDDL") (collectively, the
115.12 + * "License"). You may not use this file except in compliance with the
115.13 + * License. You can obtain a copy of the License at
115.14 + * http://www.netbeans.org/cddl-gplv2.html
115.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
115.16 + * specific language governing permissions and limitations under the
115.17 + * License. When distributing the software, include this License Header
115.18 + * Notice in each file and include the License file at
115.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
115.20 + * particular file as subject to the "Classpath" exception as provided
115.21 + * by Sun in the GPL Version 2 section of the License file that
115.22 + * accompanied this code. If applicable, add the following below the
115.23 + * License Header, with the fields enclosed by brackets [] replaced by
115.24 + * your own identifying information:
115.25 + * "Portions Copyrighted [year] [name of copyright owner]"
115.26 + *
115.27 + * Contributor(s):
115.28 + *
115.29 + * The Original Software is NetBeans. The Initial Developer of the Original
115.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
115.31 + * Microsystems, Inc. All Rights Reserved.
115.32 + *
115.33 + * If you wish your version of this file to be governed by only the CDDL
115.34 + * or only the GPL Version 2, indicate your decision by adding
115.35 + * "[Contributor] elects to include this software in this distribution
115.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
115.37 + * single choice of license, a recipient has the option to distribute
115.38 + * your version of this file under either the CDDL, the GPL Version 2 or
115.39 + * to extend the choice of license to its licensees as provided above.
115.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
115.41 + * Version 2 license, then the option applies only if the new code is
115.42 + * made subject to such option by the copyright holder.
115.43 + */
115.44 +
115.45 +package org.netbeans.modules.visualweb.gravy.model.project;
115.46 +
115.47 +import org.netbeans.jemmy.operators.JButtonOperator;
115.48 +import org.netbeans.jemmy.operators.JCheckBoxOperator;
115.49 +import org.netbeans.jemmy.operators.JDialogOperator;
115.50 +import org.netbeans.jemmy.operators.JTreeOperator;
115.51 +import org.netbeans.jemmy.operators.JComboBoxOperator;
115.52 +import org.netbeans.jemmy.operators.JTextFieldOperator;
115.53 +import org.netbeans.jemmy.JemmyException;
115.54 +import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
115.55 +import org.netbeans.modules.visualweb.gravy.TestUtils;
115.56 +import org.netbeans.modules.visualweb.gravy.Bundle;
115.57 +
115.58 +import java.io.File;
115.59 +
115.60 +/**
115.61 + * Default factory for creation of projects.
115.62 + */
115.63 +
115.64 +public class DefaultProjectFactory extends ProjectFactory {
115.65 +
115.66 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
115.67 +
115.68 + /**
115.69 + * Type of project.
115.70 + */
115.71 + private final static String projectType = Bundle.getStringTrimmed(
115.72 + Bundle.getStringTrimmed(bundle, "ProjectWizardBundle"),
115.73 + Bundle.getStringTrimmed(bundle, "ProjectType"));
115.74 +
115.75 + /**
115.76 + * Category of project.
115.77 + */
115.78 + private final static String projectCategory = Bundle.getStringTrimmed(
115.79 + Bundle.getStringTrimmed(bundle, "ProjectWizardBundle"),
115.80 + Bundle.getStringTrimmed(bundle, "ProjectCategory"));
115.81 +
115.82 + private final static String blueprintsStructure = Bundle.getStringTrimmed(
115.83 + Bundle.getStringTrimmed(bundle, "J2EEProjectsBundle"),
115.84 + Bundle.getStringTrimmed(bundle, "JavaBluePrints"));
115.85 +
115.86 + private final static String jakartaStructure = Bundle.getStringTrimmed(
115.87 + Bundle.getStringTrimmed(bundle, "J2EEProjectsBundle"),
115.88 + Bundle.getStringTrimmed(bundle, "Jakarta"));
115.89 +
115.90 + /**
115.91 + * Default project factory.
115.92 + */
115.93 + private static DefaultProjectFactory defaultPFactory;
115.94 +
115.95 + /**
115.96 + * Create new DefaultProjectFactory.
115.97 + */
115.98 + public DefaultProjectFactory() {
115.99 + }
115.100 +
115.101 + /**
115.102 + * Create instance of DefaultProjectFactory or return it, if it is already exist.
115.103 + * Singleton.
115.104 + * @return DefaultProjectFactory.
115.105 + */
115.106 + public static DefaultProjectFactory getFactory() {
115.107 + if (defaultPFactory != null) return defaultPFactory;
115.108 + else return (defaultPFactory = new DefaultProjectFactory());
115.109 + }
115.110 +
115.111 + /**
115.112 + * Create new project.
115.113 + * @param projectDescriptor Descriptor of project.
115.114 + * @return created project.
115.115 + */
115.116 + protected Project createProject(ProjectDescriptor projectDescriptor) {
115.117 + String _projectPath = projectDescriptor.getProperty(projectDescriptor.LOCATION_KEY);
115.118 + String _projectName = projectDescriptor.getProperty(projectDescriptor.NAME_KEY);
115.119 + String _J2EEVersion = projectDescriptor.getProperty(projectDescriptor.J2EEVERSION_KEY);
115.120 + String _targetServer = projectDescriptor.getProperty(projectDescriptor.SERVER_KEY);
115.121 + if (_projectPath.lastIndexOf(File.separator) != _projectPath.length() - 1) _projectPath = _projectPath + File.separator;
115.122 + try {
115.123 + TestUtils.createNewProject(_projectPath, _projectName, true, projectType, projectCategory, blueprintsStructure, _J2EEVersion, _targetServer);
115.124 + }
115.125 + catch(Exception e) {
115.126 + throw new JemmyException("Project can't be created!", e);
115.127 + }
115.128 + return new JSFWebProject(projectDescriptor);
115.129 + }
115.130 +
115.131 + /**
115.132 + * Open existing project.
115.133 + * @param pathToProject Path to project's folder.
115.134 + * @return opened project.
115.135 + */
115.136 + protected Project openProject(String pathToProject) {
115.137 + try {
115.138 + TestUtils.openProject(pathToProject);
115.139 + }
115.140 + catch(Exception e) {
115.141 + throw new JemmyException("Project can't be opened!", e);
115.142 + }
115.143 + String projectName = pathToProject.substring(pathToProject.lastIndexOf(File.separator) + 1, pathToProject.length());
115.144 + String projectLocation = pathToProject.substring(0, pathToProject.lastIndexOf(File.separator) + 1);
115.145 + ProjectNavigatorOperator.pressPopupItemOnNode(projectName, "Properties");
115.146 + JDialogOperator propertiesDialog = new JDialogOperator("Project Properties - "+projectName);
115.147 + TestUtils.wait(1000);
115.148 + JTreeOperator tree = new JTreeOperator(propertiesDialog);
115.149 + tree.selectPath(tree.findPath("Run"));
115.150 + TestUtils.wait(1000);
115.151 + String targetServer = new JComboBoxOperator(propertiesDialog).getSelectedItem().toString();
115.152 + String J2EEVersion = new JTextFieldOperator(propertiesDialog, 0).getText();
115.153 + new JButtonOperator(propertiesDialog, "OK").pushNoBlock();
115.154 + TestUtils.wait(1000);
115.155 + System.out.println("projectName="+projectName+"; projectLocation="+projectLocation+"; J2EEVersion="+J2EEVersion+"; targetServer="+targetServer);
115.156 + ProjectDescriptor projectDescriptor = new ProjectDescriptor(projectName, projectLocation, J2EEVersion, targetServer);
115.157 + return new JSFWebProject(projectDescriptor);
115.158 + }
115.159 +}
116.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
116.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/Folder.java Thu Jul 10 04:32:50 2008 -0700
116.3 @@ -0,0 +1,133 @@
116.4 +/*
116.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
116.6 + *
116.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
116.8 + *
116.9 + * The contents of this file are subject to the terms of either the GNU
116.10 + * General Public License Version 2 only ("GPL") or the Common
116.11 + * Development and Distribution License("CDDL") (collectively, the
116.12 + * "License"). You may not use this file except in compliance with the
116.13 + * License. You can obtain a copy of the License at
116.14 + * http://www.netbeans.org/cddl-gplv2.html
116.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
116.16 + * specific language governing permissions and limitations under the
116.17 + * License. When distributing the software, include this License Header
116.18 + * Notice in each file and include the License file at
116.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
116.20 + * particular file as subject to the "Classpath" exception as provided
116.21 + * by Sun in the GPL Version 2 section of the License file that
116.22 + * accompanied this code. If applicable, add the following below the
116.23 + * License Header, with the fields enclosed by brackets [] replaced by
116.24 + * your own identifying information:
116.25 + * "Portions Copyrighted [year] [name of copyright owner]"
116.26 + *
116.27 + * Contributor(s):
116.28 + *
116.29 + * The Original Software is NetBeans. The Initial Developer of the Original
116.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
116.31 + * Microsystems, Inc. All Rights Reserved.
116.32 + *
116.33 + * If you wish your version of this file to be governed by only the CDDL
116.34 + * or only the GPL Version 2, indicate your decision by adding
116.35 + * "[Contributor] elects to include this software in this distribution
116.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
116.37 + * single choice of license, a recipient has the option to distribute
116.38 + * your version of this file under either the CDDL, the GPL Version 2 or
116.39 + * to extend the choice of license to its licensees as provided above.
116.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
116.41 + * Version 2 license, then the option applies only if the new code is
116.42 + * made subject to such option by the copyright holder.
116.43 + */
116.44 +
116.45 +package org.netbeans.modules.visualweb.gravy.model.project;
116.46 +
116.47 +import java.util.ArrayList;
116.48 +import java.util.List;
116.49 +import javax.swing.tree.TreePath;
116.50 +
116.51 +/**
116.52 + * Class for folders included in Project.
116.53 + */
116.54 +
116.55 +public class Folder implements ProjectEntry {
116.56 +
116.57 + TreePath path;
116.58 + String name;
116.59 +
116.60 + /**
116.61 + * Parent of the folder.
116.62 + */
116.63 + private ProjectEntry parent;
116.64 +
116.65 + /**
116.66 + * Child project entries of the folder.
116.67 + */
116.68 + List childList = new ArrayList();
116.69 +
116.70 + /**
116.71 + * Creates a new instance of folder.
116.72 + * @param path Path to folder in project.
116.73 + * @param name Name of folder.
116.74 + */
116.75 + Folder(TreePath path, String name, ProjectEntry parent) {
116.76 + this.path = path;
116.77 + this.name = name;
116.78 + setParent(parent);
116.79 + }
116.80 +
116.81 + /**
116.82 + * Save folder.
116.83 + */
116.84 + public void save() {
116.85 + }
116.86 +
116.87 + /**
116.88 + * Save folder as folder with specified name.
116.89 + */
116.90 + public void saveAs(String name) {
116.91 + }
116.92 +
116.93 + /**
116.94 + * Get name of folder.
116.95 + * @return Name of the folder.
116.96 + */
116.97 + public String getName() {
116.98 + return name;
116.99 + }
116.100 +
116.101 + /**
116.102 + * @return TreePath of the folder.
116.103 + */
116.104 + public TreePath getTreePath() {
116.105 + return path;
116.106 + }
116.107 +
116.108 + /**
116.109 + * @return Parent of the folder.
116.110 + */
116.111 + public ProjectEntry getParent() {
116.112 + return parent;
116.113 + }
116.114 +
116.115 + /**
116.116 + * Set parent of the folder.
116.117 + */
116.118 + protected void setParent(ProjectEntry parent) {
116.119 + this.parent = parent;
116.120 + }
116.121 +
116.122 + /**
116.123 + * @return Child project entries of the folder.
116.124 + */
116.125 + public ProjectEntry[] getChildren() {
116.126 + return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
116.127 + }
116.128 +
116.129 +
116.130 +
116.131 + /**
116.132 + * Remove folder.
116.133 + */
116.134 + public void delete() {
116.135 + }
116.136 +}
117.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
117.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/JSFWebProject.java Thu Jul 10 04:32:50 2008 -0700
117.3 @@ -0,0 +1,83 @@
117.4 +/*
117.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
117.6 + *
117.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
117.8 + *
117.9 + * The contents of this file are subject to the terms of either the GNU
117.10 + * General Public License Version 2 only ("GPL") or the Common
117.11 + * Development and Distribution License("CDDL") (collectively, the
117.12 + * "License"). You may not use this file except in compliance with the
117.13 + * License. You can obtain a copy of the License at
117.14 + * http://www.netbeans.org/cddl-gplv2.html
117.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
117.16 + * specific language governing permissions and limitations under the
117.17 + * License. When distributing the software, include this License Header
117.18 + * Notice in each file and include the License file at
117.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
117.20 + * particular file as subject to the "Classpath" exception as provided
117.21 + * by Sun in the GPL Version 2 section of the License file that
117.22 + * accompanied this code. If applicable, add the following below the
117.23 + * License Header, with the fields enclosed by brackets [] replaced by
117.24 + * your own identifying information:
117.25 + * "Portions Copyrighted [year] [name of copyright owner]"
117.26 + *
117.27 + * Contributor(s):
117.28 + *
117.29 + * The Original Software is NetBeans. The Initial Developer of the Original
117.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
117.31 + * Microsystems, Inc. All Rights Reserved.
117.32 + *
117.33 + * If you wish your version of this file to be governed by only the CDDL
117.34 + * or only the GPL Version 2, indicate your decision by adding
117.35 + * "[Contributor] elects to include this software in this distribution
117.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
117.37 + * single choice of license, a recipient has the option to distribute
117.38 + * your version of this file under either the CDDL, the GPL Version 2 or
117.39 + * to extend the choice of license to its licensees as provided above.
117.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
117.41 + * Version 2 license, then the option applies only if the new code is
117.42 + * made subject to such option by the copyright holder.
117.43 + */
117.44 +
117.45 +package org.netbeans.modules.visualweb.gravy.model.project;
117.46 +
117.47 +import javax.swing.tree.TreePath;
117.48 +
117.49 +/**
117.50 + * Web JSF project.
117.51 + */
117.52 +
117.53 +public class JSFWebProject extends Project {
117.54 +
117.55 + public JSFWebProject(ProjectDescriptor prjDescriptor) {
117.56 + super(prjDescriptor);
117.57 + root = getRoot();
117.58 + WebPageFolder wpf = new WebPageFolder(new TreePath(getName()), root.webPagesName, root);
117.59 + wpf.addWebPage("Page1");
117.60 + root.childList.add(wpf);
117.61 + SourceFolder sf = root.getSourceRootFolder().getSourceSubFolder(getName().toLowerCase());
117.62 + sf.addJavaFile("ApplicationBean1");
117.63 + sf.addJavaFile("RequestBean1");
117.64 + sf.addJavaFile("SessionBean1");
117.65 + }
117.66 +
117.67 + public JSFWebProject saveAs(String newName) {
117.68 + return null;
117.69 + }
117.70 +
117.71 + public JSFWebProject saveAs(String newName, String newLocation) {
117.72 + return null;
117.73 + }
117.74 +
117.75 + /**
117.76 + * Instance of JSFWebProject is compared with project, passed with parameter.
117.77 + * @param prj Object for comparison.
117.78 + * @return true if Object equals to Project.
117.79 + */
117.80 + public boolean equals(Object prj) {
117.81 + if ((prj instanceof Project) && ((Project) prj).getName().equals(this.getName())) {
117.82 + return true;
117.83 + }
117.84 + return false;
117.85 + }
117.86 +}
118.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
118.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/JSPFile.java Thu Jul 10 04:32:50 2008 -0700
118.3 @@ -0,0 +1,325 @@
118.4 +/*
118.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
118.6 + *
118.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
118.8 + *
118.9 + * The contents of this file are subject to the terms of either the GNU
118.10 + * General Public License Version 2 only ("GPL") or the Common
118.11 + * Development and Distribution License("CDDL") (collectively, the
118.12 + * "License"). You may not use this file except in compliance with the
118.13 + * License. You can obtain a copy of the License at
118.14 + * http://www.netbeans.org/cddl-gplv2.html
118.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
118.16 + * specific language governing permissions and limitations under the
118.17 + * License. When distributing the software, include this License Header
118.18 + * Notice in each file and include the License file at
118.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
118.20 + * particular file as subject to the "Classpath" exception as provided
118.21 + * by Sun in the GPL Version 2 section of the License file that
118.22 + * accompanied this code. If applicable, add the following below the
118.23 + * License Header, with the fields enclosed by brackets [] replaced by
118.24 + * your own identifying information:
118.25 + * "Portions Copyrighted [year] [name of copyright owner]"
118.26 + *
118.27 + * Contributor(s):
118.28 + *
118.29 + * The Original Software is NetBeans. The Initial Developer of the Original
118.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
118.31 + * Microsystems, Inc. All Rights Reserved.
118.32 + *
118.33 + * If you wish your version of this file to be governed by only the CDDL
118.34 + * or only the GPL Version 2, indicate your decision by adding
118.35 + * "[Contributor] elects to include this software in this distribution
118.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
118.37 + * single choice of license, a recipient has the option to distribute
118.38 + * your version of this file under either the CDDL, the GPL Version 2 or
118.39 + * to extend the choice of license to its licensees as provided above.
118.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
118.41 + * Version 2 license, then the option applies only if the new code is
118.42 + * made subject to such option by the copyright holder.
118.43 + */
118.44 +
118.45 +package org.netbeans.modules.visualweb.gravy.model.project;
118.46 +
118.47 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
118.48 +import org.netbeans.modules.visualweb.gravy.EditorOperator;
118.49 +import org.netbeans.modules.visualweb.gravy.TestUtils;
118.50 +
118.51 +import javax.swing.tree.TreePath;
118.52 +import java.util.ArrayList;
118.53 +import java.util.List;
118.54 +
118.55 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
118.56 +import org.netbeans.jemmy.TimeoutExpiredException;
118.57 +
118.58 +/**
118.59 + * Class for JSP files.
118.60 + */
118.61 +
118.62 +public class JSPFile extends SourceFile implements ProjectEntry {
118.63 +
118.64 + private final static String reformatCode = "Reformat Code";
118.65 +
118.66 + WebPage webpage = null;
118.67 +
118.68 + private EditorOperator editor = null;
118.69 +
118.70 + /**
118.71 + * Parent of the jsp file.
118.72 + */
118.73 + protected ProjectEntry parent;
118.74 +
118.75 + /**
118.76 + * Child project entries of the jsp file.
118.77 + */
118.78 + protected List childList = new ArrayList();
118.79 +
118.80 + /**
118.81 + * Creates a new instance of web page.
118.82 + * @param path Path to web page in project.
118.83 + * @param name Name of web page.
118.84 + */
118.85 + JSPFile(TreePath path, String name, ProjectEntry parent) {
118.86 + super(path, name);
118.87 + setParent(parent);
118.88 + }
118.89 +
118.90 + /**
118.91 + * Save project entry.
118.92 + */
118.93 + public void save() {
118.94 + }
118.95 +
118.96 + /**
118.97 + * Save project entry as project entry with specified name.
118.98 + */
118.99 + public void saveAs(String name) {
118.100 + }
118.101 +
118.102 + /**
118.103 + * @return Name of the project entry.
118.104 + */
118.105 + public String getName() {
118.106 + return name;
118.107 + }
118.108 +
118.109 + /**
118.110 + * @return TreePath of the project entry.
118.111 + */
118.112 + public TreePath getTreePath() {
118.113 + return path;
118.114 + }
118.115 +
118.116 + /**
118.117 + * @return Parent of the jsp file.
118.118 + */
118.119 + public ProjectEntry getParent() {
118.120 + return parent;
118.121 + }
118.122 +
118.123 + /**
118.124 + * Set parent of the jsp file.
118.125 + */
118.126 + private void setParent(ProjectEntry parent) {
118.127 + this.parent = parent;
118.128 + }
118.129 +
118.130 + /**
118.131 + * @return Child project entries of the jsp file.
118.132 + */
118.133 + public ProjectEntry[] getChildren() {
118.134 + return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
118.135 + }
118.136 +
118.137 + /**
118.138 + * Remove project entry.
118.139 + */
118.140 + public void delete() {
118.141 + }
118.142 +
118.143 + /**
118.144 + * Open jsp file editor.
118.145 + */
118.146 + private void doOpenJSPEditor() {
118.147 + webpage.open();
118.148 + editor = webpage.page.getJSPEditor();
118.149 + editor.setVerification(false);
118.150 + editor.requestFocus();
118.151 + }
118.152 +
118.153 + /**
118.154 + * Open jsp code of web page.
118.155 + */
118.156 + private EditorOperator openJSP() {
118.157 + long tmpTimeout = 0;
118.158 + try {
118.159 + tmpTimeout = RaveWindowOperator.getDefaultRave().getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
118.160 + RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
118.161 + if (editor == null) {
118.162 + doOpenJSPEditor();
118.163 + }
118.164 + else {
118.165 + try {
118.166 + editor.makeComponentVisible();
118.167 + }
118.168 + catch(Exception e) {throw new TimeoutExpiredException("");}
118.169 + }
118.170 + }
118.171 + catch (TimeoutExpiredException e) {
118.172 + doOpenJSPEditor();
118.173 + }
118.174 + finally {
118.175 + RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", tmpTimeout);
118.176 + }
118.177 + return editor;
118.178 + }
118.179 +
118.180 + /**
118.181 + * Gets text from the currently opened jsp file of web page.
118.182 + * @return String representing whole content of the jsp file of web page.
118.183 + * (including new line characters)
118.184 + */
118.185 + public String getText() {
118.186 + editor = openJSP();
118.187 + return editor.getText();
118.188 + }
118.189 +
118.190 + /**
118.191 + * Gets text from specified line.
118.192 + * @param lineNumber Number of line.
118.193 + * @return String representing content of the line.
118.194 + */
118.195 + public String getText(int lineNumber) {
118.196 + editor = openJSP();
118.197 + return editor.getText(lineNumber);
118.198 + }
118.199 +
118.200 + /**
118.201 + * Checks if jsp file of web page contains text specified as parameter text.
118.202 + * @param text Text to compare to.
118.203 + * @return true if text was found, false otherwise.
118.204 + */
118.205 + public boolean contains(String text) {
118.206 + editor = openJSP();
118.207 + return editor.contains(text);
118.208 + }
118.209 +
118.210 + /**
118.211 + * Replaces first occurence of oldText by newText.
118.212 + * @param oldText Text to be replaced.
118.213 + * @param newText Text to write instead.
118.214 + */
118.215 + public void replace(String oldText, String newText) {
118.216 + editor = openJSP();
118.217 + editor.replace(oldText, newText);
118.218 + }
118.219 +
118.220 + /**
118.221 + * Replaced index-th occurence of oldText by newText.
118.222 + * @param oldText Text to be replaced
118.223 + * @param newText Text to write instead
118.224 + * @param index Index of oldText occurence.
118.225 + */
118.226 + public void replace(String oldText, String newText, int index) {
118.227 + editor = openJSP();
118.228 + editor.replace(oldText, newText, index);
118.229 + }
118.230 +
118.231 + /**
118.232 + * Insert text to current position.
118.233 + * @param text String to be inserted.
118.234 + */
118.235 + public void insert(String text) {
118.236 + editor = openJSP();
118.237 + editor.insert(text);
118.238 + }
118.239 +
118.240 + /**
118.241 + * Inserts text to position specified by line number and column.
118.242 + * @param text String to be inserted.
118.243 + * @param lineNumber Number of line.
118.244 + * @param column Column position.
118.245 + */
118.246 + public void insert(String text, int lineNumber, int column) {
118.247 + editor = openJSP();
118.248 + editor.insert(text, lineNumber, column);
118.249 + }
118.250 +
118.251 + /**
118.252 + * Deletes given number of characters from specified possition.
118.253 + * @param offset Position inside document.
118.254 + * @param length Number of characters to be deleted.
118.255 + */
118.256 + public void delete(int offset, int length) {
118.257 + editor = openJSP();
118.258 + editor.delete(offset, length);
118.259 + }
118.260 +
118.261 + /**
118.262 + * Deletes given number of characters from current caret possition.
118.263 + * @param length Number of characters to be deleted.
118.264 + */
118.265 + public void delete(int length) {
118.266 + editor = openJSP();
118.267 + editor.delete(length);
118.268 + }
118.269 +
118.270 + /**
118.271 + * Delete specified line.
118.272 + * @param line Number of line.
118.273 + */
118.274 + public void deleteLine(int line) {
118.275 + editor = openJSP();
118.276 + editor.deleteLine(line);
118.277 + }
118.278 +
118.279 + /**
118.280 + * Deletes characters between column1 and column2 on the specified line.
118.281 + * @param lineNumber Number of line.
118.282 + * @param column1 Column position where to start deleting.
118.283 + * @param column2 Column position where to stop deleting.
118.284 + */
118.285 + public void delete(int lineNumber, int column1, int column2) {
118.286 + editor = openJSP();
118.287 + editor.delete(lineNumber, column1, column2);
118.288 + }
118.289 +
118.290 + /**
118.291 + * Pushs key.
118.292 + * @param keyCode Key code (KeyEvent.VK_* value)
118.293 + * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
118.294 + */
118.295 + public void pushKey(int keyCode, int modifiers) {
118.296 + editor = openJSP();
118.297 + editor.pushKey(keyCode, modifiers);
118.298 + }
118.299 +
118.300 + /**
118.301 + * Pushs key.
118.302 + * @param keyCode Key code (KeyEvent.VK_* value)
118.303 + */
118.304 + public void pushKey(int keyCode) {
118.305 + editor = openJSP();
118.306 + editor.pushKey(keyCode);
118.307 + }
118.308 +
118.309 + /**
118.310 + * Get position of caret.
118.311 + * @return int Position of caret.
118.312 + */
118.313 + public int getCaretPosition() {
118.314 + editor = openJSP();
118.315 + return editor.txtEditorPane().getCaretPosition();
118.316 + }
118.317 +
118.318 + /**
118.319 + * Reformat code in JSP editor accordingly to specified rules.
118.320 + */
118.321 + public void reformatCode() {
118.322 + editor = openJSP();
118.323 + editor.txtEditorPane().clickForPopup();
118.324 + TestUtils.wait(1000);
118.325 + new JPopupMenuOperator().pushMenu(reformatCode);
118.326 + TestUtils.wait(1000);
118.327 + }
118.328 +}
119.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
119.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/JavaFile.java Thu Jul 10 04:32:50 2008 -0700
119.3 @@ -0,0 +1,325 @@
119.4 +/*
119.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
119.6 + *
119.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
119.8 + *
119.9 + * The contents of this file are subject to the terms of either the GNU
119.10 + * General Public License Version 2 only ("GPL") or the Common
119.11 + * Development and Distribution License("CDDL") (collectively, the
119.12 + * "License"). You may not use this file except in compliance with the
119.13 + * License. You can obtain a copy of the License at
119.14 + * http://www.netbeans.org/cddl-gplv2.html
119.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
119.16 + * specific language governing permissions and limitations under the
119.17 + * License. When distributing the software, include this License Header
119.18 + * Notice in each file and include the License file at
119.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
119.20 + * particular file as subject to the "Classpath" exception as provided
119.21 + * by Sun in the GPL Version 2 section of the License file that
119.22 + * accompanied this code. If applicable, add the following below the
119.23 + * License Header, with the fields enclosed by brackets [] replaced by
119.24 + * your own identifying information:
119.25 + * "Portions Copyrighted [year] [name of copyright owner]"
119.26 + *
119.27 + * Contributor(s):
119.28 + *
119.29 + * The Original Software is NetBeans. The Initial Developer of the Original
119.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
119.31 + * Microsystems, Inc. All Rights Reserved.
119.32 + *
119.33 + * If you wish your version of this file to be governed by only the CDDL
119.34 + * or only the GPL Version 2, indicate your decision by adding
119.35 + * "[Contributor] elects to include this software in this distribution
119.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
119.37 + * single choice of license, a recipient has the option to distribute
119.38 + * your version of this file under either the CDDL, the GPL Version 2 or
119.39 + * to extend the choice of license to its licensees as provided above.
119.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
119.41 + * Version 2 license, then the option applies only if the new code is
119.42 + * made subject to such option by the copyright holder.
119.43 + */
119.44 +
119.45 +package org.netbeans.modules.visualweb.gravy.model.project;
119.46 +
119.47 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
119.48 +import org.netbeans.modules.visualweb.gravy.EditorOperator;
119.49 +import org.netbeans.modules.visualweb.gravy.TestUtils;
119.50 +
119.51 +import javax.swing.tree.TreePath;
119.52 +import java.util.ArrayList;
119.53 +import java.util.List;
119.54 +
119.55 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
119.56 +import org.netbeans.jemmy.TimeoutExpiredException;
119.57 +
119.58 +/**
119.59 + * Class for Java files.
119.60 + */
119.61 +
119.62 +public class JavaFile extends SourceFile implements ProjectEntry {
119.63 +
119.64 + private final static String reformatCode = "Reformat Code";
119.65 +
119.66 + WebPage webpage = null;
119.67 +
119.68 + private EditorOperator editor = null;
119.69 +
119.70 + /**
119.71 + * Parent of the java file.
119.72 + */
119.73 + private ProjectEntry parent;
119.74 +
119.75 + /**
119.76 + * Child project entries of the java file.
119.77 + */
119.78 + private List childList = new ArrayList();
119.79 +
119.80 + /**
119.81 + * Creates a new instance of web page.
119.82 + * @param path Path to web page in project.
119.83 + * @param name Name of web page.
119.84 + */
119.85 + JavaFile(TreePath path, String name, ProjectEntry parent) {
119.86 + super(path, name);
119.87 + setParent(parent);
119.88 + }
119.89 +
119.90 + /**
119.91 + * Save java file.
119.92 + */
119.93 + public void save() {
119.94 + }
119.95 +
119.96 + /**
119.97 + * Save java file as java file with specified name.
119.98 + */
119.99 + public void saveAs(String name) {
119.100 + }
119.101 +
119.102 + /**
119.103 + * @return Name of the java file.
119.104 + */
119.105 + public String getName() {
119.106 + return name;
119.107 + }
119.108 +
119.109 + /**
119.110 + * @return TreePath of the java file.
119.111 + */
119.112 + public TreePath getTreePath() {
119.113 + return path;
119.114 + }
119.115 +
119.116 + /**
119.117 + * @return Parent of the java file.
119.118 + */
119.119 + public ProjectEntry getParent() {
119.120 + return parent;
119.121 + }
119.122 +
119.123 + /**
119.124 + * Set parent of the xml file.
119.125 + */
119.126 + private void setParent(ProjectEntry parent) {
119.127 + this.parent = parent;
119.128 + }
119.129 +
119.130 + /**
119.131 + * @return Child project entries of the java file.
119.132 + */
119.133 + public ProjectEntry[] getChildren() {
119.134 + return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
119.135 + }
119.136 +
119.137 + /**
119.138 + * Remove java file.
119.139 + */
119.140 + public void delete() {
119.141 + }
119.142 +
119.143 + /**
119.144 + * Open java file editor.
119.145 + */
119.146 + private void doOpenJavaEditor() {
119.147 + webpage.open();
119.148 + editor = webpage.page.getJavaEditor();
119.149 + editor.setVerification(false);
119.150 + editor.requestFocus();
119.151 + }
119.152 +
119.153 + /**
119.154 + * Open java file of web page.
119.155 + */
119.156 + private EditorOperator openJava() {
119.157 + long tmpTimeout = 0;
119.158 + try {
119.159 + tmpTimeout = RaveWindowOperator.getDefaultRave().getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
119.160 + RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
119.161 + if (editor == null) {
119.162 + doOpenJavaEditor();
119.163 + }
119.164 + else {
119.165 + try {
119.166 + editor.makeComponentVisible();
119.167 + }
119.168 + catch(Exception e) {throw new TimeoutExpiredException("");}
119.169 + }
119.170 + }
119.171 + catch (TimeoutExpiredException e) {
119.172 + doOpenJavaEditor();
119.173 + }
119.174 + finally {
119.175 + RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", tmpTimeout);
119.176 + }
119.177 + return editor;
119.178 + }
119.179 +
119.180 + /**
119.181 + * Gets text from the currently opened java file.
119.182 + * @return String representing whole content of the java file.
119.183 + * (including new line characters)
119.184 + */
119.185 + public String getText() {
119.186 + editor = openJava();
119.187 + return editor.getText();
119.188 + }
119.189 +
119.190 + /**
119.191 + * Gets text from specified line.
119.192 + * @param lineNumber Number of line.
119.193 + * @return String representing content of the line.
119.194 + */
119.195 + public String getText(int lineNumber) {
119.196 + editor = openJava();
119.197 + return editor.getText(lineNumber);
119.198 + }
119.199 +
119.200 + /**
119.201 + * Checks if java file contains text specified as parameter text.
119.202 + * @param text Text to compare to.
119.203 + * @return true if text was found, false otherwise.
119.204 + */
119.205 + public boolean contains(String text) {
119.206 + editor = openJava();
119.207 + return editor.contains(text);
119.208 + }
119.209 +
119.210 + /**
119.211 + * Replaces first occurence of oldText by newText.
119.212 + * @param oldText Text to be replaced.
119.213 + * @param newText Text to write instead.
119.214 + */
119.215 + public void replace(String oldText, String newText) {
119.216 + editor = openJava();
119.217 + editor.replace(oldText, newText);
119.218 + }
119.219 +
119.220 + /**
119.221 + * Replaced index-th occurence of oldText by newText.
119.222 + * @param oldText Text to be replaced
119.223 + * @param newText Text to write instead
119.224 + * @param index Tndex of oldText occurence.
119.225 + */
119.226 + public void replace(String oldText, String newText, int index) {
119.227 + editor = openJava();
119.228 + editor.replace(oldText, newText, index);
119.229 + }
119.230 +
119.231 + /**
119.232 + * Insert text to current position.
119.233 + * @param text String to be inserted.
119.234 + */
119.235 + public void insert(String text) {
119.236 + editor = openJava();
119.237 + editor.insert(text);
119.238 + }
119.239 +
119.240 + /**
119.241 + * Inserts text to position specified by line number and column.
119.242 + * @param text String to be inserted.
119.243 + * @param lineNumber Number of line.
119.244 + * @param column Column position.
119.245 + */
119.246 + public void insert(String text, int lineNumber, int column) {
119.247 + editor = openJava();
119.248 + editor.insert(text, lineNumber, column);
119.249 + }
119.250 +
119.251 + /**
119.252 + * Deletes given number of characters from specified possition.
119.253 + * @param offset Position inside document.
119.254 + * @param length Number of characters to be deleted.
119.255 + */
119.256 + public void delete(int offset, int length) {
119.257 + editor = openJava();
119.258 + editor.delete(offset, length);
119.259 + }
119.260 +
119.261 + /**
119.262 + * Deletes given number of characters from current caret possition.
119.263 + * @param length Number of characters to be deleted.
119.264 + */
119.265 + public void delete(int length) {
119.266 + editor = openJava();
119.267 + editor.delete(length);
119.268 + }
119.269 +
119.270 + /**
119.271 + * Delete specified line.
119.272 + * @param line Number of line.
119.273 + */
119.274 + public void deleteLine(int line) {
119.275 + editor = openJava();
119.276 + editor.deleteLine(line);
119.277 + }
119.278 +
119.279 + /**
119.280 + * Deletes characters between column1 and column2 on the specified line.
119.281 + * @param lineNumber Number of line.
119.282 + * @param column1 Column position where to start deleting.
119.283 + * @param column2 Column position where to stop deleting.
119.284 + */
119.285 + public void delete(int lineNumber, int column1, int column2) {
119.286 + editor = openJava();
119.287 + editor.delete(lineNumber, column1, column2);
119.288 + }
119.289 +
119.290 + /**
119.291 + * Pushs key.
119.292 + * @param keyCode Key code (KeyEvent.VK_* value)
119.293 + * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
119.294 + */
119.295 + public void pushKey(int keyCode, int modifiers) {
119.296 + editor = openJava();
119.297 + editor.pushKey(keyCode, modifiers);
119.298 + }
119.299 +
119.300 + /**
119.301 + * Pushs key.
119.302 + * @param keyCode Key code (KeyEvent.VK_* value)
119.303 + */
119.304 + public void pushKey(int keyCode) {
119.305 + editor = openJava();
119.306 + editor.pushKey(keyCode);
119.307 + }
119.308 +
119.309 + /**
119.310 + * Get position of caret.
119.311 + * @return int Position of caret.
119.312 + */
119.313 + public int getCaretPosition() {
119.314 + editor = openJava();
119.315 + return editor.txtEditorPane().getCaretPosition();
119.316 + }
119.317 +
119.318 + /**
119.319 + * Reformat code in Java editor accordingly to specified rules.
119.320 + */
119.321 + public void reformatCode() {
119.322 + editor = openJava();
119.323 + editor.txtEditorPane().clickForPopup();
119.324 + TestUtils.wait(1000);
119.325 + new JPopupMenuOperator().pushMenu(reformatCode);
119.326 + TestUtils.wait(1000);
119.327 + }
119.328 +}
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
120.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/Project.java Thu Jul 10 04:32:50 2008 -0700
120.3 @@ -0,0 +1,264 @@
120.4 +/*
120.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
120.6 + *
120.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
120.8 + *
120.9 + * The contents of this file are subject to the terms of either the GNU
120.10 + * General Public License Version 2 only ("GPL") or the Common
120.11 + * Development and Distribution License("CDDL") (collectively, the
120.12 + * "License"). You may not use this file except in compliance with the
120.13 + * License. You can obtain a copy of the License at
120.14 + * http://www.netbeans.org/cddl-gplv2.html
120.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
120.16 + * specific language governing permissions and limitations under the
120.17 + * License. When distributing the software, include this License Header
120.18 + * Notice in each file and include the License file at
120.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
120.20 + * particular file as subject to the "Classpath" exception as provided
120.21 + * by Sun in the GPL Version 2 section of the License file that
120.22 + * accompanied this code. If applicable, add the following below the
120.23 + * License Header, with the fields enclosed by brackets [] replaced by
120.24 + * your own identifying information:
120.25 + * "Portions Copyrighted [year] [name of copyright owner]"
120.26 + *
120.27 + * Contributor(s):
120.28 + *
120.29 + * The Original Software is NetBeans. The Initial Developer of the Original
120.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
120.31 + * Microsystems, Inc. All Rights Reserved.
120.32 + *
120.33 + * If you wish your version of this file to be governed by only the CDDL
120.34 + * or only the GPL Version 2, indicate your decision by adding
120.35 + * "[Contributor] elects to include this software in this distribution
120.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
120.37 + * single choice of license, a recipient has the option to distribute
120.38 + * your version of this file under either the CDDL, the GPL Version 2 or
120.39 + * to extend the choice of license to its licensees as provided above.
120.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
120.41 + * Version 2 license, then the option applies only if the new code is
120.42 + * made subject to such option by the copyright holder.
120.43 + */
120.44 +
120.45 +package org.netbeans.modules.visualweb.gravy.model.project;
120.46 +
120.47 +import org.netbeans.modules.visualweb.gravy.model.navigation.LinkManager;
120.48 +import org.netbeans.modules.visualweb.gravy.Bundle;
120.49 +import org.netbeans.modules.visualweb.gravy.Util;
120.50 +import org.netbeans.modules.visualweb.gravy.TestUtils;
120.51 +import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
120.52 +
120.53 +import org.netbeans.jemmy.JemmyException;
120.54 +import org.netbeans.jemmy.operators.JLabelOperator;
120.55 +
120.56 +/**
120.57 + * Common class for all project types, describing all general actions and methods.
120.58 + */
120.59 +
120.60 +public abstract class Project {
120.61 +
120.62 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
120.63 + private final static String popupClose = Bundle.getStringTrimmed(
120.64 + Bundle.getStringTrimmed(bundle, "NBProjectsBundle"),
120.65 + Bundle.getStringTrimmed(bundle, "CloseProjectPopupItem"));
120.66 + private final static String popupRun = Bundle.getStringTrimmed(
120.67 + Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
120.68 + Bundle.getStringTrimmed(bundle, "RunProjectPopupItem"));
120.69 +
120.70 + private final static String STR_NO_VIEW = "<No View Available>";
120.71 + private final static String STR_MAIN = " [Main]";
120.72 +
120.73 + /**
120.74 + * Descriptor of project.
120.75 + */
120.76 + private ProjectDescriptor prjDescriptor;
120.77 +
120.78 + /**
120.79 + * Root entry of the project.
120.80 + */
120.81 + protected RootEntry root;
120.82 +
120.83 + /**
120.84 + * Link manager of project.
120.85 + */
120.86 + private LinkManager linkMng;
120.87 +
120.88 + /**
120.89 + * Creates project with specified descriptor.
120.90 + * @param prjDescriptor Descriptor of project.
120.91 + */
120.92 + public Project(ProjectDescriptor prjDescriptor) {
120.93 + setDescriptor(prjDescriptor);
120.94 + root = new RootEntry(this);
120.95 + }
120.96 +
120.97 + /**
120.98 + * Get root of project tree.
120.99 + */
120.100 + public RootEntry getRoot() {
120.101 + return root;
120.102 + }
120.103 +
120.104 + /**
120.105 + * Get link manager of project tree.
120.106 + */
120.107 + public LinkManager getLinkManager() {
120.108 + if (linkMng == null) return linkMng = new LinkManager(this);
120.109 + else return linkMng;
120.110 + }
120.111 +
120.112 + /**
120.113 + * Rename project.
120.114 + * @param newProjectName New project name.
120.115 + */
120.116 + public void rename(String newProjectName){
120.117 + String name = prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
120.118 + if (!name.equals(newProjectName)) setName(newProjectName);
120.119 + }
120.120 +
120.121 + /**
120.122 + * Close project.
120.123 + */
120.124 + public void close() {
120.125 + try {
120.126 + new ProjectNavigatorOperator().pressPopupItemOnNode(getName(), popupClose);
120.127 + }
120.128 + catch(Exception e) {
120.129 + throw new JemmyException("Project can't be closed!", e);
120.130 + }
120.131 + }
120.132 +
120.133 + /**
120.134 + * Run project.
120.135 + */
120.136 + public void run() {
120.137 + try {
120.138 + new ProjectNavigatorOperator().pressPopupItemOnNode(getName(), popupRun);
120.139 + TestUtils.wait(2000);
120.140 + String[] runFinished = {getName() + STR_MAIN, STR_NO_VIEW, ""};
120.141 + waitLabelString(1, runFinished);
120.142 + }
120.143 + catch(Exception e) {
120.144 + throw new JemmyException("Project can't be run!", e);
120.145 + }
120.146 + TestUtils.wait(3000);
120.147 + }
120.148 +
120.149 + /**
120.150 + * Check label with specified index for correspondence to specified string.
120.151 + * Method wait when specified string appears in label.
120.152 + */
120.153 + private void waitLabelString(int index, String compareString) {
120.154 + String[] compareStrings = {compareString};
120.155 + waitLabelString(index, compareStrings);
120.156 + }
120.157 +
120.158 + /**
120.159 + * Check label with specified index for correspondence to one of a specified string.
120.160 + * Method wait when one of a specified string appears in label.
120.161 + */
120.162 + private void waitLabelString(int index, String[] compareStrings) {
120.163 + JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), index);
120.164 + boolean isStringAppeared = false;
120.165 + while (true) {
120.166 + jlo = new JLabelOperator(Util.getMainWindow(), index);
120.167 + TestUtils.wait(1000);
120.168 + String labelText = jlo.getText();
120.169 + for (int i = 0; i < compareStrings.length; i++) {
120.170 + if (labelText == null || !labelText.equals(compareStrings[i]))
120.171 + continue;
120.172 + else {
120.173 + isStringAppeared = true;
120.174 + break;
120.175 + }
120.176 + }
120.177 + if (isStringAppeared) break;
120.178 + }
120.179 + }
120.180 +
120.181 + /**
120.182 + * Check label with specified index for correspondence to specified string.
120.183 + * Method wait when specified string appears in label and then wait until it disappears.
120.184 + */
120.185 + private void waitLabelStringDisappear(int index, String compareString) {
120.186 + JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), index);
120.187 + while (jlo.getText() == null || !jlo.getText().equals(compareString)) {
120.188 + jlo = new JLabelOperator(Util.getMainWindow(), index);
120.189 + TestUtils.wait(1000);
120.190 + }
120.191 + while (jlo.getText() != null && jlo.getText().equals(compareString)) {
120.192 + jlo = new JLabelOperator(Util.getMainWindow(), index);
120.193 + TestUtils.wait(1000);
120.194 + }
120.195 + }
120.196 +
120.197 + /**
120.198 + * Save All project entries.
120.199 + */
120.200 + public void saveAll() {
120.201 + }
120.202 +
120.203 + /**
120.204 + * Get descriptor of project.
120.205 + * @return descriptor of project.
120.206 + */
120.207 + public ProjectDescriptor getDescriptor() {
120.208 + return prjDescriptor;
120.209 + }
120.210 +
120.211 + /**
120.212 + * Set descriptor of project.
120.213 + * @param prjDescriptor New descriptor of project.
120.214 + */
120.215 + private void setDescriptor(ProjectDescriptor prjDescriptor) {
120.216 + this.prjDescriptor = prjDescriptor;
120.217 + }
120.218 +
120.219 + /**
120.220 + * Get project name.
120.221 + * @return project name.
120.222 + */
120.223 + public String getName() {
120.224 + return prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
120.225 + }
120.226 +
120.227 + /**
120.228 + * Set project name.
120.229 + * @param name New project name.
120.230 + */
120.231 + private void setName(String name) {
120.232 + String location = prjDescriptor.getProperty(prjDescriptor.LOCATION_KEY);
120.233 + prjDescriptor = new ProjectDescriptor(name, location);
120.234 + }
120.235 +
120.236 + /**
120.237 + * Get project location.
120.238 + * @return Absolute project location.
120.239 + */
120.240 + public String getLocation() {
120.241 + return prjDescriptor.getProperty(prjDescriptor.LOCATION_KEY);
120.242 + }
120.243 +
120.244 + /**
120.245 + * Set project location.
120.246 + * @param location Absolute project location.
120.247 + */
120.248 + private void setLocation(String location) {
120.249 + String name = prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
120.250 + prjDescriptor = new ProjectDescriptor(name, location);
120.251 + }
120.252 +
120.253 + /**
120.254 + * Makes copy of the current project.
120.255 + * @param newName Project name.
120.256 + * @return Copy of the current project.
120.257 + */
120.258 + public abstract Project saveAs(String newName);
120.259 +
120.260 + /**
120.261 + * Makes copy of the current project.
120.262 + * @param newName Project name.
120.263 + * @param newLocation absolute project location.
120.264 + * @return Copy of the current project.
120.265 + */
120.266 + public abstract Project saveAs(String newName, String newLocation);
120.267 +}
121.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
121.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectDescriptor.java Thu Jul 10 04:32:50 2008 -0700
121.3 @@ -0,0 +1,143 @@
121.4 +/*
121.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
121.6 + *
121.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
121.8 + *
121.9 + * The contents of this file are subject to the terms of either the GNU
121.10 + * General Public License Version 2 only ("GPL") or the Common
121.11 + * Development and Distribution License("CDDL") (collectively, the
121.12 + * "License"). You may not use this file except in compliance with the
121.13 + * License. You can obtain a copy of the License at
121.14 + * http://www.netbeans.org/cddl-gplv2.html
121.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
121.16 + * specific language governing permissions and limitations under the
121.17 + * License. When distributing the software, include this License Header
121.18 + * Notice in each file and include the License file at
121.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
121.20 + * particular file as subject to the "Classpath" exception as provided
121.21 + * by Sun in the GPL Version 2 section of the License file that
121.22 + * accompanied this code. If applicable, add the following below the
121.23 + * License Header, with the fields enclosed by brackets [] replaced by
121.24 + * your own identifying information:
121.25 + * "Portions Copyrighted [year] [name of copyright owner]"
121.26 + *
121.27 + * Contributor(s):
121.28 + *
121.29 + * The Original Software is NetBeans. The Initial Developer of the Original
121.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
121.31 + * Microsystems, Inc. All Rights Reserved.
121.32 + *
121.33 + * If you wish your version of this file to be governed by only the CDDL
121.34 + * or only the GPL Version 2, indicate your decision by adding
121.35 + * "[Contributor] elects to include this software in this distribution
121.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
121.37 + * single choice of license, a recipient has the option to distribute
121.38 + * your version of this file under either the CDDL, the GPL Version 2 or
121.39 + * to extend the choice of license to its licensees as provided above.
121.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
121.41 + * Version 2 license, then the option applies only if the new code is
121.42 + * made subject to such option by the copyright holder.
121.43 + */
121.44 +
121.45 +package org.netbeans.modules.visualweb.gravy.model.project;
121.46 +
121.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
121.48 +import org.netbeans.modules.visualweb.gravy.model.Descriptor;
121.49 +
121.50 +import java.util.Hashtable;
121.51 +
121.52 +/**
121.53 + * Descriptor for projects.
121.54 + */
121.55 +
121.56 +public class ProjectDescriptor implements Descriptor{
121.57 +
121.58 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
121.59 +
121.60 + public final static String J2EE13 = Bundle.getStringTrimmed(
121.61 + Bundle.getStringTrimmed(bundle, "CustomizerBundle"),
121.62 + Bundle.getStringTrimmed(bundle, "J2EE13"));
121.63 +
121.64 + public final static String J2EE14 = Bundle.getStringTrimmed(
121.65 + Bundle.getStringTrimmed(bundle, "CustomizerBundle"),
121.66 + Bundle.getStringTrimmed(bundle, "J2EE14"));
121.67 +
121.68 + public final static String JavaEE5 = Bundle.getStringTrimmed(
121.69 + Bundle.getStringTrimmed(bundle, "CustomizerBundle"),
121.70 + Bundle.getStringTrimmed(bundle, "JavaEE5"));
121.71 +
121.72 + /**
121.73 + * Key for getting project's name property from properties.
121.74 + */
121.75 + public static final String NAME_KEY = "projectName";
121.76 +
121.77 + /**
121.78 + * Key for getting project's location property from properties.
121.79 + */
121.80 + public static final String LOCATION_KEY = "projectLocation";
121.81 +
121.82 + /**
121.83 + * Key for getting project's J2EE version property from properties.
121.84 + */
121.85 + public static final String J2EEVERSION_KEY = "J2EEVersion";
121.86 +
121.87 + /**
121.88 + * Key for getting project's target server property from properties.
121.89 + */
121.90 + public static final String SERVER_KEY = "targetServer";
121.91 +
121.92 + /**
121.93 + * Project's properties.
121.94 + */
121.95 + private Hashtable properties = new Hashtable();
121.96 +
121.97 + /**
121.98 + * Create descriptor of the project with default J2EE version (1.4).
121.99 + * @param projectName Name of the project.
121.100 + * @param projectLocation Location of the project.
121.101 + */
121.102 + public ProjectDescriptor(String projectName, String projectLocation) {
121.103 + this(projectName, projectLocation, J2EE14);
121.104 + }
121.105 +
121.106 + /**
121.107 + * Create descriptor of the project.
121.108 + * @param projectName Name of the project.
121.109 + * @param projectLocation Location of the project.
121.110 + * @param J2EEVersion Version of J2EE (can be "J2EE 1.3", "J2EE 1.4", "Java EE 5").
121.111 + */
121.112 + public ProjectDescriptor(String projectName, String projectLocation, String J2EEVersion) {
121.113 + this(projectName, projectLocation, J2EEVersion, null);
121.114 + }
121.115 +
121.116 + /**
121.117 + * Create descriptor of the project.
121.118 + * @param projectName Name of the project.
121.119 + * @param projectLocation Location of the project.
121.120 + * @param J2EEVersion Version of J2EE (can be "J2EE 1.3", "J2EE 1.4", "Java EE 5").
121.121 + * @param targetServer Target Server for deploying of application.
121.122 + */
121.123 + public ProjectDescriptor(String projectName, String projectLocation, String J2EEVersion, String targetServer) {
121.124 + properties.put(NAME_KEY, projectName);
121.125 + properties.put(LOCATION_KEY, projectLocation);
121.126 + properties.put(J2EEVERSION_KEY, J2EEVersion);
121.127 + properties.put(SERVER_KEY, targetServer);
121.128 + }
121.129 +
121.130 + /**
121.131 + * Get project's properties.
121.132 + * @return Hashtable of properties.
121.133 + */
121.134 + public Hashtable getProperties() {
121.135 + return properties;
121.136 + }
121.137 +
121.138 + /**
121.139 + * Get value of specified project's property.
121.140 + * @param propertyName Name of necessary property.
121.141 + * @return String value of property.
121.142 + */
121.143 + public String getProperty(String propertyName) {
121.144 + return properties.get(propertyName).toString();
121.145 + }
121.146 +}
122.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
122.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectEntry.java Thu Jul 10 04:32:50 2008 -0700
122.3 @@ -0,0 +1,79 @@
122.4 +/*
122.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
122.6 + *
122.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
122.8 + *
122.9 + * The contents of this file are subject to the terms of either the GNU
122.10 + * General Public License Version 2 only ("GPL") or the Common
122.11 + * Development and Distribution License("CDDL") (collectively, the
122.12 + * "License"). You may not use this file except in compliance with the
122.13 + * License. You can obtain a copy of the License at
122.14 + * http://www.netbeans.org/cddl-gplv2.html
122.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
122.16 + * specific language governing permissions and limitations under the
122.17 + * License. When distributing the software, include this License Header
122.18 + * Notice in each file and include the License file at
122.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
122.20 + * particular file as subject to the "Classpath" exception as provided
122.21 + * by Sun in the GPL Version 2 section of the License file that
122.22 + * accompanied this code. If applicable, add the following below the
122.23 + * License Header, with the fields enclosed by brackets [] replaced by
122.24 + * your own identifying information:
122.25 + * "Portions Copyrighted [year] [name of copyright owner]"
122.26 + *
122.27 + * Contributor(s):
122.28 + *
122.29 + * The Original Software is NetBeans. The Initial Developer of the Original
122.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
122.31 + * Microsystems, Inc. All Rights Reserved.
122.32 + *
122.33 + * If you wish your version of this file to be governed by only the CDDL
122.34 + * or only the GPL Version 2, indicate your decision by adding
122.35 + * "[Contributor] elects to include this software in this distribution
122.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
122.37 + * single choice of license, a recipient has the option to distribute
122.38 + * your version of this file under either the CDDL, the GPL Version 2 or
122.39 + * to extend the choice of license to its licensees as provided above.
122.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
122.41 + * Version 2 license, then the option applies only if the new code is
122.42 + * made subject to such option by the copyright holder.
122.43 + */
122.44 +
122.45 +package org.netbeans.modules.visualweb.gravy.model.project;
122.46 +
122.47 +/**
122.48 + * Interface for entries included in Project.
122.49 + */
122.50 +
122.51 +public interface ProjectEntry {
122.52 +
122.53 + /**
122.54 + * Save project entry.
122.55 + */
122.56 + public void save();
122.57 +
122.58 + /**
122.59 + * Save project entry as project entry with specified name.
122.60 + */
122.61 + public void saveAs(String name);
122.62 +
122.63 + /**
122.64 + * @return Name of the project entry.
122.65 + */
122.66 + public String getName();
122.67 +
122.68 + /**
122.69 + * @return Parent of the project entry.
122.70 + */
122.71 + public ProjectEntry getParent();
122.72 +
122.73 + /**
122.74 + * @return Child project entries of the project entry.
122.75 + */
122.76 + public ProjectEntry[] getChildren();
122.77 +
122.78 + /**
122.79 + * Remove project entry.
122.80 + */
122.81 + public void delete();
122.82 +}
123.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
123.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectFactory.java Thu Jul 10 04:32:50 2008 -0700
123.3 @@ -0,0 +1,87 @@
123.4 +/*
123.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
123.6 + *
123.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
123.8 + *
123.9 + * The contents of this file are subject to the terms of either the GNU
123.10 + * General Public License Version 2 only ("GPL") or the Common
123.11 + * Development and Distribution License("CDDL") (collectively, the
123.12 + * "License"). You may not use this file except in compliance with the
123.13 + * License. You can obtain a copy of the License at
123.14 + * http://www.netbeans.org/cddl-gplv2.html
123.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
123.16 + * specific language governing permissions and limitations under the
123.17 + * License. When distributing the software, include this License Header
123.18 + * Notice in each file and include the License file at
123.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
123.20 + * particular file as subject to the "Classpath" exception as provided
123.21 + * by Sun in the GPL Version 2 section of the License file that
123.22 + * accompanied this code. If applicable, add the following below the
123.23 + * License Header, with the fields enclosed by brackets [] replaced by
123.24 + * your own identifying information:
123.25 + * "Portions Copyrighted [year] [name of copyright owner]"
123.26 + *
123.27 + * Contributor(s):
123.28 + *
123.29 + * The Original Software is NetBeans. The Initial Developer of the Original
123.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
123.31 + * Microsystems, Inc. All Rights Reserved.
123.32 + *
123.33 + * If you wish your version of this file to be governed by only the CDDL
123.34 + * or only the GPL Version 2, indicate your decision by adding
123.35 + * "[Contributor] elects to include this software in this distribution
123.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
123.37 + * single choice of license, a recipient has the option to distribute
123.38 + * your version of this file under either the CDDL, the GPL Version 2 or
123.39 + * to extend the choice of license to its licensees as provided above.
123.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
123.41 + * Version 2 license, then the option applies only if the new code is
123.42 + * made subject to such option by the copyright holder.
123.43 + */
123.44 +
123.45 +package org.netbeans.modules.visualweb.gravy.model.project;
123.46 +
123.47 +/**
123.48 + * Factory for creation projects.
123.49 + */
123.50 +
123.51 +public abstract class ProjectFactory {
123.52 +
123.53 + /**
123.54 + * Create new project.
123.55 + * Add created project to List, if project isn't contained in it.
123.56 + * @param projectDescriptor Descriptor of project.
123.57 + * @return created project.
123.58 + */
123.59 + public final Project create(ProjectDescriptor projectDescriptor){
123.60 + Project project = createProject(projectDescriptor);
123.61 + if (!ProjectList.getList().contains(project)) ProjectList.add(project);
123.62 + return project;
123.63 + }
123.64 +
123.65 + /**
123.66 + * Create new project.
123.67 + * @param projectDescriptor Descriptor of project.
123.68 + * @return created project.
123.69 + */
123.70 + abstract protected Project createProject(ProjectDescriptor projectDescriptor);
123.71 +
123.72 + /**
123.73 + * Open existing project.
123.74 + * Add this project to List, if project isn't contained in it.
123.75 + * @param pathToProject Path to project's folder.
123.76 + * @return opened project.
123.77 + */
123.78 + public final Project open(String pathToProject){
123.79 + Project project = openProject(pathToProject);
123.80 + if (!ProjectList.getList().contains(project)) ProjectList.add(project);
123.81 + return project;
123.82 + }
123.83 +
123.84 + /**
123.85 + * Open existing project.
123.86 + * @param pathToProject Path to project's folder.
123.87 + * @return opened project.
123.88 + */
123.89 + abstract protected Project openProject(String pathToProject);
123.90 +}
124.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
124.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectList.java Thu Jul 10 04:32:50 2008 -0700
124.3 @@ -0,0 +1,108 @@
124.4 +/*
124.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
124.6 + *
124.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
124.8 + *
124.9 + * The contents of this file are subject to the terms of either the GNU
124.10 + * General Public License Version 2 only ("GPL") or the Common
124.11 + * Development and Distribution License("CDDL") (collectively, the
124.12 + * "License"). You may not use this file except in compliance with the
124.13 + * License. You can obtain a copy of the License at
124.14 + * http://www.netbeans.org/cddl-gplv2.html
124.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
124.16 + * specific language governing permissions and limitations under the
124.17 + * License. When distributing the software, include this License Header
124.18 + * Notice in each file and include the License file at
124.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
124.20 + * particular file as subject to the "Classpath" exception as provided
124.21 + * by Sun in the GPL Version 2 section of the License file that
124.22 + * accompanied this code. If applicable, add the following below the
124.23 + * License Header, with the fields enclosed by brackets [] replaced by
124.24 + * your own identifying information:
124.25 + * "Portions Copyrighted [year] [name of copyright owner]"
124.26 + *
124.27 + * Contributor(s):
124.28 + *
124.29 + * The Original Software is NetBeans. The Initial Developer of the Original
124.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
124.31 + * Microsystems, Inc. All Rights Reserved.
124.32 + *
124.33 + * If you wish your version of this file to be governed by only the CDDL
124.34 + * or only the GPL Version 2, indicate your decision by adding
124.35 + * "[Contributor] elects to include this software in this distribution
124.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
124.37 + * single choice of license, a recipient has the option to distribute
124.38 + * your version of this file under either the CDDL, the GPL Version 2 or
124.39 + * to extend the choice of license to its licensees as provided above.
124.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
124.41 + * Version 2 license, then the option applies only if the new code is
124.42 + * made subject to such option by the copyright holder.
124.43 + */
124.44 +
124.45 +package org.netbeans.modules.visualweb.gravy.model.project;
124.46 +
124.47 +import java.util.List;
124.48 +import java.util.ArrayList;
124.49 +
124.50 +/**
124.51 + * List of projects.
124.52 + */
124.53 +
124.54 +public class ProjectList {
124.55 +
124.56 + /**
124.57 + * Main project.
124.58 + */
124.59 + private Project mainProject;
124.60 +
124.61 + /**
124.62 + * List of projects.
124.63 + */
124.64 + private static List projectList = new ArrayList();
124.65 +
124.66 + /**
124.67 + * Create new ProjectList.
124.68 + */
124.69 + public ProjectList() {
124.70 + }
124.71 +
124.72 + /**
124.73 + * Get list of projects.
124.74 + * @return List of projects.
124.75 + */
124.76 + public static List getList() {
124.77 + return projectList;
124.78 + }
124.79 +
124.80 + /**
124.81 + * Add project to List.
124.82 + * @param project Project for add.
124.83 + */
124.84 + public static void add(Project project) {
124.85 + projectList.add(project);
124.86 + }
124.87 +
124.88 + /**
124.89 + * Remove project from List.
124.90 + * @param project Project for remove.
124.91 + */
124.92 + public static void remove(Project project) {
124.93 + projectList.remove(project);
124.94 + }
124.95 +
124.96 + /**
124.97 + * Get main project.
124.98 + * @return mainProject variable.
124.99 + */
124.100 + public Project getMainProject() {
124.101 + return mainProject;
124.102 + }
124.103 +
124.104 + /**
124.105 + * Set main project.
124.106 + * @param project Project to be set as main.
124.107 + */
124.108 + public void setMainProject(Project project) {
124.109 + mainProject = project;
124.110 + }
124.111 +}
125.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
125.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/RootEntry.java Thu Jul 10 04:32:50 2008 -0700
125.3 @@ -0,0 +1,163 @@
125.4 +/*
125.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
125.6 + *
125.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
125.8 + *
125.9 + * The contents of this file are subject to the terms of either the GNU
125.10 + * General Public License Version 2 only ("GPL") or the Common
125.11 + * Development and Distribution License("CDDL") (collectively, the
125.12 + * "License"). You may not use this file except in compliance with the
125.13 + * License. You can obtain a copy of the License at
125.14 + * http://www.netbeans.org/cddl-gplv2.html
125.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
125.16 + * specific language governing permissions and limitations under the
125.17 + * License. When distributing the software, include this License Header
125.18 + * Notice in each file and include the License file at
125.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
125.20 + * particular file as subject to the "Classpath" exception as provided
125.21 + * by Sun in the GPL Version 2 section of the License file that
125.22 + * accompanied this code. If applicable, add the following below the
125.23 + * License Header, with the fields enclosed by brackets [] replaced by
125.24 + * your own identifying information:
125.25 + * "Portions Copyrighted [year] [name of copyright owner]"
125.26 + *
125.27 + * Contributor(s):
125.28 + *
125.29 + * The Original Software is NetBeans. The Initial Developer of the Original
125.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
125.31 + * Microsystems, Inc. All Rights Reserved.
125.32 + *
125.33 + * If you wish your version of this file to be governed by only the CDDL
125.34 + * or only the GPL Version 2, indicate your decision by adding
125.35 + * "[Contributor] elects to include this software in this distribution
125.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
125.37 + * single choice of license, a recipient has the option to distribute
125.38 + * your version of this file under either the CDDL, the GPL Version 2 or
125.39 + * to extend the choice of license to its licensees as provided above.
125.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
125.41 + * Version 2 license, then the option applies only if the new code is
125.42 + * made subject to such option by the copyright holder.
125.43 + */
125.44 +
125.45 +package org.netbeans.modules.visualweb.gravy.model.project;
125.46 +
125.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
125.48 +
125.49 +import java.util.ArrayList;
125.50 +import java.util.List;
125.51 +import javax.swing.tree.TreePath;
125.52 +
125.53 +/**
125.54 + * Class for root entry of the Project.
125.55 + */
125.56 +
125.57 +public class RootEntry implements ProjectEntry {
125.58 +
125.59 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
125.60 +
125.61 + public final static String sourcePackagesName = Bundle.getStringTrimmed(
125.62 + Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
125.63 + Bundle.getStringTrimmed(bundle, "SourcePackages"));
125.64 + public final static String webPagesName = Bundle.getStringTrimmed(
125.65 + Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
125.66 + Bundle.getStringTrimmed(bundle, "WebPages"));
125.67 +
125.68 + /**
125.69 + * Project which the root entry created for.
125.70 + */
125.71 + Project project;
125.72 +
125.73 + /**
125.74 + * Child project entries of the root entry.
125.75 + */
125.76 + List childList = new ArrayList();
125.77 +
125.78 + /**
125.79 + * Creates a new instance of root entry.
125.80 + */
125.81 + public RootEntry(Project project) {
125.82 + this.project = project;
125.83 + }
125.84 +
125.85 + /**
125.86 + * Save root entry.
125.87 + */
125.88 + public void save() {
125.89 + }
125.90 +
125.91 + /**
125.92 + * Save root entry as root entry with specified name.
125.93 + */
125.94 + public void saveAs(String name) {
125.95 + }
125.96 +
125.97 + /**
125.98 + * @return Project which the root entry belong to.
125.99 + */
125.100 + public Project getProject() {
125.101 + return project;
125.102 + }
125.103 +
125.104 + /**
125.105 + * Get name of root entry.
125.106 + * @return Name of the root entry.
125.107 + */
125.108 + public String getName() {
125.109 + return null;
125.110 + }
125.111 +
125.112 + /**
125.113 + * @return TreePath of the root entry.
125.114 + */
125.115 + public TreePath getTreePath() {
125.116 + return null;
125.117 + }
125.118 +
125.119 + /**
125.120 + * @return Parent of the root entry.
125.121 + */
125.122 + public ProjectEntry getParent() {
125.123 + return null;
125.124 + }
125.125 +
125.126 + /**
125.127 + * @return Child project entries of the root entry.
125.128 + */
125.129 + public ProjectEntry[] getChildren() {
125.130 + return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
125.131 + }
125.132 +
125.133 + /**
125.134 + * @return Web Page root folder.
125.135 + */
125.136 + public WebPageFolder getWebPageRootFolder() {
125.137 + ProjectEntry[] prjEntries = getChildren();
125.138 + for (int i = 0; i < prjEntries.length ; i++) {
125.139 + if (prjEntries[i] instanceof WebPageFolder &&
125.140 + ((WebPageFolder) prjEntries[i]).getName().equals(webPagesName)) {
125.141 + return ((WebPageFolder) prjEntries[i]);
125.142 + }
125.143 + }
125.144 + return null;
125.145 + }
125.146 +
125.147 + /**
125.148 + * @return Source root folder.
125.149 + */
125.150 + public SourceFolder getSourceRootFolder() {
125.151 + ProjectEntry[] prjEntries = getChildren();
125.152 + for (int i = 0; i < prjEntries.length ; i++) {
125.153 + if (prjEntries[i] instanceof SourceFolder &&
125.154 + ((SourceFolder) prjEntries[i]).getName().equals(sourcePackagesName)) {
125.155 + return ((SourceFolder) prjEntries[i]);
125.156 + }
125.157 + }
125.158 + return null;
125.159 + }
125.160 +
125.161 + /**
125.162 + * Remove root entry.
125.163 + */
125.164 + public void delete() {
125.165 + }
125.166 +}
126.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
126.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/SourceFile.java Thu Jul 10 04:32:50 2008 -0700
126.3 @@ -0,0 +1,171 @@
126.4 +/*
126.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
126.6 + *
126.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
126.8 + *
126.9 + * The contents of this file are subject to the terms of either the GNU
126.10 + * General Public License Version 2 only ("GPL") or the Common
126.11 + * Development and Distribution License("CDDL") (collectively, the
126.12 + * "License"). You may not use this file except in compliance with the
126.13 + * License. You can obtain a copy of the License at
126.14 + * http://www.netbeans.org/cddl-gplv2.html
126.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
126.16 + * specific language governing permissions and limitations under the
126.17 + * License. When distributing the software, include this License Header
126.18 + * Notice in each file and include the License file at
126.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
126.20 + * particular file as subject to the "Classpath" exception as provided
126.21 + * by Sun in the GPL Version 2 section of the License file that
126.22 + * accompanied this code. If applicable, add the following below the
126.23 + * License Header, with the fields enclosed by brackets [] replaced by
126.24 + * your own identifying information:
126.25 + * "Portions Copyrighted [year] [name of copyright owner]"
126.26 + *
126.27 + * Contributor(s):
126.28 + *
126.29 + * The Original Software is NetBeans. The Initial Developer of the Original
126.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
126.31 + * Microsystems, Inc. All Rights Reserved.
126.32 + *
126.33 + * If you wish your version of this file to be governed by only the CDDL
126.34 + * or only the GPL Version 2, indicate your decision by adding
126.35 + * "[Contributor] elects to include this software in this distribution
126.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
126.37 + * single choice of license, a recipient has the option to distribute
126.38 + * your version of this file under either the CDDL, the GPL Version 2 or
126.39 + * to extend the choice of license to its licensees as provided above.
126.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
126.41 + * Version 2 license, then the option applies only if the new code is
126.42 + * made subject to such option by the copyright holder.
126.43 + */
126.44 +
126.45 +package org.netbeans.modules.visualweb.gravy.model.project;
126.46 +
126.47 +import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
126.48 +import org.netbeans.modules.visualweb.gravy.TestUtils;
126.49 +
126.50 +import org.netbeans.jemmy.operators.Operator;
126.51 +import org.netbeans.jemmy.JemmyException;
126.52 +
126.53 +import javax.swing.tree.TreePath;
126.54 +
126.55 +/**
126.56 + * Common class for all source files.
126.57 + */
126.58 +
126.59 +abstract class SourceFile {
126.60 +
126.61 + private final String popupOpen = "Open";
126.62 +
126.63 + TreePath path;
126.64 + String name;
126.65 +
126.66 + /**
126.67 + * Creates a new instance of web page.
126.68 + * @param path Path to web page in project.
126.69 + * @param name Name of web page.
126.70 + */
126.71 + SourceFile(TreePath path, String name) {
126.72 + this.path = path;
126.73 + this.name = name;
126.74 + }
126.75 +
126.76 + /**
126.77 + * Open source file.
126.78 + */
126.79 + public void open() {
126.80 + try {
126.81 + ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
126.82 + TestUtils.wait(500);
126.83 + String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
126.84 + prjNav.pressPopupItemOnNode(full_path, popupOpen, new Operator.DefaultStringComparator(true, true));
126.85 + }
126.86 + catch(Exception e) {
126.87 + throw new JemmyException("Source file can't be opened!", e);
126.88 + }
126.89 + TestUtils.wait(500);
126.90 + }
126.91 +
126.92 + /**
126.93 + * Close source file.
126.94 + */
126.95 + public void close() {
126.96 + }
126.97 +
126.98 + /**
126.99 + * Gets text from the currently opened source file.
126.100 + * @return String representing whole content of the source fiole.
126.101 + * (including new line characters)
126.102 + */
126.103 + public abstract String getText();
126.104 +
126.105 + /**
126.106 + * Gets text from specified line.
126.107 + * @param lineNumber Number of line.
126.108 + * @return String representing content of the line.
126.109 + */
126.110 + public abstract String getText(int lineNumber);
126.111 +
126.112 + /**
126.113 + * Checks if source file contains text specified as parameter text.
126.114 + * @param text Text to compare to.
126.115 + * @return true if text was found, false otherwise.
126.116 + */
126.117 + public abstract boolean contains(String text);
126.118 +
126.119 + /**
126.120 + * Replaces first occurence of oldText by newText.
126.121 + * @param oldText Text to be replaced.
126.122 + * @param newText Text to write instead.
126.123 + */
126.124 + public abstract void replace(String oldText, String newText);
126.125 +
126.126 + /**
126.127 + * Replaced index-th occurence of oldText by newText.
126.128 + * @param oldText Text to be replaced
126.129 + * @param newText Text to write instead
126.130 + * @param index Index of oldText occurence.
126.131 + */
126.132 + public abstract void replace(String oldText, String newText, int index);
126.133 +
126.134 + /**
126.135 + * Insert text to current position.
126.136 + * @param text String to be inserted.
126.137 + */
126.138 + public abstract void insert(String text);
126.139 +
126.140 + /**
126.141 + * Inserts text to position specified by line number and column.
126.142 + * @param text String to be inserted.
126.143 + * @param lineNumber Number of line.
126.144 + * @param column Column position.
126.145 + */
126.146 + public abstract void insert(String text, int lineNumber, int column);
126.147 +
126.148 + /**
126.149 + * Deletes given number of characters from specified possition.
126.150 + * @param offset Position inside document.
126.151 + * @param length Number of characters to be deleted.
126.152 + */
126.153 + public abstract void delete(int offset, int length);
126.154 +
126.155 + /**
126.156 + * Deletes given number of characters from current caret possition.
126.157 + * @param length Number of characters to be deleted.
126.158 + */
126.159 + public abstract void delete(int length);
126.160 +
126.161 + /**
126.162 + * Delete specified line.
126.163 + * @param line Number of line.
126.164 + */
126.165 + public abstract void deleteLine(int line);
126.166 +
126.167 + /**
126.168 + * Deletes characters between column1 and column2 on the specified line.
126.169 + * @param lineNumber Number of line.
126.170 + * @param column1 Column position where to start deleting.
126.171 + * @param column2 Column position where to stop deleting.
126.172 + */
126.173 + public abstract void delete(int lineNumber, int column1, int column2);
126.174 +}
127.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
127.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/SourceFolder.java Thu Jul 10 04:32:50 2008 -0700
127.3 @@ -0,0 +1,201 @@
127.4 +/*
127.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
127.6 + *
127.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
127.8 + *
127.9 + * The contents of this file are subject to the terms of either the GNU
127.10 + * General Public License Version 2 only ("GPL") or the Common
127.11 + * Development and Distribution License("CDDL") (collectively, the
127.12 + * "License"). You may not use this file except in compliance with the
127.13 + * License. You can obtain a copy of the License at
127.14 + * http://www.netbeans.org/cddl-gplv2.html
127.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
127.16 + * specific language governing permissions and limitations under the
127.17 + * License. When distributing the software, include this License Header
127.18 + * Notice in each file and include the License file at
127.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
127.20 + * particular file as subject to the "Classpath" exception as provided
127.21 + * by Sun in the GPL Version 2 section of the License file that
127.22 + * accompanied this code. If applicable, add the following below the
127.23 + * License Header, with the fields enclosed by brackets [] replaced by
127.24 + * your own identifying information:
127.25 + * "Portions Copyrighted [year] [name of copyright owner]"
127.26 + *
127.27 + * Contributor(s):
127.28 + *
127.29 + * The Original Software is NetBeans. The Initial Developer of the Original
127.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
127.31 + * Microsystems, Inc. All Rights Reserved.
127.32 + *
127.33 + * If you wish your version of this file to be governed by only the CDDL
127.34 + * or only the GPL Version 2, indicate your decision by adding
127.35 + * "[Contributor] elects to include this software in this distribution
127.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
127.37 + * single choice of license, a recipient has the option to distribute
127.38 + * your version of this file under either the CDDL, the GPL Version 2 or
127.39 + * to extend the choice of license to its licensees as provided above.
127.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
127.41 + * Version 2 license, then the option applies only if the new code is
127.42 + * made subject to such option by the copyright holder.
127.43 + */
127.44 +
127.45 +package org.netbeans.modules.visualweb.gravy.model.project;
127.46 +
127.47 +import org.netbeans.modules.visualweb.gravy.TestUtils;
127.48 +import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
127.49 +
127.50 +import org.netbeans.jemmy.TimeoutExpiredException;
127.51 +import org.netbeans.jemmy.JemmyException;
127.52 +import org.netbeans.jemmy.operators.Operator;
127.53 +import org.netbeans.jemmy.operators.JButtonOperator;
127.54 +import org.netbeans.jemmy.operators.JDialogOperator;
127.55 +import org.netbeans.jemmy.operators.JTextFieldOperator;
127.56 +
127.57 +import javax.swing.tree.TreePath;
127.58 +
127.59 +/**
127.60 + * Class for source folders included in Project.
127.61 + */
127.62 +
127.63 +public class SourceFolder extends Folder {
127.64 +
127.65 + private final String popupNewPackage = "New|Java Package...";
127.66 + private final String dlgNewPackage = "New Java Package";
127.67 + private final String popupNewClass = "New|Java Class...";
127.68 + private final String dlgNewClass = "New Java Class";
127.69 + private final String btnFinish = "Finish";
127.70 + private final String btnCancel = "Cancel";
127.71 +
127.72 + SourceFolder(TreePath path, String name, ProjectEntry parent) {
127.73 + super(path, name, parent);
127.74 + }
127.75 +
127.76 + /**
127.77 + * Add new source subfolder to current folder.
127.78 + * @param name Name of new source subfolder.
127.79 + * @return Added source subfolder.
127.80 + */
127.81 + public SourceFolder addSourceSubFolder(String name) {
127.82 + if (getSourceSubFolder(name) == null) {
127.83 + String path_part1 = "", path_part2 = "", full_path = "", path_to_find = "";
127.84 + ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
127.85 + TestUtils.wait(1000);
127.86 + full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
127.87 + path_to_find = full_path + "|" + name;
127.88 + if (full_path.indexOf("|", full_path.indexOf("|") + 1) != -1) {
127.89 + path_part1 = full_path.substring(0, full_path.indexOf("|", full_path.indexOf("|") + 1) + 1);
127.90 + path_part2 = full_path.substring(full_path.indexOf("|", full_path.indexOf("|") + 1) +1, full_path.length()).replace('|', '.');
127.91 + full_path = path_part1.concat(path_part2);
127.92 + path_to_find = full_path + "." + name;
127.93 + }
127.94 + try {
127.95 + prjNav.tree().findPath(path_to_find);
127.96 + }
127.97 + catch(TimeoutExpiredException tee) {
127.98 + try {
127.99 + prjNav.pressPopupItemOnNode(full_path, popupNewPackage, new Operator.DefaultStringComparator(true, true));
127.100 + }
127.101 + catch(Exception e) {
127.102 + throw new JemmyException(popupNewPackage + " item in popup menu of " + full_path + " node can't be found!", e);
127.103 + }
127.104 + TestUtils.wait(1000);
127.105 + try {
127.106 + JDialogOperator jdo = new JDialogOperator(dlgNewPackage);
127.107 + if (!path_part2.equals("")) path_part2 = path_part2 + ".";
127.108 + new JTextFieldOperator(jdo, 0).setText(path_part2 + name);
127.109 + TestUtils.wait(500);
127.110 + new JButtonOperator(jdo, btnFinish).pushNoBlock();
127.111 + }
127.112 + catch(Exception e) {
127.113 + throw new JemmyException("Error occurs in " + dlgNewPackage + " dialog!", e);
127.114 + }
127.115 + TestUtils.wait(1000);
127.116 + }
127.117 + SourceFolder newSourceFolder = new SourceFolder(new TreePath(full_path), name, this);
127.118 + childList.add(newSourceFolder);
127.119 + return newSourceFolder;
127.120 + }
127.121 + else return getSourceSubFolder(name);
127.122 + }
127.123 +
127.124 + /**
127.125 + * Get source subfolder with specified name.
127.126 + * @param name Name of source subfolder.
127.127 + * @return Source folder with specified name.
127.128 + */
127.129 + public SourceFolder getSourceSubFolder(String name) {
127.130 + for (int i = 0; i < childList.size(); i++) {
127.131 + if (childList.get(i) instanceof SourceFolder && ((SourceFolder) childList.get(i)).getName().equals(name))
127.132 + return ((SourceFolder) childList.get(i));
127.133 + }
127.134 + return null;
127.135 + }
127.136 +
127.137 + /**
127.138 + * Add Java file to folder.
127.139 + * @param name Name of Java file.
127.140 + * @return Added Java file.
127.141 + */
127.142 + public JavaFile addJavaFile(String name) {
127.143 + if (getJavaFile(name) == null) {
127.144 + String path_part1 = "", path_part2 = "", full_path = "";
127.145 + ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
127.146 + TestUtils.wait(1000);
127.147 + full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
127.148 + if (full_path.indexOf("|", full_path.indexOf("|") + 1) != -1) {
127.149 + path_part1 = full_path.substring(0, full_path.indexOf("|", full_path.indexOf("|") + 1) + 1);
127.150 + path_part2 = full_path.substring(full_path.indexOf("|", full_path.indexOf("|") + 1) +1, full_path.length()).replace('|', '.');
127.151 + full_path = path_part1.concat(path_part2);
127.152 + }
127.153 + try {
127.154 + prjNav.tree().findPath(full_path + "|" + name + ".java");
127.155 + }
127.156 + catch(TimeoutExpiredException tee) {
127.157 + try {
127.158 + prjNav.pressPopupItemOnNode(full_path, popupNewClass, new Operator.DefaultStringComparator(true, true));
127.159 + }
127.160 + catch(Exception e) {
127.161 + throw new JemmyException(popupNewClass + " item in popup menu of " + full_path + " node can't be found!", e);
127.162 + }
127.163 + TestUtils.wait(1000);
127.164 + try {
127.165 + JDialogOperator jdo = new JDialogOperator(dlgNewClass);
127.166 + new JTextFieldOperator(jdo, 0).setText(name);
127.167 + TestUtils.wait(500);
127.168 + new JButtonOperator(jdo, btnFinish).pushNoBlock();
127.169 + }
127.170 + catch(Exception e) {
127.171 + throw new JemmyException("Error occurs in " + dlgNewClass + " dialog!", e);
127.172 + }
127.173 + TestUtils.wait(1000);
127.174 + }
127.175 + JavaFile newJavaFile;
127.176 + if (getParent() instanceof RootEntry) newJavaFile = new JavaFile(new TreePath(full_path + "|<default package>"), name, this);
127.177 + else newJavaFile = new JavaFile(new TreePath(full_path), name, this);
127.178 + childList.add(newJavaFile);
127.179 + return newJavaFile;
127.180 + }
127.181 + else return getJavaFile(name);
127.182 + }
127.183 +
127.184 + /**
127.185 + * Get Java file with specified name.
127.186 + * @param name Name of Java file.
127.187 + * @return Java file with specified name.
127.188 + */
127.189 + public JavaFile getJavaFile(String name) {
127.190 + for (int i = 0; i < childList.size(); i++) {
127.191 + if (childList.get(i) instanceof JavaFile && ((JavaFile) childList.get(i)).getName().equals(name))
127.192 + return ((JavaFile) childList.get(i));
127.193 + }
127.194 + if ((getParent().getParent() instanceof RootEntry) &&
127.195 + (name.equals("ApplicationBean1") || name.equals("RequestBean1") ||
127.196 + name.equals("SessionBean1"))) {
127.197 + String str_path = this.path.toString().substring(1, this.path.toString().length() - 1);
127.198 + JavaFile newJavaFile = new JavaFile(new TreePath(str_path + "|" + this.name), name, this);
127.199 + childList.add(newJavaFile);
127.200 + return newJavaFile;
127.201 + }
127.202 + return null;
127.203 + }
127.204 +}
128.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/WebPage.java Thu Jul 10 04:32:50 2008 -0700
128.3 @@ -0,0 +1,284 @@
128.4 +/*
128.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
128.6 + *
128.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
128.8 + *
128.9 + * The contents of this file are subject to the terms of either the GNU
128.10 + * General Public License Version 2 only ("GPL") or the Common
128.11 + * Development and Distribution License("CDDL") (collectively, the
128.12 + * "License"). You may not use this file except in compliance with the
128.13 + * License. You can obtain a copy of the License at
128.14 + * http://www.netbeans.org/cddl-gplv2.html
128.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
128.16 + * specific language governing permissions and limitations under the
128.17 + * License. When distributing the software, include this License Header
128.18 + * Notice in each file and include the License file at
128.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
128.20 + * particular file as subject to the "Classpath" exception as provided
128.21 + * by Sun in the GPL Version 2 section of the License file that
128.22 + * accompanied this code. If applicable, add the following below the
128.23 + * License Header, with the fields enclosed by brackets [] replaced by
128.24 + * your own identifying information:
128.25 + * "Portions Copyrighted [year] [name of copyright owner]"
128.26 + *
128.27 + * Contributor(s):
128.28 + *
128.29 + * The Original Software is NetBeans. The Initial Developer of the Original
128.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
128.31 + * Microsystems, Inc. All Rights Reserved.
128.32 + *
128.33 + * If you wish your version of this file to be governed by only the CDDL
128.34 + * or only the GPL Version 2, indicate your decision by adding
128.35 + * "[Contributor] elects to include this software in this distribution
128.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
128.37 + * single choice of license, a recipient has the option to distribute
128.38 + * your version of this file under either the CDDL, the GPL Version 2 or
128.39 + * to extend the choice of license to its licensees as provided above.
128.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
128.41 + * Version 2 license, then the option applies only if the new code is
128.42 + * made subject to such option by the copyright holder.
128.43 + */
128.44 +
128.45 +package org.netbeans.modules.visualweb.gravy.model.project;
128.46 +
128.47 +import org.netbeans.modules.visualweb.gravy.model.navigation.*;
128.48 +import org.netbeans.modules.visualweb.gravy.model.components.*;
128.49 +import org.netbeans.modules.visualweb.gravy.model.project.components.*;
128.50 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
128.51 +import org.netbeans.modules.visualweb.gravy.PageTopComponentOperator;
128.52 +import org.netbeans.modules.visualweb.gravy.TestUtils;
128.53 +import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
128.54 +import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
128.55 +import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
128.56 +
128.57 +import org.netbeans.jemmy.TimeoutExpiredException;
128.58 +import org.netbeans.jemmy.JemmyException;
128.59 +
128.60 +import javax.swing.tree.TreePath;
128.61 +import java.awt.Point;
128.62 +import java.io.File;
128.63 +import java.util.ArrayList;
128.64 +import java.util.List;
128.65 +
128.66 +/**
128.67 + * Web pages included in Project.
128.68 + */
128.69 +
128.70 +public class WebPage extends JSPFile implements LinkableSource, LinkableTarget {
128.71 +
128.72 + private final static String propID = "id";
128.73 +
128.74 + PageTopComponentOperator page = null;
128.75 +
128.76 + private JavaFile jf;
128.77 +
128.78 + private String sep = File.separator;
128.79 +
128.80 + /**
128.81 + * Creates a new instance of web page.
128.82 + * @param path Path to web page in project.
128.83 + * @param name Name of web page.
128.84 + */
128.85 + WebPage(TreePath path, String name, ProjectEntry parent) {
128.86 + super(path, name, parent);
128.87 + SourceFolder sf = ((WebPageFolder) parent).getSourceFolder();
128.88 + JavaFile jf = sf.addJavaFile(name);
128.89 + jf.webpage = this;
128.90 + this.jf = jf;
128.91 + webpage = this;
128.92 + }
128.93 +
128.94 + /**
128.95 + * Get Java file for this web page.
128.96 + * @return Java file for this web page.
128.97 + */
128.98 + public JavaFile getJavaFile() {
128.99 + return jf;
128.100 + }
128.101 +
128.102 + /**
128.103 + * Return added component.
128.104 + * @param webcomponent Component in palette to add.
128.105 + * @return Component which was added.
128.106 + */
128.107 + public Component add(WebComponent webcomponent){
128.108 + return add(webcomponent, new Point(0, 0));
128.109 + }
128.110 +
128.111 + /**
128.112 + * Return added component.
128.113 + * @param webcomponent Component in palette to add.
128.114 + * @param point Point to place component.
128.115 + * @return Component which was added.
128.116 + */
128.117 + public Component add(WebComponent webcomponent, Point point){
128.118 + return add(webcomponent, point, null);
128.119 + }
128.120 +
128.121 + /**
128.122 + * Return added component.
128.123 + * @param webcomponent Component in palette to add.
128.124 + * @param point Point to place component.
128.125 + * @param name Name of component.
128.126 + * @return Component which was added.
128.127 + */
128.128 + public Component add(WebComponent webcomponent, Point point, String name){
128.129 + open();
128.130 + DesignerPaneOperator designer = page.getDesigner();
128.131 + TestUtils.wait(1000);
128.132 + PaletteContainerOperator palette = null;
128.133 + try {
128.134 + palette = new PaletteContainerOperator(webcomponent.getComponentSet().getID());
128.135 + }
128.136 + catch(Exception e) {
128.137 + throw new JemmyException("Palette category with name " + webcomponent.getComponentSet().getID()+ " can't be found!", e);
128.138 + }
128.139 + TestUtils.wait(2000);
128.140 + try {
128.141 + palette.addComponent(webcomponent.getID(), designer, point);
128.142 + }
128.143 + catch(Exception e) {
128.144 + throw new JemmyException("Component " + webcomponent.getID()+ " can't be added!", e);
128.145 + }
128.146 + TestUtils.wait(2000);
128.147 + try {
128.148 + SheetTableOperator sheet = new SheetTableOperator();
128.149 + if (name == null) name = sheet.getValue(propID);
128.150 + else sheet.setTextValue(propID, name);
128.151 + }
128.152 + catch(Exception e) {
128.153 + throw new JemmyException("Name for component " + webcomponent.getID()+ " can't be set!", e);
128.154 + }
128.155 + Component newComponent;
128.156 + if (webcomponent.isVisual()) {
128.157 + if (webcomponent.isEventHadling()) newComponent = new VisualEventHandlingComponent(webcomponent, name);
128.158 + else newComponent = new VisualComponent(webcomponent, name);
128.159 + ((VisualComponent) newComponent).setCoordinates(point);
128.160 + }
128.161 + else newComponent = new NonVisualComponent(webcomponent, name);
128.162 + newComponent.Page = this;
128.163 + childList.add(newComponent);
128.164 + return newComponent;
128.165 + }
128.166 +
128.167 + /**
128.168 + * Return all component on web page.
128.169 + * @return Array of Component on web page.
128.170 + */
128.171 + public Component[] getComponents(){
128.172 + return ((Component[]) childList.toArray(new Component[childList.size()]));
128.173 + }
128.174 +
128.175 + /**
128.176 + * Return component on web page with specified index.
128.177 + * @param index Index of necessary component.
128.178 + * @return Component on web page with specified index.
128.179 + */
128.180 + public Component getComponent(int index){
128.181 + return ((Component) childList.get(index));
128.182 + }
128.183 +
128.184 + /**
128.185 + * Return component on web page with specified type and index.
128.186 + * @param index Index of necessary component.
128.187 + * @param type Type of necessary component.
128.188 + * @return Component on web page with specified type and index.
128.189 + */
128.190 + public Component getComponent(Component type, int index){
128.191 + List tmpComponents = new ArrayList();
128.192 + for (int i = 0; i < childList.size(); i++) {
128.193 + if (((Component) childList.get(i)).getType().equals(type.getType()))
128.194 + tmpComponents.add(childList.get(i));
128.195 + }
128.196 + return ((Component) tmpComponents.get(index));
128.197 + }
128.198 +
128.199 + /**
128.200 + * Return component on web page with specified ID.
128.201 + * @param ID ID of necessary component.
128.202 + * @return Component on web page with specified ID.
128.203 + */
128.204 + public Component getComponent(String ID){
128.205 + return null;
128.206 + }
128.207 +
128.208 + /**
128.209 + * Get name of linkable source web page.
128.210 + * @return Name of linkable source web page.
128.211 + */
128.212 + public String getLinkableSourceName() {
128.213 + String folder_path = getTreePath().toString();
128.214 + if (folder_path.indexOf("|", folder_path.indexOf("|") + 1) == -1) return getName() + ".jsp";
128.215 + folder_path = folder_path.substring(folder_path.indexOf("|", folder_path.indexOf("|") + 1) + 1, folder_path.length() - 1).replace('|', '/');
128.216 + return folder_path + "/" + getName() + ".jsp";
128.217 + }
128.218 +
128.219 + /**
128.220 + * Get name of linkable target web page.
128.221 + * @return Name of linkable target web page.
128.222 + */
128.223 + public String getLinkableTargetName() {
128.224 + String folder_path = getTreePath().toString();
128.225 + if (folder_path.indexOf("|", folder_path.indexOf("|") + 1) == -1) return getName() + ".jsp";
128.226 + folder_path = folder_path.substring(folder_path.indexOf("|", folder_path.indexOf("|") + 1) + 1, folder_path.length() - 1).replace('|', '/');
128.227 + return folder_path + "/" + getName() + ".jsp";
128.228 + }
128.229 +
128.230 + /**
128.231 + * Get project, which this web page belongs to.
128.232 + * @return Project Project, which this web page belongs to.
128.233 + */
128.234 + private Project getProject() {
128.235 + ProjectEntry tmp = this;
128.236 + while (!((tmp = tmp.getParent()) instanceof RootEntry));
128.237 + return ((RootEntry) tmp).getProject();
128.238 + }
128.239 +
128.240 + /**
128.241 + * Open web page file.
128.242 + */
128.243 + public void open() {
128.244 + long tmpTimeout = 0;
128.245 + String tmp_path = getTreePath().toString();
128.246 + int start_compare = tmp_path.indexOf(RootEntry.webPagesName) + RootEntry.webPagesName.length() + 1;
128.247 + String compare_tooltip;
128.248 + if (start_compare != tmp_path.length())
128.249 + compare_tooltip = ((tmp_path.substring(start_compare, tmp_path.length() - 1)) + "|" + this.name + ".jsp").replace('|', File.separatorChar);
128.250 + else
128.251 + compare_tooltip = this.name + ".jsp";
128.252 + String project_path = getProject().getLocation() + getProject().getName() + sep + "web" + sep;
128.253 + compare_tooltip = project_path + compare_tooltip;
128.254 + try {
128.255 + tmpTimeout = RaveWindowOperator.getDefaultRave().getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
128.256 + RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
128.257 + if (page == null) {
128.258 + int i = 0;
128.259 + while (!((String) (page = new PageTopComponentOperator(getName(), i++)).getDump().get("Tooltip text")).equals(compare_tooltip));
128.260 + }
128.261 + else {
128.262 + try {
128.263 + page.makeComponentVisible();
128.264 + }
128.265 + catch(Exception e) {throw new TimeoutExpiredException("");}
128.266 + }
128.267 + }
128.268 + catch (TimeoutExpiredException e) {
128.269 + int i = 0;
128.270 + super.open();
128.271 + while (!((String) (page = new PageTopComponentOperator(getName(), i++)).getDump().get("Tooltip text")).equals(compare_tooltip));
128.272 + }
128.273 + finally {
128.274 + RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", tmpTimeout);
128.275 + }
128.276 + page.getDesigner();
128.277 + }
128.278 +
128.279 + /**
128.280 + * Close web page file.
128.281 + */
128.282 + public void close() {
128.283 + open();
128.284 + TestUtils.wait(500);
128.285 + page.close();
128.286 + }
128.287 +}
129.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
129.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/WebPageFolder.java Thu Jul 10 04:32:50 2008 -0700
129.3 @@ -0,0 +1,194 @@
129.4 +/*
129.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
129.6 + *
129.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
129.8 + *
129.9 + * The contents of this file are subject to the terms of either the GNU
129.10 + * General Public License Version 2 only ("GPL") or the Common
129.11 + * Development and Distribution License("CDDL") (collectively, the
129.12 + * "License"). You may not use this file except in compliance with the
129.13 + * License. You can obtain a copy of the License at
129.14 + * http://www.netbeans.org/cddl-gplv2.html
129.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
129.16 + * specific language governing permissions and limitations under the
129.17 + * License. When distributing the software, include this License Header
129.18 + * Notice in each file and include the License file at
129.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
129.20 + * particular file as subject to the "Classpath" exception as provided
129.21 + * by Sun in the GPL Version 2 section of the License file that
129.22 + * accompanied this code. If applicable, add the following below the
129.23 + * License Header, with the fields enclosed by brackets [] replaced by
129.24 + * your own identifying information:
129.25 + * "Portions Copyrighted [year] [name of copyright owner]"
129.26 + *
129.27 + * Contributor(s):
129.28 + *
129.29 + * The Original Software is NetBeans. The Initial Developer of the Original
129.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
129.31 + * Microsystems, Inc. All Rights Reserved.
129.32 + *
129.33 + * If you wish your version of this file to be governed by only the CDDL
129.34 + * or only the GPL Version 2, indicate your decision by adding
129.35 + * "[Contributor] elects to include this software in this distribution
129.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
129.37 + * single choice of license, a recipient has the option to distribute
129.38 + * your version of this file under either the CDDL, the GPL Version 2 or
129.39 + * to extend the choice of license to its licensees as provided above.
129.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
129.41 + * Version 2 license, then the option applies only if the new code is
129.42 + * made subject to such option by the copyright holder.
129.43 + */
129.44 +
129.45 +package org.netbeans.modules.visualweb.gravy.model.project;
129.46 +
129.47 +import org.netbeans.modules.visualweb.gravy.Bundle;
129.48 +import org.netbeans.modules.visualweb.gravy.TestUtils;
129.49 +import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
129.50 +
129.51 +import org.netbeans.jemmy.JemmyException;
129.52 +import org.netbeans.jemmy.operators.Operator;
129.53 +import org.netbeans.jemmy.operators.JButtonOperator;
129.54 +import org.netbeans.jemmy.operators.JDialogOperator;
129.55 +import org.netbeans.jemmy.operators.JTextFieldOperator;
129.56 +
129.57 +import javax.swing.tree.TreePath;
129.58 +
129.59 +/**
129.60 + * Class for web page folders included in Project.
129.61 + */
129.62 +
129.63 +public class WebPageFolder extends Folder {
129.64 +
129.65 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
129.66 + private final static String popupNew = Bundle.getStringTrimmed(bundle, "New");
129.67 + private final static String popupFolder = Bundle.getStringTrimmed(bundle, "Folder");
129.68 + private final static String popupNewFolder = popupNew + "|" + popupFolder + "...";
129.69 + private final static String dlgNewFolder = popupNew + " " + popupFolder;
129.70 + private final static String popupPage = Bundle.getStringTrimmed(
129.71 + Bundle.getStringTrimmed(bundle, "JSFResBundle"),
129.72 + Bundle.getStringTrimmed(bundle, "Page"));
129.73 + private final static String popupNewPage = popupNew + "|" + popupPage + "...";
129.74 + private final static String dlgNewPage = popupNew + " " + popupPage;
129.75 + private final static String btnFinish = Bundle.getStringTrimmed(bundle, "FinishButton");
129.76 + private final static String btnCancel = Bundle.getStringTrimmed(bundle, "CancelButton");
129.77 +
129.78 + private SourceFolder sf;
129.79 +
129.80 + WebPageFolder(TreePath path, String name, ProjectEntry parent) {
129.81 + super(path, name, parent);
129.82 + if (parent instanceof RootEntry) {
129.83 + RootEntry root = (RootEntry) parent;
129.84 + SourceFolder srf = new SourceFolder(new TreePath(root.getProject().getName()), root.sourcePackagesName, root);
129.85 + SourceFolder sf = new SourceFolder(new TreePath(root.getProject().getName() + "|" + root.sourcePackagesName), root.getProject().getName().toLowerCase(), srf);
129.86 + srf.childList.add(sf);
129.87 + root.childList.add(srf);
129.88 + this.sf = sf;
129.89 + }
129.90 + else this.sf = ((WebPageFolder) parent).getSourceFolder().addSourceSubFolder(name);
129.91 + }
129.92 +
129.93 + /**
129.94 + * Add new web page to folder.
129.95 + * @param name Name of new web page.
129.96 + * @return Added web page.
129.97 + */
129.98 + public WebPage addWebPage(String name) {
129.99 + if (getWebPage(name) == null) {
129.100 + ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
129.101 + TestUtils.wait(4000);
129.102 + String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
129.103 + try {
129.104 + prjNav.pressPopupItemOnNode(full_path, popupNewPage, new Operator.DefaultStringComparator(true, true));
129.105 + }
129.106 + catch(Exception e) {
129.107 + throw new JemmyException(popupNewPage + " item in popup menu of " + full_path + " node can't be found!", e);
129.108 + }
129.109 + TestUtils.wait(1000);
129.110 + try {
129.111 + JDialogOperator jdo = new JDialogOperator(dlgNewPage);
129.112 + new JTextFieldOperator(jdo, 0).setText(name);
129.113 + TestUtils.wait(500);
129.114 + new JButtonOperator(jdo, btnFinish).pushNoBlock();
129.115 + }
129.116 + catch(Exception e) {
129.117 + throw new JemmyException("Error occurs in " + dlgNewPage + " dialog!", e);
129.118 + }
129.119 + TestUtils.wait(1000);
129.120 + WebPage newWebPage = new WebPage(new TreePath(full_path), name, this);
129.121 + childList.add(newWebPage);
129.122 + return newWebPage;
129.123 + }
129.124 + else return getWebPage(name);
129.125 + }
129.126 +
129.127 + /**
129.128 + * Get web page with specified name.
129.129 + * @param name Name of web page.
129.130 + * @return Web page with specified name.
129.131 + */
129.132 + public WebPage getWebPage(String name) {
129.133 + for (int i = 0; i < childList.size(); i++) {
129.134 + if ((childList.get(i) instanceof WebPage) && ((WebPage) childList.get(i)).getName().equals(name))
129.135 + return ((WebPage) childList.get(i));
129.136 + }
129.137 + if (getParent() instanceof RootEntry && name.equals("Page1")) {
129.138 + String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
129.139 + WebPage newWebPage = new WebPage(new TreePath(full_path), name, this);
129.140 + childList.add(newWebPage);
129.141 + return newWebPage;
129.142 + }
129.143 + return null;
129.144 + }
129.145 +
129.146 + /**
129.147 + * Add web page folder to folder.
129.148 + * @param name Name of web page folder.
129.149 + * @return Added web page folder.
129.150 + */
129.151 + public WebPageFolder addWebPageSubFolder(String name) {
129.152 + ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
129.153 + TestUtils.wait(1000);
129.154 + String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
129.155 + try {
129.156 + prjNav.pressPopupItemOnNode(full_path, popupNewFolder, new Operator.DefaultStringComparator(true, true));
129.157 + }
129.158 + catch(Exception e) {
129.159 + throw new JemmyException(popupNewFolder + " item in popup menu of " + full_path + " node can't be found!", e);
129.160 + }
129.161 + TestUtils.wait(1000);
129.162 + try {
129.163 + JDialogOperator jdo = new JDialogOperator(dlgNewFolder);
129.164 + new JTextFieldOperator(jdo, 0).setText(name);
129.165 + TestUtils.wait(500);
129.166 + new JButtonOperator(jdo, btnFinish).pushNoBlock();
129.167 + }
129.168 + catch(Exception e) {
129.169 + throw new JemmyException("Error occurs in " + dlgNewFolder + " dialog!", e);
129.170 + }
129.171 + TestUtils.wait(1000);
129.172 + WebPageFolder newWebPageFolder = new WebPageFolder(new TreePath(full_path), name, this);
129.173 + childList.add(newWebPageFolder);
129.174 + return newWebPageFolder;
129.175 + }
129.176 +
129.177 + /**
129.178 + * Get web page subfolder with specified name.
129.179 + * @param name Name of web page subfolder.
129.180 + * @return Web page folder with specified name.
129.181 + */
129.182 + public WebPageFolder getWebPageSubFolder(String name) {
129.183 + for (int i = 0; i < childList.size(); i++) {
129.184 + if (childList.get(i) instanceof WebPageFolder && ((WebPageFolder) childList.get(i)).getName().equals(name))
129.185 + return ((WebPageFolder) childList.get(i));
129.186 + }
129.187 + return null;
129.188 + }
129.189 +
129.190 + /**
129.191 + * Get source folder for this web page folder.
129.192 + * @return Source folder for this web page folder.
129.193 + */
129.194 + public SourceFolder getSourceFolder() {
129.195 + return sf;
129.196 + }
129.197 +}
130.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
130.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/XMLFile.java Thu Jul 10 04:32:50 2008 -0700
130.3 @@ -0,0 +1,217 @@
130.4 +/*
130.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
130.6 + *
130.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
130.8 + *
130.9 + * The contents of this file are subject to the terms of either the GNU
130.10 + * General Public License Version 2 only ("GPL") or the Common
130.11 + * Development and Distribution License("CDDL") (collectively, the
130.12 + * "License"). You may not use this file except in compliance with the
130.13 + * License. You can obtain a copy of the License at
130.14 + * http://www.netbeans.org/cddl-gplv2.html
130.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
130.16 + * specific language governing permissions and limitations under the
130.17 + * License. When distributing the software, include this License Header
130.18 + * Notice in each file and include the License file at
130.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
130.20 + * particular file as subject to the "Classpath" exception as provided
130.21 + * by Sun in the GPL Version 2 section of the License file that
130.22 + * accompanied this code. If applicable, add the following below the
130.23 + * License Header, with the fields enclosed by brackets [] replaced by
130.24 + * your own identifying information:
130.25 + * "Portions Copyrighted [year] [name of copyright owner]"
130.26 + *
130.27 + * Contributor(s):
130.28 + *
130.29 + * The Original Software is NetBeans. The Initial Developer of the Original
130.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
130.31 + * Microsystems, Inc. All Rights Reserved.
130.32 + *
130.33 + * If you wish your version of this file to be governed by only the CDDL
130.34 + * or only the GPL Version 2, indicate your decision by adding
130.35 + * "[Contributor] elects to include this software in this distribution
130.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
130.37 + * single choice of license, a recipient has the option to distribute
130.38 + * your version of this file under either the CDDL, the GPL Version 2 or
130.39 + * to extend the choice of license to its licensees as provided above.
130.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
130.41 + * Version 2 license, then the option applies only if the new code is
130.42 + * made subject to such option by the copyright holder.
130.43 + */
130.44 +
130.45 +package org.netbeans.modules.visualweb.gravy.model.project;
130.46 +
130.47 +import java.util.ArrayList;
130.48 +import java.util.List;
130.49 +import javax.swing.tree.TreePath;
130.50 +
130.51 +/**
130.52 + * Class for XML files.
130.53 + */
130.54 +
130.55 +public class XMLFile extends SourceFile implements ProjectEntry {
130.56 +
130.57 + /**
130.58 + * Parent of the xml file.
130.59 + */
130.60 + private ProjectEntry parent;
130.61 +
130.62 + /**
130.63 + * Child project entries of the xml file.
130.64 + */
130.65 + private List childList = new ArrayList();
130.66 +
130.67 + /**
130.68 + * Creates a new instance of web page.
130.69 + * @param path Path to web page in project.
130.70 + * @param name Name of web page.
130.71 + */
130.72 + XMLFile(TreePath path, String name, ProjectEntry parent) {
130.73 + super(path, name);
130.74 + setParent(parent);
130.75 + }
130.76 +
130.77 + /**
130.78 + * Save project entry.
130.79 + */
130.80 + public void save() {
130.81 + }
130.82 +
130.83 + /**
130.84 + * Save project entry as project entry with specified name.
130.85 + */
130.86 + public void saveAs(String name) {
130.87 + }
130.88 +
130.89 + /**
130.90 + * @return Name of the project entry.
130.91 + */
130.92 + public String getName() {
130.93 + return name;
130.94 + }
130.95 +
130.96 + /**
130.97 + * @return TreePath of the project entry.
130.98 + */
130.99 + public TreePath getTreePath() {
130.100 + return path;
130.101 + }
130.102 +
130.103 + /**
130.104 + * @return Parent of the xml file.
130.105 + */
130.106 + public ProjectEntry getParent() {
130.107 + return parent;
130.108 + }
130.109 +
130.110 + /**
130.111 + * Set parent of the xml file.
130.112 + */
130.113 + private void setParent(ProjectEntry parent) {
130.114 + this.parent = parent;
130.115 + }
130.116 +
130.117 + /**
130.118 + * @return Child project entries of the xml file.
130.119 + */
130.120 + public ProjectEntry[] getChildren() {
130.121 + return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
130.122 + }
130.123 +
130.124 + /**
130.125 + * Remove project entry.
130.126 + */
130.127 + public void delete() {
130.128 + }
130.129 +
130.130 + /**
130.131 + * Gets text from the currently opened xml file.
130.132 + * @return String representing whole content of the xml file.
130.133 + * (including new line characters)
130.134 + */
130.135 + public String getText() {
130.136 + return null;
130.137 + }
130.138 +
130.139 + /**
130.140 + * Gets text from specified line.
130.141 + * @param lineNumber Number of line.
130.142 + * @return String representing content of the line.
130.143 + */
130.144 + public String getText(int lineNumber) {
130.145 + return null;
130.146 + }
130.147 +
130.148 + /**
130.149 + * Checks if xml file contains text specified as parameter text.
130.150 + * @param text Text to compare to.
130.151 + * @return true if text was found, false otherwise.
130.152 + */
130.153 + public boolean contains(String text) {
130.154 + return true;
130.155 + }
130.156 +
130.157 + /**
130.158 + * Replaces first occurence of oldText by newText.
130.159 + * @param oldText Text to be replaced.
130.160 + * @param newText Text to write instead.
130.161 + */
130.162 + public void replace(String oldText, String newText) {
130.163 + }
130.164 +
130.165 + /**
130.166 + * Replaced index-th occurence of oldText by newText.
130.167 + * @param oldText Text to be replaced
130.168 + * @param newText Text to write instead
130.169 + * @param index Tndex of oldText occurence.
130.170 + */
130.171 + public void replace(String oldText, String newText, int index) {
130.172 + }
130.173 +
130.174 + /**
130.175 + * Insert text to current position.
130.176 + * @param text String to be inserted.
130.177 + */
130.178 + public void insert(String text) {
130.179 + }
130.180 +
130.181 + /**
130.182 + * Inserts text to position specified by line number and column.
130.183 + * @param text String to be inserted.
130.184 + * @param lineNumber Number of line.
130.185 + * @param column Column position.
130.186 + */
130.187 + public void insert(String text, int lineNumber, int column) {
130.188 + }
130.189 +
130.190 + /**
130.191 + * Deletes given number of characters from specified possition.
130.192 + * @param offset Position inside document.
130.193 + * @param length Number of characters to be deleted.
130.194 + */
130.195 + public void delete(int offset, int length) {
130.196 + }
130.197 +
130.198 + /**
130.199 + * Deletes given number of characters from current caret possition.
130.200 + * @param length Number of characters to be deleted.
130.201 + */
130.202 + public void delete(int length) {
130.203 + }
130.204 +
130.205 + /**
130.206 + * Delete specified line.
130.207 + * @param line Number of line.
130.208 + */
130.209 + public void deleteLine(int line) {
130.210 + }
130.211 +
130.212 + /**
130.213 + * Deletes characters between column1 and column2 on the specified line.
130.214 + * @param lineNumber Number of line.
130.215 + * @param column1 Column position where to start deleting.
130.216 + * @param column2 Column position where to stop deleting.
130.217 + */
130.218 + public void delete(int lineNumber, int column1, int column2) {
130.219 + }
130.220 +}
131.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
131.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/Bundle.properties Thu Jul 10 04:32:50 2008 -0700
131.3 @@ -0,0 +1,62 @@
131.4 +/*
131.5 +
131.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
131.7 + *
131.8 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
131.9 +
131.10 + *
131.11 + * The contents of this file are subject to the terms of either the GNU
131.12 + * General Public License Version 2 only ("GPL") or the Common
131.13 + * Development and Distribution License("CDDL") (collectively, the
131.14 + * "License"). You may not use this file except in compliance with the
131.15 + * License. You can obtain a copy of the License at
131.16 + * http://www.netbeans.org/cddl-gplv2.html
131.17 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
131.18 + * specific language governing permissions and limitations under the
131.19 + * License. When distributing the software, include this License Header
131.20 + * Notice in each file and include the License file at
131.21 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
131.22 + * particular file as subject to the "Classpath" exception as provided
131.23 + * by Sun in the GPL Version 2 section of the License file that
131.24 + * accompanied this code. If applicable, add the following below the
131.25 + * License Header, with the fields enclosed by brackets [] replaced by
131.26 + * your own identifying information:
131.27 + * "Portions Copyrighted [year] [name of copyright owner]"
131.28 + *
131.29 + * Contributor(s):
131.30 +
131.31 + *
131.32 +
131.33 + * The Original Software is NetBeans. The Initial Developer of the Original
131.34 +
131.35 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
131.36 +
131.37 + * Microsystems, Inc. All Rights Reserved.
131.38 + *
131.39 + * If you wish your version of this file to be governed by only the CDDL
131.40 + * or only the GPL Version 2, indicate your decision by adding
131.41 + * "[Contributor] elects to include this software in this distribution
131.42 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
131.43 + * single choice of license, a recipient has the option to distribute
131.44 + * your version of this file under either the CDDL, the GPL Version 2 or
131.45 + * to extend the choice of license to its licensees as provided above.
131.46 + * However, if you add GPL Version 2 code and therefore, elected the GPL
131.47 + * Version 2 license, then the option applies only if the new code is
131.48 + * made subject to such option by the copyright holder.
131.49 +
131.50 + */
131.51 +
131.52 +
131.53 +
131.54 +#properties for Projects window and rave bundle
131.55 +
131.56 +InsyncBundle=org.netbeans.modules.visualweb.insync.action.Bundle
131.57 +
131.58 +OutlineBundle=org.netbeans.modules.visualweb.outline.Bundle
131.59 +
131.60 +ViewOutline=LBL_OutlinePanel
131.61 +
131.62 +EditEventHandler=LBL_EditEventHandlerAction
131.63 +
131.64 +EditDefEventHandler=LBL_EditEventHandlerActionName
131.65 +
132.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
132.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/Component.java Thu Jul 10 04:32:50 2008 -0700
132.3 @@ -0,0 +1,148 @@
132.4 +/*
132.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
132.6 + *
132.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
132.8 + *
132.9 + * The contents of this file are subject to the terms of either the GNU
132.10 + * General Public License Version 2 only ("GPL") or the Common
132.11 + * Development and Distribution License("CDDL") (collectively, the
132.12 + * "License"). You may not use this file except in compliance with the
132.13 + * License. You can obtain a copy of the License at
132.14 + * http://www.netbeans.org/cddl-gplv2.html
132.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
132.16 + * specific language governing permissions and limitations under the
132.17 + * License. When distributing the software, include this License Header
132.18 + * Notice in each file and include the License file at
132.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
132.20 + * particular file as subject to the "Classpath" exception as provided
132.21 + * by Sun in the GPL Version 2 section of the License file that
132.22 + * accompanied this code. If applicable, add the following below the
132.23 + * License Header, with the fields enclosed by brackets [] replaced by
132.24 + * your own identifying information:
132.25 + * "Portions Copyrighted [year] [name of copyright owner]"
132.26 + *
132.27 + * Contributor(s):
132.28 + *
132.29 + * The Original Software is NetBeans. The Initial Developer of the Original
132.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
132.31 + * Microsystems, Inc. All Rights Reserved.
132.32 + *
132.33 + * If you wish your version of this file to be governed by only the CDDL
132.34 + * or only the GPL Version 2, indicate your decision by adding
132.35 + * "[Contributor] elects to include this software in this distribution
132.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
132.37 + * single choice of license, a recipient has the option to distribute
132.38 + * your version of this file under either the CDDL, the GPL Version 2 or
132.39 + * to extend the choice of license to its licensees as provided above.
132.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
132.41 + * Version 2 license, then the option applies only if the new code is
132.42 + * made subject to such option by the copyright holder.
132.43 + */
132.44 +
132.45 +package org.netbeans.modules.visualweb.gravy.model.project.components;
132.46 +
132.47 +import org.netbeans.modules.visualweb.gravy.model.project.WebPage;
132.48 +import org.netbeans.modules.visualweb.gravy.model.components.*;
132.49 +import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
132.50 +import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
132.51 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
132.52 +import org.netbeans.modules.visualweb.gravy.TestUtils;
132.53 +
132.54 +import org.netbeans.jemmy.operators.JTreeOperator;
132.55 +import org.netbeans.jemmy.JemmyException;
132.56 +
132.57 +import java.awt.Container;
132.58 +import javax.swing.JLabel;
132.59 +import java.util.Hashtable;
132.60 +
132.61 +/**
132.62 + * Common class for all components on web page.
132.63 + */
132.64 +
132.65 +public class Component {
132.66 +
132.67 + final static String OS_MAC = "Mac OS X";
132.68 + final static String OS_SOL = "SunOS";
132.69 + final static String OS_WIN = "Windows";
132.70 + final static String OS_LIN = "Linux";
132.71 + final String propName = "id";
132.72 + public WebPage Page;
132.73 + protected String Type = "";
132.74 +
132.75 +
132.76 + /**
132.77 + * Component's properties.
132.78 + */
132.79 + private Hashtable properties = new Hashtable();
132.80 +
132.81 + /**
132.82 + * Create component on web page using web component from palette.
132.83 + * @param webcomponent Web component from palette.
132.84 + * @param name Name of component.
132.85 + */
132.86 + public Component(WebComponent webcomponent, String name) {
132.87 + Type = webcomponent.getID();
132.88 + properties.put(propName, name);
132.89 + }
132.90 +
132.91 + /**
132.92 + * Get name of component.
132.93 + * @return Name of component.
132.94 + */
132.95 + public String getName() {
132.96 + return ((String) getProperty(propName));
132.97 + }
132.98 +
132.99 + /**
132.100 + * Get type of component.
132.101 + * @return Type of component.
132.102 + */
132.103 + public String getType() {
132.104 + return Type;
132.105 + }
132.106 +
132.107 + /**
132.108 + * Return property value.
132.109 + * @param name Name of property.
132.110 + * @return Property value.
132.111 + */
132.112 + public String getProperty(String name) {
132.113 + return properties.get(name).toString();
132.114 + }
132.115 +
132.116 + /**
132.117 + * Set property value.
132.118 + * @param name Name of property.
132.119 + * @param value Value of property.
132.120 + */
132.121 + public void setProperty(String name, String value) {
132.122 + Page.open();
132.123 + DocumentOutlineOperator outline = new DocumentOutlineOperator(RaveWindowOperator.getDefaultRave());
132.124 + TestUtils.wait(1000);
132.125 + JTreeOperator aotree = outline.getStructTreeOperator();
132.126 + try {
132.127 + aotree.selectPath(aotree.findPath(Page.getName() + "|page1|html1|body1|form1|" + getName()));
132.128 + }
132.129 + catch(Exception e) {
132.130 + throw new JemmyException("Path " + Page.getName() + "|page1|html1|body1|form1|" + getName() + " can't be selected!", e);
132.131 + }
132.132 + TestUtils.wait(1000);
132.133 + try {
132.134 + SheetTableOperator sheet = new SheetTableOperator();
132.135 + String class_0 = ((Container) sheet.getRenderedComponent(sheet.findCell("name:"+name, 0).y, 1)).getComponent(0).getClass().getName();
132.136 + String class_1 = ((Container) sheet.getRenderedComponent(sheet.findCell("name:"+name, 0).y, 1)).getComponent(1).getClass().getName();
132.137 + String propName = ((JLabel) sheet.getRenderedComponent(sheet.findCell("name:"+name, 0).y, 0)).getText();
132.138 + if (class_1.equals("org.openide.explorer.propertysheet.RendererFactory$StringRenderer")) sheet.setTextValue(propName, value);
132.139 + if (class_1.equals("org.openide.explorer.propertysheet.RendererFactory$CheckboxRenderer")) sheet.setCheckBoxValue(propName, value);
132.140 + if (class_1.equals("org.openide.explorer.propertysheet.RendererFactory$ComboboxRenderer") ||
132.141 + (class_0.indexOf("AquaComboBoxButton") != -1 && System.getProperty("os.name").equals(OS_MAC)) ||
132.142 + (class_0.indexOf("javax.swing.JButton") != -1 && System.getProperty("os.name").equals(OS_SOL)) ||
132.143 + (class_0.indexOf("WindowsComboBoxUI") != -1 && class_0.indexOf("ComboBoxButton") != -1 && System.getProperty("os.name").indexOf(OS_WIN) != -1) ||
132.144 + (class_0.indexOf("javax.swing.JButton") != -1 && System.getProperty("os.name").equals(OS_LIN))) sheet.setComboBoxValue(propName, value);
132.145 + }
132.146 + catch(Exception e) {
132.147 + throw new JemmyException("Property can't be set!", e);
132.148 + }
132.149 + properties.put(name, value);
132.150 + }
132.151 +}
133.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
133.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/NonVisualComponent.java Thu Jul 10 04:32:50 2008 -0700
133.3 @@ -0,0 +1,60 @@
133.4 +/*
133.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
133.6 + *
133.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
133.8 + *
133.9 + * The contents of this file are subject to the terms of either the GNU
133.10 + * General Public License Version 2 only ("GPL") or the Common
133.11 + * Development and Distribution License("CDDL") (collectively, the
133.12 + * "License"). You may not use this file except in compliance with the
133.13 + * License. You can obtain a copy of the License at
133.14 + * http://www.netbeans.org/cddl-gplv2.html
133.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
133.16 + * specific language governing permissions and limitations under the
133.17 + * License. When distributing the software, include this License Header
133.18 + * Notice in each file and include the License file at
133.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
133.20 + * particular file as subject to the "Classpath" exception as provided
133.21 + * by Sun in the GPL Version 2 section of the License file that
133.22 + * accompanied this code. If applicable, add the following below the
133.23 + * License Header, with the fields enclosed by brackets [] replaced by
133.24 + * your own identifying information:
133.25 + * "Portions Copyrighted [year] [name of copyright owner]"
133.26 + *
133.27 + * Contributor(s):
133.28 + *
133.29 + * The Original Software is NetBeans. The Initial Developer of the Original
133.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
133.31 + * Microsystems, Inc. All Rights Reserved.
133.32 + *
133.33 + * If you wish your version of this file to be governed by only the CDDL
133.34 + * or only the GPL Version 2, indicate your decision by adding
133.35 + * "[Contributor] elects to include this software in this distribution
133.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
133.37 + * single choice of license, a recipient has the option to distribute
133.38 + * your version of this file under either the CDDL, the GPL Version 2 or
133.39 + * to extend the choice of license to its licensees as provided above.
133.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
133.41 + * Version 2 license, then the option applies only if the new code is
133.42 + * made subject to such option by the copyright holder.
133.43 + */
133.44 +
133.45 +package org.netbeans.modules.visualweb.gravy.model.project.components;
133.46 +
133.47 +import org.netbeans.modules.visualweb.gravy.model.components.*;
133.48 +
133.49 +/**
133.50 + * Common class for all non visual components on web page.
133.51 + */
133.52 +
133.53 +public class NonVisualComponent extends Component {
133.54 +
133.55 + /**
133.56 + * Create non visual component on web page using web component from palette.
133.57 + * @param webcomponent
133.58 + * @param name
133.59 + */
133.60 + public NonVisualComponent(WebComponent webcomponent, String name) {
133.61 + super(webcomponent, name);
133.62 + }
133.63 +}
134.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
134.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/VisualComponent.java Thu Jul 10 04:32:50 2008 -0700
134.3 @@ -0,0 +1,80 @@
134.4 +/*
134.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
134.6 + *
134.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
134.8 + *
134.9 + * The contents of this file are subject to the terms of either the GNU
134.10 + * General Public License Version 2 only ("GPL") or the Common
134.11 + * Development and Distribution License("CDDL") (collectively, the
134.12 + * "License"). You may not use this file except in compliance with the
134.13 + * License. You can obtain a copy of the License at
134.14 + * http://www.netbeans.org/cddl-gplv2.html
134.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
134.16 + * specific language governing permissions and limitations under the
134.17 + * License. When distributing the software, include this License Header
134.18 + * Notice in each file and include the License file at
134.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
134.20 + * particular file as subject to the "Classpath" exception as provided
134.21 + * by Sun in the GPL Version 2 section of the License file that
134.22 + * accompanied this code. If applicable, add the following below the
134.23 + * License Header, with the fields enclosed by brackets [] replaced by
134.24 + * your own identifying information:
134.25 + * "Portions Copyrighted [year] [name of copyright owner]"
134.26 + *
134.27 + * Contributor(s):
134.28 + *
134.29 + * The Original Software is NetBeans. The Initial Developer of the Original
134.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
134.31 + * Microsystems, Inc. All Rights Reserved.
134.32 + *
134.33 + * If you wish your version of this file to be governed by only the CDDL
134.34 + * or only the GPL Version 2, indicate your decision by adding
134.35 + * "[Contributor] elects to include this software in this distribution
134.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
134.37 + * single choice of license, a recipient has the option to distribute
134.38 + * your version of this file under either the CDDL, the GPL Version 2 or
134.39 + * to extend the choice of license to its licensees as provided above.
134.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
134.41 + * Version 2 license, then the option applies only if the new code is
134.42 + * made subject to such option by the copyright holder.
134.43 + */
134.44 +
134.45 +package org.netbeans.modules.visualweb.gravy.model.project.components;
134.46 +
134.47 +import org.netbeans.modules.visualweb.gravy.model.components.*;
134.48 +
134.49 +import java.awt.Point;
134.50 +
134.51 +/**
134.52 + * Common class for all components on web page.
134.53 + */
134.54 +
134.55 +public class VisualComponent extends Component {
134.56 +
134.57 + private Point point;
134.58 +
134.59 + /**
134.60 + * Create visual component on web page using web component from palette.
134.61 + * @param webcomponent Web component from palette.
134.62 + * @param name Name of component.
134.63 + */
134.64 + public VisualComponent(WebComponent webcomponent, String name) {
134.65 + super(webcomponent, name);
134.66 + }
134.67 +
134.68 + /**
134.69 + * Get coordinates of component.
134.70 + * @return Point of component.
134.71 + */
134.72 + public Point getCoordinates() {
134.73 + return point;
134.74 + }
134.75 +
134.76 + /**
134.77 + * Set coordiantes of component.
134.78 + * @param point of component.
134.79 + */
134.80 + public void setCoordinates(Point point) {
134.81 + this.point = point;
134.82 + }
134.83 +}
135.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
135.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/VisualEventHandlingComponent.java Thu Jul 10 04:32:50 2008 -0700
135.3 @@ -0,0 +1,154 @@
135.4 +/*
135.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
135.6 + *
135.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
135.8 + *
135.9 + * The contents of this file are subject to the terms of either the GNU
135.10 + * General Public License Version 2 only ("GPL") or the Common
135.11 + * Development and Distribution License("CDDL") (collectively, the
135.12 + * "License"). You may not use this file except in compliance with the
135.13 + * License. You can obtain a copy of the License at
135.14 + * http://www.netbeans.org/cddl-gplv2.html
135.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
135.16 + * specific language governing permissions and limitations under the
135.17 + * License. When distributing the software, include this License Header
135.18 + * Notice in each file and include the License file at
135.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
135.20 + * particular file as subject to the "Classpath" exception as provided
135.21 + * by Sun in the GPL Version 2 section of the License file that
135.22 + * accompanied this code. If applicable, add the following below the
135.23 + * License Header, with the fields enclosed by brackets [] replaced by
135.24 + * your own identifying information:
135.25 + * "Portions Copyrighted [year] [name of copyright owner]"
135.26 + *
135.27 + * Contributor(s):
135.28 + *
135.29 + * The Original Software is NetBeans. The Initial Developer of the Original
135.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
135.31 + * Microsystems, Inc. All Rights Reserved.
135.32 + *
135.33 + * If you wish your version of this file to be governed by only the CDDL
135.34 + * or only the GPL Version 2, indicate your decision by adding
135.35 + * "[Contributor] elects to include this software in this distribution
135.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
135.37 + * single choice of license, a recipient has the option to distribute
135.38 + * your version of this file under either the CDDL, the GPL Version 2 or
135.39 + * to extend the choice of license to its licensees as provided above.
135.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
135.41 + * Version 2 license, then the option applies only if the new code is
135.42 + * made subject to such option by the copyright holder.
135.43 + */
135.44 +
135.45 +package org.netbeans.modules.visualweb.gravy.model.project.components;
135.46 +
135.47 +import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
135.48 +import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
135.49 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
135.50 +import org.netbeans.modules.visualweb.gravy.TestUtils;
135.51 +import org.netbeans.modules.visualweb.gravy.Bundle;
135.52 +import org.netbeans.modules.visualweb.gravy.Util;
135.53 +import org.netbeans.modules.visualweb.gravy.model.components.*;
135.54 +import org.netbeans.modules.visualweb.gravy.model.project.JavaFile;
135.55 +
135.56 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
135.57 +import org.netbeans.jemmy.operators.JTreeOperator;
135.58 +import org.netbeans.jemmy.JemmyException;
135.59 +
135.60 +import java.awt.event.KeyEvent;
135.61 +
135.62 +/**
135.63 + * Common class for all components on web page.
135.64 + */
135.65 +
135.66 +public class VisualEventHandlingComponent extends VisualComponent {
135.67 +
135.68 + private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.components.Bundle";
135.69 + private final static String viewOutline = Bundle.getStringTrimmed(
135.70 + Bundle.getStringTrimmed(bundle, "OutlineBundle"),
135.71 + Bundle.getStringTrimmed(bundle, "ViewOutline"));
135.72 + private final static String popupEventHandler = Bundle.getStringTrimmed(
135.73 + Bundle.getStringTrimmed(bundle, "InsyncBundle"),
135.74 + Bundle.getStringTrimmed(bundle, "EditEventHandler"));
135.75 + private final static String[] action = {"action"};
135.76 + private final static String popupActionEventHandler = Bundle.getStringTrimmed(
135.77 + Bundle.getStringTrimmed(bundle, "InsyncBundle"),
135.78 + Bundle.getStringTrimmed(bundle, "EditDefEventHandler"), action);
135.79 + private final static String openOutline = "Window|" + viewOutline;
135.80 +
135.81 + /**
135.82 + * Create visual component on web page using web component from palette.
135.83 + * @param webcomponent Web component from palette.
135.84 + * @param name Name of component.
135.85 + */
135.86 + public VisualEventHandlingComponent(WebComponent webcomponent, String name) {
135.87 + super(webcomponent, name);
135.88 + }
135.89 +
135.90 + /**
135.91 + * Set event handler for component.
135.92 + * @param handlerText Text of event handler.
135.93 + */
135.94 + public void setEventHandler(String handlerText) {
135.95 + setEventHandler("", handlerText);
135.96 + }
135.97 +
135.98 + /**
135.99 + * Set event handler for component.
135.100 + * @param eventType Type of event.
135.101 + * @param handlerText Text of event handler.
135.102 + */
135.103 + public void setEventHandler(String eventType, String handlerText) {
135.104 + Page.open();
135.105 + try {
135.106 + Util.getMainMenu().pushMenu(openOutline);
135.107 + }
135.108 + catch(Exception e) {
135.109 + throw new JemmyException(openOutline + " menu can't be found!", e);
135.110 + }
135.111 + DocumentOutlineOperator outline = new DocumentOutlineOperator(RaveWindowOperator.getDefaultRave());
135.112 + TestUtils.wait(1000);
135.113 + try {
135.114 + JTreeOperator aotree = outline.getStructTreeOperator();
135.115 + aotree.callPopupOnPath(aotree.findPath(Page.getName() + "|page1|html1|body1|form1|" + getName()));
135.116 + TestUtils.wait(1000);
135.117 + if (!eventType.equals("")) new JPopupMenuOperator().pushMenu(popupEventHandler + "|" + eventType);
135.118 + else new JPopupMenuOperator().pushMenu(popupActionEventHandler);
135.119 + TestUtils.wait(1000);
135.120 + }
135.121 + catch(Exception e) {
135.122 + throw new JemmyException("Item for action handler in popup menu can't be found!", e);
135.123 + }
135.124 + try {
135.125 + JavaFile jf = Page.getJavaFile();
135.126 + jf.insert(handlerText);
135.127 + TestUtils.wait(1000);
135.128 + jf.pushKey(KeyEvent.VK_DOWN);
135.129 + TestUtils.wait(500);
135.130 + jf.pushKey(KeyEvent.VK_END);
135.131 + TestUtils.wait(500);
135.132 + if (!jf.getText().substring(jf.getCaretPosition() - 1, jf.getCaretPosition()).equals("}")) {
135.133 + jf.pushKey(KeyEvent.VK_HOME, KeyEvent.SHIFT_MASK);
135.134 + TestUtils.wait(500);
135.135 + jf.pushKey(KeyEvent.VK_DELETE);
135.136 + }
135.137 +
135.138 + //Workaround: switch to design gives an error
135.139 + //Workaround start
135.140 + TestUtils.wait(500);
135.141 + jf.pushKey(KeyEvent.VK_LEFT);
135.142 + TestUtils.wait(500);
135.143 + jf.pushKey(KeyEvent.VK_SPACE);
135.144 + TestUtils.wait(500);
135.145 + jf.pushKey(KeyEvent.VK_BACK_SPACE);
135.146 + //Workaround end
135.147 +
135.148 + TestUtils.wait(1000);
135.149 + jf.reformatCode();
135.150 + }
135.151 + catch(Exception e) {
135.152 + throw new JemmyException("Event Handler can't be added!", e);
135.153 + }
135.154 + DesignerPaneOperator.switchToDesignerPane();
135.155 + TestUtils.wait(1000);
135.156 + }
135.157 +}
136.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
136.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/navigation/NavigatorOperator.java Thu Jul 10 04:32:50 2008 -0700
136.3 @@ -0,0 +1,430 @@
136.4 +/*
136.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
136.6 + *
136.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
136.8 + *
136.9 + * The contents of this file are subject to the terms of either the GNU
136.10 + * General Public License Version 2 only ("GPL") or the Common
136.11 + * Development and Distribution License("CDDL") (collectively, the
136.12 + * "License"). You may not use this file except in compliance with the
136.13 + * License. You can obtain a copy of the License at
136.14 + * http://www.netbeans.org/cddl-gplv2.html
136.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
136.16 + * specific language governing permissions and limitations under the
136.17 + * License. When distributing the software, include this License Header
136.18 + * Notice in each file and include the License file at
136.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
136.20 + * particular file as subject to the "Classpath" exception as provided
136.21 + * by Sun in the GPL Version 2 section of the License file that
136.22 + * accompanied this code. If applicable, add the following below the
136.23 + * License Header, with the fields enclosed by brackets [] replaced by
136.24 + * your own identifying information:
136.25 + * "Portions Copyrighted [year] [name of copyright owner]"
136.26 + *
136.27 + * Contributor(s):
136.28 + *
136.29 + * The Original Software is NetBeans. The Initial Developer of the Original
136.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
136.31 + * Microsystems, Inc. All Rights Reserved.
136.32 + *
136.33 + * If you wish your version of this file to be governed by only the CDDL
136.34 + * or only the GPL Version 2, indicate your decision by adding
136.35 + * "[Contributor] elects to include this software in this distribution
136.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
136.37 + * single choice of license, a recipient has the option to distribute
136.38 + * your version of this file under either the CDDL, the GPL Version 2 or
136.39 + * to extend the choice of license to its licensees as provided above.
136.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
136.41 + * Version 2 license, then the option applies only if the new code is
136.42 + * made subject to such option by the copyright holder.
136.43 + */
136.44 +
136.45 +package org.netbeans.modules.visualweb.gravy.navigation;
136.46 +
136.47 +
136.48 +import org.netbeans.modules.visualweb.xhtml.FormNamePanel;
136.49 +import org.netbeans.modules.visualweb.gravy.*;
136.50 +import java.awt.*;
136.51 +import java.awt.event.*;
136.52 +import java.util.List;
136.53 +import org.netbeans.jemmy.*;
136.54 +import org.netbeans.jemmy.operators.*;
136.55 +import org.netbeans.jemmy.operators.JToggleButtonOperator;
136.56 +import org.netbeans.jemmy.operators.JComponentOperator;
136.57 +import org.netbeans.jellytools.TopComponentOperator;
136.58 +
136.59 +/**
136.60 + * Operator for "Page Navigation" pane.
136.61 + */
136.62 +public class NavigatorOperator extends JComponentOperator{
136.63 + private static final String
136.64 + DEFAULT_LINK_ID = "case1",
136.65 + PAGE_NAVIGATION_TITLE = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.navigation.Bundle","NavigationView"),
136.66 + NAVIGATION_BUTTON = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.navigation.Bundle","ViewNavigation");
136.67 +
136.68 + ComponentOperator desktop = null;
136.69 + private JToggleButtonOperator _btSource;
136.70 + private JToggleButtonOperator _btNavigation;
136.71 +
136.72 + public NavigatorOperator(ContainerOperator parent) {
136.73 + super(parent, new NavigatorChooser());
136.74 + this.setComparator(new Operator.DefaultStringComparator(true, true));
136.75 + }
136.76 +
136.77 + public NavigatorOperator() {
136.78 + this(Util.getMainWindow());
136.79 + }
136.80 +
136.81 + /**
136.82 + * Get "XML" button.
136.83 + */
136.84 + public JToggleButtonOperator btSource() {
136.85 + if (_btSource == null) {
136.86 + TopComponentOperator topComponent = new TopComponentOperator(Util.getMainWindow());
136.87 + _btSource = new JToggleButtonOperator(topComponent, "XML");
136.88 + }
136.89 + return _btSource;
136.90 + }
136.91 +
136.92 + /**
136.93 + * Get "Navigation" button.
136.94 + */
136.95 + public JToggleButtonOperator btNavigation() {
136.96 + if (_btNavigation == null) {
136.97 + TopComponentOperator topComponent = new TopComponentOperator(Util.getMainWindow());
136.98 + _btNavigation = new JToggleButtonOperator(topComponent, NAVIGATION_BUTTON);
136.99 + }
136.100 + return _btNavigation;
136.101 + }
136.102 +
136.103 + /**
136.104 + * Switch to source code of navigation rules.
136.105 + */
136.106 + public void switchToSource() {
136.107 + btSource().pushNoBlock();
136.108 + Util.wait(1000);
136.109 + new QueueTool().waitEmpty();
136.110 + }
136.111 +
136.112 + /**
136.113 + * Switch to visual designer of navigation rules.
136.114 + */
136.115 + public void switchToNavigation() {
136.116 + btNavigation().pushNoBlock();
136.117 + Util.wait(1000);
136.118 + new QueueTool().waitEmpty();
136.119 + }
136.120 +
136.121 + /**
136.122 + * Show "Page Navigation" pane.
136.123 + */
136.124 + public static NavigatorOperator show() {
136.125 + Util.getMainTab().setSelectedIndex(Util.getMainTab().findPage("Page Navigation"));
136.126 + return(new NavigatorOperator());
136.127 + }
136.128 +
136.129 + private ComponentOperator getDesktop() {
136.130 + if(desktop == null) {
136.131 + desktop = new NavigatorGraphFrameOperator();
136.132 + }
136.133 + return(desktop);
136.134 + }
136.135 +
136.136 + /**
136.137 + * Push given item of popup menu.
136.138 + * @param menuText Name of given item.
136.139 + */
136.140 + public void pushPopup(String menuText) {
136.141 + /* No need to handle Mac differently, comment it out
136.142 + if (System.getProperty("os.name").equals("Mac OS X"))
136.143 + getDesktop().typeKey(' ', InputEvent.CTRL_MASK);
136.144 + else */
136.145 +
136.146 + getDesktop().clickForPopup(1, 1);
136.147 + try { Thread.sleep(500); } catch(Exception e) {}
136.148 + new JPopupMenuOperator().pushMenuNoBlock(menuText);
136.149 + try { Thread.sleep(500); } catch(Exception e) {}
136.150 + }
136.151 +
136.152 + /**
136.153 + * Call popup menu in given position of "Page Navigation" pane.
136.154 + * @param x x-coordinate of necessary position.
136.155 + * @param y y-coordinate of necessary position.
136.156 + */
136.157 + public void clickForPopup(int x, int y) {
136.158 + getDesktop().clickForPopup(x,y);
136.159 + }
136.160 +
136.161 + /**
136.162 + * Click mouse in given position of "Page Navigation" pane.
136.163 + * @param x x-coordinate of necessary position.
136.164 + * @param y y-coordinate of necessary position.
136.165 + */
136.166 + public void clickMouse(int x, int y) {
136.167 + getDesktop().clickMouse(x,y,1);
136.168 + }
136.169 +
136.170 + /**
136.171 + * Click mouse specified times in given position of "Page Navigation" pane.
136.172 + * @param x x-coordinate of necessary position.
136.173 + * @param y y-coordinate of necessary position.
136.174 + * @param count Number of clicks.
136.175 + */
136.176 + public void clickMouse(int x, int y, int count) {
136.177 + getDesktop().clickMouse(x,y,count);
136.178 + }
136.179 +
136.180 + /**
136.181 + * Select given page in "Page Navigation" pane.
136.182 + * @param page Name of the page.
136.183 + */
136.184 + /*
136.185 + public void select(String page) {
136.186 + PageOperator pp = new PageOperator(this, page);
136.187 + pp.select();
136.188 + }
136.189 + */
136.190 +
136.191 + /**
136.192 + * Create link from one given page to another.
136.193 + * @param page1 Name of the page where link will be created from.
136.194 + * @param page2 Name of the page where link will be created to.
136.195 + */
136.196 + public void link(String page1, String page2) {
136.197 +
136.198 + linkUsingXmlSource(page1, page2);
136.199 + /*
136.200 + PageOperator p1 = new PageOperator(this, page1);
136.201 + PageOperator p2 = new PageOperator(this, page2);
136.202 + p1.select();
136.203 + Util.wait(5000);
136.204 + //Util.wait(500);
136.205 +
136.206 + getDesktop().pressMouse(p1.getX()+40, p1.getY()+40);
136.207 + getDesktop().moveMouse(p1.getX()+41, p1.getY()+41);
136.208 + getDesktop().moveMouse(p2.getX()+41, p2.getY()+41);
136.209 + getDesktop().moveMouse(p2.getX()+40, p2.getY()+40);
136.210 + getDesktop().releaseMouse(p2.getX()+40, p2.getY()+40);
136.211 + Util.wait(1000);
136.212 + */
136.213 + //new DNDDriver().dnd(this, new Point(p1.getX()+40, p1.getY()+40), this, new Point(p2.getX()+40, p2.getY()+40));
136.214 + }
136.215 +
136.216 + /**
136.217 + * Create link with specified name from one given page to another.
136.218 + * @param page1 Name of the page where link will be created from.
136.219 + * @param page2 Name of the page where link will be created to.
136.220 + * @param linkId Name of the link.
136.221 + */
136.222 + public void link(String page1, String page2, String linkId) {
136.223 + linkUsingXmlSource(page1, page2, linkId);
136.224 + /* TODO need to fix it
136.225 + link(page1,page2);
136.226 + Util.wait(1000);
136.227 + for (int i = 0; i < linkId.length(); i++) {
136.228 + typeKey(linkId.charAt(i));
136.229 + Util.wait(500);
136.230 + }
136.231 + pushKey(KeyEvent.VK_ENTER);
136.232 + Util.wait(1000);
136.233 + */
136.234 + }
136.235 +
136.236 + /**
136.237 + * Create links from one given page to another.
136.238 + * Even elements in the list are names of pages where links will be created from.
136.239 + * Odd elements in the list are names of pages where links will be created to.
136.240 + * @param webPageNameList List names of the pages.
136.241 + */
136.242 + public void linkUsingXmlSource(List webPageNameList) {
136.243 + linkUsingXmlSource(webPageNameList, DEFAULT_LINK_ID);
136.244 + }
136.245 +
136.246 + /**
136.247 + * Create links with specified name from one given page to another.
136.248 + * Even elements in the list are names of pages where links will be created from.
136.249 + * Odd elements in the list are names of pages where links will be created to.
136.250 + * @param webPageNameList List names of the pages.
136.251 + * @param linkId Name of the link.
136.252 + */
136.253 + public void linkUsingXmlSource(List webPageNameList, String linkId) {
136.254 + switchToSource();
136.255 + Util.wait(1000);
136.256 + new QueueTool().waitEmpty();
136.257 +
136.258 + EditorOperator editor = getEditorOperator();
136.259 + for (int i = 0; i < webPageNameList.size() - 1; ++i) {
136.260 + String masterWebPageName = (String) webPageNameList.get(i),
136.261 + slaveWebPageName = (String) webPageNameList.get(i + 1);
136.262 + appendLinkXmlTags(editor, masterWebPageName, slaveWebPageName, linkId);
136.263 + TestUtils.outMsg("+++ Web page link [" + linkId + "] from [" +
136.264 + masterWebPageName + "] to [" + slaveWebPageName + "] is created");
136.265 + }
136.266 + switchToNavigation();
136.267 + Util.wait(1000);
136.268 + new QueueTool().waitEmpty();
136.269 + }
136.270 +
136.271 + /**
136.272 + * Create link from one given page to another with source code editor.
136.273 + * @param fromPageName Name of the page where link will be created from.
136.274 + * @param toPageName Name of the page where link will be created to.
136.275 + */
136.276 + public void linkUsingXmlSource(String fromPageName, String toPageName) {
136.277 + linkUsingXmlSource(fromPageName, toPageName, DEFAULT_LINK_ID);
136.278 + }
136.279 +
136.280 + /**
136.281 + * Create link with specified name from one given page to another with source code editor.
136.282 + * @param fromPageName Name of the page where link will be created from.
136.283 + * @param toPageName Name of the page where link will be created to.
136.284 + * @param linkId Name of the link.
136.285 + */
136.286 + public void linkUsingXmlSource(String fromPageName, String toPageName, String linkId) {
136.287 + switchToSource();
136.288 + Util.wait(1000);
136.289 + new QueueTool().waitEmpty();
136.290 +
136.291 + EditorOperator editor = getEditorOperator();
136.292 + appendLinkXmlTags(editor, fromPageName, toPageName, linkId);
136.293 +
136.294 + switchToNavigation();
136.295 + Util.wait(1000);
136.296 + new QueueTool().waitEmpty();
136.297 + }
136.298 +
136.299 + /**
136.300 + * Add string for link with specified name from one given page to another into source code editor.
136.301 + * @param editor Operator for navigation source code editor.
136.302 + * @param fromPageName Name of the page where link will be created from.
136.303 + * @param toPageName Name of the page where link will be created to.
136.304 + * @param linkId Name of the link.
136.305 + */
136.306 + private void appendLinkXmlTags(EditorOperator editor, String fromPageName,
136.307 + String toPageName, String linkId) {
136.308 + // put editor's caret to the start position of the last line
136.309 + putCaretToBeginOfLastLine(editor);
136.310 + Util.wait(500);
136.311 + new QueueTool().waitEmpty();
136.312 +
136.313 + String linkXmlTags = getLinkXmlTags(fromPageName, toPageName, linkId);
136.314 + TestUtils.outMsg("+++ xml-tags used for link [" + linkId + "] between pages [" +
136.315 + fromPageName + "] and [" + toPageName + "]: " + linkXmlTags);
136.316 + editor.insert(linkXmlTags);
136.317 + Util.wait(1000);
136.318 + new QueueTool().waitEmpty();
136.319 + }
136.320 +
136.321 + /**
136.322 + * Put caret to begin of last line in source code editor.
136.323 + * @param editor Operator for navigation source code editor.
136.324 + */
136.325 + private void putCaretToBeginOfLastLine(EditorOperator editor) {
136.326 + if (System.getProperty("os.name").equalsIgnoreCase("Mac OS X"))
136.327 + editor.pushKey(KeyEvent.VK_END, KeyEvent.META_DOWN_MASK);
136.328 + else
136.329 + editor.pushKey(KeyEvent.VK_END, KeyEvent.CTRL_DOWN_MASK);
136.330 + Util.wait(1000);
136.331 + new QueueTool().waitEmpty();
136.332 + editor.pushUpArrowKey();
136.333 + Util.wait(1000);
136.334 + new QueueTool().waitEmpty();
136.335 + }
136.336 +
136.337 + /**
136.338 + * Return prepared tag for link with specified name from one given page to another.
136.339 + * @param fromPageName Name of the page where link will be created from.
136.340 + * @param toPageName Name of the page where link will be created to.
136.341 + * @param linkId Name of the link.
136.342 + * @return String Tag of navigation rule.
136.343 + */
136.344 + private String getLinkXmlTags(String fromPageName, String toPageName, String linkId) {
136.345 + String[] xmlTags = new String[] {
136.346 + " <navigation-rule>",
136.347 + " <from-view-id>/" + fromPageName + "</from-view-id>",
136.348 + " <navigation-case>",
136.349 + " <from-outcome>" + linkId + "</from-outcome>",
136.350 + " <to-view-id>/" + toPageName + "</to-view-id>",
136.351 + " </navigation-case>",
136.352 + " </navigation-rule>"
136.353 + };
136.354 + StringBuffer buffer = new StringBuffer();
136.355 + for (int i = 0; i < xmlTags.length; ++i) {
136.356 + buffer.append(xmlTags[i]);
136.357 + buffer.append("\n");
136.358 + }
136.359 + return buffer.toString();
136.360 + }
136.361 +
136.362 + /**
136.363 + * Get navigation source code editor.
136.364 + * @return Operator for navigation source code editor.
136.365 + */
136.366 + private EditorOperator getEditorOperator() {
136.367 + //TopComponentOperator topComponent = new TopComponentOperator(PAGE_NAVIGATION_TITLE);
136.368 + TopComponentOperator topComponent = new TopComponentOperator(Util.getMainWindow());
136.369 + EditorOperator editor = new EditorOperator(topComponent, PAGE_NAVIGATION_TITLE);
136.370 + Util.wait(1000);
136.371 + new QueueTool().waitEmpty();
136.372 + TestUtils.outMsg("+++ Source editor for [" + PAGE_NAVIGATION_TITLE + "] found");
136.373 + return editor;
136.374 + }
136.375 +
136.376 + /**
136.377 + * Create static link with specified name from one given page to another.
136.378 + * @param page1 Name of the page where link will be created from.
136.379 + * @param page2 Name of the page where link will be created to.
136.380 + * @param linkId Name of the link.
136.381 + */
136.382 + /*
136.383 + public void staticLink(String page1, String page2,String linkId) {
136.384 + PageOperator p1 = new PageOperator(this, page1);
136.385 + PageOperator p2 = new PageOperator(this, page2);
136.386 +
136.387 + p1.select();
136.388 +
136.389 + Util.wait(300);
136.390 +
136.391 + new DNDDriver().dnd(this, new Point(p1.getX()+10, p1.getY()+33), this, new Point(p2.getX()+5, p2.getY()+5));
136.392 +
136.393 + Util.wait(300);
136.394 +
136.395 + for (int i=0; i<linkId.length(); i++){
136.396 + typeKey(linkId.charAt(i));
136.397 + }
136.398 + }*/
136.399 +
136.400 + public class NavigatorGraphFrameOperator extends ComponentOperator {
136.401 + public NavigatorGraphFrameOperator() {
136.402 + super(NavigatorOperator.this, new NavigatorGraphFrameChooser());
136.403 + }
136.404 + }
136.405 + public class NavigatorGraphFrameChooser implements ComponentChooser {
136.406 + public boolean checkComponent(Component comp) {
136.407 + //return(comp instanceof PageFlowGraph);
136.408 + //return(comp instanceof org.netbeans.graph.JGraphView);
136.409 + //Hotfix for sanity to pass. There should be no test for Navigation.
136.410 + return false;
136.411 + }
136.412 + public String getDescription() {
136.413 + //return(FormNamePanel.class.getName());
136.414 + return(FormNamePanel.class.getName());
136.415 + }
136.416 + }
136.417 + public static class NavigatorChooser implements ComponentChooser {
136.418 + public NavigatorChooser() {
136.419 + }
136.420 +
136.421 + public boolean checkComponent(Component comp) {
136.422 + // TODO:
136.423 +// boolean res = comp instanceof NavigationView;
136.424 +// return res;
136.425 + return false;
136.426 + }
136.427 +
136.428 + public String getDescription() {
136.429 + // return(NavigationView.class.getName());
136.430 + return(null);
136.431 + }
136.432 + }
136.433 +}
137.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
137.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/navigation/PageOperator.java Thu Jul 10 04:32:50 2008 -0700
137.3 @@ -0,0 +1,163 @@
137.4 + /* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
137.5 + /*
137.6 + /* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
137.7 + *
137.8 + /* The contents of this file are subject to the terms of either the GNU
137.9 + /* General Public License Version 2 only ("GPL") or the Common
137.10 + /* Development and Distribution License("CDDL") (collectively, the
137.11 + /* "License"). You may not use this file except in compliance with the
137.12 + /* License. You can obtain a copy of the License at
137.13 + /* http://www.netbeans.org/cddl-gplv2.html
137.14 + /* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
137.15 + /* specific language governing permissions and limitations under the
137.16 + /* License. When distributing the software, include this License Header
137.17 + /* Notice in each file and include the License file at
137.18 + /* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
137.19 + /* particular file as subject to the "Classpath" exception as provided
137.20 + /* by Sun in the GPL Version 2 section of the License file that
137.21 + /* accompanied this code. If applicable, add the following below the
137.22 + /* License Header, with the fields enclosed by brackets [] replaced by
137.23 + /* your own identifying information:
137.24 + /* "Portions Copyrighted [year] [name of copyright owner]"
137.25 + /*
137.26 + /* Contributor(s):
137.27 + *
137.28 + * The Original Software is NetBeans. The Initial Developer of the Original
137.29 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
137.30 + * Microsystems, Inc. All Rights Reserved.
137.31 + /*
137.32 + /* If you wish your version of this file to be governed by only the CDDL
137.33 + /* or only the GPL Version 2, indicate your decision by adding
137.34 + /* "[Contributor] elects to include this software in this distribution
137.35 + /* under the [CDDL or GPL Version 2] license." If you do not indicate a
137.36 + /* single choice of license, a recipient has the option to distribute
137.37 + /* your version of this file under either the CDDL, the GPL Version 2 or
137.38 + /* to extend the choice of license to its licensees as provided above.
137.39 + /* However, if you add GPL Version 2 code and therefore, elected the GPL
137.40 + /* Version 2 license, then the option applies only if the new code is
137.41 + /* made subject to such option by the copyright holder.
137.42 + */
137.43 +
137.44 +package org.netbeans.modules.visualweb.gravy.navigation;
137.45 +
137.46 +//import org.netbeans.modules.web.jsf.navigation.NavigationView;
137.47 +//import org.netbeans.modules.visualweb.navigation.archive.Page;
137.48 +import org.netbeans.jemmy.Waiter;
137.49 +import org.netbeans.jemmy.Waitable;
137.50 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
137.51 +
137.52 +/**
137.53 + * Operator for pages onto "Page Navigation" pane.
137.54 + */
137.55 +
137.56 +public class PageOperator {
137.57 + private NavigatorOperator nav = null;
137.58 + private String name = null;
137.59 + public PageOperator(NavigatorOperator navOperator, String name) {
137.60 + nav = navOperator;
137.61 + this.name = name;
137.62 + // findPage();
137.63 + }
137.64 +
137.65 +// /**
137.66 +// * Push given item of popup menu.
137.67 +// * @param menuText Name of given item.
137.68 +// */
137.69 +// public void pushPopup(String menuText) {
137.70 +// clickForPopup();
137.71 +// new JPopupMenuOperator().pushMenu(menuText);
137.72 +// }
137.73 +//
137.74 +// /**
137.75 +// * Call popup menu on page.
137.76 +// */
137.77 +// public void clickForPopup() {
137.78 +// nav.clickForPopup(getX()+3,getY()+3);
137.79 +// }
137.80 +//
137.81 +// /**
137.82 +// * Double click on page.
137.83 +// */
137.84 +// public void mouseDoubleClick() {
137.85 +// nav.clickMouse(getX()+3,getY()+3, 2);
137.86 +// }
137.87 +//
137.88 +// /**
137.89 +// * Select this page.
137.90 +// */
137.91 +// public void select() {
137.92 +// nav.clickMouse(getX(), getY());
137.93 +// }
137.94 +//
137.95 +// /**
137.96 +// * Get x-coordinate of this page.
137.97 +// * return x-coordinate of the page.
137.98 +// */
137.99 +// public int getX() {
137.100 +// return findPage().x();
137.101 +// }
137.102 +//
137.103 +// /**
137.104 +// * Get y-coordinate of this page.
137.105 +// * return y-coordinate of the page.
137.106 +// */
137.107 +// public int getY() {
137.108 +// return findPage().y();
137.109 +// }
137.110 +//
137.111 +// /**
137.112 +// * Get width of this page.
137.113 +// * return Width of the page.
137.114 +// */
137.115 +// public int getWidth() {
137.116 +// return findPage().w();
137.117 +// }
137.118 +//
137.119 +// /**
137.120 +// * Get height of this page.
137.121 +// * return Height of the page.
137.122 +// */
137.123 +// public int getHeight() {
137.124 +// return findPage().h();
137.125 +// }
137.126 +//
137.127 +// /**
137.128 +// * Get necessary page.
137.129 +// * return Page.
137.130 +// */
137.131 +// private Page findPage() {
137.132 +// Page page = waitPage();
137.133 +// / return page;
137.134 +// }
137.135 +//
137.136 +// private Page waitPage() {
137.137 +// Waiter waiter = new Waiter (new Waitable() {
137.138 +// public Object actionProduced(Object obj) {
137.139 +// //TODO: Uncommnet once naviation module refactory complete
137.140 +//// if(nav != null) {
137.141 +//// NavigationModel navModel = ((NavigationView)nav.getSource()).getNavigationModel();
137.142 +//// List<Page> pages = navModel.getPages();
137.143 +//// if(pages.size() == 0) {
137.144 +//// return null;
137.145 +//// }
137.146 +//// for(int i=0;i <pages.size(); i++) {
137.147 +//// Page p = (Page)pages.get(i);
137.148 +//// if((p.toString()).indexOf(name) >= 0) {
137.149 +//// return p;
137.150 +//// }
137.151 +//// }
137.152 +//// }
137.153 +// return null;
137.154 +// }
137.155 +// public String getDescription() {
137.156 +// return "Waiting for navigation Page";
137.157 +// }
137.158 +// });
137.159 +// try {
137.160 +// Page page = (Page)waiter.waitAction(null);
137.161 +// return page;
137.162 +// } catch (InterruptedException e) {
137.163 +// return null;
137.164 +// }
137.165 +// }
137.166 +}
138.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
138.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/nodes/Node.java Thu Jul 10 04:32:50 2008 -0700
138.3 @@ -0,0 +1,506 @@
138.4 +/*
138.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
138.6 + *
138.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
138.8 + *
138.9 + * The contents of this file are subject to the terms of either the GNU
138.10 + * General Public License Version 2 only ("GPL") or the Common
138.11 + * Development and Distribution License("CDDL") (collectively, the
138.12 + * "License"). You may not use this file except in compliance with the
138.13 + * License. You can obtain a copy of the License at
138.14 + * http://www.netbeans.org/cddl-gplv2.html
138.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
138.16 + * specific language governing permissions and limitations under the
138.17 + * License. When distributing the software, include this License Header
138.18 + * Notice in each file and include the License file at
138.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
138.20 + * particular file as subject to the "Classpath" exception as provided
138.21 + * by Sun in the GPL Version 2 section of the License file that
138.22 + * accompanied this code. If applicable, add the following below the
138.23 + * License Header, with the fields enclosed by brackets [] replaced by
138.24 + * your own identifying information:
138.25 + * "Portions Copyrighted [year] [name of copyright owner]"
138.26 + *
138.27 + * Contributor(s):
138.28 + *
138.29 + * The Original Software is NetBeans. The Initial Developer of the Original
138.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
138.31 + * Microsystems, Inc. All Rights Reserved.
138.32 + *
138.33 + * If you wish your version of this file to be governed by only the CDDL
138.34 + * or only the GPL Version 2, indicate your decision by adding
138.35 + * "[Contributor] elects to include this software in this distribution
138.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
138.37 + * single choice of license, a recipient has the option to distribute
138.38 + * your version of this file under either the CDDL, the GPL Version 2 or
138.39 + * to extend the choice of license to its licensees as provided above.
138.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
138.41 + * Version 2 license, then the option applies only if the new code is
138.42 + * made subject to such option by the copyright holder.
138.43 + */
138.44 +
138.45 +package org.netbeans.modules.visualweb.gravy.nodes;
138.46 +
138.47 +import java.awt.Component;
138.48 +import java.awt.event.KeyEvent;
138.49 +import java.util.ArrayList;
138.50 +import javax.swing.tree.TreePath;
138.51 +import org.netbeans.jellytools.Bundle;
138.52 +import org.netbeans.modules.visualweb.gravy.actions.Action;
138.53 +import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
138.54 +import org.netbeans.jemmy.*;
138.55 +import org.netbeans.jemmy.operators.*;
138.56 +import org.openide.explorer.view.Visualizer;
138.57 +
138.58 +/** Ancestor class for all nodes.<p>
138.59 + * Nodes should help to easier testing of JTree's.
138.60 + * The most frequent usage in IDE is in the Explorer Window but nodes can be
138.61 + * used in any component which includes a JTree instance.
138.62 + * Nodes are also used as parameters for action's performing.
138.63 + * <p>
138.64 + * Example:<p>
138.65 + * <pre>
138.66 + * Node node = new Node(RepositoryTabOperator.invoke().getRootNode(), "jellytools/src|org|netbeans|jellytools");
138.67 + * System.out.println(node.getText());
138.68 + * new NewTemplateAction().performAPI(node);
138.69 + * </pre>
138.70 + */
138.71 +public class Node {
138.72 +
138.73 + static final String linkSuffix = Bundle.getString("org.openide.loaders.Bundle", "FMT_shadowName", new String[]{""});
138.74 +
138.75 + /** JTreeOperator of tree where node lives */
138.76 + protected JTreeOperator treeOperator;
138.77 + /** TreePath of node */
138.78 + protected TreePath treePath;
138.79 + /** Comparator used for this node instance. */
138.80 + private Operator.StringComparator comparator;
138.81 +
138.82 + /** creates new Node instance
138.83 + * @param treeOperator JTreeOperator of tree where node lives
138.84 + * @param treePath String tree path of node */
138.85 + public Node(JTreeOperator treeOperator, String treePath) {
138.86 + this(treeOperator, treeOperator.findPath(treePath, "|"));
138.87 + }
138.88 +
138.89 + /** creates new Node instance
138.90 + * @param treeOperator JTreeOperator of tree where node lives
138.91 + * @param treePath String tree path of node
138.92 + * @param indexes String list of indexes of nodes in each level */
138.93 + public Node(JTreeOperator treeOperator, String treePath, String indexes) {
138.94 + this(treeOperator, treeOperator.findPath(treePath, indexes, "|"));
138.95 + }
138.96 +
138.97 + /** creates new Node instance
138.98 + * @param parent parent Node
138.99 + * @param treeSubPath String tree sub-path from parent */
138.100 + public Node(Node parent, String treeSubPath) {
138.101 + this(parent.tree(), parent.findSubPath(treeSubPath, "|"));
138.102 + }
138.103 +
138.104 + /** creates new Node instance
138.105 + * @param parent parent Node
138.106 + * @param childIndex int index of child under parent node */
138.107 + public Node(Node parent, int childIndex) {
138.108 + this(parent.tree(), parent.tree().getChildPath(parent.getTreePath(), childIndex));
138.109 + }
138.110 +
138.111 + /** creates new Node instance
138.112 + * @param treeOperator JTreeOperator of tree where node lives
138.113 + * @param path TreePath of node */
138.114 + public Node(JTreeOperator treeOperator, TreePath path) {
138.115 + this.treeOperator=treeOperator;
138.116 + this.treePath=path;
138.117 + }
138.118 +
138.119 + /** Sets comparator fot this node. Comparator is used for all methods
138.120 + * after this method is called.
138.121 + * @param comparator new comparator to be set (e.g.
138.122 + * new Operator.DefaultStringComparator(true, true);
138.123 + * to search string item exactly and case sensitive)
138.124 + */
138.125 + public void setComparator(Operator.StringComparator comparator) {
138.126 + this.comparator = comparator;
138.127 + tree().setComparator(comparator);
138.128 + }
138.129 +
138.130 + /** Gets comparator for this node instance.
138.131 + * @return comparator for this node instance.
138.132 + */
138.133 + public Operator.StringComparator getComparator() {
138.134 + if(comparator == null) {
138.135 + comparator = tree().getComparator();
138.136 + }
138.137 + return comparator;
138.138 + }
138.139 +
138.140 + /** Getter for JTreeOperator of tree where node lives
138.141 + * @return JTreeOperator of tree where node lives */
138.142 + public JTreeOperator tree() {
138.143 + return(treeOperator);
138.144 + }
138.145 +
138.146 + /** Getter for TreePath of node.
138.147 + * @return TreePath of node */
138.148 + public TreePath getTreePath() {
138.149 + return(treePath);
138.150 + }
138.151 +
138.152 + /** Getter for node text
138.153 + * @return String node text */
138.154 + public String getText() {
138.155 + return(treePath.getLastPathComponent().toString());
138.156 + }
138.157 +
138.158 + /** Convert TreePath to string
138.159 + * @return String TreePath converted to string */
138.160 + private static String convertPath(TreePath path) {
138.161 + if (path==null) return null;
138.162 + int pathCount=path.getPathCount();
138.163 + if (pathCount<2) return "";
138.164 + String result = path.getPathComponent(1).toString();
138.165 + for(int i = 2; i < pathCount; i++) {
138.166 + result += "|" + path.getPathComponent(i).toString();
138.167 + }
138.168 + return result;
138.169 + }
138.170 +
138.171 + /** Getter for node path
138.172 + * @return String node path */
138.173 + public String getPath() {
138.174 + return convertPath(treePath);
138.175 + }
138.176 +
138.177 + /** Getter for path of parent node
138.178 + * @return String path of parent node */
138.179 + public String getParentPath() {
138.180 + return convertPath(treePath.getParentPath());
138.181 + }
138.182 +
138.183 + /** Returns Object instance which represents org.openide.nodes.Node
138.184 + * for this jellytools node.
138.185 + * @return Object instance which represents org.openide.nodes.Node
138.186 + */
138.187 + public Object getOpenideNode() {
138.188 + return Visualizer.findNode(this.getTreePath().getLastPathComponent());
138.189 + }
138.190 +
138.191 + /** calls popup menu on node
138.192 + * @return JPopupMenuOperator */
138.193 + public JPopupMenuOperator callPopup() {
138.194 + return new JPopupMenuOperator(treeOperator.callPopupOnPath(treePath));
138.195 + }
138.196 +
138.197 + /** performs action on node through main menu
138.198 + * @param menuPath main menu path of action */
138.199 + public void performMenuAction(String menuPath) {
138.200 + new Action(menuPath, null).performMenu(this);
138.201 + }
138.202 +
138.203 + /** performs action on node through popup menu
138.204 + * @param popupPath popup menu path of action */
138.205 + public void performPopupAction(String popupPath) {
138.206 + new Action(null, popupPath).performPopup(this);
138.207 + }
138.208 +
138.209 + /** performs action on node through API menu
138.210 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
138.211 + public void performAPIAction(String systemActionClass) {
138.212 + new Action(null, null, systemActionClass).performAPI(this);
138.213 + }
138.214 +
138.215 + /** performs action on node through main menu
138.216 + * @param menuPath main menu path of action */
138.217 + public void performMenuActionNoBlock(String menuPath) {
138.218 + new ActionNoBlock(menuPath, null).performMenu(this);
138.219 + }
138.220 +
138.221 + /** performs action on node through popup menu
138.222 + * @param popupPath popup menu path of action */
138.223 + public void performPopupActionNoBlock(String popupPath) {
138.224 + new ActionNoBlock(null, popupPath).performPopup(this);
138.225 + }
138.226 +
138.227 + /** performs action on node through API menu
138.228 + * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
138.229 + public void performAPIActionNoBlock(String systemActionClass) {
138.230 + new ActionNoBlock(null, null, systemActionClass).performAPI(this);
138.231 + }
138.232 +
138.233 + /**
138.234 + * Selects node.
138.235 + */
138.236 + public void select() {
138.237 + tree().selectPath(getTreePath());
138.238 + // sleep to workaround IDE's behavior. IDE consider as double click
138.239 + // two single clicks on the same position with delay shorter than 300 ms.
138.240 + // See org.openide.awt.MouseUtils.isDoubleClick().
138.241 + try {
138.242 + Thread.sleep(300);
138.243 + } catch (Exception e) {
138.244 + throw new JemmyException("Sleeping interrupted", e);
138.245 + }
138.246 + }
138.247 +
138.248 + /** adds node into set of selected nodes */
138.249 + public void addSelectionPath() {
138.250 + tree().addSelectionPath(getTreePath());
138.251 + }
138.252 +
138.253 + /** tests if node is leaf
138.254 + * @return boolean true when node does not have children */
138.255 + public boolean isLeaf() {
138.256 + return tree().getChildCount(treePath)<1;
138.257 + }
138.258 +
138.259 + /** returns list of names of children
138.260 + * @return String[] list of names of children */
138.261 + public String[] getChildren() {
138.262 + tree().expandPath(treePath);
138.263 + Object o[]=tree().getChildren(treePath.getLastPathComponent());
138.264 + if (o==null) return new String[0];
138.265 + String s[]=new String[o.length];
138.266 + for (int i=0; i<o.length; i++)
138.267 + s[i]=o[i].toString();
138.268 + return s;
138.269 + }
138.270 +
138.271 + /** determines if current node is link
138.272 + * @return boolean true if node is link */
138.273 + public boolean isLink() {
138.274 + return getText().endsWith(linkSuffix);
138.275 + }
138.276 +
138.277 + /** verifies if node is still present. It expands parent path of the node
138.278 + * during verification.
138.279 + * @return boolean true when node is still present */
138.280 + public boolean isPresent() {
138.281 + tree().expandPath(treePath.getParentPath());
138.282 + return tree().getRowForPath(treePath)>=0;
138.283 + }
138.284 +
138.285 + /** verifies node's popup path for presence (without invocation)
138.286 + * @param popupPath String popup path */
138.287 + public void verifyPopup(String popupPath) {
138.288 + verifyPopup(new String[]{popupPath});
138.289 + }
138.290 +
138.291 + /** verifies node's popup paths for presence (without invocation)
138.292 + * @param popupPaths String[] popup paths
138.293 + */
138.294 + public void verifyPopup(String[] popupPaths) {
138.295 + //invocation of root popup
138.296 + final JPopupMenuOperator popup=callPopup();
138.297 + for (int i=0; i<popupPaths.length; i++) {
138.298 + try {
138.299 + popup.showMenuItem(popupPaths[i], "|");
138.300 + } catch (NullPointerException npe) {
138.301 + throw new JemmyException("Popup path ["+popupPaths[i]+"] not found.");
138.302 + }
138.303 + }
138.304 + //closing popup
138.305 + popup.waitState(new ComponentChooser() {
138.306 + public boolean checkComponent(Component comp) {
138.307 + try {
138.308 + popup.pushKey(KeyEvent.VK_ESCAPE);
138.309 + return false;
138.310 + } catch (JemmyException e) {}
138.311 + return true;
138.312 + }
138.313 + public String getDescription() {
138.314 + return "Popup menu closer";
138.315 + }
138.316 + });
138.317 + }
138.318 +
138.319 + class StringArraySubPathChooser implements JTreeOperator.TreePathChooser {
138.320 + String[] arr;
138.321 + int[] indices;
138.322 + JTreeOperator.StringComparator comparator;
138.323 + TreePath parentPath;
138.324 + int parentPathCount;
138.325 + StringArraySubPathChooser(TreePath parentPath, String[] arr, int[] indices, JTreeOperator.StringComparator comparator) {
138.326 + this.arr = arr;
138.327 + this.comparator = comparator;
138.328 + this.indices = indices;
138.329 + this.parentPath=parentPath;
138.330 + this.parentPathCount=parentPath.getPathCount();
138.331 + }
138.332 + /** implementation of JTreeOperator.TreePathChooser
138.333 + * @param path TreePath
138.334 + * @param indexInParent int
138.335 + * @return boolean */
138.336 + public boolean checkPath(TreePath path, int indexInParent) {
138.337 + return(path.getPathCount() == arr.length + parentPathCount &&
138.338 + hasAsParent(path, indexInParent));
138.339 + }
138.340 + /** implementation of JTreeOperator.TreePathChooser
138.341 + * @param path TreePath
138.342 + * @param indexInParent int
138.343 + * @return boolean */
138.344 + public boolean hasAsParent(TreePath path, int indexInParent) {
138.345 + if (path.getPathCount()<=parentPathCount)
138.346 + return path.isDescendant(parentPath);
138.347 + if(arr.length+parentPathCount < path.getPathCount()) {
138.348 + return(false);
138.349 + }
138.350 + if(indices.length >= path.getPathCount()-parentPathCount &&
138.351 + indices[path.getPathCount()-parentPathCount-1] != indexInParent) {
138.352 + return(false);
138.353 + }
138.354 + Object[] comps = path.getPath();
138.355 + for(int i = parentPathCount; i < comps.length; i++) {
138.356 + if(!comparator.equals(comps[i].toString(), arr[i-parentPathCount])) {
138.357 + return(false);
138.358 + }
138.359 + }
138.360 + return(true);
138.361 + }
138.362 +
138.363 + /** implementation of JTreeOperator.TreePathChooser
138.364 + * @return String description */
138.365 + public String getDescription() {
138.366 + String desc = "";
138.367 + Object parr[]=parentPath.getPath();
138.368 + for(int i = 0; i < parr.length; i++) {
138.369 + desc = desc + parr[i].toString() + ", ";
138.370 + }
138.371 + for(int i = 0; i < arr.length; i++) {
138.372 + desc = desc + arr[i] + ", ";
138.373 + }
138.374 + if(desc.length() > 0) {
138.375 + desc = desc.substring(0, desc.length() - 2);
138.376 + }
138.377 + return("[ " + desc + " ]");
138.378 + }
138.379 +
138.380 + }
138.381 +
138.382 + TreePath findSubPath(String subPath, String delimiter) {
138.383 + return findSubPath(subPath, "", delimiter);
138.384 + }
138.385 +
138.386 + TreePath findSubPath(String subPath, String indexes, String delimiter) {
138.387 + JTreeOperator o=tree();
138.388 + String indexStr[]=o.parseString(indexes, delimiter);
138.389 + int indexInt[]= new int[indexStr.length];
138.390 + for (int i=0; i<indexStr.length; i++)
138.391 + indexInt[i]=Integer.parseInt(indexStr[i]);
138.392 + return o.findPath(new Node.StringArraySubPathChooser(treePath, o.parseString(subPath, delimiter), indexInt, getComparator()));
138.393 + }
138.394 +
138.395 + /** Expands current node to see children */
138.396 + public void expand() {
138.397 + treeOperator.expandPath(treePath);
138.398 + waitExpanded();
138.399 + }
138.400 +
138.401 + /** Collapse current node to hide children */
138.402 + public void collapse() {
138.403 + treeOperator.collapsePath(treePath);
138.404 + waitCollapsed();
138.405 + }
138.406 +
138.407 + /** Waits for node to be expanded */
138.408 + public void waitExpanded() {
138.409 + treeOperator.waitExpanded(treePath);
138.410 + }
138.411 +
138.412 + /** Waits for node to be collapsed */
138.413 + public void waitCollapsed() {
138.414 + treeOperator.waitCollapsed(treePath);
138.415 + }
138.416 +
138.417 + /** Informs if current node is expanded
138.418 + * @return boolean true when node is expanded
138.419 + */
138.420 + public boolean isExpanded() {
138.421 + return treeOperator.isExpanded(treePath);
138.422 + }
138.423 +
138.424 + /** Informs if current node is collapsed
138.425 + * @return boolean true when node is collapsed
138.426 + */
138.427 + public boolean isCollapsed() {
138.428 + return treeOperator.isCollapsed(treePath);
138.429 + }
138.430 +
138.431 + /*protected Action[] getActions() {
138.432 + return null;
138.433 + }
138.434 +
138.435 + public boolean hasAction(Class actionClass) {
138.436 + Action actions[] = getActions();
138.437 + for (int i=0; actions!=null && i<actions.length; i++)
138.438 + if (actionClass.equals(actions[i].getClass()))
138.439 + return true;
138.440 + return false;
138.441 + }*/
138.442 +
138.443 + /** verifies node's popup paths (of all actions) for presence (without invocation)
138.444 + * @param actions array of actions to be verified
138.445 + */
138.446 + public void verifyPopup(Action actions[]) {
138.447 + ArrayList popupPaths=new ArrayList();
138.448 + String path;
138.449 + for (int i=0; i<actions.length; i++) {
138.450 + path=actions[i].getPopupPath();
138.451 + if (path!=null) {
138.452 + popupPaths.add(path);
138.453 + }
138.454 + }
138.455 + verifyPopup((String[])popupPaths.toArray(new String[0]));
138.456 + }
138.457 +
138.458 +
138.459 + /** Checks whether child with specified name is present under this node.
138.460 + * @param childName name of child node
138.461 + * @return true if child is present; false otherwise
138.462 + */
138.463 + public boolean isChildPresent(String childName) {
138.464 + String[] children = this.getChildren();
138.465 + for(int i=0;i<children.length;i++) {
138.466 + if(getComparator().equals(children[i], childName)) {
138.467 + return true;
138.468 + }
138.469 + }
138.470 + return false;
138.471 + }
138.472 +
138.473 + /** Waits until child with specified name is not present under this node.
138.474 + * It can throw TimeoutExpiredException, if child is still present.
138.475 + * @param childName name of child node
138.476 + */
138.477 + public void waitChildNotPresent(final String childName) {
138.478 + try {
138.479 + new Waiter(new Waitable() {
138.480 + public Object actionProduced(Object anObject) {
138.481 + return isChildPresent(childName) ? null : Boolean.TRUE;
138.482 + }
138.483 + public String getDescription() {
138.484 + return("Child \""+childName+"\" not present under parent \""+getPath()+"\"");
138.485 + }
138.486 + }).waitAction(null);
138.487 + } catch (InterruptedException e) {
138.488 + throw new JemmyException("Interrupted.", e);
138.489 + }
138.490 + }
138.491 +
138.492 + /** Waits until this node is no longer present.
138.493 + * It can throw TimeoutExpiredException, if the node is still present.
138.494 + */
138.495 + public void waitNotPresent() {
138.496 + try {
138.497 + new Waiter(new Waitable() {
138.498 + public Object actionProduced(Object anObject) {
138.499 + return isPresent() ? null : Boolean.TRUE;
138.500 + }
138.501 + public String getDescription() {
138.502 + return("Wait node "+getPath()+" not present.");
138.503 + }
138.504 + }).waitAction(null);
138.505 + } catch (InterruptedException e) {
138.506 + throw new JemmyException("Interrupted.", e);
138.507 + }
138.508 + }
138.509 +}
139.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
139.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/nodes/WebServicesNode.java Thu Jul 10 04:32:50 2008 -0700
139.3 @@ -0,0 +1,110 @@
139.4 +/*
139.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
139.6 + *
139.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
139.8 + *
139.9 + * The contents of this file are subject to the terms of either the GNU
139.10 + * General Public License Version 2 only ("GPL") or the Common
139.11 + * Development and Distribution License("CDDL") (collectively, the
139.12 + * "License"). You may not use this file except in compliance with the
139.13 + * License. You can obtain a copy of the License at
139.14 + * http://www.netbeans.org/cddl-gplv2.html
139.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
139.16 + * specific language governing permissions and limitations under the
139.17 + * License. When distributing the software, include this License Header
139.18 + * Notice in each file and include the License file at
139.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
139.20 + * particular file as subject to the "Classpath" exception as provided
139.21 + * by Sun in the GPL Version 2 section of the License file that
139.22 + * accompanied this code. If applicable, add the following below the
139.23 + * License Header, with the fields enclosed by brackets [] replaced by
139.24 + * your own identifying information:
139.25 + * "Portions Copyrighted [year] [name of copyright owner]"
139.26 + *
139.27 + * Contributor(s):
139.28 + *
139.29 + * The Original Software is NetBeans. The Initial Developer of the Original
139.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
139.31 + * Microsystems, Inc. All Rights Reserved.
139.32 + *
139.33 + * If you wish your version of this file to be governed by only the CDDL
139.34 + * or only the GPL Version 2, indicate your decision by adding
139.35 + * "[Contributor] elects to include this software in this distribution
139.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
139.37 + * single choice of license, a recipient has the option to distribute
139.38 + * your version of this file under either the CDDL, the GPL Version 2 or
139.39 + * to extend the choice of license to its licensees as provided above.
139.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
139.41 + * Version 2 license, then the option applies only if the new code is
139.42 + * made subject to such option by the copyright holder.
139.43 + */
139.44 +
139.45 +package org.netbeans.modules.visualweb.gravy.nodes;
139.46 +
139.47 +import org.netbeans.jemmy.operators.JTreeOperator;
139.48 +
139.49 +import javax.swing.tree.TreePath;
139.50 +
139.51 +import org.netbeans.modules.visualweb.gravy.websvc.actions.AddWebServiceAction;
139.52 +import org.netbeans.modules.visualweb.gravy.websvc.actions.CreateGroupAction;
139.53 +import org.netbeans.modules.visualweb.gravy.actions.Action;
139.54 +
139.55 +
139.56 +public class WebServicesNode extends Node{
139.57 + /** creates new FormNode
139.58 + * @param treeOperator JTreeOperator tree
139.59 + * @param treePath String tree path */
139.60 + public WebServicesNode(JTreeOperator treeOperator, String treePath) {
139.61 + super(treeOperator, treePath);
139.62 + }
139.63 +
139.64 + /** creates new FormNode
139.65 + * @param parent parent Node
139.66 + * @param treeSubPath String tree path from parent node */
139.67 + public WebServicesNode(Node parent, String treeSubPath) {
139.68 + super(parent, treeSubPath);
139.69 + }
139.70 +
139.71 + /** creates new FormNode
139.72 + * @param treeOperator JTreeOperator tree
139.73 + * @param path TreePath */
139.74 + public WebServicesNode(JTreeOperator treeOperator, TreePath path) {
139.75 + super(treeOperator, path);
139.76 + }
139.77 +
139.78 + static final AddWebServiceAction addWebServiceAction = new AddWebServiceAction();
139.79 + static final CreateGroupAction createGroupAction = new CreateGroupAction();
139.80 +
139.81 + /**
139.82 + * tests popup menu items for presence
139.83 + */
139.84 + public void verifyPopup() {
139.85 + verifyPopup(new Action[]{
139.86 + addWebServiceAction,
139.87 + createGroupAction,
139.88 + });
139.89 + }
139.90 +
139.91 + /*protected static final Action[] javaActions = new Action[] {
139.92 + cutAction,
139.93 + copyAction,
139.94 + deleteAction,
139.95 + compileAction,
139.96 + };
139.97 +
139.98 + Action[] getActions() {
139.99 + return javaActions;
139.100 + }*/
139.101 +
139.102 + /** performs addWebServiceAction with this node */
139.103 + public void addWebService() {
139.104 + addWebServiceAction.perform(this);
139.105 + }
139.106 +
139.107 + /** performs createGroupAction with this node */
139.108 + public void createGroup() {
139.109 + createGroupAction.perform(this);
139.110 + }
139.111 +
139.112 +
139.113 +}
140.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
140.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/plugins/PluginsOperator.java Thu Jul 10 04:32:50 2008 -0700
140.3 @@ -0,0 +1,465 @@
140.4 +/*
140.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
140.6 +
140.7 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
140.8 +
140.9 +
140.10 +The contents of this file are subject to the terms of either the GNU
140.11 +General Public License Version 2 only ("GPL") or the Common
140.12 +Development and Distribution License("CDDL") (collectively, the
140.13 +"License"). You may not use this file except in compliance with the
140.14 +License. You can obtain a copy of the License at
140.15 +http://www.netbeans.org/cddl-gplv2.html
140.16 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
140.17 +specific language governing permissions and limitations under the
140.18 +License. When distributing the software, include this License Header
140.19 +Notice in each file and include the License file at
140.20 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
140.21 +particular file as subject to the "Classpath" exception as provided
140.22 +by Sun in the GPL Version 2 section of the License file that
140.23 +accompanied this code. If applicable, add the following below the
140.24 +License Header, with the fields enclosed by brackets [] replaced by
140.25 +your own identifying information:
140.26 +"Portions Copyrighted [year] [name of copyright owner]"
140.27 +
140.28 +Contributor(s):
140.29 +
140.30 +The Original Software is NetBeans. The Initial Developer of the Original
140.31 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
140.32 +Microsystems, Inc. All Rights Reserved.
140.33 +
140.34 +If you wish your version of this file to be governed by only the CDDL
140.35 +or only the GPL Version 2, indicate your decision by adding
140.36 +"[Contributor] elects to include this software in this distribution
140.37 +under the [CDDL or GPL Version 2] license." If you do not indicate a
140.38 +single choice of license, a recipient has the option to distribute
140.39 +your version of this file under either the CDDL, the GPL Version 2 or
140.40 +to extend the choice of license to its licensees as provided above.
140.41 +However, if you add GPL Version 2 code and therefore, elected the GPL
140.42 +Version 2 license, then the option applies only if the new code is
140.43 +made subject to such option by the copyright holder.
140.44 +*/
140.45 +package org.netbeans.modules.visualweb.gravy.plugins;
140.46 +
140.47 +import java.util.*;
140.48 +import java.io.*;
140.49 +import java.awt.*;
140.50 +import javax.swing.*;
140.51 +import org.netbeans.jemmy.*;
140.52 +import org.netbeans.jemmy.operators.*;
140.53 +import org.netbeans.modules.visualweb.gravy.*;
140.54 +
140.55 +public class PluginsOperator extends JDialogOperator {
140.56 + private static final String
140.57 + MAIN_MENU_ITEM_TOOLS = "Tools",
140.58 + MAIN_MENU_ITEM_TOOLS_PLUGINS = MAIN_MENU_ITEM_TOOLS + "|Plugins",
140.59 + DIALOG_TITLE_PLUGINS = "Plugins",
140.60 + DIALOG_TITLE_NETBEANS_IDE_INSTALLER = "NetBeans IDE Installer",
140.61 + DIALOG_TITLE_VALIDATION_WARNING = "Validation Warning",
140.62 +
140.63 + TAB_TITLE_AVAILABLE_PLUGINS = "Available Plugins",
140.64 + TAB_TITLE_DOWNLOADED_PLUGINS = "Downloaded",
140.65 +
140.66 + COLUMN_TITLE_NAME = "Name",
140.67 + COLUMN_TITLE_INSTALL = "Install",
140.68 +
140.69 + RADIO_BUTTON_LICENSE_AGREEMENT_ACCEPT_TEXT = "I accept",
140.70 +
140.71 + BUTTON_LABEL_ADD_PLUGINS = "Add Plugins",
140.72 + BUTTON_LABEL_RELOAD_CATALOG = "Reload Catalog",
140.73 + BUTTON_LABEL_INSTALL = "Install",
140.74 + BUTTON_LABEL_NEXT = "Next",
140.75 + BUTTON_LABEL_CONTINUE = "Continue",
140.76 + BUTTON_LABEL_FINISH = "Finish",
140.77 + BUTTON_LABEL_CLOSE = "Close";
140.78 +
140.79 + private JTabbedPaneOperator tabbedPane;
140.80 + private JButtonOperator btnClose;
140.81 + private boolean pluginsAvailable;
140.82 +
140.83 + public static PluginsOperator getInstance() {
140.84 + display(); // check whether the appropriate dialog is opened or not
140.85 + return (new PluginsOperator());
140.86 + }
140.87 +
140.88 + private PluginsOperator() {
140.89 + super(DIALOG_TITLE_PLUGINS);
140.90 + verify();
140.91 + }
140.92 +
140.93 + public void installAvailablePlugins() {
140.94 + installAvailablePlugins(Collections.EMPTY_LIST);
140.95 + }
140.96 + public void installAvailablePlugins(String pluginName) {
140.97 + installAvailablePlugins(new String[] {pluginName});
140.98 + }
140.99 + public void installAvailablePlugins(String[] pluginNames) {
140.100 + installAvailablePlugins(Arrays.asList(pluginNames));
140.101 + }
140.102 + public void installAvailablePlugins(java.util.List<String> pluginNames) {
140.103 + ContainerOperator containerOp = waitTabEnabled(TAB_TITLE_AVAILABLE_PLUGINS);
140.104 + JTableOperator pluginTable = new JTableOperator(containerOp);
140.105 + fillAvailablePluginsTable(containerOp, pluginTable);
140.106 + selectPlugins(pluginTable, pluginNames);
140.107 + if (pluginsAvailable) installSelectedPlugins(containerOp);
140.108 + else System.out.println("WARNING: Necessary plugins are absent!");
140.109 + closeDialog();
140.110 + }
140.111 +
140.112 + public void installDownloadedPlugins(String nbmPath) {
140.113 + ContainerOperator containerOp = waitTabEnabled(TAB_TITLE_DOWNLOADED_PLUGINS);
140.114 + new JButtonOperator(containerOp, BUTTON_LABEL_ADD_PLUGINS).pushNoBlock();
140.115 + Util.wait(500);
140.116 + new QueueTool().waitEmpty();
140.117 +
140.118 + addDownloadedPlugins(nbmPath, containerOp);
140.119 + JTableOperator pluginTable = new JTableOperator(containerOp);
140.120 + waitPluginsTableFilling(pluginTable);
140.121 +
140.122 + installSelectedPlugins(containerOp);
140.123 + closeDialog();
140.124 + }
140.125 +
140.126 + private ContainerOperator waitTabEnabled(String tabTitle) {
140.127 + for (int i = 0; i < 200; i++) {
140.128 + int cursorType = tabbedPane.getCursor().getType();
140.129 + //debugOutput("Cursor Name = " + tabbedPane.getCursor().getName());
140.130 + if (cursorType == Cursor.WAIT_CURSOR) {
140.131 + Util.wait(1000);
140.132 + new QueueTool().waitEmpty();
140.133 + } else {
140.134 + break;
140.135 + }
140.136 + }
140.137 + int tabIndex = findTab(tabTitle);
140.138 + if (tabIndex > -1) {
140.139 + tabbedPane.setSelectedIndex(tabIndex);
140.140 + ContainerOperator containerOp = new ContainerOperator(
140.141 + (Container) tabbedPane.getComponentAt(tabIndex));
140.142 + Util.wait(500);
140.143 + new QueueTool().waitEmpty();
140.144 + return containerOp;
140.145 + } else {
140.146 + throw new RuntimeException("Tab with title [" + tabTitle +
140.147 + "] isn't found in the dialog [" + this.getTitle() + "]");
140.148 + }
140.149 + }
140.150 +
140.151 + private int findTab(String tabTitle) {
140.152 + // int tabIndex = tabbedPane.indexOfTab(tabTitle); // only j2sdk 1.6
140.153 + // return tabIndex;
140.154 + int tabCount = tabbedPane.getTabCount();
140.155 + for (int i = 0; i < tabCount; i++) {
140.156 + // Component component = tabbedPane.getComponentAt(i);
140.157 + // only j2sdk 1.6: Component tabComponent = ((JTabbedPane) tabbedPane.getSource()).getTabComponentAt(i);
140.158 + String title = tabbedPane.getTitleAt(i);
140.159 + //debugOutput("+++ Tab Title = [" + title + "]");
140.160 + //if (title.equals(tabTitle)) {
140.161 + if (title.indexOf(tabTitle) > -1) {
140.162 + return i;
140.163 + }
140.164 + }
140.165 + return (-1);
140.166 + }
140.167 +
140.168 + private int getColumnIndexByName(JTableOperator tableOp, String columnName) {
140.169 + int colCount = tableOp.getColumnCount();
140.170 + for (int i = 0; i < colCount; i++) {
140.171 + String name = tableOp.getColumnName(i);
140.172 + if (name.indexOf(columnName) > -1) {
140.173 + return i;
140.174 + }
140.175 + }
140.176 + return (-1);
140.177 + }
140.178 +
140.179 + private void fillAvailablePluginsTable(ContainerOperator containerOp, JTableOperator pluginTable) {
140.180 + int rowCount = pluginTable.getRowCount();
140.181 + //debugOutput("pluginTable.getRowCount() = " + rowCount,
140.182 + // "pluginTable.getColumnCount() = " + pluginTable.getColumnCount());
140.183 + if (rowCount == 0) {
140.184 + new JButtonOperator(containerOp, BUTTON_LABEL_RELOAD_CATALOG).pushNoBlock();
140.185 + Util.wait(500);
140.186 + new QueueTool().waitEmpty();
140.187 + waitPluginsTableFilling(pluginTable);
140.188 + }
140.189 + }
140.190 +
140.191 + private void waitPluginsTableFilling(JTableOperator pluginTable) {
140.192 + for (int i = 0; i < 200; i++) {
140.193 + int rowCount = pluginTable.getRowCount();
140.194 + //debugOutput("pluginTable.getRowCount() = " + rowCount);
140.195 + if (rowCount < 1) {
140.196 + Util.wait(1000);
140.197 + new QueueTool().waitEmpty();
140.198 + } else {
140.199 + break;
140.200 + }
140.201 + }
140.202 + }
140.203 +
140.204 + private void selectPlugins(JTableOperator pluginTable,
140.205 + java.util.List<String> pluginNames) {
140.206 + java.util.List<String> selectedPlugins = new ArrayList();
140.207 + int nameColumnIndex = getColumnIndexByName(pluginTable, COLUMN_TITLE_NAME);
140.208 + int installColumnIndex = getColumnIndexByName(pluginTable, COLUMN_TITLE_INSTALL),
140.209 + rowCount = pluginTable.getRowCount();
140.210 + for (int row = 0; row < rowCount; row++) {
140.211 + Object cellValue = pluginTable.getValueAt(row, nameColumnIndex);
140.212 + //debugOutput("cellValue[" + row + "] = [" + cellValue + "]");
140.213 + if (isPluginInList(pluginNames, cellValue.toString())) {
140.214 + int rowIndex = row;
140.215 + pluginTable.clickOnCell(rowIndex, installColumnIndex);
140.216 + Util.wait(500);
140.217 + new QueueTool().waitEmpty();
140.218 + selectedPlugins.add(cellValue.toString());
140.219 + }
140.220 + }
140.221 + if (selectedPlugins.isEmpty()) pluginsAvailable = false;
140.222 + else pluginsAvailable = true;
140.223 + }
140.224 +
140.225 + private boolean isPluginInList(java.util.List<String> pluginNames, String checkedPluginName) {
140.226 + // if a list of plugin names is empty, it means that
140.227 + // all plugins in a table should be selected
140.228 + if (pluginNames.isEmpty()) return true;
140.229 + return pluginNames.contains(checkedPluginName);
140.230 + }
140.231 +
140.232 + private void addDownloadedPlugins(String nbmPath, ContainerOperator containerOp) {
140.233 + new JButtonOperator(containerOp, BUTTON_LABEL_ADD_PLUGINS).pushNoBlock();
140.234 + Util.wait(500);
140.235 + new QueueTool().waitEmpty();
140.236 +
140.237 + JFileChooserOperator fileChooserOp = new JFileChooserOperator();
140.238 + fileChooserOp.setSelectedFile(new File(nbmPath));
140.239 + Util.wait(500);
140.240 + new QueueTool().waitEmpty();
140.241 +
140.242 + fileChooserOp.approve();
140.243 + Util.wait(500);
140.244 + new QueueTool().waitEmpty();
140.245 + }
140.246 +
140.247 + private void installSelectedPlugins(ContainerOperator containerOp) {
140.248 + JButtonOperator btnInstall = new JButtonOperator(containerOp, BUTTON_LABEL_INSTALL);
140.249 + if (btnInstall.isEnabled()) {
140.250 + btnInstall.pushNoBlock();
140.251 + Util.wait(500);
140.252 + new QueueTool().waitEmpty();
140.253 + } else {
140.254 + throw new RuntimeException("The button [" + BUTTON_LABEL_INSTALL +
140.255 + "] isn't enabled in the dialog [" + DIALOG_TITLE_PLUGINS + "]");
140.256 + }
140.257 + workInstallerDialog();
140.258 + }
140.259 +
140.260 + private void workInstallerDialog() {
140.261 + JDialogOperator installerDialog = new JDialogOperator(DIALOG_TITLE_NETBEANS_IDE_INSTALLER);
140.262 + Util.wait(3000);
140.263 + new QueueTool().waitEmpty();
140.264 +
140.265 + String timeoutName = "ComponentOperator.WaitComponentTimeout";
140.266 + long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
140.267 + newTimeoutValue = 1000;
140.268 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
140.269 + try {
140.270 + new JButtonOperator(installerDialog, BUTTON_LABEL_NEXT).pushNoBlock();
140.271 + Util.wait(1000);
140.272 + new QueueTool().waitEmpty();
140.273 +
140.274 + JCheckBoxOperator cbLicenseAgreements = new JCheckBoxOperator(
140.275 + installerDialog, RADIO_BUTTON_LICENSE_AGREEMENT_ACCEPT_TEXT);
140.276 + cbLicenseAgreements.changeSelection(true);
140.277 + Util.wait(500);
140.278 + new QueueTool().waitEmpty();
140.279 +
140.280 + Util.wait(500);
140.281 + new QueueTool().waitEmpty();
140.282 + } catch(TimeoutExpiredException tee) {
140.283 + tee.printStackTrace(System.out);
140.284 + } catch(Exception e) {
140.285 + e.printStackTrace(System.out);
140.286 + throw new RuntimeException(e);
140.287 + } finally {
140.288 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, previousTimeoutValue);
140.289 + }
140.290 + new JButtonOperator(installerDialog, BUTTON_LABEL_INSTALL).pushNoBlock();
140.291 + Util.wait(500);
140.292 + new QueueTool().waitEmpty();
140.293 +
140.294 + waitInstallationFinish(installerDialog);
140.295 + }
140.296 +
140.297 + private void waitInstallationFinish(JDialogOperator dialogOp) {
140.298 + String timeoutName = "DialogWaiter.WaitDialogTimeout";
140.299 + long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
140.300 + newTimeoutValue = 1000;
140.301 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
140.302 +
140.303 + //DialogWatcher warningDialogThread = new DialogWatcher(
140.304 + // DIALOG_TITLE_VALIDATION_WARNING, BUTTON_LABEL_CONTINUE);
140.305 + //warningDialogThread.startWatch();
140.306 +
140.307 + JButtonOperator btnFinish = null;
140.308 + for (int i = 0; i < 600; i++) {
140.309 + btnFinish = checkButtonFinishAppearance(dialogOp);
140.310 + if ((btnFinish != null) && (btnFinish.isEnabled())) break;
140.311 + }
140.312 + //warningDialogThread.stopWatch();
140.313 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
140.314 + previousTimeoutValue > 0 ? previousTimeoutValue : 60000);
140.315 + //debugOutput("btnFinish = [" + btnFinish + "]", "btnFinish.isEnabled() = [" + btnFinish.isEnabled() + "]");
140.316 + if ((btnFinish != null) && (btnFinish.isEnabled())) {
140.317 + btnFinish.pushNoBlock();
140.318 + Util.wait(500);
140.319 + new QueueTool().waitEmpty();
140.320 + } else {
140.321 + throw new RuntimeException("The button [" + BUTTON_LABEL_FINISH +
140.322 + "] is not found or disabled in the dialog [" + DIALOG_TITLE_NETBEANS_IDE_INSTALLER + "]");
140.323 + }
140.324 + }
140.325 +
140.326 + private JButtonOperator checkButtonFinishAppearance(JDialogOperator dialogOp) {
140.327 + String timeoutName = "ComponentOperator.WaitComponentTimeout";
140.328 + long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
140.329 + newTimeoutValue = 1000;
140.330 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
140.331 + JButtonOperator btnFinish = null;
140.332 + try {
140.333 + btnFinish = new JButtonOperator(dialogOp, BUTTON_LABEL_FINISH);
140.334 + return btnFinish;
140.335 + } catch(TimeoutExpiredException tee) {
140.336 + Util.wait(500);
140.337 + new QueueTool().waitEmpty();
140.338 + } catch(Exception e) {
140.339 + e.printStackTrace(System.out);
140.340 + throw new RuntimeException(e);
140.341 + } finally {
140.342 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, previousTimeoutValue);
140.343 + }
140.344 + return null;
140.345 + }
140.346 +
140.347 + private void closeDialog() {
140.348 + btnClose.pushNoBlock();
140.349 + Util.wait(500);
140.350 + new QueueTool().waitEmpty();
140.351 + }
140.352 +
140.353 + public static void display() {
140.354 + String timeoutName = "DialogWaiter.WaitDialogTimeout";
140.355 + long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
140.356 + newTimeoutValue = 1500;
140.357 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
140.358 + try {
140.359 + new JDialogOperator(DIALOG_TITLE_PLUGINS);
140.360 + } catch(TimeoutExpiredException tee) { // dialog isn't open yet
140.361 + Util.getMainMenu().pushMenuNoBlock(MAIN_MENU_ITEM_TOOLS_PLUGINS);
140.362 + Util.wait(1000);
140.363 + new QueueTool().waitEmpty();
140.364 + } catch(Exception e) {
140.365 + e.printStackTrace(System.out);
140.366 + throw new RuntimeException(e);
140.367 + } finally {
140.368 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
140.369 + previousTimeoutValue > 0 ? previousTimeoutValue : 60000);
140.370 + }
140.371 + }
140.372 +
140.373 + public JTabbedPaneOperator checkTabbedPane() {
140.374 + if (tabbedPane == null) {
140.375 + tabbedPane = new JTabbedPaneOperator(this);
140.376 + }
140.377 + return tabbedPane;
140.378 + }
140.379 +
140.380 + private JButtonOperator checkButtonClose() {
140.381 + if (btnClose == null) {
140.382 + btnClose = new JButtonOperator(this, BUTTON_LABEL_CLOSE);
140.383 + }
140.384 + return btnClose;
140.385 + }
140.386 +
140.387 + /**
140.388 + * Initializes all necessary controls.
140.389 + */
140.390 + public void verify() {
140.391 + checkTabbedPane();
140.392 + checkButtonClose();
140.393 + }
140.394 +
140.395 + private void debugOutput(Object... dataArray) {
140.396 + System.out.println();
140.397 + for (Object obj : dataArray) {
140.398 + System.out.println(obj.toString());
140.399 + }
140.400 + System.out.println();
140.401 + }
140.402 +//============================================================================//
140.403 + private class DialogWatcher implements Runnable {
140.404 + private String dialogTitle, buttonLabel;
140.405 + private boolean stopWatch = true;
140.406 + private Thread watchThread = new Thread(this);
140.407 +
140.408 + public DialogWatcher(String dialogTitle, String buttonLabel) {
140.409 + this.dialogTitle = dialogTitle;
140.410 + this.buttonLabel = buttonLabel;
140.411 + }
140.412 +
140.413 + public void startWatch() {
140.414 + stopWatch = false;
140.415 + watchThread.start();
140.416 + }
140.417 + public void stopWatch() {
140.418 + stopWatch = true;
140.419 + do { // wait until a thread, which is used in this internal class, is died
140.420 + //debugOutput("+++ watchThread.isAlive() = " + watchThread.isAlive());
140.421 + Util.wait(500);
140.422 + } while (watchThread.isAlive());
140.423 + //debugOutput("+++ watchThread.isAlive() = " + watchThread.isAlive());
140.424 + Util.wait(1000);
140.425 + }
140.426 +
140.427 + public void run() {
140.428 + while (true) {
140.429 + if (stopWatch) return;
140.430 + synchronized (this) {
140.431 + try {
140.432 + wait(1000);
140.433 + } catch (Exception e) {
140.434 + e.printStackTrace(System.out);
140.435 + throw new RuntimeException(e);
140.436 + }
140.437 + }
140.438 + JDialogOperator dialogOp = checkDialogAppearance();
140.439 + if (dialogOp != null) {
140.440 + new JButtonOperator(dialogOp, buttonLabel).pushNoBlock();
140.441 + Util.wait(500);
140.442 + new QueueTool().waitEmpty();
140.443 + stopWatch = true;
140.444 + }
140.445 + }
140.446 + }
140.447 +
140.448 + private JDialogOperator checkDialogAppearance() {
140.449 + String timeoutName = "DialogWaiter.WaitDialogTimeout";
140.450 + long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
140.451 + newTimeoutValue = 1000;
140.452 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
140.453 + try {
140.454 + JDialogOperator dialogOp = new JDialogOperator(dialogTitle);
140.455 + return dialogOp;
140.456 + } catch(TimeoutExpiredException tee) {
140.457 + Util.wait(500);
140.458 + new QueueTool().waitEmpty();
140.459 + } catch(Exception e) {
140.460 + e.printStackTrace(System.out);
140.461 + throw new RuntimeException(e);
140.462 + } finally {
140.463 + JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, previousTimeoutValue);
140.464 + }
140.465 + return null;
140.466 + }
140.467 + }
140.468 +}
140.469 \ No newline at end of file
141.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
141.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/CheckBoxProperty.java Thu Jul 10 04:32:50 2008 -0700
141.3 @@ -0,0 +1,113 @@
141.4 +/*
141.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
141.6 + *
141.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
141.8 + *
141.9 + * The contents of this file are subject to the terms of either the GNU
141.10 + * General Public License Version 2 only ("GPL") or the Common
141.11 + * Development and Distribution License("CDDL") (collectively, the
141.12 + * "License"). You may not use this file except in compliance with the
141.13 + * License. You can obtain a copy of the License at
141.14 + * http://www.netbeans.org/cddl-gplv2.html
141.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
141.16 + * specific language governing permissions and limitations under the
141.17 + * License. When distributing the software, include this License Header
141.18 + * Notice in each file and include the License file at
141.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
141.20 + * particular file as subject to the "Classpath" exception as provided
141.21 + * by Sun in the GPL Version 2 section of the License file that
141.22 + * accompanied this code. If applicable, add the following below the
141.23 + * License Header, with the fields enclosed by brackets [] replaced by
141.24 + * your own identifying information:
141.25 + * "Portions Copyrighted [year] [name of copyright owner]"
141.26 + *
141.27 + * Contributor(s):
141.28 + *
141.29 + * The Original Software is NetBeans. The Initial Developer of the Original
141.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
141.31 + * Microsystems, Inc. All Rights Reserved.
141.32 + *
141.33 + * If you wish your version of this file to be governed by only the CDDL
141.34 + * or only the GPL Version 2, indicate your decision by adding
141.35 + * "[Contributor] elects to include this software in this distribution
141.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
141.37 + * single choice of license, a recipient has the option to distribute
141.38 + * your version of this file under either the CDDL, the GPL Version 2 or
141.39 + * to extend the choice of license to its licensees as provided above.
141.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
141.41 + * Version 2 license, then the option applies only if the new code is
141.42 + * made subject to such option by the copyright holder.
141.43 + */
141.44 +
141.45 +package org.netbeans.modules.visualweb.gravy.properties;
141.46 +
141.47 +import org.netbeans.jemmy.JemmyException;
141.48 +import org.netbeans.jemmy.operators.ContainerOperator;
141.49 +import org.netbeans.jemmy.operators.JCheckBoxOperator;
141.50 +import java.lang.Boolean;
141.51 +import java.lang.String;
141.52 +/**
141.53 + * Can be used to set all properties which use JComboBox to change value.
141.54 + * <p>
141.55 + * Usage:<br>
141.56 + * <pre>
141.57 + * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
141.58 + * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Properties");
141.59 + * ComboBoxProperty pr = new ComboBoxProperty(psto, "Template");
141.60 + * pr.setValue("True");
141.61 + * pr.setValue(1);
141.62 + * </pre>
141.63 + *
141.64 + * @deprecated Use {@link Property} instead
141.65 + */
141.66 +public class CheckBoxProperty extends Property {
141.67 +
141.68 + /** Waits for property with given name in specified container.
141.69 + * @param contOper ContainerOperator where to find property. It is
141.70 + * recommended to use {@link PropertySheetTabOperator}.
141.71 + * @param name property name
141.72 + * @deprecated Use {@link Property} instead
141.73 + */
141.74 + public CheckBoxProperty(ContainerOperator contOper, String name) {
141.75 + super(contOper, name);
141.76 + }
141.77 +
141.78 + /** Starts editing the property and waits for JComboBox
141.79 + * @return JComboBoxOperator of property combo box
141.80 + * @deprecated Use {@link #setValue} to change property value
141.81 + */
141.82 + public JCheckBoxOperator checkBox() {
141.83 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
141.84 + /*
141.85 + startEditing();
141.86 + return new JComboBoxOperator(contOper);
141.87 + */
141.88 + }
141.89 +
141.90 + /** Sets value of the property. It makes property editable, finds
141.91 + * JCheckBox and selects specified item.
141.92 + * @param value item to be selected
141.93 + */
141.94 + public void setValue(String value) {
141.95 + JCheckBoxOperator checkOper = checkBox();
141.96 + checkOper.setSelected(new Boolean(value).booleanValue());
141.97 + }
141.98 +
141.99 + /** Gets value of the property.
141.100 + * @return String Value of the item's state.
141.101 + */
141.102 + public String getValue() {
141.103 + JCheckBoxOperator checkOper = checkBox();
141.104 + return new Boolean(checkOper.isSelected()).toString();
141.105 + }
141.106 +
141.107 + /** Sets value of the property. It makes property editable, finds
141.108 + * JComboBox and selects index-th item.
141.109 + * @param index index of item to be selected (Start at 0)
141.110 + */
141.111 + /*public void setValue(int index) {
141.112 + JComboBoxOperator comboOper = comboBox();
141.113 + comboOper.setSelectedIndex(index);
141.114 + }
141.115 + */
141.116 +}
142.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
142.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/ComboBoxProperty.java Thu Jul 10 04:32:50 2008 -0700
142.3 @@ -0,0 +1,103 @@
142.4 +/*
142.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
142.6 + *
142.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
142.8 + *
142.9 + * The contents of this file are subject to the terms of either the GNU
142.10 + * General Public License Version 2 only ("GPL") or the Common
142.11 + * Development and Distribution License("CDDL") (collectively, the
142.12 + * "License"). You may not use this file except in compliance with the
142.13 + * License. You can obtain a copy of the License at
142.14 + * http://www.netbeans.org/cddl-gplv2.html
142.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
142.16 + * specific language governing permissions and limitations under the
142.17 + * License. When distributing the software, include this License Header
142.18 + * Notice in each file and include the License file at
142.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
142.20 + * particular file as subject to the "Classpath" exception as provided
142.21 + * by Sun in the GPL Version 2 section of the License file that
142.22 + * accompanied this code. If applicable, add the following below the
142.23 + * License Header, with the fields enclosed by brackets [] replaced by
142.24 + * your own identifying information:
142.25 + * "Portions Copyrighted [year] [name of copyright owner]"
142.26 + *
142.27 + * Contributor(s):
142.28 + *
142.29 + * The Original Software is NetBeans. The Initial Developer of the Original
142.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
142.31 + * Microsystems, Inc. All Rights Reserved.
142.32 + *
142.33 + * If you wish your version of this file to be governed by only the CDDL
142.34 + * or only the GPL Version 2, indicate your decision by adding
142.35 + * "[Contributor] elects to include this software in this distribution
142.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
142.37 + * single choice of license, a recipient has the option to distribute
142.38 + * your version of this file under either the CDDL, the GPL Version 2 or
142.39 + * to extend the choice of license to its licensees as provided above.
142.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
142.41 + * Version 2 license, then the option applies only if the new code is
142.42 + * made subject to such option by the copyright holder.
142.43 + */
142.44 +
142.45 +package org.netbeans.modules.visualweb.gravy.properties;
142.46 +
142.47 +import org.netbeans.jemmy.JemmyException;
142.48 +import org.netbeans.jemmy.operators.ContainerOperator;
142.49 +import org.netbeans.jemmy.operators.JComboBoxOperator;
142.50 +
142.51 +/**
142.52 + * Can be used to set all properties which use JComboBox to change value.
142.53 + * <p>
142.54 + * Usage:<br>
142.55 + * <pre>
142.56 + * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
142.57 + * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Properties");
142.58 + * ComboBoxProperty pr = new ComboBoxProperty(psto, "Template");
142.59 + * pr.setValue("True");
142.60 + * pr.setValue(1);
142.61 + * </pre>
142.62 + *
142.63 + * @deprecated Use {@link Property} instead
142.64 + */
142.65 +public class ComboBoxProperty extends Property {
142.66 +
142.67 + /** Waits for property with given name in specified container.
142.68 + * @param contOper ContainerOperator where to find property. It is
142.69 + * recommended to use {@link PropertySheetTabOperator}.
142.70 + * @param name property name
142.71 + * @deprecated Use {@link Property} instead
142.72 + */
142.73 + public ComboBoxProperty(ContainerOperator contOper, String name) {
142.74 + super(contOper, name);
142.75 + }
142.76 +
142.77 + /** Starts editing the property and waits for JComboBox
142.78 + * @return JComboBoxOperator of property combo box
142.79 + * @deprecated Use {@link #setValue} to change property value
142.80 + */
142.81 + public JComboBoxOperator comboBox() {
142.82 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
142.83 + /*
142.84 + startEditing();
142.85 + return new JComboBoxOperator(contOper);
142.86 + */
142.87 + }
142.88 +
142.89 + /** Sets value of the property. It makes property editable, finds
142.90 + * JComboBox and selects specified item.
142.91 + * @param value item to be selected
142.92 + */
142.93 + /*public void setValue(String value) {
142.94 + JComboBoxOperator comboOper = comboBox();
142.95 + comboOper.setSelectedItem(value);
142.96 + }*/
142.97 +
142.98 + /** Sets value of the property. It makes property editable, finds
142.99 + * JComboBox and selects index-th item.
142.100 + * @param index index of item to be selected (Start at 0)
142.101 + */
142.102 + /*public void setValue(int index) {
142.103 + JComboBoxOperator comboOper = comboBox();
142.104 + comboOper.setSelectedIndex(index);
142.105 + }*/
142.106 +}
143.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
143.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/DebugReaderWriter.java Thu Jul 10 04:32:50 2008 -0700
143.3 @@ -0,0 +1,102 @@
143.4 +/*
143.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
143.6 + *
143.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
143.8 + *
143.9 + * The contents of this file are subject to the terms of either the GNU
143.10 + * General Public License Version 2 only ("GPL") or the Common
143.11 + * Development and Distribution License("CDDL") (collectively, the
143.12 + * "License"). You may not use this file except in compliance with the
143.13 + * License. You can obtain a copy of the License at
143.14 + * http://www.netbeans.org/cddl-gplv2.html
143.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
143.16 + * specific language governing permissions and limitations under the
143.17 + * License. When distributing the software, include this License Header
143.18 + * Notice in each file and include the License file at
143.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
143.20 + * particular file as subject to the "Classpath" exception as provided
143.21 + * by Sun in the GPL Version 2 section of the License file that
143.22 + * accompanied this code. If applicable, add the following below the
143.23 + * License Header, with the fields enclosed by brackets [] replaced by
143.24 + * your own identifying information:
143.25 + * "Portions Copyrighted [year] [name of copyright owner]"
143.26 + *
143.27 + * Contributor(s):
143.28 + *
143.29 + * The Original Software is NetBeans. The Initial Developer of the Original
143.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
143.31 + * Microsystems, Inc. All Rights Reserved.
143.32 + *
143.33 + * If you wish your version of this file to be governed by only the CDDL
143.34 + * or only the GPL Version 2, indicate your decision by adding
143.35 + * "[Contributor] elects to include this software in this distribution
143.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
143.37 + * single choice of license, a recipient has the option to distribute
143.38 + * your version of this file under either the CDDL, the GPL Version 2 or
143.39 + * to extend the choice of license to its licensees as provided above.
143.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
143.41 + * Version 2 license, then the option applies only if the new code is
143.42 + * made subject to such option by the copyright holder.
143.43 + */
143.44 +
143.45 +package org.netbeans.modules.visualweb.gravy.properties;
143.46 +
143.47 +import java.io.OutputStreamWriter;
143.48 +import java.io.FileWriter;
143.49 +import java.io.IOException;
143.50 +
143.51 +/**
143.52 + * DebugReaderWriter class
143.53 + * <p>
143.54 + *
143.55 + */
143.56 +
143.57 +public class DebugReaderWriter implements PropertyReaderWriter {
143.58 + private OutputStreamWriter osw = null;
143.59 + private String elementName = null;
143.60 +
143.61 + /**
143.62 + * Create DebugReaderWriter for output to specified file.
143.63 + * @param elementName Name of the element what DebugReaderWriter is created for.
143.64 + * @param filename Name of the file for output.
143.65 + */
143.66 + public DebugReaderWriter(String elementName, String filename) throws IOException {
143.67 + this(elementName, new FileWriter(filename));
143.68 + }
143.69 +
143.70 + /**
143.71 + * Create DebugReaderWriter for output to specified OutputStreamWriter.
143.72 + * @param elementName Name of the element what DebugReaderWriter is created for.
143.73 + * @param osw OutputStreamWriter for output.
143.74 + */
143.75 + public DebugReaderWriter(String elementName, OutputStreamWriter osw) {
143.76 + this.elementName = elementName;
143.77 + this.osw = osw;
143.78 + }
143.79 +
143.80 + /**
143.81 + * Write debugging information that given value for given property was set for element.
143.82 + */
143.83 + public void setPropertyValue(String name, Object value) {
143.84 + try {
143.85 + osw.write("setPropertyValue: Element name = "+elementName+", Property name = "+name+", PropertyValue = "+value+"\n");
143.86 + } catch (IOException e) {
143.87 + }
143.88 + }
143.89 +
143.90 + /**
143.91 + * Write debugging information that given value for given property was get from element.
143.92 + */
143.93 + public Object getPropertyValue(String name) {
143.94 + try {
143.95 + osw.write("getPropertyValue: Element name = "+elementName+", Property name = "+name+"\n");
143.96 + } catch (IOException e) {
143.97 + }
143.98 +
143.99 + return null;
143.100 + }
143.101 +
143.102 + public String getName() {
143.103 + return "DebugReaderWriter";
143.104 + }
143.105 +}
144.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
144.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/Property.java Thu Jul 10 04:32:50 2008 -0700
144.3 @@ -0,0 +1,559 @@
144.4 +/*
144.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
144.6 + *
144.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
144.8 + *
144.9 + * The contents of this file are subject to the terms of either the GNU
144.10 + * General Public License Version 2 only ("GPL") or the Common
144.11 + * Development and Distribution License("CDDL") (collectively, the
144.12 + * "License"). You may not use this file except in compliance with the
144.13 + * License. You can obtain a copy of the License at
144.14 + * http://www.netbeans.org/cddl-gplv2.html
144.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
144.16 + * specific language governing permissions and limitations under the
144.17 + * License. When distributing the software, include this License Header
144.18 + * Notice in each file and include the License file at
144.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
144.20 + * particular file as subject to the "Classpath" exception as provided
144.21 + * by Sun in the GPL Version 2 section of the License file that
144.22 + * accompanied this code. If applicable, add the following below the
144.23 + * License Header, with the fields enclosed by brackets [] replaced by
144.24 + * your own identifying information:
144.25 + * "Portions Copyrighted [year] [name of copyright owner]"
144.26 + *
144.27 + * Contributor(s):
144.28 + *
144.29 + * The Original Software is NetBeans. The Initial Developer of the Original
144.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
144.31 + * Microsystems, Inc. All Rights Reserved.
144.32 + *
144.33 + * If you wish your version of this file to be governed by only the CDDL
144.34 + * or only the GPL Version 2, indicate your decision by adding
144.35 + * "[Contributor] elects to include this software in this distribution
144.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
144.37 + * single choice of license, a recipient has the option to distribute
144.38 + * your version of this file under either the CDDL, the GPL Version 2 or
144.39 + * to extend the choice of license to its licensees as provided above.
144.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
144.41 + * Version 2 license, then the option applies only if the new code is
144.42 + * made subject to such option by the copyright holder.
144.43 + */
144.44 +
144.45 +package org.netbeans.modules.visualweb.gravy.properties;
144.46 +
144.47 +import java.awt.Component;
144.48 +import java.awt.event.ActionEvent;
144.49 +import java.beans.PropertyEditor;
144.50 +import java.lang.reflect.InvocationTargetException;
144.51 +import java.lang.reflect.Method;
144.52 +import javax.swing.Action;
144.53 +import javax.swing.JComponent;
144.54 +import javax.swing.JTable;
144.55 +import javax.swing.table.TableCellRenderer;
144.56 +import org.netbeans.jemmy.JemmyException;
144.57 +import org.netbeans.jemmy.JemmyProperties;
144.58 +import org.netbeans.jemmy.Waitable;
144.59 +import org.netbeans.jemmy.Waiter;
144.60 +import org.netbeans.jemmy.operators.ContainerOperator;
144.61 +import org.netbeans.jemmy.operators.JTableOperator;
144.62 +import org.netbeans.jemmy.operators.JTextFieldOperator;
144.63 +import org.openide.ErrorManager;
144.64 +import org.openide.nodes.Node;
144.65 +
144.66 +/**
144.67 + * Handles properties in IDE property sheets. Properties are grouped in
144.68 + * property sheet. Their are identified by their display names. Once you
144.69 + * have created a Property instance you can get value, set a new text value,
144.70 + * set a new value by index of possible options or open custom editor.
144.71 + * <p>
144.72 + * Usage:<br>
144.73 + * <pre>
144.74 + PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
144.75 + Property p = new Property(pso, "Name");
144.76 + System.out.println("\nProperty name="+p.getName());
144.77 + System.out.println("\nProperty value="+p.getValue());
144.78 + p.setValue("ANewValue");
144.79 + // set a new value by index where it is applicable
144.80 + //p.setValue(2);
144.81 + // open custom editor where it is applicable
144.82 + //p.openEditor();
144.83 + * </pre>
144.84 + *
144.85 + * @see PropertySheetOperator
144.86 + */
144.87 +public class Property {
144.88 +
144.89 + // DEPRECATED>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
144.90 + /** Container to find property in */
144.91 + protected ContainerOperator contOper;
144.92 + /** Display name of the property */
144.93 + private String name;
144.94 + /** Operator of name button */
144.95 + private SheetButtonOperator nameButtonOperator;
144.96 + /** Operator of value button */
144.97 + private SheetButtonOperator valueButtonOperator;
144.98 + // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<DEPRECATED
144.99 +
144.100 + /** Class name of string renderer. */
144.101 + public static final String STRING_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$StringRenderer"; // NOI18N
144.102 + /** Class name of check box renderer. */
144.103 + public static final String CHECKBOX_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$CheckboxRenderer"; // NOI18N
144.104 + /** Class name of combo box renderer. */
144.105 + public static final String COMBOBOX_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$ComboboxRenderer"; // NOI18N
144.106 + /** Class name of radio button renderer. */
144.107 + public static final String RADIOBUTTON_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$RadioButtonRenderer"; // NOI18N
144.108 + /** Class name of set renderer. */
144.109 + public static final String SET_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$SetRenderer"; // NOI18N
144.110 +
144.111 + /** Instance of Node.Property. */
144.112 + protected Node.Property property;
144.113 + /** Property sheet where this property resides. */
144.114 + protected PropertySheetOperator propertySheetOper;
144.115 +
144.116 + /** Waits for property with given name in specified property sheet.
144.117 + * @param propertySheetOper PropertySheetOperator where to find property.
144.118 + * @param name property display name
144.119 + */
144.120 + public Property(PropertySheetOperator propertySheetOper, String name) {
144.121 + this.propertySheetOper = propertySheetOper;
144.122 + this.property = waitProperty(propertySheetOper, name);
144.123 + }
144.124 +
144.125 + /** Waits for index-th property in specified property sheet.
144.126 + * @param propertySheetOper PropertySheetOperator where to find property.
144.127 + * @param index index (row number) of property inside property sheet
144.128 + * (starts at 0). If there categories shown in property sheet,
144.129 + * rows occupied by their names must by added to index.
144.130 + */
144.131 + public Property(PropertySheetOperator propertySheetOper, int index) {
144.132 + this.propertySheetOper = propertySheetOper;
144.133 + this.property = waitProperty(propertySheetOper, index);
144.134 + }
144.135 +
144.136 + /** Waits for property with given name in specified container.
144.137 + * @param contOper ContainerOperator where to find property. It is
144.138 + * recommended to use {@link PropertySheetOperator}.
144.139 + * @param name property name
144.140 + * @deprecated Use {@link #Property(PropertySheetOperator, String)} instead
144.141 + */
144.142 + public Property(ContainerOperator contOper, String name) {
144.143 + this(new PropertySheetOperator(contOper), name);
144.144 + /*
144.145 + this.contOper = contOper;
144.146 + this.name = name;
144.147 + this.name = nameButtonOperator().getLabel();
144.148 + */
144.149 + }
144.150 +
144.151 + /** Waits for index-th property in specified container.
144.152 + * @param contOper ContainerOperator whete to find property. It is
144.153 + * recommended to use {@link PropertySheetOperator}.
144.154 + * @param index index (row number) of property inside property sheet
144.155 + * (starts at 0)
144.156 + * @deprecated Use {@link #Property(PropertySheetOperator, int)} instead
144.157 + */
144.158 + public Property(ContainerOperator contOper, int index) {
144.159 + this(new PropertySheetOperator(contOper), index);
144.160 + }
144.161 +
144.162 + /** Waits for property with given name in specified property sheet.
144.163 + * @param propSheetOper PropertySheetOperator where to find property.
144.164 + * @param name property display name
144.165 + */
144.166 + private Node.Property waitProperty(final PropertySheetOperator propSheetOper, final String name) {
144.167 + try {
144.168 + Waiter waiter = new Waiter(new Waitable() {
144.169 + public Object actionProduced(Object param) {
144.170 + Node.Property property = null;
144.171 + JTableOperator table = propSheetOper.tblSheet();
144.172 + for(int row=0;row<table.getRowCount();row++) {
144.173 + if(table.getValueAt(row, 1) instanceof Node.Property) {
144.174 + property = (Node.Property)table.getValueAt(row, 1);
144.175 + if(propSheetOper.getComparator().equals(property.getDisplayName(), name)) {
144.176 + return property;
144.177 + }
144.178 + }
144.179 + }
144.180 + return null;
144.181 + }
144.182 + public String getDescription() {
144.183 + return("Wait property "+name);
144.184 + }
144.185 + });
144.186 + return (Node.Property)waiter.waitAction(null);
144.187 + } catch (InterruptedException e) {
144.188 + throw new JemmyException("Interrupted.", e);
144.189 + }
144.190 + }
144.191 +
144.192 + /** Waits for index-th property in specified property sheet.
144.193 + * @param propSheetOper PropertySheetOperator where to find property.
144.194 + * @param index index (row number) of property inside property sheet
144.195 + * (starts at 0). If there are categories shown in property sheet,
144.196 + * rows occupied by their names must by added to index.
144.197 + */
144.198 + private Node.Property waitProperty(final PropertySheetOperator propSheetOper, final int index) {
144.199 + try {
144.200 + Waiter waiter = new Waiter(new Waitable() {
144.201 + public Object actionProduced(Object param) {
144.202 + JTableOperator table = propSheetOper.tblSheet();
144.203 + if(table.getRowCount() <= index) {
144.204 + // If table is empty or index out of bounds,
144.205 + // it returns null to wait until table is populated by values
144.206 + return null;
144.207 + }
144.208 + Object property = table.getValueAt(index, 1);
144.209 + if(property instanceof Node.Property) {
144.210 + return (Node.Property)property;
144.211 + } else {
144.212 + throw new JemmyException("On row "+index+" in table there is no property");
144.213 + }
144.214 + }
144.215 + public String getDescription() {
144.216 + return("Wait property on row "+index+" in property sheet.");
144.217 + }
144.218 + });
144.219 + //waiter.setOutput(TestOut.getNullOutput());
144.220 + return (Node.Property)waiter.waitAction(null);
144.221 + } catch (InterruptedException e) {
144.222 + throw new JemmyException("Interrupted.", e);
144.223 + }
144.224 + }
144.225 +
144.226 + /** Gets SheetButtonOperator instance of property's name button. It returns
144.227 + * valid button even if properties were reordered.
144.228 + * @return SheetButtonOperator instance of name button
144.229 + * @deprecated JTable used for property sheet instead of SheetButtons
144.230 + */
144.231 + public SheetButtonOperator nameButtonOperator() {
144.232 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
144.233 + //return null;
144.234 + /*
144.235 + if(nameButtonOperator != null) {
144.236 + if(!nameButtonOperator.isValid()) {
144.237 + nameButtonOperator = null;
144.238 + }
144.239 + }
144.240 + if(nameButtonOperator == null) {
144.241 + nameButtonOperator = SheetButtonOperator.nameButton(contOper, name);
144.242 + }
144.243 + return nameButtonOperator;
144.244 + */
144.245 + }
144.246 +
144.247 + /** Gets SheetButtonOperator instance of property's value button. It returns
144.248 + * valid button even if properties were reordered.
144.249 + * @return SheetButtonOperator instance of value button
144.250 + * @deprecated JTable used for property sheet instead of SheetButtons
144.251 + */
144.252 + public SheetButtonOperator valueButtonOperator() {
144.253 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
144.254 + /*
144.255 + if(valueButtonOperator != null) {
144.256 + if(!valueButtonOperator.isValid()) {
144.257 + valueButtonOperator = null;
144.258 + }
144.259 + }
144.260 + if(valueButtonOperator == null) {
144.261 + // Button can be changed (reordered, changed value, etc.).
144.262 + // We need to call nameButtonOperator().getNameButtonIndex()
144.263 + // to find valid name button for this property.
144.264 + valueButtonOperator = SheetButtonOperator.valueButton(contOper,
144.265 + nameButtonOperator().getNameButtonIndex());
144.266 + }
144.267 + return valueButtonOperator;
144.268 + */
144.269 + }
144.270 +
144.271 + /** Gets display name of this property.
144.272 + * It can differ from name given in constructor when only
144.273 + * substring of property name is used there.
144.274 + * @return display name of property
144.275 + */
144.276 + public String getName() {
144.277 + return property.getDisplayName();
144.278 + }
144.279 +
144.280 + /** Gets string representation of property value.
144.281 + * @return value of property
144.282 + */
144.283 + public String getValue() {
144.284 + PropertyEditor pe = property.getPropertyEditor();
144.285 + try {
144.286 + if(property.getValue() != pe.getValue()) {
144.287 + // Need to synchronize property and its property editor.
144.288 + // Otherwise it may cause problem when called pe.getAsText().
144.289 + pe.setValue(property.getValue());
144.290 + }
144.291 + } catch (Exception e) {
144.292 + throw new JemmyException("Exception while synchronizing value of property and property editor - property.getValue() != pe.getValue()", e);
144.293 + }
144.294 + return pe.getAsText();
144.295 + }
144.296 +
144.297 + /** Sets value of this property to specified text. If a new value is
144.298 + * not accepted, an information or error dialog is displayed by IDE.
144.299 + * If property is not writable JemmyException is thrown.
144.300 + * @param textValue text to be set in property (e.g. "a new value",
144.301 + * "a new item from list", "false", "TRUE")
144.302 + */
144.303 + public void setValue(String textValue) {
144.304 + propertySheetOper.getOutput().printTrace("Setting value \""+textValue+
144.305 + "\" of property \""+getName()+"\".");
144.306 + if(!isEnabled()) {
144.307 + throw new JemmyException("Property \""+getName()+"\" is read only.");
144.308 + }
144.309 + PropertyEditor pe = property.getPropertyEditor();
144.310 + try {
144.311 + if(property.getValue() != pe.getValue()) {
144.312 + // Need to synchronize property and its property editor.
144.313 + // Otherwise it may cause IAE when called pe.setAsText(textValue).
144.314 + pe.setValue(property.getValue());
144.315 + }
144.316 + } catch (Exception e) {
144.317 + throw new JemmyException("Exception while synchronizing value of property and property editor - property.getValue() != pe.getValue()", e);
144.318 + }
144.319 + try {
144.320 + JemmyProperties.getCurrentOutput().printTrace("Setting property \""+getName()+"\" to value \""+textValue+"\".");
144.321 + pe.setAsText(textValue);
144.322 + property.setValue(pe.getValue());
144.323 + } catch (IllegalAccessException iae) {
144.324 + ErrorManager.getDefault().notify(iae);
144.325 + } catch (IllegalArgumentException iare) {
144.326 + ErrorManager.getDefault().notify(iare);
144.327 + } catch (InvocationTargetException ite) {
144.328 + ErrorManager.getDefault().notify(ite);
144.329 + } catch (Exception e) {
144.330 + throw new JemmyException("Exception while setting value of property.", e);
144.331 + }
144.332 + }
144.333 +
144.334 + /** Sets value of this property by given index.
144.335 + * It is applicable for properties which can be changed by combo box.
144.336 + * If property doesn't support changing value by index JemmyException
144.337 + * is thrown.
144.338 + * @param index index of item to be selected from possible options
144.339 + */
144.340 + public void setValue(int index) {
144.341 + PropertyEditor pe = property.getPropertyEditor();
144.342 + String[] tags = pe.getTags();
144.343 + if(tags != null) {
144.344 + setValue(tags[index]);
144.345 + } else {
144.346 + throw new JemmyException("Property doesn't support changing value by index.");
144.347 + }
144.348 + }
144.349 +
144.350 + /** Returns true if this property is in editable state (it is being edited).
144.351 + * It is detected by presence of PropertySheetButton which stands
144.352 + * for property value in non editable state.
144.353 + * @return true - this property is being edited; false otherwise
144.354 + * @deprecated Use {@link #setValue} to change property value
144.355 + */
144.356 + public boolean isEditable() {
144.357 + throw new JemmyException("Don't use this! Use setValue() to change property value.");
144.358 + /*
144.359 + // wait for name button index-th PropertyPanel
144.360 + Component propertyPanel = SheetButtonOperator.waitPropertyPanel(contOper,
144.361 + nameButtonOperator().getNameButtonIndex());
144.362 + ComponentChooser chooser = new ComponentChooser() {
144.363 + public boolean checkComponent(Component comp) {
144.364 + return comp.getClass().getName().indexOf("PropertySheetButton") != -1;
144.365 + }
144.366 +
144.367 + public String getDescription() {
144.368 + return "PropertySheetButton";
144.369 + }
144.370 + };
144.371 + // if PropertySheetButton not found, property is editable
144.372 + return contOper.findComponent((Container)propertyPanel, chooser) == null;
144.373 + */
144.374 + }
144.375 +
144.376 + /** If this property is not editable, it scrolls to property and clicks
144.377 + * on name button. Otherwise does nothing.
144.378 + * @deprecated Use {@link #setValue} to change property value
144.379 + */
144.380 + public void startEditing() {
144.381 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
144.382 + /*
144.383 + if(!isEditable()) {
144.384 + nameButtonOperator().push();
144.385 + }
144.386 + */
144.387 + }
144.388 +
144.389 + /** If this property is editable, it scrolls to property if needed and
144.390 + * clicks on name button. It cancels editing and sets original value back.
144.391 + * @deprecated Use {@link #setValue} to change property value
144.392 + */
144.393 + public void stopEditing() {
144.394 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
144.395 + /*
144.396 + if(isEditable()) {
144.397 + nameButtonOperator().push();
144.398 + }
144.399 + */
144.400 + }
144.401 +
144.402 +
144.403 + /** Opens custom property editor for the property by click on "..." button.
144.404 + * It checks whether this property supports custom editor by method
144.405 + * {@link #supportsCustomEditor}.
144.406 + */
144.407 + public void openEditor() {
144.408 + if(supportsCustomEditor()) {
144.409 + final JTableOperator table = this.propertySheetOper.tblSheet();
144.410 + for(int row=0;row<table.getRowCount();row++) {
144.411 + if(table.getValueAt(row, 1) instanceof Node.Property) {
144.412 + if(this.property == (Node.Property)table.getValueAt(row, 1)) {
144.413 + // Need to request focus before selection because invokeCustomEditor action works
144.414 + // only when table is focused
144.415 + /* mdk
144.416 + table.makeComponentVisible();
144.417 + table.requestFocus();
144.418 + table.waitHasFocus();
144.419 + */
144.420 + // need to select property first
144.421 + ((javax.swing.JTable)table.getSource()).changeSelection(row, 0, false, false);
144.422 + // find action
144.423 + final Action customEditorAction = ((JComponent)table.getSource()).getActionMap().get("invokeCustomEditor"); // NOI18N
144.424 + // run action in a separate thread (no block)
144.425 + new Thread(new Runnable() {
144.426 + public void run() {
144.427 + customEditorAction.actionPerformed(new ActionEvent(table.getSource(), 0, null));
144.428 + }
144.429 + }, "Thread to open custom editor no block").start(); // NOI18N
144.430 + return;
144.431 + }
144.432 + }
144.433 + }
144.434 + }
144.435 + }
144.436 +
144.437 + /** Checks whether this property supports custom editor.
144.438 + * @return true is property supports custom editor, false otherwise
144.439 + */
144.440 + public boolean supportsCustomEditor() {
144.441 + return this.property.getPropertyEditor().supportsCustomEditor();
144.442 + }
144.443 +
144.444 + /** Sets default value for this property. If default value is not available,
144.445 + * it does nothing.
144.446 + */
144.447 + public void setDefaultValue() {
144.448 + try {
144.449 + property.restoreDefaultValue();
144.450 + } catch (Exception e) {
144.451 + throw new JemmyException("Exception while restoring default value.", e);
144.452 + }
144.453 + }
144.454 +
144.455 + /** Returns true if this property is enabled in property sheet, that means
144.456 + * it is possible to change its value by inplace editor.
144.457 + * @return true if this property is enabled, false otherwise
144.458 + */
144.459 + public boolean isEnabled() {
144.460 + return property.canWrite();
144.461 + }
144.462 +
144.463 + /** Returns true if this property can be edited as text by inplace text field.
144.464 + * It can be both for string renderer or combo box renderer.
144.465 + * @return true if this property can be edited, false otherwise
144.466 + */
144.467 + public boolean canEditAsText() {
144.468 + // if not enabled, it cannot be edited
144.469 + if(!isEnabled()) {
144.470 + return false;
144.471 + }
144.472 + final JTableOperator table = propertySheetOper.tblSheet();
144.473 + for(int row=0;row<table.getRowCount();row++) {
144.474 + if(table.getValueAt(row, 1) instanceof Node.Property) {
144.475 + if(property == (Node.Property)table.getValueAt(row, 1)) {
144.476 + table.clickForEdit(row, 1);
144.477 + long oldTimeout = propertySheetOper.getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
144.478 + propertySheetOper.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 1000);
144.479 + try {
144.480 + new JTextFieldOperator(propertySheetOper);
144.481 + return true;
144.482 + } catch (JemmyException e) {
144.483 + // property cannot be edited as text by inplace editor
144.484 + return false;
144.485 + } finally {
144.486 + // push ESC to stop editing
144.487 + table.pushKey(java.awt.event.KeyEvent.VK_ESCAPE);
144.488 + // reset timeout
144.489 + propertySheetOper.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", oldTimeout);
144.490 + }
144.491 + }
144.492 + }
144.493 + }
144.494 + // never should happen
144.495 + throw new JemmyException("Property "+getName()+" not found in this sheet:\n"+propertySheetOper.getSource().toString());
144.496 + }
144.497 +
144.498 + /** Returns class name of renderer used to render this property. It can
144.499 + * be used to determine whether correct renderer is used. Possible values
144.500 + * are defined in constants {@link #STRING_RENDERER}, {@link #CHECKBOX_RENDERER},
144.501 + * {@link #COMBOBOX_RENDERER}, {@link #RADIOBUTTON_RENDERER}, {@link #SET_RENDERER}.
144.502 + * @return class name of renderer used to render this property:
144.503 + * <UL>
144.504 + * <LI>org.openide.explorer.propertysheet.RendererFactory$StringRenderer</LI>
144.505 + * <LI>org.openide.explorer.propertysheet.RendererFactory$CheckboxRenderer</LI>
144.506 + * <LI>org.openide.explorer.propertysheet.RendererFactory$ComboboxRenderer</LI>
144.507 + * <LI>org.openide.explorer.propertysheet.RendererFactory$RadioButtonRenderer</LI>
144.508 + * <LI>org.openide.explorer.propertysheet.RendererFactory$SetRenderer</LI>
144.509 + * </UL>
144.510 + * @see #STRING_RENDERER
144.511 + * @see #CHECKBOX_RENDERER
144.512 + * @see #COMBOBOX_RENDERER
144.513 + * @see #RADIOBUTTON_RENDERER
144.514 + * @see #SET_RENDERER
144.515 + */
144.516 + public String getRendererName() {
144.517 + return getRenderer().getClass().getName();
144.518 + }
144.519 +
144.520 + /** Returns component which represents renderer for this property. */
144.521 + private Component getRenderer() {
144.522 + final JTableOperator table = propertySheetOper.tblSheet();
144.523 + for(int row=0;row<table.getRowCount();row++) {
144.524 + if(table.getValueAt(row, 1) instanceof Node.Property) {
144.525 + if(property == (Node.Property)table.getValueAt(row, 1)) {
144.526 + // gets component used to render a value
144.527 + TableCellRenderer renderer = table.getCellRenderer(row,1);
144.528 + Component comp = renderer.getTableCellRendererComponent(
144.529 + (JTable)table.getSource(),
144.530 + table.getValueAt(row, 1),
144.531 + false,
144.532 + false,
144.533 + row,
144.534 + 1
144.535 + );
144.536 + // We need to find a real renderer because it can be embedded
144.537 + // in ButtonPanel (supplies custom editor button "...")
144.538 + // or IconPanel(supplies property marking).
144.539 + try {
144.540 + Class clazz = Class.forName("org.openide.explorer.propertysheet.RendererPropertyDisplayer");
144.541 + Method findInnermostRendererMethod = clazz.getDeclaredMethod("findInnermostRenderer", new Class[] {JComponent.class});
144.542 + findInnermostRendererMethod.setAccessible(true);
144.543 + comp = (Component)findInnermostRendererMethod.invoke(null, new Object[] {comp});
144.544 + } catch (Exception e) {
144.545 + throw new JemmyException("RendererPropertyDisplayer.findInnermostRenderer() by reflection failed.", e);
144.546 + }
144.547 + return comp;
144.548 + }
144.549 + }
144.550 + }
144.551 + // never should happen
144.552 + throw new JemmyException("Property "+getName()+" not found in this sheet:\n"+propertySheetOper.getSource().toString());
144.553 + }
144.554 +
144.555 + /** Gets short description for this property. Short description is also
144.556 + * used in tooltip.
144.557 + * @return short description for this property.
144.558 + */
144.559 + public String getShortDescription() {
144.560 + return this.property.getShortDescription();
144.561 + }
144.562 +}
145.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
145.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertyFactory.java Thu Jul 10 04:32:50 2008 -0700
145.3 @@ -0,0 +1,187 @@
145.4 +/*
145.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
145.6 + *
145.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
145.8 + *
145.9 + * The contents of this file are subject to the terms of either the GNU
145.10 + * General Public License Version 2 only ("GPL") or the Common
145.11 + * Development and Distribution License("CDDL") (collectively, the
145.12 + * "License"). You may not use this file except in compliance with the
145.13 + * License. You can obtain a copy of the License at
145.14 + * http://www.netbeans.org/cddl-gplv2.html
145.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
145.16 + * specific language governing permissions and limitations under the
145.17 + * License. When distributing the software, include this License Header
145.18 + * Notice in each file and include the License file at
145.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
145.20 + * particular file as subject to the "Classpath" exception as provided
145.21 + * by Sun in the GPL Version 2 section of the License file that
145.22 + * accompanied this code. If applicable, add the following below the
145.23 + * License Header, with the fields enclosed by brackets [] replaced by
145.24 + * your own identifying information:
145.25 + * "Portions Copyrighted [year] [name of copyright owner]"
145.26 + *
145.27 + * Contributor(s):
145.28 + *
145.29 + * The Original Software is NetBeans. The Initial Developer of the Original
145.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
145.31 + * Microsystems, Inc. All Rights Reserved.
145.32 + *
145.33 + * If you wish your version of this file to be governed by only the CDDL
145.34 + * or only the GPL Version 2, indicate your decision by adding
145.35 + * "[Contributor] elects to include this software in this distribution
145.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
145.37 + * single choice of license, a recipient has the option to distribute
145.38 + * your version of this file under either the CDDL, the GPL Version 2 or
145.39 + * to extend the choice of license to its licensees as provided above.
145.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
145.41 + * Version 2 license, then the option applies only if the new code is
145.42 + * made subject to such option by the copyright holder.
145.43 + */
145.44 +
145.45 +package org.netbeans.modules.visualweb.gravy.properties;
145.46 +
145.47 +import java.io.IOException;
145.48 +
145.49 +import java.util.Hashtable;
145.50 +
145.51 +/**
145.52 + * PropertyFactory class
145.53 + * <p>
145.54 + *
145.55 + *
145.56 + */
145.57 +
145.58 +public class PropertyFactory {
145.59 +
145.60 + // Debug info reader/writer
145.61 + private PropertyReaderWriter debugrw = null;
145.62 +
145.63 + // Element name
145.64 + private String elementName;
145.65 +
145.66 + // Property readers array
145.67 + private PropertyReader preaders[] = null;
145.68 +
145.69 + // Property writers array
145.70 + private PropertyReaderWriter pwriters[] = null;
145.71 +
145.72 + // Property readers hashtable
145.73 + private Hashtable prhash = new Hashtable();
145.74 +
145.75 + // Property writers hashtable
145.76 + private Hashtable prwhash = new Hashtable();
145.77 +
145.78 + /**
145.79 + * Constructs PropertyFactory object
145.80 + *
145.81 + * @param elementName name of component
145.82 + */
145.83 + public PropertyFactory(String elementName) {
145.84 + this.elementName = elementName;
145.85 + initialize();
145.86 + }
145.87 +
145.88 + protected void initialize() {
145.89 + // Creates arrays of Readers and ReadersWriters
145.90 + preaders = new PropertyReader[1];
145.91 + pwriters = new PropertyReaderWriter[1];
145.92 +
145.93 + preaders[0] = pwriters[0] = new PropertySheetReaderWriter();
145.94 +
145.95 +
145.96 + // Creates hashtables using arrays of Readers and ReadersWriters
145.97 + for (int i = 0; i < getReadersNum(); i++) {
145.98 + prhash.put(preaders[i].getName(), preaders[i]);
145.99 + }
145.100 + for (int i = 0; i < getWritersNum(); i++) {
145.101 + prwhash.put(pwriters[i].getName(), pwriters[i]);
145.102 + }
145.103 +
145.104 + // Insert debugging enable/disable code
145.105 + if (false) {
145.106 + try {
145.107 + debugrw = new DebugReaderWriter(elementName, "c:/temp/testdebug.out");
145.108 + } catch (IOException e) {
145.109 + throw new RuntimeException(e);
145.110 + }
145.111 + }
145.112 + }
145.113 +
145.114 + /**
145.115 + * Return number of available PropertyReaders
145.116 + *
145.117 + * @return number of readers
145.118 + */
145.119 + public int getReadersNum() {
145.120 + return (preaders == null)?0:preaders.length;
145.121 + }
145.122 +
145.123 + /**
145.124 + * Return number of available PropertyReaderWriters
145.125 + *
145.126 + * @return number of writers
145.127 + */
145.128 + public int getWritersNum() {
145.129 + return (pwriters == null)?0:pwriters.length;
145.130 + }
145.131 +
145.132 + /**
145.133 + * Set property value by specified writer
145.134 + *
145.135 + * @param writer writer index
145.136 + * @param name property name
145.137 + * @param value property value to set
145.138 + */
145.139 + public void setValue(int writer, String name, Object value) {
145.140 + if (writer < 0 || writer >= getWritersNum())
145.141 + throw new ArrayIndexOutOfBoundsException(writer);
145.142 + pwriters[writer].setPropertyValue(name, value);
145.143 + if (debugrw != null)
145.144 + debugrw.setPropertyValue(name, value);
145.145 + }
145.146 +
145.147 + /**
145.148 + * Get property value by specified reader
145.149 + *
145.150 + * @param reader reader index
145.151 + * @param name property name
145.152 + * @return property value
145.153 + */
145.154 + public Object getValue(int reader, String name) {
145.155 + if (reader < 0 || reader >= getReadersNum())
145.156 + throw new ArrayIndexOutOfBoundsException(reader);
145.157 + if (debugrw != null)
145.158 + debugrw.getPropertyValue(name);
145.159 + return preaders[reader].getPropertyValue(name);
145.160 + }
145.161 + /**
145.162 + * Set property value by specified writer
145.163 + *
145.164 + * @param writer writer name
145.165 + * @param name property name
145.166 + * @param value property value to set
145.167 + */
145.168 + public void setValue(String writer, String name, Object value) {
145.169 + if (!prwhash.containsKey(writer))
145.170 + throw new IllegalArgumentException("There is no PropertyReaderWriter with name "+writer);
145.171 + ((PropertyReaderWriter)prwhash.get(writer)).setPropertyValue(name, value);
145.172 + if (debugrw != null)
145.173 + debugrw.setPropertyValue(name, value);
145.174 + }
145.175 +
145.176 + /**
145.177 + * Get property value by specified reader
145.178 + *
145.179 + * @param reader reader name
145.180 + * @param name property name
145.181 + * @return property value
145.182 + */
145.183 + public Object getValue(String reader, String name) {
145.184 + if (!prhash.containsKey(reader))
145.185 + throw new IllegalArgumentException("There is no PropertyReader with name "+reader);
145.186 + if (debugrw != null)
145.187 + debugrw.getPropertyValue(name);
145.188 + return ((PropertyReader)prhash.get(reader)).getPropertyValue(name);
145.189 + }
145.190 +}
146.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
146.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertyReader.java Thu Jul 10 04:32:50 2008 -0700
146.3 @@ -0,0 +1,66 @@
146.4 +/*
146.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
146.6 + *
146.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
146.8 + *
146.9 + * The contents of this file are subject to the terms of either the GNU
146.10 + * General Public License Version 2 only ("GPL") or the Common
146.11 + * Development and Distribution License("CDDL") (collectively, the
146.12 + * "License"). You may not use this file except in compliance with the
146.13 + * License. You can obtain a copy of the License at
146.14 + * http://www.netbeans.org/cddl-gplv2.html
146.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
146.16 + * specific language governing permissions and limitations under the
146.17 + * License. When distributing the software, include this License Header
146.18 + * Notice in each file and include the License file at
146.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
146.20 + * particular file as subject to the "Classpath" exception as provided
146.21 + * by Sun in the GPL Version 2 section of the License file that
146.22 + * accompanied this code. If applicable, add the following below the
146.23 + * License Header, with the fields enclosed by brackets [] replaced by
146.24 + * your own identifying information:
146.25 + * "Portions Copyrighted [year] [name of copyright owner]"
146.26 + *
146.27 + * Contributor(s):
146.28 + *
146.29 + * The Original Software is NetBeans. The Initial Developer of the Original
146.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
146.31 + * Microsystems, Inc. All Rights Reserved.
146.32 + *
146.33 + * If you wish your version of this file to be governed by only the CDDL
146.34 + * or only the GPL Version 2, indicate your decision by adding
146.35 + * "[Contributor] elects to include this software in this distribution
146.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
146.37 + * single choice of license, a recipient has the option to distribute
146.38 + * your version of this file under either the CDDL, the GPL Version 2 or
146.39 + * to extend the choice of license to its licensees as provided above.
146.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
146.41 + * Version 2 license, then the option applies only if the new code is
146.42 + * made subject to such option by the copyright holder.
146.43 + */
146.44 +
146.45 +package org.netbeans.modules.visualweb.gravy.properties;
146.46 +
146.47 +/**
146.48 + * PropertyReader interface
146.49 + * <p>
146.50 + * If class implementing this interface then it can read property values.
146.51 + *
146.52 + */
146.53 +
146.54 +public interface PropertyReader {
146.55 + /**
146.56 + * Read value of specified property
146.57 + *
146.58 + * @param name Name of property to read
146.59 + * @return value of specified property
146.60 + */
146.61 + Object getPropertyValue(String name);
146.62 +
146.63 + /**
146.64 + * Returns name of Reader
146.65 + *
146.66 + * @return name of Reader
146.67 + */
146.68 + String getName();
146.69 +}
147.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
147.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertyReaderWriter.java Thu Jul 10 04:32:50 2008 -0700
147.3 @@ -0,0 +1,59 @@
147.4 +/*
147.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
147.6 + *
147.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
147.8 + *
147.9 + * The contents of this file are subject to the terms of either the GNU
147.10 + * General Public License Version 2 only ("GPL") or the Common
147.11 + * Development and Distribution License("CDDL") (collectively, the
147.12 + * "License"). You may not use this file except in compliance with the
147.13 + * License. You can obtain a copy of the License at
147.14 + * http://www.netbeans.org/cddl-gplv2.html
147.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
147.16 + * specific language governing permissions and limitations under the
147.17 + * License. When distributing the software, include this License Header
147.18 + * Notice in each file and include the License file at
147.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
147.20 + * particular file as subject to the "Classpath" exception as provided
147.21 + * by Sun in the GPL Version 2 section of the License file that
147.22 + * accompanied this code. If applicable, add the following below the
147.23 + * License Header, with the fields enclosed by brackets [] replaced by
147.24 + * your own identifying information:
147.25 + * "Portions Copyrighted [year] [name of copyright owner]"
147.26 + *
147.27 + * Contributor(s):
147.28 + *
147.29 + * The Original Software is NetBeans. The Initial Developer of the Original
147.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
147.31 + * Microsystems, Inc. All Rights Reserved.
147.32 + *
147.33 + * If you wish your version of this file to be governed by only the CDDL
147.34 + * or only the GPL Version 2, indicate your decision by adding
147.35 + * "[Contributor] elects to include this software in this distribution
147.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
147.37 + * single choice of license, a recipient has the option to distribute
147.38 + * your version of this file under either the CDDL, the GPL Version 2 or
147.39 + * to extend the choice of license to its licensees as provided above.
147.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
147.41 + * Version 2 license, then the option applies only if the new code is
147.42 + * made subject to such option by the copyright holder.
147.43 + */
147.44 +
147.45 +package org.netbeans.modules.visualweb.gravy.properties;
147.46 +
147.47 +/**
147.48 + * PropertyReaderWriter interface
147.49 + * <p>
147.50 + * If class implementing this interface then it can read and write property values.
147.51 + *
147.52 + */
147.53 +
147.54 +public interface PropertyReaderWriter extends PropertyReader{
147.55 + /**
147.56 + * Set value for specified property
147.57 + *
147.58 + * @param name Name of property to read
147.59 + * value Property value
147.60 + */
147.61 + void setPropertyValue(String name, Object value);
147.62 +}
148.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
148.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetOperator.java Thu Jul 10 04:32:50 2008 -0700
148.3 @@ -0,0 +1,455 @@
148.4 +/*
148.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
148.6 + *
148.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
148.8 + *
148.9 + * The contents of this file are subject to the terms of either the GNU
148.10 + * General Public License Version 2 only ("GPL") or the Common
148.11 + * Development and Distribution License("CDDL") (collectively, the
148.12 + * "License"). You may not use this file except in compliance with the
148.13 + * License. You can obtain a copy of the License at
148.14 + * http://www.netbeans.org/cddl-gplv2.html
148.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
148.16 + * specific language governing permissions and limitations under the
148.17 + * License. When distributing the software, include this License Header
148.18 + * Notice in each file and include the License file at
148.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
148.20 + * particular file as subject to the "Classpath" exception as provided
148.21 + * by Sun in the GPL Version 2 section of the License file that
148.22 + * accompanied this code. If applicable, add the following below the
148.23 + * License Header, with the fields enclosed by brackets [] replaced by
148.24 + * your own identifying information:
148.25 + * "Portions Copyrighted [year] [name of copyright owner]"
148.26 + *
148.27 + * Contributor(s):
148.28 + *
148.29 + * The Original Software is NetBeans. The Initial Developer of the Original
148.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
148.31 + * Microsystems, Inc. All Rights Reserved.
148.32 + *
148.33 + * If you wish your version of this file to be governed by only the CDDL
148.34 + * or only the GPL Version 2, indicate your decision by adding
148.35 + * "[Contributor] elects to include this software in this distribution
148.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
148.37 + * single choice of license, a recipient has the option to distribute
148.38 + * your version of this file under either the CDDL, the GPL Version 2 or
148.39 + * to extend the choice of license to its licensees as provided above.
148.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
148.41 + * Version 2 license, then the option applies only if the new code is
148.42 + * made subject to such option by the copyright holder.
148.43 + */
148.44 +
148.45 +package org.netbeans.modules.visualweb.gravy.properties;
148.46 +
148.47 +import java.awt.Component;
148.48 +import java.awt.Frame;
148.49 +import java.awt.Window;
148.50 +import javax.swing.JComponent;
148.51 +import org.netbeans.jellytools.Bundle;
148.52 +import org.netbeans.modules.visualweb.gravy.Util;
148.53 +import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
148.54 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
148.55 +import org.netbeans.modules.visualweb.gravy.actions.HelpAction;
148.56 +import org.netbeans.modules.visualweb.gravy.actions.PropertiesAction;
148.57 +import org.netbeans.modules.visualweb.gravy.actions.ShowDescriptionAreaAction;
148.58 +import org.netbeans.modules.visualweb.gravy.actions.SortByCategoryAction;
148.59 +import org.netbeans.modules.visualweb.gravy.actions.SortByNameAction;
148.60 +import org.netbeans.jemmy.ComponentChooser;
148.61 +import org.netbeans.jemmy.JemmyException;
148.62 +import org.netbeans.jemmy.JemmyProperties;
148.63 +import org.netbeans.jemmy.TestOut;
148.64 +import org.netbeans.jemmy.Timeouts;
148.65 +import org.netbeans.jemmy.Waitable;
148.66 +import org.netbeans.jemmy.Waiter;
148.67 +import org.netbeans.jemmy.operators.ContainerOperator;
148.68 +import org.netbeans.jemmy.operators.JButtonOperator;
148.69 +import org.netbeans.jemmy.operators.JLabelOperator;
148.70 +import org.netbeans.jemmy.operators.JTabbedPaneOperator;
148.71 +import org.netbeans.jemmy.operators.JTableOperator;
148.72 +import org.netbeans.jemmy.operators.JTextAreaOperator;
148.73 +import org.netbeans.jemmy.operators.WindowOperator;
148.74 +import org.openide.explorer.propertysheet.PropertySheet;
148.75 +import org.openide.windows.TopComponent;
148.76 +
148.77 +/**
148.78 + * Handles org.openide.explorer.propertysheet.PropertySheet which
148.79 + * represents IDE property sheet TopComponent.
148.80 + * It includes JTable with properties and optional description area.
148.81 + * Use {@link Property} class or its descendants to work with properties.
148.82 + * <p>
148.83 + * Usage:<br>
148.84 + * <pre>
148.85 + PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
148.86 + new Property(pso, "Arguments").setValue("arg1 arg2");
148.87 + pso.sortByName();
148.88 + System.out.println("Number of properties="+pso.tblSheet().getRowCount());
148.89 + pso.sortByCategory();
148.90 + * </pre>
148.91 + *
148.92 + * @see Property
148.93 + * @see PropertiesAction
148.94 + * @see SortByCategoryAction
148.95 + * @see SortByNameAction
148.96 + * @see ShowDescriptionAreaAction
148.97 + * @see HelpAction
148.98 + */
148.99 +public class PropertySheetOperator extends TopComponentOperator {
148.100 + // In IDE PropertySheet extends JPanel (parent org.netbeans.core.NbSheet extends TopComponent).
148.101 + /* In new window system global property sheet resides in main window and extends TopComponent.
148.102 + * Other property sheets are opened in dialog and they do not behave as TopComponents.
148.103 + */
148.104 +
148.105 + /** JTable representing property sheet. */
148.106 + private JTableOperator _tblSheet;
148.107 + private JLabelOperator _lblDescriptionHeader;
148.108 + private JTextAreaOperator _txtDescription;
148.109 + private JButtonOperator _btHelp;
148.110 +
148.111 + /** "No Properties" property sheet. */
148.112 + public static final int MODE_NO_PROPERTIES = 0;
148.113 + /** "Properties of" property sheet. */
148.114 + public static final int MODE_PROPERTIES_OF_ONE_OBJECT = 1;
148.115 + /** "Properties of Multiple Objects" property sheet. */
148.116 + public static final int MODE_PROPERTIES_OF_MULTIPLE_OBJECTS = 2;
148.117 +
148.118 + /** "Properties" */
148.119 + private static final String propertiesText = Bundle.getStringTrimmed("org.openide.actions.Bundle",
148.120 + "Properties");
148.121 +
148.122 + /** Generic constructor
148.123 + * @param sheet instance of PropertySheet
148.124 + */
148.125 + public PropertySheetOperator(JComponent sheet) {
148.126 + super(sheet);
148.127 + }
148.128 +
148.129 + /** Waits for property sheet anywhere in IDE. */
148.130 + public PropertySheetOperator() {
148.131 + this(waitPropertySheet(null, 0));
148.132 + }
148.133 +
148.134 + /** Waits for property sheet with name according to given mode ("No Properties",
148.135 + * "Properties of" or "Properties of Multiple Objects").
148.136 + * @param mode type of shown properties
148.137 + * @see #MODE_NO_PROPERTIES
148.138 + * @see #MODE_PROPERTIES_OF_ONE_OBJECT
148.139 + * @see #MODE_PROPERTIES_OF_MULTIPLE_OBJECTS
148.140 + */
148.141 + public PropertySheetOperator(int mode) {
148.142 + this(mode, "");
148.143 + }
148.144 +
148.145 + /** Waits for property sheet with name according to given mode ("No Properties",
148.146 + * "Properties of" or "Properties of Multiple Objects") plus objectName
148.147 + * in case of one object property sheet. In case of usage
148.148 + * <code>
148.149 + * new PropertySheetOperator(PropertySheetOperator.MODE_PROPERTIES_OF_ONE_OBJECT, "MyClass");
148.150 + * </code>
148.151 + * will be searched property sheet with name "Properties of MyClass" (on
148.152 + * English locale).
148.153 + * @param mode type of shown properties
148.154 + * @param objectName name of object for that properties are shown (e.g. "MyClass")
148.155 + * @see #MODE_NO_PROPERTIES
148.156 + * @see #MODE_PROPERTIES_OF_ONE_OBJECT
148.157 + * @see #MODE_PROPERTIES_OF_MULTIPLE_OBJECTS
148.158 + */
148.159 + public PropertySheetOperator(int mode, String objectName) {
148.160 + this(Bundle.getString("org.netbeans.core.Bundle", "CTL_FMT_GlobalProperties",
148.161 + new Object[]{new Integer(mode), objectName}));
148.162 + }
148.163 +
148.164 + /** Waits for property sheet with given name. Typically sheet
148.165 + * name is used as window title.
148.166 + * @param sheetName name of sheet to find (e.g. "Properties of MyClass")
148.167 + */
148.168 + public PropertySheetOperator(String sheetName) {
148.169 + this(waitPropertySheet(sheetName, 0));
148.170 + }
148.171 +
148.172 + /** Waits for property sheet with given name in specified
148.173 + * container.
148.174 + * @param contOper where to find
148.175 + * @param sheetName name of sheet to find (e.g. "Properties of MyClass")
148.176 + */
148.177 + public PropertySheetOperator(ContainerOperator contOper, String sheetName) {
148.178 + super((JComponent)contOper.waitSubComponent(new PropertySheetSubchooser(sheetName, contOper.getComparator())));
148.179 + copyEnvironment(contOper);
148.180 + }
148.181 +
148.182 + /** Waits for property sheet in specified ContainerOperator.
148.183 + * It is for example PropertySheet in Options window.
148.184 + * @param contOper where to find
148.185 + */
148.186 + public PropertySheetOperator(ContainerOperator contOper) {
148.187 + this(contOper, 0);
148.188 + }
148.189 +
148.190 + /** Waits for index-th property sheet in specified ContainerOperator.
148.191 + * @param contOper where to find
148.192 + * @param index int index
148.193 + */
148.194 + public PropertySheetOperator(ContainerOperator contOper, int index) {
148.195 + super((JComponent)contOper.waitSubComponent(new PropertySheetSubchooser(), index));
148.196 + copyEnvironment(contOper);
148.197 + }
148.198 +
148.199 + /** Invokes properties by default action on currently selected object.
148.200 + * @return instance of PropertySheetOperator
148.201 + * @see org.netbeans.modules.visualweb.gravy.actions.PropertiesAction
148.202 + */
148.203 + public static PropertySheetOperator invoke() {
148.204 + new PropertiesAction().perform();
148.205 + return new PropertySheetOperator();
148.206 + }
148.207 +
148.208 + /** Returns JTableOperator representing SheetTable of this property sheet.
148.209 + * @return instance of JTableOperator
148.210 + */
148.211 + public JTableOperator tblSheet() {
148.212 + if(_tblSheet == null) {
148.213 + _tblSheet = new JTableOperator(this);
148.214 + }
148.215 + return _tblSheet;
148.216 + }
148.217 +
148.218 + /** Returns JLabelOperator representing header of description area.
148.219 + * @return instance of JLabelOperator
148.220 + */
148.221 + public JLabelOperator lblDescriptionHeader() {
148.222 + if(_lblDescriptionHeader == null) {
148.223 + _lblDescriptionHeader = new JLabelOperator(this);
148.224 + }
148.225 + return _lblDescriptionHeader;
148.226 + }
148.227 +
148.228 + /** Returns JTextAreaOperator representing text from description area.
148.229 + * @return instance of JTextAreaOperator
148.230 + */
148.231 + public JTextAreaOperator txtDescription() {
148.232 + if(_txtDescription == null) {
148.233 + _txtDescription = new JTextAreaOperator(this);
148.234 + }
148.235 + return _txtDescription;
148.236 + }
148.237 +
148.238 + /** Returns JButtonOperator representing help button of description area.
148.239 + * @return instance of JButtonOperator
148.240 + */
148.241 + public JButtonOperator btHelp() {
148.242 + if(_btHelp == null) {
148.243 + _btHelp = new JButtonOperator(this);
148.244 + }
148.245 + return _btHelp;
148.246 + }
148.247 +
148.248 + /** Gets JTabbedPaneOperator of this property sheet.
148.249 + * @return instance of JTabbedPaneOperator
148.250 + * @deprecated JTabbedPane is no more used in property sheet.
148.251 + */
148.252 + public JTabbedPaneOperator tbpPropertySheetTabbedPane() {
148.253 + throw new JemmyException("Don't use this! JTabbedPane no more used in property sheet.");
148.254 + /*
148.255 + if(_tbpPropertySheetTabPane == null) {
148.256 + _tbpPropertySheetTabPane = new JTabbedPaneOperator(this);
148.257 + }
148.258 + return _tbpPropertySheetTabPane;
148.259 + */
148.260 + }
148.261 +
148.262 + /** Gets PropertySheetTabOperator with given name. It selects requested tab
148.263 + * if exist and it is not active.
148.264 + * @param tabName name of tab to find.
148.265 + * @return instance of PropertySheetTabOperator
148.266 + * @deprecated will be removed because of property sheet rewrite
148.267 + */
148.268 + public PropertySheetTabOperator getPropertySheetTabOperator(String tabName) {
148.269 + return new PropertySheetTabOperator(this, tabName);
148.270 + }
148.271 +
148.272 + /** Gets PropertySheetToolbarOperator for this property sheet.
148.273 + * @return instance of PropertySheetToolbarOperator
148.274 + * @deprecated Tool bar no more used in property sheet.
148.275 + */
148.276 + public PropertySheetToolbarOperator getToolbar() {
148.277 + throw new JemmyException("Don't use this! Tool bar no more used in property sheet.");
148.278 + //return new PropertySheetToolbarOperator(this);
148.279 + }
148.280 +
148.281 + /** Gets text of header from description area.
148.282 + * @return text of header from description area
148.283 + */
148.284 + public String getDescriptionHeader() {
148.285 + return lblDescriptionHeader().getText();
148.286 + }
148.287 +
148.288 + /** Gest description from description area.
148.289 + * @return description from description area.
148.290 + */
148.291 + public String getDescription() {
148.292 + return txtDescription().getText();
148.293 + }
148.294 +
148.295 + /** Sorts properties by name by calling of popup menu on property sheet. */
148.296 + public void sortByName() {
148.297 + new SortByNameAction().perform(this);
148.298 + }
148.299 +
148.300 + /** Sorts properties by category by calling of popup menu on property sheet. */
148.301 + public void sortByCategory() {
148.302 + new SortByCategoryAction().perform(this);
148.303 + }
148.304 +
148.305 + /** Shows or hides description area depending on whether it is already shown
148.306 + * or not. It just invokes Show description area popup menu item.
148.307 + */
148.308 + public void showDescriptionArea() {
148.309 + new ShowDescriptionAreaAction().perform(this);
148.310 + }
148.311 +
148.312 + /** Shows help by calling popup menu on property sheet. */
148.313 + public void help() {
148.314 + new HelpAction().performPopup(this);
148.315 + }
148.316 +
148.317 + /** Performs verification by accessing all sub-components */
148.318 + public void verify() {
148.319 + tblSheet();
148.320 + }
148.321 +
148.322 + /** Closes this property sheet and waits until
148.323 + * it is not closed. In fact it closes container in which this property
148.324 + * sheet is placed. It can be a TopComponent in the main window or in a separate
148.325 + * frame, or a dialog.
148.326 + */
148.327 +
148.328 +
148.329 + public void close() {
148.330 + if(getSource() instanceof TopComponent) {
148.331 + // run in dispatch thread
148.332 + boolean canClose = runMapping(new MapBooleanAction("canClose") {
148.333 + public boolean map() {
148.334 + return ((TopComponent)getSource()).canClose(null, true);
148.335 + }
148.336 + });
148.337 + if(canClose) {
148.338 + // if it is regular TopComponent and it can be closed
148.339 + super.close();
148.340 + return;
148.341 + }
148.342 + }
148.343 + // close window where property sheet is hosted but not main window
148.344 + if(getWindow() != Util.getMainWindow().getSource()) {
148.345 + new WindowOperator(getWindow()).close();
148.346 + }
148.347 + }
148.348 +
148.349 +
148.350 + /** Finds property sheet anywhere in IDE. First it tries to find TopComponent
148.351 + * representing global properties and if not found, it tries to find
148.352 + * property sheet in all dialogs owned by Main Window or other frames in SDI.
148.353 + * @param sheetName name of property sheet
148.354 + * @param index index of property sheet
148.355 + */
148.356 + private static JComponent findPropertySheet(String sheetName, int index) {
148.357 + // try to find PS in MainWindow
148.358 + JComponent comp = findTopComponent(null, sheetName, index, new PropertySheetSubchooser());
148.359 + if(comp != null) {
148.360 + return comp;
148.361 + }
148.362 + /* mdk - isCompactMode
148.363 + // Try to find PS in a dialog which is owned by Main window or by other
148.364 + // frame in SDI.
148.365 + Frame[] frames;
148.366 + MainWindowOperator mwo = Util.getMainWindow();
148.367 + if(mwo.isCompactMode()) {
148.368 + frames = new Frame[] {(Frame)mwo.getSource()};
148.369 + } else {
148.370 + frames = Frame.getFrames();
148.371 + }
148.372 + for(int frameIndex=0;frameIndex<frames.length;frameIndex++) {
148.373 + Window[] windows = frames[frameIndex].getOwnedWindows();
148.374 + for(int i=0;i<windows.length;i++) {
148.375 + if(windows[i].isShowing()) {
148.376 + // only showing windows are interesting
148.377 + // create windows operator for found window
148.378 + WindowOperator wo = new WindowOperator(windows[i]);
148.379 + // supress output
148.380 + wo.setOutput(TestOut.getNullOutput());
148.381 + // try to find PropertySheet subcomponent
148.382 + comp = (JComponent)wo.findSubComponent(
148.383 + new PropertySheetSubchooser(sheetName, mwo.getComparator()),
148.384 + index);
148.385 + if(comp != null) {
148.386 + return comp;
148.387 + }
148.388 + }
148.389 + }
148.390 + }*/
148.391 + return null;
148.392 + }
148.393 +
148.394 + /** Waits for property sheet anywhere in IDE. First it tries to find TopComponent
148.395 + * representing global properties and if not found, it tries to find
148.396 + * property sheet in all dialogs owned by Main Window or other frames in SDI.
148.397 + * @param sheetName name of property sheet
148.398 + * @param index index of property sheet
148.399 + */
148.400 + private static JComponent waitPropertySheet(final String sheetName, final int index) {
148.401 + try {
148.402 + Waiter waiter = new Waiter(new Waitable() {
148.403 + public Object actionProduced(Object obj) {
148.404 + return findPropertySheet(sheetName, index);
148.405 + }
148.406 + public String getDescription() {
148.407 + return("Wait PropertySheet with name="+sheetName+
148.408 + " index="+index+" loaded");
148.409 + }
148.410 + });
148.411 + Timeouts times = JemmyProperties.getCurrentTimeouts().cloneThis();
148.412 + times.setTimeout("Waiter.WaitingTime", times.getTimeout("ComponentOperator.WaitComponentTimeout"));
148.413 + waiter.setTimeouts(times);
148.414 + waiter.setOutput(JemmyProperties.getCurrentOutput());
148.415 + return (JComponent)waiter.waitAction(null);
148.416 + } catch(InterruptedException e) {
148.417 + throw new JemmyException("Interrupted.", e);
148.418 + }
148.419 + }
148.420 +
148.421 + /** SubChooser to determine find property sheet.
148.422 + * Used in constructors.
148.423 + */
148.424 + private static final class PropertySheetSubchooser implements ComponentChooser {
148.425 +
148.426 + private String sheetName;
148.427 + private StringComparator comparator;
148.428 +
148.429 + public PropertySheetSubchooser() {
148.430 + }
148.431 +
148.432 + public PropertySheetSubchooser(String sheetName, StringComparator comparator) {
148.433 + this.sheetName = sheetName;
148.434 + this.comparator = comparator;
148.435 + }
148.436 +
148.437 + public boolean checkComponent(Component comp) {
148.438 + if(comp instanceof PropertySheet) {
148.439 + if(sheetName == null) {
148.440 + return true;
148.441 + } else {
148.442 + if(comp instanceof TopComponent) {
148.443 + String name = ((TopComponent)comp).getName();
148.444 + if(name == null) {
148.445 + name = comp.getName();
148.446 + }
148.447 + return comparator.equals(name, sheetName);
148.448 + }
148.449 + }
148.450 + }
148.451 + return false;
148.452 + }
148.453 +
148.454 + public String getDescription() {
148.455 + return "org.openide.explorer.propertysheet.PropertySheet";
148.456 + }
148.457 + }
148.458 +}
149.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
149.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetReaderWriter.java Thu Jul 10 04:32:50 2008 -0700
149.3 @@ -0,0 +1,110 @@
149.4 +/*
149.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
149.6 + *
149.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
149.8 + *
149.9 + * The contents of this file are subject to the terms of either the GNU
149.10 + * General Public License Version 2 only ("GPL") or the Common
149.11 + * Development and Distribution License("CDDL") (collectively, the
149.12 + * "License"). You may not use this file except in compliance with the
149.13 + * License. You can obtain a copy of the License at
149.14 + * http://www.netbeans.org/cddl-gplv2.html
149.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
149.16 + * specific language governing permissions and limitations under the
149.17 + * License. When distributing the software, include this License Header
149.18 + * Notice in each file and include the License file at
149.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
149.20 + * particular file as subject to the "Classpath" exception as provided
149.21 + * by Sun in the GPL Version 2 section of the License file that
149.22 + * accompanied this code. If applicable, add the following below the
149.23 + * License Header, with the fields enclosed by brackets [] replaced by
149.24 + * your own identifying information:
149.25 + * "Portions Copyrighted [year] [name of copyright owner]"
149.26 + *
149.27 + * Contributor(s):
149.28 + *
149.29 + * The Original Software is NetBeans. The Initial Developer of the Original
149.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
149.31 + * Microsystems, Inc. All Rights Reserved.
149.32 + *
149.33 + * If you wish your version of this file to be governed by only the CDDL
149.34 + * or only the GPL Version 2, indicate your decision by adding
149.35 + * "[Contributor] elects to include this software in this distribution
149.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
149.37 + * single choice of license, a recipient has the option to distribute
149.38 + * your version of this file under either the CDDL, the GPL Version 2 or
149.39 + * to extend the choice of license to its licensees as provided above.
149.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
149.41 + * Version 2 license, then the option applies only if the new code is
149.42 + * made subject to such option by the copyright holder.
149.43 + */
149.44 +
149.45 +package org.netbeans.modules.visualweb.gravy.properties;
149.46 +
149.47 +
149.48 +import org.netbeans.modules.visualweb.gravy.properties.Property;
149.49 +import org.netbeans.modules.visualweb.gravy.Util;
149.50 +import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
149.51 +
149.52 +import javax.swing.*;
149.53 +
149.54 +import org.netbeans.jemmy.operators.JTableOperator;
149.55 +
149.56 +/**
149.57 + * PropertySheetReaderWriter class
149.58 + * <p>
149.59 + * This class can read and write properties on property sheet.
149.60 + *
149.61 + */
149.62 +
149.63 +public class PropertySheetReaderWriter implements PropertyReaderWriter {
149.64 + //private PropertySheetOperator pso;
149.65 + private SheetTableOperator pso;
149.66 +
149.67 + /**
149.68 + * Constructs PropertySheetReaderWriter object
149.69 + */
149.70 + public PropertySheetReaderWriter() {
149.71 + pso = new SheetTableOperator();//new PropertySheetOperator(Util.getMainWindow());
149.72 + pso.setCompareStyle(true, false);
149.73 + // descr = pso.getDescriptionHeader();
149.74 + }
149.75 +
149.76 +
149.77 + /**
149.78 + * Read value of specified property
149.79 + *
149.80 + * @param name Name of property to read
149.81 + * @return value of specified property
149.82 + */
149.83 + public Object getPropertyValue(String name) {
149.84 + String value = (new Property(new PropertySheetOperator(Util.getMainWindow()), name)).getValue();//pso.getValue(name);
149.85 + return value;//(new Property(pso, name)).getValue();
149.86 + }
149.87 +
149.88 + /**
149.89 + * Set value for specified property
149.90 + *
149.91 + * @param name Name of property to read
149.92 + * value Property value
149.93 + */
149.94 + public void setPropertyValue(String name, Object value) {
149.95 + System.out.println("Setting value of " + name + " TO " +value);
149.96 + //if(!(getPropertyValue(name).equals(value))) {
149.97 + //(new Property(pso, name)).setValue(value.toString());
149.98 + //pso.setTextValue(name, value.toString());
149.99 + //new SheetTableOperator().setTextValue(name, value.toString());
149.100 + new Property (
149.101 + new PropertySheetOperator(Util.getMainWindow()),name).setValue(value.toString());
149.102 + //}
149.103 + }
149.104 +
149.105 + /**
149.106 + * Returns name of Reader
149.107 + *
149.108 + * @return name of Reader
149.109 + */
149.110 + public String getName() {
149.111 + return "PropertySheet";
149.112 + }
149.113 +}
150.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
150.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetTabOperator.java Thu Jul 10 04:32:50 2008 -0700
150.3 @@ -0,0 +1,193 @@
150.4 +/*
150.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
150.6 + *
150.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
150.8 + *
150.9 + * The contents of this file are subject to the terms of either the GNU
150.10 + * General Public License Version 2 only ("GPL") or the Common
150.11 + * Development and Distribution License("CDDL") (collectively, the
150.12 + * "License"). You may not use this file except in compliance with the
150.13 + * License. You can obtain a copy of the License at
150.14 + * http://www.netbeans.org/cddl-gplv2.html
150.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
150.16 + * specific language governing permissions and limitations under the
150.17 + * License. When distributing the software, include this License Header
150.18 + * Notice in each file and include the License file at
150.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
150.20 + * particular file as subject to the "Classpath" exception as provided
150.21 + * by Sun in the GPL Version 2 section of the License file that
150.22 + * accompanied this code. If applicable, add the following below the
150.23 + * License Header, with the fields enclosed by brackets [] replaced by
150.24 + * your own identifying information:
150.25 + * "Portions Copyrighted [year] [name of copyright owner]"
150.26 + *
150.27 + * Contributor(s):
150.28 + *
150.29 + * The Original Software is NetBeans. The Initial Developer of the Original
150.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
150.31 + * Microsystems, Inc. All Rights Reserved.
150.32 + *
150.33 + * If you wish your version of this file to be governed by only the CDDL
150.34 + * or only the GPL Version 2, indicate your decision by adding
150.35 + * "[Contributor] elects to include this software in this distribution
150.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
150.37 + * single choice of license, a recipient has the option to distribute
150.38 + * your version of this file under either the CDDL, the GPL Version 2 or
150.39 + * to extend the choice of license to its licensees as provided above.
150.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
150.41 + * Version 2 license, then the option applies only if the new code is
150.42 + * made subject to such option by the copyright holder.
150.43 + */
150.44 +
150.45 +package org.netbeans.modules.visualweb.gravy.properties;
150.46 +
150.47 +import java.awt.Component;
150.48 +import java.awt.Container;
150.49 +import javax.swing.JComponent;
150.50 +import javax.swing.JTabbedPane;
150.51 +import org.netbeans.jellytools.Bundle;
150.52 +import org.netbeans.jemmy.ComponentChooser;
150.53 +import org.netbeans.jemmy.ComponentSearcher;
150.54 +import org.netbeans.jemmy.JemmyException;
150.55 +import org.netbeans.jemmy.JemmyProperties;
150.56 +import org.netbeans.jemmy.TestOut;
150.57 +import org.netbeans.jemmy.Waitable;
150.58 +import org.netbeans.jemmy.Waiter;
150.59 +import org.netbeans.jemmy.operators.ContainerOperator;
150.60 +import org.netbeans.jemmy.operators.JComponentOperator;
150.61 +import org.netbeans.jemmy.operators.JTabbedPaneOperator;
150.62 +
150.63 +/**
150.64 + * Handles org.openide.explorer.propertysheet.PropertySheetTab which
150.65 + * represents a single tab of properties in a IDE property sheet.
150.66 + * PropertySheetTab extends JPanel in IDE.
150.67 + * <p>
150.68 + * Usage:<br>
150.69 + * <pre>
150.70 + * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
150.71 + * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
150.72 + * Property pr = new Property(psto, "Template");
150.73 + * System.out.println("\nProperty name="+pr.getName());
150.74 + * System.out.println("\nProperty value="+pr.getValue());
150.75 + * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Other Properties");
150.76 + * </pre>
150.77 + *
150.78 + * @deprecated Use {@link PropertySheetOperator} instead
150.79 + */
150.80 +public class PropertySheetTabOperator extends ContainerOperator {//JComponentOperator {
150.81 +
150.82 + /** Waits for PropertySheetTab with given name in specified container. If tab
150.83 + * exist and it is not active, it selects it.
150.84 + * @param contOper where to find
150.85 + * @param tabName name of tab
150.86 + * @deprecated Use {@link PropertySheetOperator} instead
150.87 + */
150.88 + public PropertySheetTabOperator(ContainerOperator contOper, String tabName) {
150.89 + super(resolveParent(contOper));
150.90 + //super(contOper.getParent());
150.91 + //super((Container)contOper.getSource());
150.92 + /*super(waitPropertySheetTab(contOper, tabName));
150.93 + copyEnvironment(contOper);*/
150.94 + }
150.95 +
150.96 + /** Waits for PropertySheetTab with name "Properties" in specified container.
150.97 + * If tab exist and it is not active, it selects it.
150.98 + * @param contOper where to find
150.99 + * @deprecated Use {@link PropertySheetOperator} instead
150.100 + */
150.101 + public PropertySheetTabOperator(ContainerOperator contOper) {
150.102 + super(resolveParent(contOper));
150.103 + //super(contOper.getParent());
150.104 + //super((Container)contOper.getSource());
150.105 + /*super(waitPropertySheetTab(contOper,
150.106 + Bundle.getString("org.openide.nodes.Bundle", "Properties")));
150.107 + copyEnvironment(contOper);*/
150.108 + }
150.109 +
150.110 + /** In case contOper is operator of PropertySheet instance we need to
150.111 + * return parent because in Property we search for PropertySheet in that
150.112 + * parent.
150.113 + */
150.114 + private static Container resolveParent(ContainerOperator contOper) {
150.115 + if(contOper.getParent() == null) {
150.116 + return (Container)contOper.getSource();
150.117 + } else {
150.118 + return contOper.getParent();
150.119 + }
150.120 + }
150.121 +
150.122 + /** Finds org.openide.explorer.propertysheet.PropertySheetTab in given
150.123 + * container. On its parent (JTabbedPane) find a pane with given tabName
150.124 + * and select that tab.
150.125 + * @return JComponent representing PropertySheetTab, null if not found.
150.126 + */
150.127 + private static JComponent findPropertySheetTab(ContainerOperator contOper, String tabName) {
150.128 + ComponentChooser chooser = new PropertySheetTabChooser();
150.129 + ComponentSearcher searcher = new ComponentSearcher((Container)contOper.getSource());
150.130 + searcher.setOutput(TestOut.getNullOutput());
150.131 + Component comp = searcher.findComponent(chooser);
150.132 + if(comp == null) {
150.133 + return null;
150.134 + }
150.135 + JTabbedPaneOperator tabbed = new JTabbedPaneOperator((JTabbedPane)comp.getParent());
150.136 + int count = tabbed.getTabCount();
150.137 + for(int i=0; i < count; i++) {
150.138 + if(contOper.getComparator().equals(tabbed.getTitleAt(i), tabName)) {
150.139 + tabbed.selectPage(i);
150.140 + return (JComponent)tabbed.getSelectedComponent();
150.141 + }
150.142 + }
150.143 + return null;
150.144 + }
150.145 +
150.146 + /** Waits for PropertySheetTab.
150.147 + * @see #findPropertySheetTab()
150.148 + */
150.149 + private static JComponent waitPropertySheetTab(final ContainerOperator contOper,
150.150 + final String tabName) {
150.151 + try {
150.152 + Waiter waiter = new Waiter(new Waitable() {
150.153 + public Object actionProduced(Object obj) {
150.154 + return findPropertySheetTab(contOper, tabName);
150.155 + }
150.156 + public String getDescription() {
150.157 + return("Wait PropertySheetTab \""+tabName+"\".");
150.158 + }
150.159 + });
150.160 + waiter.setOutput(JemmyProperties.getCurrentOutput());
150.161 + return((JComponent)waiter.waitAction(null));
150.162 + } catch(InterruptedException e) {
150.163 + throw new JemmyException("Interrupted waiting for PropertySheetTab");
150.164 + }
150.165 + }
150.166 +
150.167 + /** Chooser to find any instance of
150.168 + * org.openide.explorer.propertysheet.PropertySheetTab.
150.169 + */
150.170 + private static class PropertySheetTabChooser implements ComponentChooser {
150.171 + public PropertySheetTabChooser() {
150.172 + }
150.173 +
150.174 + public boolean checkComponent(Component comp) {
150.175 + return comp.getClass().getName().equals("org.openide.explorer.propertysheet.SheetTable");
150.176 + }
150.177 +
150.178 + public String getDescription() {
150.179 + return "SheetTable";
150.180 + }
150.181 + }
150.182 +
150.183 + /** Count number of properties on the tab.
150.184 + * @return number or properties
150.185 + * @deprecated Use {@link PropertySheetOperator} instead
150.186 + */
150.187 + public int getCount() {
150.188 + throw new JemmyException("Don't use this! No JTabbedPane is used in property sheet.");
150.189 + /*// Trying to find non sense name it goes through all properties and
150.190 + // returned index represents the count.
150.191 + SheetButtonOperator.SheetButtonChooser chooser =
150.192 + new SheetButtonOperator.SheetButtonChooser("Nonsense name @#$%^&", getComparator());
150.193 + findComponent((Container)getSource(), chooser);
150.194 + return chooser.getIndex()+1;*/
150.195 + }
150.196 +}
151.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
151.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetToolbarOperator.java Thu Jul 10 04:32:50 2008 -0700
151.3 @@ -0,0 +1,230 @@
151.4 +/*
151.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
151.6 + *
151.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
151.8 + *
151.9 + * The contents of this file are subject to the terms of either the GNU
151.10 + * General Public License Version 2 only ("GPL") or the Common
151.11 + * Development and Distribution License("CDDL") (collectively, the
151.12 + * "License"). You may not use this file except in compliance with the
151.13 + * License. You can obtain a copy of the License at
151.14 + * http://www.netbeans.org/cddl-gplv2.html
151.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
151.16 + * specific language governing permissions and limitations under the
151.17 + * License. When distributing the software, include this License Header
151.18 + * Notice in each file and include the License file at
151.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
151.20 + * particular file as subject to the "Classpath" exception as provided
151.21 + * by Sun in the GPL Version 2 section of the License file that
151.22 + * accompanied this code. If applicable, add the following below the
151.23 + * License Header, with the fields enclosed by brackets [] replaced by
151.24 + * your own identifying information:
151.25 + * "Portions Copyrighted [year] [name of copyright owner]"
151.26 + *
151.27 + * Contributor(s):
151.28 + *
151.29 + * The Original Software is NetBeans. The Initial Developer of the Original
151.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
151.31 + * Microsystems, Inc. All Rights Reserved.
151.32 + *
151.33 + * If you wish your version of this file to be governed by only the CDDL
151.34 + * or only the GPL Version 2, indicate your decision by adding
151.35 + * "[Contributor] elects to include this software in this distribution
151.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
151.37 + * single choice of license, a recipient has the option to distribute
151.38 + * your version of this file under either the CDDL, the GPL Version 2 or
151.39 + * to extend the choice of license to its licensees as provided above.
151.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
151.41 + * Version 2 license, then the option applies only if the new code is
151.42 + * made subject to such option by the copyright holder.
151.43 + */
151.44 +
151.45 +package org.netbeans.modules.visualweb.gravy.properties;
151.46 +
151.47 +import java.awt.Component;
151.48 +import java.awt.Container;
151.49 +import javax.swing.JComponent;
151.50 +import org.netbeans.jemmy.ComponentChooser;
151.51 +import org.netbeans.jemmy.JemmyException;
151.52 +import org.netbeans.jemmy.operators.ContainerOperator;
151.53 +import org.netbeans.jemmy.operators.JButtonOperator;
151.54 +import org.netbeans.jemmy.operators.JComponentOperator;
151.55 +import org.netbeans.jemmy.operators.JToggleButtonOperator;
151.56 +
151.57 +/**
151.58 + * Handles org.openide.explorer.propertysheet.PropertySheetToolbar which
151.59 + * represents toolbar in the properties sheet. It includes three sort option
151.60 + * toggle buttons, show editable toggle button, customizer button and help
151.61 + * button.
151.62 + * <p>
151.63 + * Usage:<br>
151.64 + * <pre>
151.65 + * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
151.66 + * PropertySheetToolbarOperator psto = new PropertySheetToolbarOperator(pso);
151.67 + * psto.unsorted();
151.68 + * psto.sortByType();
151.69 + * System.out.println("Help enabled="+psto.btHelp().isEnabled());
151.70 + * </pre>
151.71 + *
151.72 + * @deprecated Tool bar is no more present in property sheet.
151.73 + */
151.74 +public class PropertySheetToolbarOperator extends JComponentOperator {
151.75 + // in IDE PropertySheetToolbar extends JPanel
151.76 +
151.77 + /** Component operators */
151.78 + private JToggleButtonOperator _btUnsorted;
151.79 + private JToggleButtonOperator _btSortByName;
151.80 + private JToggleButtonOperator _btSortByType;
151.81 + private JToggleButtonOperator _btShowEditable;
151.82 + private JButtonOperator _btCustomizer;
151.83 + private JButtonOperator _btHelp;
151.84 +
151.85 +
151.86 + /** Waits for PropertySheetToolbar in given container.
151.87 + * @param contOper where to find
151.88 + * @deprecated Tool bar is no more present in property sheet.
151.89 + */
151.90 + public PropertySheetToolbarOperator(ContainerOperator contOper) {
151.91 + super((JComponent)waitPropertySheetToolbar(contOper));
151.92 + }
151.93 +
151.94 + /** Gets instance of JToggleButtonOperator of "Unsorted" button.
151.95 + * @return JToggleButtonOperator instance
151.96 + * @deprecated Tool bar is no more present in property sheet.
151.97 + */
151.98 + public JToggleButtonOperator btUnsorted() {
151.99 + if(_btUnsorted == null) {
151.100 + _btUnsorted = new JToggleButtonOperator(this, 0);
151.101 + }
151.102 + return _btUnsorted;
151.103 + }
151.104 +
151.105 + /** Gets instance of JToggleButtonOperator of "Sort by Name" button.
151.106 + * @return JToggleButtonOperator instance
151.107 + * @deprecated Tool bar is no more present in property sheet.
151.108 + */
151.109 + public JToggleButtonOperator btSortByName() {
151.110 + if(_btSortByName == null) {
151.111 + _btSortByName = new JToggleButtonOperator(this, 1);
151.112 + }
151.113 + return _btSortByName;
151.114 + }
151.115 +
151.116 + /** Gets instance of JToggleButtonOperator of "Sort by Type" button.
151.117 + * @return JToggleButtonOperator instance
151.118 + * @deprecated Tool bar is no more present in property sheet.
151.119 + */
151.120 + public JToggleButtonOperator btSortByType() {
151.121 + if(_btSortByType == null) {
151.122 + _btSortByType = new JToggleButtonOperator(this, 2);
151.123 + }
151.124 + return _btSortByType;
151.125 + }
151.126 +
151.127 + /** Gets instance of JToggleButtonOperator of "Show Editable Properties
151.128 + * Only" button.
151.129 + * @return JToggleButtonOperator instance
151.130 + * @deprecated Tool bar is no more present in property sheet.
151.131 + */
151.132 + public JToggleButtonOperator btShowEditable() {
151.133 + if(_btShowEditable == null) {
151.134 + _btShowEditable = new JToggleButtonOperator(this, 3);
151.135 + }
151.136 + return _btShowEditable;
151.137 + }
151.138 +
151.139 + /** Gets instance of JButtonOperator of "Customizer" button.
151.140 + * @return JButtonOperator instance
151.141 + * @deprecated Tool bar is no more present in property sheet.
151.142 + */
151.143 + public JButtonOperator btCustomizer() {
151.144 + if(_btCustomizer == null) {
151.145 + _btCustomizer = new JButtonOperator(this, 0);
151.146 + }
151.147 + return _btCustomizer;
151.148 + }
151.149 +
151.150 + /** Gets instance of JButtonOperator of "Help" button.
151.151 + * @return JButtonOperator instance
151.152 + * @deprecated Tool bar is no more present in property sheet.
151.153 + */
151.154 + public JButtonOperator btHelp() {
151.155 + if(_btHelp == null) {
151.156 + _btHelp = new JButtonOperator(this, 1);
151.157 + }
151.158 + return _btHelp;
151.159 + }
151.160 +
151.161 + /** Pushes "Unsorted" button.
151.162 + * @deprecated Tool bar is no more present in property sheet.
151.163 + */
151.164 + public void unsorted() {
151.165 + btUnsorted().push();
151.166 + }
151.167 +
151.168 + /** Pushes "Sort by Name" button.
151.169 + * @deprecated Tool bar is no more present in property sheet.
151.170 + */
151.171 + public void sortByName() {
151.172 + btSortByName().push();
151.173 + }
151.174 +
151.175 + /** Pushes "Sort by Type" button.
151.176 + * @deprecated Tool bar is no more present in property sheet.
151.177 + */
151.178 + public void sortByType() {
151.179 + btSortByType().push();
151.180 + }
151.181 +
151.182 + /** Sets "Show Editable Properties Only" toggle button to desired state.
151.183 + * @param show true - select button (show only editable properties);
151.184 + * false - unselect button (show all properties)
151.185 + * @deprecated Tool bar is no more present in property sheet.
151.186 + */
151.187 + public void showEditable(boolean show) {
151.188 + btShowEditable().setSelected(show);
151.189 + }
151.190 +
151.191 + /** Pushes "Customizer" button and no block further execution.
151.192 + * @deprecated Tool bar is no more present in property sheet.
151.193 + */
151.194 + public void customizer() {
151.195 + btCustomizer().pushNoBlock();
151.196 + }
151.197 +
151.198 + /** Pushes "Help" button.
151.199 + * @deprecated Tool bar is no more present in property sheet.
151.200 + */
151.201 + public void help() {
151.202 + btHelp().push();
151.203 + }
151.204 +
151.205 + /** Waits for instance of PropertySheetToolbar in a container. */
151.206 + private static Component waitPropertySheetToolbar(ContainerOperator contOper) {
151.207 + throw new JemmyException("Don't use this! No tool bar is present in property sheet.");
151.208 + /*
151.209 + ComponentChooser chooser = new ComponentChooser() {
151.210 + public boolean checkComponent(Component comp) {
151.211 + return comp.getClass().getName().indexOf("PropertySheetToolbar") != -1;
151.212 + }
151.213 +
151.214 + public String getDescription() {
151.215 + return "org.openide.explorer.propertysheet.PropertySheetToolbar";
151.216 + }
151.217 + };
151.218 + return contOper.waitComponent((Container)contOper.getSource(), chooser);
151.219 + */
151.220 + }
151.221 +
151.222 + /** Performs verification by accessing all sub-components
151.223 + * @deprecated Tool bar is no more present in property sheet.
151.224 + */
151.225 + public void verify() {
151.226 + btCustomizer();
151.227 + btHelp();
151.228 + btShowEditable();
151.229 + btSortByName();
151.230 + btSortByType();
151.231 + btUnsorted();
151.232 + }
151.233 +}
152.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
152.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/SheetButtonOperator.java Thu Jul 10 04:32:50 2008 -0700
152.3 @@ -0,0 +1,296 @@
152.4 +/*
152.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
152.6 + *
152.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
152.8 + *
152.9 + * The contents of this file are subject to the terms of either the GNU
152.10 + * General Public License Version 2 only ("GPL") or the Common
152.11 + * Development and Distribution License("CDDL") (collectively, the
152.12 + * "License"). You may not use this file except in compliance with the
152.13 + * License. You can obtain a copy of the License at
152.14 + * http://www.netbeans.org/cddl-gplv2.html
152.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
152.16 + * specific language governing permissions and limitations under the
152.17 + * License. When distributing the software, include this License Header
152.18 + * Notice in each file and include the License file at
152.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
152.20 + * particular file as subject to the "Classpath" exception as provided
152.21 + * by Sun in the GPL Version 2 section of the License file that
152.22 + * accompanied this code. If applicable, add the following below the
152.23 + * License Header, with the fields enclosed by brackets [] replaced by
152.24 + * your own identifying information:
152.25 + * "Portions Copyrighted [year] [name of copyright owner]"
152.26 + *
152.27 + * Contributor(s):
152.28 + *
152.29 + * The Original Software is NetBeans. The Initial Developer of the Original
152.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
152.31 + * Microsystems, Inc. All Rights Reserved.
152.32 + *
152.33 + * If you wish your version of this file to be governed by only the CDDL
152.34 + * or only the GPL Version 2, indicate your decision by adding
152.35 + * "[Contributor] elects to include this software in this distribution
152.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
152.37 + * single choice of license, a recipient has the option to distribute
152.38 + * your version of this file under either the CDDL, the GPL Version 2 or
152.39 + * to extend the choice of license to its licensees as provided above.
152.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
152.41 + * Version 2 license, then the option applies only if the new code is
152.42 + * made subject to such option by the copyright holder.
152.43 + */
152.44 +
152.45 +package org.netbeans.modules.visualweb.gravy.properties;
152.46 +
152.47 +import java.awt.Component;
152.48 +import java.awt.Container;
152.49 +import java.lang.reflect.Method;
152.50 +import javax.swing.JComponent;
152.51 +import org.netbeans.jemmy.Action;
152.52 +import org.netbeans.jemmy.ActionProducer;
152.53 +import org.netbeans.jemmy.ComponentChooser;
152.54 +import org.netbeans.jemmy.JemmyException;
152.55 +import org.netbeans.jemmy.operators.ContainerOperator;
152.56 +import org.netbeans.jemmy.operators.JComponentOperator;
152.57 +import org.netbeans.jemmy.operators.Operator;
152.58 +import org.netbeans.jemmy.util.MouseVisualizer;
152.59 +import org.openide.explorer.propertysheet.PropertyPanel;
152.60 +
152.61 +/**
152.62 + * Handle sheet button in IDE property sheets. SheetButton extends JPanel
152.63 + * and it can show property name, property value or customizer button ("..." button).
152.64 + * It is not recommended to use it directly but to use Property class and its
152.65 + * descendants.
152.66 + *
152.67 + * @deprecated JTable used instead of array of SheetButtons.
152.68 + * Use {@link Property} to change value of property.
152.69 + */
152.70 +public class SheetButtonOperator extends JComponentOperator {
152.71 +
152.72 + /** Index of name button (number of row) */
152.73 + private int nameButtonIndex;
152.74 + /** Temporary storage */
152.75 + private static int temporaryNameButtonIndex;
152.76 +
152.77 + /** Create new instance. Use getters below to construct a new instance.
152.78 + * @deprecated JTable used instead of array of SheetButtons.
152.79 + * Use {@link Property} to change value of property.
152.80 + */
152.81 + private SheetButtonOperator(Component button) {
152.82 + super((JComponent)button);
152.83 + }
152.84 +
152.85 + /** Waits for sheet button representing specified property name. It sets
152.86 + * index of button in sheet.
152.87 + * @param contOper where to find button
152.88 + * @param propertyName name of property
152.89 + * @return SheetButtonOperator instance
152.90 + * @see #getNameButtonIndex()
152.91 + * @deprecated JTable used instead of array of SheetButtons.
152.92 + * Use {@link Property} to change value of property.
152.93 + */
152.94 + public static synchronized SheetButtonOperator nameButton(ContainerOperator contOper,
152.95 + String propertyName) {
152.96 + SheetButtonOperator sbo =
152.97 + new SheetButtonOperator(waitNameButton(contOper, propertyName, 0));
152.98 + sbo.nameButtonIndex = temporaryNameButtonIndex;
152.99 + return sbo;
152.100 + }
152.101 +
152.102 + /** Waits for index-th sheet button representing property name. It sets
152.103 + * index of button in sheet.
152.104 + * @param contOper where to find button
152.105 + * @param index index of button (row in sheet - starts at 0)
152.106 + * @return SheetButtonOperator instance
152.107 + * @see #getNameButtonIndex()
152.108 + * @deprecated JTable used instead of array of SheetButtons.
152.109 + * Use {@link Property} to change value of property.
152.110 + */
152.111 + public static SheetButtonOperator nameButton(ContainerOperator contOper, int index) {
152.112 + SheetButtonOperator sbo = new SheetButtonOperator(waitNameButton(contOper, null, index));
152.113 + sbo.nameButtonIndex = index;
152.114 + return sbo;
152.115 + }
152.116 +
152.117 + /** Waits for sheet button representing value of property. It is identified
152.118 + * by index which can be found by name button.
152.119 + * @param contOper where to find
152.120 + * @param nameButtonIndex index of property in sheet
152.121 + * @return SheetButtonOperator instance
152.122 + * @deprecated JTable used instead of array of SheetButtons.
152.123 + * Use {@link Property} to change value of property.
152.124 + */
152.125 + public static SheetButtonOperator valueButton(ContainerOperator contOper, int nameButtonIndex) {
152.126 + return new SheetButtonOperator(waitValueButton(contOper, nameButtonIndex));
152.127 + }
152.128 +
152.129 + /** Waits for customizer button ("..." button) in given ContainerOperator.
152.130 + * @param contOper where to find button
152.131 + * @return SheetButtonOperator instance
152.132 + * @deprecated JTable used instead of array of SheetButtons.
152.133 + * Use {@link Property} to change value of property.
152.134 + */
152.135 + public static SheetButtonOperator customizerButton(ContainerOperator contOper) {
152.136 + return new SheetButtonOperator(waitCustomizerButton(contOper));
152.137 + }
152.138 +
152.139 + /** Waits LazyToolTipSheetButton by its name and index. Sets index of
152.140 + * property in sheet. */
152.141 + private static Component waitNameButton(ContainerOperator contOper, String name, int index) {
152.142 + throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
152.143 + /*SheetButtonChooser chooser = new SheetButtonChooser(name, contOper.getComparator());
152.144 + Component comp = contOper.waitComponent((Container)contOper.getSource(), chooser, index);
152.145 + temporaryNameButtonIndex = chooser.getIndex();
152.146 + return comp;*/
152.147 + }
152.148 +
152.149 + /** Waits "..." button which is SheetButton class. */
152.150 + private static Component waitCustomizerButton(ContainerOperator contOper) {
152.151 + throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
152.152 + /*ComponentChooser chooser = new ComponentChooser() {
152.153 + public boolean checkComponent(Component comp) {
152.154 + return comp.getClass().getName().indexOf("propertysheet.SheetButton") != -1;
152.155 + }
152.156 +
152.157 + public String getDescription() {
152.158 + return "SheetButton \"...\"";
152.159 + }
152.160 + };
152.161 + return contOper.waitComponent((Container)contOper.getSource(), chooser);*/
152.162 + }
152.163 +
152.164 + /** Waits value button which is instance of PropertySheetButton. First
152.165 + * it finds nameButtonIndex-th PropertyPanel and inside it it tries to find
152.166 + * PropertySheetButton.
152.167 + */
152.168 + private static Component waitValueButton(ContainerOperator contOper, int nameButtonIndex) {
152.169 + throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
152.170 + /*ComponentChooser chooser = new ComponentChooser() {
152.171 + public boolean checkComponent(Component comp) {
152.172 + return comp.getClass().getName().indexOf("PropertySheetButton") != -1;
152.173 + }
152.174 +
152.175 + public String getDescription() {
152.176 + return "PropertySheetButton";
152.177 + }
152.178 + };
152.179 + Component propertyPanel = waitPropertyPanel(contOper, nameButtonIndex);
152.180 + return contOper.waitComponent((Container)propertyPanel, chooser);*/
152.181 + }
152.182 +
152.183 + /** Waits org.openide.explorer.propertysheet.PropertyPanel with given index.
152.184 + * PropertyPanel represents container for a value both in editable and
152.185 + * non editable states.
152.186 + */
152.187 + static Component waitPropertyPanel(ContainerOperator contOper, int nameButtonIndex) {
152.188 + throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
152.189 + /*ComponentChooser chooser = new ComponentChooser() {
152.190 + public boolean checkComponent(Component comp) {
152.191 + return comp instanceof PropertyPanel;
152.192 + }
152.193 +
152.194 + public String getDescription() {
152.195 + return "org.openide.explorer.propertysheet.PropertyPanel";
152.196 + }
152.197 + };
152.198 + return contOper.waitComponent((Container)contOper.getSource(), chooser, nameButtonIndex);*/
152.199 + }
152.200 +
152.201 + /** Chooser to find instance LazyToolTipSheetButton by property name.
152.202 + * getIndex() method can be used to get index of found button.
152.203 + * It is also used by PropertySheetTabOperator. */
152.204 + static class SheetButtonChooser implements ComponentChooser {
152.205 + private String propertyName;
152.206 + private int index = -1;
152.207 + private StringComparator comparator;
152.208 +
152.209 + public SheetButtonChooser(String propertyName, StringComparator comparator) {
152.210 + this.propertyName = propertyName;
152.211 + this.comparator = comparator;
152.212 + }
152.213 +
152.214 + public boolean checkComponent(Component comp) {
152.215 + if(comp.getClass().getName().indexOf("LazyToolTipSheetButton") != -1) {
152.216 + index++;
152.217 + return comparator.equals(getButtonLabel(comp), propertyName);
152.218 + }
152.219 + return false;
152.220 + }
152.221 +
152.222 + public String getDescription() {
152.223 + return "\""+(propertyName == null ? "index-th" : propertyName)+"\" SheetButton";
152.224 + }
152.225 +
152.226 + public int getIndex() {
152.227 + return index;
152.228 + }
152.229 + }
152.230 +
152.231 + /** Gets label of given sheet button by reflection call. */
152.232 + private static String getButtonLabel(Component sheetButton) {
152.233 + try {
152.234 + Class clazz = Class.forName("org.openide.explorer.propertysheet.SheetButton");
152.235 + Method getLabelMethod = clazz.getDeclaredMethod("getLabel", null);
152.236 + getLabelMethod.setAccessible(true);
152.237 + return getLabelMethod.invoke(sheetButton, null).toString();
152.238 + } catch (Exception e) {
152.239 + throw new JemmyException("SheetButton.getLabel() by reflection failed.", e);
152.240 + }
152.241 + }
152.242 +
152.243 + /** Gets label of this sheet button.
152.244 + * @return label of this button
152.245 + */
152.246 + public String getLabel() {
152.247 + return getButtonLabel(getSource());
152.248 + }
152.249 +
152.250 + /** Gets index (row) of name button in property sheet. Each row represents
152.251 + * one property.
152.252 + * @return index (row) of name button
152.253 + */
152.254 + public int getNameButtonIndex() {
152.255 + return nameButtonIndex;
152.256 + }
152.257 +
152.258 + /** If needed, it scrolls to be this button visible, and clicks on
152.259 + * this button by mouse.
152.260 + */
152.261 + public void push() {
152.262 + // Possibly we don't need to scroll and makeVisible, if we use only
152.263 + // setText, setSelectedItem (not typeText, selectItem) in Property
152.264 + // and its descendants
152.265 + MouseVisualizer mv = new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false);
152.266 + mv.scroll(true);
152.267 + mv.makeVisible(this);
152.268 + clickMouse();
152.269 + }
152.270 +
152.271 + /** If needed, it scrolls to be this button visible, and clicks
152.272 + * on this button by mouse and no block further execution. */
152.273 + public void pushNoBlock() {
152.274 + try {
152.275 + new ActionProducer(new Action() {
152.276 + public Object launch(Object obj) {
152.277 + push();
152.278 + return null;
152.279 + }
152.280 + public String getDescription() {
152.281 + return("Push \""+getLabel()+"\" button - don't wait");
152.282 + }
152.283 + }, false).produceAction(null);
152.284 + } catch (Exception e) {
152.285 + throw new JemmyException("Push \""+getLabel()+"\" button action failed.", e);
152.286 + }
152.287 + }
152.288 +
152.289 + /** If needed, it scrolls to be this button visible, and clicks for popup
152.290 + * on this button.
152.291 + */
152.292 + public void clickForPopup() {
152.293 + MouseVisualizer mv = new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false);
152.294 + mv.scroll(true);
152.295 + mv.makeVisible(this);
152.296 + super.clickForPopup();
152.297 + }
152.298 +
152.299 +}
153.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
153.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/SheetTableOperator.java Thu Jul 10 04:32:50 2008 -0700
153.3 @@ -0,0 +1,328 @@
153.4 +/*
153.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
153.6 + *
153.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
153.8 + *
153.9 + * The contents of this file are subject to the terms of either the GNU
153.10 + * General Public License Version 2 only ("GPL") or the Common
153.11 + * Development and Distribution License("CDDL") (collectively, the
153.12 + * "License"). You may not use this file except in compliance with the
153.13 + * License. You can obtain a copy of the License at
153.14 + * http://www.netbeans.org/cddl-gplv2.html
153.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
153.16 + * specific language governing permissions and limitations under the
153.17 + * License. When distributing the software, include this License Header
153.18 + * Notice in each file and include the License file at
153.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
153.20 + * particular file as subject to the "Classpath" exception as provided
153.21 + * by Sun in the GPL Version 2 section of the License file that
153.22 + * accompanied this code. If applicable, add the following below the
153.23 + * License Header, with the fields enclosed by brackets [] replaced by
153.24 + * your own identifying information:
153.25 + * "Portions Copyrighted [year] [name of copyright owner]"
153.26 + *
153.27 + * Contributor(s):
153.28 + *
153.29 + * The Original Software is NetBeans. The Initial Developer of the Original
153.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
153.31 + * Microsystems, Inc. All Rights Reserved.
153.32 + *
153.33 + * If you wish your version of this file to be governed by only the CDDL
153.34 + * or only the GPL Version 2, indicate your decision by adding
153.35 + * "[Contributor] elects to include this software in this distribution
153.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
153.37 + * single choice of license, a recipient has the option to distribute
153.38 + * your version of this file under either the CDDL, the GPL Version 2 or
153.39 + * to extend the choice of license to its licensees as provided above.
153.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
153.41 + * Version 2 license, then the option applies only if the new code is
153.42 + * made subject to such option by the copyright holder.
153.43 + */
153.44 +
153.45 +package org.netbeans.modules.visualweb.gravy.properties;
153.46 +
153.47 +import org.netbeans.modules.visualweb.gravy.TestUtils;
153.48 +import org.netbeans.modules.visualweb.gravy.Util;
153.49 +import java.awt.Component;
153.50 +import java.awt.event.KeyEvent;
153.51 +import java.awt.event.InputEvent;
153.52 +import java.util.*;
153.53 +import java.util.List;
153.54 +import java.lang.reflect.*;
153.55 +import javax.swing.*;
153.56 +import javax.swing.table.TableCellRenderer;
153.57 +import org.netbeans.jemmy.ComponentChooser;
153.58 +import org.netbeans.jemmy.drivers.DriverManager;
153.59 +import org.netbeans.jemmy.operators.JComboBoxOperator;
153.60 +import org.netbeans.jemmy.operators.JTableOperator;
153.61 +import org.netbeans.jemmy.operators.JTextComponentOperator;
153.62 +import org.netbeans.jemmy.operators.*;
153.63 +import org.netbeans.jemmy.*;
153.64 +import org.netbeans.jellytools.Bundle;
153.65 +
153.66 +import org.openide.explorer.propertysheet.InplaceEditor;
153.67 +
153.68 +/**
153.69 + * Class represented sheet of properties.
153.70 + */
153.71 +public class SheetTableOperator extends JTableOperator {
153.72 +
153.73 + /**
153.74 + * Look for SheetTable in main window.
153.75 + */
153.76 + public SheetTableOperator() {
153.77 + super(Util.getMainWindow(), new SheetTableChooser());
153.78 + }
153.79 +
153.80 + /**
153.81 + * Look for SheetTable in specified container.
153.82 + * @param container Container where SheetTable is looked for.
153.83 + */
153.84 + public SheetTableOperator(ContainerOperator container) {
153.85 + super(container, new SheetTableChooser());
153.86 + }
153.87 +
153.88 + /**
153.89 + * Set comparison style.
153.90 + * @param compareExactly Make comparison by exact match. If false, comparison is made by entry.
153.91 + * @param caseSensitive Make case sensitive comparison.
153.92 + */
153.93 + public void setCompareStyle(boolean compareExactly, boolean caseSensitive){
153.94 + setComparator(new DefaultStringComparator(compareExactly,caseSensitive));
153.95 + }
153.96 +
153.97 + /**
153.98 + * Find row for specified property in this SheetTable.
153.99 + * @param propName Name of the property.
153.100 + */
153.101 + private int findRow(String propName){
153.102 + return findCell(new PropertyCellChooser(propName), null, new int[] {0}, 0).y;
153.103 + }
153.104 +
153.105 + /**
153.106 + * Click on row for specified property in this SheetTable.
153.107 + * @param propName Name of the property.
153.108 + */
153.109 + public void clickCell(String propName){
153.110 + clickOnCell(findRow(propName), 1);
153.111 + //TODO need second click to let component exit from inline editing mode
153.112 + clickOnCell(findRow(propName), 1);
153.113 + }
153.114 +
153.115 + /**
153.116 + * Make row for specified property editable.
153.117 + * @param propName Name of the property.
153.118 + */
153.119 + public void startEditing(String propName) {
153.120 + //clicknCell(findRow(propName), 1);
153.121 + clickCell(propName);
153.122 + pushKey(KeyEvent.VK_SPACE);
153.123 + }
153.124 +
153.125 + /**
153.126 + * Push dotten button in row for specified property.
153.127 + * @param propName Name of the property.
153.128 + */
153.129 + public void pushDotted(String propName) {
153.130 + clickOnCell(findRow(propName), 0);
153.131 + TestUtils.wait(2000);
153.132 + pushKey(KeyEvent.VK_SPACE,InputEvent.CTRL_MASK);
153.133 + }
153.134 +
153.135 + /**
153.136 + * Get value of specified property.
153.137 + * @param propName Name of the property.
153.138 + * @return String Value of specified property.
153.139 + */
153.140 + public String getValue(String propName) {
153.141 + return(((InplaceEditor)getRenderedComponent(findRow(propName), 1)).getValue().toString());
153.142 + }
153.143 +
153.144 + /**
153.145 + * Set value of specified property.
153.146 + * @param propName Name of the property.
153.147 + * @param value Value for specified property.
153.148 + */
153.149 + public void setValue(String propName, String value) {
153.150 + int row = findRow(propName);
153.151 + //((InplaceEditor)getRenderedComponent(row, 1)).setValue(value);
153.152 + System.out.println("Class: "+((InplaceEditor)getRenderedComponent(row, 1)).getClass());
153.153 + }
153.154 +
153.155 + /**
153.156 + * Set value of specified property with Text Component.
153.157 + * @param propName Name of the property.
153.158 + * @param value Value for specified property.
153.159 + */
153.160 + public void setTextValue(String propName, String value) {
153.161 + startEditing(propName);
153.162 + new JTextComponentOperator(this).enterText(value);
153.163 + Util.wait(500);
153.164 + }
153.165 +
153.166 + /**
153.167 + * Set value of specified property where is a button for call dialog for set value.
153.168 + * @param propName Name of the property.
153.169 + * @param value Value for specified property.
153.170 + */
153.171 + public void setButtonValue(String propName, String value) {
153.172 + clickForEdit(findCell(propName, 2).y, 1);
153.173 + //second click added to let component exit from inline editing mode
153.174 + clickForEdit(findCell(propName, 2).y, 1);
153.175 + new JTextComponentOperator(this).enterText(value);
153.176 + }
153.177 +
153.178 + /**
153.179 + * Set value of specified property with ComboBox.
153.180 + * @param propName Name of the property.
153.181 + * @param value Value for specified property.
153.182 + */
153.183 + public void setComboBoxValue(String propName, String value) {
153.184 + clickOnCell(findRow(propName), 1);
153.185 + new JComboBoxOperator(this).selectItem(value);
153.186 + }
153.187 +
153.188 + /**
153.189 + * Set value of specified property with CheckBox.
153.190 + * @param propName Name of the property.
153.191 + * @param value Value for specified property.
153.192 + */
153.193 + public void setCheckBoxValue(String propName, String value) {
153.194 + if (!getValue(propName).equals(value)) switchCheckBox(propName);
153.195 + }
153.196 +
153.197 + /**
153.198 + * Switch value of CheckBox for specified property.
153.199 + * @param propName Name of the property.
153.200 + */
153.201 + public void switchCheckBox(String propName){
153.202 + clickOnCell(findRow(propName), 1);
153.203 + }
153.204 +
153.205 + /**
153.206 + * Set image
153.207 + * @param componentID ID of component.
153.208 + * @param propertyName url for image component and imageURL for imagehyperlink component.
153.209 + * @param imagePath Path to image.
153.210 + */
153.211 + public void setImage(String componentID, String propertyName, String imagePath) {
153.212 + pushDotted(propertyName);
153.213 + JDialogOperator dialog1 = new JDialogOperator(componentID);
153.214 + new JButtonOperator(dialog1, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","PropertySheet_AddFile")).pushNoBlock();
153.215 + JDialogOperator dialog2 = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","PropertySheet_AddFile"));
153.216 + new JTextFieldOperator(dialog2, 0).setText(imagePath);
153.217 + Util.wait(1000);
153.218 + new JButtonOperator(dialog2, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","PropertySheet_AddFile")).pushNoBlock();
153.219 + dialog2.waitClosed();
153.220 + Util.wait(1000);
153.221 + new JButtonOperator(dialog1, "OK").pushNoBlock();
153.222 + dialog1.waitClosed();
153.223 + }
153.224 +
153.225 + /**
153.226 + * Set specified value of specified property with ComboBox.
153.227 + * @param propName Name of the property.
153.228 + * @param item Item for specified property.
153.229 + */
153.230 + public void selectCombo(String propName, final String item) {
153.231 + int row = findRow(propName);
153.232 + // ((InplaceEditor)getRenderedComponent(row, 1)).setValue(value);
153.233 + // JComboBoxOperator combo = new JComboBoxOperator(((JComboBox)getRenderedComponent(row, 1)));
153.234 + // combo.setVerification(false);
153.235 + // combo.selectItem(item);
153.236 + }
153.237 +
153.238 + /**
153.239 + * Get current component's id
153.240 + */
153.241 + public String getSelectedComponentID() {
153.242 + setCompareStyle(true, true);
153.243 + String id = getValue("id");
153.244 + return id;
153.245 + }
153.246 +
153.247 +
153.248 + /**
153.249 + * Prints all properties from propertysheet to string
153.250 + * @return String with names and values
153.251 + */
153.252 + public String printAllProperties() {
153.253 + String output = "";
153.254 +
153.255 + for (int row = 0; row < getRowCount(); row++) {
153.256 +
153.257 + Object currentValue = null;
153.258 + String currentStringValue = "";
153.259 + String currentName = "";
153.260 + Object renderedComponent = null;
153.261 +
153.262 + currentName = ((JLabel) getRenderedComponent(row, 0)).getText();
153.263 +
153.264 + try {
153.265 + renderedComponent = getRenderedComponent(row, 1);
153.266 + currentValue = ( (InplaceEditor) renderedComponent ).getValue();
153.267 +
153.268 + try {
153.269 + currentStringValue = (String) currentValue;
153.270 + } catch (ClassCastException e) {
153.271 + currentStringValue = "Can't cast class " + currentValue.getClass().getName() +
153.272 + " to String. toString returns: \"" + currentValue.toString() + "\"";
153.273 + }
153.274 +
153.275 + } catch (ClassCastException e) {
153.276 + if(renderedComponent instanceof TableCellRenderer) {
153.277 + currentStringValue = "$TableCellRenderer";
153.278 + } else {
153.279 + currentStringValue = "Can't cast class " + renderedComponent.getClass().getName() + " to InplaceEditor.";
153.280 + }
153.281 + }
153.282 +
153.283 + output += "Property: " + currentName + "; Value: " + currentStringValue + "\r\n";
153.284 + } // for
153.285 +
153.286 + return output;
153.287 + }
153.288 +
153.289 +
153.290 + /**
153.291 + * Open SheetTable.
153.292 + * @return Opened SheetTable.
153.293 + */
153.294 + public static SheetTableOperator createInstance() {
153.295 + Util.getMainMenu().pushMenuNoBlock("Window|Properties"); // show if hidden (collapse if already shown)
153.296 +
153.297 + SheetTableOperator props = new SheetTableOperator();
153.298 + int propsCnt = props.getRowCount();
153.299 + Util.getMainMenu().pushMenuNoBlock("Window|Properties"); // toggle expansion
153.300 + if(propsCnt > props.getRowCount()) {
153.301 + Util.getMainMenu().pushMenuNoBlock("Window|Properties"); // toggle expansion another time if was collapsed
153.302 + }
153.303 +
153.304 + return props;
153.305 + }
153.306 +
153.307 + protected static class PropertyCellChooser implements JTableOperator.TableCellChooser {
153.308 + String text;
153.309 + public PropertyCellChooser(String text) {
153.310 + this.text = text;
153.311 + }
153.312 + public boolean checkCell(JTableOperator oper, int row, int column) {
153.313 + JLabel label = (JLabel)oper.getRenderedComponent(row, column);
153.314 + return(label!=null && oper.getComparator().equals(label.getText(), text));
153.315 + }
153.316 + public String getDescription() {
153.317 + return(text + " property");
153.318 + }
153.319 + }
153.320 +
153.321 + static class SheetTableChooser implements ComponentChooser {
153.322 + public SheetTableChooser() {
153.323 + }
153.324 + public boolean checkComponent(Component comp) {
153.325 + return(comp.getClass().getName().equals("org.openide.explorer.propertysheet.SheetTable"));
153.326 + }
153.327 + public String getDescription() {
153.328 + return("org.openide.explorer.propertysheet.SheetTable");
153.329 + }
153.330 + }
153.331 +}
154.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
154.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/TextFieldProperty.java Thu Jul 10 04:32:50 2008 -0700
154.3 @@ -0,0 +1,94 @@
154.4 +/*
154.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
154.6 + *
154.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
154.8 + *
154.9 + * The contents of this file are subject to the terms of either the GNU
154.10 + * General Public License Version 2 only ("GPL") or the Common
154.11 + * Development and Distribution License("CDDL") (collectively, the
154.12 + * "License"). You may not use this file except in compliance with the
154.13 + * License. You can obtain a copy of the License at
154.14 + * http://www.netbeans.org/cddl-gplv2.html
154.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
154.16 + * specific language governing permissions and limitations under the
154.17 + * License. When distributing the software, include this License Header
154.18 + * Notice in each file and include the License file at
154.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
154.20 + * particular file as subject to the "Classpath" exception as provided
154.21 + * by Sun in the GPL Version 2 section of the License file that
154.22 + * accompanied this code. If applicable, add the following below the
154.23 + * License Header, with the fields enclosed by brackets [] replaced by
154.24 + * your own identifying information:
154.25 + * "Portions Copyrighted [year] [name of copyright owner]"
154.26 + *
154.27 + * Contributor(s):
154.28 + *
154.29 + * The Original Software is NetBeans. The Initial Developer of the Original
154.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
154.31 + * Microsystems, Inc. All Rights Reserved.
154.32 + *
154.33 + * If you wish your version of this file to be governed by only the CDDL
154.34 + * or only the GPL Version 2, indicate your decision by adding
154.35 + * "[Contributor] elects to include this software in this distribution
154.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
154.37 + * single choice of license, a recipient has the option to distribute
154.38 + * your version of this file under either the CDDL, the GPL Version 2 or
154.39 + * to extend the choice of license to its licensees as provided above.
154.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
154.41 + * Version 2 license, then the option applies only if the new code is
154.42 + * made subject to such option by the copyright holder.
154.43 + */
154.44 +
154.45 +package org.netbeans.modules.visualweb.gravy.properties;
154.46 +
154.47 +import java.awt.event.KeyEvent;
154.48 +import org.netbeans.jemmy.JemmyException;
154.49 +import org.netbeans.jemmy.operators.ContainerOperator;
154.50 +import org.netbeans.jemmy.operators.JTextFieldOperator;
154.51 +
154.52 +/**
154.53 + * Can be used to set all properties which use JTextField to change value.
154.54 + * <p>
154.55 + * Usage:<br>
154.56 + * <pre>
154.57 + * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
154.58 + * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Properties");
154.59 + * TextFieldProperty pr = new TextFieldProperty(psto, "Name");
154.60 + * pr.setValue("NewValue");
154.61 + * </pre>
154.62 + *
154.63 + * @deprecated Use {@link Property} instead
154.64 + */
154.65 +public class TextFieldProperty extends Property {
154.66 +
154.67 + /** Waits for property with given name in specified container.
154.68 + * @param contOper ContainerOperator where to find property. It is
154.69 + * recommended to use {@link PropertySheetTabOperator}.
154.70 + * @param name property name
154.71 + * @deprecated Use {@link Property} instead
154.72 + */
154.73 + public TextFieldProperty(ContainerOperator contOper, String name) {
154.74 + super(contOper, name);
154.75 + }
154.76 +
154.77 + /** Starts editing the property and waits for JTextField
154.78 + * @return JTextFieldOperator of property text field
154.79 + * @deprecated Use {@link Property} instead
154.80 + */
154.81 + public JTextFieldOperator textField() {
154.82 + throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
154.83 + /*startEditing();
154.84 + return new JTextFieldOperator(contOper);*/
154.85 + }
154.86 +
154.87 +
154.88 + /** Sets value of the property. It makes property editable, finds
154.89 + * JTextField, sets its value and pushes Enter key.
154.90 + * @param value new value of property
154.91 + */
154.92 + /*public void setValue(String value) {
154.93 + JTextFieldOperator textOper = textField();
154.94 + textOper.enterText(value);
154.95 + }*/
154.96 +
154.97 +}
155.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
155.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/AbbreviationsEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
155.3 @@ -0,0 +1,451 @@
155.4 +/*
155.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
155.6 + *
155.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
155.8 + *
155.9 + * The contents of this file are subject to the terms of either the GNU
155.10 + * General Public License Version 2 only ("GPL") or the Common
155.11 + * Development and Distribution License("CDDL") (collectively, the
155.12 + * "License"). You may not use this file except in compliance with the
155.13 + * License. You can obtain a copy of the License at
155.14 + * http://www.netbeans.org/cddl-gplv2.html
155.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
155.16 + * specific language governing permissions and limitations under the
155.17 + * License. When distributing the software, include this License Header
155.18 + * Notice in each file and include the License file at
155.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
155.20 + * particular file as subject to the "Classpath" exception as provided
155.21 + * by Sun in the GPL Version 2 section of the License file that
155.22 + * accompanied this code. If applicable, add the following below the
155.23 + * License Header, with the fields enclosed by brackets [] replaced by
155.24 + * your own identifying information:
155.25 + * "Portions Copyrighted [year] [name of copyright owner]"
155.26 + *
155.27 + * Contributor(s):
155.28 + *
155.29 + * The Original Software is NetBeans. The Initial Developer of the Original
155.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
155.31 + * Microsystems, Inc. All Rights Reserved.
155.32 + *
155.33 + * If you wish your version of this file to be governed by only the CDDL
155.34 + * or only the GPL Version 2, indicate your decision by adding
155.35 + * "[Contributor] elects to include this software in this distribution
155.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
155.37 + * single choice of license, a recipient has the option to distribute
155.38 + * your version of this file under either the CDDL, the GPL Version 2 or
155.39 + * to extend the choice of license to its licensees as provided above.
155.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
155.41 + * Version 2 license, then the option applies only if the new code is
155.42 + * made subject to such option by the copyright holder.
155.43 + */
155.44 +
155.45 +/*
155.46 + * Abbreviations.java
155.47 + *
155.48 + * Created on 1/2/03 4:04 PM
155.49 + */
155.50 +package org.netbeans.modules.visualweb.gravy.properties.editors;
155.51 +
155.52 +import java.util.*;
155.53 +import javax.swing.table.TableModel;
155.54 +import org.netbeans.modules.visualweb.gravy.OptionsOperator;
155.55 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
155.56 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetTabOperator;
155.57 +import org.netbeans.modules.visualweb.gravy.properties.TextFieldProperty;
155.58 +import org.netbeans.jemmy.EventTool;
155.59 +import org.netbeans.jemmy.operators.*;
155.60 +
155.61 +import javax.swing.JDialog;
155.62 +import org.netbeans.jellytools.Bundle;
155.63 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
155.64 +import org.netbeans.jemmy.operators.*;
155.65 +/** Class implementing all necessary methods for handling "Abbreviations" NbDialog.
155.66 + */
155.67 +public class AbbreviationsEditorOperator extends NbDialogOperator {
155.68 +
155.69 + /** Creates new Abbreviations that can handle it.
155.70 + */
155.71 + public AbbreviationsEditorOperator() {
155.72 + super(java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("PROP_Abbreviations"));
155.73 + }
155.74 +
155.75 + /** Creates new StringArrayCustomEditorOperator
155.76 + * @param wrapper JDialogOperator wrapper for custom editor */
155.77 + public AbbreviationsEditorOperator(JDialogOperator wrapper) {
155.78 + super((JDialog)wrapper.getSource());
155.79 + }
155.80 +
155.81 + private JTableOperator _tabAbbreviations;
155.82 + private JButtonOperator _btMetalScrollButton;
155.83 + private JButtonOperator _btMetalScrollButton2;
155.84 + private JButtonOperator _btAdd;
155.85 + private JButtonOperator _btEdit;
155.86 + private JButtonOperator _btRemove;
155.87 + private JButtonOperator _btOK;
155.88 + private JButtonOperator _btCancel;
155.89 + private JButtonOperator _btHelp;
155.90 +
155.91 +
155.92 + //******************************
155.93 + // Subcomponents definition part
155.94 + //******************************
155.95 +
155.96 + /** Tries to find null JTable in this dialog.
155.97 + * @return JTableOperator
155.98 + */
155.99 + public JTableOperator tabAbbreviations() {
155.100 + if (_tabAbbreviations==null) {
155.101 + _tabAbbreviations = new JTableOperator(this);
155.102 + }
155.103 + return _tabAbbreviations;
155.104 + }
155.105 +
155.106 + /** Tries to find "" MetalScrollButton in this dialog.
155.107 + * @return JButtonOperator
155.108 + */
155.109 + public JButtonOperator btMetalScrollButton() {
155.110 + if (_btMetalScrollButton==null) {
155.111 + _btMetalScrollButton = new JButtonOperator(this, "");
155.112 + }
155.113 + return _btMetalScrollButton;
155.114 + }
155.115 +
155.116 + /** Tries to find "" MetalScrollButton in this dialog.
155.117 + * @return JButtonOperator
155.118 + */
155.119 + public JButtonOperator btMetalScrollButton2() {
155.120 + if (_btMetalScrollButton2==null) {
155.121 + _btMetalScrollButton2 = new JButtonOperator(this, "", 1);
155.122 + }
155.123 + return _btMetalScrollButton2;
155.124 + }
155.125 +
155.126 + /** Tries to find "Add..." JButton in this dialog.
155.127 + * @return JButtonOperator
155.128 + */
155.129 + public JButtonOperator btAdd() {
155.130 + if (_btAdd==null) {
155.131 + _btAdd = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Add"));
155.132 + }
155.133 + return _btAdd;
155.134 + }
155.135 +
155.136 + /** Tries to find "Edit..." JButton in this dialog.
155.137 + * @return JButtonOperator
155.138 + */
155.139 + public JButtonOperator btEdit() {
155.140 + if (_btEdit==null) {
155.141 + _btEdit = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("AEP_Edit"));
155.142 + }
155.143 + return _btEdit;
155.144 + }
155.145 +
155.146 + /** Tries to find "Remove" JButton in this dialog.
155.147 + * @return JButtonOperator
155.148 + */
155.149 + public JButtonOperator btRemove() {
155.150 + if (_btRemove==null) {
155.151 + _btRemove = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("Remove"));
155.152 + }
155.153 + return _btRemove;
155.154 + }
155.155 +
155.156 + /** Tries to find "OK" JButton in this dialog.
155.157 + * @return JButtonOperator
155.158 + */
155.159 + public JButtonOperator btOK() {
155.160 + if (_btOK==null) {
155.161 + _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("KBEP_OK_LABEL"));
155.162 + }
155.163 + return _btOK;
155.164 + }
155.165 +
155.166 + /** Tries to find "Cancel" JButton in this dialog.
155.167 + * @return JButtonOperator
155.168 + */
155.169 + public JButtonOperator btCancel() {
155.170 + if (_btCancel==null) {
155.171 + _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
155.172 + }
155.173 + return _btCancel;
155.174 + }
155.175 +
155.176 + /** Tries to find "Help" JButton in this dialog.
155.177 + * @return JButtonOperator
155.178 + */
155.179 + public JButtonOperator btHelp() {
155.180 + if (_btHelp==null) {
155.181 + _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
155.182 + }
155.183 + return _btHelp;
155.184 + }
155.185 +
155.186 +
155.187 + //****************************************
155.188 + // Low-level functionality definition part
155.189 + //****************************************
155.190 +
155.191 + /** clicks on "" MetalScrollButton
155.192 + */
155.193 + public void metalScrollButton() {
155.194 + btMetalScrollButton().push();
155.195 + }
155.196 +
155.197 + /** clicks on "" MetalScrollButton
155.198 + */
155.199 + public void metalScrollButton2() {
155.200 + btMetalScrollButton2().push();
155.201 + }
155.202 +
155.203 + /** clicks on "Add..." JButton
155.204 + */
155.205 + public void add() {
155.206 + btAdd().push();
155.207 + }
155.208 +
155.209 + /** clicks on "Edit..." JButton
155.210 + */
155.211 + public void edit() {
155.212 + btEdit().push();
155.213 + }
155.214 +
155.215 + /** clicks on "Remove" JButton
155.216 + */
155.217 + public void remove() {
155.218 + btRemove().push();
155.219 + }
155.220 +
155.221 + /** clicks on "OK" JButton
155.222 + */
155.223 + public void oK() {
155.224 + btOK().push();
155.225 + }
155.226 +
155.227 + /** clicks on "Cancel" JButton
155.228 + */
155.229 + public void cancel() {
155.230 + btCancel().push();
155.231 + }
155.232 +
155.233 + /** clicks on "Help" JButton
155.234 + */
155.235 + public void help() {
155.236 + btHelp().push();
155.237 + }
155.238 +
155.239 +
155.240 + //*****************************************
155.241 + // High-level functionality definition part
155.242 + //*****************************************
155.243 +
155.244 + /** Performs verification of Abbreviations by accessing all its components.
155.245 + */
155.246 + public void verify() {
155.247 + tabAbbreviations();
155.248 + btMetalScrollButton();
155.249 + btMetalScrollButton2();
155.250 + btAdd();
155.251 + btEdit();
155.252 + btRemove();
155.253 + btOK();
155.254 + btCancel();
155.255 + btHelp();
155.256 + }
155.257 +
155.258 + /**
155.259 + * Add specified abbreviation with specified expansion.
155.260 + * @param abbreviation Name of abbreviation.
155.261 + * @param expansion Name of expansion.
155.262 + */
155.263 + public void addAbbreviation(String abbreviation, String expansion) {
155.264 + btAdd().pushNoBlock();
155.265 + EnterAbbreviation enter = new EnterAbbreviation();
155.266 + enter.fillAbbreviation(abbreviation, expansion);
155.267 + enter.oK();
155.268 + }
155.269 +
155.270 + /**
155.271 + * Edit specified abbreviation.
155.272 + * @param abbreviationName Name of abbreviations.
155.273 + * @param newAbbreviationName New name of abbreviations.
155.274 + * @param newExpansion New name of expansion.
155.275 + */
155.276 + public boolean editAbbreviation(String abbreviationName, String newAbbreviationName, String newExpansion) {
155.277 + int row = tabAbbreviations().findCellRow(abbreviationName);
155.278 +
155.279 + if (row == (-1))
155.280 + return false;
155.281 +
155.282 + tabAbbreviations().selectCell(row, 0);
155.283 + btEdit().pushNoBlock();
155.284 +
155.285 + EnterAbbreviation enter = new EnterAbbreviation();
155.286 +
155.287 + enter.fillAbbreviation(newAbbreviationName, newExpansion);
155.288 + enter.oK();
155.289 +
155.290 + return true;
155.291 + }
155.292 +
155.293 + /**
155.294 + * Edit specified abbreviation or add if it isn't exist.
155.295 + * @param abbreviationName Name of abbreviations.
155.296 + * @param newAbbreviationName New name of abbreviations.
155.297 + * @param newExpansion New name of expansion.
155.298 + */
155.299 + public void addOrEditAbbreviation(String abbreviationName, String newAbbreviationName, String newExpansion) {
155.300 + if (!editAbbreviation(abbreviationName, newAbbreviationName, newExpansion))
155.301 + addAbbreviation(newAbbreviationName, newExpansion);
155.302 + }
155.303 +
155.304 + /**
155.305 + * Remove specified abbreviation.
155.306 + * @param abbreviation Name of abbreviations.
155.307 + * @return True if abbreviation was removed.
155.308 + */
155.309 + public boolean removeAbbreviation(String abbreviation) {
155.310 + int row = tabAbbreviations().findCellRow(abbreviation,
155.311 + new Operator.DefaultStringComparator(true, true));
155.312 +
155.313 + if (row == (-1))
155.314 + return false;
155.315 +
155.316 + tabAbbreviations().selectCell(row, 0);
155.317 + btRemove().pushNoBlock();
155.318 +
155.319 + return true;
155.320 + }
155.321 +
155.322 + /**
155.323 + * Get map of abbreviations.
155.324 + * @return Map of abbreviations.
155.325 + */
155.326 + public Map listAbbreviations() {
155.327 + TableModel model = tabAbbreviations().getModel();
155.328 + int rowCount = model.getRowCount();
155.329 + Map result = new HashMap();
155.330 +
155.331 + for (int cntr = 0; cntr < rowCount; cntr++) {
155.332 + result.put((String) model.getValueAt(cntr, 0), (String) model.getValueAt(cntr, 1));
155.333 + }
155.334 +
155.335 + return result;
155.336 + }
155.337 +
155.338 + /**
155.339 + * Get abbreviations editor.
155.340 + * @return AbbreviationsEditorOperator.
155.341 + */
155.342 + public static AbbreviationsEditorOperator invoke(String editorName) {
155.343 + OptionsOperator options = OptionsOperator.invoke();
155.344 + new EventTool().waitNoEvent(500);
155.345 +
155.346 + options.advanced();
155.347 + new EventTool().waitNoEvent(500);
155.348 +
155.349 + options.selectOption(ResourceBundle.getBundle("org/netbeans/core/Bundle").getString("UI/Services/Editing")+
155.350 + "|"+ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("OPTIONS_all")+
155.351 + "|" + editorName);
155.352 + new EventTool().waitNoEvent(500);
155.353 + PropertySheetOperator property = new PropertySheetOperator(options);
155.354 + PropertySheetTabOperator psto = new PropertySheetTabOperator(property);
155.355 + new TextFieldProperty(psto,ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("PROP_Abbreviations")).openEditor();
155.356 +
155.357 + AbbreviationsEditorOperator abbs = new AbbreviationsEditorOperator();
155.358 +
155.359 + options.close(); /*??? not sure whether this is assured to work*/
155.360 + return abbs;
155.361 + }
155.362 +
155.363 + /**
155.364 + * Add specified abbreviation with specified expansion with specified editor.
155.365 + * @param editorName Name of editor.
155.366 + * @param abbreviation Name of abbreviation.
155.367 + * @param expansion Name of expansion.
155.368 + */
155.369 + public static void addAbbreviation(String editorName, String abbreviation, String expansion) {
155.370 + AbbreviationsEditorOperator instance = invoke(editorName);
155.371 +
155.372 + instance.addAbbreviation(abbreviation, expansion);
155.373 + instance.oK();
155.374 + }
155.375 +
155.376 + /**
155.377 + * Edit specified abbreviation or add if it isn't exist with specified editor.
155.378 + * @param editorName Name of editor.
155.379 + * @param abbreviationName Name of abbreviations.
155.380 + * @param newAbbreviationName New name of abbreviations.
155.381 + * @param newExpansion New name of expansion.
155.382 + */
155.383 + public static void addOrEditAbbreviation(String editorName, String abbreviationName, String newAbbreviationName, String newExpansion) {
155.384 + AbbreviationsEditorOperator instance = invoke(editorName);
155.385 +
155.386 + instance.addOrEditAbbreviation(abbreviationName, newAbbreviationName, newExpansion);
155.387 + instance.oK();
155.388 + }
155.389 +
155.390 + /**
155.391 + * Remove specified abbreviation with specified editor.
155.392 + * @param editorName Name of editor.
155.393 + * @param abbreviation Name of abbreviations.
155.394 + * @return True if abbreviation was removed.
155.395 + */
155.396 + public static boolean removeAbbreviation(String editorName, String abbreviation) {
155.397 + AbbreviationsEditorOperator instance = invoke(editorName);
155.398 + boolean result = instance.removeAbbreviation(abbreviation);
155.399 +
155.400 + instance.oK();
155.401 + return result;
155.402 + }
155.403 +
155.404 + /**
155.405 + * Edit specified abbreviation with specified editor.
155.406 + * @param editorName Name of editor.
155.407 + * @param abbreviationName Name of abbreviations.
155.408 + * @param newAbbreviationName New name of abbreviations.
155.409 + * @param newExpansion New name of expansion.
155.410 + */
155.411 + public static boolean editAbbreviation(String editorName, String abbreviationName, String newAbbreviationName, String newExpansion) {
155.412 + AbbreviationsEditorOperator instance = invoke(editorName);
155.413 + boolean result = instance.editAbbreviation(abbreviationName, newAbbreviationName, newExpansion);
155.414 +
155.415 + instance.oK();
155.416 + return result;
155.417 + }
155.418 +
155.419 + /**
155.420 + * Get map of abbreviations.
155.421 + * @param editorName Name of AbbreviationsEditor.
155.422 + * @return Map of abbreviations.
155.423 + */
155.424 + public static Map listAbbreviations(String editorName) {
155.425 + AbbreviationsEditorOperator instance = invoke(editorName);
155.426 + Map result = instance.listAbbreviations();
155.427 +
155.428 + instance.oK();
155.429 +
155.430 + return result;
155.431 + }
155.432 +
155.433 + /** Performs simple test of Abbreviations
155.434 + * @param args the command line arguments
155.435 + */
155.436 + public static void main(String args[]) {
155.437 + AbbreviationsEditorOperator.addAbbreviation("Java Editor","aaa","All abbrev");
155.438 + /*try {
155.439 + //java.io.PrintWriter pw= new java.io.PrintWriter(new java.io.FileWriter("/tmp/abbrevs.java"));
155.440 + Map map=Abbreviations.listAbbreviations(java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("OPTIONS_java"));
155.441 + java.util.Iterator keys=map.keySet().iterator();
155.442 + String key;
155.443 + while (keys.hasNext()) {
155.444 + key=(String)(keys.next());
155.445 + System.out.println(key+" "+map.get(key));
155.446 + // pw.println("new Abbreviation(\""+key+"\", \""+map.get(key)+"\", \"\", \"\"),");
155.447 + }
155.448 + //pw.close();
155.449 + } catch (Exception ex) {
155.450 + ex.printStackTrace();
155.451 + }*/
155.452 + }
155.453 +}
155.454 +
156.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
156.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/AddKeybinding.java Thu Jul 10 04:32:50 2008 -0700
156.3 @@ -0,0 +1,240 @@
156.4 +/*
156.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
156.6 + *
156.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
156.8 + *
156.9 + * The contents of this file are subject to the terms of either the GNU
156.10 + * General Public License Version 2 only ("GPL") or the Common
156.11 + * Development and Distribution License("CDDL") (collectively, the
156.12 + * "License"). You may not use this file except in compliance with the
156.13 + * License. You can obtain a copy of the License at
156.14 + * http://www.netbeans.org/cddl-gplv2.html
156.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
156.16 + * specific language governing permissions and limitations under the
156.17 + * License. When distributing the software, include this License Header
156.18 + * Notice in each file and include the License file at
156.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
156.20 + * particular file as subject to the "Classpath" exception as provided
156.21 + * by Sun in the GPL Version 2 section of the License file that
156.22 + * accompanied this code. If applicable, add the following below the
156.23 + * License Header, with the fields enclosed by brackets [] replaced by
156.24 + * your own identifying information:
156.25 + * "Portions Copyrighted [year] [name of copyright owner]"
156.26 + *
156.27 + * Contributor(s):
156.28 + *
156.29 + * The Original Software is NetBeans. The Initial Developer of the Original
156.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
156.31 + * Microsystems, Inc. All Rights Reserved.
156.32 + *
156.33 + * If you wish your version of this file to be governed by only the CDDL
156.34 + * or only the GPL Version 2, indicate your decision by adding
156.35 + * "[Contributor] elects to include this software in this distribution
156.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
156.37 + * single choice of license, a recipient has the option to distribute
156.38 + * your version of this file under either the CDDL, the GPL Version 2 or
156.39 + * to extend the choice of license to its licensees as provided above.
156.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
156.41 + * Version 2 license, then the option applies only if the new code is
156.42 + * made subject to such option by the copyright holder.
156.43 + */
156.44 +
156.45 +/*
156.46 + * AddKeybinding.java
156.47 + *
156.48 + * Created on 10/17/02 12:54 PM
156.49 + */
156.50 +package org.netbeans.modules.visualweb.gravy.properties.editors;
156.51 +
156.52 +import org.netbeans.jemmy.operators.*;
156.53 +
156.54 +/** Class implementing all necessary methods for handling "Add Keybinding" NbDialog.
156.55 + */
156.56 +public class AddKeybinding extends JDialogOperator {
156.57 +
156.58 + /** Creates new AddKeybinding that can handle it.
156.59 + */
156.60 + public AddKeybinding() {
156.61 + super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("MSP_AddTitle"));
156.62 + }
156.63 +
156.64 + private JLabelOperator _lblShortcutSequence;
156.65 + private JTextFieldOperator _txtShortcutSequence;
156.66 + private JTextAreaOperator _txtJTextArea;
156.67 + private JButtonOperator _btOK;
156.68 + private JButtonOperator _btClear;
156.69 + private JButtonOperator _btCancel;
156.70 + private JButtonOperator _btHelp;
156.71 +
156.72 +
156.73 + //******************************
156.74 + // Subcomponents definition part
156.75 + //******************************
156.76 +
156.77 + /** Tries to find "Shortcut Sequence:" JLabel in this dialog.
156.78 + * @return JLabelOperator
156.79 + */
156.80 + public JLabelOperator lblShortcutSequence() {
156.81 + if (_lblShortcutSequence==null) {
156.82 + _lblShortcutSequence = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("LBL_KSIP_Sequence"));
156.83 + }
156.84 + return _lblShortcutSequence;
156.85 + }
156.86 +
156.87 + /** Tries to find null JTextField in this dialog.
156.88 + * @return JTextFieldOperator
156.89 + */
156.90 + public JTextFieldOperator txtShortcutSequence() {
156.91 + if (_txtShortcutSequence==null) {
156.92 + _txtShortcutSequence = new JTextFieldOperator(this);
156.93 + }
156.94 + return _txtShortcutSequence;
156.95 + }
156.96 +
156.97 + /** Tries to find null JTextArea in this dialog.
156.98 + * @return JTextAreaOperator
156.99 + */
156.100 + public JTextAreaOperator txtJTextArea() {
156.101 + if (_txtJTextArea==null) {
156.102 + _txtJTextArea = new JTextAreaOperator(this);
156.103 + }
156.104 + return _txtJTextArea;
156.105 + }
156.106 +
156.107 + /** Tries to find "OK" JButton in this dialog.
156.108 + * @return JButtonOperator
156.109 + */
156.110 + public JButtonOperator btOK() {
156.111 + if (_btOK==null) {
156.112 + _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
156.113 + }
156.114 + return _btOK;
156.115 + }
156.116 +
156.117 + /** Tries to find "Clear" JButton in this dialog.
156.118 + * @return JButtonOperator
156.119 + */
156.120 + public JButtonOperator btClear() {
156.121 + if (_btClear==null) {
156.122 + _btClear = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_CLEAR_LABEL"));
156.123 + }
156.124 + return _btClear;
156.125 + }
156.126 +
156.127 + /** Tries to find "Cancel" JButton in this dialog.
156.128 + * @return JButtonOperator
156.129 + */
156.130 + public JButtonOperator btCancel() {
156.131 + if (_btCancel==null) {
156.132 + _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
156.133 + }
156.134 + return _btCancel;
156.135 + }
156.136 +
156.137 + /** Tries to find "Help" JButton in this dialog.
156.138 + * @return JButtonOperator
156.139 + */
156.140 + public JButtonOperator btHelp() {
156.141 + if (_btHelp==null) {
156.142 + _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
156.143 + }
156.144 + return _btHelp;
156.145 + }
156.146 +
156.147 +
156.148 + //****************************************
156.149 + // Low-level functionality definition part
156.150 + //****************************************
156.151 +
156.152 + /** gets text for txtShortcutSequence
156.153 + * @return String text
156.154 + */
156.155 + public String getShortcutSequence() {
156.156 + return txtShortcutSequence().getText();
156.157 + }
156.158 +
156.159 + /** sets text for txtShortcutSequence
156.160 + * @param text String text
156.161 + */
156.162 + public void setShortcutSequence(String text) {
156.163 + txtShortcutSequence().setText(text);
156.164 + }
156.165 +
156.166 + /** types text for txtShortcutSequence
156.167 + * @param text String text
156.168 + */
156.169 + public void typeShortcutSequence(String text) {
156.170 + txtShortcutSequence().typeText(text);
156.171 + }
156.172 +
156.173 + /** gets text for txtJTextArea
156.174 + * @return String text
156.175 + */
156.176 + public String getJTextArea() {
156.177 + return txtJTextArea().getText();
156.178 + }
156.179 +
156.180 + /** sets text for txtJTextArea
156.181 + * @param text String text
156.182 + */
156.183 + public void setJTextArea(String text) {
156.184 + txtJTextArea().setText(text);
156.185 + }
156.186 +
156.187 + /** types text for txtJTextArea
156.188 + * @param text String text
156.189 + */
156.190 + public void typeJTextArea(String text) {
156.191 + txtJTextArea().typeText(text);
156.192 + }
156.193 +
156.194 + /** clicks on "OK" JButton
156.195 + */
156.196 + public void oK() {
156.197 + btOK().push();
156.198 + }
156.199 +
156.200 + /** clicks on "Clear" JButton
156.201 + */
156.202 + public void clear() {
156.203 + btClear().push();
156.204 + }
156.205 +
156.206 + /** clicks on "Cancel" JButton
156.207 + */
156.208 + public void cancel() {
156.209 + btCancel().push();
156.210 + }
156.211 +
156.212 + /** clicks on "Help" JButton
156.213 + */
156.214 + public void help() {
156.215 + btHelp().push();
156.216 + }
156.217 +
156.218 +
156.219 + //*****************************************
156.220 + // High-level functionality definition part
156.221 + //*****************************************
156.222 +
156.223 + /** Performs verification of AddKeybinding by accessing all its components.
156.224 + */
156.225 + public void verify() {
156.226 + lblShortcutSequence();
156.227 + txtShortcutSequence();
156.228 + txtJTextArea();
156.229 + btOK();
156.230 + btClear();
156.231 + btCancel();
156.232 + btHelp();
156.233 + }
156.234 +
156.235 + /** Performs simple test of AddKeybinding
156.236 + * @param args the command line arguments
156.237 + */
156.238 + public static void main(String args[]) {
156.239 + new AddKeybinding().verify();
156.240 + System.out.println("AddKeybinding verification finished.");
156.241 + }
156.242 +}
156.243 +
157.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
157.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ClasspathCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
157.3 @@ -0,0 +1,294 @@
157.4 +/*
157.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
157.6 + *
157.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
157.8 + *
157.9 + * The contents of this file are subject to the terms of either the GNU
157.10 + * General Public License Version 2 only ("GPL") or the Common
157.11 + * Development and Distribution License("CDDL") (collectively, the
157.12 + * "License"). You may not use this file except in compliance with the
157.13 + * License. You can obtain a copy of the License at
157.14 + * http://www.netbeans.org/cddl-gplv2.html
157.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
157.16 + * specific language governing permissions and limitations under the
157.17 + * License. When distributing the software, include this License Header
157.18 + * Notice in each file and include the License file at
157.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
157.20 + * particular file as subject to the "Classpath" exception as provided
157.21 + * by Sun in the GPL Version 2 section of the License file that
157.22 + * accompanied this code. If applicable, add the following below the
157.23 + * License Header, with the fields enclosed by brackets [] replaced by
157.24 + * your own identifying information:
157.25 + * "Portions Copyrighted [year] [name of copyright owner]"
157.26 + *
157.27 + * Contributor(s):
157.28 + *
157.29 + * The Original Software is NetBeans. The Initial Developer of the Original
157.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
157.31 + * Microsystems, Inc. All Rights Reserved.
157.32 + *
157.33 + * If you wish your version of this file to be governed by only the CDDL
157.34 + * or only the GPL Version 2, indicate your decision by adding
157.35 + * "[Contributor] elects to include this software in this distribution
157.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
157.37 + * single choice of license, a recipient has the option to distribute
157.38 + * your version of this file under either the CDDL, the GPL Version 2 or
157.39 + * to extend the choice of license to its licensees as provided above.
157.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
157.41 + * Version 2 license, then the option applies only if the new code is
157.42 + * made subject to such option by the copyright holder.
157.43 + */
157.44 +
157.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
157.46 +
157.47 +import java.io.File;
157.48 +/*
157.49 + * ClasspathCustomEditorOperator.java
157.50 + *
157.51 + * Created on 6/13/02 4:40 PM
157.52 + */
157.53 +
157.54 +import java.util.ArrayList;
157.55 +import javax.swing.JDialog;
157.56 +import javax.swing.ListModel;
157.57 +import org.netbeans.jellytools.Bundle;
157.58 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
157.59 +import org.netbeans.jemmy.operators.*;
157.60 +
157.61 +/** Class implementing all necessary methods for handling Classpath Custom Editor
157.62 + */
157.63 +public class ClasspathCustomEditorOperator extends NbDialogOperator {
157.64 +
157.65 + /** Creates new ClasspathCustomEditorOperator
157.66 + * @throws TimeoutExpiredException when NbDialog not found
157.67 + * @param title String title of custom editor */
157.68 + public ClasspathCustomEditorOperator(String title) {
157.69 + super(title);
157.70 + }
157.71 +
157.72 + /** Creates new ClasspathCustomEditorOperator
157.73 + * @param wrapper JDialogOperator wrapper for custom editor */
157.74 + public ClasspathCustomEditorOperator(JDialogOperator wrapper) {
157.75 + super((JDialog)wrapper.getSource());
157.76 + }
157.77 +
157.78 + private JButtonOperator _btAddDirectory;
157.79 + private JButtonOperator _btMoveDown;
157.80 + private JListOperator _lstClasspath;
157.81 + private JButtonOperator _btAddJARZIP;
157.82 + private JButtonOperator _btRemove;
157.83 + private JButtonOperator _btMoveUp;
157.84 +
157.85 +
157.86 + /** Tries to find Add Directory... JButton in this dialog.
157.87 + * @throws TimeoutExpiredException when component not found
157.88 + * @return JButtonOperator
157.89 + */
157.90 + public JButtonOperator btAddDirectory() {
157.91 + if (_btAddDirectory==null) {
157.92 + _btAddDirectory = new JButtonOperator(this, Bundle.getString(
157.93 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.94 + "CTL_AddDirectory"));
157.95 + }
157.96 + return _btAddDirectory;
157.97 + }
157.98 +
157.99 + /** Tries to find "Move Down" JButton in this dialog.
157.100 + * @throws TimeoutExpiredException when component not found
157.101 + * @return JButtonOperator
157.102 + */
157.103 + public JButtonOperator btMoveDown() {
157.104 + if (_btMoveDown==null) {
157.105 + _btMoveDown = new JButtonOperator(this, Bundle.getString(
157.106 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.107 + "CTL_MoveDown"));
157.108 + }
157.109 + return _btMoveDown;
157.110 + }
157.111 +
157.112 + /** Tries to find null JList in this dialog.
157.113 + * @throws TimeoutExpiredException when component not found
157.114 + * @return JListOperator
157.115 + */
157.116 + public JListOperator lstClasspath() {
157.117 + if (_lstClasspath==null) {
157.118 + _lstClasspath = new JListOperator(this);
157.119 + }
157.120 + return _lstClasspath;
157.121 + }
157.122 +
157.123 + /** Tries to find Add JAR/ZIP... JButton in this dialog.
157.124 + * @throws TimeoutExpiredException when component not found
157.125 + * @return JButtonOperator
157.126 + */
157.127 + public JButtonOperator btAddJARZIP() {
157.128 + if (_btAddJARZIP==null) {
157.129 + _btAddJARZIP = new JButtonOperator(this, Bundle.getString(
157.130 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.131 + "CTL_AddJAR"));
157.132 + }
157.133 + return _btAddJARZIP;
157.134 + }
157.135 +
157.136 + /** Tries to find "Remove" JButton in this dialog.
157.137 + * @throws TimeoutExpiredException when component not found
157.138 + * @return JButtonOperator
157.139 + */
157.140 + public JButtonOperator btRemove() {
157.141 + if (_btRemove==null) {
157.142 + _btRemove = new JButtonOperator(this, Bundle.getString(
157.143 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.144 + "CTL_Remove"));
157.145 + }
157.146 + return _btRemove;
157.147 + }
157.148 +
157.149 + /** Tries to find "Move Up" JButton in this dialog.
157.150 + * @throws TimeoutExpiredException when component not found
157.151 + * @return JButtonOperator
157.152 + */
157.153 + public JButtonOperator btMoveUp() {
157.154 + if (_btMoveUp==null) {
157.155 + _btMoveUp = new JButtonOperator(this, Bundle.getString(
157.156 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.157 + "CTL_MoveUp"));
157.158 + }
157.159 + return _btMoveUp;
157.160 + }
157.161 +
157.162 + /** clicks on Add Directory... JButton
157.163 + * @throws TimeoutExpiredException when JButton not found
157.164 + * @return FileCustomEditorOperator of directory selector */
157.165 + public FileCustomEditorOperator addDirectory() {
157.166 + btAddDirectory().pushNoBlock();
157.167 + return new FileCustomEditorOperator(Bundle.getString(
157.168 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.169 + "CTL_FileSystemPanel.Local_Dialog_Title"));
157.170 + }
157.171 +
157.172 + /** clicks on "Move Down" JButton
157.173 + * @throws TimeoutExpiredException when JButton not found
157.174 + */
157.175 + public void moveDown() {
157.176 + btMoveDown().push();
157.177 + }
157.178 +
157.179 + /** clicks on Add JAR/ZIP... JButton
157.180 + * @throws TimeoutExpiredException when JButton not found
157.181 + * @return FileCustomEditorOperator of JAR or ZIP file selector */
157.182 + public FileCustomEditorOperator addJARZIP() {
157.183 + btAddJARZIP().pushNoBlock();
157.184 + return new FileCustomEditorOperator(Bundle.getString(
157.185 + "org.netbeans.core.execution.beaninfo.editors.Bundle",
157.186 + "CTL_FileSystemPanel.Jar_Dialog_Title"));
157.187 + }
157.188 +
157.189 + /** adds directory into classpath list
157.190 + * @param directoryPath String directory path to be added */
157.191 + public void addDirectory(String directoryPath) {
157.192 + FileCustomEditorOperator editor=addDirectory();
157.193 + editor.setFileValue(directoryPath);
157.194 + editor.ok();
157.195 + }
157.196 +
157.197 + /** adds JAR or ZIP file into classpath list
157.198 + * @param filePath String path of JAR or ZIP file to be added */
157.199 + public void addJARZIP(String filePath) {
157.200 + FileCustomEditorOperator editor=addJARZIP();
157.201 + editor.setFileValue(filePath);
157.202 + editor.ok();
157.203 + }
157.204 +
157.205 + /** adds directory into classpath list
157.206 + * @param directory File directory to be added */
157.207 + public void addDirectory(File directory) {
157.208 + FileCustomEditorOperator editor=addDirectory();
157.209 + editor.setFileValue(directory);
157.210 + editor.ok();
157.211 + }
157.212 +
157.213 + /** adds JAR or ZIP file into classpath list
157.214 + * @param jarZip File JAR or ZIP to be added */
157.215 + public void addJARZIP(File jarZip) {
157.216 + FileCustomEditorOperator editor=addJARZIP();
157.217 + editor.setFileValue(jarZip);
157.218 + editor.ok();
157.219 + }
157.220 +
157.221 + /** sets complete classpath in custom editor
157.222 + * @param classPathElements File[] array of directories or JAR or ZIP files
157.223 + * to be included in classapth */
157.224 + public void setClasspathValue(File[] classPathElements) {
157.225 + removeAll();
157.226 + for (int i=0; i<classPathElements.length; i++) {
157.227 + if (classPathElements[i].isFile())
157.228 + addJARZIP(classPathElements[i]);
157.229 + else
157.230 + addDirectory(classPathElements[i]);
157.231 + }
157.232 + }
157.233 +
157.234 + /** sets complete classpath in custom editor
157.235 + * @param classPathElements String[] array of paths of directories or JAR
157.236 + * or ZIP files to be included in classapth */
157.237 + public void setClasspathValue(String[] classPathElements) {
157.238 + removeAll();
157.239 + for (int i=0; i<classPathElements.length; i++) {
157.240 + String lower=classPathElements[i].toLowerCase();
157.241 + if (lower.endsWith(".jar")||lower.endsWith(".zip"))
157.242 + addJARZIP(classPathElements[i]);
157.243 + else
157.244 + addDirectory(classPathElements[i]);
157.245 + }
157.246 + }
157.247 +
157.248 + /** clicks on "Remove" JButton
157.249 + * @throws TimeoutExpiredException when JButton not found
157.250 + */
157.251 + public void remove() {
157.252 + btRemove().push();
157.253 + }
157.254 +
157.255 + /** clicks on "Move Up" JButton
157.256 + * @throws TimeoutExpiredException when JButton not found
157.257 + */
157.258 + public void moveUp() {
157.259 + btMoveUp().push();
157.260 + }
157.261 +
157.262 + /** removes given item from classpath
157.263 + * @param value String item to be removed */
157.264 + public void remove(String value) {
157.265 + lstClasspath().selectItem(value);
157.266 + remove();
157.267 + }
157.268 +
157.269 + /** removes complete classpath */
157.270 + public void removeAll() {
157.271 + while (lstClasspath().getModel().getSize()>0) {
157.272 + lstClasspath().selectItem(0);
157.273 + remove();
157.274 + }
157.275 + }
157.276 +
157.277 + /** returns complete class path from editor
157.278 + * @return String[] class paths */
157.279 + public String[] getClasspathValue() {
157.280 + ArrayList data=new ArrayList();
157.281 + ListModel model=lstClasspath().getModel();
157.282 + for (int i=0; i<model.getSize(); i++)
157.283 + data.add(model.getElementAt(i).toString());
157.284 + return (String[])data.toArray(new String[data.size()]);
157.285 + }
157.286 +
157.287 + /** Performs verification by accessing all sub-components */
157.288 + public void verify() {
157.289 + btAddDirectory();
157.290 + btAddJARZIP();
157.291 + btMoveDown();
157.292 + btMoveUp();
157.293 + btRemove();
157.294 + lstClasspath();
157.295 + }
157.296 +}
157.297 +
158.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
158.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ColorCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
158.3 @@ -0,0 +1,106 @@
158.4 +/*
158.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
158.6 + *
158.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
158.8 + *
158.9 + * The contents of this file are subject to the terms of either the GNU
158.10 + * General Public License Version 2 only ("GPL") or the Common
158.11 + * Development and Distribution License("CDDL") (collectively, the
158.12 + * "License"). You may not use this file except in compliance with the
158.13 + * License. You can obtain a copy of the License at
158.14 + * http://www.netbeans.org/cddl-gplv2.html
158.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
158.16 + * specific language governing permissions and limitations under the
158.17 + * License. When distributing the software, include this License Header
158.18 + * Notice in each file and include the License file at
158.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
158.20 + * particular file as subject to the "Classpath" exception as provided
158.21 + * by Sun in the GPL Version 2 section of the License file that
158.22 + * accompanied this code. If applicable, add the following below the
158.23 + * License Header, with the fields enclosed by brackets [] replaced by
158.24 + * your own identifying information:
158.25 + * "Portions Copyrighted [year] [name of copyright owner]"
158.26 + *
158.27 + * Contributor(s):
158.28 + *
158.29 + * The Original Software is NetBeans. The Initial Developer of the Original
158.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
158.31 + * Microsystems, Inc. All Rights Reserved.
158.32 + *
158.33 + * If you wish your version of this file to be governed by only the CDDL
158.34 + * or only the GPL Version 2, indicate your decision by adding
158.35 + * "[Contributor] elects to include this software in this distribution
158.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
158.37 + * single choice of license, a recipient has the option to distribute
158.38 + * your version of this file under either the CDDL, the GPL Version 2 or
158.39 + * to extend the choice of license to its licensees as provided above.
158.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
158.41 + * Version 2 license, then the option applies only if the new code is
158.42 + * made subject to such option by the copyright holder.
158.43 + */
158.44 +
158.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
158.46 +
158.47 +/*
158.48 + * ColorCustomEditorOperator.java
158.49 + *
158.50 + * Created on June 13, 2002, 4:01 PM
158.51 + */
158.52 +
158.53 +import java.awt.Color;
158.54 +import javax.swing.JDialog;
158.55 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
158.56 +import org.netbeans.jemmy.operators.*;
158.57 +
158.58 +/** Class implementing all necessary methods for handling Color Custom Editor
158.59 + */
158.60 +public class ColorCustomEditorOperator extends NbDialogOperator {
158.61 +
158.62 + private JColorChooserOperator _colorChooser=null;
158.63 +
158.64 + /** Creates a new instance of FileCustomEditorOperator
158.65 + * @param title String title of custom editor */
158.66 + public ColorCustomEditorOperator(String title) {
158.67 + super(title);
158.68 + }
158.69 +
158.70 + /** Creates a new instance of FileCustomEditorOperator
158.71 + * @param wrapper JDialogOperator wrapper for custom editor */
158.72 + public ColorCustomEditorOperator(JDialogOperator wrapper) {
158.73 + super((JDialog)wrapper.getSource());
158.74 + }
158.75 +
158.76 + /** locates and returns JColorChooserOperator
158.77 + * @return JColorChooserOperator */
158.78 + public JColorChooserOperator colorChooser() {
158.79 + if (_colorChooser==null) {
158.80 + _colorChooser=new JColorChooserOperator(this);
158.81 + }
158.82 + return _colorChooser;
158.83 + }
158.84 +
158.85 + /** returns edited color
158.86 + * @return Color */
158.87 + public Color getColorValue() {
158.88 + return colorChooser().getColor();
158.89 + }
158.90 +
158.91 + /** sets edited color
158.92 + * @param color Color */
158.93 + public void setColorValue(Color color) {
158.94 + colorChooser().setColor(color);
158.95 + }
158.96 +
158.97 + /** sets edited color
158.98 + * @param r int red
158.99 + * @param g int green
158.100 + * @param b int blue */
158.101 + public void setRGBValue(int r, int g, int b) {
158.102 + colorChooser().setColor(r, g, b);
158.103 + }
158.104 +
158.105 + /** Performs verification by accessing all sub-components */
158.106 + public void verify() {
158.107 + colorChooser();
158.108 + }
158.109 +}
159.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
159.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/DimensionCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
159.3 @@ -0,0 +1,124 @@
159.4 +/*
159.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
159.6 + *
159.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
159.8 + *
159.9 + * The contents of this file are subject to the terms of either the GNU
159.10 + * General Public License Version 2 only ("GPL") or the Common
159.11 + * Development and Distribution License("CDDL") (collectively, the
159.12 + * "License"). You may not use this file except in compliance with the
159.13 + * License. You can obtain a copy of the License at
159.14 + * http://www.netbeans.org/cddl-gplv2.html
159.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
159.16 + * specific language governing permissions and limitations under the
159.17 + * License. When distributing the software, include this License Header
159.18 + * Notice in each file and include the License file at
159.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
159.20 + * particular file as subject to the "Classpath" exception as provided
159.21 + * by Sun in the GPL Version 2 section of the License file that
159.22 + * accompanied this code. If applicable, add the following below the
159.23 + * License Header, with the fields enclosed by brackets [] replaced by
159.24 + * your own identifying information:
159.25 + * "Portions Copyrighted [year] [name of copyright owner]"
159.26 + *
159.27 + * Contributor(s):
159.28 + *
159.29 + * The Original Software is NetBeans. The Initial Developer of the Original
159.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
159.31 + * Microsystems, Inc. All Rights Reserved.
159.32 + *
159.33 + * If you wish your version of this file to be governed by only the CDDL
159.34 + * or only the GPL Version 2, indicate your decision by adding
159.35 + * "[Contributor] elects to include this software in this distribution
159.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
159.37 + * single choice of license, a recipient has the option to distribute
159.38 + * your version of this file under either the CDDL, the GPL Version 2 or
159.39 + * to extend the choice of license to its licensees as provided above.
159.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
159.41 + * Version 2 license, then the option applies only if the new code is
159.42 + * made subject to such option by the copyright holder.
159.43 + */
159.44 +
159.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
159.46 +
159.47 +import javax.swing.JDialog;
159.48 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
159.49 +import org.netbeans.jemmy.JemmyException;
159.50 +import org.netbeans.jemmy.operators.*;
159.51 +
159.52 +// editor for Dimension
159.53 +/** Class implementing all necessary methods for handling Dimension Custom Editor */
159.54 +public class DimensionCustomEditorOperator extends NbDialogOperator {
159.55 +
159.56 + JTextFieldOperator _txtFieldWidth;
159.57 + JTextFieldOperator _txtFieldHeight;
159.58 +
159.59 + /** Creates a new instance of DimensionCustomEditorOperator
159.60 + * @param title String title of custom editor */
159.61 + public DimensionCustomEditorOperator(String title) {
159.62 + super(title);
159.63 + }
159.64 +
159.65 + /** Creates a new instance of DimensionCustomEditorOperator
159.66 + * @param wrapper JDialogOperator wrapper for custom editor */
159.67 + public DimensionCustomEditorOperator(JDialogOperator wrapper) {
159.68 + super((JDialog)wrapper.getSource());
159.69 + }
159.70 +
159.71 + /** sets dimension value
159.72 + * @param width int width
159.73 + * @param height int height */
159.74 + public void setDimensionValue(String width, String height) {
159.75 + txtFieldWidth().setText(width);
159.76 + txtFieldHeight().setText(height);
159.77 + }
159.78 +
159.79 + /** returns width value
159.80 + * @return ind width */
159.81 + public String getWidthValue() {
159.82 + return txtFieldWidth().getText();
159.83 + }
159.84 +
159.85 + /** sets width value
159.86 + * @param value int width */
159.87 + public void setWidthValue(String value) {
159.88 + txtFieldWidth().setText(value);
159.89 + }
159.90 +
159.91 + /** returns height value
159.92 + * @return int height */
159.93 + public String getHeightValue() {
159.94 + return txtFieldHeight().getText();
159.95 + }
159.96 +
159.97 + /** sets height value
159.98 + * @param value int height */
159.99 + public void setHeightValue(String value) {
159.100 + txtFieldHeight().setText(value);
159.101 + }
159.102 +
159.103 + /** getter for height text field operator
159.104 + * @return JTextFieldOperator */
159.105 + public JTextFieldOperator txtFieldWidth() {
159.106 + if(_txtFieldWidth==null) {
159.107 + _txtFieldWidth = new JTextFieldOperator(this, 0);
159.108 + }
159.109 + return _txtFieldWidth;
159.110 + }
159.111 +
159.112 + /** getter for width text field operator
159.113 + * @return JTextFieldOperator */
159.114 + public JTextFieldOperator txtFieldHeight() {
159.115 + if(_txtFieldHeight==null) {
159.116 + _txtFieldHeight = new JTextFieldOperator(this, 1);
159.117 + }
159.118 + return _txtFieldHeight;
159.119 + }
159.120 +
159.121 + /** Performs verification by accessing all sub-components */
159.122 + public void verify() {
159.123 + txtFieldHeight();
159.124 + txtFieldWidth();
159.125 + }
159.126 +
159.127 +}
160.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
160.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/EnterAbbreviation.java Thu Jul 10 04:32:50 2008 -0700
160.3 @@ -0,0 +1,250 @@
160.4 +/*
160.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
160.6 + *
160.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
160.8 + *
160.9 + * The contents of this file are subject to the terms of either the GNU
160.10 + * General Public License Version 2 only ("GPL") or the Common
160.11 + * Development and Distribution License("CDDL") (collectively, the
160.12 + * "License"). You may not use this file except in compliance with the
160.13 + * License. You can obtain a copy of the License at
160.14 + * http://www.netbeans.org/cddl-gplv2.html
160.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
160.16 + * specific language governing permissions and limitations under the
160.17 + * License. When distributing the software, include this License Header
160.18 + * Notice in each file and include the License file at
160.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
160.20 + * particular file as subject to the "Classpath" exception as provided
160.21 + * by Sun in the GPL Version 2 section of the License file that
160.22 + * accompanied this code. If applicable, add the following below the
160.23 + * License Header, with the fields enclosed by brackets [] replaced by
160.24 + * your own identifying information:
160.25 + * "Portions Copyrighted [year] [name of copyright owner]"
160.26 + *
160.27 + * Contributor(s):
160.28 + *
160.29 + * The Original Software is NetBeans. The Initial Developer of the Original
160.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
160.31 + * Microsystems, Inc. All Rights Reserved.
160.32 + *
160.33 + * If you wish your version of this file to be governed by only the CDDL
160.34 + * or only the GPL Version 2, indicate your decision by adding
160.35 + * "[Contributor] elects to include this software in this distribution
160.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
160.37 + * single choice of license, a recipient has the option to distribute
160.38 + * your version of this file under either the CDDL, the GPL Version 2 or
160.39 + * to extend the choice of license to its licensees as provided above.
160.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
160.41 + * Version 2 license, then the option applies only if the new code is
160.42 + * made subject to such option by the copyright holder.
160.43 + */
160.44 +
160.45 +/*
160.46 + * EnterAbbreviation.java
160.47 + *
160.48 + * Created on 8/28/02 11:08 AM
160.49 + */
160.50 +package org.netbeans.modules.visualweb.gravy.properties.editors;
160.51 +
160.52 +import org.netbeans.jemmy.operators.*;
160.53 +
160.54 +/** Class implementing all necessary methods for handling "Enter Abbreviation" NbDialog.
160.55 + */
160.56 +public class EnterAbbreviation extends JDialogOperator {
160.57 +
160.58 + /** Creates new EnterAbbreviation that can handle it.
160.59 + */
160.60 + public EnterAbbreviation() {
160.61 + super(java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AEP_EnterAbbrev"));
160.62 + }
160.63 +
160.64 + private JLabelOperator _lblAbbreviation;
160.65 + private JTextFieldOperator _txtAbbreviation;
160.66 + private JLabelOperator _lblExpansion;
160.67 + private JTextAreaOperator _txtExpansion;
160.68 + private JButtonOperator _btOK;
160.69 + private JButtonOperator _btCancel;
160.70 + private JButtonOperator _btHelp;
160.71 +
160.72 +
160.73 + //******************************
160.74 + // Subcomponents definition part
160.75 + //******************************
160.76 +
160.77 + /** Tries to find "Abbreviation:" JLabel in this dialog.
160.78 + * @return JLabelOperator
160.79 + */
160.80 + public JLabelOperator lblAbbreviation() {
160.81 + if (_lblAbbreviation==null) {
160.82 + _lblAbbreviation = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AIP_Abbrev"));
160.83 + }
160.84 + return _lblAbbreviation;
160.85 + }
160.86 +
160.87 + /** Tries to find null JTextField in this dialog.
160.88 + * @return JTextFieldOperator
160.89 + */
160.90 + public JTextFieldOperator txtAbbreviation() {
160.91 + if (_txtAbbreviation==null) {
160.92 + _txtAbbreviation = new JTextFieldOperator(this);
160.93 + }
160.94 + return _txtAbbreviation;
160.95 + }
160.96 +
160.97 + /** Tries to find "Expansion:" JLabel in this dialog.
160.98 + * @return JLabelOperator
160.99 + */
160.100 + public JLabelOperator lblExpansion() {
160.101 + if (_lblExpansion==null) {
160.102 + _lblExpansion = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AIP_Expand"));
160.103 + }
160.104 + return _lblExpansion;
160.105 + }
160.106 +
160.107 + /** Tries to find null JTextArea in this dialog.
160.108 + * @return JTextAreaOperator
160.109 + */
160.110 + public JTextAreaOperator txtExpansion() {
160.111 + if (_txtExpansion==null) {
160.112 + _txtExpansion = new JTextAreaOperator(this);
160.113 + }
160.114 + return _txtExpansion;
160.115 + }
160.116 +
160.117 + /** Tries to find "OK" JButton in this dialog.
160.118 + * @return JButtonOperator
160.119 + */
160.120 + public JButtonOperator btOK() {
160.121 + if (_btOK==null) {
160.122 + _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
160.123 + }
160.124 + return _btOK;
160.125 + }
160.126 +
160.127 + /** Tries to find "Cancel" JButton in this dialog.
160.128 + * @return JButtonOperator
160.129 + */
160.130 + public JButtonOperator btCancel() {
160.131 + if (_btCancel==null) {
160.132 + _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
160.133 + }
160.134 + return _btCancel;
160.135 + }
160.136 +
160.137 + /** Tries to find "Help" JButton in this dialog.
160.138 + * @return JButtonOperator
160.139 + */
160.140 + public JButtonOperator btHelp() {
160.141 + if (_btHelp==null) {
160.142 + _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
160.143 + }
160.144 + return _btHelp;
160.145 + }
160.146 +
160.147 +
160.148 + //****************************************
160.149 + // Low-level functionality definition part
160.150 + //****************************************
160.151 +
160.152 + /** gets text for txtAbbreviation
160.153 + * @return String text
160.154 + */
160.155 + public String getAbbreviation() {
160.156 + return txtAbbreviation().getText();
160.157 + }
160.158 +
160.159 + /** sets text for txtAbbreviation
160.160 + * @param text String text
160.161 + */
160.162 + public void setAbbreviation(String text) {
160.163 + txtAbbreviation().setText(text);
160.164 + }
160.165 +
160.166 + /** types text for txtAbbreviation
160.167 + * @param text String text
160.168 + */
160.169 + public void typeAbbreviation(String text) {
160.170 + txtAbbreviation().typeText(text);
160.171 + }
160.172 +
160.173 + /** gets text for txtExpansion
160.174 + * @return String text
160.175 + */
160.176 + public String getExpansion() {
160.177 + return txtExpansion().getText();
160.178 + }
160.179 +
160.180 + /** sets text for txtExpansion
160.181 + * @param text String text
160.182 + */
160.183 + public void setExpansion(String text) {
160.184 + txtExpansion().setText(text);
160.185 + }
160.186 +
160.187 + /** types text for txtExpansion
160.188 + * @param text String text
160.189 + */
160.190 + public void typeExpansion(String text) {
160.191 + txtExpansion().typeText(text);
160.192 + }
160.193 +
160.194 + /** clicks on "OK" JButton
160.195 + */
160.196 + public void oK() {
160.197 + btOK().push();
160.198 +
160.199 + try {
160.200 + Thread.sleep(2000);
160.201 + } catch (InterruptedException e) {
160.202 + e.printStackTrace(System.err);
160.203 + }
160.204 + }
160.205 +
160.206 + /** clicks on "Cancel" JButton
160.207 + */
160.208 + public void cancel() {
160.209 + btCancel().push();
160.210 + }
160.211 +
160.212 + /** clicks on "Help" JButton
160.213 + */
160.214 + public void help() {
160.215 + btHelp().push();
160.216 + }
160.217 +
160.218 +
160.219 + //*****************************************
160.220 + // High-level functionality definition part
160.221 + //*****************************************
160.222 +
160.223 + /** Performs verification of EnterAbbreviation by accessing all its components.
160.224 + */
160.225 + public void verify() {
160.226 + lblAbbreviation();
160.227 + txtAbbreviation();
160.228 + lblExpansion();
160.229 + txtExpansion();
160.230 + btOK();
160.231 + btCancel();
160.232 + btHelp();
160.233 + }
160.234 +
160.235 + public void fillAbbreviation(String abbreviation, String expansion) {
160.236 + if (!"".equals(txtAbbreviation().getText()))
160.237 + txtAbbreviation().clearText();
160.238 + typeAbbreviation(abbreviation);
160.239 +
160.240 + if (!"".equals(txtExpansion().getText()))
160.241 + txtExpansion().clearText();
160.242 + typeExpansion(expansion);
160.243 + }
160.244 +
160.245 + /** Performs simple test of EnterAbbreviation
160.246 + * @param args the command line arguments
160.247 + */
160.248 + public static void main(String args[]) {
160.249 + new EnterAbbreviation().verify();
160.250 + System.out.println("EnterAbbreviation verification finished.");
160.251 + }
160.252 +}
160.253 +
161.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
161.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FileCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
161.3 @@ -0,0 +1,113 @@
161.4 +/*
161.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
161.6 + *
161.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
161.8 + *
161.9 + * The contents of this file are subject to the terms of either the GNU
161.10 + * General Public License Version 2 only ("GPL") or the Common
161.11 + * Development and Distribution License("CDDL") (collectively, the
161.12 + * "License"). You may not use this file except in compliance with the
161.13 + * License. You can obtain a copy of the License at
161.14 + * http://www.netbeans.org/cddl-gplv2.html
161.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
161.16 + * specific language governing permissions and limitations under the
161.17 + * License. When distributing the software, include this License Header
161.18 + * Notice in each file and include the License file at
161.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
161.20 + * particular file as subject to the "Classpath" exception as provided
161.21 + * by Sun in the GPL Version 2 section of the License file that
161.22 + * accompanied this code. If applicable, add the following below the
161.23 + * License Header, with the fields enclosed by brackets [] replaced by
161.24 + * your own identifying information:
161.25 + * "Portions Copyrighted [year] [name of copyright owner]"
161.26 + *
161.27 + * Contributor(s):
161.28 + *
161.29 + * The Original Software is NetBeans. The Initial Developer of the Original
161.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
161.31 + * Microsystems, Inc. All Rights Reserved.
161.32 + *
161.33 + * If you wish your version of this file to be governed by only the CDDL
161.34 + * or only the GPL Version 2, indicate your decision by adding
161.35 + * "[Contributor] elects to include this software in this distribution
161.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
161.37 + * single choice of license, a recipient has the option to distribute
161.38 + * your version of this file under either the CDDL, the GPL Version 2 or
161.39 + * to extend the choice of license to its licensees as provided above.
161.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
161.41 + * Version 2 license, then the option applies only if the new code is
161.42 + * made subject to such option by the copyright holder.
161.43 + */
161.44 +
161.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
161.46 +
161.47 +/*
161.48 + * FileCustomEditorOperator.java
161.49 + *
161.50 + * Created on June 13, 2002, 4:01 PM
161.51 + */
161.52 +
161.53 +import java.io.File;
161.54 +import javax.swing.JDialog;
161.55 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
161.56 +import org.netbeans.jemmy.operators.*;
161.57 +
161.58 +/** Class implementing all necessary methods for handling File Custom Editor
161.59 + */
161.60 +public class FileCustomEditorOperator extends NbDialogOperator {
161.61 +
161.62 + private JFileChooserOperator _fileChooser=null;
161.63 +
161.64 + /** Creates a new instance of FileCustomEditorOperator
161.65 + * @param title String title of custom editor */
161.66 + public FileCustomEditorOperator(String title) {
161.67 + super(title);
161.68 + }
161.69 +
161.70 + /** Creates a new instance of FileCustomEditorOperator
161.71 + * @param wrapper JDialogOperator wrapper for custom editor */
161.72 + public FileCustomEditorOperator(JDialogOperator wrapper) {
161.73 + super((JDialog)wrapper.getSource());
161.74 + }
161.75 +
161.76 + /** getter for JFileChooserOperator
161.77 + * @return JFileChooserOperator */
161.78 + public JFileChooserOperator fileChooser() {
161.79 + if (_fileChooser==null) {
161.80 + _fileChooser=new JFileChooserOperator(this);
161.81 + }
161.82 + return _fileChooser;
161.83 + }
161.84 +
161.85 + /** returns edited file
161.86 + * @return File */
161.87 + public File getFileValue() {
161.88 + return fileChooser().getSelectedFile();
161.89 + }
161.90 +
161.91 + /** sets edited file
161.92 + * @param file File */
161.93 + public void setFileValue(File file) {
161.94 + // Need to go from parent to file because events are not fired when
161.95 + // only setSelectedFile(file) is used.
161.96 + // select parent directory
161.97 + fileChooser().setSelectedFile(file.getParentFile());
161.98 + // go into dir
161.99 + fileChooser().enterSubDir(file.getParentFile().getName());
161.100 + // wait file is displayed
161.101 + fileChooser().waitFileDisplayed(file.getName());
161.102 + // select file
161.103 + fileChooser().selectFile(file.getName());
161.104 + }
161.105 +
161.106 + /** sets edited file
161.107 + * @param fileName String file name */
161.108 + public void setFileValue(String fileName) {
161.109 + setFileValue(new File(fileName));
161.110 + }
161.111 +
161.112 + /** Performs verification by accessing all sub-components */
161.113 + public void verify() {
161.114 + fileChooser();
161.115 + }
161.116 +}
162.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
162.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FilesystemCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
162.3 @@ -0,0 +1,286 @@
162.4 +/*
162.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
162.6 + *
162.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
162.8 + *
162.9 + * The contents of this file are subject to the terms of either the GNU
162.10 + * General Public License Version 2 only ("GPL") or the Common
162.11 + * Development and Distribution License("CDDL") (collectively, the
162.12 + * "License"). You may not use this file except in compliance with the
162.13 + * License. You can obtain a copy of the License at
162.14 + * http://www.netbeans.org/cddl-gplv2.html
162.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
162.16 + * specific language governing permissions and limitations under the
162.17 + * License. When distributing the software, include this License Header
162.18 + * Notice in each file and include the License file at
162.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
162.20 + * particular file as subject to the "Classpath" exception as provided
162.21 + * by Sun in the GPL Version 2 section of the License file that
162.22 + * accompanied this code. If applicable, add the following below the
162.23 + * License Header, with the fields enclosed by brackets [] replaced by
162.24 + * your own identifying information:
162.25 + * "Portions Copyrighted [year] [name of copyright owner]"
162.26 + *
162.27 + * Contributor(s):
162.28 + *
162.29 + * The Original Software is NetBeans. The Initial Developer of the Original
162.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
162.31 + * Microsystems, Inc. All Rights Reserved.
162.32 + *
162.33 + * If you wish your version of this file to be governed by only the CDDL
162.34 + * or only the GPL Version 2, indicate your decision by adding
162.35 + * "[Contributor] elects to include this software in this distribution
162.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
162.37 + * single choice of license, a recipient has the option to distribute
162.38 + * your version of this file under either the CDDL, the GPL Version 2 or
162.39 + * to extend the choice of license to its licensees as provided above.
162.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
162.41 + * Version 2 license, then the option applies only if the new code is
162.42 + * made subject to such option by the copyright holder.
162.43 + */
162.44 +
162.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
162.46 +
162.47 +import javax.swing.JDialog;
162.48 +import org.netbeans.jellytools.Bundle;
162.49 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
162.50 +import org.netbeans.jemmy.operators.*;
162.51 +import org.netbeans.jemmy.operators.JDialogOperator;
162.52 +
162.53 +/** Class implementing all necessary methods for handling FileSystem Custom Editor.
162.54 + * It is editor for bean org.openide.filesystems.FileSystem.
162.55 + */
162.56 +public class FilesystemCustomEditorOperator extends NbDialogOperator {
162.57 +
162.58 + /** Creates new FilesystemCustomEditorOperator that can handle it.
162.59 + * Throws TimeoutExpiredException when NbDialog not found
162.60 + * @param title title of custom editor */
162.61 + public FilesystemCustomEditorOperator(String title) {
162.62 + super(title);
162.63 + }
162.64 +
162.65 + /** Creates new FilesytemCustomEditorOperator
162.66 + * @param wrapper JDialogOperator wrapper for custom editor */
162.67 + public FilesystemCustomEditorOperator(JDialogOperator wrapper) {
162.68 + super((JDialog)wrapper.getSource());
162.69 + }
162.70 +
162.71 + private JRadioButtonOperator _rbAddLocalDirectory;
162.72 + private JTextFieldOperator _txtDirectory;
162.73 + private JButtonOperator _btBrowse;
162.74 + private JRadioButtonOperator _rbAddJARFile;
162.75 + private JTextFieldOperator _txtJARFile;
162.76 + private JButtonOperator _btBrowse2;
162.77 + private JRadioButtonOperator _rbAddOtherFileSystemType;
162.78 + private JComboBoxOperator _cboType;
162.79 +
162.80 +
162.81 + //******************************
162.82 + // Subcomponents definition part
162.83 + //******************************
162.84 +
162.85 + /** Tries to find "Add Local Directory" JRadioButton in this dialog.
162.86 + * @return JRadioButtonOperator instance
162.87 + */
162.88 + public JRadioButtonOperator rbAddLocalDirectory() {
162.89 + if (_rbAddLocalDirectory==null) {
162.90 + _rbAddLocalDirectory = new JRadioButtonOperator(this,
162.91 + Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
162.92 + "CTL_FileSystemPanel.dirRadioButton.text"));
162.93 + }
162.94 + return _rbAddLocalDirectory;
162.95 + }
162.96 +
162.97 + /** Tries to find JTextField for Directory in this dialog.
162.98 + * @return JTextFieldOperator instance
162.99 + */
162.100 + public JTextFieldOperator txtDirectory() {
162.101 + if (_txtDirectory==null) {
162.102 + _txtDirectory = new JTextFieldOperator(this);
162.103 + }
162.104 + return _txtDirectory;
162.105 + }
162.106 +
162.107 + /** Tries to find "Browse" JButton to select Directory in this dialog.
162.108 + * @return JButtonOperator instance
162.109 + */
162.110 + public JButtonOperator btBrowse() {
162.111 + if (_btBrowse==null) {
162.112 + _btBrowse = new JButtonOperator(this,
162.113 + Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
162.114 + "CTL_FileSystemPanel.browseDirButton.text"));
162.115 + }
162.116 + return _btBrowse;
162.117 + }
162.118 +
162.119 + /** Tries to find "Add JAR File" JRadioButton in this dialog.
162.120 + * @return JRadioButtonOperator instance
162.121 + */
162.122 + public JRadioButtonOperator rbAddJARFile() {
162.123 + if (_rbAddJARFile==null) {
162.124 + _rbAddJARFile = new JRadioButtonOperator(this,
162.125 + Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
162.126 + "CTL_FileSystemPanel.jarRadioButton.text"));
162.127 + }
162.128 + return _rbAddJARFile;
162.129 + }
162.130 +
162.131 + /** Tries to find JTextField for JAR File in this dialog.
162.132 + * @return JTextFieldOperator instance
162.133 + */
162.134 + public JTextFieldOperator txtJARFile() {
162.135 + if (_txtJARFile==null) {
162.136 + _txtJARFile = new JTextFieldOperator(this, 1);
162.137 + }
162.138 + return _txtJARFile;
162.139 + }
162.140 +
162.141 + /** Tries to find "Browse" JButton to select JAR File in this dialog.
162.142 + * @return JButtonOperator instance
162.143 + */
162.144 + public JButtonOperator btBrowse2() {
162.145 + if (_btBrowse2==null) {
162.146 + _btBrowse2 = new JButtonOperator(this,
162.147 + Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
162.148 + "CTL_FileSystemPanel.browseJarButton.text"),
162.149 + 1);
162.150 + }
162.151 + return _btBrowse2;
162.152 + }
162.153 +
162.154 + /** Tries to find "Add (other file system type)" JRadioButton in this dialog.
162.155 + * @return JRadioButtonOperator instance
162.156 + */
162.157 + public JRadioButtonOperator rbAddOtherFileSystemType() {
162.158 + if (_rbAddOtherFileSystemType==null) {
162.159 + _rbAddOtherFileSystemType = new JRadioButtonOperator(this,
162.160 + Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
162.161 + "CTL_FileSystemPanel.otherRadioButton.text"));
162.162 + }
162.163 + return _rbAddOtherFileSystemType;
162.164 + }
162.165 +
162.166 + /** Tries to find JComboBox for Type of filesystem in this dialog.
162.167 + * @return JComboBoxOperator instance
162.168 + */
162.169 + public JComboBoxOperator cboType() {
162.170 + if (_cboType==null) {
162.171 + _cboType = new JComboBoxOperator(this);
162.172 + }
162.173 + return _cboType;
162.174 + }
162.175 +
162.176 +
162.177 + //****************************************
162.178 + // Low-level functionality definition part
162.179 + //****************************************
162.180 +
162.181 + /** clicks on "Add Local Directory" JRadioButton.
162.182 + */
162.183 + public void addLocalDirectory() {
162.184 + rbAddLocalDirectory().push();
162.185 + }
162.186 +
162.187 + /** Gets text from Directory text field.
162.188 + * @return text from Directory text field.
162.189 + */
162.190 + public String getDirectory() {
162.191 + return txtDirectory().getText();
162.192 + }
162.193 +
162.194 + /** Sets text in Directory text field.
162.195 + * @param directory file path to directory
162.196 + */
162.197 + public void setDirectory(String directory) {
162.198 + txtDirectory().setText(directory);
162.199 + }
162.200 +
162.201 + /** Types text in Directory text field.
162.202 + * @param directory file path to directory
162.203 + */
162.204 + public void typeDirectory(String directory) {
162.205 + txtDirectory().typeText(directory);
162.206 + }
162.207 +
162.208 + /** Clicks on "Browse" JButton to set Directory. */
162.209 + public void browse() {
162.210 + btBrowse().pushNoBlock();
162.211 + }
162.212 +
162.213 + /** Clicks on "Add JAR File" JRadioButton. */
162.214 + public void addJARFile() {
162.215 + rbAddJARFile().push();
162.216 + }
162.217 +
162.218 + /** Gets text from JAR File text field.
162.219 + * @return text from JAR File text field
162.220 + */
162.221 + public String getJARFile() {
162.222 + return txtJARFile().getText();
162.223 + }
162.224 +
162.225 + /** Sets text in JAR File text field.
162.226 + * @param jarFile file path to JAR file
162.227 + */
162.228 + public void setJARFile(String jarFile) {
162.229 + txtJARFile().setText(jarFile);
162.230 + }
162.231 +
162.232 + /** Types text in JAR File text field.
162.233 + * @param jarFile file path to JAR file
162.234 + */
162.235 + public void typeJARFile(String jarFile) {
162.236 + txtJARFile().typeText(jarFile);
162.237 + }
162.238 +
162.239 + /** Clicks on "Browse" JButton to select JAR File */
162.240 + public void browse2() {
162.241 + btBrowse2().pushNoBlock();
162.242 + }
162.243 +
162.244 + /** Clicks on "Add (other file system type)" JRadioButton. */
162.245 + public void addOtherFileSystemType() {
162.246 + rbAddOtherFileSystemType().push();
162.247 + }
162.248 +
162.249 + /** Returns selected item from combo box of filesystem type.
162.250 + * @return selected item from combo box of filesystem type
162.251 + */
162.252 + public String getSelectedType() {
162.253 + return cboType().getSelectedItem().toString();
162.254 + }
162.255 +
162.256 + /** Selects item in combo box of filesystem type.
162.257 + * @param item item to be selected
162.258 + */
162.259 + public void selectType(String item) {
162.260 + cboType().selectItem(item);
162.261 + }
162.262 +
162.263 + /** Types text in combo box of filesystem type.
162.264 + * @param filesystemType type of filesystem
162.265 + */
162.266 + public void typeType(String filesystemType) {
162.267 + cboType().typeText(filesystemType);
162.268 + }
162.269 +
162.270 +
162.271 + //*****************************************
162.272 + // High-level functionality definition part
162.273 + //*****************************************
162.274 +
162.275 + /** Performs verification of this operator by accessing all its components.
162.276 + */
162.277 + public void verify() {
162.278 + rbAddLocalDirectory();
162.279 + txtDirectory();
162.280 + btBrowse();
162.281 + rbAddJARFile();
162.282 + txtJARFile();
162.283 + btBrowse2();
162.284 + rbAddOtherFileSystemType();
162.285 + cboType();
162.286 + }
162.287 +
162.288 +}
162.289 +
163.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
163.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FindEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
163.3 @@ -0,0 +1,437 @@
163.4 +/*
163.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
163.6 + *
163.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
163.8 + *
163.9 + * The contents of this file are subject to the terms of either the GNU
163.10 + * General Public License Version 2 only ("GPL") or the Common
163.11 + * Development and Distribution License("CDDL") (collectively, the
163.12 + * "License"). You may not use this file except in compliance with the
163.13 + * License. You can obtain a copy of the License at
163.14 + * http://www.netbeans.org/cddl-gplv2.html
163.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
163.16 + * specific language governing permissions and limitations under the
163.17 + * License. When distributing the software, include this License Header
163.18 + * Notice in each file and include the License file at
163.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
163.20 + * particular file as subject to the "Classpath" exception as provided
163.21 + * by Sun in the GPL Version 2 section of the License file that
163.22 + * accompanied this code. If applicable, add the following below the
163.23 + * License Header, with the fields enclosed by brackets [] replaced by
163.24 + * your own identifying information:
163.25 + * "Portions Copyrighted [year] [name of copyright owner]"
163.26 + *
163.27 + * Contributor(s):
163.28 + *
163.29 + * The Original Software is NetBeans. The Initial Developer of the Original
163.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
163.31 + * Microsystems, Inc. All Rights Reserved.
163.32 + *
163.33 + * If you wish your version of this file to be governed by only the CDDL
163.34 + * or only the GPL Version 2, indicate your decision by adding
163.35 + * "[Contributor] elects to include this software in this distribution
163.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
163.37 + * single choice of license, a recipient has the option to distribute
163.38 + * your version of this file under either the CDDL, the GPL Version 2 or
163.39 + * to extend the choice of license to its licensees as provided above.
163.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
163.41 + * Version 2 license, then the option applies only if the new code is
163.42 + * made subject to such option by the copyright holder.
163.43 + */
163.44 +
163.45 +/*
163.46 + * Find.java
163.47 + *
163.48 + * Created on 2/11/03 1:29 PM
163.49 + */
163.50 +package org.netbeans.modules.visualweb.gravy.properties.editors;
163.51 +
163.52 +import java.awt.Robot;
163.53 +import java.awt.event.InputEvent;
163.54 +import java.awt.event.KeyEvent;
163.55 +import org.netbeans.jemmy.operators.*;
163.56 +
163.57 +
163.58 +import javax.swing.JDialog;
163.59 +import org.netbeans.jellytools.Bundle;
163.60 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
163.61 +import org.netbeans.jemmy.operators.*;
163.62 +
163.63 +/** Class implementing all necessary methods for handling "Find" NbDialog.
163.64 + */
163.65 +public class FindEditorOperator extends NbDialogOperator {
163.66 +
163.67 + /** Creates new Find that can handle it.
163.68 + */
163.69 + public FindEditorOperator() {
163.70 + super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-title"));
163.71 + }
163.72 +
163.73 + /** Creates new StringArrayCustomEditorOperator
163.74 + * @param wrapper JDialogOperator wrapper for custom editor */
163.75 + public FindEditorOperator(JDialogOperator wrapper) {
163.76 + super((JDialog)wrapper.getSource());
163.77 + }
163.78 +
163.79 + private JLabelOperator _lblFindWhat;
163.80 + private JComboBoxOperator _cboFindWhat;
163.81 + public static final String ITEM_ = "";
163.82 + private JCheckBoxOperator _cbHighlightSearch;
163.83 + private JCheckBoxOperator _cbIncrementalSearch;
163.84 + private JCheckBoxOperator _cbMatchCase;
163.85 + private JCheckBoxOperator _cbSmartCase;
163.86 + private JCheckBoxOperator _cbMatchWholeWordsOnly;
163.87 + private JCheckBoxOperator _cbBackwardSearch;
163.88 + private JCheckBoxOperator _cbWrapSearch;
163.89 + private JButtonOperator _btFind;
163.90 + private JButtonOperator _btClose;
163.91 + private JButtonOperator _btHelp;
163.92 +
163.93 +
163.94 + //******************************
163.95 + // Subcomponents definition part
163.96 + //******************************
163.97 +
163.98 + /** Tries to find "Find What:" JLabel in this dialog.
163.99 + * @return JLabelOperator
163.100 + */
163.101 + public JLabelOperator lblFindWhat() {
163.102 + if (_lblFindWhat==null) {
163.103 + _lblFindWhat = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-what"));
163.104 + }
163.105 + return _lblFindWhat;
163.106 + }
163.107 +
163.108 + /** Tries to find null JComboBox in this dialog.
163.109 + * @return JComboBoxOperator
163.110 + */
163.111 + public JComboBoxOperator cboFindWhat() {
163.112 + if (_cboFindWhat==null) {
163.113 + _cboFindWhat = new JComboBoxOperator(this);
163.114 + }
163.115 + return _cboFindWhat;
163.116 + }
163.117 +
163.118 + /** Tries to find " Highlight Search" JCheckBox in this dialog.
163.119 + * @return JCheckBoxOperator
163.120 + */
163.121 + public JCheckBoxOperator cbHighlightSearch() {
163.122 + if (_cbHighlightSearch==null) {
163.123 + _cbHighlightSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-highlight-search"));
163.124 + }
163.125 + return _cbHighlightSearch;
163.126 + }
163.127 +
163.128 + /** Tries to find " Incremental Search" JCheckBox in this dialog.
163.129 + * @return JCheckBoxOperator
163.130 + */
163.131 + public JCheckBoxOperator cbIncrementalSearch() {
163.132 + if (_cbIncrementalSearch==null) {
163.133 + _cbIncrementalSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-inc-search"));
163.134 + }
163.135 + return _cbIncrementalSearch;
163.136 + }
163.137 +
163.138 + /** Tries to find " Match Case" JCheckBox in this dialog.
163.139 + * @return JCheckBoxOperator
163.140 + */
163.141 + public JCheckBoxOperator cbMatchCase() {
163.142 + if (_cbMatchCase==null) {
163.143 + _cbMatchCase = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-match-case"));
163.144 + }
163.145 + return _cbMatchCase;
163.146 + }
163.147 +
163.148 + /** Tries to find " Smart Case" JCheckBox in this dialog.
163.149 + * @return JCheckBoxOperator
163.150 + */
163.151 + public JCheckBoxOperator cbSmartCase() {
163.152 + if (_cbSmartCase==null) {
163.153 + _cbSmartCase = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-smart-case"));
163.154 + }
163.155 + return _cbSmartCase;
163.156 + }
163.157 +
163.158 + /** Tries to find " Match Whole Words Only" JCheckBox in this dialog.
163.159 + * @return JCheckBoxOperator
163.160 + */
163.161 + public JCheckBoxOperator cbMatchWholeWordsOnly() {
163.162 + if (_cbMatchWholeWordsOnly==null) {
163.163 + _cbMatchWholeWordsOnly = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-whole-words"));
163.164 + }
163.165 + return _cbMatchWholeWordsOnly;
163.166 + }
163.167 +
163.168 + /** Tries to find " Backward Search" JCheckBox in this dialog.
163.169 + * @return JCheckBoxOperator
163.170 + */
163.171 + public JCheckBoxOperator cbBackwardSearch() {
163.172 + if (_cbBackwardSearch==null) {
163.173 + _cbBackwardSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-backward-search"));
163.174 + }
163.175 + return _cbBackwardSearch;
163.176 + }
163.177 +
163.178 + /** Tries to find " Wrap Search" JCheckBox in this dialog.
163.179 + * @return JCheckBoxOperator
163.180 + */
163.181 + public JCheckBoxOperator cbWrapSearch() {
163.182 + if (_cbWrapSearch==null) {
163.183 + _cbWrapSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-wrap-search"));
163.184 + }
163.185 + return _cbWrapSearch;
163.186 + }
163.187 +
163.188 + /** Tries to find "Find" JButton in this dialog.
163.189 + * @return JButtonOperator
163.190 + */
163.191 + public JButtonOperator btFind() {
163.192 + if (_btFind==null) {
163.193 + _btFind = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-find"));
163.194 + }
163.195 + return _btFind;
163.196 + }
163.197 +
163.198 + /** Tries to find "Close" JButton in this dialog.
163.199 + * @return JButtonOperator
163.200 + */
163.201 + public JButtonOperator btClose() {
163.202 + if (_btClose==null) {
163.203 + _btClose = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-cancel"));
163.204 + }
163.205 + return _btClose;
163.206 + }
163.207 +
163.208 + /** Tries to find "Help" JButton in this dialog.
163.209 + * @return JButtonOperator
163.210 + */
163.211 + public JButtonOperator btHelp() {
163.212 + if (_btHelp==null) {
163.213 + _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
163.214 + }
163.215 + return _btHelp;
163.216 + }
163.217 +
163.218 +
163.219 + //****************************************
163.220 + // Low-level functionality definition part
163.221 + //****************************************
163.222 +
163.223 + /** returns selected item for cboFindWhat
163.224 + * @return String item
163.225 + */
163.226 + public String getSelectedFindWhat() {
163.227 + return cboFindWhat().getSelectedItem().toString();
163.228 + }
163.229 +
163.230 + /** selects item for cboFindWhat
163.231 + * @param item String item
163.232 + */
163.233 + public void selectFindWhat(String item) {
163.234 + cboFindWhat().selectItem(item);
163.235 + }
163.236 +
163.237 + /** types text for cboFindWhat
163.238 + * @param text String text
163.239 + */
163.240 + public void typeFindWhat(String text) {
163.241 + cboFindWhat().typeText(text);
163.242 + }
163.243 +
163.244 + /** checks or unchecks given JCheckBox
163.245 + * @param state boolean requested state
163.246 + */
163.247 + public void checkHighlightSearch(boolean state) {
163.248 + if (cbHighlightSearch().isSelected()!=state) {
163.249 + cbHighlightSearch().push();
163.250 + }
163.251 + }
163.252 +
163.253 + /** checks or unchecks given JCheckBox
163.254 + * @param state boolean requested state
163.255 + */
163.256 + public void checkIncrementalSearch(boolean state) {
163.257 + if (cbIncrementalSearch().isSelected()!=state) {
163.258 + cbIncrementalSearch().push();
163.259 + }
163.260 + }
163.261 +
163.262 + /** checks or unchecks given JCheckBox
163.263 + * @param state boolean requested state
163.264 + */
163.265 + public void checkMatchCase(boolean state) {
163.266 + if (cbMatchCase().isSelected()!=state) {
163.267 + cbMatchCase().push();
163.268 + }
163.269 + }
163.270 +
163.271 + /** checks or unchecks given JCheckBox
163.272 + * @param state boolean requested state
163.273 + */
163.274 + public void checkSmartCase(boolean state) {
163.275 + if (cbSmartCase().isSelected()!=state) {
163.276 + cbSmartCase().push();
163.277 + }
163.278 + }
163.279 +
163.280 + /** checks or unchecks given JCheckBox
163.281 + * @param state boolean requested state
163.282 + */
163.283 + public void checkMatchWholeWordsOnly(boolean state) {
163.284 + if (cbMatchWholeWordsOnly().isSelected()!=state) {
163.285 + cbMatchWholeWordsOnly().push();
163.286 + }
163.287 + }
163.288 +
163.289 + /** checks or unchecks given JCheckBox
163.290 + * @param state boolean requested state
163.291 + */
163.292 + public void checkBackwardSearch(boolean state) {
163.293 + if (cbBackwardSearch().isSelected()!=state) {
163.294 + cbBackwardSearch().push();
163.295 + }
163.296 + }
163.297 +
163.298 + /** checks or unchecks given JCheckBox
163.299 + * @param state boolean requested state
163.300 + */
163.301 + public void checkWrapSearch(boolean state) {
163.302 + if (cbWrapSearch().isSelected()!=state) {
163.303 + cbWrapSearch().push();
163.304 + }
163.305 + }
163.306 +
163.307 + /** checks or unchecks All JCheckBoxes
163.308 + * @param state boolean requested state
163.309 + */
163.310 + public void checkAll(boolean state) {
163.311 + checkMatchCase(state);
163.312 + checkSmartCase(state);
163.313 + checkMatchWholeWordsOnly(state);
163.314 +
163.315 + checkHighlightSearch(state);
163.316 + checkIncrementalSearch(state);
163.317 + checkBackwardSearch(state);
163.318 + checkWrapSearch(state);
163.319 + }
163.320 +
163.321 + /** clicks on "Find" JButton
163.322 + */
163.323 + public void find() {
163.324 + btFind().pushNoBlock();
163.325 + }
163.326 +
163.327 + /** clicks on "Close" JButton
163.328 + */
163.329 + public void close() {
163.330 + btClose().push();
163.331 + }
163.332 +
163.333 + /** clicks on "Help" JButton
163.334 + */
163.335 + public void help() {
163.336 + btHelp().push();
163.337 + }
163.338 +
163.339 +
163.340 + //*****************************************
163.341 + // High-level functionality definition part
163.342 + //*****************************************
163.343 +
163.344 + /** Performs verification of Find by accessing all its components.
163.345 + */
163.346 + public void verify() {
163.347 + lblFindWhat();
163.348 + cboFindWhat();
163.349 + cbHighlightSearch();
163.350 + cbIncrementalSearch();
163.351 + cbMatchCase();
163.352 + cbSmartCase();
163.353 + cbMatchWholeWordsOnly();
163.354 + cbBackwardSearch();
163.355 + cbWrapSearch();
163.356 + btFind();
163.357 + btClose();
163.358 + btHelp();
163.359 + }
163.360 +
163.361 + public static void find(String text) {
163.362 + FindEditorOperator op=new FindEditorOperator();
163.363 + op.typeFindWhat(text);
163.364 + op.find();
163.365 + }
163.366 +
163.367 + public static void find(String text,Robot robot) {
163.368 + FindEditorOperator op=new FindEditorOperator();
163.369 + robot.waitForIdle();
163.370 + java.awt.Point p=op.cboFindWhat().getLocationOnScreen();
163.371 + int x=p.x+op.cboFindWhat().getWidth()/2;
163.372 + int y=p.y+op.cboFindWhat().getHeight()/2;
163.373 + robot.mouseMove(x,y);
163.374 + robot.mousePress(InputEvent.BUTTON1_MASK);
163.375 + robot.delay(50);
163.376 + robot.mouseRelease(InputEvent.BUTTON1_MASK);
163.377 + char c;
163.378 + boolean upper;
163.379 + for (int i=0;i < text.length();i++) {
163.380 + c=text.charAt(i);
163.381 + if (Character.isUpperCase(c)) {
163.382 + upper=true;
163.383 + } else {
163.384 + upper=false;
163.385 + c=(char)(Character.toUpperCase((char)c));
163.386 + }
163.387 + if (upper) {
163.388 + robot.keyPress(KeyEvent.VK_SHIFT);
163.389 + }
163.390 + robot.keyPress((int)c);
163.391 + robot.delay(5);
163.392 + robot.keyRelease((int)c);
163.393 + robot.delay(5);
163.394 + if (upper) {
163.395 + robot.keyRelease(KeyEvent.VK_SHIFT);
163.396 + }
163.397 + }
163.398 + p=op.btFind().getLocationOnScreen();
163.399 + x=p.x+op.btFind().getWidth()/2;
163.400 + y=p.y+op.btFind().getHeight()/2;
163.401 + robot.mouseMove(x,y);
163.402 + robot.mousePress(InputEvent.BUTTON1_MASK);
163.403 + robot.delay(50);
163.404 + robot.mouseRelease(InputEvent.BUTTON1_MASK);
163.405 + robot.delay(50);
163.406 + robot.waitForIdle();
163.407 + }
163.408 +
163.409 +
163.410 + /** Performs simple test of Find
163.411 + * @param args the command line arguments
163.412 + */
163.413 + public static void main(String args[]) {
163.414 + //new Find().verify();
163.415 + System.out.println("Find verification finished.");
163.416 + try {
163.417 + Robot robot=new Robot();
163.418 + System.out.println("Start delay.");
163.419 + robot.delay(2000);
163.420 + System.out.println("Delayed");
163.421 + robot.waitForIdle();
163.422 + robot.keyPress(KeyEvent.VK_CONTROL);
163.423 + robot.delay(1);
163.424 + robot.keyPress(KeyEvent.VK_F);
163.425 + robot.delay(20);
163.426 + robot.keyRelease(KeyEvent.VK_F);
163.427 + robot.delay(1);
163.428 + robot.keyRelease(KeyEvent.VK_CONTROL);
163.429 + System.out.println("1");
163.430 + robot.waitForIdle();
163.431 + System.out.println("2");
163.432 + FindEditorOperator.find("aaa",robot);
163.433 + System.out.println("3");
163.434 +
163.435 + } catch (Exception ex) {
163.436 + ex.printStackTrace();
163.437 + }
163.438 + }
163.439 +}
163.440 +
164.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
164.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FontCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
164.3 @@ -0,0 +1,202 @@
164.4 +/*
164.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
164.6 + *
164.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
164.8 + *
164.9 + * The contents of this file are subject to the terms of either the GNU
164.10 + * General Public License Version 2 only ("GPL") or the Common
164.11 + * Development and Distribution License("CDDL") (collectively, the
164.12 + * "License"). You may not use this file except in compliance with the
164.13 + * License. You can obtain a copy of the License at
164.14 + * http://www.netbeans.org/cddl-gplv2.html
164.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
164.16 + * specific language governing permissions and limitations under the
164.17 + * License. When distributing the software, include this License Header
164.18 + * Notice in each file and include the License file at
164.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
164.20 + * particular file as subject to the "Classpath" exception as provided
164.21 + * by Sun in the GPL Version 2 section of the License file that
164.22 + * accompanied this code. If applicable, add the following below the
164.23 + * License Header, with the fields enclosed by brackets [] replaced by
164.24 + * your own identifying information:
164.25 + * "Portions Copyrighted [year] [name of copyright owner]"
164.26 + *
164.27 + * Contributor(s):
164.28 + *
164.29 + * The Original Software is NetBeans. The Initial Developer of the Original
164.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
164.31 + * Microsystems, Inc. All Rights Reserved.
164.32 + *
164.33 + * If you wish your version of this file to be governed by only the CDDL
164.34 + * or only the GPL Version 2, indicate your decision by adding
164.35 + * "[Contributor] elects to include this software in this distribution
164.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
164.37 + * single choice of license, a recipient has the option to distribute
164.38 + * your version of this file under either the CDDL, the GPL Version 2 or
164.39 + * to extend the choice of license to its licensees as provided above.
164.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
164.41 + * Version 2 license, then the option applies only if the new code is
164.42 + * made subject to such option by the copyright holder.
164.43 + */
164.44 +
164.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
164.46 +
164.47 +/*
164.48 + * FontCustomEditorOperator.java
164.49 + *
164.50 + * Created on 6/13/02 4:29 PM
164.51 + */
164.52 +
164.53 +import javax.swing.JDialog;
164.54 +import org.netbeans.jellytools.Bundle;
164.55 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
164.56 +import org.netbeans.jemmy.operators.*;
164.57 +
164.58 +/** Class implementing all necessary methods for handling Font Custom Editor
164.59 + */
164.60 +public class FontCustomEditorOperator extends NbDialogOperator {
164.61 +
164.62 + /** Creates new FontCustomEditorOperator
164.63 + * @throws TimeoutExpiredException when NbDialog not found
164.64 + * @param title String title of custom editor */
164.65 + public FontCustomEditorOperator(String title) {
164.66 + super(title);
164.67 + }
164.68 +
164.69 + /** Creates a new instance of FontCustomEditorOperator
164.70 + * @param wrapper JDialogOperator wrapper for custom editor */
164.71 + public FontCustomEditorOperator(JDialogOperator wrapper) {
164.72 + super((JDialog)wrapper.getSource());
164.73 + }
164.74 +
164.75 + private JListOperator _lstFontName;
164.76 + private JListOperator _lstFontSize;
164.77 + private JTextFieldOperator _txtFontName;
164.78 + private JTextFieldOperator _txtFontSize;
164.79 + private JTextFieldOperator _txtFontStyle;
164.80 + private JListOperator _lstFontStyle;
164.81 + /** String constant for plain font style */
164.82 + public static final String STYLE_PLAIN = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Plain");
164.83 + /** String constant for bold font style */
164.84 + public static final String STYLE_BOLD = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Bold");
164.85 + /** String constant for italic font style */
164.86 + public static final String STYLE_ITALIC = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Italic");
164.87 + /** String constant for bold italic font style */
164.88 + public static final String STYLE_BOLDITALIC = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_BoldItalic");
164.89 +
164.90 +
164.91 + /** Tries to find null JList in this dialog.
164.92 + * @throws TimeoutExpiredException when component not found
164.93 + * @return JListOperator
164.94 + */
164.95 + public JListOperator lstFontName() {
164.96 + if (_lstFontName==null) {
164.97 + _lstFontName = new JListOperator( this, 0 );
164.98 + }
164.99 + return _lstFontName;
164.100 + }
164.101 +
164.102 + /** Tries to find null JList in this dialog.
164.103 + * @throws TimeoutExpiredException when component not found
164.104 + * @return JListOperator
164.105 + */
164.106 + public JListOperator lstFontSize() {
164.107 + if (_lstFontSize==null) {
164.108 + _lstFontSize = new JListOperator( this, 2 );
164.109 + }
164.110 + return _lstFontSize;
164.111 + }
164.112 +
164.113 + /** Tries to find null JTextField in this dialog.
164.114 + * @throws TimeoutExpiredException when component not found
164.115 + * @return JTextFieldOperator
164.116 + */
164.117 + public JTextFieldOperator txtFontName() {
164.118 + if (_txtFontName==null) {
164.119 + _txtFontName = new JTextFieldOperator( this, 0 );
164.120 + }
164.121 + return _txtFontName;
164.122 + }
164.123 +
164.124 + /** Tries to find null JTextField in this dialog.
164.125 + * @throws TimeoutExpiredException when component not found
164.126 + * @return JTextFieldOperator
164.127 + */
164.128 + public JTextFieldOperator txtFontSize() {
164.129 + if (_txtFontSize==null) {
164.130 + _txtFontSize = new JTextFieldOperator( this, 2 );
164.131 + }
164.132 + return _txtFontSize;
164.133 + }
164.134 +
164.135 + /** Tries to find null JTextField in this dialog.
164.136 + * @throws TimeoutExpiredException when component not found
164.137 + * @return JTextFieldOperator
164.138 + */
164.139 + public JTextFieldOperator txtFontStyle() {
164.140 + if (_txtFontStyle==null) {
164.141 + _txtFontStyle = new JTextFieldOperator( this, 1 );
164.142 + }
164.143 + return _txtFontStyle;
164.144 + }
164.145 +
164.146 + /** Tries to find null JList in this dialog.
164.147 + * @throws TimeoutExpiredException when component not found
164.148 + * @return JListOperator
164.149 + */
164.150 + public JListOperator lstFontStyle() {
164.151 + if (_lstFontStyle==null) {
164.152 + _lstFontStyle = new JListOperator( this, 1 );
164.153 + }
164.154 + return _lstFontStyle;
164.155 + }
164.156 +
164.157 + /** returns edited font name
164.158 + * @return String font name */
164.159 + public String getFontName() {
164.160 + return txtFontName().getText();
164.161 + }
164.162 +
164.163 + /** returns edited font style
164.164 + * @return String font style */
164.165 + public String getFontStyle() {
164.166 + return txtFontStyle().getText();
164.167 + }
164.168 +
164.169 + /** returns edited font size
164.170 + * @return String font size */
164.171 + public String getFontSize() {
164.172 + return txtFontSize().getText();
164.173 + }
164.174 +
164.175 + /** tries to find and set text of txtFontName
164.176 + * @param name String font name */
164.177 + public void setFontName( String name ) {
164.178 + lstFontName().selectItem(name);
164.179 + }
164.180 +
164.181 + /** tries to find and set text of txtFontSize
164.182 + * @param size String font size */
164.183 + public void setFontSize( String size ) {
164.184 + txtFontSize().setText("");
164.185 + txtFontSize().typeText(size);
164.186 + }
164.187 +
164.188 + /** tries to find and set text of txtFontStyle
164.189 + * @param style String font style */
164.190 + public void setFontStyle( String style ) {
164.191 + lstFontStyle().selectItem(style);
164.192 + }
164.193 +
164.194 + /** Performs verification by accessing all sub-components */
164.195 + public void verify() {
164.196 + txtFontName();
164.197 + txtFontSize();
164.198 + txtFontStyle();
164.199 + lstFontName();
164.200 + lstFontSize();
164.201 + lstFontStyle();
164.202 + }
164.203 +
164.204 +}
164.205 +
165.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
165.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/GoToLineEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
165.3 @@ -0,0 +1,252 @@
165.4 +/*
165.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
165.6 + *
165.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
165.8 + *
165.9 + * The contents of this file are subject to the terms of either the GNU
165.10 + * General Public License Version 2 only ("GPL") or the Common
165.11 + * Development and Distribution License("CDDL") (collectively, the
165.12 + * "License"). You may not use this file except in compliance with the
165.13 + * License. You can obtain a copy of the License at
165.14 + * http://www.netbeans.org/cddl-gplv2.html
165.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
165.16 + * specific language governing permissions and limitations under the
165.17 + * License. When distributing the software, include this License Header
165.18 + * Notice in each file and include the License file at
165.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
165.20 + * particular file as subject to the "Classpath" exception as provided
165.21 + * by Sun in the GPL Version 2 section of the License file that
165.22 + * accompanied this code. If applicable, add the following below the
165.23 + * License Header, with the fields enclosed by brackets [] replaced by
165.24 + * your own identifying information:
165.25 + * "Portions Copyrighted [year] [name of copyright owner]"
165.26 + *
165.27 + * Contributor(s):
165.28 + *
165.29 + * The Original Software is NetBeans. The Initial Developer of the Original
165.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
165.31 + * Microsystems, Inc. All Rights Reserved.
165.32 + *
165.33 + * If you wish your version of this file to be governed by only the CDDL
165.34 + * or only the GPL Version 2, indicate your decision by adding
165.35 + * "[Contributor] elects to include this software in this distribution
165.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
165.37 + * single choice of license, a recipient has the option to distribute
165.38 + * your version of this file under either the CDDL, the GPL Version 2 or
165.39 + * to extend the choice of license to its licensees as provided above.
165.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
165.41 + * Version 2 license, then the option applies only if the new code is
165.42 + * made subject to such option by the copyright holder.
165.43 + */
165.44 +
165.45 +/*
165.46 + * GoToLine.java
165.47 + *
165.48 + * Created on 2/11/03 10:58 AM
165.49 + */
165.50 +package org.netbeans.modules.visualweb.gravy.properties.editors;
165.51 +
165.52 +import java.awt.Robot;
165.53 +import java.awt.event.InputEvent;
165.54 +import org.netbeans.jemmy.operators.*;
165.55 +
165.56 +import javax.swing.JDialog;
165.57 +import org.netbeans.jellytools.Bundle;
165.58 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
165.59 +import org.netbeans.jemmy.operators.*;
165.60 +
165.61 +
165.62 +/** Class implementing all necessary methods for handling "Go to Line" NbDialog.
165.63 + */
165.64 +public class GoToLineEditorOperator extends NbDialogOperator {
165.65 +
165.66 + /** Creates new GoToLine that can handle it.
165.67 + */
165.68 + public GoToLineEditorOperator() {
165.69 + super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-title"));
165.70 + }
165.71 +
165.72 + /** Creates new StringArrayCustomEditorOperator
165.73 + * @param wrapper JDialogOperator wrapper for custom editor */
165.74 + public GoToLineEditorOperator(JDialogOperator wrapper) {
165.75 + super((JDialog)wrapper.getSource());
165.76 + }
165.77 +
165.78 + private JLabelOperator _lblGoToLine;
165.79 + private JComboBoxOperator _cboGoToLine;
165.80 + private JButtonOperator _btGoto;
165.81 + private JButtonOperator _btClose;
165.82 + private JButtonOperator _btHelp;
165.83 +
165.84 +
165.85 + //******************************
165.86 + // Subcomponents definition part
165.87 + //******************************
165.88 +
165.89 + /** Tries to find "Go to Line:" JLabel in this dialog.
165.90 + * @return JLabelOperator
165.91 + */
165.92 + public JLabelOperator lblGoToLine() {
165.93 + if (_lblGoToLine==null) {
165.94 + _lblGoToLine = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-line"));
165.95 + }
165.96 + return _lblGoToLine;
165.97 + }
165.98 +
165.99 + /** Tries to find null JComboBox in this dialog.
165.100 + * @return JComboBoxOperator
165.101 + */
165.102 + public JComboBoxOperator cboGoToLine() {
165.103 + if (_cboGoToLine==null) {
165.104 + _cboGoToLine = new JComboBoxOperator(this);
165.105 + }
165.106 + return _cboGoToLine;
165.107 + }
165.108 +
165.109 + /** Tries to find "Goto" JButton in this dialog.
165.110 + * @return JButtonOperator
165.111 + */
165.112 + public JButtonOperator btGoto() {
165.113 + if (_btGoto==null) {
165.114 + _btGoto = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-button-goto"));
165.115 + }
165.116 + return _btGoto;
165.117 + }
165.118 +
165.119 + /** Tries to find "Close" JButton in this dialog.
165.120 + * @return JButtonOperator
165.121 + */
165.122 + public JButtonOperator btClose() {
165.123 + if (_btClose==null) {
165.124 + _btClose = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-button-cancel"));
165.125 + }
165.126 + return _btClose;
165.127 + }
165.128 +
165.129 + /** Tries to find "Help" JButton in this dialog.
165.130 + * @return JButtonOperator
165.131 + */
165.132 + public JButtonOperator btHelp() {
165.133 + if (_btHelp==null) {
165.134 + _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
165.135 + }
165.136 + return _btHelp;
165.137 + }
165.138 +
165.139 +
165.140 + //****************************************
165.141 + // Low-level functionality definition part
165.142 + //****************************************
165.143 +
165.144 + /** returns selected item for cboGoToLine
165.145 + * @return String item
165.146 + */
165.147 + public String getSelectedGoToLine() {
165.148 + return cboGoToLine().getSelectedItem().toString();
165.149 + }
165.150 +
165.151 + /** selects item for cboGoToLine
165.152 + * @param item String item
165.153 + */
165.154 + public void selectGoToLine(String item) {
165.155 + cboGoToLine().selectItem(item);
165.156 + }
165.157 +
165.158 + /** types text for cboGoToLine
165.159 + * @param text String text
165.160 + */
165.161 + public void typeGoToLine(String text) {
165.162 + cboGoToLine().typeText(text);
165.163 + }
165.164 +
165.165 + /** clicks on "Goto" JButton
165.166 + */
165.167 + public void goTo() {
165.168 + btGoto().push();
165.169 + }
165.170 +
165.171 + /** clicks on "Close" JButton
165.172 + */
165.173 + public void close() {
165.174 + btClose().push();
165.175 + }
165.176 +
165.177 + /** clicks on "Help" JButton
165.178 + */
165.179 + public void help() {
165.180 + btHelp().push();
165.181 + }
165.182 +
165.183 +
165.184 + //*****************************************
165.185 + // High-level functionality definition part
165.186 + //*****************************************
165.187 +
165.188 + /** Performs verification of GoToLine by accessing all its components.
165.189 + */
165.190 + public void verify() {
165.191 + lblGoToLine();
165.192 + cboGoToLine();
165.193 + btGoto();
165.194 + btClose();
165.195 + btHelp();
165.196 + }
165.197 +
165.198 + /**
165.199 + * Get to specified line.
165.200 + * @param line Number of line.
165.201 + */
165.202 + public static void goToLine(int line) {
165.203 + GoToLineEditorOperator op=new GoToLineEditorOperator();
165.204 + op.typeGoToLine(String.valueOf(line));
165.205 + op.goTo();
165.206 + while (op.isVisible()) {
165.207 + op.goTo();
165.208 + }
165.209 + }
165.210 +
165.211 + /**
165.212 + * Get to specified line with specified robot.
165.213 + * @param line Number of line.
165.214 + * @param robot Robot which will get line.
165.215 + */
165.216 + public static void goToLine(int line,Robot robot) {
165.217 + GoToLineEditorOperator op=new GoToLineEditorOperator();
165.218 + java.awt.Point p;
165.219 + int x,y;
165.220 +
165.221 + String s=String.valueOf(line);
165.222 + int c;
165.223 + robot.waitForIdle();
165.224 + robot.delay(200);
165.225 + for (int i=0;i < s.length();i++) {
165.226 + c=(int)s.charAt(i);
165.227 + robot.keyPress(c);
165.228 + robot.delay(50);
165.229 + robot.keyRelease(c);
165.230 + }
165.231 + p=op.btGoto().getLocationOnScreen();
165.232 + x=p.x+op.btGoto().getWidth()/2;
165.233 + y=p.y+op.btGoto().getHeight()/2;
165.234 + robot.mouseMove(x,y);
165.235 + robot.mousePress(InputEvent.BUTTON1_MASK);
165.236 + robot.delay(50);
165.237 + robot.mouseRelease(InputEvent.BUTTON1_MASK);
165.238 + robot.delay(50);
165.239 + robot.waitForIdle();
165.240 + while (op.isVisible()) {
165.241 + robot.delay(50);
165.242 + }
165.243 + }
165.244 +
165.245 + /** Performs simple test of GoToLine
165.246 + * @param args the command line arguments
165.247 + */
165.248 + public static void main(String args[]) {
165.249 + //new GoToLine().verify();
165.250 + System.out.println("GoToLine verification finished.");
165.251 + char c='0';
165.252 + System.out.println("Char c="+Integer.toHexString((int)c));
165.253 + }
165.254 +}
165.255 +
166.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
166.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/IconCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
166.3 @@ -0,0 +1,205 @@
166.4 +/*
166.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
166.6 + *
166.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
166.8 + *
166.9 + * The contents of this file are subject to the terms of either the GNU
166.10 + * General Public License Version 2 only ("GPL") or the Common
166.11 + * Development and Distribution License("CDDL") (collectively, the
166.12 + * "License"). You may not use this file except in compliance with the
166.13 + * License. You can obtain a copy of the License at
166.14 + * http://www.netbeans.org/cddl-gplv2.html
166.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
166.16 + * specific language governing permissions and limitations under the
166.17 + * License. When distributing the software, include this License Header
166.18 + * Notice in each file and include the License file at
166.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
166.20 + * particular file as subject to the "Classpath" exception as provided
166.21 + * by Sun in the GPL Version 2 section of the License file that
166.22 + * accompanied this code. If applicable, add the following below the
166.23 + * License Header, with the fields enclosed by brackets [] replaced by
166.24 + * your own identifying information:
166.25 + * "Portions Copyrighted [year] [name of copyright owner]"
166.26 + *
166.27 + * Contributor(s):
166.28 + *
166.29 + * The Original Software is NetBeans. The Initial Developer of the Original
166.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
166.31 + * Microsystems, Inc. All Rights Reserved.
166.32 + *
166.33 + * If you wish your version of this file to be governed by only the CDDL
166.34 + * or only the GPL Version 2, indicate your decision by adding
166.35 + * "[Contributor] elects to include this software in this distribution
166.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
166.37 + * single choice of license, a recipient has the option to distribute
166.38 + * your version of this file under either the CDDL, the GPL Version 2 or
166.39 + * to extend the choice of license to its licensees as provided above.
166.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
166.41 + * Version 2 license, then the option applies only if the new code is
166.42 + * made subject to such option by the copyright holder.
166.43 + */
166.44 +
166.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
166.46 +
166.47 +import javax.swing.JDialog;
166.48 +import org.netbeans.jellytools.Bundle;
166.49 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
166.50 +import org.netbeans.jemmy.operators.*;
166.51 +
166.52 +/** Class implementing all necessary methods for handling Icon Custom Editor.
166.53 + */
166.54 +public class IconCustomEditorOperator extends NbDialogOperator {
166.55 +
166.56 + /** Creates new IconCustomEditorOperator that can handle it.
166.57 + * Throws TimeoutExpiredException when NbDialog not found.
166.58 + * @param title title of custom editor
166.59 + */
166.60 + public IconCustomEditorOperator(String title) {
166.61 + super(title);
166.62 + }
166.63 +
166.64 + /** Creates new IconCustomEditorOperator.
166.65 + * @param wrapper JDialogOperator wrapper for custom editor
166.66 + */
166.67 + public IconCustomEditorOperator(JDialogOperator wrapper) {
166.68 + super((JDialog)wrapper.getSource());
166.69 + }
166.70 +
166.71 + private JRadioButtonOperator _rbURL;
166.72 + private JRadioButtonOperator _rbFile;
166.73 + private JRadioButtonOperator _rbClasspath;
166.74 + private JRadioButtonOperator _rbNoPicture;
166.75 + private JTextFieldOperator _txtName;
166.76 + private JButtonOperator _btSelectFile;
166.77 +
166.78 + //******************************
166.79 + // Subcomponents definition part
166.80 + //******************************
166.81 +
166.82 + /** Tries to find "URL" JRadioButton in this dialog.
166.83 + * @return JRadioButtonOperator instance
166.84 + */
166.85 + public JRadioButtonOperator rbURL() {
166.86 + if (_rbURL==null) {
166.87 + _rbURL = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_URL"));
166.88 + }
166.89 + return _rbURL;
166.90 + }
166.91 +
166.92 + /** Tries to find "File" JRadioButton in this dialog.
166.93 + * @return JRadioButtonOperator instance
166.94 + */
166.95 + public JRadioButtonOperator rbFile() {
166.96 + if (_rbFile==null) {
166.97 + _rbFile = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_File"));
166.98 + }
166.99 + return _rbFile;
166.100 + }
166.101 +
166.102 + /** Tries to find "Classpath" JRadioButton in this dialog.
166.103 + * @return JRadioButtonOperator instance
166.104 + */
166.105 + public JRadioButtonOperator rbClasspath() {
166.106 + if (_rbClasspath==null) {
166.107 + _rbClasspath = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_Classpath"));
166.108 + }
166.109 + return _rbClasspath;
166.110 + }
166.111 +
166.112 + /** Tries to find "No picture" JRadioButton in this dialog.
166.113 + * @return JRadioButtonOperator instance
166.114 + */
166.115 + public JRadioButtonOperator rbNoPicture() {
166.116 + if (_rbNoPicture==null) {
166.117 + _rbNoPicture = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_NoPicture"));
166.118 + }
166.119 + return _rbNoPicture;
166.120 + }
166.121 +
166.122 + /** Tries to find Name JTextField in this dialog.
166.123 + * @return JTextFieldOperator instance
166.124 + */
166.125 + public JTextFieldOperator txtName() {
166.126 + if (_txtName==null) {
166.127 + _txtName = new JTextFieldOperator(this);
166.128 + }
166.129 + return _txtName;
166.130 + }
166.131 +
166.132 + /** Tries to find "Select File" JButton in this dialog.
166.133 + * @return JButtonOperator instance
166.134 + */
166.135 + public JButtonOperator btSelectFile() {
166.136 + if (_btSelectFile==null) {
166.137 + _btSelectFile = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_ButtonSelect"));
166.138 + }
166.139 + return _btSelectFile;
166.140 + }
166.141 +
166.142 + //****************************************
166.143 + // Low-level functionality definition part
166.144 + //****************************************
166.145 +
166.146 + /** Clicks on "URL" JRadioButton. */
166.147 + public void uRL() {
166.148 + rbURL().push();
166.149 + }
166.150 +
166.151 + /** Clicks on "File" JRadioButton. */
166.152 + public void file() {
166.153 + rbFile().push();
166.154 + }
166.155 +
166.156 + /** Clicks on "Classpath" JRadioButton. */
166.157 + public void classpath() {
166.158 + rbClasspath().push();
166.159 + }
166.160 +
166.161 + /** Clicks on "No picture" JRadioButton. */
166.162 + public void noPicture() {
166.163 + rbNoPicture().push();
166.164 + }
166.165 +
166.166 + /** Gets text from Name text field.
166.167 + * @return text from Name text field.
166.168 + */
166.169 + public String getName() {
166.170 + return txtName().getText();
166.171 + }
166.172 +
166.173 + /** Sets text in Name text field.
166.174 + * @param text text to be written to Name text field
166.175 + */
166.176 + public void setName(String text) {
166.177 + txtName().setText(text);
166.178 + }
166.179 +
166.180 + /** Types text in Name text field.
166.181 + * @param text text to be written to Name text field
166.182 + */
166.183 + public void typeName(String text) {
166.184 + txtName().typeText(text);
166.185 + }
166.186 +
166.187 + /** Clicks on "Select File" JButton. */
166.188 + public void selectFile() {
166.189 + btSelectFile().pushNoBlock();
166.190 + }
166.191 +
166.192 + //*****************************************
166.193 + // High-level functionality definition part
166.194 + //*****************************************
166.195 +
166.196 + /** Performs verification of this operator by accessing all its components.
166.197 + */
166.198 + public void verify() {
166.199 + rbURL();
166.200 + rbFile();
166.201 + rbClasspath();
166.202 + rbNoPicture();
166.203 + txtName();
166.204 + btSelectFile();
166.205 + btOK();
166.206 + btCancel();
166.207 + }
166.208 +}
167.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
167.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/KeyBindingsEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
167.3 @@ -0,0 +1,414 @@
167.4 +/*
167.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
167.6 + *
167.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
167.8 + *
167.9 + * The contents of this file are subject to the terms of either the GNU
167.10 + * General Public License Version 2 only ("GPL") or the Common
167.11 + * Development and Distribution License("CDDL") (collectively, the
167.12 + * "License"). You may not use this file except in compliance with the
167.13 + * License. You can obtain a copy of the License at
167.14 + * http://www.netbeans.org/cddl-gplv2.html
167.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
167.16 + * specific language governing permissions and limitations under the
167.17 + * License. When distributing the software, include this License Header
167.18 + * Notice in each file and include the License file at
167.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
167.20 + * particular file as subject to the "Classpath" exception as provided
167.21 + * by Sun in the GPL Version 2 section of the License file that
167.22 + * accompanied this code. If applicable, add the following below the
167.23 + * License Header, with the fields enclosed by brackets [] replaced by
167.24 + * your own identifying information:
167.25 + * "Portions Copyrighted [year] [name of copyright owner]"
167.26 + *
167.27 + * Contributor(s):
167.28 + *
167.29 + * The Original Software is NetBeans. The Initial Developer of the Original
167.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
167.31 + * Microsystems, Inc. All Rights Reserved.
167.32 + *
167.33 + * If you wish your version of this file to be governed by only the CDDL
167.34 + * or only the GPL Version 2, indicate your decision by adding
167.35 + * "[Contributor] elects to include this software in this distribution
167.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
167.37 + * single choice of license, a recipient has the option to distribute
167.38 + * your version of this file under either the CDDL, the GPL Version 2 or
167.39 + * to extend the choice of license to its licensees as provided above.
167.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
167.41 + * Version 2 license, then the option applies only if the new code is
167.42 + * made subject to such option by the copyright holder.
167.43 + */
167.44 +
167.45 +/*
167.46 + * KeyBindings.java
167.47 + *
167.48 + * Created on 10/17/02 12:54 PM
167.49 + */
167.50 +package org.netbeans.modules.visualweb.gravy.properties.editors;
167.51 +
167.52 +import java.io.File;
167.53 +import java.io.FileWriter;
167.54 +import java.io.PrintWriter;
167.55 +import org.netbeans.jemmy.operators.*;
167.56 +import java.util.*;
167.57 +
167.58 +import javax.swing.ListModel;
167.59 +import org.netbeans.modules.visualweb.gravy.OptionsOperator;
167.60 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
167.61 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetTabOperator;
167.62 +import org.netbeans.modules.visualweb.gravy.properties.TextFieldProperty;
167.63 +import org.netbeans.jemmy.EventTool;
167.64 +
167.65 +import javax.swing.JDialog;
167.66 +import org.netbeans.jellytools.Bundle;
167.67 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
167.68 +import org.netbeans.jemmy.operators.*;
167.69 +
167.70 +/** Class implementing all necessary methods for handling "Key Bindings" NbDialog.
167.71 + */
167.72 +public class KeyBindingsEditorOperator extends NbDialogOperator {
167.73 +
167.74 + /** Creates new KeyBindings that can handle it.
167.75 + */
167.76 + public KeyBindingsEditorOperator() {
167.77 + super("Key Bindings");
167.78 +// java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("PROP_keyBindings"));
167.79 + }
167.80 +
167.81 + /** Creates new StringArrayCustomEditorOperator
167.82 + * @param wrapper JDialogOperator wrapper for custom editor */
167.83 + public KeyBindingsEditorOperator(JDialogOperator wrapper) {
167.84 + super((JDialog)wrapper.getSource());
167.85 + }
167.86 + private JRadioButtonOperator _rbSortByName;
167.87 + private JRadioButtonOperator _rbSortByAction;
167.88 + private JListOperator _lstActions;
167.89 + private JButtonOperator _btMetalScrollButton;
167.90 + private JButtonOperator _btMetalScrollButton2;
167.91 + private JLabelOperator _lblKeybindings;
167.92 + private JListOperator _lstKeybindings;
167.93 + private JButtonOperator _btAdd;
167.94 + private JButtonOperator _btRemove;
167.95 + private JButtonOperator _btOK;
167.96 + private JButtonOperator _btCancel;
167.97 + private JButtonOperator _btHelp;
167.98 +
167.99 +
167.100 + //******************************
167.101 + // Subcomponents definition part
167.102 + //******************************
167.103 +
167.104 + /** Tries to find " Sort by Name" JRadioButton in this dialog.
167.105 + * @return JRadioButtonOperator
167.106 + */
167.107 + public JRadioButtonOperator rbSortByName() {
167.108 + if (_rbSortByName==null) {
167.109 + _rbSortByName = new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_name_sort_button"));
167.110 + }
167.111 + return _rbSortByName;
167.112 + }
167.113 +
167.114 + /** Tries to find " Sort by Action" JRadioButton in this dialog.
167.115 + * @return JRadioButtonOperator
167.116 + */
167.117 + public JRadioButtonOperator rbSortByAction() {
167.118 + if (_rbSortByAction==null) {
167.119 + _rbSortByAction = new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_action_sort_button"));
167.120 + }
167.121 + return _rbSortByAction;
167.122 + }
167.123 +
167.124 + /** Tries to find null JList in this dialog.
167.125 + * @return JListOperator
167.126 + */
167.127 + public JListOperator lstActions() {
167.128 + if (_lstActions==null) {
167.129 + _lstActions = new JListOperator(this);
167.130 + }
167.131 + return _lstActions;
167.132 + }
167.133 +
167.134 + /** Tries to find "" MetalScrollButton in this dialog.
167.135 + * @return JButtonOperator
167.136 + */
167.137 + public JButtonOperator btMetalScrollButton() {
167.138 + if (_btMetalScrollButton==null) {
167.139 + _btMetalScrollButton = new JButtonOperator(this, "");
167.140 + }
167.141 + return _btMetalScrollButton;
167.142 + }
167.143 +
167.144 + /** Tries to find "" MetalScrollButton in this dialog.
167.145 + * @return JButtonOperator
167.146 + */
167.147 + public JButtonOperator btMetalScrollButton2() {
167.148 + if (_btMetalScrollButton2==null) {
167.149 + _btMetalScrollButton2 = new JButtonOperator(this, "", 1);
167.150 + }
167.151 + return _btMetalScrollButton2;
167.152 + }
167.153 +
167.154 + /** Tries to find "Keybindings:" JLabel in this dialog.
167.155 + * @return JLabelOperator
167.156 + */
167.157 + public JLabelOperator lblKeybindings() {
167.158 + if (_lblKeybindings==null) {
167.159 + _lblKeybindings = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Sequences"));
167.160 + }
167.161 + return _lblKeybindings;
167.162 + }
167.163 +
167.164 + /** Tries to find null JList in this dialog.
167.165 + * @return JListOperator
167.166 + */
167.167 + public JListOperator lstKeybindings() {
167.168 + if (_lstKeybindings==null) {
167.169 + _lstKeybindings = new JListOperator(this, 1);
167.170 + }
167.171 + return _lstKeybindings;
167.172 + }
167.173 +
167.174 + /** Tries to find "Add..." JButton in this dialog.
167.175 + * @return JButtonOperator
167.176 + */
167.177 + public JButtonOperator btAdd() {
167.178 + if (_btAdd==null) {
167.179 + _btAdd = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Add"));
167.180 + }
167.181 + return _btAdd;
167.182 + }
167.183 +
167.184 + /** Tries to find "Remove" JButton in this dialog.
167.185 + * @return JButtonOperator
167.186 + */
167.187 + public JButtonOperator btRemove() {
167.188 + if (_btRemove==null) {
167.189 + _btRemove = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Remove"));
167.190 + }
167.191 + return _btRemove;
167.192 + }
167.193 +
167.194 + /** Tries to find "OK" JButton in this dialog.
167.195 + * @return JButtonOperator
167.196 + */
167.197 + public JButtonOperator btOK() {
167.198 + if (_btOK==null) {
167.199 + _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
167.200 + }
167.201 + return _btOK;
167.202 + }
167.203 +
167.204 + /** Tries to find "Cancel" JButton in this dialog.
167.205 + * @return JButtonOperator
167.206 + */
167.207 + public JButtonOperator btCancel() {
167.208 + if (_btCancel==null) {
167.209 + _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.core.awt.Bundle").getString("CancelButton"));
167.210 + }
167.211 + return _btCancel;
167.212 + }
167.213 +
167.214 + /** Tries to find "Help" JButton in this dialog.
167.215 + * @return JButtonOperator
167.216 + */
167.217 + public JButtonOperator btHelp() {
167.218 + if (_btHelp==null) {
167.219 + _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
167.220 + }
167.221 + return _btHelp;
167.222 + }
167.223 +
167.224 +
167.225 + //****************************************
167.226 + // Low-level functionality definition part
167.227 + //****************************************
167.228 +
167.229 + /** clicks on " Sort by Name" JRadioButton
167.230 + */
167.231 + public void sortByName() {
167.232 + rbSortByName().push();
167.233 + }
167.234 +
167.235 + /** clicks on " Sort by Action" JRadioButton
167.236 + */
167.237 + public void sortByAction() {
167.238 + rbSortByAction().push();
167.239 + }
167.240 +
167.241 + /** clicks on "" MetalScrollButton
167.242 + */
167.243 + public void metalScrollButton() {
167.244 + btMetalScrollButton().push();
167.245 + }
167.246 +
167.247 + /** clicks on "" MetalScrollButton
167.248 + */
167.249 + public void metalScrollButton2() {
167.250 + btMetalScrollButton2().push();
167.251 + }
167.252 +
167.253 + /** clicks on "Add..." JButton
167.254 + */
167.255 + public void add() {
167.256 + btAdd().push();
167.257 + }
167.258 +
167.259 + /** clicks on "Remove" JButton
167.260 + */
167.261 + public void remove() {
167.262 + btRemove().push();
167.263 + }
167.264 +
167.265 + /** clicks on "OK" JButton
167.266 + */
167.267 + public void oK() {
167.268 + btOK().push();
167.269 + }
167.270 +
167.271 + /** clicks on "Cancel" JButton
167.272 + */
167.273 + public void cancel() {
167.274 + btCancel().push();
167.275 + }
167.276 +
167.277 + /** clicks on "Help" JButton
167.278 + */
167.279 + public void help() {
167.280 + btHelp().push();
167.281 + }
167.282 +
167.283 +
167.284 + //*****************************************
167.285 + // High-level functionality definition part
167.286 + //*****************************************
167.287 +
167.288 + /** Performs verification of KeyBindings by accessing all its components.
167.289 + */
167.290 + public void verify() {
167.291 + rbSortByName();
167.292 + rbSortByAction();
167.293 + lstActions();
167.294 + btMetalScrollButton();
167.295 + btMetalScrollButton2();
167.296 + lblKeybindings();
167.297 + lstKeybindings();
167.298 + btAdd();
167.299 + btRemove();
167.300 + btOK();
167.301 + btCancel();
167.302 + btHelp();
167.303 + }
167.304 +
167.305 + public List listActions() {
167.306 + ListModel model = lstActions().getModel();
167.307 + List ret=new Vector();
167.308 + for (int i=0;i < model.getSize();i++) {
167.309 + ret.add(model.getElementAt(i));
167.310 + }
167.311 + return ret;
167.312 + }
167.313 +
167.314 + public List listKeyBindings(String actionName) {
167.315 + JListOperator jlist=lstActions();
167.316 + jlist.selectItem(actionName);
167.317 + ListModel model = lstKeybindings().getModel();
167.318 + List ret=new Vector();
167.319 + for (int i=0;i < model.getSize();i++) {
167.320 + ret.add(model.getElementAt(i));
167.321 + }
167.322 + return ret;
167.323 + }
167.324 +
167.325 + /**
167.326 + * @param editorName
167.327 + * @return KeyBindingEditorOperator
167.328 + */
167.329 + public static KeyBindingsEditorOperator invoke(String editorName) {
167.330 + OptionsOperator options = OptionsOperator.invoke();
167.331 + options.advanced();
167.332 + try {
167.333 + Thread.sleep(1000);
167.334 + } catch (Exception ex) {
167.335 + }
167.336 + options.selectOption(ResourceBundle.getBundle("org/netbeans/core/Bundle").getString("UI/Services/Editing")+"|"+ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("OPTIONS_all")+"|" + editorName);
167.337 + //new EventTool().waitNoEvent(500);
167.338 + try {
167.339 + Thread.sleep(1000);
167.340 + } catch (Exception ex) {
167.341 + }
167.342 + PropertySheetOperator property = new PropertySheetOperator(options);
167.343 + PropertySheetTabOperator psto = new PropertySheetTabOperator(property);
167.344 + TextFieldProperty tfp=new TextFieldProperty(psto, ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("PROP_KeyBindings"));
167.345 + tfp.openEditor();
167.346 + KeyBindingsEditorOperator ret=new KeyBindingsEditorOperator();
167.347 + //options.close();
167.348 + return ret;
167.349 + }
167.350 +
167.351 + /**
167.352 + * Get list of KeyBindingsEditor's actions.
167.353 + * @param editorName Name of KeyBindingsEditor.
167.354 + * @return List of KeyBindingsEditor's actions.
167.355 + */
167.356 + public static List listActions(String editorName) {
167.357 + KeyBindingsEditorOperator instance = invoke(editorName);
167.358 + List result = instance.listActions();
167.359 + instance.oK();
167.360 + return result;
167.361 + }
167.362 +
167.363 + /**
167.364 + * Get list of KeyBindingsEditor's bindings.
167.365 + * @param editorName Name of KeyBindingsEditor.
167.366 + * @return List of KeyBindingsEditor's bindings.
167.367 + */
167.368 + public static Hashtable listAllKeyBindings(String editorName) {
167.369 + KeyBindingsEditorOperator instance = invoke(editorName);
167.370 + List result = instance.listActions();
167.371 + Hashtable ret=new Hashtable();
167.372 + for (int i=0;i < result.size();i++) {
167.373 + ret.put(result.get(i).toString(),instance.listKeyBindings(result.get(i).toString()));
167.374 + }
167.375 + instance.oK();
167.376 + return ret;
167.377 + }
167.378 +
167.379 + /** Performs simple test of KeyBindings
167.380 + * @param args the command line arguments
167.381 + */
167.382 + public static void main(String args[]) {
167.383 + //repeating test
167.384 + String[] names=new String[] {"Plain Editor","HTML Editor","Java Editor"};
167.385 + List list;
167.386 + for (int j=0;j < 20;j++) {
167.387 +
167.388 + for (int i=0;i < names.length;i++) {
167.389 + list = KeyBindingsEditorOperator.listActions(names[i]);
167.390 + System.out.println("step "+j+" output size="+list.size());
167.391 + }
167.392 + }
167.393 +
167.394 + /*String name="Java Editor";
167.395 + Hashtable table;
167.396 + table = KeyBindings.listAllKeyBindings(name);
167.397 + Object[] keys=table.keySet().toArray();
167.398 + Arrays.sort(keys);
167.399 + List list;
167.400 + try {
167.401 + File out=new File("/tmp/"+name+" actions.lst");
167.402 + PrintWriter pw=new PrintWriter(new FileWriter(out));
167.403 + for (int i=0;i < keys.length;i++) {
167.404 + pw.print(keys[i]+": ");
167.405 + list=(List)table.get(keys[i]);
167.406 + for (int j=0;j < list.size();j++) {
167.407 + pw.print(list.get(j)+" ");
167.408 + }
167.409 + pw.println();
167.410 + }
167.411 + pw.close();
167.412 + } catch (Exception ex) {
167.413 + ex.printStackTrace();
167.414 + }*/
167.415 + }
167.416 +}
167.417 +
168.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
168.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ProcessDescriptorCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
168.3 @@ -0,0 +1,172 @@
168.4 +/*
168.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
168.6 + *
168.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
168.8 + *
168.9 + * The contents of this file are subject to the terms of either the GNU
168.10 + * General Public License Version 2 only ("GPL") or the Common
168.11 + * Development and Distribution License("CDDL") (collectively, the
168.12 + * "License"). You may not use this file except in compliance with the
168.13 + * License. You can obtain a copy of the License at
168.14 + * http://www.netbeans.org/cddl-gplv2.html
168.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
168.16 + * specific language governing permissions and limitations under the
168.17 + * License. When distributing the software, include this License Header
168.18 + * Notice in each file and include the License file at
168.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
168.20 + * particular file as subject to the "Classpath" exception as provided
168.21 + * by Sun in the GPL Version 2 section of the License file that
168.22 + * accompanied this code. If applicable, add the following below the
168.23 + * License Header, with the fields enclosed by brackets [] replaced by
168.24 + * your own identifying information:
168.25 + * "Portions Copyrighted [year] [name of copyright owner]"
168.26 + *
168.27 + * Contributor(s):
168.28 + *
168.29 + * The Original Software is NetBeans. The Initial Developer of the Original
168.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
168.31 + * Microsystems, Inc. All Rights Reserved.
168.32 + *
168.33 + * If you wish your version of this file to be governed by only the CDDL
168.34 + * or only the GPL Version 2, indicate your decision by adding
168.35 + * "[Contributor] elects to include this software in this distribution
168.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
168.37 + * single choice of license, a recipient has the option to distribute
168.38 + * your version of this file under either the CDDL, the GPL Version 2 or
168.39 + * to extend the choice of license to its licensees as provided above.
168.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
168.41 + * Version 2 license, then the option applies only if the new code is
168.42 + * made subject to such option by the copyright holder.
168.43 + */
168.44 +
168.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
168.46 +
168.47 +/*
168.48 + * ProcessDescriptorCustomEditorOperator.java
168.49 + *
168.50 + * Created on 6/12/02 5:00 PM
168.51 + */
168.52 +
168.53 +import javax.swing.JDialog;
168.54 +import org.netbeans.jellytools.Bundle;
168.55 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
168.56 +import org.netbeans.jemmy.operators.*;
168.57 +
168.58 +/** Class implementing all necessary methods for handling Process Descriptor Custom
168.59 + * Editor
168.60 + */
168.61 +public class ProcessDescriptorCustomEditorOperator extends NbDialogOperator {
168.62 +
168.63 + /** Creates new ProcessDescriptorCustomEditorOperator
168.64 + * @throws TimeoutExpiredException when NbDialog not found
168.65 + * @param title String title of custom editor */
168.66 + public ProcessDescriptorCustomEditorOperator(String title) {
168.67 + super(title);
168.68 + }
168.69 +
168.70 + /** creates new ProcessDescriptorCustomEditorOperator
168.71 + * @param wrapper JDialogOperator wrapper for custom editor */
168.72 + public ProcessDescriptorCustomEditorOperator(JDialogOperator wrapper) {
168.73 + super((JDialog)wrapper.getSource());
168.74 + }
168.75 +
168.76 + private JTextAreaOperator _txtArgumentKey;
168.77 + private JButtonOperator _btSelectProcessExecutable;
168.78 + private JTextFieldOperator _txtProcess;
168.79 + private JTextAreaOperator _txtArguments;
168.80 +
168.81 + /** Tries to find null JTextArea in this dialog.
168.82 + * @throws TimeoutExpiredException when component not found
168.83 + * @return JTextAreaOperator
168.84 + */
168.85 + public JTextAreaOperator txtArgumentKey() {
168.86 + if (_txtArgumentKey==null) {
168.87 + _txtArgumentKey = new JTextAreaOperator( this, 1 );
168.88 + }
168.89 + return _txtArgumentKey;
168.90 + }
168.91 +
168.92 + /** Tries to find ... JButton in this dialog.
168.93 + * @throws TimeoutExpiredException when component not found
168.94 + * @return JButtonOperator
168.95 + */
168.96 + public JButtonOperator btSelectProcessExecutable() {
168.97 + if (_btSelectProcessExecutable==null) {
168.98 + _btSelectProcessExecutable = new JButtonOperator(this,
168.99 + Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle",
168.100 + "CTL_NbProcessDescriptorCustomEditor.jButton1.text"));
168.101 + }
168.102 + return _btSelectProcessExecutable;
168.103 + }
168.104 +
168.105 + /** Tries to find null JTextField in this dialog.
168.106 + * @throws TimeoutExpiredException when component not found
168.107 + * @return JTextFieldOperator
168.108 + */
168.109 + public JTextFieldOperator txtProcess() {
168.110 + if (_txtProcess==null) {
168.111 + _txtProcess = new JTextFieldOperator( this, 0 );
168.112 + }
168.113 + return _txtProcess;
168.114 + }
168.115 +
168.116 + /** Tries to find null JTextArea in this dialog.
168.117 + * @throws TimeoutExpiredException when component not found
168.118 + * @return JTextAreaOperator
168.119 + */
168.120 + public JTextAreaOperator txtArguments() {
168.121 + if (_txtArguments==null) {
168.122 + _txtArguments = new JTextAreaOperator( this, 0 );
168.123 + }
168.124 + return _txtArguments;
168.125 + }
168.126 +
168.127 + /** getter for Argument Key text
168.128 + * @return String text of Argument Key */
168.129 + public String getArgumentKey() {
168.130 + return txtArgumentKey().getText();
168.131 + }
168.132 +
168.133 + /** clicks on ... JButton
168.134 + * @throws TimeoutExpiredException when JButton not found
168.135 + * @return FileCustomEditorOperator */
168.136 + public FileCustomEditorOperator selectProcessExecutable() {
168.137 + btSelectProcessExecutable().pushNoBlock();
168.138 + return new FileCustomEditorOperator(Bundle.getString("org.openide.actions.Bundle", "Open"));
168.139 + }
168.140 +
168.141 + /** getter of edited process text
168.142 + * @return String process text */
168.143 + public String getProcess() {
168.144 + return txtProcess().getText();
168.145 + }
168.146 +
168.147 + /** tries to find and set text of txtProcess
168.148 + * @param text String text
168.149 + */
168.150 + public void setProcess( String text ) {
168.151 + txtProcess().setText(text);
168.152 + }
168.153 +
168.154 + /** getter of edited arguments text
168.155 + * @return String argumentstext */
168.156 + public String getArguments() {
168.157 + return txtArguments().getText();
168.158 + }
168.159 +
168.160 + /** tries to find and set text of txtArguments
168.161 + * @param text String text
168.162 + */
168.163 + public void setArguments( String text ) {
168.164 + txtArguments().setText(text);
168.165 + }
168.166 +
168.167 + /** Performs verification by accessing all sub-components */
168.168 + public void verify() {
168.169 + txtArgumentKey();
168.170 + txtArguments();
168.171 + txtProcess();
168.172 + btSelectProcessExecutable();
168.173 + }
168.174 +}
168.175 +
169.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
169.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/RectangleCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
169.3 @@ -0,0 +1,175 @@
169.4 +/*
169.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
169.6 + *
169.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
169.8 + *
169.9 + * The contents of this file are subject to the terms of either the GNU
169.10 + * General Public License Version 2 only ("GPL") or the Common
169.11 + * Development and Distribution License("CDDL") (collectively, the
169.12 + * "License"). You may not use this file except in compliance with the
169.13 + * License. You can obtain a copy of the License at
169.14 + * http://www.netbeans.org/cddl-gplv2.html
169.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
169.16 + * specific language governing permissions and limitations under the
169.17 + * License. When distributing the software, include this License Header
169.18 + * Notice in each file and include the License file at
169.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
169.20 + * particular file as subject to the "Classpath" exception as provided
169.21 + * by Sun in the GPL Version 2 section of the License file that
169.22 + * accompanied this code. If applicable, add the following below the
169.23 + * License Header, with the fields enclosed by brackets [] replaced by
169.24 + * your own identifying information:
169.25 + * "Portions Copyrighted [year] [name of copyright owner]"
169.26 + *
169.27 + * Contributor(s):
169.28 + *
169.29 + * The Original Software is NetBeans. The Initial Developer of the Original
169.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
169.31 + * Microsystems, Inc. All Rights Reserved.
169.32 + *
169.33 + * If you wish your version of this file to be governed by only the CDDL
169.34 + * or only the GPL Version 2, indicate your decision by adding
169.35 + * "[Contributor] elects to include this software in this distribution
169.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
169.37 + * single choice of license, a recipient has the option to distribute
169.38 + * your version of this file under either the CDDL, the GPL Version 2 or
169.39 + * to extend the choice of license to its licensees as provided above.
169.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
169.41 + * Version 2 license, then the option applies only if the new code is
169.42 + * made subject to such option by the copyright holder.
169.43 + */
169.44 +
169.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
169.46 +
169.47 +import javax.swing.JDialog;
169.48 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
169.49 +import org.netbeans.jemmy.JemmyException;
169.50 +import org.netbeans.jemmy.operators.*;
169.51 +
169.52 +// editor for Rectangle
169.53 +/** Class implementing all necessary methods for handling Rectangle Custom Editor
169.54 + */
169.55 +public class RectangleCustomEditorOperator extends NbDialogOperator {
169.56 +
169.57 + JTextFieldOperator _txtFieldX;
169.58 + JTextFieldOperator _txtFieldY;
169.59 + JTextFieldOperator _txtFieldWidth;
169.60 + JTextFieldOperator _txtFieldHeight;
169.61 +
169.62 + /** creates new RectangleCustomEditorOperator
169.63 + * @param title String title of custom editor */
169.64 + public RectangleCustomEditorOperator(String title) {
169.65 + super(title);
169.66 + }
169.67 +
169.68 + /** creates new RectangleCustomEditorOperator
169.69 + * @param wrapper JDialogOperator wrapper for custom editor */
169.70 + public RectangleCustomEditorOperator(JDialogOperator wrapper) {
169.71 + super((JDialog)wrapper.getSource());
169.72 + }
169.73 +
169.74 + /** setter for edited rectangle value
169.75 + * @param x int x
169.76 + * @param y int y
169.77 + * @param width int width
169.78 + * @param height int height */
169.79 + public void setRectangleValue(String x, String y, String width, String height) {
169.80 + txtFieldX().setText(x);
169.81 + txtFieldY().setText(y);
169.82 + txtFieldWidth().setText(width);
169.83 + txtFieldHeight().setText(height);
169.84 + }
169.85 +
169.86 + /** getter for edited X value
169.87 + * @return int X */
169.88 + public String getXValue() {
169.89 + return txtFieldX().getText();
169.90 + }
169.91 +
169.92 + /** setter for edited X value
169.93 + * @param value int X */
169.94 + public void setXValue(String value) {
169.95 + txtFieldX().setText(value);
169.96 + }
169.97 +
169.98 + /** getter for edited Y value
169.99 + * @return int Y */
169.100 + public String getYValue() {
169.101 + return txtFieldY().getText();
169.102 + }
169.103 +
169.104 + /** setter for edited Y value
169.105 + * @param value int Y */
169.106 + public void setYValue(String value) {
169.107 + txtFieldY().setText(value);
169.108 + }
169.109 +
169.110 + /** getter for edited Width value
169.111 + * @return int Width */
169.112 + public String getWidthValue() {
169.113 + return txtFieldWidth().getText();
169.114 + }
169.115 +
169.116 + /** setter for edited Width value
169.117 + * @param value int Width */
169.118 + public void setWidthValue(String value) {
169.119 + txtFieldWidth().setText(value);
169.120 + }
169.121 +
169.122 + /** getter for edited Height value
169.123 + * @return int Height */
169.124 + public String getHeightValue() {
169.125 + return txtFieldHeight().getText();
169.126 + }
169.127 +
169.128 + /** setter for edited Height value
169.129 + * @param value int Height */
169.130 + public void setHeightValue(String value) {
169.131 + txtFieldHeight().setText(value);
169.132 + }
169.133 +
169.134 + /** getter for X JTextFieldOperator
169.135 + * @return JTextFieldOperator */
169.136 + public JTextFieldOperator txtFieldX() {
169.137 + if(_txtFieldX==null) {
169.138 + _txtFieldX = new JTextFieldOperator(this, 0);
169.139 + }
169.140 + return _txtFieldX;
169.141 + }
169.142 +
169.143 + /** getter for Y JTextFieldOperator
169.144 + * @return JTextFieldOperator */
169.145 + public JTextFieldOperator txtFieldY() {
169.146 + if(_txtFieldY==null) {
169.147 + _txtFieldY = new JTextFieldOperator(this, 1);
169.148 + }
169.149 + return _txtFieldY;
169.150 + }
169.151 +
169.152 + /** getter for Width JTextFieldOperator
169.153 + * @return JTextFieldOperator */
169.154 + public JTextFieldOperator txtFieldWidth() {
169.155 + if(_txtFieldWidth==null) {
169.156 + _txtFieldWidth = new JTextFieldOperator(this, 2);
169.157 + }
169.158 + return _txtFieldWidth;
169.159 + }
169.160 +
169.161 + /** getter for Height JTextFieldOperator
169.162 + * @return JTextFieldOperator */
169.163 + public JTextFieldOperator txtFieldHeight() {
169.164 + if(_txtFieldHeight==null) {
169.165 + _txtFieldHeight = new JTextFieldOperator(this, 3);
169.166 + }
169.167 + return _txtFieldHeight;
169.168 + }
169.169 +
169.170 + /** Performs verification by accessing all sub-components */
169.171 + public void verify() {
169.172 + txtFieldHeight();
169.173 + txtFieldWidth();
169.174 + txtFieldX();
169.175 + txtFieldY();
169.176 + }
169.177 +
169.178 +}
170.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
170.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ServiceTypeCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
170.3 @@ -0,0 +1,146 @@
170.4 +/*
170.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
170.6 + *
170.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
170.8 + *
170.9 + * The contents of this file are subject to the terms of either the GNU
170.10 + * General Public License Version 2 only ("GPL") or the Common
170.11 + * Development and Distribution License("CDDL") (collectively, the
170.12 + * "License"). You may not use this file except in compliance with the
170.13 + * License. You can obtain a copy of the License at
170.14 + * http://www.netbeans.org/cddl-gplv2.html
170.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
170.16 + * specific language governing permissions and limitations under the
170.17 + * License. When distributing the software, include this License Header
170.18 + * Notice in each file and include the License file at
170.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
170.20 + * particular file as subject to the "Classpath" exception as provided
170.21 + * by Sun in the GPL Version 2 section of the License file that
170.22 + * accompanied this code. If applicable, add the following below the
170.23 + * License Header, with the fields enclosed by brackets [] replaced by
170.24 + * your own identifying information:
170.25 + * "Portions Copyrighted [year] [name of copyright owner]"
170.26 + *
170.27 + * Contributor(s):
170.28 + *
170.29 + * The Original Software is NetBeans. The Initial Developer of the Original
170.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
170.31 + * Microsystems, Inc. All Rights Reserved.
170.32 + *
170.33 + * If you wish your version of this file to be governed by only the CDDL
170.34 + * or only the GPL Version 2, indicate your decision by adding
170.35 + * "[Contributor] elects to include this software in this distribution
170.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
170.37 + * single choice of license, a recipient has the option to distribute
170.38 + * your version of this file under either the CDDL, the GPL Version 2 or
170.39 + * to extend the choice of license to its licensees as provided above.
170.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
170.41 + * Version 2 license, then the option applies only if the new code is
170.42 + * made subject to such option by the copyright holder.
170.43 + */
170.44 +
170.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
170.46 +
170.47 +/*
170.48 + * ServiceTypeCustomEditorOperator.java
170.49 + *
170.50 + * Created on 6/12/02 4:39 PM
170.51 + */
170.52 +
170.53 +import javax.swing.JDialog;
170.54 +import org.netbeans.jellytools.Bundle;
170.55 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
170.56 +import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
170.57 +import org.netbeans.jemmy.operators.*;
170.58 +
170.59 +/** Class implementing all necessary methods for handling Service Type Custom Editor
170.60 + */
170.61 +public class ServiceTypeCustomEditorOperator extends NbDialogOperator {
170.62 +
170.63 + /** Creates new ServiceTypeCustomEditorOperator
170.64 + * @throws TimeoutExpiredException when NbDialog not found
170.65 + * @param title String title of custom editor */
170.66 + public ServiceTypeCustomEditorOperator(String title) {
170.67 + super(title);
170.68 + }
170.69 +
170.70 + /** creates new ServiceTypeCustomEditorOperator
170.71 + * @param wrapper JDialogOperator wrapper for custom editor */
170.72 + public ServiceTypeCustomEditorOperator(JDialogOperator wrapper) {
170.73 + super((JDialog)wrapper.getSource());
170.74 + }
170.75 +
170.76 + private JButtonOperator _btDefault;
170.77 + private JSplitPaneOperator _splitPane;
170.78 + private JListOperator _lstServices;
170.79 + private PropertySheetOperator _propertySheet;
170.80 +
170.81 + /** Tries to find "Default" JButton in this dialog.
170.82 + * @throws TimeoutExpiredException when component not found
170.83 + * @return JButtonOperator
170.84 + */
170.85 + public JButtonOperator btDefault() {
170.86 + if (_btDefault==null) {
170.87 + _btDefault = new JButtonOperator( this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "LAB_DefaultServiceType"));
170.88 + }
170.89 + return _btDefault;
170.90 + }
170.91 +
170.92 + /** getter for JSplitPaneOperator
170.93 + * @return JSplitPaneOperator */
170.94 + public JSplitPaneOperator splitPane() {
170.95 + if (_splitPane==null) {
170.96 + _splitPane=new JSplitPaneOperator(this);
170.97 + }
170.98 + return _splitPane;
170.99 + }
170.100 +
170.101 + /** Tries to find null ListView$NbList in this dialog.
170.102 + * @throws TimeoutExpiredException when component not found
170.103 + * @return JListOperator
170.104 + */
170.105 + public JListOperator lstServices() {
170.106 + if (_lstServices==null) {
170.107 + _lstServices = new JListOperator(splitPane());
170.108 + }
170.109 + return _lstServices;
170.110 + }
170.111 +
170.112 + /** getter for PropertySheetOperator
170.113 + * @return PropertySheetOperator */
170.114 + public PropertySheetOperator propertySheet() {
170.115 + if (_propertySheet==null) {
170.116 + _propertySheet=new PropertySheetOperator(splitPane());
170.117 + }
170.118 + return _propertySheet;
170.119 + }
170.120 +
170.121 + /** clicks on "Default" JButton
170.122 + * @throws TimeoutExpiredException when JButton not found
170.123 + */
170.124 + public void setDefault() {
170.125 + btDefault().push();
170.126 + }
170.127 +
170.128 + /** getter for selected service type name
170.129 + * @return String service type name */
170.130 + public String getServiceTypeValue() {
170.131 + Object o=lstServices().getSelectedValue();
170.132 + if (o!=null) return o.toString();
170.133 + return null;
170.134 + }
170.135 +
170.136 + /** setter for service type name
170.137 + * @param serviceName String name of service type to be set */
170.138 + public void setServiceTypeValue(String serviceName) {
170.139 + lstServices().selectItem(serviceName);
170.140 + }
170.141 +
170.142 + /** Performs verification by accessing all sub-components */
170.143 + public void verify() {
170.144 + btDefault();
170.145 + lstServices();
170.146 + propertySheet();
170.147 + }
170.148 +}
170.149 +
171.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
171.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/StringArrayCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
171.3 @@ -0,0 +1,289 @@
171.4 +/*
171.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
171.6 + *
171.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
171.8 + *
171.9 + * The contents of this file are subject to the terms of either the GNU
171.10 + * General Public License Version 2 only ("GPL") or the Common
171.11 + * Development and Distribution License("CDDL") (collectively, the
171.12 + * "License"). You may not use this file except in compliance with the
171.13 + * License. You can obtain a copy of the License at
171.14 + * http://www.netbeans.org/cddl-gplv2.html
171.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
171.16 + * specific language governing permissions and limitations under the
171.17 + * License. When distributing the software, include this License Header
171.18 + * Notice in each file and include the License file at
171.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
171.20 + * particular file as subject to the "Classpath" exception as provided
171.21 + * by Sun in the GPL Version 2 section of the License file that
171.22 + * accompanied this code. If applicable, add the following below the
171.23 + * License Header, with the fields enclosed by brackets [] replaced by
171.24 + * your own identifying information:
171.25 + * "Portions Copyrighted [year] [name of copyright owner]"
171.26 + *
171.27 + * Contributor(s):
171.28 + *
171.29 + * The Original Software is NetBeans. The Initial Developer of the Original
171.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
171.31 + * Microsystems, Inc. All Rights Reserved.
171.32 + *
171.33 + * If you wish your version of this file to be governed by only the CDDL
171.34 + * or only the GPL Version 2, indicate your decision by adding
171.35 + * "[Contributor] elects to include this software in this distribution
171.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
171.37 + * single choice of license, a recipient has the option to distribute
171.38 + * your version of this file under either the CDDL, the GPL Version 2 or
171.39 + * to extend the choice of license to its licensees as provided above.
171.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
171.41 + * Version 2 license, then the option applies only if the new code is
171.42 + * made subject to such option by the copyright holder.
171.43 + */
171.44 +
171.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
171.46 +
171.47 +import java.util.ResourceBundle;
171.48 +import javax.swing.JDialog;
171.49 +import javax.swing.ListModel;
171.50 +import org.netbeans.jellytools.Bundle;
171.51 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
171.52 +import org.netbeans.jemmy.operators.*;
171.53 +
171.54 +/** Class implementing all necessary methods for handling String Array Custom Editor
171.55 + */
171.56 +public class StringArrayCustomEditorOperator extends NbDialogOperator {
171.57 +
171.58 + /** Creates new StringArrayCustomEditorOperator
171.59 + * @throws TimeoutExpiredException when NbDialog not found
171.60 + * @param title String title of custom editor */
171.61 + public StringArrayCustomEditorOperator(String title) {
171.62 + super(title);
171.63 + }
171.64 +
171.65 + /** Creates new StringArrayCustomEditorOperator
171.66 + * @param wrapper JDialogOperator wrapper for custom editor */
171.67 + public StringArrayCustomEditorOperator(JDialogOperator wrapper) {
171.68 + super((JDialog)wrapper.getSource());
171.69 + }
171.70 +
171.71 + private JButtonOperator _btAdd;
171.72 + private JButtonOperator _btRemove;
171.73 + private JButtonOperator _btEdit;
171.74 + private JButtonOperator _btUp;
171.75 + private JButtonOperator _btDown;
171.76 + private JListOperator _lstItemList;
171.77 + private JTextFieldOperator _txtItemText;
171.78 + private static final ResourceBundle _bundle = Bundle.getBundle("org.netbeans.beaninfo.editors.Bundle");
171.79 +
171.80 + //******************************
171.81 + // Subcomponents definition part
171.82 + //******************************
171.83 +
171.84 + /** Tries to find "Edit" JButton in this dialog.
171.85 + * @throws TimeoutExpiredException when component not found
171.86 + * @return JButtonOperator
171.87 + */
171.88 + public JButtonOperator btEdit() {
171.89 + if (_btEdit==null) {
171.90 + _btEdit = new JButtonOperator(this, _bundle.getString("CTL_Change_StringArrayCustomEditor"));
171.91 + }
171.92 + return _btEdit;
171.93 + }
171.94 +
171.95 + /** Tries to find "Down" JButton in this dialog.
171.96 + * @throws TimeoutExpiredException when component not found
171.97 + * @return JButtonOperator
171.98 + */
171.99 + public JButtonOperator btDown() {
171.100 + if (_btDown==null) {
171.101 + _btDown = new JButtonOperator(this, _bundle.getString("CTL_MoveDown"));
171.102 + }
171.103 + return _btDown;
171.104 + }
171.105 +
171.106 + /** Tries to find "Up" JButton in this dialog.
171.107 + * @throws TimeoutExpiredException when component not found
171.108 + * @return JButtonOperator
171.109 + */
171.110 + public JButtonOperator btUp() {
171.111 + if (_btUp==null) {
171.112 + _btUp = new JButtonOperator(this, _bundle.getString("CTL_MoveUp"));
171.113 + }
171.114 + return _btUp;
171.115 + }
171.116 +
171.117 + /** Tries to find "Add" JButton in this dialog.
171.118 + * @throws TimeoutExpiredException when component not found
171.119 + * @return JButtonOperator
171.120 + */
171.121 + public JButtonOperator btAdd() {
171.122 + if (_btAdd==null) {
171.123 + _btAdd = new JButtonOperator(this, _bundle.getString("CTL_Add_StringArrayCustomEditor"));
171.124 + }
171.125 + return _btAdd;
171.126 + }
171.127 +
171.128 + /** Tries to find JList in this dialog.
171.129 + * @throws TimeoutExpiredException when component not found
171.130 + * @return JListOperator
171.131 + */
171.132 + public JListOperator lstItemList() {
171.133 + if (_lstItemList==null) {
171.134 + _lstItemList = new JListOperator(this);
171.135 + }
171.136 + return _lstItemList;
171.137 + }
171.138 +
171.139 + /** Tries to find "Remove" JButton in this dialog.
171.140 + * @throws TimeoutExpiredException when component not found
171.141 + * @return JButtonOperator
171.142 + */
171.143 + public JButtonOperator btRemove() {
171.144 + if (_btRemove==null) {
171.145 + _btRemove = new JButtonOperator(this, _bundle.getString("CTL_Remove"));
171.146 + }
171.147 + return _btRemove;
171.148 + }
171.149 +
171.150 + /** Tries to find null JTextField in this dialog.
171.151 + * @throws TimeoutExpiredException when component not found
171.152 + * @return JTextFieldOperator
171.153 + */
171.154 + public JTextFieldOperator txtItemText() {
171.155 + if (_txtItemText==null) {
171.156 + _txtItemText = new JTextFieldOperator(this);
171.157 + }
171.158 + return _txtItemText;
171.159 + }
171.160 +
171.161 + /** clicks on "Edit" JButton
171.162 + * @throws TimeoutExpiredException when JButton not found
171.163 + */
171.164 + public void edit() {
171.165 + btEdit().push();
171.166 + }
171.167 +
171.168 + /** clicks on "Down" JButton
171.169 + * @throws TimeoutExpiredException when JButton not found
171.170 + */
171.171 + public void down() {
171.172 + btDown().push();
171.173 + }
171.174 +
171.175 + /** clicks on "Up" JButton
171.176 + * @throws TimeoutExpiredException when JButton not found
171.177 + */
171.178 + public void up() {
171.179 + btUp().push();
171.180 + }
171.181 +
171.182 + /** clicks on "Add" JButton
171.183 + * @throws TimeoutExpiredException when JButton not found
171.184 + */
171.185 + public void add() {
171.186 + btAdd().push();
171.187 + }
171.188 +
171.189 + /** clicks on "Remove" JButton
171.190 + * @throws TimeoutExpiredException when JButton not found
171.191 + */
171.192 + public void remove() {
171.193 + btRemove().push();
171.194 + }
171.195 +
171.196 + /** Gets text from text field.
171.197 + * @return String edited item text */
171.198 + public String getItemText() {
171.199 + return txtItemText().getText();
171.200 + }
171.201 +
171.202 + /** tries to find and set text of txtItem
171.203 + * @param text String text
171.204 + */
171.205 + public void setItemText( String text ) {
171.206 + txtItemText().clearText();
171.207 + txtItemText().typeText(text);
171.208 + }
171.209 +
171.210 +
171.211 + /** getter for array of Strings
171.212 + * @return String[] array of strings from custom editor */
171.213 + public String[] getStringArrayValue() {
171.214 + ListModel lm=lstItemList().getModel();
171.215 + String value[]=new String[lm.getSize()];
171.216 + for (int i=0; i<lm.getSize(); i++) {
171.217 + value[i]=lm.getElementAt(i).toString();
171.218 + }
171.219 + return value;
171.220 + }
171.221 +
171.222 + /** adds String to the edited array
171.223 + * @param value String value to be added */
171.224 + public void add(String value) {
171.225 + setItemText(value);
171.226 + add();
171.227 + }
171.228 +
171.229 + /** removes String from array
171.230 + * @param value String value to be removed */
171.231 + public void remove(String value) {
171.232 + lstItemList().selectItem(value);
171.233 + remove();
171.234 + }
171.235 +
171.236 + /** removes all Strings from array */
171.237 + public void removeAll() {
171.238 + while (lstItemList().getModel().getSize()>0) {
171.239 + lstItemList().selectItem(0);
171.240 + remove();
171.241 + }
171.242 + }
171.243 +
171.244 + /** Replaces oldValue by newValue. It selects oldValue item in the list,
171.245 + * types newValue into text field and pushes Edit button.
171.246 + * @param oldValue value from list to be replaced
171.247 + * @param newValue new value
171.248 + */
171.249 + public void edit(String oldValue, String newValue) {
171.250 + lstItemList().selectItem(oldValue);
171.251 + setItemText(newValue);
171.252 + edit();
171.253 + }
171.254 +
171.255 + /** Moves given item one position up. It select value item and pushes
171.256 + * Up button. It fails, if item is the topmost and Up button is disabled.
171.257 + * @param value item to be moved up
171.258 + */
171.259 + public void up(String value) {
171.260 + lstItemList().selectItem(value);
171.261 + up();
171.262 + }
171.263 +
171.264 + /** Moves given item one position down. It select value item and pushes
171.265 + * Down button. It fails, if item is the bottommost and Down button is disabled.
171.266 + * @param value item to be moved down
171.267 + */
171.268 + public void down(String value) {
171.269 + lstItemList().selectItem(value);
171.270 + down();
171.271 + }
171.272 +
171.273 + /** setter for String array
171.274 + * @param value String[] array os Strings to be set */
171.275 + public void setStringArrayValue(String[] value) {
171.276 + removeAll();
171.277 + for (int i=0; i<value.length; i++)
171.278 + add(value[i]);
171.279 + }
171.280 +
171.281 + /** Performs verification by accessing all sub-components */
171.282 + public void verify() {
171.283 + btAdd();
171.284 + btRemove();
171.285 + btEdit();
171.286 + btUp();
171.287 + btDown();
171.288 + lstItemList();
171.289 + txtItemText();
171.290 + }
171.291 +}
171.292 +
172.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
172.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/StringCustomEditorOperator.java Thu Jul 10 04:32:50 2008 -0700
172.3 @@ -0,0 +1,92 @@
172.4 +/*
172.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
172.6 + *
172.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
172.8 + *
172.9 + * The contents of this file are subject to the terms of either the GNU
172.10 + * General Public License Version 2 only ("GPL") or the Common
172.11 + * Development and Distribution License("CDDL") (collectively, the
172.12 + * "License"). You may not use this file except in compliance with the
172.13 + * License. You can obtain a copy of the License at
172.14 + * http://www.netbeans.org/cddl-gplv2.html
172.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
172.16 + * specific language governing permissions and limitations under the
172.17 + * License. When distributing the software, include this License Header
172.18 + * Notice in each file and include the License file at
172.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
172.20 + * particular file as subject to the "Classpath" exception as provided
172.21 + * by Sun in the GPL Version 2 section of the License file that
172.22 + * accompanied this code. If applicable, add the following below the
172.23 + * License Header, with the fields enclosed by brackets [] replaced by
172.24 + * your own identifying information:
172.25 + * "Portions Copyrighted [year] [name of copyright owner]"
172.26 + *
172.27 + * Contributor(s):
172.28 + *
172.29 + * The Original Software is NetBeans. The Initial Developer of the Original
172.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
172.31 + * Microsystems, Inc. All Rights Reserved.
172.32 + *
172.33 + * If you wish your version of this file to be governed by only the CDDL
172.34 + * or only the GPL Version 2, indicate your decision by adding
172.35 + * "[Contributor] elects to include this software in this distribution
172.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
172.37 + * single choice of license, a recipient has the option to distribute
172.38 + * your version of this file under either the CDDL, the GPL Version 2 or
172.39 + * to extend the choice of license to its licensees as provided above.
172.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
172.41 + * Version 2 license, then the option applies only if the new code is
172.42 + * made subject to such option by the copyright holder.
172.43 + */
172.44 +
172.45 +package org.netbeans.modules.visualweb.gravy.properties.editors;
172.46 +
172.47 +import javax.swing.JDialog;
172.48 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
172.49 +import org.netbeans.jemmy.operators.*;
172.50 +
172.51 +/** Class implementing all necessary methods for handling String Custom Editor
172.52 + */
172.53 +public class StringCustomEditorOperator extends NbDialogOperator {
172.54 +
172.55 + private JTextAreaOperator _txtArea;
172.56 +
172.57 + /** Creates new StringCustomEditorOperator
172.58 + * @param title String title of custom editor */
172.59 + public StringCustomEditorOperator(String title) {
172.60 + super(title);
172.61 + }
172.62 +
172.63 + /** Creates new StringCustomEditorOperator
172.64 + * @param wrapper JDialogOperator wrapper for custom editor */
172.65 + public StringCustomEditorOperator(JDialogOperator wrapper) {
172.66 + super((JDialog)wrapper.getSource());
172.67 + }
172.68 +
172.69 + /** setter for edited String value
172.70 + * @return String */
172.71 + public String getStringValue() {
172.72 + return txtArea().getText();
172.73 + }
172.74 +
172.75 + /** getter for edited String value
172.76 + * @param text String */
172.77 + public void setStringValue(String text) {
172.78 + txtArea().setText(text);
172.79 + }
172.80 +
172.81 + /** getter for JTextFieldOperator with edited text
172.82 + * @return JTextFieldOperator */
172.83 + public JTextAreaOperator txtArea() {
172.84 + if(_txtArea==null) {
172.85 + _txtArea = new JTextAreaOperator(this);
172.86 + }
172.87 + return _txtArea;
172.88 + }
172.89 +
172.90 + /** Performs verification by accessing all sub-components */
172.91 + public void verify() {
172.92 + txtArea();
172.93 + }
172.94 +
172.95 +}
173.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
173.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/search/SearchPanelOperator.java Thu Jul 10 04:32:50 2008 -0700
173.3 @@ -0,0 +1,200 @@
173.4 +/*
173.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
173.6 + *
173.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
173.8 + *
173.9 + * The contents of this file are subject to the terms of either the GNU
173.10 + * General Public License Version 2 only ("GPL") or the Common
173.11 + * Development and Distribution License("CDDL") (collectively, the
173.12 + * "License"). You may not use this file except in compliance with the
173.13 + * License. You can obtain a copy of the License at
173.14 + * http://www.netbeans.org/cddl-gplv2.html
173.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
173.16 + * specific language governing permissions and limitations under the
173.17 + * License. When distributing the software, include this License Header
173.18 + * Notice in each file and include the License file at
173.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
173.20 + * particular file as subject to the "Classpath" exception as provided
173.21 + * by Sun in the GPL Version 2 section of the License file that
173.22 + * accompanied this code. If applicable, add the following below the
173.23 + * License Header, with the fields enclosed by brackets [] replaced by
173.24 + * your own identifying information:
173.25 + * "Portions Copyrighted [year] [name of copyright owner]"
173.26 + *
173.27 + * Contributor(s):
173.28 + *
173.29 + * The Original Software is NetBeans. The Initial Developer of the Original
173.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
173.31 + * Microsystems, Inc. All Rights Reserved.
173.32 + *
173.33 + * If you wish your version of this file to be governed by only the CDDL
173.34 + * or only the GPL Version 2, indicate your decision by adding
173.35 + * "[Contributor] elects to include this software in this distribution
173.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
173.37 + * single choice of license, a recipient has the option to distribute
173.38 + * your version of this file under either the CDDL, the GPL Version 2 or
173.39 + * to extend the choice of license to its licensees as provided above.
173.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
173.41 + * Version 2 license, then the option applies only if the new code is
173.42 + * made subject to such option by the copyright holder.
173.43 + */
173.44 +
173.45 +package org.netbeans.modules.visualweb.gravy.search;
173.46 +
173.47 +import java.awt.Point;
173.48 +
173.49 +import org.netbeans.modules.visualweb.gravy.Util;
173.50 +
173.51 +import org.netbeans.modules.search.SearchPanel;
173.52 +
173.53 +import java.awt.Component;
173.54 +
173.55 +import org.netbeans.jellytools.Bundle;
173.56 +
173.57 +import org.netbeans.jemmy.ComponentChooser;
173.58 +
173.59 +import org.netbeans.jemmy.operators.JComboBoxOperator;
173.60 +import org.netbeans.jemmy.operators.ContainerOperator;
173.61 +import org.netbeans.jemmy.operators.JButtonOperator;
173.62 +import org.netbeans.jemmy.operators.JCheckBoxOperator;
173.63 +import org.netbeans.jemmy.operators.JDialogOperator;
173.64 +import org.netbeans.jemmy.operators.JTabbedPaneOperator;
173.65 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
173.66 +import org.netbeans.jemmy.operators.JRadioButtonOperator;
173.67 +import org.netbeans.jemmy.operators.JTextFieldOperator;
173.68 +import org.netbeans.jemmy.operators.Operator;
173.69 +
173.70 +
173.71 +/**
173.72 + * SearchPanelOperator class
173.73 + * @author <a href="mailto:sva@sparc.spb.su">Vladimir Strigun</a>
173.74 + */
173.75 +public class SearchPanelOperator extends JDialogOperator {
173.76 +
173.77 + JTabbedPaneOperator tabbedPane;
173.78 +
173.79 + public SearchPanelOperator() {
173.80 + super("Find In FIles");
173.81 + }
173.82 +
173.83 +
173.84 + public void switchToObjectNameTab(){
173.85 + switchToTab(1);
173.86 + }
173.87 +
173.88 + public void switchToTypeTab(){
173.89 + switchToTab(2);
173.90 + }
173.91 +
173.92 + public Component switchToTab(int index){
173.93 + SearchPanelOperator searchPanel = new SearchPanelOperator();
173.94 + if(tabbedPane == null ) this.tabbedPane = new JTabbedPaneOperator(searchPanel, 0);
173.95 + return tabbedPane.selectPage(index);
173.96 + }
173.97 +
173.98 + public void close(){
173.99 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_CANCEL"));
173.100 + }
173.101 +
173.102 + public void search(){
173.103 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SEARCH"));
173.104 + }
173.105 +
173.106 + public void help(){
173.107 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_HELP"));
173.108 + }
173.109 +
173.110 + private void pushButton(String title){
173.111 + (new JButtonOperator(new SearchPanelOperator(), title)).push();
173.112 + }
173.113 +
173.114 + public static class SearchPanelChooser implements ComponentChooser {
173.115 + public SearchPanelChooser() {
173.116 + }
173.117 + public boolean checkComponent(Component comp) {
173.118 + return(comp instanceof org.netbeans.modules.search.SearchPanel);
173.119 + }
173.120 + public String getDescription() {
173.121 + return(SearchPanel.class.getName());
173.122 + }
173.123 + }
173.124 +
173.125 + public void setDateBetween(int dateNum, String date){
173.126 + switchToTab(3);
173.127 + (new JTextFieldOperator(this, dateNum)).typeText(date);
173.128 + }
173.129 +
173.130 + public void setWithinDate(String date){
173.131 + switchToTab(3);
173.132 + (new JTextFieldOperator(this, 0)).typeText(date);
173.133 + }
173.134 +
173.135 + public void pressCriterion(int tabNumber, boolean check){
173.136 + switchToTab(tabNumber);
173.137 + (new JCheckBoxOperator(this, 2)).changeSelection(check);
173.138 + }
173.139 +
173.140 + public void setSubstringText(int tabNumber, String text){
173.141 + switchToTab(tabNumber);
173.142 + (new JTextFieldOperator(this, 0)).typeText(text);
173.143 + }
173.144 +
173.145 + public String getSubstringText(int tabNumber){
173.146 + switchToTab(tabNumber);
173.147 + return (new JTextFieldOperator(this, 0)).getText();
173.148 + }
173.149 +
173.150 + public void setRegularExpression(int tabNumber, String text){
173.151 + switchToTab(tabNumber);
173.152 + (new JTextFieldOperator(this, 1)).typeText(text);
173.153 + }
173.154 +
173.155 + public void matchCase(int tabNumber, boolean matchCase){
173.156 + Component tab = switchToTab(tabNumber);
173.157 + (new JRadioButtonOperator(this, 0)).doClick();
173.158 + (new JCheckBoxOperator(this, 0)).changeSelection(matchCase);
173.159 + }
173.160 +
173.161 + public boolean getCaseState(int tabNumber){
173.162 + Component tab = switchToTab(tabNumber);
173.163 + (new JRadioButtonOperator(this, 0)).doClick();
173.164 + return (new JCheckBoxOperator(this, 0)).isSelected();
173.165 + }
173.166 +
173.167 + public void matchWholeWords(int tabNumber, boolean wholeWords){
173.168 + Component tab = switchToTab(tabNumber);
173.169 + (new JRadioButtonOperator(this, 0)).doClick();
173.170 + (new JCheckBoxOperator(this, 1)).changeSelection(wholeWords);
173.171 + }
173.172 +
173.173 +
173.174 + public boolean getWholeWordsState(int tabNumber){
173.175 + Component tab = switchToTab(tabNumber);
173.176 + (new JRadioButtonOperator(this, 0)).doClick();
173.177 + return (new JCheckBoxOperator(this, 1)).isSelected();
173.178 + }
173.179 +
173.180 + public boolean getCriterionState(int tabNumber){
173.181 + Component tab = switchToTab(tabNumber);
173.182 + (new JRadioButtonOperator(this, 0)).doClick();
173.183 + return (new JCheckBoxOperator(this, 2)).isSelected();
173.184 + }
173.185 +
173.186 + public void saveSettings(int tabNumber, String name){
173.187 + Component tab = switchToTab(tabNumber);
173.188 + (new JButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SAVE_AS"))).push();
173.189 + JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_LABEL_SAVE_CRITERION"));
173.190 + (new JTextFieldOperator(dialog)).typeText(name);
173.191 + (new JButtonOperator(dialog, "OK")).push();
173.192 + }
173.193 +
173.194 + public void restoreSettings(int tabNumber, String name){
173.195 + Component tab = switchToTab(tabNumber);
173.196 + (new JButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_RESTORE"))).push();
173.197 + JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_LABEL_RESTORE_CRITERION"));
173.198 + (new JComboBoxOperator(dialog)).selectItem(name);
173.199 + (new JButtonOperator(dialog, "OK")).push();
173.200 + }
173.201 +
173.202 +}
173.203 +
174.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
174.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/search/SearchResultsOperator.java Thu Jul 10 04:32:50 2008 -0700
174.3 @@ -0,0 +1,162 @@
174.4 +/*
174.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
174.6 + *
174.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
174.8 + *
174.9 + * The contents of this file are subject to the terms of either the GNU
174.10 + * General Public License Version 2 only ("GPL") or the Common
174.11 + * Development and Distribution License("CDDL") (collectively, the
174.12 + * "License"). You may not use this file except in compliance with the
174.13 + * License. You can obtain a copy of the License at
174.14 + * http://www.netbeans.org/cddl-gplv2.html
174.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
174.16 + * specific language governing permissions and limitations under the
174.17 + * License. When distributing the software, include this License Header
174.18 + * Notice in each file and include the License file at
174.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
174.20 + * particular file as subject to the "Classpath" exception as provided
174.21 + * by Sun in the GPL Version 2 section of the License file that
174.22 + * accompanied this code. If applicable, add the following below the
174.23 + * License Header, with the fields enclosed by brackets [] replaced by
174.24 + * your own identifying information:
174.25 + * "Portions Copyrighted [year] [name of copyright owner]"
174.26 + *
174.27 + * Contributor(s):
174.28 + *
174.29 + * The Original Software is NetBeans. The Initial Developer of the Original
174.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
174.31 + * Microsystems, Inc. All Rights Reserved.
174.32 + *
174.33 + * If you wish your version of this file to be governed by only the CDDL
174.34 + * or only the GPL Version 2, indicate your decision by adding
174.35 + * "[Contributor] elects to include this software in this distribution
174.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
174.37 + * single choice of license, a recipient has the option to distribute
174.38 + * your version of this file under either the CDDL, the GPL Version 2 or
174.39 + * to extend the choice of license to its licensees as provided above.
174.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
174.41 + * Version 2 license, then the option applies only if the new code is
174.42 + * made subject to such option by the copyright holder.
174.43 + */
174.44 +
174.45 +package org.netbeans.modules.visualweb.gravy.search;
174.46 +
174.47 +import java.awt.Point;
174.48 +
174.49 +import org.netbeans.modules.visualweb.gravy.Util;
174.50 +
174.51 +//import org.netbeans.modules.search.ResultView;
174.52 +import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
174.53 +
174.54 +import java.awt.Component;
174.55 +import org.netbeans.jellytools.Bundle;
174.56 +
174.57 +import org.netbeans.jemmy.ComponentChooser;
174.58 +
174.59 +import org.netbeans.jemmy.operators.ContainerOperator;
174.60 +import org.netbeans.jemmy.operators.JComponentOperator;
174.61 +import org.netbeans.jemmy.operators.JButtonOperator;
174.62 +import org.netbeans.jemmy.operators.JPopupMenuOperator;
174.63 +import org.netbeans.jemmy.operators.JRadioButtonOperator;
174.64 +import org.netbeans.jemmy.operators.JTreeOperator;
174.65 +import org.netbeans.jemmy.operators.Operator;
174.66 +
174.67 +import javax.swing.*;
174.68 +
174.69 +/**
174.70 + * SearchResultsOperator class
174.71 + * @author <a href="mailto:sva@sparc.spb.su">Vladimir Strigun</a>
174.72 + */
174.73 +public class SearchResultsOperator extends TopComponentOperator{
174.74 +
174.75 + JTreeOperator tree;
174.76 +
174.77 + public SearchResultsOperator(ContainerOperator cont) {
174.78 + super(cont, new SearchResultsChooser());
174.79 + }
174.80 + public SearchResultsOperator() {
174.81 + //this(Util.getMainTab());
174.82 + this(Util.getMainWindow());
174.83 + }
174.84 +
174.85 + public static class SearchResultsChooser implements ComponentChooser {
174.86 + public SearchResultsChooser() {
174.87 + }
174.88 + public boolean checkComponent(Component comp) {
174.89 + Class curClass = comp.getClass();
174.90 + while(curClass != null) {
174.91 + if(curClass.getName().equals("org.netbeans.modules.search.ResultView")) {
174.92 + return(true);
174.93 + }
174.94 + curClass = curClass.getSuperclass();
174.95 + }
174.96 + return(false);
174.97 + }
174.98 + public String getDescription() {
174.99 + return("org.netbeans.modules.search.ResultView");
174.100 + }
174.101 + }
174.102 +
174.103 + public JTreeOperator getTree() {
174.104 + if(tree == null) {
174.105 + makeComponentVisible();
174.106 + tree = new JTreeOperator(this);
174.107 + }
174.108 + return(tree);
174.109 + }
174.110 +
174.111 + public void close(){
174.112 + //pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_CANCEL"));
174.113 + super.close();
174.114 + }
174.115 +
174.116 + public void pushButton(String title){
174.117 + Util.getMainTab().setSelectedIndex(Util.getMainTab().findPage("Search Results"));
174.118 + (new JButtonOperator(this, title)).push();
174.119 + }
174.120 +
174.121 + public void help(){
174.122 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_HELP"));
174.123 + }
174.124 +
174.125 + public void modifySearch(){
174.126 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_CUSTOMIZE"));
174.127 + }
174.128 +
174.129 + public void showAllDetails(){
174.130 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_FILL"));
174.131 + }
174.132 +
174.133 + public void stopSearch(){
174.134 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_STOP"));
174.135 + }
174.136 +
174.137 + public void showInExplorer(){
174.138 + pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SHOW"));
174.139 + }
174.140 +
174.141 + public void sortByName(){
174.142 + (new JRadioButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SORT"))).doClick();
174.143 + }
174.144 +
174.145 + public void sortByDefault(){
174.146 + (new JRadioButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_UNSORT"))).doClick();
174.147 + }
174.148 +
174.149 + public void selectFoundedFile(String node){
174.150 + JTreeOperator resTree = getTree();
174.151 + tree.selectPath(tree.findPath(node));
174.152 + }
174.153 +
174.154 + public String getFoundedFileName(int index){
174.155 + JTreeOperator resTree = getTree();
174.156 + return (tree.getChild(tree.getRoot(), index)).toString();
174.157 + }
174.158 +
174.159 + public int getFoundedFilesCount(){
174.160 + JTreeOperator resTree = getTree();
174.161 + return tree.getChildCount(tree.getRoot());
174.162 + }
174.163 +
174.164 +}
174.165 +
175.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
175.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/toolbox/PaletteContainerOperator.java Thu Jul 10 04:32:50 2008 -0700
175.3 @@ -0,0 +1,395 @@
175.4 +/*
175.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
175.6 + *
175.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
175.8 + *
175.9 + * The contents of this file are subject to the terms of either the GNU
175.10 + * General Public License Version 2 only ("GPL") or the Common
175.11 + * Development and Distribution License("CDDL") (collectively, the
175.12 + * "License"). You may not use this file except in compliance with the
175.13 + * License. You can obtain a copy of the License at
175.14 + * http://www.netbeans.org/cddl-gplv2.html
175.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
175.16 + * specific language governing permissions and limitations under the
175.17 + * License. When distributing the software, include this License Header
175.18 + * Notice in each file and include the License file at
175.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
175.20 + * particular file as subject to the "Classpath" exception as provided
175.21 + * by Sun in the GPL Version 2 section of the License file that
175.22 + * accompanied this code. If applicable, add the following below the
175.23 + * License Header, with the fields enclosed by brackets [] replaced by
175.24 + * your own identifying information:
175.25 + * "Portions Copyrighted [year] [name of copyright owner]"
175.26 + *
175.27 + * Contributor(s):
175.28 + *
175.29 + * The Original Software is NetBeans. The Initial Developer of the Original
175.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
175.31 + * Microsystems, Inc. All Rights Reserved.
175.32 + *
175.33 + * If you wish your version of this file to be governed by only the CDDL
175.34 + * or only the GPL Version 2, indicate your decision by adding
175.35 + * "[Contributor] elects to include this software in this distribution
175.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
175.37 + * single choice of license, a recipient has the option to distribute
175.38 + * your version of this file under either the CDDL, the GPL Version 2 or
175.39 + * to extend the choice of license to its licensees as provided above.
175.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
175.41 + * Version 2 license, then the option applies only if the new code is
175.42 + * made subject to such option by the copyright holder.
175.43 + */
175.44 +
175.45 +package org.netbeans.modules.visualweb.gravy.toolbox;
175.46 +
175.47 +import org.netbeans.modules.visualweb.gravy.*;
175.48 +import org.netbeans.modules.visualweb.gravy.DNDDriver;
175.49 +import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
175.50 +//import com.sun.rave.toolbox.PaletteContainer;
175.51 +import org.netbeans.modules.visualweb.gravy.actions.PropertiesAction;
175.52 +import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
175.53 +import java.awt.Component;
175.54 +import java.awt.Container;
175.55 +import java.awt.Point;
175.56 +import java.awt.Rectangle;
175.57 +import java.awt.event.*;
175.58 +import java.beans.*;
175.59 +import java.util.StringTokenizer;
175.60 +import org.netbeans.jemmy.ComponentChooser;
175.61 +import org.netbeans.jemmy.QueueTool;
175.62 +import org.netbeans.jemmy.drivers.input.MouseRobotDriver;
175.63 +import org.netbeans.jemmy.operators.*;
175.64 +import org.netbeans.jellytools.Bundle;
175.65 +import javax.swing.*;
175.66 +import org.netbeans.jemmy.Timeout;
175.67 +
175.68 +/**
175.69 + *
175.70 + * @author Alexandre (Shura) Iline (alexandre.iline@sun.com)
175.71 + */
175.72 +public class PaletteContainerOperator extends ContainerOperator {
175.73 +
175.74 + private static final String PALETTE_TITLE = "Palette";
175.75 + JListOperator theTree = null;
175.76 + JCheckBoxOperator categoryButton = null;
175.77 + private String name;
175.78 + static String defaultPaletteCategory = "Basic";
175.79 +
175.80 + private PaletteContainerOperator(ContainerOperator cont, String name) {
175.81 + super(cont, new PaletteContainerChooser(name));
175.82 + this.name=name;
175.83 + }
175.84 +
175.85 + /**
175.86 + * @param name of the section in Palette
175.87 + * @return Container containing CheckBox with section name and JList of the components
175.88 + */
175.89 + private static Container findPaletteContainer(String name) {
175.90 + return new JCheckBoxOperator(new org.netbeans.jellytools.TopComponentOperator(PALETTE_TITLE), name).getParent();
175.91 + }
175.92 +
175.93 + public PaletteContainerOperator(String name) {
175.94 + super(findPaletteContainer(name));
175.95 + this.name=name;
175.96 + }
175.97 +
175.98 + public static String getDefaultPaletteCategory() {
175.99 + return defaultPaletteCategory;
175.100 + }
175.101 +
175.102 + public void showComponents() {
175.103 + if (categoryButton == null) {
175.104 + categoryButton = new JCheckBoxOperator(this, name);
175.105 + }
175.106 + categoryButton.changeSelection(true);
175.107 + }
175.108 +
175.109 + public void hideComponents() {
175.110 + if (categoryButton == null) {
175.111 + categoryButton = new JCheckBoxOperator(this, name);
175.112 + }
175.113 + categoryButton.changeSelection(false);
175.114 + }
175.115 +
175.116 + public Point getClickPoint(String componentName) {
175.117 + JListOperator theTree = getComponentsTree();
175.118 + return(theTree.getClickPoint(theTree.findItemIndex(componentName)));
175.119 + }
175.120 + /**
175.121 + * TODO:
175.122 + */
175.123 + public Point getClickPoint(String componentName, int index) {
175.124 + return(getComponentsTree().getClickPoint(
175.125 + getComponentsTree().findItemIndex(componentName, index)));
175.126 + }
175.127 +
175.128 + public Point getClickPointOfClass(Class clz) {
175.129 + return(getClickPoint(getDisplayNameOfClass(clz)));
175.130 + }
175.131 +
175.132 + public Point getClickPointOfClass(String className) {
175.133 + try {
175.134 + return(getClickPointOfClass(Class.forName(className)));
175.135 + } catch(ClassNotFoundException e) {
175.136 + return(getClickPoint(getShortClassName(className)));
175.137 + }
175.138 + }
175.139 +
175.140 + private JViewport findViewportOfPalette() {
175.141 + JViewport viewPort = (JViewport)ContainerOperator.findContainerUnder(getSource(),
175.142 + new ComponentChooser() {
175.143 + public boolean checkComponent(Component comp) {
175.144 + return (JViewport.class.isInstance(comp));
175.145 + }
175.146 + public String getDescription() {
175.147 + return ("JViewport");
175.148 + }
175.149 + });
175.150 + return viewPort;
175.151 + }
175.152 +
175.153 + public void dndPaletteComponent(String componentName,
175.154 + ComponentOperator designer, Point designerPoint) {
175.155 + Point clickPoint = getClickPoint(componentName);
175.156 + Util.wait(1000);
175.157 + dndPaletteComponent(clickPoint, designer, designerPoint);
175.158 + }
175.159 +
175.160 + public void dndComponentOfClass(String componentClassName,
175.161 + ComponentOperator designer, Point designerPoint) {
175.162 + Point clickPoint = getClickPointOfClass(componentClassName);
175.163 + Util.wait(1000);
175.164 + dndPaletteComponent(clickPoint, designer, designerPoint);
175.165 + }
175.166 +
175.167 + private void dndPaletteComponent(Point componentClickPoint, ComponentOperator designer,
175.168 + Point designerPoint) {
175.169 + JViewport viewPort = findViewportOfPalette();
175.170 + ComponentOperator component = getComponentsTree();
175.171 + int compX = (component.getLocationOnScreen().x - viewPort.getLocationOnScreen().x) +
175.172 + componentClickPoint.x;
175.173 + int compY = (component.getLocationOnScreen().y - viewPort.getLocationOnScreen().y) +
175.174 + componentClickPoint.y;
175.175 +
175.176 + System.out.println();
175.177 + System.out.println("+++ coordinates of component in Palette Panel = [" +
175.178 + compX + ", " + compY + "]");
175.179 + System.out.println();
175.180 +
175.181 + viewPort.setViewPosition(new Point(compX, compY));
175.182 + Util.wait(1000);
175.183 + //TODO Somehow it goes to previous component so need to shift y a bit
175.184 + //componentClickPoint = new Point(componentClickPoint.x,componentClickPoint.y+5);
175.185 + component.clickMouse(componentClickPoint.x, componentClickPoint.y, 1);
175.186 + Util.wait(2000);
175.187 + System.out.println();
175.188 + System.out.println("+++ Component in Palette Panel should be visible and selected");
175.189 + System.out.println("+++ Left-top position in Palette Panel = " + viewPort.getViewPosition());
175.190 + System.out.println();
175.191 +
175.192 + DNDDriver dndDriver = new DNDDriver();
175.193 + Util.wait(1000);
175.194 + dndDriver.dnd(component, componentClickPoint, designer, designerPoint,
175.195 + InputEvent.BUTTON1_MASK, 0);
175.196 + Util.wait(3000);
175.197 + System.out.println();
175.198 + System.out.println("+++ Component should be put from Palette on Designer Pane");
175.199 + System.out.println();
175.200 +
175.201 + }
175.202 +
175.203 + public JListOperator getComponentsTree() {
175.204 + showComponents();
175.205 + if(theTree == null) {
175.206 + theTree = new JListOperator(this);
175.207 + }
175.208 + return(theTree);
175.209 + }
175.210 +
175.211 + public void addComponent(String componentName) {
175.212 + Point clickPoint = getClickPoint(componentName);
175.213 + theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
175.214 + }
175.215 +
175.216 + public void addComponent(String componentName, int index) {
175.217 + Point clickPoint = getClickPoint(componentName, index);
175.218 + theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
175.219 + }
175.220 + public void addComponentOfClass(Class clz) {
175.221 + Point clickPoint = getClickPointOfClass(clz);
175.222 + theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
175.223 + TestUtils.wait(2000);
175.224 + }
175.225 +
175.226 + public void addComponentOfClass(String className) {
175.227 + Point clickPoint = getClickPointOfClass(className);
175.228 + theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
175.229 + TestUtils.wait(2000);
175.230 + }
175.231 +
175.232 + public void addComponent(String componentName, DesignerPaneOperator designer, Point location) {
175.233 + Point clickPoint = getClickPoint(componentName);
175.234 + //getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
175.235 + JListOperator tree = getComponentsTree();
175.236 + if (tree.isSelectionEmpty()) {
175.237 + tree.selectItem(componentName);
175.238 + } else {
175.239 + tree.clearSelection();
175.240 + tree.selectItem(componentName);
175.241 + }
175.242 + TestUtils.wait(2000);
175.243 + designer.clickMouse(location.x, location.y, 1);
175.244 + TestUtils.wait(2000);
175.245 + //Second click added because when component added on designer it is not in focus
175.246 + designer.clickMouse(1, 100, 1);
175.247 + TestUtils.wait(2000);
175.248 + designer.clickMouse(location.x+5, location.y+5, 1);
175.249 + TestUtils.wait(2000);
175.250 + }
175.251 +
175.252 + /**
175.253 + * Add component which beginning text is same as others.
175.254 + * i.g., Image and Image Hyperlink. It always selects Image Hyperlink when
175.255 + * use addComponent("Image", designer, new Point(x,y))
175.256 + * as Image Hyperlink is listed in front of Image in Palette.
175.257 + * Example: <BR>
175.258 + * <pre>
175.259 + * String componentName = "Image" ;
175.260 + * int index = 1 ;
175.261 + * palette.addComponent(componentName, indes, designer, new Point(x,y));
175.262 + * </pre>
175.263 + */
175.264 + public void addComponent(String componentName, int index, DesignerPaneOperator designer, Point location) {
175.265 + Point clickPoint = getClickPoint(componentName, index);
175.266 + getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
175.267 + TestUtils.wait(2000);
175.268 + designer.clickMouse(location.x, location.y, 1);
175.269 + TestUtils.wait(2000);
175.270 + }
175.271 +
175.272 + public void addComponentOfClass(Class clz, DesignerPaneOperator designer, Point location) {
175.273 + Point clickPoint = getClickPointOfClass(clz);
175.274 + getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
175.275 + designer.clickMouse(location.x, location.y, 1);
175.276 + TestUtils.wait(2000);
175.277 + }
175.278 +
175.279 + public void addComponentOfClass(String className, DesignerPaneOperator designer, Point location) {
175.280 +
175.281 + Point clickPoint = getClickPointOfClass(className);
175.282 + getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
175.283 + designer.clickMouse(location.x, location.y, 1);
175.284 + TestUtils.wait(2000);
175.285 + }
175.286 +
175.287 +/*
175.288 + public void addComponent(String componentName) {
175.289 + getComponentButton(componentName).clickMouse(2);
175.290 + }
175.291 +
175.292 + public void addComponentOfClass(Class clz) {
175.293 + getComponentButtonOfClass(clz).clickMouse(2);
175.294 + }
175.295 +
175.296 + public void addComponentOfClass(String className) {
175.297 + getComponentButtonOfClass(className).clickMouse(2);
175.298 + }
175.299 +
175.300 + public void addComponent(String componentName, DesignerPaneOperator designer, Point location) {
175.301 + //new DNDDriver().dnd(getComponentButton(componentName), new Point(1, 1),
175.302 + //designer, location);
175.303 + getComponentButton(componentName).clickMouse();
175.304 + designer.clickMouse(location.x, location.y, 1);
175.305 + }
175.306 +
175.307 + public void addComponentOfClass(Class clz, DesignerPaneOperator designer, Point location) {
175.308 + getComponentButtonOfClass(clz).clickMouse();
175.309 + designer.clickMouse(location.x, location.y, 1);
175.310 + }
175.311 +
175.312 + public void addComponentOfClass(String className, DesignerPaneOperator designer, Point location) {
175.313 + getComponentButtonOfClass(className).clickMouse();
175.314 + designer.clickMouse(location.x, location.y, 1);
175.315 + }
175.316 + */
175.317 + public void placeClip(String clipName, JEditorPaneOperator editor, int caretPosition) {
175.318 + Rectangle rect = editor.modelToView(caretPosition);
175.319 + Point location = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
175.320 + dndComponentOfClass(clipName, editor, location);
175.321 + }
175.322 +/*
175.323 + public void placeClip(String clipName, JEditorPaneOperator editor, int caretPosition) {
175.324 + Rectangle rect = editor.modelToView(caretPosition);
175.325 + Point location = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
175.326 + new DNDDriver().dnd(getComponentButton(clipName), new Point(1, 1), editor, location);
175.327 + }
175.328 + */
175.329 + public void placeClip(String clipName, JEditorPaneOperator editor) {
175.330 + placeClip(clipName, editor, editor.getCaretPosition());
175.331 + }
175.332 +
175.333 + private String getDisplayNameOfClass(Class clz) {
175.334 + String name = null;
175.335 + try {
175.336 + name = java.beans.Introspector.getBeanInfo(clz).getBeanDescriptor().getDisplayName();
175.337 + } catch(IntrospectionException e) {
175.338 + }
175.339 + if(name == null) {
175.340 + name = getShortClassName(clz.getName());
175.341 + }
175.342 + return(name);
175.343 + }
175.344 +
175.345 + private String getShortClassName(String className) {
175.346 + String name = null;
175.347 + StringTokenizer token = new StringTokenizer(className, ".");
175.348 + while(token.hasMoreTokens()) {
175.349 + name=token.nextToken();
175.350 + }
175.351 + return(name);
175.352 + }
175.353 +
175.354 + /**
175.355 + * TODO: need to be updated
175.356 + *
175.357 + */
175.358 + public static void showPalette() {
175.359 + Util.getMainMenu().pushMenu("Window|Palette" );
175.360 + new QueueTool().waitEmpty();
175.361 + }
175.362 +
175.363 + public static PaletteContainerOperator showPalette(String buttName, String paletteName) {
175.364 + new org.netbeans.modules.visualweb.gravy.toolbox.actions.ShowPaletteAction().perform();
175.365 + new QueueTool().waitEmpty();
175.366 + new JToggleButtonOperator(new ToolBoxOperator(), buttName).push();
175.367 + //new JButtonOperator(new ToolBoxOperator(), buttName).push();
175.368 + return(new PaletteContainerOperator(paletteName));
175.369 + }
175.370 +
175.371 + public static PaletteContainerOperator showCodeClips() {
175.372 + new org.netbeans.modules.visualweb.gravy.toolbox.actions.ShowPaletteAction().perform();
175.373 + new QueueTool().waitEmpty();
175.374 + new JToggleButtonOperator(new ToolBoxOperator(), Bundle.getStringTrimmed("com.sun.rave.toolbox.Bundle", "CODE_CLIPS")).push();
175.375 + return(new PaletteContainerOperator("Samples"));
175.376 + }
175.377 +
175.378 + /**
175.379 + * TODO: maked private because doesn't work properly
175.380 + */
175.381 + private static class PaletteContainerChooser implements ComponentChooser {
175.382 + String name;
175.383 + public PaletteContainerChooser(String name) {
175.384 + this.name = name;
175.385 + }
175.386 + public boolean checkComponent(Component comp) {
175.387 + System.out.println("Class ="+ comp.getClass()+" Name="+comp.getClass().getName());
175.388 + if (comp.getClass().getName().equals("org.netbeans.modules.palette.ui.CategoryDescriptor$1")){
175.389 + return true;
175.390 + }
175.391 + return false;//(comp.getClass().getName().equals("org.netbeans.modules.palette.ui.CategoryButton"));
175.392 +
175.393 + }
175.394 + public String getDescription() {
175.395 + return(/*PaletteContainer.class.getName() + */" with \"" + name + "\" name");
175.396 + }
175.397 + }
175.398 +}
176.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
176.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/toolbox/ToolBoxOperator.java Thu Jul 10 04:32:50 2008 -0700
176.3 @@ -0,0 +1,75 @@
176.4 +/*
176.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
176.6 + *
176.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
176.8 + *
176.9 + * The contents of this file are subject to the terms of either the GNU
176.10 + * General Public License Version 2 only ("GPL") or the Common
176.11 + * Development and Distribution License("CDDL") (collectively, the
176.12 + * "License"). You may not use this file except in compliance with the
176.13 + * License. You can obtain a copy of the License at
176.14 + * http://www.netbeans.org/cddl-gplv2.html
176.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
176.16 + * specific language governing permissions and limitations under the
176.17 + * License. When distributing the software, include this License Header
176.18 + * Notice in each file and include the License file at
176.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
176.20 + * particular file as subject to the "Classpath" exception as provided
176.21 + * by Sun in the GPL Version 2 section of the License file that
176.22 + * accompanied this code. If applicable, add the following below the
176.23 + * License Header, with the fields enclosed by brackets [] replaced by
176.24 + * your own identifying information:
176.25 + * "Portions Copyrighted [year] [name of copyright owner]"
176.26 + *
176.27 + * Contributor(s):
176.28 + *
176.29 + * The Original Software is NetBeans. The Initial Developer of the Original
176.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
176.31 + * Microsystems, Inc. All Rights Reserved.
176.32 + *
176.33 + * If you wish your version of this file to be governed by only the CDDL
176.34 + * or only the GPL Version 2, indicate your decision by adding
176.35 + * "[Contributor] elects to include this software in this distribution
176.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
176.37 + * single choice of license, a recipient has the option to distribute
176.38 + * your version of this file under either the CDDL, the GPL Version 2 or
176.39 + * to extend the choice of license to its licensees as provided above.
176.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
176.41 + * Version 2 license, then the option applies only if the new code is
176.42 + * made subject to such option by the copyright holder.
176.43 + */
176.44 +
176.45 +package org.netbeans.modules.visualweb.gravy.toolbox;
176.46 +
176.47 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
176.48 +
176.49 +import java.awt.Component;
176.50 +
176.51 +import org.netbeans.jemmy.ComponentChooser;
176.52 +
176.53 +import org.netbeans.jemmy.operators.ContainerOperator;
176.54 +
176.55 +/**
176.56 + *
176.57 + * @author Alexandre (Shura) Iline (alexandre.iline@sun.com)
176.58 + */
176.59 +public class ToolBoxOperator extends ContainerOperator {
176.60 + public ToolBoxOperator(ContainerOperator cont) {
176.61 + super(cont, new ToolBoxChooser());
176.62 + }
176.63 + public ToolBoxOperator() {
176.64 + this(RaveWindowOperator.getDefaultRave());
176.65 + }
176.66 +
176.67 + public static class ToolBoxChooser implements ComponentChooser {
176.68 + public ToolBoxChooser() {
176.69 + }
176.70 + public boolean checkComponent(Component comp) {
176.71 + return(comp.getClass().getName().equals("com.sun.rave.toolbox.ToolBox"));
176.72 + }
176.73 + public String getDescription() {
176.74 + return("com.sun.rave.toolbox.ToolBox");
176.75 + }
176.76 + }
176.77 +
176.78 +}
177.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
177.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/toolbox/actions/ShowPaletteAction.java Thu Jul 10 04:32:50 2008 -0700
177.3 @@ -0,0 +1,51 @@
177.4 +/*
177.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
177.6 + *
177.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
177.8 + *
177.9 + * The contents of this file are subject to the terms of either the GNU
177.10 + * General Public License Version 2 only ("GPL") or the Common
177.11 + * Development and Distribution License("CDDL") (collectively, the
177.12 + * "License"). You may not use this file except in compliance with the
177.13 + * License. You can obtain a copy of the License at
177.14 + * http://www.netbeans.org/cddl-gplv2.html
177.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
177.16 + * specific language governing permissions and limitations under the
177.17 + * License. When distributing the software, include this License Header
177.18 + * Notice in each file and include the License file at
177.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
177.20 + * particular file as subject to the "Classpath" exception as provided
177.21 + * by Sun in the GPL Version 2 section of the License file that
177.22 + * accompanied this code. If applicable, add the following below the
177.23 + * License Header, with the fields enclosed by brackets [] replaced by
177.24 + * your own identifying information:
177.25 + * "Portions Copyrighted [year] [name of copyright owner]"
177.26 + *
177.27 + * Contributor(s):
177.28 + *
177.29 + * The Original Software is NetBeans. The Initial Developer of the Original
177.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
177.31 + * Microsystems, Inc. All Rights Reserved.
177.32 + *
177.33 + * If you wish your version of this file to be governed by only the CDDL
177.34 + * or only the GPL Version 2, indicate your decision by adding
177.35 + * "[Contributor] elects to include this software in this distribution
177.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
177.37 + * single choice of license, a recipient has the option to distribute
177.38 + * your version of this file under either the CDDL, the GPL Version 2 or
177.39 + * to extend the choice of license to its licensees as provided above.
177.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
177.41 + * Version 2 license, then the option applies only if the new code is
177.42 + * made subject to such option by the copyright holder.
177.43 + */
177.44 +
177.45 +package org.netbeans.modules.visualweb.gravy.toolbox.actions;
177.46 +public class ShowPaletteAction extends org.netbeans.jellytools.actions.Action {
177.47 + private static final String menuString = "Window|Creator Palette";
177.48 + private static final Shortcut shortcut = new Shortcut(java.awt.event.KeyEvent.VK_X, java.awt.event.KeyEvent.CTRL_MASK);
177.49 +
177.50 + /** creates new CopyAction instance */
177.51 + public ShowPaletteAction() {
177.52 + super(menuString, null, null, shortcut);
177.53 + }
177.54 +}
178.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
178.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/websvc/AddWebServiceOperator.java Thu Jul 10 04:32:50 2008 -0700
178.3 @@ -0,0 +1,324 @@
178.4 +/*
178.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
178.6 + *
178.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
178.8 + *
178.9 + * The contents of this file are subject to the terms of either the GNU
178.10 + * General Public License Version 2 only ("GPL") or the Common
178.11 + * Development and Distribution License("CDDL") (collectively, the
178.12 + * "License"). You may not use this file except in compliance with the
178.13 + * License. You can obtain a copy of the License at
178.14 + * http://www.netbeans.org/cddl-gplv2.html
178.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
178.16 + * specific language governing permissions and limitations under the
178.17 + * License. When distributing the software, include this License Header
178.18 + * Notice in each file and include the License file at
178.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
178.20 + * particular file as subject to the "Classpath" exception as provided
178.21 + * by Sun in the GPL Version 2 section of the License file that
178.22 + * accompanied this code. If applicable, add the following below the
178.23 + * License Header, with the fields enclosed by brackets [] replaced by
178.24 + * your own identifying information:
178.25 + * "Portions Copyrighted [year] [name of copyright owner]"
178.26 + *
178.27 + * Contributor(s):
178.28 + *
178.29 + * The Original Software is NetBeans. The Initial Developer of the Original
178.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
178.31 + * Microsystems, Inc. All Rights Reserved.
178.32 + *
178.33 + * If you wish your version of this file to be governed by only the CDDL
178.34 + * or only the GPL Version 2, indicate your decision by adding
178.35 + * "[Contributor] elects to include this software in this distribution
178.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
178.37 + * single choice of license, a recipient has the option to distribute
178.38 + * your version of this file under either the CDDL, the GPL Version 2 or
178.39 + * to extend the choice of license to its licensees as provided above.
178.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
178.41 + * Version 2 license, then the option applies only if the new code is
178.42 + * made subject to such option by the copyright holder.
178.43 + */
178.44 +
178.45 +package org.netbeans.modules.visualweb.gravy.websvc;
178.46 +
178.47 +import org.netbeans.jellytools.NbDialogOperator;
178.48 +import org.netbeans.jemmy.operators.*;
178.49 +import org.netbeans.modules.visualweb.gravy.TestUtils;
178.50 +import org.netbeans.modules.visualweb.gravy.Util;
178.51 +
178.52 +/**
178.53 + * AddWebServiceOperator class
178.54 + * Implements test functionality for "Add Web Service" dialog
178.55 + *
178.56 + * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a>
178.57 + */
178.58 +public class AddWebServiceOperator extends NbDialogOperator{
178.59 +
178.60 + private JRadioButtonOperator _rbtURL;
178.61 + private JRadioButtonOperator _rbtLocal;
178.62 + private JButtonOperator _btBrowse;
178.63 + //private JButtonOperator _btGetWSInf;
178.64 + private JButtonOperator _btSetProxy;
178.65 + private JButtonOperator _btAdd;
178.66 + private JButtonOperator _btCancel;
178.67 + private JButtonOperator _btHelp;
178.68 + private JTextFieldOperator _txtURL;
178.69 + private JTextFieldOperator _txtLocal;
178.70 + //private JTextFieldOperator _txtWSName;
178.71 + private JTextFieldOperator _txtWSPackageName;
178.72 + private boolean _isProxySet = false;
178.73 + private String STR_BROWSE = "Browse...";
178.74 + private String STR_PROXY = "Set Proxy...";
178.75 + private String STR_ADD = "Add";
178.76 + private String STR_CANCEL = "Cancel";
178.77 + private String STR_HELP = "Help";
178.78 + private String STR_OPEN = "Open";
178.79 + private String STR_OK = "OK";
178.80 + private String STR_OPTIONS = "Options";
178.81 + private String STR_FILE = "Local File:";
178.82 + private String STR_URL = "URL:";
178.83 + private String STR_SYSTEM_PROXY = "Use System Proxy Settings";
178.84 + private String STR_MANUAL_PROXY = "Manual Proxy Settings";
178.85 + private String wsLabel = "Services tab web services compiling script";
178.86 +
178.87 + //private JTextComponentOperator _txtResults;
178.88 +
178.89 + public AddWebServiceOperator() {
178.90 + super("Add Web Service");
178.91 + }
178.92 +
178.93 + public JRadioButtonOperator rbtURL() {
178.94 + if (_rbtURL == null) {
178.95 + _rbtURL = new JRadioButtonOperator(this, STR_URL);
178.96 + }
178.97 + return _rbtURL;
178.98 + }
178.99 +
178.100 + public JRadioButtonOperator rbtLocal() {
178.101 + if (_rbtLocal == null) {
178.102 + _rbtLocal = new JRadioButtonOperator(this, STR_FILE);
178.103 + }
178.104 + return _rbtLocal;
178.105 + }
178.106 +
178.107 + public JButtonOperator btBrowse() {
178.108 + if (_btBrowse == null) {
178.109 + _btBrowse = new JButtonOperator(this, STR_BROWSE);
178.110 + }
178.111 + return _btBrowse;
178.112 + }
178.113 +
178.114 + /*public JButtonOperator btGetWSInf() {
178.115 + if (_btGetWSInf == null) {
178.116 + _btGetWSInf = new JButtonOperator(this, "Get Web Service Information");
178.117 + }
178.118 + return _btGetWSInf;
178.119 + }*/
178.120 +
178.121 + public JButtonOperator btSetProxy() {
178.122 + if (_btSetProxy == null) {
178.123 + _btSetProxy = new JButtonOperator(this, STR_PROXY);
178.124 +
178.125 + }
178.126 + return _btSetProxy;
178.127 + }
178.128 +
178.129 + public JButtonOperator btAdd() {
178.130 + if (_btAdd == null) {
178.131 + _btAdd = new JButtonOperator(this, STR_ADD);
178.132 + }
178.133 + return _btAdd;
178.134 + }
178.135 +
178.136 + public JButtonOperator btCancel() {
178.137 + if (_btCancel == null) {
178.138 + _btCancel = new JButtonOperator(this, STR_CANCEL);
178.139 + }
178.140 + return _btCancel;
178.141 + }
178.142 +
178.143 + public JButtonOperator btHelp() {
178.144 + if (_btHelp == null) {
178.145 + _btHelp = new JButtonOperator(this, STR_HELP);
178.146 + }
178.147 + return _btHelp;
178.148 + }
178.149 +
178.150 + public JTextFieldOperator txtURL() {
178.151 + if (_txtURL == null) {
178.152 + _txtURL = new JTextFieldOperator(this, 0);
178.153 + }
178.154 + return _txtURL;
178.155 + }
178.156 +
178.157 + public JTextFieldOperator txtLocal() {
178.158 + if (_txtLocal == null) {
178.159 + _txtLocal = new JTextFieldOperator(this, 1);
178.160 + }
178.161 + return _txtLocal;
178.162 + }
178.163 +
178.164 + /*public JTextFieldOperator txtWSName() {
178.165 + if (_txtWSName == null) {
178.166 + //System.out.println("TRACE: "+new JTextFieldOperator(this, 0).getText());
178.167 + //System.out.println("TRACE: "+new JTextFieldOperator(this, 1).getText());
178.168 + //System.out.println("TRACE: "+new JTextFieldOperator(this, 2).getText());
178.169 + //System.out.println("TRACE: "+new JTextFieldOperator(this, 3).getText());
178.170 + //System.out.println("TRACE: "+new JTextFieldOperator(this, 4).getText());
178.171 + //_txtWSName = new JTextFieldOperator(this, 4);
178.172 + try{
178.173 + _txtWSName = new JTextFieldOperator(this, 6);
178.174 + }catch(Exception e){
178.175 + _txtWSName = null;
178.176 + }
178.177 + }
178.178 + return _txtWSName;
178.179 + }*/
178.180 +
178.181 + public JTextFieldOperator txtWSPackageName() {
178.182 + if (_txtWSPackageName == null) {
178.183 + _txtWSPackageName = new JTextFieldOperator(this, 2);
178.184 + }
178.185 + return _txtWSPackageName;
178.186 + }
178.187 +
178.188 + /*public JTextComponentOperator txtResults() {
178.189 + if (_txtResults == null) {
178.190 + //_txtResults = new JTextComponentOperator(this,9);
178.191 + _txtResults = new JTextComponentOperator(this,8);
178.192 + }
178.193 + return _txtResults;
178.194 + }*/
178.195 +
178.196 + public boolean isProxySet() {
178.197 + return _isProxySet;
178.198 + }
178.199 +
178.200 +
178.201 + public void verify() {
178.202 + btAdd();
178.203 + btCancel();
178.204 + btHelp();
178.205 + //btGetWSInf();
178.206 + btBrowse();
178.207 + btSetProxy();
178.208 + rbtLocal();
178.209 + rbtURL();
178.210 + txtLocal();
178.211 + txtURL();
178.212 + //txtWSName();
178.213 + txtWSPackageName();
178.214 + //txtResults();
178.215 + }
178.216 +
178.217 + public String addLocalWebService(String name) {
178.218 + JRadioButtonOperator wsType = rbtLocal();
178.219 + wsType.requestFocus();
178.220 + wsType.setSelected(true);
178.221 + wsType.doClick();
178.222 + TestUtils.wait(2000);
178.223 + /*btBrowse().pushNoBlock();
178.224 + TestUtils.wait(2000);
178.225 + JDialogOperator open = new JDialogOperator(STR_OPEN);
178.226 + JTextFieldOperator wsdlFileName = new JTextFieldOperator(open, 0);
178.227 + wsdlFileName.typeText(name);
178.228 + TestUtils.wait(1000);
178.229 + new JButtonOperator(open, STR_OPEN).pushNoBlock();*/
178.230 + JTextFieldOperator wsdlUrl = txtLocal();
178.231 + wsdlUrl.clearText();
178.232 + wsdlUrl.setText(name);
178.233 + TestUtils.wait(1000);
178.234 + //TODO hardcoded?
178.235 + //if ((new JTextComponentOperator(this, 2)).getText().indexOf("error occurred")!= -1) return null;
178.236 + //String wsName = "empty";
178.237 + //JTextFieldOperator wsNameOper = txtWSName();
178.238 + //if (wsNameOper!=null ) {wsName = wsNameOper.getText();}
178.239 + // btAdd().pushNoBlock();
178.240 + btAdd().pushNoBlock();
178.241 + isWebServiceClientGenerated();
178.242 + //return wsName;
178.243 + return null;
178.244 + }
178.245 +
178.246 + public String addWebService(String url) {
178.247 + return addWebService(url, "websvc");
178.248 + }
178.249 +
178.250 + public String addWebService(String url, String packageName) {
178.251 + JRadioButtonOperator wsType = rbtURL();
178.252 + wsType.requestFocus();
178.253 + wsType.setSelected(true);
178.254 + wsType.doClick();
178.255 + TestUtils.wait(2000);
178.256 + JTextFieldOperator wsdlUrl = txtURL();
178.257 + wsdlUrl.clearText();
178.258 + wsdlUrl.setText(url);
178.259 + TestUtils.wait(1000);
178.260 + JTextFieldOperator pkgName = txtWSPackageName();
178.261 + pkgName.clearText();
178.262 + pkgName.setText(packageName);
178.263 + TestUtils.wait(1000);
178.264 + btAdd().pushNoBlock();;
178.265 + isWebServiceClientGenerated();
178.266 + return null;
178.267 + }
178.268 +
178.269 + public void setProxy(String proxyHost, String proxyPort) {
178.270 + if (isProxySet()) clearProxy();
178.271 + btSetProxy().pushNoBlock();
178.272 + //JDialogOperator proxyConfig = new JDialogOperator("Proxy Configuration");
178.273 + JDialogOperator proxyConfig = new JDialogOperator(STR_OPTIONS);
178.274 + //JCheckBoxOperator proxyCb = new JCheckBoxOperator(proxyConfig);
178.275 + TestUtils.wait(1000);
178.276 + JRadioButtonOperator proxyRb = new JRadioButtonOperator(proxyConfig, STR_MANUAL_PROXY);
178.277 + proxyRb.requestFocus();
178.278 + proxyRb.setSelected(true);
178.279 + proxyRb.doClick();
178.280 + //proxyCb.requestFocus();
178.281 + //proxyCb.setSelected(true);
178.282 + // proxyCb.doClick();
178.283 + _isProxySet = true;
178.284 + TestUtils.wait(2000);
178.285 + new JTextFieldOperator(proxyConfig, 0).setText(proxyHost);
178.286 + TestUtils.wait(1000);
178.287 + new JTextFieldOperator(proxyConfig,1).setText(proxyPort);
178.288 + TestUtils.wait(1000);
178.289 + new JButtonOperator(proxyConfig, STR_OK).pushNoBlock();
178.290 + }
178.291 +
178.292 + public void clearProxy() {
178.293 + if (isProxySet()) {
178.294 + btSetProxy().pushNoBlock();
178.295 + //JDialogOperator proxyConfig = new JDialogOperator("Proxy Configuration");
178.296 + JDialogOperator proxyConfig = new JDialogOperator(STR_OPTIONS);
178.297 + //JCheckBoxOperator proxyCb = new JCheckBoxOperator(proxyConfig);
178.298 + TestUtils.wait(1000);
178.299 + JRadioButtonOperator proxyRb = new JRadioButtonOperator(proxyConfig, STR_SYSTEM_PROXY);
178.300 + //proxyCb.requestFocus();
178.301 + //proxyCb.setSelected(false);
178.302 + //proxyCb.doClick();
178.303 + proxyRb.requestFocus();
178.304 + proxyRb.setSelected(true);
178.305 + proxyRb.doClick();
178.306 + _isProxySet = false;
178.307 + TestUtils.wait(1000);
178.308 + new JButtonOperator(proxyConfig, STR_OK).pushNoBlock();
178.309 + }
178.310 + }
178.311 +
178.312 + private boolean isWebServiceClientGenerated() {
178.313 + TestUtils.wait(500);
178.314 + JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), 1);
178.315 + while (jlo.getText() == null || jlo.getText().indexOf(wsLabel) == -1) {
178.316 + jlo = new JLabelOperator(Util.getMainWindow(), 1);
178.317 + System.out.println("label in first cycle = " + jlo.getText());
178.318 + TestUtils.wait(1000);
178.319 + }
178.320 + while (jlo.getText() != null && jlo.getText().indexOf(wsLabel) != -1) {
178.321 + jlo = new JLabelOperator(Util.getMainWindow(), 1);
178.322 + TestUtils.wait(1000);
178.323 + }
178.324 + TestUtils.wait(1000);
178.325 + return true;
178.326 + }
178.327 +}
179.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
179.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/websvc/TestMethodOperator.java Thu Jul 10 04:32:50 2008 -0700
179.3 @@ -0,0 +1,113 @@
179.4 +/*
179.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
179.6 + *
179.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
179.8 + *
179.9 + * The contents of this file are subject to the terms of either the GNU
179.10 + * General Public License Version 2 only ("GPL") or the Common
179.11 + * Development and Distribution License("CDDL") (collectively, the
179.12 + * "License"). You may not use this file except in compliance with the
179.13 + * License. You can obtain a copy of the License at
179.14 + * http://www.netbeans.org/cddl-gplv2.html
179.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
179.16 + * specific language governing permissions and limitations under the
179.17 + * License. When distributing the software, include this License Header
179.18 + * Notice in each file and include the License file at
179.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
179.20 + * particular file as subject to the "Classpath" exception as provided
179.21 + * by Sun in the GPL Version 2 section of the License file that
179.22 + * accompanied this code. If applicable, add the following below the
179.23 + * License Header, with the fields enclosed by brackets [] replaced by
179.24 + * your own identifying information:
179.25 + * "Portions Copyrighted [year] [name of copyright owner]"
179.26 + *
179.27 + * Contributor(s):
179.28 + *
179.29 + * The Original Software is NetBeans. The Initial Developer of the Original
179.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
179.31 + * Microsystems, Inc. All Rights Reserved.
179.32 + *
179.33 + * If you wish your version of this file to be governed by only the CDDL
179.34 + * or only the GPL Version 2, indicate your decision by adding
179.35 + * "[Contributor] elects to include this software in this distribution
179.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
179.37 + * single choice of license, a recipient has the option to distribute
179.38 + * your version of this file under either the CDDL, the GPL Version 2 or
179.39 + * to extend the choice of license to its licensees as provided above.
179.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
179.41 + * Version 2 license, then the option applies only if the new code is
179.42 + * made subject to such option by the copyright holder.
179.43 + */
179.44 +
179.45 +package org.netbeans.modules.visualweb.gravy.websvc;
179.46 +
179.47 +import org.netbeans.jellytools.Bundle;
179.48 +import org.netbeans.jemmy.operators.JButtonOperator;
179.49 +import org.netbeans.jemmy.operators.JTableOperator;
179.50 +import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
179.51 +
179.52 +/**
179.53 + * TestMethodOperator class
179.54 + * Implements test functionality for "Test Web Service Method" dialog
179.55 + *
179.56 + * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a>
179.57 + */
179.58 +public class TestMethodOperator extends NbDialogOperator{
179.59 +
179.60 + private JButtonOperator _btSubmit;
179.61 + private JButtonOperator _btClose;
179.62 + private JButtonOperator _btHelp;
179.63 + private JTableOperator _tblValues;
179.64 + private JTableOperator _tblResults;
179.65 + private String STR_SUBMIT = "Submit";
179.66 + private String STR_CLOSE = "Close";
179.67 + private String STR_HELP = "Help";
179.68 +
179.69 + public TestMethodOperator() {
179.70 + super(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.websvcmgr.ui.Bundle","TEST_WEB_SERVICE_METHOD"));
179.71 + }
179.72 +
179.73 + public JButtonOperator btSubmit() {
179.74 + if (_btSubmit == null) {
179.75 + _btSubmit = new JButtonOperator(this, STR_SUBMIT);
179.76 + }
179.77 + return _btSubmit;
179.78 + }
179.79 +
179.80 + public JButtonOperator btClose() {
179.81 + if (_btClose == null) {
179.82 + _btClose = new JButtonOperator(this, STR_CLOSE);
179.83 + }
179.84 + return _btClose;
179.85 + }
179.86 +
179.87 + public JButtonOperator btHelp() {
179.88 + if (_btHelp == null) {
179.89 + _btHelp = new JButtonOperator(this, STR_HELP);
179.90 + }
179.91 + return _btHelp;
179.92 + }
179.93 +
179.94 + public JTableOperator tblValues() {
179.95 + if (_tblValues == null) {
179.96 + _tblValues = new JTableOperator(this, 0);
179.97 + }
179.98 + return _tblValues;
179.99 + }
179.100 +
179.101 + public JTableOperator tblResults() {
179.102 + if (_tblResults == null) {
179.103 + _tblResults = new JTableOperator(this, 1);
179.104 + }
179.105 + return _tblResults;
179.106 + }
179.107 +
179.108 +
179.109 + public void verify() {
179.110 + btSubmit();
179.111 + btClose();
179.112 + btHelp();
179.113 + tblValues();
179.114 + tblResults();
179.115 + }
179.116 +}
180.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
180.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/websvc/actions/AddWebServiceAction.java Thu Jul 10 04:32:50 2008 -0700
180.3 @@ -0,0 +1,60 @@
180.4 +/*
180.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
180.6 + *
180.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
180.8 + *
180.9 + * The contents of this file are subject to the terms of either the GNU
180.10 + * General Public License Version 2 only ("GPL") or the Common
180.11 + * Development and Distribution License("CDDL") (collectively, the
180.12 + * "License"). You may not use this file except in compliance with the
180.13 + * License. You can obtain a copy of the License at
180.14 + * http://www.netbeans.org/cddl-gplv2.html
180.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
180.16 + * specific language governing permissions and limitations under the
180.17 + * License. When distributing the software, include this License Header
180.18 + * Notice in each file and include the License file at
180.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
180.20 + * particular file as subject to the "Classpath" exception as provided
180.21 + * by Sun in the GPL Version 2 section of the License file that
180.22 + * accompanied this code. If applicable, add the following below the
180.23 + * License Header, with the fields enclosed by brackets [] replaced by
180.24 + * your own identifying information:
180.25 + * "Portions Copyrighted [year] [name of copyright owner]"
180.26 + *
180.27 + * Contributor(s):
180.28 + *
180.29 + * The Original Software is NetBeans. The Initial Developer of the Original
180.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
180.31 + * Microsystems, Inc. All Rights Reserved.
180.32 + *
180.33 + * If you wish your version of this file to be governed by only the CDDL
180.34 + * or only the GPL Version 2, indicate your decision by adding
180.35 + * "[Contributor] elects to include this software in this distribution
180.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
180.37 + * single choice of license, a recipient has the option to distribute
180.38 + * your version of this file under either the CDDL, the GPL Version 2 or
180.39 + * to extend the choice of license to its licensees as provided above.
180.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
180.41 + * Version 2 license, then the option applies only if the new code is
180.42 + * made subject to such option by the copyright holder.
180.43 + */
180.44 +
180.45 +package org.netbeans.modules.visualweb.gravy.websvc.actions;
180.46 +
180.47 +import org.netbeans.modules.visualweb.gravy.actions.Action;
180.48 +import org.netbeans.jellytools.Bundle;
180.49 +
180.50 +/** Used to call "Add Web Service" popup menu item
180.51 + * @see org.netbeans.modules.visualweb.gravy.actions.Action
180.52 + * @author Alexey.Butenko@sun.com
180.53 + */
180.54 +public class AddWebServiceAction extends Action{
180.55 + private static final String _popup = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.websvcmgr.actions.Bundle", "ADD_WEB_SERVICE_Action");
180.56 + private static final String _menu = null; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
180.57 + private static final Action.Shortcut _shortcut = null;
180.58 +
180.59 + /** Creates new SaveAction instance. */
180.60 + public AddWebServiceAction() {
180.61 + super(_menu, _popup, null, _shortcut);
180.62 + }
180.63 +}
181.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
181.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/websvc/actions/CreateGroupAction.java Thu Jul 10 04:32:50 2008 -0700
181.3 @@ -0,0 +1,60 @@
181.4 +/*
181.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
181.6 + *
181.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
181.8 + *
181.9 + * The contents of this file are subject to the terms of either the GNU
181.10 + * General Public License Version 2 only ("GPL") or the Common
181.11 + * Development and Distribution License("CDDL") (collectively, the
181.12 + * "License"). You may not use this file except in compliance with the
181.13 + * License. You can obtain a copy of the License at
181.14 + * http://www.netbeans.org/cddl-gplv2.html
181.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
181.16 + * specific language governing permissions and limitations under the
181.17 + * License. When distributing the software, include this License Header
181.18 + * Notice in each file and include the License file at
181.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
181.20 + * particular file as subject to the "Classpath" exception as provided
181.21 + * by Sun in the GPL Version 2 section of the License file that
181.22 + * accompanied this code. If applicable, add the following below the
181.23 + * License Header, with the fields enclosed by brackets [] replaced by
181.24 + * your own identifying information:
181.25 + * "Portions Copyrighted [year] [name of copyright owner]"
181.26 + *
181.27 + * Contributor(s):
181.28 + *
181.29 + * The Original Software is NetBeans. The Initial Developer of the Original
181.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
181.31 + * Microsystems, Inc. All Rights Reserved.
181.32 + *
181.33 + * If you wish your version of this file to be governed by only the CDDL
181.34 + * or only the GPL Version 2, indicate your decision by adding
181.35 + * "[Contributor] elects to include this software in this distribution
181.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
181.37 + * single choice of license, a recipient has the option to distribute
181.38 + * your version of this file under either the CDDL, the GPL Version 2 or
181.39 + * to extend the choice of license to its licensees as provided above.
181.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
181.41 + * Version 2 license, then the option applies only if the new code is
181.42 + * made subject to such option by the copyright holder.
181.43 + */
181.44 +
181.45 +package org.netbeans.modules.visualweb.gravy.websvc.actions;
181.46 +
181.47 +import org.netbeans.modules.visualweb.gravy.actions.Action;
181.48 +import org.netbeans.jellytools.Bundle;
181.49 +
181.50 +/** Used to call "Create Group" popup menu item
181.51 + * @see org.netbeans.modules.visualweb.gravy.actions.Action
181.52 + * @author Alexey.Butenko@sun.com
181.53 + */
181.54 +public class CreateGroupAction extends Action {
181.55 + private static final String _popup = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.websvcmgr.actions.Bundle", "ADD_GROUP");
181.56 + private static final String _menu = null; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
181.57 + private static final Action.Shortcut _shortcut = null;
181.58 +
181.59 + /** Creates new SaveAction instance. */
181.60 + public CreateGroupAction() {
181.61 + super(_menu, _popup, null, _shortcut);
181.62 + }
181.63 +}
182.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
182.2 +++ b/visualweb.gravy/src/org/netbeans/modules/visualweb/gravy/welcome/WelcomeOperator.java Thu Jul 10 04:32:50 2008 -0700
182.3 @@ -0,0 +1,91 @@
182.4 +/*
182.5 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
182.6 +*
182.7 +* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
182.8 +*
182.9 +* The contents of this file are subject to the terms of either the GNU
182.10 +* General Public License Version 2 only ("GPL") or the Common
182.11 +* Development and Distribution License("CDDL") (collectively, the
182.12 +* "License"). You may not use this file except in compliance with the
182.13 +* License. You can obtain a copy of the License at
182.14 +* http://www.netbeans.org/cddl-gplv2.html
182.15 +* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
182.16 +* specific language governing permissions and limitations under the
182.17 +* License. When distributing the software, include this License Header
182.18 +* Notice in each file and include the License file at
182.19 +* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
182.20 +* particular file as subject to the "Classpath" exception as provided
182.21 +* by Sun in the GPL Version 2 section of the License file that
182.22 +* accompanied this code. If applicable, add the following below the
182.23 +* License Header, with the fields enclosed by brackets [] replaced by
182.24 +* your own identifying information:
182.25 +* "Portions Copyrighted [year] [name of copyright owner]"
182.26 +*
182.27 +* Contributor(s):
182.28 +*
182.29 +* The Original Software is NetBeans. The Initial Developer of the Original
182.30 +* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
182.31 +* Microsystems, Inc. All Rights Reserved.
182.32 +*
182.33 +* If you wish your version of this file to be governed by only the CDDL
182.34 +* or only the GPL Version 2, indicate your decision by adding
182.35 +* "[Contributor] elects to include this software in this distribution
182.36 +* under the [CDDL or GPL Version 2] license." If you do not indicate a
182.37 +* single choice of license, a recipient has the option to distribute
182.38 +* your version of this file under either the CDDL, the GPL Version 2 or
182.39 +* to extend the choice of license to its licensees as provided above.
182.40 +* However, if you add GPL Version 2 code and therefore, elected the GPL
182.41 +* Version 2 license, then the option applies only if the new code is
182.42 +* made subject to such option by the copyright holder.
182.43 +*/
182.44 +
182.45 +package org.netbeans.modules.visualweb.gravy.welcome;
182.46 +
182.47 +import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
182.48 +import org.netbeans.jemmy.operators.JButtonOperator;
182.49 +import org.netbeans.jemmy.operators.JTableOperator;
182.50 +
182.51 +/**
182.52 + * This class implements test functionality for the window "Welcome".
182.53 + */
182.54 +public class WelcomeOperator extends org.netbeans.jellytools.TopComponentOperator {
182.55 + /**
182.56 + * Creates an instance of this class.
182.57 + */
182.58 + public WelcomeOperator() {
182.59 + super(RaveWindowOperator.getDefaultRave(), "Welcome");
182.60 + }
182.61 +
182.62 + /**
182.63 + * Returns a list of recently opened/created projects.
182.64 + * @return the appropriate object JTableOperator
182.65 + */
182.66 + public JTableOperator getRecentProjectsList() {
182.67 + return(new JTableOperator(this));
182.68 + }
182.69 +
182.70 + /**
182.71 + * Creates and returns an instance of this class.
182.72 + * @return an instance of this class
182.73 + */
182.74 + public static WelcomeOperator showWelcome() {
182.75 +/*
182.76 + JTabbedPaneOperator tabbed = Util.getMainTab();
182.77 + //JemmyProperties.setCurrentDispatchingModel(3);
182.78 + //TBD - not working!
182.79 + //tabbed.selectPage("Welcome");
182.80 + tabbed.setSelectedIndex(tabbed.findPage("Welcome"));
182.81 +*/
182.82 + new org.netbeans.jellytools.TopComponentOperator("Welcome");
182.83 + return(new WelcomeOperator());
182.84 + }
182.85 +
182.86 + /**
182.87 + * Returns a button, placed on the window "Welcome"
182.88 + * @param text a text of a required button
182.89 + * @return an object JButtonOperator
182.90 + */
182.91 + public static JButtonOperator getWelcomeButton(String text) {
182.92 + return(new JButtonOperator(showWelcome(), text));
182.93 + }
182.94 +}
183.1 --- a/visualweb.jsfsupport.components/build.xml Thu Jul 10 04:29:52 2008 -0700
183.2 +++ b/visualweb.jsfsupport.components/build.xml Thu Jul 10 04:32:50 2008 -0700
183.3 @@ -59,7 +59,9 @@
183.4 </target>
183.5
183.6 <target name="javadoc-zip-init">
183.7 - <ant dir="library" target="javadoc-zip" inheritAll="false"/>
183.8 + <ant dir="library" target="javadoc-zip" inheritAll="false">
183.9 + <property name="no.javadoc.preview" value="true"/>
183.10 + </ant>
183.11 </target>
183.12
183.13 <target name="netbeans-extra" depends="init">
184.1 --- a/visualweb.kit/gravy/build.xml Thu Jul 10 04:29:52 2008 -0700
184.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
184.3 @@ -1,110 +0,0 @@
184.4 -<?xml version="1.0" encoding="UTF-8"?>
184.5 -<!--
184.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
184.7 -
184.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
184.9 -
184.10 -
184.11 -The contents of this file are subject to the terms of either the GNU
184.12 -General Public License Version 2 only ("GPL") or the Common
184.13 -Development and Distribution License("CDDL") (collectively, the
184.14 -"License"). You may not use this file except in compliance with the
184.15 -License. You can obtain a copy of the License at
184.16 -http://www.netbeans.org/cddl-gplv2.html
184.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
184.18 -specific language governing permissions and limitations under the
184.19 -License. When distributing the software, include this License Header
184.20 -Notice in each file and include the License file at
184.21 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
184.22 -particular file as subject to the "Classpath" exception as provided
184.23 -by Sun in the GPL Version 2 section of the License file that
184.24 -accompanied this code. If applicable, add the following below the
184.25 -License Header, with the fields enclosed by brackets [] replaced by
184.26 -your own identifying information:
184.27 -"Portions Copyrighted [year] [name of copyright owner]"
184.28 -
184.29 -Contributor(s):
184.30 -
184.31 -The Original Software is NetBeans. The Initial Developer of the Original
184.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
184.33 -Microsystems, Inc. All Rights Reserved.
184.34 -
184.35 -If you wish your version of this file to be governed by only the CDDL
184.36 -or only the GPL Version 2, indicate your decision by adding
184.37 -"[Contributor] elects to include this software in this distribution
184.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
184.39 -single choice of license, a recipient has the option to distribute
184.40 -your version of this file under either the CDDL, the GPL Version 2 or
184.41 -to extend the choice of license to its licensees as provided above.
184.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
184.43 -Version 2 license, then the option applies only if the new code is
184.44 -made subject to such option by the copyright holder.
184.45 --->
184.46 -<!-- You may freely edit this file. See commented blocks below for -->
184.47 -<!-- some examples of how to customize the build. -->
184.48 -<!-- (If you delete it and reopen the project it will be recreated.) -->
184.49 -<project name="gravy" default="default" basedir=".">
184.50 - <description>Builds, tests, and runs the project gravy.</description>
184.51 - <import file="nbproject/build-impl.xml"/>
184.52 - <!--
184.53 -
184.54 - There exist several targets which are by default empty and which can be
184.55 - used for execution of your tasks. These targets are usually executed
184.56 - before and after some main targets. They are:
184.57 -
184.58 - -pre-init: called before initialization of project properties
184.59 - -post-init: called after initialization of project properties
184.60 - -pre-compile: called before javac compilation
184.61 - -post-compile: called after javac compilation
184.62 - -pre-compile-single: called before javac compilation of single file
184.63 - -post-compile-single: called after javac compilation of single file
184.64 - -pre-compile-test: called before javac compilation of JUnit tests
184.65 - -post-compile-test: called after javac compilation of JUnit tests
184.66 - -pre-compile-test-single: called before javac compilation of single JUnit test
184.67 - -post-compile-test-single: called after javac compilation of single JUunit test
184.68 - -pre-jar: called before JAR building
184.69 - -post-jar: called after JAR building
184.70 - -post-clean: called after cleaning build products
184.71 -
184.72 - (Targets beginning with '-' are not intended to be called on their own.)
184.73 -
184.74 - Example of inserting an obfuscator after compilation could look like this:
184.75 -
184.76 - <target name="-post-compile">
184.77 - <obfuscate>
184.78 - <fileset dir="${build.classes.dir}"/>
184.79 - </obfuscate>
184.80 - </target>
184.81 -
184.82 - For list of available properties check the imported
184.83 - nbproject/build-impl.xml file.
184.84 -
184.85 -
184.86 - Another way to customize the build is by overriding existing main targets.
184.87 - The targets of interest are:
184.88 -
184.89 - -init-macrodef-javac: defines macro for javac compilation
184.90 - -init-macrodef-junit: defines macro for junit execution
184.91 - -init-macrodef-debug: defines macro for class debugging
184.92 - -init-macrodef-java: defines macro for class execution
184.93 - -do-jar-with-manifest: JAR building (if you are using a manifest)
184.94 - -do-jar-without-manifest: JAR building (if you are not using a manifest)
184.95 - run: execution of project
184.96 - -javadoc-build: Javadoc generation
184.97 - test-report: JUnit report generation
184.98 -
184.99 - An example of overriding the target for project execution could look like this:
184.100 -
184.101 - <target name="run" depends="gravy-impl.jar">
184.102 - <exec dir="bin" executable="launcher.exe">
184.103 - <arg file="${dist.jar}"/>
184.104 - </exec>
184.105 - </target>
184.106 -
184.107 - Notice that the overridden target depends on the jar target and not only on
184.108 - the compile target as the regular run target does. Again, for a list of available
184.109 - properties which you can use, check the target you are overriding in the
184.110 - nbproject/build-impl.xml file.
184.111 -
184.112 - -->
184.113 -</project>
185.1 Binary file visualweb.kit/gravy/builds/gravy.jar has changed
186.1 --- a/visualweb.kit/gravy/nbproject/build-impl.xml Thu Jul 10 04:29:52 2008 -0700
186.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
186.3 @@ -1,605 +0,0 @@
186.4 -<?xml version="1.0" encoding="UTF-8"?>
186.5 -<!--
186.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
186.7 -*** EDIT ../build.xml INSTEAD ***
186.8 -
186.9 -For the purpose of easier reading the script
186.10 -is divided into following sections:
186.11 -
186.12 - - initialization
186.13 - - compilation
186.14 - - jar
186.15 - - execution
186.16 - - debugging
186.17 - - javadoc
186.18 - - junit compilation
186.19 - - junit execution
186.20 - - junit debugging
186.21 - - applet
186.22 - - cleanup
186.23 -
186.24 - -->
186.25 -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="gravy-impl">
186.26 - <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
186.27 - <!--
186.28 - ======================
186.29 - INITIALIZATION SECTION
186.30 - ======================
186.31 - -->
186.32 - <target name="-pre-init">
186.33 - <!-- Empty placeholder for easier customization. -->
186.34 - <!-- You can override this target in the ../build.xml file. -->
186.35 - </target>
186.36 - <target depends="-pre-init" name="-init-private">
186.37 - <property file="nbproject/private/config.properties"/>
186.38 - <property file="nbproject/private/configs/${config}.properties"/>
186.39 - <property file="nbproject/private/private.properties"/>
186.40 - </target>
186.41 - <target depends="-pre-init,-init-private" name="-init-user">
186.42 - <property file="${user.properties.file}"/>
186.43 - <!-- The two properties below are usually overridden -->
186.44 - <!-- by the active platform. Just a fallback. -->
186.45 - <property name="default.javac.source" value="1.4"/>
186.46 - <property name="default.javac.target" value="1.4"/>
186.47 - </target>
186.48 - <target depends="-pre-init,-init-private,-init-user" name="-init-project">
186.49 - <property file="nbproject/configs/${config}.properties"/>
186.50 - <property file="nbproject/project.properties"/>
186.51 - </target>
186.52 - <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
186.53 - <available file="${manifest.file}" property="manifest.available"/>
186.54 - <condition property="manifest.available+main.class">
186.55 - <and>
186.56 - <isset property="manifest.available"/>
186.57 - <isset property="main.class"/>
186.58 - <not>
186.59 - <equals arg1="${main.class}" arg2="" trim="true"/>
186.60 - </not>
186.61 - </and>
186.62 - </condition>
186.63 - <condition property="manifest.available+main.class+mkdist.available">
186.64 - <and>
186.65 - <istrue value="${manifest.available+main.class}"/>
186.66 - <isset property="libs.CopyLibs.classpath"/>
186.67 - </and>
186.68 - </condition>
186.69 - <condition property="have.tests">
186.70 - <or>
186.71 - <available file="${test.src.dir}"/>
186.72 - </or>
186.73 - </condition>
186.74 - <condition property="have.sources">
186.75 - <or>
186.76 - <available file="${src.dir}"/>
186.77 - </or>
186.78 - </condition>
186.79 - <condition property="netbeans.home+have.tests">
186.80 - <and>
186.81 - <isset property="netbeans.home"/>
186.82 - <isset property="have.tests"/>
186.83 - </and>
186.84 - </condition>
186.85 - <condition property="no.javadoc.preview">
186.86 - <isfalse value="${javadoc.preview}"/>
186.87 - </condition>
186.88 - <property name="run.jvmargs" value=""/>
186.89 - <property name="javac.compilerargs" value=""/>
186.90 - <property name="work.dir" value="${basedir}"/>
186.91 - <condition property="no.deps">
186.92 - <and>
186.93 - <istrue value="${no.dependencies}"/>
186.94 - </and>
186.95 - </condition>
186.96 - <property name="javac.debug" value="true"/>
186.97 - <property name="javadoc.preview" value="true"/>
186.98 - <property name="application.args" value=""/>
186.99 - <property name="source.encoding" value="${file.encoding}"/>
186.100 - <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
186.101 - <and>
186.102 - <isset property="javadoc.encoding"/>
186.103 - <not>
186.104 - <equals arg1="${javadoc.encoding}" arg2=""/>
186.105 - </not>
186.106 - </and>
186.107 - </condition>
186.108 - <property name="javadoc.encoding.used" value="${source.encoding}"/>
186.109 - <property name="includes" value="**"/>
186.110 - <property name="excludes" value=""/>
186.111 - </target>
186.112 - <target name="-post-init">
186.113 - <!-- Empty placeholder for easier customization. -->
186.114 - <!-- You can override this target in the ../build.xml file. -->
186.115 - </target>
186.116 - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
186.117 - <fail unless="src.dir">Must set src.dir</fail>
186.118 - <fail unless="test.src.dir">Must set test.src.dir</fail>
186.119 - <fail unless="build.dir">Must set build.dir</fail>
186.120 - <fail unless="dist.dir">Must set dist.dir</fail>
186.121 - <fail unless="build.classes.dir">Must set build.classes.dir</fail>
186.122 - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
186.123 - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
186.124 - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
186.125 - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
186.126 - <fail unless="dist.jar">Must set dist.jar</fail>
186.127 - </target>
186.128 - <target name="-init-macrodef-property">
186.129 - <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
186.130 - <attribute name="name"/>
186.131 - <attribute name="value"/>
186.132 - <sequential>
186.133 - <property name="@{name}" value="${@{value}}"/>
186.134 - </sequential>
186.135 - </macrodef>
186.136 - </target>
186.137 - <target name="-init-macrodef-javac">
186.138 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
186.139 - <attribute default="${src.dir}" name="srcdir"/>
186.140 - <attribute default="${build.classes.dir}" name="destdir"/>
186.141 - <attribute default="${javac.classpath}" name="classpath"/>
186.142 - <attribute default="${includes}" name="includes"/>
186.143 - <attribute default="${excludes}" name="excludes"/>
186.144 - <attribute default="${javac.debug}" name="debug"/>
186.145 - <attribute default="" name="javac.compilerargs.jaxws"/>
186.146 - <element name="customize" optional="true"/>
186.147 - <sequential>
186.148 - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="" srcdir="@{srcdir}" target="${javac.target}">
186.149 - <classpath>
186.150 - <path path="@{classpath}"/>
186.151 - </classpath>
186.152 - <compilerarg line="${javac.compilerargs} @{javac.compilerargs.jaxws}"/>
186.153 - <customize/>
186.154 - </javac>
186.155 - </sequential>
186.156 - </macrodef>
186.157 - <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
186.158 - <attribute default="${src.dir}" name="srcdir"/>
186.159 - <attribute default="${build.classes.dir}" name="destdir"/>
186.160 - <attribute default="${javac.classpath}" name="classpath"/>
186.161 - <sequential>
186.162 - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
186.163 - <classpath>
186.164 - <path path="@{classpath}"/>
186.165 - </classpath>
186.166 - </depend>
186.167 - </sequential>
186.168 - </macrodef>
186.169 - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
186.170 - <attribute default="${build.classes.dir}" name="destdir"/>
186.171 - <sequential>
186.172 - <fail unless="javac.includes">Must set javac.includes</fail>
186.173 - <pathconvert pathsep="," property="javac.includes.binary">
186.174 - <path>
186.175 - <filelist dir="@{destdir}" files="${javac.includes}"/>
186.176 - </path>
186.177 - <globmapper from="*.java" to="*.class"/>
186.178 - </pathconvert>
186.179 - <delete>
186.180 - <files includes="${javac.includes.binary}"/>
186.181 - </delete>
186.182 - </sequential>
186.183 - </macrodef>
186.184 - </target>
186.185 - <target name="-init-macrodef-junit">
186.186 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
186.187 - <attribute default="${includes}" name="includes"/>
186.188 - <attribute default="${excludes}" name="excludes"/>
186.189 - <sequential>
186.190 - <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
186.191 - <batchtest todir="${build.test.results.dir}">
186.192 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
186.193 - <filename name="**/*Test.java"/>
186.194 - </fileset>
186.195 - </batchtest>
186.196 - <classpath>
186.197 - <path path="${run.test.classpath}"/>
186.198 - </classpath>
186.199 - <syspropertyset>
186.200 - <propertyref prefix="test-sys-prop."/>
186.201 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
186.202 - </syspropertyset>
186.203 - <formatter type="brief" usefile="false"/>
186.204 - <formatter type="xml"/>
186.205 - <jvmarg line="${run.jvmargs}"/>
186.206 - </junit>
186.207 - </sequential>
186.208 - </macrodef>
186.209 - </target>
186.210 - <target name="-init-macrodef-nbjpda">
186.211 - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
186.212 - <attribute default="${main.class}" name="name"/>
186.213 - <attribute default="${debug.classpath}" name="classpath"/>
186.214 - <attribute default="" name="stopclassname"/>
186.215 - <sequential>
186.216 - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
186.217 - <classpath>
186.218 - <path path="@{classpath}"/>
186.219 - </classpath>
186.220 - </nbjpdastart>
186.221 - </sequential>
186.222 - </macrodef>
186.223 - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
186.224 - <attribute default="${build.classes.dir}" name="dir"/>
186.225 - <sequential>
186.226 - <nbjpdareload>
186.227 - <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
186.228 - </nbjpdareload>
186.229 - </sequential>
186.230 - </macrodef>
186.231 - </target>
186.232 - <target name="-init-debug-args">
186.233 - <property name="version-output" value="java version "${ant.java.version}"/>
186.234 - <condition property="have-jdk-older-than-1.4">
186.235 - <or>
186.236 - <contains string="${version-output}" substring="java version "1.0"/>
186.237 - <contains string="${version-output}" substring="java version "1.1"/>
186.238 - <contains string="${version-output}" substring="java version "1.2"/>
186.239 - <contains string="${version-output}" substring="java version "1.3"/>
186.240 - </or>
186.241 - </condition>
186.242 - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
186.243 - <istrue value="${have-jdk-older-than-1.4}"/>
186.244 - </condition>
186.245 - </target>
186.246 - <target depends="-init-debug-args" name="-init-macrodef-debug">
186.247 - <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
186.248 - <attribute default="${main.class}" name="classname"/>
186.249 - <attribute default="${debug.classpath}" name="classpath"/>
186.250 - <element name="customize" optional="true"/>
186.251 - <sequential>
186.252 - <java classname="@{classname}" dir="${work.dir}" fork="true">
186.253 - <jvmarg line="${debug-args-line}"/>
186.254 - <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
186.255 - <jvmarg line="${run.jvmargs}"/>
186.256 - <classpath>
186.257 - <path path="@{classpath}"/>
186.258 - </classpath>
186.259 - <syspropertyset>
186.260 - <propertyref prefix="run-sys-prop."/>
186.261 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
186.262 - </syspropertyset>
186.263 - <customize/>
186.264 - </java>
186.265 - </sequential>
186.266 - </macrodef>
186.267 - </target>
186.268 - <target name="-init-macrodef-java">
186.269 - <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
186.270 - <attribute default="${main.class}" name="classname"/>
186.271 - <element name="customize" optional="true"/>
186.272 - <sequential>
186.273 - <java classname="@{classname}" dir="${work.dir}" fork="true">
186.274 - <jvmarg line="${run.jvmargs}"/>
186.275 - <classpath>
186.276 - <path path="${run.classpath}"/>
186.277 - </classpath>
186.278 - <syspropertyset>
186.279 - <propertyref prefix="run-sys-prop."/>
186.280 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
186.281 - </syspropertyset>
186.282 - <customize/>
186.283 - </java>
186.284 - </sequential>
186.285 - </macrodef>
186.286 - </target>
186.287 - <target name="-init-presetdef-jar">
186.288 - <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
186.289 - <jar compress="${jar.compress}" jarfile="${dist.jar}">
186.290 - <j2seproject1:fileset dir="${build.classes.dir}"/>
186.291 - </jar>
186.292 - </presetdef>
186.293 - </target>
186.294 - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
186.295 - <!--
186.296 - ===================
186.297 - COMPILATION SECTION
186.298 - ===================
186.299 - -->
186.300 - <target depends="init" name="deps-jar" unless="no.deps">
186.301 - <ant antfile="${project.jemmy}/build.xml" inheritall="false" target="jar"/>
186.302 - </target>
186.303 - <target depends="init,deps-jar" name="-pre-pre-compile">
186.304 - <mkdir dir="${build.classes.dir}"/>
186.305 - </target>
186.306 - <target name="-pre-compile">
186.307 - <!-- Empty placeholder for easier customization. -->
186.308 - <!-- You can override this target in the ../build.xml file. -->
186.309 - </target>
186.310 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources" name="-do-compile">
186.311 - <j2seproject3:depend/>
186.312 - <j2seproject3:javac/>
186.313 - <copy todir="${build.classes.dir}">
186.314 - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
186.315 - </copy>
186.316 - </target>
186.317 - <target name="-post-compile">
186.318 - <!-- Empty placeholder for easier customization. -->
186.319 - <!-- You can override this target in the ../build.xml file. -->
186.320 - </target>
186.321 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
186.322 - <target name="-pre-compile-single">
186.323 - <!-- Empty placeholder for easier customization. -->
186.324 - <!-- You can override this target in the ../build.xml file. -->
186.325 - </target>
186.326 - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
186.327 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
186.328 - <j2seproject3:force-recompile/>
186.329 - <j2seproject3:javac excludes="" includes="${javac.includes}"/>
186.330 - </target>
186.331 - <target name="-post-compile-single">
186.332 - <!-- Empty placeholder for easier customization. -->
186.333 - <!-- You can override this target in the ../build.xml file. -->
186.334 - </target>
186.335 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
186.336 - <!--
186.337 - ====================
186.338 - JAR BUILDING SECTION
186.339 - ====================
186.340 - -->
186.341 - <target depends="init" name="-pre-pre-jar">
186.342 - <dirname file="${dist.jar}" property="dist.jar.dir"/>
186.343 - <mkdir dir="${dist.jar.dir}"/>
186.344 - </target>
186.345 - <target name="-pre-jar">
186.346 - <!-- Empty placeholder for easier customization. -->
186.347 - <!-- You can override this target in the ../build.xml file. -->
186.348 - </target>
186.349 - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
186.350 - <j2seproject1:jar/>
186.351 - </target>
186.352 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
186.353 - <j2seproject1:jar manifest="${manifest.file}"/>
186.354 - </target>
186.355 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
186.356 - <j2seproject1:jar manifest="${manifest.file}">
186.357 - <j2seproject1:manifest>
186.358 - <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
186.359 - </j2seproject1:manifest>
186.360 - </j2seproject1:jar>
186.361 - <echo>To run this application from the command line without Ant, try:</echo>
186.362 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
186.363 - <property location="${dist.jar}" name="dist.jar.resolved"/>
186.364 - <pathconvert property="run.classpath.with.dist.jar">
186.365 - <path path="${run.classpath}"/>
186.366 - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
186.367 - </pathconvert>
186.368 - <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
186.369 - </target>
186.370 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
186.371 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
186.372 - <pathconvert property="run.classpath.without.build.classes.dir">
186.373 - <path path="${run.classpath}"/>
186.374 - <map from="${build.classes.dir.resolved}" to=""/>
186.375 - </pathconvert>
186.376 - <pathconvert pathsep=" " property="jar.classpath">
186.377 - <path path="${run.classpath.without.build.classes.dir}"/>
186.378 - <chainedmapper>
186.379 - <flattenmapper/>
186.380 - <globmapper from="*" to="lib/*"/>
186.381 - </chainedmapper>
186.382 - </pathconvert>
186.383 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
186.384 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
186.385 - <fileset dir="${build.classes.dir}"/>
186.386 - <manifest>
186.387 - <attribute name="Main-Class" value="${main.class}"/>
186.388 - <attribute name="Class-Path" value="${jar.classpath}"/>
186.389 - </manifest>
186.390 - </copylibs>
186.391 - <echo>To run this application from the command line without Ant, try:</echo>
186.392 - <property location="${dist.jar}" name="dist.jar.resolved"/>
186.393 - <echo>java -jar "${dist.jar.resolved}"</echo>
186.394 - </target>
186.395 - <target name="-post-jar">
186.396 - <!-- Empty placeholder for easier customization. -->
186.397 - <!-- You can override this target in the ../build.xml file. -->
186.398 - </target>
186.399 - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
186.400 - <!--
186.401 - =================
186.402 - EXECUTION SECTION
186.403 - =================
186.404 - -->
186.405 - <target depends="init,compile" description="Run a main class." name="run">
186.406 - <j2seproject1:java>
186.407 - <customize>
186.408 - <arg line="${application.args}"/>
186.409 - </customize>
186.410 - </j2seproject1:java>
186.411 - </target>
186.412 - <target depends="init,compile" name="run-single">
186.413 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
186.414 - <j2seproject1:java classname="${run.class}"/>
186.415 - </target>
186.416 - <!--
186.417 - =================
186.418 - DEBUGGING SECTION
186.419 - =================
186.420 - -->
186.421 - <target depends="init" if="netbeans.home" name="-debug-start-debugger">
186.422 - <j2seproject1:nbjpdastart name="${debug.class}"/>
186.423 - </target>
186.424 - <target depends="init,compile" name="-debug-start-debuggee">
186.425 - <j2seproject3:debug>
186.426 - <customize>
186.427 - <arg line="${application.args}"/>
186.428 - </customize>
186.429 - </j2seproject3:debug>
186.430 - </target>
186.431 - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
186.432 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
186.433 - <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
186.434 - </target>
186.435 - <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
186.436 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
186.437 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
186.438 - <j2seproject3:debug classname="${debug.class}"/>
186.439 - </target>
186.440 - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
186.441 - <target depends="init" name="-pre-debug-fix">
186.442 - <fail unless="fix.includes">Must set fix.includes</fail>
186.443 - <property name="javac.includes" value="${fix.includes}.java"/>
186.444 - </target>
186.445 - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
186.446 - <j2seproject1:nbjpdareload/>
186.447 - </target>
186.448 - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
186.449 - <!--
186.450 - ===============
186.451 - JAVADOC SECTION
186.452 - ===============
186.453 - -->
186.454 - <target depends="init" name="-javadoc-build">
186.455 - <mkdir dir="${dist.javadoc.dir}"/>
186.456 - <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" destdir="${dist.javadoc.dir}" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
186.457 - <classpath>
186.458 - <path path="${javac.classpath}"/>
186.459 - </classpath>
186.460 - <packageset dir="${src.dir}" excludes="${excludes}" includes="${includes}"/>
186.461 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
186.462 - <filename name="**/*.java"/>
186.463 - </fileset>
186.464 - </javadoc>
186.465 - </target>
186.466 - <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
186.467 - <nbbrowse file="${dist.javadoc.dir}/index.html"/>
186.468 - </target>
186.469 - <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
186.470 - <!--
186.471 - =========================
186.472 - JUNIT COMPILATION SECTION
186.473 - =========================
186.474 - -->
186.475 - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
186.476 - <mkdir dir="${build.test.classes.dir}"/>
186.477 - </target>
186.478 - <target name="-pre-compile-test">
186.479 - <!-- Empty placeholder for easier customization. -->
186.480 - <!-- You can override this target in the ../build.xml file. -->
186.481 - </target>
186.482 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test">
186.483 - <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
186.484 - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
186.485 - <copy todir="${build.test.classes.dir}">
186.486 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
186.487 - </copy>
186.488 - </target>
186.489 - <target name="-post-compile-test">
186.490 - <!-- Empty placeholder for easier customization. -->
186.491 - <!-- You can override this target in the ../build.xml file. -->
186.492 - </target>
186.493 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
186.494 - <target name="-pre-compile-test-single">
186.495 - <!-- Empty placeholder for easier customization. -->
186.496 - <!-- You can override this target in the ../build.xml file. -->
186.497 - </target>
186.498 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
186.499 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
186.500 - <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
186.501 - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/>
186.502 - <copy todir="${build.test.classes.dir}">
186.503 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
186.504 - </copy>
186.505 - </target>
186.506 - <target name="-post-compile-test-single">
186.507 - <!-- Empty placeholder for easier customization. -->
186.508 - <!-- You can override this target in the ../build.xml file. -->
186.509 - </target>
186.510 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
186.511 - <!--
186.512 - =======================
186.513 - JUNIT EXECUTION SECTION
186.514 - =======================
186.515 - -->
186.516 - <target depends="init" if="have.tests" name="-pre-test-run">
186.517 - <mkdir dir="${build.test.results.dir}"/>
186.518 - </target>
186.519 - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
186.520 - <j2seproject3:junit/>
186.521 - </target>
186.522 - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
186.523 - <fail if="tests.failed">Some tests failed; see details above.</fail>
186.524 - </target>
186.525 - <target depends="init" if="have.tests" name="test-report"/>
186.526 - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
186.527 - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
186.528 - <target depends="init" if="have.tests" name="-pre-test-run-single">
186.529 - <mkdir dir="${build.test.results.dir}"/>
186.530 - </target>
186.531 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
186.532 - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
186.533 - <j2seproject3:junit excludes="" includes="${test.includes}"/>
186.534 - </target>
186.535 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
186.536 - <fail if="tests.failed">Some tests failed; see details above.</fail>
186.537 - </target>
186.538 - <target depends="init,compile-test,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
186.539 - <!--
186.540 - =======================
186.541 - JUNIT DEBUGGING SECTION
186.542 - =======================
186.543 - -->
186.544 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
186.545 - <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
186.546 - <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
186.547 - <customize>
186.548 - <syspropertyset>
186.549 - <propertyref prefix="test-sys-prop."/>
186.550 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
186.551 - </syspropertyset>
186.552 - <arg line="${test.class}"/>
186.553 - </customize>
186.554 - </j2seproject3:debug>
186.555 - </target>
186.556 - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
186.557 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
186.558 - </target>
186.559 - <target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
186.560 - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
186.561 - <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
186.562 - </target>
186.563 - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
186.564 - <!--
186.565 - =========================
186.566 - APPLET EXECUTION SECTION
186.567 - =========================
186.568 - -->
186.569 - <target depends="init,compile-single" name="run-applet">
186.570 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
186.571 - <j2seproject1:java classname="sun.applet.AppletViewer">
186.572 - <customize>
186.573 - <arg value="${applet.url}"/>
186.574 - </customize>
186.575 - </j2seproject1:java>
186.576 - </target>
186.577 - <!--
186.578 - =========================
186.579 - APPLET DEBUGGING SECTION
186.580 - =========================
186.581 - -->
186.582 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
186.583 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
186.584 - <j2seproject3:debug classname="sun.applet.AppletViewer">
186.585 - <customize>
186.586 - <arg value="${applet.url}"/>
186.587 - </customize>
186.588 - </j2seproject3:debug>
186.589 - </target>
186.590 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
186.591 - <!--
186.592 - ===============
186.593 - CLEANUP SECTION
186.594 - ===============
186.595 - -->
186.596 - <target depends="init" name="deps-clean" unless="no.deps">
186.597 - <ant antfile="${project.jemmy}/build.xml" inheritall="false" target="clean"/>
186.598 - </target>
186.599 - <target depends="init" name="-do-clean">
186.600 - <delete dir="${build.dir}"/>
186.601 - <delete dir="${dist.dir}"/>
186.602 - </target>
186.603 - <target name="-post-clean">
186.604 - <!-- Empty placeholder for easier customization. -->
186.605 - <!-- You can override this target in the ../build.xml file. -->
186.606 - </target>
186.607 - <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
186.608 -</project>
187.1 --- a/visualweb.kit/gravy/nbproject/project.properties Thu Jul 10 04:29:52 2008 -0700
187.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
187.3 @@ -1,173 +0,0 @@
187.4 -#DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
187.5 -#
187.6 -#Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
187.7 -#
187.8 -#The contents of this file are subject to the terms of either the GNU
187.9 -#General Public License Version 2 only ("GPL") or the Common
187.10 -#Development and Distribution License("CDDL") (collectively, the
187.11 -#"License"). You may not use this file except in compliance with the
187.12 -#License. You can obtain a copy of the License at
187.13 -#http://www.netbeans.org/cddl-gplv2.html
187.14 -#or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
187.15 -#specific language governing permissions and limitations under the
187.16 -#License. When distributing the software, include this License Header
187.17 -#Notice in each file and include the License file at
187.18 -#nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
187.19 -#particular file as subject to the "Classpath" exception as provided
187.20 -#by Sun in the GPL Version 2 section of the License file that
187.21 -#accompanied this code. If applicable, add the following below the
187.22 -#License Header, with the fields enclosed by brackets [] replaced by
187.23 -#your own identifying information:
187.24 -#"Portions Copyrighted [year] [name of copyright owner]"
187.25 -#
187.26 -#Contributor(s):
187.27 -#
187.28 -#The Original Software is NetBeans. The Initial Developer of the Original
187.29 -#Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
187.30 -#Microsystems, Inc. All Rights Reserved.
187.31 -#
187.32 -#If you wish your version of this file to be governed by only the CDDL
187.33 -#or only the GPL Version 2, indicate your decision by adding
187.34 -#"[Contributor] elects to include this software in this distribution
187.35 -#under the [CDDL or GPL Version 2] license." If you do not indicate a
187.36 -#single choice of license, a recipient has the option to distribute
187.37 -#your version of this file under either the CDDL, the GPL Version 2 or
187.38 -#to extend the choice of license to its licensees as provided above.
187.39 -#However, if you add GPL Version 2 code and therefore, elected the GPL
187.40 -#Version 2 license, then the option applies only if the new code is
187.41 -#made subject to such option by the copyright holder.
187.42 -application.args=
187.43 -build.classes.dir=${build.dir}/classes
187.44 -build.classes.excludes=**/*.java,**/*.form
187.45 -# This directory is removed when the project is cleaned:
187.46 -build.dir=build
187.47 -build.generated.dir=${build.dir}/generated
187.48 -# Only compile against the classpath explicitly listed here:
187.49 -build.sysclasspath=ignore
187.50 -build.test.classes.dir=${build.dir}/test/classes
187.51 -build.test.results.dir=${build.dir}/test/results
187.52 -debug.classpath=\
187.53 - ${run.classpath}
187.54 -debug.test.classpath=\
187.55 - ${run.test.classpath}
187.56 -# This directory is removed when the project is cleaned:
187.57 -dist.dir=dist
187.58 -dist.jar=${dist.dir}/gravy.jar
187.59 -dist.javadoc.dir=${dist.dir}/javadoc
187.60 -excludes=
187.61 -file.reference.httpunit.jar=../../testtools/external/httpunit.jar
187.62 -file.reference.jelly2-nb.jar=../../jellytools/builds/jelly2-nb.jar
187.63 -file.reference.junit.jar=../../xtest/lib/junit.jar
187.64 -file.reference.nbjunit.jar=../../xtest/lib/nbjunit.jar
187.65 -file.reference.xtest.jar=../../xtest/lib/xtest.jar
187.66 -includes=**
187.67 -platform8.dir=platform8
187.68 -ide9.dir=ide9
187.69 -project.jemmy=../../jemmy
187.70 -reference.jemmy.jar=${project.jemmy}/dist/jemmy.jar
187.71 -visualweb2.dir=visualweb2
187.72 -#TODO My Dependencies
187.73 -netbeans.dest.dir=../../nbbuild/netbeans
187.74 -file.reference.org-openide-awt.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-awt.jar
187.75 -file.reference.org-openide-filesystems.jar=${netbeans.dest.dir}/${platform8.dir}/core/org-openide-filesystems.jar
187.76 -file.reference.org-openide-util.jar=${netbeans.dest.dir}/${platform8.dir}/lib/org-openide-util.jar
187.77 -file.reference.org-openide-text.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-text.jar
187.78 -file.reference.org-openide-loaders.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-loaders.jar
187.79 -file.reference.org-openide-text.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-text.jar
187.80 -file.reference.org-openide-windows.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-windows.jar
187.81 -file.reference.org-openide-nodes.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-nodes.jar
187.82 -file.reference.org-openide-explorer.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-openide-explorer.jar
187.83 -file.reference.org-netbeans-core-windows.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-netbeans-core-windows.jar
187.84 -file.reference.org-netbeans-swing-tabcontrol.jar=${netbeans.dest.dir}/${platform8.dir}/modules/org-netbeans-swing-tabcontrol.jar
187.85 -
187.86 -file.reference.org-netbeans-modules-utilities.jar=${netbeans.dest.dir}/${ide9.dir}/modules/org-netbeans-modules-utilities.jar
187.87 -file.reference.org-netbeans-modules-editor-lib.jar=${netbeans.dest.dir}/${ide9.dir}/modules/org-netbeans-modules-editor-lib.jar
187.88 -file.reference.org-netbeans-modules-editor-completion.jar=${netbeans.dest.dir}/${ide9.dir}/modules/org-netbeans-modules-editor-completion.jar
187.89 -file.reference.org-netbeans-spi-palette.jar=${netbeans.dest.dir}/${ide9.dir}/modules/org-netbeans-spi-palette.jar
187.90 -
187.91 -file.reference.org-netbeans-modules-visualweb-xhtml.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-xhtml.jar
187.92 -file.reference.org-netbeans-modules-visualweb-outline.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-outline.jar
187.93 -file.reference.org-netbeans-modules-visualweb-designer.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-designer.jar
187.94 -file.reference.org-netbeans-modules-visualweb-designer-jsf.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-designer-jsf.jar
187.95 -file.reference.org-netbeans-modules-visualweb-designer-markup.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-designer-markup.jar
187.96 -file.reference.org-netbeans-modules-visualweb-insync.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-insync.jar
187.97 -file.reference.org-netbeans-modules-visualweb-queryeditor.jar=${netbeans.dest.dir}/${ide9.dir}/modules/org-netbeans-modules-db-sql-visualeditor.jar
187.98 -file.reference.org-netbeans-modules-visualweb-navigation-new.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-navigation.jar
187.99 -file.reference.org-netbeans-modules-visualweb-dataconnectivity.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/org-netbeans-modules-visualweb-dataconnectivity.jar
187.100 -
187.101 -file.reference.jsfcl.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/ext/jsfcl.jar
187.102 -#file.reference.html-dt.jar=${netbeans.dest.dir}/rave2.0/modules/ext/html-dt.jar
187.103 -file.reference.designtime.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/ext/designtime.jar
187.104 -file.reference.designer-html.jar=${netbeans.dest.dir}/${visualweb2.dir}/modules/ext/designer-html.jar
187.105 -#END
187.106 -jar.compress=false
187.107 -javac.classpath=\
187.108 - ${file.reference.org-openide-awt.jar}:\
187.109 - ${file.reference.org-openide-filesystems.jar}:\
187.110 - ${file.reference.org-openide-util.jar}:\
187.111 - ${file.reference.org-openide-text.jar}:\
187.112 - ${file.reference.org-openide-loaders.jar}:\
187.113 - ${file.reference.org-openide-text.jar}:\
187.114 - ${file.reference.org-openide-windows.jar}:\
187.115 - ${file.reference.org-openide-nodes.jar}:\
187.116 - ${file.reference.org-openide-explorer.jar}:\
187.117 - ${file.reference.org-netbeans-core-windows.jar}:\
187.118 - ${file.reference.org-netbeans-swing-tabcontrol.jar}:\
187.119 - ${file.reference.org-netbeans-modules-utilities.jar}:\
187.120 - ${file.reference.org-netbeans-modules-editor-lib.jar}:\
187.121 - ${file.reference.org-netbeans-modules-editor-completion.jar}:\
187.122 - ${file.reference.org-netbeans-spi-palette.jar}:\
187.123 - ${file.reference.org-netbeans-modules-visualweb-xhtml.jar}:\
187.124 - ${file.reference.org-netbeans-modules-visualweb-outline.jar}:\
187.125 - ${file.reference.org-netbeans-modules-visualweb-designer.jar}:\
187.126 - ${file.reference.org-netbeans-modules-visualweb-designer-jsf.jar}:\
187.127 - ${file.reference.org-netbeans-modules-visualweb-designer-markup.jar}:\
187.128 - ${file.reference.org-netbeans-modules-visualweb-insync.jar}:\
187.129 - ${file.reference.org-netbeans-modules-visualweb-queryeditor.jar}:\
187.130 - ${file.reference.org-netbeans-modules-visualweb-navigation-new.jar}:\
187.131 - ${file.reference.org-netbeans-modules-visualweb-dataconnectivity.jar}:\
187.132 - ${file.reference.jsfcl.jar}:\
187.133 - ${file.reference.designtime.jar}:\
187.134 - ${file.reference.designer-html.jar}:\
187.135 - ${file.reference.jelly2-nb.jar}:\
187.136 - ${file.reference.httpunit.jar}:\
187.137 - ${file.reference.nbjunit.jar}:\
187.138 - ${file.reference.xtest.jar}:\
187.139 - ${libs.junit.classpath}:\
187.140 - ${file.reference.junit.jar}:\
187.141 - ${reference.jemmy.jar}
187.142 -
187.143 -# Space-separated list of extra javac options
187.144 -javac.compilerargs=
187.145 -javac.deprecation=false
187.146 -javac.source=1.5
187.147 -javac.target=1.5
187.148 -javac.test.classpath=\
187.149 - ${javac.classpath}:\
187.150 - ${build.classes.dir}:\
187.151 - ${libs.junit.classpath}
187.152 -javadoc.additionalparam=
187.153 -javadoc.author=false
187.154 -javadoc.encoding=
187.155 -javadoc.noindex=false
187.156 -javadoc.nonavbar=false
187.157 -javadoc.notree=false
187.158 -javadoc.private=false
187.159 -javadoc.splitindex=true
187.160 -javadoc.use=true
187.161 -javadoc.version=false
187.162 -javadoc.windowtitle=
187.163 -meta.inf.dir=${src.dir}/META-INF
187.164 -platform.active=default_platform
187.165 -run.classpath=\
187.166 - ${javac.classpath}:\
187.167 - ${build.classes.dir}
187.168 -# Space-separated list of JVM arguments used when running the project
187.169 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
187.170 -# or test-sys-prop.name=value to set system properties for unit tests):
187.171 -run.jvmargs=
187.172 -run.test.classpath=\
187.173 - ${javac.test.classpath}:\
187.174 - ${build.test.classes.dir}
187.175 -src.dir=src
187.176 -test.src.dir=test
188.1 --- a/visualweb.kit/gravy/nbproject/project.xml Thu Jul 10 04:29:52 2008 -0700
188.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
188.3 @@ -1,67 +0,0 @@
188.4 -<?xml version="1.0" encoding="UTF-8"?>
188.5 -<!--
188.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
188.7 -
188.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
188.9 -
188.10 -
188.11 -The contents of this file are subject to the terms of either the GNU
188.12 -General Public License Version 2 only ("GPL") or the Common
188.13 -Development and Distribution License("CDDL") (collectively, the
188.14 -"License"). You may not use this file except in compliance with the
188.15 -License. You can obtain a copy of the License at
188.16 -http://www.netbeans.org/cddl-gplv2.html
188.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
188.18 -specific language governing permissions and limitations under the
188.19 -License. When distributing the software, include this License Header
188.20 -Notice in each file and include the License file at
188.21 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
188.22 -particular file as subject to the "Classpath" exception as provided
188.23 -by Sun in the GPL Version 2 section of the License file that
188.24 -accompanied this code. If applicable, add the following below the
188.25 -License Header, with the fields enclosed by brackets [] replaced by
188.26 -your own identifying information:
188.27 -"Portions Copyrighted [year] [name of copyright owner]"
188.28 -
188.29 -Contributor(s):
188.30 -
188.31 -The Original Software is NetBeans. The Initial Developer of the Original
188.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
188.33 -Microsystems, Inc. All Rights Reserved.
188.34 -
188.35 -If you wish your version of this file to be governed by only the CDDL
188.36 -or only the GPL Version 2, indicate your decision by adding
188.37 -"[Contributor] elects to include this software in this distribution
188.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
188.39 -single choice of license, a recipient has the option to distribute
188.40 -your version of this file under either the CDDL, the GPL Version 2 or
188.41 -to extend the choice of license to its licensees as provided above.
188.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
188.43 -Version 2 license, then the option applies only if the new code is
188.44 -made subject to such option by the copyright holder.
188.45 --->
188.46 -<project xmlns="http://www.netbeans.org/ns/project/1">
188.47 - <type>org.netbeans.modules.java.j2seproject</type>
188.48 - <configuration>
188.49 - <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
188.50 - <name>gravy</name>
188.51 - <minimum-ant-version>1.6.5</minimum-ant-version>
188.52 - <source-roots>
188.53 - <root id="src.dir"/>
188.54 - </source-roots>
188.55 - <test-roots>
188.56 - <root id="test.src.dir"/>
188.57 - </test-roots>
188.58 - </data>
188.59 - <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
188.60 - <reference>
188.61 - <foreign-project>jemmy</foreign-project>
188.62 - <artifact-type>jar</artifact-type>
188.63 - <script>build.xml</script>
188.64 - <target>jar</target>
188.65 - <clean-target>clean</clean-target>
188.66 - <id>jar</id>
188.67 - </reference>
188.68 - </references>
188.69 - </configuration>
188.70 -</project>
189.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/Action.java Thu Jul 10 04:29:52 2008 -0700
189.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
189.3 @@ -1,774 +0,0 @@
189.4 -/*
189.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
189.6 - *
189.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
189.8 - *
189.9 - * The contents of this file are subject to the terms of either the GNU
189.10 - * General Public License Version 2 only ("GPL") or the Common
189.11 - * Development and Distribution License("CDDL") (collectively, the
189.12 - * "License"). You may not use this file except in compliance with the
189.13 - * License. You can obtain a copy of the License at
189.14 - * http://www.netbeans.org/cddl-gplv2.html
189.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
189.16 - * specific language governing permissions and limitations under the
189.17 - * License. When distributing the software, include this License Header
189.18 - * Notice in each file and include the License file at
189.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
189.20 - * particular file as subject to the "Classpath" exception as provided
189.21 - * by Sun in the GPL Version 2 section of the License file that
189.22 - * accompanied this code. If applicable, add the following below the
189.23 - * License Header, with the fields enclosed by brackets [] replaced by
189.24 - * your own identifying information:
189.25 - * "Portions Copyrighted [year] [name of copyright owner]"
189.26 - *
189.27 - * Contributor(s):
189.28 - *
189.29 - * The Original Software is NetBeans. The Initial Developer of the Original
189.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
189.31 - * Microsystems, Inc. All Rights Reserved.
189.32 - *
189.33 - * If you wish your version of this file to be governed by only the CDDL
189.34 - * or only the GPL Version 2, indicate your decision by adding
189.35 - * "[Contributor] elects to include this software in this distribution
189.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
189.37 - * single choice of license, a recipient has the option to distribute
189.38 - * your version of this file under either the CDDL, the GPL Version 2 or
189.39 - * to extend the choice of license to its licensees as provided above.
189.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
189.41 - * Version 2 license, then the option applies only if the new code is
189.42 - * made subject to such option by the copyright holder.
189.43 - */
189.44 -package org.netbeans.modules.visualweb.gravy;
189.45 -
189.46 -import java.awt.Component;
189.47 -import java.awt.Container;
189.48 -import java.awt.EventQueue;
189.49 -import java.awt.event.ActionEvent;
189.50 -import java.awt.event.KeyEvent;
189.51 -import javax.swing.tree.TreePath;
189.52 -
189.53 -import org.netbeans.jellytools.JellyVersion;
189.54 -import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
189.55 -import org.netbeans.jellytools.nodes.Node;
189.56 -import org.netbeans.jemmy.EventTool;
189.57 -import org.netbeans.jemmy.JemmyException;
189.58 -import org.netbeans.jemmy.JemmyProperties;
189.59 -import org.netbeans.jemmy.Timeouts;
189.60 -import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
189.61 -import org.netbeans.jemmy.operators.ComponentOperator;
189.62 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
189.63 -import org.netbeans.jemmy.operators.Operator;
189.64 -import org.netbeans.jemmy.operators.Operator.ComponentVisualizer;
189.65 -import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
189.66 -import org.netbeans.jemmy.operators.Operator.StringComparator;
189.67 -import org.netbeans.jemmy.util.EmptyVisualizer;
189.68 -import org.openide.util.actions.SystemAction;
189.69 -
189.70 -
189.71 -/** Ancestor class for all blocking actions.<p>
189.72 - * It handles performing action through main menu (MENU_MODE), popup menu
189.73 - * (POPUP_MODE), IDE SystemAction API call (API_MODE) or through keyboard shortcut
189.74 - * (SHORTCUT_MODE).<p>
189.75 - * Action can be performed in exact mode by calling performMenu(...),
189.76 - * performPopup(...), performAPI(...) or performShortcut(...).<p>
189.77 - * If exact mode is not supported by the action it throws
189.78 - * UnsupportedOperationException.<p>
189.79 - * Current implementation supports MENU_MODE when menuPath is defined, POPUP_MODE
189.80 - * when popupPath is defined, API_MODE when systemActionClass is defined and
189.81 - * SHORTCUT_MODE when shorcut is defined (see Action constructors).<p>
189.82 - * Action also can be performed using runtime default mode by calling perform(...).<p>
189.83 - * When default mode is not support by the action other modes are tried till
189.84 - * supported mode found and action is performed.
189.85 - *
189.86 - * <BR>Timeouts used: <BR>
189.87 - * Action.WaitAfterShortcutTimeout - time to sleep between shortcuts in sequence (default 0) <BR>
189.88 - *
189.89 - * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
189.90 -public class Action {
189.91 -
189.92 - /** through menu action performing mode */
189.93 - public static final int MENU_MODE = 0;
189.94 - /** through popup menu action performing mode */
189.95 - public static final int POPUP_MODE = 1;
189.96 - /** through API action performing mode */
189.97 - public static final int API_MODE = 2;
189.98 - /** through shortcut action performing mode */
189.99 - public static final int SHORTCUT_MODE = 3;
189.100 -
189.101 - /** sleep time between nodes selection and action execution */
189.102 - protected static final long SELECTION_WAIT_TIME = 300;
189.103 - /** sleep time after action execution */
189.104 - protected static final long AFTER_ACTION_WAIT_TIME = 0;
189.105 - /** sleep time between sequence of shortcuts */
189.106 - protected static final long WAIT_AFTER_SHORTCUT_TIMEOUT = 0;
189.107 -
189.108 - private static final int sequence[][] = {{MENU_MODE, POPUP_MODE, SHORTCUT_MODE, API_MODE},
189.109 - {POPUP_MODE, MENU_MODE, SHORTCUT_MODE, API_MODE},
189.110 - {API_MODE, POPUP_MODE, MENU_MODE, SHORTCUT_MODE},
189.111 - {SHORTCUT_MODE, POPUP_MODE, MENU_MODE, API_MODE}};
189.112 -
189.113 - /** menu path of current action or null when MENU_MODE is not supported */
189.114 - protected String menuPath;
189.115 - /** popup menu path of current action or null when POPUP_MODE is not supported */
189.116 - protected String popupPath;
189.117 - /** SystemAction class of current action or null when API_MODE is not supported */
189.118 - protected Class systemActionClass;
189.119 - /** array of shortcuts of current action or null when SHORTCUT_MODE is not supported */
189.120 - protected Shortcut[] shortcuts;
189.121 -
189.122 - /** Comparator used as default for all Action instances. It is set in static clause. */
189.123 - private static StringComparator defaultComparator;
189.124 - /** Comparator used for this action instance. */
189.125 - private StringComparator comparator;
189.126 -
189.127 - /** creates new Action instance without API_MODE and SHORTCUT_MODE support
189.128 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
189.129 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
189.130 - public Action(String menuPath, String popupPath) {
189.131 - this(menuPath, popupPath, null, (Shortcut[])null);
189.132 - }
189.133 -
189.134 - /** creates new Action instance without SHORTCUT_MODE support
189.135 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
189.136 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
189.137 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
189.138 - public Action(String menuPath, String popupPath, String systemActionClass) {
189.139 - this(menuPath, popupPath, systemActionClass, (Shortcut[])null);
189.140 - }
189.141 -
189.142 - /** creates new Action instance without API_MODE support
189.143 - * @param shortcuts array of Shortcut instances (use null value if shorcut mode is not supported)
189.144 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
189.145 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
189.146 - public Action(String menuPath, String popupPath, Shortcut[] shortcuts) {
189.147 - this(menuPath, popupPath, null, shortcuts);
189.148 - }
189.149 -
189.150 - /** creates new Action instance without API_MODE support
189.151 - * @param shortcut Shortcut (use null value if menu mode is not supported)
189.152 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
189.153 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
189.154 - public Action(String menuPath, String popupPath, Shortcut shortcut) {
189.155 - this(menuPath, popupPath, null, new Shortcut[] {shortcut});
189.156 - }
189.157 -
189.158 - /** creates new Action instance
189.159 - * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
189.160 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
189.161 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
189.162 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
189.163 - public Action(String menuPath, String popupPath, String systemActionClass, Shortcut[] shortcuts) {
189.164 - this.menuPath = menuPath;
189.165 - this.popupPath = popupPath;
189.166 - if (systemActionClass==null) {
189.167 - this.systemActionClass = null;
189.168 - } else try {
189.169 - this.systemActionClass = Class.forName(systemActionClass);
189.170 - } catch (ClassNotFoundException e) {
189.171 - this.systemActionClass = null;
189.172 - }
189.173 - this.shortcuts = shortcuts;
189.174 - }
189.175 -
189.176 - /** creates new Action instance
189.177 - * @param shortcut Shortcut String (use null value if menu mode is not supported)
189.178 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
189.179 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
189.180 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
189.181 - public Action(String menuPath, String popupPath, String systemActionClass, Shortcut shortcut) {
189.182 - this(menuPath, popupPath, systemActionClass, new Shortcut[] {shortcut});
189.183 - }
189.184 -
189.185 - static {
189.186 - // Checks if you run on correct jemmy version. Writes message to jemmy log if not.
189.187 - JellyVersion.checkJemmyVersion();
189.188 -
189.189 - if (JemmyProperties.getCurrentProperty("Action.DefaultMode")==null)
189.190 - JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(POPUP_MODE));
189.191 - Timeouts.initDefault("Action.WaitAfterShortcutTimeout", WAIT_AFTER_SHORTCUT_TIMEOUT);
189.192 - // Set case sensitive comparator as default because of
189.193 - // very often clash between Cut and Execute menu items.
189.194 - // Substring criterion is set according to default string comparator
189.195 - boolean compareExactly = !Operator.getDefaultStringComparator().equals("abc", "a"); // NOI18N
189.196 - defaultComparator = new DefaultStringComparator(compareExactly, true);
189.197 - }
189.198 -
189.199 - private void perform(int mode) {
189.200 - switch (mode) {
189.201 - case POPUP_MODE: performPopup(); break;
189.202 - case MENU_MODE: performMenu(); break;
189.203 - case API_MODE: performAPI(); break;
189.204 - case SHORTCUT_MODE: performShortcut(); break;
189.205 - default: throw new IllegalArgumentException("Wrong Action.MODE");
189.206 - }
189.207 - }
189.208 -
189.209 - private void perform(Node node, int mode) {
189.210 - switch (mode) {
189.211 - case POPUP_MODE: performPopup(node); break;
189.212 - case MENU_MODE: performMenu(node); break;
189.213 - case API_MODE: performAPI(node); break;
189.214 - case SHORTCUT_MODE: performShortcut(node); break;
189.215 - default: throw new IllegalArgumentException("Wrong Action.MODE");
189.216 - }
189.217 - }
189.218 -
189.219 - private void perform(Node[] nodes, int mode) {
189.220 - switch (mode) {
189.221 - case POPUP_MODE: performPopup(nodes); break;
189.222 - case MENU_MODE: performMenu(nodes); break;
189.223 - case API_MODE: performAPI(nodes); break;
189.224 - case SHORTCUT_MODE: performShortcut(nodes); break;
189.225 - default: throw new IllegalArgumentException("Wrong Action.MODE");
189.226 - }
189.227 - }
189.228 -
189.229 - private void perform(ComponentOperator component, int mode) {
189.230 - switch (mode) {
189.231 - case POPUP_MODE: performPopup(component); break;
189.232 - case MENU_MODE: performMenu(component); break;
189.233 - case API_MODE: performAPI(component); break;
189.234 - case SHORTCUT_MODE: performShortcut(component); break;
189.235 - default: throw new IllegalArgumentException("Wrong Action.MODE");
189.236 - }
189.237 - }
189.238 -
189.239 -
189.240 - /** performs action depending on default mode,<br>
189.241 - * calls performPopup(), performMenu() or performAPI(),<br>
189.242 - * when default mode is not supported, others are tried */
189.243 - public void perform() {
189.244 - int modes[] = sequence[getDefaultMode()];
189.245 - for (int i=0; i<modes.length; i++) try {
189.246 - perform(modes[i]);
189.247 - return;
189.248 - } catch (UnsupportedOperationException e) {}
189.249 - }
189.250 -
189.251 - /** performs action depending on default mode,<br>
189.252 - * calls performPopup(), performMenu() or performAPI(),<br>
189.253 - * when default mode is not supported, others are tried
189.254 - * @param node node to be action performed on */
189.255 - public void perform(Node node) {
189.256 - int modes[] = sequence[getDefaultMode()];
189.257 - for (int i=0; i<modes.length; i++) try {
189.258 - perform(node, modes[i]);
189.259 - return;
189.260 - } catch (UnsupportedOperationException e) {}
189.261 - }
189.262 -
189.263 - /** performs action depending on default mode,<br>
189.264 - * calls performPopup(), performMenu() or performAPI(),<br>
189.265 - * when default mode is not supported, others are tried
189.266 - * @param nodes nodes to be action performed on */
189.267 - public void perform(Node[] nodes) {
189.268 - int modes[] = sequence[getDefaultMode()];
189.269 - for (int i=0; i<modes.length; i++) try {
189.270 - perform(nodes, modes[i]);
189.271 - return;
189.272 - } catch (UnsupportedOperationException e) {}
189.273 - }
189.274 -
189.275 - /** performs action depending on default mode,<br>
189.276 - * calls performPopup(), performMenu() or performAPI(),<br>
189.277 - * when default mode is not supported, others are tried
189.278 - * @param component component to be action performed on */
189.279 - public void perform(ComponentOperator component) {
189.280 - int modes[] = sequence[getDefaultMode()];
189.281 - for (int i=0; i<modes.length; i++) try {
189.282 - perform(component, modes[i]);
189.283 - return;
189.284 - } catch (UnsupportedOperationException e) {}
189.285 - }
189.286 -
189.287 - /** performs action through main menu
189.288 - * @throws UnsupportedOperationException when action does not support menu mode */
189.289 - public void performMenu() {
189.290 - if (menuPath==null) {
189.291 - throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
189.292 - }
189.293 - // Need to wait here to be more reliable.
189.294 - // TBD - It can be removed after issue 23663 is solved.
189.295 - new EventTool().waitNoEvent(500);
189.296 - Util.getMainMenu().pushMenu(menuPath);
189.297 - try {
189.298 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
189.299 - } catch (Exception e) {
189.300 - throw new JemmyException("Sleeping interrupted", e);
189.301 - }
189.302 - }
189.303 -
189.304 - /** performs action through main menu
189.305 - * @param node node to be action performed on
189.306 - * @throws UnsupportedOperationException when action does not support menu mode */
189.307 - public void performMenu(Node node) {
189.308 - performMenu(new Node[]{node});
189.309 - }
189.310 -
189.311 - /** performs action through main menu
189.312 - * @param nodes nodes to be action performed on
189.313 - * @throws UnsupportedOperationException when action does not support menu mode */
189.314 - public void performMenu(Node[] nodes) {
189.315 - if (menuPath==null)
189.316 - throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
189.317 - testNodes(nodes);
189.318 - nodes[0].select();
189.319 - for (int i=1; i<nodes.length; i++)
189.320 - nodes[i].addSelectionPath();
189.321 - try {
189.322 - Thread.sleep(SELECTION_WAIT_TIME);
189.323 - } catch (Exception e) {
189.324 - throw new JemmyException("Sleeping interrupted", e);
189.325 - }
189.326 - performMenu();
189.327 - }
189.328 -
189.329 - /** performs action through main menu
189.330 - * @param component component to be action performed on
189.331 - * @throws UnsupportedOperationException when action does not support menu mode */
189.332 - public void performMenu(ComponentOperator component) {
189.333 - component.getFocus();
189.334 - try {
189.335 - Thread.sleep(SELECTION_WAIT_TIME);
189.336 - } catch (Exception e) {
189.337 - throw new JemmyException("Sleeping interrupted", e);
189.338 - }
189.339 - performMenu();
189.340 - }
189.341 -
189.342 - /** performs action through popup menu
189.343 - * @throws UnsupportedOperationException */
189.344 - public void performPopup() {
189.345 - throw new UnsupportedOperationException(getClass().toString()+" does not implement performPopup()");
189.346 - }
189.347 -
189.348 - /** performs action through popup menu
189.349 - * @param node node to be action performed on
189.350 - * @throws UnsupportedOperationException when action does not support popup mode */
189.351 - public void performPopup(Node node) {
189.352 - performPopup(new Node[]{node});
189.353 - }
189.354 -
189.355 - /** performs action through popup menu
189.356 - * @param nodes nodes to be action performed on
189.357 - * @throws UnsupportedOperationException when action does not support popup mode */
189.358 - public void performPopup(Node[] nodes) {
189.359 - if (popupPath==null) {
189.360 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
189.361 - }
189.362 - testNodes(nodes);
189.363 - TreePath paths[]=new TreePath[nodes.length];
189.364 - for (int i=0; i<nodes.length; i++) {
189.365 - paths[i]=nodes[i].getTreePath();
189.366 - }
189.367 - ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
189.368 - ComponentVisualizer oldVisualizer = null;
189.369 - // If visualizer of JTreeOperator is EmptyVisualizer, we need
189.370 - // to avoid making tree component visible in callPopup method.
189.371 - // So far only known case is tree from TreeTableOperator.
189.372 - if(treeVisualizer instanceof EmptyVisualizer) {
189.373 - oldVisualizer = Operator.getDefaultComponentVisualizer();
189.374 - Operator.setDefaultComponentVisualizer(treeVisualizer);
189.375 - }
189.376 - // Need to wait here to be more reliable.
189.377 - // TBD - It can be removed after issue 23663 is solved.
189.378 - new EventTool().waitNoEvent(500);
189.379 - JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
189.380 - // restore previously used default visualizer
189.381 - if(oldVisualizer != null) {
189.382 - Operator.setDefaultComponentVisualizer(oldVisualizer);
189.383 - }
189.384 - popup.pushMenu(popupPath, "|", getComparator());
189.385 - try {
189.386 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
189.387 - } catch (Exception e) {
189.388 - throw new JemmyException("Sleeping interrupted", e);
189.389 - }
189.390 - }
189.391 -
189.392 - /** performs action through popup menu
189.393 - * @param component component to be action performed on
189.394 - * @throws UnsupportedOperationException when action does not support popup mode */
189.395 - public void performPopup(ComponentOperator component) {
189.396 - if (popupPath==null) {
189.397 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
189.398 - }
189.399 - // Need to wait here to be more reliable.
189.400 - // TBD - It can be removed after issue 23663 is solved.
189.401 - new EventTool().waitNoEvent(500);
189.402 - component.clickForPopup();
189.403 - new JPopupMenuOperator(component).pushMenu(popupPath, "|", getComparator());
189.404 - try {
189.405 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
189.406 - } catch (Exception e) {
189.407 - throw new JemmyException("Sleeping interrupted", e);
189.408 - }
189.409 - }
189.410 -
189.411 - /** performs action through API
189.412 - * @throws UnsupportedOperationException when action does not support API mode */
189.413 - public void performAPI() {
189.414 - if (systemActionClass==null) {
189.415 - throw new UnsupportedOperationException(getClass().toString()+" does not support API call.");
189.416 - }
189.417 - try {
189.418 - // actions has to be invoked in dispatch thread (see http://www.netbeans.org/issues/show_bug.cgi?id=35755)
189.419 - EventQueue.invokeAndWait(new Runnable() {
189.420 - public void run() {
189.421 - if(SystemAction.class.isAssignableFrom(systemActionClass)) {
189.422 - // SystemAction used in IDE
189.423 - SystemAction.get(systemActionClass).actionPerformed(
189.424 - new ActionEvent(new Container(), 0, null));
189.425 - } else {
189.426 - // action implements javax.swing.Action
189.427 - try {
189.428 - ((javax.swing.Action)systemActionClass.newInstance()).actionPerformed(null);
189.429 - } catch (Exception e) {
189.430 - throw new JemmyException("Exception when trying to create instance of action \""+systemActionClass.getName()+"\".", e);
189.431 - }
189.432 - }
189.433 - }
189.434 - });
189.435 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
189.436 - } catch (Exception e) {
189.437 - throw new JemmyException("Interrupted", e);
189.438 - }
189.439 - }
189.440 -
189.441 - /** performs action through API
189.442 - * @param node node to be action performed on
189.443 - * @throws UnsupportedOperationException when action does not support API mode */
189.444 - public void performAPI(Node node) {
189.445 - performAPI(new Node[]{node});
189.446 - }
189.447 -
189.448 - /** performs action through API
189.449 - * @param nodes nodes to be action performed on
189.450 - * @throws UnsupportedOperationException when action does not support API mode */
189.451 - public void performAPI(Node[] nodes) {
189.452 - if (systemActionClass==null)
189.453 - throw new UnsupportedOperationException(getClass().toString()+" does not define SystemAction");
189.454 - testNodes(nodes);
189.455 - nodes[0].select();
189.456 - for (int i=1; i<nodes.length; i++)
189.457 - nodes[i].addSelectionPath();
189.458 - try {
189.459 - Thread.sleep(SELECTION_WAIT_TIME);
189.460 - } catch (Exception e) {
189.461 - throw new JemmyException("Sleeping interrupted", e);
189.462 - }
189.463 - performAPI();
189.464 - }
189.465 -
189.466 - /** performs action through API
189.467 - * @param component component to be action performed on
189.468 - * @throws UnsupportedOperationException when action does not support API mode */
189.469 - public void performAPI(ComponentOperator component) {
189.470 - component.getFocus();
189.471 - try {
189.472 - Thread.sleep(SELECTION_WAIT_TIME);
189.473 - } catch (Exception e) {
189.474 - throw new JemmyException("Sleeping interrupted", e);
189.475 - }
189.476 - performAPI();
189.477 - }
189.478 -
189.479 - /** performs action through shortcut
189.480 - * @throws UnsupportedOperationException if no shortcut is defined */
189.481 - public void performShortcut() {
189.482 - if (shortcuts == null) {
189.483 - throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
189.484 - }
189.485 - for(int i=0; i<shortcuts.length; i++) {
189.486 - new KeyRobotDriver(null).pushKey(null, shortcuts[i].getKeyCode(), shortcuts[i].getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
189.487 - JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
189.488 - }
189.489 - try {
189.490 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
189.491 - } catch (Exception e) {
189.492 - throw new JemmyException("Sleeping interrupted", e);
189.493 - }
189.494 - }
189.495 -
189.496 - /** performs action through shortcut
189.497 - * @param node node to be action performed on
189.498 - * @throws UnsupportedOperationException when action does not support shortcut mode */
189.499 - public void performShortcut(Node node) {
189.500 - performShortcut(new Node[]{node});
189.501 - }
189.502 -
189.503 - /** performs action through shortcut
189.504 - * @param nodes nodes to be action performed on
189.505 - * @throws UnsupportedOperationException when action does not support shortcut mode */
189.506 - public void performShortcut(Node[] nodes) {
189.507 - if (shortcuts == null) {
189.508 - throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
189.509 - }
189.510 - testNodes(nodes);
189.511 - nodes[0].select();
189.512 - for (int i=1; i<nodes.length; i++)
189.513 - nodes[i].addSelectionPath();
189.514 - try {
189.515 - Thread.sleep(SELECTION_WAIT_TIME);
189.516 - } catch (Exception e) {
189.517 - throw new JemmyException("Sleeping interrupted", e);
189.518 - }
189.519 - performShortcut();
189.520 - }
189.521 -
189.522 - /** performs action through shortcut
189.523 - * @param component component to be action performed on
189.524 - * @throws UnsupportedOperationException when action does not support shortcut mode */
189.525 - public void performShortcut(ComponentOperator component) {
189.526 - component.getFocus();
189.527 - try {
189.528 - Thread.sleep(SELECTION_WAIT_TIME);
189.529 - } catch (Exception e) {
189.530 - throw new JemmyException("Sleeping interrupted", e);
189.531 - }
189.532 - performShortcut();
189.533 - }
189.534 -
189.535 - /** tests if nodes are all from the same tree
189.536 - * @param nodes nodes
189.537 - * @throws IllegalArgumentException when given nodes does not pass */
189.538 - protected void testNodes(Node[] nodes) {
189.539 - if ((nodes==null)||(nodes.length==0))
189.540 - throw new IllegalArgumentException("argument nodes is null or empty");
189.541 - Class myClass = getClass();
189.542 - Component nodesTree=nodes[0].tree().getSource();
189.543 - for (int i=0; i<nodes.length; i++) {
189.544 -// if (!nodes[i].hasAction(myClass))
189.545 -// throw new IllegalArgumentException(this.toString()+" could not be performed on "+nodes[i].toString());
189.546 - if (nodes[i]==null)
189.547 - throw new IllegalArgumentException("argument nodes contains null value");
189.548 - if (!nodesTree.equals(nodes[i].tree().getSource()))
189.549 - throw new IllegalArgumentException(nodes[i].toString()+" is from different tree");
189.550 - }
189.551 - }
189.552 -
189.553 - /** Returns default mode in which actions are performed.
189.554 - * @return default mode in which actions are performed
189.555 - * @see #POPUP_MODE
189.556 - * @see #MENU_MODE
189.557 - * @see #API_MODE
189.558 - * @see #SHORTCUT_MODE
189.559 - */
189.560 - public int getDefaultMode() {
189.561 - int mode=(((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
189.562 - if (mode<0 || mode>3)
189.563 - return POPUP_MODE;
189.564 - return mode;
189.565 - }
189.566 -
189.567 - /** Sets default mode in which actions are performed. If given mode value
189.568 - * is not valid, it sets {@link #POPUP_MODE} as default.
189.569 - * @param mode mode to be set
189.570 - * @return previous value
189.571 - * @see #POPUP_MODE
189.572 - * @see #MENU_MODE
189.573 - * @see #API_MODE
189.574 - * @see #SHORTCUT_MODE
189.575 - */
189.576 - public int setDefaultMode(int mode) {
189.577 - int oldMode = (((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
189.578 - if (mode<0 || mode>3) {
189.579 - mode = POPUP_MODE;
189.580 - }
189.581 - JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(mode));
189.582 - return oldMode;
189.583 - }
189.584 -
189.585 -
189.586 - /** Sets comparator fot this action. Comparator is used for all actions
189.587 - * after this method is called.
189.588 - * @param comparator new comparator to be set (e.g.
189.589 - * new Operator.DefaultStringComparator(true, true);
189.590 - * to search string item exactly and case sensitive)
189.591 - */
189.592 - public void setComparator(StringComparator comparator) {
189.593 - this.comparator = comparator;
189.594 - }
189.595 -
189.596 - /** Gets comparator set for this action instance.
189.597 - * @return comparator set for this action instance.
189.598 - */
189.599 - public StringComparator getComparator() {
189.600 - if(comparator == null) {
189.601 - comparator = defaultComparator;
189.602 - }
189.603 - return comparator;
189.604 - }
189.605 -
189.606 - /** getter for popup menu path
189.607 - * @return String popup menu path (or null if not suported)
189.608 - */
189.609 - public String getPopupPath() {
189.610 - return popupPath;
189.611 - }
189.612 -
189.613 - /** getter for main menu path
189.614 - * @return String main menu path (or null if not suported)
189.615 - */
189.616 - public String getMenuPath() {
189.617 - return menuPath;
189.618 - }
189.619 -
189.620 - /** getter for system action class
189.621 - * @return Class of system action (or null if not suported)
189.622 - */
189.623 - public Class getSystemActionClass() {
189.624 - return systemActionClass;
189.625 - }
189.626 -
189.627 - /** getter for array of shortcuts
189.628 - * @return Shortcut[] (or null if not suported)
189.629 - */
189.630 - public Shortcut[] getShortcuts() {
189.631 - return shortcuts;
189.632 - }
189.633 -
189.634 - /** Checks whether this action is enabled. If IDE system action class
189.635 - * is defined, it calls its isEnabled() method else if main menu path is
189.636 - * defined, it checks menu item is enabled. Otherwise it throws
189.637 - * UnsupportedOperationException.
189.638 - * @return true if this action is enabled; false otherwise
189.639 - */
189.640 - public boolean isEnabled() {
189.641 - if(systemActionClass != null) {
189.642 - return SystemAction.get(systemActionClass).isEnabled();
189.643 - } else if(menuPath != null) {
189.644 - return Util.getMainMenu().showMenuItem(
189.645 - menuPath, "|", getComparator()).isEnabled();
189.646 - } else {
189.647 - throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
189.648 - }
189.649 - }
189.650 -
189.651 - /** Checks whether this action on given nodes is enabled. If IDE system action class
189.652 - * is defined, it calls its isEnabled() method. Nodes are selected first.
189.653 - * Else if popup menu path is defined, it checks menu item is enabled.
189.654 - * Otherwise it throws UnsupportedOperationException.
189.655 - * @param nodes array of nodes to be selected before a check
189.656 - * @return true if this action is enabled; false otherwise
189.657 - */
189.658 - public boolean isEnabled(Node[] nodes) {
189.659 - testNodes(nodes);
189.660 - if(systemActionClass != null) {
189.661 - nodes[0].select();
189.662 - for (int i=1; i<nodes.length; i++)
189.663 - nodes[i].addSelectionPath();
189.664 - try {
189.665 - Thread.sleep(SELECTION_WAIT_TIME);
189.666 - } catch (Exception e) {
189.667 - throw new JemmyException("Sleeping interrupted", e);
189.668 - }
189.669 - return SystemAction.get(systemActionClass).isEnabled();
189.670 - } else if(popupPath != null) {
189.671 - TreePath paths[]=new TreePath[nodes.length];
189.672 - for (int i=0; i<nodes.length; i++) {
189.673 - paths[i]=nodes[i].getTreePath();
189.674 - }
189.675 - ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
189.676 - ComponentVisualizer oldVisualizer = null;
189.677 - // If visualizer of JTreeOperator is EmptyVisualizer, we need
189.678 - // to avoid making tree component visible in callPopup method.
189.679 - // So far only known case is tree from TreeTableOperator.
189.680 - if(treeVisualizer instanceof EmptyVisualizer) {
189.681 - oldVisualizer = Operator.getDefaultComponentVisualizer();
189.682 - Operator.setDefaultComponentVisualizer(treeVisualizer);
189.683 - }
189.684 - // Need to wait here to be more reliable.
189.685 - // TBD - It can be removed after issue 23663 is solved.
189.686 - new EventTool().waitNoEvent(500);
189.687 - JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
189.688 - // restore previously used default visualizer
189.689 - if(oldVisualizer != null) {
189.690 - Operator.setDefaultComponentVisualizer(oldVisualizer);
189.691 - }
189.692 - return popup.showMenuItem(popupPath, "|", getComparator()).isEnabled();
189.693 - } else {
189.694 - throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
189.695 - }
189.696 - }
189.697 -
189.698 - /** Checks whether this action on given node is enabled. If IDE system action class
189.699 - * is defined, it calls its isEnabled() method. Node is selected first.
189.700 - * Else if popup menu path is defined, it checks menu item is enabled.
189.701 - * Otherwise it throws UnsupportedOperationException.
189.702 - * @param node node to be selected before a check
189.703 - * @return true if this action is enabled; false otherwise
189.704 - */
189.705 - public boolean isEnabled(Node node) {
189.706 - return isEnabled(new Node[] {node});
189.707 - }
189.708 -
189.709 - /** Checks whether this action is enabled for given ComponentOperator.
189.710 - * First it makes component visible and focused.
189.711 - * If IDE system action class is defined, it calls its isEnabled() method.
189.712 - * Else if main menu path is defined, it checks menu item is enabled.
189.713 - * Otherwise it throws UnsupportedOperationException.
189.714 - * @param componentOperator instance of ComponentOperator
189.715 - * @return true if this action is enabled; false otherwise
189.716 - */
189.717 - public boolean isEnabled(ComponentOperator componentOperator) {
189.718 - componentOperator.makeComponentVisible();
189.719 - componentOperator.getFocus();
189.720 - if(systemActionClass != null) {
189.721 - return SystemAction.get(systemActionClass).isEnabled();
189.722 - } else if(popupPath != null) {
189.723 - // Need to wait here to be more reliable.
189.724 - // TBD - It can be removed after issue 23663 is solved.
189.725 - new EventTool().waitNoEvent(500);
189.726 - componentOperator.clickForPopup();
189.727 - return new JPopupMenuOperator(componentOperator).showMenuItem(
189.728 - popupPath, "|", getComparator()).isEnabled();
189.729 - } else if(menuPath != null) {
189.730 - return Util.getMainMenu().showMenuItem(
189.731 - menuPath, "|", getComparator()).isEnabled();
189.732 - } else {
189.733 - throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
189.734 - }
189.735 - }
189.736 -
189.737 - /** This class defines keyboard shortcut for action execution */
189.738 - public static class Shortcut extends Object {
189.739 - /** key code of shortcut (see KeyEvent) */
189.740 - protected int keyCode;
189.741 - /** key modifiers of shortcut (see KeyEvent) */
189.742 - protected int keyModifiers;
189.743 -
189.744 - /** creates new shortcut
189.745 - * @param keyCode int key code (see KeyEvent) */
189.746 - public Shortcut(int keyCode) {
189.747 - this(keyCode, 0);
189.748 - }
189.749 -
189.750 - /** creates new shortcut
189.751 - * @param keyCode int key code (see KeyEvent)
189.752 - * @param keyModifiers int key modifiers (see KeyEvent) */
189.753 - public Shortcut(int keyCode, int keyModifiers) {
189.754 - this.keyCode=keyCode;
189.755 - this.keyModifiers=keyModifiers;
189.756 - }
189.757 -
189.758 - /** getter for key code
189.759 - * @return int key code */
189.760 - public int getKeyCode() {
189.761 - return keyCode;
189.762 - }
189.763 -
189.764 - /** getter for key modifiers
189.765 - * @return int key modifiers */
189.766 - public int getKeyModifiers() {
189.767 - return keyModifiers;
189.768 - }
189.769 -
189.770 - /** returns String representation of shortcut
189.771 - * @return String representation of shortcut */
189.772 - public String toString() {
189.773 - String s=KeyEvent.getKeyModifiersText(getKeyModifiers());
189.774 - return s+(s.length()>0?"+":"")+KeyEvent.getKeyText(getKeyCode());
189.775 - }
189.776 - }
189.777 -}
190.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/Bundle.java Thu Jul 10 04:29:52 2008 -0700
190.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
190.3 @@ -1,210 +0,0 @@
190.4 -/*
190.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
190.6 - *
190.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
190.8 - *
190.9 - * The contents of this file are subject to the terms of either the GNU
190.10 - * General Public License Version 2 only ("GPL") or the Common
190.11 - * Development and Distribution License("CDDL") (collectively, the
190.12 - * "License"). You may not use this file except in compliance with the
190.13 - * License. You can obtain a copy of the License at
190.14 - * http://www.netbeans.org/cddl-gplv2.html
190.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
190.16 - * specific language governing permissions and limitations under the
190.17 - * License. When distributing the software, include this License Header
190.18 - * Notice in each file and include the License file at
190.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
190.20 - * particular file as subject to the "Classpath" exception as provided
190.21 - * by Sun in the GPL Version 2 section of the License file that
190.22 - * accompanied this code. If applicable, add the following below the
190.23 - * License Header, with the fields enclosed by brackets [] replaced by
190.24 - * your own identifying information:
190.25 - * "Portions Copyrighted [year] [name of copyright owner]"
190.26 - *
190.27 - * Contributor(s):
190.28 - *
190.29 - * The Original Software is NetBeans. The Initial Developer of the Original
190.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
190.31 - * Microsystems, Inc. All Rights Reserved.
190.32 - *
190.33 - * If you wish your version of this file to be governed by only the CDDL
190.34 - * or only the GPL Version 2, indicate your decision by adding
190.35 - * "[Contributor] elects to include this software in this distribution
190.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
190.37 - * single choice of license, a recipient has the option to distribute
190.38 - * your version of this file under either the CDDL, the GPL Version 2 or
190.39 - * to extend the choice of license to its licensees as provided above.
190.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
190.41 - * Version 2 license, then the option applies only if the new code is
190.42 - * made subject to such option by the copyright holder.
190.43 - */
190.44 -
190.45 -package org.netbeans.modules.visualweb.gravy;
190.46 -
190.47 -import java.util.MissingResourceException;
190.48 -import java.util.ResourceBundle;
190.49 -import org.netbeans.jemmy.JemmyException;
190.50 -import org.openide.util.NbBundle;
190.51 -
190.52 -/** Helper class to get strings from NetBeans Bundle.properties files.
190.53 - * <br>
190.54 - * Everytime someone wants to identify a component by its title, label, caption or whatever,
190.55 - * he should not use hard coded string in his test case but he should use
190.56 - * <code>Bundle.getString(bundleName, key)</code> to obtain string from bundle.
190.57 - * Then test cases can be executed on different than English locale because
190.58 - * <code>getString()</code> methods returns string according to current locale.
190.59 - * <br><br>
190.60 - * Usage:
190.61 - * <br><pre>
190.62 - * // "OK"
190.63 - * Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION");
190.64 - * // "Properties of AnObject"
190.65 - * Bundle.getString("org.netbeans.core.Bundle", "CTL_FMT_LocalProperties", new Object[] {new Integer(1), "AnObject"});
190.66 - * // "View"
190.67 - * Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View");
190.68 - * </pre>
190.69 - */
190.70 -public class Bundle {
190.71 -
190.72 - /** Placeholder to disallow creating of instances. */
190.73 - private Bundle() {
190.74 - throw new Error("Bundle is just a container for static methods");
190.75 - }
190.76 -
190.77 - /** Returns ResourceBundle from specified path.
190.78 - * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
190.79 - * @return ResourceBundle instance
190.80 - */
190.81 - public static ResourceBundle getBundle(String bundle) {
190.82 - try {
190.83 - return NbBundle.getBundle(bundle);
190.84 - } catch (NullPointerException e) {
190.85 - throw new JemmyException("\"" + bundle + "\" bundle has not been found", e);
190.86 - } catch (MissingResourceException e) {
190.87 - throw new JemmyException("\"" + bundle + "\" bundle has not been found", e);
190.88 - }
190.89 - }
190.90 -
190.91 - /** Gets string from specified ResourceBundle.
190.92 - * @param bundle instance of ResourceBundle
190.93 - * @param key key of requested string
190.94 - * @return string from bundle in current locale
190.95 - */
190.96 - public static String getString(ResourceBundle bundle, String key) {
190.97 - try {
190.98 - return bundle.getString(key);
190.99 - } catch (MissingResourceException e) {
190.100 - throw new JemmyException("\"" + key + "\" key has not been found", e);
190.101 - } catch (NullPointerException npe) {
190.102 - throw new JemmyException("Cannot accept null parameter.", npe);
190.103 - }
190.104 - }
190.105 -
190.106 - /** Gets string from bundle specified by path to bundle and format it.
190.107 - * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
190.108 - * @param key key of requested string
190.109 - * @param params parameters to be formatted
190.110 - * @return string from bundle in current locale with formatted parameters
190.111 - */
190.112 - public static String getString(ResourceBundle bundle, String key, Object[] params) {
190.113 - return java.text.MessageFormat.format(getString(bundle, key), params);
190.114 - }
190.115 -
190.116 - /** Gets string from bundle specified by path to bundle.
190.117 - * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
190.118 - * @param key key of requested string
190.119 - * @return string from bundle in current locale
190.120 - */
190.121 - public static String getString(String bundle, String key) {
190.122 - return getString(getBundle(bundle), key);
190.123 - }
190.124 -
190.125 - /** Gets string from bundle, removes mnemonic (i.e. '&' or '(&X)') from it
190.126 - * and cuts parameters like {0} from the end.
190.127 - * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
190.128 - * @param key key of requested string
190.129 - * @return string from bundle in current locale. Mnemonic (i.e. '&' or '(&X)')
190.130 - * is removed and parameter patterns are also removed starting by first '{'.
190.131 - */
190.132 - public static String getStringTrimmed(String bundle, String key) {
190.133 - return trim(getString(getBundle(bundle), key));
190.134 - }
190.135 -
190.136 - /** Gets string from bundle specified by path to bundle and format it.
190.137 - * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
190.138 - * @param key key of requested string
190.139 - * @param params parameter to be formatted
190.140 - * @return string from bundle in current locale with formatted parameters
190.141 - */
190.142 - public static String getString(String bundle, String key, Object[] params) {
190.143 - return java.text.MessageFormat.format(getString(bundle, key), params);
190.144 - }
190.145 -
190.146 - /** Gets string from bundle and formats it. It removes mnemonic (i.e. '&' or '(&X)')
190.147 - * from it and cuts parameters like {0} from the end if any.
190.148 - * @param bundle path to bundle (e.g. "org.netbeans.core.Bundle")
190.149 - * @param key key of requested string
190.150 - * @param params parameter to be formatted
190.151 - * @return string from bundle in current locale. Mnemonic and parameters
190.152 - * like {0} removed from the end.
190.153 - */
190.154 - public static String getStringTrimmed(String bundle, String key, Object[] params) {
190.155 - return trim(getString(getBundle(bundle), key, params));
190.156 - }
190.157 -
190.158 - /** Removes mnemonic (i.e. '&' or '(&X)') and cut parameters like {0} from the end.
190.159 - * @param value string to modify
190.160 - * @return string with removed mnemonic and parameters like {0} from the end.
190.161 - */
190.162 - private static String trim(String value) {
190.163 - // remove mnemonic, i.e. '&' or '(&X)'
190.164 - value = cutAmpersand(value);
190.165 - // cut parameters like {0} from string
190.166 - if(value.indexOf('{')!=-1) {
190.167 - value = value.substring(0, value.indexOf('{'));
190.168 - }
190.169 - return value;
190.170 - }
190.171 -
190.172 - /**
190.173 - * Removes an ampersand from a text string; commonly used to strip out unneeded mnemonics.
190.174 - * Replaces the first occurence of <samp>&?</samp> by <samp>?</samp> or <samp>(&??</samp> by the empty string
190.175 - * where <samp>?</samp> is a wildcard for any character.
190.176 - * <samp>&?</samp> is a shortcut in English locale.
190.177 - * <samp>(&?)</samp> is a shortcut in Japanese locale.
190.178 - * Used to remove shortcuts from workspace names (or similar) when shortcuts are not supported.
190.179 - * <p>The current implementation behaves in the same way regardless of locale.
190.180 - * In case of a conflict it would be necessary to change the
190.181 - * behavior based on the current locale.
190.182 - * @param text a localized label that may have mnemonic information in it
190.183 - * @return string without first <samp>&</samp> if there was any
190.184 - */
190.185 - private static String cutAmpersand(String text) {
190.186 - // modified code of org.openide.awt.Actions.cutAmpersand
190.187 - // see also org.openide.awt.Mnemonics
190.188 - int i;
190.189 - String result = text;
190.190 - /* First check of occurence of '(&'. If not found check
190.191 - * for '&' itself.
190.192 - * If '(&' is found then remove '(&??' and rest of line.
190.193 - */
190.194 - i = text.indexOf("(&"); // NOI18N
190.195 - if (i >= 0 && i + 3 < text.length() && /* #31093 */text.charAt(i + 3) == ')') { // NOI18N
190.196 - result = text.substring(0, i);
190.197 - } else {
190.198 - //Sequence '(&?)' not found look for '&' itself
190.199 - i = text.indexOf('&');
190.200 - if (i < 0) {
190.201 - //No ampersand
190.202 - result = text;
190.203 - } else if (i == (text.length() - 1)) {
190.204 - //Ampersand is last character, wrong shortcut but we remove it anyway
190.205 - result = text.substring(0, i);
190.206 - } else {
190.207 - //Remove ampersand from middle of string
190.208 - result = text.substring(0, i) + text.substring(i + 1);
190.209 - }
190.210 - }
190.211 - return result;
190.212 - }
190.213 -}
191.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/Bundle.properties Thu Jul 10 04:29:52 2008 -0700
191.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
191.3 @@ -1,57 +0,0 @@
191.4 -#DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
191.5 -#
191.6 -#Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
191.7 -#
191.8 -#The contents of this file are subject to the terms of either the GNU
191.9 -#General Public License Version 2 only ("GPL") or the Common
191.10 -#Development and Distribution License("CDDL") (collectively, the
191.11 -#"License"). You may not use this file except in compliance with the
191.12 -#License. You can obtain a copy of the License at
191.13 -#http://www.netbeans.org/cddl-gplv2.html
191.14 -#or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
191.15 -#specific language governing permissions and limitations under the
191.16 -#License. When distributing the software, include this License Header
191.17 -#Notice in each file and include the License file at
191.18 -#nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
191.19 -#particular file as subject to the "Classpath" exception as provided
191.20 -#by Sun in the GPL Version 2 section of the License file that
191.21 -#accompanied this code. If applicable, add the following below the
191.22 -#License Header, with the fields enclosed by brackets [] replaced by
191.23 -#your own identifying information:
191.24 -#"Portions Copyrighted [year] [name of copyright owner]"
191.25 -#
191.26 -#Contributor(s):
191.27 -#
191.28 -#The Original Software is NetBeans. The Initial Developer of the Original
191.29 -#Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
191.30 -#Microsystems, Inc. All Rights Reserved.
191.31 -#
191.32 -#If you wish your version of this file to be governed by only the CDDL
191.33 -#or only the GPL Version 2, indicate your decision by adding
191.34 -#"[Contributor] elects to include this software in this distribution
191.35 -#under the [CDDL or GPL Version 2] license." If you do not indicate a
191.36 -#single choice of license, a recipient has the option to distribute
191.37 -#your version of this file under either the CDDL, the GPL Version 2 or
191.38 -#to extend the choice of license to its licensees as provided above.
191.39 -#However, if you add GPL Version 2 code and therefore, elected the GPL
191.40 -#Version 2 license, then the option applies only if the new code is
191.41 -#made subject to such option by the copyright holder.
191.42 -# Project Navigation Window
191.43 -ProjectNode_WebPages=Web Pages
191.44 -ProjectMenuItem_New=New
191.45 -ProjectMenuItem_Open=Open
191.46 -ProjectMenuItem_Page=Visual Web JSF Page...
191.47 -Dialog_NewPage=New Visual Web JSF Page
191.48 -WebPage_extension=.jsp
191.49 -
191.50 -
191.51 -#Designer Panel
191.52 -DesignerMenuItem_SetImage=Set Image...
191.53 -Dialog_ImageCustomizer=Image Customizer -
191.54 -
191.55 -# Property Sheet Window
191.56 -PropertySheet_AddFile=Add File
191.57 -
191.58 -#General
191.59 -Button_Finish=Finish
191.60 -Button_OK=OK
192.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/CompletionPaneOperator.java Thu Jul 10 04:29:52 2008 -0700
192.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
192.3 @@ -1,67 +0,0 @@
192.4 -/*
192.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
192.6 - *
192.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
192.8 - *
192.9 - * The contents of this file are subject to the terms of either the GNU
192.10 - * General Public License Version 2 only ("GPL") or the Common
192.11 - * Development and Distribution License("CDDL") (collectively, the
192.12 - * "License"). You may not use this file except in compliance with the
192.13 - * License. You can obtain a copy of the License at
192.14 - * http://www.netbeans.org/cddl-gplv2.html
192.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
192.16 - * specific language governing permissions and limitations under the
192.17 - * License. When distributing the software, include this License Header
192.18 - * Notice in each file and include the License file at
192.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
192.20 - * particular file as subject to the "Classpath" exception as provided
192.21 - * by Sun in the GPL Version 2 section of the License file that
192.22 - * accompanied this code. If applicable, add the following below the
192.23 - * License Header, with the fields enclosed by brackets [] replaced by
192.24 - * your own identifying information:
192.25 - * "Portions Copyrighted [year] [name of copyright owner]"
192.26 - *
192.27 - * Contributor(s):
192.28 - *
192.29 - * The Original Software is NetBeans. The Initial Developer of the Original
192.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
192.31 - * Microsystems, Inc. All Rights Reserved.
192.32 - *
192.33 - * If you wish your version of this file to be governed by only the CDDL
192.34 - * or only the GPL Version 2, indicate your decision by adding
192.35 - * "[Contributor] elects to include this software in this distribution
192.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
192.37 - * single choice of license, a recipient has the option to distribute
192.38 - * your version of this file under either the CDDL, the GPL Version 2 or
192.39 - * to extend the choice of license to its licensees as provided above.
192.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
192.41 - * Version 2 license, then the option applies only if the new code is
192.42 - * made subject to such option by the copyright holder.
192.43 - */
192.44 -
192.45 -package org.netbeans.modules.visualweb.gravy;
192.46 -
192.47 -import java.awt.Component;
192.48 -import org.netbeans.editor.ext.*;
192.49 -import org.netbeans.jemmy.ComponentChooser;
192.50 -import org.netbeans.jemmy.operators.*;
192.51 -
192.52 -/**
192.53 - * CompletionPaneOperator class
192.54 - */
192.55 -public class CompletionPaneOperator extends JScrollPaneOperator {
192.56 -
192.57 - public CompletionPaneOperator(ContainerOperator contOper) {
192.58 - super(contOper, new CompletionPaneChooser());
192.59 -
192.60 - }
192.61 - public static class CompletionPaneChooser implements ComponentChooser {
192.62 - public boolean checkComponent(Component comp) {
192.63 - //return(comp instanceof org.netbeans.editor.ext.ScrollCompletionPane);
192.64 - return(comp instanceof javax.swing.JScrollPane);
192.65 - }
192.66 - public String getDescription() {
192.67 - return("Completion Pane Operator");
192.68 - }
192.69 - }
192.70 -}
193.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/DNDDriver.java Thu Jul 10 04:29:52 2008 -0700
193.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
193.3 @@ -1,110 +0,0 @@
193.4 -/*
193.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
193.6 -*
193.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
193.8 -*
193.9 -* The contents of this file are subject to the terms of either the GNU
193.10 -* General Public License Version 2 only ("GPL") or the Common
193.11 -* Development and Distribution License("CDDL") (collectively, the
193.12 -* "License"). You may not use this file except in compliance with the
193.13 -* License. You can obtain a copy of the License at
193.14 -* http://www.netbeans.org/cddl-gplv2.html
193.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
193.16 -* specific language governing permissions and limitations under the
193.17 -* License. When distributing the software, include this License Header
193.18 -* Notice in each file and include the License file at
193.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
193.20 -* particular file as subject to the "Classpath" exception as provided
193.21 -* by Sun in the GPL Version 2 section of the License file that
193.22 -* accompanied this code. If applicable, add the following below the
193.23 -* License Header, with the fields enclosed by brackets [] replaced by
193.24 -* your own identifying information:
193.25 -* "Portions Copyrighted [year] [name of copyright owner]"
193.26 -*
193.27 -* Contributor(s):
193.28 -*
193.29 -* The Original Software is NetBeans. The Initial Developer of the Original
193.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
193.31 -* Microsystems, Inc. All Rights Reserved.
193.32 -*
193.33 -* If you wish your version of this file to be governed by only the CDDL
193.34 -* or only the GPL Version 2, indicate your decision by adding
193.35 -* "[Contributor] elects to include this software in this distribution
193.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
193.37 -* single choice of license, a recipient has the option to distribute
193.38 -* your version of this file under either the CDDL, the GPL Version 2 or
193.39 -* to extend the choice of license to its licensees as provided above.
193.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
193.41 -* Version 2 license, then the option applies only if the new code is
193.42 -* made subject to such option by the copyright holder.
193.43 -*/
193.44 -
193.45 -package org.netbeans.modules.visualweb.gravy;
193.46 -
193.47 -import java.awt.Point;
193.48 -import org.netbeans.jemmy.Timeout;
193.49 -import org.netbeans.jemmy.drivers.input.MouseRobotDriver;
193.50 -import org.netbeans.jemmy.operators.ComponentOperator;
193.51 -import org.netbeans.jemmy.operators.Operator;
193.52 -
193.53 -/**
193.54 - * This class allows tester to imitate "drag-and-drop" action (the appropriate
193.55 - * sequence of events), as if a mouse is being used in an automated test by hand.
193.56 - */
193.57 -public class DNDDriver {
193.58 - MouseRobotDriver mDriver;
193.59 - Timeout beforeDragSleep, afterDragSleep;
193.60 -
193.61 - /**
193.62 - * Creates a new instance of DNDDriver
193.63 - */
193.64 - public DNDDriver() {
193.65 - mDriver = new MouseRobotDriver(new Timeout("", 10));
193.66 - beforeDragSleep = new Timeout("", 100);
193.67 - afterDragSleep = new Timeout("", 10);
193.68 - }
193.69 -
193.70 - /**
193.71 - * Performs "drag-and-drop" action.
193.72 - * @param source an component, which should be moved
193.73 - * @param from a point inside the source component, where mouse cursor should be placed
193.74 - * @param target an component, on which the source component should be dropped
193.75 - * @param to a point inside the target component, where mouse cursor should be placed finally
193.76 - * @param button defines, which mouse button should be used (left, right,...)
193.77 - * @param modifiers defines, which additional keyboard keys (Ctrl, Alt,...) should be used
193.78 - */
193.79 - public void dnd(ComponentOperator source, Point from, ComponentOperator target, Point to, int button, int modifiers) {
193.80 - mDriver.moveMouse(source, from.x, from.y);
193.81 - mDriver.pressMouse(source, from.x, from.y, button, modifiers);
193.82 - beforeDragSleep.sleep();
193.83 - mDriver.moveMouse(source, from.x, from.y);
193.84 - mDriver.moveMouse(source, from.x + 1, from.y + 1);
193.85 - mDriver.moveMouse(target, to.x + 1, to.y + 1);
193.86 - mDriver.moveMouse(target, to.x, to.y);
193.87 - afterDragSleep.sleep();
193.88 - mDriver.releaseMouse(target, to.x, to.y, button, modifiers);
193.89 - }
193.90 -
193.91 - /**
193.92 - * Performs "drag-and-drop" action.
193.93 - * @param source an component, which should be moved
193.94 - * @param from a point inside the source component, where mouse cursor should be placed
193.95 - * @param target an component, on which the source component should be dropped
193.96 - * @param to a point inside the target component, where mouse cursor should be placed finally
193.97 - */
193.98 - public void dnd(ComponentOperator source, Point from, ComponentOperator target, Point to) {
193.99 - dnd(source, from, target, to, Operator.getDefaultMouseButton(), 0);
193.100 - }
193.101 -
193.102 - /**
193.103 - * Performs "drag-and-drop" action.
193.104 - * @param source an component, which should be moved
193.105 - * @param target an component, on which the source component should be dropped
193.106 - */
193.107 - public void dnd(ComponentOperator source, ComponentOperator target) {
193.108 - dnd(source, new Point(source.getCenterXForClick(),
193.109 - source.getCenterYForClick()),
193.110 - target, new Point(target.getCenterXForClick(),
193.111 - target.getCenterYForClick()));
193.112 - }
193.113 -}
194.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/DeploymentDialogOperator.java Thu Jul 10 04:29:52 2008 -0700
194.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
194.3 @@ -1,141 +0,0 @@
194.4 -/*
194.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
194.6 - *
194.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
194.8 - *
194.9 - * The contents of this file are subject to the terms of either the GNU
194.10 - * General Public License Version 2 only ("GPL") or the Common
194.11 - * Development and Distribution License("CDDL") (collectively, the
194.12 - * "License"). You may not use this file except in compliance with the
194.13 - * License. You can obtain a copy of the License at
194.14 - * http://www.netbeans.org/cddl-gplv2.html
194.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
194.16 - * specific language governing permissions and limitations under the
194.17 - * License. When distributing the software, include this License Header
194.18 - * Notice in each file and include the License file at
194.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
194.20 - * particular file as subject to the "Classpath" exception as provided
194.21 - * by Sun in the GPL Version 2 section of the License file that
194.22 - * accompanied this code. If applicable, add the following below the
194.23 - * License Header, with the fields enclosed by brackets [] replaced by
194.24 - * your own identifying information:
194.25 - * "Portions Copyrighted [year] [name of copyright owner]"
194.26 - *
194.27 - * Contributor(s):
194.28 - *
194.29 - * The Original Software is NetBeans. The Initial Developer of the Original
194.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
194.31 - * Microsystems, Inc. All Rights Reserved.
194.32 - *
194.33 - * If you wish your version of this file to be governed by only the CDDL
194.34 - * or only the GPL Version 2, indicate your decision by adding
194.35 - * "[Contributor] elects to include this software in this distribution
194.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
194.37 - * single choice of license, a recipient has the option to distribute
194.38 - * your version of this file under either the CDDL, the GPL Version 2 or
194.39 - * to extend the choice of license to its licensees as provided above.
194.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
194.41 - * Version 2 license, then the option applies only if the new code is
194.42 - * made subject to such option by the copyright holder.
194.43 - */
194.44 -
194.45 -/*
194.46 - * DeploymentDialogOperator.java
194.47 - *
194.48 - * Created on November 11, 2003, 9:35 PM
194.49 - */
194.50 -
194.51 -package org.netbeans.modules.visualweb.gravy;
194.52 -
194.53 -import java.awt.Component;
194.54 -import java.awt.Container;
194.55 -import javax.swing.JDialog;
194.56 -import javax.swing.JFrame;
194.57 -
194.58 -import org.netbeans.jemmy.ComponentChooser;
194.59 -import org.netbeans.jemmy.ComponentSearcher;
194.60 -import org.netbeans.jemmy.JemmyProperties;
194.61 -import org.netbeans.jemmy.operators.JCheckBoxOperator;
194.62 -import org.netbeans.jemmy.operators.JDialogOperator;
194.63 -import org.netbeans.jemmy.operators.JLabelOperator;
194.64 -
194.65 -public class DeploymentDialogOperator extends JDialogOperator {
194.66 -
194.67 - JCheckBoxOperator autoHide;
194.68 -
194.69 - /** Creates a new instance of DeploymentDialogOperator */
194.70 - public DeploymentDialogOperator() {
194.71 - super(new DeploymentDialogFinder());
194.72 - copyEnvironment(Util.getMainWindow());
194.73 - getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 600000);
194.74 - getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 600000);
194.75 - }
194.76 -
194.77 - /**
194.78 - * Creates a new instance of DeploymentDialogOperator
194.79 - */
194.80 - public static DeploymentDialogOperator deploy() {
194.81 - return(Util.getMainWindow().deploy());
194.82 - }
194.83 -
194.84 - /**
194.85 - * Get checkbox for autoHide deployment dialog.
194.86 - * @return JCheckBoxOperator
194.87 - */
194.88 - public JCheckBoxOperator chbAutoHide() {
194.89 - if(autoHide == null) {
194.90 - autoHide = new JCheckBoxOperator(this, "Automatically close this window when finished");
194.91 - }
194.92 - return(autoHide);
194.93 - }
194.94 -
194.95 - /**
194.96 - * Check or uncheck checkbox for autoHide deployment dialog.
194.97 - * @param isAutoHide Boolean value for checkbox's state.
194.98 - */
194.99 - public void setAutoHide(boolean isAutoHide) {
194.100 - chbAutoHide().changeSelection(isAutoHide);
194.101 - }
194.102 -
194.103 - /**
194.104 - * Wait specified status.
194.105 - * @param status Status which will be waited.
194.106 - * @return JLabelOperator Label with specified state.
194.107 - */
194.108 - public JLabelOperator waitStatus(String status) {
194.109 - return(new JLabelOperator(this, status));
194.110 - }
194.111 -
194.112 - /**
194.113 - * Wait state "Completed".
194.114 - * @return JLabelOperator Label with state "Completed".
194.115 - */
194.116 - public JLabelOperator waitCompleted() {
194.117 - return(waitStatus("Completed"));
194.118 - }
194.119 -
194.120 - public static class DeploymentDialogFinder implements
194.121 - ComponentChooser {
194.122 - public boolean checkComponent(Component comp) {
194.123 - ComponentSearcher searcher = new
194.124 - ComponentSearcher((Container)comp);
194.125 -
194.126 - searcher.setOutput(JemmyProperties.getCurrentOutput().createErrorOutput());
194.127 - /* return(comp instanceof JFrame &&
194.128 - searcher.findComponent(new ComponentChooser() {
194.129 - public boolean checkComponent(Component comp) {
194.130 -
194.131 - return(comp.getClass().getName().endsWith("ProgressUI"));
194.132 - }
194.133 - public String getDescription() {
194.134 - return("ProgressUI");
194.135 - }
194.136 - }) != null);*/
194.137 - return(comp instanceof JDialog);
194.138 - }
194.139 - public String getDescription() {
194.140 - return("Deployment dialog");
194.141 - }
194.142 - }
194.143 -}
194.144 -
195.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/DeploymentUtils.java Thu Jul 10 04:29:52 2008 -0700
195.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
195.3 @@ -1,739 +0,0 @@
195.4 -/*
195.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
195.6 - *
195.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
195.8 - *
195.9 - * The contents of this file are subject to the terms of either the GNU
195.10 - * General Public License Version 2 only ("GPL") or the Common
195.11 - * Development and Distribution License("CDDL") (collectively, the
195.12 - * "License"). You may not use this file except in compliance with the
195.13 - * License. You can obtain a copy of the License at
195.14 - * http://www.netbeans.org/cddl-gplv2.html
195.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
195.16 - * specific language governing permissions and limitations under the
195.17 - * License. When distributing the software, include this License Header
195.18 - * Notice in each file and include the License file at
195.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
195.20 - * particular file as subject to the "Classpath" exception as provided
195.21 - * by Sun in the GPL Version 2 section of the License file that
195.22 - * accompanied this code. If applicable, add the following below the
195.23 - * License Header, with the fields enclosed by brackets [] replaced by
195.24 - * your own identifying information:
195.25 - * "Portions Copyrighted [year] [name of copyright owner]"
195.26 - *
195.27 - * Contributor(s):
195.28 - *
195.29 - * The Original Software is NetBeans. The Initial Developer of the Original
195.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
195.31 - * Microsystems, Inc. All Rights Reserved.
195.32 - *
195.33 - * If you wish your version of this file to be governed by only the CDDL
195.34 - * or only the GPL Version 2, indicate your decision by adding
195.35 - * "[Contributor] elects to include this software in this distribution
195.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
195.37 - * single choice of license, a recipient has the option to distribute
195.38 - * your version of this file under either the CDDL, the GPL Version 2 or
195.39 - * to extend the choice of license to its licensees as provided above.
195.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
195.41 - * Version 2 license, then the option applies only if the new code is
195.42 - * made subject to such option by the copyright holder.
195.43 - */
195.44 -
195.45 -package org.netbeans.modules.visualweb.gravy;
195.46 -
195.47 -import java.io.IOException;
195.48 -
195.49 -import com.meterware.httpunit.*;
195.50 -
195.51 -import junit.framework.TestCase;
195.52 -
195.53 -/**
195.54 - * RemoteDeploymentUtils class
195.55 - */
195.56 -
195.57 -public class DeploymentUtils
195.58 -{
195.59 - /**
195.60 - * Check if project was deployed.
195.61 - * @param deploy_string String to execute.
195.62 - * @return True if project works well, in other way retuirn false.
195.63 - */
195.64 - public static boolean testProject(String deploy_string)
195.65 - {
195.66 - try
195.67 - {
195.68 - Process oasp = Runtime.getRuntime().exec(deploy_string);
195.69 - System.out.println(deploy_string+" execute.");
195.70 - try
195.71 - {
195.72 - if (oasp.waitFor() == 0) System.out.println("Project has been deployed successfully!");
195.73 - else
195.74 - {
195.75 - System.out.println("Project has not been deployed!");
195.76 - TestCase.fail("Cannot run application.");
195.77 - }
195.78 - }
195.79 - catch (InterruptedException ie)
195.80 - {
195.81 - TestCase.fail("Exception in waitFor() : " + ie);
195.82 - return false;
195.83 - }
195.84 - oasp.destroy();
195.85 - }
195.86 - catch (IOException e)
195.87 - {
195.88 - TestCase.fail("Cannot run application.");
195.89 - return false;
195.90 - }
195.91 - TestUtils.wait(20000);
195.92 - return true;
195.93 - }
195.94 -
195.95 - /**
195.96 - * Check project with page navigation.
195.97 - * @param checkURL Project's URL.
195.98 - * @return True if project works well, in other way retuirn false.
195.99 - */
195.100 - public static boolean httpVerifySimpleNavigation(String checkURL)
195.101 - {
195.102 - try
195.103 - {
195.104 - WebConversation conversation = new WebConversation();
195.105 - WebResponse response = null;
195.106 - response = conversation.getResponse(checkURL);
195.107 - WebForm addContainer = response.getForms()[0];
195.108 -
195.109 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.110 - response = addContainer.submit(btn);
195.111 - System.out.println("Response text after page commit: " + response.getText());
195.112 - if (!response.getTitle().equals("Page2 Title"))
195.113 - {
195.114 - TestCase.fail("Cannot find Page2 in response");
195.115 - return false;
195.116 - }
195.117 - }
195.118 - catch (Exception e)
195.119 - {
195.120 - System.out.println("Exception occured: ");
195.121 - e.printStackTrace();
195.122 - TestCase.fail("Exception in HTTP check : " + e);
195.123 - return false;
195.124 - }
195.125 - return true;
195.126 - }
195.127 -
195.128 - /**
195.129 - * Check project with web service.
195.130 - * @param checkURL Project's URL.
195.131 - * @return True if project works well, in other way retuirn false.
195.132 - */
195.133 - public static boolean httpVerifyWebService(String checkURL)
195.134 - {
195.135 - try
195.136 - {
195.137 - String webOutput;
195.138 - WebConversation conversation = new WebConversation();
195.139 - WebResponse response = null;
195.140 - response = conversation.getResponse(checkURL);
195.141 - WebForm addContainer = response.getForms()[0];
195.142 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.143 - response = addContainer.submit(btn);
195.144 - webOutput = response.getText();
195.145 - System.out.println("Response text : " + webOutput);
195.146 - if (((response.getText()).indexOf("Kent") == -1) ||
195.147 - ((response.getText()).indexOf("Richard") == -1) ||
195.148 - ((response.getText()).indexOf("Cancel by 6pm local time 24 hours prior to avoid no-show billing.") == -1))
195.149 - {
195.150 - TestCase.fail("Cannot find strings according to chosen WebService in response");
195.151 - return false;
195.152 - }
195.153 - }
195.154 - catch (Exception e)
195.155 - {
195.156 - System.out.println("Exception occured: ");
195.157 - e.printStackTrace();
195.158 - TestCase.fail("Exception in HTTP check : " + e);
195.159 - return false;
195.160 - }
195.161 - return true;
195.162 - }
195.163 -
195.164 - /**
195.165 - * Check "Intro" project.
195.166 - * @param checkURL Project's URL.
195.167 - * @return True if project works well, in other way retuirn false.
195.168 - */
195.169 - public static boolean httpVerifyIntro(String checkURL)
195.170 - {
195.171 - try
195.172 - {
195.173 - WebConversation conversation = new WebConversation();
195.174 - WebResponse response = null;
195.175 - response = conversation.getResponse(checkURL);
195.176 - com.meterware.httpunit.WebForm addContainer = response.getForms()[0];
195.177 - WebRequest request = addContainer.getRequest();
195.178 - System.out.println("Response text : " + response.getText());
195.179 - addContainer.setParameter("form1:dropdown1", "Chen, Larry");
195.180 - response = conversation.getResponse(request);
195.181 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.182 - response = addContainer.submit(btn);
195.183 - addContainer = response.getForms()[0];
195.184 - System.out.println("Response text after page commit: " + response.getText());
195.185 - if ((response.getText()).indexOf("Hello, Larry!") == -1)
195.186 - {
195.187 - TestCase.fail("Cannot find \" Hello, Larry! \" string in response after submit");
195.188 - return false;
195.189 - }
195.190 - }
195.191 - catch (Exception e)
195.192 - {
195.193 - System.out.println("Exception occured: ");
195.194 - e.printStackTrace();
195.195 - TestCase.fail("Exception in HTTP check : " + e);
195.196 - return false;
195.197 - }
195.198 - return true;
195.199 - }
195.200 -
195.201 - /**
195.202 - * Check project with validaton.
195.203 - * @param checkURL Project's URL.
195.204 - * @return True if project works well, in other way retuirn false.
195.205 - */
195.206 - public static boolean httpVerifyValidation(String checkURL)
195.207 - {
195.208 - try
195.209 - {
195.210 - WebConversation conversation = new WebConversation();
195.211 - WebResponse response = null;
195.212 - response = conversation.getResponse(checkURL);
195.213 - WebForm addContainer = response.getForms()[0];
195.214 - WebRequest request = addContainer.getRequest();
195.215 - System.out.println("Set textField value = 500, expected result = 932");
195.216 - addContainer.setParameter("form1:textField1", "500");
195.217 - response = conversation.getResponse(request);
195.218 - System.out.println("Response text after 1st page commit: " + response.getText());
195.219 - if ((response.getText()).indexOf("932") == -1)
195.220 - {
195.221 - TestCase.fail("Cannot find value \"932:\" string in response");
195.222 - return false;
195.223 - }
195.224 - TestUtils.wait(5000);
195.225 - addContainer = response.getForms()[0];
195.226 - request = addContainer.getRequest();
195.227 - System.out.println("Set textField value = -1000, expected result = Validation Error");
195.228 - addContainer.setParameter("form1:textField1", "-1000");
195.229 - response = conversation.getResponse(request);
195.230 - System.out.println("Response text after 2st page commit: " + response.getText());
195.231 - if ((response.getText()).indexOf("Validation Error") == -1)
195.232 - {
195.233 - TestCase.fail("Cannot find \"Validation Error:\" string in response");
195.234 - return false;
195.235 - }
195.236 - }
195.237 - catch (Exception e)
195.238 - {
195.239 - System.out.println("Exception occured: ");
195.240 - e.printStackTrace();
195.241 - TestCase.fail("Exception in HTTP check : " + e);
195.242 - return false;
195.243 - }
195.244 - return true;
195.245 - }
195.246 -
195.247 - /**
195.248 - * Check project with dynamic navigation.
195.249 - * @param checkURL Project's URL.
195.250 - * @return True if project works well, in other way retuirn false.
195.251 - */
195.252 - public static boolean httpVerifyDynamicNavigation(String checkURL)
195.253 - {
195.254 - try
195.255 - {
195.256 - WebConversation conversation = new WebConversation();
195.257 - WebResponse response = null;
195.258 - response = conversation.getResponse(checkURL);
195.259 - WebForm addContainer = response.getForms()[0];
195.260 - addContainer.setParameter("form1:dropdown1", "Emerald City");
195.261 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.262 - response = addContainer.submit(btn);
195.263 - System.out.println("Response text after form1 submit: " + response.getText());
195.264 - if (!response.getTitle().equals("Page2 Title"))
195.265 - {
195.266 - TestCase.fail("Wrong webform responce after WebForm1 submit action");
195.267 - return false;
195.268 - }
195.269 - addContainer = response.getForms()[0];
195.270 - btn = addContainer.getSubmitButtons()[0];
195.271 - response = addContainer.submit(btn);
195.272 - System.out.println("Response text after 1 form2 submit: " + response.getText());
195.273 - if (response.getTitle().equals("Page1 Title"))
195.274 - {
195.275 - TestCase.fail("Wrong webform responce after WebForm2 first submit action");
195.276 - return false;
195.277 - }
195.278 - response = addContainer.submit(btn);
195.279 - System.out.println("Response text after 2 Page2 submit: " + response.getText());
195.280 - response = addContainer.submit(btn);
195.281 - System.out.println("Response text after 3 Page2 submit: " + response.getText());
195.282 -
195.283 - if (!response.getTitle().equals("Page1 Title"))
195.284 - {
195.285 - TestCase.fail("Wrong page responce after Page2 third submit action");
195.286 - return false;
195.287 - }
195.288 - }
195.289 - catch (Exception e)
195.290 - {
195.291 - System.out.println("Exception occured: ");
195.292 - e.printStackTrace();
195.293 - TestCase.fail("Excetion in HTTP check : " + e);
195.294 - return false;
195.295 - }
195.296 - return true;
195.297 - }
195.298 -
195.299 - /**
195.300 - * Check project which send email.
195.301 - * @param checkURL Project's URL.
195.302 - * @return True if project works well, in other way retuirn false.
195.303 - */
195.304 - public static boolean httpVerifyEmail(String checkURL)
195.305 - {
195.306 - try
195.307 - {
195.308 - WebConversation conversation = new WebConversation();
195.309 - WebResponse response = null;
195.310 - response = conversation.getResponse(checkURL);
195.311 - WebForm addContainer = response.getForms()[0];
195.312 - addContainer.setParameter("form1:txtComments", "Hello world!");
195.313 - TestUtils.wait(2000);
195.314 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.315 - response = addContainer.submit(btn);
195.316 - TestUtils.wait(2000);
195.317 - System.out.println("Response text after page commit: " + response.getText());
195.318 - if ((response.getText()).indexOf("Your comments have been successfully sent") == -1)
195.319 - {
195.320 - TestCase.fail("Cannot find \"Your comments have been successfully sent\" string in response");
195.321 - return false;
195.322 - }
195.323 - }
195.324 - catch (Exception e)
195.325 - {
195.326 - System.out.println("Exception occured: ");
195.327 - e.printStackTrace();
195.328 - System.out.println("Check your mail settings, it can be cause of failing.");
195.329 - TestCase.fail("Excetion in HTTP check : " + e);
195.330 - return false;
195.331 - }
195.332 - return true;
195.333 - }
195.334 -
195.335 - /**
195.336 - * Check project which DB access.
195.337 - * @param checkURL Project's URL.
195.338 - * @return True if project works well, in other way retuirn false.
195.339 - */
195.340 - public static boolean httpVerifyDBAccess(String checkURL)
195.341 - {
195.342 - try
195.343 - {
195.344 - String webOutput;
195.345 - WebConversation conversation = new WebConversation();
195.346 - WebResponse response = null;
195.347 - response = conversation.getResponse(checkURL); //
195.348 - WebForm addContainer = response.getForms()[0];
195.349 - addContainer.setParameter("form1:dropdown1", "2");
195.350 - TestUtils.wait(5000);
195.351 - WebRequest request = addContainer.getRequest();
195.352 - TestUtils.wait(5000);
195.353 - response = conversation.getResponse(request);
195.354 - webOutput = response.getText();
195.355 - System.out.println("Response text : " + webOutput);
195.356 - }
195.357 - catch (Exception e)
195.358 - {
195.359 - System.out.println("Exception occured: ");
195.360 - e.printStackTrace();
195.361 - TestCase.fail("Exception in HTTP check : " + e);
195.362 - return false;
195.363 - }
195.364 - return true;
195.365 - }
195.366 -
195.367 - /**
195.368 - * Check project with number converter.
195.369 - * @param checkURL Project's URL.
195.370 - * @return True if project works well, in other way retuirn false.
195.371 - */
195.372 - public static boolean httpVerifyNumberConverter(String checkURL)
195.373 - {
195.374 - try
195.375 - {
195.376 - WebConversation conversation = new WebConversation();
195.377 - WebResponse response = null;
195.378 - response = conversation.getResponse(checkURL);
195.379 - WebForm addContainer = response.getForms()[0];
195.380 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.381 - System.out.println("Set textField value = 125, expected result = class.java.Long");
195.382 - addContainer.setParameter("form1:textField1", "125");
195.383 - response = addContainer.submit(btn);
195.384 - System.out.println("Response text after 1st page commit: " + response.getText());
195.385 - if ((response.getText()).indexOf("java.lang.Long") == -1)
195.386 - {
195.387 - TestCase.fail("Cannot find value \"java.lang.Long\" string in response");
195.388 - return false;
195.389 - }
195.390 - TestUtils.wait(5000);
195.391 - addContainer = response.getForms()[0];
195.392 - btn = addContainer.getSubmitButtons()[0];
195.393 - System.out.println("Set textField value = 125.3, expected result = class.java.Double");
195.394 - addContainer.setParameter("form1:textField1", "125.3");
195.395 - response = addContainer.submit(btn);
195.396 - System.out.println("Response text after 2st page commit: " + response.getText());
195.397 - if ((response.getText()).indexOf("java.lang.Double") == -1)
195.398 - {
195.399 - TestCase.fail("Cannot find \"java.lang.Double\" string in response");
195.400 - return false;
195.401 - }
195.402 - }
195.403 - catch (Exception e)
195.404 - {
195.405 - System.out.println("Exception occured: ");
195.406 - e.printStackTrace();
195.407 - TestCase.fail("Exception in HTTP check : " + e);
195.408 - return false;
195.409 - }
195.410 - return true;
195.411 - }
195.412 -
195.413 - /**
195.414 - * Check project with currency converter.
195.415 - * @param checkURL Project's URL.
195.416 - * @return True if project works well, in other way retuirn false.
195.417 - */
195.418 - public static boolean httpVerifyCurrencyConverter(String checkURL)
195.419 - {
195.420 - try
195.421 - {
195.422 - WebConversation conversation = new WebConversation();
195.423 - WebResponse response = null;
195.424 - response = conversation.getResponse(checkURL);
195.425 - WebForm addContainer = response.getForms()[0];
195.426 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.427 - System.out.println("Set textField value = $1,234.00");
195.428 - addContainer.setParameter("form1:textField1", "$1,234.00");
195.429 - response = addContainer.submit(btn);
195.430 - System.out.println("Response text after 1st page commit: " + response.getText());
195.431 - if (((response.getText()).indexOf("£822.67") == -1) ||
195.432 - ((response.getText()).indexOf("E 1.028,33") == -1))
195.433 - {
195.434 - TestCase.fail("Cannot find value \"£822.67\" or \"E 1.028,33\" string in response");
195.435 - return false;
195.436 - }
195.437 - }
195.438 - catch (Exception e)
195.439 - {
195.440 - System.out.println("Exception occured: ");
195.441 - e.printStackTrace();
195.442 - TestCase.fail("Exception in HTTP check : " + e);
195.443 - return false;
195.444 - }
195.445 - return true;
195.446 - }
195.447 -
195.448 - /**
195.449 - * Check project with date converter.
195.450 - * @param checkURL Project's URL.
195.451 - * @return True if project works well, in other way retuirn false.
195.452 - */
195.453 - public static boolean httpVerifyDateConverter(String checkURL)
195.454 - {
195.455 - try
195.456 - {
195.457 - WebConversation conversation = new WebConversation();
195.458 - WebResponse response = null;
195.459 - response = conversation.getResponse(checkURL);
195.460 - WebForm addContainer = response.getForms()[0];
195.461 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.462 - response = addContainer.submit(btn);
195.463 - System.out.println("Response text after 1st page commit: " + response.getText());
195.464 - if (((response.getText()).indexOf("Greenwich Mean Time") == -1) ||
195.465 - ((response.getText()).indexOf("GMT") == -1) ||
195.466 - (((response.getText()).indexOf("Pacific Daylight Time") == -1) &&
195.467 - ((response.getText()).indexOf("Pacific Standard Time") == -1)))
195.468 - {
195.469 - TestCase.fail("Cannot find date time strings in response");
195.470 - return false;
195.471 - }
195.472 - }
195.473 - catch (Exception e)
195.474 - {
195.475 - System.out.println("Exception occured: ");
195.476 - e.printStackTrace();
195.477 - TestCase.fail("Exception in HTTP check : " + e);
195.478 - return false;
195.479 - }
195.480 - return true;
195.481 - }
195.482 -
195.483 - /**
195.484 - * Check project with "List" component.
195.485 - * @param checkURL Project's URL.
195.486 - * @return True if project works well, in other way retuirn false.
195.487 - */
195.488 - public static boolean httpVerifyList(String checkURL)
195.489 - {
195.490 - try
195.491 - {
195.492 - WebConversation conversation = new WebConversation();
195.493 - WebResponse response = null;
195.494 - response = conversation.getResponse(checkURL);
195.495 - com.meterware.httpunit.WebForm addContainer = response.getForms()[0];
195.496 - System.out.println("Response : " + response.getText());
195.497 - String[] valArray = {"choice1", "choice2"};
195.498 - addContainer.setParameter("form1:multiSelectListbox1", valArray);
195.499 - SubmitButton btm = addContainer.getSubmitButton("form1:button1");
195.500 - response = addContainer.submit(btm);
195.501 - addContainer = response.getForms()[0];
195.502 - System.out.println("Response text after page commit: " + response.getText());
195.503 - if ((response.getText()).indexOf("Values chosen:\nchoice1\nchoice2") == -1)
195.504 - {
195.505 - TestCase.fail("Cannot find result string in response after submit");
195.506 - return false;
195.507 - }
195.508 - TestUtils.wait(5000);
195.509 - btm = addContainer.getSubmitButton("form1:button2");
195.510 - TestUtils.wait(3000);
195.511 - response = addContainer.submit(btm);
195.512 - TestUtils.wait(3000);
195.513 - addContainer = response.getForms()[0];
195.514 - btm = addContainer.getSubmitButton("form1:button2");
195.515 - response = addContainer.submit(btm);
195.516 - TestUtils.wait(3000);
195.517 - addContainer = response.getForms()[0];
195.518 - TestUtils.wait(3000);
195.519 - System.out.println("Response text after 1 page commit: " + response.getText());
195.520 - String[] valArray1 = {"testChoice5", "testChoice6"};
195.521 - addContainer.setParameter("form1:multiSelectListbox1", valArray1);
195.522 - btm = addContainer.getSubmitButton("form1:button1");
195.523 - response = addContainer.submit(btm);
195.524 - addContainer = response.getForms()[0];
195.525 - System.out.println("Response text after 2 page commit: " + response.getText());
195.526 - if ((response.getText()).indexOf("Values chosen:\ntestChoice5\ntestChoice6") == -1)
195.527 - {
195.528 - TestCase.fail("Cannot find result string in response after submit");
195.529 - return false;
195.530 - }
195.531 - TestUtils.wait(5000);
195.532 - btm = addContainer.getSubmitButton("form1:button3");
195.533 - TestUtils.wait(3000);
195.534 - response = addContainer.submit(btm);
195.535 - TestUtils.wait(3000);
195.536 - addContainer = response.getForms()[0];
195.537 - System.out.println("Response text after 3 page commit: " + response.getText());
195.538 - if (((response.getText()).indexOf("testChoice5") != -1) ||
195.539 - ((response.getText()).indexOf("testChoice6") != -1))
195.540 - {
195.541 - TestCase.fail("Wrong list items left after removing in response after submit");
195.542 - return false;
195.543 - }
195.544 - }
195.545 - catch (Exception e)
195.546 - {
195.547 - System.out.println("Exception occured: ");
195.548 - e.printStackTrace();
195.549 - TestCase.fail("Excetion in HTTP check : " + e);
195.550 - return false;
195.551 - }
195.552 - return true;
195.553 - }
195.554 -
195.555 - /**
195.556 - * Check project with property binding.
195.557 - * @param checkURL Project's URL.
195.558 - * @return True if project works well, in other way retuirn false.
195.559 - */
195.560 - public static boolean httpVerifyLinking(String checkURL)
195.561 - {
195.562 - try
195.563 - {
195.564 - WebConversation conversation = new WebConversation();
195.565 - WebResponse response = null;
195.566 - response = conversation.getResponse(checkURL);
195.567 - WebForm addContainer = response.getForms()[0];
195.568 - WebRequest request = addContainer.getRequest();
195.569 - System.out.println("Response text : " + response.getText());
195.570 - addContainer.setParameter("form1:dropdown1", "Chen, Larry");
195.571 - response = conversation.getResponse(request);
195.572 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.573 - response = addContainer.submit(btn);
195.574 - addContainer = response.getForms()[0];
195.575 - System.out.println("Response text after page commit: " + response.getText());
195.576 - if ((response.getText()).indexOf("Hello, Larry!") == -1)
195.577 - {
195.578 - TestCase.fail("Cannot find \" Hello, Larry! \" string in response after submit");
195.579 - return false;
195.580 - }
195.581 - }
195.582 - catch (Exception e)
195.583 - {
195.584 - System.out.println("Exception occured: ");
195.585 - e.printStackTrace();
195.586 - TestCase.fail("Exception in HTTP check : " + e);
195.587 - return false;
195.588 - }
195.589 - return true;
195.590 - }
195.591 -
195.592 - /**
195.593 - * Check project with ancillary library.
195.594 - * @param checkURL Project's URL.
195.595 - * @return True if project works well, in other way retuirn false.
195.596 - */
195.597 - public static boolean httpVerifyLibrary(String checkURL)
195.598 - {
195.599 - try
195.600 - {
195.601 - WebConversation conversation = new WebConversation();
195.602 - WebResponse response = null;
195.603 - response = conversation.getResponse(checkURL);
195.604 - com.meterware.httpunit.WebForm addContainer = response.getForms()[0];
195.605 - System.out.println("Response : " + response.getText());
195.606 - if ((response.getText()).indexOf("Hello, world.") == -1)
195.607 - {
195.608 - TestCase.fail("Cannot find \"Hello, world.\" string in response.");
195.609 - return false;
195.610 - }
195.611 - }
195.612 - catch (Exception e)
195.613 - {
195.614 - System.out.println("Exception occured: " + e);
195.615 - e.printStackTrace();
195.616 - TestCase.fail("Exception in HTTP check : " + e);
195.617 - return false;
195.618 - }
195.619 - return true;
195.620 - }
195.621 -
195.622 - /**
195.623 - * Check project with "Message" component.
195.624 - * @param checkURL Project's URL.
195.625 - * @return True if project works well, in other way retuirn false.
195.626 - */
195.627 - public static boolean httpVerifyMessage(String checkURL)
195.628 - {
195.629 - try
195.630 - {
195.631 - WebConversation conversation = new WebConversation();
195.632 - WebResponse response = null;
195.633 - response = conversation.getResponse(checkURL);
195.634 - WebForm addContainer = response.getForms()[0];
195.635 - WebRequest request = addContainer.getRequest();
195.636 - System.out.println("Response text : " + response.getText());
195.637 - SubmitButton btn = addContainer.getSubmitButtons()[0];
195.638 - response = addContainer.submit(btn);
195.639 - addContainer = response.getForms()[0];
195.640 - System.out.println("Response text after page commit: " + response.getText());
195.641 - if ((response.getText()).indexOf("Validation Error: Value is required.") == -1 || (response.getText()).indexOf("Validation Error: Value is required.") == -1)
195.642 - {
195.643 - TestCase.fail("Cannot find \"Validation Error: Value is required.\" string in response after submit");
195.644 - return false;
195.645 - }
195.646 - TestUtils.wait(1000);
195.647 - addContainer.setParameter("form1:textField1", "abc");
195.648 - addContainer.setParameter("form1:textField2", "abc");
195.649 - btn = addContainer.getSubmitButtons()[0];
195.650 - response = addContainer.submit(btn);
195.651 - addContainer = response.getForms()[0];
195.652 - System.out.println("Response text after page commit: " + response.getText());
195.653 - if ((response.getText()).indexOf("Conversion error occurred.") == -1)
195.654 - {
195.655 - TestCase.fail("Cannot find \"Conversion error occurred.\" string in response after submit");
195.656 - return false;
195.657 - }
195.658 - TestUtils.wait(1000);
195.659 - addContainer.setParameter("form1:textField1", "10");
195.660 - addContainer.setParameter("form1:textField2", "abc");
195.661 - btn = addContainer.getSubmitButtons()[0];
195.662 - response = addContainer.submit(btn);
195.663 - addContainer = response.getForms()[0];
195.664 - System.out.println("Response text after page commit: " + response.getText());
195.665 - if ((response.getText()).indexOf("Validation Error: Specified attribute is not between the expected values of 1 and 5.") == -1)
195.666 - {
195.667 - TestCase.fail("Cannot find \"Validation Error: Specified attribute is not between the expected values of 1 and 5.\" string in response after submit");
195.668 - return false;
195.669 - }
195.670 - TestUtils.wait(1000);
195.671 - addContainer.setParameter("form1:textField1", "4");
195.672 - addContainer.setParameter("form1:textField2", "abc");
195.673 - btn = addContainer.getSubmitButtons()[0];
195.674 - response = addContainer.submit(btn);
195.675 - addContainer = response.getForms()[0];
195.676 - System.out.println("Response text after page commit: " + response.getText());
195.677 - if ((response.getText()).indexOf("Form Message: Processing Complete.") == -1)
195.678 - {
195.679 - TestCase.fail("Cannot find \"Form Message: Processing Complete.\" string in response after submit");
195.680 - return false;
195.681 - }
195.682 - }
195.683 - catch (Exception e)
195.684 - {
195.685 - System.out.println("Exception occured: ");
195.686 - e.printStackTrace();
195.687 - TestCase.fail("Exception in HTTP check : " + e);
195.688 - return false;
195.689 - }
195.690 - return true;
195.691 - }
195.692 -
195.693 - /**
195.694 - * Check CRUD project.
195.695 - * @param checkURL Project's URL.
195.696 - * @return True if project works well, in other way retuirn false.
195.697 - */
195.698 - public static boolean httpVerifyCRUD(String checkURL)
195.699 - {
195.700 - try
195.701 - {
195.702 - WebConversation conversation = new WebConversation();
195.703 - WebResponse response = conversation.getResponse(checkURL);
195.704 - System.out.println("Start page: " + response.getText());
195.705 - WebForm form = response.getForms()[0];
195.706 - SubmitButton addBtn=(SubmitButton)form.getButtonWithID("form1:addTrip");
195.707 - response = form.submit(addBtn);
195.708 - System.out.println("Details screen for add = " + response.getText());
195.709 - form = response.getForms()[0];
195.710 - form.setParameter("form1:depDate","16.06.2004 0:23:09");
195.711 - form.setParameter("form1:fromCity","Hobbiton");
195.712 - form.setParameter("form1:toCity","Rivendell");
195.713 - form.setParameter("form1:tripTypeId","3");
195.714 - SubmitButton saveBtn=(SubmitButton)form.getButtonWithID("form1:save");
195.715 - response = form.submit(saveBtn);
195.716 - System.out.println("After adding travel: " + response.getText());
195.717 - form = response.getForms()[0];
195.718 - SubmitButton updateBtn=(SubmitButton)form.getButtonWithID("form1:dataTable1:0:update");
195.719 - response = form.submit(updateBtn);
195.720 - System.out.println("Details screen for update = " + response.getText());
195.721 - form = response.getForms()[0];
195.722 - form.setParameter("form1:depDate","16.07.2004 0:23:09");
195.723 - form.setParameter("form1:fromCity","Rivendell");
195.724 - form.setParameter("form1:toCity","Orodruin");
195.725 - form.setParameter("form1:tripTypeId","4");
195.726 - saveBtn=(SubmitButton)form.getButtonWithID("form1:save");
195.727 - response = form.submit(saveBtn);
195.728 - System.out.println("After updating travel: " + response.getText());
195.729 - form = response.getForms()[0];
195.730 - SubmitButton deleteBtn=(SubmitButton)form.getButtonWithID("form1:dataTable1:0:delete");
195.731 - response = form.submit(deleteBtn);
195.732 - }
195.733 - catch (Exception e)
195.734 - {
195.735 - System.out.println("Exception occured: ");
195.736 - e.printStackTrace();
195.737 - TestCase.fail("Exception in HTTP check : " + e);
195.738 - return false;
195.739 - }
195.740 - return true;
195.741 - }
195.742 -}
196.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/DocumentOutlineOperator.java Thu Jul 10 04:29:52 2008 -0700
196.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
196.3 @@ -1,228 +0,0 @@
196.4 -/*
196.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
196.6 - *
196.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
196.8 - *
196.9 - * The contents of this file are subject to the terms of either the GNU
196.10 - * General Public License Version 2 only ("GPL") or the Common
196.11 - * Development and Distribution License("CDDL") (collectively, the
196.12 - * "License"). You may not use this file except in compliance with the
196.13 - * License. You can obtain a copy of the License at
196.14 - * http://www.netbeans.org/cddl-gplv2.html
196.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
196.16 - * specific language governing permissions and limitations under the
196.17 - * License. When distributing the software, include this License Header
196.18 - * Notice in each file and include the License file at
196.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
196.20 - * particular file as subject to the "Classpath" exception as provided
196.21 - * by Sun in the GPL Version 2 section of the License file that
196.22 - * accompanied this code. If applicable, add the following below the
196.23 - * License Header, with the fields enclosed by brackets [] replaced by
196.24 - * your own identifying information:
196.25 - * "Portions Copyrighted [year] [name of copyright owner]"
196.26 - *
196.27 - * Contributor(s):
196.28 - *
196.29 - * The Original Software is NetBeans. The Initial Developer of the Original
196.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
196.31 - * Microsystems, Inc. All Rights Reserved.
196.32 - *
196.33 - * If you wish your version of this file to be governed by only the CDDL
196.34 - * or only the GPL Version 2, indicate your decision by adding
196.35 - * "[Contributor] elects to include this software in this distribution
196.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
196.37 - * single choice of license, a recipient has the option to distribute
196.38 - * your version of this file under either the CDDL, the GPL Version 2 or
196.39 - * to extend the choice of license to its licensees as provided above.
196.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
196.41 - * Version 2 license, then the option applies only if the new code is
196.42 - * made subject to such option by the copyright holder.
196.43 - */
196.44 -
196.45 -package org.netbeans.modules.visualweb.gravy;
196.46 -
196.47 -import java.awt.*;
196.48 -import java.util.*;
196.49 -import com.sun.rave.designtime.DesignBean;
196.50 -import org.netbeans.jemmy.ComponentChooser;
196.51 -import org.netbeans.jemmy.operators.*;
196.52 -import javax.swing.tree.*;
196.53 -
196.54 -/**
196.55 - * Operator for Outline window.
196.56 - */
196.57 -public class DocumentOutlineOperator extends JComponentOperator {
196.58 - private JTreeOperator structureTree;
196.59 -
196.60 - public DocumentOutlineOperator(ContainerOperator contOper) {
196.61 - super(contOper, new DocumentOutlineChooser());
196.62 - }
196.63 -
196.64 - /** Performs verification by accessing all sub-components */
196.65 - public void verify() {
196.66 - getStructTreeOperator();
196.67 - }
196.68 -
196.69 - /**
196.70 - * Find specified tree path.
196.71 - * @param strTreePath String which represents tree path.
196.72 - * @return TreePath Specified path.
196.73 - */
196.74 - public TreePath findPath(String strTreePath) {
196.75 - verify();
196.76 - return (structureTree.findPath(strTreePath));
196.77 - }
196.78 -
196.79 - /**
196.80 - * Find specified tree path with specified comparator.
196.81 - * @param strTreePath String which represents tree path.
196.82 - * @param nodeIndexes Array of nodes indexes.
196.83 - * @param comparator Comparator to compare tree path with specified string.
196.84 - * @return TreePath Specified path.
196.85 - */
196.86 - public TreePath findPath(String strTreePath, int[] nodeIndexes,
196.87 - Operator.StringComparator comparator) {
196.88 - verify();
196.89 - String[] nodeNames = new Operator.DefaultPathParser("|").parse(strTreePath);
196.90 - if (nodeIndexes == null) {
196.91 - nodeIndexes = new int[nodeNames.length]; // fill the array in with zero values
196.92 - }
196.93 - System.out.println("+++ DocumentOutlineOperator.findPath(...): nodeNames = " +
196.94 - Arrays.asList(nodeNames));
196.95 - System.out.print("+++ DocumentOutlineOperator.findPath(...): nodeIndexes = [");
196.96 - for (int i = 0; i < nodeIndexes.length; ++i) {
196.97 - System.out.print(nodeIndexes[i] +
196.98 - (i < nodeIndexes.length - 1 ? ", " : ""));
196.99 - }
196.100 - System.out.println("]");
196.101 - TreePath treePath = structureTree.findPath(nodeNames, nodeIndexes,
196.102 - comparator);
196.103 - return treePath;
196.104 - }
196.105 -
196.106 - /**
196.107 - * Click on specified tree path.
196.108 - * @param strTreePath String which represents tree path.
196.109 - */
196.110 - public void clickOnPath(String strTreePath) {
196.111 - structureTree.clickOnPath(findPath(strTreePath));
196.112 - }
196.113 -
196.114 - /**
196.115 - * Expand specified tree path.
196.116 - * @param strTreePath String which represents tree path.
196.117 - */
196.118 - public void expandPath(String strTreePath) {
196.119 - structureTree.expandPath(findPath(strTreePath));
196.120 - }
196.121 -
196.122 - /**
196.123 - * Select specified tree path.
196.124 - * @param strTreePath String which represents tree path.
196.125 - */
196.126 - public void selectPath(String strTreePath) {
196.127 - structureTree.selectPath(findPath(strTreePath));
196.128 - }
196.129 -
196.130 - /**
196.131 - * Click for popup with specified mouse button.
196.132 - * @param i Number of mouse button.
196.133 - */
196.134 - public void clickForPopup(int i) {
196.135 - verify();
196.136 - structureTree.clickForPopup(i);
196.137 - }
196.138 -
196.139 - /**
196.140 - * Get tree which represents structure.
196.141 - * @return JTreeOperator JTree which represents structure.
196.142 - */
196.143 - public JTreeOperator getStructTreeOperator() {
196.144 - if (structureTree == null) {
196.145 - structureTree = new JTreeOperator(this);
196.146 - }
196.147 - return structureTree;
196.148 - }
196.149 -
196.150 - /**
196.151 - * Press button with given title.
196.152 - * @param btName Name of button.
196.153 - */
196.154 - public void pressButton(String btName){
196.155 - new JButtonOperator(this, btName).pushNoBlock();
196.156 - }
196.157 -
196.158 - /**
196.159 - * Find child with specified name in specified parent.
196.160 - * @param parent Bean where child will be searched.
196.161 - * @param componentName Name of child.
196.162 - * @return DesignBean Found child.
196.163 - */
196.164 - private DesignBean findChild(DesignBean parent, String componentName){
196.165 - DesignBean lb;
196.166 - if (parent.getInstanceName().equals(componentName)){
196.167 - return parent;
196.168 - }
196.169 - for (int i = 0; i < parent.getChildBeanCount(); i++) {
196.170 - if ((lb=findChild(parent.getChildBean(i),componentName))!=null){
196.171 - return lb;
196.172 - }
196.173 - }
196.174 - return null;
196.175 - }
196.176 -
196.177 - /**
196.178 - * Select component with specified name.
196.179 - * @param componentName Name of component.
196.180 - * @return True if component selected.
196.181 - */
196.182 - public boolean selectComponent(String componentName) {
196.183 - DesignBean[] lbs = null;
196.184 - Object rootChild = structureTree.getChildren(structureTree.getRoot())[0];
196.185 - for (int i = 0; i < structureTree.getChildCount(rootChild); i++) {
196.186 - DesignBean lb = (DesignBean)structureTree.getChildren(rootChild)[i];
196.187 - DesignBean res=findChild(lb,componentName);
196.188 - if (res!=null) {
196.189 - lbs = new DesignBean[] {res};
196.190 - break;
196.191 - }
196.192 - }
196.193 - if (lbs != null) {
196.194 - TestUtils.wait(500);
196.195 - return true;
196.196 - } else {
196.197 - return false;
196.198 - }
196.199 - }
196.200 -
196.201 - /**
196.202 - * Open page with specified name.
196.203 - * @param page Name of page.
196.204 - */
196.205 - public void openPage(String page){
196.206 - new JButtonOperator(this,page).clickForPopup();
196.207 - new JPopupMenuOperator().pushMenu(
196.208 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.outline.Bundle","Open"));
196.209 - }
196.210 -
196.211 - /**
196.212 - * Open source code of page with specified name.
196.213 - * @param page Name of page.
196.214 - */
196.215 - public void openPageSource(String page){
196.216 - new JButtonOperator(this,page).clickForPopup();
196.217 - new JPopupMenuOperator().pushMenu(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.outline.Bundle","ViewBF",
196.218 - new String[]{page})
196.219 - );
196.220 - }
196.221 -
196.222 - public static class DocumentOutlineChooser implements ComponentChooser {
196.223 - public boolean checkComponent(Component comp) {
196.224 - return comp.getClass().getName().equalsIgnoreCase("org.netbeans.modules.visualweb.outline.OutlinePanel");
196.225 - }
196.226 -
196.227 - public String getDescription() {
196.228 - return "Document Outline Operator";
196.229 - }
196.230 - }
196.231 -}
197.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/EditorOperator.java Thu Jul 10 04:29:52 2008 -0700
197.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
197.3 @@ -1,829 +0,0 @@
197.4 -/*
197.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
197.6 - *
197.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
197.8 - *
197.9 - * The contents of this file are subject to the terms of either the GNU
197.10 - * General Public License Version 2 only ("GPL") or the Common
197.11 - * Development and Distribution License("CDDL") (collectively, the
197.12 - * "License"). You may not use this file except in compliance with the
197.13 - * License. You can obtain a copy of the License at
197.14 - * http://www.netbeans.org/cddl-gplv2.html
197.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
197.16 - * specific language governing permissions and limitations under the
197.17 - * License. When distributing the software, include this License Header
197.18 - * Notice in each file and include the License file at
197.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
197.20 - * particular file as subject to the "Classpath" exception as provided
197.21 - * by Sun in the GPL Version 2 section of the License file that
197.22 - * accompanied this code. If applicable, add the following below the
197.23 - * License Header, with the fields enclosed by brackets [] replaced by
197.24 - * your own identifying information:
197.25 - * "Portions Copyrighted [year] [name of copyright owner]"
197.26 - *
197.27 - * Contributor(s):
197.28 - *
197.29 - * The Original Software is NetBeans. The Initial Developer of the Original
197.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
197.31 - * Microsystems, Inc. All Rights Reserved.
197.32 - *
197.33 - * If you wish your version of this file to be governed by only the CDDL
197.34 - * or only the GPL Version 2, indicate your decision by adding
197.35 - * "[Contributor] elects to include this software in this distribution
197.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
197.37 - * single choice of license, a recipient has the option to distribute
197.38 - * your version of this file under either the CDDL, the GPL Version 2 or
197.39 - * to extend the choice of license to its licensees as provided above.
197.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
197.41 - * Version 2 license, then the option applies only if the new code is
197.42 - * made subject to such option by the copyright holder.
197.43 - */
197.44 -
197.45 -package org.netbeans.modules.visualweb.gravy;
197.46 -
197.47 -import java.awt.Component;
197.48 -import java.awt.Container;
197.49 -import java.awt.event.KeyEvent;
197.50 -import java.lang.reflect.Method;
197.51 -import java.util.ArrayList;
197.52 -import java.util.Iterator;
197.53 -import java.util.List;
197.54 -import javax.swing.JComponent;
197.55 -import javax.swing.JToolBar;
197.56 -import javax.swing.text.BadLocationException;
197.57 -import javax.swing.text.Document;
197.58 -import javax.swing.text.StyledDocument;
197.59 -import org.netbeans.modules.visualweb.gravy.actions.SaveAction;
197.60 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
197.61 -
197.62 -import org.netbeans.jemmy.*;
197.63 -import org.netbeans.jemmy.operators.*;
197.64 -
197.65 -import org.openide.cookies.LineCookie;
197.66 -import org.openide.loaders.DataObject;
197.67 -import org.openide.text.Annotatable;
197.68 -import org.openide.text.Annotation;
197.69 -import org.openide.text.CloneableEditor;
197.70 -import org.openide.text.Line;
197.71 -import org.openide.text.NbDocument;
197.72 -import org.openide.text.Line.Set;
197.73 -import org.openide.windows.TopComponent;
197.74 -
197.75 -/**
197.76 - * Handle an editor top component in NetBeans IDE. It enables to get, select, insert or
197.77 - * delete text, move caret, work with annotations and with toolbar buttons.
197.78 - * Majority of operations is done by JEditorPane API calls. If you want
197.79 - * to do operations by key navigation, use methods of JEditorPaneOperator
197.80 - * instance by {@link #txtEditorPane()}. For example, call
197.81 - * <code>txtEditorPane().changeCaretPosition(int)</code> instead of
197.82 - * <code>{@link #setCaretPosition(int)}</code>.
197.83 - * <p>
197.84 - * Usage:<br>
197.85 - * <pre>
197.86 - EditorOperator eo = new EditorOperator(filename);
197.87 - eo.setCaretPositionToLine(10);
197.88 - eo.insert("// My new comment\n");
197.89 - eo.select("// My new comment");
197.90 - eo.deleteLine(10);
197.91 - eo.getToolbarButton("Toggle Bookmark").push();
197.92 - // discard changes and close
197.93 - eo.close(false);
197.94 - // save changes and close
197.95 - eo.close(true);
197.96 - // try to close all opened documents (confirmation dialog may appear)
197.97 - eo.closeAllDocuments();
197.98 - // close all opened documents and discard all changes
197.99 - eo.closeDiscardAll();
197.100 - * </pre>
197.101 - *
197.102 - * @author Jiri.Skrivanek@sun.com
197.103 - */
197.104 -public class EditorOperator extends TopComponentOperator {
197.105 -
197.106 - private static int WAIT_TIME = 60000;
197.107 -
197.108 - static {
197.109 - Timeouts.initDefault("EditorOperator.WaitModifiedTimeout", WAIT_TIME);
197.110 - }
197.111 -
197.112 - /** Components operators. */
197.113 - private JEditorPaneOperator _txtEditorPane;
197.114 - private JLabelOperator _lblRowColumn;
197.115 - private JLabelOperator _lblInputMode;
197.116 - private JLabelOperator _lblStatusBar;
197.117 - private JComboBoxOperator _cboQuickBrowse;
197.118 -
197.119 - /** Waits for the first opened editor with given name.
197.120 - * If not active, it is activated.
197.121 - * @param filename name of file showed in the editor (it used to be label of tab)
197.122 - */
197.123 - public EditorOperator(String filename) {
197.124 - this(filename, 0);
197.125 - }
197.126 -
197.127 - /** Waits for index-th opened editor with given name.
197.128 - * If not active, it is activated.
197.129 - * @param filename name of file showed in the editor (it used to be label of tab)
197.130 - * @param index index of editor to be find
197.131 - */
197.132 - public EditorOperator(String filename, int index) {
197.133 - super(waitTopComponent(null, filename, index, new EditorSubchooser(filename)));
197.134 -// super(filename, new EditorSubchooser());
197.135 - this.requestFocus(); // needed for pushKey() methods
197.136 - }
197.137 -
197.138 -
197.139 -/* public EditorOperator(ContainerOperator contOper) {
197.140 - super(contOper, new EditorSubchooser());
197.141 - this.requestFocus(); // needed for pushKey() methods
197.142 - }
197.143 -*/
197.144 - /** Waits for first open editor with given name in specified container.
197.145 - * If not active, it is activated.
197.146 - * @param contOper container where to search
197.147 - * @param filename name of file showed in the editor (it used to be label of tab)
197.148 - */
197.149 - public EditorOperator(ContainerOperator contOper, String filename) {
197.150 -// this(contOper, filename, 0);
197.151 - super(contOper, new EditorSubchooser(filename));
197.152 - this.requestFocus(); // needed for pushKey() methods
197.153 -
197.154 - }
197.155 -
197.156 - /** Waits for index-th opened editor with given name in specified container.
197.157 - * If not active, it is activated.
197.158 - * @param contOper container where to search
197.159 - * @param filename name of file showed in the editor (it used to be label of tab)
197.160 - * @param index index of editor to be find
197.161 - */
197.162 - public EditorOperator(ContainerOperator contOper, String filename, int index) {
197.163 - super(waitTopComponent(contOper, filename, index, new EditorSubchooser(filename)));
197.164 - copyEnvironment(contOper);
197.165 - this.requestFocus(); // needed for pushKey() methods
197.166 - }
197.167 -
197.168 - /** Closes all opened documents and discards all changes by IDE API calls.
197.169 - * It works also if no file is modified, so it is a safe way how to close
197.170 - * documents and no block further execution.
197.171 - */
197.172 - public static void closeDiscardAll() {
197.173 - // run in dispatch thread
197.174 - // TODO: workaround for compilation
197.175 - JTabbedPaneOperator tabbed = new JTabbedPaneOperator(RaveWindowOperator.getDefault());
197.176 - for (int i=0; i<tabbed.getTabCount();i++){
197.177 - EditorOperator.close((TopComponent)tabbed.getComponent(i),false);
197.178 - }
197.179 -/* TODO: doesn't work; rewrite it
197.180 - ModeImpl mode = (ModeImpl)new QueueTool().invokeSmoothly(new QueueTool.QueueAction("findMode") { // NOI18N
197.181 - public Object launch() {
197.182 - return WindowManagerImpl.getInstance().findMode("editor"); //NOI18N
197.183 - }
197.184 - });
197.185 - Iterator iter = mode.getOpenedTopComponents().iterator();
197.186 -
197.187 - while(iter.hasNext()) {
197.188 - EditorOperator.close((TopComponent)iter.next(), false);
197.189 - }
197.190 - */
197.191 - }
197.192 -
197.193 - /** Closes this editor by IDE API call and depending on given flag
197.194 - * it saves or discards changes.
197.195 - * @param save true - save changes, false - discard changes
197.196 - */
197.197 - public void close(boolean save) {
197.198 - if(save) {
197.199 - super.save();
197.200 - close();
197.201 - } else {
197.202 - closeDiscard();
197.203 - }
197.204 - }
197.205 -
197.206 - /** Closes top component. It saves it or not depending on given flag.
197.207 - * Other top components like VCS outputs are closed directly.
197.208 - * It is package private because it is also used by EditorWindowOperator.
197.209 - */
197.210 - static void close(TopComponent tc, boolean save) {
197.211 - TopComponentOperator tco = new TopComponentOperator(tc);
197.212 - if(save) {
197.213 - tco.save();
197.214 - tco.close();
197.215 - } else {
197.216 - tco.closeDiscard();
197.217 - }
197.218 - }
197.219 -
197.220 - /** Returns operator of currently shown editor pane.
197.221 - * @return JTabbedPaneOperator instance of editor pane
197.222 - */
197.223 - public JEditorPaneOperator txtEditorPane() {
197.224 - if(_txtEditorPane == null) {
197.225 - _txtEditorPane = new JEditorPaneOperator(this);
197.226 - }
197.227 - return _txtEditorPane;
197.228 - }
197.229 -
197.230 - /** Returns operator of label showing current row and column at the left
197.231 - * corner of the Source Editor window.
197.232 - * @return JLabelOperator instance of row:column label
197.233 - */
197.234 - public JLabelOperator lblRowColumn() {
197.235 - if(_lblRowColumn == null) {
197.236 - _lblRowColumn = new JLabelOperator(this, 0);
197.237 - }
197.238 - return _lblRowColumn;
197.239 - }
197.240 -
197.241 - /** Returns operator of label showing current input mode (INS/OVR -
197.242 - * insert/overwrite).
197.243 - * @return JLabelOperator instance of input mode label
197.244 - */
197.245 - public JLabelOperator lblInputMode() {
197.246 - if(_lblInputMode == null) {
197.247 - _lblInputMode = new JLabelOperator(this, 1);
197.248 - }
197.249 - return _lblInputMode;
197.250 - }
197.251 -
197.252 - /** Returns operator of status bar at the bottom of the Source Editor.
197.253 - * @return JLabelOperator instance of status bar
197.254 - */
197.255 - public JLabelOperator lblStatusBar() {
197.256 - if(_lblStatusBar == null) {
197.257 - _lblStatusBar = new JLabelOperator(this, 2);
197.258 - }
197.259 - return _lblStatusBar;
197.260 - }
197.261 -
197.262 - /** Returns operator of combo box showing members of the class. It
197.263 - * is applicable only for Java objects.
197.264 - * @return JComboBoxOperator instance of members combo box
197.265 - */
197.266 - public JComboBoxOperator cboQuickBrowse() {
197.267 - if (_cboQuickBrowse == null) {
197.268 - _cboQuickBrowse = new JComboBoxOperator(this);
197.269 - }
197.270 - return _cboQuickBrowse;
197.271 - }
197.272 -
197.273 - /** Selects item in quick browse combo box.
197.274 - * @param item itme to be selected
197.275 - */
197.276 - public void setQuickBrowse(String item) {
197.277 - cboQuickBrowse().selectItem(item);
197.278 - }
197.279 -
197.280 - /************** Get, select, delete, insert text ************************/
197.281 -
197.282 - /** Gets text from the currently opened Editor window.
197.283 - * @return a string representing whole content of the Editor window
197.284 - * (including new line characters)
197.285 - */
197.286 - public String getText() {
197.287 - return txtEditorPane().getText();
197.288 - }
197.289 -
197.290 - /** Gets text from specified line.
197.291 - * It might fail on the last line of a file because of issues
197.292 - * http://www.netbeans.org/issues/show_bug.cgi?id=24434 and
197.293 - * http://www.netbeans.org/issues/show_bug.cgi?id=24433.
197.294 - * @param lineNumber number of line (beggining from 1)
197.295 - * @return a string representing content of the line including new line
197.296 - * character
197.297 - */
197.298 - public String getText(int lineNumber) {
197.299 - return ((Line)getLine(lineNumber)).getText();
197.300 - }
197.301 -
197.302 - /** Returns instance of org.openide.text.Line for given line number.
197.303 - * @param lineNumber number of line (beggining at 1)
197.304 - * @return org.openide.text.Line instance
197.305 - */
197.306 - private Object getLine(int lineNumber) {
197.307 - Document doc = txtEditorPane().getDocument();
197.308 - DataObject od = (DataObject)doc.getProperty(Document.StreamDescriptionProperty);
197.309 - Set set = ((LineCookie)od.getCookie(LineCookie.class)).getLineSet();
197.310 - try {
197.311 - return set.getCurrent(lineNumber-1);
197.312 - } catch (IndexOutOfBoundsException e) {
197.313 - throw new JemmyException("Index must be > 0", e);
197.314 - }
197.315 - }
197.316 -
197.317 - /** Checks if editor window contains text specified as parameter text.
197.318 - * @param text text to compare to
197.319 - * @return true if text was found, false otherwise
197.320 - */
197.321 - public boolean contains(String text) {
197.322 - return getText().indexOf(text) != -1;
197.323 - }
197.324 -
197.325 - /** Selects whole line specified by its number. Caret will stand at the
197.326 - * next available line.
197.327 - * @param lineNumber number of line (beggining from 1)
197.328 - */
197.329 - public void select(int lineNumber) {
197.330 - int lineOffset = getLineOffset(lineNumber);
197.331 - setCaretPosition(lineOffset);
197.332 - txtEditorPane().moveCaretPosition(lineOffset+getText(lineNumber).length());
197.333 - }
197.334 -
197.335 - /** Selects text between line1 and line2 (both are included). Caret will
197.336 - * stand behing the selection (at the next line if available).
197.337 - * @param line1 number of line where to begin (beggining from 1)
197.338 - * @param line2 number of line where to finish (beggining from 1)
197.339 - */
197.340 - public void select(int line1, int line2) {
197.341 - setCaretPosition(getLineOffset(line1));
197.342 - txtEditorPane().moveCaretPosition(getLineOffset(line2)+getText(line2).length());
197.343 - }
197.344 -
197.345 - /** Selects text in specified line on position defined by column1
197.346 - * and column2 (both are included). Caret will stand at the end of
197.347 - * the selection.
197.348 - * @param lineNumber number of line (beggining from 1)
197.349 - * @param column1 column position where selection starts (beggining from 1)
197.350 - * @param column2 column position where selection ends (beggining from 1) */
197.351 - public void select(int lineNumber, int column1, int column2) {
197.352 - int lineOffset = getLineOffset(lineNumber);
197.353 - setCaretPosition(lineOffset+column1-1);
197.354 - txtEditorPane().moveCaretPosition(lineOffset+column2);
197.355 - }
197.356 -
197.357 - /** Selects index-th occurence of given text.
197.358 - * @param text text to be selected
197.359 - * @param index index of text occurence (first occurence has index 0)
197.360 - * @see #select(String)
197.361 - */
197.362 - public void select(String text, int index) {
197.363 - int position = txtEditorPane().getPositionByText(text, index);
197.364 - if(position == -1) {
197.365 - throw new JemmyException(index+"-th occurence of \""+text+"\" not found.");
197.366 - }
197.367 - setCaretPosition(position);
197.368 - txtEditorPane().moveCaretPosition(position+text.length());
197.369 - }
197.370 -
197.371 - /** Selects first occurence of given text.
197.372 - * @param text text to be selected
197.373 - * @see #select(String, int)
197.374 - */
197.375 - public void select(String text) {
197.376 - select(text, 0);
197.377 - }
197.378 -
197.379 - /** Replaces first occurence of oldText by newText.
197.380 - * @param oldText text to be replaced
197.381 - * @param newText text to write instead
197.382 - */
197.383 - public void replace(String oldText, String newText) {
197.384 - replace(oldText, newText, 0);
197.385 - }
197.386 -
197.387 - /** Replaced index-th occurence of oldText by newText.
197.388 - * @param oldText text to be replaced
197.389 - * @param newText text to write instead
197.390 - * @param index index of oldText occurence (first occurence has index 0)
197.391 - */
197.392 - public void replace(String oldText, String newText, int index) {
197.393 - select(oldText, index);
197.394 - txtEditorPane().replaceSelection(newText);
197.395 - }
197.396 -
197.397 - /** Inserts text to current position. Caret will stand at the end
197.398 - * of newly inserted text.
197.399 - * @param text a string to be inserted
197.400 - */
197.401 - public void insert(final String text) {
197.402 - final int offset = txtEditorPane().getCaretPosition();
197.403 - runMapping(new MapVoidAction("insertString") {
197.404 - public void map() {
197.405 - try {
197.406 - txtEditorPane().getDocument().insertString(offset, text, null);
197.407 - } catch (BadLocationException e) {
197.408 - throw new JemmyException("Cannot insert \""+text+"\" to position "+offset+".", e);
197.409 - }
197.410 - }
197.411 - });
197.412 - }
197.413 -
197.414 - /** Inserts text to position specified by line number and column.
197.415 - * Caret will stand at the end of newly inserted text.
197.416 - * @param text a string to be inserted
197.417 - * @param lineNumber number of line (beggining from 1)
197.418 - * @param column column position (beggining from 1)
197.419 - */
197.420 - public void insert(String text, int lineNumber, int column) {
197.421 - setCaretPosition(lineNumber, column);
197.422 - insert(text);
197.423 - }
197.424 -
197.425 - /** Deletes given number of characters from specified possition.
197.426 - * Position of caret will not change.
197.427 - * @param offset position inside document (0 means the beginning)
197.428 - * @param length number of characters to be deleted
197.429 - */
197.430 - public void delete(int offset, int length) {
197.431 - try {
197.432 - txtEditorPane().getDocument().remove(offset, length);
197.433 - } catch (BadLocationException e) {
197.434 - throw new JemmyException("Cannot delete "+length+" characters from position "
197.435 - +offset+".", e);
197.436 - }
197.437 - }
197.438 -
197.439 - /** Deletes given number of characters from current caret possition.
197.440 - * Position of caret will not change.
197.441 - * @param length number of characters to be deleted
197.442 - */
197.443 - public void delete(int length) {
197.444 - delete(txtEditorPane().getCaretPosition(), length);
197.445 - }
197.446 -
197.447 - /** Delete specified line.
197.448 - * Position of caret will not change.
197.449 - * @param line number of line (beggining from 1)
197.450 - */
197.451 - public void deleteLine(int line) {
197.452 - delete(getLineOffset(line), getText(line).length());
197.453 - }
197.454 -
197.455 - /** Deletes characters between column1 and column2 (both are included)
197.456 - * on the specified line.
197.457 - * @param lineNumber number of line (beggining from 1)
197.458 - * @param column1 column position where to start deleting (beggining from 1)
197.459 - * @param column2 column position where to stop deleting (beggining from 1) */
197.460 - public void delete(int lineNumber, int column1, int column2) {
197.461 - delete(getLineOffset(lineNumber)+column1-1, column2-column1+1);
197.462 - }
197.463 -
197.464 - /********************** Caret manipulation ************************/
197.465 -
197.466 - /** Returns current line number.
197.467 - * @return number of line where the caret stays (first line == 1)
197.468 - */
197.469 - public int getLineNumber() {
197.470 - StyledDocument doc = (StyledDocument)txtEditorPane().getDocument();
197.471 - int offset = txtEditorPane().getCaretPosition();
197.472 - return NbDocument.findLineNumber(doc, offset) + 1;
197.473 - }
197.474 -
197.475 - /** Pushes key of requested key code. */
197.476 - public void pushKey(int keyCode) {
197.477 - // need to request focus before any key push
197.478 - this.requestFocus();
197.479 - txtEditorPane().pushKey(keyCode);
197.480 - }
197.481 -
197.482 - /** Pushes Home key (KeyEvent.VK_HOME) */
197.483 - public void pushHomeKey() {
197.484 - pushKey(KeyEvent.VK_HOME);
197.485 - }
197.486 -
197.487 - /** Pushes End key (KeyEvent.VK_END) */
197.488 - public void pushEndKey() {
197.489 - pushKey(KeyEvent.VK_END);
197.490 - }
197.491 -
197.492 - /** Pushes Tab key (KeyEvent.VK_TAB) */
197.493 - public void pushTabKey() {
197.494 - pushKey(KeyEvent.VK_TAB);
197.495 - }
197.496 -
197.497 - /** Pushes Down key (KeyEvent.VK_DOWN) */
197.498 - public void pushDownArrowKey() {
197.499 - pushKey(KeyEvent.VK_DOWN);
197.500 - }
197.501 -
197.502 - /** Pushes Up key (KeyEvent.VK_UP) */
197.503 - public void pushUpArrowKey() {
197.504 - pushKey(KeyEvent.VK_UP);
197.505 - }
197.506 -
197.507 - /** Returns offset of the beginning of a line.
197.508 - * @param lineNumber number of line (starts at 1)
197.509 - * @return offset offset of line from the beginning of a file
197.510 - */
197.511 - private int getLineOffset(int lineNumber) {
197.512 - try {
197.513 - StyledDocument doc = (StyledDocument)txtEditorPane().getDocument();
197.514 - return NbDocument.findLineOffset(doc, lineNumber-1);
197.515 - } catch (IndexOutOfBoundsException e) {
197.516 - throw new JemmyException("Invalid line number "+lineNumber, e);
197.517 - }
197.518 - }
197.519 -
197.520 - /** Sets caret position relatively to current position.
197.521 - * @param relativeMove count of charaters to move caret
197.522 - */
197.523 - public void setCaretPositionRelative(int relativeMove) {
197.524 - setCaretPosition(txtEditorPane().getCaretPosition()+relativeMove);
197.525 - }
197.526 -
197.527 - /** Sets caret position to the beginning of specified line.
197.528 - * Lines are numbered from 1, so setCaretPosition(1) will set caret
197.529 - * to the beginning of the first line.
197.530 - * @param lineNumber number of line (beggining from 1)
197.531 - */
197.532 - public void setCaretPositionToLine(int lineNumber) {
197.533 - txtEditorPane().setCaretPosition(getLineOffset(lineNumber));
197.534 - }
197.535 -
197.536 - /** Sets caret position to the end of specified line.
197.537 - * Lines are numbered from 1, so setCaretPosition(1) will set caret
197.538 - * to the end of the first line.
197.539 - * @param lineNumber number of line (beggining from 1)
197.540 - */
197.541 - public void setCaretPositionToEndOfLine(int lineNumber) {
197.542 - // getText returns contents of line plus \n, that's why we use length()-1
197.543 - txtEditorPane().setCaretPosition(getLineOffset(lineNumber)+
197.544 - getText(lineNumber).length()-1);
197.545 - }
197.546 -
197.547 - /** Sets caret position to specified line and column
197.548 - * @param lineNumber line number where to set caret
197.549 - * @param column column where to set caret (1 means beginning of the row)
197.550 - */
197.551 - public void setCaretPosition(int lineNumber, int column) {
197.552 - setCaretPosition(getLineOffset(lineNumber)+column-1);
197.553 - }
197.554 -
197.555 - /** Sets caret to desired position.
197.556 - * @param position a position to set caret to (number of characters from
197.557 - * the beggining of the file - 0 means beginning of the file).
197.558 - */
197.559 - public void setCaretPosition(int position) {
197.560 - if(position < 0 || position > getText().length()) {
197.561 - throw new JemmyException("Invalid caret position "+position);
197.562 - }
197.563 - txtEditorPane().setCaretPosition(position);
197.564 - }
197.565 -
197.566 - /** Sets caret position before or after index-th occurence of given string.
197.567 - * @param text text to be searched
197.568 - * @param index index of text occurence (first occurence has index 0)
197.569 - * @param before if true put caret before text, otherwise after.
197.570 - */
197.571 - public void setCaretPosition(String text, int index, boolean before) {
197.572 - setCaretPosition(txtEditorPane().getPositionByText(text, index)
197.573 - +(before ? 0:text.length()));
197.574 - }
197.575 -
197.576 - /** Sets caret position before or after first occurence of given string.
197.577 - * @param text text to be searched
197.578 - * @param before if true put caret before text, otherwise after.
197.579 - */
197.580 - public void setCaretPosition(String text, boolean before) {
197.581 - setCaretPosition(text, 0, before);
197.582 - }
197.583 -
197.584 - /**************************** Annotations ******************************/
197.585 - /************** thanks to Jan Lahoda for valuable input ***************/
197.586 -
197.587 - /** Gets an array of annotations attached to given line.
197.588 - * @param lineNumber number of line (beggining from 1)
197.589 - * @return an array of org.openide.text.Annotation instances
197.590 - * @see #getAnnotationShortDescription
197.591 - * @see #getAnnotationType
197.592 - */
197.593 - public Object[] getAnnotations(int lineNumber) {
197.594 - return getAnnotations(getLine(lineNumber)).toArray(new Annotation[0]);
197.595 - }
197.596 -
197.597 - /** Gets annotations from given Line object
197.598 - * @param line instance of org.openide.text.Line
197.599 - * @return list of annotations
197.600 - */
197.601 - private List getAnnotations(Object line) {
197.602 - try {
197.603 - Method getAnnotations = Annotatable.class.getDeclaredMethod("getAnnotations", null);
197.604 - getAnnotations.setAccessible(true);
197.605 - return (List)getAnnotations.invoke(line, null);
197.606 - } catch (Exception e) {
197.607 - throw new JemmyException("getAnnotations() by reflection failed.", e);
197.608 - }
197.609 - }
197.610 -
197.611 - /**Gets all annotations for current editor (Document).
197.612 - * @return array of org.openide.text.Annotation containing all annotations
197.613 - * attached to this editor.
197.614 - * @see #getAnnotationShortDescription
197.615 - * @see #getAnnotationType
197.616 - */
197.617 - public Object[] getAnnotations() {
197.618 - Document doc = txtEditorPane().getDocument();
197.619 - DataObject dob = (DataObject)doc.getProperty(Document.StreamDescriptionProperty);
197.620 -
197.621 - // get line annotations
197.622 - Set set = ((LineCookie)dob.getCookie(LineCookie.class)).getLineSet();
197.623 - Iterator iter = set.getLines().iterator();
197.624 - ArrayList result = new ArrayList();
197.625 - while(iter.hasNext()) {
197.626 - result.addAll(getAnnotations((Line)iter.next()));
197.627 - }
197.628 - // get error and override parser annotations
197.629 - Class javaEditorClass = null;
197.630 - try {
197.631 - javaEditorClass = Class.forName("org.netbeans.modules.java.JavaEditor");
197.632 - } catch (ClassNotFoundException e) {
197.633 - // print only warning. Class JavaEditor don't need to be present when
197.634 - // java module is uninstalled.
197.635 - getOutput().printLine("WARNING: Class org.netbeans.modules.java.JavaEditor not found.");
197.636 - }
197.637 - Object javaEditorInstance = dob.getCookie(javaEditorClass);
197.638 - if(javaEditorInstance != null) {
197.639 - ArrayList errorAnnotations;
197.640 - try {
197.641 - java.lang.reflect.Field annot = javaEditorClass.getDeclaredField("errorAnnotations");
197.642 - annot.setAccessible(true);
197.643 - errorAnnotations = (ArrayList)annot.get(javaEditorInstance);
197.644 - } catch (Exception e) {
197.645 - throw new JemmyException("Get errorAnnotations field failed.", e);
197.646 - }
197.647 - result.addAll(errorAnnotations);
197.648 - ArrayList overrideAnnotations;
197.649 - try {
197.650 - java.lang.reflect.Field annot = javaEditorClass.getDeclaredField("overrideAnnotations");
197.651 - annot.setAccessible(true);
197.652 - overrideAnnotations = (ArrayList)annot.get(javaEditorInstance);
197.653 - } catch (Exception e) {
197.654 - throw new JemmyException("Get overrideAnnotations field failed.", e);
197.655 - }
197.656 - result.addAll(overrideAnnotations);
197.657 - }
197.658 - // return all line and parser annotations together
197.659 - return result.toArray(new Annotation[result.size()]);
197.660 - }
197.661 -
197.662 - /** Returns a string uniquely identifying annotation. For editor bookmark
197.663 - * it is for example
197.664 - * org.netbeans.modules.editor.NbEditorKit.BOOKMARK_ANNOTATION_TYPE.
197.665 - * @param annotation instance of org.openide.text.Annotation
197.666 - * @return a string uniquely identifying annotation
197.667 - * @see #getAnnotations()
197.668 - *@see #getAnnotations(int)
197.669 - */
197.670 - public static String getAnnotationType(Object annotation) {
197.671 - return ((Annotation)annotation).getAnnotationType();
197.672 - }
197.673 -
197.674 - /** Returns a short description of annotation. It is localized.
197.675 - * @param annotation instance of org.openide.text.Annotation
197.676 - * @return a short description of annotation according to current locale
197.677 - */
197.678 - public static String getAnnotationShortDescription(Object annotation) {
197.679 - return ((Annotation)annotation).getShortDescription();
197.680 - }
197.681 -
197.682 - /***************** Methods for toolbar manipulation *******************/
197.683 -
197.684 - /** Return JButtonOperator representing a toolbar button found by given
197.685 - * tooltip within the Source Editor.
197.686 - * @param buttonTooltip tooltip of toolbar button
197.687 - * @return JButtonOperator instance of found toolbar button
197.688 - */
197.689 - public JButtonOperator getToolbarButton(String buttonTooltip) {
197.690 - ToolbarButtonChooser chooser = new ToolbarButtonChooser(buttonTooltip, getComparator());
197.691 - return new JButtonOperator(JButtonOperator.waitJButton(
197.692 - (Container)this.getSource(), chooser));
197.693 - }
197.694 -
197.695 - /** Return JButtonOperator representing index-th toolbar button within
197.696 - * the Source Editor.
197.697 - * @param index index of toolbar button to find
197.698 - * @return JButtonOperator instance of found toolbar button
197.699 - */
197.700 - public JButtonOperator getToolbarButton(int index) {
197.701 - // finds JToolbar
197.702 - ComponentChooser chooser = new ComponentChooser() {
197.703 - public boolean checkComponent(Component comp) {
197.704 - return comp instanceof JToolBar;
197.705 - }
197.706 - public String getDescription() {
197.707 - return "javax.swing.JToolBar";
197.708 - }
197.709 - };
197.710 - Container toolbar = (Container)findComponent((Container)getSource(), chooser);
197.711 - if(toolbar == null) {
197.712 - throw new JemmyException("Toolbar not present.");
197.713 - }
197.714 - // if "quick browse" combo box is present, skip first button (MetalComboBoxButton usualy)
197.715 - Component combo = JComboBoxOperator.findJComboBox(toolbar,
197.716 - ComponentSearcher.getTrueChooser("JComboBox"));
197.717 - if(combo != null) {
197.718 - index++;
197.719 - }
197.720 - return new JButtonOperator(JButtonOperator.waitJButton((Container)toolbar,
197.721 - ComponentSearcher.getTrueChooser("JButton"), index));
197.722 - }
197.723 -
197.724 - /** Pushes popup menu on toolbar. It doesn't matter on which position it is
197.725 - * invoked, everytime it is the same. That's why popup menu is invoked on
197.726 - * the toolbar button with index 0. To switch toolbar on use Options ->
197.727 - * Editing -> Editor Settings -> Toolbar Visible -> true.
197.728 - * @param popupPath path to menu item (e.g. "Toolbar Visible")
197.729 - */
197.730 - public void pushToolbarPopupMenu(String popupPath) {
197.731 - getToolbarButton(0).clickForPopup();
197.732 - new JPopupMenuOperator().pushMenu(popupPath, "|");
197.733 - }
197.734 -
197.735 - /** Chooser which can be used to find a component with given tooltip,
197.736 - * in this case a toolbar button.
197.737 - */
197.738 - private static class ToolbarButtonChooser implements ComponentChooser {
197.739 - private String buttonTooltip;
197.740 - private StringComparator comparator;
197.741 -
197.742 - public ToolbarButtonChooser(String buttonTooltip, StringComparator comparator) {
197.743 - this.buttonTooltip = buttonTooltip;
197.744 - this.comparator = comparator;
197.745 - }
197.746 -
197.747 - public boolean checkComponent(Component comp) {
197.748 - return comparator.equals(((JComponent)comp).getToolTipText(), buttonTooltip);
197.749 - }
197.750 -
197.751 - public String getDescription() {
197.752 - return "Toolbar button with tooltip \""+buttonTooltip+"\".";
197.753 - }
197.754 - }
197.755 -
197.756 - /** Returns current modify state of edited source
197.757 - * @return boolean true when edited source is modified
197.758 - */
197.759 - public boolean isModified() {
197.760 - return getName().endsWith("*");
197.761 - }
197.762 -
197.763 - /** Waits for given modified state of edited source.
197.764 - * @param modified boolean true waits for file state change to modified, false for change to
197.765 - * unmodified (saved).
197.766 - * Throws TimeoutExpiredException when EditorOperator.WaitModifiedTimeout expires.
197.767 - */
197.768 - public void waitModified(final boolean modified) {
197.769 - try {
197.770 - Waiter waiter = new Waiter(new Waitable() {
197.771 - public Object actionProduced(Object obj) {
197.772 - return isModified()==modified?new Object():null;
197.773 - }
197.774 - public String getDescription() {
197.775 - return("Wait Modified State");
197.776 - }
197.777 - });
197.778 - Timeouts times = getTimeouts().cloneThis();
197.779 - times.setTimeout("Waiter.WaitingTime", times.getTimeout("EditorOperator.WaitModifiedTimeout"));
197.780 - waiter.setTimeouts(times);
197.781 - waiter.setOutput(getOutput());
197.782 - waiter.waitAction(null);
197.783 - } catch(InterruptedException e) {}
197.784 - }
197.785 -
197.786 - /** Performs save action with optional verification. */
197.787 - public void save() {
197.788 - new SaveAction().perform(this);
197.789 - if (getVerification())
197.790 - waitModified(false);
197.791 - }
197.792 -
197.793 - public void closeAndCancelByPopup() {
197.794 - this.clickForPopup();
197.795 - new JPopupMenuOperator().pushMenu("Close");
197.796 - new EventTool().waitNoEvent(500);
197.797 -
197.798 - try {
197.799 - JDialogOperator qDialog = new JDialogOperator("Question");
197.800 - new QueueTool().waitEmpty(100);
197.801 - new JButtonOperator(qDialog, "Cancel").push();
197.802 - }catch(Exception e) {}
197.803 - }
197.804 -
197.805 -
197.806 - /** Performs verification by accessing all sub-components */
197.807 - public void verify() {
197.808 - txtEditorPane();
197.809 - cboQuickBrowse();
197.810 - lblInputMode();
197.811 - lblRowColumn();
197.812 - lblStatusBar();
197.813 - }
197.814 -
197.815 - /** SubChooser to determine Editor TopComponent
197.816 - * Used in findTopComponent method.
197.817 - */
197.818 - private static final class EditorSubchooser implements ComponentChooser {
197.819 - String ID;
197.820 - public EditorSubchooser(String ID) {
197.821 - this.ID = ID;
197.822 - }
197.823 - public boolean checkComponent(Component comp) {
197.824 - return(comp instanceof CloneableEditor &&
197.825 - ((CloneableEditor)comp).getName().indexOf(ID) != -1 && comp.isShowing());
197.826 - }
197.827 -
197.828 - public String getDescription() {
197.829 - return "org.openide.text.CloneableEditor";
197.830 - }
197.831 - }
197.832 -}
198.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/Flasher.java Thu Jul 10 04:29:52 2008 -0700
198.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
198.3 @@ -1,225 +0,0 @@
198.4 -/*
198.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
198.6 - *
198.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
198.8 - *
198.9 - * The contents of this file are subject to the terms of either the GNU
198.10 - * General Public License Version 2 only ("GPL") or the Common
198.11 - * Development and Distribution License("CDDL") (collectively, the
198.12 - * "License"). You may not use this file except in compliance with the
198.13 - * License. You can obtain a copy of the License at
198.14 - * http://www.netbeans.org/cddl-gplv2.html
198.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
198.16 - * specific language governing permissions and limitations under the
198.17 - * License. When distributing the software, include this License Header
198.18 - * Notice in each file and include the License file at
198.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
198.20 - * particular file as subject to the "Classpath" exception as provided
198.21 - * by Sun in the GPL Version 2 section of the License file that
198.22 - * accompanied this code. If applicable, add the following below the
198.23 - * License Header, with the fields enclosed by brackets [] replaced by
198.24 - * your own identifying information:
198.25 - * "Portions Copyrighted [year] [name of copyright owner]"
198.26 - *
198.27 - * Contributor(s):
198.28 - *
198.29 - * The Original Software is NetBeans. The Initial Developer of the Original
198.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
198.31 - * Microsystems, Inc. All Rights Reserved.
198.32 - *
198.33 - * If you wish your version of this file to be governed by only the CDDL
198.34 - * or only the GPL Version 2, indicate your decision by adding
198.35 - * "[Contributor] elects to include this software in this distribution
198.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
198.37 - * single choice of license, a recipient has the option to distribute
198.38 - * your version of this file under either the CDDL, the GPL Version 2 or
198.39 - * to extend the choice of license to its licensees as provided above.
198.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
198.41 - * Version 2 license, then the option applies only if the new code is
198.42 - * made subject to such option by the copyright holder.
198.43 - */
198.44 -
198.45 -/**
198.46 - *
198.47 - * $Id$ $Revision$ $Date$
198.48 - *
198.49 - */
198.50 -package org.netbeans.modules.visualweb.gravy;
198.51 -
198.52 -import java.awt.Color;
198.53 -import java.awt.Dimension;
198.54 -import java.awt.Graphics;
198.55 -import java.awt.Component;
198.56 -import java.awt.Point;
198.57 -import javax.swing.JDialog;
198.58 -import javax.swing.JFrame;
198.59 -import javax.swing.JLayeredPane;
198.60 -import javax.swing.JPanel;
198.61 -import javax.swing.SwingUtilities;
198.62 -
198.63 -import org.netbeans.jemmy.operators.ComponentOperator;
198.64 -import org.netbeans.jemmy.JemmyException;
198.65 -import org.netbeans.jemmy.JemmyProperties;
198.66 -import org.netbeans.jemmy.Timeoutable;
198.67 -import org.netbeans.jemmy.Timeouts;
198.68 -
198.69 -/**
198.70 - * Flasher is a utility class allowing to highlight special point by drawing a cross with
198.71 - * this point as center. It can be useful when it's necessary to see where is given point situated
198.72 - * @version 1.0 Mar 15, 2005
198.73 - */
198.74 -public class Flasher implements Timeoutable{
198.75 -
198.76 - /**
198.77 - * Default color of the cross. Now it's red.
198.78 - */
198.79 - public static final Color DEFAULT_COLOR=new Color(255,0,0);
198.80 - protected static final int len=30;
198.81 - protected Color color=DEFAULT_COLOR;
198.82 - protected static long WAIT_TIME=1000;
198.83 -
198.84 - /**
198.85 - * By default, flash is executed in the main thread
198.86 - */
198.87 - protected boolean separateThread=false;
198.88 - protected Timeouts timeouts;
198.89 -
198.90 - static {
198.91 - Timeouts.initDefault("Flasher.FlashTimeout", WAIT_TIME);
198.92 - }
198.93 -
198.94 - public void setTimeouts(Timeouts timeouts) {
198.95 - this.timeouts = timeouts;
198.96 - }
198.97 -
198.98 - public Timeouts getTimeouts() {
198.99 - return timeouts;
198.100 - }
198.101 -
198.102 - /**
198.103 - * Constructs new object ready for flashing
198.104 - */
198.105 - public Flasher(){
198.106 - this(false);
198.107 - }
198.108 -
198.109 - /**
198.110 - * Constructs new object ready for flashing
198.111 - * @param separateThread If true, flash will be started in separate thread
198.112 - * and test execution continues without delay
198.113 - */
198.114 - public Flasher(boolean separateThread){
198.115 - this.separateThread=separateThread;
198.116 - setTimeouts(JemmyProperties.getProperties().getTimeouts());
198.117 - }
198.118 -
198.119 - /**
198.120 - * Sets color of the cross. Must be used before flash() call
198.121 - * @param color New color
198.122 - */
198.123 - public void setColor(Color color){
198.124 - this.color=color;
198.125 - }
198.126 -
198.127 - /**
198.128 - * Draws a cross with center in specified point of component
198.129 - * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
198.130 - * @param p Center of the cross
198.131 - * @param op Operator for parent component of the point
198.132 - */
198.133 - public void flash(ComponentOperator op, Point p){
198.134 - flash(op.getSource(),p);
198.135 - }
198.136 -
198.137 - /**
198.138 - * Draws a cross with center in specified point of component
198.139 - * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
198.140 - * @param x x-coordinate of center of the cross
198.141 - * @param y x-coordinate of center of the cross
198.142 - * @param op Operator for parent component of the point
198.143 - */
198.144 - public void flash(ComponentOperator op, int x, int y){
198.145 - flash(op.getSource(),x,y);
198.146 - }
198.147 -
198.148 - /**
198.149 - * Draws a cross with center in specified point of component
198.150 - * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
198.151 - * @param x x-coordinate of center of the cross
198.152 - * @param y x-coordinate of center of the cross
198.153 - * @param comp Parent component of the point
198.154 - */
198.155 - public void flash(Component comp, int x, int y){
198.156 - flash(comp,new Point(x,y));
198.157 - }
198.158 -
198.159 - /**
198.160 - * Draws a cross with center in specified point of component
198.161 - * Delays by "Flasher.FlashTimeout" timeout, then cross disappears
198.162 - * @param p Center of the cross
198.163 - * @param comp Parent component of the point
198.164 - */
198.165 - public void flash(final Component comp, final Point p){
198.166 -
198.167 - if (separateThread){
198.168 - new Thread(new Runnable() {
198.169 - public void run() {
198.170 - doFlash(comp,p);
198.171 - }
198.172 - }).start();
198.173 - }else{
198.174 - doFlash(comp,p);
198.175 - }
198.176 - }
198.177 -
198.178 - /**
198.179 - * Draws a cross. Called from flash() in the main thread or in a
198.180 - * separate thread depending on separateThread field value
198.181 - */
198.182 - protected void doFlash(Component comp, Point p){
198.183 -
198.184 - // we need to find JDialog or JFrame ancestor to use JLayeredPane
198.185 - JFrame f;
198.186 - JDialog d;
198.187 - JLayeredPane lpane=null;
198.188 - if (comp instanceof JDialog){
198.189 - lpane=((JDialog)comp).getLayeredPane();
198.190 - }else if (comp instanceof JFrame){
198.191 - lpane=((JFrame)comp).getLayeredPane();
198.192 - }else if ((d=(JDialog)SwingUtilities.getAncestorOfClass(JDialog.class, comp))!=null){
198.193 - lpane=d.getLayeredPane();
198.194 - }else if ((f=(JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, comp))!=null){
198.195 - lpane=f.getLayeredPane();
198.196 - }else{
198.197 - throw new JemmyException("Containing dialog or frame not found");
198.198 - }
198.199 - Point p1= new Point (p.x+comp.getLocationOnScreen().x-lpane.getLocationOnScreen().x,
198.200 - p.y+comp.getLocationOnScreen().y-lpane.getLocationOnScreen().y);
198.201 - JPanel flash=new FlashPane(p1,lpane.getSize());
198.202 - lpane.add(flash, JLayeredPane.DRAG_LAYER);
198.203 - lpane.repaint();
198.204 - try{
198.205 - Thread.currentThread().sleep(timeouts.getTimeout("Flasher.FlashTimeout"));
198.206 - }catch(InterruptedException e) {}
198.207 - lpane.remove(flash);
198.208 - lpane.repaint();
198.209 - }
198.210 -
198.211 - protected class FlashPane extends JPanel{
198.212 -
198.213 - private Point p;
198.214 - public FlashPane(Point p, Dimension d){
198.215 - super();
198.216 - this.p=p;
198.217 - setSize(d);
198.218 - setOpaque(false);
198.219 - }
198.220 -
198.221 - public synchronized void paint(Graphics g){
198.222 - super.paint(g);
198.223 - g.setColor(color);
198.224 - g.drawLine(p.x-len,p.y,p.x+len,p.y);
198.225 - g.drawLine(p.x,p.y-len,p.x,p.y+len);
198.226 - }
198.227 - }
198.228 -}
199.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/HelpOperator.java Thu Jul 10 04:29:52 2008 -0700
199.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
199.3 @@ -1,410 +0,0 @@
199.4 -/*
199.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
199.6 - *
199.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
199.8 - *
199.9 - * The contents of this file are subject to the terms of either the GNU
199.10 - * General Public License Version 2 only ("GPL") or the Common
199.11 - * Development and Distribution License("CDDL") (collectively, the
199.12 - * "License"). You may not use this file except in compliance with the
199.13 - * License. You can obtain a copy of the License at
199.14 - * http://www.netbeans.org/cddl-gplv2.html
199.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
199.16 - * specific language governing permissions and limitations under the
199.17 - * License. When distributing the software, include this License Header
199.18 - * Notice in each file and include the License file at
199.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
199.20 - * particular file as subject to the "Classpath" exception as provided
199.21 - * by Sun in the GPL Version 2 section of the License file that
199.22 - * accompanied this code. If applicable, add the following below the
199.23 - * License Header, with the fields enclosed by brackets [] replaced by
199.24 - * your own identifying information:
199.25 - * "Portions Copyrighted [year] [name of copyright owner]"
199.26 - *
199.27 - * Contributor(s):
199.28 - *
199.29 - * The Original Software is NetBeans. The Initial Developer of the Original
199.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
199.31 - * Microsystems, Inc. All Rights Reserved.
199.32 - *
199.33 - * If you wish your version of this file to be governed by only the CDDL
199.34 - * or only the GPL Version 2, indicate your decision by adding
199.35 - * "[Contributor] elects to include this software in this distribution
199.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
199.37 - * single choice of license, a recipient has the option to distribute
199.38 - * your version of this file under either the CDDL, the GPL Version 2 or
199.39 - * to extend the choice of license to its licensees as provided above.
199.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
199.41 - * Version 2 license, then the option applies only if the new code is
199.42 - * made subject to such option by the copyright holder.
199.43 - */
199.44 -
199.45 -package org.netbeans.modules.visualweb.gravy;
199.46 -
199.47 -import java.awt.Component;
199.48 -import java.awt.Dialog;
199.49 -import java.awt.Frame;
199.50 -import java.awt.Window;
199.51 -import org.netbeans.modules.visualweb.gravy.actions.HelpAction;
199.52 -import org.netbeans.jemmy.ComponentChooser;
199.53 -import org.netbeans.jemmy.TestOut;
199.54 -import org.netbeans.jemmy.operators.JButtonOperator;
199.55 -import org.netbeans.jemmy.operators.JEditorPaneOperator;
199.56 -import org.netbeans.jemmy.operators.JSplitPaneOperator;
199.57 -import org.netbeans.jemmy.operators.JTabbedPaneOperator;
199.58 -import org.netbeans.jemmy.operators.JTextFieldOperator;
199.59 -import org.netbeans.jemmy.operators.JTreeOperator;
199.60 -import org.netbeans.jemmy.operators.WindowOperator;
199.61 -
199.62 -/** Class implementing all necessary methods for handling "IDE Help" Frame.
199.63 - * Normally the Help window is a JFrame.
199.64 - * But the Help window can be transformed to a JDialog
199.65 - * when another modal dialog is shown. This operator can handle both states.
199.66 - *
199.67 - * @see HelpAction
199.68 - */
199.69 -public class HelpOperator extends WindowOperator {
199.70 -
199.71 - /** Creates new HelpOperator that can handle it. It tries to find a window
199.72 - * which contains some javax.help.JHelp* sub component.
199.73 - * It throws TimeoutExpiredException when window is not found
199.74 - */
199.75 - public HelpOperator() {
199.76 - super(WindowOperator.waitWindow(new HelpWindowChooser()));
199.77 - }
199.78 -
199.79 - /** Creates new HelpOperator that can handle it. It tries to find a window
199.80 - * which contains some javax.help.JHelp* sub component and the window
199.81 - * has given title.
199.82 - * It throws TimeoutExpiredException when JFrame not found
199.83 - * @param title String help frame title
199.84 - */
199.85 - public HelpOperator(String title) {
199.86 - super(WindowOperator.waitWindow(new HelpWindowChooser(title)));
199.87 - }
199.88 -
199.89 - private static final HelpAction helpAction = new HelpAction();
199.90 -
199.91 - private JButtonOperator _btBack;
199.92 - private JButtonOperator _btNext;
199.93 - private JButtonOperator _btPrint;
199.94 - private JButtonOperator _btPageSetup;
199.95 - private JSplitPaneOperator _splpHelpSplitPane;
199.96 - private JTabbedPaneOperator _tbpHelpTabPane;
199.97 - private JTreeOperator _treeContents;
199.98 - private JTreeOperator _treeIndex;
199.99 - private JTextFieldOperator _txtIndexFind;
199.100 - private JTreeOperator _treeSearch;
199.101 - private JTextFieldOperator _txtSearchFind;
199.102 - private JEditorPaneOperator _txtContentViewer;
199.103 -
199.104 - /** Returns title of help window. The help window can be either JFrame
199.105 - * or JDialog.
199.106 - * @return title of help window
199.107 - */
199.108 - public String getTitle() {
199.109 - if(getSource() instanceof Frame) {
199.110 - return ((Frame)getSource()).getTitle();
199.111 - } else {
199.112 - return ((Dialog)getSource()).getTitle();
199.113 - }
199.114 - }
199.115 -
199.116 - /** invokes default help
199.117 - * @return HelpOperator for invoked help */
199.118 - public static HelpOperator invoke() {
199.119 - helpAction.perform();
199.120 - return new HelpOperator();
199.121 - }
199.122 -
199.123 - /** invokes help with defined help set
199.124 - * @param helpSet String help set name
199.125 - * @return HelpOperator for invoked help */
199.126 - public static HelpOperator invoke(String helpSet) {
199.127 - new HelpAction(helpSet).perform();
199.128 - return new HelpOperator(helpSet);
199.129 - }
199.130 -
199.131 - /** Tries to find "" JButton in this dialog.
199.132 - * It throws TimeoutExpiredException when component not found
199.133 - * @return JButtonOperator
199.134 - */
199.135 - public JButtonOperator btBack() {
199.136 - if (_btBack==null) {
199.137 - _btBack = new JButtonOperator(this, helpButtonChooser, 0);
199.138 - }
199.139 - return _btBack;
199.140 - }
199.141 -
199.142 - /** Tries to find "" JButton in this dialog.
199.143 - * It throws TimeoutExpiredException when component not found
199.144 - * @return JButtonOperator
199.145 - */
199.146 - public JButtonOperator btNext() {
199.147 - if (_btNext==null) {
199.148 - _btNext = new JButtonOperator(this, helpButtonChooser, 1);
199.149 - }
199.150 - return _btNext;
199.151 - }
199.152 -
199.153 - /** Tries to find "" JButton in this dialog.
199.154 - * It throws TimeoutExpiredException when component not found
199.155 - * @return JButtonOperator
199.156 - */
199.157 - public JButtonOperator btPrint() {
199.158 - if (_btPrint==null) {
199.159 - _btPrint = new JButtonOperator(this, helpButtonChooser, 3);
199.160 - }
199.161 - return _btPrint;
199.162 - }
199.163 -
199.164 - /** Tries to find "" JSplitPaneOperator in this dialog.
199.165 - * It throws TimeoutExpiredException when component not found
199.166 - * @return JButtonOperator
199.167 - */
199.168 - public JSplitPaneOperator splpHelpSplitPane() {
199.169 - if (_splpHelpSplitPane==null) {
199.170 - _splpHelpSplitPane = new JSplitPaneOperator( this );
199.171 - }
199.172 - return _splpHelpSplitPane;
199.173 - }
199.174 -
199.175 - /** Tries to find "" JTabbedPane in this dialog.
199.176 - * It throws TimeoutExpiredException when component not found
199.177 - * @return JButtonOperator
199.178 - */
199.179 - public JTabbedPaneOperator tbpHelpTabPane() {
199.180 - if (_tbpHelpTabPane==null) {
199.181 - _tbpHelpTabPane = new JTabbedPaneOperator( splpHelpSplitPane() );
199.182 - }
199.183 - return _tbpHelpTabPane;
199.184 - }
199.185 -
199.186 - /** Tries to find "" JButton in this dialog.
199.187 - * It throws TimeoutExpiredException when component not found
199.188 - * @return JButtonOperator
199.189 - */
199.190 - public JButtonOperator btPageSetup() {
199.191 - if (_btPageSetup==null) {
199.192 - _btPageSetup = new JButtonOperator(this, helpButtonChooser, 4);
199.193 - }
199.194 - return _btPageSetup;
199.195 - }
199.196 -
199.197 - /** Tries to find JTree in Contents tab of this dialog.
199.198 - * It throws TimeoutExpiredException when component not found
199.199 - * @return JTreeOperator
199.200 - */
199.201 - public JTreeOperator treeContents() {
199.202 - selectPageContents();
199.203 - if (_treeContents==null) {
199.204 - _treeContents = new JTreeOperator( tbpHelpTabPane(), 0 );
199.205 - }
199.206 - return _treeContents;
199.207 - }
199.208 -
199.209 - /** Tries to find JTree in Index tab of this dialog.
199.210 - * It throws TimeoutExpiredException when component not found
199.211 - * @return JTreeOperator
199.212 - */
199.213 - public JTreeOperator treeIndex() {
199.214 - selectPageIndex();
199.215 - if (_treeIndex==null) {
199.216 - _treeIndex = new JTreeOperator( tbpHelpTabPane(), 0 );
199.217 - }
199.218 - return _treeIndex;
199.219 - }
199.220 -
199.221 - /** Tries to find JTextField Find in Index tab of this dialog.
199.222 - * It throws TimeoutExpiredException when component not found
199.223 - * @return JTextFieldOperator
199.224 - */
199.225 - public JTextFieldOperator txtIndexFind() {
199.226 - selectPageIndex();
199.227 - if (_txtIndexFind==null) {
199.228 - _txtIndexFind = new JTextFieldOperator( tbpHelpTabPane(), 0 );
199.229 - }
199.230 - return _txtIndexFind;
199.231 - }
199.232 -
199.233 - /** Tries to find JTree in Search tab of this dialog.
199.234 - * It throws TimeoutExpiredException when component not found
199.235 - * @return JTreeOperator
199.236 - */
199.237 - public JTreeOperator treeSearch() {
199.238 - selectPageSearch();
199.239 - if (_treeSearch==null) {
199.240 - _treeSearch = new JTreeOperator( tbpHelpTabPane(), 0 );
199.241 - }
199.242 - return _treeSearch;
199.243 - }
199.244 -
199.245 - /** Tries to find JTextField Find in Search tab of this dialog.
199.246 - * It throws TimeoutExpiredException when component not found
199.247 - * @return JTextFieldOperator
199.248 - */
199.249 - public JTextFieldOperator txtSearchFind() {
199.250 - selectPageSearch();
199.251 - if (_txtSearchFind==null) {
199.252 - _txtSearchFind = new JTextFieldOperator( tbpHelpTabPane(), 0 );
199.253 - }
199.254 - return _txtSearchFind;
199.255 - }
199.256 -
199.257 - /** Tries to find null BasicContentViewerUI$JHEditorPane in this dialog.
199.258 - * It throws TimeoutExpiredException when component not found
199.259 - * @return JEditorPaneOperator
199.260 - */
199.261 - public JEditorPaneOperator txtContentViewer() {
199.262 - if (_txtContentViewer==null) {
199.263 - _txtContentViewer = new JEditorPaneOperator( splpHelpSplitPane(), 0 );
199.264 - }
199.265 - return _txtContentViewer;
199.266 - }
199.267 -
199.268 - /** clicks on "Back" JButton
199.269 - * It throws TimeoutExpiredException when MetalSplitPaneDivider$1 not found
199.270 - */
199.271 - public void back() {
199.272 - btBack().push();
199.273 - }
199.274 -
199.275 - /** clicks on "Next" JButton
199.276 - * It throws TimeoutExpiredException when JButton not found
199.277 - */
199.278 - public void next() {
199.279 - btNext().push();
199.280 - }
199.281 -
199.282 - /** clicks on "Print" JButton
199.283 - * It throws TimeoutExpiredException when JButton not found
199.284 - */
199.285 - public void print() {
199.286 - btPrint().push();
199.287 - }
199.288 -
199.289 - /** clicks on "Page Setup" JButton
199.290 - * It throws TimeoutExpiredException when JButton not found
199.291 - */
199.292 - public void pageSetup() {
199.293 - btPageSetup().pushNoBlock();
199.294 - }
199.295 -
199.296 - /** selects page Contents */
199.297 - public void selectPageContents() {
199.298 - tbpHelpTabPane().selectPage(0);
199.299 - }
199.300 -
199.301 - /** selects page Index */
199.302 - public void selectPageIndex() {
199.303 - tbpHelpTabPane().selectPage(1);
199.304 - }
199.305 -
199.306 - /** selects page Search */
199.307 - public void selectPageSearch() {
199.308 - tbpHelpTabPane().selectPage(2);
199.309 - }
199.310 -
199.311 - /** tries to find and set text of txtIndexFind
199.312 - * @param text String text
199.313 - */
199.314 - public void indexFind( String text ) {
199.315 - txtIndexFind().enterText(text);
199.316 - }
199.317 -
199.318 - /** tries to find and set text of txtSearchFind
199.319 - * @param text String text
199.320 - */
199.321 - public void searchFind( String text ) {
199.322 - txtSearchFind().enterText(text);
199.323 - }
199.324 -
199.325 - /** returns help content in plain text form
199.326 - * @return String text of help
199.327 - */
199.328 - public String getContentText() {
199.329 - return txtContentViewer().getText();
199.330 - }
199.331 -
199.332 - /** Performs verification by accessing all sub-components */
199.333 - public void verify() {
199.334 - btBack();
199.335 - btNext();
199.336 - btPageSetup();
199.337 - btPrint();
199.338 - treeContents();
199.339 - txtContentViewer();
199.340 - treeIndex();
199.341 - txtIndexFind();
199.342 - treeSearch();
199.343 - txtSearchFind();
199.344 - }
199.345 -
199.346 - /** Implementation of ComponentChooser to choose component which
199.347 - * is instance of javax.help.JHelp*. */
199.348 - private static final ComponentChooser jHelpChooser = new ComponentChooser() {
199.349 - public boolean checkComponent(Component comp) {
199.350 - return comp.getClass().getName().startsWith("javax.help.JHelp");
199.351 - }
199.352 - public String getDescription() {
199.353 - return("any javax.help");
199.354 - }
199.355 - };
199.356 -
199.357 - /** Compare title of window with given pattern. */
199.358 - private static boolean compareTitle(WindowOperator oper, String expectedTitle) {
199.359 - String title;
199.360 - if(oper.getSource() instanceof Frame) {
199.361 - title = ((Frame)oper.getSource()).getTitle();
199.362 - } else {
199.363 - title = ((Dialog)oper.getSource()).getTitle();
199.364 - }
199.365 - return oper.getComparator().equals(title, expectedTitle);
199.366 - }
199.367 -
199.368 - /** SubChooser to determine Window which contains some
199.369 - * javax.help.JHelp* sub component.
199.370 - */
199.371 - private static final class HelpWindowChooser implements ComponentChooser {
199.372 -
199.373 - private String title;
199.374 -
199.375 - public HelpWindowChooser() {
199.376 - }
199.377 -
199.378 - public HelpWindowChooser(String title) {
199.379 - this.title = title;
199.380 - }
199.381 -
199.382 - public boolean checkComponent(Component comp) {
199.383 - WindowOperator winOper = new WindowOperator((Window)comp);
199.384 - winOper.setOutput(TestOut.getNullOutput());
199.385 - if(winOper.findSubComponent(jHelpChooser) != null) {
199.386 - if(title != null) {
199.387 - return compareTitle(winOper, title);
199.388 - } else {
199.389 - return true;
199.390 - }
199.391 - }
199.392 - return false;
199.393 - }
199.394 -
199.395 - public String getDescription() {
199.396 - return "containing any javax.help.JHelp component"+
199.397 - (title == null ? "" : " and with title '"+title+"'");
199.398 - }
199.399 - }
199.400 -
199.401 - /** SubChooser to find HelpButton in help window. */
199.402 - private static final ComponentChooser helpButtonChooser = new ComponentChooser() {
199.403 -
199.404 - public boolean checkComponent(Component comp) {
199.405 - return comp.getClass().getName().endsWith("HelpButton");
199.406 - }
199.407 -
199.408 - public String getDescription() {
199.409 - return "HelpButton";
199.410 - }
199.411 - };
199.412 -}
199.413 -
200.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/HttpTestCase.java Thu Jul 10 04:29:52 2008 -0700
200.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
200.3 @@ -1,156 +0,0 @@
200.4 -/*
200.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
200.6 -*
200.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
200.8 -*
200.9 -* The contents of this file are subject to the terms of either the GNU
200.10 -* General Public License Version 2 only ("GPL") or the Common
200.11 -* Development and Distribution License("CDDL") (collectively, the
200.12 -* "License"). You may not use this file except in compliance with the
200.13 -* License. You can obtain a copy of the License at
200.14 -* http://www.netbeans.org/cddl-gplv2.html
200.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
200.16 -* specific language governing permissions and limitations under the
200.17 -* License. When distributing the software, include this License Header
200.18 -* Notice in each file and include the License file at
200.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
200.20 -* particular file as subject to the "Classpath" exception as provided
200.21 -* by Sun in the GPL Version 2 section of the License file that
200.22 -* accompanied this code. If applicable, add the following below the
200.23 -* License Header, with the fields enclosed by brackets [] replaced by
200.24 -* your own identifying information:
200.25 -* "Portions Copyrighted [year] [name of copyright owner]"
200.26 -*
200.27 -* Contributor(s):
200.28 -*
200.29 -* The Original Software is NetBeans. The Initial Developer of the Original
200.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
200.31 -* Microsystems, Inc. All Rights Reserved.
200.32 -*
200.33 -* If you wish your version of this file to be governed by only the CDDL
200.34 -* or only the GPL Version 2, indicate your decision by adding
200.35 -* "[Contributor] elects to include this software in this distribution
200.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
200.37 -* single choice of license, a recipient has the option to distribute
200.38 -* your version of this file under either the CDDL, the GPL Version 2 or
200.39 -* to extend the choice of license to its licensees as provided above.
200.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
200.41 -* Version 2 license, then the option applies only if the new code is
200.42 -* made subject to such option by the copyright holder.
200.43 -*/
200.44 -
200.45 -package org.netbeans.modules.visualweb.gravy;
200.46 -
200.47 -import com.meterware.httpunit.*;
200.48 -import junit.framework.Test;
200.49 -import junit.framework.TestCase;
200.50 -import junit.framework.TestSuite;
200.51 -import java.io.File;
200.52 -import org.netbeans.junit.NbTestCase;
200.53 -
200.54 -/**
200.55 - * This class allows to check a real execution of deployed web-application
200.56 - * inside running automated test.
200.57 - */
200.58 -public class HttpTestCase extends NbTestCase implements Test {
200.59 - private WebConversation conversation;
200.60 - private WebRequest request;
200.61 - private WebResponse response;
200.62 - private long waitTime = 10000;
200.63 - private long waitDelta = 100;
200.64 - TestProperties props;
200.65 -
200.66 - /**
200.67 - * Creates a new instance of this class.
200.68 - * @param testName a name of new created test.
200.69 - */
200.70 - public HttpTestCase(String testName) {
200.71 - super(testName);
200.72 - conversation = new WebConversation();
200.73 - props = new TestProperties();
200.74 - }
200.75 -
200.76 - /**
200.77 - * Initializes an instance of class WebConversation, which will
200.78 - * check an execution of web-application.
200.79 - * @return the created instance of WebConversation
200.80 - */
200.81 - public WebConversation initConversation() {
200.82 - getLog().println("Creating WebConversation");
200.83 - conversation = new WebConversation();
200.84 - return(conversation);
200.85 - }
200.86 -
200.87 - /**
200.88 - * Returns an instance of initialized WebConversation.
200.89 - * @return the instance of WebConversation
200.90 - */
200.91 - public WebConversation getConversation() {
200.92 - return(conversation);
200.93 - }
200.94 -
200.95 - /**
200.96 - * Initializes an instance of http-request.
200.97 - * @param path an absolute URL to a deployed web-application
200.98 - * @return the instance of http-request
200.99 - */
200.100 - public WebRequest initRequest(String path) {
200.101 - getLog().println("Creating request for \"" + path + "\"");
200.102 - request = new GetMethodWebRequest(path);
200.103 - return(request);
200.104 - }
200.105 -
200.106 - /**
200.107 - * Returns an instance of initialized http-request.
200.108 - * @return the instance of http-request
200.109 - */
200.110 - public WebRequest getRequest() {
200.111 - return(request);
200.112 - }
200.113 -
200.114 - /**
200.115 - * Returns a http-response from web-server.
200.116 - * @return the instance of http-response
200.117 - */
200.118 - public WebResponse getResponse() throws Exception {
200.119 - getLog().println("Getting response for " + request);
200.120 - Exception exc = null;
200.121 - long startTime = System.currentTimeMillis();
200.122 - do {
200.123 - try {
200.124 - response = conversation.getResponse(request);
200.125 - } catch(Exception e) {
200.126 - exc = e;
200.127 - Thread.sleep(waitDelta);
200.128 - }
200.129 - } while(exc != null && (System.currentTimeMillis() - startTime) < waitTime);
200.130 - if(exc != null) {
200.131 - System.out.println("WebRequest.getResponse() did not succed in 1 minute");
200.132 - System.out.println("Ended up with exception:");
200.133 - exc.printStackTrace();
200.134 - throw(exc);
200.135 - }
200.136 - return(response);
200.137 - }
200.138 -
200.139 - /**
200.140 - * Returns the last received web-response or waits, until the first web-response
200.141 - * is received, and returns it.
200.142 - * @return the instance of WebResponse
200.143 - */
200.144 - public WebResponse lastResponse() throws Exception {
200.145 - if(response == null) {
200.146 - return(getResponse());
200.147 - } else {
200.148 - return(response);
200.149 - }
200.150 - }
200.151 -
200.152 - /**
200.153 - * Returns test properties (TestProperties object).
200.154 - * @return test properties
200.155 - */
200.156 - protected TestProperties getTestProperties() {
200.157 - return(props);
200.158 - }
200.159 -}
201.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/LineDiff.java Thu Jul 10 04:29:52 2008 -0700
201.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
201.3 @@ -1,213 +0,0 @@
201.4 -/*
201.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
201.6 -*
201.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
201.8 -*
201.9 -* The contents of this file are subject to the terms of either the GNU
201.10 -* General Public License Version 2 only ("GPL") or the Common
201.11 -* Development and Distribution License("CDDL") (collectively, the
201.12 -* "License"). You may not use this file except in compliance with the
201.13 -* License. You can obtain a copy of the License at
201.14 -* http://www.netbeans.org/cddl-gplv2.html
201.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
201.16 -* specific language governing permissions and limitations under the
201.17 -* License. When distributing the software, include this License Header
201.18 -* Notice in each file and include the License file at
201.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
201.20 -* particular file as subject to the "Classpath" exception as provided
201.21 -* by Sun in the GPL Version 2 section of the License file that
201.22 -* accompanied this code. If applicable, add the following below the
201.23 -* License Header, with the fields enclosed by brackets [] replaced by
201.24 -* your own identifying information:
201.25 -* "Portions Copyrighted [year] [name of copyright owner]"
201.26 -*
201.27 -* Contributor(s):
201.28 -*
201.29 -* The Original Software is NetBeans. The Initial Developer of the Original
201.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
201.31 -* Microsystems, Inc. All Rights Reserved.
201.32 -*
201.33 -* If you wish your version of this file to be governed by only the CDDL
201.34 -* or only the GPL Version 2, indicate your decision by adding
201.35 -* "[Contributor] elects to include this software in this distribution
201.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
201.37 -* single choice of license, a recipient has the option to distribute
201.38 -* your version of this file under either the CDDL, the GPL Version 2 or
201.39 -* to extend the choice of license to its licensees as provided above.
201.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
201.41 -* Version 2 license, then the option applies only if the new code is
201.42 -* made subject to such option by the copyright holder.
201.43 -*/
201.44 -
201.45 -package org.netbeans.modules.visualweb.gravy;
201.46 -
201.47 -import org.netbeans.junit.diff.Diff;
201.48 -import java.io.File;
201.49 -import java.io.FileOutputStream;
201.50 -import java.io.LineNumberReader;
201.51 -import java.io.FileReader;
201.52 -import java.io.FileWriter;
201.53 -import java.io.PrintStream;
201.54 -import java.io.PrintWriter;
201.55 -import java.util.ArrayList;
201.56 -
201.57 -/**
201.58 - * Compares 2 text files and finds lines, which are different.
201.59 - */
201.60 -public class LineDiff implements Diff {
201.61 - private static boolean ignoreCase;
201.62 -
201.63 - /** Creates a new instance of LineDiff */
201.64 - public LineDiff(boolean ignoreCase) {
201.65 - this.ignoreCase = ignoreCase;
201.66 - }
201.67 -
201.68 - /**
201.69 - * Returns true or false depending on mode of file comparison.
201.70 - * @return true, if file comparison is not case-sensitive, otherwise - false.
201.71 - */
201.72 - public static boolean getIgnoreCase() {
201.73 - return ignoreCase;
201.74 - }
201.75 -
201.76 - /**
201.77 - * @param l1 first line to compare
201.78 - * @param l2 second line to compare
201.79 - * @return true if lines equal
201.80 - */
201.81 - private boolean compareLines(String l1,String l2) {
201.82 - if (getIgnoreCase()) {
201.83 - if (l1.equalsIgnoreCase(l2))
201.84 - return true;
201.85 - } else {
201.86 - if (l1.equals(l2))
201.87 - return true;
201.88 - }
201.89 - return false;
201.90 - }
201.91 -
201.92 - /**
201.93 - * @param first first file to compare
201.94 - * @param second second file to compare
201.95 - * @param diff difference file, caller can pass null value, when results are not needed.
201.96 - * @return true iff files differ
201.97 - */
201.98 - public boolean diff(String first, String second, String diff) throws java.io.IOException {
201.99 - File fFirst = new File(first);
201.100 - File fSecond = new File(second);
201.101 - File fDiff = null != diff ? new File(diff) : null;
201.102 - return diff(fFirst, fSecond, fDiff);
201.103 - }
201.104 -
201.105 - /**
201.106 - * @param first first file to compare
201.107 - * @param second second file to compare
201.108 - * @param diff difference file, caller can pass null value, when results are not needed.
201.109 - * @return true iff files differ
201.110 - */
201.111 - public boolean diff(java.io.File firstFile, java.io.File secondFile, java.io.File diffFile) throws java.io.IOException {
201.112 - LineNumberReader first = new LineNumberReader(new FileReader(firstFile));
201.113 - LineNumberReader second = new LineNumberReader(new FileReader(secondFile));
201.114 - String firstLine;
201.115 - String secondLine;
201.116 -
201.117 - if (diffFile == null) {
201.118 - while ((firstLine = first.readLine()) != null) {
201.119 - secondLine = second.readLine();
201.120 - if (secondLine == null) {
201.121 - first.close();
201.122 - second.close();
201.123 - return true;
201.124 - }
201.125 - if (!compareLines(firstLine,secondLine)) {
201.126 - first.close();
201.127 - second.close();
201.128 - return true;
201.129 - }
201.130 - }
201.131 - } else {
201.132 - ArrayList a1,a2,newLines,missingLines;
201.133 -
201.134 - a1=new ArrayList();
201.135 - while ((firstLine = first.readLine()) != null) {
201.136 - a1.add(firstLine);
201.137 - }
201.138 - a2=new ArrayList();
201.139 - while ((secondLine = second.readLine()) != null) {
201.140 - a2.add(secondLine);
201.141 - }
201.142 - first.close();
201.143 - second.close();
201.144 - newLines=new ArrayList();
201.145 - missingLines=new ArrayList();
201.146 -
201.147 - int j=0,bj;
201.148 - boolean found;
201.149 -
201.150 - for (int i=0;i < a1.size();i++) {
201.151 - if (j >= a2.size()) {
201.152 - for (int k=i;k < a1.size();k++) {
201.153 - missingLines.add(k+"> "+a1.get(k));
201.154 - }
201.155 - break;
201.156 - }
201.157 - firstLine=(String)(a1.get(i));
201.158 - secondLine=(String)(a2.get(j));
201.159 - if (!compareLines(firstLine,secondLine)) {
201.160 - found=false;
201.161 - for (int k=j;k < a2.size();k++) {
201.162 - secondLine = (String)(a2.get(k));
201.163 - if (compareLines(firstLine,secondLine)) {
201.164 - for (int l=j;l < k;l++) {
201.165 - newLines.add(l+"> "+a2.get(l));
201.166 - }
201.167 - j=k;
201.168 - found=true;
201.169 - break;
201.170 - }
201.171 - }
201.172 - if (!found) {
201.173 - missingLines.add(i+"> "+firstLine);
201.174 - j--;
201.175 - }
201.176 - }
201.177 - j++;
201.178 - }
201.179 - if (j < a2.size()) {
201.180 - for (int i=j;i < a2.size();i++) {
201.181 - newLines.add(i+"> "+a2.get(i));
201.182 - }
201.183 - }
201.184 -
201.185 - if (missingLines.size() > 0 || newLines.size() > 0) {
201.186 - PrintStream pw=null;
201.187 - pw=new PrintStream(new FileOutputStream(diffFile));
201.188 - //pw=System.out;
201.189 - if (missingLines.size() > 0) {
201.190 - pw.println("-----------------------------Missing Lines:-----");
201.191 - for (int i=0;i < missingLines.size();i++) {
201.192 - pw.println(missingLines.get(i));
201.193 - }
201.194 - }
201.195 - if (newLines.size() > 0) {
201.196 - pw.println("-----------------------------New Lines:---------");
201.197 - for (int i=0;i < newLines.size();i++) {
201.198 - pw.println(newLines.get(i));
201.199 - }
201.200 - }
201.201 - pw.close();
201.202 - return true;
201.203 - }
201.204 - }
201.205 - return false;
201.206 - }
201.207 -
201.208 - public static void main(String[] argv) {
201.209 - try {
201.210 - LineDiff diff=new LineDiff(true);
201.211 - diff.diff("/tmp/diff/test.pass","/tmp/diff/test.ref","/tmp/diff/test.diff");
201.212 - } catch (Exception ex) {
201.213 - ex.printStackTrace();
201.214 - }
201.215 - }
201.216 -}
202.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/MainWindowOperator.java Thu Jul 10 04:29:52 2008 -0700
202.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
202.3 @@ -1,531 +0,0 @@
202.4 -/*
202.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
202.6 - *
202.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
202.8 - *
202.9 - * The contents of this file are subject to the terms of either the GNU
202.10 - * General Public License Version 2 only ("GPL") or the Common
202.11 - * Development and Distribution License("CDDL") (collectively, the
202.12 - * "License"). You may not use this file except in compliance with the
202.13 - * License. You can obtain a copy of the License at
202.14 - * http://www.netbeans.org/cddl-gplv2.html
202.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
202.16 - * specific language governing permissions and limitations under the
202.17 - * License. When distributing the software, include this License Header
202.18 - * Notice in each file and include the License file at
202.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
202.20 - * particular file as subject to the "Classpath" exception as provided
202.21 - * by Sun in the GPL Version 2 section of the License file that
202.22 - * accompanied this code. If applicable, add the following below the
202.23 - * License Header, with the fields enclosed by brackets [] replaced by
202.24 - * your own identifying information:
202.25 - * "Portions Copyrighted [year] [name of copyright owner]"
202.26 - *
202.27 - * Contributor(s):
202.28 - *
202.29 - * The Original Software is NetBeans. The Initial Developer of the Original
202.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
202.31 - * Microsystems, Inc. All Rights Reserved.
202.32 - *
202.33 - * If you wish your version of this file to be governed by only the CDDL
202.34 - * or only the GPL Version 2, indicate your decision by adding
202.35 - * "[Contributor] elects to include this software in this distribution
202.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
202.37 - * single choice of license, a recipient has the option to distribute
202.38 - * your version of this file under either the CDDL, the GPL Version 2 or
202.39 - * to extend the choice of license to its licensees as provided above.
202.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
202.41 - * Version 2 license, then the option applies only if the new code is
202.42 - * made subject to such option by the copyright holder.
202.43 - */
202.44 -
202.45 -package org.netbeans.modules.visualweb.gravy;
202.46 -
202.47 -import java.awt.Component;
202.48 -import java.awt.Container;
202.49 -import java.io.PrintStream;
202.50 -import java.util.ArrayList;
202.51 -
202.52 -import javax.swing.*;
202.53 -import javax.swing.event.ChangeListener;
202.54 -import javax.swing.event.ChangeEvent;
202.55 -
202.56 -import org.netbeans.jemmy.ComponentChooser;
202.57 -import org.netbeans.jemmy.JemmyProperties;
202.58 -import org.netbeans.jemmy.JemmyException;
202.59 -import org.netbeans.jemmy.Waitable;
202.60 -import org.netbeans.jemmy.Waiter;
202.61 -
202.62 -import org.netbeans.jemmy.operators.ContainerOperator;
202.63 -import org.netbeans.jemmy.operators.ComponentOperator;
202.64 -import org.netbeans.jemmy.operators.DialogOperator;
202.65 -import org.netbeans.jemmy.operators.JButtonOperator;
202.66 -import org.netbeans.jemmy.operators.JComponentOperator.JComponentByTipFinder;
202.67 -import org.netbeans.jemmy.operators.JFrameOperator;
202.68 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
202.69 -import org.openide.awt.Toolbar;
202.70 -
202.71 -import org.openide.awt.StatusDisplayer;
202.72 -
202.73 -/**
202.74 - *
202.75 - * @author shura
202.76 - */
202.77 -public class MainWindowOperator extends JFrameOperator {
202.78 -
202.79 - JButtonOperator deployButton;
202.80 -
202.81 - /** Creates a new instance of MainWindowOperator */
202.82 - public MainWindowOperator() {
202.83 - super((JFrame) RaveWindowOperator.getDefaultRave().getSource());
202.84 - copyEnvironment(RaveWindowOperator.getDefaultRave());
202.85 - }
202.86 -
202.87 - /** Pushes Save All Button in Main Toolbar
202.88 - */
202.89 - public void saveAll() {
202.90 - new JButtonOperator(this, new JComponentByTipFinder("Save All")).push();
202.91 - }
202.92 -
202.93 - /** Pushes Deploy button from Main Toolbar and waits some timeout
202.94 - */
202.95 - public DeploymentDialogOperator deploy() {
202.96 - btDeploy().push();
202.97 - DeploymentDialogOperator dlg = null;
202.98 - long oldWaitTime = Util.getMainWindow().getTimeouts().getTimeout("DialogWaiter.WaitDialogTimeout");
202.99 - try {
202.100 - Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", 100000);
202.101 - dlg = new DeploymentDialogOperator();
202.102 - } catch(Exception e) {
202.103 - e.printStackTrace();
202.104 - Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", oldWaitTime);
202.105 - }
202.106 - return(dlg);
202.107 - }
202.108 -
202.109 - /** Deploy project and waits until deployment completed */
202.110 - public void deployProject() {
202.111 - DeploymentDialogOperator dlg=deploy();
202.112 - dlg.setAutoHide(false);
202.113 - dlg.waitCompleted();
202.114 - Util.wait(1000);
202.115 - dlg.close();
202.116 - }
202.117 -
202.118 - /** Pushes deploy button from Main Toolbar
202.119 - */
202.120 - public JButtonOperator btDeploy() {
202.121 - if(deployButton == null) {
202.122 - deployButton = new JButtonOperator(this, new JComponentByTipFinder(
202.123 - Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle",
202.124 - "LBL_RunMainProjectAction_Name")));
202.125 - deployButton.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
202.126 - }
202.127 - return(deployButton);
202.128 - }
202.129 - private static StatusTextTracer statusTextTracer = null;
202.130 -
202.131 - /** Returns text from status bar.
202.132 - * @return currently displayed text
202.133 - */
202.134 - public String getStatusText() {
202.135 - return org.openide.awt.StatusDisplayer.getDefault().getStatusText();
202.136 - }
202.137 -
202.138 -
202.139 - /** Sets given text to main window's status bar.
202.140 - * @param newStatusText string to be displayed in status bar
202.141 - */
202.142 - public void setStatusText(String newStatusText) {
202.143 - org.openide.awt.StatusDisplayer.getDefault().setStatusText(newStatusText);
202.144 - }
202.145 -
202.146 - /** Returns singleton instance of StatusTextTracer.
202.147 - * @return singleton instance of StatusTextTracer
202.148 - */
202.149 - public synchronized StatusTextTracer getStatusTextTracer() {
202.150 - if(statusTextTracer == null) {
202.151 - statusTextTracer = new StatusTextTracer();
202.152 - }
202.153 - return statusTextTracer;
202.154 - }
202.155 -
202.156 - /** Waits until given text appears in the main window status bar.
202.157 - * If you want to trace status messages during an operation is proceed,
202.158 - * use {@link StatusTextTracer}.
202.159 - * @param text a text to wait for
202.160 - */
202.161 - public void waitStatusText(final String text) {
202.162 - getStatusTextTracer().start();
202.163 - try {
202.164 - // not wait in case status text was already printed out
202.165 - if(!getComparator().equals(getStatusText(), text)) {
202.166 - getStatusTextTracer().waitText(text);
202.167 - }
202.168 - } finally {
202.169 - getStatusTextTracer().stop();
202.170 - }
202.171 - }
202.172 -
202.173 -
202.174 - /** Class to trace messages printed to status bar of the Main Window.
202.175 - * <p>
202.176 - * Usage:<br>
202.177 - * <pre>
202.178 - * MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer();
202.179 - * // start tracing
202.180 - * stt.start();
202.181 - * // compile action will produce at least two messages: "Compiling ...",
202.182 - * // "Finished ..."
202.183 - * new CompileAction().performAPI();
202.184 - *
202.185 - * // waits for "Compiling" status text
202.186 - * stt.waitText("Compiling");
202.187 - * // waits for "Finished" status text
202.188 - * stt.waitText("Finished");
202.189 - *
202.190 - * // order is not significant => following works as well
202.191 - * stt.waitText("Finished");
202.192 - * stt.waitText("Compiling");
202.193 - *
202.194 - * // to be order significant, set removedCompared parameter to true
202.195 - * stt.waitText("Compiling", true);
202.196 - * stt.waitText("Finished", true);
202.197 - *
202.198 - * // history was removed by above methods => need to produce a new messages
202.199 - * new CompileAction().performAPI();
202.200 - *
202.201 - * // order is significant if removedCompared parameter is true =>
202.202 - * // => following fails because Finished is shown as second
202.203 - * stt.waitText("Finished", true);
202.204 - * stt.waitText("Compiling", true);
202.205 - *
202.206 - * // stop tracing
202.207 - * stt.stop();
202.208 - * </pre>
202.209 - */
202.210 - public class StatusTextTracer implements ChangeListener {
202.211 - /** List of all messages */
202.212 - private ArrayList statusTextHistory;
202.213 -
202.214 - /** Creates new instance. */
202.215 - public StatusTextTracer() {
202.216 - this.statusTextHistory = new ArrayList();
202.217 - }
202.218 -
202.219 - /** Starts to register all status messages into history array.
202.220 - * Exactly, it adds the listener to org.openide.awt.StatusDisplayer.
202.221 - * It clears possible previously filled history array before.
202.222 - */
202.223 - public void start() {
202.224 - stop();
202.225 - clear();
202.226 - StatusDisplayer.getDefault().addChangeListener(this);
202.227 - }
202.228 -
202.229 - /** Stops registering of status messages. Exactly, it removes the
202.230 - * listener from org.openide.awt.StatusDisplayer.
202.231 - */
202.232 - public void stop() {
202.233 - StatusDisplayer.getDefault().removeChangeListener(this);
202.234 - }
202.235 -
202.236 - /** Called when status text was changed. It adds status text to history
202.237 - * array.
202.238 - * @param evt change event - not used
202.239 - */
202.240 - public void stateChanged(ChangeEvent evt) {
202.241 - synchronized (this) {
202.242 - statusTextHistory.add(StatusDisplayer.getDefault().getStatusText());
202.243 - // print message to jemmy output stream
202.244 - JemmyProperties.getCurrentOutput().printTrace("Status text changed to: \""+
202.245 - StatusDisplayer.getDefault().getStatusText()+"\"");
202.246 - }
202.247 - }
202.248 -
202.249 - /** Clears status text history array. */
202.250 - public void clear() {
202.251 - synchronized (this) {
202.252 - statusTextHistory.clear();
202.253 - }
202.254 - }
202.255 -
202.256 - /** Checks whether given text equals to any of messages in the history
202.257 - * array. Comparator of this MainWindowOperator instance is used.
202.258 - * If <tt>removeCompared</tt> parameter is set to <tt>true</tt>,
202.259 - * messages already compared are removed from history array. Otherwise
202.260 - * messages are not removed until {@link #clear} or {@link #start} are
202.261 - * called.
202.262 - * @param text a text to be compared
202.263 - * @param removeCompared whether to remove already compared messages from
202.264 - * history array
202.265 - * @return true if text matches any of messages in the history array;
202.266 - * false otherwise
202.267 - */
202.268 - public boolean contains(String text, boolean removeCompared) {
202.269 - StringComparator comparator = getComparator();
202.270 - synchronized (this) {
202.271 - if(removeCompared) {
202.272 - while(!statusTextHistory.isEmpty()) {
202.273 - String status = (String)statusTextHistory.remove(0);
202.274 - if(comparator.equals(status, text)) {
202.275 - return true;
202.276 - }
202.277 - }
202.278 - } else {
202.279 - for (int i = 0; i < statusTextHistory.size(); i ++) {
202.280 - if(comparator.equals((String)statusTextHistory.get(i), text)) {
202.281 - return true;
202.282 - }
202.283 - }
202.284 - }
202.285 - return false;
202.286 - }
202.287 - }
202.288 -
202.289 - /** Waits for text to be shown in the Main Window status bar not
202.290 - * removing any message from history.
202.291 - * Comparator of this MainWindowOperator instance is used.
202.292 - * It throws TimeoutExpiredException if timeout expires.
202.293 - * @param text a text to wait for
202.294 - */
202.295 - public void waitText(final String text) {
202.296 - waitText(text, false);
202.297 - }
202.298 -
202.299 - /** Waits for text to be shown in the Main Window status bar.
202.300 - * Comparator of this MainWindowOperator instance is used.
202.301 - * If <tt>removeCompared</tt> parameter is set to <tt>true</tt>,
202.302 - * messages already compared are removed from history array. It satisfies
202.303 - * that order of messages is significant when this method is called
202.304 - * more than once.
202.305 - * If <tt>removeCompared</tt> parameter is set to <tt>false</tt>,
202.306 - * messages are not removed until {@link #clear} or {@link #start} are
202.307 - * called and its order is not taken into account.
202.308 - * @param text a text to wait for
202.309 - * @param removeCompared whether to remove already compared messages from
202.310 - * history array
202.311 - */
202.312 - public void waitText(final String text, final boolean removeCompared) {
202.313 - try {
202.314 - new Waiter(new Waitable() {
202.315 - public Object actionProduced(Object anObject) {
202.316 - return contains(text, removeCompared) ? Boolean.TRUE : null;
202.317 - }
202.318 - public String getDescription() {
202.319 - return("Wait status text equals to "+text);
202.320 - }
202.321 - }).waitAction(null);
202.322 - } catch (InterruptedException e) {
202.323 - throw new JemmyException("Interrupted.", e);
202.324 - }
202.325 - }
202.326 -
202.327 - /** Calls {@link #stop} at the end of life cycle of this class. */
202.328 - public void finalize() {
202.329 - stop();
202.330 - }
202.331 -
202.332 - /** Returns list of elements collected from the moment method
202.333 - * {@link #start} was called. Remember, if <tt>removeCompared</tt>
202.334 - * parameter is set to <tt>true</tt> in some of methods,
202.335 - * messages already compared are removed from history array.
202.336 - * @return ArrayList of elements representing status text messages
202.337 - */
202.338 - public ArrayList getStatusTextHistory() {
202.339 - return statusTextHistory;
202.340 - }
202.341 -
202.342 - /** Prints list of elements collected from the moment method
202.343 - * {@link #start} was called. Remember, if <tt>removeCompared</tt>
202.344 - * parameter is set to <tt>true</tt> in some of methods,
202.345 - * messages already compared are removed from history array.
202.346 - * @param outputPrintStream stream to print output in
202.347 - */
202.348 - public void printStatusTextHistory(PrintStream outputPrintStream) {
202.349 - for (int i = 0; i < statusTextHistory.size(); i ++) {
202.350 - outputPrintStream.println(statusTextHistory.get(i).toString());
202.351 - }
202.352 - }
202.353 - }
202.354 -
202.355 -
202.356 - /***************** methods for toolbars manipulation *******************/
202.357 -
202.358 - /** Returns ContainerOperator representing index-th floating toolbar in
202.359 - * IDE main window. Toolbars are NOT indexed from left to right.
202.360 - * @param index index of toolbar to find
202.361 - * @return ContainerOperator instance representing a toolbar
202.362 - */
202.363 - public ContainerOperator getToolbar(int index) {
202.364 - ComponentChooser chooser = new ToolbarChooser();
202.365 - return new ContainerOperator((Container)waitComponent((Container)getSource(),
202.366 - chooser, index));
202.367 - }
202.368 -
202.369 - /** Returns ContainerOperator representing floating toolbar with given name.
202.370 - * @param toolbarName toolbar's display name. It is shown in its tooltip.
202.371 - * @return ContainerOperator instance representing a toolbar
202.372 - */
202.373 - public ContainerOperator getToolbar(String toolbarName) {
202.374 - ComponentChooser chooser = new ToolbarChooser(toolbarName, getComparator());
202.375 - return new ContainerOperator((Container)waitComponent((Container)getSource(), chooser));
202.376 - }
202.377 -
202.378 - /** Returns number of toolbars currently shown in IDE.
202.379 - * @return number of toolbars
202.380 - */
202.381 - public int getToolbarCount() {
202.382 - ToolbarChooser chooser = new ToolbarChooser("Non sense name - @#$%^&*", //NOI18N
202.383 - getComparator());
202.384 - findComponent((Container)getSource(), chooser);
202.385 - return chooser.getCount();
202.386 - }
202.387 -
202.388 - /** Returns display name of toolbar with given index. Toolbars are NOT
202.389 - * indexed from left to right.
202.390 - * @param index index of toolbar
202.391 - * @return display name of toolbar
202.392 - */
202.393 - public String getToolbarName(int index) {
202.394 - return ((Toolbar)getToolbar(index).getSource()).getDisplayName();
202.395 - }
202.396 -
202.397 - /** Return JButtonOperator representing a toolbar button found by given
202.398 - * tooltip within given toolbar operator.
202.399 - * @param toolbarOper ContainerOperator of a toolbar.
202.400 - * Use {@link #getToolbar(String)} or {@link #getToolbar(int)}
202.401 - * to obtain an operator.
202.402 - * @param buttonTooltip tooltip of toolbar button
202.403 - * @return JButtonOperator instance of found toolbar button
202.404 - */
202.405 - public JButtonOperator getToolbarButton(ContainerOperator toolbarOper, String buttonTooltip) {
202.406 - ToolbarButtonChooser chooser = new ToolbarButtonChooser(buttonTooltip, getComparator());
202.407 - return new JButtonOperator(JButtonOperator.waitJButton(
202.408 - (Container)toolbarOper.getSource(), chooser));
202.409 - }
202.410 -
202.411 - /** Return JButtonOperator representing index-th toolbar button within given
202.412 - * toolbar operator.
202.413 - * @param toolbarOper ContainerOperator of a toolbar.
202.414 - * Use {@link #getToolbar(String)} or {@link #getToolbar(int)}
202.415 - * to obtain an operator.
202.416 - * @param index index of toolbar button to find
202.417 - * @return JButtonOperator instance of found toolbar button
202.418 - */
202.419 - public JButtonOperator getToolbarButton(ContainerOperator toolbarOper, int index) {
202.420 - return new JButtonOperator(toolbarOper, index);
202.421 - }
202.422 -
202.423 - /** Pushes popup menu on toolbars. It doesn't matter on which toolbar it is
202.424 - * invoked, everytime it is the same. That's why popup menu is invoked on
202.425 - * the right side of toolbar with index 0.
202.426 - * @param popupPath path to menu item (e.g. "Edit")
202.427 - */
202.428 - public void pushToolbarPopupMenu(String popupPath) {
202.429 - ContainerOperator contOper = getToolbar(0);
202.430 - contOper.clickForPopup(contOper.getWidth()-1, contOper.getHeight()/2);
202.431 - new JPopupMenuOperator().pushMenu(popupPath, "|");
202.432 - }
202.433 -
202.434 - /** Pushes popup menu on toolbars - no block further execution.
202.435 - * It doesn't matter on which toolbar it is
202.436 - * invoked, everytime it is the same. That's why popup menu is invoked on
202.437 - * the right side of toolbar with index 0.
202.438 - * @param popupPath path to menu item (e.g. "Save Configuration...")
202.439 - */
202.440 - public void pushToolbarPopupMenuNoBlock(String popupPath) {
202.441 - ContainerOperator contOper = getToolbar(0);
202.442 - contOper.clickForPopup(contOper.getWidth()-1, contOper.getHeight()/2);
202.443 - new JPopupMenuOperator().pushMenuNoBlock(popupPath, "|");
202.444 - }
202.445 -
202.446 - /** Drags a toolbar to a new position determined by [x, y] relatively.
202.447 - * @param toolbarOper ContainerOperator of a toolbar.
202.448 - * Use {@link #getToolbar(String)} or {@link #getToolbar(int)}
202.449 - * to obtain an operator.
202.450 - * @param x relative move along x direction
202.451 - * @param y relative move along y direction
202.452 - */
202.453 - public void dragNDropToolbar(ContainerOperator toolbarOper, int x, int y) {
202.454 - ComponentChooser chooser = new ComponentChooser() {
202.455 - public boolean checkComponent(Component comp) {
202.456 - if(comp instanceof JPanel) {
202.457 - String className = comp.getClass().getName();
202.458 - return className.equals("org.openide.awt.Toolbar$ToolbarBump") ||
202.459 - // used in Windows L&F
202.460 - className.equals("org.openide.awt.Toolbar$ToolbarGrip");
202.461 - }
202.462 - return false;
202.463 - }
202.464 - public String getDescription() {
202.465 - return "org.openide.awt.Toolbar$ToolbarBump or org.openide.awt.Toolbar$ToolbarGrip";
202.466 - }
202.467 - };
202.468 - Component comp = findComponent((Container)toolbarOper.getSource(), chooser);
202.469 - new ComponentOperator(comp).dragNDrop(comp.getWidth()/2, comp.getHeight()/2, x, y);
202.470 - }
202.471 -
202.472 -
202.473 - /** Chooser which can be used to find a org.openide.awt.Toolbar component or
202.474 - * count a number of such components in given container.
202.475 - */
202.476 - private static class ToolbarChooser implements ComponentChooser {
202.477 - private String toolbarName;
202.478 - private StringComparator comparator;
202.479 - private int count = 0;
202.480 -
202.481 - /** Use this to find org.openide.awt.Toolbar component with given name. */
202.482 - public ToolbarChooser(String toolbarName, StringComparator comparator) {
202.483 - this.toolbarName = toolbarName;
202.484 - this.comparator = comparator;
202.485 - }
202.486 -
202.487 - /** Use this to count org.openide.awt.Toolbar components in given container. */
202.488 - public ToolbarChooser() {
202.489 - this.comparator = null;
202.490 - }
202.491 -
202.492 - public boolean checkComponent(Component comp) {
202.493 - if(comp instanceof org.openide.awt.Toolbar) {
202.494 - count++;
202.495 - if(comparator != null) {
202.496 - return comparator.equals(((Toolbar)comp).getDisplayName(), toolbarName);
202.497 - } else {
202.498 - return true;
202.499 - }
202.500 - }
202.501 - return false;
202.502 - }
202.503 -
202.504 - public String getDescription() {
202.505 - return "org.openide.awt.Toolbar";
202.506 - }
202.507 -
202.508 - public int getCount() {
202.509 - return count;
202.510 - }
202.511 - }
202.512 -
202.513 - /** Chooser which can be used to find a component with given tooltip,
202.514 - * for example a toolbar button.
202.515 - */
202.516 - private static class ToolbarButtonChooser implements ComponentChooser {
202.517 - private String buttonTooltip;
202.518 - private StringComparator comparator;
202.519 -
202.520 - public ToolbarButtonChooser(String buttonTooltip, StringComparator comparator) {
202.521 - this.buttonTooltip = buttonTooltip;
202.522 - this.comparator = comparator;
202.523 - }
202.524 -
202.525 - public boolean checkComponent(Component comp) {
202.526 - return comparator.equals(((JComponent)comp).getToolTipText(), buttonTooltip);
202.527 - }
202.528 -
202.529 - public String getDescription() {
202.530 - return "Toolbar button with tooltip \""+buttonTooltip+"\".";
202.531 - }
202.532 - }
202.533 -
202.534 -}
203.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/NbDialogOperator.java Thu Jul 10 04:29:52 2008 -0700
203.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
203.3 @@ -1,172 +0,0 @@
203.4 -/*
203.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
203.6 - *
203.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
203.8 - *
203.9 - * The contents of this file are subject to the terms of either the GNU
203.10 - * General Public License Version 2 only ("GPL") or the Common
203.11 - * Development and Distribution License("CDDL") (collectively, the
203.12 - * "License"). You may not use this file except in compliance with the
203.13 - * License. You can obtain a copy of the License at
203.14 - * http://www.netbeans.org/cddl-gplv2.html
203.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
203.16 - * specific language governing permissions and limitations under the
203.17 - * License. When distributing the software, include this License Header
203.18 - * Notice in each file and include the License file at
203.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
203.20 - * particular file as subject to the "Classpath" exception as provided
203.21 - * by Sun in the GPL Version 2 section of the License file that
203.22 - * accompanied this code. If applicable, add the following below the
203.23 - * License Header, with the fields enclosed by brackets [] replaced by
203.24 - * your own identifying information:
203.25 - * "Portions Copyrighted [year] [name of copyright owner]"
203.26 - *
203.27 - * Contributor(s):
203.28 - *
203.29 - * The Original Software is NetBeans. The Initial Developer of the Original
203.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
203.31 - * Microsystems, Inc. All Rights Reserved.
203.32 - *
203.33 - * If you wish your version of this file to be governed by only the CDDL
203.34 - * or only the GPL Version 2, indicate your decision by adding
203.35 - * "[Contributor] elects to include this software in this distribution
203.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
203.37 - * single choice of license, a recipient has the option to distribute
203.38 - * your version of this file under either the CDDL, the GPL Version 2 or
203.39 - * to extend the choice of license to its licensees as provided above.
203.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
203.41 - * Version 2 license, then the option applies only if the new code is
203.42 - * made subject to such option by the copyright holder.
203.43 - */
203.44 -
203.45 -package org.netbeans.modules.visualweb.gravy;
203.46 -
203.47 -import javax.swing.JDialog;
203.48 -import org.netbeans.jemmy.operators.JButtonOperator;
203.49 -import org.netbeans.jemmy.operators.JDialogOperator;
203.50 -
203.51 -/**
203.52 - * Handle generic NetBeans dialog. The dialog can include Yes, No, OK,
203.53 - * Cancel, Close or Help buttons. The dialog is identified by its title.
203.54 - */
203.55 -public class NbDialogOperator extends JDialogOperator {
203.56 -
203.57 - private JButtonOperator _btYes;
203.58 - private JButtonOperator _btNo;
203.59 - private JButtonOperator _btOK;
203.60 - private JButtonOperator _btCancel;
203.61 - private JButtonOperator _btClose;
203.62 - private JButtonOperator _btHelp;
203.63 - /** Waits until dialog with requested title is found. Title is compared
203.64 - * on partial match and case non-sensitive. If dialog is not found, runtime
203.65 - * exception is thrown.
203.66 - * @param title title of window
203.67 - */
203.68 - public NbDialogOperator(String title) {
203.69 - super(title);
203.70 - }
203.71 -
203.72 - /** Created NbDialogOperator with given dialog
203.73 - * @param dialog JDialog instance */
203.74 - public NbDialogOperator(JDialog dialog) {
203.75 - super(dialog);
203.76 - }
203.77 -
203.78 - /** Returns operator of "Yes" button.
203.79 - * @return JButtonOperator instance of "Yes" button
203.80 - */
203.81 - public JButtonOperator btYes() {
203.82 - if (_btYes == null) {
203.83 - String yesCaption = Bundle.getString("org.netbeans.core.Bundle", "YES_OPTION_CAPTION");
203.84 - _btYes = new JButtonOperator(this, yesCaption);
203.85 - }
203.86 - return _btYes;
203.87 - }
203.88 -
203.89 - /** Returns operator of "No" button.
203.90 - * @return JButtonOperator instance of "No" button
203.91 - */
203.92 - public JButtonOperator btNo() {
203.93 - if (_btNo == null) {
203.94 - String noCaption = Bundle.getString("org.netbeans.core.Bundle", "NO_OPTION_CAPTION");
203.95 - _btNo = new JButtonOperator(this, noCaption);
203.96 - }
203.97 - return _btNo;
203.98 - }
203.99 -
203.100 - /** Returns operator of "OK" button.
203.101 - * @return JButtonOperator instance of "OK" button
203.102 - */
203.103 - public JButtonOperator btOK() {
203.104 - if (_btOK == null) {
203.105 - String oKCaption = Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION");
203.106 - _btOK = new JButtonOperator(this, oKCaption);
203.107 - }
203.108 - return _btOK;
203.109 - }
203.110 -
203.111 - /** Returns operator of "Cancel" button.
203.112 - * @return JButtonOperator instance of "Cancel" button
203.113 - */
203.114 - public JButtonOperator btCancel() {
203.115 - if (_btCancel == null) {
203.116 - String cancelCaption = Bundle.getString("org.netbeans.core.Bundle", "CANCEL_OPTION_CAPTION");
203.117 - _btCancel = new JButtonOperator(this, cancelCaption);
203.118 - }
203.119 - return _btCancel;
203.120 - }
203.121 -
203.122 - /** Returns operator of "Close" button.
203.123 - * @return JButtonOperator instance of "Close" button
203.124 - */
203.125 - public JButtonOperator btClose() {
203.126 - if (_btClose == null) {
203.127 - String closeCaption = Bundle.getString("org.netbeans.core.Bundle", "CLOSED_OPTION_CAPTION");
203.128 - _btClose = new JButtonOperator(this, closeCaption);
203.129 - }
203.130 - return _btClose;
203.131 - }
203.132 -
203.133 - /** Returns operator of "Help" button.
203.134 - * @return JButtonOperator instance of "Help" button
203.135 - */
203.136 - public JButtonOperator btHelp() {
203.137 - if (_btHelp == null) {
203.138 - String helpCaption = Bundle.getString("org.netbeans.core.Bundle", "HELP_OPTION_CAPTION");
203.139 - _btHelp = new JButtonOperator(this, helpCaption);
203.140 - }
203.141 - return _btHelp;
203.142 - }
203.143 -
203.144 - /** Pushes "Yes" button. */
203.145 - public void yes() {
203.146 - btYes().push();
203.147 - }
203.148 -
203.149 - /** Pushes "No" button. */
203.150 - public void no() {
203.151 - btNo().push();
203.152 - }
203.153 -
203.154 - /** Pushes "OK" button. */
203.155 - public void ok() {
203.156 - btOK().push();
203.157 - }
203.158 -
203.159 - /** Pushes "Cancel" button. */
203.160 - public void cancel() {
203.161 - btCancel().push();
203.162 - }
203.163 -
203.164 - /** Pushes "Close" button. Using {@link JDialogOperator#close() close()}
203.165 - * will close dialog default way like on demand of a window manager.
203.166 - */
203.167 - public void closeByButton() {
203.168 - btClose().push();
203.169 - }
203.170 -
203.171 - /** Pushes "Help" button. */
203.172 - public void help() {
203.173 - btHelp().push();
203.174 - }
203.175 -}
204.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/OptionsOperator.java Thu Jul 10 04:29:52 2008 -0700
204.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
204.3 @@ -1,434 +0,0 @@
204.4 -/*
204.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
204.6 - *
204.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
204.8 - *
204.9 - * The contents of this file are subject to the terms of either the GNU
204.10 - * General Public License Version 2 only ("GPL") or the Common
204.11 - * Development and Distribution License("CDDL") (collectively, the
204.12 - * "License"). You may not use this file except in compliance with the
204.13 - * License. You can obtain a copy of the License at
204.14 - * http://www.netbeans.org/cddl-gplv2.html
204.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
204.16 - * specific language governing permissions and limitations under the
204.17 - * License. When distributing the software, include this License Header
204.18 - * Notice in each file and include the License file at
204.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
204.20 - * particular file as subject to the "Classpath" exception as provided
204.21 - * by Sun in the GPL Version 2 section of the License file that
204.22 - * accompanied this code. If applicable, add the following below the
204.23 - * License Header, with the fields enclosed by brackets [] replaced by
204.24 - * your own identifying information:
204.25 - * "Portions Copyrighted [year] [name of copyright owner]"
204.26 - *
204.27 - * Contributor(s):
204.28 - *
204.29 - * The Original Software is NetBeans. The Initial Developer of the Original
204.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
204.31 - * Microsystems, Inc. All Rights Reserved.
204.32 - *
204.33 - * If you wish your version of this file to be governed by only the CDDL
204.34 - * or only the GPL Version 2, indicate your decision by adding
204.35 - * "[Contributor] elects to include this software in this distribution
204.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
204.37 - * single choice of license, a recipient has the option to distribute
204.38 - * your version of this file under either the CDDL, the GPL Version 2 or
204.39 - * to extend the choice of license to its licensees as provided above.
204.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
204.41 - * Version 2 license, then the option applies only if the new code is
204.42 - * made subject to such option by the copyright holder.
204.43 - */
204.44 -
204.45 -package org.netbeans.modules.visualweb.gravy;
204.46 -
204.47 -import java.awt.Rectangle;
204.48 -import java.lang.reflect.InvocationTargetException;
204.49 -import javax.swing.table.JTableHeader;
204.50 -import javax.swing.tree.TreePath;
204.51 -import org.netbeans.modules.visualweb.gravy.Util;
204.52 -import org.netbeans.jemmy.EventTool;
204.53 -import org.netbeans.jemmy.JemmyException;
204.54 -import org.netbeans.jemmy.Timeouts;
204.55 -import org.netbeans.jemmy.operators.ComponentOperator;
204.56 -import org.netbeans.jemmy.operators.JButtonOperator;
204.57 -import org.netbeans.jemmy.operators.JComboBoxOperator;
204.58 -import org.netbeans.jemmy.operators.Operator;
204.59 -import org.netbeans.jemmy.operators.JRadioButtonOperator;
204.60 -
204.61 -/**
204.62 - * Provides access to the Options window and it's subcomponents.
204.63 - * Use PropertySheet class to access properties.
204.64 - * treeTable() method returns TreeTable operator for
204.65 - * options list accessing.
204.66 - */
204.67 -public class OptionsOperator extends NbDialogOperator {
204.68 -
204.69 - /**
204.70 - * Constant used for indication of project property definition level
204.71 - * (first column after ">>").
204.72 - */
204.73 - public static final int PROJECT_LEVEL = 2;
204.74 -
204.75 - /**
204.76 - * Constant used for indication of user property definition level
204.77 - * (second column after ">>").
204.78 - */
204.79 - public static final int USER_LEVEL = 3;
204.80 -
204.81 - /**
204.82 - * Constant used for indication of default property definition level
204.83 - * (third column after ">>").
204.84 - */
204.85 - public static final int DEFAULT_LEVEL = 4;
204.86 -
204.87 -
204.88 - private static final long BEFORE_EDITING_TIMEOUT = 2000;
204.89 -
204.90 - private static int DEFINE_HERE = 0;
204.91 -
204.92 -
204.93 - private JRadioButtonOperator _rbBasic;
204.94 - private JButtonOperator _btAdvanced;
204.95 - private JButtonOperator _btClose;
204.96 - private JButtonOperator _btHelp;
204.97 - private TreeTableOperator _treeTable;
204.98 -
204.99 - /**
204.100 - * Waits for the Options window opened
204.101 - */
204.102 - public OptionsOperator() {
204.103 - super(getTitleToFind());
204.104 - setComparator(oldComparator);
204.105 - setDefaultStringComparator(oldComparator);
204.106 - }
204.107 -
204.108 - private static StringComparator oldComparator;
204.109 -
204.110 - /** Method to set exactly matching comparator to be used in constructor.
204.111 - * @return "Options" - title of window to be found
204.112 - */
204.113 - private static String getTitleToFind() {
204.114 - oldComparator = Operator.getDefaultStringComparator();
204.115 - DefaultStringComparator comparator = new DefaultStringComparator(true, true);
204.116 - setDefaultStringComparator(comparator);
204.117 - return Bundle.getString("org.netbeans.core.Bundle", "UI/Services");
204.118 - }
204.119 - /**
204.120 - * Invoces Options window by the menu operation.
204.121 - * @return OptionsOperator instance
204.122 - */
204.123 - public static OptionsOperator invoke() {
204.124 -// invokeAction.perform();
204.125 - Util.getMainMenu().pushMenu("Tools|Options");
204.126 - return new OptionsOperator();
204.127 - }
204.128 -
204.129 - static {
204.130 - Timeouts.initDefault("OptionsOperator.BeforeEditingTimeout", BEFORE_EDITING_TIMEOUT);
204.131 - }
204.132 -
204.133 - //subcomponents
204.134 -
204.135 - //******************************
204.136 - // Subcomponents definition part
204.137 - //******************************
204.138 -
204.139 - /** Tries to find " Basic" JRadioButton in this dialog.
204.140 - * @return JRadioButtonOperator
204.141 - */
204.142 - public JRadioButtonOperator rbBasic() {
204.143 - if (_rbBasic==null) {
204.144 - _rbBasic = new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("com.sun.rave.extension.core.actions.Bundle").getString("CTL_basic_button").trim());
204.145 - }
204.146 - return _rbBasic;
204.147 - }
204.148 -
204.149 - /** Tries to find " Advanced" JRadioButton in this dialog.
204.150 - * @return JRadioButtonOperator
204.151 - */
204.152 - public JButtonOperator rbAdvanced() {
204.153 - if (_btAdvanced==null) {
204.154 - _btAdvanced = new JButtonOperator(this, "Advanced Options");
204.155 - //new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("com.sun.rave.extension.core.actions.Bundle").getString("CTL_advanced_button").trim());
204.156 - }
204.157 - return _btAdvanced;
204.158 - }
204.159 -
204.160 - /** Tries to find "Close" JButton in this dialog.
204.161 - * @return JButtonOperator
204.162 - */
204.163 - public JButtonOperator btClose() {
204.164 - if (_btClose==null) {
204.165 - _btClose = new JButtonOperator(this, Bundle.getStringTrimmed(
204.166 - "org.netbeans.core.actions.Bundle", "CTL_close_button"));
204.167 - }
204.168 - return _btClose;
204.169 - }
204.170 -
204.171 - /** Tries to find "Help" JButton in this dialog.
204.172 - * @return JButtonOperator
204.173 - */
204.174 - public JButtonOperator btHelp() {
204.175 - if (_btHelp==null) {
204.176 - _btHelp = new JButtonOperator(this, "Help"
204.177 - /* TODO: change literal string to Bundle.getStringTrimmed(
204.178 - "org.netbeans.core.actions.Bundle", "CTL_help_button")*/);
204.179 - }
204.180 - return _btHelp;
204.181 - }
204.182 -
204.183 - //****************************************
204.184 - // Low-level functionality definition part
204.185 - //****************************************
204.186 -
204.187 - /** Implements switching to Basic mode
204.188 - * clicks on " Basic" JRadioButton
204.189 - */
204.190 - public void basic() {
204.191 - rbBasic().push();
204.192 - }
204.193 -
204.194 - /** Implements switching to Basic mode
204.195 - * clicks on " Advanced" JRadioButton
204.196 - */
204.197 - public void advanced() {
204.198 - rbAdvanced().push();
204.199 - }
204.200 -
204.201 - /** clicks on "Close" JButton
204.202 - */
204.203 - public void close() {
204.204 - btClose().pushNoBlock();
204.205 - }
204.206 -
204.207 - /** clicks on "Help" JButton
204.208 - */
204.209 - public void help() {
204.210 - btHelp().push();
204.211 - }
204.212 -
204.213 -
204.214 - /** Getter for table containing property list and
204.215 - * property definition levels.
204.216 - * @return TreeTableOperator instance
204.217 - */
204.218 - public TreeTableOperator treeTable() {
204.219 - if(_treeTable == null) {
204.220 - _treeTable = new TreeTableOperator(this);
204.221 - }
204.222 - return _treeTable;
204.223 - }
204.224 -
204.225 - //shortcuts
204.226 - /** Selects an option in the options tree.
204.227 - * @param optionPath Path to the option in left (tree-like) column.
204.228 - * @return row index of selected node (starts at 0)
204.229 - */
204.230 - public int selectOption(String optionPath) {
204.231 - TreePath path = treeTable().tree().findPath(optionPath, "|");
204.232 - if(!treeTable().tree().isPathSelected(path)) {
204.233 - treeTable().tree().selectPath(path);
204.234 - }
204.235 - int result = treeTable().tree().getRowForPath(path);
204.236 - treeTable().scrollToCell(result, 0);
204.237 - new EventTool().waitNoEvent(500);
204.238 - return(result);
204.239 - }
204.240 -
204.241 - /** Selects an option in the options tree, waits for property sheet
204.242 - * corresponding to selected node and returns instance of PropertySheetOperator.
204.243 - * @param optionPath Path to the option in left (tree-like) column.
204.244 - * @return PropertySheetOperator of selected option
204.245 - */
204.246 - /*public PropertySheetOperator getPropertySheet(String optionPath) {
204.247 - selectOption(optionPath);
204.248 - // wait for property sheet corresponding with selected node
204.249 - final String nodeName = treeTable().tree().getSelectionPath().getLastPathComponent().toString();
204.250 - try {
204.251 - return (PropertySheetOperator)new Waiter(new Waitable() {
204.252 - public Object actionProduced(Object optionsOper) {
204.253 - PropertySheetOperator pso = new PropertySheetOperator((OptionsOperator)optionsOper);//this);
204.254 - return pso.getDescriptionHeader().equals(nodeName) ? pso: null;
204.255 - }
204.256 - public String getDescription() {
204.257 - return("Wait Property sheet for \""+nodeName+"\" is showing.");
204.258 - }
204.259 - }
204.260 - ).waitAction(this);
204.261 - } catch (InterruptedException e) {
204.262 - throw new JemmyException("Interrupted.", e);
204.263 - }
204.264 - }*/
204.265 -
204.266 - //definition levels
204.267 -
204.268 - /**
204.269 - * Shows definition levels column by clicking on the "<<" table
204.270 - * column title.
204.271 - */
204.272 - public void showLevels() {
204.273 - if(treeTable().getColumnCount() == 2) {
204.274 - clickOnSecondHeader();
204.275 - }
204.276 - }
204.277 -
204.278 - /**
204.279 - * Hides definition levels column by clicking on the ">>" table
204.280 - * column title.
204.281 - */
204.282 - public void hideLevels() {
204.283 - if(treeTable().getColumnCount() > 2) {
204.284 - clickOnSecondHeader();
204.285 - }
204.286 - }
204.287 -
204.288 - /**
204.289 - * Sets definition level for the option.
204.290 - * @param optionPath Path to the option in left (tree-like) column.
204.291 - * @param level One of the PROJECT_LEVEL, USER_LEVEL or DEFAULT_LEVEL
204.292 - */
204.293 - /*public void setLevel(String optionPath, final int level) {
204.294 - showLevels();
204.295 - int curLevel = getLevel(optionPath);
204.296 - getOutput().printLine("Setting " + level + " level for \"" +
204.297 - optionPath + "\" option. \nCurrent level: " + curLevel);
204.298 - final int row = selectOption(optionPath);
204.299 - if(level > curLevel) {
204.300 - produceNoBlocking(new NoBlockingAction("Setting property definition level") {
204.301 - public Object doAction(Object param) {
204.302 - setLevel(row, level);
204.303 - return(null);
204.304 - }
204.305 - });
204.306 - JDialogOperator question = new JDialogOperator(Bundle.getString("org.openide.Bundle",
204.307 - "NTF_QuestionTitle"));
204.308 - new JButtonOperator(question, Bundle.getString("org.openide.Bundle",
204.309 - "CTL_YES")).push();
204.310 - } else if(level < curLevel) {
204.311 - setLevel(row, level);
204.312 - }
204.313 - }*/
204.314 -
204.315 - /**
204.316 - * Gets definition level for the option.
204.317 - * @param optionPath Path to the option in left (tree-like) column.
204.318 - * @return level One of the PROJECT_LEVEL, USER_LEVEL or DEFAULT_LEVEL
204.319 - */
204.320 - public int getLevel(String optionPath) {
204.321 - int row = selectOption(optionPath);
204.322 - if (getValue(row, PROJECT_LEVEL) == DEFINE_HERE) {
204.323 - return PROJECT_LEVEL;
204.324 - } else if(getValue(row, USER_LEVEL) == DEFINE_HERE) {
204.325 - return USER_LEVEL;
204.326 - } else if(getValue(row, DEFAULT_LEVEL) == DEFINE_HERE) {
204.327 - return DEFAULT_LEVEL;
204.328 - }
204.329 - return -1;
204.330 - }
204.331 -
204.332 - /** Make an option to be difined on the project level.
204.333 - * @param optionPath Path to the option in left (tree-like) column.
204.334 - */
204.335 - /*public void setProjectLevel(String optionPath) {
204.336 - setLevel(optionPath, PROJECT_LEVEL);
204.337 - }*/
204.338 -
204.339 - /** Make an option to be difined on the user level.
204.340 - * @param optionPath Path to the option in left (tree-like) column.
204.341 - */
204.342 - /*public void setUserLevel(String optionPath) {
204.343 - setLevel(optionPath, USER_LEVEL);
204.344 - }*/
204.345 -
204.346 - /** Make an option to be difined on the default level.
204.347 - * @param optionPath Path to the option in left (tree-like) column.
204.348 - */
204.349 - /*public void setDefaultLevel(String optionPath) {
204.350 - setLevel(optionPath, DEFAULT_LEVEL);
204.351 - }*/
204.352 -
204.353 - //protected
204.354 -
204.355 - /** Sets a level for the row index.
204.356 - * @param row row index in the table
204.357 - * @param level level value
204.358 - */
204.359 - protected void setLevel(int row, int level) {
204.360 - if (level == PROJECT_LEVEL) {
204.361 - defineHere(row, level);
204.362 - } else if(level == USER_LEVEL) {
204.363 - defineHere(row, level);
204.364 - } else if(level == DEFAULT_LEVEL) {
204.365 - revertLevel(row, level);
204.366 - }
204.367 - }
204.368 -
204.369 - /** Gets a value of the level definition mark.
204.370 - * @param row row index in the table
204.371 - * @param column column index in the table
204.372 - * @return value of the level definition mark
204.373 - */
204.374 - protected int getValue(int row, int column) {
204.375 - /* TODO: ab153207, commented FileStateProperty was not found
204.376 - try {
204.377 - FileStateProperty property = ((FileStateProperty)treeTable().getValueAt(row, column));
204.378 - return(((Integer)property.getValue()).intValue());
204.379 - } catch(IllegalAccessException e) {
204.380 - throw new JemmyException("Can not access value!", e);
204.381 - } catch(InvocationTargetException e) {
204.382 - throw new JemmyException("Can not access value!", e);
204.383 - }*/
204.384 - return 0;
204.385 - }
204.386 -
204.387 - /** Chooses "Revert Def" from the combobox.
204.388 - * @param row row index in the table
204.389 - * @param colIndex column index in the table
204.390 - */
204.391 - protected void revertLevel(final int row, final int colIndex) {
204.392 - editLevel(row, colIndex, Bundle.getString("org.netbeans.core.projects.Bundle",
204.393 - "LBL_action_revert"));
204.394 - }
204.395 -
204.396 - /** Chooses "Define Here" from the combobox.
204.397 - * @param row row index in the table
204.398 - * @param colIndex column index in the table
204.399 - */
204.400 - protected void defineHere(int row, int colIndex) {
204.401 - editLevel(row, colIndex, Bundle.getString("org.netbeans.core.projects.Bundle",
204.402 - "LBL_action_define"));
204.403 - }
204.404 -
204.405 - /**
204.406 - * Causes table editing and chooses a value in the combobox.
204.407 - * @param rowIndex Row index.
204.408 - * @param colIndex Column index. One of the columns containing
204.409 - * level definition marks.
204.410 - * @param value String value to be choosed in the combobox.
204.411 - */
204.412 - protected void editLevel(int rowIndex, int colIndex, String value) {
204.413 - //Point pnt = treeTable().getPointToClick(rowIndex, colIndex);
204.414 - treeTable().clickOnCell(rowIndex, colIndex);
204.415 - JComboBoxOperator combo = new JComboBoxOperator(treeTable());
204.416 - getTimeouts().sleep("OptionsOperator.BeforeEditingTimeout");
204.417 - combo.selectItem(value);
204.418 - }
204.419 -
204.420 - /**
204.421 - * Clicks on "<<" column header.
204.422 - */
204.423 - protected void clickOnSecondHeader() {
204.424 - JTableHeader header = treeTable().getTableHeader();
204.425 - Rectangle rect = header.getHeaderRect(1);
204.426 - new ComponentOperator(header).clickMouse(rect.x + rect.width/2,
204.427 - rect.y + rect.height/2,
204.428 - 1);
204.429 - }
204.430 -
204.431 - /** Performs verification by accessing all sub-components */
204.432 - public void verify() {
204.433 - btClose();
204.434 - btHelp();
204.435 - treeTable().verify();
204.436 - }
204.437 -}
205.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/PageTopComponentOperator.java Thu Jul 10 04:29:52 2008 -0700
205.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
205.3 @@ -1,104 +0,0 @@
205.4 -/*
205.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
205.6 - *
205.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
205.8 - *
205.9 - * The contents of this file are subject to the terms of either the GNU
205.10 - * General Public License Version 2 only ("GPL") or the Common
205.11 - * Development and Distribution License("CDDL") (collectively, the
205.12 - * "License"). You may not use this file except in compliance with the
205.13 - * License. You can obtain a copy of the License at
205.14 - * http://www.netbeans.org/cddl-gplv2.html
205.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
205.16 - * specific language governing permissions and limitations under the
205.17 - * License. When distributing the software, include this License Header
205.18 - * Notice in each file and include the License file at
205.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
205.20 - * particular file as subject to the "Classpath" exception as provided
205.21 - * by Sun in the GPL Version 2 section of the License file that
205.22 - * accompanied this code. If applicable, add the following below the
205.23 - * License Header, with the fields enclosed by brackets [] replaced by
205.24 - * your own identifying information:
205.25 - * "Portions Copyrighted [year] [name of copyright owner]"
205.26 - *
205.27 - * Contributor(s):
205.28 - *
205.29 - * The Original Software is NetBeans. The Initial Developer of the Original
205.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
205.31 - * Microsystems, Inc. All Rights Reserved.
205.32 - *
205.33 - * If you wish your version of this file to be governed by only the CDDL
205.34 - * or only the GPL Version 2, indicate your decision by adding
205.35 - * "[Contributor] elects to include this software in this distribution
205.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
205.37 - * single choice of license, a recipient has the option to distribute
205.38 - * your version of this file under either the CDDL, the GPL Version 2 or
205.39 - * to extend the choice of license to its licensees as provided above.
205.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
205.41 - * Version 2 license, then the option applies only if the new code is
205.42 - * made subject to such option by the copyright holder.
205.43 - */
205.44 -
205.45 -package org.netbeans.modules.visualweb.gravy;
205.46 -
205.47 -import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
205.48 -import org.netbeans.modules.visualweb.gravy.EditorOperator;
205.49 -import org.netbeans.jellytools.TopComponentOperator;
205.50 -import org.netbeans.jemmy.util.Dumper;
205.51 -import java.awt.Component;
205.52 -
205.53 -/**
205.54 - * Provides access to the Page and it's subcomponents.
205.55 - */
205.56 -public class PageTopComponentOperator extends TopComponentOperator {
205.57 -
205.58 - /**
205.59 - * Name of the page.
205.60 - */
205.61 - String name = "";
205.62 -
205.63 - /**
205.64 - * Create operator, which represents page.
205.65 - * @param name Name of the page.
205.66 - */
205.67 - public PageTopComponentOperator(String name) {
205.68 - super(name);
205.69 - this.name = name;
205.70 - }
205.71 -
205.72 - /**
205.73 - * Create operator, which represents page.
205.74 - * @param name Name of the page.
205.75 - */
205.76 - public PageTopComponentOperator(String name, int index) {
205.77 - super(name, index);
205.78 - this.name = name;
205.79 - }
205.80 -
205.81 - /**
205.82 - * Get page designer.
205.83 - * @return DesignerPaneOperator Designer for this page.
205.84 - */
205.85 - public DesignerPaneOperator getDesigner() {
205.86 - DesignerPaneOperator.switchToDesignerPane();
205.87 - return new DesignerPaneOperator(this);
205.88 - }
205.89 -
205.90 - /**
205.91 - * Get JSP editor.
205.92 - * @return EditorOperator JSP editor for this page.
205.93 - */
205.94 - public EditorOperator getJSPEditor() {
205.95 - DesignerPaneOperator.switchToJSPSource();
205.96 - return new EditorOperator(this, name);
205.97 - }
205.98 -
205.99 - /**
205.100 - * Get Java editor.
205.101 - * @return EditorOperator Java editor for this page.
205.102 - */
205.103 - public EditorOperator getJavaEditor() {
205.104 - DesignerPaneOperator.switchToJavaSource();
205.105 - return new EditorOperator(this, name);
205.106 - }
205.107 -}
206.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/ProjectNavigatorOperator.java Thu Jul 10 04:29:52 2008 -0700
206.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
206.3 @@ -1,207 +0,0 @@
206.4 -/*
206.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
206.6 - *
206.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
206.8 - *
206.9 - * The contents of this file are subject to the terms of either the GNU
206.10 - * General Public License Version 2 only ("GPL") or the Common
206.11 - * Development and Distribution License("CDDL") (collectively, the
206.12 - * "License"). You may not use this file except in compliance with the
206.13 - * License. You can obtain a copy of the License at
206.14 - * http://www.netbeans.org/cddl-gplv2.html
206.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
206.16 - * specific language governing permissions and limitations under the
206.17 - * License. When distributing the software, include this License Header
206.18 - * Notice in each file and include the License file at
206.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
206.20 - * particular file as subject to the "Classpath" exception as provided
206.21 - * by Sun in the GPL Version 2 section of the License file that
206.22 - * accompanied this code. If applicable, add the following below the
206.23 - * License Header, with the fields enclosed by brackets [] replaced by
206.24 - * your own identifying information:
206.25 - * "Portions Copyrighted [year] [name of copyright owner]"
206.26 - *
206.27 - * Contributor(s):
206.28 - *
206.29 - * The Original Software is NetBeans. The Initial Developer of the Original
206.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
206.31 - * Microsystems, Inc. All Rights Reserved.
206.32 - *
206.33 - * If you wish your version of this file to be governed by only the CDDL
206.34 - * or only the GPL Version 2, indicate your decision by adding
206.35 - * "[Contributor] elects to include this software in this distribution
206.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
206.37 - * single choice of license, a recipient has the option to distribute
206.38 - * your version of this file under either the CDDL, the GPL Version 2 or
206.39 - * to extend the choice of license to its licensees as provided above.
206.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
206.41 - * Version 2 license, then the option applies only if the new code is
206.42 - * made subject to such option by the copyright holder.
206.43 - */
206.44 -
206.45 -package org.netbeans.modules.visualweb.gravy;
206.46 -
206.47 -import javax.swing.tree.TreePath;
206.48 -
206.49 -import org.netbeans.jemmy.operators.*;
206.50 -import org.netbeans.jemmy.*;
206.51 -import org.netbeans.jellytools.*;
206.52 -import org.netbeans.modules.visualweb.gravy.actions.ShowFilesAction;
206.53 -import org.netbeans.modules.visualweb.gravy.actions.ShowProjectsAction;
206.54 -import org.netbeans.modules.visualweb.gravy.actions.BuildProjectAction;
206.55 -
206.56 -import java.awt.*;
206.57 -
206.58 -/** Provides access to Projects window and it's components
206.59 - * @author Alexey Butenko
206.60 - *
206.61 - */
206.62 -public class ProjectNavigatorOperator extends org.netbeans.jellytools.ProjectsTabOperator {
206.63 -
206.64 - public ProjectNavigatorOperator() {
206.65 - super();
206.66 - }
206.67 -
206.68 - /** Select Path
206.69 - * @param treePath - String path to select
206.70 - */
206.71 - public void selectPath(String treePath) {
206.72 - makeComponentVisible();
206.73 - TreePath path = tree().findPath(treePath);
206.74 - tree().selectPath(path);
206.75 - }
206.76 -
206.77 - /** Opens Projects window
206.78 - */
206.79 - public static ProjectNavigatorOperator showProjectNavigator() {
206.80 - new ShowProjectsAction().perform();
206.81 - new QueueTool().waitEmpty();
206.82 - Util.wait(500);
206.83 - return(new ProjectNavigatorOperator());
206.84 - }
206.85 - /**
206.86 - * Select Node
206.87 - * @param node - Node to select
206.88 - */
206.89 - public static void selectNode(String node){
206.90 - ProjectNavigatorOperator projectNav = ProjectNavigatorOperator.showProjectNavigator();
206.91 - projectNav.makeComponentVisible();
206.92 - JTreeOperator tree = projectNav.tree();
206.93 - tree.selectPath(tree.findPath(node));
206.94 - }
206.95 -
206.96 - /** Build Project
206.97 - * @param prjName - Name of the project to build
206.98 - */
206.99 - public void buildProject(String prjName) {
206.100 - makeComponentVisible();
206.101 - pressPopupItemOnNode(prjName, Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_BuildProject"));
206.102 - }
206.103 -
206.104 - /** Opens Files Tab
206.105 - */
206.106 - public static JTreeOperator switchToFiles() {
206.107 - new ShowFilesAction().perform();
206.108 -
206.109 - ContainerOperator containerOperator = new ContainerOperator(
206.110 - waitTopComponent(null,
206.111 - Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle",
206.112 - "LBL_projectTab_tc"), 0,
206.113 - new ComponentChooser() {
206.114 - public boolean checkComponent(Component comp) {
206.115 - return comp.getClass().getName().endsWith("ProjectTab");
206.116 - }
206.117 - public String getDescription() {
206.118 - return "org.netbeans.modules.projects.ui.ProjectTab";
206.119 - }
206.120 - }));
206.121 - Util.wait(1000);
206.122 - JTreeOperator treeOperator = new JTreeOperator(containerOperator);
206.123 - return (treeOperator);
206.124 - }
206.125 -
206.126 - /** Opens Projects Tab
206.127 - */
206.128 - public static ProjectNavigatorOperator switchToProjects() {
206.129 - new ShowProjectsAction().perform();
206.130 - return(new ProjectNavigatorOperator());
206.131 - }
206.132 -
206.133 - /** Press popup item on node
206.134 - * @param path - click for popup on
206.135 - * @param menuItem - item to click in popup window
206.136 - * @param comparator - StringComparator
206.137 - */
206.138 - public static ProjectNavigatorOperator pressPopupItemOnNode(String path, String menuItem,
206.139 - StringComparator comparator) {
206.140 - try{
206.141 - ProjectNavigatorOperator projectNav = ProjectNavigatorOperator.showProjectNavigator();
206.142 - TestUtils.wait(4000);
206.143 - //projectNav.makeComponentVisible();
206.144 - JTreeOperator tree = projectNav.tree();
206.145 - JPopupMenuOperator popup;
206.146 - if (path.equals("ROOT")) {
206.147 - popup = new JPopupMenuOperator(tree.callPopupOnPath(new TreePath(tree.getRoot())));
206.148 - } else {
206.149 - popup = new JPopupMenuOperator(tree.callPopupOnPath(tree.findPath(path, "|")));
206.150 - }
206.151 - new QueueTool().waitEmpty();
206.152 - Util.wait(1000);
206.153 -
206.154 - if (comparator != null) {
206.155 - popup.setComparator(comparator);
206.156 - }
206.157 -
206.158 - popup.pushMenuNoBlock(menuItem, "|");
206.159 - new QueueTool().waitEmpty();
206.160 - Util.wait(1000);
206.161 - return projectNav;
206.162 - } catch(Exception e) {
206.163 - System.out.println("Exception occured in pressPopupItemOnPath function");
206.164 - e.printStackTrace();
206.165 - return null;
206.166 - }
206.167 - }
206.168 -
206.169 - /** Press popup item on node
206.170 - * @param path - click for popup on
206.171 - * @param menuItem - item to click in popup window
206.172 - */
206.173 - public static ProjectNavigatorOperator pressPopupItemOnNode(String path, String menuItem) {
206.174 - return pressPopupItemOnNode(path, menuItem, null);
206.175 - }
206.176 -
206.177 - /**
206.178 - * Add a new page
206.179 - * @param projectName project that a page will be created at
206.180 - * @param pageName page will be created
206.181 - */
206.182 - public void addWebPage(String projectName, String pageName){
206.183 - String treeNodePath = projectName + "|" + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle",
206.184 - "ProjectNode_WebPages");
206.185 - String popupMenuItem = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","ProjectMenuItem_New")
206.186 - +"|"+ Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","ProjectMenuItem_Page");
206.187 - pressPopupItemOnNode(treeNodePath, popupMenuItem);
206.188 -
206.189 - JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","Dialog_NewPage"));
206.190 - Util.wait(1000);
206.191 -
206.192 - JTextFieldOperator textfieldFolderName = new JTextFieldOperator(dialog, 0);
206.193 - textfieldFolderName.setText(pageName);
206.194 - new JButtonOperator(dialog, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","Button_Finish")).pushNoBlock();
206.195 - //dialog.waitClosed();
206.196 - Util.wait(1000);
206.197 -
206.198 - }
206.199 -
206.200 - /**
206.201 - * Open a jsp page of current project
206.202 - * @param webPageName
206.203 - */
206.204 - public void openWebPage(String projectName, String webPageName) {
206.205 - String treeNodePath = projectName + "|" + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "ProjectNode_WebPages") + "|" +
206.206 - webPageName + Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "WebPage_extension");
206.207 - String popupMenuItem = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "ProjectMenuItem_Open");
206.208 - pressPopupItemOnNode(treeNodePath, popupMenuItem);
206.209 - }
206.210 -}
207.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/RaveTestCase.java Thu Jul 10 04:29:52 2008 -0700
207.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
207.3 @@ -1,284 +0,0 @@
207.4 -/*
207.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
207.6 -
207.7 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
207.8 -
207.9 -The contents of this file are subject to the terms of either the GNU
207.10 -General Public License Version 2 only ("GPL") or the Common
207.11 -Development and Distribution License("CDDL") (collectively, the
207.12 -"License"). You may not use this file except in compliance with the
207.13 -License. You can obtain a copy of the License at
207.14 -http://www.netbeans.org/cddl-gplv2.html
207.15 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
207.16 -specific language governing permissions and limitations under the
207.17 -License. When distributing the software, include this License Header
207.18 -Notice in each file and include the License file at
207.19 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
207.20 -particular file as subject to the "Classpath" exception as provided
207.21 -by Sun in the GPL Version 2 section of the License file that
207.22 -accompanied this code. If applicable, add the following below the
207.23 -License Header, with the fields enclosed by brackets [] replaced by
207.24 -your own identifying information:
207.25 -"Portions Copyrighted [year] [name of copyright owner]"
207.26 -
207.27 -Contributor(s):
207.28 -
207.29 -The Original Software is NetBeans. The Initial Developer of the Original
207.30 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
207.31 -Microsystems, Inc. All Rights Reserved.
207.32 -
207.33 -If you wish your version of this file to be governed by only the CDDL
207.34 -or only the GPL Version 2, indicate your decision by adding
207.35 -"[Contributor] elects to include this software in this distribution
207.36 -under the [CDDL or GPL Version 2] license." If you do not indicate a
207.37 -single choice of license, a recipient has the option to distribute
207.38 -your version of this file under either the CDDL, the GPL Version 2 or
207.39 -to extend the choice of license to its licensees as provided above.
207.40 -However, if you add GPL Version 2 code and therefore, elected the GPL
207.41 -Version 2 license, then the option applies only if the new code is
207.42 -made subject to such option by the copyright holder.
207.43 -*/
207.44 -
207.45 -package org.netbeans.modules.visualweb.gravy;
207.46 -
207.47 -import org.netbeans.jellytools.JellyTestCase;
207.48 -import org.netbeans.junit.*;
207.49 -import org.netbeans.jemmy.*;
207.50 -import org.netbeans.jemmy.util.PNGEncoder;
207.51 -import org.netbeans.jemmy.util.Dumper;
207.52 -import org.netbeans.xtest.util.NativeKill;
207.53 -
207.54 -//import com.sun.rave.gravy.winsys.DockablePaneOperator;
207.55 -
207.56 -import java.awt.*;
207.57 -import java.awt.event.HierarchyEvent;
207.58 -import java.awt.event.AWTEventListener;
207.59 -import java.awt.event.HierarchyListener;
207.60 -
207.61 -import java.io.*;
207.62 -
207.63 -import java.util.Properties;
207.64 -import java.util.Iterator;
207.65 -import java.util.Map;
207.66 -
207.67 -/**
207.68 - *
207.69 - * @author Alexandre (Shura) Iline (alexandre.iline@sun.com)
207.70 - */
207.71 -public class RaveTestCase extends JellyTestCase {
207.72 -
207.73 - /** Full Thread Dump feature in case of failure is disabled by default
207.74 - */
207.75 - public boolean doFullThreadDump = Boolean.valueOf(System.getProperty("xtest.FullThreadDump.do", "false")).booleanValue();
207.76 -
207.77 - TestProperties props;
207.78 -
207.79 - public RaveTestCase(String testName) {
207.80 - super(testName);
207.81 - props = new TestProperties();
207.82 - dumpScreen = true;
207.83 - }
207.84 -
207.85 - protected TestProperties getTestProperties() {
207.86 - return(props);
207.87 - }
207.88 -
207.89 -//@todo
207.90 -
207.91 - protected boolean waitNoEvent = true;
207.92 -
207.93 -// all code until end of class should be removed after JellyTestCase corresponding change - adding waitNoEvent member
207.94 -
207.95 - /** Overriden method from JUnit framework execution to perform conditional
207.96 - * screen shot and conversion from TimeoutExpiredException to AssertionFailedError. <br>
207.97 - * Waits a second before test execution.
207.98 - * @throws Throwable Throwable
207.99 - */
207.100 - public void runBare() throws Throwable {
207.101 -
207.102 - //close the damn window
207.103 -// if(Util.getMainWindow().
207.104 -// findSubComponent(new DockablePaneOperator.DockablePaneFinder("JUnitTestRunnerExecutor"))
207.105 -// != null) {
207.106 -// new DockablePaneOperator("JUnitTestRunnerExecutor").hide();
207.107 -// }
207.108 - // workaround for JDK bug 4924516 (see below)
207.109 - Toolkit.getDefaultToolkit().addAWTEventListener(distributingHierarchyListener,
207.110 - HierarchyEvent.HIERARCHY_EVENT_MASK);
207.111 - // wait
207.112 - if(waitNoEvent) {
207.113 - new EventTool().waitNoEvent(1000);
207.114 - }
207.115 - try {
207.116 - super.runBare();
207.117 - } catch (ThreadDeath td) {
207.118 - // ThreadDead must be re-throwed immediately
207.119 - throw td;
207.120 - } catch (Throwable th) {
207.121 - // suite is notified about test failure so it can do some debug actions
207.122 - try {
207.123 - failNotify(th);
207.124 - } catch (Exception e3) {}
207.125 - // screen capture is performed when test fails and in dependency on system property
207.126 - if (captureScreen) {
207.127 - try {
207.128 - PNGEncoder.captureScreen(getWorkDir().getAbsolutePath()+File.separator+"screen.png");
207.129 - } catch (Exception e1) {}
207.130 - }
207.131 - // XML dump is performed when test fails and in dependency on system property
207.132 - if (dumpScreen) {
207.133 - try {
207.134 - Dumper.dumpAll(getWorkDir().getAbsolutePath()+File.separator+"screen.xml");
207.135 - } catch (Exception e2) {}
207.136 - }
207.137 - // Full Thread Dump is performed when test fails and in dependency on system property
207.138 - if (doFullThreadDump) {
207.139 - try {
207.140 - doFullThreadDump();
207.141 - }
207.142 - catch (Exception e4) {
207.143 - e4.printStackTrace();
207.144 - System.out.println("Dump for all threads is not created");
207.145 - }
207.146 - }
207.147 - // closes all modal dialogs in dependency on systems property
207.148 - if (closeAllModal) try {
207.149 - closeAllModal();
207.150 - } catch (Exception e) {}
207.151 - if (th instanceof JemmyException) {
207.152 - // all instancies of JemmyException are re-throwed as AssertionError (test failed)
207.153 - throw new AssertionFailedErrorException(th.getMessage(), th);
207.154 - } else {
207.155 - throw th;
207.156 - }
207.157 - } finally {
207.158 - // workaround for JDK bug 4924516 (see below)
207.159 - Toolkit.getDefaultToolkit().removeAWTEventListener(distributingHierarchyListener);
207.160 - }
207.161 - }
207.162 -
207.163 - public static Properties getDeploymentTargetProperties(String path_to_file) {
207.164 - Properties properties = new Properties();
207.165 - try {
207.166 - System.out.println("path to file is \"" + path_to_file + "\".");
207.167 - properties.load(new FileInputStream(path_to_file));
207.168 - } catch(Exception e) {
207.169 - System.out.println("Properties can not be loaded!");
207.170 - System.out.println("e=" + e.toString());
207.171 - return null;
207.172 - }
207.173 - return properties;
207.174 - }
207.175 -
207.176 - public static Properties getDeploymentTargetProperties() {
207.177 - String sep = File.separator;
207.178 - String path = System.getProperty("xtest.data.dir");
207.179 - path = path + sep + "DeploymentTargets.properties";
207.180 - return getDeploymentTargetProperties(path);
207.181 - }
207.182 -
207.183 - public static Properties getDefaultDeploymentTargetProperties() {
207.184 - String sep = File.separator;
207.185 - String path = System.getProperty("xtest.data.dir");
207.186 - path = path + sep + "DefaultDeploymentTargets.properties";
207.187 - return getDeploymentTargetProperties(path);
207.188 - }
207.189 -
207.190 - private void doFullThreadDump() {
207.191 - try {
207.192 - String xtestWorkdir = System.getProperty("xtest.workdir");
207.193 - File idePidFile = new File(xtestWorkdir, "ide.pid");
207.194 - LineNumberReader reader = new LineNumberReader(new FileReader(idePidFile));
207.195 - String line = reader.readLine();
207.196 - assertNotNull("Cannot read PID from file "+idePidFile, line);
207.197 - long pid = Long.parseLong(line);
207.198 - System.out.println();
207.199 - System.out.println("Full Thread Dump - BEGIN");
207.200 - boolean result = NativeKill.dumpProcess(pid);
207.201 - TestUtils.wait(2000);
207.202 - System.out.println("Full Thread Dump - END");
207.203 - System.out.println();
207.204 - assertTrue("NativeKill.dumpProcess("+pid+") failed.", result);
207.205 - }
207.206 - catch (IOException ioe) {
207.207 - System.out.println("IOException was thrown!");
207.208 - ioe.printStackTrace();
207.209 - }
207.210 - try {
207.211 - FileOutputStream fos = new FileOutputStream(getWorkDir().getAbsolutePath()+File.separator+"threads.dump");
207.212 - PrintWriter pw = new PrintWriter(fos);
207.213 - pw.println("Full thread dump Java HotSpot(TM) Client VM");
207.214 - pw.println();
207.215 - Map threadsMap = Thread.getAllStackTraces();
207.216 - Iterator keys = threadsMap.keySet().iterator();
207.217 - Iterator values = threadsMap.values().iterator();
207.218 - Thread key;
207.219 - StackTraceElement[] value;
207.220 - while (keys.hasNext()) {
207.221 - key = ((Thread) (keys.next()));
207.222 - String daemon = key.isDaemon()?" daemon":"";
207.223 - pw.println("\"" + key.getName() + "\"" + daemon +
207.224 - " prio=" + key.getPriority() + " id=" + key.getId() +
207.225 - " ThreadGroup=" + key.getThreadGroup().getName());
207.226 - value = ((StackTraceElement[]) (values.next()));
207.227 - for (int i = 0; i < value.length; i++)
207.228 - pw.println(" " + value[i].toString());
207.229 - pw.println();
207.230 - }
207.231 - pw.close();
207.232 - }
207.233 - catch (FileNotFoundException fnfe) {
207.234 - System.out.println("FileNotFoundException was thrown!");
207.235 - fnfe.printStackTrace();
207.236 - }
207.237 - catch (IOException ioe) {
207.238 - System.out.println("IOException was thrown!");
207.239 - ioe.printStackTrace();
207.240 - }
207.241 - }
207.242 -
207.243 - /* Workaround for JDK bug http://developer.java.sun.com/developer/bugParade/bugs/4924516.html.
207.244 - * Also see issue http://www.netbeans.org/issues/show_bug.cgi?id=32466.
207.245 - * ------------------------------------------------------------------------------------------
207.246 - * It can be removed when it is fixed (probably in JDK1.5.0). The following
207.247 - * listener is added to Toolkit at runBare() method and removed when it finishes.
207.248 - * It distributes HierarchyEvent to all listening components and its subcomponents.
207.249 - */
207.250 - private static final RaveTestCase.DistributingHierarchyListener
207.251 - distributingHierarchyListener = new RaveTestCase.DistributingHierarchyListener();
207.252 -
207.253 - private static class DistributingHierarchyListener implements AWTEventListener {
207.254 -
207.255 - public DistributingHierarchyListener() {
207.256 - }
207.257 -
207.258 - public void eventDispatched(java.awt.AWTEvent aWTEvent) {
207.259 - HierarchyEvent hevt = null;
207.260 - if (aWTEvent instanceof HierarchyEvent) {
207.261 - hevt = (HierarchyEvent) aWTEvent;
207.262 - }
207.263 - if (hevt != null && ((HierarchyEvent.SHOWING_CHANGED & hevt.getChangeFlags()) != 0)) {
207.264 - distributeShowingEvent(hevt.getComponent(), hevt);
207.265 - }
207.266 - }
207.267 -
207.268 - private static void distributeShowingEvent(Component c, HierarchyEvent hevt) {
207.269 - //HierarchyListener[] hierarchyListeners = c.getHierarchyListeners();
207.270 - // Need to use component.getListeners because it is not synchronized
207.271 - // and it not cause deadlock
207.272 - HierarchyListener[] hierarchyListeners = (HierarchyListener[])(c.getListeners(HierarchyListener.class));
207.273 - if (hierarchyListeners != null) {
207.274 - for (int i = 0; i < hierarchyListeners.length; i++) {
207.275 - hierarchyListeners[i].hierarchyChanged(hevt);
207.276 - }
207.277 - }
207.278 - if (c instanceof Container) {
207.279 - Container cont = (Container) c;
207.280 - int n = cont.getComponentCount();
207.281 - for (int i = 0; i < n; i++) {
207.282 - distributeShowingEvent(cont.getComponent(i), hevt);
207.283 - }
207.284 - }
207.285 - }
207.286 - }
207.287 -}
208.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/RaveWindowOperator.java Thu Jul 10 04:29:52 2008 -0700
208.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
208.3 @@ -1,85 +0,0 @@
208.4 -/*
208.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
208.6 - *
208.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
208.8 - *
208.9 - * The contents of this file are subject to the terms of either the GNU
208.10 - * General Public License Version 2 only ("GPL") or the Common
208.11 - * Development and Distribution License("CDDL") (collectively, the
208.12 - * "License"). You may not use this file except in compliance with the
208.13 - * License. You can obtain a copy of the License at
208.14 - * http://www.netbeans.org/cddl-gplv2.html
208.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
208.16 - * specific language governing permissions and limitations under the
208.17 - * License. When distributing the software, include this License Header
208.18 - * Notice in each file and include the License file at
208.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
208.20 - * particular file as subject to the "Classpath" exception as provided
208.21 - * by Sun in the GPL Version 2 section of the License file that
208.22 - * accompanied this code. If applicable, add the following below the
208.23 - * License Header, with the fields enclosed by brackets [] replaced by
208.24 - * your own identifying information:
208.25 - * "Portions Copyrighted [year] [name of copyright owner]"
208.26 - *
208.27 - * Contributor(s):
208.28 - *
208.29 - * The Original Software is NetBeans. The Initial Developer of the Original
208.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
208.31 - * Microsystems, Inc. All Rights Reserved.
208.32 - *
208.33 - * If you wish your version of this file to be governed by only the CDDL
208.34 - * or only the GPL Version 2, indicate your decision by adding
208.35 - * "[Contributor] elects to include this software in this distribution
208.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
208.37 - * single choice of license, a recipient has the option to distribute
208.38 - * your version of this file under either the CDDL, the GPL Version 2 or
208.39 - * to extend the choice of license to its licensees as provided above.
208.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
208.41 - * Version 2 license, then the option applies only if the new code is
208.42 - * made subject to such option by the copyright holder.
208.43 - */
208.44 -
208.45 -package org.netbeans.modules.visualweb.gravy;
208.46 -
208.47 -
208.48 -import org.netbeans.jemmy.operators.JButtonOperator;
208.49 -
208.50 -/**
208.51 - * @author Alexey Butenko
208.52 - */
208.53 -public class RaveWindowOperator extends org.netbeans.jellytools.MainWindowOperator{
208.54 - /** Singleton instance of MainWindowOperator. */
208.55 - private static RaveWindowOperator defaultMainWindowOperator;
208.56 - JButtonOperator deployButton, buttonSaveAll;
208.57 -
208.58 - public RaveWindowOperator() {
208.59 - super();
208.60 - }
208.61 -
208.62 - /** Returns instance of MainWindowOperator. It is singleton, so this method
208.63 - * is only way how to obtain instance. If instance not exists, it creates one.
208.64 - * @return instance of MainWindowOperator
208.65 - */
208.66 - public static synchronized RaveWindowOperator getDefaultRave() {
208.67 - if(defaultMainWindowOperator == null) {
208.68 - defaultMainWindowOperator = new RaveWindowOperator();
208.69 - }
208.70 - return (defaultMainWindowOperator);
208.71 - }
208.72 -
208.73 - public JButtonOperator btDeploy() {
208.74 - if (deployButton == null) {
208.75 - deployButton = getToolbarButton(this, "Run Main Project");
208.76 - deployButton.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
208.77 - }
208.78 - return(deployButton);
208.79 - }
208.80 -
208.81 - public JButtonOperator btSaveAll() {
208.82 - if (buttonSaveAll == null) {
208.83 - buttonSaveAll = getToolbarButton(this, "Save All");
208.84 - buttonSaveAll.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
208.85 - }
208.86 - return (buttonSaveAll);
208.87 - }
208.88 -}
209.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/Repeater.java Thu Jul 10 04:29:52 2008 -0700
209.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
209.3 @@ -1,136 +0,0 @@
209.4 -/*
209.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
209.6 -*
209.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
209.8 -*
209.9 -* The contents of this file are subject to the terms of either the GNU
209.10 -* General Public License Version 2 only ("GPL") or the Common
209.11 -* Development and Distribution License("CDDL") (collectively, the
209.12 -* "License"). You may not use this file except in compliance with the
209.13 -* License. You can obtain a copy of the License at
209.14 -* http://www.netbeans.org/cddl-gplv2.html
209.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
209.16 -* specific language governing permissions and limitations under the
209.17 -* License. When distributing the software, include this License Header
209.18 -* Notice in each file and include the License file at
209.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
209.20 -* particular file as subject to the "Classpath" exception as provided
209.21 -* by Sun in the GPL Version 2 section of the License file that
209.22 -* accompanied this code. If applicable, add the following below the
209.23 -* License Header, with the fields enclosed by brackets [] replaced by
209.24 -* your own identifying information:
209.25 -* "Portions Copyrighted [year] [name of copyright owner]"
209.26 -*
209.27 -* Contributor(s):
209.28 -*
209.29 -* The Original Software is NetBeans. The Initial Developer of the Original
209.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
209.31 -* Microsystems, Inc. All Rights Reserved.
209.32 -*
209.33 -* If you wish your version of this file to be governed by only the CDDL
209.34 -* or only the GPL Version 2, indicate your decision by adding
209.35 -* "[Contributor] elects to include this software in this distribution
209.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
209.37 -* single choice of license, a recipient has the option to distribute
209.38 -* your version of this file under either the CDDL, the GPL Version 2 or
209.39 -* to extend the choice of license to its licensees as provided above.
209.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
209.41 -* Version 2 license, then the option applies only if the new code is
209.42 -* made subject to such option by the copyright holder.
209.43 -*/
209.44 -
209.45 -package org.netbeans.modules.visualweb.gravy;
209.46 -import org.netbeans.jemmy.JemmyProperties;
209.47 -import org.netbeans.jemmy.Timeout;
209.48 -
209.49 -/**
209.50 - * This class is intended to be used as a base for anonymous classes
209.51 - * aimed on several repeating of some action which is possible to failed
209.52 - * from first (second, third..) attempt
209.53 - */
209.54 -public class Repeater {
209.55 -
209.56 - private int repeatCount = 3;
209.57 - private long repeatTimeout = 2000;
209.58 -
209.59 - /** Creates a new instance of Repeater
209.60 - * Uses default of 3 attempts with 2 sec timeout
209.61 - */
209.62 - public Repeater() {
209.63 - }
209.64 -
209.65 - /** Creates a new instance of Repeater
209.66 - * Uses default 2 sec timeout
209.67 - * @param repeatCount Number of attempts to try
209.68 - */
209.69 - public Repeater(int repeatCount) {
209.70 - this.repeatCount = repeatCount;
209.71 - }
209.72 -
209.73 - /** Creates a new instance of Repeater
209.74 - * @param repeatCount Number of attempts to try
209.75 - * @param repeatTimout Timeout between attempts
209.76 - */
209.77 - public Repeater(int repeatCount, long repeatTimeout) {
209.78 - this.repeatCount = repeatCount;
209.79 - this.repeatTimeout = repeatTimeout;
209.80 - }
209.81 -
209.82 - /**
209.83 - * Trys to perform action() several attempts, if any errors are
209.84 - * thrown, tryis to repeat it until specified repeat number of
209.85 - * attempts is reached
209.86 - */
209.87 - public void tryAction() {
209.88 - boolean success = false;
209.89 - for(int i = 0; !success && i < repeatCount; i++) {
209.90 - try {
209.91 - action();
209.92 - success = true;
209.93 - } catch (Error e) {
209.94 - JemmyProperties.getCurrentOutput().printTrace("Attempt = " + (i + 1) + " failed with the following error:");
209.95 - e.printStackTrace(JemmyProperties.getCurrentOutput().getOutput());
209.96 - // We re-throw exception if this is the last attempt
209.97 - if (i == repeatCount - 1) throw e;
209.98 - new Timeout("repeatTimeout", repeatTimeout).sleep();
209.99 - } catch (RuntimeException re) {
209.100 - JemmyProperties.getCurrentOutput().printTrace("Attempt = " + (i + 1) + " failed with the following exception:");
209.101 - re.printStackTrace(JemmyProperties.getCurrentOutput().getOutput());
209.102 - // We re-throw exception if this is the last attempt
209.103 - if (i == repeatCount - 1) throw re;
209.104 - new Timeout("repeatTimeout", repeatTimeout).sleep();
209.105 - }
209.106 - }
209.107 - }
209.108 -
209.109 - /**
209.110 - * Trys to perform action() several attempts, if any errors are
209.111 - * thrown, tryis to repeat it until specified repeatCount number of
209.112 - * attempts is reached
209.113 - * @param repeatCount Number of attempts to perform
209.114 - */
209.115 - public void tryAction(int repeatCount) {
209.116 - this.repeatCount = repeatCount;
209.117 - tryAction();
209.118 - }
209.119 -
209.120 - /**
209.121 - * Trys to perform action() several attempts, if any errors are
209.122 - * thrown, tryis to repeat it until specified repeatCount number of
209.123 - * attempts is reached. Uses specified repeatTimeout between attempts
209.124 - * @param repeatCount Number of attempts to perform
209.125 - * @param repeatTimeout Timeout between attempts
209.126 - */
209.127 - public void tryAction(int repeatCount, long repeatTimeout) {
209.128 - this.repeatCount = repeatCount;
209.129 - this.repeatTimeout = repeatTimeout;
209.130 - tryAction();
209.131 - }
209.132 -
209.133 - /**
209.134 - * Action to perform. Implement it in your anonymous class
209.135 - */
209.136 - public void action() {
209.137 - JemmyProperties.getCurrentOutput().printTrace("Repeater: Nothing set to do!");
209.138 - }
209.139 -}
210.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/StartStopDialogOperator.java Thu Jul 10 04:29:52 2008 -0700
210.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
210.3 @@ -1,149 +0,0 @@
210.4 -/*
210.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
210.6 -*
210.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
210.8 -*
210.9 -* The contents of this file are subject to the terms of either the GNU
210.10 -* General Public License Version 2 only ("GPL") or the Common
210.11 -* Development and Distribution License("CDDL") (collectively, the
210.12 -* "License"). You may not use this file except in compliance with the
210.13 -* License. You can obtain a copy of the License at
210.14 -* http://www.netbeans.org/cddl-gplv2.html
210.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
210.16 -* specific language governing permissions and limitations under the
210.17 -* License. When distributing the software, include this License Header
210.18 -* Notice in each file and include the License file at
210.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
210.20 -* particular file as subject to the "Classpath" exception as provided
210.21 -* by Sun in the GPL Version 2 section of the License file that
210.22 -* accompanied this code. If applicable, add the following below the
210.23 -* License Header, with the fields enclosed by brackets [] replaced by
210.24 -* your own identifying information:
210.25 -* "Portions Copyrighted [year] [name of copyright owner]"
210.26 -*
210.27 -* Contributor(s):
210.28 -*
210.29 -* The Original Software is NetBeans. The Initial Developer of the Original
210.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
210.31 -* Microsystems, Inc. All Rights Reserved.
210.32 -*
210.33 -* If you wish your version of this file to be governed by only the CDDL
210.34 -* or only the GPL Version 2, indicate your decision by adding
210.35 -* "[Contributor] elects to include this software in this distribution
210.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
210.37 -* single choice of license, a recipient has the option to distribute
210.38 -* your version of this file under either the CDDL, the GPL Version 2 or
210.39 -* to extend the choice of license to its licensees as provided above.
210.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
210.41 -* Version 2 license, then the option applies only if the new code is
210.42 -* made subject to such option by the copyright holder.
210.43 -*/
210.44 -
210.45 -package org.netbeans.modules.visualweb.gravy;
210.46 -
210.47 -import java.awt.Component;
210.48 -import java.awt.Container;
210.49 -import javax.swing.JFrame;
210.50 -import org.netbeans.jemmy.ComponentChooser;
210.51 -import org.netbeans.jemmy.ComponentSearcher;
210.52 -import org.netbeans.jemmy.JemmyProperties;
210.53 -import org.netbeans.jemmy.operators.JCheckBoxOperator;
210.54 -import org.netbeans.jemmy.operators.JFrameOperator;
210.55 -import org.netbeans.jemmy.operators.JLabelOperator;
210.56 -import org.netbeans.jemmy.operators.JButtonOperator;
210.57 -
210.58 -/**
210.59 - * This class is used in automated tests, developed for Creator 2.0/2.1, for launching
210.60 - * and shutting down of an application server, included into these products.
210.61 - */
210.62 -public class StartStopDialogOperator extends JFrameOperator {
210.63 - JCheckBoxOperator autoHide;
210.64 -
210.65 - /**
210.66 - * Creates a new instance of this class.
210.67 - */
210.68 - public StartStopDialogOperator() {
210.69 - super(new StartStopDialogFinder());
210.70 - copyEnvironment(Util.getMainWindow());
210.71 - getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 600000);
210.72 - getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 600000);
210.73 - }
210.74 -
210.75 - /**
210.76 - * Initializes and returns a checkbox "Autohide"
210.77 - * @return an object JCheckBoxOperator
210.78 - */
210.79 - public JCheckBoxOperator chbAutoHide() {
210.80 - if(autoHide == null) {
210.81 - autoHide = new JCheckBoxOperator(this, "Automatically close this window when finished");
210.82 - }
210.83 - return(autoHide);
210.84 - }
210.85 -
210.86 - /**
210.87 - * Marks or unmarks a checkbox "Auto Hide".
210.88 - * @param isAutoHide boolean value, which defines if a checkbox "Auto Hide"
210.89 - * is marked or not.
210.90 - */
210.91 - public void setAutoHide(boolean isAutoHide) {
210.92 - chbAutoHide().changeSelection(isAutoHide);
210.93 - }
210.94 -
210.95 - /**
210.96 - * Waits until the required string appears in the dialog.
210.97 - * @param status string, which is waited in the dialog
210.98 - * @return an object JLabelOperator
210.99 - */
210.100 - public JLabelOperator waitStatus(String status) {
210.101 - return(new JLabelOperator(this, status));
210.102 - }
210.103 -
210.104 - /**
210.105 - * Waits until the string "Completed" appears in the dialog.
210.106 - * @return an object JLabelOperator
210.107 - */
210.108 - public JLabelOperator waitCompleted() {
210.109 - return(waitStatus("Completed"));
210.110 - }
210.111 -
210.112 - /**
210.113 - * Launches an application server.
210.114 - */
210.115 - public void start(String action) {
210.116 - new JButtonOperator(this, "Start Server").push();
210.117 - }
210.118 -
210.119 - /**
210.120 - * Shuts an application server down.
210.121 - */
210.122 - public void stop(String action) {
210.123 - new JButtonOperator(this, "Stop Server").push();
210.124 - }
210.125 -
210.126 - /**
210.127 - * Inner class, which is used for searching of a "Start/Stop-dialog" in
210.128 - * Creator's IDE.
210.129 - */
210.130 - public static class StartStopDialogFinder implements ComponentChooser {
210.131 - /**
210.132 - * Searches a component "Start/Stop-dialog" in Creator's IDE
210.133 - * @return true if dialog is found, otherwise - false.
210.134 - */
210.135 - public boolean checkComponent(Component comp) {
210.136 - ComponentSearcher searcher = new ComponentSearcher((Container)comp);
210.137 - searcher.setOutput(JemmyProperties.getCurrentOutput().createErrorOutput());
210.138 - return(comp instanceof JFrame &&
210.139 - searcher.findComponent(new ComponentChooser() {
210.140 - public boolean checkComponent(Component comp) {
210.141 - return(comp.getClass().getName().startsWith("Server Status"));
210.142 - }
210.143 - public String getDescription() {
210.144 - return("ProgressUI");
210.145 - }
210.146 - }) != null);
210.147 - }
210.148 - public String getDescription() {
210.149 - return("StartStop dialog");
210.150 - }
210.151 - }
210.152 -}
211.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/StatusWaitable.java Thu Jul 10 04:29:52 2008 -0700
211.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
211.3 @@ -1,168 +0,0 @@
211.4 -/*
211.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
211.6 -*
211.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
211.8 -*
211.9 -* The contents of this file are subject to the terms of either the GNU
211.10 -* General Public License Version 2 only ("GPL") or the Common
211.11 -* Development and Distribution License("CDDL") (collectively, the
211.12 -* "License"). You may not use this file except in compliance with the
211.13 -* License. You can obtain a copy of the License at
211.14 -* http://www.netbeans.org/cddl-gplv2.html
211.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
211.16 -* specific language governing permissions and limitations under the
211.17 -* License. When distributing the software, include this License Header
211.18 -* Notice in each file and include the License file at
211.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
211.20 -* particular file as subject to the "Classpath" exception as provided
211.21 -* by Sun in the GPL Version 2 section of the License file that
211.22 -* accompanied this code. If applicable, add the following below the
211.23 -* License Header, with the fields enclosed by brackets [] replaced by
211.24 -* your own identifying information:
211.25 -* "Portions Copyrighted [year] [name of copyright owner]"
211.26 -*
211.27 -* Contributor(s):
211.28 -*
211.29 -* The Original Software is NetBeans. The Initial Developer of the Original
211.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
211.31 -* Microsystems, Inc. All Rights Reserved.
211.32 -*
211.33 -* If you wish your version of this file to be governed by only the CDDL
211.34 -* or only the GPL Version 2, indicate your decision by adding
211.35 -* "[Contributor] elects to include this software in this distribution
211.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
211.37 -* single choice of license, a recipient has the option to distribute
211.38 -* your version of this file under either the CDDL, the GPL Version 2 or
211.39 -* to extend the choice of license to its licensees as provided above.
211.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
211.41 -* Version 2 license, then the option applies only if the new code is
211.42 -* made subject to such option by the copyright holder.
211.43 -*/
211.44 -
211.45 -package org.netbeans.modules.visualweb.gravy;
211.46 -
211.47 -import org.netbeans.jemmy.Waitable;
211.48 -import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
211.49 -
211.50 -/**
211.51 - * This class is used for observation of status of some component.
211.52 - */
211.53 -public class StatusWaitable implements Waitable {
211.54 - private String[] variants;
211.55 - private String valid;
211.56 - private boolean exactMatch;
211.57 - private boolean thread;
211.58 -
211.59 - /**
211.60 - * Creates an instance of this class.
211.61 - * @param variants an array of Strings, which could appear in an observable component.
211.62 - */
211.63 - public StatusWaitable(String[] variants) {
211.64 - this.variants = variants;
211.65 - this.exactMatch = true;
211.66 - this.thread = false;
211.67 - }
211.68 -
211.69 - /**
211.70 - * Creates an instance of this class.
211.71 - * @param variants an array of Strings, which could appear in an observable component.
211.72 - * @param isExact a boolean value, which defines a mode of String comparison:
211.73 - * true means using of the method equals(), false means using of the method indexOf().
211.74 - */
211.75 - public StatusWaitable(String[] variants, boolean isExact) {
211.76 - this.variants = variants;
211.77 - this.exactMatch = isExact;
211.78 - this.thread = false;
211.79 - }
211.80 -
211.81 - /**
211.82 - * Creates an instance of this class.
211.83 - * @param variant1 a string, which could appear in an observable component.
211.84 - * @param variant2 a string, which could appear in an observable component.
211.85 - */
211.86 - public StatusWaitable(String variant1, String variant2) {
211.87 - this.variants = new String[] {variant1, variant2};
211.88 - this.exactMatch = false;
211.89 - this.thread = true;
211.90 - }
211.91 -
211.92 - /**
211.93 - * Creates an instance of this class.
211.94 - * @param variant1 a string, which could appear in an observable component.
211.95 - * @param variant2 a string, which could appear in an observable component.
211.96 - * @param variant3 a string, which could appear in an observable component.
211.97 - */
211.98 - public StatusWaitable(String variant1, String variant2, String variant3) {
211.99 - this.variants = new String[] {variant1, variant2, variant3};
211.100 - this.exactMatch = false;
211.101 - this.thread = true;
211.102 - }
211.103 -
211.104 - /**
211.105 - * Checks if wait criteria have been met.
211.106 - * @param o optional waiting parameter.
211.107 - * @return null if criteria has not been met.
211.108 - */
211.109 - public Object actionProduced(Object o) {
211.110 - if(exactMatch){
211.111 - for(int i=0;i<variants.length;i++) {
211.112 - if (variants[i].equals(getStatusText())) {
211.113 - valid = variants[i];
211.114 - return Boolean.TRUE;
211.115 - }
211.116 - }
211.117 - }else{
211.118 - if(thread){
211.119 - String status = getStatusText();
211.120 - if(status.startsWith(variants[0])){
211.121 - int index = status.lastIndexOf(variants[1]);
211.122 - int index1 = 0;
211.123 - if(variants.length==3) index1 = status.lastIndexOf(variants[2]);
211.124 - if(index+variants[1].length() == status.length()){
211.125 - return Boolean.TRUE;
211.126 - }
211.127 - if(variants.length==3) if(index1+variants[2].length() == status.length()){
211.128 - return Boolean.TRUE;
211.129 - }
211.130 - }
211.131 - }else{
211.132 - for(int i=0;i<variants.length;i++) {
211.133 - if (getStatusText().indexOf(variants[i])!=-1) {
211.134 - valid = variants[i];
211.135 - return Boolean.TRUE;
211.136 - }
211.137 - }
211.138 - }
211.139 - }
211.140 - return null;
211.141 - }
211.142 -
211.143 - /**
211.144 - * Returns description.
211.145 - * @return a text description of the wait criteria.
211.146 - */
211.147 - public String getDescription() {
211.148 - String dsc = "";
211.149 - for(int i=0;i<variants.length;i++) {
211.150 - dsc+=variants[i] + "|";
211.151 - }
211.152 - return "Variants = " + dsc;
211.153 - }
211.154 -
211.155 - /**
211.156 - * Returns current status of an observable component.
211.157 - * @return a text corresponding to current status.
211.158 - */
211.159 - public String getStatus() {
211.160 - return valid;
211.161 - }
211.162 -
211.163 - /**
211.164 - * Returns current text from status line of the IDE's main window.
211.165 - * @return a text from IDE's status line.
211.166 - */
211.167 - private String getStatusText() {
211.168 - String s = (Util.getMainWindow()).getStatusText();
211.169 - return (s == null) ? "" : s;
211.170 - }
211.171 -}
212.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/TestProperties.java Thu Jul 10 04:29:52 2008 -0700
212.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
212.3 @@ -1,113 +0,0 @@
212.4 -/*
212.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
212.6 -*
212.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
212.8 -*
212.9 -* The contents of this file are subject to the terms of either the GNU
212.10 -* General Public License Version 2 only ("GPL") or the Common
212.11 -* Development and Distribution License("CDDL") (collectively, the
212.12 -* "License"). You may not use this file except in compliance with the
212.13 -* License. You can obtain a copy of the License at
212.14 -* http://www.netbeans.org/cddl-gplv2.html
212.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
212.16 -* specific language governing permissions and limitations under the
212.17 -* License. When distributing the software, include this License Header
212.18 -* Notice in each file and include the License file at
212.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
212.20 -* particular file as subject to the "Classpath" exception as provided
212.21 -* by Sun in the GPL Version 2 section of the License file that
212.22 -* accompanied this code. If applicable, add the following below the
212.23 -* License Header, with the fields enclosed by brackets [] replaced by
212.24 -* your own identifying information:
212.25 -* "Portions Copyrighted [year] [name of copyright owner]"
212.26 -*
212.27 -* Contributor(s):
212.28 -*
212.29 -* The Original Software is NetBeans. The Initial Developer of the Original
212.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
212.31 -* Microsystems, Inc. All Rights Reserved.
212.32 -*
212.33 -* If you wish your version of this file to be governed by only the CDDL
212.34 -* or only the GPL Version 2, indicate your decision by adding
212.35 -* "[Contributor] elects to include this software in this distribution
212.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
212.37 -* single choice of license, a recipient has the option to distribute
212.38 -* your version of this file under either the CDDL, the GPL Version 2 or
212.39 -* to extend the choice of license to its licensees as provided above.
212.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
212.41 -* Version 2 license, then the option applies only if the new code is
212.42 -* made subject to such option by the copyright holder.
212.43 -*/
212.44 -
212.45 -package org.netbeans.modules.visualweb.gravy;
212.46 -
212.47 -import java.io.*;
212.48 -import java.util.Properties;
212.49 -
212.50 -/**
212.51 - * This class is used as storage of various test properties, which can be loaded
212.52 - * from a file and saved to a file.
212.53 - */
212.54 -public class TestProperties {
212.55 - Properties props;
212.56 - String propFile;
212.57 -
212.58 - /**
212.59 - * Creates a new instance of this class and loads properties from a file.
212.60 - */
212.61 - public TestProperties() {
212.62 - props = new Properties();
212.63 - loadProps();
212.64 - }
212.65 -
212.66 - /**
212.67 - * Returns current set of test properties.
212.68 - * @return an object Properties
212.69 - */
212.70 - protected Properties getTestProperties() {
212.71 - return(props);
212.72 - }
212.73 -
212.74 - /**
212.75 - * Returns a value of required property.
212.76 - * @param key a name of required property
212.77 - * @return a value of required property (an object String)
212.78 - */
212.79 - public String getTestProperty(String key) {
212.80 - return(props.getProperty(key));
212.81 - }
212.82 -
212.83 - /**
212.84 - * Returns a value of required property.
212.85 - * @param key a name of required property
212.86 - * @return a value of required property (an object String)
212.87 - */
212.88 - public Object setTestProperty(String key, String value) {
212.89 - Object retValue = props.setProperty(key, value);
212.90 - saveProps();
212.91 - return(retValue);
212.92 - }
212.93 -
212.94 - /**
212.95 - * Loads test properties from file.
212.96 - */
212.97 - private void loadProps() {
212.98 - try{
212.99 - propFile = System.getProperty("xtest.workdir") + File.separator + "TestProperties";
212.100 - props.load(new FileInputStream(propFile));
212.101 - } catch(IOException e) {
212.102 - //do nothing
212.103 - }
212.104 - }
212.105 -
212.106 - /**
212.107 - * Stores all test properties to file.
212.108 - */
212.109 - private void saveProps() {
212.110 - try{
212.111 - props.store(new FileOutputStream(propFile), "Rave test properties");
212.112 - } catch(IOException e) {
212.113 - //do nothing
212.114 - }
212.115 - }
212.116 -}
213.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/TestUtils.java Thu Jul 10 04:29:52 2008 -0700
213.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
213.3 @@ -1,1351 +0,0 @@
213.4 -/*
213.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
213.6 - *
213.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
213.8 - *
213.9 - * The contents of this file are subject to the terms of either the GNU
213.10 - * General Public License Version 2 only ("GPL") or the Common
213.11 - * Development and Distribution License("CDDL") (collectively, the
213.12 - * "License"). You may not use this file except in compliance with the
213.13 - * License. You can obtain a copy of the License at
213.14 - * http://www.netbeans.org/cddl-gplv2.html
213.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
213.16 - * specific language governing permissions and limitations under the
213.17 - * License. When distributing the software, include this License Header
213.18 - * Notice in each file and include the License file at
213.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
213.20 - * particular file as subject to the "Classpath" exception as provided
213.21 - * by Sun in the GPL Version 2 section of the License file that
213.22 - * accompanied this code. If applicable, add the following below the
213.23 - * License Header, with the fields enclosed by brackets [] replaced by
213.24 - * your own identifying information:
213.25 - * "Portions Copyrighted [year] [name of copyright owner]"
213.26 - *
213.27 - * Contributor(s):
213.28 - *
213.29 - * The Original Software is NetBeans. The Initial Developer of the Original
213.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
213.31 - * Microsystems, Inc. All Rights Reserved.
213.32 - *
213.33 - * If you wish your version of this file to be governed by only the CDDL
213.34 - * or only the GPL Version 2, indicate your decision by adding
213.35 - * "[Contributor] elects to include this software in this distribution
213.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
213.37 - * single choice of license, a recipient has the option to distribute
213.38 - * your version of this file under either the CDDL, the GPL Version 2 or
213.39 - * to extend the choice of license to its licensees as provided above.
213.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
213.41 - * Version 2 license, then the option applies only if the new code is
213.42 - * made subject to such option by the copyright holder.
213.43 - */
213.44 -
213.45 -package org.netbeans.modules.visualweb.gravy;
213.46 -
213.47 -import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
213.48 -import java.nio.charset.MalformedInputException;
213.49 -import javax.swing.tree.TreePath;
213.50 -import org.netbeans.jellytools.Bundle;
213.51 -import org.netbeans.jellytools.NewProjectWizardOperator;
213.52 -import org.netbeans.jellytools.TopComponentOperator;
213.53 -import org.netbeans.modules.visualweb.gravy.debugger.BuildOutputOperator;
213.54 -import org.netbeans.modules.visualweb.gravy.welcome.WelcomeOperator;
213.55 -import org.netbeans.modules.visualweb.gravy.actions.CloseProjectAction;
213.56 -import java.awt.*;
213.57 -import java.awt.event.*;
213.58 -import java.io.*;
213.59 -import java.util.Date;
213.60 -import java.util.Properties;
213.61 -import java.text.SimpleDateFormat;
213.62 -import java.net.URL;
213.63 -import org.netbeans.modules.visualweb.gravy.properties.Property;
213.64 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetTabOperator;
213.65 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
213.66 -import org.netbeans.modules.visualweb.gravy.designer.*;
213.67 -import javax.swing.*;
213.68 -import org.netbeans.jemmy.*;
213.69 -import org.netbeans.jemmy.drivers.*;
213.70 -import org.netbeans.jemmy.drivers.input.*;
213.71 -import org.netbeans.jemmy.operators.*;
213.72 -import com.meterware.httpunit.*;
213.73 -import java.util.Enumeration;
213.74 -import java.util.zip.ZipEntry;
213.75 -import java.util.zip.ZipFile;
213.76 -import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
213.77 -import org.netbeans.jellytools.OutputOperator;
213.78 -import org.openide.windows.TopComponent;
213.79 -
213.80 -/**
213.81 - * TestUtils class
213.82 - * @author Vladimir Strigun (sva@sparc.spb.su)
213.83 - */
213.84 -
213.85 -public class TestUtils {
213.86 -
213.87 - public static final String KEY_STRING_AFTER_PRJ_NAME_J2EE = "src",
213.88 - KEY_STRING_AFTER_PRJ_NAME_JSF = "web";
213.89 - private static final String SAVE_DIALOG_TITLE = "Save";
213.90 - private static final String SAVE_ALL = "Save All";
213.91 - //public static final String SAVE_ALL = Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_SaveAllAction");
213.92 - private static final String CLOSE_PROJECT = "Close";
213.93 - //public static final String CLOSE_PROJECT = Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_CloseProjectAction");
213.94 -
213.95 - private static String delim = "|";
213.96 - private static String fSep = System.getProperty("file.separator");
213.97 -
213.98 - private static String pathLastCreatedProject;
213.99 -
213.100 - private static final String LBL_VWJSF = "Visual Web JavaServer Faces";
213.101 -
213.102 - /** Create new Project with given name
213.103 - * @param projectName - Project's name
213.104 - */
213.105 - public static void createNewProject(String projectName){
213.106 -
213.107 - createNewProjectAbsoluteLocation(null,projectName);
213.108 - }
213.109 -
213.110 - /** Create new Project with name included time stamp
213.111 - * @param projectName - Project's name
213.112 - */
213.113 - public static void createNewProjectTimeStamped(String projectName){
213.114 - createNewProject( projectName+"_"+getCurrentDateAndTimeAsString());
213.115 - }
213.116 -
213.117 - /** Create new Project with given name and relative location
213.118 - * @param location - relative location
213.119 - * @param projectName - Project's name
213.120 - */
213.121 -
213.122 - public static void createNewProjectLocation(String location, String projectName){
213.123 -
213.124 - createNewProjectLoc(location,projectName,false);
213.125 - }
213.126 -
213.127 - /** Create new Project with given name and absolute location
213.128 - * @param location - absolute location
213.129 - * @param projectName - Project's name
213.130 - */
213.131 -
213.132 - public static void createNewProjectAbsoluteLocation(String location, String projectName){
213.133 -
213.134 - createNewProjectLoc(location,projectName,true);
213.135 - }
213.136 -
213.137 - public static String createNewPortletProjectLoc(String location, String projectName,
213.138 - boolean absoluteLocation, String projectCategory, String projectType) {
213.139 - NewProjectWizardOperator po=NewProjectWizardOperator.invoke();
213.140 -
213.141 - //need to wait for a list containing project
213.142 - Waiter projectListWaiter = new Waiter(new Waitable() {
213.143 - public Object actionProduced(Object po) {
213.144 - JList projList =
213.145 - (JList)((ContainerOperator)po).
213.146 - findSubComponent(new JListOperator.JListFinder(), 1);
213.147 - JListOperator projListOper = new JListOperator(projList);
213.148 - projListOper.copyEnvironment((ComponentOperator)po);
213.149 - /*return((projListOper.findItemIndex(Bundle.getString(
213.150 - "com.sun.rave.project.nbbridge.Bundle",
213.151 - "Templates/Project/Web/raveform.xml")) == -1) ? null : "");*/
213.152 - //return((projListOper.findItemIndex("Application") == -1) ? null : "");
213.153 - if ((projListOper.findItemIndex("Application") == -1)&&(projListOper.findItemIndex("Travel") == -1))
213.154 - return null;
213.155 - else return "";
213.156 - }
213.157 - public String getDescription() {
213.158 - return("Project list to be displayed");
213.159 - }
213.160 - });
213.161 - wait(1000);
213.162 -
213.163 - /* select the categroy */
213.164 - po.selectCategory(projectCategory);
213.165 - projectListWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 180000);
213.166 - try {
213.167 - projectListWaiter.waitAction(po);
213.168 - } catch(InterruptedException e) {}
213.169 - /* Select project type */
213.170 - //po.selectProject(Bundle.getString("com.sun.rave.project.nbbridge.Bundle", "Templates/Project/Web/raveform.xml"));
213.171 - po.selectProject(projectType);
213.172 - wait(1000);
213.173 - po.next();
213.174 - wait(2000);
213.175 - if (projectName != null) {
213.176 - new JTextFieldOperator(po).setText(projectName);
213.177 - } else {
213.178 - projectName = new JTextFieldOperator(po).getText();
213.179 - }
213.180 - if (location != null) {
213.181 - if (!absoluteLocation){
213.182 - location=new JTextFieldOperator(po, 1).getText() + "/" + location;
213.183 - }
213.184 - new JTextFieldOperator(po,1).setText(location);
213.185 - } else {
213.186 - location = new JTextFieldOperator(po, 1).getText();
213.187 - }
213.188 - pathLastCreatedProject = location;
213.189 -
213.190 - wait(1000);
213.191 - po.next();
213.192 - wait(2000);
213.193 -
213.194 - po.finish();
213.195 -
213.196 - String timeoutName = "DialogWaiter.WaitDialogTimeout";
213.197 - long timeoutValue = JemmyProperties.getCurrentTimeout(timeoutName);
213.198 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, 8000);
213.199 - try {
213.200 - new JButtonOperator(new JDialogOperator("Question"), "Yes").pushNoBlock();
213.201 - } catch(Exception e) {
213.202 - } finally {
213.203 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
213.204 - timeoutValue);
213.205 - }
213.206 -
213.207 - Util.getMainWindow().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 60000);//project creation time
213.208 - //disableBrowser(projectName, true);
213.209 -
213.210 - disableBrowser(projectName, location, true);
213.211 - return projectName;
213.212 - }
213.213 - @Deprecated
213.214 - public static String createNewJSFProject() {
213.215 - return createNewJSFProject(null); // use default name
213.216 - }
213.217 - @Deprecated
213.218 - public static String createNewJSFProject(String projectName) {
213.219 - return createNewProjectLoc(null, projectName, true,
213.220 - "Web"/*Bundle.getStringTrimmed("com.sun.rave.jsf.project.Bundle",
213.221 - "OpenIDE-Module-Display-Category")*/,
213.222 - "Web Application"/*Bundle.getStringTrimmed("com.sun.rave.jsf.project.ui.wizards.Bundle",
213.223 - "Templates/Project/Web/emptyJsf.xml")*/);
213.224 - }
213.225 -
213.226 - /**
213.227 - * Creates project with J2EE 1.4 and default source structure
213.228 - * @param location Project's location, if null then default location used
213.229 - * @param projectName Project's name, if null then default name used
213.230 - * @param absoluteLocation absolute or relative location
213.231 - * @param projectCategory Category of the project (General, Web, etc.)
213.232 - * @param projectType Type of the project of the given category
213.233 - * @return Name of the Created project
213.234 - *
213.235 - */
213.236 - public static String createNewProjectLoc(String location, String projectName,
213.237 - boolean absoluteLocation, String projectCategory, String projectType) {
213.238 - projectName = createNewProject(location, projectName, absoluteLocation, projectCategory, projectType, null, "J2EE 1.4");
213.239 - return projectName;
213.240 - }
213.241 -
213.242 - /**
213.243 - * Creates JAVA EE 5 project with default source level
213.244 - * @param location Project's location, if null then default location used
213.245 - * @param projectName Project's name, if null then default name used
213.246 - * @param absoluteLocation absolute or relative location
213.247 - * @param projectCategory Category of the project (General, Web, etc.)
213.248 - * @param projectType Type of the project of the given category
213.249 - * @return Name of the Created project
213.250 - */
213.251 - public static String createJavaEE5ProjectLoc(String location, String projectName,
213.252 - boolean absoluteLocation, String projectCategory, String projectType) {
213.253 - projectName = createNewProject(location, projectName, absoluteLocation, projectCategory, projectType, null, "Java EE 5");
213.254 - return projectName;
213.255 - }
213.256 -
213.257 - /**
213.258 - * Creating project
213.259 - * @param location Project's location, if null then default location used
213.260 - * @param projectName Project's name, if null then default name used
213.261 - * @param absoluteLocation absolute or relative location
213.262 - * @param projectCategory Category of the project (General, Web, etc.)
213.263 - * @param projectType Type of the project of the given category, i.e. Web Application
213.264 - * @param sourceStructure source structure (Java BluePrints, Jakarta), if null
213.265 - * then currently selected used
213.266 - * @param J2EELevel (Java EE 5, J2EE 1.4, J2EE 1.3), if null then currently selected used
213.267 - * @return Name of the Created project
213.268 - */
213.269 - public static String createNewProject(
213.270 - String location,
213.271 - String projectName,
213.272 - boolean absoluteLocation,
213.273 - String projectCategory,
213.274 - String projectType,
213.275 - String sourceStructure,
213.276 - String J2EELevel) {
213.277 - projectName = createNewProject(location, projectName, absoluteLocation,
213.278 - projectCategory, projectType, sourceStructure, J2EELevel, null);
213.279 - return projectName;
213.280 - }
213.281 -
213.282 - /**
213.283 - * Creating project
213.284 - * @param location Project's location, if null then default location used
213.285 - * @param projectName Project's name, if null then default name used
213.286 - * @param absoluteLocation absolute or relative location
213.287 - * @param projectCategory Category of the project (General, Web, etc.)
213.288 - * @param projectType Type of the project of the given category, i.e. Web Application
213.289 - * @param sourceStructure source structure (Java BluePrints, Jakarta), if null
213.290 - * then currently selected used
213.291 - * @param J2EELevel (Java EE 5, J2EE 1.4, J2EE 1.3), if null then currently selected used
213.292 - * @param server deployment target, if null then default application server used
213.293 - * @return Name of the Created project
213.294 - */
213.295 - public static String createNewProject(
213.296 - String location,
213.297 - String projectName,
213.298 - boolean absoluteLocation,
213.299 - String projectCategory,
213.300 - String projectType,
213.301 - String sourceStructure,
213.302 - String J2EELevel,
213.303 - String server) {
213.304 - new Operator.DefaultStringComparator(true, true);
213.305 - NewProjectWizardOperator po=NewProjectWizardOperator.invoke();
213.306 -
213.307 - //need to wait for a list containing project
213.308 - Waiter projectListWaiter = new Waiter(new Waitable() {
213.309 - public Object actionProduced(Object po) {
213.310 - JList projList =
213.311 - (JList)((ContainerOperator)po).
213.312 - findSubComponent(new JListOperator.JListFinder(), 1);
213.313 - JListOperator projListOper = new JListOperator(projList);
213.314 - projListOper.copyEnvironment((ComponentOperator)po);
213.315 - /*return((projListOper.findItemIndex(Bundle.getString(
213.316 - "com.sun.rave.project.nbbridge.Bundle",
213.317 - "Templates/Project/Web/raveform.xml")) == -1) ? null : "");*/
213.318 - //return((projListOper.findItemIndex("Application") == -1) ? null : "");
213.319 - if ((projListOper.findItemIndex("Application") == -1)&&(projListOper.findItemIndex("Travel") == -1))
213.320 - return null;
213.321 - else return "";
213.322 - }
213.323 - public String getDescription() {
213.324 - return("Project list to be displayed");
213.325 - }
213.326 - });
213.327 - wait(1000);
213.328 -
213.329 - /* select Web categroy */
213.330 - po.selectCategory(projectCategory);
213.331 - projectListWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 180000);
213.332 - try {
213.333 - projectListWaiter.waitAction(po);
213.334 - } catch(InterruptedException e) {}
213.335 - /* Select project type */
213.336 - //po.selectProject(Bundle.getString("com.sun.rave.project.nbbridge.Bundle", "Templates/Project/Web/raveform.xml"));
213.337 - Operator.StringComparator comparator = po.getComparator();
213.338 - Operator.StringComparator stringComparator = new Operator.DefaultStringComparator(true, true);
213.339 - po.setComparator(stringComparator);
213.340 - wait(1000);
213.341 - po.selectProject(projectType);
213.342 - wait(2000);
213.343 - po.setComparator(comparator);
213.344 - wait(1000);
213.345 -
213.346 - po.next();
213.347 - wait(2000);
213.348 - if (projectName != null) {
213.349 - new JTextFieldOperator(po, 0).typeText(projectName);
213.350 - } else {
213.351 - projectName = new JTextFieldOperator(po, 0).getText();
213.352 - }
213.353 - if (location != null) {
213.354 - if (!absoluteLocation){
213.355 - location=new JTextFieldOperator(po, 2).getText() + "/" + location;
213.356 - }
213.357 - new JTextFieldOperator(po, 2).setText(location);
213.358 - } else {
213.359 - location = new JTextFieldOperator(po, 2).getText();
213.360 - }
213.361 - pathLastCreatedProject = location;
213.362 -
213.363 - //Setting source structure (Blue Prints or Jakarta)
213.364 - //if (sourceStructure!=null) {
213.365 - // new JComboBoxOperator(po, 0).selectItem(sourceStructure);
213.366 - //}
213.367 -
213.368 - po.next();
213.369 - wait(2000);
213.370 - //Setting Server
213.371 - if (server != null) {
213.372 - new JComboBoxOperator(po, 0).selectItem(server);
213.373 - }
213.374 -
213.375 - wait(1000);
213.376 - //Setting level of J2EE
213.377 - if (J2EELevel != null) {
213.378 - new JComboBoxOperator(po, 1).selectItem(J2EELevel);
213.379 - }
213.380 - wait(1000);
213.381 - if (new JButtonOperator(po, "Next").isEnabled()) {
213.382 - po.next();
213.383 - wait(1000);
213.384 - //Setting "Visual Web JavaServer Faces" framework
213.385 - JTableOperator tlbFrameworks = new JTableOperator(po);
213.386 - Point VWcell = tlbFrameworks.findCell(LBL_VWJSF, 1);
213.387 - tlbFrameworks.selectCell(VWcell.y, VWcell.x);
213.388 - wait(2000);
213.389 - }
213.390 - po.finish();
213.391 - String timeoutName = "DialogWaiter.WaitDialogTimeout";
213.392 - long timeoutValue = JemmyProperties.getCurrentTimeout(timeoutName);
213.393 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, 10000);
213.394 - Waiter waitProjectPropertiesDialog = new Waiter(new Waitable() {
213.395 - public Object actionProduced(Object obj) {
213.396 - try {
213.397 - new JButtonOperator(new JDialogOperator("Edit Project Properties"), "Regenerate").push();
213.398 - return null;
213.399 - }catch(TimeoutExpiredException e) {
213.400 - return true;
213.401 - }
213.402 -
213.403 - }
213.404 -
213.405 - public String getDescription() {
213.406 - return "Wait all dialogs";
213.407 - }
213.408 - });
213.409 - waitProjectPropertiesDialog.getTimeouts().setTimeout("Waiter.WaitingTime", 60000);
213.410 - try {
213.411 - waitProjectPropertiesDialog.waitAction(null);
213.412 - } catch(Exception e) {
213.413 - e.printStackTrace();
213.414 - } finally {
213.415 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
213.416 - timeoutValue);
213.417 - }
213.418 - /*
213.419 - try {
213.420 - for (int i = 0 ;i<5; i++) {
213.421 - new JButtonOperator(new JDialogOperator("Edit Project Properties"), "Cancel").pushNoBlock();
213.422 - }
213.423 - } catch(Exception e) {
213.424 - } finally {
213.425 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
213.426 - timeoutValue);
213.427 - }
213.428 - */
213.429 - //wait(20000);
213.430 - //Util.getMainWindow().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 60000);//project creation time
213.431 -
213.432 -
213.433 - //new TopComponentOperator("Page1");
213.434 - disableBrowser(projectName, location, true);
213.435 -
213.436 - Waiter projectCreationWaiter = new Waiter(new Waitable() {
213.437 - public Object actionProduced(Object po) {
213.438 - try {
213.439 - int i = 0;
213.440 - PageTopComponentOperator page;
213.441 - while (((String) (page = new PageTopComponentOperator("Page1", i++)).getDump().get("Tooltip text")).indexOf("web" + File.separator + "Page1.jsp") == -1);
213.442 - new DesignerPaneOperator(page);
213.443 - return "";
213.444 - }catch(TimeoutExpiredException e) {
213.445 - return null;
213.446 - }
213.447 - }
213.448 - public String getDescription() {
213.449 - return("Project list to be displayed");
213.450 - }
213.451 - });
213.452 - wait(1000);
213.453 - projectCreationWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 600000);
213.454 - System.out.println("TRACE: Start waiting: "+ getCurrentDateAndTimeAsString());
213.455 - try {
213.456 - projectCreationWaiter.waitAction(null);
213.457 - }catch (Exception e) {
213.458 - // e.printStackTrace();
213.459 - throw new JemmyException("Exception when waiting Page1 opened", e);
213.460 - }
213.461 - System.out.println("TRACE: Stop waiting: "+ getCurrentDateAndTimeAsString());
213.462 - return projectName;
213.463 - }
213.464 -
213.465 -
213.466 - public static String getPathLastCreatedProject() {
213.467 - return pathLastCreatedProject;
213.468 - }
213.469 -
213.470 - public static void openProject(String projectPath, boolean welcomeOperator){
213.471 - if(welcomeOperator) WelcomeOperator.getWelcomeButton(Bundle.getStringTrimmed("com.sun.rave.welcome.Bundle", "LBL_OpenProject")).pushNoBlock();
213.472 - else Util.getMainMenu().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|"
213.473 - + Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle", "LBL_OpenProjectAction"));
213.474 - // String workDir = System.getProperty("scratch.dir").replace('/',File.separatorChar);
213.475 - // workDir+=File.separatorChar+"Creator"+File.separatorChar+projectPath;
213.476 - Util.wait(3000);
213.477 - // (new JTextFieldOperator(new JDialogOperator("Open"))).typeText(workDir);
213.478 - // (new JButtonOperator(new JDialogOperator("Open"), "Open")).push();
213.479 - (new JTextFieldOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), 1)).typeText(projectPath);
213.480 - (new JButtonOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "BTN_PrjChooser_ApproveButtonText"))).push();
213.481 - // DesignerPaneOperator des = new DesignerPaneOperator(Util.getMainTab());
213.482 - // DesignerPaneOperator des = new DesignerPaneOperator();
213.483 - Util.wait(3000);
213.484 - }
213.485 -
213.486 - public static void openProject(String projectPath){
213.487 - /*
213.488 - Util.getMainMenu().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.core.Bundle",
213.489 - "Menu/File")+"|"
213.490 - +Bundle.getStringTrimmed("com.sun.rave.project.actions.Bundle",
213.491 - "LBL_OpenProjectAction"));
213.492 - */
213.493 - Util.getMainMenu().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.core.Bundle",
213.494 - "Menu/File")+"|"
213.495 - +"Open Project");
213.496 -
213.497 - Util.wait(3000);
213.498 - //(new JTextFieldOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), 1)).typeText(projectPath);
213.499 - JDialogOperator openPrjDialog = new JDialogOperator("Open Project");
213.500 -// if (System.getProperty("os.name").equals("Mac OS X")) {
213.501 -// String[] splittedPath = projectPath.substring(1, projectPath.length()).split(File.separator);
213.502 -// TestUtils.wait(1000);
213.503 -// JComboBoxOperator cbRoot = new JComboBoxOperator(openPrjDialog);
213.504 -// for (int i = 0; i < cbRoot.getItemCount(); i++) {
213.505 -// System.out.println("cbRoot.getItemAt(i).toString()=" + cbRoot.getItemAt(i).toString());
213.506 -// TestUtils.wait(500);
213.507 -// if (cbRoot.getItemAt(i).toString().equals(File.separator)) {
213.508 -// cbRoot.setSelectedIndex(i);
213.509 -// break;
213.510 -// }
213.511 -// }
213.512 -// String toCompare = "";
213.513 -// for (int i = 0; i < splittedPath.length; i++) {
213.514 -// JTableOperator jtoPath = new JTableOperator(openPrjDialog);
213.515 -// toCompare += "/" + splittedPath[i];
213.516 -// System.out.println("toComapre="+toCompare);
213.517 -// TestUtils.wait(500);
213.518 -// Point cell = jtoPath.findCell(toCompare, new Operator.DefaultStringComparator(true, true), 0);
213.519 -// jtoPath.clickOnCell((int) cell.getY(), (int) cell.getX());
213.520 -// TestUtils.wait(500);
213.521 -// if (i != splittedPath.length - 1) jtoPath.clickOnCell((int) cell.getY(), (int) cell.getX(), 2);
213.522 -// else new JButtonOperator(openPrjDialog, "Open Project Folder").pushNoBlock();
213.523 -// TestUtils.wait(500);
213.524 -// }
213.525 -// } else {
213.526 - new JTextFieldOperator(openPrjDialog, 1).setText(projectPath);
213.527 - new JButtonOperator(openPrjDialog, "Open Project").push();
213.528 -// }
213.529 - // (new JButtonOperator(new JDialogOperator("Open"), "Open")).push();
213.530 - //(new JButtonOperator(new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "LBL_PrjChooser_Title")), Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "BTN_PrjChooser_ApproveButtonText"))).push();
213.531 - //(new JButtonOperator(openPrjDialog, "Open Project Folder")).push();
213.532 - // DesignerPaneOperator des = new DesignerPaneOperator(Util.getMainTab());
213.533 - // DesignerPaneOperator des = new DesignerPaneOperator();
213.534 - Util.wait(3000);
213.535 - }
213.536 -
213.537 - public static void openWebFormJavaFile(String projectName){
213.538 - // Util.getMainMenu().pushMenu(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View")+delim+Bundle.getStringTrimmed("com.sun.rave.project.Bundle", "LBL_Projects"));
213.539 - Util.getMainMenu().pushMenu(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View")+delim+Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Projects"));
213.540 - final JTreeOperator tree = new JTreeOperator(new ProjectNavigatorOperator());
213.541 - // TreePath treePath = tree.findPath(projectName, "|");
213.542 - // tree.expandPath(treePath);
213.543 - String path = projectName + "|Java Sources|"+projectName.toLowerCase()+"|Page1.java";
213.544 - TreePath treePath = tree.findPath(path, "|");
213.545 - (new JPopupMenuOperator(tree.callPopupOnPath(treePath))).pushMenu("Open");
213.546 - }
213.547 -
213.548 - public static void closeCurrentProject(){
213.549 - try{
213.550 - Util.getMainMenu().pushMenu(
213.551 - Bundle.getStringTrimmed("org.netbeans.core.Bundle",
213.552 - "Menu/File")
213.553 - +delim
213.554 - +CLOSE_PROJECT);
213.555 - }catch(TimeoutExpiredException e){
213.556 - System.out.println("Can't close current project. May be project doesn't exist");
213.557 - e.printStackTrace();
213.558 - }
213.559 - }
213.560 -
213.561 - public static void closeCurrentProjectSaveAll(){
213.562 - try{
213.563 - try {
213.564 - /*
213.565 - Util.getMainMenu().pushMenu(
213.566 - Bundle.getStringTrimmed("org.netbeans.core.Bundle",
213.567 - "Menu/File")
213.568 - +delim
213.569 - + CLOSE_PROJECT);
213.570 - */
213.571 - new CloseProjectAction().perform();
213.572 - } catch (TimeoutExpiredException e) {}
213.573 - JDialogOperator saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
213.574 - new JButtonOperator(saveAll,
213.575 - SAVE_ALL).pushNoBlock();
213.576 - }catch(TimeoutExpiredException e){
213.577 - System.out.println("Can't close current project. May be project doesn't exist");
213.578 - e.printStackTrace();
213.579 - }
213.580 - }
213.581 -
213.582 - /**
213.583 - * Closes project <code>prjName</code> if it is currently selected
213.584 - * @param prjName Project Name
213.585 - * @deprecated Use closeCurrentProject or closeProjectByName instead
213.586 - */
213.587 - public static void closeProject(String prjName) {
213.588 - try{
213.589 - try {
213.590 - Util.getMainMenu().pushMenu(
213.591 - Bundle.getStringTrimmed("org.netbeans.core.Bundle",
213.592 - "Menu/File")
213.593 - +delim
213.594 - +CLOSE_PROJECT
213.595 - +" \""+prjName+"\"");
213.596 - } catch (TimeoutExpiredException e) {}
213.597 - JDialogOperator saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
213.598 - new JButtonOperator(saveAll, SAVE_ALL).pushNoBlock();
213.599 - }catch(org.netbeans.jemmy.TimeoutExpiredException e){
213.600 - System.out.println("Can't close current project. May be project doesn't exist");
213.601 - e.printStackTrace();
213.602 - }
213.603 - }
213.604 -
213.605 - /**
213.606 - * Closes project <code>prjName</code>. Saves all if Save Dialog is shown
213.607 - * @param prjName Project Name
213.608 - */
213.609 - public static void closeProjectByName(String prjName) {
213.610 -
213.611 - try {
213.612 - ProjectNavigatorOperator pno = new ProjectNavigatorOperator().switchToProjects();
213.613 - pno.pressPopupItemOnNode(prjName, "Close");
213.614 - } catch (TimeoutExpiredException e) {
213.615 - throw new RuntimeException("Failed to close project", e);
213.616 - }
213.617 -
213.618 - JDialogOperator saveAll = null;
213.619 -
213.620 - try {
213.621 - saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
213.622 - new JButtonOperator(saveAll, SAVE_ALL).pushNoBlock();
213.623 - } catch (org.netbeans.jemmy.TimeoutExpiredException e) {
213.624 - if (saveAll == null) System.out.println("No Save Dialog is shown");
213.625 - else {
213.626 - System.out.println("Failed to save all");
213.627 - e.printStackTrace();
213.628 - }
213.629 - }
213.630 - }
213.631 -
213.632 - /**
213.633 - * Checks whether project <code>prjName</code> is opened
213.634 - * @param prjName Project Name to check
213.635 - * @return Returns true if project name is shown in Projects tree
213.636 - */
213.637 - public static boolean isProjectOpened(String prjName) {
213.638 - ProjectNavigatorOperator pno = null;
213.639 - try {
213.640 - pno = new ProjectNavigatorOperator().switchToProjects();
213.641 - JTreeOperator jto = pno.tree();
213.642 - Timeouts timeouts = jto.getTimeouts().cloneThis();
213.643 - jto.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 3000);
213.644 - try {
213.645 - jto.findPath(prjName);
213.646 - } finally {
213.647 - jto.setTimeouts(timeouts);
213.648 - }
213.649 - } catch (TimeoutExpiredException e) {
213.650 - if (pno == null) {
213.651 - // e.printStackTrace();
213.652 - throw new RuntimeException("Failed to open Project Navigator", e);
213.653 - } else {
213.654 - return false;
213.655 - }
213.656 - }
213.657 - return true;
213.658 - }
213.659 -
213.660 - public static void closeProjectSaveAll(String prjName){
213.661 - try{
213.662 - try {
213.663 - /*
213.664 - Util.getMainMenu().pushMenu(
213.665 - Bundle.getStringTrimmed("org.netbeans.core.Bundle",
213.666 - "Menu/File") + delim
213.667 - + CLOSE_PROJECT
213.668 - + " \"" + prjName + "\"");
213.669 - */
213.670 - new CloseProjectAction().perform();
213.671 - } catch (TimeoutExpiredException e) {}
213.672 - JDialogOperator saveAll = new JDialogOperator(SAVE_DIALOG_TITLE);
213.673 - new JButtonOperator(saveAll, SAVE_ALL).push();
213.674 - }catch(org.netbeans.jemmy.TimeoutExpiredException e){
213.675 - System.out.println("Can't close current project. May be project doesn't exist");
213.676 - e.printStackTrace();
213.677 - }
213.678 - }
213.679 -
213.680 - public static void closeProjectAfterSaveAll(String prjName) {
213.681 - try{
213.682 - Util.getMainMenu().pushMenu(
213.683 - Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + delim
213.684 - + SAVE_ALL);
213.685 - Util.getMainMenu().pushMenu(
213.686 - Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + delim
213.687 - + CLOSE_PROJECT
213.688 - + " \"" + prjName + "\"");
213.689 - } catch(Exception e) {
213.690 - e.printStackTrace();
213.691 - }
213.692 - }
213.693 -
213.694 - public static void pushPopupMenuItemOnMainDesignerTab(
213.695 - DesignerPaneOperator designerOperator, String menuItem) {
213.696 - clickMainDesignerTabForPopup(designerOperator);
213.697 - JPopupMenuOperator popupMenu = new JPopupMenuOperator();
213.698 - Util.wait(1000);
213.699 - popupMenu.setComparator(new ComponentOperator.DefaultStringComparator(
213.700 - false, false));
213.701 - popupMenu.pushMenu(menuItem);
213.702 - Util.wait(2000);
213.703 - }
213.704 -
213.705 - public static void createNewProjectLoc(String location, String projectName, boolean absoluteLocation){
213.706 -
213.707 - createNewProjectLoc(location, projectName, absoluteLocation, "Web", "Visual Web Application");
213.708 - }
213.709 -
213.710 - private static void clickMainDesignerTabForPopup(
213.711 - DesignerPaneOperator designerOperator) {
213.712 - TabbedAdapter tabbedAdapter = getTabbedAdapter(designerOperator);
213.713 -
213.714 - int selectedIndex = tabbedAdapter.getSelectionModel().getSelectedIndex();
213.715 - Rectangle tabRect = tabbedAdapter.getTabBounds(selectedIndex);
213.716 - int clickX = tabRect.x + (tabRect.width / 2),
213.717 - clickY = tabRect.y + (tabRect.height / 2);
213.718 -
213.719 - ComponentOperator componentOperator = new ComponentOperator((Component)tabbedAdapter);
213.720 - MouseDriver mouseDriver = new MouseRobotDriver(new Timeout("", 300));
213.721 - mouseDriver.clickMouse(componentOperator, clickX, clickY, 1,
213.722 - InputEvent.BUTTON3_MASK, 0, new Timeout("", 10));
213.723 - Util.wait(1000);
213.724 - }
213.725 -
213.726 - public static String getCurrentProjectName() {
213.727 - // JSF-project is used by default
213.728 - return getCurrentProjectName(KEY_STRING_AFTER_PRJ_NAME_JSF);
213.729 - }
213.730 -
213.731 - public static String getCurrentProjectName(String keyStringAfterPrjName) {
213.732 - DesignerPaneOperator designerOperator = new DesignerPaneOperator();
213.733 - TopComponent topComponent = getSelectedTopComponent(designerOperator);
213.734 - String toolTip = topComponent.getToolTipText();
213.735 -
213.736 - System.out.println();
213.737 - System.out.println("+++ TopComconent's tooltip = [" + toolTip + "]");
213.738 -
213.739 - String prjName = toolTip.replace(File.separatorChar, '/');
213.740 - int substrIndex = prjName.lastIndexOf("/" + keyStringAfterPrjName);
213.741 - prjName = prjName.substring(0, substrIndex);
213.742 -
213.743 - substrIndex = prjName.lastIndexOf("/");
213.744 - prjName = prjName.substring(substrIndex + 1);
213.745 -
213.746 - System.out.println("+++ Current project name = " + prjName);
213.747 - System.out.println();
213.748 -
213.749 - return prjName;
213.750 - }
213.751 -
213.752 - public static boolean isMainTabOfDesignerSelected(
213.753 - DesignerPaneOperator designerOperator, String tabTitle) {
213.754 - TopComponent topComponent = getSelectedTopComponent(designerOperator);
213.755 - String name = getTopComponentName(topComponent).trim();
213.756 -
213.757 - System.out.println("+++ Tab Title = [" + tabTitle + "]");
213.758 - System.out.println("+++ TopComconent name = [" + name + "]");
213.759 - System.out.println();
213.760 -
213.761 - return (name.equals(tabTitle.trim()));
213.762 - }
213.763 -
213.764 - private static TabbedAdapter getTabbedAdapter(ContainerOperator containerOperator) {
213.765 - if (containerOperator == null) return null;
213.766 - Container container = containerOperator.getParent();
213.767 - while (container != null) {
213.768 - if (container instanceof TabbedAdapter) {
213.769 - System.out.println();
213.770 - System.out.println("+++ Tabbed Adapter found = " + container);
213.771 - System.out.println();
213.772 - return ((TabbedAdapter) container);
213.773 - }
213.774 - container = container.getParent();
213.775 - }
213.776 - return null;
213.777 - }
213.778 -
213.779 - public static TopComponent[] getTabTopComponents(ContainerOperator containerOperator) {
213.780 - TabbedAdapter tabbedAdapter = getTabbedAdapter(containerOperator);
213.781 - if (tabbedAdapter == null) {
213.782 - return null;
213.783 - }
213.784 - TopComponent[] topComponents = tabbedAdapter.getTopComponents();
213.785 - return topComponents;
213.786 - }
213.787 -
213.788 - public static TopComponent getTabSelectedTopComponent(ContainerOperator containerOperator) {
213.789 - TabbedAdapter tabbedAdapter = getTabbedAdapter(containerOperator);
213.790 - if (tabbedAdapter == null) {
213.791 - return null;
213.792 - }
213.793 - int selectedIndex = tabbedAdapter.getSelectionModel().getSelectedIndex();
213.794 - TopComponent topComponent = tabbedAdapter.getSelectedTopComponent();
213.795 - return topComponent;
213.796 - }
213.797 -
213.798 - private static TopComponent getSelectedTopComponent(DesignerPaneOperator designerOperator) {
213.799 - TopComponent topComponent = getTabSelectedTopComponent(designerOperator);
213.800 -
213.801 - System.out.println();
213.802 - System.out.println("+++ TopComconent found = " + topComponent);
213.803 - System.out.println();
213.804 - return topComponent;
213.805 - }
213.806 -
213.807 - public static String getTopComponentName(TopComponent topComponent) {
213.808 - String name = topComponent.getDisplayName();
213.809 - if ((name == null) || (name.length() < 1)) {
213.810 - name = topComponent.getName();
213.811 - }
213.812 - return name;
213.813 - }
213.814 -
213.815 - public static boolean checkProjectBuilded(){
213.816 - BuildOutputOperator console = new BuildOutputOperator();
213.817 - if((console.getTextOutput()).indexOf("BUILD SUCCESSFUL")!=-1) return true;
213.818 - return false;
213.819 - }
213.820 -
213.821 - public static void wait(int millisec){
213.822 - Util.wait(millisec);
213.823 - //System.out.println("sleep to "+millisec/1000+" seconds");
213.824 - //try { Thread.sleep(millisec); } catch(Exception e) {}
213.825 - }
213.826 -
213.827 - public static void waitStatusText(String line) {
213.828 - String[] variants = {line};
213.829 - StatusWaitable csw = new StatusWaitable(variants, false);
213.830 - String result = waitStatus(csw);
213.831 - if(result!=null){
213.832 - System.out.println("Error while waiting status text: "+result);
213.833 - }
213.834 - }
213.835 -
213.836 - public static String waitStatus(StatusWaitable csw){
213.837 - Waiter w = new Waiter(csw);
213.838 - try {
213.839 - w.waitAction(csw);
213.840 - } catch (InterruptedException e) {
213.841 - e.printStackTrace();
213.842 - return("Exception while waiting status text:" + e);
213.843 - } catch (TimeoutExpiredException e1) {
213.844 - e1.printStackTrace();
213.845 - return("Exception while waiting status text:" + e1);
213.846 - }
213.847 - return null;
213.848 - }
213.849 -
213.850 - public static void waitDeployed(OutputOperator output, int maxTimeout) throws InterruptedException {
213.851 - Waiter deploymentWaiter = new Waiter(new Waitable() {
213.852 - public Object actionProduced(Object output) {
213.853 - String text = ((OutputOperator)output).getText();
213.854 - if (text.indexOf("BUILD FAILED")!=-1)
213.855 - throw new RuntimeException(new InterruptedException("BUILD FAILED String found in Output Window"));
213.856 - if (text.indexOf("BUILD SUCCESSFUL")!=-1)
213.857 - return "true";
213.858 - return null;
213.859 -
213.860 - }
213.861 - public String getDescription() {
213.862 - return("Waiting Project Deployed");
213.863 - }
213.864 - });
213.865 - //Waiter deploymentWaiter = new Waiter(new WaitDeploymentCompleted());
213.866 - deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", maxTimeout);
213.867 - deploymentWaiter.waitAction(output);
213.868 - output.close();
213.869 - }
213.870 -
213.871 - /** getting coords of selected component from "style" property
213.872 - *
213.873 - *
213.874 - */
213.875 -
213.876 - public static Point getComponentCoords() {
213.877 - PropertySheetOperator pso = new PropertySheetOperator(Util.getMainWindow());
213.878 - PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
213.879 - psto.setComparator(new Operator.DefaultStringComparator(true, true));
213.880 - Property pr = new Property(psto, "style");
213.881 - String propValue = pr.getValue();
213.882 -
213.883 -
213.884 - int xLoc = new Integer(propValue.substring(propValue.indexOf("left: ") + 6, propValue.indexOf("px", propValue.indexOf("left: ")))).intValue();
213.885 - int yLoc = new Integer(propValue.substring(propValue.indexOf("top: ") + 5, propValue.indexOf("px", propValue.indexOf("top: ")))).intValue();
213.886 -
213.887 - return new Point(xLoc, yLoc);
213.888 - }
213.889 -
213.890 - /** getting current Date and Time as one string ( YYYYMMDDHHMMSS )
213.891 - *
213.892 - *
213.893 - */
213.894 - public static String getCurrentDateAndTimeAsString(){
213.895 - return (new SimpleDateFormat("yyyyMMddHHmmss")).format(new Date());
213.896 - }
213.897 -
213.898 - /** export WAR file
213.899 - *
213.900 - *
213.901 - */
213.902 - public static void exportWAR(String projectName, String pathToWAR, boolean platform){
213.903 - // ProjectNavigatorOperator.pressPopupItemOnNode("ROOT", "Export WAR File");
213.904 - ProjectNavigatorOperator.pressPopupItemOnNode(projectName, "Export WAR File");
213.905 - wait(2000);
213.906 - JDialogOperator newWF = new JDialogOperator("Export WAR");
213.907 - new JTextFieldOperator(newWF, 0).setText(pathToWAR+fSep+projectName+".war");
213.908 - wait(1000);
213.909 - new JRadioButtonOperator(newWF, platform?0:1).setSelected(true);
213.910 - wait(1000);
213.911 - new JButtonOperator(newWF, "OK").pushNoBlock();
213.912 - newWF.waitClosed();
213.913 - wait(2000);
213.914 - long oldWaitTime = Util.getMainWindow().getTimeouts().getTimeout("DialogWaiter.WaitDialogTimeout");
213.915 - try {
213.916 - Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", 5000);
213.917 - JDialogOperator owdo = new JDialogOperator("Question");
213.918 - new JButtonOperator(owdo, "Yes").pushNoBlock();
213.919 - Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", oldWaitTime);
213.920 - } catch(Exception e) {
213.921 - Util.getMainWindow().getTimeouts().setTimeout("DialogWaiter.WaitDialogTimeout", oldWaitTime);
213.922 - }
213.923 - System.out.println("WAR File exported in "+pathToWAR+fSep+projectName+".war");
213.924 - while (new JLabelOperator(Util.getMainWindow(), 0).getText().indexOf("Finished") == -1 &&
213.925 - new JLabelOperator(Util.getMainWindow(), 0).getText().indexOf("(export.war)") == -1) {}
213.926 - wait(2000);
213.927 - }
213.928 -
213.929 - public static void exportWAR(String projectName, String pathToWAR){
213.930 - exportWAR(projectName, pathToWAR, true);
213.931 - }
213.932 -
213.933 - /**
213.934 - * Prints list of all child components of container
213.935 - * @param op - container
213.936 - */
213.937 - public static void printComponentList(ComponentOperator op) {
213.938 - Component cmp=op.getSource();
213.939 - if (cmp instanceof Container){
213.940 - printComponentList((Container)cmp);
213.941 - }else {
213.942 - System.out.println("Not a container");
213.943 - }
213.944 - }
213.945 -
213.946 - public static void printComponentList(Container container) {
213.947 - printComponentList(container, 0);
213.948 - }
213.949 -
213.950 - private static void printComponentList(Container container, int tabCount) {
213.951 - printComponentList(System.out, container, tabCount);
213.952 - }
213.953 -
213.954 - public static void printComponentList(String fileName, Container container) {
213.955 - PrintStream printOut = null;
213.956 - try {
213.957 - printOut = new PrintStream(new FileOutputStream(fileName, true));
213.958 - printComponentList(printOut, container, 0);
213.959 - } catch(Exception e) {
213.960 - e.printStackTrace();
213.961 - } finally {
213.962 - try {
213.963 - printOut.flush();
213.964 - printOut.close();
213.965 - } catch(Exception e) {e.printStackTrace();}
213.966 - }
213.967 - }
213.968 -
213.969 - private static void printComponentList(PrintStream out, Container container,
213.970 - int tabCount) {
213.971 - Component[] components = container.getComponents();
213.972 - for (int i = 0; i < components.length; i++) {
213.973 - Component component = components[i];
213.974 -
213.975 - out.println();
213.976 - out.println();
213.977 - for (int j = 0; j < tabCount; j++) {
213.978 - out.print("\t");
213.979 - }
213.980 - out.print("+++ COMPONENT = " + component);
213.981 - out.println();
213.982 - // print next level
213.983 - if (component instanceof Container) {
213.984 - printComponentList(out, (Container) component, tabCount + 1);
213.985 - }
213.986 - }
213.987 - }
213.988 -
213.989 - private static final String
213.990 - CREATOR_SYSTEM_DIR = "visualweb1" + File.separator + "config",
213.991 - CREATOR_INSTALL_PROPERTIES_FILE_NAME = "com-sun-rave-install.properties";
213.992 - // CREATOR_SYSTEM_DIR = "system",
213.993 - // CREATOR_INSTALL_PROPERTIES_FILE_NAME = "install.properties";
213.994 -
213.995 - private static final String
213.996 - HTTP_PROTOCOL = "http",
213.997 - WEB_PORT_PROPERTY_NAME = "webPort",
213.998 - ADMIN_PORT_PROPERTY_NAME = "adminPort",
213.999 - LOCALHOST="localhost";
213.1000 -
213.1001 - public static URL getJ2EEApplicationURL(String projectName) {
213.1002 - String webPort = getWebPortFromProperties(),
213.1003 - unsensitiveProjectName = projectName.toLowerCase();
213.1004 - try {
213.1005 - return (new URL(HTTP_PROTOCOL, LOCALHOST,
213.1006 - Integer.parseInt(webPort), File.separator + unsensitiveProjectName));
213.1007 - } catch (Exception e) {
213.1008 - e.printStackTrace();
213.1009 - return null;
213.1010 - }
213.1011 - }
213.1012 -
213.1013 - public static String getWebPortFromProperties() {
213.1014 - Properties installProperties = getCreatorInstallProperties();
213.1015 - return ((installProperties == null) ? null :
213.1016 - installProperties.getProperty(WEB_PORT_PROPERTY_NAME));
213.1017 - }
213.1018 -
213.1019 - public static String getAdminPortFromProperties() {
213.1020 - Properties installProperties = getCreatorInstallProperties();
213.1021 - return ((installProperties == null) ? null :
213.1022 - installProperties.getProperty(ADMIN_PORT_PROPERTY_NAME));
213.1023 - }
213.1024 -
213.1025 - public static Properties getCreatorInstallProperties() {
213.1026 - // ak153254: Fixed the name of installation properties file due to the fact
213.1027 - // that netbeans.dest.dir property doesn't exist any more
213.1028 - String installPropertiesFileName = System.getProperty("netbeans.home") +
213.1029 - File.separator + ".." + File.separator + CREATOR_SYSTEM_DIR +
213.1030 - File.separator + CREATOR_INSTALL_PROPERTIES_FILE_NAME;
213.1031 - try {
213.1032 - Properties installProperties = new Properties();
213.1033 - installProperties.load(new FileInputStream(installPropertiesFileName));
213.1034 - return installProperties;
213.1035 - } catch (Exception e) {
213.1036 - e.printStackTrace();
213.1037 - return null;
213.1038 - }
213.1039 - }
213.1040 -
213.1041 - public static void outMsg(String msg) {
213.1042 - outMsg(msg, true, true);
213.1043 - }
213.1044 -
213.1045 - public static void outMsg(String msg, boolean spaceBefore, boolean spaceAfter) {
213.1046 - outMsg(System.out, msg, spaceBefore, spaceAfter);
213.1047 - }
213.1048 -
213.1049 - public static void outMsg(String fileName, String msg) {
213.1050 - outMsg(fileName, msg, true, true);
213.1051 - }
213.1052 -
213.1053 - public static void outMsg(String fileName, String msg, boolean spaceBefore,
213.1054 - boolean spaceAfter) {
213.1055 - PrintStream printOut = null;
213.1056 - try {
213.1057 - printOut = new PrintStream(new FileOutputStream(fileName, true));
213.1058 - outMsg(printOut, msg, spaceBefore, spaceAfter);
213.1059 - } catch(Exception e) {
213.1060 - e.printStackTrace();
213.1061 - } finally {
213.1062 - try {
213.1063 - printOut.flush();
213.1064 - printOut.close();
213.1065 - } catch(Exception e) {e.printStackTrace();}
213.1066 - }
213.1067 - }
213.1068 -
213.1069 - private static void outMsg(PrintStream out, String msg, boolean spaceBefore,
213.1070 - boolean spaceAfter) {
213.1071 - if (spaceBefore) {
213.1072 - out.println();
213.1073 - }
213.1074 - out.println(msg);
213.1075 - if (spaceAfter) {
213.1076 - out.println();
213.1077 - }
213.1078 - }
213.1079 -
213.1080 - public static boolean isServerStarted() {
213.1081 - String adminPort = "24848";//getAdminPortFromProperties();
213.1082 - System.out.println("adminPort = " + adminPort);
213.1083 - return isServerStarted(LOCALHOST, adminPort);
213.1084 - }
213.1085 -
213.1086 - public static boolean isServerStarted(String host, String port) {
213.1087 - return isServerStarted(host, port, null, null);
213.1088 - }
213.1089 -
213.1090 - public static boolean isServerStarted(String host, String port,
213.1091 - String userName, String userPassword) {
213.1092 - try {
213.1093 - WebConversation conversation = new WebConversation();
213.1094 - HttpUnitOptions.setExceptionsThrownOnErrorStatus(false);
213.1095 - HttpUnitOptions.setExceptionsThrownOnScriptError(false);
213.1096 - if ((userName != null) && (userPassword != null)) {
213.1097 - conversation.setAuthorization(userName, userPassword);
213.1098 - }
213.1099 - String url = HTTP_PROTOCOL + "://" + host + ":" + port;
213.1100 - try {
213.1101 - WebResponse response = conversation.getResponse(url);
213.1102 - } catch(java.io.EOFException e) {
213.1103 - // workaround: handle an exception from Web Server 6.1
213.1104 - outMsg("+++ Method [isServerStarted(...)]: an exception [" + e +
213.1105 - "] after attempt to receive a response " +
213.1106 - "from server [" + url + "]");
213.1107 - e.printStackTrace();
213.1108 - }
213.1109 - } catch (Throwable t) {
213.1110 - t.printStackTrace();
213.1111 - System.out.println("Exception in HTTP check : " + t);
213.1112 - return false;
213.1113 - }
213.1114 - return true;
213.1115 - }
213.1116 -
213.1117 - public static String getRequestPrefix(long timeout) {
213.1118 - Waiter waiter = new Waiter(new Waitable() {
213.1119 - public Object actionProduced(Object p) {
213.1120 - String _requestPrefix = "";
213.1121 - _requestPrefix = System.getProperty("test.netbeans.j2eeserver.clienturl");
213.1122 - if(_requestPrefix != null &&
213.1123 - _requestPrefix.length() > 0) {
213.1124 - return(_requestPrefix);
213.1125 - } else {
213.1126 - return(null);
213.1127 - }
213.1128 - }
213.1129 - public String getDescription() {
213.1130 - return("URL to be set");
213.1131 - }
213.1132 - });
213.1133 - waiter.getTimeouts().setTimeout("Waiter.WaitingTime", timeout);
213.1134 - try {
213.1135 - return((String)waiter.waitAction(null));
213.1136 - } catch(java.lang.InterruptedException e) {
213.1137 - return("");
213.1138 - }
213.1139 - }
213.1140 -
213.1141 - public static void disableBrowser(String prjName, boolean dis) {
213.1142 - ProjectNavigatorOperator.pressPopupItemOnNode(prjName, "Properties");
213.1143 - JDialogOperator propertiesDialog = new JDialogOperator("Project Properties - "+prjName);
213.1144 - wait(1000);
213.1145 - JTreeOperator tree = new JTreeOperator(propertiesDialog);
213.1146 - tree.selectPath(tree.findPath("Run"));
213.1147 - wait(2000);
213.1148 - JCheckBoxOperator checkBox = new JCheckBoxOperator(propertiesDialog);
213.1149 - checkBox.setSelected(!dis);
213.1150 - wait(1000);
213.1151 - new JButtonOperator(propertiesDialog, "OK").pushNoBlock();
213.1152 - wait(1000);
213.1153 - }
213.1154 -
213.1155 - public static void disableBrowser(String prjName, String prjLoc, boolean dis) {
213.1156 - final String propFileStr = prjLoc+File.separator + prjName + File.separator+"nbproject"
213.1157 - +File.separator+"project.properties";
213.1158 - FileInputStream propIn = null;
213.1159 -
213.1160 - //need to wait property file to be created
213.1161 - Waiter propertyFileWaiter = new Waiter(new Waitable() {
213.1162 - public Object actionProduced(Object path) {
213.1163 - File file = new File((String)path);
213.1164 - if (file.exists()) {
213.1165 - return file;
213.1166 - } else return null;
213.1167 - }
213.1168 - public String getDescription() {
213.1169 - return("\"" + propFileStr + "\" property file to be created");
213.1170 - }
213.1171 - });
213.1172 -
213.1173 - propertyFileWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", 20000);
213.1174 - File propFile = null;
213.1175 - try {
213.1176 - propFile = (File)propertyFileWaiter.waitAction(propFileStr);
213.1177 - } catch(InterruptedException e) {}
213.1178 -
213.1179 -
213.1180 - wait(1000);
213.1181 - try {
213.1182 - Properties prop = new Properties();
213.1183 - wait(1000);
213.1184 - propIn = new FileInputStream(propFile);
213.1185 - wait(1000);
213.1186 - prop.load(propIn);
213.1187 - //wait(2000);
213.1188 - Boolean newVal = new Boolean(!dis);
213.1189 - prop.setProperty("display.browser", newVal.toString());
213.1190 - //System.out.println("TRACE Property set : display.browser = "+prop.getProperty("display.browser"));
213.1191 - //wait(2000);
213.1192 - prop.store(new FileOutputStream(propFileStr), null);
213.1193 - //wait(5000);
213.1194 - }catch (Exception e) {
213.1195 - e.printStackTrace();
213.1196 - System.out.println("Exception occured "+ e);
213.1197 - }
213.1198 - }
213.1199 -
213.1200 - public static JMenuItem findPopupMenuItemByLabel(JPopupMenuOperator menuOperator,
213.1201 - String menuItemLabel) {
213.1202 - return findPopupMenuItemByLabel(menuOperator, menuItemLabel, true, false);
213.1203 - }
213.1204 -
213.1205 - public static JMenuItem findPopupMenuItemByLabel(JPopupMenuOperator menuOperator,
213.1206 - String menuItemLabel, boolean equalsMode, boolean ignoreCaseMode) {
213.1207 - String labelText = (ignoreCaseMode ? menuItemLabel.toUpperCase() : menuItemLabel);
213.1208 -
213.1209 - MenuElement[] menuItems = menuOperator.getSubElements();
213.1210 - for (int i = 0; i < menuItems.length; i++) {
213.1211 - JMenuItem menuItem = (JMenuItem) menuItems[i];
213.1212 - String menuItemText = (ignoreCaseMode ?
213.1213 - menuItem.getText().toUpperCase() : menuItem.getText());
213.1214 - if (equalsMode) {
213.1215 - if (menuItemText.equals(labelText)) {
213.1216 - return menuItem;
213.1217 - }
213.1218 - } else {
213.1219 - if (menuItemText.indexOf(labelText) > -1) {
213.1220 - return menuItem;
213.1221 - }
213.1222 - }
213.1223 - }
213.1224 - return null;
213.1225 - }
213.1226 - /**
213.1227 - * @param destinationUrl - url with zip file
213.1228 - * @param srcFile - file in which downloaded file will be saved
213.1229 - */
213.1230 -
213.1231 - public static void downloadFile(String destinationUrl, String srcFile)
213.1232 - throws MalformedInputException, IOException {
213.1233 -
213.1234 - // try {
213.1235 - // Create an URL instance
213.1236 - URL url = new URL(destinationUrl);
213.1237 -
213.1238 - // Get an input stream for reading
213.1239 - InputStream in = url.openStream();
213.1240 -
213.1241 - // Create a buffered input stream for efficency
213.1242 - BufferedInputStream bufIn = new BufferedInputStream(in);
213.1243 - OutputStream outStr = new FileOutputStream(srcFile);
213.1244 -
213.1245 - // Repeat until end of file
213.1246 - for (;;) {
213.1247 - int data = bufIn.read();
213.1248 -
213.1249 - // Check for EOF
213.1250 - if (data == -1)
213.1251 - break;
213.1252 - else
213.1253 - outStr.write(data);
213.1254 - //System.out.print ( (char) data);
213.1255 - }
213.1256 - outStr.close();
213.1257 - /*
213.1258 - } catch(MalformedURLException mue) {
213.1259 - System.err.println("Invalid URL");
213.1260 - System.out.println("Invalid URL :" + mue);
213.1261 - fail("Invalid URL");
213.1262 - } catch (IOException ioe) {
213.1263 - System.err.println("I/O Error - " + ioe);
213.1264 - fail("I/O Error - " + ioe);
213.1265 - }
213.1266 - */
213.1267 - }
213.1268 -
213.1269 - public static String unzip(String file) throws IOException {
213.1270 - String projectName;
213.1271 - Enumeration entries;
213.1272 - ZipFile zipFile;
213.1273 - //try {
213.1274 - zipFile = new ZipFile(file);
213.1275 - entries = zipFile.entries();
213.1276 - System.out.println("Extracting from: " + zipFile.getName());
213.1277 - //TODO:
213.1278 - String firstEntry = ((ZipEntry)zipFile.entries().nextElement()).getName();
213.1279 - System.out.println("FIRST ENTRY = " + firstEntry);
213.1280 - String startDir = firstEntry;
213.1281 - if (firstEntry.indexOf('/') != -1) {
213.1282 - startDir = firstEntry.substring(0, firstEntry.indexOf('/'));
213.1283 - System.out.println("dir = " + startDir);
213.1284 - (new File(startDir)).mkdir();
213.1285 - }
213.1286 - projectName = startDir;
213.1287 - //_projectPath = (new File(startDir)).getAbsolutePath();
213.1288 - while(entries.hasMoreElements()) {
213.1289 - ZipEntry entry = (ZipEntry)entries.nextElement();
213.1290 -
213.1291 -
213.1292 - if(entry.isDirectory()) {
213.1293 - // Assume directories are stored parents first then children.
213.1294 - System.out.println("Extracting directory: " + entry.getName());
213.1295 - // This is not robust, just for demonstration purposes.
213.1296 - (new File(entry.getName())).mkdir();
213.1297 - //continue;
213.1298 - } else {
213.1299 - System.out.println("Extracting file: " + entry.getName());
213.1300 - copyInputStream(zipFile.getInputStream(entry),
213.1301 - new BufferedOutputStream(new FileOutputStream(entry.getName())));
213.1302 - }
213.1303 -
213.1304 - }
213.1305 - zipFile.close();
213.1306 - return projectName;
213.1307 - /*
213.1308 - } catch (IOException ioe) {
213.1309 - System.err.println("Unhandled exception:");
213.1310 - ioe.printStackTrace();
213.1311 - fail();
213.1312 - }
213.1313 - */
213.1314 - }
213.1315 - protected static final void copyInputStream(InputStream in, OutputStream out)
213.1316 - throws IOException {
213.1317 - byte[] buffer = new byte[1024];
213.1318 - int len;
213.1319 -
213.1320 - while((len = in.read(buffer)) >= 0)
213.1321 - out.write(buffer, 0, len);
213.1322 -
213.1323 - in.close();
213.1324 - out.close();
213.1325 - }
213.1326 -
213.1327 - /**
213.1328 - * Parse logs for exceptions
213.1329 - *
213.1330 - */
213.1331 - public static String parseLogs(String pathToFile, String strToFind) throws IOException {
213.1332 - String lineSep = System.getProperty("line.separator");
213.1333 - BufferedReader br = new BufferedReader(new FileReader(pathToFile));
213.1334 - String nextLine = "";
213.1335 - StringBuffer sb = new StringBuffer();
213.1336 - while ((nextLine = br.readLine()) != null) {
213.1337 - if (nextLine.indexOf(strToFind)!=-1) {
213.1338 - sb.append(nextLine);
213.1339 - sb.append(lineSep);
213.1340 - }
213.1341 - }
213.1342 - return sb.toString();
213.1343 - }
213.1344 -
213.1345 - public static void setHTTPProxy(String proxyHost, String proxyPort) {
213.1346 - OptionsOperator opOper = OptionsOperator.invoke();
213.1347 - opOper.selectOption("General Settings|System Settings");
213.1348 - SheetTableOperator props = new SheetTableOperator(opOper);
213.1349 - props.setComboBoxValue("Type of proxy configuration", "Use HTTP Proxy");
213.1350 - props.setTextValue("Proxy Host", proxyHost);
213.1351 - props.setTextValue("Proxy Port", proxyPort);
213.1352 - opOper.close();
213.1353 - }
213.1354 -}
214.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/TopComponentByIdChooser.java Thu Jul 10 04:29:52 2008 -0700
214.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
214.3 @@ -1,71 +0,0 @@
214.4 -/*
214.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
214.6 - *
214.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
214.8 - *
214.9 - * The contents of this file are subject to the terms of either the GNU
214.10 - * General Public License Version 2 only ("GPL") or the Common
214.11 - * Development and Distribution License("CDDL") (collectively, the
214.12 - * "License"). You may not use this file except in compliance with the
214.13 - * License. You can obtain a copy of the License at
214.14 - * http://www.netbeans.org/cddl-gplv2.html
214.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
214.16 - * specific language governing permissions and limitations under the
214.17 - * License. When distributing the software, include this License Header
214.18 - * Notice in each file and include the License file at
214.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
214.20 - * particular file as subject to the "Classpath" exception as provided
214.21 - * by Sun in the GPL Version 2 section of the License file that
214.22 - * accompanied this code. If applicable, add the following below the
214.23 - * License Header, with the fields enclosed by brackets [] replaced by
214.24 - * your own identifying information:
214.25 - * "Portions Copyrighted [year] [name of copyright owner]"
214.26 - *
214.27 - * Contributor(s):
214.28 - *
214.29 - * The Original Software is NetBeans. The Initial Developer of the Original
214.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
214.31 - * Microsystems, Inc. All Rights Reserved.
214.32 - *
214.33 - * If you wish your version of this file to be governed by only the CDDL
214.34 - * or only the GPL Version 2, indicate your decision by adding
214.35 - * "[Contributor] elects to include this software in this distribution
214.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
214.37 - * single choice of license, a recipient has the option to distribute
214.38 - * your version of this file under either the CDDL, the GPL Version 2 or
214.39 - * to extend the choice of license to its licensees as provided above.
214.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
214.41 - * Version 2 license, then the option applies only if the new code is
214.42 - * made subject to such option by the copyright holder.
214.43 - */
214.44 -
214.45 -package org.netbeans.modules.visualweb.gravy;
214.46 -
214.47 -import java.awt.Component;
214.48 -import org.netbeans.jemmy.ComponentChooser;
214.49 -import org.netbeans.jemmy.operators.Operator;
214.50 -import org.openide.windows.TopComponent;
214.51 -import org.openide.windows.WindowManager;
214.52 -
214.53 -/**
214.54 - * Chooser for finding TopComponent by it's ID.
214.55 - */
214.56 -public class TopComponentByIdChooser implements ComponentChooser {
214.57 - private String id;
214.58 -
214.59 - public TopComponentByIdChooser(String theID) {
214.60 - id = theID;
214.61 - }
214.62 - public boolean checkComponent(Component comp) {
214.63 - if (comp instanceof TopComponent) {
214.64 - return(Operator.getDefaultStringComparator().equals(
214.65 - WindowManager.getDefault().findTopComponentID((TopComponent)comp),
214.66 - id));
214.67 - } else {
214.68 - return(false);
214.69 - }
214.70 - }
214.71 - public String getDescription() {
214.72 - return("TopComponent with \"" + id + "\" preffered id");
214.73 - }
214.74 -}
215.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/TopComponentOperator.java Thu Jul 10 04:29:52 2008 -0700
215.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
215.3 @@ -1,294 +0,0 @@
215.4 -/*
215.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
215.6 - *
215.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
215.8 - *
215.9 - * The contents of this file are subject to the terms of either the GNU
215.10 - * General Public License Version 2 only ("GPL") or the Common
215.11 - * Development and Distribution License("CDDL") (collectively, the
215.12 - * "License"). You may not use this file except in compliance with the
215.13 - * License. You can obtain a copy of the License at
215.14 - * http://www.netbeans.org/cddl-gplv2.html
215.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
215.16 - * specific language governing permissions and limitations under the
215.17 - * License. When distributing the software, include this License Header
215.18 - * Notice in each file and include the License file at
215.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
215.20 - * particular file as subject to the "Classpath" exception as provided
215.21 - * by Sun in the GPL Version 2 section of the License file that
215.22 - * accompanied this code. If applicable, add the following below the
215.23 - * License Header, with the fields enclosed by brackets [] replaced by
215.24 - * your own identifying information:
215.25 - * "Portions Copyrighted [year] [name of copyright owner]"
215.26 - *
215.27 - * Contributor(s):
215.28 - *
215.29 - * The Original Software is NetBeans. The Initial Developer of the Original
215.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
215.31 - * Microsystems, Inc. All Rights Reserved.
215.32 - *
215.33 - * If you wish your version of this file to be governed by only the CDDL
215.34 - * or only the GPL Version 2, indicate your decision by adding
215.35 - * "[Contributor] elects to include this software in this distribution
215.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
215.37 - * single choice of license, a recipient has the option to distribute
215.38 - * your version of this file under either the CDDL, the GPL Version 2 or
215.39 - * to extend the choice of license to its licensees as provided above.
215.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
215.41 - * Version 2 license, then the option applies only if the new code is
215.42 - * made subject to such option by the copyright holder.
215.43 - */
215.44 -
215.45 -package org.netbeans.modules.visualweb.gravy;
215.46 -
215.47 -import java.awt.Component;
215.48 -import java.io.IOException;
215.49 -import org.netbeans.jemmy.ComponentChooser;
215.50 -
215.51 -import org.netbeans.jemmy.*;
215.52 -
215.53 -import org.netbeans.jemmy.operators.JComponentOperator;
215.54 -import org.netbeans.jemmy.operators.ContainerOperator;
215.55 -import org.netbeans.jemmy.operators.Operator;
215.56 -
215.57 -import org.openide.windows.*;
215.58 -import org.openide.cookies.SaveCookie;
215.59 -import org.openide.loaders.DataObject;
215.60 -
215.61 -import javax.swing.*;
215.62 -
215.63 -/**
215.64 - * Class for TopComponents.
215.65 - */
215.66 -public class TopComponentOperator extends JComponentOperator {
215.67 -
215.68 - /**
215.69 - * Create TopComponentOperator with specified name in given container.
215.70 - * @param parent Container where TopComponent will be looking for.
215.71 - * @param ID Name of the TopComponent.
215.72 - */
215.73 - public TopComponentOperator(ContainerOperator parent, String ID) {
215.74 - super(parent, new TopComponentChooser(ID));
215.75 - }
215.76 -
215.77 - /**
215.78 - * Create TopComponentOperator with chooser in given container.
215.79 - * @param parent Container where TopComponent will be looking for.
215.80 - * @param chooser Chooser for finding.
215.81 - */
215.82 - public TopComponentOperator(ContainerOperator parent, ComponentChooser chooser) {
215.83 - super(parent, chooser);
215.84 - }
215.85 -
215.86 - /**
215.87 - * Create TopComponentOperator from given JComponent.
215.88 - * @param component JComponent from which TopComponentOperator will be created.
215.89 - */
215.90 - public TopComponentOperator(JComponent component) {
215.91 - super(component);
215.92 - }
215.93 -
215.94 - public static class TopComponentChooser implements ComponentChooser {
215.95 - String ID;
215.96 - public TopComponentChooser(String ID) {
215.97 - this.ID = ID;
215.98 - }
215.99 - public boolean checkComponent(Component comp) {
215.100 - return(comp instanceof TopComponent && comp != null &&
215.101 - ((TopComponent)comp).getName() != null &&
215.102 - ((TopComponent)comp).getName().indexOf(ID) != -1);
215.103 - }
215.104 - public String getDescription() {
215.105 - return("A TopComponent with \"" + ID + "\" ID");
215.106 - }
215.107 - }
215.108 -
215.109 -
215.110 - /**
215.111 - * Find TopComponent with specified name in given container with given subchooser.
215.112 - * @param cont Container where TopComponent will be looking for.
215.113 - * @param name Name of the TopComponent.
215.114 - * @param subchooser Subchooser for finding.
215.115 - * @return JComponent Found component.
215.116 - */
215.117 - protected static JComponent findTopComponent(ContainerOperator cont, String name, int index, ComponentChooser subchooser) {
215.118 - Object tc[]=TopComponent.getRegistry().getOpened().toArray();
215.119 - StringComparator comparator=cont==null?Operator.getDefaultStringComparator():cont.getComparator();
215.120 - TopComponent c;
215.121 - for (int i=0; i<tc.length; i++) {
215.122 - c=(TopComponent)tc[i];
215.123 - if (c.isShowing() && comparator.equals(c.getName(), name) && isUnder(cont, c) && (subchooser==null || subchooser.checkComponent(c))) {
215.124 - index--;
215.125 - if (index<0)
215.126 - return c;
215.127 - }
215.128 - }
215.129 - for (int i=0; i<tc.length; i++) {
215.130 - c=(TopComponent)tc[i];
215.131 - if ((!c.isShowing()) && isParentShowing(c) && comparator.equals(c.getName(), name) && isUnder(cont, c) && (subchooser==null || subchooser.checkComponent(c))) {
215.132 - index--;
215.133 - if (index<0)
215.134 - return c;
215.135 - }
215.136 - }
215.137 - return null;
215.138 - }
215.139 -
215.140 - /**
215.141 - * Check if component's parent is showing.
215.142 - * @param c Component for verification.
215.143 - * @return True if component's parent is showing.
215.144 - */
215.145 - private static boolean isParentShowing(Component c) {
215.146 - while (c!=null) {
215.147 - if (c.isShowing()) return true;
215.148 - c=c.getParent();
215.149 - }
215.150 - return false;
215.151 - }
215.152 -
215.153 - /**
215.154 - * Check if component is under given container.
215.155 - * @param cont Container.
215.156 - * @param c Component for verification.
215.157 - * @return True if component is under given container.
215.158 - */
215.159 - private static boolean isUnder(ContainerOperator cont, Component c) {
215.160 - if (cont==null) return true;
215.161 - Component comp=cont.getSource();
215.162 - while (comp!=c && c!=null) c=c.getParent();
215.163 - return (comp==c);
215.164 - }
215.165 -
215.166 - /** Closes this TopComponent instance by IDE API call and wait until
215.167 - * it is not closed. If this TopComponent is modified (e.g. editor top
215.168 - * component), question dialog is shown and you have to close it. To close
215.169 - * this TopComponent and discard possible changes use {@link #closeDiscard}
215.170 - * method.
215.171 - */
215.172 - public void close() {
215.173 - // run in a new thread because question may block further execution
215.174 - new Thread(new Runnable() {
215.175 - public void run() {
215.176 - // run in dispatch thread
215.177 - runMapping(new MapVoidAction("close") {
215.178 - public void map() {
215.179 - ((TopComponent)getSource()).close();
215.180 - }
215.181 - });
215.182 - }
215.183 - }, "thread to close TopComponent").start();
215.184 - // wait to be away
215.185 - waitComponentShowing(false);
215.186 - }
215.187 -
215.188 - /**
215.189 - * Waits the topcomponent to be closed.
215.190 - */
215.191 - public void waitClosed() {
215.192 - getOutput().printLine("Wait topcomponent to be closed \n : "+
215.193 - getSource().toString());
215.194 - getOutput().printGolden("Wait topcomponent to be closed");
215.195 - waitState(new ComponentChooser() {
215.196 - public boolean checkComponent(Component comp) {
215.197 - return(!comp.isVisible());
215.198 - }
215.199 - public String getDescription() {
215.200 - return("Closed topcomponent");
215.201 - }
215.202 - });
215.203 - }
215.204 -
215.205 - /** Saves content of this TopComponent. If it is not applicable or content
215.206 - * of TopComponent is not modified, it does nothing.
215.207 - */
215.208 - public void save() {
215.209 - // should be just one node
215.210 - org.openide.nodes.Node[] nodes = ((TopComponent)getSource()).getActivatedNodes();
215.211 - // TopComponent like Execution doesn't have any nodes associated
215.212 - if(nodes != null) {
215.213 - for(int i=0;i<nodes.length;i++) {
215.214 - SaveCookie sc = (SaveCookie)nodes[i].getCookie(SaveCookie.class);
215.215 - if(sc != null) {
215.216 - try {
215.217 - sc.save();
215.218 - } catch (IOException e) {
215.219 - throw new JemmyException("Exception while saving this TopComponent.", e);
215.220 - }
215.221 - }
215.222 - }
215.223 - }
215.224 - }
215.225 -
215.226 - /** Closes this TopComponent instance by IDE API call and wait until
215.227 - * it is not closed. If this TopComponent is modified (e.g. editor top
215.228 - * component), it discards possible changes.
215.229 - * @see #close
215.230 - */
215.231 - public void closeDiscard() {
215.232 - setUnmodified();
215.233 - close();
215.234 - }
215.235 -
215.236 - /** Finds DataObject for the content of this TopComponent and set it
215.237 - * unmodified. Used in closeDiscard method.
215.238 - */
215.239 - private void setUnmodified() {
215.240 - // should be just one node
215.241 - org.openide.nodes.Node[] nodes = ((TopComponent)getSource()).getActivatedNodes();
215.242 - // TopComponent like Execution doesn't have any nodes associated
215.243 - if(nodes != null) {
215.244 - for(int i=0;i<nodes.length;i++) {
215.245 - DataObject dob = (DataObject)nodes[i].getCookie(DataObject.class);
215.246 - dob.setModified(false);
215.247 - }
215.248 - }
215.249 - }
215.250 -
215.251 - /** Waits for index-th TopComponent with given name in IDE registry.
215.252 - * It throws JemmyException when TopComponent is not find until timeout
215.253 - * expires.
215.254 - * @param name name of TopComponent
215.255 - * @param index index of TopComponent
215.256 - * @return TopComponent instance or throws JemmyException if not found
215.257 - * @see #findTopComponent
215.258 - */
215.259 - protected static JComponent waitTopComponent(final String name, final int index) {
215.260 - return waitTopComponent(null, name, index, null);
215.261 - }
215.262 -
215.263 - /** Waits for index-th TopComponent with given name in IDE registry.
215.264 - * It throws JemmyException when TopComponent is not find until timeout
215.265 - * expires.
215.266 - * @param cont container where to search
215.267 - * @param name name of TopComponent
215.268 - * @param index index of TopComponent
215.269 - * @param subchooser ComponentChooser to determine exact TopComponent
215.270 - * @return TopComponent instance or throws JemmyException if not found
215.271 - * @see #findTopComponent
215.272 - */
215.273 - protected static JComponent waitTopComponent(final ContainerOperator cont, final String name, final int index, final ComponentChooser subchooser) {
215.274 - try {
215.275 - Waiter waiter = new Waiter(new Waitable() {
215.276 - public Object actionProduced(Object obj) {
215.277 - return findTopComponent(cont, name, index, subchooser);
215.278 - }
215.279 - public String getDescription() {
215.280 - return("Wait TopComponent with name="+name+
215.281 - " index="+String.valueOf(index)+
215.282 - (subchooser == null ? "" : " subchooser="+subchooser.getDescription())+
215.283 - " loaded");
215.284 - }
215.285 - });
215.286 - Timeouts times = JemmyProperties.getCurrentTimeouts().cloneThis();
215.287 - times.setTimeout("Waiter.WaitingTime", times.getTimeout("ComponentOperator.WaitComponentTimeout"));
215.288 - waiter.setTimeouts(times);
215.289 - waiter.setOutput(JemmyProperties.getCurrentOutput());
215.290 - return((JComponent)waiter.waitAction(null));
215.291 - } catch(InterruptedException e) {
215.292 - return(null);
215.293 - }
215.294 - }
215.295 -
215.296 -
215.297 -}
216.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/TreeTableOperator.java Thu Jul 10 04:29:52 2008 -0700
216.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
216.3 @@ -1,357 +0,0 @@
216.4 -/*
216.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
216.6 -*
216.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
216.8 -*
216.9 -* The contents of this file are subject to the terms of either the GNU
216.10 -* General Public License Version 2 only ("GPL") or the Common
216.11 -* Development and Distribution License("CDDL") (collectively, the
216.12 -* "License"). You may not use this file except in compliance with the
216.13 -* License. You can obtain a copy of the License at
216.14 -* http://www.netbeans.org/cddl-gplv2.html
216.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
216.16 -* specific language governing permissions and limitations under the
216.17 -* License. When distributing the software, include this License Header
216.18 -* Notice in each file and include the License file at
216.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
216.20 -* particular file as subject to the "Classpath" exception as provided
216.21 -* by Sun in the GPL Version 2 section of the License file that
216.22 -* accompanied this code. If applicable, add the following below the
216.23 -* License Header, with the fields enclosed by brackets [] replaced by
216.24 -* your own identifying information:
216.25 -* "Portions Copyrighted [year] [name of copyright owner]"
216.26 -*
216.27 -* Contributor(s):
216.28 -*
216.29 -* The Original Software is NetBeans. The Initial Developer of the Original
216.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
216.31 -* Microsystems, Inc. All Rights Reserved.
216.32 -*
216.33 -* If you wish your version of this file to be governed by only the CDDL
216.34 -* or only the GPL Version 2, indicate your decision by adding
216.35 -* "[Contributor] elects to include this software in this distribution
216.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
216.37 -* single choice of license, a recipient has the option to distribute
216.38 -* your version of this file under either the CDDL, the GPL Version 2 or
216.39 -* to extend the choice of license to its licensees as provided above.
216.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
216.41 -* Version 2 license, then the option applies only if the new code is
216.42 -* made subject to such option by the copyright holder.
216.43 -*/
216.44 -
216.45 -package org.netbeans.modules.visualweb.gravy;
216.46 -
216.47 -import java.awt.Component;
216.48 -import java.awt.Point;
216.49 -import java.awt.Rectangle;
216.50 -import javax.swing.JPopupMenu;
216.51 -import javax.swing.JScrollPane;
216.52 -import javax.swing.JTable;
216.53 -import javax.swing.JTree;
216.54 -import javax.swing.tree.TreePath;
216.55 -import org.netbeans.jemmy.ComponentChooser;
216.56 -import org.netbeans.jemmy.ComponentSearcher;
216.57 -import org.netbeans.jemmy.Timeout;
216.58 -import org.netbeans.jemmy.drivers.DriverManager;
216.59 -import org.netbeans.jemmy.drivers.MouseDriver;
216.60 -import org.netbeans.jemmy.drivers.SupportiveDriver;
216.61 -import org.netbeans.jemmy.operators.ComponentOperator;
216.62 -import org.netbeans.jemmy.operators.ContainerOperator;
216.63 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
216.64 -import org.netbeans.jemmy.operators.JScrollPaneOperator;
216.65 -import org.netbeans.jemmy.operators.JTableOperator;
216.66 -import org.netbeans.jemmy.operators.JTreeOperator;
216.67 -import org.netbeans.jemmy.util.EmptyVisualizer;
216.68 -
216.69 -/**
216.70 - * This class is used for dealing with IDE's TreeTable component,
216.71 - * used instead of JTree in some dialogs: Options, SetupWizard, ...
216.72 - */
216.73 -public class TreeTableOperator extends JTableOperator {
216.74 - private JTreeOperator _tree;
216.75 -
216.76 - /**
216.77 - * Creates new instance.
216.78 - * @param view JTable representing requested TreeTable
216.79 - */
216.80 - public TreeTableOperator(JTable view) {
216.81 - super(view);
216.82 - }
216.83 -
216.84 - /**
216.85 - * Creates new instance for the first TreeTable in container.
216.86 - * @param contOper container where to find TreeTable
216.87 - */
216.88 - public TreeTableOperator(ContainerOperator contOper) {
216.89 - this(contOper, 0);
216.90 - }
216.91 - /**
216.92 - * Creates new instance for the first TreeTable in container.
216.93 - * @param contOper container where to find TreeTable
216.94 - * @param index int index
216.95 - */
216.96 - public TreeTableOperator(ContainerOperator contOper, int index) {
216.97 - this((JTable)
216.98 - waitComponent(contOper,
216.99 - new TreeTableFinder(ComponentSearcher.
216.100 - getTrueChooser("Any TreeTable")),
216.101 - index));
216.102 - copyEnvironment(contOper);
216.103 - }
216.104 -
216.105 - /**
216.106 - * Returns operator for a tree which is showed as a part of the table.
216.107 - * @return JTreeOperator instance
216.108 - */
216.109 - public JTreeOperator tree() {
216.110 - if(_tree == null) {
216.111 - // cell renderer component for first column is JTree
216.112 - Object value = getValueAt(0, 0);
216.113 - JTree jTree = (JTree)getCellRenderer(0, 0).getTableCellRendererComponent((JTable)this.getSource(), value, false, false, 0, 0);
216.114 - // Need to set EmptyVisualizer because found JTree doesn't have any parent Container
216.115 - // and calling makeComponentVisible() throws NPE
216.116 -// _tree = new JTreeOperator(jTree);
216.117 - _tree = new RenderedTreeOperator(this, jTree);
216.118 - _tree.setVisualizer(new EmptyVisualizer());
216.119 - }
216.120 - // Everytime make parent container visible because tree has EmptyVisualizer
216.121 - // and it is need for example for popup menu operations on JTree
216.122 - makeComponentVisible();
216.123 - return _tree;
216.124 - }
216.125 -
216.126 - /** Registers RenderedMouseDriver to be used by RenderedTreeOperator. */
216.127 - static {
216.128 - DriverManager.setDriver(DriverManager.MOUSE_DRIVER_ID, new RenderedMouseDriver(), RenderedTreeOperator.class);
216.129 - }
216.130 -
216.131 - /**
216.132 - * This inner class is a finder, which helps to search a component TreeTable.
216.133 - */
216.134 - static class TreeTableFinder implements ComponentChooser {
216.135 - ComponentChooser subFinder;
216.136 - public TreeTableFinder(ComponentChooser sf) {
216.137 - subFinder = sf;
216.138 - }
216.139 - public boolean checkComponent(Component comp) {
216.140 - Class cls = comp.getClass();
216.141 - do {
216.142 - if(cls.getName().equals("org.openide.explorer.view.TreeTable")) {
216.143 - return(subFinder.checkComponent(comp));
216.144 - }
216.145 - } while((cls = cls.getSuperclass()) != null);
216.146 - return(false);
216.147 - }
216.148 - public String getDescription() {
216.149 - return(subFinder.getDescription());
216.150 - }
216.151 - }
216.152 -
216.153 - /**
216.154 - * MouseDriver used to process events not on JTree but on TreeTable
216.155 - * component which is used to handle events in real.
216.156 - */
216.157 - public static class RenderedMouseDriver extends SupportiveDriver implements MouseDriver {
216.158 -
216.159 - /**
216.160 - * Creates new instance of RenderedMouseDriver.
216.161 - */
216.162 - public RenderedMouseDriver() {
216.163 - super(new Class[] {RenderedTreeOperator.class});
216.164 - }
216.165 -
216.166 - /**
216.167 - * Presses mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.168 - * @param oper operator which delegates events on an real operator
216.169 - * @param x x position of mouse operation
216.170 - * @param y y position of mouse operation
216.171 - * @param mouseButton mouse button identification
216.172 - * @param modifiers modifiers pressed during mouse click
216.173 - */
216.174 - public void pressMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers) {
216.175 - checkSupported(oper);
216.176 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.177 - DriverManager.getMouseDriver(realOper).pressMouse(realOper, x, y, mouseButton, modifiers);
216.178 - }
216.179 -
216.180 - /**
216.181 - * Releases mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.182 - * @param oper operator which delegates events on an real operator
216.183 - * @param x x position of mouse operation
216.184 - * @param y y position of mouse operation
216.185 - * @param mouseButton mouse button identification
216.186 - * @param modifiers modifiers pressed during mouse click
216.187 - */
216.188 - public void releaseMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers) {
216.189 - checkSupported(oper);
216.190 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.191 - DriverManager.getMouseDriver(realOper).releaseMouse(realOper, x, y, mouseButton, modifiers);
216.192 - }
216.193 -
216.194 - /**
216.195 - * Clicks mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.196 - * @param oper operator which delegates events on an real operator
216.197 - * @param x x position of mouse operation
216.198 - * @param y y position of mouse operation
216.199 - * @param clickCount how many times to be clicked
216.200 - * @param mouseButton mouse button identification
216.201 - * @param modifiers modifiers pressed during mouse click
216.202 - * @param mouseClick timeout of mouse click
216.203 - */
216.204 - public void clickMouse(ComponentOperator oper, int x, int y, int clickCount, int mouseButton,
216.205 - int modifiers, Timeout mouseClick) {
216.206 - checkSupported(oper);
216.207 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.208 - DriverManager.getMouseDriver(realOper).clickMouse(realOper, x, y, clickCount, mouseButton, modifiers, mouseClick);
216.209 - }
216.210 -
216.211 - /**
216.212 - * Moves mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.213 - * @param oper operator which delegates events on an real operator
216.214 - * @param x x position of mouse operation
216.215 - * @param y y position of mouse operation
216.216 - */
216.217 - public void moveMouse(ComponentOperator oper, int x, int y) {
216.218 - checkSupported(oper);
216.219 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.220 - DriverManager.getMouseDriver(realOper).moveMouse(realOper, x, y);
216.221 - }
216.222 -
216.223 - /**
216.224 - * Drags mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.225 - * @param oper operator which delegates events on an real operator
216.226 - * @param x x position of mouse operation
216.227 - * @param y y position of mouse operation
216.228 - * @param mouseButton mouse button identification
216.229 - * @param modifiers modifiers pressed during mouse click
216.230 - */
216.231 - public void dragMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers) {
216.232 - checkSupported(oper);
216.233 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.234 - DriverManager.getMouseDriver(realOper).dragMouse(realOper, x, y, mouseButton, modifiers);
216.235 - }
216.236 -
216.237 - /**
216.238 - * Provides drag and drop operation on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.239 - * @param oper operator which delegates events on an real operator
216.240 - * @param start_x x position where to drag
216.241 - * @param start_y y position where to drag
216.242 - * @param end_x x position where to drop
216.243 - * @param end_y y position where to drop
216.244 - * @param mouseButton mouse button identification
216.245 - * @param modifiers modifiers pressed during mouse click
216.246 - * @param before timeout before drag
216.247 - * @param after timeout after drop
216.248 - */
216.249 - public void dragNDrop(ComponentOperator oper, int start_x, int start_y, int end_x, int end_y,
216.250 - int mouseButton, int modifiers, Timeout before, Timeout after) {
216.251 - checkSupported(oper);
216.252 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.253 - DriverManager.getMouseDriver(realOper).dragNDrop(realOper, start_x, start_y, end_x, end_y,
216.254 - mouseButton, modifiers, before, after);
216.255 - }
216.256 -
216.257 - /**
216.258 - * Enters mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.259 - * @param oper operator which delegates events on an real operator
216.260 - */
216.261 - public void enterMouse(ComponentOperator oper){
216.262 - checkSupported(oper);
216.263 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.264 - DriverManager.getMouseDriver(realOper).enterMouse(realOper);
216.265 - }
216.266 -
216.267 - /**
216.268 - * Exits mouse on operator given by {@link TreeTableOperator.RenderedTreeOperator#getRealOperator getRealOperator()} method.
216.269 - * @param oper operator which delegates events on an real operator
216.270 - */
216.271 - public void exitMouse(ComponentOperator oper) {
216.272 - checkSupported(oper);
216.273 - ComponentOperator realOper = ((RenderedTreeOperator)oper).getRealOperator();
216.274 - DriverManager.getMouseDriver(realOper).exitMouse(realOper);
216.275 - }
216.276 - }
216.277 -
216.278 - /**
216.279 - * Operator used to process events not on JTree but on TreeTable
216.280 - * component which is used to handle events in real.
216.281 - */
216.282 - public static class RenderedTreeOperator extends JTreeOperator {
216.283 - TreeTableOperator oper;
216.284 -
216.285 - /**
216.286 - * Creates new instance of RenderedTreeOperator.
216.287 - * @param oper TreeTable operator to handle events
216.288 - * @param tree JTree representing nodes
216.289 - */
216.290 - public RenderedTreeOperator(TreeTableOperator oper, JTree tree) {
216.291 - super(tree);
216.292 - this.oper = oper;
216.293 - }
216.294 -
216.295 - /**
216.296 - * Returns TreeTableOperator instance which is used to handle events.
216.297 - * @return TreeTableOperator instance
216.298 - */
216.299 - public ComponentOperator getRealOperator() {
216.300 - return(oper);
216.301 - }
216.302 -
216.303 - /**
216.304 - * Calls popup menu on specified tree paths.
216.305 - * @param paths an array of TreePath instances
216.306 - * @param mouseButton mouse button identification
216.307 - * @return JPopupMenu instance opened by this method
216.308 - */
216.309 - public JPopupMenu callPopupOnPaths(TreePath[] paths, int mouseButton) {
216.310 - oper.makeComponentVisible();
216.311 - for(int i = 0; i < paths.length; i++) {
216.312 - if(paths[i].getParentPath() != null) {
216.313 - expandPath(paths[i].getParentPath());
216.314 - }
216.315 - }
216.316 - selectPaths(paths);
216.317 - scrollToPath(paths[paths.length - 1]);
216.318 - Point point = getPointToClick(paths[paths.length - 1]);
216.319 - return(JPopupMenuOperator.callPopup(oper.getSource(),
216.320 - (int)point.getX(),
216.321 - (int)point.getY(),
216.322 - mouseButton));
216.323 - }
216.324 -
216.325 - /**
216.326 - * Scrolls to a path if the tree is on a JScrollPane component.
216.327 - * @param path TreePath where to scroll
216.328 - */
216.329 - public void scrollToPath(TreePath path) {
216.330 - makeComponentVisible();
216.331 - //try to find JScrollPane under.
216.332 - JScrollPane scroll = (JScrollPane)getContainer(new JScrollPaneOperator.
216.333 - JScrollPaneFinder(ComponentSearcher.
216.334 - getTrueChooser("JScrollPane")));
216.335 - if(scroll == null) {
216.336 - return;
216.337 - }
216.338 - JScrollPaneOperator scroller = new JScrollPaneOperator(scroll);
216.339 - scroller.copyEnvironment(this);
216.340 - scroller.setVisualizer(new EmptyVisualizer());
216.341 - Rectangle rect = getPathBounds(path);
216.342 - if(rect != null) {
216.343 - scroller.scrollToComponentRectangle(getRealOperator().getSource(),
216.344 - (int)rect.getX(),
216.345 - (int)rect.getY(),
216.346 - (int)rect.getWidth(),
216.347 - (int)rect.getHeight());
216.348 - } else {
216.349 - throw(new NoSuchPathException(path));
216.350 - }
216.351 - }
216.352 - }
216.353 -
216.354 - /**
216.355 - * Performs verification by accessing all sub-components
216.356 - */
216.357 - public void verify() {
216.358 - tree();
216.359 - }
216.360 -}
217.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/Util.java Thu Jul 10 04:29:52 2008 -0700
217.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
217.3 @@ -1,322 +0,0 @@
217.4 -/*
217.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
217.6 - *
217.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
217.8 - *
217.9 - * The contents of this file are subject to the terms of either the GNU
217.10 - * General Public License Version 2 only ("GPL") or the Common
217.11 - * Development and Distribution License("CDDL") (collectively, the
217.12 - * "License"). You may not use this file except in compliance with the
217.13 - * License. You can obtain a copy of the License at
217.14 - * http://www.netbeans.org/cddl-gplv2.html
217.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
217.16 - * specific language governing permissions and limitations under the
217.17 - * License. When distributing the software, include this License Header
217.18 - * Notice in each file and include the License file at
217.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
217.20 - * particular file as subject to the "Classpath" exception as provided
217.21 - * by Sun in the GPL Version 2 section of the License file that
217.22 - * accompanied this code. If applicable, add the following below the
217.23 - * License Header, with the fields enclosed by brackets [] replaced by
217.24 - * your own identifying information:
217.25 - * "Portions Copyrighted [year] [name of copyright owner]"
217.26 - *
217.27 - * Contributor(s):
217.28 - *
217.29 - * The Original Software is NetBeans. The Initial Developer of the Original
217.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
217.31 - * Microsystems, Inc. All Rights Reserved.
217.32 - *
217.33 - * If you wish your version of this file to be governed by only the CDDL
217.34 - * or only the GPL Version 2, indicate your decision by adding
217.35 - * "[Contributor] elects to include this software in this distribution
217.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
217.37 - * single choice of license, a recipient has the option to distribute
217.38 - * your version of this file under either the CDDL, the GPL Version 2 or
217.39 - * to extend the choice of license to its licensees as provided above.
217.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
217.41 - * Version 2 license, then the option applies only if the new code is
217.42 - * made subject to such option by the copyright holder.
217.43 - */
217.44 -
217.45 -package org.netbeans.modules.visualweb.gravy;
217.46 -
217.47 -import java.util.*;
217.48 -import java.awt.*;
217.49 -import org.netbeans.jemmy.operators.*;
217.50 -import org.netbeans.jemmy.util.DefaultVisualizer;
217.51 -import org.netbeans.jemmy.util.NameComponentChooser;
217.52 -import org.netbeans.jemmy.Waiter;
217.53 -import org.netbeans.jemmy.Waitable;
217.54 -import org.netbeans.jemmy.EventTool;
217.55 -import org.netbeans.jemmy.QueueTool;
217.56 -import java.awt.event.*;
217.57 -import org.netbeans.junit.NbTestCase;
217.58 -import org.netbeans.jellytools.*;
217.59 -import org.netbeans.jellytools.Bundle;
217.60 -import org.netbeans.jemmy.EventDispatcher;
217.61 -
217.62 -/**
217.63 - * Class with different ancillary utils.
217.64 - */
217.65 -public class Util {
217.66 - public static final String
217.67 - WINDOWS_OS_FAMILY_NAME = "Windows",
217.68 - LINUX_OS_FAMILY_NAME = "Linux",
217.69 - SUN_OS_FAMILY_NAME = "SunOS",
217.70 - MAC_OS_FAMILY_NAME = "Mac";
217.71 -
217.72 - static MainWindowOperator mainWindow;
217.73 - static JMenuBarOperator mainMenu;
217.74 -
217.75 - /**
217.76 - * Get delay scale for tests.
217.77 - * @return double Value of delay scale.
217.78 - */
217.79 - public static double getDelayScale(){
217.80 - String s=System.getProperty("Env-RaveTestsDelayScale","1");
217.81 - try{
217.82 - return Double.parseDouble(s);
217.83 - }catch(NumberFormatException e){
217.84 - return 1;
217.85 - }
217.86 - }
217.87 -
217.88 - /**
217.89 - * Get operation system's name.
217.90 - * @return String Name of operation system.
217.91 - */
217.92 - public static String getOperatingSystemName() {
217.93 - return System.getProperty("os.name");
217.94 - }
217.95 -
217.96 - /**
217.97 - * @return True if operation system is from Windows family.
217.98 - */
217.99 - public static boolean isWindowsOS() {
217.100 - String osName = getOperatingSystemName();
217.101 - return (osName.toUpperCase().indexOf(
217.102 - WINDOWS_OS_FAMILY_NAME.toUpperCase()) > -1);
217.103 - }
217.104 -
217.105 - /**
217.106 - * @return True if operation system is from Sun (Solaris) family.
217.107 - */
217.108 - public static boolean isSunOS() {
217.109 - String osName = getOperatingSystemName();
217.110 - return (osName.toUpperCase().indexOf(
217.111 - SUN_OS_FAMILY_NAME.toUpperCase()) > -1);
217.112 - }
217.113 -
217.114 - /**
217.115 - * @return True if operation system is from MAC OS X family.
217.116 - */
217.117 - public static boolean isMacOS() {
217.118 - String osName = getOperatingSystemName();
217.119 - return (osName.toUpperCase().indexOf(
217.120 - MAC_OS_FAMILY_NAME.toUpperCase()) > -1);
217.121 - }
217.122 -
217.123 - /**
217.124 - * Get main window.
217.125 - * @return MainWindowOperator.
217.126 - */
217.127 - public static MainWindowOperator getMainWindow() {
217.128 - if(mainWindow == null) {
217.129 - Operator.setDefaultComponentVisualizer(new DefaultVisualizer());
217.130 - mainWindow = new MainWindowOperator();
217.131 - }
217.132 - return(mainWindow);
217.133 - }
217.134 -
217.135 - /**
217.136 - * Get main menu.
217.137 - * @return JMenuBarOperator Main menu.
217.138 - */
217.139 - public static JMenuBarOperator getMainMenu() {
217.140 - if(mainMenu == null) {
217.141 - mainMenu = new JMenuBarOperator(getMainWindow());
217.142 - }
217.143 - return(mainMenu);
217.144 - }
217.145 -
217.146 - /**
217.147 - * Get main tab.
217.148 - * @return JTabbedPaneOperator Main tab.
217.149 - */
217.150 - public static JTabbedPaneOperator getMainTab() {
217.151 - return(new JTabbedPaneOperator(new ContainerOperator(getMainWindow(),
217.152 - new NameComponentChooser("mainTab"))));
217.153 - }
217.154 -
217.155 - /**
217.156 - * Select tab with specified name.
217.157 - * @param tabName Name of the tab.
217.158 - */
217.159 - public static void selectTab(String tabName){
217.160 - new org.netbeans.jellytools.TopComponentOperator(tabName);
217.161 - }
217.162 -
217.163 - /**
217.164 - * Generate time stamp.
217.165 - * @return String Time stamp.
217.166 - */
217.167 - public static String generateTimeStamp() {
217.168 - Calendar calendar = Calendar.getInstance();
217.169 - return("" +
217.170 - calendar.get(Calendar.YEAR) +
217.171 - calendar.get(Calendar.MONTH) +
217.172 - calendar.get(Calendar.DAY_OF_MONTH) +
217.173 - calendar.get(Calendar.HOUR_OF_DAY) +
217.174 - calendar.get(Calendar.MINUTE) +
217.175 - calendar.get(Calendar.SECOND));
217.176 - }
217.177 -
217.178 - /**
217.179 - * Close main window.
217.180 - */
217.181 - public static void closeWindow(){
217.182 - (new org.netbeans.jellytools.actions.Action(
217.183 - Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Window").substring(1)/*Menu/Window=&Window*/
217.184 - + "|" +
217.185 - Bundle.getStringTrimmed("org.netbeans.core.windows.actions.Bundle", "LBL_CloseWindowAction"), /*Close Window*/
217.186 - null)).performMenu();
217.187 - }
217.188 -
217.189 - /**
217.190 - * Save all that is opened and changed with main menu.
217.191 - */
217.192 - public static void saveAll(){
217.193 - // find item "Save all"
217.194 - JMenuItemOperator saveAll= Util.getMainMenu().showMenuItem(new String[]{"File","Save All"});
217.195 - if (saveAll.isEnabled()){
217.196 - Util.getMainMenu().pushMenu(Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File")+"|"+Bundle.getStringTrimmed("com.sun.rave.gravy.project.actions.Bundle", "LBL_SaveAllAction"));
217.197 - }
217.198 - }
217.199 -
217.200 - /**
217.201 - * Save all that is opened and changed with API function.
217.202 - */
217.203 - public static void saveAllAPICall() {
217.204 - ((org.openide.actions.SaveAllAction)org.openide.actions.SaveAllAction.
217.205 - findObject(org.openide.actions.SaveAllAction.class, true)).performAction();
217.206 - }
217.207 -
217.208 - /**
217.209 - * Get time of execution.
217.210 - * @return long Time in format long.
217.211 - */
217.212 - public static long getExecutionTime() {
217.213 - String execTime = System.getProperty("xtest.ide.execution.time");
217.214 - if(execTime != null) {
217.215 - System.out.println("Property = " + execTime);
217.216 - int comps[] = new int[6];
217.217 - StringTokenizer token = new StringTokenizer(execTime, ":");
217.218 - for(int i = 0; i<6; i++) {
217.219 - comps[i] = Integer.parseInt(token.nextToken());
217.220 - }
217.221 - Calendar calend = Calendar.getInstance();
217.222 - calend.set(comps[0], comps[1] - 1, comps[2], comps[3], comps[4], comps[5]);
217.223 - long result = calend.getTimeInMillis();
217.224 - System.out.print("Execution time: " + calend.toString());
217.225 - System.out.println(" = " + result);
217.226 - return(result);
217.227 - } else {
217.228 - throw(new RuntimeException("xtest.ide.execution.time property is empty"));
217.229 - }
217.230 - }
217.231 -
217.232 - /**
217.233 - * Get current time .
217.234 - * @return long Time in format long.
217.235 - */
217.236 - public static long getCurrentTime() {
217.237 - Calendar calend = Calendar.getInstance();
217.238 - long result = calend.getTimeInMillis();
217.239 - System.out.print("Current time: " + calend.toString());
217.240 - System.out.println(" = " + result);
217.241 - return(result);
217.242 - }
217.243 -
217.244 - /**
217.245 - * Save performance data.
217.246 - */
217.247 - public static void savePerformanceData(NbTestCase test, String id, long startTime, long endTime) {
217.248 - System.out.println("Time diff is " + (endTime - startTime));
217.249 - System.out.println("Saving it into " + test.getName() + ".perfdata");
217.250 - test.getLog(test.getName() + ".perfdata").print(test.getName() + "." + id + " = ");
217.251 - test.getLog(test.getName() + ".perfdata").println(endTime - startTime);
217.252 - }
217.253 -
217.254 - /**
217.255 - * Save performance data.
217.256 - */
217.257 - public static void savePerformanceData(NbTestCase test, String id, long startTime) {
217.258 - savePerformanceData(test, id, startTime, getCurrentTime());
217.259 - }
217.260 -
217.261 - /**
217.262 - * Wait for specified time.
217.263 - * @param millisec Amount of milliseconds.
217.264 - */
217.265 - public static void wait(int millisec){
217.266 - millisec = new Double(millisec*getDelayScale()).intValue();
217.267 - System.out.println("Delay scale() = " + getDelayScale());
217.268 - System.out.println("Sleep to "+millisec/1000+" seconds");
217.269 - EventDispatcher.waitQueueEmpty();
217.270 - try { Thread.sleep(millisec); } catch(Exception e) {}
217.271 - EventDispatcher.waitQueueEmpty();
217.272 - }
217.273 -
217.274 - /**
217.275 - * Wait for any keyboard event.
217.276 - */
217.277 - public static void waitKeyboardEvent() {
217.278 - waitKeyboardEvent(1200000);
217.279 - }
217.280 -
217.281 - /**
217.282 - * Wait for any keyboard event with specified delay.
217.283 - * @param delay Time for delay in long format
217.284 - */
217.285 - public static void waitKeyboardEvent(long delay) {
217.286 - String interactiveTestMode = System.getProperty("interactive.test.mode");
217.287 - if ((interactiveTestMode == null) || (!interactiveTestMode.equalsIgnoreCase("Yes"))) {
217.288 - return;
217.289 - }
217.290 - Waiter kbdWaiter = getKeyboardEventWaiter();
217.291 - kbdWaiter.getTimeouts().setTimeout("Waiter.WaitingTime", delay);
217.292 - try {
217.293 - kbdWaiter.waitAction(null);
217.294 - } catch(Exception e) {
217.295 - e.printStackTrace();
217.296 - }
217.297 - }
217.298 -
217.299 - private static Waiter getKeyboardEventWaiter() {
217.300 - final String msgKeyWasPressed = "Key was pressed";
217.301 - Waiter kbdWaiter = new Waiter(new Waitable() {
217.302 - public Object actionProduced(Object obj) {
217.303 - AWTEvent awtEvent = null;
217.304 - try {
217.305 - awtEvent = EventTool.getLastEvent();
217.306 - } catch(Exception e) {
217.307 - TestUtils.outMsg("+++ Exception was thrown = " + e.getMessage());
217.308 - e.printStackTrace();
217.309 - return e.getMessage();
217.310 - }
217.311 - Util.wait(1000);
217.312 - new QueueTool().waitEmpty();
217.313 - if (awtEvent.getID() == KeyEvent.KEY_RELEASED) {
217.314 - TestUtils.outMsg("+++ " + msgKeyWasPressed);
217.315 - return msgKeyWasPressed;
217.316 - }
217.317 - return null;
217.318 - }
217.319 - public String getDescription() {
217.320 - return "Waiting for key press...";
217.321 - }
217.322 - });
217.323 - return kbdWaiter;
217.324 - }
217.325 -}
218.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/Action.java Thu Jul 10 04:29:52 2008 -0700
218.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
218.3 @@ -1,777 +0,0 @@
218.4 -/*
218.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
218.6 - *
218.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
218.8 - *
218.9 - * The contents of this file are subject to the terms of either the GNU
218.10 - * General Public License Version 2 only ("GPL") or the Common
218.11 - * Development and Distribution License("CDDL") (collectively, the
218.12 - * "License"). You may not use this file except in compliance with the
218.13 - * License. You can obtain a copy of the License at
218.14 - * http://www.netbeans.org/cddl-gplv2.html
218.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
218.16 - * specific language governing permissions and limitations under the
218.17 - * License. When distributing the software, include this License Header
218.18 - * Notice in each file and include the License file at
218.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
218.20 - * particular file as subject to the "Classpath" exception as provided
218.21 - * by Sun in the GPL Version 2 section of the License file that
218.22 - * accompanied this code. If applicable, add the following below the
218.23 - * License Header, with the fields enclosed by brackets [] replaced by
218.24 - * your own identifying information:
218.25 - * "Portions Copyrighted [year] [name of copyright owner]"
218.26 - *
218.27 - * Contributor(s):
218.28 - *
218.29 - * The Original Software is NetBeans. The Initial Developer of the Original
218.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
218.31 - * Microsystems, Inc. All Rights Reserved.
218.32 - *
218.33 - * If you wish your version of this file to be governed by only the CDDL
218.34 - * or only the GPL Version 2, indicate your decision by adding
218.35 - * "[Contributor] elects to include this software in this distribution
218.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
218.37 - * single choice of license, a recipient has the option to distribute
218.38 - * your version of this file under either the CDDL, the GPL Version 2 or
218.39 - * to extend the choice of license to its licensees as provided above.
218.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
218.41 - * Version 2 license, then the option applies only if the new code is
218.42 - * made subject to such option by the copyright holder.
218.43 - */
218.44 -
218.45 -package org.netbeans.modules.visualweb.gravy.actions;
218.46 -
218.47 -import java.awt.Component;
218.48 -import java.awt.Container;
218.49 -import java.awt.EventQueue;
218.50 -import java.awt.event.ActionEvent;
218.51 -import java.awt.event.KeyEvent;
218.52 -import javax.swing.tree.TreePath;
218.53 -
218.54 -import org.netbeans.jellytools.JellyVersion;
218.55 -import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
218.56 -import org.netbeans.modules.visualweb.gravy.Util;
218.57 -// mdk import org.netbeans.jellytools.nodes.Node;
218.58 -import org.netbeans.modules.visualweb.gravy.nodes.Node;
218.59 -import org.netbeans.jemmy.EventTool;
218.60 -import org.netbeans.jemmy.JemmyException;
218.61 -import org.netbeans.jemmy.JemmyProperties;
218.62 -import org.netbeans.jemmy.Timeouts;
218.63 -import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
218.64 -import org.netbeans.jemmy.operators.ComponentOperator;
218.65 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
218.66 -import org.netbeans.jemmy.operators.Operator;
218.67 -import org.netbeans.jemmy.operators.Operator.ComponentVisualizer;
218.68 -import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
218.69 -import org.netbeans.jemmy.operators.Operator.StringComparator;
218.70 -import org.netbeans.jemmy.util.EmptyVisualizer;
218.71 -import org.openide.util.actions.SystemAction;
218.72 -
218.73 -
218.74 -/** Ancestor class for all blocking actions.<p>
218.75 - * It handles performing action through main menu (MENU_MODE), popup menu
218.76 - * (POPUP_MODE), IDE SystemAction API call (API_MODE) or through keyboard shortcut
218.77 - * (SHORTCUT_MODE).<p>
218.78 - * Action can be performed in exact mode by calling performMenu(...),
218.79 - * performPopup(...), performAPI(...) or performShortcut(...).<p>
218.80 - * If exact mode is not supported by the action it throws
218.81 - * UnsupportedOperationException.<p>
218.82 - * Current implementation supports MENU_MODE when menuPath is defined, POPUP_MODE
218.83 - * when popupPath is defined, API_MODE when systemActionClass is defined and
218.84 - * SHORTCUT_MODE when shorcut is defined (see Action constructors).<p>
218.85 - * Action also can be performed using runtime default mode by calling perform(...).<p>
218.86 - * When default mode is not support by the action other modes are tried till
218.87 - * supported mode found and action is performed.
218.88 - *
218.89 - * <BR>Timeouts used: <BR>
218.90 - * Action.WaitAfterShortcutTimeout - time to sleep between shortcuts in sequence (default 0) <BR>
218.91 - *
218.92 - * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
218.93 -public class Action {
218.94 -
218.95 - /** through menu action performing mode */
218.96 - public static final int MENU_MODE = 0;
218.97 - /** through popup menu action performing mode */
218.98 - public static final int POPUP_MODE = 1;
218.99 - /** through API action performing mode */
218.100 - public static final int API_MODE = 2;
218.101 - /** through shortcut action performing mode */
218.102 - public static final int SHORTCUT_MODE = 3;
218.103 -
218.104 - /** sleep time between nodes selection and action execution */
218.105 - protected static final long SELECTION_WAIT_TIME = 300;
218.106 - /** sleep time after action execution */
218.107 - protected static final long AFTER_ACTION_WAIT_TIME = 0;
218.108 - /** sleep time between sequence of shortcuts */
218.109 - protected static final long WAIT_AFTER_SHORTCUT_TIMEOUT = 0;
218.110 -
218.111 - private static final int sequence[][] = {{MENU_MODE, POPUP_MODE, SHORTCUT_MODE, API_MODE},
218.112 - {POPUP_MODE, MENU_MODE, SHORTCUT_MODE, API_MODE},
218.113 - {API_MODE, POPUP_MODE, MENU_MODE, SHORTCUT_MODE},
218.114 - {SHORTCUT_MODE, POPUP_MODE, MENU_MODE, API_MODE}};
218.115 -
218.116 - /** menu path of current action or null when MENU_MODE is not supported */
218.117 - protected String menuPath;
218.118 - /** popup menu path of current action or null when POPUP_MODE is not supported */
218.119 - protected String popupPath;
218.120 - /** SystemAction class of current action or null when API_MODE is not supported */
218.121 - protected Class systemActionClass;
218.122 - /** array of shortcuts of current action or null when SHORTCUT_MODE is not supported */
218.123 - protected Shortcut[] shortcuts;
218.124 -
218.125 - /** Comparator used as default for all Action instances. It is set in static clause. */
218.126 - private static StringComparator defaultComparator;
218.127 - /** Comparator used for this action instance. */
218.128 - private StringComparator comparator;
218.129 -
218.130 - /** creates new Action instance without API_MODE and SHORTCUT_MODE support
218.131 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
218.132 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
218.133 - public Action(String menuPath, String popupPath) {
218.134 - this(menuPath, popupPath, null, (Shortcut[])null);
218.135 - }
218.136 -
218.137 - /** creates new Action instance without SHORTCUT_MODE support
218.138 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
218.139 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
218.140 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
218.141 - public Action(String menuPath, String popupPath, String systemActionClass) {
218.142 - this(menuPath, popupPath, systemActionClass, (Shortcut[])null);
218.143 - }
218.144 -
218.145 - /** creates new Action instance without API_MODE support
218.146 - * @param shortcuts array of Shortcut instances (use null value if shorcut mode is not supported)
218.147 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
218.148 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
218.149 - public Action(String menuPath, String popupPath, Shortcut[] shortcuts) {
218.150 - this(menuPath, popupPath, null, shortcuts);
218.151 - }
218.152 -
218.153 - /** creates new Action instance without API_MODE support
218.154 - * @param shortcut Shortcut (use null value if menu mode is not supported)
218.155 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
218.156 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
218.157 - public Action(String menuPath, String popupPath, Shortcut shortcut) {
218.158 - this(menuPath, popupPath, null, new Shortcut[] {shortcut});
218.159 - }
218.160 -
218.161 - /** creates new Action instance
218.162 - * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
218.163 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
218.164 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
218.165 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
218.166 - public Action(String menuPath, String popupPath, String systemActionClass, Shortcut[] shortcuts) {
218.167 - this.menuPath = menuPath;
218.168 - this.popupPath = popupPath;
218.169 - if (systemActionClass==null) {
218.170 - this.systemActionClass = null;
218.171 - } else try {
218.172 - this.systemActionClass = Class.forName(systemActionClass);
218.173 - } catch (ClassNotFoundException e) {
218.174 - this.systemActionClass = null;
218.175 - }
218.176 - this.shortcuts = shortcuts;
218.177 - }
218.178 -
218.179 - /** creates new Action instance
218.180 - * @param shortcut Shortcut String (use null value if menu mode is not supported)
218.181 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
218.182 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
218.183 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
218.184 - public Action(String menuPath, String popupPath, String systemActionClass, Shortcut shortcut) {
218.185 - this(menuPath, popupPath, systemActionClass, new Shortcut[] {shortcut});
218.186 - }
218.187 -
218.188 - static {
218.189 - // Checks if you run on correct jemmy version. Writes message to jemmy log if not.
218.190 - JellyVersion.checkJemmyVersion();
218.191 -
218.192 - if (JemmyProperties.getCurrentProperty("Action.DefaultMode")==null)
218.193 - JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(POPUP_MODE));
218.194 - Timeouts.initDefault("Action.WaitAfterShortcutTimeout", WAIT_AFTER_SHORTCUT_TIMEOUT);
218.195 - // Set case sensitive comparator as default because of
218.196 - // very often clash between Cut and Execute menu items.
218.197 - // Substring criterion is set according to default string comparator
218.198 - boolean compareExactly = !Operator.getDefaultStringComparator().equals("abc", "a"); // NOI18N
218.199 - defaultComparator = new DefaultStringComparator(compareExactly, true);
218.200 - }
218.201 -
218.202 - private void perform(int mode) {
218.203 - switch (mode) {
218.204 - case POPUP_MODE: performPopup(); break;
218.205 - case MENU_MODE: performMenu(); break;
218.206 - case API_MODE: performAPI(); break;
218.207 - case SHORTCUT_MODE: performShortcut(); break;
218.208 - default: throw new IllegalArgumentException("Wrong Action.MODE");
218.209 - }
218.210 - }
218.211 -
218.212 - private void perform(Node node, int mode) {
218.213 - switch (mode) {
218.214 - case POPUP_MODE: performPopup(node); break;
218.215 - case MENU_MODE: performMenu(node); break;
218.216 - case API_MODE: performAPI(node); break;
218.217 - case SHORTCUT_MODE: performShortcut(node); break;
218.218 - default: throw new IllegalArgumentException("Wrong Action.MODE");
218.219 - }
218.220 - }
218.221 -
218.222 - private void perform(Node[] nodes, int mode) {
218.223 - switch (mode) {
218.224 - case POPUP_MODE: performPopup(nodes); break;
218.225 - case MENU_MODE: performMenu(nodes); break;
218.226 - case API_MODE: performAPI(nodes); break;
218.227 - case SHORTCUT_MODE: performShortcut(nodes); break;
218.228 - default: throw new IllegalArgumentException("Wrong Action.MODE");
218.229 - }
218.230 - }
218.231 -
218.232 - private void perform(ComponentOperator component, int mode) {
218.233 - switch (mode) {
218.234 - case POPUP_MODE: performPopup(component); break;
218.235 - case MENU_MODE: performMenu(component); break;
218.236 - case API_MODE: performAPI(component); break;
218.237 - case SHORTCUT_MODE: performShortcut(component); break;
218.238 - default: throw new IllegalArgumentException("Wrong Action.MODE");
218.239 - }
218.240 - }
218.241 -
218.242 -
218.243 - /** performs action depending on default mode,<br>
218.244 - * calls performPopup(), performMenu() or performAPI(),<br>
218.245 - * when default mode is not supported, others are tried */
218.246 - public void perform() {
218.247 - int modes[] = sequence[getDefaultMode()];
218.248 - for (int i=0; i<modes.length; i++) try {
218.249 - perform(modes[i]);
218.250 - return;
218.251 - } catch (UnsupportedOperationException e) {}
218.252 - }
218.253 -
218.254 - /** performs action depending on default mode,<br>
218.255 - * calls performPopup(), performMenu() or performAPI(),<br>
218.256 - * when default mode is not supported, others are tried
218.257 - * @param node node to be action performed on */
218.258 - public void perform(Node node) {
218.259 - int modes[] = sequence[getDefaultMode()];
218.260 - for (int i=0; i<modes.length; i++) try {
218.261 - perform(node, modes[i]);
218.262 - return;
218.263 - } catch (UnsupportedOperationException e) {}
218.264 - }
218.265 -
218.266 - /** performs action depending on default mode,<br>
218.267 - * calls performPopup(), performMenu() or performAPI(),<br>
218.268 - * when default mode is not supported, others are tried
218.269 - * @param nodes nodes to be action performed on */
218.270 - public void perform(Node[] nodes) {
218.271 - int modes[] = sequence[getDefaultMode()];
218.272 - for (int i=0; i<modes.length; i++) try {
218.273 - perform(nodes, modes[i]);
218.274 - return;
218.275 - } catch (UnsupportedOperationException e) {}
218.276 - }
218.277 -
218.278 - /** performs action depending on default mode,<br>
218.279 - * calls performPopup(), performMenu() or performAPI(),<br>
218.280 - * when default mode is not supported, others are tried
218.281 - * @param component component to be action performed on */
218.282 - public void perform(ComponentOperator component) {
218.283 - int modes[] = sequence[getDefaultMode()];
218.284 - for (int i=0; i<modes.length; i++) try {
218.285 - perform(component, modes[i]);
218.286 - return;
218.287 - } catch (UnsupportedOperationException e) {}
218.288 - }
218.289 -
218.290 - /** performs action through main menu
218.291 - * @throws UnsupportedOperationException when action does not support menu mode */
218.292 - public void performMenu() {
218.293 - if (menuPath==null) {
218.294 - throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
218.295 - }
218.296 - // Need to wait here to be more reliable.
218.297 - // TBD - It can be removed after issue 23663 is solved.
218.298 - new EventTool().waitNoEvent(500);
218.299 - Util.getMainMenu().pushMenu(menuPath);
218.300 - try {
218.301 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
218.302 - } catch (Exception e) {
218.303 - throw new JemmyException("Sleeping interrupted", e);
218.304 - }
218.305 - }
218.306 -
218.307 - /** performs action through main menu
218.308 - * @param node node to be action performed on
218.309 - * @throws UnsupportedOperationException when action does not support menu mode */
218.310 - public void performMenu(Node node) {
218.311 - performMenu(new Node[]{node});
218.312 - }
218.313 -
218.314 - /** performs action through main menu
218.315 - * @param nodes nodes to be action performed on
218.316 - * @throws UnsupportedOperationException when action does not support menu mode */
218.317 - public void performMenu(Node[] nodes) {
218.318 - if (menuPath==null)
218.319 - throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
218.320 - testNodes(nodes);
218.321 - nodes[0].select();
218.322 - for (int i=1; i<nodes.length; i++)
218.323 - nodes[i].addSelectionPath();
218.324 - try {
218.325 - Thread.sleep(SELECTION_WAIT_TIME);
218.326 - } catch (Exception e) {
218.327 - throw new JemmyException("Sleeping interrupted", e);
218.328 - }
218.329 - performMenu();
218.330 - }
218.331 -
218.332 - /** performs action through main menu
218.333 - * @param component component to be action performed on
218.334 - * @throws UnsupportedOperationException when action does not support menu mode */
218.335 - public void performMenu(ComponentOperator component) {
218.336 - component.getFocus();
218.337 - try {
218.338 - Thread.sleep(SELECTION_WAIT_TIME);
218.339 - } catch (Exception e) {
218.340 - throw new JemmyException("Sleeping interrupted", e);
218.341 - }
218.342 - performMenu();
218.343 - }
218.344 -
218.345 - /** performs action through popup menu
218.346 - * @throws UnsupportedOperationException */
218.347 - public void performPopup() {
218.348 - throw new UnsupportedOperationException(getClass().toString()+" does not implement performPopup()");
218.349 - }
218.350 -
218.351 - /** performs action through popup menu
218.352 - * @param node node to be action performed on
218.353 - * @throws UnsupportedOperationException when action does not support popup mode */
218.354 - public void performPopup(Node node) {
218.355 - performPopup(new Node[]{node});
218.356 - }
218.357 -
218.358 - /** performs action through popup menu
218.359 - * @param nodes nodes to be action performed on
218.360 - * @throws UnsupportedOperationException when action does not support popup mode */
218.361 - public void performPopup(Node[] nodes) {
218.362 - if (popupPath==null) {
218.363 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
218.364 - }
218.365 - testNodes(nodes);
218.366 - TreePath paths[]=new TreePath[nodes.length];
218.367 - for (int i=0; i<nodes.length; i++) {
218.368 - paths[i]=nodes[i].getTreePath();
218.369 - }
218.370 - ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
218.371 - ComponentVisualizer oldVisualizer = null;
218.372 - // If visualizer of JTreeOperator is EmptyVisualizer, we need
218.373 - // to avoid making tree component visible in callPopup method.
218.374 - // So far only known case is tree from TreeTableOperator.
218.375 - if(treeVisualizer instanceof EmptyVisualizer) {
218.376 - oldVisualizer = Operator.getDefaultComponentVisualizer();
218.377 - Operator.setDefaultComponentVisualizer(treeVisualizer);
218.378 - }
218.379 - // Need to wait here to be more reliable.
218.380 - // TBD - It can be removed after issue 23663 is solved.
218.381 - new EventTool().waitNoEvent(500);
218.382 - JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
218.383 - // restore previously used default visualizer
218.384 - if(oldVisualizer != null) {
218.385 - Operator.setDefaultComponentVisualizer(oldVisualizer);
218.386 - }
218.387 - popup.pushMenu(popupPath, "|", getComparator());
218.388 - try {
218.389 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
218.390 - } catch (Exception e) {
218.391 - throw new JemmyException("Sleeping interrupted", e);
218.392 - }
218.393 - }
218.394 -
218.395 - /** performs action through popup menu
218.396 - * @param component component to be action performed on
218.397 - * @throws UnsupportedOperationException when action does not support popup mode */
218.398 - public void performPopup(ComponentOperator component) {
218.399 - if (popupPath==null) {
218.400 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
218.401 - }
218.402 - // Need to wait here to be more reliable.
218.403 - // TBD - It can be removed after issue 23663 is solved.
218.404 - new EventTool().waitNoEvent(500);
218.405 - component.clickForPopup();
218.406 - new JPopupMenuOperator(component).pushMenu(popupPath, "|", getComparator());
218.407 - try {
218.408 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
218.409 - } catch (Exception e) {
218.410 - throw new JemmyException("Sleeping interrupted", e);
218.411 - }
218.412 - }
218.413 -
218.414 - /** performs action through API
218.415 - * @throws UnsupportedOperationException when action does not support API mode */
218.416 - public void performAPI() {
218.417 - if (systemActionClass==null) {
218.418 - throw new UnsupportedOperationException(getClass().toString()+" does not support API call.");
218.419 - }
218.420 - try {
218.421 - // actions has to be invoked in dispatch thread (see http://www.netbeans.org/issues/show_bug.cgi?id=35755)
218.422 - EventQueue.invokeAndWait(new Runnable() {
218.423 - public void run() {
218.424 - if(SystemAction.class.isAssignableFrom(systemActionClass)) {
218.425 - // SystemAction used in IDE
218.426 - SystemAction.get(systemActionClass).actionPerformed(
218.427 - new ActionEvent(new Container(), 0, null));
218.428 - } else {
218.429 - // action implements javax.swing.Action
218.430 - try {
218.431 - ((javax.swing.Action)systemActionClass.newInstance()).actionPerformed(null);
218.432 - } catch (Exception e) {
218.433 - throw new JemmyException("Exception when trying to create instance of action \""+systemActionClass.getName()+"\".", e);
218.434 - }
218.435 - }
218.436 - }
218.437 - });
218.438 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
218.439 - } catch (Exception e) {
218.440 - throw new JemmyException("Interrupted", e);
218.441 - }
218.442 - }
218.443 -
218.444 - /** performs action through API
218.445 - * @param node node to be action performed on
218.446 - * @throws UnsupportedOperationException when action does not support API mode */
218.447 - public void performAPI(Node node) {
218.448 - performAPI(new Node[]{node});
218.449 - }
218.450 -
218.451 - /** performs action through API
218.452 - * @param nodes nodes to be action performed on
218.453 - * @throws UnsupportedOperationException when action does not support API mode */
218.454 - public void performAPI(Node[] nodes) {
218.455 - if (systemActionClass==null)
218.456 - throw new UnsupportedOperationException(getClass().toString()+" does not define SystemAction");
218.457 - testNodes(nodes);
218.458 - nodes[0].select();
218.459 - for (int i=1; i<nodes.length; i++)
218.460 - nodes[i].addSelectionPath();
218.461 - try {
218.462 - Thread.sleep(SELECTION_WAIT_TIME);
218.463 - } catch (Exception e) {
218.464 - throw new JemmyException("Sleeping interrupted", e);
218.465 - }
218.466 - performAPI();
218.467 - }
218.468 -
218.469 - /** performs action through API
218.470 - * @param component component to be action performed on
218.471 - * @throws UnsupportedOperationException when action does not support API mode */
218.472 - public void performAPI(ComponentOperator component) {
218.473 - component.getFocus();
218.474 - try {
218.475 - Thread.sleep(SELECTION_WAIT_TIME);
218.476 - } catch (Exception e) {
218.477 - throw new JemmyException("Sleeping interrupted", e);
218.478 - }
218.479 - performAPI();
218.480 - }
218.481 -
218.482 - /** performs action through shortcut
218.483 - * @throws UnsupportedOperationException if no shortcut is defined */
218.484 - public void performShortcut() {
218.485 - if (shortcuts == null) {
218.486 - throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
218.487 - }
218.488 - for(int i=0; i<shortcuts.length; i++) {
218.489 - new KeyRobotDriver(null).pushKey(null, shortcuts[i].getKeyCode(), shortcuts[i].getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
218.490 - JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
218.491 - }
218.492 - try {
218.493 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
218.494 - } catch (Exception e) {
218.495 - throw new JemmyException("Sleeping interrupted", e);
218.496 - }
218.497 - }
218.498 -
218.499 - /** performs action through shortcut
218.500 - * @param node node to be action performed on
218.501 - * @throws UnsupportedOperationException when action does not support shortcut mode */
218.502 - public void performShortcut(Node node) {
218.503 - performShortcut(new Node[]{node});
218.504 - }
218.505 -
218.506 - /** performs action through shortcut
218.507 - * @param nodes nodes to be action performed on
218.508 - * @throws UnsupportedOperationException when action does not support shortcut mode */
218.509 - public void performShortcut(Node[] nodes) {
218.510 - if (shortcuts == null) {
218.511 - throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
218.512 - }
218.513 - testNodes(nodes);
218.514 - nodes[0].select();
218.515 - for (int i=1; i<nodes.length; i++)
218.516 - nodes[i].addSelectionPath();
218.517 - try {
218.518 - Thread.sleep(SELECTION_WAIT_TIME);
218.519 - } catch (Exception e) {
218.520 - throw new JemmyException("Sleeping interrupted", e);
218.521 - }
218.522 - performShortcut();
218.523 - }
218.524 -
218.525 - /** performs action through shortcut
218.526 - * @param component component to be action performed on
218.527 - * @throws UnsupportedOperationException when action does not support shortcut mode */
218.528 - public void performShortcut(ComponentOperator component) {
218.529 - component.getFocus();
218.530 - try {
218.531 - Thread.sleep(SELECTION_WAIT_TIME);
218.532 - } catch (Exception e) {
218.533 - throw new JemmyException("Sleeping interrupted", e);
218.534 - }
218.535 - performShortcut();
218.536 - }
218.537 -
218.538 - /** tests if nodes are all from the same tree
218.539 - * @param nodes nodes
218.540 - * @throws IllegalArgumentException when given nodes does not pass */
218.541 - protected void testNodes(Node[] nodes) {
218.542 - if ((nodes==null)||(nodes.length==0))
218.543 - throw new IllegalArgumentException("argument nodes is null or empty");
218.544 - Class myClass = getClass();
218.545 - Component nodesTree=nodes[0].tree().getSource();
218.546 - for (int i=0; i<nodes.length; i++) {
218.547 -// if (!nodes[i].hasAction(myClass))
218.548 -// throw new IllegalArgumentException(this.toString()+" could not be performed on "+nodes[i].toString());
218.549 - if (nodes[i]==null)
218.550 - throw new IllegalArgumentException("argument nodes contains null value");
218.551 - if (!nodesTree.equals(nodes[i].tree().getSource()))
218.552 - throw new IllegalArgumentException(nodes[i].toString()+" is from different tree");
218.553 - }
218.554 - }
218.555 -
218.556 - /** Returns default mode in which actions are performed.
218.557 - * @return default mode in which actions are performed
218.558 - * @see #POPUP_MODE
218.559 - * @see #MENU_MODE
218.560 - * @see #API_MODE
218.561 - * @see #SHORTCUT_MODE
218.562 - */
218.563 - public int getDefaultMode() {
218.564 - int mode=(((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
218.565 - if (mode<0 || mode>3)
218.566 - return POPUP_MODE;
218.567 - return mode;
218.568 - }
218.569 -
218.570 - /** Sets default mode in which actions are performed. If given mode value
218.571 - * is not valid, it sets {@link #POPUP_MODE} as default.
218.572 - * @param mode mode to be set
218.573 - * @return previous value
218.574 - * @see #POPUP_MODE
218.575 - * @see #MENU_MODE
218.576 - * @see #API_MODE
218.577 - * @see #SHORTCUT_MODE
218.578 - */
218.579 - public int setDefaultMode(int mode) {
218.580 - int oldMode = (((Integer)JemmyProperties.getCurrentProperty("Action.DefaultMode")).intValue());
218.581 - if (mode<0 || mode>3) {
218.582 - mode = POPUP_MODE;
218.583 - }
218.584 - JemmyProperties.setCurrentProperty("Action.DefaultMode", new Integer(mode));
218.585 - return oldMode;
218.586 - }
218.587 -
218.588 -
218.589 - /** Sets comparator fot this action. Comparator is used for all actions
218.590 - * after this method is called.
218.591 - * @param comparator new comparator to be set (e.g.
218.592 - * new Operator.DefaultStringComparator(true, true);
218.593 - * to search string item exactly and case sensitive)
218.594 - */
218.595 - public void setComparator(StringComparator comparator) {
218.596 - this.comparator = comparator;
218.597 - }
218.598 -
218.599 - /** Gets comparator set for this action instance.
218.600 - * @return comparator set for this action instance.
218.601 - */
218.602 - public StringComparator getComparator() {
218.603 - if(comparator == null) {
218.604 - comparator = defaultComparator;
218.605 - }
218.606 - return comparator;
218.607 - }
218.608 -
218.609 - /** getter for popup menu path
218.610 - * @return String popup menu path (or null if not suported)
218.611 - */
218.612 - public String getPopupPath() {
218.613 - return popupPath;
218.614 - }
218.615 -
218.616 - /** getter for main menu path
218.617 - * @return String main menu path (or null if not suported)
218.618 - */
218.619 - public String getMenuPath() {
218.620 - return menuPath;
218.621 - }
218.622 -
218.623 - /** getter for system action class
218.624 - * @return Class of system action (or null if not suported)
218.625 - */
218.626 - public Class getSystemActionClass() {
218.627 - return systemActionClass;
218.628 - }
218.629 -
218.630 - /** getter for array of shortcuts
218.631 - * @return Shortcut[] (or null if not suported)
218.632 - */
218.633 - public Shortcut[] getShortcuts() {
218.634 - return shortcuts;
218.635 - }
218.636 -
218.637 - /** Checks whether this action is enabled. If IDE system action class
218.638 - * is defined, it calls its isEnabled() method else if main menu path is
218.639 - * defined, it checks menu item is enabled. Otherwise it throws
218.640 - * UnsupportedOperationException.
218.641 - * @return true if this action is enabled; false otherwise
218.642 - */
218.643 - public boolean isEnabled() {
218.644 - if(systemActionClass != null) {
218.645 - return SystemAction.get(systemActionClass).isEnabled();
218.646 - } else if(menuPath != null) {
218.647 - return Util.getMainMenu().showMenuItem(
218.648 - menuPath, "|", getComparator()).isEnabled();
218.649 - } else {
218.650 - throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
218.651 - }
218.652 - }
218.653 -
218.654 - /** Checks whether this action on given nodes is enabled. If IDE system action class
218.655 - * is defined, it calls its isEnabled() method. Nodes are selected first.
218.656 - * Else if popup menu path is defined, it checks menu item is enabled.
218.657 - * Otherwise it throws UnsupportedOperationException.
218.658 - * @param nodes array of nodes to be selected before a check
218.659 - * @return true if this action is enabled; false otherwise
218.660 - */
218.661 - public boolean isEnabled(Node[] nodes) {
218.662 - testNodes(nodes);
218.663 - if(systemActionClass != null) {
218.664 - nodes[0].select();
218.665 - for (int i=1; i<nodes.length; i++)
218.666 - nodes[i].addSelectionPath();
218.667 - try {
218.668 - Thread.sleep(SELECTION_WAIT_TIME);
218.669 - } catch (Exception e) {
218.670 - throw new JemmyException("Sleeping interrupted", e);
218.671 - }
218.672 - return SystemAction.get(systemActionClass).isEnabled();
218.673 - } else if(popupPath != null) {
218.674 - TreePath paths[]=new TreePath[nodes.length];
218.675 - for (int i=0; i<nodes.length; i++) {
218.676 - paths[i]=nodes[i].getTreePath();
218.677 - }
218.678 - ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
218.679 - ComponentVisualizer oldVisualizer = null;
218.680 - // If visualizer of JTreeOperator is EmptyVisualizer, we need
218.681 - // to avoid making tree component visible in callPopup method.
218.682 - // So far only known case is tree from TreeTableOperator.
218.683 - if(treeVisualizer instanceof EmptyVisualizer) {
218.684 - oldVisualizer = Operator.getDefaultComponentVisualizer();
218.685 - Operator.setDefaultComponentVisualizer(treeVisualizer);
218.686 - }
218.687 - // Need to wait here to be more reliable.
218.688 - // TBD - It can be removed after issue 23663 is solved.
218.689 - new EventTool().waitNoEvent(500);
218.690 - JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
218.691 - // restore previously used default visualizer
218.692 - if(oldVisualizer != null) {
218.693 - Operator.setDefaultComponentVisualizer(oldVisualizer);
218.694 - }
218.695 - return popup.showMenuItem(popupPath, "|", getComparator()).isEnabled();
218.696 - } else {
218.697 - throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
218.698 - }
218.699 - }
218.700 -
218.701 - /** Checks whether this action on given node is enabled. If IDE system action class
218.702 - * is defined, it calls its isEnabled() method. Node is selected first.
218.703 - * Else if popup menu path is defined, it checks menu item is enabled.
218.704 - * Otherwise it throws UnsupportedOperationException.
218.705 - * @param node node to be selected before a check
218.706 - * @return true if this action is enabled; false otherwise
218.707 - */
218.708 - public boolean isEnabled(Node node) {
218.709 - return isEnabled(new Node[] {node});
218.710 - }
218.711 -
218.712 - /** Checks whether this action is enabled for given ComponentOperator.
218.713 - * First it makes component visible and focused.
218.714 - * If IDE system action class is defined, it calls its isEnabled() method.
218.715 - * Else if main menu path is defined, it checks menu item is enabled.
218.716 - * Otherwise it throws UnsupportedOperationException.
218.717 - * @param componentOperator instance of ComponentOperator
218.718 - * @return true if this action is enabled; false otherwise
218.719 - */
218.720 - public boolean isEnabled(ComponentOperator componentOperator) {
218.721 - componentOperator.makeComponentVisible();
218.722 - componentOperator.getFocus();
218.723 - if(systemActionClass != null) {
218.724 - return SystemAction.get(systemActionClass).isEnabled();
218.725 - } else if(popupPath != null) {
218.726 - // Need to wait here to be more reliable.
218.727 - // TBD - It can be removed after issue 23663 is solved.
218.728 - new EventTool().waitNoEvent(500);
218.729 - componentOperator.clickForPopup();
218.730 - return new JPopupMenuOperator(componentOperator).showMenuItem(
218.731 - popupPath, "|", getComparator()).isEnabled();
218.732 - } else if(menuPath != null) {
218.733 - return Util.getMainMenu().showMenuItem(
218.734 - menuPath, "|", getComparator()).isEnabled();
218.735 - } else {
218.736 - throw new UnsupportedOperationException("Cannot detect if "+getClass().getName()+" is enabled.");
218.737 - }
218.738 - }
218.739 -
218.740 - /** This class defines keyboard shortcut for action execution */
218.741 - public static class Shortcut extends Object {
218.742 - /** key code of shortcut (see KeyEvent) */
218.743 - protected int keyCode;
218.744 - /** key modifiers of shortcut (see KeyEvent) */
218.745 - protected int keyModifiers;
218.746 -
218.747 - /** creates new shortcut
218.748 - * @param keyCode int key code (see KeyEvent) */
218.749 - public Shortcut(int keyCode) {
218.750 - this(keyCode, 0);
218.751 - }
218.752 -
218.753 - /** creates new shortcut
218.754 - * @param keyCode int key code (see KeyEvent)
218.755 - * @param keyModifiers int key modifiers (see KeyEvent) */
218.756 - public Shortcut(int keyCode, int keyModifiers) {
218.757 - this.keyCode=keyCode;
218.758 - this.keyModifiers=keyModifiers;
218.759 - }
218.760 -
218.761 - /** getter for key code
218.762 - * @return int key code */
218.763 - public int getKeyCode() {
218.764 - return keyCode;
218.765 - }
218.766 -
218.767 - /** getter for key modifiers
218.768 - * @return int key modifiers */
218.769 - public int getKeyModifiers() {
218.770 - return keyModifiers;
218.771 - }
218.772 -
218.773 - /** returns String representation of shortcut
218.774 - * @return String representation of shortcut */
218.775 - public String toString() {
218.776 - String s=KeyEvent.getKeyModifiersText(getKeyModifiers());
218.777 - return s+(s.length()>0?"+":"")+KeyEvent.getKeyText(getKeyCode());
218.778 - }
218.779 - }
218.780 -}
219.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/ActionNoBlock.java Thu Jul 10 04:29:52 2008 -0700
219.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
219.3 @@ -1,241 +0,0 @@
219.4 -/*
219.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
219.6 - *
219.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
219.8 - *
219.9 - * The contents of this file are subject to the terms of either the GNU
219.10 - * General Public License Version 2 only ("GPL") or the Common
219.11 - * Development and Distribution License("CDDL") (collectively, the
219.12 - * "License"). You may not use this file except in compliance with the
219.13 - * License. You can obtain a copy of the License at
219.14 - * http://www.netbeans.org/cddl-gplv2.html
219.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
219.16 - * specific language governing permissions and limitations under the
219.17 - * License. When distributing the software, include this License Header
219.18 - * Notice in each file and include the License file at
219.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
219.20 - * particular file as subject to the "Classpath" exception as provided
219.21 - * by Sun in the GPL Version 2 section of the License file that
219.22 - * accompanied this code. If applicable, add the following below the
219.23 - * License Header, with the fields enclosed by brackets [] replaced by
219.24 - * your own identifying information:
219.25 - * "Portions Copyrighted [year] [name of copyright owner]"
219.26 - *
219.27 - * Contributor(s):
219.28 - *
219.29 - * The Original Software is NetBeans. The Initial Developer of the Original
219.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
219.31 - * Microsystems, Inc. All Rights Reserved.
219.32 - *
219.33 - * If you wish your version of this file to be governed by only the CDDL
219.34 - * or only the GPL Version 2, indicate your decision by adding
219.35 - * "[Contributor] elects to include this software in this distribution
219.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
219.37 - * single choice of license, a recipient has the option to distribute
219.38 - * your version of this file under either the CDDL, the GPL Version 2 or
219.39 - * to extend the choice of license to its licensees as provided above.
219.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
219.41 - * Version 2 license, then the option applies only if the new code is
219.42 - * made subject to such option by the copyright holder.
219.43 - */
219.44 -
219.45 -package org.netbeans.modules.visualweb.gravy.actions;
219.46 -
219.47 -import java.awt.Container;
219.48 -import java.awt.EventQueue;
219.49 -import java.awt.event.ActionEvent;
219.50 -import javax.swing.tree.TreePath;
219.51 -// mdk import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
219.52 -import org.netbeans.modules.visualweb.gravy.Util;
219.53 -import org.netbeans.modules.visualweb.gravy.nodes.Node;
219.54 -import org.netbeans.jemmy.EventTool;
219.55 -import org.netbeans.jemmy.JemmyException;
219.56 -import org.netbeans.jemmy.JemmyProperties;
219.57 -import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
219.58 -import org.netbeans.jemmy.operators.ComponentOperator;
219.59 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
219.60 -import org.netbeans.jemmy.operators.Operator;
219.61 -import org.netbeans.jemmy.util.EmptyVisualizer;
219.62 -import org.openide.util.actions.SystemAction;
219.63 -
219.64 -/** Ancestor class for all non-blocking actions.<p>
219.65 - * This class re-implements all blocking calls from parent Action class to
219.66 - * non-blocking call.<p>
219.67 - * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a>
219.68 - * @see Action */
219.69 -public class ActionNoBlock extends Action {
219.70 -
219.71 - /** creates new non-blocking Action instance without API_MODE support
219.72 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
219.73 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
219.74 - public ActionNoBlock(String menuPath, String popupPath) {
219.75 - super(menuPath, popupPath);
219.76 - }
219.77 -
219.78 - /** creates new non-blocking Action instance
219.79 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
219.80 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
219.81 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
219.82 - public ActionNoBlock(String menuPath, String popupPath, String systemActionClass) {
219.83 - super(menuPath, popupPath, systemActionClass);
219.84 - }
219.85 -
219.86 - /** creates new Action instance without API_MODE support
219.87 - * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
219.88 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
219.89 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
219.90 - public ActionNoBlock(String menuPath, String popupPath, Shortcut[] shortcuts) {
219.91 - super(menuPath, popupPath, shortcuts);
219.92 - }
219.93 -
219.94 - /** creates new Action instance without API_MODE support
219.95 - * @param shortcut Shortcut (use null value if shortcut mode is not supported)
219.96 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
219.97 - * @param popupPath action path in popup menu (use null value if popup mode shell is not supported) */
219.98 - public ActionNoBlock(String menuPath, String popupPath, Shortcut shortcut) {
219.99 - super(menuPath, popupPath, shortcut);
219.100 - }
219.101 -
219.102 - /** creates new Action instance
219.103 - * @param shortcuts array of Shortcut instances (use null value if shortcut mode is not supported)
219.104 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
219.105 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
219.106 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
219.107 - public ActionNoBlock(String menuPath, String popupPath, String systemActionClass, Shortcut[] shortcuts) {
219.108 - super(menuPath, popupPath, systemActionClass, shortcuts);
219.109 - }
219.110 -
219.111 - /** creates new Action instance
219.112 - * @param shortcut Shortcut String (use null value if menu mode is not supported)
219.113 - * @param menuPath action path in main menu (use null value if menu mode is not supported)
219.114 - * @param popupPath action path in popup menu (use null value if popup mode is not supported)
219.115 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
219.116 - public ActionNoBlock(String menuPath, String popupPath, String systemActionClass, Shortcut shortcut) {
219.117 - super(menuPath, popupPath, systemActionClass, shortcut);
219.118 - }
219.119 -
219.120 - /** performs action through main menu
219.121 - * @throws UnsupportedOperationException when action does not support menu mode */
219.122 - public void performMenu() {
219.123 - if (menuPath==null) {
219.124 - throw new UnsupportedOperationException(getClass().toString()+" does not define menu path");
219.125 - }
219.126 - // Need to wait here to be more reliable.
219.127 - // TBD - It can be removed after issue 23663 is solved.
219.128 - new EventTool().waitNoEvent(500);
219.129 -// mdk MainWindowOperator.getDefault().menuBar().pushMenuNoBlock(menuPath, "|");
219.130 - Util.getMainMenu().pushMenuNoBlock(menuPath, "|");
219.131 - try {
219.132 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
219.133 - } catch (Exception e) {
219.134 - throw new JemmyException("Sleeping interrupted", e);
219.135 - }
219.136 - }
219.137 -
219.138 - /** performs action through popup menu
219.139 - * @param nodes nodes to be action performed on
219.140 - * @throws UnsupportedOperationException when action does not support popup mode */
219.141 - public void performPopup(Node[] nodes) {
219.142 - if (popupPath==null)
219.143 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
219.144 - testNodes(nodes);
219.145 - TreePath paths[]=new TreePath[nodes.length];
219.146 - for (int i=0; i<nodes.length; i++) {
219.147 - paths[i]=nodes[i].getTreePath();
219.148 - }
219.149 - Operator.ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
219.150 - Operator.ComponentVisualizer oldVisualizer = null;
219.151 - // If visualizer of JTreeOperator is EmptyVisualizer, we need
219.152 - // to avoid making tree component visible in callPopup method.
219.153 - // So far only known case is tree from TreeTableOperator.
219.154 - if(treeVisualizer instanceof EmptyVisualizer) {
219.155 - oldVisualizer = Operator.getDefaultComponentVisualizer();
219.156 - Operator.setDefaultComponentVisualizer(treeVisualizer);
219.157 - }
219.158 - // Need to wait here to be more reliable.
219.159 - // TBD - It can be removed after issue 23663 is solved.
219.160 - new EventTool().waitNoEvent(500);
219.161 - JPopupMenuOperator popup = new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
219.162 - // restore previously used default visualizer
219.163 - if(oldVisualizer != null) {
219.164 - Operator.setDefaultComponentVisualizer(oldVisualizer);
219.165 - }
219.166 - popup.setComparator(getComparator());
219.167 - popup.pushMenuNoBlock(popupPath, "|");
219.168 - try {
219.169 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
219.170 - } catch (Exception e) {
219.171 - throw new JemmyException("Sleeping interrupted", e);
219.172 - }
219.173 - }
219.174 -
219.175 - /** performs action through popup menu
219.176 - * @param component component to be action performed on
219.177 - * @throws UnsupportedOperationException when action does not support popup mode */
219.178 - public void performPopup(ComponentOperator component) {
219.179 - if (popupPath==null)
219.180 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
219.181 - // Need to wait here to be more reliable.
219.182 - // TBD - It can be removed after issue 23663 is solved.
219.183 - new EventTool().waitNoEvent(500);
219.184 - component.clickForPopup();
219.185 - JPopupMenuOperator popup=new JPopupMenuOperator(component);
219.186 - popup.setComparator(getComparator());
219.187 - popup.pushMenuNoBlock(popupPath, "|");
219.188 - try {
219.189 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
219.190 - } catch (Exception e) {
219.191 - throw new JemmyException("Sleeping interrupted", e);
219.192 - }
219.193 - }
219.194 -
219.195 - /** performs action through API
219.196 - * @throws UnsupportedOperationException when action does not support API mode */
219.197 - public void performAPI() {
219.198 - if (systemActionClass==null) {
219.199 - throw new UnsupportedOperationException(getClass().toString()+" does not define SystemAction");
219.200 - }
219.201 - new Thread(new Runnable() {
219.202 - public void run() {
219.203 - try {
219.204 - // Actions have to be invoked in dispatch thread
219.205 - // (see http://www.netbeans.org/issues/show_bug.cgi?id=35755)
219.206 - EventQueue.invokeAndWait(new Runnable() {
219.207 - public void run() {
219.208 - SystemAction.get(systemActionClass).actionPerformed(
219.209 - new ActionEvent(new Container(), 0, null));
219.210 - }
219.211 - });
219.212 - } catch (Exception e) {
219.213 - throw new JemmyException("Exception while performing action in dispatch thread", e);
219.214 - }
219.215 - }
219.216 - }, "thread performing action through API").start();
219.217 - try {
219.218 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
219.219 - } catch (Exception e) {
219.220 - throw new JemmyException("Interrupted", e);
219.221 - }
219.222 - }
219.223 -
219.224 - /** performs action through shortcut
219.225 - * @throws UnsupportedOperationException when action does not support shortcut mode */
219.226 - public void performShortcut() {
219.227 - if (shortcuts == null) {
219.228 - throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
219.229 - }
219.230 - new Thread(new Runnable() {
219.231 - public void run() {
219.232 - for(int i=0; i<shortcuts.length; i++) {
219.233 - new KeyRobotDriver(null).pushKey(null, shortcuts[i].getKeyCode(), shortcuts[i].getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
219.234 - JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
219.235 - }
219.236 - }
219.237 - }, "thread performing action through shortcut").start();
219.238 - try {
219.239 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
219.240 - } catch (Exception e) {
219.241 - throw new JemmyException("Sleeping interrupted", e);
219.242 - }
219.243 - }
219.244 -}
220.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/BuildProjectAction.java Thu Jul 10 04:29:52 2008 -0700
220.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
220.3 @@ -1,60 +0,0 @@
220.4 -/*
220.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
220.6 - *
220.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
220.8 - *
220.9 - * The contents of this file are subject to the terms of either the GNU
220.10 - * General Public License Version 2 only ("GPL") or the Common
220.11 - * Development and Distribution License("CDDL") (collectively, the
220.12 - * "License"). You may not use this file except in compliance with the
220.13 - * License. You can obtain a copy of the License at
220.14 - * http://www.netbeans.org/cddl-gplv2.html
220.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
220.16 - * specific language governing permissions and limitations under the
220.17 - * License. When distributing the software, include this License Header
220.18 - * Notice in each file and include the License file at
220.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
220.20 - * particular file as subject to the "Classpath" exception as provided
220.21 - * by Sun in the GPL Version 2 section of the License file that
220.22 - * accompanied this code. If applicable, add the following below the
220.23 - * License Header, with the fields enclosed by brackets [] replaced by
220.24 - * your own identifying information:
220.25 - * "Portions Copyrighted [year] [name of copyright owner]"
220.26 - *
220.27 - * Contributor(s):
220.28 - *
220.29 - * The Original Software is NetBeans. The Initial Developer of the Original
220.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
220.31 - * Microsystems, Inc. All Rights Reserved.
220.32 - *
220.33 - * If you wish your version of this file to be governed by only the CDDL
220.34 - * or only the GPL Version 2, indicate your decision by adding
220.35 - * "[Contributor] elects to include this software in this distribution
220.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
220.37 - * single choice of license, a recipient has the option to distribute
220.38 - * your version of this file under either the CDDL, the GPL Version 2 or
220.39 - * to extend the choice of license to its licensees as provided above.
220.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
220.41 - * Version 2 license, then the option applies only if the new code is
220.42 - * made subject to such option by the copyright holder.
220.43 - */
220.44 -
220.45 -package org.netbeans.modules.visualweb.gravy.actions;
220.46 -
220.47 -import org.netbeans.jellytools.Bundle;
220.48 -
220.49 -/** Used to call Build Project popup menu, "Run|Build Main Project" main menu item
220.50 - * "org.openide.actions.BuildProjectAction" or Ctrl+Shift+B shortcut.
220.51 - * @see Action
220.52 - * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
220.53 -public class BuildProjectAction extends Action{
220.54 - private static final String menuString = Bundle.getStringTrimmed("org.netbeans.core.Bundle","Menu/Run")
220.55 - + "|"+Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle","LBL_BuildMainProjectAction_Name");
220.56 - private static final String popup = Bundle.getString("com.sun.rave.project.actions.Bundle",
220.57 - "LBL_BuildProject");
220.58 - private static final Action.Shortcut shortcut = null;
220.59 -
220.60 - public BuildProjectAction() {
220.61 - super(menuString, popup, null, shortcut);
220.62 - }
220.63 -}
221.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/CloseProjectAction.java Thu Jul 10 04:29:52 2008 -0700
221.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
221.3 @@ -1,61 +0,0 @@
221.4 -/*
221.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
221.6 - *
221.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
221.8 - *
221.9 - * The contents of this file are subject to the terms of either the GNU
221.10 - * General Public License Version 2 only ("GPL") or the Common
221.11 - * Development and Distribution License("CDDL") (collectively, the
221.12 - * "License"). You may not use this file except in compliance with the
221.13 - * License. You can obtain a copy of the License at
221.14 - * http://www.netbeans.org/cddl-gplv2.html
221.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
221.16 - * specific language governing permissions and limitations under the
221.17 - * License. When distributing the software, include this License Header
221.18 - * Notice in each file and include the License file at
221.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
221.20 - * particular file as subject to the "Classpath" exception as provided
221.21 - * by Sun in the GPL Version 2 section of the License file that
221.22 - * accompanied this code. If applicable, add the following below the
221.23 - * License Header, with the fields enclosed by brackets [] replaced by
221.24 - * your own identifying information:
221.25 - * "Portions Copyrighted [year] [name of copyright owner]"
221.26 - *
221.27 - * Contributor(s):
221.28 - *
221.29 - * The Original Software is NetBeans. The Initial Developer of the Original
221.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
221.31 - * Microsystems, Inc. All Rights Reserved.
221.32 - *
221.33 - * If you wish your version of this file to be governed by only the CDDL
221.34 - * or only the GPL Version 2, indicate your decision by adding
221.35 - * "[Contributor] elects to include this software in this distribution
221.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
221.37 - * single choice of license, a recipient has the option to distribute
221.38 - * your version of this file under either the CDDL, the GPL Version 2 or
221.39 - * to extend the choice of license to its licensees as provided above.
221.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
221.41 - * Version 2 license, then the option applies only if the new code is
221.42 - * made subject to such option by the copyright holder.
221.43 - */
221.44 -
221.45 -package org.netbeans.modules.visualweb.gravy.actions;
221.46 -
221.47 -import org.netbeans.jellytools.Bundle;
221.48 -
221.49 -import java.awt.event.KeyEvent;
221.50 -/** Used to call "Close Project" popup menu item,
221.51 - * or File/Close Project menu,
221.52 - * or CTRL-W shortcut.
221.53 - * @see Action
221.54 - * @author Alexey.Butenko@sun.com
221.55 - */
221.56 -public class CloseProjectAction extends Action {
221.57 - private static final String closePopup = "Close";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete");
221.58 - private static final String closeMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + closePopup;
221.59 - private static final Shortcut closeShortcut = new Shortcut(KeyEvent.VK_W, KeyEvent.CTRL_MASK);
221.60 -
221.61 - public CloseProjectAction(){
221.62 - super(closeMenu, closePopup, null, closeShortcut);
221.63 - }
221.64 -}
222.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/DeleteAction.java Thu Jul 10 04:29:52 2008 -0700
222.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
222.3 @@ -1,104 +0,0 @@
222.4 -/*
222.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
222.6 - *
222.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
222.8 - *
222.9 - * The contents of this file are subject to the terms of either the GNU
222.10 - * General Public License Version 2 only ("GPL") or the Common
222.11 - * Development and Distribution License("CDDL") (collectively, the
222.12 - * "License"). You may not use this file except in compliance with the
222.13 - * License. You can obtain a copy of the License at
222.14 - * http://www.netbeans.org/cddl-gplv2.html
222.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
222.16 - * specific language governing permissions and limitations under the
222.17 - * License. When distributing the software, include this License Header
222.18 - * Notice in each file and include the License file at
222.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
222.20 - * particular file as subject to the "Classpath" exception as provided
222.21 - * by Sun in the GPL Version 2 section of the License file that
222.22 - * accompanied this code. If applicable, add the following below the
222.23 - * License Header, with the fields enclosed by brackets [] replaced by
222.24 - * your own identifying information:
222.25 - * "Portions Copyrighted [year] [name of copyright owner]"
222.26 - *
222.27 - * Contributor(s):
222.28 - *
222.29 - * The Original Software is NetBeans. The Initial Developer of the Original
222.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
222.31 - * Microsystems, Inc. All Rights Reserved.
222.32 - *
222.33 - * If you wish your version of this file to be governed by only the CDDL
222.34 - * or only the GPL Version 2, indicate your decision by adding
222.35 - * "[Contributor] elects to include this software in this distribution
222.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
222.37 - * single choice of license, a recipient has the option to distribute
222.38 - * your version of this file under either the CDDL, the GPL Version 2 or
222.39 - * to extend the choice of license to its licensees as provided above.
222.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
222.41 - * Version 2 license, then the option applies only if the new code is
222.42 - * made subject to such option by the copyright holder.
222.43 - */
222.44 -
222.45 -package org.netbeans.modules.visualweb.gravy.actions;
222.46 -
222.47 -
222.48 -import org.netbeans.jellytools.Bundle;
222.49 -import org.netbeans.modules.visualweb.gravy.nodes.Node;
222.50 -import javax.swing.tree.TreePath;
222.51 -import org.netbeans.jemmy.EventTool;
222.52 -import org.netbeans.jemmy.JemmyException;
222.53 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
222.54 -import org.netbeans.jemmy.operators.Operator;
222.55 -import org.netbeans.jemmy.operators.Operator.ComponentVisualizer;
222.56 -import org.netbeans.jemmy.util.EmptyVisualizer;
222.57 -
222.58 -import java.awt.event.KeyEvent;
222.59 -
222.60 -/** Used to call "Delete" popup menu item,
222.61 - * "org.openide.actions.SaveAction" or DEL shortcut.
222.62 - * @see Action
222.63 - * @author Alexey.Butenko@sun.com
222.64 - */
222.65 -public class DeleteAction extends Action {
222.66 - private static final String deletePopup = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete");
222.67 - private static final String deleteMenu = null; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
222.68 - private static final Shortcut deleteShortcut = new Shortcut(KeyEvent.VK_DELETE);
222.69 -
222.70 - public DeleteAction(){
222.71 - super(deleteMenu, deletePopup, "org.openide.actions.DeleteAction", deleteShortcut);
222.72 - }
222.73 -
222.74 - public void performPopup(Node[] nodes) {
222.75 - if (popupPath==null) {
222.76 - throw new UnsupportedOperationException(getClass().toString()+" does not define popup path");
222.77 - }
222.78 - testNodes(nodes);
222.79 - TreePath paths[]=new TreePath[nodes.length];
222.80 - for (int i=0; i<nodes.length; i++) {
222.81 - paths[i]=nodes[i].getTreePath();
222.82 - }
222.83 - ComponentVisualizer treeVisualizer = nodes[0].tree().getVisualizer();
222.84 - ComponentVisualizer oldVisualizer = null;
222.85 - // If visualizer of JTreeOperator is EmptyVisualizer, we need
222.86 - // to avoid making tree component visible in callPopup method.
222.87 - // So far only known case is tree from TreeTableOperator.
222.88 - if(treeVisualizer instanceof EmptyVisualizer) {
222.89 - oldVisualizer = Operator.getDefaultComponentVisualizer();
222.90 - Operator.setDefaultComponentVisualizer(treeVisualizer);
222.91 - }
222.92 - // Need to wait here to be more reliable.
222.93 - // TBD - It can be removed after issue 23663 is solved.
222.94 - new EventTool().waitNoEvent(500);
222.95 - JPopupMenuOperator popup=new JPopupMenuOperator(nodes[0].tree().callPopupOnPaths(paths));
222.96 - // restore previously used default visualizer
222.97 - if(oldVisualizer != null) {
222.98 - Operator.setDefaultComponentVisualizer(oldVisualizer);
222.99 - }
222.100 - popup.pushMenuNoBlock(popupPath, "|", getComparator());
222.101 - try {
222.102 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
222.103 - } catch (Exception e) {
222.104 - throw new JemmyException("Sleeping interrupted", e);
222.105 - }
222.106 - }
222.107 -}
223.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/FindAction.java Thu Jul 10 04:29:52 2008 -0700
223.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
223.3 @@ -1,82 +0,0 @@
223.4 -/*
223.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
223.6 - *
223.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
223.8 - *
223.9 - * The contents of this file are subject to the terms of either the GNU
223.10 - * General Public License Version 2 only ("GPL") or the Common
223.11 - * Development and Distribution License("CDDL") (collectively, the
223.12 - * "License"). You may not use this file except in compliance with the
223.13 - * License. You can obtain a copy of the License at
223.14 - * http://www.netbeans.org/cddl-gplv2.html
223.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
223.16 - * specific language governing permissions and limitations under the
223.17 - * License. When distributing the software, include this License Header
223.18 - * Notice in each file and include the License file at
223.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
223.20 - * particular file as subject to the "Classpath" exception as provided
223.21 - * by Sun in the GPL Version 2 section of the License file that
223.22 - * accompanied this code. If applicable, add the following below the
223.23 - * License Header, with the fields enclosed by brackets [] replaced by
223.24 - * your own identifying information:
223.25 - * "Portions Copyrighted [year] [name of copyright owner]"
223.26 - *
223.27 - * Contributor(s):
223.28 - *
223.29 - * The Original Software is NetBeans. The Initial Developer of the Original
223.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
223.31 - * Microsystems, Inc. All Rights Reserved.
223.32 - *
223.33 - * If you wish your version of this file to be governed by only the CDDL
223.34 - * or only the GPL Version 2, indicate your decision by adding
223.35 - * "[Contributor] elects to include this software in this distribution
223.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
223.37 - * single choice of license, a recipient has the option to distribute
223.38 - * your version of this file under either the CDDL, the GPL Version 2 or
223.39 - * to extend the choice of license to its licensees as provided above.
223.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
223.41 - * Version 2 license, then the option applies only if the new code is
223.42 - * made subject to such option by the copyright holder.
223.43 - */
223.44 -
223.45 -package org.netbeans.modules.visualweb.gravy.actions;
223.46 -
223.47 -import org.netbeans.modules.visualweb.gravy.Util;
223.48 -import org.netbeans.jellytools.Bundle;
223.49 -
223.50 -import java.awt.event.KeyEvent;
223.51 -import org.netbeans.jemmy.JemmyException;
223.52 -import org.netbeans.jemmy.JemmyProperties;
223.53 -import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
223.54 -
223.55 -/** Used to call "Edit|Find" main menu item or Ctrl+F shortcut.
223.56 - * @see Action
223.57 - * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
223.58 -public class FindAction extends Action{
223.59 - private static final String findPopup = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Find");
223.60 - private static final String findMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Edit") + "|" + findPopup;
223.61 - private static final Action.Shortcut findShortcut = Util.isMacOS() ?
223.62 - new Action.Shortcut(KeyEvent.VK_F, KeyEvent.META_MASK) : new Action.Shortcut(KeyEvent.VK_F, KeyEvent.CTRL_MASK);
223.63 - /** Creates a new instance of FindAction */
223.64 - public FindAction() {
223.65 - super(findMenu, findPopup, "org.openide.actions.FindAction", findShortcut);
223.66 - }
223.67 -
223.68 - /** performs action through shortcut
223.69 - * @throws UnsupportedOperationException if no shortcut is defined */
223.70 - public void performShortcut() {
223.71 - if (shortcuts == null) {
223.72 - throw new UnsupportedOperationException(getClass().toString()+" does not define shortcut");
223.73 - }
223.74 - for(int i=0; i<shortcuts.length; i++) {
223.75 - new KeyRobotDriver(null).pushKey(null, findShortcut.getKeyCode(), findShortcut.getKeyModifiers(), JemmyProperties.getCurrentTimeouts().create("Timeouts.DeltaTimeout"));
223.76 - JemmyProperties.getProperties().getTimeouts().sleep("Action.WaitAfterShortcutTimeout");
223.77 - }
223.78 - try {
223.79 - Thread.sleep(AFTER_ACTION_WAIT_TIME);
223.80 - } catch (Exception e) {
223.81 - throw new JemmyException("Sleeping interrupted", e);
223.82 - }
223.83 - }
223.84 -
223.85 -}
224.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/HelpAction.java Thu Jul 10 04:29:52 2008 -0700
224.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
224.3 @@ -1,83 +0,0 @@
224.4 -/*
224.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
224.6 - *
224.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
224.8 - *
224.9 - * The contents of this file are subject to the terms of either the GNU
224.10 - * General Public License Version 2 only ("GPL") or the Common
224.11 - * Development and Distribution License("CDDL") (collectively, the
224.12 - * "License"). You may not use this file except in compliance with the
224.13 - * License. You can obtain a copy of the License at
224.14 - * http://www.netbeans.org/cddl-gplv2.html
224.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
224.16 - * specific language governing permissions and limitations under the
224.17 - * License. When distributing the software, include this License Header
224.18 - * Notice in each file and include the License file at
224.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
224.20 - * particular file as subject to the "Classpath" exception as provided
224.21 - * by Sun in the GPL Version 2 section of the License file that
224.22 - * accompanied this code. If applicable, add the following below the
224.23 - * License Header, with the fields enclosed by brackets [] replaced by
224.24 - * your own identifying information:
224.25 - * "Portions Copyrighted [year] [name of copyright owner]"
224.26 - *
224.27 - * Contributor(s):
224.28 - *
224.29 - * The Original Software is NetBeans. The Initial Developer of the Original
224.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
224.31 - * Microsystems, Inc. All Rights Reserved.
224.32 - *
224.33 - * If you wish your version of this file to be governed by only the CDDL
224.34 - * or only the GPL Version 2, indicate your decision by adding
224.35 - * "[Contributor] elects to include this software in this distribution
224.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
224.37 - * single choice of license, a recipient has the option to distribute
224.38 - * your version of this file under either the CDDL, the GPL Version 2 or
224.39 - * to extend the choice of license to its licensees as provided above.
224.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
224.41 - * Version 2 license, then the option applies only if the new code is
224.42 - * made subject to such option by the copyright holder.
224.43 - */
224.44 -
224.45 -package org.netbeans.modules.visualweb.gravy.actions;
224.46 -
224.47 -import java.awt.event.KeyEvent;
224.48 -
224.49 -import org.netbeans.jellytools.Bundle;
224.50 -
224.51 -/** Used to call "Help|Contents" or "Help|Help Sets|{help_set} main menu item,
224.52 - * "org.openide.actions.HelpAction" or F1 shortcut. It can also be used
224.53 - * to invoke help on a property sheet from popup menu.
224.54 - * @see Action
224.55 - * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
224.56 -public class HelpAction extends Action {
224.57 -
224.58 - // String used in property sheets
224.59 - private static final String popupPath =
224.60 - Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_Help");
224.61 - private static final String helpMenu =
224.62 - Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Help");
224.63 -/* mdk - Help|Core IDE Help
224.64 - private static final String helpMenu =
224.65 - Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Help") + "|" +
224.66 - Bundle.getStringTrimmed("org.netbeans.modules.usersguide.Bundle", "Menu/Help/org-netbeans-modules-usersguide-master.xml");
224.67 -*/
224.68 - private static final String helpSetsMenu =
224.69 - Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Help") + "|" +
224.70 - Bundle.getStringTrimmed("org.netbeans.modules.javahelp.resources.Bundle", "Menu/Help/HelpShortcuts") + "|";
224.71 - private static final Shortcut helpShortcut = new Shortcut(KeyEvent.VK_F1);
224.72 -
224.73 - /** Creates new HelpAction instance for specific help set.
224.74 - * @param helpSet menu item of help set to be showed (e.g. "Core IDE Help")
224.75 - */
224.76 - public HelpAction(String helpSet) {
224.77 - super(helpSetsMenu + helpSet, null);
224.78 - }
224.79 -
224.80 - /** Creates new HelpAction instance for master help set (Help|Contents)
224.81 - * or for generic use e.g. in property sheets.
224.82 - */
224.83 - public HelpAction() {
224.84 - super(helpMenu, popupPath, "org.openide.actions.HelpAction", helpShortcut);
224.85 - }
224.86 -}
225.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/OptionsViewAction.java Thu Jul 10 04:29:52 2008 -0700
225.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
225.3 @@ -1,63 +0,0 @@
225.4 -/*
225.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
225.6 - *
225.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
225.8 - *
225.9 - * The contents of this file are subject to the terms of either the GNU
225.10 - * General Public License Version 2 only ("GPL") or the Common
225.11 - * Development and Distribution License("CDDL") (collectively, the
225.12 - * "License"). You may not use this file except in compliance with the
225.13 - * License. You can obtain a copy of the License at
225.14 - * http://www.netbeans.org/cddl-gplv2.html
225.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
225.16 - * specific language governing permissions and limitations under the
225.17 - * License. When distributing the software, include this License Header
225.18 - * Notice in each file and include the License file at
225.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
225.20 - * particular file as subject to the "Classpath" exception as provided
225.21 - * by Sun in the GPL Version 2 section of the License file that
225.22 - * accompanied this code. If applicable, add the following below the
225.23 - * License Header, with the fields enclosed by brackets [] replaced by
225.24 - * your own identifying information:
225.25 - * "Portions Copyrighted [year] [name of copyright owner]"
225.26 - *
225.27 - * Contributor(s):
225.28 - *
225.29 - * The Original Software is NetBeans. The Initial Developer of the Original
225.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
225.31 - * Microsystems, Inc. All Rights Reserved.
225.32 - *
225.33 - * If you wish your version of this file to be governed by only the CDDL
225.34 - * or only the GPL Version 2, indicate your decision by adding
225.35 - * "[Contributor] elects to include this software in this distribution
225.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
225.37 - * single choice of license, a recipient has the option to distribute
225.38 - * your version of this file under either the CDDL, the GPL Version 2 or
225.39 - * to extend the choice of license to its licensees as provided above.
225.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
225.41 - * Version 2 license, then the option applies only if the new code is
225.42 - * made subject to such option by the copyright holder.
225.43 - */
225.44 -
225.45 -package org.netbeans.modules.visualweb.gravy.actions;
225.46 -
225.47 -import java.awt.event.KeyEvent;
225.48 -import org.netbeans.jellytools.Bundle;
225.49 -
225.50 -/** Used to call "Tools|Options" main menu item or
225.51 - * "org.netbeans.core.actions.OptionsAction".
225.52 - * @see Action
225.53 - */
225.54 -public class OptionsViewAction extends Action {
225.55 - private static final String menu =
225.56 - Bundle.getStringTrimmed("org.netbeans.core.Bundle",
225.57 - "Menu/Tools") +
225.58 - "|" +
225.59 - Bundle.getStringTrimmed("org.netbeans.core.actions.Bundle",
225.60 - "Options");
225.61 -
225.62 - /** Creates new instance. */
225.63 - public OptionsViewAction() {
225.64 - super(menu, null, "org.netbeans.core.actions.OptionsAction");
225.65 - }
225.66 -}
226.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/PropertiesAction.java Thu Jul 10 04:29:52 2008 -0700
226.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
226.3 @@ -1,62 +0,0 @@
226.4 -/*
226.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
226.6 - *
226.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
226.8 - *
226.9 - * The contents of this file are subject to the terms of either the GNU
226.10 - * General Public License Version 2 only ("GPL") or the Common
226.11 - * Development and Distribution License("CDDL") (collectively, the
226.12 - * "License"). You may not use this file except in compliance with the
226.13 - * License. You can obtain a copy of the License at
226.14 - * http://www.netbeans.org/cddl-gplv2.html
226.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
226.16 - * specific language governing permissions and limitations under the
226.17 - * License. When distributing the software, include this License Header
226.18 - * Notice in each file and include the License file at
226.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
226.20 - * particular file as subject to the "Classpath" exception as provided
226.21 - * by Sun in the GPL Version 2 section of the License file that
226.22 - * accompanied this code. If applicable, add the following below the
226.23 - * License Header, with the fields enclosed by brackets [] replaced by
226.24 - * your own identifying information:
226.25 - * "Portions Copyrighted [year] [name of copyright owner]"
226.26 - *
226.27 - * Contributor(s):
226.28 - *
226.29 - * The Original Software is NetBeans. The Initial Developer of the Original
226.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
226.31 - * Microsystems, Inc. All Rights Reserved.
226.32 - *
226.33 - * If you wish your version of this file to be governed by only the CDDL
226.34 - * or only the GPL Version 2, indicate your decision by adding
226.35 - * "[Contributor] elects to include this software in this distribution
226.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
226.37 - * single choice of license, a recipient has the option to distribute
226.38 - * your version of this file under either the CDDL, the GPL Version 2 or
226.39 - * to extend the choice of license to its licensees as provided above.
226.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
226.41 - * Version 2 license, then the option applies only if the new code is
226.42 - * made subject to such option by the copyright holder.
226.43 - */
226.44 -
226.45 -package org.netbeans.modules.visualweb.gravy.actions;
226.46 -
226.47 -import java.awt.event.KeyEvent;
226.48 -import org.netbeans.jellytools.Bundle;
226.49 -
226.50 -/** Used to call "Properties" popup menu item, "View|Properties" main menu item,
226.51 - * "org.openide.actions.PropertiesAction" or Ctrl+1 shortcut.
226.52 - * @see Action
226.53 - * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a> */
226.54 -public class PropertiesAction extends Action {
226.55 -
226.56 - private static final String propertiesPopup = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Properties");
226.57 - private static final String propertiesMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Window")
226.58 - + "|" + propertiesPopup;
226.59 - private static final Shortcut propertiesShortcut = new Shortcut(KeyEvent.VK_1, KeyEvent.CTRL_MASK);
226.60 -
226.61 - /** creates new PropertiesAction instance */
226.62 - public PropertiesAction() {
226.63 - super(propertiesMenu, propertiesPopup, "org.openide.actions.PropertiesAction", propertiesShortcut);
226.64 - }
226.65 -}
227.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/SaveAction.java Thu Jul 10 04:29:52 2008 -0700
227.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
227.3 @@ -1,80 +0,0 @@
227.4 -/*
227.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
227.6 - *
227.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
227.8 - *
227.9 - * The contents of this file are subject to the terms of either the GNU
227.10 - * General Public License Version 2 only ("GPL") or the Common
227.11 - * Development and Distribution License("CDDL") (collectively, the
227.12 - * "License"). You may not use this file except in compliance with the
227.13 - * License. You can obtain a copy of the License at
227.14 - * http://www.netbeans.org/cddl-gplv2.html
227.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
227.16 - * specific language governing permissions and limitations under the
227.17 - * License. When distributing the software, include this License Header
227.18 - * Notice in each file and include the License file at
227.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
227.20 - * particular file as subject to the "Classpath" exception as provided
227.21 - * by Sun in the GPL Version 2 section of the License file that
227.22 - * accompanied this code. If applicable, add the following below the
227.23 - * License Header, with the fields enclosed by brackets [] replaced by
227.24 - * your own identifying information:
227.25 - * "Portions Copyrighted [year] [name of copyright owner]"
227.26 - *
227.27 - * Contributor(s):
227.28 - *
227.29 - * The Original Software is NetBeans. The Initial Developer of the Original
227.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
227.31 - * Microsystems, Inc. All Rights Reserved.
227.32 - *
227.33 - * If you wish your version of this file to be governed by only the CDDL
227.34 - * or only the GPL Version 2, indicate your decision by adding
227.35 - * "[Contributor] elects to include this software in this distribution
227.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
227.37 - * single choice of license, a recipient has the option to distribute
227.38 - * your version of this file under either the CDDL, the GPL Version 2 or
227.39 - * to extend the choice of license to its licensees as provided above.
227.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
227.41 - * Version 2 license, then the option applies only if the new code is
227.42 - * made subject to such option by the copyright holder.
227.43 - */
227.44 -
227.45 -package org.netbeans.modules.visualweb.gravy.actions;
227.46 -
227.47 -import java.awt.event.KeyEvent;
227.48 -import org.netbeans.jellytools.Bundle;
227.49 -import org.netbeans.modules.visualweb.gravy.nodes.Node;
227.50 -
227.51 -/** Used to call "Save" popup menu item, "File|Save" main menu item,
227.52 - * "org.openide.actions.SaveAction" or Ctrl+S shortcut.
227.53 - * @see Action
227.54 - * @author Jiri.Skrivanek@sun.com
227.55 - */
227.56 -public class SaveAction extends Action {
227.57 -
227.58 - private static final String savePopup = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Save"); by ois
227.59 - private static final String saveMenu = ""; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
227.60 - private static final Shortcut saveShortcut = new Shortcut(KeyEvent.VK_S, KeyEvent.CTRL_MASK);
227.61 -
227.62 - /** Creates new SaveAction instance. */
227.63 - public SaveAction() {
227.64 - super(saveMenu, savePopup, "org.openide.actions.SaveAction", saveShortcut);
227.65 - }
227.66 -
227.67 - /** Throws UnsupportedOperationException because SaveAction doesn't have
227.68 - * popup representation on nodes.
227.69 - * @param nodes array of nodes
227.70 - */
227.71 - public void performPopup(Node[] nodes) {
227.72 - throw new UnsupportedOperationException("SaveAction doesn't have popup representation on node.");
227.73 - }
227.74 -
227.75 - /** Throws UnsupportedOperationException because SaveAction doesn't have
227.76 - * popup representation on node.
227.77 - * @param node a node
227.78 - */
227.79 - public void performPopup(Node node) {
227.80 - throw new UnsupportedOperationException("SaveAction doesn't have popup representation on node.");
227.81 - }
227.82 -
227.83 -}
228.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/ShowDescriptionAreaAction.java Thu Jul 10 04:29:52 2008 -0700
228.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
228.3 @@ -1,58 +0,0 @@
228.4 -/*
228.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
228.6 - *
228.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
228.8 - *
228.9 - * The contents of this file are subject to the terms of either the GNU
228.10 - * General Public License Version 2 only ("GPL") or the Common
228.11 - * Development and Distribution License("CDDL") (collectively, the
228.12 - * "License"). You may not use this file except in compliance with the
228.13 - * License. You can obtain a copy of the License at
228.14 - * http://www.netbeans.org/cddl-gplv2.html
228.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
228.16 - * specific language governing permissions and limitations under the
228.17 - * License. When distributing the software, include this License Header
228.18 - * Notice in each file and include the License file at
228.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
228.20 - * particular file as subject to the "Classpath" exception as provided
228.21 - * by Sun in the GPL Version 2 section of the License file that
228.22 - * accompanied this code. If applicable, add the following below the
228.23 - * License Header, with the fields enclosed by brackets [] replaced by
228.24 - * your own identifying information:
228.25 - * "Portions Copyrighted [year] [name of copyright owner]"
228.26 - *
228.27 - * Contributor(s):
228.28 - *
228.29 - * The Original Software is NetBeans. The Initial Developer of the Original
228.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
228.31 - * Microsystems, Inc. All Rights Reserved.
228.32 - *
228.33 - * If you wish your version of this file to be governed by only the CDDL
228.34 - * or only the GPL Version 2, indicate your decision by adding
228.35 - * "[Contributor] elects to include this software in this distribution
228.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
228.37 - * single choice of license, a recipient has the option to distribute
228.38 - * your version of this file under either the CDDL, the GPL Version 2 or
228.39 - * to extend the choice of license to its licensees as provided above.
228.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
228.41 - * Version 2 license, then the option applies only if the new code is
228.42 - * made subject to such option by the copyright holder.
228.43 - */
228.44 -
228.45 -package org.netbeans.modules.visualweb.gravy.actions;
228.46 -
228.47 -import org.netbeans.jellytools.Bundle;
228.48 -
228.49 -/** Used to call "Show Description Area" popup menu item on a property sheet.
228.50 - * @see Action
228.51 - * @author Jiri.Skrivanek@sun.com
228.52 - */
228.53 -public class ShowDescriptionAreaAction extends Action {
228.54 -
228.55 - private static final String popupPath = Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_ShowDescription");
228.56 -
228.57 - /** creates new ShowDescriptionAreaAction instance */
228.58 - public ShowDescriptionAreaAction() {
228.59 - super(null, popupPath);
228.60 - }
228.61 -}
229.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/ShowFilesAction.java Thu Jul 10 04:29:52 2008 -0700
229.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
229.3 @@ -1,66 +0,0 @@
229.4 -/*
229.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
229.6 - *
229.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
229.8 - *
229.9 - * The contents of this file are subject to the terms of either the GNU
229.10 - * General Public License Version 2 only ("GPL") or the Common
229.11 - * Development and Distribution License("CDDL") (collectively, the
229.12 - * "License"). You may not use this file except in compliance with the
229.13 - * License. You can obtain a copy of the License at
229.14 - * http://www.netbeans.org/cddl-gplv2.html
229.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
229.16 - * specific language governing permissions and limitations under the
229.17 - * License. When distributing the software, include this License Header
229.18 - * Notice in each file and include the License file at
229.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
229.20 - * particular file as subject to the "Classpath" exception as provided
229.21 - * by Sun in the GPL Version 2 section of the License file that
229.22 - * accompanied this code. If applicable, add the following below the
229.23 - * License Header, with the fields enclosed by brackets [] replaced by
229.24 - * your own identifying information:
229.25 - * "Portions Copyrighted [year] [name of copyright owner]"
229.26 - *
229.27 - * Contributor(s):
229.28 - *
229.29 - * The Original Software is NetBeans. The Initial Developer of the Original
229.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
229.31 - * Microsystems, Inc. All Rights Reserved.
229.32 - *
229.33 - * If you wish your version of this file to be governed by only the CDDL
229.34 - * or only the GPL Version 2, indicate your decision by adding
229.35 - * "[Contributor] elects to include this software in this distribution
229.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
229.37 - * single choice of license, a recipient has the option to distribute
229.38 - * your version of this file under either the CDDL, the GPL Version 2 or
229.39 - * to extend the choice of license to its licensees as provided above.
229.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
229.41 - * Version 2 license, then the option applies only if the new code is
229.42 - * made subject to such option by the copyright holder.
229.43 - */
229.44 -
229.45 -package org.netbeans.modules.visualweb.gravy.actions;
229.46 -
229.47 -import org.netbeans.modules.visualweb.gravy.*;
229.48 -import org.netbeans.jellytools.Bundle;
229.49 -import org.netbeans.jemmy.*;
229.50 -
229.51 -/** Used to call "View|Files" main menu item or Ctrl+2 shortcut.
229.52 - * @see Action
229.53 - * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
229.54 -public class ShowFilesAction extends Action{
229.55 - private static final String popup = null;
229.56 - private static final String menuString = Bundle.getStringTrimmed("org.netbeans.core.Bundle","Menu/Window") + "|Files";
229.57 - private static final Action.Shortcut shortcut = new Action.Shortcut(java.awt.event.KeyEvent.VK_2, java.awt.event.KeyEvent.CTRL_MASK);
229.58 -
229.59 - /** creates new CopyAction instance */
229.60 - public ShowFilesAction() {
229.61 - super(menuString, popup, null, shortcut);
229.62 - }
229.63 -
229.64 - public void perform() {
229.65 - Util.getMainMenu().pushMenuNoBlock(menuString);
229.66 - new QueueTool().waitEmpty();
229.67 - Util.wait(800);
229.68 - }
229.69 -}
230.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/ShowProjectsAction.java Thu Jul 10 04:29:52 2008 -0700
230.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
230.3 @@ -1,66 +0,0 @@
230.4 -/*
230.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
230.6 - *
230.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
230.8 - *
230.9 - * The contents of this file are subject to the terms of either the GNU
230.10 - * General Public License Version 2 only ("GPL") or the Common
230.11 - * Development and Distribution License("CDDL") (collectively, the
230.12 - * "License"). You may not use this file except in compliance with the
230.13 - * License. You can obtain a copy of the License at
230.14 - * http://www.netbeans.org/cddl-gplv2.html
230.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
230.16 - * specific language governing permissions and limitations under the
230.17 - * License. When distributing the software, include this License Header
230.18 - * Notice in each file and include the License file at
230.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
230.20 - * particular file as subject to the "Classpath" exception as provided
230.21 - * by Sun in the GPL Version 2 section of the License file that
230.22 - * accompanied this code. If applicable, add the following below the
230.23 - * License Header, with the fields enclosed by brackets [] replaced by
230.24 - * your own identifying information:
230.25 - * "Portions Copyrighted [year] [name of copyright owner]"
230.26 - *
230.27 - * Contributor(s):
230.28 - *
230.29 - * The Original Software is NetBeans. The Initial Developer of the Original
230.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
230.31 - * Microsystems, Inc. All Rights Reserved.
230.32 - *
230.33 - * If you wish your version of this file to be governed by only the CDDL
230.34 - * or only the GPL Version 2, indicate your decision by adding
230.35 - * "[Contributor] elects to include this software in this distribution
230.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
230.37 - * single choice of license, a recipient has the option to distribute
230.38 - * your version of this file under either the CDDL, the GPL Version 2 or
230.39 - * to extend the choice of license to its licensees as provided above.
230.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
230.41 - * Version 2 license, then the option applies only if the new code is
230.42 - * made subject to such option by the copyright holder.
230.43 - */
230.44 -
230.45 -package org.netbeans.modules.visualweb.gravy.actions;
230.46 -
230.47 -import org.netbeans.jellytools.Bundle;
230.48 -import org.netbeans.jemmy.*;
230.49 -import org.netbeans.modules.visualweb.gravy.*;
230.50 -
230.51 -/** Used to call "View|Projects" main menu item or Ctrl+1 shortcut.
230.52 - * @see Action
230.53 - * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a> */
230.54 -public class ShowProjectsAction extends Action{
230.55 - private static final String popup = null;
230.56 - private static final String menuString = Bundle.getStringTrimmed("org.netbeans.core.windows.resources.Bundle","Menu/Window")+"|"+Bundle.getStringTrimmed("org.netbeans.modules.compapp.projects.wizard.Bundle","LBL_projectTabLogical_tc");
230.57 - private static final Action.Shortcut shortcut = new Action.Shortcut(java.awt.event.KeyEvent.VK_1, java.awt.event.KeyEvent.CTRL_MASK);
230.58 -
230.59 - /** creates new CopyAction instance */
230.60 - public ShowProjectsAction() {
230.61 - super(menuString, popup, null, shortcut);
230.62 - }
230.63 -
230.64 - public void perform() {
230.65 - Util.getMainMenu().pushMenuNoBlock(menuString);
230.66 - new QueueTool().waitEmpty();
230.67 - Util.wait(800);
230.68 - }
230.69 -}
231.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/SortByCategoryAction.java Thu Jul 10 04:29:52 2008 -0700
231.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
231.3 @@ -1,58 +0,0 @@
231.4 -/*
231.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
231.6 - *
231.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
231.8 - *
231.9 - * The contents of this file are subject to the terms of either the GNU
231.10 - * General Public License Version 2 only ("GPL") or the Common
231.11 - * Development and Distribution License("CDDL") (collectively, the
231.12 - * "License"). You may not use this file except in compliance with the
231.13 - * License. You can obtain a copy of the License at
231.14 - * http://www.netbeans.org/cddl-gplv2.html
231.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
231.16 - * specific language governing permissions and limitations under the
231.17 - * License. When distributing the software, include this License Header
231.18 - * Notice in each file and include the License file at
231.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
231.20 - * particular file as subject to the "Classpath" exception as provided
231.21 - * by Sun in the GPL Version 2 section of the License file that
231.22 - * accompanied this code. If applicable, add the following below the
231.23 - * License Header, with the fields enclosed by brackets [] replaced by
231.24 - * your own identifying information:
231.25 - * "Portions Copyrighted [year] [name of copyright owner]"
231.26 - *
231.27 - * Contributor(s):
231.28 - *
231.29 - * The Original Software is NetBeans. The Initial Developer of the Original
231.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
231.31 - * Microsystems, Inc. All Rights Reserved.
231.32 - *
231.33 - * If you wish your version of this file to be governed by only the CDDL
231.34 - * or only the GPL Version 2, indicate your decision by adding
231.35 - * "[Contributor] elects to include this software in this distribution
231.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
231.37 - * single choice of license, a recipient has the option to distribute
231.38 - * your version of this file under either the CDDL, the GPL Version 2 or
231.39 - * to extend the choice of license to its licensees as provided above.
231.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
231.41 - * Version 2 license, then the option applies only if the new code is
231.42 - * made subject to such option by the copyright holder.
231.43 - */
231.44 -
231.45 -package org.netbeans.modules.visualweb.gravy.actions;
231.46 -
231.47 -import org.netbeans.jellytools.Bundle;
231.48 -
231.49 -/** Used to call "Sort by Category" popup menu item on a property sheet.
231.50 - * @see Action
231.51 - * @author Jiri.Skrivanek@sun.com
231.52 - */
231.53 -public class SortByCategoryAction extends Action {
231.54 -
231.55 - private static final String popupPath = Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_NoSort");
231.56 -
231.57 - /** creates new SortByCategoryAction instance */
231.58 - public SortByCategoryAction() {
231.59 - super(null, popupPath);
231.60 - }
231.61 -}
232.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/actions/SortByNameAction.java Thu Jul 10 04:29:52 2008 -0700
232.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
232.3 @@ -1,58 +0,0 @@
232.4 -/*
232.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
232.6 - *
232.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
232.8 - *
232.9 - * The contents of this file are subject to the terms of either the GNU
232.10 - * General Public License Version 2 only ("GPL") or the Common
232.11 - * Development and Distribution License("CDDL") (collectively, the
232.12 - * "License"). You may not use this file except in compliance with the
232.13 - * License. You can obtain a copy of the License at
232.14 - * http://www.netbeans.org/cddl-gplv2.html
232.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
232.16 - * specific language governing permissions and limitations under the
232.17 - * License. When distributing the software, include this License Header
232.18 - * Notice in each file and include the License file at
232.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
232.20 - * particular file as subject to the "Classpath" exception as provided
232.21 - * by Sun in the GPL Version 2 section of the License file that
232.22 - * accompanied this code. If applicable, add the following below the
232.23 - * License Header, with the fields enclosed by brackets [] replaced by
232.24 - * your own identifying information:
232.25 - * "Portions Copyrighted [year] [name of copyright owner]"
232.26 - *
232.27 - * Contributor(s):
232.28 - *
232.29 - * The Original Software is NetBeans. The Initial Developer of the Original
232.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
232.31 - * Microsystems, Inc. All Rights Reserved.
232.32 - *
232.33 - * If you wish your version of this file to be governed by only the CDDL
232.34 - * or only the GPL Version 2, indicate your decision by adding
232.35 - * "[Contributor] elects to include this software in this distribution
232.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
232.37 - * single choice of license, a recipient has the option to distribute
232.38 - * your version of this file under either the CDDL, the GPL Version 2 or
232.39 - * to extend the choice of license to its licensees as provided above.
232.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
232.41 - * Version 2 license, then the option applies only if the new code is
232.42 - * made subject to such option by the copyright holder.
232.43 - */
232.44 -
232.45 -package org.netbeans.modules.visualweb.gravy.actions;
232.46 -
232.47 -import org.netbeans.jellytools.Bundle;
232.48 -
232.49 -/** Used to call "Sort by Name" popup menu item on a property sheet.
232.50 - * @see Action
232.51 - * @author Jiri.Skrivanek@sun.com
232.52 - */
232.53 -public class SortByNameAction extends Action {
232.54 -
232.55 - private static final String popupPath = Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_AlphaSort");
232.56 -
232.57 - /** creates new SortByNameAction instance */
232.58 - public SortByNameAction() {
232.59 - super(null, popupPath);
232.60 - }
232.61 -}
233.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/AddDataSourceOperator.java Thu Jul 10 04:29:52 2008 -0700
233.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
233.3 @@ -1,246 +0,0 @@
233.4 -/*
233.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
233.6 -*
233.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
233.8 -*
233.9 -* The contents of this file are subject to the terms of either the GNU
233.10 -* General Public License Version 2 only ("GPL") or the Common
233.11 -* Development and Distribution License("CDDL") (collectively, the
233.12 -* "License"). You may not use this file except in compliance with the
233.13 -* License. You can obtain a copy of the License at
233.14 -* http://www.netbeans.org/cddl-gplv2.html
233.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
233.16 -* specific language governing permissions and limitations under the
233.17 -* License. When distributing the software, include this License Header
233.18 -* Notice in each file and include the License file at
233.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
233.20 -* particular file as subject to the "Classpath" exception as provided
233.21 -* by Sun in the GPL Version 2 section of the License file that
233.22 -* accompanied this code. If applicable, add the following below the
233.23 -* License Header, with the fields enclosed by brackets [] replaced by
233.24 -* your own identifying information:
233.25 -* "Portions Copyrighted [year] [name of copyright owner]"
233.26 -*
233.27 -* Contributor(s):
233.28 -*
233.29 -* The Original Software is NetBeans. The Initial Developer of the Original
233.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
233.31 -* Microsystems, Inc. All Rights Reserved.
233.32 -*
233.33 -* If you wish your version of this file to be governed by only the CDDL
233.34 -* or only the GPL Version 2, indicate your decision by adding
233.35 -* "[Contributor] elects to include this software in this distribution
233.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
233.37 -* single choice of license, a recipient has the option to distribute
233.38 -* your version of this file under either the CDDL, the GPL Version 2 or
233.39 -* to extend the choice of license to its licensees as provided above.
233.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
233.41 -* Version 2 license, then the option applies only if the new code is
233.42 -* made subject to such option by the copyright holder.
233.43 -*/
233.44 -
233.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
233.46 -
233.47 -import org.netbeans.jemmy.operators.JButtonOperator;
233.48 -import org.netbeans.jemmy.operators.JComboBoxOperator;
233.49 -import org.netbeans.jemmy.operators.JTextFieldOperator;
233.50 -import org.netbeans.jemmy.JemmyException;
233.51 -import org.netbeans.jellytools.Bundle;
233.52 -import org.netbeans.jellytools.NbDialogOperator;
233.53 -
233.54 -/**
233.55 - * This class implements test functionality for "Add Data Source" dialog
233.56 - */
233.57 -public class AddDataSourceOperator extends NbDialogOperator{
233.58 - private JButtonOperator _btEdit, _btTestConnection, _btAdd,_btSelectTable;
233.59 - private JComboBoxOperator _cboServerType, _cboURL;
233.60 - private JTextFieldOperator _txtDSName, _txtDBName, _txtHostName,
233.61 - _txtUser, _txtPassword, _txtValidationTable;
233.62 -
233.63 - /**
233.64 - * Creates new instance of this class.
233.65 - */
233.66 - public AddDataSourceOperator(){
233.67 - super(getBundleString("New Database Connection"));
233.68 - }
233.69 -
233.70 - /**
233.71 - * Initializes (if necessary) and returns an object JButtonOperator
233.72 - * for the dialog button "Configure".
233.73 - * @return the appropriate object JButtonOperator
233.74 - */
233.75 - public JButtonOperator btEdit() {
233.76 - if (_btEdit==null) {
233.77 - _btEdit = new JButtonOperator(this, getBundleString("LBL_CONFIGURE"));
233.78 - }
233.79 - return _btEdit;
233.80 - }
233.81 -
233.82 - /**
233.83 - * Initializes (if necessary) and returns an object JButtonOperator
233.84 - * for the dialog button "Connection".
233.85 - * @return the appropriate object JButtonOperator
233.86 - */
233.87 - public JButtonOperator btTestConnection() {
233.88 - if (_btTestConnection==null) {
233.89 - _btTestConnection = new JButtonOperator(this, getBundleString("TEST_CONNECTION"));
233.90 - }
233.91 - return _btTestConnection;
233.92 - }
233.93 -
233.94 - /**
233.95 - * Initializes (if necessary) and returns an object JButtonOperator
233.96 - * for the dialog button "Add".
233.97 - * @return the appropriate object JButtonOperator
233.98 - */
233.99 - public JButtonOperator btAdd() {
233.100 - if (_btAdd==null) {
233.101 - _btAdd = new JButtonOperator(this, getBundleString("ADD"));
233.102 - }
233.103 - return _btAdd;
233.104 - }
233.105 -
233.106 - /**
233.107 - * Initializes (if necessary) and returns an object JButtonOperator
233.108 - * for the dialog button "Select".
233.109 - * @return the appropriate object JButtonOperator
233.110 - */
233.111 - public JButtonOperator btSelectTable() {
233.112 - if (_btSelectTable==null) {
233.113 - _btSelectTable = new JButtonOperator(this, getBundleString("SelectValTable_SelectBtn_label"));
233.114 - }
233.115 - return _btSelectTable;
233.116 - }
233.117 -
233.118 - /**
233.119 - * Initializes (if necessary) and returns an object JComboBoxOperator
233.120 - * for the dialog drop-down list "Server Type".
233.121 - * @return the appropriate object JComboBoxOperator
233.122 - */
233.123 - public JComboBoxOperator cboServerType() {
233.124 - if (_cboServerType==null) {
233.125 - _cboServerType = new JComboBoxOperator(this);
233.126 - }
233.127 - return _cboServerType;
233.128 - }
233.129 -
233.130 - /**
233.131 - * Initializes (if necessary) and returns an object JComboBoxOperator
233.132 - * for the dialog drop-down list "URL".
233.133 - * @return the appropriate object JComboBoxOperator
233.134 - */
233.135 - public JComboBoxOperator cboURL() {
233.136 - if (_cboURL==null) {
233.137 - _cboURL = new JComboBoxOperator(this,1);
233.138 - }
233.139 - return _cboURL;
233.140 - }
233.141 -
233.142 - /**
233.143 - * Initializes (if necessary) and returns an object JTextFieldOperator
233.144 - * for the dialog text field "Datasource Name".
233.145 - * @return the appropriate object JTextFieldOperator
233.146 - */
233.147 - public JTextFieldOperator txtDSName() {
233.148 - if (_txtDSName==null) {
233.149 - _txtDSName = new JTextFieldOperator(this, 4);
233.150 - }
233.151 - return _txtDSName;
233.152 - }
233.153 -
233.154 - /**
233.155 - * Initializes (if necessary) and returns an object JTextFieldOperator
233.156 - * for the dialog text field "Database Name".
233.157 - * @return the appropriate object JTextFieldOperator
233.158 - */
233.159 - public JTextFieldOperator txtDBName() {
233.160 - if (_txtDBName==null) {
233.161 - _txtDBName = new JTextFieldOperator(this, 0);
233.162 - }
233.163 - return _txtDBName;
233.164 - }
233.165 -
233.166 - /**
233.167 - * Initializes (if necessary) and returns an object JTextFieldOperator
233.168 - * for the dialog text field "Host Name".
233.169 - * @return the appropriate object JTextFieldOperator
233.170 - */
233.171 - public JTextFieldOperator txtHostName() {
233.172 - if (_txtHostName==null) {
233.173 - _txtHostName = new JTextFieldOperator(this, 1);
233.174 - }
233.175 - return _txtHostName;
233.176 - }
233.177 -
233.178 - /**
233.179 - * Initializes (if necessary) and returns an object JTextFieldOperator
233.180 - * for the dialog text field "User".
233.181 - * @return the appropriate object JTextFieldOperator
233.182 - */
233.183 - public JTextFieldOperator txtUser() {
233.184 - if (_txtUser==null) {
233.185 - _txtUser = new JTextFieldOperator(this, 2);
233.186 - }
233.187 - return _txtUser;
233.188 - }
233.189 -
233.190 - /**
233.191 - * Initializes (if necessary) and returns an object JTextFieldOperator
233.192 - * for the dialog text field "Password".
233.193 - * @return the appropriate object JTextFieldOperator
233.194 - */
233.195 - public JTextFieldOperator txtPassword() {
233.196 - if (_txtPassword==null) {
233.197 - _txtPassword = new JTextFieldOperator(this, 3);
233.198 - }
233.199 - return _txtPassword;
233.200 - }
233.201 -
233.202 - /**
233.203 - * Initializes (if necessary) and returns an object JTextFieldOperator
233.204 - * for the dialog text field "Validation Table".
233.205 - * @return the appropriate object JTextFieldOperator
233.206 - */
233.207 - public JTextFieldOperator txtValidationTable() {
233.208 - if (_txtValidationTable==null) {
233.209 - _txtValidationTable = new JTextFieldOperator(this, 7);
233.210 - }
233.211 - return _txtValidationTable;
233.212 - }
233.213 -
233.214 - /**
233.215 - * Initializes all necessary controls.
233.216 - */
233.217 - public void verify() {
233.218 - btOK();
233.219 - btCancel();
233.220 -// btHelp();
233.221 -// btEdit();
233.222 -// btTestConnection();
233.223 -// btSelectTable();
233.224 -// txtDSName();
233.225 -// txtDBName();
233.226 -// txtHostName();
233.227 - txtPassword();
233.228 - cboURL();
233.229 - txtUser();
233.230 -// txtValidationTable();
233.231 - cboServerType();
233.232 - }
233.233 -
233.234 - /**
233.235 - * Finds in a bundle file and returns an actual text of control component.
233.236 - * @param p_text string-key corresponding to required control component.
233.237 - * @return actual text of control component
233.238 - */
233.239 - public static String getBundleString(String p_text) {
233.240 -/* System.out.println("Getting bundle for " + p_text);
233.241 - try {
233.242 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
233.243 - } catch (JemmyException e) {}
233.244 - return null;
233.245 -*/
233.246 - //stub
233.247 - return p_text;
233.248 - }
233.249 -}
234.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/AddQueryCriteriaOperator.java Thu Jul 10 04:29:52 2008 -0700
234.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
234.3 @@ -1,150 +0,0 @@
234.4 -/*
234.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
234.6 -*
234.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
234.8 -*
234.9 -* The contents of this file are subject to the terms of either the GNU
234.10 -* General Public License Version 2 only ("GPL") or the Common
234.11 -* Development and Distribution License("CDDL") (collectively, the
234.12 -* "License"). You may not use this file except in compliance with the
234.13 -* License. You can obtain a copy of the License at
234.14 -* http://www.netbeans.org/cddl-gplv2.html
234.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
234.16 -* specific language governing permissions and limitations under the
234.17 -* License. When distributing the software, include this License Header
234.18 -* Notice in each file and include the License file at
234.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
234.20 -* particular file as subject to the "Classpath" exception as provided
234.21 -* by Sun in the GPL Version 2 section of the License file that
234.22 -* accompanied this code. If applicable, add the following below the
234.23 -* License Header, with the fields enclosed by brackets [] replaced by
234.24 -* your own identifying information:
234.25 -* "Portions Copyrighted [year] [name of copyright owner]"
234.26 -*
234.27 -* Contributor(s):
234.28 -*
234.29 -* The Original Software is NetBeans. The Initial Developer of the Original
234.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
234.31 -* Microsystems, Inc. All Rights Reserved.
234.32 -*
234.33 -* If you wish your version of this file to be governed by only the CDDL
234.34 -* or only the GPL Version 2, indicate your decision by adding
234.35 -* "[Contributor] elects to include this software in this distribution
234.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
234.37 -* single choice of license, a recipient has the option to distribute
234.38 -* your version of this file under either the CDDL, the GPL Version 2 or
234.39 -* to extend the choice of license to its licensees as provided above.
234.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
234.41 -* Version 2 license, then the option applies only if the new code is
234.42 -* made subject to such option by the copyright holder.
234.43 -*/
234.44 -
234.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
234.46 -
234.47 -import org.netbeans.jemmy.operators.JButtonOperator;
234.48 -import org.netbeans.jemmy.operators.JComboBoxOperator;
234.49 -import org.netbeans.jemmy.operators.JTextFieldOperator;
234.50 -import org.netbeans.jemmy.operators.JRadioButtonOperator;
234.51 -import org.netbeans.jemmy.JemmyException;
234.52 -import org.netbeans.jellytools.Bundle;
234.53 -import org.netbeans.jellytools.NbDialogOperator;
234.54 -
234.55 -/**
234.56 - * This class implements test functionality for "Add Query Criteria" dialog
234.57 - */
234.58 -public class AddQueryCriteriaOperator extends NbDialogOperator{
234.59 - private JComboBoxOperator _cboCompareType;
234.60 - private JTextFieldOperator _txtValue, _txtParameter;
234.61 - private JRadioButtonOperator _rbtValue, _rbtParameter;
234.62 -
234.63 - /**
234.64 - * Creates new instance of this class.
234.65 - */
234.66 - public AddQueryCriteriaOperator(){
234.67 - super(getBundleString("ADD_QUERY_CRITERIA_TITLE"));
234.68 - }
234.69 -
234.70 - /**
234.71 - * Initializes (if necessary) and returns an object JComboBoxOperator
234.72 - * for the dialog drop-down list "Compare Type".
234.73 - * @return the appropriate object JComboBoxOperator
234.74 - */
234.75 - public JComboBoxOperator cboCompareType() {
234.76 - if (_cboCompareType==null) {
234.77 - _cboCompareType = new JComboBoxOperator(this);
234.78 - }
234.79 - return _cboCompareType;
234.80 - }
234.81 -
234.82 - /**
234.83 - * Initializes (if necessary) and returns an object JTextFieldOperator
234.84 - * for the dialog text field "Value".
234.85 - * @return the appropriate object JTextFieldOperator
234.86 - */
234.87 - public JTextFieldOperator txtValue() {
234.88 - if (_txtValue==null) {
234.89 - _txtValue = new JTextFieldOperator(this, 0);
234.90 - }
234.91 - return _txtValue;
234.92 - }
234.93 -
234.94 - /**
234.95 - * Initializes (if necessary) and returns an object JTextFieldOperator
234.96 - * for the dialog text field "Parameter".
234.97 - * @return the appropriate object JTextFieldOperator
234.98 - */
234.99 - public JTextFieldOperator txtParameter() {
234.100 - if (_txtParameter==null) {
234.101 - _txtParameter = new JTextFieldOperator(this, 1);
234.102 - }
234.103 - return _txtParameter;
234.104 - }
234.105 -
234.106 - /**
234.107 - * Initializes (if necessary) and returns an object JRadioButtonOperator
234.108 - * for the dialog radio-button "Value".
234.109 - * @return the appropriate object JRadioButtonOperator
234.110 - */
234.111 - public JRadioButtonOperator rbtValue() {
234.112 - if (_rbtValue == null) {
234.113 - _rbtValue = new JRadioButtonOperator(this, 0);
234.114 - }
234.115 - return _rbtValue;
234.116 - }
234.117 -
234.118 - /**
234.119 - * Initializes (if necessary) and returns an object JRadioButtonOperator
234.120 - * for the dialog radio-button "Parameter".
234.121 - * @return the appropriate object JRadioButtonOperator
234.122 - */
234.123 - public JRadioButtonOperator rbtParameter() {
234.124 - if (_rbtParameter == null) {
234.125 - _rbtParameter = new JRadioButtonOperator(this, 1);
234.126 - }
234.127 - return _rbtParameter;
234.128 - }
234.129 -
234.130 - /**
234.131 - * Initializes all necessary controls.
234.132 - */
234.133 - public void verify() {
234.134 - btOK();
234.135 - btCancel();
234.136 - btHelp();
234.137 - txtValue();
234.138 - txtParameter();
234.139 - cboCompareType();
234.140 - rbtValue();
234.141 - rbtParameter();
234.142 - }
234.143 -
234.144 - /**
234.145 - * Finds in a bundle file and returns an actual text of control component.
234.146 - * @param p_text string-key corresponding to required control component.
234.147 - * @return actual text of control component
234.148 - */
234.149 - public static String getBundleString(String p_text) {
234.150 - return QueryBuilderOperator.getBundleString(p_text);
234.151 - }
234.152 -
234.153 -}
235.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/DataSource.java Thu Jul 10 04:29:52 2008 -0700
235.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
235.3 @@ -1,253 +0,0 @@
235.4 -/*
235.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
235.6 -*
235.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
235.8 -*
235.9 -* The contents of this file are subject to the terms of either the GNU
235.10 -* General Public License Version 2 only ("GPL") or the Common
235.11 -* Development and Distribution License("CDDL") (collectively, the
235.12 -* "License"). You may not use this file except in compliance with the
235.13 -* License. You can obtain a copy of the License at
235.14 -* http://www.netbeans.org/cddl-gplv2.html
235.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
235.16 -* specific language governing permissions and limitations under the
235.17 -* License. When distributing the software, include this License Header
235.18 -* Notice in each file and include the License file at
235.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
235.20 -* particular file as subject to the "Classpath" exception as provided
235.21 -* by Sun in the GPL Version 2 section of the License file that
235.22 -* accompanied this code. If applicable, add the following below the
235.23 -* License Header, with the fields enclosed by brackets [] replaced by
235.24 -* your own identifying information:
235.25 -* "Portions Copyrighted [year] [name of copyright owner]"
235.26 -*
235.27 -* Contributor(s):
235.28 -*
235.29 -* The Original Software is NetBeans. The Initial Developer of the Original
235.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
235.31 -* Microsystems, Inc. All Rights Reserved.
235.32 -*
235.33 -* If you wish your version of this file to be governed by only the CDDL
235.34 -* or only the GPL Version 2, indicate your decision by adding
235.35 -* "[Contributor] elects to include this software in this distribution
235.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
235.37 -* single choice of license, a recipient has the option to distribute
235.38 -* your version of this file under either the CDDL, the GPL Version 2 or
235.39 -* to extend the choice of license to its licensees as provided above.
235.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
235.41 -* Version 2 license, then the option applies only if the new code is
235.42 -* made subject to such option by the copyright holder.
235.43 -*/
235.44 -
235.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
235.46 -
235.47 -/**
235.48 - * This class implements an object DataSource, which is used for storing
235.49 - * of various parameters of a datasource.
235.50 - */
235.51 -public class DataSource {
235.52 - private String dbType="", dbUrl="", dbHost="", dbName="", hostName="",
235.53 - user="", password="", port="", validationTable=null;
235.54 -
235.55 - /**
235.56 - * Returns a type of database.
235.57 - * @return string with a type of database.
235.58 - */
235.59 - public String getDbType() {
235.60 - return dbType;
235.61 - }
235.62 -
235.63 - /**
235.64 - * Returns a database URL.
235.65 - * @return string with a database URL.
235.66 - */
235.67 - public String getDbUrl() {
235.68 - return dbUrl;
235.69 - }
235.70 -
235.71 - /**
235.72 - * Returns a database host.
235.73 - * @return string with a database host.
235.74 - */
235.75 - public String getDbHost() {
235.76 - return dbHost;
235.77 - }
235.78 -
235.79 - /**
235.80 - * Returns a database name.
235.81 - * @return string with a database name.
235.82 - */
235.83 - public String getDbName() {
235.84 - return dbName;
235.85 - }
235.86 -
235.87 - /**
235.88 - * Returns a host name.
235.89 - * @return string with a host name.
235.90 - */
235.91 - public String getHostName() {
235.92 - return hostName;
235.93 - }
235.94 -
235.95 - /**
235.96 - * Returns an user name.
235.97 - * @return string with an user name.
235.98 - */
235.99 - public String getUser() {
235.100 - return user;
235.101 - }
235.102 -
235.103 - /**
235.104 - * Returns a password.
235.105 - * @return string with a password.
235.106 - */
235.107 - public String getPassword() {
235.108 - return password;
235.109 - }
235.110 -
235.111 - /**
235.112 - * Returns a database port number.
235.113 - * @return string with a port number.
235.114 - */
235.115 - public String getPort() {
235.116 - return port;
235.117 - }
235.118 -
235.119 - /**
235.120 - * Returns a database host.
235.121 - * @return string with a database host.
235.122 - */
235.123 - public String getValidationTable() {
235.124 - return validationTable;
235.125 - }
235.126 -
235.127 - /**
235.128 - * Creates an instance of this class.
235.129 - * @param p_dbHost string with a database host
235.130 - * @param p_dbName string with a database name
235.131 - * @param p_user string with an user name
235.132 - * @param p_password string with an user password
235.133 - * @param p_port string with a database port
235.134 - */
235.135 - public DataSource(String p_dbHost, String p_dbName, String p_user, String p_password, String p_port){
235.136 - this("",p_dbHost,p_dbName,p_user,p_password,p_port);
235.137 - }
235.138 -
235.139 - /**
235.140 - * Creates an instance of this class.
235.141 - * @param p_dbType string with a database type
235.142 - * @param p_dbHost string with a database host
235.143 - * @param p_dbName string with a database name
235.144 - * @param p_user string with an user name
235.145 - * @param p_password string with an user password
235.146 - * @param p_port string with a database port
235.147 - */
235.148 - public DataSource(String p_dbType, String p_dbHost, String p_dbName, String p_user, String p_password, String p_port){
235.149 - this(p_dbType,p_dbHost,p_dbName,p_user,p_password,p_port,null);
235.150 - }
235.151 -
235.152 - /**
235.153 - * Creates an instance of this class.
235.154 - * @param p_dbType string with a database type
235.155 - * @param p_dbHost string with a database host
235.156 - * @param p_dbName string with a database name
235.157 - * @param p_user string with an user name
235.158 - * @param p_password string with an user password
235.159 - * @param p_port string with a database port
235.160 - * @param p_validationTable
235.161 - */
235.162 - public DataSource(String p_dbType, String p_dbHost, String p_dbName, String p_user, String p_password, String p_port, String p_validationTable){
235.163 - setDbType(p_dbType);
235.164 - setDbHost(p_dbHost);
235.165 - setDbName(p_dbName);
235.166 - setUser(p_user);
235.167 - setPassword(p_password);
235.168 - setPort(p_port);
235.169 - setValidationTable(p_validationTable);
235.170 - setDbUrl("");
235.171 - //@todo parse dbUrl
235.172 - }
235.173 -
235.174 - /**
235.175 - * Creates an instance of this class.
235.176 - * @param p_ds an another DataSource object (a prototype of new datasource)
235.177 - */
235.178 - public DataSource(DataSource p_ds){
235.179 - setDbType(p_ds.getDbType());
235.180 - setDbHost(p_ds.getDbHost());
235.181 - setDbName(p_ds.getDbName());
235.182 - setUser(p_ds.getUser());
235.183 - setPassword(p_ds.getPassword());
235.184 - setPort(p_ds.getPort());
235.185 - setDbUrl(p_ds.getDbUrl());
235.186 - setValidationTable(p_ds.getValidationTable());
235.187 - }
235.188 -
235.189 - /**
235.190 - * Changes a database type for a datasource.
235.191 - * @param dbType string with a database type
235.192 - */
235.193 - public void setDbType(String dbType) {
235.194 - this.dbType = dbType;
235.195 - }
235.196 -
235.197 - /**
235.198 - * Changes a database URL for a datasource.
235.199 - * @param dbUrl string with a database URL
235.200 - */
235.201 - public void setDbUrl(String dbUrl) {
235.202 - this.dbUrl = dbUrl;
235.203 - }
235.204 -
235.205 - /**
235.206 - * Changes a database host for a datasource.
235.207 - * @param dbHost string with a database host
235.208 - */
235.209 - public void setDbHost(String dbHost) {
235.210 - this.dbHost = dbHost;
235.211 - }
235.212 -
235.213 - /**
235.214 - * Changes a database name for a datasource.
235.215 - * @param dbName string with a database name
235.216 - */
235.217 - public void setDbName(String dbName) {
235.218 - this.dbName = dbName;
235.219 - }
235.220 -
235.221 - /**
235.222 - * Changes a host name for a datasource.
235.223 - * @param hostName string with a host name
235.224 - */
235.225 - public void setHostName(String hostName) {
235.226 - this.hostName = hostName;
235.227 - }
235.228 -
235.229 - /**
235.230 - * Changes an user name for a datasource.
235.231 - * @param user an user name
235.232 - */
235.233 - public void setUser(String user) {
235.234 - this.user = user;
235.235 - }
235.236 -
235.237 - /**
235.238 - * Changes a password for a datasource.
235.239 - * @param password an user password
235.240 - */
235.241 - public void setPassword(String password) {
235.242 - this.password = password;
235.243 - }
235.244 -
235.245 - /**
235.246 - * Changes a database port number for a datasource.
235.247 - * @param port a database port number
235.248 - */
235.249 - public void setPort(String port) {
235.250 - this.port = port;
235.251 - }
235.252 -
235.253 - public void setValidationTable(String validationTable) {
235.254 - this.validationTable = validationTable;
235.255 - }
235.256 -}
236.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/EditServerTypesOperator.java Thu Jul 10 04:29:52 2008 -0700
236.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
236.3 @@ -1,230 +0,0 @@
236.4 -/*
236.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
236.6 -*
236.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
236.8 -*
236.9 -* The contents of this file are subject to the terms of either the GNU
236.10 -* General Public License Version 2 only ("GPL") or the Common
236.11 -* Development and Distribution License("CDDL") (collectively, the
236.12 -* "License"). You may not use this file except in compliance with the
236.13 -* License. You can obtain a copy of the License at
236.14 -* http://www.netbeans.org/cddl-gplv2.html
236.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
236.16 -* specific language governing permissions and limitations under the
236.17 -* License. When distributing the software, include this License Header
236.18 -* Notice in each file and include the License file at
236.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
236.20 -* particular file as subject to the "Classpath" exception as provided
236.21 -* by Sun in the GPL Version 2 section of the License file that
236.22 -* accompanied this code. If applicable, add the following below the
236.23 -* License Header, with the fields enclosed by brackets [] replaced by
236.24 -* your own identifying information:
236.25 -* "Portions Copyrighted [year] [name of copyright owner]"
236.26 -*
236.27 -* Contributor(s):
236.28 -*
236.29 -* The Original Software is NetBeans. The Initial Developer of the Original
236.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
236.31 -* Microsystems, Inc. All Rights Reserved.
236.32 -*
236.33 -* If you wish your version of this file to be governed by only the CDDL
236.34 -* or only the GPL Version 2, indicate your decision by adding
236.35 -* "[Contributor] elects to include this software in this distribution
236.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
236.37 -* single choice of license, a recipient has the option to distribute
236.38 -* your version of this file under either the CDDL, the GPL Version 2 or
236.39 -* to extend the choice of license to its licensees as provided above.
236.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
236.41 -* Version 2 license, then the option applies only if the new code is
236.42 -* made subject to such option by the copyright holder.
236.43 -*/
236.44 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
236.45 -
236.46 -import org.netbeans.jellytools.NbDialogOperator;
236.47 -import org.netbeans.jellytools.Bundle;
236.48 -import org.netbeans.jemmy.JemmyException;
236.49 -import org.netbeans.jemmy.operators.JButtonOperator;
236.50 -import org.netbeans.jemmy.operators.JListOperator;
236.51 -import org.netbeans.jemmy.operators.JTextFieldOperator;
236.52 -import org.netbeans.jemmy.operators.JComboBoxOperator;
236.53 -
236.54 -/**
236.55 - * This class implements test functionality for "Edit Server Types" dialog
236.56 - */
236.57 -public class EditServerTypesOperator extends NbDialogOperator{
236.58 - /**
236.59 - * Creates new instance of this class.
236.60 - */
236.61 - public EditServerTypesOperator(){
236.62 - super(getBundleString("New JDBC Driver"));
236.63 - }
236.64 -
236.65 - private JButtonOperator _btAdd;
236.66 - private JButtonOperator _btRemove;
236.67 - private JButtonOperator _btNew;
236.68 - private JButtonOperator _btDelete;
236.69 - private JButtonOperator _btFind;
236.70 - private JListOperator _lstServerTypes;
236.71 - private JListOperator _lstJars;
236.72 - private JTextFieldOperator _txtName;
236.73 - private JTextFieldOperator _txtTemplate;
236.74 - private JComboBoxOperator _cboDriver;
236.75 -
236.76 - /**
236.77 - * Initializes (if necessary) and returns an object JButtonOperator
236.78 - * for the dialog button "Add".
236.79 - * @return the appropriate object JButtonOperator
236.80 - */
236.81 - public JButtonOperator btAdd() {
236.82 - if (_btAdd==null) {
236.83 - _btAdd = new JButtonOperator(this, getBundleString("Add..."));
236.84 - }
236.85 - return _btAdd;
236.86 - }
236.87 -
236.88 - /**
236.89 - * Initializes (if necessary) and returns an object JButtonOperator
236.90 - * for the dialog button "Remove".
236.91 - * @return the appropriate object JButtonOperator
236.92 - */
236.93 - public JButtonOperator btRemove() {
236.94 - if (_btRemove==null) {
236.95 - _btRemove = new JButtonOperator(this, getBundleString("Remove"));
236.96 - }
236.97 - return _btRemove;
236.98 - }
236.99 -
236.100 - /**
236.101 - * Initializes (if necessary) and returns an object JButtonOperator
236.102 - * for the dialog button "New".
236.103 - * @return the appropriate object JButtonOperator
236.104 - */
236.105 - public JButtonOperator btNew() {
236.106 - if (_btNew==null) {
236.107 - _btNew = new JButtonOperator(this, getBundleString("Add..."));
236.108 - }
236.109 - return _btNew;
236.110 - }
236.111 -
236.112 - /**
236.113 - * Initializes (if necessary) and returns an object JButtonOperator
236.114 - * for the dialog button "Delete".
236.115 - * @return the appropriate object JButtonOperator
236.116 - */
236.117 - public JButtonOperator btDelete() {
236.118 - if (_btDelete==null) {
236.119 - _btDelete = new JButtonOperator(this, getBundleString("LBL_REMOVE_DRIVER"));
236.120 - }
236.121 - return _btDelete;
236.122 - }
236.123 -
236.124 - /**
236.125 - * Initializes (if necessary) and returns an object JButtonOperator
236.126 - * for the dialog button "Find".
236.127 - * @return the appropriate object JButtonOperator
236.128 - */
236.129 - public JButtonOperator btFind() {
236.130 - if (_btFind==null) {
236.131 - _btFind = new JButtonOperator(this, getBundleString("Find"));
236.132 - }
236.133 - return _btFind;
236.134 - }
236.135 -
236.136 - /**
236.137 - * Initializes (if necessary) and returns an object JTextFieldOperator
236.138 - * for the dialog text field "Name".
236.139 - * @return the appropriate object JTextFieldOperator
236.140 - */
236.141 - public JTextFieldOperator txtName() {
236.142 - if (_txtName==null) {
236.143 - _txtName = new JTextFieldOperator(this, 0);
236.144 - }
236.145 - return _txtName;
236.146 - }
236.147 -
236.148 - /**
236.149 - * Initializes (if necessary) and returns an object JTextFieldOperator
236.150 - * for the dialog text field "Template".
236.151 - * @return the appropriate object JTextFieldOperator
236.152 - */
236.153 - public JTextFieldOperator txtTemplate() {
236.154 - if (_txtTemplate==null) {
236.155 - _txtTemplate = new JTextFieldOperator(this, 1);
236.156 - }
236.157 - return _txtTemplate;
236.158 - }
236.159 -
236.160 - /**
236.161 - * Initializes (if necessary) and returns an object JComboBoxOperator
236.162 - * for the dialog drop-down list "Driver".
236.163 - * @return the appropriate object JComboBoxOperator
236.164 - */
236.165 - public JComboBoxOperator cboDriver() {
236.166 - if (_cboDriver==null) {
236.167 - _cboDriver = new JComboBoxOperator(this);
236.168 - }
236.169 - return _cboDriver;
236.170 - }
236.171 -
236.172 - /**
236.173 - * Initializes (if necessary) and returns an object JListOperator
236.174 - * for the dialog list "Server Types".
236.175 - * @return the appropriate object JListOperator
236.176 - */
236.177 - public JListOperator lstServerTypes() {
236.178 - if (_lstServerTypes==null) {
236.179 - _lstServerTypes = new JListOperator(this,0);
236.180 - }
236.181 - return _lstServerTypes;
236.182 - }
236.183 -
236.184 - /**
236.185 - * Initializes (if necessary) and returns an object JListOperator
236.186 - * for the dialog list "Jars".
236.187 - * @return the appropriate object JListOperator
236.188 - */
236.189 - public JListOperator lstJars() {
236.190 - if (_lstJars==null) {
236.191 - _lstJars = new JListOperator(this,1);
236.192 - }
236.193 - return _lstJars;
236.194 - }
236.195 -
236.196 - /**
236.197 - * Initializes all necessary controls.
236.198 - */
236.199 - public void verify() {
236.200 - btAdd();
236.201 - btRemove();
236.202 - btNew();
236.203 -// btDelete();
236.204 - btFind();
236.205 -// btClose();
236.206 -// btHelp();
236.207 - txtName();
236.208 - txtTemplate();
236.209 - cboDriver();
236.210 -// lstServerTypes();
236.211 -// lstJars();
236.212 - btOK();
236.213 - btCancel();
236.214 - }
236.215 -
236.216 - /**
236.217 - * Finds in a bundle file and returns an actual text of control component.
236.218 - * @param p_text string-key corresponding to required control component.
236.219 - * @return actual text of control component
236.220 - */
236.221 - public static String getBundleString(String p_text) {
236.222 - System.out.println("Getting bundle for " + p_text);
236.223 -/* try {
236.224 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.actions.Bundle", p_text);
236.225 - } catch (JemmyException e) {}
236.226 - try {
236.227 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
236.228 - } catch (JemmyException e) {}
236.229 -*/
236.230 - return p_text;
236.231 - }
236.232 -
236.233 -}
237.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ExportDataSourcesOperator.java Thu Jul 10 04:29:52 2008 -0700
237.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
237.3 @@ -1,93 +0,0 @@
237.4 -/*
237.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
237.6 -*
237.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
237.8 -*
237.9 -* The contents of this file are subject to the terms of either the GNU
237.10 -* General Public License Version 2 only ("GPL") or the Common
237.11 -* Development and Distribution License("CDDL") (collectively, the
237.12 -* "License"). You may not use this file except in compliance with the
237.13 -* License. You can obtain a copy of the License at
237.14 -* http://www.netbeans.org/cddl-gplv2.html
237.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
237.16 -* specific language governing permissions and limitations under the
237.17 -* License. When distributing the software, include this License Header
237.18 -* Notice in each file and include the License file at
237.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
237.20 -* particular file as subject to the "Classpath" exception as provided
237.21 -* by Sun in the GPL Version 2 section of the License file that
237.22 -* accompanied this code. If applicable, add the following below the
237.23 -* License Header, with the fields enclosed by brackets [] replaced by
237.24 -* your own identifying information:
237.25 -* "Portions Copyrighted [year] [name of copyright owner]"
237.26 -*
237.27 -* Contributor(s):
237.28 -*
237.29 -* The Original Software is NetBeans. The Initial Developer of the Original
237.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
237.31 -* Microsystems, Inc. All Rights Reserved.
237.32 -*
237.33 -* If you wish your version of this file to be governed by only the CDDL
237.34 -* or only the GPL Version 2, indicate your decision by adding
237.35 -* "[Contributor] elects to include this software in this distribution
237.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
237.37 -* single choice of license, a recipient has the option to distribute
237.38 -* your version of this file under either the CDDL, the GPL Version 2 or
237.39 -* to extend the choice of license to its licensees as provided above.
237.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
237.41 -* Version 2 license, then the option applies only if the new code is
237.42 -* made subject to such option by the copyright holder.
237.43 -*/
237.44 -
237.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
237.46 -
237.47 -import org.netbeans.jemmy.operators.JCheckBoxOperator;
237.48 -
237.49 -/**
237.50 - * This class implements test functionality for a dialog "Export Data Sources"
237.51 - */
237.52 -public class ExportDataSourcesOperator extends ExportImportDataSourcesOperator{
237.53 - private JCheckBoxOperator _cbIncludeUser;
237.54 - private JCheckBoxOperator _cbIncludePassword;
237.55 -
237.56 - /**
237.57 - * Creates new instance of this class.
237.58 - */
237.59 - public ExportDataSourcesOperator(){
237.60 - super(getBundleString("EXPORT_DLG_NAME"));
237.61 - }
237.62 -
237.63 - /**
237.64 - * Initializes (if necessary) and returns an object JCheckBoxOperator
237.65 - * for the dialog check-box "Include User".
237.66 - * @return the appropriate object JCheckBoxOperator
237.67 - */
237.68 - public JCheckBoxOperator cbIncludeUser() {
237.69 - if (_cbIncludeUser==null) {
237.70 - _cbIncludeUser = new JCheckBoxOperator(this, 0);
237.71 - }
237.72 - return _cbIncludeUser;
237.73 - }
237.74 -
237.75 - /**
237.76 - * Initializes (if necessary) and returns an object JCheckBoxOperator
237.77 - * for the dialog check-box "Include Password".
237.78 - * @return the appropriate object JCheckBoxOperator
237.79 - */
237.80 - public JCheckBoxOperator cbIncludePassword() {
237.81 - if (_cbIncludePassword==null) {
237.82 - _cbIncludePassword = new JCheckBoxOperator(this, 1);
237.83 - }
237.84 - return _cbIncludePassword;
237.85 - }
237.86 -
237.87 - /**
237.88 - * Initializes all necessary controls.
237.89 - */
237.90 - public void verify(){
237.91 - super.verify();
237.92 - cbIncludeUser();
237.93 - cbIncludePassword();
237.94 - }
237.95 -
237.96 -}
238.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ExportImportDataSourcesOperator.java Thu Jul 10 04:29:52 2008 -0700
238.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
238.3 @@ -1,242 +0,0 @@
238.4 -/*
238.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
238.6 -*
238.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
238.8 -*
238.9 -* The contents of this file are subject to the terms of either the GNU
238.10 -* General Public License Version 2 only ("GPL") or the Common
238.11 -* Development and Distribution License("CDDL") (collectively, the
238.12 -* "License"). You may not use this file except in compliance with the
238.13 -* License. You can obtain a copy of the License at
238.14 -* http://www.netbeans.org/cddl-gplv2.html
238.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
238.16 -* specific language governing permissions and limitations under the
238.17 -* License. When distributing the software, include this License Header
238.18 -* Notice in each file and include the License file at
238.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
238.20 -* particular file as subject to the "Classpath" exception as provided
238.21 -* by Sun in the GPL Version 2 section of the License file that
238.22 -* accompanied this code. If applicable, add the following below the
238.23 -* License Header, with the fields enclosed by brackets [] replaced by
238.24 -* your own identifying information:
238.25 -* "Portions Copyrighted [year] [name of copyright owner]"
238.26 -*
238.27 -* Contributor(s):
238.28 -*
238.29 -* The Original Software is NetBeans. The Initial Developer of the Original
238.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
238.31 -* Microsystems, Inc. All Rights Reserved.
238.32 -*
238.33 -* If you wish your version of this file to be governed by only the CDDL
238.34 -* or only the GPL Version 2, indicate your decision by adding
238.35 -* "[Contributor] elects to include this software in this distribution
238.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
238.37 -* single choice of license, a recipient has the option to distribute
238.38 -* your version of this file under either the CDDL, the GPL Version 2 or
238.39 -* to extend the choice of license to its licensees as provided above.
238.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
238.41 -* Version 2 license, then the option applies only if the new code is
238.42 -* made subject to such option by the copyright holder.
238.43 -*/
238.44 -
238.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
238.46 -
238.47 -import org.netbeans.jellytools.NbDialogOperator;
238.48 -import org.netbeans.jellytools.Bundle;
238.49 -import org.netbeans.jemmy.JemmyException;
238.50 -import org.netbeans.jemmy.operators.JButtonOperator;
238.51 -import org.netbeans.jemmy.operators.JTextFieldOperator;
238.52 -import org.netbeans.jemmy.operators.JListOperator;
238.53 -
238.54 -/**
238.55 - * This class is used as abstract ancestor of classes ExportDataSourcesOperator
238.56 - * and ImportDataSourcesOperator.
238.57 - */
238.58 -public abstract class ExportImportDataSourcesOperator extends NbDialogOperator{
238.59 -
238.60 - /**
238.61 - * This constructor is used by inherited classes for
238.62 - * creation of their new instances.
238.63 - */
238.64 - public ExportImportDataSourcesOperator(String p_title){
238.65 - super(p_title);
238.66 - }
238.67 -
238.68 - private JButtonOperator _btSelectAll;
238.69 - private JButtonOperator _btClear;
238.70 - private JButtonOperator _btBrowse;
238.71 - private JTextFieldOperator _txtDSName;
238.72 - private JTextFieldOperator _txtValidationQuery;
238.73 - private JTextFieldOperator _txtDriverClass;
238.74 - private JTextFieldOperator _txtUser;
238.75 - private JTextFieldOperator _txtPassword;
238.76 - private JTextFieldOperator _txtURL;
238.77 - private JTextFieldOperator _txtFileName;
238.78 - private JListOperator _lstDataSources;
238.79 -
238.80 - /**
238.81 - * Initializes (if necessary) and returns an object JButtonOperator
238.82 - * for the dialog button "Select All".
238.83 - * @return the appropriate object JButtonOperator
238.84 - */
238.85 - public JButtonOperator btSelectAll() {
238.86 - if (_btSelectAll==null) {
238.87 - _btSelectAll = new JButtonOperator(this, getBundleString("SCHEMA_SELECT_ALL_BTN_LABEL"));
238.88 - }
238.89 - return _btSelectAll;
238.90 - }
238.91 -
238.92 - /**
238.93 - * Initializes (if necessary) and returns an object JButtonOperator
238.94 - * for the dialog button "Clear".
238.95 - * @return the appropriate object JButtonOperator
238.96 - */
238.97 - public JButtonOperator btClear() {
238.98 - if (_btClear==null) {
238.99 - _btClear = new JButtonOperator(this, getBundleString("SCHEMA_CLEAR_BTN_LABEL"));
238.100 - }
238.101 - return _btClear;
238.102 - }
238.103 -
238.104 - /**
238.105 - * Initializes (if necessary) and returns an object JButtonOperator
238.106 - * for the dialog button "Browse".
238.107 - * @return the appropriate object JButtonOperator
238.108 - */
238.109 - public JButtonOperator btBrowse() {
238.110 - if (_btBrowse==null) {
238.111 - _btBrowse = new JButtonOperator(this, getBundleString("BROWSE_BUTTON_LABEL"));
238.112 - }
238.113 - return _btBrowse;
238.114 - }
238.115 -
238.116 - /**
238.117 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.118 - * for the dialog text field "Datasource Name".
238.119 - * @return the appropriate object JTextFieldOperator
238.120 - */
238.121 - public JTextFieldOperator txtDSName() {
238.122 - if (_txtDSName==null) {
238.123 - _txtDSName = new JTextFieldOperator(this, 2);
238.124 - }
238.125 - return _txtDSName;
238.126 - }
238.127 -
238.128 - /**
238.129 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.130 - * for the dialog text field "Validation Query".
238.131 - * @return the appropriate object JTextFieldOperator
238.132 - */
238.133 - public JTextFieldOperator txtValidationQuery() {
238.134 - if (_txtValidationQuery==null) {
238.135 - _txtValidationQuery = new JTextFieldOperator(this, 1);
238.136 - }
238.137 - return _txtValidationQuery;
238.138 - }
238.139 -
238.140 - /**
238.141 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.142 - * for the dialog text field "Driver Class".
238.143 - * @return the appropriate object JTextFieldOperator
238.144 - */
238.145 - public JTextFieldOperator txtDriverClass() {
238.146 - if (_txtDriverClass==null) {
238.147 - _txtDriverClass = new JTextFieldOperator(this, 0);
238.148 - }
238.149 - return _txtDriverClass;
238.150 - }
238.151 -
238.152 - /**
238.153 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.154 - * for the dialog text field "User".
238.155 - * @return the appropriate object JTextFieldOperator
238.156 - */
238.157 - public JTextFieldOperator txtUser() {
238.158 - if (_txtUser==null) {
238.159 - _txtUser = new JTextFieldOperator(this, 3);
238.160 - }
238.161 - return _txtUser;
238.162 - }
238.163 -
238.164 - /**
238.165 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.166 - * for the dialog text field "Password".
238.167 - * @return the appropriate object JTextFieldOperator
238.168 - */
238.169 - public JTextFieldOperator txtPassword() {
238.170 - if (_txtPassword==null) {
238.171 - _txtPassword = new JTextFieldOperator(this, 4);
238.172 - }
238.173 - return _txtPassword;
238.174 - }
238.175 -
238.176 - /**
238.177 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.178 - * for the dialog text field "Database URL".
238.179 - * @return the appropriate object JTextFieldOperator
238.180 - */
238.181 - public JTextFieldOperator txtURL() {
238.182 - if (_txtURL==null) {
238.183 - _txtURL = new JTextFieldOperator(this, 5);
238.184 - }
238.185 - return _txtURL;
238.186 - }
238.187 -
238.188 - /**
238.189 - * Initializes (if necessary) and returns an object JTextFieldOperator
238.190 - * for the dialog text field "File Name".
238.191 - * @return the appropriate object JTextFieldOperator
238.192 - */
238.193 - public JTextFieldOperator txtFileName() {
238.194 - if (_txtFileName==null) {
238.195 - _txtFileName = new JTextFieldOperator(this, 2);
238.196 - }
238.197 - return _txtFileName;
238.198 - }
238.199 -
238.200 - /**
238.201 - * Initializes (if necessary) and returns an object JListOperator
238.202 - * for the dialog list "Data Sources".
238.203 - * @return the appropriate object JListOperator
238.204 - */
238.205 - public JListOperator lstDataSources() {
238.206 - if (_lstDataSources==null) {
238.207 - _lstDataSources = new JListOperator(this);
238.208 - }
238.209 - return _lstDataSources;
238.210 - }
238.211 -
238.212 - /**
238.213 - * Initializes all necessary controls.
238.214 - */
238.215 - public void verify(){
238.216 - btOK();
238.217 - btCancel();
238.218 - btHelp();
238.219 - btSelectAll();
238.220 - btClear();
238.221 - btBrowse();
238.222 - txtDSName();
238.223 - txtDriverClass();
238.224 - txtUser();
238.225 - txtPassword();
238.226 - txtURL();
238.227 - txtValidationQuery();
238.228 - txtFileName();
238.229 - lstDataSources();
238.230 - }
238.231 -
238.232 - /**
238.233 - * Finds in a bundle file and returns an actual text of control component.
238.234 - * @param p_text string-key corresponding to required control component.
238.235 - * @return actual text of control component
238.236 - */
238.237 - public static String getBundleString(String p_text) {
238.238 - System.out.println("Getting bundle for " + p_text);
238.239 - try {
238.240 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
238.241 - } catch (JemmyException e) {}
238.242 - return null;
238.243 - }
238.244 -
238.245 -}
239.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ImportDataSourcesOperator.java Thu Jul 10 04:29:52 2008 -0700
239.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
239.3 @@ -1,54 +0,0 @@
239.4 -/*
239.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
239.6 -*
239.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
239.8 -*
239.9 -* The contents of this file are subject to the terms of either the GNU
239.10 -* General Public License Version 2 only ("GPL") or the Common
239.11 -* Development and Distribution License("CDDL") (collectively, the
239.12 -* "License"). You may not use this file except in compliance with the
239.13 -* License. You can obtain a copy of the License at
239.14 -* http://www.netbeans.org/cddl-gplv2.html
239.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
239.16 -* specific language governing permissions and limitations under the
239.17 -* License. When distributing the software, include this License Header
239.18 -* Notice in each file and include the License file at
239.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
239.20 -* particular file as subject to the "Classpath" exception as provided
239.21 -* by Sun in the GPL Version 2 section of the License file that
239.22 -* accompanied this code. If applicable, add the following below the
239.23 -* License Header, with the fields enclosed by brackets [] replaced by
239.24 -* your own identifying information:
239.25 -* "Portions Copyrighted [year] [name of copyright owner]"
239.26 -*
239.27 -* Contributor(s):
239.28 -*
239.29 -* The Original Software is NetBeans. The Initial Developer of the Original
239.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
239.31 -* Microsystems, Inc. All Rights Reserved.
239.32 -*
239.33 -* If you wish your version of this file to be governed by only the CDDL
239.34 -* or only the GPL Version 2, indicate your decision by adding
239.35 -* "[Contributor] elects to include this software in this distribution
239.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
239.37 -* single choice of license, a recipient has the option to distribute
239.38 -* your version of this file under either the CDDL, the GPL Version 2 or
239.39 -* to extend the choice of license to its licensees as provided above.
239.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
239.41 -* Version 2 license, then the option applies only if the new code is
239.42 -* made subject to such option by the copyright holder.
239.43 -*/
239.44 -
239.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
239.46 -
239.47 -/**
239.48 - * This class implements test functionality for a dialog "Import Data Sources"
239.49 - */
239.50 -public class ImportDataSourcesOperator extends ExportImportDataSourcesOperator{
239.51 - /**
239.52 - * Creates new instance of this class.
239.53 - */
239.54 - public ImportDataSourcesOperator(){
239.55 - super(getBundleString("IMPORT_DLG_NAME"));
239.56 - }
239.57 -}
240.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ModifyDataSourceOperator.java Thu Jul 10 04:29:52 2008 -0700
240.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
240.3 @@ -1,284 +0,0 @@
240.4 -/*
240.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
240.6 -*
240.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
240.8 -*
240.9 -* The contents of this file are subject to the terms of either the GNU
240.10 -* General Public License Version 2 only ("GPL") or the Common
240.11 -* Development and Distribution License("CDDL") (collectively, the
240.12 -* "License"). You may not use this file except in compliance with the
240.13 -* License. You can obtain a copy of the License at
240.14 -* http://www.netbeans.org/cddl-gplv2.html
240.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
240.16 -* specific language governing permissions and limitations under the
240.17 -* License. When distributing the software, include this License Header
240.18 -* Notice in each file and include the License file at
240.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
240.20 -* particular file as subject to the "Classpath" exception as provided
240.21 -* by Sun in the GPL Version 2 section of the License file that
240.22 -* accompanied this code. If applicable, add the following below the
240.23 -* License Header, with the fields enclosed by brackets [] replaced by
240.24 -* your own identifying information:
240.25 -* "Portions Copyrighted [year] [name of copyright owner]"
240.26 -*
240.27 -* Contributor(s):
240.28 -*
240.29 -* The Original Software is NetBeans. The Initial Developer of the Original
240.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
240.31 -* Microsystems, Inc. All Rights Reserved.
240.32 -*
240.33 -* If you wish your version of this file to be governed by only the CDDL
240.34 -* or only the GPL Version 2, indicate your decision by adding
240.35 -* "[Contributor] elects to include this software in this distribution
240.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
240.37 -* single choice of license, a recipient has the option to distribute
240.38 -* your version of this file under either the CDDL, the GPL Version 2 or
240.39 -* to extend the choice of license to its licensees as provided above.
240.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
240.41 -* Version 2 license, then the option applies only if the new code is
240.42 -* made subject to such option by the copyright holder.
240.43 -*/
240.44 -
240.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
240.46 -
240.47 -import org.netbeans.jemmy.operators.*;
240.48 -import org.netbeans.jemmy.JemmyException;
240.49 -import org.netbeans.jellytools.Bundle;
240.50 -import org.netbeans.jellytools.NbDialogOperator;
240.51 -
240.52 -/**
240.53 - * This class implements test functionality for "Modify Data Source" dialog
240.54 - */
240.55 -public class ModifyDataSourceOperator extends NbDialogOperator{
240.56 - /**
240.57 - * Creates new instance of this class.
240.58 - */
240.59 - public ModifyDataSourceOperator(){
240.60 - super(getBundleString("MODIFY_DATASOURCE"));
240.61 - }
240.62 -
240.63 - private JButtonOperator _btGetSchemas;
240.64 - private JButtonOperator _btTestConnection;
240.65 - private JButtonOperator _btModify;
240.66 - private JButtonOperator _btCancel;
240.67 - private JButtonOperator _btHelp;
240.68 - private JButtonOperator _btSelectAll;
240.69 - private JButtonOperator _btClear;
240.70 - private JListOperator _lstSchemas;
240.71 - private JTextFieldOperator _txtDSName;
240.72 - private JTextFieldOperator _txtValidationQuery;
240.73 - private JTextFieldOperator _txtDriverClass;
240.74 - private JTextFieldOperator _txtUser;
240.75 - private JTextFieldOperator _txtPassword;
240.76 - private JTextFieldOperator _txtURL;
240.77 - private JTabbedPaneOperator _tbpMainTabPane;
240.78 -
240.79 - public JTabbedPaneOperator tbpMainTabPane() {
240.80 - if (_tbpMainTabPane==null) {
240.81 - _tbpMainTabPane = new JTabbedPaneOperator( this );
240.82 - }
240.83 - return _tbpMainTabPane;
240.84 - }
240.85 -
240.86 - /**
240.87 - * Initializes (if necessary) and returns an object JButtonOperator
240.88 - * for the dialog button "Get Schemas".
240.89 - * @return the appropriate object JButtonOperator
240.90 - */
240.91 - public JButtonOperator btGetSchemas() {
240.92 - if (_btGetSchemas==null) {
240.93 - _btGetSchemas = new JButtonOperator(this, getBundleString("GET_SCHEMAS_BTN_LABEL"));
240.94 - }
240.95 - return _btGetSchemas;
240.96 - }
240.97 -
240.98 - /**
240.99 - * Initializes (if necessary) and returns an object JButtonOperator
240.100 - * for the dialog button "Test Connection".
240.101 - * @return the appropriate object JButtonOperator
240.102 - */
240.103 - public JButtonOperator btTestConnection() {
240.104 - if (_btTestConnection==null) {
240.105 - _btTestConnection = new JButtonOperator(this, getBundleString("TEST_CONNECTION"));
240.106 - }
240.107 - return _btTestConnection;
240.108 - }
240.109 -
240.110 - /**
240.111 - * Initializes (if necessary) and returns an object JButtonOperator
240.112 - * for the dialog button "Modify".
240.113 - * @return the appropriate object JButtonOperator
240.114 - */
240.115 - public JButtonOperator btModify() {
240.116 - if (_btModify==null) {
240.117 - _btModify = new JButtonOperator(this, getBundleString("MODIFY"));
240.118 - }
240.119 - return _btModify;
240.120 - }
240.121 -
240.122 - /**
240.123 - * Initializes (if necessary) and returns an object JButtonOperator
240.124 - * for the dialog button "Cancel".
240.125 - * @return the appropriate object JButtonOperator
240.126 - */
240.127 - public JButtonOperator btCancel() {
240.128 - if (_btCancel==null) {
240.129 - _btCancel = new JButtonOperator(this, getBundleString("CANCEL"));
240.130 - }
240.131 - return _btCancel;
240.132 - }
240.133 -
240.134 - /**
240.135 - * Initializes (if necessary) and returns an object JButtonOperator
240.136 - * for the dialog button "Help".
240.137 - * @return the appropriate object JButtonOperator
240.138 - */
240.139 - public JButtonOperator btHelp() {
240.140 - if (_btHelp==null) {
240.141 - _btHelp = new JButtonOperator(this, getBundleString("HELP"));
240.142 - }
240.143 - return _btHelp;
240.144 - }
240.145 -
240.146 - /**
240.147 - * Initializes (if necessary) and returns an object JButtonOperator
240.148 - * for the dialog button "Select All".
240.149 - * @return the appropriate object JButtonOperator
240.150 - */
240.151 - public JButtonOperator btSelectAll() {
240.152 - if (_btSelectAll==null) {
240.153 - _btSelectAll = new JButtonOperator(this, getBundleString("SCHEMA_SELECT_ALL_BTN_LABEL"));
240.154 - }
240.155 - return _btSelectAll;
240.156 - }
240.157 -
240.158 - /**
240.159 - * Initializes (if necessary) and returns an object JButtonOperator
240.160 - * for the dialog button "Clear".
240.161 - * @return the appropriate object JButtonOperator
240.162 - */
240.163 - public JButtonOperator btClear() {
240.164 - if (_btClear==null) {
240.165 - _btClear = new JButtonOperator(this, getBundleString("SCHEMA_CLEAR_BTN_LABEL"));
240.166 - }
240.167 - return _btClear;
240.168 - }
240.169 -
240.170 - /**
240.171 - * Initializes (if necessary) and returns an object JListOperator
240.172 - * for the dialog list "Schemas".
240.173 - * @return the appropriate object JListOperator
240.174 - */
240.175 - public JListOperator lstSchemas() {
240.176 - if (_lstSchemas==null) {
240.177 - _lstSchemas = new JListOperator(this);
240.178 - }
240.179 - return _lstSchemas;
240.180 - }
240.181 -
240.182 - /**
240.183 - * Initializes (if necessary) and returns an object JTextFieldOperator
240.184 - * for the dialog text field "Data Source Name".
240.185 - * @return the appropriate object JTextFieldOperator
240.186 - */
240.187 - public JTextFieldOperator txtDSName() {
240.188 - if (_txtDSName==null) {
240.189 - _txtDSName = new JTextFieldOperator(this, 2);
240.190 - }
240.191 - return _txtDSName;
240.192 - }
240.193 -
240.194 - /**
240.195 - * Initializes (if necessary) and returns an object JTextFieldOperator
240.196 - * for the dialog text field "Validation Query".
240.197 - * @return the appropriate object JTextFieldOperator
240.198 - */
240.199 - public JTextFieldOperator txtValidationQuery() {
240.200 - if (_txtValidationQuery==null) {
240.201 - _txtValidationQuery = new JTextFieldOperator(this, 1);
240.202 - }
240.203 - return _txtValidationQuery;
240.204 - }
240.205 -
240.206 - /**
240.207 - * Initializes (if necessary) and returns an object JTextFieldOperator
240.208 - * for the dialog text field "Driver Class".
240.209 - * @return the appropriate object JTextFieldOperator
240.210 - */
240.211 - public JTextFieldOperator txtDriverClass() {
240.212 - if (_txtDriverClass==null) {
240.213 - _txtDriverClass = new JTextFieldOperator(this, 0);
240.214 - }
240.215 - return _txtDriverClass;
240.216 - }
240.217 -
240.218 - /**
240.219 - * Initializes (if necessary) and returns an object JTextFieldOperator
240.220 - * for the dialog text field "User".
240.221 - * @return the appropriate object JTextFieldOperator
240.222 - */
240.223 - public JTextFieldOperator txtUser() {
240.224 - if (_txtUser==null) {
240.225 - _txtUser = new JTextFieldOperator(this, 3);
240.226 - }
240.227 - return _txtUser;
240.228 - }
240.229 -
240.230 - /**
240.231 - * Initializes (if necessary) and returns an object JTextFieldOperator
240.232 - * for the dialog text field "Password".
240.233 - * @return the appropriate object JTextFieldOperator
240.234 - */
240.235 - public JTextFieldOperator txtPassword() {
240.236 - if (_txtPassword==null) {
240.237 - _txtPassword = new JTextFieldOperator(this, 4);
240.238 - }
240.239 - return _txtPassword;
240.240 - }
240.241 -
240.242 - /**
240.243 - * Initializes (if necessary) and returns an object JTextFieldOperator
240.244 - * for the dialog text field "URL".
240.245 - * @return the appropriate object JTextFieldOperator
240.246 - */
240.247 - public JTextFieldOperator txtURL() {
240.248 - if (_txtURL==null) {
240.249 - _txtURL = new JTextFieldOperator(this, 5);
240.250 - }
240.251 - return _txtURL;
240.252 - }
240.253 -
240.254 - /**
240.255 - * Initializes all necessary controls.
240.256 - */
240.257 - public void verify() {
240.258 - btModify();
240.259 - btCancel();
240.260 - btHelp();
240.261 - btGetSchemas();
240.262 - btSelectAll();
240.263 - btClear();
240.264 - btTestConnection();
240.265 - txtDSName();
240.266 - txtDriverClass();
240.267 - txtPassword();
240.268 - txtURL();
240.269 - txtUser();
240.270 - txtValidationQuery();
240.271 - lstSchemas();
240.272 - }
240.273 -
240.274 - /**
240.275 - * Finds in a bundle file and returns an actual text of control component.
240.276 - * @param p_text string-key corresponding to required control component.
240.277 - * @return actual text of control component
240.278 - */
240.279 - public static String getBundleString(String p_text) {
240.280 - System.out.println("Getting bundle for " + p_text);
240.281 - try {
240.282 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
240.283 - } catch (JemmyException e) {}
240.284 - return null;
240.285 - }
240.286 -
240.287 -}
241.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/QueryBuilderOperator.java Thu Jul 10 04:29:52 2008 -0700
241.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
241.3 @@ -1,887 +0,0 @@
241.4 -/*
241.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
241.6 - *
241.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
241.8 - *
241.9 - * The contents of this file are subject to the terms of either the GNU
241.10 - * General Public License Version 2 only ("GPL") or the Common
241.11 - * Development and Distribution License("CDDL") (collectively, the
241.12 - * "License"). You may not use this file except in compliance with the
241.13 - * License. You can obtain a copy of the License at
241.14 - * http://www.netbeans.org/cddl-gplv2.html
241.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
241.16 - * specific language governing permissions and limitations under the
241.17 - * License. When distributing the software, include this License Header
241.18 - * Notice in each file and include the License file at
241.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
241.20 - * particular file as subject to the "Classpath" exception as provided
241.21 - * by Sun in the GPL Version 2 section of the License file that
241.22 - * accompanied this code. If applicable, add the following below the
241.23 - * License Header, with the fields enclosed by brackets [] replaced by
241.24 - * your own identifying information:
241.25 - * "Portions Copyrighted [year] [name of copyright owner]"
241.26 - *
241.27 - * Contributor(s):
241.28 - *
241.29 - * The Original Software is NetBeans. The Initial Developer of the Original
241.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
241.31 - * Microsystems, Inc. All Rights Reserved.
241.32 - *
241.33 - * If you wish your version of this file to be governed by only the CDDL
241.34 - * or only the GPL Version 2, indicate your decision by adding
241.35 - * "[Contributor] elects to include this software in this distribution
241.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
241.37 - * single choice of license, a recipient has the option to distribute
241.38 - * your version of this file under either the CDDL, the GPL Version 2 or
241.39 - * to extend the choice of license to its licensees as provided above.
241.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
241.41 - * Version 2 license, then the option applies only if the new code is
241.42 - * made subject to such option by the copyright holder.
241.43 - */
241.44 -
241.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
241.46 -
241.47 -import org.netbeans.modules.visualweb.gravy.Util;
241.48 -import org.netbeans.modules.db.sql.visualeditor.querybuilder.*;
241.49 -import java.awt.*;
241.50 -import java.util.*;
241.51 -import javax.swing.*;
241.52 -import java.awt.event.*;
241.53 -import org.netbeans.jemmy.*;
241.54 -import org.netbeans.jemmy.operators.*;
241.55 -import org.netbeans.jellytools.Bundle;
241.56 -
241.57 -/**
241.58 - * This class implements test functionality for a window "QueryBuilder".
241.59 - */
241.60 -public class QueryBuilderOperator extends ContainerOperator{
241.61 - ComponentOperator desktop = null;
241.62 - JTextComponentOperator query = null;
241.63 - public static final String SORT_TYPE = "Sort Type";
241.64 - public static final String SORT_ORDER = "Sort Order";
241.65 - public static final String DESCENDING = "Descending";
241.66 - public static final String ASCENDING = "Ascending";
241.67 -
241.68 - static final String ADD_QUERY_CRITERIA = "Add Query Criteria";
241.69 - public static final String CRITERIA = "Criteria";
241.70 - private static final String COLUMN = "Column";
241.71 - static final String POPUP_MENU_ITEM_PARSE_QUERY = "Parse Query";
241.72 - static final String POPUP_MENU_ITEM_RUN_QUERY = "Run Query";
241.73 - public static final String POPUP_MENU_ITEM_ADD_TABLE = "Add Table"; // "Add Table...";
241.74 - public static final String DIALOG_TITLE_ADD_TABLE = "Select Table"; // "Select Table(s) to Add";
241.75 - public final static String CANCEL = "Cancel";
241.76 - public final static String GROUP_BY="Group By";
241.77 - public static final String POPUP_MENU_ITEM_REMOVE_FROM_QUERY="Remove from Query";
241.78 - public final static String EQUALS = "Equals";
241.79 - public final static String NOT_EQUALS = "Not Equals";
241.80 - public final static String LESS_THAN = "Less Than";
241.81 - public final static String LESS_THAN_EQUALS = "Less Than Equals";
241.82 - public final static String GREATER_THAN = "Greater Than";
241.83 - public final static String GREATER_THAN_EQUALS = "Greater Than Equals";
241.84 - /**
241.85 - * @param tableName looking for given table to choose correct QueryBuilder instance
241.86 - * @return Container instanceof QueryBuilder
241.87 - */
241.88 - private static Container findQueryBuilder(String tableName) {
241.89 - java.awt.Container container = new org.netbeans.jemmy.operators.JTableOperator(
241.90 - Util.getMainWindow(),
241.91 - new QueryBuilderInputTableChooser(tableName)).getParent();
241.92 - while (!(container instanceof QueryBuilder)) {
241.93 - //System.out.println("TRACE: findQueryBuilder: " + container.getClass().getName());
241.94 - container = container.getParent();
241.95 - }
241.96 - return container;
241.97 - }
241.98 -
241.99 - /**
241.100 - * Creates new instance of this class.
241.101 - * @param parent an object ContainerOperator related to container, which includes created Query Builder
241.102 - * @param tabId a name of required tab
241.103 - */
241.104 - public QueryBuilderOperator(ContainerOperator parent, String tabId) {
241.105 - //super(parent, new QueryBuilderChooser(tabId));
241.106 - super(findQueryBuilder(tabId));
241.107 - this.setComparator(new Operator.DefaultStringComparator(true, true));
241.108 - }
241.109 -
241.110 - /**
241.111 - * Creates new instance of this class.
241.112 - * @param tabId a name of required tab
241.113 - */
241.114 - public QueryBuilderOperator(String tabId) {
241.115 - this(Util.getMainWindow(), tabId);
241.116 - }
241.117 -
241.118 - /**
241.119 - * Creates new instance of this class.
241.120 - * @param parent an object ContainerOperator related to container, which includes created Query Builder
241.121 - */
241.122 - public QueryBuilderOperator(ContainerOperator parent) {
241.123 - super(parent, new QueryBuilderChooser());
241.124 - this.setComparator(new Operator.DefaultStringComparator(true, true));
241.125 - }
241.126 -
241.127 - /**
241.128 - * Creates new instance of this class.
241.129 - */
241.130 - public QueryBuilderOperator() {
241.131 - this(Util.getMainWindow());
241.132 - }
241.133 -
241.134 - /**
241.135 - * Closes a window of Query Builder.
241.136 - */
241.137 - public void close(){
241.138 - Util.closeWindow();
241.139 - }
241.140 -
241.141 - /**
241.142 - * TODO: Fix it
241.143 - * Returns an object QueryBuilderGraphFrameOperator
241.144 - * @return QueryBuilderGraphFrameOperator
241.145 - */
241.146 - public QueryBuilderPaneOperator getGraphFrame() {
241.147 - return(new QueryBuilderPaneOperator());
241.148 - }
241.149 -
241.150 - /**
241.151 - * Returns an object TableFrameOperator
241.152 - * Represent Operator for Table with given name in Graph Frame of the QueryBuilder
241.153 - * @param tableName
241.154 - * @return TableFrameOperator
241.155 - *
241.156 - */
241.157 - public TableFrameOperator getTableFrame(String tableName) {
241.158 - return(new TableFrameOperator(tableName));
241.159 - }
241.160 -
241.161 - /**
241.162 - * Returns an object InputTableOperator
241.163 - * @return InputTableOperator
241.164 - */
241.165 - public InputTableOperator getInputTable() {
241.166 - return(new InputTableOperator());
241.167 - }
241.168 - /**
241.169 - * TODO: Fix it
241.170 - */
241.171 - private ComponentOperator getDesktop() {
241.172 - if(desktop == null) {
241.173 - //desktop = new ComponentOperator(new QueryBuilderOperator().getGraphFrame(),
241.174 - // new Operator.Finder(JDesktopPane.class));
241.175 - desktop = new QueryBuilderOperator().getGraphFrame();
241.176 - }
241.177 - return(desktop);
241.178 - }
241.179 -
241.180 - /**
241.181 - * Initializes (if necessary) and returns an object JTextComponentOperator (query text).
241.182 - * @return JTextComponentOperator
241.183 - */
241.184 - public JTextComponentOperator getQueryTextComponent() {
241.185 - if(query == null) {
241.186 - //query = new JTextComponentOperator(this);
241.187 - query = new JEditorPaneOperator(this);
241.188 - }
241.189 - return(query);
241.190 - }
241.191 -
241.192 - /**
241.193 - * Returns an object JTableOperator (result table of a query)
241.194 - * @return JTableOperator
241.195 - */
241.196 - public JTableOperator getResultTable() {
241.197 - return(new JTableOperator(this, new Operator.Finder(QueryBuilderResultTable.class)));
241.198 - }
241.199 -
241.200 - /**
241.201 - * Clicks an item of a popup menu.
241.202 - * @param menuText a menu item
241.203 - */
241.204 - public void pushPopup(String menuText) {
241.205 - getDesktop().clickForPopup(10, 10);
241.206 - new JPopupMenuOperator().pushMenuNoBlock(menuText);
241.207 - }
241.208 -
241.209 - /**
241.210 - * Returns JComponentOperator, which wraps component, presenting
241.211 - * Graph Panel of Query Editor
241.212 - */
241.213 - public JComponentOperator getGraphComponent() {
241.214 - JComponent jComponent = (JComponent) findComponent((Container) this.getSource(),
241.215 - new ComponentChooser() {
241.216 - public boolean checkComponent(Component comp) {
241.217 - return (comp.getClass().getName().endsWith("SceneComponent") ?
241.218 - true : false);
241.219 - }
241.220 - public String getDescription() {
241.221 - return ("Graph component [SceneComponent] is being found...");
241.222 - }
241.223 - });
241.224 - return (new JComponentOperator(jComponent));
241.225 - }
241.226 -
241.227 - /**
241.228 - * Returns JScrollPaneOperator, which wraps a scroll pane
241.229 - * of Graph Panel of Query Editor
241.230 - */
241.231 - public JScrollPaneOperator getGraphScrollPane() {
241.232 - Component component = getGraphComponent().getSource();
241.233 - do {
241.234 - component = component.getParent();
241.235 - } while (!(component instanceof JScrollPane));
241.236 - return (new JScrollPaneOperator((JScrollPane) component));
241.237 - }
241.238 -
241.239 - //========================================================================//
241.240 - /**
241.241 - * Class for component, presenting DB Table on Graph Panel of Query Editor
241.242 - */
241.243 - private static class DBTableGraphComponent {
241.244 - private QueryBuilderOperator queryBuilder;
241.245 - private Container dbTableGraphObject;
241.246 - private JTable structureTable;
241.247 -
241.248 - private DBTableGraphComponent(QueryBuilderOperator queryBuilder,
241.249 - Container dbTableGraphObject) {
241.250 - this.queryBuilder = queryBuilder;
241.251 - this.dbTableGraphObject = dbTableGraphObject;
241.252 - structureTable = (JTable) ComponentOperator.findComponent(dbTableGraphObject,
241.253 - new ComponentChooser() {
241.254 - public boolean checkComponent(Component comp) {
241.255 - return (comp instanceof JTable ? true : false);
241.256 - }
241.257 - public String getDescription() {
241.258 - return "DB table component on Query Editor Graph Panel";
241.259 - }
241.260 - });
241.261 - }
241.262 -
241.263 - private String getDBTableName() {
241.264 - QueryBuilderTableModel tableModel = (QueryBuilderTableModel) structureTable.getModel();
241.265 - return tableModel.getTableName();
241.266 - }
241.267 -
241.268 - public JTable getStructureTable() {
241.269 - return structureTable;
241.270 - }
241.271 -
241.272 - private void callPopupMenu(String popupMenuItem) {
241.273 - new ComponentOperator(dbTableGraphObject).makeComponentVisible();
241.274 - Util.wait(1000);
241.275 - new QueueTool().waitEmpty();
241.276 -
241.277 - JComponentOperator graphComponentOp = queryBuilder.getGraphComponent();
241.278 - Point pointGraphComponent = graphComponentOp.getLocationOnScreen(),
241.279 - pointDBTableObj = dbTableGraphObject.getLocationOnScreen();
241.280 - int dx = pointDBTableObj.x - pointGraphComponent.x + 3,
241.281 - dy = pointDBTableObj.y - pointGraphComponent.y - 3;
241.282 -
241.283 - graphComponentOp.clickForPopup(dx, dy);
241.284 - Util.wait(1000);
241.285 - new QueueTool().waitEmpty();
241.286 -
241.287 - new JPopupMenuOperator().pushMenuNoBlock(popupMenuItem);
241.288 - Util.wait(1000);
241.289 - new QueueTool().waitEmpty();
241.290 - }
241.291 -
241.292 - @Override
241.293 - public String toString() {
241.294 - return getDBTableName();
241.295 - }
241.296 -
241.297 - @Override
241.298 - public boolean equals(Object obj) {
241.299 - if (obj == null) return false;
241.300 - if (obj instanceof String) return (getDBTableName().equals(obj.toString()));
241.301 -
241.302 - if (getClass() != obj.getClass()) return false;
241.303 -
241.304 - DBTableGraphComponent other = (DBTableGraphComponent) obj;
241.305 - return (getDBTableName().equals(other.getDBTableName()));
241.306 - }
241.307 -
241.308 - @Override
241.309 - public int hashCode() {
241.310 - return getDBTableName().hashCode();
241.311 - }
241.312 -
241.313 - private static java.util.List<DBTableGraphComponent> getDBTableGraphComponentList(
241.314 - QueryBuilderOperator queryBuilder) {
241.315 - java.util.List<DBTableGraphComponent> componentList = new ArrayList<DBTableGraphComponent>();
241.316 - Container container = (Container) queryBuilder.getGraphComponent().getSource();
241.317 - Component[] components = container.getComponents();
241.318 - for (Component component : components) {
241.319 - if (component.getClass().getName().endsWith("QBNodeComponent")) {
241.320 - componentList.add(new DBTableGraphComponent(queryBuilder,
241.321 - (Container) component));
241.322 - }
241.323 - }
241.324 - return componentList;
241.325 - }
241.326 -
241.327 - private static DBTableGraphComponent findDBTable(QueryBuilderOperator queryBuilder,
241.328 - String dbTableName) {
241.329 - return findDBTable(getDBTableGraphComponentList(queryBuilder), dbTableName);
241.330 - }
241.331 - private static DBTableGraphComponent findDBTable(
241.332 - java.util.List<DBTableGraphComponent> dbTableList, String dbTableName) {
241.333 - for (DBTableGraphComponent dbTable : dbTableList) {
241.334 - if (dbTable.equals(dbTableName)) return dbTable;
241.335 - }
241.336 - return null;
241.337 - }
241.338 - }
241.339 - //========================================================================//
241.340 -
241.341 - public JTableOperator getStructureTableOfDBTableOnGraphPanel(String dbTableName) {
241.342 - DBTableGraphComponent graphComponent = DBTableGraphComponent.findDBTable(this, dbTableName);
241.343 - if (graphComponent == null) return null;
241.344 - return (new JTableOperator(graphComponent.getStructureTable()));
241.345 - }
241.346 -
241.347 - public boolean isDBTableOpenedOnGraphPanel(String dbTableName) {
241.348 - return (DBTableGraphComponent.findDBTable(this, dbTableName) != null);
241.349 - }
241.350 -
241.351 - /**
241.352 - * Adds a database table into a query.
241.353 - * @param dbTableName name of a database table
241.354 - */
241.355 - public void addTable(String dbTableName) {
241.356 - DBTableGraphComponent dbTable = DBTableGraphComponent.findDBTable(this, dbTableName);
241.357 - if (dbTable != null) return; // DB table is already opened in Graph Pane of Query Editor
241.358 -
241.359 - JComponentOperator jCompOp = getGraphComponent();
241.360 - Util.wait(1000);
241.361 - new QueueTool().waitEmpty();
241.362 -
241.363 - //pushPopup(getBundleString("Add_Table"));
241.364 - jCompOp.clickForPopup(2, 2);
241.365 - Util.wait(1000);
241.366 - new QueueTool().waitEmpty();
241.367 -
241.368 - new JPopupMenuOperator().pushMenuNoBlock(POPUP_MENU_ITEM_ADD_TABLE);
241.369 - Util.wait(1000);
241.370 - new QueueTool().waitEmpty();
241.371 -
241.372 - //JDialogOperator addTableDialog = new JDialogOperator(getBundleString("Add_Table_Title"));
241.373 - JDialogOperator addTableDialog = new JDialogOperator(DIALOG_TITLE_ADD_TABLE);
241.374 - Util.wait(1000);
241.375 - new QueueTool().waitEmpty();
241.376 -
241.377 - new JListOperator(addTableDialog).selectItem(dbTableName);
241.378 - Util.wait(1000);
241.379 - new QueueTool().waitEmpty();
241.380 -
241.381 - new JButtonOperator(addTableDialog, "OK").pushNoBlock();
241.382 - Util.wait(1000);
241.383 - new QueueTool().waitEmpty();
241.384 - }
241.385 -
241.386 - /**
241.387 - * Removes a database table from a query.
241.388 - * @param dbTableName name of a database table
241.389 - */
241.390 - public void removeTable(String dbTableName) {
241.391 - DBTableGraphComponent dbTable = DBTableGraphComponent.findDBTable(this, dbTableName);
241.392 - dbTable.callPopupMenu(POPUP_MENU_ITEM_REMOVE_FROM_QUERY);
241.393 - Util.wait(1000);
241.394 - new QueueTool().waitEmpty();
241.395 - }
241.396 -
241.397 - /**
241.398 - * Updates text of a query.
241.399 - * @param newQuery text of query
241.400 - */
241.401 - public void retypeQuery(String newQuery) {
241.402 - // this.getQueryTextComponent().clearText();
241.403 - // Util.wait(500);
241.404 - // this.getQueryTextComponent().typeText(newQuery);
241.405 - this.getQueryTextComponent().setText(newQuery);
241.406 - Util.wait(1500);
241.407 - new QueueTool().waitEmpty();
241.408 - }
241.409 -
241.410 - /**
241.411 - * Changes text of a query.
241.412 - * @param substring a part of query text, which should be changed
241.413 - * @param newSubstring new text, which will replace a part of query text
241.414 - */
241.415 - public void changeQuery(String substring, String newSubstring) {
241.416 - getQueryTextComponent().selectText(substring);
241.417 - getQueryTextComponent().replaceSelection(newSubstring);
241.418 - }
241.419 -
241.420 - /**
241.421 - * Performs a query.
241.422 - * @return object JTableOperator
241.423 - */
241.424 - public JTableOperator runQuery() {
241.425 - getQueryTextComponent().clickForPopup(2, 2);
241.426 - Util.wait(1000);
241.427 - new QueueTool().waitEmpty();
241.428 -
241.429 - new JPopupMenuOperator().pushMenuNoBlock(POPUP_MENU_ITEM_RUN_QUERY);
241.430 - Util.wait(1000);
241.431 - new QueueTool().waitEmpty();
241.432 - return(getResultTable());
241.433 - }
241.434 -
241.435 - /**
241.436 - * Parses a query.
241.437 - */
241.438 - public void parseQuery() {
241.439 - getQueryTextComponent().clickForPopup(2, 2);
241.440 - Util.wait(1000);
241.441 - new QueueTool().waitEmpty();
241.442 -
241.443 - new JPopupMenuOperator().pushMenuNoBlock(POPUP_MENU_ITEM_PARSE_QUERY);
241.444 - Util.wait(1000);
241.445 - new QueueTool().waitEmpty();
241.446 - }
241.447 -
241.448 - /**
241.449 - * Invokes a dialog "Add query criteria".
241.450 - * @param column a name of a required column
241.451 - * @return an object AddQueryCriteriaOperator
241.452 - */
241.453 - public AddQueryCriteriaOperator invokeAddCriteria(String column) {
241.454 - return invokeAddCriteria(getInputTable().findCellRow(column));
241.455 - }
241.456 -
241.457 - /**
241.458 - * Invokes a dialog "Add query criteria".
241.459 - * @param column a number of a required column
241.460 - * @return an object AddQueryCriteriaOperator
241.461 - */
241.462 - public AddQueryCriteriaOperator invokeAddCriteria(int column) {
241.463 - JTableOperator inputTable = getInputTable();
241.464 - //Point p = inputTable.getPointToClick(column, inputTable.findColumn(getBundleString("CRITERIA")));
241.465 - //Point p = inputTable.getPointToClick(column, inputTable.findColumn(CRITERIA));
241.466 - Point p = inputTable.getPointToClick(column, inputTable.findColumn(COLUMN));
241.467 - Util.wait(500);
241.468 - new QueueTool().waitEmpty();
241.469 -
241.470 - inputTable.clickForPopup(p.x, p.y);
241.471 - JPopupMenuOperator popup = new JPopupMenuOperator();
241.472 - Util.wait(500);
241.473 - new QueueTool().waitEmpty();
241.474 -
241.475 - //popup.pushMenuNoBlock(getBundleString("ADD_QUERY_CRITERIA"));
241.476 - popup.pushMenuNoBlock(ADD_QUERY_CRITERIA);
241.477 - Util.wait(500);
241.478 - new QueueTool().waitEmpty();
241.479 -
241.480 - return new AddQueryCriteriaOperator();
241.481 - }
241.482 -
241.483 - /**
241.484 - * Adds query criteria to a column of a database table.
241.485 - * @param column a name of a required column
241.486 - * @param value text of criteria value
241.487 - * @param operatorValue string with a comparison operator or a statement,
241.488 - * which is used in criteria (for example, "=")
241.489 - */
241.490 - public void addSimpleCriteria(String column, String value, String operatorValue) {
241.491 - // invoke add query criteria dialog
241.492 - AddQueryCriteriaOperator dialog = invokeAddCriteria(column);
241.493 -
241.494 - if (operatorValue != null)
241.495 - dialog.cboCompareType().selectItem(operatorValue);
241.496 -
241.497 - dialog.txtValue().setText(value);
241.498 - Util.wait(1000);
241.499 - new QueueTool().waitEmpty();
241.500 -
241.501 - dialog.btOK().pushNoBlock();
241.502 - Util.wait(1000);
241.503 - new QueueTool().waitEmpty();
241.504 - }
241.505 -
241.506 - /**
241.507 - * Adds a new parameter to a query criteria.
241.508 - * @param column a name of a required column
241.509 - */
241.510 - public void addParamCriteria(String column) {
241.511 - AddQueryCriteriaOperator dialog = invokeAddCriteria(column);
241.512 -
241.513 - dialog.rbtParameter().setSelected(true);
241.514 - Util.wait(1000);
241.515 - new QueueTool().waitEmpty();
241.516 -
241.517 - dialog.btOK().pushNoBlock();
241.518 - Util.wait(1500);
241.519 - new QueueTool().waitEmpty();
241.520 - }
241.521 -
241.522 - /**
241.523 - * Adds a new parameter to a query criteria.
241.524 - * @param column a number of a required column
241.525 - */
241.526 - public void addParamCriteria(int column) {
241.527 - AddQueryCriteriaOperator dialog = invokeAddCriteria(column);
241.528 -
241.529 - dialog.rbtParameter().setSelected(true);
241.530 - Util.wait(1000);
241.531 - new QueueTool().waitEmpty();
241.532 -
241.533 - dialog.btOK().pushNoBlock();
241.534 - Util.wait(1500);
241.535 - new QueueTool().waitEmpty();
241.536 - }
241.537 -
241.538 - /**
241.539 - * Selects "graphical join" of database tables (an arrow between 2 tables)
241.540 - * on graphical diagram.
241.541 - * @param table1 the 1st database table
241.542 - * @param table2 the 2nd database table
241.543 - * @deprecated Uses old graph library
241.544 - */
241.545 - public void selectJoin(String table1, String table2) {
241.546 - QueryBuilderGraphFrame gframe = (QueryBuilderGraphFrame) getGraphFrame().getSource();
241.547 -
241.548 - QueryBuilderInternalFrame fr1 = (QueryBuilderInternalFrame) getTableFrame(table1).getSource();
241.549 - QueryBuilderInternalFrame fr2 = (QueryBuilderInternalFrame) getTableFrame(table2).getSource();
241.550 -/* TODO: jgraph remnoed
241.551 - DefaultGraphCell cell1 = fr1.getGraphCell();
241.552 - DefaultGraphCell cell2 = fr2.getGraphCell();
241.553 -
241.554 - for(int i=0;i<gframe.getGraph().getModel().getRootCount();i++) {
241.555 - Object o = gframe.getGraph().getModel().getRootAt(i);
241.556 -
241.557 - if(gframe.getGraph().getModel().isEdge(o)) {
241.558 -
241.559 - DefaultEdge e = (DefaultEdge) o;
241.560 -
241.561 - DefaultPort sourcePort = (DefaultPort)e.getSource();
241.562 - DefaultPort targetPort = (DefaultPort)e.getTarget();
241.563 -
241.564 - DefaultGraphCell sourceCell = (DefaultGraphCell) sourcePort.getParent();
241.565 - DefaultGraphCell targetCell = (DefaultGraphCell) targetPort.getParent();
241.566 -
241.567 - if(sourceCell == cell2 && targetCell == cell1 ||
241.568 - sourceCell == cell1 && targetCell == cell2) {
241.569 - Rectangle rect = gframe.getGraph().getCellBounds(o);
241.570 - ComponentOperator desktop = ComponentOperator.createOperator(gframe.getGraph());
241.571 - desktop.clickMouse((int) rect.getCenterX(), (int) rect.getCenterY(), 1);
241.572 - Util.wait(2000);
241.573 - break;
241.574 - }
241.575 - }
241.576 -
241.577 - }
241.578 - */
241.579 - }
241.580 -
241.581 - /**
241.582 - * Find Container consist Table with given tableName
241.583 - */
241.584 - private Container findTableFrame(String tableName) {
241.585 - java.awt.Container container = new JTableOperator(this,
241.586 - new QueryBuilderTableChooser(tableName)).getParent();
241.587 - while (!(container instanceof QBNodeComponent)) {
241.588 - container = container.getParent();
241.589 - System.out.println("TRACE: findTableFrame: "+ container.getClass().getName());
241.590 - }
241.591 - return container;
241.592 - }
241.593 -
241.594 - /**
241.595 - * This internal class handles a frame with a "graphical table"
241.596 - * on graphical diagram.
241.597 - */
241.598 - public class TableFrameOperator extends /*JComponentOperator*/ ContainerOperator {
241.599 - JTableOperator table = null;
241.600 - String tableName;
241.601 -
241.602 - /**
241.603 - * Creates new instance of this class.
241.604 - * @param tableName a name of database table
241.605 - */
241.606 - public TableFrameOperator(String tableName) {
241.607 - super(findTableFrame(tableName));
241.608 - //super(QueryBuilderOperator.this, new TableFrameChooser(tableName));
241.609 - this.tableName = tableName;
241.610 - //super(QueryBuilderOperator.this, tableName);
241.611 - }
241.612 - /*
241.613 - public TableFrameOperator(ContainerOperator cont) {
241.614 - super(cont, new TableFrameChooser());
241.615 - }
241.616 - */
241.617 -
241.618 - public String getTitle() {
241.619 - return tableName;
241.620 - }
241.621 -
241.622 - public ContainerOperator getTitleOperator() {
241.623 - Container cont = this.getTable().getParent();
241.624 - cont = cont.getParent();
241.625 - //cont = cont.getParent();
241.626 - return new ContainerOperator(cont);
241.627 - }
241.628 -
241.629 - /**
241.630 - * Returns an object JTableOperator, related to a database table,
241.631 - * included into graphical frame.
241.632 - * @return an object JTableOperator
241.633 - */
241.634 - public JTableOperator getTable() {
241.635 - if(table == null) {
241.636 - table = new JTableOperator(this, new QueryBuilderTableChooser());
241.637 - this.getQueueTool().waitEmpty(100);
241.638 - }
241.639 - return(table);
241.640 - }
241.641 -
241.642 - /**
241.643 - * Reversible selection changing of a single field of "graphical table".
241.644 - * @param fieldName a name of table field
241.645 - */
241.646 - public void changeFieldSelection(String fieldName) {
241.647 - System.out.println(fieldName);
241.648 - System.out.println(getTable().findCell(fieldName, 0));
241.649 - int row = getTable().findCell(fieldName, 0).y;
241.650 - if(row == -1) {
241.651 - throw(new JemmyException("Can not find \"" + fieldName +
241.652 - "\" in \"\" table"));
241.653 - }
241.654 - getTable().clickOnCell(row, 0);
241.655 - }
241.656 - /**
241.657 - * Chooser for Table in Graph View Frame
241.658 - *
241.659 - */
241.660 - public class QueryBuilderTableChooser implements ComponentChooser {
241.661 -
241.662 - public boolean checkComponent(Component comp) {
241.663 - boolean res = comp instanceof QueryBuilderTable;
241.664 - if (res) {
241.665 - String firstValue = ((QueryBuilderTable)comp).getValueAt(0, 2).toString();
241.666 - String secondValue = ((QueryBuilderTable)comp).getValueAt(1, 2).toString();
241.667 - //System.out.println("TRACE: QueryBuilderTableChooser: firstValue = "+
241.668 - // ((QueryBuilderTable)comp).getValueAt(0, 2));
241.669 - //System.out.println("TRACE: QueryBuilderTableChooser: secondValue = " +secondValue);
241.670 - boolean firstFound = false;
241.671 - boolean secondFound = false;
241.672 - JTableOperator inputTable = QueryBuilderOperator.this.getInputTable();
241.673 - int rowCout = inputTable.getRowCount();
241.674 - for (int i=0;i<rowCout;i++) {
241.675 - if ((inputTable.getValueAt(i, 0).toString().equals(firstValue)) &&
241.676 - (inputTable.getValueAt(i, 2).toString().indexOf(TableFrameOperator.this.tableName)!=-1)) {
241.677 - firstFound = true;
241.678 - break;
241.679 - }
241.680 - }
241.681 - for (int i=0;i<rowCout;i++) {
241.682 - if ((inputTable.getValueAt(i, 0).toString().equals(secondValue)) &&
241.683 - (inputTable.getValueAt(i, 2).toString().indexOf(TableFrameOperator.this.tableName)!=-1)) {
241.684 - secondFound = true;
241.685 - break;
241.686 - }
241.687 - }
241.688 - return firstFound && secondFound;
241.689 - }
241.690 - return false;
241.691 - }
241.692 -
241.693 - public String getDescription() {
241.694 - return "Chooser for QueryBuilderTable";
241.695 - }
241.696 -
241.697 - }
241.698 - }
241.699 -
241.700 - public class QueryBuilderTableChooser implements ComponentChooser {
241.701 - String tableName;
241.702 -
241.703 - public QueryBuilderTableChooser(String tableName) {
241.704 - this.tableName = tableName;
241.705 - }
241.706 -
241.707 - public boolean checkComponent(Component comp) {
241.708 - boolean res = comp instanceof QueryBuilderTable;
241.709 - if (res) {
241.710 - String firstValue = ((QueryBuilderTable)comp).getValueAt(0, 2).toString();
241.711 - String secondValue = ((QueryBuilderTable)comp).getValueAt(1, 2).toString();
241.712 - //System.out.println("TRACE: QueryBuilderTableChooser: firstValue = "+
241.713 - // ((QueryBuilderTable)comp).getValueAt(0, 2));
241.714 - //System.out.println("TRACE: QueryBuilderTableChooser: secondValue = " +secondValue);
241.715 - boolean firstFound = false;
241.716 - boolean secondFound = false;
241.717 - JTableOperator inputTable = QueryBuilderOperator.this.getInputTable();
241.718 - int rowCout = inputTable.getRowCount();
241.719 - for (int i=0;i<rowCout;i++) {
241.720 - if ((inputTable.getValueAt(i, 0).toString().equals(firstValue)) &&
241.721 - (inputTable.getValueAt(i, 2).toString().indexOf(tableName)!=-1)) {
241.722 - firstFound = true;
241.723 - break;
241.724 - }
241.725 - }
241.726 - for (int i=0;i<rowCout;i++) {
241.727 - if ((inputTable.getValueAt(i, 0).toString().equals(secondValue)) &&
241.728 - (inputTable.getValueAt(i, 2).toString().indexOf(tableName)!=-1)) {
241.729 - secondFound = true;
241.730 - break;
241.731 - }
241.732 - }
241.733 - return firstFound && secondFound;
241.734 - }
241.735 - return false;
241.736 - }
241.737 -
241.738 - public String getDescription() {
241.739 - return "Chooser for QueryBuilderTable";
241.740 - }
241.741 -
241.742 - }
241.743 - /**
241.744 - * TableFrameChooser
241.745 - * @deprecated TODO: Need to choose correct table name
241.746 - */
241.747 - public class TableFrameChooser implements ComponentChooser {
241.748 - String tableName;
241.749 - public TableFrameChooser(String tableName) {
241.750 - this.tableName = tableName;
241.751 - }
241.752 - public boolean checkComponent(Component comp) {
241.753 - if (comp instanceof QueryBuilderPane) {
241.754 - return true;
241.755 - }
241.756 - return false;
241.757 - }
241.758 -
241.759 - public String getDescription() {
241.760 - return "TableFrameChooser";
241.761 - }
241.762 -
241.763 - }
241.764 -
241.765 -
241.766 - /**
241.767 - *
241.768 - *
241.769 - */
241.770 - public class QueryBuilderPaneOperator extends ContainerOperator {
241.771 - public QueryBuilderPaneOperator() {
241.772 - super(QueryBuilderOperator.this, new QueryBuilderPaneChooser());
241.773 - }
241.774 - }
241.775 -
241.776 - public class QueryBuilderPaneChooser implements ComponentChooser {
241.777 - public boolean checkComponent(Component comp) {
241.778 - return comp instanceof QueryBuilderPane;
241.779 - }
241.780 - public String getDescription() {
241.781 - return "QueryBuilderPane Component";
241.782 - }
241.783 - }
241.784 -
241.785 - /**
241.786 - * @deprecated
241.787 - */
241.788 - public class QueryBuilderGraphFrameOperator extends ContainerOperator {
241.789 - public QueryBuilderGraphFrameOperator() {
241.790 - super(QueryBuilderOperator.this, new QueryBuilderGraphFrameChooser());
241.791 - }
241.792 - }
241.793 - /**
241.794 - *
241.795 - */
241.796 - public class QueryBuilderGraphFrameChooser implements ComponentChooser {
241.797 - public boolean checkComponent(Component comp) {
241.798 - return(comp instanceof QueryBuilderGraphFrame);
241.799 - }
241.800 - public String getDescription() {
241.801 - return(QueryBuilderGraphFrame.class.getName());
241.802 - }
241.803 - }
241.804 -
241.805 - public class InputTableOperator extends JTableOperator {
241.806 - public InputTableOperator() {
241.807 - super(QueryBuilderOperator.this, new Operator.Finder(QueryBuilderInputTable.class));
241.808 - }
241.809 -
241.810 - }
241.811 -
241.812 - /**
241.813 - * Looking for QueryBuilderInputTable by searching its instances and choosing one
241.814 - * which contains tableName Tabke
241.815 - */
241.816 - public static class QueryBuilderInputTableChooser implements ComponentChooser {
241.817 - String tableName;
241.818 -
241.819 - /**
241.820 - *
241.821 - * @param tableName Name of the Table in QueryBuilderInputTable
241.822 - */
241.823 - public QueryBuilderInputTableChooser(String tableName) {
241.824 - this.tableName = tableName;
241.825 - }
241.826 -
241.827 -
241.828 - public boolean checkComponent(Component comp) {
241.829 - if (comp instanceof QueryBuilderInputTable) {
241.830 - JTableOperator table = new JTableOperator((QueryBuilderInputTable)comp);
241.831 - //System.out.println("TRACE: QueryBuilderInputTableChooser table = "+ table.getValueAt(0, 2).toString());
241.832 - if (table.getValueAt(0, 2).toString().indexOf(tableName)!=-1)
241.833 - return true;
241.834 - }
241.835 - return false;
241.836 - }
241.837 -
241.838 - public String getDescription() {
241.839 - return "QueryInputTable with name: " + tableName;
241.840 - }
241.841 -
241.842 - }
241.843 -
241.844 - /**
241.845 - * TODO: Doesn't work properly, not used anymore
241.846 - * @deprecated
241.847 - */
241.848 - public static class QueryBuilderChooser implements ComponentChooser {
241.849 - private String tabId = null;
241.850 -
241.851 - public QueryBuilderChooser() {
241.852 - }
241.853 -
241.854 - public QueryBuilderChooser(String _tabId) {
241.855 - tabId = _tabId;
241.856 - }
241.857 -
241.858 - public boolean checkComponent(Component comp) {
241.859 - boolean res = comp instanceof QueryBuilder;
241.860 - if(tabId != null && res) {
241.861 - String name = new JTableOperator(new ContainerOperator(ContainerOperator.findContainerUnder(comp)),
241.862 - new QueryBuilderInputTableChooser(tabId)).getValueAt(0, 2).toString();
241.863 - if (name.equalsIgnoreCase(tabId)) {
241.864 - return true;
241.865 - }
241.866 - return false;
241.867 - } else {
241.868 - return res;
241.869 - }
241.870 - }
241.871 -
241.872 - public String getDescription() {
241.873 - return(QueryBuilder.class.getName());
241.874 - }
241.875 - }
241.876 -
241.877 - /**
241.878 - * Finds in a bundle file and returns an actual text of control component.
241.879 - * @param p_text string-key corresponding to required control component.
241.880 - * @return actual text of control component
241.881 - * @deprecated No Bundle present
241.882 - */
241.883 - public static String getBundleString(String p_text) {
241.884 - System.out.println("Getting bundle for " + p_text);
241.885 - try {
241.886 - return Bundle.getStringTrimmed("com.sun.rave.dataconnectivity.querybuilder.Bundle", p_text);
241.887 - } catch (JemmyException e) {}
241.888 - return null;
241.889 - }
241.890 -}
242.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ServerExplorerOperator.java Thu Jul 10 04:29:52 2008 -0700
242.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
242.3 @@ -1,790 +0,0 @@
242.4 -/*
242.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
242.6 -*
242.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
242.8 -*
242.9 -* The contents of this file are subject to the terms of either the GNU
242.10 -* General Public License Version 2 only ("GPL") or the Common
242.11 -* Development and Distribution License("CDDL") (collectively, the
242.12 -* "License"). You may not use this file except in compliance with the
242.13 -* License. You can obtain a copy of the License at
242.14 -* http://www.netbeans.org/cddl-gplv2.html
242.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
242.16 -* specific language governing permissions and limitations under the
242.17 -* License. When distributing the software, include this License Header
242.18 -* Notice in each file and include the License file at
242.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
242.20 -* particular file as subject to the "Classpath" exception as provided
242.21 -* by Sun in the GPL Version 2 section of the License file that
242.22 -* accompanied this code. If applicable, add the following below the
242.23 -* License Header, with the fields enclosed by brackets [] replaced by
242.24 -* your own identifying information:
242.25 -* "Portions Copyrighted [year] [name of copyright owner]"
242.26 -*
242.27 -* Contributor(s):
242.28 -*
242.29 -* The Original Software is NetBeans. The Initial Developer of the Original
242.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
242.31 -* Microsystems, Inc. All Rights Reserved.
242.32 -*
242.33 -* If you wish your version of this file to be governed by only the CDDL
242.34 -* or only the GPL Version 2, indicate your decision by adding
242.35 -* "[Contributor] elects to include this software in this distribution
242.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
242.37 -* single choice of license, a recipient has the option to distribute
242.38 -* your version of this file under either the CDDL, the GPL Version 2 or
242.39 -* to extend the choice of license to its licensees as provided above.
242.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
242.41 -* Version 2 license, then the option applies only if the new code is
242.42 -* made subject to such option by the copyright holder.
242.43 -*/
242.44 -
242.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
242.46 -
242.47 -import org.netbeans.modules.visualweb.gravy.DNDDriver;
242.48 -import org.netbeans.modules.visualweb.gravy.TestUtils;
242.49 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
242.50 -import org.netbeans.modules.visualweb.gravy.Util;
242.51 -import org.netbeans.modules.visualweb.gravy.websvc.AddWebServiceOperator;
242.52 -import org.netbeans.modules.visualweb.gravy.nodes.WebServicesNode;
242.53 -import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
242.54 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
242.55 -import org.netbeans.modules.visualweb.gravy.model.deployment.DeploymentTargetDescriptor;
242.56 -import org.netbeans.jellytools.Bundle;
242.57 -import org.netbeans.jellytools.NbDialogOperator;
242.58 -import org.netbeans.jellytools.WizardOperator;
242.59 -import org.netbeans.jemmy.JemmyProperties;
242.60 -import org.netbeans.jemmy.QueueTool;
242.61 -import org.netbeans.jemmy.TimeoutExpiredException;
242.62 -import org.netbeans.jemmy.operators.*;
242.63 -import javax.swing.*;
242.64 -import javax.swing.tree.TreePath;
242.65 -import javax.swing.tree.TreeNode;
242.66 -import java.awt.*;
242.67 -import java.awt.event.KeyEvent;
242.68 -import org.netbeans.jemmy.Waitable;
242.69 -import org.netbeans.jemmy.Waiter;
242.70 -import java.util.Hashtable;
242.71 -
242.72 -/**
242.73 - * This class implements test functionality for the window "ServerExplorer".
242.74 - */
242.75 -public class ServerExplorerOperator extends TopComponentOperator {
242.76 -
242.77 - public static final String
242.78 - STR_NAME_WEBLOGIC = "BEA WebLogic Server",
242.79 - STR_NAME_JBOSS = "JBoss Application Server",
242.80 - STR_NAME_APPSERVER = "Sun Java System Application Server",
242.81 - STR_NAME_GLASSFISH_V1 = "GlassFish V1",
242.82 - STR_NAME_GLASSFISH_V2 = "GlassFish V2",
242.83 - STR_NAME_TOMCAT50 = "Tomcat 5.0",
242.84 - STR_NAME_TOMCAT55 = "Tomcat 5.5",
242.85 - STR_NAME_TOMCAT60 = "Tomcat 6.0",
242.86 - STR_MENU_ITEM_SERVER_MANAGER = "Tools|Servers",
242.87 - STR_DIALOG_TITLE_SERVER_MANAGER = "Servers",
242.88 - STR_WIZARD_TITLE_ADD_SERVER = "Add Server Instance",
242.89 - STR_BUTTON_TITLE_ADD_SERVER = "Add Server...",
242.90 - STR_BUTTON_TITLE_CLOSE = "Close",
242.91 - STR_BUTTON_TITLE_CHOOSE = "Choose",
242.92 - STR_MENU_ITEM_START = "Start",
242.93 - STR_MENU_ITEM_STOP = "Stop",
242.94 - STR_SERVERS_PATH = "Servers|",
242.95 - STR_SERVER_START = "Starting ",
242.96 - STR_SERVER_STOP = "Stopping ";
242.97 -
242.98 - JTreeOperator tree = null;
242.99 -
242.100 - /**
242.101 - * Creates a new instance of this class
242.102 - * @param parent an object ContainerOperator related to container, which
242.103 - * includes window "Server Explorer".
242.104 - */
242.105 - public ServerExplorerOperator(ContainerOperator parent) {
242.106 - super(parent, "Services");
242.107 - }
242.108 -
242.109 - /**
242.110 - * Creates a new instance of this class
242.111 - */
242.112 - public ServerExplorerOperator() {
242.113 - this(Util.getMainWindow());
242.114 - }
242.115 -
242.116 - /**
242.117 - * Returns a tree, which is contained in the window "Server Explorer".
242.118 - * @return an object JTreeOperator
242.119 - */
242.120 - public JTreeOperator getTree() {
242.121 - if (tree == null) {
242.122 - makeComponentVisible();
242.123 - tree = new JTreeOperator(this);
242.124 - }
242.125 - return (tree);
242.126 - }
242.127 -
242.128 - /**
242.129 - * Selects a tree node according to a required tree path.
242.130 - * @param treePath a path of required tree node
242.131 - */
242.132 - public void selectPath(String treePath) {
242.133 - makeComponentVisible();
242.134 - TestUtils.wait(500);
242.135 - TreePath path = getTree().findPath(treePath);
242.136 - TestUtils.wait(500);
242.137 - tree.selectPath(path);
242.138 - }
242.139 -
242.140 - /**
242.141 - * Clicks an item of popup menu, related to required tree node.
242.142 - * @param treePath a path of required tree node
242.143 - * @param menu a name of menu item
242.144 - */
242.145 - public void pushPopup(String treePath, String menu) {
242.146 - pushPopup(getTree(), treePath, menu);
242.147 - }
242.148 -
242.149 - /**
242.150 - * Clicks an item of popup menu, related to required tree node.
242.151 - * @param tree an object JTreeOperator, related to a tree
242.152 - * @param treePath a path of required tree node
242.153 - * @param menu a name of menu item
242.154 - */
242.155 - public void pushPopup(JTreeOperator tree, String treePath, String menu) {
242.156 - new JPopupMenuOperator(getTree().callPopupOnPath(getTree().findPath(treePath))).pushMenuNoBlock(menu);
242.157 - new QueueTool().waitEmpty();
242.158 - TestUtils.wait(100);
242.159 - }
242.160 -
242.161 - /**
242.162 - * Clicks an item of popup menu, related to required tree node.
242.163 - * @param treePath a string array with path of required tree node
242.164 - * (sequence of node names from the root node to a required node)
242.165 - * @param menu a name of menu item
242.166 - */
242.167 - public void pushPopup(String[] treePath, String menu) {
242.168 - new JPopupMenuOperator(getTree().callPopupOnPath(getTree().findPath(treePath))).pushMenuNoBlock(menu);
242.169 - new QueueTool().waitEmpty();
242.170 - TestUtils.wait(100);
242.171 - }
242.172 -
242.173 - /**
242.174 - * Adds database table on Design View via popup menu, related to its tree node.
242.175 - * @param treePath a path of required tree node
242.176 - */
242.177 - public void addTable(String treePath) {
242.178 - selectPath(treePath);
242.179 - pushPopup(getTree(), treePath, "Add to Form");
242.180 - }
242.181 -
242.182 - /**
242.183 - * Adds database table on Design View via popup menu, related to its tree node.
242.184 - * @param treePath a path of required tree node
242.185 - * @param designer an object DesignerPaneOperator
242.186 - */
242.187 - public void addTable(String treePath, DesignerPaneOperator designer) {
242.188 - addTable(treePath, designer, new Point(1,1));
242.189 - }
242.190 -
242.191 - /**
242.192 - * Adds database table on Design View via popup menu, related to its tree node.
242.193 - * @param treePath a path of required tree node as object TreePath
242.194 - * @param designer an object DesignerPaneOperator
242.195 - */
242.196 - public void addTable(TreePath treePath, DesignerPaneOperator designer) {
242.197 - addTable(treePath, designer, new Point(1,1));
242.198 - }
242.199 -
242.200 - /**
242.201 - * Adds database table on Design View via popup menu, related to its tree node.
242.202 - * @param treePath a path of required tree node
242.203 - * @param designer an object DesignerPaneOperator
242.204 - * @param location a point on Design View for mouse clicking
242.205 - */
242.206 - public void addTable(String treePath, DesignerPaneOperator designer, Point location) {
242.207 - addTable(tree.findPath(treePath), designer, location);
242.208 - }
242.209 -
242.210 - /**
242.211 - * Adds database table on Design View via popup menu, related to its tree node.
242.212 - * @param treePath a path of required tree node as object TreePath
242.213 - * @param designer an object DesignerPaneOperator
242.214 - * @param location a point on Design View for mouse clicking
242.215 - */
242.216 - public void addTable(TreePath treePath, DesignerPaneOperator designer, Point location) {
242.217 - makeComponentVisible();
242.218 - TestUtils.wait(2000);
242.219 - //ServerNavigatorOperator.showNavigatorOperator();
242.220 - TestUtils.wait(500);
242.221 - tree.selectPath(treePath);
242.222 - TestUtils.wait(3000);
242.223 - new DNDDriver().dnd(tree, tree.getPointToClick(treePath), designer, location);
242.224 - TestUtils.wait(3000);
242.225 - }
242.226 -
242.227 - /**
242.228 - * Undeploys a project from an application server.
242.229 - * @param server a name of application server
242.230 - * @param prj a name of project
242.231 - * @param parse boolean parameter: true - only the first 2 chars of the
242.232 - * project name are considered, false - full project name is valuable
242.233 - */
242.234 - public static void undeployProject(String server, String prj, boolean parse) {
242.235 -
242.236 - String serverPath = null;
242.237 -
242.238 - serverPath = "Deployment Server";
242.239 -
242.240 -
242.241 - System.out.println("default is " + serverPath);
242.242 -
242.243 - // Select the Server Navigator and set the JTreeOperator
242.244 - new QueueTool().waitEmpty(100);
242.245 - ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
242.246 - explorer.makeComponentVisible();
242.247 - JTreeOperator tree = explorer.getTree();
242.248 -
242.249 - // Sleep 4 secs to make sure Server Navigator is in focus
242.250 - Util.wait(4000);
242.251 -
242.252 - // Need to refresh J2EE AppServer node
242.253 - explorer.pushPopup(tree, serverPath, "Refresh");
242.254 -
242.255 - // Increase timeout for tree to redisplay after refresh
242.256 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
242.257 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
242.258 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
242.259 -
242.260 - TestUtils.wait(1000);
242.261 - explorer.selectPath(serverPath+"|Deployed Components");
242.262 - explorer.getTree().expandPath(explorer.getTree().findPath(serverPath+"|Deployed Components"));
242.263 - System.out.println("TRACE: Path =" + serverPath+"|Deployed Components");
242.264 - TestUtils.wait(1000);
242.265 -
242.266 - // TODO delete workaround
242.267 - // ************* workaround *************
242.268 - explorer.pushPopup(tree, serverPath, "Refresh");
242.269 - TestUtils.wait(1000);
242.270 - explorer.selectPath(serverPath+"|Deployed Components");
242.271 - explorer.getTree().expandPath(explorer.getTree().findPath(serverPath+"|Deployed Components"));
242.272 - System.out.println("TRACE: Path =" + serverPath+"|Deployed Components");
242.273 - TestUtils.wait(1000);
242.274 - // ************* workaround *************
242.275 -
242.276 - explorer.selectPath(serverPath+"|Deployed Components|/"+prj);
242.277 - System.out.println("TRACE: Path =" + serverPath+"|Deployed Components|/"+prj);
242.278 - TestUtils.wait(1000);
242.279 - System.out.println("TRACE: Push Menu Undeploy...");
242.280 - explorer.pushPopup(explorer.getTree(), serverPath+"|Deployed Components|/"+prj, "Undeploy");
242.281 - }
242.282 -
242.283 - /**
242.284 - * Checks undeployment of a project from an application server.
242.285 - * @param server a name of application server
242.286 - * @param prj a name of project
242.287 - * @param parse boolean parameter: true - only the first 2 chars of the
242.288 - * project name are considered, false - full project name is valuable
242.289 - */
242.290 - public static boolean verifyUndeployment(String server, String prj, boolean parse) {
242.291 -
242.292 - System.out.println("Started!");
242.293 -
242.294 - String serverPath = null;
242.295 - String pePath = "Deployment Server";
242.296 - String deploymentPath = null;
242.297 - String defaultServer = null;
242.298 -
242.299 - serverPath = pePath;
242.300 - serverPath = "Deployment Server";
242.301 -
242.302 -
242.303 - // Select the Server Navigator and set the JTreeOperator
242.304 - new QueueTool().waitEmpty(100);
242.305 - ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
242.306 - explorer.makeComponentVisible();
242.307 - JTreeOperator tree = explorer.getTree();
242.308 -
242.309 -
242.310 - // Need to refresh J2EE AppServer node
242.311 - explorer.pushPopup(tree, serverPath, "Refresh");
242.312 -
242.313 - // Increase timeout for tree to redisplay after refresh
242.314 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
242.315 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
242.316 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
242.317 -
242.318 - // Get treepath of the parent node of Deployed components
242.319 - //recreate operator (just in case - to avoid caching)
242.320 - JTreeOperator oldTree = tree;
242.321 - tree = new JTreeOperator((JTree) tree.getSource());
242.322 - tree.copyEnvironment(oldTree);
242.323 - //do it two times 'cause refresh is delayed.
242.324 - TreePath deployedComps;
242.325 -
242.326 - try {
242.327 - deployedComps = tree.findPath(serverPath + "|Deployed Components");
242.328 - } catch (TimeoutExpiredException e) {
242.329 - deployedComps = tree.findPath(serverPath + "|Deployed Components");
242.330 - }
242.331 -
242.332 - // Expand the SN to the Deployed Components node
242.333 - explorer.getTree().selectPath(deployedComps);
242.334 - explorer.getTree().expandPath(deployedComps);
242.335 -
242.336 - Util.wait(1000);
242.337 - new QueueTool().waitEmpty(100);
242.338 -
242.339 - // Get a TreePath array of the deployed components
242.340 - TreePath[] aDeployedComps = tree.getChildPaths(deployedComps);
242.341 -
242.342 - boolean undeployed = true;
242.343 - // Search for a project matching prj if matches then undeploy
242.344 - for (int i = 0; i < aDeployedComps.length; i++) {
242.345 -
242.346 - // Get the index (position) of the project in the TreePath
242.347 - String prjNode = aDeployedComps[i].getLastPathComponent().toString();
242.348 - if (parse) prjNode = prjNode.substring(0, 3);
242.349 -
242.350 - JemmyProperties.getCurrentOutput().printLine(aDeployedComps[i].toString());
242.351 - JemmyProperties.getCurrentOutput().printLine(aDeployedComps[i].getLastPathComponent().toString());
242.352 -
242.353 - if (prjNode.equals("/" + prj)) {
242.354 - Util.wait(1000);
242.355 - undeployed = false;
242.356 - new QueueTool().waitEmpty(100);
242.357 - }
242.358 - } // end for
242.359 -
242.360 - return undeployed;
242.361 - }
242.362 -
242.363 - /**
242.364 - * Removes a resource from an application server.
242.365 - * @param resource a name of resource (tree node)
242.366 - */
242.367 - public static void deleteResource(String resource) {
242.368 -
242.369 - System.out.println("Started!");
242.370 -
242.371 - String serverPath = null;
242.372 - String pePath = "Deployment Server";
242.373 - TreePath resourcePath = null;
242.374 - String defaultServer = null;
242.375 -
242.376 - serverPath = pePath;
242.377 - serverPath = "Deployment Server";
242.378 -
242.379 -
242.380 - // Select the Server Navigator and set the JTreeOperator
242.381 - new QueueTool().waitEmpty(100);
242.382 - ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
242.383 - explorer.makeComponentVisible();
242.384 - JTreeOperator tree = explorer.getTree();
242.385 -
242.386 -
242.387 - // Need to refresh J2EE AppServer node
242.388 - explorer.pushPopup(tree, serverPath, "Refresh");
242.389 -
242.390 - // Increase timeout for tree to redisplay after refresh
242.391 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
242.392 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
242.393 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
242.394 -
242.395 - // Get treepath of the parent node of Deployed components
242.396 - //recreate operator (just in case - to avoid caching)
242.397 - JTreeOperator oldTree = tree;
242.398 - tree = new JTreeOperator((JTree) tree.getSource());
242.399 - tree.copyEnvironment(oldTree);
242.400 - //do it two times 'cause refresh is delayed.
242.401 -
242.402 -
242.403 - try {
242.404 - explorer.makeComponentVisible();
242.405 - TestUtils.wait(500);
242.406 - resourcePath = tree.findPath(serverPath + "|Resources");
242.407 - } catch (TimeoutExpiredException e) {
242.408 - explorer.makeComponentVisible();
242.409 - TestUtils.wait(500);
242.410 - resourcePath = tree.findPath(serverPath + "|Resources");
242.411 - }
242.412 -
242.413 - TestUtils.wait(500);
242.414 - // Expand the SN to the Deployed Components node
242.415 - explorer.getTree().selectPath(resourcePath);
242.416 - explorer.getTree().expandPath(resourcePath);
242.417 -
242.418 - try {
242.419 - Thread.sleep(1000);
242.420 - } catch (Exception e) {
242.421 - }
242.422 - new QueueTool().waitEmpty(100);
242.423 -
242.424 - // Get a TreePath array of the deployed components
242.425 - TreePath[] aResources = tree.getChildPaths(resourcePath);
242.426 -
242.427 - // Search for a project matching prj if matches then undeploy
242.428 - for (int i = 0; i < aResources.length; i++) {
242.429 - // Get the index (position) of the project in the TreePath
242.430 - String resNode = aResources[i].getLastPathComponent().toString();
242.431 -
242.432 - JemmyProperties.getCurrentOutput().printLine(aResources[i].toString());
242.433 - JemmyProperties.getCurrentOutput().printLine(aResources[i].getLastPathComponent().toString());
242.434 -
242.435 - if (resNode.equals(resource)) {
242.436 - Util.wait(1000);
242.437 - new QueueTool().waitEmpty(100);
242.438 - //Remove resource
242.439 - explorer.pushPopup(tree, serverPath + "|Resources|" + resource, "Delete");
242.440 - new QueueTool().waitEmpty(100);
242.441 - }
242.442 - } // end for
242.443 - }
242.444 -
242.445 - /**
242.446 - * Stops an application server.
242.447 - * @param server a name of an application server (name of tree node)
242.448 - */
242.449 - public static void stopServer(String server) {
242.450 - // Select the Runtime and set the JTreeOperator
242.451 - new QueueTool().waitEmpty(100);
242.452 - ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
242.453 - TestUtils.wait(2000);
242.454 - JTreeOperator tree = explorer.getTree();
242.455 - TestUtils.wait(1000);
242.456 -
242.457 - // Select the requested server node
242.458 - tree.selectPath(tree.findPath(STR_SERVERS_PATH + server));
242.459 - TestUtils.wait(5000);
242.460 - // open context menu on the requested server node
242.461 - new QueueTool().waitEmpty(100);
242.462 - tree.callPopupOnPath(tree.findPath(STR_SERVERS_PATH + server));
242.463 - TestUtils.wait(500);
242.464 - JPopupMenuOperator snpm = new JPopupMenuOperator();
242.465 - TestUtils.wait(1000);
242.466 - if (!(new JMenuItemOperator(snpm, STR_MENU_ITEM_STOP).isEnabled()))
242.467 - tree.pushKey(KeyEvent.VK_ESCAPE);
242.468 - else {
242.469 - JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), 1);
242.470 - new JMenuItemOperator(snpm, STR_MENU_ITEM_STOP).push();
242.471 - while (jlo.getText() == null || !jlo.getText().equals(STR_SERVER_STOP + server)) {
242.472 - jlo = new JLabelOperator(Util.getMainWindow(), 1);
242.473 - System.out.println("label in first cycle = " + jlo.getText());
242.474 - TestUtils.wait(1000);
242.475 - }
242.476 - while (jlo.getText() != null && jlo.getText().equals(STR_SERVER_STOP + server)) {
242.477 - jlo = new JLabelOperator(Util.getMainWindow(), 1);
242.478 - TestUtils.wait(1000);
242.479 - }
242.480 - TestUtils.wait(1000);
242.481 - }
242.482 - new QueueTool().waitEmpty(100);
242.483 - TestUtils.wait(5000);
242.484 - }
242.485 -
242.486 - /**
242.487 - * Checks if an application server is started or not.
242.488 - * @param server a name of an application server (name of tree node)
242.489 - * @return true - server is running, false - otherwise.
242.490 - */
242.491 - public static boolean isServerStarted(String server) throws Exception {
242.492 - String serverPath = null;
242.493 - String pePath = "Deployment Server";
242.494 - String deploymentPath = null;
242.495 -
242.496 - // Select the Server Navigator and set the JTreeOperator
242.497 - new QueueTool().waitEmpty(100);
242.498 - ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
242.499 - explorer.makeComponentVisible();
242.500 - JTreeOperator tree = explorer.getTree();
242.501 -
242.502 - // Sleep 4 secs to make sure Server Navigator is in focus
242.503 - Util.wait(1000);
242.504 -
242.505 - serverPath = pePath;
242.506 -
242.507 - // Select the requested server node
242.508 - TreePath serverNode = tree.findPath(serverPath);
242.509 - explorer.getTree().selectPath(serverNode);
242.510 - explorer.getTree().expandPath(serverNode);
242.511 - TreePath serverSubNode = tree.findPath(serverPath);
242.512 - explorer.getTree().selectPath(serverSubNode);
242.513 -
242.514 - // open context menu on the requested server node
242.515 - new QueueTool().waitEmpty(100);
242.516 -
242.517 - explorer.pushPopup(tree, serverPath,
242.518 - Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.actions.Bundle",
242.519 - "LBL_StartStopServer"));
242.520 - JDialogOperator serverStatusDialog = new JDialogOperator("Server Status");
242.521 - // "Server Status - deployer:Sun:AppServer::localhost:14848");
242.522 - new JCheckBoxOperator(serverStatusDialog,
242.523 - Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.Bundle",
242.524 - "LBL_Close_When_Finished")).changeSelection(true);
242.525 - final JButtonOperator buttonStart = new JButtonOperator(serverStatusDialog,
242.526 - "Start Server");
242.527 - final JButtonOperator buttonStop = new JButtonOperator(serverStatusDialog,
242.528 - "Stop Server");
242.529 -
242.530 - new Waiter(new Waitable() {
242.531 - public Object actionProduced(Object obj) {
242.532 - return (((buttonStart != null && buttonStart.isEnabled()) ||
242.533 - (buttonStop != null && buttonStop.isEnabled())) ? this : null);
242.534 - }
242.535 - public String getDescription() {
242.536 - return "One of Start/Stop buttons to enable";
242.537 - }
242.538 - }).waitAction(null);
242.539 -
242.540 - boolean started = !((buttonStart != null) && (buttonStart.isEnabled()));
242.541 -
242.542 - serverStatusDialog.close();
242.543 - serverStatusDialog.dispose();
242.544 -
242.545 - new QueueTool().waitEmpty(100);
242.546 - return started;
242.547 - }
242.548 -
242.549 - /**
242.550 - * Starts an application server.
242.551 - * @param server a name of an application server (name of tree node)
242.552 - */
242.553 - public static void startServer(String server) throws Exception {
242.554 - // Select the Runtime and set the JTreeOperator
242.555 - new QueueTool().waitEmpty(100);
242.556 - ServerNavigatorOperator explorer = ServerNavigatorOperator.showNavigatorOperator();
242.557 - TestUtils.wait(2000);
242.558 - JTreeOperator tree = explorer.getTree();
242.559 - TestUtils.wait(1000);
242.560 -
242.561 - // Select the requested server node
242.562 - tree.selectPath(tree.findPath(STR_SERVERS_PATH + server));
242.563 - TestUtils.wait(5000);
242.564 - // open context menu on the requested server node
242.565 - new QueueTool().waitEmpty(100);
242.566 - tree.callPopupOnPath(tree.findPath(STR_SERVERS_PATH + server));
242.567 - TestUtils.wait(500);
242.568 - JPopupMenuOperator snpm = new JPopupMenuOperator();
242.569 - TestUtils.wait(1000);
242.570 - if (!(new JMenuItemOperator(snpm, STR_MENU_ITEM_START).isEnabled()))
242.571 - tree.pushKey(KeyEvent.VK_ESCAPE);
242.572 - else {
242.573 - JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), 1);
242.574 - new JMenuItemOperator(snpm, STR_MENU_ITEM_START).push();
242.575 - while (jlo.getText() == null || !jlo.getText().equals(STR_SERVER_START + server)) {
242.576 - jlo = new JLabelOperator(Util.getMainWindow(), 1);
242.577 - System.out.println("label in first cycle = " + jlo.getText());
242.578 - TestUtils.wait(1000);
242.579 - }
242.580 - while (jlo.getText() != null && jlo.getText().equals(STR_SERVER_START + server)) {
242.581 - jlo = new JLabelOperator(Util.getMainWindow(), 1);
242.582 - TestUtils.wait(1000);
242.583 - }
242.584 - TestUtils.wait(1000);
242.585 - }
242.586 - new QueueTool().waitEmpty(100);
242.587 - TestUtils.wait(5000);
242.588 - }
242.589 -
242.590 - /**
242.591 - * Adds a deployment target.
242.592 - * @param DTDescriptor object DeploymentTargetDescriptor, describing
242.593 - * properties of deployment target
242.594 - */
242.595 - public static void addDeploymentTarget(DeploymentTargetDescriptor DTDescriptor) {
242.596 - Hashtable properties = (Hashtable) DTDescriptor.getProperties();
242.597 -
242.598 - String serverType = properties.get(DeploymentTargetDescriptor.SERVER_TYPE_KEY).toString();
242.599 -
242.600 - //log("Open Server manager");
242.601 - ActionNoBlock srv = new ActionNoBlock(STR_MENU_ITEM_SERVER_MANAGER, "", "");
242.602 - srv.performMenu();
242.603 - TestUtils.wait(500);
242.604 -
242.605 - //log("Find Server manager dialog");
242.606 - NbDialogOperator serverManager = new NbDialogOperator(STR_DIALOG_TITLE_SERVER_MANAGER);
242.607 -
242.608 - // Is server in list?
242.609 - // We want to use here public API
242.610 - JTreeOperator jto = new JTreeOperator(serverManager);
242.611 - Object[] treeNodes = jto.getChildren(jto.getRoot());
242.612 - int length = treeNodes.length;
242.613 - String addServerName = properties.get(DeploymentTargetDescriptor.NAME_KEY + serverType).toString();
242.614 - for (int i = 0; i < length; i++) {
242.615 - String currentServerName = treeNodes[i].toString();
242.616 - if (currentServerName.equals(addServerName)) {
242.617 - //log("press close for server manager");
242.618 - JButtonOperator close = new JButtonOperator(serverManager, STR_BUTTON_TITLE_CLOSE);
242.619 - close.pushNoBlock();
242.620 - TestUtils.wait(500);
242.621 - return;
242.622 - }
242.623 - }
242.624 -
242.625 - //log("Press add server button");
242.626 - JButtonOperator addServer = new JButtonOperator(serverManager, STR_BUTTON_TITLE_ADD_SERVER);
242.627 - addServer.pushNoBlock();
242.628 - TestUtils.wait(500);
242.629 -
242.630 - //log("locate server instance wizard");
242.631 - WizardOperator serverInstance = new WizardOperator(STR_WIZARD_TITLE_ADD_SERVER);
242.632 -
242.633 - //log("Chose Server");
242.634 - //JComboBoxOperator cbServerType = new JComboBoxOperator(serverInstance);
242.635 - //cbServerType.selectItem(serverType);
242.636 - JListOperator jlo = new JListOperator(serverInstance, 1);
242.637 - jlo.selectItem(serverType);
242.638 - TestUtils.wait(500);
242.639 -
242.640 - //log("Enter Name");
242.641 - JTextFieldOperator tfName = new JTextFieldOperator(serverInstance);
242.642 - tfName.setText(properties.get(DeploymentTargetDescriptor.NAME_KEY + serverType).toString());
242.643 - TestUtils.wait(500);
242.644 -
242.645 - //log("Go to next wizard page");
242.646 - serverInstance.next();
242.647 - TestUtils.wait(500);
242.648 -
242.649 - //log("Set location");
242.650 - String projectPath = properties.get(DeploymentTargetDescriptor.PATH_KEY + serverType).toString();
242.651 - JTextFieldOperator fileName;
242.652 - if (serverType.equals(STR_NAME_TOMCAT50) || serverType.equals(STR_NAME_TOMCAT55) || serverType.equals(STR_NAME_TOMCAT60))
242.653 - fileName = new JTextFieldOperator(serverInstance, 1);
242.654 - else
242.655 - fileName = new JTextFieldOperator(serverInstance, 0);
242.656 - fileName.setText(projectPath);
242.657 -
242.658 - TestUtils.wait(5000);
242.659 -
242.660 - if (serverType.equals(STR_NAME_WEBLOGIC)) addWebLogic(serverType, properties, serverInstance);
242.661 - if (serverType.equals(STR_NAME_JBOSS)) addJBoss(serverType, properties, serverInstance);
242.662 - if (serverType.equals(STR_NAME_APPSERVER) || serverType.equals(STR_NAME_GLASSFISH_V1) || serverType.equals(STR_NAME_GLASSFISH_V2)) addAppServer(serverType, properties, serverInstance);
242.663 - if (serverType.equals(STR_NAME_TOMCAT50) || serverType.equals(STR_NAME_TOMCAT55) || serverType.equals(STR_NAME_TOMCAT60)) addTomcat(serverType, properties, serverInstance);
242.664 -
242.665 - //log("finish wizard");
242.666 - serverInstance.finish();
242.667 - TestUtils.wait(500);
242.668 -
242.669 - //log("press close for server manager");
242.670 - JButtonOperator close = new JButtonOperator(serverManager, STR_BUTTON_TITLE_CLOSE);
242.671 - close.pushNoBlock();
242.672 - TestUtils.wait(5000);
242.673 - }
242.674 -
242.675 - private static void addWebLogic(String serverType, Hashtable properties, WizardOperator serverInstance) {
242.676 - //workaround
242.677 - serverInstance.pushKey(KeyEvent.VK_LEFT);
242.678 -
242.679 - //log("Go to next wizard page");
242.680 - serverInstance.next();
242.681 - TestUtils.wait(500);
242.682 -
242.683 - //log("Choose Instance");
242.684 - JComboBoxOperator cbInstance = new JComboBoxOperator(serverInstance);
242.685 - cbInstance.selectItem(properties.get(DeploymentTargetDescriptor.DOMAIN_KEY + serverType).toString());
242.686 - TestUtils.wait(500);
242.687 -
242.688 - //log("Enter Login");
242.689 - JTextFieldOperator tfLogin = new JTextFieldOperator(serverInstance, 3);
242.690 - tfLogin.setText(properties.get(DeploymentTargetDescriptor.LOGIN_KEY + serverType).toString());
242.691 - TestUtils.wait(500);
242.692 -
242.693 - //log("Enter Password");
242.694 - JTextFieldOperator tfPassword = new JTextFieldOperator(serverInstance, 4);
242.695 - tfPassword.setText(properties.get(DeploymentTargetDescriptor.PASSWORD_KEY + serverType).toString());
242.696 - TestUtils.wait(500);
242.697 - }
242.698 -
242.699 - private static void addJBoss(String serverType, Hashtable properties, WizardOperator serverInstance) {
242.700 - //log("Go to next wizard page");
242.701 - serverInstance.next();
242.702 - TestUtils.wait(500);
242.703 - //log("Wizard step = " + serverInstance.stepsGetSelectedIndex() + ": " + serverInstance.stepsGetSelectedValue());
242.704 -
242.705 - //log("Choose Instance");
242.706 - JComboBoxOperator cbInstance = new JComboBoxOperator(serverInstance);
242.707 - cbInstance.selectItem(properties.get(DeploymentTargetDescriptor.DOMAIN_KEY + serverType).toString());
242.708 - TestUtils.wait(500);
242.709 - }
242.710 -
242.711 - private static void addAppServer(String serverType, Hashtable properties, WizardOperator serverInstance) {
242.712 - //log("Choose Instance");
242.713 - JComboBoxOperator cbInstance = new JComboBoxOperator(serverInstance);
242.714 -// cbInstance.selectItem(properties.get(PROP_PREFIX_DOMAIN + serverType).toString());
242.715 - TestUtils.wait(500);
242.716 -
242.717 - //log("Go to next wizard page");
242.718 - serverInstance.next();
242.719 - TestUtils.wait(2000);
242.720 -
242.721 - //log("Enter Login");
242.722 - JTextFieldOperator tfLogin = new JTextFieldOperator(serverInstance, 0);
242.723 - tfLogin.setText(properties.get(DeploymentTargetDescriptor.LOGIN_KEY + serverType).toString());
242.724 - TestUtils.wait(500);
242.725 -
242.726 - //log("Enter Password");
242.727 - JTextFieldOperator tfPassword = new JTextFieldOperator(serverInstance, 1);
242.728 - tfPassword.setText(properties.get(DeploymentTargetDescriptor.PASSWORD_KEY + serverType).toString());
242.729 - TestUtils.wait(500);
242.730 - }
242.731 -
242.732 - private static void addTomcat(String serverType, Hashtable properties, WizardOperator serverInstance) {
242.733 - //log("Enter Login");
242.734 - JTextFieldOperator tfLogin = new JTextFieldOperator(serverInstance, 3);
242.735 - tfLogin.setText(properties.get(DeploymentTargetDescriptor.LOGIN_KEY + serverType).toString());
242.736 - TestUtils.wait(500);
242.737 -
242.738 - //log("Enter Password");
242.739 - JTextFieldOperator tfPassword = new JTextFieldOperator(serverInstance, 2);
242.740 - tfPassword.setText(properties.get(DeploymentTargetDescriptor.PASSWORD_KEY + serverType).toString());
242.741 - TestUtils.wait(500);
242.742 - }
242.743 -
242.744 - /**
242.745 - * Adds an URL of Web Service
242.746 - * @param url URL of a Web Service WSDL file
242.747 - * @return name of added Web Service
242.748 - */
242.749 - public String addWebServiceUrl(String url) {
242.750 - new WebServicesNode(this.getTree(), "Web Services").addWebService();
242.751 - AddWebServiceOperator addWs = new AddWebServiceOperator();
242.752 - //if (addWs.isProxySet()) addWs.clearProxy();
242.753 - String wsName = addWs.addWebService(url);
242.754 - addWs.btAdd().pushNoBlock();
242.755 - TestUtils.wait(1000);
242.756 - //new JButtonOperator(new JDialogOperator("Configure web servcie methods"), "OK").doClick();
242.757 - return wsName;
242.758 - }
242.759 -
242.760 - /**
242.761 - * Adds an URL of Web Service
242.762 - * @param url URL of a Web Service WSDL file
242.763 - * @param proxyHost a proxy server host
242.764 - * @param proxyPort a proxy server port
242.765 - * @return name of added Web Service
242.766 - */
242.767 - public String addWebServiceUrl(String url, String proxyHost, String proxyPort) {
242.768 - new WebServicesNode(this.getTree(), "Web Services").addWebService();
242.769 - AddWebServiceOperator addWs = new AddWebServiceOperator();
242.770 - addWs.setProxy(proxyHost, proxyPort);
242.771 - String wsName = addWs.addWebService(url);
242.772 - addWs.btAdd().pushNoBlock();
242.773 - TestUtils.wait(1000);
242.774 - //new JButtonOperator(new JDialogOperator("Configure web servcie methods"), "OK").doClick();
242.775 - return wsName;
242.776 - }
242.777 -
242.778 - /**
242.779 - * Adds a Web Service by using a local file.
242.780 - * @param wsName a local WSDL file
242.781 - * @return name of added Web Service
242.782 - */
242.783 - public String addWebServiceLocal(String wsName) {
242.784 - new WebServicesNode(this.getTree(), "Web Services").addWebService();
242.785 - AddWebServiceOperator addWs = new AddWebServiceOperator();
242.786 - String wsDisplayName = addWs.addLocalWebService(wsName);
242.787 - addWs.btAdd().pushNoBlock();
242.788 - TestUtils.wait(1000);
242.789 - //new JButtonOperator(new JDialogOperator("Configure web servcie methods"), "OK").doClick();
242.790 - return wsDisplayName;
242.791 -
242.792 - }
242.793 -}
243.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/dataconnectivity/ServerNavigatorOperator.java Thu Jul 10 04:29:52 2008 -0700
243.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
243.3 @@ -1,594 +0,0 @@
243.4 -/*
243.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
243.6 - *
243.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
243.8 - *
243.9 - * The contents of this file are subject to the terms of either the GNU
243.10 - * General Public License Version 2 only ("GPL") or the Common
243.11 - * Development and Distribution License("CDDL") (collectively, the
243.12 - * "License"). You may not use this file except in compliance with the
243.13 - * License. You can obtain a copy of the License at
243.14 - * http://www.netbeans.org/cddl-gplv2.html
243.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
243.16 - * specific language governing permissions and limitations under the
243.17 - * License. When distributing the software, include this License Header
243.18 - * Notice in each file and include the License file at
243.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
243.20 - * particular file as subject to the "Classpath" exception as provided
243.21 - * by Sun in the GPL Version 2 section of the License file that
243.22 - * accompanied this code. If applicable, add the following below the
243.23 - * License Header, with the fields enclosed by brackets [] replaced by
243.24 - * your own identifying information:
243.25 - * "Portions Copyrighted [year] [name of copyright owner]"
243.26 - *
243.27 - * Contributor(s):
243.28 - *
243.29 - * The Original Software is NetBeans. The Initial Developer of the Original
243.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
243.31 - * Microsystems, Inc. All Rights Reserved.
243.32 - *
243.33 - * If you wish your version of this file to be governed by only the CDDL
243.34 - * or only the GPL Version 2, indicate your decision by adding
243.35 - * "[Contributor] elects to include this software in this distribution
243.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
243.37 - * single choice of license, a recipient has the option to distribute
243.38 - * your version of this file under either the CDDL, the GPL Version 2 or
243.39 - * to extend the choice of license to its licensees as provided above.
243.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
243.41 - * Version 2 license, then the option applies only if the new code is
243.42 - * made subject to such option by the copyright holder.
243.43 - */
243.44 -
243.45 -package org.netbeans.modules.visualweb.gravy.dataconnectivity;
243.46 -
243.47 -import java.awt.Point;
243.48 -import org.netbeans.jemmy.*;
243.49 -import org.netbeans.jemmy.operators.*;
243.50 -import org.netbeans.jellytools.Bundle;
243.51 -import javax.swing.tree.TreePath;
243.52 -import java.awt.event.KeyEvent;
243.53 -import java.io.File;
243.54 -import java.text.MessageFormat;
243.55 -import org.netbeans.modules.visualweb.gravy.*;
243.56 -import junit.framework.*;
243.57 -
243.58 -/**
243.59 - * This class implements test functionality for the window "Server Navigator".
243.60 - */
243.61 -public class ServerNavigatorOperator extends ServerExplorerOperator {
243.62 - private static final String pointbaseName = "Bundled Database";
243.63 - private static final String[] pbParams = new String[] {"", pointbaseName};
243.64 -
243.65 - JTreeOperator tree = null;
243.66 -
243.67 - /**
243.68 - * Creates a new instance of this class
243.69 - * @param parent an object ContainerOperator related to container, which
243.70 - * includes window "Server Navigator".
243.71 - */
243.72 - public ServerNavigatorOperator(ContainerOperator parent) {
243.73 - super(parent);
243.74 - getTree();
243.75 - }
243.76 -
243.77 - /**
243.78 - * Creates a new instance of this class
243.79 - */
243.80 - public ServerNavigatorOperator() {
243.81 - this(Util.getMainWindow());
243.82 - }
243.83 -
243.84 - /**
243.85 - * Makes the window "Server Navigator" visible.
243.86 - * @return an object ServerNavigatorOperator
243.87 - */
243.88 - public static ServerNavigatorOperator showNavigatorOperator() {
243.89 - // Util.getMainMenu().pushMenuNoBlock("Window|"+Bundle.getStringTrimmed("com.sun.rave.servernav.Bundle", "LBL_ServerNavigator"));
243.90 - Util.getMainMenu().pushMenuNoBlock("Window|Services");
243.91 - Util.wait(1000);
243.92 - new QueueTool().waitEmpty();
243.93 - return (new ServerNavigatorOperator());
243.94 - }
243.95 -
243.96 - /**
243.97 - * Adds database table on Design View via popup menu, related to its tree node.
243.98 - * @param p_path a path of required tree node as an object TreePath
243.99 - */
243.100 - public void addTable(TreePath p_path) {
243.101 - JPopupMenuOperator popup = new JPopupMenuOperator(getTree().callPopupOnPath(p_path));
243.102 - popup.pushMenu(getBundleString("Add_to_Form"));
243.103 - }
243.104 -
243.105 - /**
243.106 - * Adds a data source into window "Server Navigator".
243.107 - * @param p_dsname a name of data source
243.108 - * @param p_ds an object DataSource with properties of data source
243.109 - * @return true if data source was added successfully
243.110 - */
243.111 - public boolean addDataSource(String p_dsname, DataSource p_ds) {
243.112 -
243.113 - pushPopup(getBundleString("Databases"),getBundleString("New connection..."));
243.114 -
243.115 - AddDataSourceOperator a_dlg = new AddDataSourceOperator();
243.116 -
243.117 - JComboBoxOperator a_cbo = a_dlg.cboServerType();
243.118 - System.out.println("DBType=" + p_ds.getDbType());
243.119 -
243.120 - // Following line don't work :( Imitating...
243.121 - System.out.println("DBType now=" + a_cbo.getSelectedItem());
243.122 - if(p_ds.getDbType()!=null && p_ds.getDbType().length()>0){
243.123 - a_cbo.selectItem(p_ds.getDbType());
243.124 - }
243.125 -/* int ind = -1;
243.126 - for (int i = 0; i < a_cbo.getItemCount(); i++) {
243.127 - if ((((JdbcDriverInfo) a_cbo.getItemAt(i)).getDisplayName()).equals(p_ds.getDbType())) {
243.128 - ind = i;
243.129 - }
243.130 - }
243.131 - a_cbo.selectItem(ind);
243.132 - */
243.133 - Util.wait(1000);
243.134 -/*
243.135 - a_dlg.txtDSName().clearText();
243.136 - a_dlg.txtDSName().typeText(p_dsname);
243.137 - Util.wait(500);
243.138 -
243.139 - if (a_dlg.txtHostName().isEditable()) {
243.140 - a_dlg.txtHostName().clearText();
243.141 - a_dlg.txtHostName().typeText(p_ds.getDbHost());
243.142 - }
243.143 - Util.wait(500);
243.144 -
243.145 - if (a_dlg.txtDBName().isEditable()) {
243.146 - a_dlg.txtDBName().clearText();
243.147 - a_dlg.txtDBName().typeText(p_ds.getDbName());
243.148 - }
243.149 - Util.wait(500);
243.150 - */
243.151 - System.out.println("DB URL=" + p_ds.getDbUrl());
243.152 - if(p_ds.getDbUrl()!=null && p_ds.getDbUrl().length()>0){
243.153 - a_dlg.cboURL().clearText();
243.154 - a_dlg.cboURL().typeText(p_ds.getDbUrl());
243.155 - }
243.156 - Util.wait(500);
243.157 -
243.158 - a_dlg.txtUser().clearText();
243.159 - a_dlg.txtUser().typeText(p_ds.getUser());
243.160 - Util.wait(500);
243.161 -
243.162 - a_dlg.txtPassword().clearText();
243.163 - a_dlg.txtPassword().typeText(p_ds.getPassword());
243.164 - Util.wait(500);
243.165 -/*
243.166 - if (p_ds.getValidationTable()!=null){
243.167 - a_dlg.txtValidationTable().clearText();
243.168 - a_dlg.txtValidationTable().typeText(p_ds.getValidationTable());
243.169 - }else try {
243.170 - //select first table of schema as validation table
243.171 - a_dlg.btSelectTable().push();
243.172 - JDialogOperator selectDlg=new JDialogOperator();
243.173 - new JListOperator(selectDlg).selectItem(0);
243.174 - new JButtonOperator(selectDlg,0).push();
243.175 - }catch (org.netbeans.jemmy.TimeoutExpiredException e){
243.176 - // exception appears if connection isn't successful at all
243.177 - }
243.178 - Util.wait(1000);
243.179 -
243.180 - //a_dlg.txtURL().clearText();
243.181 - //a_dlg.txtURL().typeText(p_ds.getDbUrl());
243.182 -
243.183 - new QueueTool().waitEmpty();
243.184 -
243.185 - // Test connection
243.186 -
243.187 - a_dlg.btTestConnection().push();
243.188 - JDialogOperator a_dlg1 = new JDialogOperator(a_dlg);
243.189 - Util.wait(1000);
243.190 -
243.191 - boolean success = !(new JTextFieldOperator(a_dlg1).getText().equals("Failed") ||
243.192 - new JTextFieldOperator(a_dlg1,1).getText().equals("Failed")
243.193 - );
243.194 - */
243.195 - new JButtonOperator(a_dlg, getBundleString("OK")).push();
243.196 -
243.197 - // Add data source, if connection is OK
243.198 -
243.199 - Util.wait(10000);
243.200 - if (p_ds.getDbType().equalsIgnoreCase("mysql")) {
243.201 - new JButtonOperator(a_dlg, getBundleString("OK")).push();
243.202 - }
243.203 - return true;
243.204 - }
243.205 -
243.206 - /**
243.207 - * Opens connection with a data source.
243.208 - * @param p_dsname a name of data source
243.209 - * @param p_ds an object DataSource with properties of data source
243.210 - */
243.211 - public void connectToDataSource(String p_dsname, DataSource p_ds){
243.212 -
243.213 -
243.214 - String[] a_ss = {getBundleString("Databases"), p_dsname};
243.215 - pushPopup(a_ss,getBundleString("Connect..."));
243.216 - Util.wait(1000);
243.217 -
243.218 - JDialogOperator a_dlg = new JDialogOperator();
243.219 - Util.wait(1000);
243.220 -
243.221 - JTextFieldOperator tfUser = new JTextFieldOperator(a_dlg, 0);
243.222 - tfUser.clearText();
243.223 - tfUser.typeText(p_ds.getUser());
243.224 - Util.wait(500);
243.225 -
243.226 - JTextFieldOperator tfPassword = new JTextFieldOperator(a_dlg, 1);
243.227 - tfPassword.clearText();
243.228 - tfPassword.typeText(p_ds.getPassword());
243.229 - Util.wait(500);
243.230 -
243.231 - JCheckBoxOperator chkRemember = new JCheckBoxOperator(a_dlg);
243.232 - chkRemember.setSelected(true);
243.233 -
243.234 - new JButtonOperator(a_dlg, getBundleString("OK")).pushNoBlock();
243.235 -
243.236 - // Add data source, if connection is OK
243.237 -
243.238 - Util.wait(2000);
243.239 - try {
243.240 - new org.netbeans.jellytools.TopComponentOperator("Output").close();
243.241 - }catch(Exception e) {
243.242 - e.printStackTrace();
243.243 - }
243.244 - //new JButtonOperator(a_dlg, getBundleString("OK")).pushNoBlock();
243.245 -
243.246 - }
243.247 -
243.248 - /**
243.249 - * Changes parameters of a data source.
243.250 - * @param p_dsname a name of data source
243.251 - * @param p_ds an object DataSource with properties of data source
243.252 - * @return true if data source was modified successfully
243.253 - */
243.254 - public boolean modifyDataSource(String p_dsname, DataSource p_ds) {
243.255 -
243.256 - String[] a_ss = {getBundleString("Databases"), p_dsname};
243.257 - pushPopup(a_ss,getBundleString("MODIFY_DATASOURCE"));
243.258 -
243.259 - ModifyDataSourceOperator a_dlg = new ModifyDataSourceOperator();
243.260 -
243.261 - JTextFieldOperator a_tfo = a_dlg.txtDSName();
243.262 - a_tfo.clearText();
243.263 - a_tfo.typeText(p_dsname);
243.264 - Util.wait(500);
243.265 -
243.266 - a_tfo = a_dlg.txtUser();
243.267 - a_tfo.clearText();
243.268 - a_tfo.typeText(p_ds.getUser());
243.269 - Util.wait(500);
243.270 -
243.271 - a_tfo = a_dlg.txtPassword();
243.272 - a_tfo.clearText();
243.273 - a_tfo.typeText(p_ds.getPassword());
243.274 - Util.wait(500);
243.275 -
243.276 - a_tfo = a_dlg.txtURL();
243.277 - a_tfo.clearText();
243.278 - a_tfo.typeText(p_ds.getDbUrl());
243.279 - Util.wait(2000);
243.280 -
243.281 - //a_tf=(JTextField)a_dlg.waitSubComponent(new TextFieldChooser(6));
243.282 - //a_tf.setText(p_ds.getDbUrl());
243.283 -
243.284 - new QueueTool().waitEmpty();
243.285 -
243.286 - // Test connection
243.287 -
243.288 - a_dlg.btTestConnection().push();
243.289 - JDialogOperator a_dlg1 = new JDialogOperator(a_dlg, 0);
243.290 -
243.291 - boolean success = a_dlg1.getTitle().equals("Information");
243.292 - new JButtonOperator(a_dlg1, getBundleString("OK")).push();
243.293 -
243.294 - // Modify data source, if connection is OK
243.295 -
243.296 - new JButtonOperator(a_dlg, getBundleString(success ? "MODIFY" : "CANCEL")).push();
243.297 -
243.298 - return success;
243.299 - }
243.300 -
243.301 - /**
243.302 - * Removes a data source.
243.303 - * @param p_dsname a name of data source
243.304 - * @return true if data source was removed successfully
243.305 - */
243.306 - public boolean removeDataSource(String p_dsname) {
243.307 -
243.308 - String[] a_ss = {getBundleString("Databases"), p_dsname};
243.309 -
243.310 - pushPopup(a_ss,getBundleString("REMOVE_CONNECTION"));
243.311 -
243.312 - Util.wait(1000);
243.313 -
243.314 - return true;
243.315 - }
243.316 -
243.317 - /**
243.318 - * Adds new type of DB server into Server Navigator.
243.319 - * @param p_typeName a name of server type
243.320 - * @param p_template not used
243.321 - * @param p_iniDrivers drivers, needed for this DB server
243.322 - */
243.323 - public void addNewServerType(String p_typeName, String p_template, String p_iniDrivers) {
243.324 - addNewServerType(p_typeName, p_template, p_iniDrivers, "");
243.325 - }
243.326 -
243.327 - /**
243.328 - * Adds new type of DB server into Server Navigator.
243.329 - * @param p_typeName a name of server type
243.330 - * @param p_template not used
243.331 - * @param p_iniDrivers drivers, needed for this DB server
243.332 - * @param p_addDrivers additional drivers, which should be added
243.333 - */
243.334 - public void addNewServerType(String p_typeName, String p_template, String p_iniDrivers, String p_addDrivers) {
243.335 -
243.336 - pushPopup(new String[]{getBundleString("Databases"),getBundleString("Drivers")}, getBundleString("New driver..."));
243.337 -
243.338 - EditServerTypesOperator a_dlg = new EditServerTypesOperator();
243.339 - Util.wait(1000);
243.340 -
243.341 - a_dlg.btNew().pushNoBlock();
243.342 - JDialogOperator a_dlg1 = new JDialogOperator(getBundleString("Select Driver"));
243.343 -
243.344 - if (System.getProperty("os.name").equals("Mac OS X")) {
243.345 - String[] splittedPath = p_iniDrivers.substring(1, p_iniDrivers.length()).split(File.separator);
243.346 - TestUtils.wait(1000);
243.347 - JComboBoxOperator cbRoot = new JComboBoxOperator(a_dlg1);
243.348 - for (int i = 0; i < cbRoot.getItemCount(); i++)
243.349 - if (cbRoot.getItemAt(i).toString().equals(File.separator)) {
243.350 - cbRoot.setSelectedIndex(i);
243.351 - break;
243.352 - }
243.353 - String toCompare = "";
243.354 - for (int i = 0; i < splittedPath.length; i++) {
243.355 - JTableOperator jtoPath = new JTableOperator(a_dlg1);
243.356 - toCompare += "/" + splittedPath[i];
243.357 - System.out.println("toComapre="+toCompare);
243.358 - Point cell = jtoPath.findCell(toCompare, new Operator.DefaultStringComparator(true, true), 0);
243.359 - TestUtils.wait(1000);
243.360 - jtoPath.clickOnCell((int) cell.getY(), (int) cell.getX(),2);
243.361 - TestUtils.wait(1000);
243.362 - }
243.363 - } else {
243.364 -
243.365 - JTextFieldOperator a_tf1 = new JTextFieldOperator(a_dlg1);
243.366 - a_tf1.typeText(p_iniDrivers);
243.367 - Util.wait(500);
243.368 - new JButtonOperator(a_dlg1, "Open").push();
243.369 - Util.wait(1000);
243.370 - }
243.371 -/*Case when more then one file commented
243.372 - if (!(p_addDrivers == null) && !(p_addDrivers.equals(""))) {
243.373 -
243.374 - new JButtonOperator(a_dlg, getBundleString("Add...")).pushNoBlock();
243.375 - a_dlg1 = new JDialogOperator(getBundleString("Select driver"));
243.376 -
243.377 - a_tf1 = new JTextFieldOperator(a_dlg1);
243.378 - a_tf1.typeText(p_addDrivers);
243.379 -
243.380 - new JButtonOperator(a_dlg1, "Open").push();
243.381 - Util.wait(1000);
243.382 - }
243.383 -
243.384 - a_tf1 = a_dlg.txtName();
243.385 - a_tf1.clearText();
243.386 - a_tf1.typeText(p_typeName);
243.387 - Util.wait(1000);
243.388 - */
243.389 -/*
243.390 - a_tf1 = a_dlg.txtTemplate();
243.391 - a_tf1.clearText();
243.392 - a_tf1.typeText(p_template);
243.393 - Util.wait(1000);
243.394 -
243.395 -
243.396 - // try to close window without choosing driver class. Error message should appear
243.397 - a_dlg.btOK().push();
243.398 - a_dlg1 = new JDialogOperator("Information");
243.399 - Util.wait(1000);
243.400 - new JButtonOperator(a_dlg1, getBundleString("OK")).push();
243.401 - */
243.402 - // choose driver class and close window
243.403 - //a_dlg.btFind().push();
243.404 - //a_dlg.cboDriver().setSelectedIndex(0);
243.405 -
243.406 - Util.wait(1000);
243.407 - a_dlg.btOK().push();
243.408 -
243.409 - }
243.410 -
243.411 - /**
243.412 - * Deletes a type of DB server from Server Navigator.
243.413 - * @param p_typeName a name of server type
243.414 - */
243.415 - public void deleteServerType(String p_typeName) {
243.416 -
243.417 - pushPopup(getBundleString("Databases"), getBundleString("CONFIGURE_JDBC_DRIVER"));
243.418 -
243.419 - EditServerTypesOperator a_dlg = new EditServerTypesOperator();
243.420 - Util.wait(1000);
243.421 -
243.422 - a_dlg.lstServerTypes().setSelectedValue(p_typeName, true);
243.423 - a_dlg.btRemove().pushNoBlock();
243.424 -
243.425 - // JDialogOperator a_dlg1=new JDialogOperator("Question");
243.426 - // a_dlg1.pressKey(KeyEvent.VK_ENTER);
243.427 -
243.428 - Util.wait(1000);
243.429 -
243.430 - a_dlg.closeByButton();
243.431 - }
243.432 -
243.433 - /**
243.434 - * Opens a window "View Data" for some database table/view.
243.435 - * @param p_path a path of required tree node
243.436 - */
243.437 - public void viewData(String p_path) {
243.438 - pushPopup(p_path, getBundleString("VIEW_DATA"));
243.439 - }
243.440 -
243.441 - /**
243.442 - * Opens a window "View Data" for some database table/view.
243.443 - * @param p_path a string array with path of required tree node
243.444 - * (sequence of node names from the root node to a required node)
243.445 - */
243.446 - public void viewData(String[] p_path) {
243.447 - pushPopup(p_path, getBundleString("VIEW_DATA"));
243.448 - }
243.449 -
243.450 - // public void viewData(TreePath p_path) {
243.451 - //
243.452 - // JPopupMenuOperator popup = new JPopupMenuOperator(tree.callPopupOnPath(p_path));
243.453 - // popup.pushMenu(getBundleString("VIEW_DATA"));
243.454 - // }
243.455 -
243.456 - /**
243.457 - * Closes an opened window "View Data".
243.458 - */
243.459 - public void closeDataView() {
243.460 - Util.closeWindow();
243.461 - }
243.462 -
243.463 - /**
243.464 - * Opens a window "View Data" for a schema of some database table/view.
243.465 - * @param p_ds a name of required data source
243.466 - * @param p_schema not used
243.467 - */
243.468 - public void showSchema(String p_ds, String[] p_schema) {
243.469 - pushPopup(getBundleString("Databases") + "/" + p_ds, getBundleString("VIEW_DATA"));
243.470 - }
243.471 -
243.472 - /**
243.473 - * Finds in a bundle file and returns an actual text of control component.
243.474 - * @param p_text string-key corresponding to required control component.
243.475 - * @return actual text of control component
243.476 - */
243.477 - public static String getBundleString(String p_text) {
243.478 - System.out.println("Getting bundle for " + p_text);
243.479 -/* try {
243.480 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.actions.Bundle", p_text);
243.481 - } catch (JemmyException e) {}
243.482 - try {
243.483 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.ui.Bundle", p_text);
243.484 - } catch (JemmyException e) {}
243.485 - return null;
243.486 - */
243.487 -
243.488 - // stub
243.489 - return p_text;
243.490 - }
243.491 -
243.492 - /**
243.493 - * Checks, whether built-in database server PointBase is running or not.
243.494 - * @return true - DB server ir running, false - otherwise
243.495 - */
243.496 - public static boolean isPBRunning() {
243.497 - boolean result = true;
243.498 - JPopupMenuOperator pointbasePopupMenu = getTreeNodePopupMenu(
243.499 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
243.500 - "Bundled_DB_ServerNav_NodeName", pbParams));
243.501 - if (pointbasePopupMenu != null) {
243.502 - result = !(TestUtils.findPopupMenuItemByLabel(pointbasePopupMenu,
243.503 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
243.504 - "Bundled_DB_Start", pbParams)).isEnabled());
243.505 - } else {
243.506 - Assert.fail("Popup menu for bundled server not found");
243.507 - }
243.508 - pointbasePopupMenu.pressKey(KeyEvent.VK_ESCAPE);
243.509 - new QueueTool().waitEmpty();
243.510 - Util.wait(500);
243.511 - return result;
243.512 - }
243.513 -
243.514 - /**
243.515 - * Shuts a built-in database server PointBase down.
243.516 - */
243.517 - public static void stopPB(){
243.518 - JPopupMenuOperator pointbasePopupMenu = getTreeNodePopupMenu(
243.519 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
243.520 - "Bundled_DB_ServerNav_NodeName", pbParams));
243.521 - if (pointbasePopupMenu != null) {
243.522 - pointbasePopupMenu.pushMenuNoBlock(
243.523 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
243.524 - "Bundled_DB_Stop", pbParams));
243.525 - new QueueTool().waitEmpty();
243.526 - Util.wait(2000);
243.527 - System.out.println("Pointbase Database Server has been stopped.");
243.528 - }
243.529 - new QueueTool().waitEmpty();
243.530 - Util.wait(1000);
243.531 - }
243.532 -
243.533 - /**
243.534 - * Launches a built-in database server PointBase.
243.535 - */
243.536 - public static void startPB(){
243.537 - JPopupMenuOperator pointbasePopupMenu = getTreeNodePopupMenu(
243.538 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
243.539 - "Bundled_DB_ServerNav_NodeName", pbParams));
243.540 - if (pointbasePopupMenu != null) {
243.541 - pointbasePopupMenu.pushMenuNoBlock(
243.542 - Bundle.getStringTrimmed("org.netbeans.modules.visualweb.dataconnectivity.explorer.ideDb.Bundle",
243.543 - "Bundled_DB_Start", pbParams));
243.544 - new QueueTool().waitEmpty();
243.545 - Util.wait(2000);
243.546 - System.out.println("Pointbase Database Server has started.");
243.547 - }
243.548 - new QueueTool().waitEmpty();
243.549 - Util.wait(1000);
243.550 - }
243.551 -
243.552 - private static JTreeOperator selectTreeNode(String nodeName) {
243.553 - try {
243.554 - // select the Server Navigator and set the JTreeOperator
243.555 - QueueTool queueTool = new QueueTool();
243.556 - queueTool.waitEmpty(100);
243.557 - ServerNavigatorOperator serverExplorer = showNavigatorOperator();
243.558 - serverExplorer.makeComponentVisible();
243.559 -
243.560 - JTreeOperator tree = serverExplorer.getTree();
243.561 -
243.562 - // Increase timeout for tree to redisplay after refresh
243.563 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeExpandedTimeout", 60000);
243.564 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
243.565 - tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout", 60000);
243.566 -
243.567 - TreePath serverNode = tree.findPath(nodeName);
243.568 - serverExplorer.getTree().selectPath(serverNode);
243.569 - queueTool.waitEmpty(100);
243.570 -
243.571 - return tree;
243.572 - } catch (Exception e) {
243.573 - e.printStackTrace();
243.574 - return null;
243.575 - }
243.576 - }
243.577 -
243.578 - private static JPopupMenuOperator getTreeNodePopupMenu(String nodeName) {
243.579 - try {
243.580 - QueueTool queueTool = new QueueTool();
243.581 - JTreeOperator tree = selectTreeNode(nodeName);
243.582 -
243.583 - TreePath serverNode = tree.findPath(nodeName);
243.584 - queueTool.waitEmpty(100);
243.585 -
243.586 - JPopupMenuOperator popupMenu = new JPopupMenuOperator(
243.587 - tree.callPopupOnPath(serverNode));
243.588 - queueTool.waitEmpty(100);
243.589 - Util.wait(100);
243.590 -
243.591 - return popupMenu;
243.592 - } catch (Exception e) {
243.593 - e.printStackTrace();
243.594 - return null;
243.595 - }
243.596 - }
243.597 -}
244.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/BuildOutputOperator.java Thu Jul 10 04:29:52 2008 -0700
244.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
244.3 @@ -1,117 +0,0 @@
244.4 -/*
244.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
244.6 - *
244.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
244.8 - *
244.9 - * The contents of this file are subject to the terms of either the GNU
244.10 - * General Public License Version 2 only ("GPL") or the Common
244.11 - * Development and Distribution License("CDDL") (collectively, the
244.12 - * "License"). You may not use this file except in compliance with the
244.13 - * License. You can obtain a copy of the License at
244.14 - * http://www.netbeans.org/cddl-gplv2.html
244.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
244.16 - * specific language governing permissions and limitations under the
244.17 - * License. When distributing the software, include this License Header
244.18 - * Notice in each file and include the License file at
244.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
244.20 - * particular file as subject to the "Classpath" exception as provided
244.21 - * by Sun in the GPL Version 2 section of the License file that
244.22 - * accompanied this code. If applicable, add the following below the
244.23 - * License Header, with the fields enclosed by brackets [] replaced by
244.24 - * your own identifying information:
244.25 - * "Portions Copyrighted [year] [name of copyright owner]"
244.26 - *
244.27 - * Contributor(s):
244.28 - *
244.29 - * The Original Software is NetBeans. The Initial Developer of the Original
244.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
244.31 - * Microsystems, Inc. All Rights Reserved.
244.32 - *
244.33 - * If you wish your version of this file to be governed by only the CDDL
244.34 - * or only the GPL Version 2, indicate your decision by adding
244.35 - * "[Contributor] elects to include this software in this distribution
244.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
244.37 - * single choice of license, a recipient has the option to distribute
244.38 - * your version of this file under either the CDDL, the GPL Version 2 or
244.39 - * to extend the choice of license to its licensees as provided above.
244.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
244.41 - * Version 2 license, then the option applies only if the new code is
244.42 - * made subject to such option by the copyright holder.
244.43 - */
244.44 -
244.45 -package org.netbeans.modules.visualweb.gravy.debugger;
244.46 -
244.47 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
244.48 -import org.netbeans.modules.visualweb.gravy.Util;
244.49 -
244.50 -import java.awt.Component;
244.51 -
244.52 -import javax.swing.JDesktopPane;
244.53 -
244.54 -import org.netbeans.jemmy.ComponentChooser;
244.55 -import org.netbeans.jemmy.JemmyException;
244.56 -import org.netbeans.jemmy.operators.JTextComponentOperator;
244.57 -import org.netbeans.jemmy.operators.JComponentOperator;
244.58 -import org.netbeans.jemmy.operators.JTextPaneOperator;
244.59 -import org.netbeans.jemmy.operators.Operator;
244.60 -import org.netbeans.jemmy.operators.ContainerOperator;
244.61 -
244.62 -/**
244.63 - * BuildOutputOperator class
244.64 - */
244.65 -public class BuildOutputOperator extends TopComponentOperator{
244.66 - JTextComponentOperator textComponent = null;
244.67 - TermOperator termOper = null;
244.68 -
244.69 - public BuildOutputOperator(ContainerOperator parent) {
244.70 - super(parent, new BuildOutputChooser("Build Output Window"));
244.71 - }
244.72 -
244.73 - public BuildOutputOperator() {
244.74 - this(Util.getMainWindow());
244.75 - }
244.76 -
244.77 - /** Show build output window.
244.78 - */
244.79 - public static BuildOutputOperator show() {
244.80 - return(new BuildOutputOperator(Util.getMainWindow()));
244.81 - }
244.82 -
244.83 - /** Return text area of the build output window.
244.84 - */
244.85 - public JTextComponentOperator getTextComponent() {
244.86 - if(textComponent == null) {
244.87 - textComponent = new JTextComponentOperator(this);
244.88 - }
244.89 - return(textComponent);
244.90 - }
244.91 -
244.92 - /** Get text from build output.
244.93 - */
244.94 - public String getTextOutput(){
244.95 - if(termOper == null) {
244.96 - termOper = new TermOperator(this);
244.97 - }
244.98 - return termOper.getText();
244.99 - }
244.100 -
244.101 - public static class BuildOutputChooser implements ComponentChooser {
244.102 - String ID;
244.103 - private Operator.StringComparator comparator;
244.104 - public BuildOutputChooser(String ID) {
244.105 - this(ID, new Operator.DefaultStringComparator(false, false));
244.106 - }
244.107 - public BuildOutputChooser(String ID, Operator.StringComparator comparator){
244.108 - this.ID = ID;
244.109 - this.comparator = comparator;
244.110 - }
244.111 - public boolean checkComponent(Component comp) {
244.112 - if(comp !=null && ((Component)comp).getName()!=null)
244.113 - return(comp instanceof Component && ((Component)comp).getName().startsWith(ID) );
244.114 - else return false;
244.115 - }
244.116 - public String getDescription() {
244.117 - return("A Component with \"" + ID + "\" ID");
244.118 - }
244.119 - }
244.120 -}
245.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/DebuggerConsoleOperator.java Thu Jul 10 04:29:52 2008 -0700
245.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
245.3 @@ -1,107 +0,0 @@
245.4 -/*
245.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
245.6 - *
245.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
245.8 - *
245.9 - * The contents of this file are subject to the terms of either the GNU
245.10 - * General Public License Version 2 only ("GPL") or the Common
245.11 - * Development and Distribution License("CDDL") (collectively, the
245.12 - * "License"). You may not use this file except in compliance with the
245.13 - * License. You can obtain a copy of the License at
245.14 - * http://www.netbeans.org/cddl-gplv2.html
245.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
245.16 - * specific language governing permissions and limitations under the
245.17 - * License. When distributing the software, include this License Header
245.18 - * Notice in each file and include the License file at
245.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
245.20 - * particular file as subject to the "Classpath" exception as provided
245.21 - * by Sun in the GPL Version 2 section of the License file that
245.22 - * accompanied this code. If applicable, add the following below the
245.23 - * License Header, with the fields enclosed by brackets [] replaced by
245.24 - * your own identifying information:
245.25 - * "Portions Copyrighted [year] [name of copyright owner]"
245.26 - *
245.27 - * Contributor(s):
245.28 - *
245.29 - * The Original Software is NetBeans. The Initial Developer of the Original
245.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
245.31 - * Microsystems, Inc. All Rights Reserved.
245.32 - *
245.33 - * If you wish your version of this file to be governed by only the CDDL
245.34 - * or only the GPL Version 2, indicate your decision by adding
245.35 - * "[Contributor] elects to include this software in this distribution
245.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
245.37 - * single choice of license, a recipient has the option to distribute
245.38 - * your version of this file under either the CDDL, the GPL Version 2 or
245.39 - * to extend the choice of license to its licensees as provided above.
245.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
245.41 - * Version 2 license, then the option applies only if the new code is
245.42 - * made subject to such option by the copyright holder.
245.43 - */
245.44 -
245.45 -package org.netbeans.modules.visualweb.gravy.debugger;
245.46 -
245.47 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
245.48 -import org.netbeans.modules.visualweb.gravy.Util;
245.49 -
245.50 -import java.awt.Component;
245.51 -
245.52 -import javax.swing.JDesktopPane;
245.53 -
245.54 -import org.netbeans.jemmy.ComponentChooser;
245.55 -import org.netbeans.jemmy.JemmyException;
245.56 -import org.netbeans.jemmy.operators.JTextComponentOperator;
245.57 -import org.netbeans.jemmy.operators.JTextPaneOperator;
245.58 -import org.netbeans.jemmy.operators.ContainerOperator;
245.59 -import org.netbeans.jemmy.operators.Operator;
245.60 -
245.61 -/**
245.62 - * DebuggerConsoleOperator class
245.63 - */
245.64 -public class DebuggerConsoleOperator extends TopComponentOperator{
245.65 - TermOperator termOper = null;
245.66 -
245.67 - public DebuggerConsoleOperator(ContainerOperator parent) {
245.68 - super(parent, new DebuggerConsoleChooser("Debugger Console"));
245.69 - }
245.70 -
245.71 - public DebuggerConsoleOperator() {
245.72 - this(Util.getMainWindow());
245.73 - }
245.74 -
245.75 - /** Show debugger console window.
245.76 - */
245.77 - public static DebuggerConsoleOperator show() {
245.78 - return(new DebuggerConsoleOperator(Util.getMainWindow()));
245.79 - }
245.80 -
245.81 - /** Get text from debugger console.
245.82 - */
245.83 - public String getTextOutput(){
245.84 - if(termOper == null) {
245.85 - termOper = new TermOperator(this);
245.86 - }
245.87 - return termOper.getText();
245.88 - }
245.89 -
245.90 - public static class DebuggerConsoleChooser implements ComponentChooser {
245.91 - String ID;
245.92 - private Operator.StringComparator comparator;
245.93 - public DebuggerConsoleChooser(String ID) {
245.94 - this(ID, new Operator.DefaultStringComparator(false, false));
245.95 - }
245.96 - public DebuggerConsoleChooser(String ID, Operator.StringComparator comparator){
245.97 - this.ID = ID;
245.98 - this.comparator = comparator;
245.99 - }
245.100 - public boolean checkComponent(Component comp) {
245.101 - if(comp !=null && ((Component)comp).getName()!=null)
245.102 - return(comp instanceof Component && ((Component)comp).getName().startsWith(ID) );
245.103 - else return false;
245.104 - }
245.105 - public String getDescription() {
245.106 - return("A Component with \"" + ID + "\" ID");
245.107 - }
245.108 - }
245.109 -
245.110 -}
246.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/DebuggerWindowOperator.java Thu Jul 10 04:29:52 2008 -0700
246.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
246.3 @@ -1,486 +0,0 @@
246.4 -/*
246.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
246.6 - *
246.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
246.8 - *
246.9 - * The contents of this file are subject to the terms of either the GNU
246.10 - * General Public License Version 2 only ("GPL") or the Common
246.11 - * Development and Distribution License("CDDL") (collectively, the
246.12 - * "License"). You may not use this file except in compliance with the
246.13 - * License. You can obtain a copy of the License at
246.14 - * http://www.netbeans.org/cddl-gplv2.html
246.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
246.16 - * specific language governing permissions and limitations under the
246.17 - * License. When distributing the software, include this License Header
246.18 - * Notice in each file and include the License file at
246.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
246.20 - * particular file as subject to the "Classpath" exception as provided
246.21 - * by Sun in the GPL Version 2 section of the License file that
246.22 - * accompanied this code. If applicable, add the following below the
246.23 - * License Header, with the fields enclosed by brackets [] replaced by
246.24 - * your own identifying information:
246.25 - * "Portions Copyrighted [year] [name of copyright owner]"
246.26 - *
246.27 - * Contributor(s):
246.28 - *
246.29 - * The Original Software is NetBeans. The Initial Developer of the Original
246.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
246.31 - * Microsystems, Inc. All Rights Reserved.
246.32 - *
246.33 - * If you wish your version of this file to be governed by only the CDDL
246.34 - * or only the GPL Version 2, indicate your decision by adding
246.35 - * "[Contributor] elects to include this software in this distribution
246.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
246.37 - * single choice of license, a recipient has the option to distribute
246.38 - * your version of this file under either the CDDL, the GPL Version 2 or
246.39 - * to extend the choice of license to its licensees as provided above.
246.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
246.41 - * Version 2 license, then the option applies only if the new code is
246.42 - * made subject to such option by the copyright holder.
246.43 - */
246.44 -
246.45 -package org.netbeans.modules.visualweb.gravy.debugger;
246.46 -
246.47 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
246.48 -import org.netbeans.modules.visualweb.gravy.Util;
246.49 -
246.50 -import java.awt.Component;
246.51 -
246.52 -import javax.swing.JDesktopPane;
246.53 -
246.54 -import org.netbeans.jemmy.ComponentChooser;
246.55 -import org.netbeans.jemmy.JemmyException;
246.56 -
246.57 -import org.netbeans.jemmy.operators.ComponentOperator;
246.58 -import org.netbeans.jemmy.operators.ContainerOperator;
246.59 -import org.netbeans.jemmy.operators.JButtonOperator;
246.60 -import org.netbeans.jemmy.operators.JDialogOperator;
246.61 -import org.netbeans.jemmy.operators.JInternalFrameOperator;
246.62 -import org.netbeans.jemmy.operators.JListOperator;
246.63 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
246.64 -import org.netbeans.jemmy.operators.JTableOperator;
246.65 -import org.netbeans.jemmy.operators.JToggleButtonOperator;
246.66 -import org.netbeans.jemmy.operators.JTextComponentOperator;
246.67 -import org.netbeans.jemmy.operators.Operator;
246.68 -
246.69 -/**
246.70 - * DebuggerWindowOperator class
246.71 - */
246.72 -public class DebuggerWindowOperator extends TopComponentOperator{
246.73 - ComponentOperator desktop = null;
246.74 - JTextComponentOperator query = null;
246.75 -
246.76 - private JToggleButtonOperator _tbSessions;
246.77 - private JToggleButtonOperator _tbThreads;
246.78 - private JToggleButtonOperator _tbCallStack;
246.79 - private JToggleButtonOperator _tbLocalVariables;
246.80 - private JToggleButtonOperator _tbAllInOne;
246.81 - private JToggleButtonOperator _tbWatches;
246.82 - private JToggleButtonOperator _tbClasses;
246.83 - private JToggleButtonOperator _tbBreakpoints;
246.84 - private JToggleButtonOperator _tbProperties;
246.85 - private JToggleButtonOperator _tbPublic;
246.86 - private JToggleButtonOperator _tbProtected;
246.87 - private JToggleButtonOperator _tbPrivate;
246.88 - private JToggleButtonOperator _tbPackagePrivate;
246.89 - private JToggleButtonOperator _tbStatic;
246.90 - private JToggleButtonOperator _tbInherited;
246.91 -
246.92 - private JTableOperator _tabTreeTable;
246.93 -
246.94 - private String [] views = {"Sessions", "Threads", "CallStack", "LocalVariables", "AllInOne", "Watches", "Classes", "Breakpoints", "Properties"};
246.95 -
246.96 - public DebuggerWindowOperator(ContainerOperator parent) {
246.97 - super(parent, new DebuggerWindowChooser("Debugger"));
246.98 - }
246.99 -
246.100 - public DebuggerWindowOperator() {
246.101 - this(Util.getMainWindow());
246.102 - }
246.103 -
246.104 - /** Show debugger window
246.105 - */
246.106 - public DebuggerWindowOperator show() {
246.107 - this.setComparator(new Operator.DefaultStringComparator(false, true));
246.108 - Util.getMainTab().setSelectedIndex(Util.getMainTab().findPage("Debugger"));
246.109 - return(new DebuggerWindowOperator(Util.getMainWindow()));
246.110 - }
246.111 -
246.112 -
246.113 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.114 - * @return JToggleButtonOperator
246.115 - */
246.116 - public JToggleButtonOperator tbSessions() {
246.117 - _tbSessions = new JToggleButtonOperator(this, "", 0);
246.118 - return _tbSessions;
246.119 - }
246.120 -
246.121 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.122 - * @return JToggleButtonOperator
246.123 - */
246.124 - public JToggleButtonOperator tbThreads() {
246.125 - _tbThreads = new JToggleButtonOperator(this, "", 1);
246.126 - return _tbThreads;
246.127 - }
246.128 -
246.129 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.130 - * @return JToggleButtonOperator
246.131 - */
246.132 - public JToggleButtonOperator tbCallStack() {
246.133 - _tbCallStack = new JToggleButtonOperator(this, "", 2);
246.134 - return _tbCallStack;
246.135 - }
246.136 -
246.137 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.138 - * @return JToggleButtonOperator
246.139 - */
246.140 - public JToggleButtonOperator tbLocalVariables() {
246.141 - _tbLocalVariables = new JToggleButtonOperator(this, "", 3);
246.142 - return _tbLocalVariables;
246.143 - }
246.144 -
246.145 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.146 - * @return JToggleButtonOperator
246.147 - */
246.148 - public JToggleButtonOperator tbAllInOne() {
246.149 - _tbAllInOne = new JToggleButtonOperator(this, "", 4);
246.150 - return _tbAllInOne;
246.151 - }
246.152 -
246.153 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.154 - * @return JToggleButtonOperator
246.155 - */
246.156 - public JToggleButtonOperator tbWatches() {
246.157 - _tbWatches = new JToggleButtonOperator(this, "", 5);
246.158 - return _tbWatches;
246.159 - }
246.160 -
246.161 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.162 - * @return JToggleButtonOperator
246.163 - */
246.164 - public JToggleButtonOperator tbClasses() {
246.165 - _tbClasses = new JToggleButtonOperator(this, "", 6);
246.166 - return _tbClasses;
246.167 - }
246.168 -
246.169 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.170 - * @return JToggleButtonOperator
246.171 - */
246.172 - public JToggleButtonOperator tbBreakpoints() {
246.173 - _tbBreakpoints = new JToggleButtonOperator(this, "", 7);
246.174 - return _tbBreakpoints;
246.175 - }
246.176 -
246.177 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.178 - * @return JToggleButtonOperator
246.179 - */
246.180 - public JToggleButtonOperator tbProperties() {
246.181 - _tbProperties = new JToggleButtonOperator(this, "", 8);
246.182 - return _tbProperties;
246.183 - }
246.184 -
246.185 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.186 - * @return JToggleButtonOperator
246.187 - */
246.188 - public JToggleButtonOperator tbPublic() {
246.189 - _tbPublic = new JToggleButtonOperator(this, "", 9);
246.190 - return _tbPublic;
246.191 - }
246.192 -
246.193 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.194 - * @return JToggleButtonOperator
246.195 - */
246.196 - public JToggleButtonOperator tbProtected() {
246.197 - _tbProtected = new JToggleButtonOperator(this, "", 10);
246.198 - return _tbProtected;
246.199 - }
246.200 -
246.201 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.202 - * @return JToggleButtonOperator
246.203 - */
246.204 - public JToggleButtonOperator tbPrivate() {
246.205 - _tbPrivate = new JToggleButtonOperator(this, "", 11);
246.206 - return _tbPrivate;
246.207 - }
246.208 -
246.209 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.210 - * @return JToggleButtonOperator
246.211 - */
246.212 - public JToggleButtonOperator tbPackagePrivate() {
246.213 - _tbPackagePrivate = new JToggleButtonOperator(this, "", 12);
246.214 - return _tbPackagePrivate;
246.215 - }
246.216 -
246.217 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.218 - * @return JToggleButtonOperator
246.219 - */
246.220 - public JToggleButtonOperator tbStatic() {
246.221 - _tbStatic = new JToggleButtonOperator(this, "", 13);
246.222 - return _tbStatic;
246.223 - }
246.224 -
246.225 - /** Tries to find "" ToolbarToggleButton in this dialog.
246.226 - * @return JToggleButtonOperator
246.227 - */
246.228 - public JToggleButtonOperator tbInherited() {
246.229 - _tbInherited = new JToggleButtonOperator(this, "", 14);
246.230 - return _tbInherited;
246.231 - }
246.232 -
246.233 -
246.234 - /** checks or unchecks given ToolbarToggleButton
246.235 - * @param state boolean requested state
246.236 - */
246.237 - public void checkBreakpoints(boolean state) {
246.238 - if (tbBreakpoints().isSelected()!=state) {
246.239 - tbBreakpoints().push();
246.240 - }
246.241 - }
246.242 -
246.243 - /** Get state of the given ToolbarToggleButton
246.244 - */
246.245 - public boolean getBreakpointsState() {
246.246 - return tbBreakpoints().isSelected();
246.247 - }
246.248 -
246.249 -
246.250 - /** checks or unchecks given ToolbarToggleButton
246.251 - * @param state boolean requested state
246.252 - */
246.253 - public void checkSessions(boolean state) {
246.254 - if (tbSessions().isSelected()!=state) {
246.255 - tbSessions().push();
246.256 - }
246.257 - }
246.258 -
246.259 - /** Get state of the given ToolbarToggleButton
246.260 - */
246.261 - public boolean getSessionsState() {
246.262 - return tbSessions().isSelected();
246.263 - }
246.264 -
246.265 - /** checks or unchecks given ToolbarToggleButton
246.266 - * @param state boolean requested state
246.267 - */
246.268 - public void checkThreads(boolean state) {
246.269 - if (tbThreads().isSelected()!=state) {
246.270 - tbThreads().push();
246.271 - }
246.272 - }
246.273 -
246.274 - /** Get state of the given ToolbarToggleButton
246.275 - */
246.276 - public boolean getThreadsState() {
246.277 - return tbThreads().isSelected();
246.278 - }
246.279 -
246.280 - /** checks or unchecks given ToolbarToggleButton
246.281 - * @param state boolean requested state
246.282 - */
246.283 - public void checkCallStack(boolean state) {
246.284 - if (tbCallStack().isSelected()!=state) {
246.285 - tbCallStack().push();
246.286 - }
246.287 - }
246.288 -
246.289 - /** Get state of the given ToolbarToggleButton
246.290 - */
246.291 - public boolean getCallStackState() {
246.292 - return tbCallStack().isSelected();
246.293 - }
246.294 -
246.295 - /** checks or unchecks given ToolbarToggleButton
246.296 - * @param state boolean requested state
246.297 - */
246.298 - public void checkLocalVariables(boolean state) {
246.299 - if (tbLocalVariables().isSelected()!=state) {
246.300 - tbLocalVariables().push();
246.301 - }
246.302 - }
246.303 -
246.304 - /** Get state of the given ToolbarToggleButton
246.305 - */
246.306 - public boolean getLocalVariablesState() {
246.307 - return tbLocalVariables().isSelected();
246.308 - }
246.309 -
246.310 - /** checks or unchecks given ToolbarToggleButton
246.311 - * @param state boolean requested state
246.312 - */
246.313 - public void checkAllInOne(boolean state) {
246.314 - if (tbAllInOne().isSelected()!=state) {
246.315 - tbAllInOne().push();
246.316 - }
246.317 - }
246.318 -
246.319 - /** Get state of the given ToolbarToggleButton
246.320 - */
246.321 - public boolean getAllInOneState() {
246.322 - return tbAllInOne().isSelected();
246.323 - }
246.324 -
246.325 - /** checks or unchecks given ToolbarToggleButton
246.326 - * @param state boolean requested state
246.327 - */
246.328 - public void checkWatches(boolean state) {
246.329 - if (tbWatches().isSelected()!=state) {
246.330 - tbWatches().push();
246.331 - }
246.332 - }
246.333 -
246.334 - /** Get state of the given ToolbarToggleButton
246.335 - */
246.336 - public boolean getWatchesState() {
246.337 - return tbWatches().isSelected();
246.338 - }
246.339 -
246.340 - /** checks or unchecks given ToolbarToggleButton
246.341 - * @param state boolean requested state
246.342 - */
246.343 - public void checkClasses(boolean state) {
246.344 - if (tbClasses().isSelected()!=state) {
246.345 - tbClasses().push();
246.346 - }
246.347 - }
246.348 -
246.349 - /** Get state of the given ToolbarToggleButton
246.350 - */
246.351 - public boolean getClassesState() {
246.352 - return tbClasses().isSelected();
246.353 - }
246.354 -
246.355 - /** checks or unchecks given ToolbarToggleButton
246.356 - * @param state boolean requested state
246.357 - */
246.358 - public void checkProperties(boolean state) {
246.359 - if (tbProperties().isSelected()!=state) {
246.360 - tbProperties().push();
246.361 - }
246.362 - }
246.363 -
246.364 - /** Get state of the given ToolbarToggleButton
246.365 - */
246.366 - public boolean getPropertiesState() {
246.367 - return tbProperties().isSelected();
246.368 - }
246.369 -
246.370 -
246.371 - /** Tries to find null TreeTable in this dialog.
246.372 - * @return JTableOperator
246.373 - */
246.374 - public JTableOperator getJTableOperator(String view) {
246.375 - int viewNumber = -1;
246.376 - int displayedViews = -1;
246.377 - do {
246.378 - viewNumber++;
246.379 - switch (viewNumber) {
246.380 - case 0: {
246.381 - if (views[viewNumber].equals(view)) {
246.382 - checkSessions(true);
246.383 - displayedViews++;
246.384 - } else if (getSessionsState()) {
246.385 - displayedViews++;
246.386 - }
246.387 - break;
246.388 - }
246.389 - case 1: {
246.390 - if (views[viewNumber].equals(view)) {
246.391 - checkThreads(true);
246.392 - displayedViews++;
246.393 - } else if (getThreadsState()) {
246.394 - displayedViews++;
246.395 - }
246.396 - break;
246.397 - }
246.398 - case 2: {
246.399 - if (views[viewNumber].equals(view)) {
246.400 - checkCallStack(true);
246.401 - displayedViews++;
246.402 - } else if (getCallStackState()) {
246.403 - displayedViews++;
246.404 - }
246.405 - break;
246.406 - }
246.407 - case 3: {
246.408 - if (views[viewNumber].equals(view)) {
246.409 - checkLocalVariables(true);
246.410 - displayedViews++;
246.411 - } else if (getLocalVariablesState()) {
246.412 - displayedViews++;
246.413 - }
246.414 - break;
246.415 - }
246.416 - case 4: {
246.417 - if (views[viewNumber].equals(view)) {
246.418 - checkAllInOne(true);
246.419 - displayedViews++;
246.420 - } else if (getAllInOneState()) {
246.421 - displayedViews++;
246.422 - }
246.423 - break;
246.424 - }
246.425 - case 5: {
246.426 - if (views[viewNumber].equals(view)) {
246.427 - checkWatches(true);
246.428 - displayedViews++;
246.429 - } else if (getWatchesState()) {
246.430 - displayedViews++;
246.431 - }
246.432 - break;
246.433 - }
246.434 - case 6: {
246.435 - if (views[viewNumber].equals(view)) {
246.436 - checkClasses(true);
246.437 - displayedViews++;
246.438 - } else if (getClassesState()) {
246.439 - displayedViews++;
246.440 - }
246.441 - break;
246.442 - }
246.443 - case 7: {
246.444 - if (views[viewNumber].equals(view)) {
246.445 - checkBreakpoints(true);
246.446 - displayedViews++;
246.447 - } else if (getBreakpointsState()) {
246.448 - displayedViews++;
246.449 - }
246.450 - break;
246.451 - }
246.452 - case 8: {
246.453 - if (views[viewNumber].equals(view)) {
246.454 - checkProperties(true);
246.455 - displayedViews++;
246.456 - } else if (getPropertiesState()) {
246.457 - displayedViews++;
246.458 - }
246.459 - break;
246.460 - }
246.461 - }
246.462 -
246.463 - } while (!views[viewNumber].equals(view));
246.464 - _tabTreeTable = new JTableOperator(this, displayedViews);
246.465 - return _tabTreeTable;
246.466 - }
246.467 -
246.468 - public static class DebuggerWindowChooser implements ComponentChooser {
246.469 - String ID;
246.470 - private Operator.StringComparator comparator;
246.471 - public DebuggerWindowChooser(String ID) {
246.472 - this(ID, new Operator.DefaultStringComparator(false, false));
246.473 - }
246.474 - public DebuggerWindowChooser(String ID, Operator.StringComparator comparator){
246.475 - this.ID = ID;
246.476 - this.comparator = comparator;
246.477 - }
246.478 - public boolean checkComponent(Component comp) {
246.479 - if(comp !=null && ((Component)comp).getName()!=null)
246.480 - return(comp instanceof Component && ((Component)comp).getName().equals(ID) );
246.481 - else return false;
246.482 - }
246.483 - public String getDescription() {
246.484 - return("A Component with \"" + ID + "\" ID");
246.485 - }
246.486 - }
246.487 -
246.488 -
246.489 -}
247.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/TermOperator.java Thu Jul 10 04:29:52 2008 -0700
247.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
247.3 @@ -1,559 +0,0 @@
247.4 -/*
247.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
247.6 - *
247.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
247.8 - *
247.9 - * The contents of this file are subject to the terms of either the GNU
247.10 - * General Public License Version 2 only ("GPL") or the Common
247.11 - * Development and Distribution License("CDDL") (collectively, the
247.12 - * "License"). You may not use this file except in compliance with the
247.13 - * License. You can obtain a copy of the License at
247.14 - * http://www.netbeans.org/cddl-gplv2.html
247.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
247.16 - * specific language governing permissions and limitations under the
247.17 - * License. When distributing the software, include this License Header
247.18 - * Notice in each file and include the License file at
247.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
247.20 - * particular file as subject to the "Classpath" exception as provided
247.21 - * by Sun in the GPL Version 2 section of the License file that
247.22 - * accompanied this code. If applicable, add the following below the
247.23 - * License Header, with the fields enclosed by brackets [] replaced by
247.24 - * your own identifying information:
247.25 - * "Portions Copyrighted [year] [name of copyright owner]"
247.26 - *
247.27 - * Contributor(s):
247.28 - *
247.29 - * The Original Software is NetBeans. The Initial Developer of the Original
247.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
247.31 - * Microsystems, Inc. All Rights Reserved.
247.32 - *
247.33 - * If you wish your version of this file to be governed by only the CDDL
247.34 - * or only the GPL Version 2, indicate your decision by adding
247.35 - * "[Contributor] elects to include this software in this distribution
247.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
247.37 - * single choice of license, a recipient has the option to distribute
247.38 - * your version of this file under either the CDDL, the GPL Version 2 or
247.39 - * to extend the choice of license to its licensees as provided above.
247.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
247.41 - * Version 2 license, then the option applies only if the new code is
247.42 - * made subject to such option by the copyright holder.
247.43 - */
247.44 -
247.45 -//The class is invalid: terminalemulator was replaced by core/output2
247.46 -//so, removing all the meet from it
247.47 -package org.netbeans.modules.visualweb.gravy.debugger;
247.48 -
247.49 -import java.awt.Component;
247.50 -import java.awt.Container;
247.51 -import java.awt.event.InputEvent;
247.52 -import java.awt.event.KeyEvent;
247.53 -import javax.swing.JComponent;
247.54 -import javax.swing.JTabbedPane;
247.55 -import org.netbeans.jellytools.actions.*;
247.56 -
247.57 -import org.netbeans.jemmy.ComponentChooser;
247.58 -import org.netbeans.jemmy.operators.ComponentOperator;
247.59 -import org.netbeans.jemmy.operators.ContainerOperator;
247.60 -import org.netbeans.jemmy.operators.JTabbedPaneOperator;
247.61 -import org.netbeans.jemmy.operators.Operator;
247.62 -
247.63 -/** Operator for Output pane containing one (normal output)
247.64 - * or more (for example JavaDoc output) output terminals
247.65 - * (org.netbeans.lib.terminalemulator.Term component).
247.66 - * <p>
247.67 - * Usage:<br>
247.68 - * <pre>
247.69 - * // find term with given name
247.70 - * TermOperator to = new TermOperator("MyClass - I/O");
247.71 - * // wait for a message appears in output
247.72 - * to.waitText("my message");
247.73 - * // get the text
247.74 - * String wholeOutput = to.getText();
247.75 - * to.clearOutput();
247.76 - * to.waitText("your message");
247.77 - * // close this output either way
247.78 - * to.close(); // or to.discard();
247.79 - * </pre>
247.80 - *
247.81 - */
247.82 -public class TermOperator extends ComponentOperator {
247.83 -
247.84 - // only first 5 Terms and 5 Screens are to be cached
247.85 - ComponentOperator[] _screen=new ComponentOperator[5];
247.86 - JComponent[] _term=new JComponent[5];
247.87 -
247.88 - // Actions used only in TermOperator.
247.89 - private static final Action findNextAction =
247.90 - new Action(null,
247.91 - "Find Next");//,
247.92 - //null,
247.93 - //new Shortcut(KeyEvent.VK_F3));
247.94 -
247.95 - private static final Action selectAllAction =
247.96 - new Action(null,
247.97 - "Select All");//,
247.98 - //null,
247.99 - //new Shortcut(KeyEvent.VK_A, InputEvent.CTRL_MASK));
247.100 -
247.101 - private static final Action clearAction =
247.102 - new Action(null,
247.103 - "Clear Output");
247.104 -
247.105 - private static final Action startRedirectionAction =
247.106 - new Action(null,
247.107 - "Start Redirection of This View to File");
247.108 -
247.109 - private static final Action stopRedirectionAction =
247.110 - new Action(null,
247.111 - "Stop Redirection of This View to File");
247.112 -
247.113 - private static final CopyAction copyAction = new CopyAction();
247.114 - private static final FindAction findAction = new FindAction();
247.115 -
247.116 -
247.117 - /** Create new instance of TermOperator from given component.
247.118 - * @param source TopComponent instance with Term
247.119 - */
247.120 - public TermOperator(JComponent source) {
247.121 - // used in OutputOperator
247.122 - super(source);
247.123 - }
247.124 -
247.125 - /** Waits for output term with given name.
247.126 - * It is activated by defalt.
247.127 - * @param name name of output term to look for
247.128 - *
247.129 - public TermOperator(String name) {
247.130 - this(name, 0);
247.131 - }
247.132 -
247.133 - /** Waits for index-th output term with given name.
247.134 - * It is activated by defalt.
247.135 - * @param name name of output term to look for
247.136 - * @param index index of requested output term with given name
247.137 - */
247.138 -
247.139 - /*public TermOperator(String name, int index) {
247.140 - super(new OutputOperator().waitSubComponent(new InnerTabSubchooser(name), index));
247.141 - makeComponentVisible();
247.142 - }*/
247.143 -
247.144 - /** Waits for output term with given name in specified container.
247.145 - * It is activated by defalt.
247.146 - * @param contOper container where to search
247.147 - * @param name name of output term to look for
247.148 - * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
247.149 - * because term can only be placed inside Output top component
247.150 - */
247.151 - public TermOperator(ContainerOperator contOper, String name) {
247.152 - this(contOper, name, 0);
247.153 - }
247.154 -
247.155 - /** Creates TermOperator instance
247.156 - * @param contOper container where to search
247.157 - * @param index int index of requested output term with given name
247.158 - * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
247.159 - * because term can only be placed inside Output top component
247.160 - */
247.161 - public TermOperator(ContainerOperator contOper, int index) {
247.162 - this(contOper, null, index);
247.163 - }
247.164 -
247.165 - /** Creates TermOperator instance
247.166 - * @param contOper container where to search
247.167 - * @param name String name of output term to look for
247.168 - * @param index int index of requested output term with given name
247.169 - * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
247.170 - * because term can only be placed inside Output top component
247.171 - */
247.172 - public TermOperator(ContainerOperator contOper, String name, int index) {
247.173 - super(contOper.waitSubComponent(new InnerTabSubchooser(name), index));
247.174 - makeComponentVisible();
247.175 - copyEnvironment(contOper);
247.176 - }
247.177 -
247.178 - /** Creates TermOperator instance
247.179 - * @param contOper container where to search
247.180 - * @deprecated Use {@link #TermOperator(String)} or {@link #TermOperator(String, int)}
247.181 - * because term can only be placed inside Output top component
247.182 - */
247.183 - public TermOperator(ContainerOperator contOper) {
247.184 - super(contOper);
247.185 - }
247.186 -
247.187 - /** Activates this term. If this term is in tabbed pane, it is selected. If
247.188 - * it is only term in the Output top component, the Output top component
247.189 - * is activated.
247.190 - */
247.191 - /*public void makeComponentVisible() {
247.192 - if(getParent() instanceof JTabbedPane) {
247.193 - super.makeComponentVisible();
247.194 - // Term is a tab of JTabbedPane
247.195 - new JTabbedPaneOperator((JTabbedPane)getParent()).setSelectedComponent(getSource());
247.196 - } else {
247.197 - // term is sub component of Output top component
247.198 - new OutputOperator().makeComponentVisible();
247.199 - }
247.200 - }*/
247.201 -
247.202 - /** Getter for Term object
247.203 - * @return instance of Term
247.204 - */
247.205 - public JComponent getTermSource() {
247.206 - return getTermSource(0);
247.207 - }
247.208 -
247.209 - /** Getter for Term object
247.210 - * @return instance of Term
247.211 - * @param termIndex index of Term inside (usualy 0, Javadoc Output has two Terms: 0 and 1).
247.212 - */
247.213 - public JComponent getTermSource(int termIndex) {
247.214 - if (termIndex>=_term.length)
247.215 - return (JComponent)ComponentOperator.waitComponent((Container)getSource(), new TermFinder(), termIndex);
247.216 - if (_term[termIndex]==null) {
247.217 - _term[termIndex]=(JComponent)ComponentOperator.waitComponent((Container)getSource(), new TermFinder(), termIndex);
247.218 - }
247.219 - return _term[termIndex];
247.220 - }
247.221 -
247.222 - /** Finds a row by text in the first Term.
247.223 - * @param rowText String row text
247.224 - * @return row number of specified text; -1 if text not found
247.225 - */
247.226 - public int findRow(String rowText) {
247.227 - return findRow(rowText, 0);
247.228 - }
247.229 -
247.230 - /** Finds a row by text.
247.231 - * @param rowText String row text
247.232 - * @param termIndex int Term index
247.233 - * @return row number of specified text; -1 if text not found
247.234 - */
247.235 - public int findRow(String rowText, int termIndex) {
247.236 - for(int i = 0; i < getLineCount(termIndex); i++) {
247.237 - if(getComparator().equals(getRowText(i, termIndex), rowText)) {
247.238 - return i;
247.239 - }
247.240 - }
247.241 - return -1;
247.242 - }
247.243 -
247.244 - /** Invokes <code>flush</code> and returns text from the first Term.
247.245 - * @return text from the first Term.
247.246 - */
247.247 - public String getText() {
247.248 - return getText(0);
247.249 - }
247.250 -
247.251 - /** Invokes <code>flush</code> and returns text.
247.252 - * @param termIndex int Term index
247.253 - * @return text from termIndex-th Term
247.254 - */
247.255 - public String getText(int termIndex) {
247.256 - flush(termIndex);
247.257 - return getText(0, getLineCount(termIndex) - 1, termIndex);
247.258 - }
247.259 -
247.260 - /** Get text between <code>startRow</code> and <code>endRow</code> from the first Term
247.261 - * @param startRow first row to be included
247.262 - * @param endRow last row to be included
247.263 - * @return text between <code>startRow</code> and <code>endRow</code> from the first Term
247.264 - */
247.265 - public String getText(int startRow, int endRow) {
247.266 - return getText(startRow, endRow);
247.267 - }
247.268 -
247.269 - /** Get text between <code>startRow</code> and <code>endRow</code>
247.270 - * @param startRow first row to be included
247.271 - * @param endRow last row to be included
247.272 - * @param termIndex int Term index
247.273 - * @return text between <code>startRow</code> and <code>endRow</code>
247.274 - */
247.275 - public String getText(int startRow, int endRow, int termIndex) {
247.276 - flush(termIndex);
247.277 - String result = "";
247.278 - for(int i = startRow; i < endRow; i++) {
247.279 - result = result + getRowText(i, termIndex) + "\n";
247.280 - }
247.281 - return(result);
247.282 - }
247.283 -
247.284 - /** Waits for text to be displayed in output term.
247.285 - * @param text text to wait for
247.286 - */
247.287 - public void waitText(String text) {
247.288 - waitText(text, 0);
247.289 - }
247.290 -
247.291 - /** Waits for text to be displayed in termIndex-th term.
247.292 - * @param text text to wait for
247.293 - * @param termIndex Term index
247.294 - */
247.295 - public void waitText(final String text, final int termIndex) {
247.296 - getOutput().printLine("Wait \"" + text + "\" text in component \n : "+
247.297 - getTermSource(termIndex).toString());
247.298 - getOutput().printGolden("Wait \"" + text + "\" text");
247.299 - waitState(new ComponentChooser() {
247.300 - public boolean checkComponent(Component comp) {
247.301 - return(findRow(text, termIndex) > -1);
247.302 - }
247.303 - public String getDescription() {
247.304 - return("\"" + text + "\" text");
247.305 - }
247.306 - });
247.307 - }
247.308 -
247.309 - /** Returns count of filled lines of the first Term.
247.310 - * @return count of filled lines of the first Term.
247.311 - */
247.312 - public int getLineCount() {
247.313 - return getLineCount(0);
247.314 - }
247.315 -
247.316 - /** Returns count of filled lines.
247.317 - * @param termIndex int Term index
247.318 - * @return count of filled lines.
247.319 - */
247.320 - public int getLineCount(int termIndex) {
247.321 - flush(termIndex);
247.322 - return(getCursorRow(termIndex) + 1);
247.323 - }
247.324 -
247.325 - /** Returns the topmost component lying on the first Term.
247.326 - * All events should be dispatched to this component.
247.327 - * @return the topmost component lying on the first Term.
247.328 - */
247.329 - public ComponentOperator screen() {
247.330 - return screen(0);
247.331 - }
247.332 -
247.333 - /** Returns the topmost component lying on the term.
247.334 - * All events should be dispatched to this component.
247.335 - * @param termIndex int Term index
247.336 - * @return the topmost component lying on the termIndex-throws Term.
247.337 - */
247.338 - public ComponentOperator screen(int termIndex) {
247.339 - ComponentOperator sc;
247.340 - if (termIndex>=_screen.length || _screen[termIndex] == null) {
247.341 - sc = ComponentOperator.createOperator(ComponentOperator.waitComponent(getTermSource(termIndex), new ScreenFinder()));
247.342 - sc.copyEnvironment(this);
247.343 - if (termIndex<_screen.length)
247.344 - _screen[termIndex] = sc;
247.345 - return sc;
247.346 - }
247.347 - return _screen[termIndex];
247.348 - }
247.349 -
247.350 - ////////////////////////////////////////////////////////
247.351 - //Mapping //
247.352 - /** Returns text from specified row.
247.353 - * Maps <code>Term.getRowText(int)</code> through queue for the first Term.
247.354 - * @param row row number to get text from
247.355 - * @return text from the specified row
247.356 - */
247.357 - public String getRowText(int row) {
247.358 - return getRowText(row, 0);
247.359 - }
247.360 -
247.361 - /** Returns text from specified row of termIndex-th term.
247.362 - * Maps <code>Term.getRowText(int)</code> through queue
247.363 - * @param row row number to get text from
247.364 - * @param termIndex int Term index
247.365 - * @return text from the specified row
247.366 - */
247.367 - public String getRowText(final int row, final int termIndex) {
247.368 - return((String)runMapping(new MapAction("getRowText") {
247.369 - public Object map() {
247.370 - return(null);
247.371 - //return(((Term)getTermSource(termIndex)).getRowText(row));
247.372 - }}));}
247.373 -
247.374 - /** Returns text within given coordinates.
247.375 - * Maps <code>Term.textWithin(...)</code> through queue for the first Term.
247.376 - * @param beginRow starting row
247.377 - * @param beginCol starting column
247.378 - * @param endRow ending row
247.379 - * @param endCol ending column
247.380 - * @return text within begin and end coordinates
247.381 - */
247.382 - public String textWithin(int beginRow, int beginCol, int endRow, int endCol) {
247.383 - return textWithin(beginRow, beginCol, endRow, endCol, 0);
247.384 - }
247.385 -
247.386 - /** Returns text within given coordinates of termIndex-th term.
247.387 - * Maps <code>Term.textWithin(...)</code> through queue
247.388 - * @param beginRow starting row
247.389 - * @param beginCol starting column
247.390 - * @param endRow ending row
247.391 - * @param endCol ending column
247.392 - * @param termIndex int Term index
247.393 - * @return text within begin and end coordinates
247.394 - */
247.395 - public String textWithin(int beginRow, int beginCol, int endRow, int endCol, final int termIndex) {
247.396 - //final Coord begin = Coord.make(beginRow, beginCol);
247.397 - //final Coord end = Coord.make(endRow, endCol);
247.398 - final Object begin=null;
247.399 - final Object end=null;
247.400 - return((String)runMapping(new MapAction("textWithin") {
247.401 - public Object map() {
247.402 - return(null);
247.403 - //return(((Term)getTermSource(termIndex)).textWithin(begin, end));
247.404 - }}));}
247.405 -
247.406 - /* commented to avoid confusing.
247.407 - public int getRows() {
247.408 - return(runMapping(new MapIntegerAction("getRows") {
247.409 - public int map() {
247.410 - return(((Term)getTerm()).getRows());
247.411 - }}));}
247.412 - */
247.413 -
247.414 - /** Returns row where the cursor stands.
247.415 - * Maps <code>Term.getCursorRow()</code> through queue for the first Term
247.416 - * @return int cursor row
247.417 - */
247.418 - public int getCursorRow() {
247.419 - return getCursorRow(0);
247.420 - }
247.421 -
247.422 - /** Returns row where the cursor stands.
247.423 - * Maps <code>Term.getCursorRow()</code> through queue
247.424 - * @param termIndex int Term index
247.425 - * @return int cursor row
247.426 - */
247.427 - public int getCursorRow(final int termIndex) {
247.428 - return(runMapping(new MapIntegerAction("getCursorRow") {
247.429 - public int map() {
247.430 - return(0);
247.431 - //return(((Term)getTermSource(termIndex)).getCursorRow());
247.432 - }}));}
247.433 -
247.434 - /** Flushes buffer.
247.435 - * Maps <code>Term.flush()</code> through queue for the first Term */
247.436 - public void flush() {
247.437 - flush(0);
247.438 - }
247.439 -
247.440 - /** Flushes buffer.
247.441 - * Maps <code>Term.flush()</code> through queue
247.442 - * @param termIndex int Term index
247.443 - */
247.444 - public void flush(final int termIndex) {
247.445 - runMapping(new MapVoidAction("flush") {
247.446 - public void map() {
247.447 - //((Term)getTermSource(termIndex)).flush();
247.448 - }});}
247.449 -
247.450 - //End of mapping //
247.451 - ////////////////////////////////////////////////////////
247.452 -
247.453 - static class ScreenFinder implements ComponentChooser {
247.454 - public boolean checkComponent(Component comp) {
247.455 - Class cls = comp.getClass();
247.456 - do {
247.457 - if(cls.getName().equals("org.netbeans.lib.terminalemulator.Screen")) {
247.458 - return(true);
247.459 - }
247.460 - } while((cls = cls.getSuperclass()) != null);
247.461 - return(false);
247.462 - }
247.463 - public String getDescription() {
247.464 - return("Screen component");
247.465 - }
247.466 - }
247.467 -
247.468 - static class TermFinder implements ComponentChooser {
247.469 - public boolean checkComponent(Component comp) {
247.470 - return false;
247.471 - //return comp instanceof Term;
247.472 - }
247.473 - public String getDescription() {
247.474 - return "org.netbeans.lib.terminalemulator.Term";
247.475 - }
247.476 - }
247.477 -
247.478 - /** SubChooser to determine Term TopComponent
247.479 - * Used in findTopComponent method.
247.480 - */
247.481 - private static final class InnerTabSubchooser implements ComponentChooser {
247.482 -
247.483 - /** Name of term to search for. */
247.484 - private String termName;
247.485 -
247.486 - public InnerTabSubchooser() {
247.487 - }
247.488 -
247.489 - public InnerTabSubchooser(String termName) {
247.490 - this.termName = termName;
247.491 - }
247.492 -
247.493 - public boolean checkComponent(Component comp) {
247.494 - if(comp.getClass().getName().endsWith("OutputTabInner")) { // NOI18N
247.495 - return Operator.getDefaultStringComparator().equals(comp.getName(), termName);
247.496 - } else {
247.497 - return false;
247.498 - }
247.499 - }
247.500 -
247.501 - public String getDescription() {
247.502 - return "org.netbeans.core.output.OutputTabInner"; // NOI18N
247.503 - }
247.504 - }
247.505 -
247.506 - /** Performs verification by accessing all sub-components */
247.507 - public void verify() {
247.508 - screen();
247.509 - }
247.510 -
247.511 - /****************************** Actions *****************************/
247.512 -
247.513 - /** Performs copy action. */
247.514 - public void copy() {
247.515 - //copyAction.perform(screen());
247.516 - }
247.517 -
247.518 - /** Performs find action. */
247.519 - public void find() {
247.520 - //findAction.perform(screen());
247.521 - }
247.522 -
247.523 - /** Performs find next action. */
247.524 - public void findNext() {
247.525 - //findNextAction.perform(screen());
247.526 - }
247.527 -
247.528 - /** Performs select all action. */
247.529 - public void selectAll() {
247.530 - //selectAllAction.perform(screen());
247.531 - }
247.532 -
247.533 - /** Performs clear output action. */
247.534 - public void clearOutput() {
247.535 - //clearAction.perform(screen());
247.536 - }
247.537 -
247.538 - /** Performs start redirection action. */
247.539 - public void startRedirection() {
247.540 - //startRedirectionAction.perform(screen());
247.541 - }
247.542 -
247.543 - /** Performs stop redirection action. */
247.544 - public void stopRedirection() {
247.545 - //stopRedirectionAction.perform(screen());
247.546 - }
247.547 -
247.548 - /** Performs discard action. */
247.549 - public void discard() {
247.550 - //new DiscardOutputAction().perform(this);
247.551 - }
247.552 -
247.553 - /** Performs discard all action. */
247.554 - public void discardAll() {
247.555 - //new DiscardAllOutputsAction().perform(this);
247.556 - }
247.557 -
247.558 - /** Closes output teby by API. */
247.559 - public void close() {
247.560 - //new DiscardOutputAction().performAPI(this);
247.561 - }
247.562 -}
248.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/AddBreakpointAction.java Thu Jul 10 04:29:52 2008 -0700
248.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
248.3 @@ -1,61 +0,0 @@
248.4 -/*
248.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
248.6 - *
248.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
248.8 - *
248.9 - * The contents of this file are subject to the terms of either the GNU
248.10 - * General Public License Version 2 only ("GPL") or the Common
248.11 - * Development and Distribution License("CDDL") (collectively, the
248.12 - * "License"). You may not use this file except in compliance with the
248.13 - * License. You can obtain a copy of the License at
248.14 - * http://www.netbeans.org/cddl-gplv2.html
248.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
248.16 - * specific language governing permissions and limitations under the
248.17 - * License. When distributing the software, include this License Header
248.18 - * Notice in each file and include the License file at
248.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
248.20 - * particular file as subject to the "Classpath" exception as provided
248.21 - * by Sun in the GPL Version 2 section of the License file that
248.22 - * accompanied this code. If applicable, add the following below the
248.23 - * License Header, with the fields enclosed by brackets [] replaced by
248.24 - * your own identifying information:
248.25 - * "Portions Copyrighted [year] [name of copyright owner]"
248.26 - *
248.27 - * Contributor(s):
248.28 - *
248.29 - * The Original Software is NetBeans. The Initial Developer of the Original
248.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
248.31 - * Microsystems, Inc. All Rights Reserved.
248.32 - *
248.33 - * If you wish your version of this file to be governed by only the CDDL
248.34 - * or only the GPL Version 2, indicate your decision by adding
248.35 - * "[Contributor] elects to include this software in this distribution
248.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
248.37 - * single choice of license, a recipient has the option to distribute
248.38 - * your version of this file under either the CDDL, the GPL Version 2 or
248.39 - * to extend the choice of license to its licensees as provided above.
248.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
248.41 - * Version 2 license, then the option applies only if the new code is
248.42 - * made subject to such option by the copyright holder.
248.43 - */
248.44 -
248.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
248.46 -
248.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
248.48 -import org.netbeans.jellytools.Bundle;
248.49 -import java.awt.event.KeyEvent;
248.50 -
248.51 -/** AddBreakpointAction class
248.52 - */
248.53 -public class AddBreakpointAction extends ActionNoBlock {
248.54 -
248.55 - private static final String addBreakpointMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
248.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Breakpoint_Title");
248.57 - private static final Shortcut addBreakpointShortcut = new Shortcut(KeyEvent.VK_B, KeyEvent.CTRL_MASK);
248.58 -
248.59 -
248.60 - /** creates new AddBreakpointAction instance */
248.61 - public AddBreakpointAction() {
248.62 - super(addBreakpointMenu, null, "org.netbeans.modules.debugger.support.actions.AddBreakpointAction", addBreakpointShortcut);
248.63 - }
248.64 -}
249.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/AddWatchAction.java Thu Jul 10 04:29:52 2008 -0700
249.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
249.3 @@ -1,61 +0,0 @@
249.4 -/*
249.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
249.6 - *
249.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
249.8 - *
249.9 - * The contents of this file are subject to the terms of either the GNU
249.10 - * General Public License Version 2 only ("GPL") or the Common
249.11 - * Development and Distribution License("CDDL") (collectively, the
249.12 - * "License"). You may not use this file except in compliance with the
249.13 - * License. You can obtain a copy of the License at
249.14 - * http://www.netbeans.org/cddl-gplv2.html
249.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
249.16 - * specific language governing permissions and limitations under the
249.17 - * License. When distributing the software, include this License Header
249.18 - * Notice in each file and include the License file at
249.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
249.20 - * particular file as subject to the "Classpath" exception as provided
249.21 - * by Sun in the GPL Version 2 section of the License file that
249.22 - * accompanied this code. If applicable, add the following below the
249.23 - * License Header, with the fields enclosed by brackets [] replaced by
249.24 - * your own identifying information:
249.25 - * "Portions Copyrighted [year] [name of copyright owner]"
249.26 - *
249.27 - * Contributor(s):
249.28 - *
249.29 - * The Original Software is NetBeans. The Initial Developer of the Original
249.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
249.31 - * Microsystems, Inc. All Rights Reserved.
249.32 - *
249.33 - * If you wish your version of this file to be governed by only the CDDL
249.34 - * or only the GPL Version 2, indicate your decision by adding
249.35 - * "[Contributor] elects to include this software in this distribution
249.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
249.37 - * single choice of license, a recipient has the option to distribute
249.38 - * your version of this file under either the CDDL, the GPL Version 2 or
249.39 - * to extend the choice of license to its licensees as provided above.
249.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
249.41 - * Version 2 license, then the option applies only if the new code is
249.42 - * made subject to such option by the copyright holder.
249.43 - */
249.44 -
249.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
249.46 -
249.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
249.48 -import org.netbeans.jellytools.Bundle;
249.49 -import java.awt.event.KeyEvent;
249.50 -
249.51 -/** AddWatchAction class
249.52 - */
249.53 -public class AddWatchAction extends ActionNoBlock {
249.54 -
249.55 - private static final String addWatchMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
249.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Watch_Title");
249.57 - private static final Shortcut addWatchShortcut = new Shortcut(KeyEvent.VK_W, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK );
249.58 -
249.59 -
249.60 - /** creates new AddWatchAction instance */
249.61 - public AddWatchAction() {
249.62 - super(addWatchMenu, null, "org.netbeans.modules.debugger.support.actions.AddWatchAction", addWatchShortcut);
249.63 - }
249.64 -}
250.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/ContinueDebugAction.java Thu Jul 10 04:29:52 2008 -0700
250.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
250.3 @@ -1,60 +0,0 @@
250.4 -/*
250.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
250.6 - *
250.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
250.8 - *
250.9 - * The contents of this file are subject to the terms of either the GNU
250.10 - * General Public License Version 2 only ("GPL") or the Common
250.11 - * Development and Distribution License("CDDL") (collectively, the
250.12 - * "License"). You may not use this file except in compliance with the
250.13 - * License. You can obtain a copy of the License at
250.14 - * http://www.netbeans.org/cddl-gplv2.html
250.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
250.16 - * specific language governing permissions and limitations under the
250.17 - * License. When distributing the software, include this License Header
250.18 - * Notice in each file and include the License file at
250.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
250.20 - * particular file as subject to the "Classpath" exception as provided
250.21 - * by Sun in the GPL Version 2 section of the License file that
250.22 - * accompanied this code. If applicable, add the following below the
250.23 - * License Header, with the fields enclosed by brackets [] replaced by
250.24 - * your own identifying information:
250.25 - * "Portions Copyrighted [year] [name of copyright owner]"
250.26 - *
250.27 - * Contributor(s):
250.28 - *
250.29 - * The Original Software is NetBeans. The Initial Developer of the Original
250.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
250.31 - * Microsystems, Inc. All Rights Reserved.
250.32 - *
250.33 - * If you wish your version of this file to be governed by only the CDDL
250.34 - * or only the GPL Version 2, indicate your decision by adding
250.35 - * "[Contributor] elects to include this software in this distribution
250.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
250.37 - * single choice of license, a recipient has the option to distribute
250.38 - * your version of this file under either the CDDL, the GPL Version 2 or
250.39 - * to extend the choice of license to its licensees as provided above.
250.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
250.41 - * Version 2 license, then the option applies only if the new code is
250.42 - * made subject to such option by the copyright holder.
250.43 - */
250.44 -
250.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
250.46 -
250.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
250.48 -import org.netbeans.jellytools.Bundle;
250.49 -import java.awt.event.KeyEvent;
250.50 -
250.51 -/** ConinueDebugAction class
250.52 - */
250.53 -public class ContinueDebugAction extends ActionNoBlock {
250.54 -
250.55 - private static final String continueDebugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
250.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Continue_action_name");
250.57 - private static final Shortcut continueDebugShortcut = new Shortcut(KeyEvent.VK_F5, KeyEvent.ALT_MASK);
250.58 -
250.59 - /** creates new ContinueDebugAction instance */
250.60 - public ContinueDebugAction() {
250.61 - super(continueDebugMenu, null, "org.netbeans.modules.debugger.support.actions.ContinueAction", continueDebugShortcut);
250.62 - }
250.63 -}
251.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/DebuggerWindowAction.java Thu Jul 10 04:29:52 2008 -0700
251.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
251.3 @@ -1,63 +0,0 @@
251.4 -/*
251.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
251.6 - *
251.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
251.8 - *
251.9 - * The contents of this file are subject to the terms of either the GNU
251.10 - * General Public License Version 2 only ("GPL") or the Common
251.11 - * Development and Distribution License("CDDL") (collectively, the
251.12 - * "License"). You may not use this file except in compliance with the
251.13 - * License. You can obtain a copy of the License at
251.14 - * http://www.netbeans.org/cddl-gplv2.html
251.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
251.16 - * specific language governing permissions and limitations under the
251.17 - * License. When distributing the software, include this License Header
251.18 - * Notice in each file and include the License file at
251.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
251.20 - * particular file as subject to the "Classpath" exception as provided
251.21 - * by Sun in the GPL Version 2 section of the License file that
251.22 - * accompanied this code. If applicable, add the following below the
251.23 - * License Header, with the fields enclosed by brackets [] replaced by
251.24 - * your own identifying information:
251.25 - * "Portions Copyrighted [year] [name of copyright owner]"
251.26 - *
251.27 - * Contributor(s):
251.28 - *
251.29 - * The Original Software is NetBeans. The Initial Developer of the Original
251.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
251.31 - * Microsystems, Inc. All Rights Reserved.
251.32 - *
251.33 - * If you wish your version of this file to be governed by only the CDDL
251.34 - * or only the GPL Version 2, indicate your decision by adding
251.35 - * "[Contributor] elects to include this software in this distribution
251.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
251.37 - * single choice of license, a recipient has the option to distribute
251.38 - * your version of this file under either the CDDL, the GPL Version 2 or
251.39 - * to extend the choice of license to its licensees as provided above.
251.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
251.41 - * Version 2 license, then the option applies only if the new code is
251.42 - * made subject to such option by the copyright holder.
251.43 - */
251.44 -
251.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
251.46 -
251.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
251.48 -import java.awt.event.KeyEvent;
251.49 -import org.netbeans.jellytools.Bundle;
251.50 -
251.51 -/** Used to call "View|Debugger Window" main menu item
251.52 - */
251.53 -public class DebuggerWindowAction extends ActionNoBlock {
251.54 - private static final String menu =
251.55 - Bundle.getStringTrimmed("org.netbeans.core.Bundle",
251.56 - "Menu/View") +
251.57 - "|" +
251.58 - Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle",
251.59 - "CTL_Debugger_Window_action_name");
251.60 - private static final Shortcut debuggerWindowShortcut = new Shortcut(KeyEvent.VK_D, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK);
251.61 -
251.62 - /** Creates new DebuggerWindowAction instance. */
251.63 - public DebuggerWindowAction() {
251.64 - super(menu, null, "org.netbeans.core.actions.OptionsAction", debuggerWindowShortcut);
251.65 - }
251.66 -}
252.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/FinishDebugAction.java Thu Jul 10 04:29:52 2008 -0700
252.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
252.3 @@ -1,60 +0,0 @@
252.4 -/*
252.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
252.6 - *
252.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
252.8 - *
252.9 - * The contents of this file are subject to the terms of either the GNU
252.10 - * General Public License Version 2 only ("GPL") or the Common
252.11 - * Development and Distribution License("CDDL") (collectively, the
252.12 - * "License"). You may not use this file except in compliance with the
252.13 - * License. You can obtain a copy of the License at
252.14 - * http://www.netbeans.org/cddl-gplv2.html
252.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
252.16 - * specific language governing permissions and limitations under the
252.17 - * License. When distributing the software, include this License Header
252.18 - * Notice in each file and include the License file at
252.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
252.20 - * particular file as subject to the "Classpath" exception as provided
252.21 - * by Sun in the GPL Version 2 section of the License file that
252.22 - * accompanied this code. If applicable, add the following below the
252.23 - * License Header, with the fields enclosed by brackets [] replaced by
252.24 - * your own identifying information:
252.25 - * "Portions Copyrighted [year] [name of copyright owner]"
252.26 - *
252.27 - * Contributor(s):
252.28 - *
252.29 - * The Original Software is NetBeans. The Initial Developer of the Original
252.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
252.31 - * Microsystems, Inc. All Rights Reserved.
252.32 - *
252.33 - * If you wish your version of this file to be governed by only the CDDL
252.34 - * or only the GPL Version 2, indicate your decision by adding
252.35 - * "[Contributor] elects to include this software in this distribution
252.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
252.37 - * single choice of license, a recipient has the option to distribute
252.38 - * your version of this file under either the CDDL, the GPL Version 2 or
252.39 - * to extend the choice of license to its licensees as provided above.
252.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
252.41 - * Version 2 license, then the option applies only if the new code is
252.42 - * made subject to such option by the copyright holder.
252.43 - */
252.44 -
252.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
252.46 -
252.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
252.48 -import org.netbeans.jellytools.Bundle;
252.49 -import java.awt.event.KeyEvent;
252.50 -
252.51 -/** FinishDebugAction class
252.52 - */
252.53 -public class FinishDebugAction extends ActionNoBlock {
252.54 -
252.55 - private static final String finishDebugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
252.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Finish_action_name");
252.57 - private static final Shortcut finishDebugShortcut = new Shortcut(KeyEvent.VK_F5, KeyEvent.SHIFT_MASK );
252.58 -
252.59 - /** creates new FinishDebugAction instance */
252.60 - public FinishDebugAction() {
252.61 - super(finishDebugMenu, null, "org.openide.actions.FinishDebuggerAction", finishDebugShortcut);
252.62 - }
252.63 -}
253.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/PauseDebugAction.java Thu Jul 10 04:29:52 2008 -0700
253.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
253.3 @@ -1,59 +0,0 @@
253.4 -/*
253.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
253.6 - *
253.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
253.8 - *
253.9 - * The contents of this file are subject to the terms of either the GNU
253.10 - * General Public License Version 2 only ("GPL") or the Common
253.11 - * Development and Distribution License("CDDL") (collectively, the
253.12 - * "License"). You may not use this file except in compliance with the
253.13 - * License. You can obtain a copy of the License at
253.14 - * http://www.netbeans.org/cddl-gplv2.html
253.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
253.16 - * specific language governing permissions and limitations under the
253.17 - * License. When distributing the software, include this License Header
253.18 - * Notice in each file and include the License file at
253.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
253.20 - * particular file as subject to the "Classpath" exception as provided
253.21 - * by Sun in the GPL Version 2 section of the License file that
253.22 - * accompanied this code. If applicable, add the following below the
253.23 - * License Header, with the fields enclosed by brackets [] replaced by
253.24 - * your own identifying information:
253.25 - * "Portions Copyrighted [year] [name of copyright owner]"
253.26 - *
253.27 - * Contributor(s):
253.28 - *
253.29 - * The Original Software is NetBeans. The Initial Developer of the Original
253.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
253.31 - * Microsystems, Inc. All Rights Reserved.
253.32 - *
253.33 - * If you wish your version of this file to be governed by only the CDDL
253.34 - * or only the GPL Version 2, indicate your decision by adding
253.35 - * "[Contributor] elects to include this software in this distribution
253.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
253.37 - * single choice of license, a recipient has the option to distribute
253.38 - * your version of this file under either the CDDL, the GPL Version 2 or
253.39 - * to extend the choice of license to its licensees as provided above.
253.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
253.41 - * Version 2 license, then the option applies only if the new code is
253.42 - * made subject to such option by the copyright holder.
253.43 - */
253.44 -
253.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
253.46 -
253.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
253.48 -import org.netbeans.jellytools.Bundle;
253.49 -import java.awt.event.KeyEvent;
253.50 -
253.51 -/** PauseDebugAction class
253.52 - */
253.53 -public class PauseDebugAction extends ActionNoBlock {
253.54 -
253.55 - private static final String pauseDebugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
253.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Pause_action_name");
253.57 -
253.58 - /** creates new PauseDebugAction instance */
253.59 - public PauseDebugAction() {
253.60 - super(pauseDebugMenu, null, "org.netbeans.modules.debugger.support.actions.PauseAction");
253.61 - }
253.62 -}
254.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/RunToCursorAction.java Thu Jul 10 04:29:52 2008 -0700
254.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
254.3 @@ -1,60 +0,0 @@
254.4 -/*
254.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
254.6 - *
254.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
254.8 - *
254.9 - * The contents of this file are subject to the terms of either the GNU
254.10 - * General Public License Version 2 only ("GPL") or the Common
254.11 - * Development and Distribution License("CDDL") (collectively, the
254.12 - * "License"). You may not use this file except in compliance with the
254.13 - * License. You can obtain a copy of the License at
254.14 - * http://www.netbeans.org/cddl-gplv2.html
254.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
254.16 - * specific language governing permissions and limitations under the
254.17 - * License. When distributing the software, include this License Header
254.18 - * Notice in each file and include the License file at
254.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
254.20 - * particular file as subject to the "Classpath" exception as provided
254.21 - * by Sun in the GPL Version 2 section of the License file that
254.22 - * accompanied this code. If applicable, add the following below the
254.23 - * License Header, with the fields enclosed by brackets [] replaced by
254.24 - * your own identifying information:
254.25 - * "Portions Copyrighted [year] [name of copyright owner]"
254.26 - *
254.27 - * Contributor(s):
254.28 - *
254.29 - * The Original Software is NetBeans. The Initial Developer of the Original
254.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
254.31 - * Microsystems, Inc. All Rights Reserved.
254.32 - *
254.33 - * If you wish your version of this file to be governed by only the CDDL
254.34 - * or only the GPL Version 2, indicate your decision by adding
254.35 - * "[Contributor] elects to include this software in this distribution
254.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
254.37 - * single choice of license, a recipient has the option to distribute
254.38 - * your version of this file under either the CDDL, the GPL Version 2 or
254.39 - * to extend the choice of license to its licensees as provided above.
254.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
254.41 - * Version 2 license, then the option applies only if the new code is
254.42 - * made subject to such option by the copyright holder.
254.43 - */
254.44 -
254.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
254.46 -
254.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
254.48 -import org.netbeans.jellytools.Bundle;
254.49 -import java.awt.event.KeyEvent;
254.50 -
254.51 -/** RunToCursorAction class
254.52 - */
254.53 -public class RunToCursorAction extends ActionNoBlock {
254.54 -
254.55 - private static final String runToCursorMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
254.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Run_to_cursor_action_name");
254.57 - private static final Shortcut runToCursorShortcut = new Shortcut(KeyEvent.VK_F10, KeyEvent.CTRL_MASK);
254.58 -
254.59 - /** creates new RunToCursorAction instance */
254.60 - public RunToCursorAction() {
254.61 - super(runToCursorMenu, null, "org.netbeans.modules.debugger.support.actions.RunToCursorAction", runToCursorShortcut);
254.62 - }
254.63 -}
255.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StartDebugAction.java Thu Jul 10 04:29:52 2008 -0700
255.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
255.3 @@ -1,60 +0,0 @@
255.4 -/*
255.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
255.6 - *
255.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
255.8 - *
255.9 - * The contents of this file are subject to the terms of either the GNU
255.10 - * General Public License Version 2 only ("GPL") or the Common
255.11 - * Development and Distribution License("CDDL") (collectively, the
255.12 - * "License"). You may not use this file except in compliance with the
255.13 - * License. You can obtain a copy of the License at
255.14 - * http://www.netbeans.org/cddl-gplv2.html
255.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
255.16 - * specific language governing permissions and limitations under the
255.17 - * License. When distributing the software, include this License Header
255.18 - * Notice in each file and include the License file at
255.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
255.20 - * particular file as subject to the "Classpath" exception as provided
255.21 - * by Sun in the GPL Version 2 section of the License file that
255.22 - * accompanied this code. If applicable, add the following below the
255.23 - * License Header, with the fields enclosed by brackets [] replaced by
255.24 - * your own identifying information:
255.25 - * "Portions Copyrighted [year] [name of copyright owner]"
255.26 - *
255.27 - * Contributor(s):
255.28 - *
255.29 - * The Original Software is NetBeans. The Initial Developer of the Original
255.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
255.31 - * Microsystems, Inc. All Rights Reserved.
255.32 - *
255.33 - * If you wish your version of this file to be governed by only the CDDL
255.34 - * or only the GPL Version 2, indicate your decision by adding
255.35 - * "[Contributor] elects to include this software in this distribution
255.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
255.37 - * single choice of license, a recipient has the option to distribute
255.38 - * your version of this file under either the CDDL, the GPL Version 2 or
255.39 - * to extend the choice of license to its licensees as provided above.
255.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
255.41 - * Version 2 license, then the option applies only if the new code is
255.42 - * made subject to such option by the copyright holder.
255.43 - */
255.44 -
255.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
255.46 -
255.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
255.48 -import org.netbeans.jellytools.Bundle;
255.49 -import java.awt.event.KeyEvent;
255.50 -
255.51 -/** StartDebugAction class
255.52 - */
255.53 -public class StartDebugAction extends ActionNoBlock {
255.54 -
255.55 - private static final String debugMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
255.56 - + "|" + Bundle.getStringTrimmed("com.sun.rave.gravy.project.actions.Bundle", "LBL_DebugProject");
255.57 - private static final Shortcut debugShortcut = new Shortcut(KeyEvent.VK_F5);
255.58 -
255.59 - /** creates new StartDebugAction instance */
255.60 - public StartDebugAction() {
255.61 - super(debugMenu, null, "org.netbeans.modules.debugger.support.actions.StartAction");
255.62 - }
255.63 -}
256.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StepIntoAction.java Thu Jul 10 04:29:52 2008 -0700
256.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
256.3 @@ -1,61 +0,0 @@
256.4 -/*
256.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
256.6 - *
256.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
256.8 - *
256.9 - * The contents of this file are subject to the terms of either the GNU
256.10 - * General Public License Version 2 only ("GPL") or the Common
256.11 - * Development and Distribution License("CDDL") (collectively, the
256.12 - * "License"). You may not use this file except in compliance with the
256.13 - * License. You can obtain a copy of the License at
256.14 - * http://www.netbeans.org/cddl-gplv2.html
256.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
256.16 - * specific language governing permissions and limitations under the
256.17 - * License. When distributing the software, include this License Header
256.18 - * Notice in each file and include the License file at
256.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
256.20 - * particular file as subject to the "Classpath" exception as provided
256.21 - * by Sun in the GPL Version 2 section of the License file that
256.22 - * accompanied this code. If applicable, add the following below the
256.23 - * License Header, with the fields enclosed by brackets [] replaced by
256.24 - * your own identifying information:
256.25 - * "Portions Copyrighted [year] [name of copyright owner]"
256.26 - *
256.27 - * Contributor(s):
256.28 - *
256.29 - * The Original Software is NetBeans. The Initial Developer of the Original
256.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
256.31 - * Microsystems, Inc. All Rights Reserved.
256.32 - *
256.33 - * If you wish your version of this file to be governed by only the CDDL
256.34 - * or only the GPL Version 2, indicate your decision by adding
256.35 - * "[Contributor] elects to include this software in this distribution
256.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
256.37 - * single choice of license, a recipient has the option to distribute
256.38 - * your version of this file under either the CDDL, the GPL Version 2 or
256.39 - * to extend the choice of license to its licensees as provided above.
256.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
256.41 - * Version 2 license, then the option applies only if the new code is
256.42 - * made subject to such option by the copyright holder.
256.43 - */
256.44 -
256.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
256.46 -
256.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
256.48 -import org.netbeans.jellytools.Bundle;
256.49 -import java.awt.event.KeyEvent;
256.50 -
256.51 -/** StepIntoAction class
256.52 - */
256.53 -public class StepIntoAction extends ActionNoBlock {
256.54 -
256.55 - private static final String stepIntoMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
256.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Step_into_action_name");
256.57 - private static final Shortcut stepIntoShortcut = new Shortcut(KeyEvent.VK_F11);
256.58 -
256.59 -
256.60 - /** creates new StepIntoAction instance */
256.61 - public StepIntoAction() {
256.62 - super(stepIntoMenu, null, "org.netbeans.modules.debugger.actions.StepIntoAction", stepIntoShortcut);
256.63 - }
256.64 -}
257.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StepOutAction.java Thu Jul 10 04:29:52 2008 -0700
257.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
257.3 @@ -1,61 +0,0 @@
257.4 -/*
257.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
257.6 - *
257.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
257.8 - *
257.9 - * The contents of this file are subject to the terms of either the GNU
257.10 - * General Public License Version 2 only ("GPL") or the Common
257.11 - * Development and Distribution License("CDDL") (collectively, the
257.12 - * "License"). You may not use this file except in compliance with the
257.13 - * License. You can obtain a copy of the License at
257.14 - * http://www.netbeans.org/cddl-gplv2.html
257.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
257.16 - * specific language governing permissions and limitations under the
257.17 - * License. When distributing the software, include this License Header
257.18 - * Notice in each file and include the License file at
257.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
257.20 - * particular file as subject to the "Classpath" exception as provided
257.21 - * by Sun in the GPL Version 2 section of the License file that
257.22 - * accompanied this code. If applicable, add the following below the
257.23 - * License Header, with the fields enclosed by brackets [] replaced by
257.24 - * your own identifying information:
257.25 - * "Portions Copyrighted [year] [name of copyright owner]"
257.26 - *
257.27 - * Contributor(s):
257.28 - *
257.29 - * The Original Software is NetBeans. The Initial Developer of the Original
257.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
257.31 - * Microsystems, Inc. All Rights Reserved.
257.32 - *
257.33 - * If you wish your version of this file to be governed by only the CDDL
257.34 - * or only the GPL Version 2, indicate your decision by adding
257.35 - * "[Contributor] elects to include this software in this distribution
257.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
257.37 - * single choice of license, a recipient has the option to distribute
257.38 - * your version of this file under either the CDDL, the GPL Version 2 or
257.39 - * to extend the choice of license to its licensees as provided above.
257.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
257.41 - * Version 2 license, then the option applies only if the new code is
257.42 - * made subject to such option by the copyright holder.
257.43 - */
257.44 -
257.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
257.46 -
257.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
257.48 -import org.netbeans.jellytools.Bundle;
257.49 -import java.awt.event.KeyEvent;
257.50 -
257.51 -/** StepOutAction class
257.52 - */
257.53 -public class StepOutAction extends ActionNoBlock {
257.54 -
257.55 - private static final String stepOutMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
257.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Step_out_action_name");
257.57 - private static final Shortcut stepOutShortcut = new Shortcut(KeyEvent.VK_F11, KeyEvent.SHIFT_MASK);
257.58 -
257.59 -
257.60 - /** creates new StepOutAction instance */
257.61 - public StepOutAction() {
257.62 - super(stepOutMenu, null, "org.netbeans.modules.debugger.actions.StepOutAction", stepOutShortcut);
257.63 - }
257.64 -}
258.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/StepOverAction.java Thu Jul 10 04:29:52 2008 -0700
258.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
258.3 @@ -1,61 +0,0 @@
258.4 -/*
258.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
258.6 - *
258.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
258.8 - *
258.9 - * The contents of this file are subject to the terms of either the GNU
258.10 - * General Public License Version 2 only ("GPL") or the Common
258.11 - * Development and Distribution License("CDDL") (collectively, the
258.12 - * "License"). You may not use this file except in compliance with the
258.13 - * License. You can obtain a copy of the License at
258.14 - * http://www.netbeans.org/cddl-gplv2.html
258.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
258.16 - * specific language governing permissions and limitations under the
258.17 - * License. When distributing the software, include this License Header
258.18 - * Notice in each file and include the License file at
258.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
258.20 - * particular file as subject to the "Classpath" exception as provided
258.21 - * by Sun in the GPL Version 2 section of the License file that
258.22 - * accompanied this code. If applicable, add the following below the
258.23 - * License Header, with the fields enclosed by brackets [] replaced by
258.24 - * your own identifying information:
258.25 - * "Portions Copyrighted [year] [name of copyright owner]"
258.26 - *
258.27 - * Contributor(s):
258.28 - *
258.29 - * The Original Software is NetBeans. The Initial Developer of the Original
258.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
258.31 - * Microsystems, Inc. All Rights Reserved.
258.32 - *
258.33 - * If you wish your version of this file to be governed by only the CDDL
258.34 - * or only the GPL Version 2, indicate your decision by adding
258.35 - * "[Contributor] elects to include this software in this distribution
258.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
258.37 - * single choice of license, a recipient has the option to distribute
258.38 - * your version of this file under either the CDDL, the GPL Version 2 or
258.39 - * to extend the choice of license to its licensees as provided above.
258.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
258.41 - * Version 2 license, then the option applies only if the new code is
258.42 - * made subject to such option by the copyright holder.
258.43 - */
258.44 -
258.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
258.46 -
258.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
258.48 -import org.netbeans.jellytools.Bundle;
258.49 -import java.awt.event.KeyEvent;
258.50 -
258.51 -/** StepOverAction class
258.52 - */
258.53 -public class StepOverAction extends ActionNoBlock {
258.54 -
258.55 - private static final String stepOverMenu = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Debug")
258.56 - + "|" + Bundle.getStringTrimmed("org.netbeans.modules.debugger.support.actions.Bundle", "CTL_Step_over_action_name");
258.57 - private static final Shortcut stepOverShortcut = new Shortcut(KeyEvent.VK_F8);
258.58 -
258.59 -
258.60 - /** creates new StepOverAction instance */
258.61 - public StepOverAction() {
258.62 - super(stepOverMenu, null, "org.netbeans.modules.debugger.actions.StepOverAction", stepOverShortcut);
258.63 - }
258.64 -}
259.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/debugger/actions/ToggleBreakpointAction.java Thu Jul 10 04:29:52 2008 -0700
259.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
259.3 @@ -1,62 +0,0 @@
259.4 -/*
259.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
259.6 - *
259.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
259.8 - *
259.9 - * The contents of this file are subject to the terms of either the GNU
259.10 - * General Public License Version 2 only ("GPL") or the Common
259.11 - * Development and Distribution License("CDDL") (collectively, the
259.12 - * "License"). You may not use this file except in compliance with the
259.13 - * License. You can obtain a copy of the License at
259.14 - * http://www.netbeans.org/cddl-gplv2.html
259.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
259.16 - * specific language governing permissions and limitations under the
259.17 - * License. When distributing the software, include this License Header
259.18 - * Notice in each file and include the License file at
259.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
259.20 - * particular file as subject to the "Classpath" exception as provided
259.21 - * by Sun in the GPL Version 2 section of the License file that
259.22 - * accompanied this code. If applicable, add the following below the
259.23 - * License Header, with the fields enclosed by brackets [] replaced by
259.24 - * your own identifying information:
259.25 - * "Portions Copyrighted [year] [name of copyright owner]"
259.26 - *
259.27 - * Contributor(s):
259.28 - *
259.29 - * The Original Software is NetBeans. The Initial Developer of the Original
259.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
259.31 - * Microsystems, Inc. All Rights Reserved.
259.32 - *
259.33 - * If you wish your version of this file to be governed by only the CDDL
259.34 - * or only the GPL Version 2, indicate your decision by adding
259.35 - * "[Contributor] elects to include this software in this distribution
259.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
259.37 - * single choice of license, a recipient has the option to distribute
259.38 - * your version of this file under either the CDDL, the GPL Version 2 or
259.39 - * to extend the choice of license to its licensees as provided above.
259.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
259.41 - * Version 2 license, then the option applies only if the new code is
259.42 - * made subject to such option by the copyright holder.
259.43 - */
259.44 -
259.45 -package org.netbeans.modules.visualweb.gravy.debugger.actions;
259.46 -
259.47 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
259.48 -import org.netbeans.jellytools.Bundle;
259.49 -import java.awt.event.KeyEvent;
259.50 -
259.51 -/** ToggleBreakpointAction class
259.52 - */
259.53 -public class ToggleBreakpointAction extends ActionNoBlock {
259.54 -
259.55 - private static final String toggleBreakpointMenu = "Run|" +
259.56 - Bundle.getStringTrimmed("org.netbeans.modules.debugger.ui.actions.Bundle", "CTL_Toggle_breakpoint");
259.57 - private static final Shortcut toggleBreakpointShortcut = new Shortcut(KeyEvent.VK_F8, KeyEvent.SHIFT_MASK);
259.58 -
259.59 - private static final String toggleBreakpointPopup = Bundle.getStringTrimmed("org.netbeans.editor.Bundle", "toggle-breakpoint");
259.60 -
259.61 - /** creates new ToggleBreakpointAction instance */
259.62 - public ToggleBreakpointAction() {
259.63 - super(null, toggleBreakpointPopup, "org.netbeans.modules.debugger.support.actions.ToggleBreakpointAction", toggleBreakpointShortcut);
259.64 - }
259.65 -}
260.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/designer/BHTableLayoutOperator.java Thu Jul 10 04:29:52 2008 -0700
260.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
260.3 @@ -1,378 +0,0 @@
260.4 -/*
260.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
260.6 -*
260.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
260.8 -*
260.9 -* The contents of this file are subject to the terms of either the GNU
260.10 -* General Public License Version 2 only ("GPL") or the Common
260.11 -* Development and Distribution License("CDDL") (collectively, the
260.12 -* "License"). You may not use this file except in compliance with the
260.13 -* License. You can obtain a copy of the License at
260.14 -* http://www.netbeans.org/cddl-gplv2.html
260.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
260.16 -* specific language governing permissions and limitations under the
260.17 -* License. When distributing the software, include this License Header
260.18 -* Notice in each file and include the License file at
260.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
260.20 -* particular file as subject to the "Classpath" exception as provided
260.21 -* by Sun in the GPL Version 2 section of the License file that
260.22 -* accompanied this code. If applicable, add the following below the
260.23 -* License Header, with the fields enclosed by brackets [] replaced by
260.24 -* your own identifying information:
260.25 -* "Portions Copyrighted [year] [name of copyright owner]"
260.26 -*
260.27 -* Contributor(s):
260.28 -*
260.29 -* The Original Software is NetBeans. The Initial Developer of the Original
260.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
260.31 -* Microsystems, Inc. All Rights Reserved.
260.32 -*
260.33 -* If you wish your version of this file to be governed by only the CDDL
260.34 -* or only the GPL Version 2, indicate your decision by adding
260.35 -* "[Contributor] elects to include this software in this distribution
260.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
260.37 -* single choice of license, a recipient has the option to distribute
260.38 -* your version of this file under either the CDDL, the GPL Version 2 or
260.39 -* to extend the choice of license to its licensees as provided above.
260.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
260.41 -* Version 2 license, then the option applies only if the new code is
260.42 -* made subject to such option by the copyright holder.
260.43 -*/
260.44 -
260.45 -package org.netbeans.modules.visualweb.gravy.designer;
260.46 -
260.47 -import org.netbeans.jellytools.Bundle;
260.48 -import org.netbeans.jellytools.NbDialogOperator;
260.49 -import org.netbeans.jemmy.JemmyException;
260.50 -import org.netbeans.jemmy.operators.*;
260.51 -import org.netbeans.modules.visualweb.gravy.Util;
260.52 -
260.53 -/**
260.54 - * This class implements test functionality for the dialog "Table Layout",
260.55 - * related to the component "Table" from the palette "Basic".
260.56 - */
260.57 -public class BHTableLayoutOperator extends GeneralTableLayoutOperator{
260.58 - /**
260.59 - * Creates an instance of this class.
260.60 - */
260.61 - public BHTableLayoutOperator(){
260.62 - super();
260.63 - }
260.64 -
260.65 - /**
260.66 - * Creates and returns an instance of this class via using
260.67 - * the appropriate item of a poup menu.
260.68 - * @param menu a popup menu, related to a table
260.69 - * @return a new created object BHTableLayoutOperator
260.70 - */
260.71 - public static BHTableLayoutOperator invoke(JPopupMenuOperator menu){
260.72 - Util.wait(300);
260.73 - menu.pushMenuNoBlock(getBundleString("tblLayoutEllipse"));
260.74 - return new BHTableLayoutOperator();
260.75 - }
260.76 -
260.77 - private JButtonOperator _btBrowseFirst;
260.78 - private JButtonOperator _btBrowsePrevious;
260.79 - private JButtonOperator _btBrowseNext;
260.80 - private JButtonOperator _btBrowseLast;
260.81 - private JTextFieldOperator _txtPageSize;
260.82 - private JTextFieldOperator _txtFirst;
260.83 - private JTextFieldOperator _txtPrevious;
260.84 - private JTextFieldOperator _txtNext;
260.85 - private JTextFieldOperator _txtLast;
260.86 - private JComboBoxOperator _cboPosition;
260.87 - private JComboBoxOperator _cboAlignment;
260.88 - private JComboBoxOperator _cboNavigation;
260.89 - private JCheckBoxOperator _cbEnable;
260.90 - private JCheckBoxOperator _cbFirst;
260.91 - private JCheckBoxOperator _cbPrevious;
260.92 - private JCheckBoxOperator _cbNext;
260.93 - private JCheckBoxOperator _cbLast;
260.94 -
260.95 - /**
260.96 - * Initializes (if necessary) and returns an object JButtonOperator
260.97 - * for the dialog button "<<".
260.98 - * @return the appropriate object JButtonOperator
260.99 - */
260.100 - public JButtonOperator btBrowseFirst() {
260.101 - if (_btBrowseFirst==null) {
260.102 - _btBrowseFirst = new JButtonOperator(this, getBundleString("browseEllipse"),0);
260.103 - }
260.104 - return _btBrowseFirst;
260.105 - }
260.106 -
260.107 - /**
260.108 - * Initializes (if necessary) and returns an object JButtonOperator
260.109 - * for the dialog button "<".
260.110 - * @return the appropriate object JButtonOperator
260.111 - */
260.112 - public JButtonOperator btBrowsePrevious() {
260.113 - if (_btBrowsePrevious==null) {
260.114 - _btBrowsePrevious = new JButtonOperator(this, getBundleString("browseEllipse"),1);
260.115 - }
260.116 - return _btBrowsePrevious;
260.117 - }
260.118 -
260.119 - /**
260.120 - * Initializes (if necessary) and returns an object JButtonOperator
260.121 - * for the dialog button ">".
260.122 - * @return the appropriate object JButtonOperator
260.123 - */
260.124 - public JButtonOperator btBrowseNext() {
260.125 - if (_btBrowseNext==null) {
260.126 - _btBrowseNext = new JButtonOperator(this, getBundleString("browseEllipse"),2);
260.127 - }
260.128 - return _btBrowseNext;
260.129 - }
260.130 -
260.131 - /**
260.132 - * Initializes (if necessary) and returns an object JButtonOperator
260.133 - * for the dialog button ">>".
260.134 - * @return the appropriate object JButtonOperator
260.135 - */
260.136 - public JButtonOperator btBrowseLast() {
260.137 - if (_btBrowseLast==null) {
260.138 - _btBrowseLast = new JButtonOperator(this, getBundleString("browseEllipse"),3);
260.139 - }
260.140 - return _btBrowseLast;
260.141 - }
260.142 -
260.143 - /**
260.144 - * Initializes (if necessary) and returns an object JTextFieldOperator
260.145 - * for the dialog text field "Page Size".
260.146 - * @return the appropriate object JTextFieldOperator
260.147 - */
260.148 - public JTextFieldOperator txtPageSize() {
260.149 - if (_txtPageSize==null) {
260.150 - _txtPageSize = new JTextFieldOperator(this, 0);
260.151 - }
260.152 - return _txtPageSize;
260.153 - }
260.154 -
260.155 - /**
260.156 - * Initializes (if necessary) and returns an object JTextFieldOperator
260.157 - * for the dialog text field "First".
260.158 - * @return the appropriate object JTextFieldOperator
260.159 - */
260.160 - public JTextFieldOperator txtFirst() {
260.161 - if (_txtFirst==null) {
260.162 - _txtFirst = new JTextFieldOperator(this, 1);
260.163 - }
260.164 - return _txtFirst;
260.165 - }
260.166 -
260.167 - /**
260.168 - * Initializes (if necessary) and returns an object JTextFieldOperator
260.169 - * for the dialog text field "Previous".
260.170 - * @return the appropriate object JTextFieldOperator
260.171 - */
260.172 - public JTextFieldOperator txtPrevious() {
260.173 - if (_txtPrevious==null) {
260.174 - _txtPrevious = new JTextFieldOperator(this, 2);
260.175 - }
260.176 - return _txtPrevious;
260.177 - }
260.178 -
260.179 - /**
260.180 - * Initializes (if necessary) and returns an object JTextFieldOperator
260.181 - * for the dialog text field "Next".
260.182 - * @return the appropriate object JTextFieldOperator
260.183 - */
260.184 - public JTextFieldOperator txtNext() {
260.185 - if (_txtNext==null) {
260.186 - _txtNext = new JTextFieldOperator(this, 3);
260.187 - }
260.188 - return _txtNext;
260.189 - }
260.190 -
260.191 - /**
260.192 - * Initializes (if necessary) and returns an object JTextFieldOperator
260.193 - * for the dialog text field "Last".
260.194 - * @return the appropriate object JTextFieldOperator
260.195 - */
260.196 - public JTextFieldOperator txtLast() {
260.197 - if (_txtLast==null) {
260.198 - _txtLast = new JTextFieldOperator(this, 4);
260.199 - }
260.200 - return _txtLast;
260.201 - }
260.202 -
260.203 - /**
260.204 - * Initializes (if necessary) and returns an object JCheckBoxOperator
260.205 - * for the dialog check-box "Enable".
260.206 - * @return the appropriate object JCheckBoxOperator
260.207 - */
260.208 - public JCheckBoxOperator cbEnable() {
260.209 - if (_cbEnable==null) {
260.210 - _cbEnable = new JCheckBoxOperator(this, getBundleString("enablePaging"));
260.211 - }
260.212 - return _cbEnable;
260.213 - }
260.214 -
260.215 - /**
260.216 - * Initializes (if necessary) and returns an object JCheckBoxOperator
260.217 - * for the dialog check-box "First".
260.218 - * @return the appropriate object JCheckBoxOperator
260.219 - */
260.220 - public JCheckBoxOperator cbFirst() {
260.221 - if (_cbFirst==null) {
260.222 - _cbFirst = new JCheckBoxOperator(this, getBundleString("firstPage"));
260.223 - }
260.224 - return _cbFirst;
260.225 - }
260.226 -
260.227 - /**
260.228 - * Initializes (if necessary) and returns an object JCheckBoxOperator
260.229 - * for the dialog check-box "Previous".
260.230 - * @return the appropriate object JCheckBoxOperator
260.231 - */
260.232 - public JCheckBoxOperator cbPrevious() {
260.233 - if (_cbPrevious==null) {
260.234 - _cbPrevious = new JCheckBoxOperator(this, getBundleString("prevPage"));
260.235 - }
260.236 - return _cbPrevious;
260.237 - }
260.238 -
260.239 - /**
260.240 - * Initializes (if necessary) and returns an object JCheckBoxOperator
260.241 - * for the dialog check-box "Next".
260.242 - * @return the appropriate object JCheckBoxOperator
260.243 - */
260.244 - public JCheckBoxOperator cbNext() {
260.245 - if (_cbNext==null) {
260.246 - _cbNext = new JCheckBoxOperator(this, getBundleString("nextPage"));
260.247 - }
260.248 - return _cbNext;
260.249 - }
260.250 -
260.251 - /**
260.252 - * Initializes (if necessary) and returns an object JCheckBoxOperator
260.253 - * for the dialog check-box "Last".
260.254 - * @return the appropriate object JCheckBoxOperator
260.255 - */
260.256 - public JCheckBoxOperator cbLast() {
260.257 - if (_cbLast==null) {
260.258 - _cbLast = new JCheckBoxOperator(this, getBundleString("lastPage"));
260.259 - }
260.260 - return _cbLast;
260.261 - }
260.262 -
260.263 - /**
260.264 - * Initializes (if necessary) and returns an object JComboBoxOperator
260.265 - * for the dialog drop-down list "Navigation".
260.266 - * @return the appropriate object JComboBoxOperator
260.267 - */
260.268 - public JComboBoxOperator cboNavigation() {
260.269 - if (_cboNavigation==null) {
260.270 - _cboNavigation = new JComboBoxOperator(this,0);
260.271 - }
260.272 - return _cboNavigation;
260.273 - }
260.274 -
260.275 - /**
260.276 - * Initializes (if necessary) and returns an object JComboBoxOperator
260.277 - * for the dialog drop-down list "Source".
260.278 - * @return the appropriate object JComboBoxOperator
260.279 - */
260.280 - public JComboBoxOperator cboSource() {
260.281 - if (_cboSource==null) {
260.282 - _cboSource = new JComboBoxOperator(this,0);
260.283 - }
260.284 - return _cboSource;
260.285 - }
260.286 -
260.287 - /**
260.288 - * Initializes (if necessary) and returns an object JComboBoxOperator
260.289 - * for the dialog drop-down list "Component Type".
260.290 - * @return the appropriate object JComboBoxOperator
260.291 - */
260.292 - public JComboBoxOperator cboComponentType() {
260.293 - if (_cboComponentType==null) {
260.294 - _cboComponentType = new JComboBoxOperator(this,2);
260.295 - }
260.296 - return _cboComponentType;
260.297 - }
260.298 -
260.299 - /**
260.300 - * Initializes (if necessary) and returns an object JComboBoxOperator
260.301 - * for the dialog drop-down list "Position".
260.302 - * @return the appropriate object JComboBoxOperator
260.303 - */
260.304 - public JComboBoxOperator cboPosition() {
260.305 - if (_cboPosition==null) {
260.306 - _cboPosition = new JComboBoxOperator(this,1);
260.307 - }
260.308 - return _cboPosition;
260.309 - }
260.310 -
260.311 - /**
260.312 - * Initializes (if necessary) and returns an object JComboBoxOperator
260.313 - * for the dialog drop-down list "Alignment".
260.314 - * @return the appropriate object JComboBoxOperator
260.315 - */
260.316 - public JComboBoxOperator cboAlignment() {
260.317 - if (_cboAlignment==null) {
260.318 - _cboAlignment = new JComboBoxOperator(this,3);
260.319 - }
260.320 - return _cboAlignment;
260.321 - }
260.322 -
260.323 - /**
260.324 - * Select the tab "Columns" in the tabbed pane.
260.325 - */
260.326 - public void selectColumnsTab(){
260.327 - tbpLayout().selectPage(getBundleString("cols"));
260.328 - }
260.329 -
260.330 - /**
260.331 - * Select the tab "Options" in the tabbed pane.
260.332 - */
260.333 - public void selectOptionsTab(){
260.334 - tbpLayout().selectPage(getBundleString("paging"));
260.335 - }
260.336 -
260.337 - /**
260.338 - * Initializes all necessary controls.
260.339 - */
260.340 - public void verify() {
260.341 -
260.342 - super.verify();
260.343 -
260.344 - selectOptionsTab();
260.345 -
260.346 - btBrowseFirst();
260.347 - btBrowsePrevious();
260.348 - btBrowseNext();
260.349 - btBrowseLast();
260.350 - cboNavigation();
260.351 - cboPosition();
260.352 - cboAlignment();
260.353 - cbEnable();
260.354 - cbFirst();
260.355 - cbPrevious();
260.356 - cbNext();
260.357 - cbLast();
260.358 - txtPageSize();
260.359 - txtFirst();
260.360 - txtPrevious();
260.361 - txtNext();
260.362 - txtLast();
260.363 -
260.364 - selectColumnsTab();
260.365 - }
260.366 -
260.367 - /**
260.368 - * Finds in a bundle file and returns an actual text of control component.
260.369 - * @param p_text string-key corresponding to required control component.
260.370 - * @return actual text of control component
260.371 - */
260.372 - public static String getBundleString(String p_text) {
260.373 - System.out.println("Getting bundle for " + p_text);
260.374 - try {
260.375 - return Bundle.getStringTrimmed("org.netbeans.modules.visualweb.faces.dt.std.table.Bundle", p_text);
260.376 - } catch (JemmyException e) {
260.377 - System.out.println(e.getMessage());
260.378 - }
260.379 - return null;
260.380 - }
260.381 -}
261.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/designer/DesignerPaneOperator.java Thu Jul 10 04:29:52 2008 -0700
261.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
261.3 @@ -1,452 +0,0 @@
261.4 -/*
261.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
261.6 -*
261.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
261.8 -*
261.9 -* The contents of this file are subject to the terms of either the GNU
261.10 -* General Public License Version 2 only ("GPL") or the Common
261.11 -* Development and Distribution License("CDDL") (collectively, the
261.12 -* "License"). You may not use this file except in compliance with the
261.13 -* License. You can obtain a copy of the License at
261.14 -* http://www.netbeans.org/cddl-gplv2.html
261.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
261.16 -* specific language governing permissions and limitations under the
261.17 -* License. When distributing the software, include this License Header
261.18 -* Notice in each file and include the License file at
261.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
261.20 -* particular file as subject to the "Classpath" exception as provided
261.21 -* by Sun in the GPL Version 2 section of the License file that
261.22 -* accompanied this code. If applicable, add the following below the
261.23 -* License Header, with the fields enclosed by brackets [] replaced by
261.24 -* your own identifying information:
261.25 -* "Portions Copyrighted [year] [name of copyright owner]"
261.26 -*
261.27 -* Contributor(s):
261.28 -*
261.29 -* The Original Software is NetBeans. The Initial Developer of the Original
261.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
261.31 -* Microsystems, Inc. All Rights Reserved.
261.32 -*
261.33 -* If you wish your version of this file to be governed by only the CDDL
261.34 -* or only the GPL Version 2, indicate your decision by adding
261.35 -* "[Contributor] elects to include this software in this distribution
261.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
261.37 -* single choice of license, a recipient has the option to distribute
261.38 -* your version of this file under either the CDDL, the GPL Version 2 or
261.39 -* to extend the choice of license to its licensees as provided above.
261.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
261.41 -* Version 2 license, then the option applies only if the new code is
261.42 -* made subject to such option by the copyright holder.
261.43 -*/
261.44 -
261.45 -package org.netbeans.modules.visualweb.gravy.designer;
261.46 -
261.47 -import org.netbeans.modules.visualweb.css2.ModelViewMapper;
261.48 -import org.netbeans.modules.visualweb.designer.WebForm;
261.49 -import org.netbeans.modules.visualweb.gravy.Util;
261.50 -import org.netbeans.modules.visualweb.css2.CssBox;
261.51 -import org.netbeans.modules.visualweb.designer.*;
261.52 -import org.netbeans.modules.visualweb.designer.jsf.*;
261.53 -import org.netbeans.modules.visualweb.designer.jsf.ui.*;
261.54 -import org.netbeans.modules.visualweb.gravy.properties.*;
261.55 -import java.awt.*;
261.56 -import org.netbeans.jemmy.ComponentChooser;
261.57 -import org.netbeans.jemmy.operators.*;
261.58 -import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
261.59 -import org.netbeans.jellytools.Bundle;
261.60 -import org.netbeans.modules.visualweb.designer.html.HtmlAttribute;
261.61 -import com.sun.rave.designtime.DesignBean;
261.62 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
261.63 -import org.openide.windows.TopComponent;
261.64 -import org.netbeans.jemmy.QueueTool;
261.65 -import org.netbeans.modules.visualweb.api.designer.DomProvider;
261.66 -
261.67 -/**
261.68 - * This class implements test functionality for the Design View of a project web-page.
261.69 - */
261.70 -public class DesignerPaneOperator extends JComponentOperator {
261.71 - private static final String
261.72 - DESIGNER_BUTTON_DESIGN = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.project.jsfloader.Bundle", "CTL_DesignerTabCaption"),//"Design"
261.73 - DESIGNER_BUTTON_JSP = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.project.jsfloader.Bundle","CTL_JspTabCaption"),//"JSP",
261.74 - DESIGNER_BUTTON_JAVA = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.project.jsfloader.Bundle","CTL_JavaTabCaption");//"Java";
261.75 -
261.76 - protected static String defaultPalette="JSFSTD";
261.77 - protected String currentPalette=defaultPalette;
261.78 -
261.79 - /**
261.80 - * Creates a new instance of this class
261.81 - * @param cont an object ContainerOperator related to container, which
261.82 - * includes window of web-page.
261.83 - */
261.84 - public DesignerPaneOperator(ContainerOperator cont) {
261.85 - super(cont, new DesignerPaneChooser());
261.86 - }
261.87 -
261.88 - /**
261.89 - * Creates a new instance of this class
261.90 - * @param cont an object ContainerOperator related to container, which
261.91 - * includes window of web-page.
261.92 - * @param index a number of desired component if container includes several
261.93 - * similar components
261.94 - */
261.95 - public DesignerPaneOperator(ContainerOperator cont, int index) {
261.96 - super(cont, new DesignerPaneChooser(), index);
261.97 - }
261.98 -
261.99 - /**
261.100 - * Creates a new instance of this class
261.101 - */
261.102 - public DesignerPaneOperator() {
261.103 - this(RaveWindowOperator.getDefaultRave());
261.104 - }
261.105 -
261.106 - /**
261.107 - * Returns a Design View of a project web-page.
261.108 - * @return an object ContainerOperator
261.109 - */
261.110 - public ContainerOperator getDesignerView() {
261.111 - return(new ContainerOperator(getContainer(new Operator.Finder(JsfTopComponent.class))));
261.112 - }
261.113 -
261.114 - /**
261.115 - * Returns a center coordinate of component, placed on Design View.
261.116 - * @param comp_id a component identifier
261.117 - * @return an object Point
261.118 - */
261.119 - public Point getComponentCenter(String comp_id) {
261.120 - CssBox box = getCssBox(getDesignBean(comp_id));
261.121 - if (box != null) {
261.122 - return (new Point(box.getAbsoluteX(), box.getAbsoluteY()));
261.123 - }
261.124 - return null;
261.125 - }
261.126 -
261.127 - /**
261.128 - * Returns a coordinate of component top-left corner, placed on Design View.
261.129 - * @param componentID a component identifier
261.130 - * @return an object Point
261.131 - */
261.132 - public Point getComponentLocation(String componentID) {
261.133 - Rectangle compRect = getComponentRectangle(componentID);
261.134 - if (compRect != null) {
261.135 - return (compRect.getLocation());
261.136 - }
261.137 - return null;
261.138 - }
261.139 -
261.140 - /**
261.141 - * Returns measurements of a component, placed on Design View.
261.142 - * @param componentID a component identifier
261.143 - * @return an object Rectangle
261.144 - */
261.145 - public Rectangle getComponentRectangle(String componentID) {
261.146 - CssBox box = getCssBox(getDesignBean(componentID));
261.147 - if (box != null) {
261.148 - return (box.getExtentsRectangle());
261.149 - }
261.150 - return null;
261.151 - }
261.152 -
261.153 - private DesignBean getDesignBean(String componentID) {
261.154 - if ((componentID == null) || (componentID.length() < 1)) return null;
261.155 -
261.156 - DesignerPane designerPane = (DesignerPane) getSource();
261.157 -// DesignBean bean =
261.158 -// designerPane.getWebForm().getModel().getLiveUnit().getBeanByName(
261.159 -// componentID);
261.160 -// org.openide.filesystems.FileObject jspFileObject = designerPane.getWebForm().getJspDataObject().getPrimaryFile();
261.161 - WebForm webForm = designerPane.getWebForm();
261.162 - DomProvider domProvider = webForm.getDomProvider();
261.163 - JsfForm jsfForm = JsfForm.findJsfFormForDomProvider(domProvider);
261.164 - org.openide.filesystems.FileObject jspFileObject = jsfForm.getJspDataObject().getPrimaryFile();
261.165 - org.netbeans.modules.visualweb.insync.models.FacesModel facesModel = org.netbeans.modules.visualweb.insync.models.FacesModel.getInstance(jspFileObject);
261.166 - DesignBean bean = facesModel.getLiveUnit().getBeanByName(componentID);
261.167 - return bean;
261.168 - }
261.169 -
261.170 - private CssBox getCssBox(DesignBean designBean) {
261.171 - if (designBean == null) return null;
261.172 - DesignerPane designerPane = (DesignerPane) getSource();
261.173 - /*
261.174 - CssBox cssBox = ModelViewMapper.findBox(designerPane.getPageBox(), designBean);
261.175 - //designerPane.getWebForm().getMapper().findBox(designBean);
261.176 - */
261.177 - WebForm webForm = designerPane.getWebForm();
261.178 - CssBox cssBox = ModelViewMapper.findBox(webForm.getPane().getPageBox(),
261.179 - webForm.getSelection().getSelectedComponentRootElements()[0]);
261.180 - return cssBox;
261.181 - }
261.182 -
261.183 - /**
261.184 - * Invokes a popup menu, related to a component, placed on Design View.
261.185 - * @param comp_id a component identifier
261.186 - */
261.187 - public void clickForPopup(String comp_id){
261.188 - Point p=getComponentCenter(comp_id);
261.189 - clickForPopup(p.x,p.y);
261.190 - }
261.191 -
261.192 - /**
261.193 - * Clicks mouse on a component, placed on Design View.
261.194 - * @param comp_id a component identifier
261.195 - * @param clickCount a number of clicks
261.196 - */
261.197 - public void clickMouse(String comp_id, int clickCount){
261.198 - Point p=getComponentCenter(comp_id);
261.199 - clickMouse(p.x,p.y,clickCount);
261.200 - }
261.201 -
261.202 - /**
261.203 - * Selects a component on Design View.
261.204 - * @param comp_id a component identifier
261.205 - */
261.206 - public void select(String comp_id){
261.207 - Point p=getComponentCenter(comp_id);
261.208 - clickMouse(p.x,p.y,1);
261.209 - }
261.210 -
261.211 - public static class DesignerPaneChooser implements ComponentChooser {
261.212 - public boolean checkComponent(Component comp) {
261.213 - return(comp instanceof org.netbeans.modules.visualweb.designer.DesignerPane);
261.214 - }
261.215 - public String getDescription() {
261.216 - return(DesignerPane.class.getName());
261.217 - }
261.218 - }
261.219 -
261.220 - /**
261.221 - * Adds a component on Design View.
261.222 - * @param component a component name
261.223 - * @param x coordinate x of top-left component corner on Design View
261.224 - * @param y coordinate y of top-left component corner on Design View
261.225 - */
261.226 - public void addComponent(String component, int x, int y) {
261.227 - addComponent(component,x,y,null,null);
261.228 - }
261.229 -
261.230 - /**
261.231 - * Adds a component on Design View.
261.232 - * @param component a component name
261.233 - * @param x coordinate x of top-left component corner on Design View
261.234 - * @param y coordinate y of top-left component corner on Design View
261.235 - * @param id a name of modified component property
261.236 - * @param value a value of modified component property
261.237 - */
261.238 - public void addComponent(String component, int x, int y, String id, String value) {
261.239 - addComponentFromPalette(component,x,y,id,value,currentPalette);
261.240 - }
261.241 -
261.242 - /**
261.243 - * Sets a component palette used by default.
261.244 - * @param palName a palette name
261.245 - */
261.246 - public static void setDefaultPalette(String palName){
261.247 - defaultPalette=palName;
261.248 - }
261.249 -
261.250 - /**
261.251 - * Sets a component palette "BraveHeart" as a default palette.
261.252 - */
261.253 - public static void setDefaultBraveHeartPalette(){
261.254 - defaultPalette="Basic";
261.255 - }
261.256 -
261.257 - /**
261.258 - * Sets a component palette "Standard" as a default palette.
261.259 - */
261.260 - public static void setDefaultStandardPalette(){
261.261 - defaultPalette="JSFSTD";
261.262 - }
261.263 -
261.264 - /**
261.265 - * Sets a current component palette.
261.266 - * @param palName a palette name
261.267 - */
261.268 - public void setPalette(String palName){
261.269 - currentPalette=palName;
261.270 - }
261.271 -
261.272 - /**
261.273 - * Sets a component palette "BraveHeart" as a current palette.
261.274 - */
261.275 - public void setBraveHeartPalette(){
261.276 - setPalette("Basic");
261.277 - }
261.278 -
261.279 - /**
261.280 - * Sets a component palette "Standard" as a current palette.
261.281 - */
261.282 - public void setStandardPalette(){
261.283 - setPalette("JSFSTD");
261.284 - }
261.285 -
261.286 - /**
261.287 - * Adds a component on Design View.
261.288 - * @param component a component name
261.289 - * @param x coordinate x of top-left component corner on Design View
261.290 - * @param y coordinate y of top-left component corner on Design View
261.291 - * @param id a name of modified component property
261.292 - * @param value a value of modified component property
261.293 - * @param palName a palette name
261.294 - */
261.295 - public void addComponentFromPalette(String component, int x, int y, String id, String value, String palName) {
261.296 -
261.297 - // Wait for the Portfolio to appear
261.298 - Util.wait(2000);
261.299 - PaletteContainerOperator palette = PaletteContainerOperator.showPalette(Bundle.getStringTrimmed("com.sun.rave.toolbox.Bundle", "COMPONENTS"), palName);
261.300 -
261.301 - System.out.println("======================================================================");
261.302 - System.out.println(palName + " Components");
261.303 - System.out.println("======================================================================");
261.304 - // workaround for CR 6258411
261.305 - Point clickPoint = palette.getClickPoint(component);
261.306 - new QueueTool().waitEmpty();
261.307 - palette.getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
261.308 - Util.wait(300);
261.309 -
261.310 - palette.addComponent(component, this, new Point(x, y));
261.311 -
261.312 - //@todo This is temporary - remove after Rave bug will be fixed
261.313 - //select component
261.314 - //clickMouse(1,1,1);
261.315 - //clickMouse(x,y,1);
261.316 -
261.317 - Util.wait(1000);
261.318 -
261.319 - // Change properties
261.320 -
261.321 - SheetTableOperator props = new SheetTableOperator();
261.322 - if (id!=null){
261.323 - props.setTextValue("id",id);
261.324 - Util.wait(1000);
261.325 - }
261.326 - if (value!=null){
261.327 - props.setTextValue("value",value);
261.328 - Util.wait(1000);
261.329 - }
261.330 -
261.331 - }
261.332 -
261.333 - /**
261.334 - * Switch to JSP Editor of web-page.
261.335 - */
261.336 - public static void switchToJSPSource() {
261.337 - switchToSource(DESIGNER_BUTTON_JSP);
261.338 - }
261.339 -
261.340 - /**
261.341 - * Switch to Java Editor of web-page.
261.342 - */
261.343 - public static void switchToJavaSource() {
261.344 - switchToSource(DESIGNER_BUTTON_JAVA);
261.345 - }
261.346 -
261.347 - /**
261.348 - * Switch to Design View of web-page.
261.349 - */
261.350 - public static void switchToDesignerPane() {
261.351 - switchToSource(DESIGNER_BUTTON_DESIGN);
261.352 - }
261.353 -
261.354 - private static void switchToSource(String toggleButtonText) {
261.355 - //org.netbeans.jellytools.TopComponentOperator topComponent =
261.356 - //new org.netbeans.jellytools.TopComponentOperator("Page1.jsp");
261.357 - // new org.netbeans.jellytools.TopComponentOperator(Util.getMainWindow());
261.358 - //Util.wait(1000);
261.359 - JToggleButtonOperator toggleButton = new JToggleButtonOperator(Util.getMainWindow(),
261.360 - toggleButtonText);
261.361 - Util.wait(1000);
261.362 - toggleButton.setSelected(true);
261.363 - Util.wait(1000);
261.364 - }
261.365 -
261.366 - /**
261.367 - * Extracts and returns a coordinate of a component from a window "Properties".
261.368 - * @return an object Point
261.369 - */
261.370 - public Point getCoords() {
261.371 -
261.372 - PropertySheetOperator pso = new PropertySheetOperator(Util.getMainWindow());
261.373 - PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
261.374 - // set a new comparator which should find the required property by performing
261.375 - // a strictly comparison of a property name with a given pattern
261.376 - psto.setComparator(new Operator.DefaultStringComparator(true, true));
261.377 -
261.378 - // Name of the property is style
261.379 - Property pr = new Property(psto, "style" /* Bundle.getResourceString("CSS_Style") */);
261.380 - String propValue = pr.getValue();
261.381 -
261.382 - //value of style property (example) = position: absolute; left: 288px; top: 96px
261.383 -
261.384 - int xLoc = HtmlAttribute.parseInt(propValue.substring(propValue.indexOf("left: ") + 6));
261.385 - int yLoc = HtmlAttribute.parseInt(propValue.substring(propValue.indexOf("top: ") + 5));
261.386 - // int xLoc = new Integer(propValue.substring(propValue.indexOf("left: ")+6,propValue.indexOf("px;"))).intValue();
261.387 - // int yLoc = new Integer(propValue.substring(propValue.indexOf("top: ")+5,propValue.indexOf("px; position:"))).intValue();
261.388 -
261.389 - return new Point(xLoc, yLoc);
261.390 - }
261.391 -
261.392 - public void makeComponentVisible() {
261.393 - TopComponent theComponent = (TopComponent)findContainerUnder(getSource(), new ComponentChooser() {
261.394 - public boolean checkComponent(Component comp) {
261.395 - return(comp instanceof TopComponent);
261.396 - }
261.397 - public String getDescription() {
261.398 - return("TopComponent");
261.399 - }
261.400 - });
261.401 -
261.402 - final TopComponent topComponent = theComponent;
261.403 - try {
261.404 - javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
261.405 - public void run() {
261.406 - String topComponentString =
261.407 - org.openide.windows.WindowManager.getDefault().findTopComponentID(topComponent);
261.408 - System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++");
261.409 - System.out.println(topComponentString);
261.410 - System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++");
261.411 - }
261.412 - });
261.413 - } catch (Exception e) {
261.414 - e.printStackTrace();
261.415 - }
261.416 - new org.netbeans.jellytools.TopComponentOperator(theComponent).makeComponentVisible();
261.417 - super.makeComponentVisible();
261.418 - }
261.419 -
261.420 - /**
261.421 - * Sets an image to a component via Image customizer.
261.422 - * @param componentID a component identifier
261.423 - * @param imagePath a path to an image file
261.424 - */
261.425 - public void setImage(String componentID, String imagePath) {
261.426 - clickForPopup(componentID); // this api not working 6/1/06
261.427 - Util.wait(500);
261.428 - new JPopupMenuOperator().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "DesignerMenuItem_SetImage"));
261.429 - JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "DesignerMenuItem_SetImage" ));
261.430 - JTextFieldOperator tf_Name = new JTextFieldOperator(dialog, 0);
261.431 - tf_Name.setText(imagePath);
261.432 - Util.wait(1000);
261.433 - new JButtonOperator(dialog, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "OK")).pushNoBlock();
261.434 - dialog.waitClosed();
261.435 - Util.wait(1000);
261.436 - }
261.437 -
261.438 - /**
261.439 - * Sets an image to a component via Image customizer.
261.440 - * @param x coordinate x of top-left component corner on Design View
261.441 - * @param y coordinate y of top-left component corner on Design View
261.442 - * @param imagePath a path to an image file
261.443 - */
261.444 - public void setImage(int x, int y, String imagePath) {
261.445 - clickForPopup(x, y);
261.446 - Util.wait(500);
261.447 - new JPopupMenuOperator().pushMenuNoBlock(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "DesignerMenuItem_SetImage"));
261.448 - JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "Dialog_ImageCustomizer" ));
261.449 - (new JTextFieldOperator(dialog, 0)).enterText(imagePath);
261.450 - Util.wait(1000);
261.451 - new JButtonOperator(dialog, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle", "Button_OK")).pushNoBlock();
261.452 - dialog.waitClosed();
261.453 - Util.wait(1000);
261.454 - }
261.455 -}
262.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/designer/GeneralTableLayoutOperator.java Thu Jul 10 04:29:52 2008 -0700
262.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
262.3 @@ -1,326 +0,0 @@
262.4 -/*
262.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
262.6 -*
262.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
262.8 -*
262.9 -* The contents of this file are subject to the terms of either the GNU
262.10 -* General Public License Version 2 only ("GPL") or the Common
262.11 -* Development and Distribution License("CDDL") (collectively, the
262.12 -* "License"). You may not use this file except in compliance with the
262.13 -* License. You can obtain a copy of the License at
262.14 -* http://www.netbeans.org/cddl-gplv2.html
262.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
262.16 -* specific language governing permissions and limitations under the
262.17 -* License. When distributing the software, include this License Header
262.18 -* Notice in each file and include the License file at
262.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
262.20 -* particular file as subject to the "Classpath" exception as provided
262.21 -* by Sun in the GPL Version 2 section of the License file that
262.22 -* accompanied this code. If applicable, add the following below the
262.23 -* License Header, with the fields enclosed by brackets [] replaced by
262.24 -* your own identifying information:
262.25 -* "Portions Copyrighted [year] [name of copyright owner]"
262.26 -*
262.27 -* Contributor(s):
262.28 -*
262.29 -* The Original Software is NetBeans. The Initial Developer of the Original
262.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
262.31 -* Microsystems, Inc. All Rights Reserved.
262.32 -*
262.33 -* If you wish your version of this file to be governed by only the CDDL
262.34 -* or only the GPL Version 2, indicate your decision by adding
262.35 -* "[Contributor] elects to include this software in this distribution
262.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
262.37 -* single choice of license, a recipient has the option to distribute
262.38 -* your version of this file under either the CDDL, the GPL Version 2 or
262.39 -* to extend the choice of license to its licensees as provided above.
262.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
262.41 -* Version 2 license, then the option applies only if the new code is
262.42 -* made subject to such option by the copyright holder.
262.43 -*/
262.44 -
262.45 -package org.netbeans.modules.visualweb.gravy.designer;
262.46 -
262.47 -import org.netbeans.jellytools.Bundle;
262.48 -import org.netbeans.jellytools.NbDialogOperator;
262.49 -import org.netbeans.jemmy.JemmyException;
262.50 -import org.netbeans.jemmy.operators.*;
262.51 -
262.52 -/**
262.53 - * This abstract class implements test functionality for the dialog "Table Layout".
262.54 - */
262.55 -public abstract class GeneralTableLayoutOperator extends NbDialogOperator{
262.56 - /**
262.57 - * Constructor of this class.
262.58 - */
262.59 - public GeneralTableLayoutOperator(){
262.60 - super(getBundleString("tblLayout"));
262.61 - }
262.62 -
262.63 - private JTabbedPaneOperator _tbpLayout;
262.64 -
262.65 - private JButtonOperator _btApply;
262.66 - private JButtonOperator _btNew;
262.67 - private JButtonOperator _btUp;
262.68 - private JButtonOperator _btDown;
262.69 - private JButtonOperator _btAdd;
262.70 - private JButtonOperator _btRemove;
262.71 - private JButtonOperator _btRemoveAll;
262.72 - private JListOperator _lstAvailable;
262.73 - private JListOperator _lstDisplayed;
262.74 - private JTextFieldOperator _txtHeader;
262.75 - private JTextFieldOperator _txtFooter;
262.76 - private JTextFieldOperator _txtValue;
262.77 - protected JComboBoxOperator _cboSource;
262.78 - protected JComboBoxOperator _cboComponentType;
262.79 -
262.80 - /**
262.81 - * Initializes (if necessary) and returns an object JTabbedPaneOperator
262.82 - * for the dialog tabbed pane.
262.83 - * @return the appropriate object JTabbedPaneOperator
262.84 - */
262.85 - public JTabbedPaneOperator tbpLayout() {
262.86 - if (_tbpLayout==null) {
262.87 - _tbpLayout = new JTabbedPaneOperator(this);
262.88 - }
262.89 - return _tbpLayout;
262.90 - }
262.91 -
262.92 - /**
262.93 - * Initializes (if necessary) and returns an object JButtonOperator
262.94 - * for the dialog button "Apply".
262.95 - * @return the appropriate object JButtonOperator
262.96 - */
262.97 - public JButtonOperator btApply() {
262.98 - if (_btApply==null) {
262.99 - _btApply = new JButtonOperator(this, Bundle.getStringTrimmed("com.sun.jsfcl.binding.Bundle", "apply"));
262.100 - }
262.101 - return _btApply;
262.102 - }
262.103 -
262.104 - /**
262.105 - * Initializes (if necessary) and returns an object JButtonOperator
262.106 - * for the dialog button "New".
262.107 - * @return the appropriate object JButtonOperator
262.108 - */
262.109 - public JButtonOperator btNew() {
262.110 - if (_btNew==null) {
262.111 - _btNew = new JButtonOperator(this, getBundleString("new"));
262.112 - }
262.113 - return _btNew;
262.114 - }
262.115 -
262.116 - /**
262.117 - * Initializes (if necessary) and returns an object JButtonOperator
262.118 - * for the dialog button "Up".
262.119 - * @return the appropriate object JButtonOperator
262.120 - */
262.121 - public JButtonOperator btUp() {
262.122 - if (_btUp==null) {
262.123 - _btUp = new JButtonOperator(this, getBundleString("up"));
262.124 - }
262.125 - return _btUp;
262.126 - }
262.127 -
262.128 - /**
262.129 - * Initializes (if necessary) and returns an object JButtonOperator
262.130 - * for the dialog button "Down".
262.131 - * @return the appropriate object JButtonOperator
262.132 - */
262.133 - public JButtonOperator btDown() {
262.134 - if (_btDown==null) {
262.135 - _btDown = new JButtonOperator(this, getBundleString("down"));
262.136 - }
262.137 - return _btDown;
262.138 - }
262.139 -
262.140 - /**
262.141 - * Initializes (if necessary) and returns an object JButtonOperator
262.142 - * for the dialog button "Add".
262.143 - * @return the appropriate object JButtonOperator
262.144 - */
262.145 - public JButtonOperator btAdd() {
262.146 - if (_btAdd==null) {
262.147 - _btAdd = new JButtonOperator(this, ">");
262.148 - }
262.149 - return _btAdd;
262.150 - }
262.151 -
262.152 - /**
262.153 - * Initializes (if necessary) and returns an object JButtonOperator
262.154 - * for the dialog button "<".
262.155 - * @return the appropriate object JButtonOperator
262.156 - */
262.157 - public JButtonOperator btRemove() {
262.158 - if (_btRemove==null) {
262.159 - _btRemove = new JButtonOperator(this, "<");
262.160 - }
262.161 - return _btRemove;
262.162 - }
262.163 -
262.164 - /**
262.165 - * Initializes (if necessary) and returns an object JButtonOperator
262.166 - * for the dialog button "<<".
262.167 - * @return the appropriate object JButtonOperator
262.168 - */
262.169 - public JButtonOperator btRemoveAll() {
262.170 - if (_btRemoveAll==null) {
262.171 - _btRemoveAll = new JButtonOperator(this, "<<");
262.172 - }
262.173 - return _btRemoveAll;
262.174 - }
262.175 -
262.176 - /**
262.177 - * Initializes (if necessary) and returns an object JListOperator
262.178 - * for the dialog list "Available".
262.179 - * @return the appropriate object JListOperator
262.180 - */
262.181 - public JListOperator lstAvailable() {
262.182 - if (_lstAvailable==null) {
262.183 - _lstAvailable = new JListOperator(this,0);
262.184 - }
262.185 - return _lstAvailable;
262.186 - }
262.187 -
262.188 - /**
262.189 - * Initializes (if necessary) and returns an object JListOperator
262.190 - * for the dialog list "Displayed".
262.191 - * @return the appropriate object JListOperator
262.192 - */
262.193 - public JListOperator lstDisplayed() {
262.194 - if (_lstDisplayed==null) {
262.195 - _lstDisplayed = new JListOperator(this,1);
262.196 - }
262.197 - return _lstDisplayed;
262.198 - }
262.199 -
262.200 - /**
262.201 - * Initializes (if necessary) and returns an object JTextFieldOperator
262.202 - * for the dialog text field "Header".
262.203 - * @return the appropriate object JTextFieldOperator
262.204 - */
262.205 - public JTextFieldOperator txtHeader() {
262.206 - if (_txtHeader==null) {
262.207 - _txtHeader = new JTextFieldOperator(this, 0);
262.208 - }
262.209 - return _txtHeader;
262.210 - }
262.211 -
262.212 - /**
262.213 - * Initializes (if necessary) and returns an object JTextFieldOperator
262.214 - * for the dialog text field "Footer".
262.215 - * @return the appropriate object JTextFieldOperator
262.216 - */
262.217 - public JTextFieldOperator txtFooter() {
262.218 - if (_txtFooter==null) {
262.219 - _txtFooter = new JTextFieldOperator(this, 1);
262.220 - }
262.221 - return _txtFooter;
262.222 - }
262.223 -
262.224 - /**
262.225 - * Initializes (if necessary) and returns an object JTextFieldOperator
262.226 - * for the dialog text field "Value".
262.227 - * @return the appropriate object JTextFieldOperator
262.228 - */
262.229 - public JTextFieldOperator txtValue() {
262.230 - if (_txtValue==null) {
262.231 - _txtValue = new JTextFieldOperator(this, 2);
262.232 - }
262.233 - return _txtValue;
262.234 - }
262.235 -
262.236 - /**
262.237 - * Initializes (if necessary) and returns an object JComboBoxOperator
262.238 - * for the dialog drop-down list "Source".
262.239 - * @return the appropriate object JComboBoxOperator
262.240 - */
262.241 - public JComboBoxOperator cboSource() {
262.242 - if (_cboSource==null) {
262.243 - _cboSource = new JComboBoxOperator(this,0);
262.244 - }
262.245 - return _cboSource;
262.246 - }
262.247 -
262.248 - /**
262.249 - * Initializes (if necessary) and returns an object JComboBoxOperator
262.250 - * for the dialog drop-down list "Component Type".
262.251 - * @return the appropriate object JComboBoxOperator
262.252 - */
262.253 - public JComboBoxOperator cboComponentType() {
262.254 - if (_cboComponentType==null) {
262.255 - _cboComponentType = new JComboBoxOperator(this,1);
262.256 - }
262.257 - return _cboComponentType;
262.258 - }
262.259 -
262.260 - /**
262.261 - * Select the tab "Columns" in the tabbed pane.
262.262 - */
262.263 - public void selectColumnsTab(){
262.264 - tbpLayout().selectPage(getBundleString("cols"));
262.265 - }
262.266 -
262.267 - /**
262.268 - * Finds in a bundle file and returns an actual text of control component.
262.269 - * @param p_text string-key corresponding to required control component.
262.270 - * @return actual text of control component
262.271 - */
262.272 - public static String getBundleString(String p_text) {
262.273 - System.out.println("Getting bundle for " + p_text);
262.274 - try {
262.275 - return Bundle.getStringTrimmed("com.sun.jsfcl.std.table.Bundle", p_text);
262.276 - } catch (JemmyException e) {}
262.277 - return null;
262.278 - }
262.279 -
262.280 - /**
262.281 - * Initializes all necessary controls.
262.282 - */
262.283 - public void verify() {
262.284 - btOK();
262.285 - btApply();
262.286 - btCancel();
262.287 - btHelp();
262.288 -
262.289 - selectColumnsTab();
262.290 -
262.291 - btUp();
262.292 - btDown();
262.293 - btNew();
262.294 - btAdd();
262.295 - btRemove();
262.296 - btRemoveAll();
262.297 - lstAvailable();
262.298 - lstDisplayed();
262.299 - txtFooter();
262.300 - txtValue();
262.301 - cboSource();
262.302 - cboComponentType();
262.303 - }
262.304 -
262.305 - /**
262.306 - * Adds new column to the table.
262.307 - * @param column a column name
262.308 - */
262.309 - public void addColumn(String column){
262.310 - lstAvailable().selectItem(column);
262.311 - btAdd().push();
262.312 - }
262.313 -
262.314 - /**
262.315 - * Removes a column from the table.
262.316 - * @param column a column name
262.317 - */
262.318 - public void removeColumn(String column){
262.319 - lstDisplayed().selectItem(column);
262.320 - btRemove().push();
262.321 - }
262.322 -
262.323 - /**
262.324 - * Removes all columns from the table.
262.325 - */
262.326 - public void removeAllColumns(){
262.327 - btRemoveAll().push();
262.328 - }
262.329 -}
263.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/designer/TableLayoutOperator.java Thu Jul 10 04:29:52 2008 -0700
263.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
263.3 @@ -1,342 +0,0 @@
263.4 -/*
263.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
263.6 -*
263.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
263.8 -*
263.9 -* The contents of this file are subject to the terms of either the GNU
263.10 -* General Public License Version 2 only ("GPL") or the Common
263.11 -* Development and Distribution License("CDDL") (collectively, the
263.12 -* "License"). You may not use this file except in compliance with the
263.13 -* License. You can obtain a copy of the License at
263.14 -* http://www.netbeans.org/cddl-gplv2.html
263.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
263.16 -* specific language governing permissions and limitations under the
263.17 -* License. When distributing the software, include this License Header
263.18 -* Notice in each file and include the License file at
263.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
263.20 -* particular file as subject to the "Classpath" exception as provided
263.21 -* by Sun in the GPL Version 2 section of the License file that
263.22 -* accompanied this code. If applicable, add the following below the
263.23 -* License Header, with the fields enclosed by brackets [] replaced by
263.24 -* your own identifying information:
263.25 -* "Portions Copyrighted [year] [name of copyright owner]"
263.26 -*
263.27 -* Contributor(s):
263.28 -*
263.29 -* The Original Software is NetBeans. The Initial Developer of the Original
263.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
263.31 -* Microsystems, Inc. All Rights Reserved.
263.32 -*
263.33 -* If you wish your version of this file to be governed by only the CDDL
263.34 -* or only the GPL Version 2, indicate your decision by adding
263.35 -* "[Contributor] elects to include this software in this distribution
263.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
263.37 -* single choice of license, a recipient has the option to distribute
263.38 -* your version of this file under either the CDDL, the GPL Version 2 or
263.39 -* to extend the choice of license to its licensees as provided above.
263.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
263.41 -* Version 2 license, then the option applies only if the new code is
263.42 -* made subject to such option by the copyright holder.
263.43 -*/
263.44 -
263.45 -package org.netbeans.modules.visualweb.gravy.designer;
263.46 -
263.47 -import org.netbeans.jellytools.Bundle;
263.48 -import org.netbeans.jellytools.NbDialogOperator;
263.49 -import org.netbeans.jemmy.JemmyException;
263.50 -import org.netbeans.jemmy.operators.*;
263.51 -
263.52 -/**
263.53 - * This class implements test functionality for the dialog "Table Layout".
263.54 - */
263.55 -public class TableLayoutOperator extends GeneralTableLayoutOperator{
263.56 - /**
263.57 - * Creates an instance of this class.
263.58 - */
263.59 - public TableLayoutOperator(){
263.60 - super();
263.61 - }
263.62 -
263.63 - /**
263.64 - * Creates and returns an instance of this class via using
263.65 - * the appropriate item of a poup menu.
263.66 - * @param menu a popup menu, related to a table
263.67 - * @return a new created object TableLayoutOperator
263.68 - */
263.69 - public static TableLayoutOperator invoke(JPopupMenuOperator menu){
263.70 - menu.pushMenuNoBlock("tblLayoutEllipse");
263.71 - return new TableLayoutOperator();
263.72 - }
263.73 -
263.74 - private JButtonOperator _btBrowseFirst;
263.75 - private JButtonOperator _btBrowsePrevious;
263.76 - private JButtonOperator _btBrowseNext;
263.77 - private JButtonOperator _btBrowseLast;
263.78 - private JTextFieldOperator _txtPageSize;
263.79 - private JTextFieldOperator _txtFirst;
263.80 - private JTextFieldOperator _txtPrevious;
263.81 - private JTextFieldOperator _txtNext;
263.82 - private JTextFieldOperator _txtLast;
263.83 - private JComboBoxOperator _cboPosition;
263.84 - private JComboBoxOperator _cboAlignment;
263.85 - private JComboBoxOperator _cboNavigation;
263.86 - private JCheckBoxOperator _cbEnable;
263.87 - private JCheckBoxOperator _cbFirst;
263.88 - private JCheckBoxOperator _cbPrevious;
263.89 - private JCheckBoxOperator _cbNext;
263.90 - private JCheckBoxOperator _cbLast;
263.91 -
263.92 - /**
263.93 - * Initializes (if necessary) and returns an object JButtonOperator
263.94 - * for the dialog button "<<".
263.95 - * @return the appropriate object JButtonOperator
263.96 - */
263.97 - public JButtonOperator btBrowseFirst() {
263.98 - if (_btBrowseFirst==null) {
263.99 - _btBrowseFirst = new JButtonOperator(this, getBundleString("browseEllipse"),0);
263.100 - }
263.101 - return _btBrowseFirst;
263.102 - }
263.103 -
263.104 - /**
263.105 - * Initializes (if necessary) and returns an object JButtonOperator
263.106 - * for the dialog button "<".
263.107 - * @return the appropriate object JButtonOperator
263.108 - */
263.109 - public JButtonOperator btBrowsePrevious() {
263.110 - if (_btBrowsePrevious==null) {
263.111 - _btBrowsePrevious = new JButtonOperator(this, getBundleString("browseEllipse"),1);
263.112 - }
263.113 - return _btBrowsePrevious;
263.114 - }
263.115 -
263.116 - /**
263.117 - * Initializes (if necessary) and returns an object JButtonOperator
263.118 - * for the dialog button ">".
263.119 - * @return the appropriate object JButtonOperator
263.120 - */
263.121 - public JButtonOperator btBrowseNext() {
263.122 - if (_btBrowseNext==null) {
263.123 - _btBrowseNext = new JButtonOperator(this, getBundleString("browseEllipse"),2);
263.124 - }
263.125 - return _btBrowseNext;
263.126 - }
263.127 -
263.128 - /**
263.129 - * Initializes (if necessary) and returns an object JButtonOperator
263.130 - * for the dialog button ">>".
263.131 - * @return the appropriate object JButtonOperator
263.132 - */
263.133 - public JButtonOperator btBrowseLast() {
263.134 - if (_btBrowseLast==null) {
263.135 - _btBrowseLast = new JButtonOperator(this, getBundleString("browseEllipse"),3);
263.136 - }
263.137 - return _btBrowseLast;
263.138 - }
263.139 -
263.140 - /**
263.141 - * Initializes (if necessary) and returns an object JTextFieldOperator
263.142 - * for the dialog text field "Page Size".
263.143 - * @return the appropriate object JTextFieldOperator
263.144 - */
263.145 - public JTextFieldOperator txtPageSize() {
263.146 - if (_txtPageSize==null) {
263.147 - _txtPageSize = new JTextFieldOperator(this, 0);
263.148 - }
263.149 - return _txtPageSize;
263.150 - }
263.151 -
263.152 - /**
263.153 - * Initializes (if necessary) and returns an object JTextFieldOperator
263.154 - * for the dialog text field "First".
263.155 - * @return the appropriate object JTextFieldOperator
263.156 - */
263.157 - public JTextFieldOperator txtFirst() {
263.158 - if (_txtFirst==null) {
263.159 - _txtFirst = new JTextFieldOperator(this, 1);
263.160 - }
263.161 - return _txtFirst;
263.162 - }
263.163 -
263.164 - /**
263.165 - * Initializes (if necessary) and returns an object JTextFieldOperator
263.166 - * for the dialog text field "Previous".
263.167 - * @return the appropriate object JTextFieldOperator
263.168 - */
263.169 - public JTextFieldOperator txtPrevious() {
263.170 - if (_txtPrevious==null) {
263.171 - _txtPrevious = new JTextFieldOperator(this, 2);
263.172 - }
263.173 - return _txtPrevious;
263.174 - }
263.175 -
263.176 - /**
263.177 - * Initializes (if necessary) and returns an object JTextFieldOperator
263.178 - * for the dialog text field "Next".
263.179 - * @return the appropriate object JTextFieldOperator
263.180 - */
263.181 - public JTextFieldOperator txtNext() {
263.182 - if (_txtNext==null) {
263.183 - _txtNext = new JTextFieldOperator(this, 3);
263.184 - }
263.185 - return _txtNext;
263.186 - }
263.187 -
263.188 - /**
263.189 - * Initializes (if necessary) and returns an object JTextFieldOperator
263.190 - * for the dialog text field "Last".
263.191 - * @return the appropriate object JTextFieldOperator
263.192 - */
263.193 - public JTextFieldOperator txtLast() {
263.194 - if (_txtLast==null) {
263.195 - _txtLast = new JTextFieldOperator(this, 4);
263.196 - }
263.197 - return _txtLast;
263.198 - }
263.199 -
263.200 - /**
263.201 - * Initializes (if necessary) and returns an object JCheckBoxOperator
263.202 - * for the dialog check-box "Enable".
263.203 - * @return the appropriate object JCheckBoxOperator
263.204 - */
263.205 - public JCheckBoxOperator cbEnable() {
263.206 - if (_cbEnable==null) {
263.207 - _cbEnable = new JCheckBoxOperator(this, getBundleString("enablePaging"));
263.208 - }
263.209 - return _cbEnable;
263.210 - }
263.211 -
263.212 - /**
263.213 - * Initializes (if necessary) and returns an object JCheckBoxOperator
263.214 - * for the dialog check-box "First".
263.215 - * @return the appropriate object JCheckBoxOperator
263.216 - */
263.217 - public JCheckBoxOperator cbFirst() {
263.218 - if (_cbFirst==null) {
263.219 - _cbFirst = new JCheckBoxOperator(this, getBundleString("firstPage"));
263.220 - }
263.221 - return _cbFirst;
263.222 - }
263.223 -
263.224 - /**
263.225 - * Initializes (if necessary) and returns an object JCheckBoxOperator
263.226 - * for the dialog check-box "Previous".
263.227 - * @return the appropriate object JCheckBoxOperator
263.228 - */
263.229 - public JCheckBoxOperator cbPrevious() {
263.230 - if (_cbPrevious==null) {
263.231 - _cbPrevious = new JCheckBoxOperator(this, getBundleString("prevPage"));
263.232 - }
263.233 - return _cbPrevious;
263.234 - }
263.235 -
263.236 - /**
263.237 - * Initializes (if necessary) and returns an object JCheckBoxOperator
263.238 - * for the dialog check-box "Next".
263.239 - * @return the appropriate object JCheckBoxOperator
263.240 - */
263.241 - public JCheckBoxOperator cbNext() {
263.242 - if (_cbNext==null) {
263.243 - _cbNext = new JCheckBoxOperator(this, getBundleString("nextPage"));
263.244 - }
263.245 - return _cbNext;
263.246 - }
263.247 -
263.248 - /**
263.249 - * Initializes (if necessary) and returns an object JCheckBoxOperator
263.250 - * for the dialog check-box "Last".
263.251 - * @return the appropriate object JCheckBoxOperator
263.252 - */
263.253 - public JCheckBoxOperator cbLast() {
263.254 - if (_cbLast==null) {
263.255 - _cbLast = new JCheckBoxOperator(this, getBundleString("lastPage"));
263.256 - }
263.257 - return _cbLast;
263.258 - }
263.259 -
263.260 - /**
263.261 - * Initializes (if necessary) and returns an object JComboBoxOperator
263.262 - * for the dialog drop-down list "Navigation".
263.263 - * @return the appropriate object JComboBoxOperator
263.264 - */
263.265 - public JComboBoxOperator cboNavigation() {
263.266 - if (_cboNavigation==null) {
263.267 - _cboNavigation = new JComboBoxOperator(this,0);
263.268 - }
263.269 - return _cboNavigation;
263.270 - }
263.271 -
263.272 - /**
263.273 - * Initializes (if necessary) and returns an object JComboBoxOperator
263.274 - * for the dialog drop-down list "Position".
263.275 - * @return the appropriate object JComboBoxOperator
263.276 - */
263.277 - public JComboBoxOperator cboPosition() {
263.278 - if (_cboPosition==null) {
263.279 - _cboPosition = new JComboBoxOperator(this,1);
263.280 - }
263.281 - return _cboPosition;
263.282 - }
263.283 -
263.284 - /**
263.285 - * Initializes (if necessary) and returns an object JComboBoxOperator
263.286 - * for the dialog drop-down list "Alignment".
263.287 - * @return the appropriate object JComboBoxOperator
263.288 - */
263.289 - public JComboBoxOperator cboAlignment() {
263.290 - if (_cboAlignment==null) {
263.291 - _cboAlignment = new JComboBoxOperator(this,2);
263.292 - }
263.293 - return _cboAlignment;
263.294 - }
263.295 -
263.296 - /**
263.297 - * Select the tab "Paging" in the tabbed pane.
263.298 - */
263.299 - public void selectPagingTab(){
263.300 - tbpLayout().selectPage(getBundleString("paging"));
263.301 - }
263.302 -
263.303 - /**
263.304 - * Initializes all necessary controls.
263.305 - */
263.306 - public void verify() {
263.307 -
263.308 - super.verify();
263.309 -
263.310 - selectPagingTab();
263.311 -
263.312 - btBrowseFirst();
263.313 - btBrowsePrevious();
263.314 - btBrowseNext();
263.315 - btBrowseLast();
263.316 - cboNavigation();
263.317 - cboPosition();
263.318 - cboAlignment();
263.319 - cbEnable();
263.320 - cbFirst();
263.321 - cbPrevious();
263.322 - cbNext();
263.323 - cbLast();
263.324 - txtPageSize();
263.325 - txtFirst();
263.326 - txtPrevious();
263.327 - txtNext();
263.328 - txtLast();
263.329 -
263.330 - selectColumnsTab();
263.331 - }
263.332 -
263.333 - /**
263.334 - * Finds in a bundle file and returns an actual text of control component.
263.335 - * @param p_text string-key corresponding to required control component.
263.336 - * @return actual text of control component
263.337 - */
263.338 - public static String getBundleString(String p_text) {
263.339 - System.out.println("Getting bundle for " + p_text);
263.340 - try {
263.341 - return Bundle.getStringTrimmed("com.sun.jsfcl.std.table.Bundle", p_text);
263.342 - } catch (JemmyException e) {}
263.343 - return null;
263.344 - }
263.345 -}
264.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/designer/TrayOperator.java Thu Jul 10 04:29:52 2008 -0700
264.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
264.3 @@ -1,145 +0,0 @@
264.4 -/*
264.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
264.6 -*
264.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
264.8 -*
264.9 -* The contents of this file are subject to the terms of either the GNU
264.10 -* General Public License Version 2 only ("GPL") or the Common
264.11 -* Development and Distribution License("CDDL") (collectively, the
264.12 -* "License"). You may not use this file except in compliance with the
264.13 -* License. You can obtain a copy of the License at
264.14 -* http://www.netbeans.org/cddl-gplv2.html
264.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
264.16 -* specific language governing permissions and limitations under the
264.17 -* License. When distributing the software, include this License Header
264.18 -* Notice in each file and include the License file at
264.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
264.20 -* particular file as subject to the "Classpath" exception as provided
264.21 -* by Sun in the GPL Version 2 section of the License file that
264.22 -* accompanied this code. If applicable, add the following below the
264.23 -* License Header, with the fields enclosed by brackets [] replaced by
264.24 -* your own identifying information:
264.25 -* "Portions Copyrighted [year] [name of copyright owner]"
264.26 -*
264.27 -* Contributor(s):
264.28 -*
264.29 -* The Original Software is NetBeans. The Initial Developer of the Original
264.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
264.31 -* Microsystems, Inc. All Rights Reserved.
264.32 -*
264.33 -* If you wish your version of this file to be governed by only the CDDL
264.34 -* or only the GPL Version 2, indicate your decision by adding
264.35 -* "[Contributor] elects to include this software in this distribution
264.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
264.37 -* single choice of license, a recipient has the option to distribute
264.38 -* your version of this file under either the CDDL, the GPL Version 2 or
264.39 -* to extend the choice of license to its licensees as provided above.
264.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
264.41 -* Version 2 license, then the option applies only if the new code is
264.42 -* made subject to such option by the copyright holder.
264.43 -*/
264.44 -
264.45 -package org.netbeans.modules.visualweb.gravy.designer;
264.46 -
264.47 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
264.48 -import org.netbeans.jemmy.operators.JLabelOperator;
264.49 -import org.netbeans.jemmy.operators.JButtonOperator;
264.50 -import org.netbeans.jemmy.operators.JTreeOperator;
264.51 -import org.netbeans.jemmy.TimeoutExpiredException;
264.52 -import java.awt.*;
264.53 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
264.54 -import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
264.55 -import org.netbeans.modules.visualweb.gravy.TestUtils;
264.56 -import org.netbeans.modules.visualweb.gravy.Util;
264.57 -import org.netbeans.modules.visualweb.gravy.nodes.Node;
264.58 -
264.59 -/**
264.60 - * This class implements test functionality for the window "Tray".
264.61 - */
264.62 -public class TrayOperator extends DocumentOutlineOperator{
264.63 - /**
264.64 - * Creates an instance of this class.
264.65 - */
264.66 - public TrayOperator(){
264.67 - super(RaveWindowOperator.getDefaultRave());
264.68 - }
264.69 -
264.70 - private JTreeOperator rowsetTreeOperator=null;
264.71 -
264.72 - /**
264.73 - * Initializes (if necessary) and returns an object JTreeOperator
264.74 - * for the rowset tree.
264.75 - * @return the appropriate object JTreeOperator
264.76 - */
264.77 - public JTreeOperator getRowsetTreeOperator() {
264.78 - if (rowsetTreeOperator == null) {
264.79 - rowsetTreeOperator = new JTreeOperator(this,1);
264.80 - }
264.81 - return rowsetTreeOperator;
264.82 - }
264.83 -
264.84 - private void clickSessionBean(){
264.85 - JTreeOperator tree = getStructTreeOperator();
264.86 - tree.expandPath(tree.findPath("SessionBean1"));
264.87 - }
264.88 -
264.89 - private void pushRowSetPopup_(String rowSetName, String menu) {
264.90 - getRowsetTreeOperator().callPopupOnPath(getRowsetTreeOperator().findPath(new String[]{rowSetName},false,false));
264.91 - new JPopupMenuOperator().pushMenuNoBlock(menu);
264.92 - }
264.93 -
264.94 - private void selectRowSet_(String rowSetName){
264.95 - getRowsetTreeOperator().selectPath(getRowsetTreeOperator().findPath(new String[]{rowSetName},false,false));
264.96 - }
264.97 -
264.98 - private void openRowSet_(String rowSetName){
264.99 - DocumentOutlineOperator doo = new DocumentOutlineOperator(Util.getMainWindow());
264.100 - doo.makeComponentVisible();
264.101 - Node node = new Node(doo.getStructTreeOperator(), "SessionBean1|"+rowSetName);
264.102 - node.callPopup().pushMenu("Edit SQL Statement");
264.103 - Util.wait(3000);
264.104 -
264.105 - //getRowsetTreeOperator().clickOnPath(getRowsetTreeOperator().findPath(new String[]{rowSetName},false,false),2);
264.106 - }
264.107 -
264.108 - /**
264.109 - * Clicks an item of a popup menu, related to a row set.
264.110 - * @param rowSetName a name of row set
264.111 - * @param menu a name of popup menu item
264.112 - */
264.113 - public void pushRowSetPopup(String rowSetName, String menu) {
264.114 - TestUtils.printComponentList(this);
264.115 - try{
264.116 - pushRowSetPopup_(rowSetName, menu);
264.117 - return;
264.118 - }catch (TimeoutExpiredException ex){}
264.119 - clickSessionBean();
264.120 - pushRowSetPopup_(rowSetName, menu);
264.121 - }
264.122 -
264.123 - /**
264.124 - * Selects a row set.
264.125 - * @param rowSetName a name of row set
264.126 - */
264.127 - public void selectRowSet(String rowSetName){
264.128 - try{
264.129 - selectRowSet_(rowSetName);
264.130 - return;
264.131 - }catch (TimeoutExpiredException ex){}
264.132 - clickSessionBean();
264.133 - selectRowSet_(rowSetName);
264.134 - }
264.135 -
264.136 - /**
264.137 - * Opens a row set.
264.138 - * @param rowSetName a name of row set
264.139 - */
264.140 - public void openRowSet(String rowSetName){
264.141 - try{
264.142 - openRowSet_(rowSetName);
264.143 - return;
264.144 - }catch (TimeoutExpiredException ex){}
264.145 - clickSessionBean();
264.146 - openRowSet_(rowSetName);
264.147 - }
264.148 -}
265.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/Descriptor.java Thu Jul 10 04:29:52 2008 -0700
265.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
265.3 @@ -1,62 +0,0 @@
265.4 -/*
265.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
265.6 - *
265.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
265.8 - *
265.9 - * The contents of this file are subject to the terms of either the GNU
265.10 - * General Public License Version 2 only ("GPL") or the Common
265.11 - * Development and Distribution License("CDDL") (collectively, the
265.12 - * "License"). You may not use this file except in compliance with the
265.13 - * License. You can obtain a copy of the License at
265.14 - * http://www.netbeans.org/cddl-gplv2.html
265.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
265.16 - * specific language governing permissions and limitations under the
265.17 - * License. When distributing the software, include this License Header
265.18 - * Notice in each file and include the License file at
265.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
265.20 - * particular file as subject to the "Classpath" exception as provided
265.21 - * by Sun in the GPL Version 2 section of the License file that
265.22 - * accompanied this code. If applicable, add the following below the
265.23 - * License Header, with the fields enclosed by brackets [] replaced by
265.24 - * your own identifying information:
265.25 - * "Portions Copyrighted [year] [name of copyright owner]"
265.26 - *
265.27 - * Contributor(s):
265.28 - *
265.29 - * The Original Software is NetBeans. The Initial Developer of the Original
265.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
265.31 - * Microsystems, Inc. All Rights Reserved.
265.32 - *
265.33 - * If you wish your version of this file to be governed by only the CDDL
265.34 - * or only the GPL Version 2, indicate your decision by adding
265.35 - * "[Contributor] elects to include this software in this distribution
265.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
265.37 - * single choice of license, a recipient has the option to distribute
265.38 - * your version of this file under either the CDDL, the GPL Version 2 or
265.39 - * to extend the choice of license to its licensees as provided above.
265.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
265.41 - * Version 2 license, then the option applies only if the new code is
265.42 - * made subject to such option by the copyright holder.
265.43 - */
265.44 -
265.45 -package org.netbeans.modules.visualweb.gravy.model;
265.46 -
265.47 -/**
265.48 - * Common interface for all descriptor types.
265.49 - */
265.50 -
265.51 -public interface Descriptor {
265.52 -
265.53 - /**
265.54 - * Get properties.
265.55 - * @return Object of properties.
265.56 - */
265.57 - public Object getProperties();
265.58 -
265.59 - /**
265.60 - * Get value of specified property.
265.61 - * @param propertyName Name of necessary property.
265.62 - * @return Object value of property.
265.63 - */
265.64 - public Object getProperty(String propertyName);
265.65 -}
266.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/ExternalProcess.java Thu Jul 10 04:29:52 2008 -0700
266.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
266.3 @@ -1,59 +0,0 @@
266.4 -/*
266.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
266.6 - *
266.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
266.8 - *
266.9 - * The contents of this file are subject to the terms of either the GNU
266.10 - * General Public License Version 2 only ("GPL") or the Common
266.11 - * Development and Distribution License("CDDL") (collectively, the
266.12 - * "License"). You may not use this file except in compliance with the
266.13 - * License. You can obtain a copy of the License at
266.14 - * http://www.netbeans.org/cddl-gplv2.html
266.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
266.16 - * specific language governing permissions and limitations under the
266.17 - * License. When distributing the software, include this License Header
266.18 - * Notice in each file and include the License file at
266.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
266.20 - * particular file as subject to the "Classpath" exception as provided
266.21 - * by Sun in the GPL Version 2 section of the License file that
266.22 - * accompanied this code. If applicable, add the following below the
266.23 - * License Header, with the fields enclosed by brackets [] replaced by
266.24 - * your own identifying information:
266.25 - * "Portions Copyrighted [year] [name of copyright owner]"
266.26 - *
266.27 - * Contributor(s):
266.28 - *
266.29 - * The Original Software is NetBeans. The Initial Developer of the Original
266.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
266.31 - * Microsystems, Inc. All Rights Reserved.
266.32 - *
266.33 - * If you wish your version of this file to be governed by only the CDDL
266.34 - * or only the GPL Version 2, indicate your decision by adding
266.35 - * "[Contributor] elects to include this software in this distribution
266.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
266.37 - * single choice of license, a recipient has the option to distribute
266.38 - * your version of this file under either the CDDL, the GPL Version 2 or
266.39 - * to extend the choice of license to its licensees as provided above.
266.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
266.41 - * Version 2 license, then the option applies only if the new code is
266.42 - * made subject to such option by the copyright holder.
266.43 - */
266.44 -
266.45 -package org.netbeans.modules.visualweb.gravy.model;
266.46 -
266.47 -/**
266.48 - * Common interface for all external processes.
266.49 - */
266.50 -
266.51 -public interface ExternalProcess {
266.52 -
266.53 - /**
266.54 - * Start external process.
266.55 - */
266.56 - public void start();
266.57 -
266.58 - /**
266.59 - * Stop external process.
266.60 - */
266.61 - public void stop();
266.62 -}
267.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/IDE.java Thu Jul 10 04:29:52 2008 -0700
267.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
267.3 @@ -1,147 +0,0 @@
267.4 -/*
267.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
267.6 - *
267.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
267.8 - *
267.9 - * The contents of this file are subject to the terms of either the GNU
267.10 - * General Public License Version 2 only ("GPL") or the Common
267.11 - * Development and Distribution License("CDDL") (collectively, the
267.12 - * "License"). You may not use this file except in compliance with the
267.13 - * License. You can obtain a copy of the License at
267.14 - * http://www.netbeans.org/cddl-gplv2.html
267.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
267.16 - * specific language governing permissions and limitations under the
267.17 - * License. When distributing the software, include this License Header
267.18 - * Notice in each file and include the License file at
267.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
267.20 - * particular file as subject to the "Classpath" exception as provided
267.21 - * by Sun in the GPL Version 2 section of the License file that
267.22 - * accompanied this code. If applicable, add the following below the
267.23 - * License Header, with the fields enclosed by brackets [] replaced by
267.24 - * your own identifying information:
267.25 - * "Portions Copyrighted [year] [name of copyright owner]"
267.26 - *
267.27 - * Contributor(s):
267.28 - *
267.29 - * The Original Software is NetBeans. The Initial Developer of the Original
267.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
267.31 - * Microsystems, Inc. All Rights Reserved.
267.32 - *
267.33 - * If you wish your version of this file to be governed by only the CDDL
267.34 - * or only the GPL Version 2, indicate your decision by adding
267.35 - * "[Contributor] elects to include this software in this distribution
267.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
267.37 - * single choice of license, a recipient has the option to distribute
267.38 - * your version of this file under either the CDDL, the GPL Version 2 or
267.39 - * to extend the choice of license to its licensees as provided above.
267.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
267.41 - * Version 2 license, then the option applies only if the new code is
267.42 - * made subject to such option by the copyright holder.
267.43 - */
267.44 -
267.45 -package org.netbeans.modules.visualweb.gravy.model;
267.46 -
267.47 -import org.netbeans.modules.visualweb.gravy.model.components.*;
267.48 -import org.netbeans.modules.visualweb.gravy.model.deployment.*;
267.49 -import org.netbeans.modules.visualweb.gravy.model.project.*;
267.50 -import org.netbeans.modules.visualweb.gravy.Util;
267.51 -import org.netbeans.modules.visualweb.gravy.TestUtils;
267.52 -
267.53 -import org.netbeans.jemmy.JemmyException;
267.54 -
267.55 -import java.util.List;
267.56 -
267.57 -/**
267.58 - * Representing IDE itself.
267.59 - */
267.60 -
267.61 -public class IDE {
267.62 -
267.63 - /**
267.64 - * Variable representing IDE.
267.65 - */
267.66 - private static IDE ide;
267.67 -
267.68 - /**
267.69 - * Add default depoyment targets.
267.70 - */
267.71 - private IDE() {
267.72 - DeploymentTargetDescriptor dtd = new DeploymentTargetDescriptor();
267.73 - dtd.loadDefault();
267.74 - if (dtd.getProperties()!=null) {
267.75 - DefaultDeploymentTargetFactory.getFactory().create(dtd);
267.76 - }
267.77 - }
267.78 -
267.79 - /**
267.80 - * Create instance of IDE or return it, if it is already exist.
267.81 - * Singleton.
267.82 - * @return IDE.
267.83 - */
267.84 - public static IDE getIDE() {
267.85 - if (ide != null) return ide;
267.86 - else return (ide = new IDE());
267.87 - }
267.88 -
267.89 - /**
267.90 - * Get deployment targets.
267.91 - * @return List of deployment targets.
267.92 - */
267.93 - public List getDeploymentTargets() {
267.94 - return DeploymentTargetList.getList();
267.95 - }
267.96 -
267.97 - /**
267.98 - * Add deployment target to IDE.
267.99 - * @param DTDescriptor Descriptor of deployment target.
267.100 - * @return added deployment target.
267.101 - */
267.102 - public DeploymentTarget addDeploymentTarget(DeploymentTargetDescriptor DTDescriptor) {
267.103 - return DefaultDeploymentTargetFactory.getFactory().create(DTDescriptor);
267.104 - }
267.105 -
267.106 - /**
267.107 - * Get projects.
267.108 - * @return List of projects.
267.109 - */
267.110 - public List getProjects() {
267.111 - return ProjectList.getList();
267.112 - }
267.113 -
267.114 - /**
267.115 - * Create new project.
267.116 - * @param projectDescriptor Descriptor of project.
267.117 - * @return created project.
267.118 - */
267.119 - public Project createProject(ProjectDescriptor projectDescriptor) {
267.120 - return DefaultProjectFactory.getFactory().create(projectDescriptor);
267.121 - }
267.122 -
267.123 - /**
267.124 - * Open existing project.
267.125 - * @param pathToProject Path to project's folder.
267.126 - * @return existing project.
267.127 - */
267.128 - public Project openProject(String pathToProject) {
267.129 - return DefaultProjectFactory.getFactory().open(pathToProject);
267.130 - }
267.131 -
267.132 - /**
267.133 - * Deploy main project.
267.134 - */
267.135 - public void deploy(){
267.136 - try {
267.137 - Util.getMainWindow().btDeploy().push();
267.138 - } catch(Exception e) {
267.139 - throw new JemmyException("IDE can't deploy Application!", e);
267.140 - }
267.141 - TestUtils.wait(20000);
267.142 - }
267.143 -
267.144 - /**
267.145 - * Return default component set.
267.146 - */
267.147 - public ComponentSet getDefaultComponentSet() {
267.148 - return BasicComponentSet.getBasicComponentSet();
267.149 - }
267.150 -}
268.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/BasicComponentSet.java Thu Jul 10 04:29:52 2008 -0700
268.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
268.3 @@ -1,84 +0,0 @@
268.4 -/*
268.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
268.6 - *
268.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
268.8 - *
268.9 - * The contents of this file are subject to the terms of either the GNU
268.10 - * General Public License Version 2 only ("GPL") or the Common
268.11 - * Development and Distribution License("CDDL") (collectively, the
268.12 - * "License"). You may not use this file except in compliance with the
268.13 - * License. You can obtain a copy of the License at
268.14 - * http://www.netbeans.org/cddl-gplv2.html
268.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
268.16 - * specific language governing permissions and limitations under the
268.17 - * License. When distributing the software, include this License Header
268.18 - * Notice in each file and include the License file at
268.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
268.20 - * particular file as subject to the "Classpath" exception as provided
268.21 - * by Sun in the GPL Version 2 section of the License file that
268.22 - * accompanied this code. If applicable, add the following below the
268.23 - * License Header, with the fields enclosed by brackets [] replaced by
268.24 - * your own identifying information:
268.25 - * "Portions Copyrighted [year] [name of copyright owner]"
268.26 - *
268.27 - * Contributor(s):
268.28 - *
268.29 - * The Original Software is NetBeans. The Initial Developer of the Original
268.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
268.31 - * Microsystems, Inc. All Rights Reserved.
268.32 - *
268.33 - * If you wish your version of this file to be governed by only the CDDL
268.34 - * or only the GPL Version 2, indicate your decision by adding
268.35 - * "[Contributor] elects to include this software in this distribution
268.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
268.37 - * single choice of license, a recipient has the option to distribute
268.38 - * your version of this file under either the CDDL, the GPL Version 2 or
268.39 - * to extend the choice of license to its licensees as provided above.
268.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
268.41 - * Version 2 license, then the option applies only if the new code is
268.42 - * made subject to such option by the copyright holder.
268.43 - */
268.44 -
268.45 -package org.netbeans.modules.visualweb.gravy.model.components;
268.46 -
268.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
268.48 -
268.49 -/**
268.50 - * Representing Basic Component set of the Pallette.
268.51 - */
268.52 -
268.53 -public final class BasicComponentSet extends ComponentSet {
268.54 -
268.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
268.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
268.57 - private final static String BASIC_CS_ID = Bundle.getStringTrimmed(ravePaletteBundle,
268.58 - Bundle.getStringTrimmed(bundle, "PaletteGroup"));
268.59 -
268.60 - /**
268.61 - * Variable representing component set "Basic".
268.62 - */
268.63 - private static BasicComponentSet bcs;
268.64 -
268.65 - /**
268.66 - * Creates a new instance of BasicComponentSet.
268.67 - */
268.68 - private BasicComponentSet() {
268.69 - super(BASIC_CS_ID);
268.70 - components.put(ButtonComponent.BUTTON_ID, new ButtonComponent(this));
268.71 - components.put(TextFieldComponent.TEXTFIELD_ID, new TextFieldComponent(this));
268.72 - components.put(LabelComponent.LABEL_ID, new LabelComponent(this));
268.73 - components.put(TableComponent.TABLE_ID, new TableComponent(this));
268.74 - components.put(DropDownListComponent.DROP_DOWN_LIST_ID, new DropDownListComponent(this));
268.75 - components.put(StaticTextComponent.STATIC_TEXT_ID, new StaticTextComponent(this));
268.76 - }
268.77 -
268.78 - /**
268.79 - * Create instance of BasicComponentSet or return it, if it is already exist.
268.80 - * Singleton.
268.81 - * @return BasicComponentSet.
268.82 - */
268.83 - public static BasicComponentSet getBasicComponentSet() {
268.84 - if (bcs != null) return bcs;
268.85 - else return (bcs = new BasicComponentSet());
268.86 - }
268.87 -}
269.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/Bundle.properties Thu Jul 10 04:29:52 2008 -0700
269.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
269.3 @@ -1,68 +0,0 @@
269.4 -/*
269.5 -
269.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
269.7 - *
269.8 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
269.9 -
269.10 - *
269.11 - * The contents of this file are subject to the terms of either the GNU
269.12 - * General Public License Version 2 only ("GPL") or the Common
269.13 - * Development and Distribution License("CDDL") (collectively, the
269.14 - * "License"). You may not use this file except in compliance with the
269.15 - * License. You can obtain a copy of the License at
269.16 - * http://www.netbeans.org/cddl-gplv2.html
269.17 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
269.18 - * specific language governing permissions and limitations under the
269.19 - * License. When distributing the software, include this License Header
269.20 - * Notice in each file and include the License file at
269.21 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
269.22 - * particular file as subject to the "Classpath" exception as provided
269.23 - * by Sun in the GPL Version 2 section of the License file that
269.24 - * accompanied this code. If applicable, add the following below the
269.25 - * License Header, with the fields enclosed by brackets [] replaced by
269.26 - * your own identifying information:
269.27 - * "Portions Copyrighted [year] [name of copyright owner]"
269.28 - *
269.29 - * Contributor(s):
269.30 -
269.31 - *
269.32 -
269.33 - * The Original Software is NetBeans. The Initial Developer of the Original
269.34 -
269.35 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
269.36 -
269.37 - * Microsystems, Inc. All Rights Reserved.
269.38 - *
269.39 - * If you wish your version of this file to be governed by only the CDDL
269.40 - * or only the GPL Version 2, indicate your decision by adding
269.41 - * "[Contributor] elects to include this software in this distribution
269.42 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
269.43 - * single choice of license, a recipient has the option to distribute
269.44 - * your version of this file under either the CDDL, the GPL Version 2 or
269.45 - * to extend the choice of license to its licensees as provided above.
269.46 - * However, if you add GPL Version 2 code and therefore, elected the GPL
269.47 - * Version 2 license, then the option applies only if the new code is
269.48 - * made subject to such option by the copyright holder.
269.49 -
269.50 - */
269.51 -
269.52 -
269.53 -
269.54 -#properties for rave webui.designtime bundle
269.55 -
269.56 -RavePaletteBundle=org.netbeans.modules.visualweb.webui.designtime.resources.Bundle
269.57 -
269.58 -ButtonComponent=NAME_vweb-ui-component-Button
269.59 -
269.60 -LabelComponent=NAME_vweb-ui-component-Label
269.61 -
269.62 -TextFieldComponent=NAME_vweb-ui-component-TextField
269.63 -
269.64 -TableComponent=NAME_vweb-ui-component-Table
269.65 -
269.66 -DropDownListComponent=NAME_vweb-ui-component-DropDown
269.67 -
269.68 -StaticTextComponent=NAME_vweb-ui-component-StaticText
269.69 -
269.70 -PaletteGroup=CreatorDesignerPalette/Basic
269.71 -
270.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/ButtonComponent.java Thu Jul 10 04:29:52 2008 -0700
270.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
270.3 @@ -1,62 +0,0 @@
270.4 -/*
270.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
270.6 - *
270.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
270.8 - *
270.9 - * The contents of this file are subject to the terms of either the GNU
270.10 - * General Public License Version 2 only ("GPL") or the Common
270.11 - * Development and Distribution License("CDDL") (collectively, the
270.12 - * "License"). You may not use this file except in compliance with the
270.13 - * License. You can obtain a copy of the License at
270.14 - * http://www.netbeans.org/cddl-gplv2.html
270.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
270.16 - * specific language governing permissions and limitations under the
270.17 - * License. When distributing the software, include this License Header
270.18 - * Notice in each file and include the License file at
270.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
270.20 - * particular file as subject to the "Classpath" exception as provided
270.21 - * by Sun in the GPL Version 2 section of the License file that
270.22 - * accompanied this code. If applicable, add the following below the
270.23 - * License Header, with the fields enclosed by brackets [] replaced by
270.24 - * your own identifying information:
270.25 - * "Portions Copyrighted [year] [name of copyright owner]"
270.26 - *
270.27 - * Contributor(s):
270.28 - *
270.29 - * The Original Software is NetBeans. The Initial Developer of the Original
270.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
270.31 - * Microsystems, Inc. All Rights Reserved.
270.32 - *
270.33 - * If you wish your version of this file to be governed by only the CDDL
270.34 - * or only the GPL Version 2, indicate your decision by adding
270.35 - * "[Contributor] elects to include this software in this distribution
270.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
270.37 - * single choice of license, a recipient has the option to distribute
270.38 - * your version of this file under either the CDDL, the GPL Version 2 or
270.39 - * to extend the choice of license to its licensees as provided above.
270.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
270.41 - * Version 2 license, then the option applies only if the new code is
270.42 - * made subject to such option by the copyright holder.
270.43 - */
270.44 -
270.45 -package org.netbeans.modules.visualweb.gravy.model.components;
270.46 -
270.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
270.48 -
270.49 -/**
270.50 - * Button components.
270.51 - */
270.52 -
270.53 -public class ButtonComponent extends WebComponent {
270.54 -
270.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
270.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
270.57 - public final static String BUTTON_ID = Bundle.getStringTrimmed(ravePaletteBundle,
270.58 - Bundle.getStringTrimmed(bundle, "ButtonComponent"));
270.59 -
270.60 - public ButtonComponent(ComponentSet set) {
270.61 - super(set, BUTTON_ID);
270.62 - isVisual = true;
270.63 - isEventHadling = true;
270.64 - }
270.65 -}
271.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/CodeClipComponent.java Thu Jul 10 04:29:52 2008 -0700
271.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
271.3 @@ -1,53 +0,0 @@
271.4 -/*
271.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
271.6 - *
271.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
271.8 - *
271.9 - * The contents of this file are subject to the terms of either the GNU
271.10 - * General Public License Version 2 only ("GPL") or the Common
271.11 - * Development and Distribution License("CDDL") (collectively, the
271.12 - * "License"). You may not use this file except in compliance with the
271.13 - * License. You can obtain a copy of the License at
271.14 - * http://www.netbeans.org/cddl-gplv2.html
271.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
271.16 - * specific language governing permissions and limitations under the
271.17 - * License. When distributing the software, include this License Header
271.18 - * Notice in each file and include the License file at
271.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
271.20 - * particular file as subject to the "Classpath" exception as provided
271.21 - * by Sun in the GPL Version 2 section of the License file that
271.22 - * accompanied this code. If applicable, add the following below the
271.23 - * License Header, with the fields enclosed by brackets [] replaced by
271.24 - * your own identifying information:
271.25 - * "Portions Copyrighted [year] [name of copyright owner]"
271.26 - *
271.27 - * Contributor(s):
271.28 - *
271.29 - * The Original Software is NetBeans. The Initial Developer of the Original
271.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
271.31 - * Microsystems, Inc. All Rights Reserved.
271.32 - *
271.33 - * If you wish your version of this file to be governed by only the CDDL
271.34 - * or only the GPL Version 2, indicate your decision by adding
271.35 - * "[Contributor] elects to include this software in this distribution
271.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
271.37 - * single choice of license, a recipient has the option to distribute
271.38 - * your version of this file under either the CDDL, the GPL Version 2 or
271.39 - * to extend the choice of license to its licensees as provided above.
271.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
271.41 - * Version 2 license, then the option applies only if the new code is
271.42 - * made subject to such option by the copyright holder.
271.43 - */
271.44 -
271.45 -package org.netbeans.modules.visualweb.gravy.model.components;
271.46 -
271.47 -/**
271.48 - * Common class for code clip components in palette.
271.49 - */
271.50 -
271.51 -public class CodeClipComponent extends PaletteComponent {
271.52 -
271.53 - public CodeClipComponent(ComponentSet set, String ID) {
271.54 - super(set, ID);
271.55 - }
271.56 -}
272.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/ComponentSet.java Thu Jul 10 04:29:52 2008 -0700
272.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
272.3 @@ -1,95 +0,0 @@
272.4 -/*
272.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
272.6 - *
272.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
272.8 - *
272.9 - * The contents of this file are subject to the terms of either the GNU
272.10 - * General Public License Version 2 only ("GPL") or the Common
272.11 - * Development and Distribution License("CDDL") (collectively, the
272.12 - * "License"). You may not use this file except in compliance with the
272.13 - * License. You can obtain a copy of the License at
272.14 - * http://www.netbeans.org/cddl-gplv2.html
272.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
272.16 - * specific language governing permissions and limitations under the
272.17 - * License. When distributing the software, include this License Header
272.18 - * Notice in each file and include the License file at
272.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
272.20 - * particular file as subject to the "Classpath" exception as provided
272.21 - * by Sun in the GPL Version 2 section of the License file that
272.22 - * accompanied this code. If applicable, add the following below the
272.23 - * License Header, with the fields enclosed by brackets [] replaced by
272.24 - * your own identifying information:
272.25 - * "Portions Copyrighted [year] [name of copyright owner]"
272.26 - *
272.27 - * Contributor(s):
272.28 - *
272.29 - * The Original Software is NetBeans. The Initial Developer of the Original
272.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
272.31 - * Microsystems, Inc. All Rights Reserved.
272.32 - *
272.33 - * If you wish your version of this file to be governed by only the CDDL
272.34 - * or only the GPL Version 2, indicate your decision by adding
272.35 - * "[Contributor] elects to include this software in this distribution
272.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
272.37 - * single choice of license, a recipient has the option to distribute
272.38 - * your version of this file under either the CDDL, the GPL Version 2 or
272.39 - * to extend the choice of license to its licensees as provided above.
272.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
272.41 - * Version 2 license, then the option applies only if the new code is
272.42 - * made subject to such option by the copyright holder.
272.43 - */
272.44 -
272.45 -package org.netbeans.modules.visualweb.gravy.model.components;
272.46 -
272.47 -import java.util.Hashtable;
272.48 -
272.49 -/**
272.50 - * Set for Components.
272.51 - */
272.52 -
272.53 -public class ComponentSet {
272.54 -
272.55 - protected Hashtable components = new Hashtable();
272.56 -
272.57 - private String ID;
272.58 -
272.59 - /**
272.60 - * Create New ComponentsSet with specified ID.
272.61 - */
272.62 - public ComponentSet(String ID) {
272.63 - this.ID = ID;
272.64 - }
272.65 -
272.66 - /**
272.67 - * Get Components of the Set.
272.68 - * @return Hashtable of the Components.
272.69 - */
272.70 - public Hashtable getComponents() {
272.71 - return components;
272.72 - }
272.73 -
272.74 - /**
272.75 - * Get component with specified ID.
272.76 - * @param ID Component's ID.
272.77 - * @return Component with given ID.
272.78 - */
272.79 - public PaletteComponent getComponent(String ID) {
272.80 - return ((PaletteComponent) components.get(ID));
272.81 - }
272.82 -
272.83 - /**
272.84 - * Get Component Set ID.
272.85 - * @return ComponentSet ID.
272.86 - */
272.87 - public String getID() {
272.88 - return ID;
272.89 - }
272.90 -
272.91 - /**
272.92 - * Set ID for ComponentSet.
272.93 - * @param ID Component Set ID.
272.94 - */
272.95 - private void setID(String ID) {
272.96 - this.ID = ID;
272.97 - }
272.98 -}
273.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/DropDownListComponent.java Thu Jul 10 04:29:52 2008 -0700
273.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
273.3 @@ -1,62 +0,0 @@
273.4 -/*
273.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
273.6 - *
273.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
273.8 - *
273.9 - * The contents of this file are subject to the terms of either the GNU
273.10 - * General Public License Version 2 only ("GPL") or the Common
273.11 - * Development and Distribution License("CDDL") (collectively, the
273.12 - * "License"). You may not use this file except in compliance with the
273.13 - * License. You can obtain a copy of the License at
273.14 - * http://www.netbeans.org/cddl-gplv2.html
273.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
273.16 - * specific language governing permissions and limitations under the
273.17 - * License. When distributing the software, include this License Header
273.18 - * Notice in each file and include the License file at
273.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
273.20 - * particular file as subject to the "Classpath" exception as provided
273.21 - * by Sun in the GPL Version 2 section of the License file that
273.22 - * accompanied this code. If applicable, add the following below the
273.23 - * License Header, with the fields enclosed by brackets [] replaced by
273.24 - * your own identifying information:
273.25 - * "Portions Copyrighted [year] [name of copyright owner]"
273.26 - *
273.27 - * Contributor(s):
273.28 - *
273.29 - * The Original Software is NetBeans. The Initial Developer of the Original
273.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
273.31 - * Microsystems, Inc. All Rights Reserved.
273.32 - *
273.33 - * If you wish your version of this file to be governed by only the CDDL
273.34 - * or only the GPL Version 2, indicate your decision by adding
273.35 - * "[Contributor] elects to include this software in this distribution
273.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
273.37 - * single choice of license, a recipient has the option to distribute
273.38 - * your version of this file under either the CDDL, the GPL Version 2 or
273.39 - * to extend the choice of license to its licensees as provided above.
273.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
273.41 - * Version 2 license, then the option applies only if the new code is
273.42 - * made subject to such option by the copyright holder.
273.43 - */
273.44 -
273.45 -package org.netbeans.modules.visualweb.gravy.model.components;
273.46 -
273.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
273.48 -
273.49 -/**
273.50 - * Button components.
273.51 - */
273.52 -
273.53 -public class DropDownListComponent extends WebComponent {
273.54 -
273.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
273.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
273.57 - public final static String DROP_DOWN_LIST_ID = Bundle.getStringTrimmed(ravePaletteBundle,
273.58 - Bundle.getStringTrimmed(bundle, "DropDownListComponent"));
273.59 -
273.60 - public DropDownListComponent(ComponentSet set) {
273.61 - super(set, DROP_DOWN_LIST_ID);
273.62 - isVisual = true;
273.63 - isEventHadling = true;
273.64 - }
273.65 -}
274.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/LabelComponent.java Thu Jul 10 04:29:52 2008 -0700
274.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
274.3 @@ -1,62 +0,0 @@
274.4 -/*
274.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
274.6 - *
274.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
274.8 - *
274.9 - * The contents of this file are subject to the terms of either the GNU
274.10 - * General Public License Version 2 only ("GPL") or the Common
274.11 - * Development and Distribution License("CDDL") (collectively, the
274.12 - * "License"). You may not use this file except in compliance with the
274.13 - * License. You can obtain a copy of the License at
274.14 - * http://www.netbeans.org/cddl-gplv2.html
274.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
274.16 - * specific language governing permissions and limitations under the
274.17 - * License. When distributing the software, include this License Header
274.18 - * Notice in each file and include the License file at
274.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
274.20 - * particular file as subject to the "Classpath" exception as provided
274.21 - * by Sun in the GPL Version 2 section of the License file that
274.22 - * accompanied this code. If applicable, add the following below the
274.23 - * License Header, with the fields enclosed by brackets [] replaced by
274.24 - * your own identifying information:
274.25 - * "Portions Copyrighted [year] [name of copyright owner]"
274.26 - *
274.27 - * Contributor(s):
274.28 - *
274.29 - * The Original Software is NetBeans. The Initial Developer of the Original
274.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
274.31 - * Microsystems, Inc. All Rights Reserved.
274.32 - *
274.33 - * If you wish your version of this file to be governed by only the CDDL
274.34 - * or only the GPL Version 2, indicate your decision by adding
274.35 - * "[Contributor] elects to include this software in this distribution
274.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
274.37 - * single choice of license, a recipient has the option to distribute
274.38 - * your version of this file under either the CDDL, the GPL Version 2 or
274.39 - * to extend the choice of license to its licensees as provided above.
274.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
274.41 - * Version 2 license, then the option applies only if the new code is
274.42 - * made subject to such option by the copyright holder.
274.43 - */
274.44 -
274.45 -package org.netbeans.modules.visualweb.gravy.model.components;
274.46 -
274.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
274.48 -
274.49 -/**
274.50 - * Label component.
274.51 - */
274.52 -
274.53 -public class LabelComponent extends WebComponent {
274.54 -
274.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
274.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
274.57 - public final static String LABEL_ID = Bundle.getStringTrimmed(ravePaletteBundle,
274.58 - Bundle.getStringTrimmed(bundle, "LabelComponent"));
274.59 -
274.60 - public LabelComponent(ComponentSet set) {
274.61 - super(set, LABEL_ID);
274.62 - isVisual = true;
274.63 - isEventHadling = false;
274.64 - }
274.65 -}
275.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/PaletteComponent.java Thu Jul 10 04:29:52 2008 -0700
275.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
275.3 @@ -1,104 +0,0 @@
275.4 -/*
275.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
275.6 - *
275.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
275.8 - *
275.9 - * The contents of this file are subject to the terms of either the GNU
275.10 - * General Public License Version 2 only ("GPL") or the Common
275.11 - * Development and Distribution License("CDDL") (collectively, the
275.12 - * "License"). You may not use this file except in compliance with the
275.13 - * License. You can obtain a copy of the License at
275.14 - * http://www.netbeans.org/cddl-gplv2.html
275.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
275.16 - * specific language governing permissions and limitations under the
275.17 - * License. When distributing the software, include this License Header
275.18 - * Notice in each file and include the License file at
275.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
275.20 - * particular file as subject to the "Classpath" exception as provided
275.21 - * by Sun in the GPL Version 2 section of the License file that
275.22 - * accompanied this code. If applicable, add the following below the
275.23 - * License Header, with the fields enclosed by brackets [] replaced by
275.24 - * your own identifying information:
275.25 - * "Portions Copyrighted [year] [name of copyright owner]"
275.26 - *
275.27 - * Contributor(s):
275.28 - *
275.29 - * The Original Software is NetBeans. The Initial Developer of the Original
275.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
275.31 - * Microsystems, Inc. All Rights Reserved.
275.32 - *
275.33 - * If you wish your version of this file to be governed by only the CDDL
275.34 - * or only the GPL Version 2, indicate your decision by adding
275.35 - * "[Contributor] elects to include this software in this distribution
275.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
275.37 - * single choice of license, a recipient has the option to distribute
275.38 - * your version of this file under either the CDDL, the GPL Version 2 or
275.39 - * to extend the choice of license to its licensees as provided above.
275.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
275.41 - * Version 2 license, then the option applies only if the new code is
275.42 - * made subject to such option by the copyright holder.
275.43 - */
275.44 -
275.45 -package org.netbeans.modules.visualweb.gravy.model.components;
275.46 -
275.47 -/**
275.48 - * Common class for all components in palette.
275.49 - */
275.50 -
275.51 -public class PaletteComponent {
275.52 -
275.53 - private ComponentSet set;
275.54 - private String ID;
275.55 -
275.56 - /**
275.57 - * Create Component with specified ID for specified ComponentSet.
275.58 - * @param set ComponentSet.
275.59 - * @param ID Component ID.
275.60 - */
275.61 - public PaletteComponent(ComponentSet set, String ID) {
275.62 - setID(ID);
275.63 - setComponentSet(set);
275.64 - }
275.65 -
275.66 - /**
275.67 - * Return true if Component belongs to the specified ComponentSet.
275.68 - * @param set ComponentSet.
275.69 - * @return true if Component belongs to the specified ComponentSet.
275.70 - */
275.71 - public boolean isBelongsTo(ComponentSet set) {
275.72 - if (this.set.getID().equals(set.getID())) return true;
275.73 - else return false;
275.74 - }
275.75 -
275.76 - /**
275.77 - * Get Component ID.
275.78 - * @return Component ID.
275.79 - */
275.80 - public String getID() {
275.81 - return ID;
275.82 - }
275.83 -
275.84 - /**
275.85 - * Set ID for Component.
275.86 - * @param ID Component ID.
275.87 - */
275.88 - private void setID(String ID) {
275.89 - this.ID = ID;
275.90 - }
275.91 -
275.92 - /**
275.93 - * Get ComponentSet which component belong to.
275.94 - * @return ComponentSet ComponentSet which component belongs to.
275.95 - */
275.96 - public ComponentSet getComponentSet() {
275.97 - return set;
275.98 - }
275.99 -
275.100 - /**
275.101 - * Set ComponentSet for Component.
275.102 - * @param ComponentSet ComponentSet which component should belong to.
275.103 - */
275.104 - private void setComponentSet(ComponentSet set) {
275.105 - this.set = set;
275.106 - }
275.107 -}
276.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/StaticTextComponent.java Thu Jul 10 04:29:52 2008 -0700
276.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
276.3 @@ -1,62 +0,0 @@
276.4 -/*
276.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
276.6 - *
276.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
276.8 - *
276.9 - * The contents of this file are subject to the terms of either the GNU
276.10 - * General Public License Version 2 only ("GPL") or the Common
276.11 - * Development and Distribution License("CDDL") (collectively, the
276.12 - * "License"). You may not use this file except in compliance with the
276.13 - * License. You can obtain a copy of the License at
276.14 - * http://www.netbeans.org/cddl-gplv2.html
276.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
276.16 - * specific language governing permissions and limitations under the
276.17 - * License. When distributing the software, include this License Header
276.18 - * Notice in each file and include the License file at
276.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
276.20 - * particular file as subject to the "Classpath" exception as provided
276.21 - * by Sun in the GPL Version 2 section of the License file that
276.22 - * accompanied this code. If applicable, add the following below the
276.23 - * License Header, with the fields enclosed by brackets [] replaced by
276.24 - * your own identifying information:
276.25 - * "Portions Copyrighted [year] [name of copyright owner]"
276.26 - *
276.27 - * Contributor(s):
276.28 - *
276.29 - * The Original Software is NetBeans. The Initial Developer of the Original
276.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
276.31 - * Microsystems, Inc. All Rights Reserved.
276.32 - *
276.33 - * If you wish your version of this file to be governed by only the CDDL
276.34 - * or only the GPL Version 2, indicate your decision by adding
276.35 - * "[Contributor] elects to include this software in this distribution
276.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
276.37 - * single choice of license, a recipient has the option to distribute
276.38 - * your version of this file under either the CDDL, the GPL Version 2 or
276.39 - * to extend the choice of license to its licensees as provided above.
276.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
276.41 - * Version 2 license, then the option applies only if the new code is
276.42 - * made subject to such option by the copyright holder.
276.43 - */
276.44 -
276.45 -package org.netbeans.modules.visualweb.gravy.model.components;
276.46 -
276.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
276.48 -
276.49 -/**
276.50 - * Label component.
276.51 - */
276.52 -
276.53 -public class StaticTextComponent extends WebComponent {
276.54 -
276.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
276.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
276.57 - public final static String STATIC_TEXT_ID = Bundle.getStringTrimmed(ravePaletteBundle,
276.58 - Bundle.getStringTrimmed(bundle, "StaticTextComponent"));
276.59 -
276.60 - public StaticTextComponent(ComponentSet set) {
276.61 - super(set, STATIC_TEXT_ID);
276.62 - isVisual = true;
276.63 - isEventHadling = false;
276.64 - }
276.65 -}
277.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/TableComponent.java Thu Jul 10 04:29:52 2008 -0700
277.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
277.3 @@ -1,62 +0,0 @@
277.4 -/*
277.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
277.6 - *
277.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
277.8 - *
277.9 - * The contents of this file are subject to the terms of either the GNU
277.10 - * General Public License Version 2 only ("GPL") or the Common
277.11 - * Development and Distribution License("CDDL") (collectively, the
277.12 - * "License"). You may not use this file except in compliance with the
277.13 - * License. You can obtain a copy of the License at
277.14 - * http://www.netbeans.org/cddl-gplv2.html
277.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
277.16 - * specific language governing permissions and limitations under the
277.17 - * License. When distributing the software, include this License Header
277.18 - * Notice in each file and include the License file at
277.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
277.20 - * particular file as subject to the "Classpath" exception as provided
277.21 - * by Sun in the GPL Version 2 section of the License file that
277.22 - * accompanied this code. If applicable, add the following below the
277.23 - * License Header, with the fields enclosed by brackets [] replaced by
277.24 - * your own identifying information:
277.25 - * "Portions Copyrighted [year] [name of copyright owner]"
277.26 - *
277.27 - * Contributor(s):
277.28 - *
277.29 - * The Original Software is NetBeans. The Initial Developer of the Original
277.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
277.31 - * Microsystems, Inc. All Rights Reserved.
277.32 - *
277.33 - * If you wish your version of this file to be governed by only the CDDL
277.34 - * or only the GPL Version 2, indicate your decision by adding
277.35 - * "[Contributor] elects to include this software in this distribution
277.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
277.37 - * single choice of license, a recipient has the option to distribute
277.38 - * your version of this file under either the CDDL, the GPL Version 2 or
277.39 - * to extend the choice of license to its licensees as provided above.
277.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
277.41 - * Version 2 license, then the option applies only if the new code is
277.42 - * made subject to such option by the copyright holder.
277.43 - */
277.44 -
277.45 -package org.netbeans.modules.visualweb.gravy.model.components;
277.46 -
277.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
277.48 -
277.49 -/**
277.50 - * Label component.
277.51 - */
277.52 -
277.53 -public class TableComponent extends WebComponent {
277.54 -
277.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
277.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
277.57 - public final static String TABLE_ID = Bundle.getStringTrimmed(ravePaletteBundle,
277.58 - Bundle.getStringTrimmed(bundle, "TableComponent"));
277.59 -
277.60 - public TableComponent(ComponentSet set) {
277.61 - super(set, TABLE_ID);
277.62 - isVisual = true;
277.63 - isEventHadling = false;
277.64 - }
277.65 -}
278.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/TextFieldComponent.java Thu Jul 10 04:29:52 2008 -0700
278.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
278.3 @@ -1,62 +0,0 @@
278.4 -/*
278.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
278.6 - *
278.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
278.8 - *
278.9 - * The contents of this file are subject to the terms of either the GNU
278.10 - * General Public License Version 2 only ("GPL") or the Common
278.11 - * Development and Distribution License("CDDL") (collectively, the
278.12 - * "License"). You may not use this file except in compliance with the
278.13 - * License. You can obtain a copy of the License at
278.14 - * http://www.netbeans.org/cddl-gplv2.html
278.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
278.16 - * specific language governing permissions and limitations under the
278.17 - * License. When distributing the software, include this License Header
278.18 - * Notice in each file and include the License file at
278.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
278.20 - * particular file as subject to the "Classpath" exception as provided
278.21 - * by Sun in the GPL Version 2 section of the License file that
278.22 - * accompanied this code. If applicable, add the following below the
278.23 - * License Header, with the fields enclosed by brackets [] replaced by
278.24 - * your own identifying information:
278.25 - * "Portions Copyrighted [year] [name of copyright owner]"
278.26 - *
278.27 - * Contributor(s):
278.28 - *
278.29 - * The Original Software is NetBeans. The Initial Developer of the Original
278.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
278.31 - * Microsystems, Inc. All Rights Reserved.
278.32 - *
278.33 - * If you wish your version of this file to be governed by only the CDDL
278.34 - * or only the GPL Version 2, indicate your decision by adding
278.35 - * "[Contributor] elects to include this software in this distribution
278.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
278.37 - * single choice of license, a recipient has the option to distribute
278.38 - * your version of this file under either the CDDL, the GPL Version 2 or
278.39 - * to extend the choice of license to its licensees as provided above.
278.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
278.41 - * Version 2 license, then the option applies only if the new code is
278.42 - * made subject to such option by the copyright holder.
278.43 - */
278.44 -
278.45 -package org.netbeans.modules.visualweb.gravy.model.components;
278.46 -
278.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
278.48 -
278.49 -/**
278.50 - * Text Field components.
278.51 - */
278.52 -
278.53 -public class TextFieldComponent extends WebComponent {
278.54 -
278.55 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.components.Bundle";
278.56 - private final static String ravePaletteBundle = Bundle.getStringTrimmed(bundle, "RavePaletteBundle");
278.57 - public final static String TEXTFIELD_ID = Bundle.getStringTrimmed(ravePaletteBundle,
278.58 - Bundle.getStringTrimmed(bundle, "TextFieldComponent"));
278.59 -
278.60 - public TextFieldComponent(ComponentSet set) {
278.61 - super(set, TEXTFIELD_ID);
278.62 - isVisual = true;
278.63 - isEventHadling = true;
278.64 - }
278.65 -}
279.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/components/WebComponent.java Thu Jul 10 04:29:52 2008 -0700
279.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
279.3 @@ -1,72 +0,0 @@
279.4 -/*
279.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
279.6 - *
279.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
279.8 - *
279.9 - * The contents of this file are subject to the terms of either the GNU
279.10 - * General Public License Version 2 only ("GPL") or the Common
279.11 - * Development and Distribution License("CDDL") (collectively, the
279.12 - * "License"). You may not use this file except in compliance with the
279.13 - * License. You can obtain a copy of the License at
279.14 - * http://www.netbeans.org/cddl-gplv2.html
279.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
279.16 - * specific language governing permissions and limitations under the
279.17 - * License. When distributing the software, include this License Header
279.18 - * Notice in each file and include the License file at
279.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
279.20 - * particular file as subject to the "Classpath" exception as provided
279.21 - * by Sun in the GPL Version 2 section of the License file that
279.22 - * accompanied this code. If applicable, add the following below the
279.23 - * License Header, with the fields enclosed by brackets [] replaced by
279.24 - * your own identifying information:
279.25 - * "Portions Copyrighted [year] [name of copyright owner]"
279.26 - *
279.27 - * Contributor(s):
279.28 - *
279.29 - * The Original Software is NetBeans. The Initial Developer of the Original
279.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
279.31 - * Microsystems, Inc. All Rights Reserved.
279.32 - *
279.33 - * If you wish your version of this file to be governed by only the CDDL
279.34 - * or only the GPL Version 2, indicate your decision by adding
279.35 - * "[Contributor] elects to include this software in this distribution
279.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
279.37 - * single choice of license, a recipient has the option to distribute
279.38 - * your version of this file under either the CDDL, the GPL Version 2 or
279.39 - * to extend the choice of license to its licensees as provided above.
279.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
279.41 - * Version 2 license, then the option applies only if the new code is
279.42 - * made subject to such option by the copyright holder.
279.43 - */
279.44 -
279.45 -package org.netbeans.modules.visualweb.gravy.model.components;
279.46 -
279.47 -/**
279.48 - * Common class for web components in palette.
279.49 - */
279.50 -
279.51 -public class WebComponent extends PaletteComponent {
279.52 -
279.53 - protected boolean isVisual;
279.54 - protected boolean isEventHadling;
279.55 -
279.56 - public WebComponent(ComponentSet set, String ID) {
279.57 - super(set, ID);
279.58 - }
279.59 -
279.60 - /**
279.61 - * Is component visual or not.
279.62 - * @return True if component is visual and false if non visual.
279.63 - */
279.64 - public boolean isVisual() {
279.65 - return isVisual;
279.66 - }
279.67 -
279.68 - /**
279.69 - * Is component action or not.
279.70 - * @return True if component is visual and false if non visual.
279.71 - */
279.72 - public boolean isEventHadling() {
279.73 - return isEventHadling;
279.74 - }
279.75 -}
280.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/ApplicationServer.java Thu Jul 10 04:29:52 2008 -0700
280.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
280.3 @@ -1,185 +0,0 @@
280.4 -/*
280.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
280.6 - *
280.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
280.8 - *
280.9 - * The contents of this file are subject to the terms of either the GNU
280.10 - * General Public License Version 2 only ("GPL") or the Common
280.11 - * Development and Distribution License("CDDL") (collectively, the
280.12 - * "License"). You may not use this file except in compliance with the
280.13 - * License. You can obtain a copy of the License at
280.14 - * http://www.netbeans.org/cddl-gplv2.html
280.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
280.16 - * specific language governing permissions and limitations under the
280.17 - * License. When distributing the software, include this License Header
280.18 - * Notice in each file and include the License file at
280.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
280.20 - * particular file as subject to the "Classpath" exception as provided
280.21 - * by Sun in the GPL Version 2 section of the License file that
280.22 - * accompanied this code. If applicable, add the following below the
280.23 - * License Header, with the fields enclosed by brackets [] replaced by
280.24 - * your own identifying information:
280.25 - * "Portions Copyrighted [year] [name of copyright owner]"
280.26 - *
280.27 - * Contributor(s):
280.28 - *
280.29 - * The Original Software is NetBeans. The Initial Developer of the Original
280.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
280.31 - * Microsystems, Inc. All Rights Reserved.
280.32 - *
280.33 - * If you wish your version of this file to be governed by only the CDDL
280.34 - * or only the GPL Version 2, indicate your decision by adding
280.35 - * "[Contributor] elects to include this software in this distribution
280.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
280.37 - * single choice of license, a recipient has the option to distribute
280.38 - * your version of this file under either the CDDL, the GPL Version 2 or
280.39 - * to extend the choice of license to its licensees as provided above.
280.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
280.41 - * Version 2 license, then the option applies only if the new code is
280.42 - * made subject to such option by the copyright holder.
280.43 - */
280.44 -
280.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
280.46 -
280.47 -import org.netbeans.jemmy.JemmyException;
280.48 -import org.netbeans.modules.visualweb.gravy.Util;
280.49 -import org.netbeans.modules.visualweb.gravy.TestUtils;
280.50 -import org.netbeans.modules.visualweb.gravy.model.ExternalProcess;
280.51 -import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
280.52 -
280.53 -/**
280.54 - * Common class for all application servers.
280.55 - */
280.56 -
280.57 -public class ApplicationServer implements DeploymentTarget, ExternalProcess {
280.58 -
280.59 - public final static String SERVER_START = "Start";
280.60 - public final static String SERVER_START_DEBUG = "Start in Debug Mode";
280.61 - public final static String SERVER_RESTART = "Restart";
280.62 - public final static String SERVER_STOP = "Stop";
280.63 - public final static String SERVER_REMOVE = "Remove";
280.64 - public final static String SERVER_CUSTOMIZE = "Customize";
280.65 - public final static String SERVER_VIEW_CONSOLE = "View Admin Console";
280.66 - public final static String PROPERTIES = "Properties";
280.67 - public final static String REFRESH = "Refresh";
280.68 - public final static String APPLICATION_UNDEPLOY = "Undeploy";
280.69 -
280.70 - public String SERVER_VIEW_LOG;
280.71 - public String APPLICATION_DISABLE;
280.72 - public String APPLICATION_ENABLE;
280.73 -
280.74 - /**
280.75 - * Prefix before application node in the list of web applications.
280.76 - */
280.77 - public String app_pref;
280.78 -
280.79 - /**
280.80 - * Path to web applications.
280.81 - */
280.82 - public String web_applications_path;
280.83 -
280.84 - /**
280.85 - * Path to JDBC resources.
280.86 - */
280.87 - public String jdbc_resources_path;
280.88 -
280.89 - /**
280.90 - * Array of items of Application Server's popup menu.
280.91 - */
280.92 - public String[][] server_popup;
280.93 -
280.94 - /**
280.95 - * Array of items of application's popup menu.
280.96 - */
280.97 - public String[] application_popup;
280.98 -
280.99 - /**
280.100 - * Array of items of resource's popup menu.
280.101 - */
280.102 - public String[] resource_popup;
280.103 -
280.104 - /**
280.105 - * Prefix for request to load application in browser.
280.106 - */
280.107 - public String requestPrefix;
280.108 -
280.109 - /**
280.110 - * Descriptor of deployment target.
280.111 - */
280.112 - private DeploymentTargetDescriptor DTDescriptor;
280.113 -
280.114 - /**
280.115 - * Get descriptor of Application Server.
280.116 - * @return descriptor of Application Server.
280.117 - */
280.118 - public DeploymentTargetDescriptor getDescriptor() {
280.119 - return DTDescriptor;
280.120 - }
280.121 -
280.122 - /**
280.123 - * Set descriptor of Application Server.
280.124 - * @param DTDescriptor New descriptor of Application Server.
280.125 - */
280.126 - protected void setDescriptor(DeploymentTargetDescriptor DTDescriptor) {
280.127 - this.DTDescriptor = DTDescriptor;
280.128 - }
280.129 -
280.130 - /**
280.131 - * Deploy project to this server.
280.132 - * @param project Project to deploy.
280.133 - */
280.134 - public void deploy(Object project) {
280.135 - try {
280.136 - Util.getMainWindow().btDeploy().push();
280.137 - }
280.138 - catch(Exception e) {
280.139 - throw new JemmyException("Application can't be deployed to " + getName() + "!", e);
280.140 - }
280.141 - TestUtils.wait(20000);
280.142 - }
280.143 -
280.144 - /**
280.145 - * Start Application Server.
280.146 - */
280.147 - public void start() {
280.148 - try {
280.149 - ServerNavigatorOperator.startServer(getName());
280.150 - }
280.151 - catch(Exception e) {
280.152 - throw new JemmyException(getName() + " can't be started!", e);
280.153 - }
280.154 - }
280.155 -
280.156 - /**
280.157 - * Stop Application Server.
280.158 - */
280.159 - public void stop() {
280.160 - try {
280.161 - ServerNavigatorOperator.stopServer(getName());
280.162 - }
280.163 - catch(Exception e) {
280.164 - throw new JemmyException(getName() + " can't be stopped!", e);
280.165 - }
280.166 - }
280.167 -
280.168 - /**
280.169 - * Instance of Application Server is compared with deployment target, passed with parameter.
280.170 - * @param dt Object for comparison.
280.171 - * @return true if Object equals to ApplicationServer.
280.172 - */
280.173 - public boolean equals(Object dt) {
280.174 - if ((dt instanceof DeploymentTarget) && ((DeploymentTarget) dt).getName().equals(this.getName())) {
280.175 - return true;
280.176 - }
280.177 - return false;
280.178 - }
280.179 -
280.180 - /**
280.181 - * Get name of Application Server.
280.182 - * @return name.
280.183 - */
280.184 - public String getName() {
280.185 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
280.186 - return DTDescriptor.getProperty(DTDescriptor.NAME_KEY + serverType);
280.187 - }
280.188 -}
281.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DefaultDeploymentTargetFactory.java Thu Jul 10 04:29:52 2008 -0700
281.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
281.3 @@ -1,99 +0,0 @@
281.4 -/*
281.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
281.6 - *
281.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
281.8 - *
281.9 - * The contents of this file are subject to the terms of either the GNU
281.10 - * General Public License Version 2 only ("GPL") or the Common
281.11 - * Development and Distribution License("CDDL") (collectively, the
281.12 - * "License"). You may not use this file except in compliance with the
281.13 - * License. You can obtain a copy of the License at
281.14 - * http://www.netbeans.org/cddl-gplv2.html
281.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
281.16 - * specific language governing permissions and limitations under the
281.17 - * License. When distributing the software, include this License Header
281.18 - * Notice in each file and include the License file at
281.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
281.20 - * particular file as subject to the "Classpath" exception as provided
281.21 - * by Sun in the GPL Version 2 section of the License file that
281.22 - * accompanied this code. If applicable, add the following below the
281.23 - * License Header, with the fields enclosed by brackets [] replaced by
281.24 - * your own identifying information:
281.25 - * "Portions Copyrighted [year] [name of copyright owner]"
281.26 - *
281.27 - * Contributor(s):
281.28 - *
281.29 - * The Original Software is NetBeans. The Initial Developer of the Original
281.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
281.31 - * Microsystems, Inc. All Rights Reserved.
281.32 - *
281.33 - * If you wish your version of this file to be governed by only the CDDL
281.34 - * or only the GPL Version 2, indicate your decision by adding
281.35 - * "[Contributor] elects to include this software in this distribution
281.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
281.37 - * single choice of license, a recipient has the option to distribute
281.38 - * your version of this file under either the CDDL, the GPL Version 2 or
281.39 - * to extend the choice of license to its licensees as provided above.
281.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
281.41 - * Version 2 license, then the option applies only if the new code is
281.42 - * made subject to such option by the copyright holder.
281.43 - */
281.44 -
281.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
281.46 -
281.47 -import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
281.48 -
281.49 -import org.netbeans.jemmy.JemmyException;
281.50 -
281.51 -/**
281.52 - * Default factory for creation of deployment targets.
281.53 - */
281.54 -
281.55 -public class DefaultDeploymentTargetFactory extends DeploymentTargetFactory {
281.56 -
281.57 - /**
281.58 - * Default deployment target factory.
281.59 - */
281.60 - private static DefaultDeploymentTargetFactory defaultDTFactory;
281.61 -
281.62 - /**
281.63 - * Create new DefaultDeploymentTargetFactory.
281.64 - */
281.65 - public DefaultDeploymentTargetFactory() {
281.66 - }
281.67 -
281.68 - /**
281.69 - * Create instance of DefaultDeploymentTargetFactory or return it, if it is already exist.
281.70 - * Singleton.
281.71 - * @return DefaultDeploymentTargetFactory.
281.72 - */
281.73 - public static DefaultDeploymentTargetFactory getFactory() {
281.74 - if (defaultDTFactory != null) return defaultDTFactory;
281.75 - else return (defaultDTFactory = new DefaultDeploymentTargetFactory());
281.76 - }
281.77 -
281.78 - /**
281.79 - * Create new deployment target.
281.80 - * Return server's type in accordance with PROP_NAME_SERVER_TYPE variable.
281.81 - * @param DTDescriptor Descriptor of deployment target.
281.82 - * @return created deployment target.
281.83 - */
281.84 - protected DeploymentTarget createInstance(DeploymentTargetDescriptor DTDescriptor) {
281.85 - try {
281.86 - ServerNavigatorOperator.addDeploymentTarget(DTDescriptor);
281.87 - }
281.88 - catch(Exception e) {
281.89 - throw new JemmyException("Deployment Target can't be added!", e);
281.90 - }
281.91 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
281.92 - if (serverType.equals(ServerNavigatorOperator.STR_NAME_WEBLOGIC)) return new WebLogic9(DTDescriptor);
281.93 - if (serverType.equals(ServerNavigatorOperator.STR_NAME_JBOSS)) return new JBoss4(DTDescriptor);
281.94 - if (serverType.equals(ServerNavigatorOperator.STR_NAME_GLASSFISH_V1) ||
281.95 - serverType.equals(ServerNavigatorOperator.STR_NAME_GLASSFISH_V2) ||
281.96 - serverType.equals(ServerNavigatorOperator.STR_NAME_APPSERVER)) return new SunApplicationServer(DTDescriptor);
281.97 - if (serverType.equals(ServerNavigatorOperator.STR_NAME_TOMCAT50)) return new Tomcat50(DTDescriptor);
281.98 - if (serverType.equals(ServerNavigatorOperator.STR_NAME_TOMCAT55)) return new Tomcat55(DTDescriptor);
281.99 - if (serverType.equals(ServerNavigatorOperator.STR_NAME_TOMCAT60)) return new Tomcat60(DTDescriptor);
281.100 - return null;
281.101 - }
281.102 -}
282.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTarget.java Thu Jul 10 04:29:52 2008 -0700
282.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
282.3 @@ -1,67 +0,0 @@
282.4 -/*
282.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
282.6 - *
282.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
282.8 - *
282.9 - * The contents of this file are subject to the terms of either the GNU
282.10 - * General Public License Version 2 only ("GPL") or the Common
282.11 - * Development and Distribution License("CDDL") (collectively, the
282.12 - * "License"). You may not use this file except in compliance with the
282.13 - * License. You can obtain a copy of the License at
282.14 - * http://www.netbeans.org/cddl-gplv2.html
282.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
282.16 - * specific language governing permissions and limitations under the
282.17 - * License. When distributing the software, include this License Header
282.18 - * Notice in each file and include the License file at
282.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
282.20 - * particular file as subject to the "Classpath" exception as provided
282.21 - * by Sun in the GPL Version 2 section of the License file that
282.22 - * accompanied this code. If applicable, add the following below the
282.23 - * License Header, with the fields enclosed by brackets [] replaced by
282.24 - * your own identifying information:
282.25 - * "Portions Copyrighted [year] [name of copyright owner]"
282.26 - *
282.27 - * Contributor(s):
282.28 - *
282.29 - * The Original Software is NetBeans. The Initial Developer of the Original
282.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
282.31 - * Microsystems, Inc. All Rights Reserved.
282.32 - *
282.33 - * If you wish your version of this file to be governed by only the CDDL
282.34 - * or only the GPL Version 2, indicate your decision by adding
282.35 - * "[Contributor] elects to include this software in this distribution
282.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
282.37 - * single choice of license, a recipient has the option to distribute
282.38 - * your version of this file under either the CDDL, the GPL Version 2 or
282.39 - * to extend the choice of license to its licensees as provided above.
282.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
282.41 - * Version 2 license, then the option applies only if the new code is
282.42 - * made subject to such option by the copyright holder.
282.43 - */
282.44 -
282.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
282.46 -
282.47 -/**
282.48 - * Common interface for all deployment targets, describing all general actions and methods.
282.49 - */
282.50 -
282.51 -public interface DeploymentTarget {
282.52 -
282.53 - /**
282.54 - * Deploy project to deployment target.
282.55 - * @param project for deployment.
282.56 - */
282.57 - public void deploy(Object project);
282.58 -
282.59 - /**
282.60 - * Get name of deployment target.
282.61 - * @return String value.
282.62 - */
282.63 - public String getName();
282.64 -
282.65 - /**
282.66 - * Get descriptor of of deployment target.
282.67 - * @return descriptor of deployment target.
282.68 - */
282.69 - public DeploymentTargetDescriptor getDescriptor();
282.70 -}
283.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTargetDescriptor.java Thu Jul 10 04:29:52 2008 -0700
283.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
283.3 @@ -1,142 +0,0 @@
283.4 -/*
283.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
283.6 - *
283.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
283.8 - *
283.9 - * The contents of this file are subject to the terms of either the GNU
283.10 - * General Public License Version 2 only ("GPL") or the Common
283.11 - * Development and Distribution License("CDDL") (collectively, the
283.12 - * "License"). You may not use this file except in compliance with the
283.13 - * License. You can obtain a copy of the License at
283.14 - * http://www.netbeans.org/cddl-gplv2.html
283.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
283.16 - * specific language governing permissions and limitations under the
283.17 - * License. When distributing the software, include this License Header
283.18 - * Notice in each file and include the License file at
283.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
283.20 - * particular file as subject to the "Classpath" exception as provided
283.21 - * by Sun in the GPL Version 2 section of the License file that
283.22 - * accompanied this code. If applicable, add the following below the
283.23 - * License Header, with the fields enclosed by brackets [] replaced by
283.24 - * your own identifying information:
283.25 - * "Portions Copyrighted [year] [name of copyright owner]"
283.26 - *
283.27 - * Contributor(s):
283.28 - *
283.29 - * The Original Software is NetBeans. The Initial Developer of the Original
283.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
283.31 - * Microsystems, Inc. All Rights Reserved.
283.32 - *
283.33 - * If you wish your version of this file to be governed by only the CDDL
283.34 - * or only the GPL Version 2, indicate your decision by adding
283.35 - * "[Contributor] elects to include this software in this distribution
283.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
283.37 - * single choice of license, a recipient has the option to distribute
283.38 - * your version of this file under either the CDDL, the GPL Version 2 or
283.39 - * to extend the choice of license to its licensees as provided above.
283.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
283.41 - * Version 2 license, then the option applies only if the new code is
283.42 - * made subject to such option by the copyright holder.
283.43 - */
283.44 -
283.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
283.46 -
283.47 -import org.netbeans.modules.visualweb.gravy.model.Descriptor;
283.48 -import org.netbeans.modules.visualweb.gravy.RaveTestCase;
283.49 -
283.50 -import java.util.Hashtable;
283.51 -
283.52 -/**
283.53 - * Descriptor for deployment targets.
283.54 - */
283.55 -
283.56 -public class DeploymentTargetDescriptor implements Descriptor{
283.57 -
283.58 - /**
283.59 - * Key for getting deployment target's name from properties.
283.60 - */
283.61 - public static final String NAME_KEY = "deployment.target.name.";
283.62 -
283.63 - /**
283.64 - * Key for getting deployment target's type from properties.
283.65 - */
283.66 - public static final String SERVER_TYPE_KEY = "deployment.target.type";
283.67 -
283.68 - /**
283.69 - * Key for getting deployment target's web request prefix from properties.
283.70 - */
283.71 - public static final String REQUEST_PREFIX_KEY = "deployment.target.prefix.";
283.72 -
283.73 - /**
283.74 - * Key for getting path to deployment target from properties.
283.75 - */
283.76 - public static final String PATH_KEY = "deployment.target.path.";
283.77 -
283.78 - /**
283.79 - * Key for getting deployment target's domain from properties.
283.80 - */
283.81 - public static final String DOMAIN_KEY = "deployment.target.domain.";
283.82 -
283.83 - /**
283.84 - * Key for getting login for deployment target from properties.
283.85 - */
283.86 - public static final String LOGIN_KEY = "deployment.target.login.";
283.87 -
283.88 - /**
283.89 - * Key for getting password for deployment target from properties.
283.90 - */
283.91 - public static final String PASSWORD_KEY = "deployment.target.password.";
283.92 -
283.93 - /**
283.94 - * Deployment target's properties.
283.95 - */
283.96 - private Hashtable properties = new Hashtable();
283.97 -
283.98 - /**
283.99 - * Return deployment target's properties.
283.100 - * @return Hashtable of properties.
283.101 - */
283.102 - public Hashtable getProperties() {
283.103 - return properties;
283.104 - }
283.105 -
283.106 - /**
283.107 - * Get value of specified deployment target's property.
283.108 - * @param propertyName Name of necessary property.
283.109 - * @return String value of property.
283.110 - */
283.111 - public String getProperty(String propertyName) {
283.112 - return properties.get(propertyName).toString();
283.113 - }
283.114 -
283.115 - /**
283.116 - * Set value for specified deployment target's property.
283.117 - * @param propertyName Name of necessary property.
283.118 - * @param propertyValue Value for necessary property.
283.119 - */
283.120 - public void setProperty(String propertyName, String propertyValue) {
283.121 - properties.put(propertyName, propertyValue);
283.122 - }
283.123 -
283.124 - /**
283.125 - * Load deployment target's properties.
283.126 - */
283.127 - public void load() {
283.128 - properties = RaveTestCase.getDeploymentTargetProperties();
283.129 - }
283.130 -
283.131 - /**
283.132 - * Load deployment target's properties from specified file.
283.133 - * @param path_to_file Path to file with properties.
283.134 - */
283.135 - public void load(String path_to_file) {
283.136 - properties = RaveTestCase.getDeploymentTargetProperties(path_to_file);
283.137 - }
283.138 -
283.139 - /**
283.140 - * Load default deployment target's properties.
283.141 - */
283.142 - public void loadDefault() {
283.143 - properties = RaveTestCase.getDefaultDeploymentTargetProperties();
283.144 - }
283.145 -}
284.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTargetFactory.java Thu Jul 10 04:29:52 2008 -0700
284.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
284.3 @@ -1,68 +0,0 @@
284.4 -/*
284.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
284.6 - *
284.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
284.8 - *
284.9 - * The contents of this file are subject to the terms of either the GNU
284.10 - * General Public License Version 2 only ("GPL") or the Common
284.11 - * Development and Distribution License("CDDL") (collectively, the
284.12 - * "License"). You may not use this file except in compliance with the
284.13 - * License. You can obtain a copy of the License at
284.14 - * http://www.netbeans.org/cddl-gplv2.html
284.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
284.16 - * specific language governing permissions and limitations under the
284.17 - * License. When distributing the software, include this License Header
284.18 - * Notice in each file and include the License file at
284.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
284.20 - * particular file as subject to the "Classpath" exception as provided
284.21 - * by Sun in the GPL Version 2 section of the License file that
284.22 - * accompanied this code. If applicable, add the following below the
284.23 - * License Header, with the fields enclosed by brackets [] replaced by
284.24 - * your own identifying information:
284.25 - * "Portions Copyrighted [year] [name of copyright owner]"
284.26 - *
284.27 - * Contributor(s):
284.28 - *
284.29 - * The Original Software is NetBeans. The Initial Developer of the Original
284.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
284.31 - * Microsystems, Inc. All Rights Reserved.
284.32 - *
284.33 - * If you wish your version of this file to be governed by only the CDDL
284.34 - * or only the GPL Version 2, indicate your decision by adding
284.35 - * "[Contributor] elects to include this software in this distribution
284.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
284.37 - * single choice of license, a recipient has the option to distribute
284.38 - * your version of this file under either the CDDL, the GPL Version 2 or
284.39 - * to extend the choice of license to its licensees as provided above.
284.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
284.41 - * Version 2 license, then the option applies only if the new code is
284.42 - * made subject to such option by the copyright holder.
284.43 - */
284.44 -
284.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
284.46 -
284.47 -/**
284.48 - * Factory for creation deployment targets.
284.49 - */
284.50 -
284.51 -public abstract class DeploymentTargetFactory {
284.52 -
284.53 - /**
284.54 - * Create new deployment target.
284.55 - * Add created deployment target to List, if deployemnt target isn't contained in it.
284.56 - * @param DTDescriptor Descriptor of deployment target.
284.57 - * @return created deployment target.
284.58 - */
284.59 - public final DeploymentTarget create(DeploymentTargetDescriptor DTDescriptor){
284.60 - DeploymentTarget dt = createInstance(DTDescriptor);
284.61 - if (!DeploymentTargetList.getList().contains(dt)) DeploymentTargetList.add(dt);
284.62 - return dt;
284.63 - }
284.64 -
284.65 - /**
284.66 - * Create new deployment target.
284.67 - * @param DTDescriptor Descriptor of deployment target.
284.68 - * @return created deployment target.
284.69 - */
284.70 - abstract protected DeploymentTarget createInstance(DeploymentTargetDescriptor DTDescriptor);
284.71 -}
285.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/DeploymentTargetList.java Thu Jul 10 04:29:52 2008 -0700
285.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
285.3 @@ -1,108 +0,0 @@
285.4 -/*
285.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
285.6 - *
285.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
285.8 - *
285.9 - * The contents of this file are subject to the terms of either the GNU
285.10 - * General Public License Version 2 only ("GPL") or the Common
285.11 - * Development and Distribution License("CDDL") (collectively, the
285.12 - * "License"). You may not use this file except in compliance with the
285.13 - * License. You can obtain a copy of the License at
285.14 - * http://www.netbeans.org/cddl-gplv2.html
285.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
285.16 - * specific language governing permissions and limitations under the
285.17 - * License. When distributing the software, include this License Header
285.18 - * Notice in each file and include the License file at
285.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
285.20 - * particular file as subject to the "Classpath" exception as provided
285.21 - * by Sun in the GPL Version 2 section of the License file that
285.22 - * accompanied this code. If applicable, add the following below the
285.23 - * License Header, with the fields enclosed by brackets [] replaced by
285.24 - * your own identifying information:
285.25 - * "Portions Copyrighted [year] [name of copyright owner]"
285.26 - *
285.27 - * Contributor(s):
285.28 - *
285.29 - * The Original Software is NetBeans. The Initial Developer of the Original
285.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
285.31 - * Microsystems, Inc. All Rights Reserved.
285.32 - *
285.33 - * If you wish your version of this file to be governed by only the CDDL
285.34 - * or only the GPL Version 2, indicate your decision by adding
285.35 - * "[Contributor] elects to include this software in this distribution
285.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
285.37 - * single choice of license, a recipient has the option to distribute
285.38 - * your version of this file under either the CDDL, the GPL Version 2 or
285.39 - * to extend the choice of license to its licensees as provided above.
285.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
285.41 - * Version 2 license, then the option applies only if the new code is
285.42 - * made subject to such option by the copyright holder.
285.43 - */
285.44 -
285.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
285.46 -
285.47 -import java.util.List;
285.48 -import java.util.ArrayList;
285.49 -
285.50 -/**
285.51 - * List of deployment targets.
285.52 - */
285.53 -
285.54 -public class DeploymentTargetList {
285.55 -
285.56 - /**
285.57 - * Default deployment target.
285.58 - */
285.59 - private DeploymentTarget defaultDT;
285.60 -
285.61 - /**
285.62 - * List of deployment targets.
285.63 - */
285.64 - private static List DTList = new ArrayList();;
285.65 -
285.66 - /**
285.67 - * Create new DeploymentTargetList.
285.68 - */
285.69 - public DeploymentTargetList() {
285.70 - }
285.71 -
285.72 - /**
285.73 - * Get list of deployment targets.
285.74 - * @return List of deployment targets.
285.75 - */
285.76 - public static List getList() {
285.77 - return DTList;
285.78 - }
285.79 -
285.80 - /**
285.81 - * Add deployment target to List.
285.82 - * @param dt Deployment Target for add.
285.83 - */
285.84 - public static void add(DeploymentTarget dt) {
285.85 - DTList.add(dt);
285.86 - }
285.87 -
285.88 - /**
285.89 - * Remove deployment target from List.
285.90 - * @param dt Deployment Target for remove.
285.91 - */
285.92 - public static void remove(DeploymentTarget dt) {
285.93 - DTList.remove(dt);
285.94 - }
285.95 -
285.96 - /**
285.97 - * Return default deployment target.
285.98 - * @return defaultDT variable.
285.99 - */
285.100 - public DeploymentTarget getDefaultDT() {
285.101 - return defaultDT;
285.102 - }
285.103 -
285.104 - /**
285.105 - * Set default deployment target.
285.106 - * @param dt Deployment Target to be set as default.
285.107 - */
285.108 - public void setDefaultDT(DeploymentTarget dt) {
285.109 - defaultDT = dt;
285.110 - }
285.111 -}
286.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/JBoss4.java Thu Jul 10 04:29:52 2008 -0700
286.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
286.3 @@ -1,79 +0,0 @@
286.4 -/*
286.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
286.6 - *
286.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
286.8 - *
286.9 - * The contents of this file are subject to the terms of either the GNU
286.10 - * General Public License Version 2 only ("GPL") or the Common
286.11 - * Development and Distribution License("CDDL") (collectively, the
286.12 - * "License"). You may not use this file except in compliance with the
286.13 - * License. You can obtain a copy of the License at
286.14 - * http://www.netbeans.org/cddl-gplv2.html
286.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
286.16 - * specific language governing permissions and limitations under the
286.17 - * License. When distributing the software, include this License Header
286.18 - * Notice in each file and include the License file at
286.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
286.20 - * particular file as subject to the "Classpath" exception as provided
286.21 - * by Sun in the GPL Version 2 section of the License file that
286.22 - * accompanied this code. If applicable, add the following below the
286.23 - * License Header, with the fields enclosed by brackets [] replaced by
286.24 - * your own identifying information:
286.25 - * "Portions Copyrighted [year] [name of copyright owner]"
286.26 - *
286.27 - * Contributor(s):
286.28 - *
286.29 - * The Original Software is NetBeans. The Initial Developer of the Original
286.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
286.31 - * Microsystems, Inc. All Rights Reserved.
286.32 - *
286.33 - * If you wish your version of this file to be governed by only the CDDL
286.34 - * or only the GPL Version 2, indicate your decision by adding
286.35 - * "[Contributor] elects to include this software in this distribution
286.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
286.37 - * single choice of license, a recipient has the option to distribute
286.38 - * your version of this file under either the CDDL, the GPL Version 2 or
286.39 - * to extend the choice of license to its licensees as provided above.
286.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
286.41 - * Version 2 license, then the option applies only if the new code is
286.42 - * made subject to such option by the copyright holder.
286.43 - */
286.44 -
286.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
286.46 -
286.47 -/**
286.48 - * Class representing JBoss Application Servers.
286.49 - */
286.50 -
286.51 -public class JBoss4 extends ApplicationServer {
286.52 -
286.53 - public final static String SERVER_START_PROFILE = "Start in Profile Mode";
286.54 - public final static String SERVER_VIEW_JMX = "View JMX Console";
286.55 - public final static String APPLICATION_OPEN = "Open in Browser";
286.56 - public final static String applications_node = "Applications";
286.57 - public final static String web_applications_node = "Web Applications";
286.58 -
286.59 - {
286.60 - this.SERVER_VIEW_LOG = "View Server Log";
286.61 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
286.62 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
286.63 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
286.64 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
286.65 - {PROPERTIES, "true", "true"},*/ {SERVER_VIEW_CONSOLE, "true", "true"},
286.66 - {SERVER_VIEW_JMX, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
286.67 - {PROPERTIES, "true", "true"}};
286.68 - this.application_popup = new String[] {APPLICATION_OPEN, APPLICATION_UNDEPLOY};
286.69 - this.app_pref = "";
286.70 - }
286.71 -
286.72 - /**
286.73 - * Creates JBoss4 with specified descriptor.
286.74 - * @param DTDescriptor Descriptor of JBoss Application Server.
286.75 - */
286.76 - public JBoss4(DeploymentTargetDescriptor DTDescriptor) {
286.77 - setDescriptor(DTDescriptor);
286.78 - this.web_applications_path = getName() + "|" + applications_node + "|" + web_applications_node;
286.79 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
286.80 - this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
286.81 - }
286.82 -}
287.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/SunApplicationServer.java Thu Jul 10 04:29:52 2008 -0700
287.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
287.3 @@ -1,83 +0,0 @@
287.4 -/*
287.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
287.6 - *
287.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
287.8 - *
287.9 - * The contents of this file are subject to the terms of either the GNU
287.10 - * General Public License Version 2 only ("GPL") or the Common
287.11 - * Development and Distribution License("CDDL") (collectively, the
287.12 - * "License"). You may not use this file except in compliance with the
287.13 - * License. You can obtain a copy of the License at
287.14 - * http://www.netbeans.org/cddl-gplv2.html
287.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
287.16 - * specific language governing permissions and limitations under the
287.17 - * License. When distributing the software, include this License Header
287.18 - * Notice in each file and include the License file at
287.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
287.20 - * particular file as subject to the "Classpath" exception as provided
287.21 - * by Sun in the GPL Version 2 section of the License file that
287.22 - * accompanied this code. If applicable, add the following below the
287.23 - * License Header, with the fields enclosed by brackets [] replaced by
287.24 - * your own identifying information:
287.25 - * "Portions Copyrighted [year] [name of copyright owner]"
287.26 - *
287.27 - * Contributor(s):
287.28 - *
287.29 - * The Original Software is NetBeans. The Initial Developer of the Original
287.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
287.31 - * Microsystems, Inc. All Rights Reserved.
287.32 - *
287.33 - * If you wish your version of this file to be governed by only the CDDL
287.34 - * or only the GPL Version 2, indicate your decision by adding
287.35 - * "[Contributor] elects to include this software in this distribution
287.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
287.37 - * single choice of license, a recipient has the option to distribute
287.38 - * your version of this file under either the CDDL, the GPL Version 2 or
287.39 - * to extend the choice of license to its licensees as provided above.
287.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
287.41 - * Version 2 license, then the option applies only if the new code is
287.42 - * made subject to such option by the copyright holder.
287.43 - */
287.44 -
287.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
287.46 -
287.47 -/**
287.48 - * Class representing Sun Application Servers.
287.49 - */
287.50 -
287.51 -public class SunApplicationServer extends ApplicationServer {
287.52 -
287.53 - public final static String SERVER_START_PROFILE = "Start in Profile Mode";
287.54 - public final static String RESOURCE_DELETE = "Delete Resource";
287.55 - public final static String applications_node = "Applications";
287.56 - public final static String web_applications_node = "Web Applications";
287.57 - public final static String resources_node = "Resources";
287.58 - public final static String jdbc_node = "JDBC";
287.59 - public final static String jdbc_resources_node = "JDBC Resources";
287.60 -
287.61 - {
287.62 - this.SERVER_VIEW_LOG = "View Server Log";
287.63 - this.APPLICATION_DISABLE = "Disable";
287.64 - this.APPLICATION_ENABLE = "Enable";
287.65 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
287.66 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
287.67 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
287.68 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
287.69 - {PROPERTIES, "true", "true"},*/ {SERVER_VIEW_CONSOLE, "true", "true"},
287.70 - {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
287.71 - this.application_popup = new String[] {APPLICATION_UNDEPLOY, APPLICATION_DISABLE, PROPERTIES};
287.72 - this.app_pref = "";
287.73 - }
287.74 -
287.75 - /**
287.76 - * Creates SunApplicationServer with specified descriptor.
287.77 - * @param DTDescriptor Descriptor of Sun Application Server.
287.78 - */
287.79 - public SunApplicationServer(DeploymentTargetDescriptor DTDescriptor) {
287.80 - setDescriptor(DTDescriptor);
287.81 - this.web_applications_path = getName() + "|" + applications_node + "|" + web_applications_node;
287.82 - this.jdbc_resources_path = getName() + "|" + resources_node + "|" + jdbc_node + "|" + jdbc_resources_node;
287.83 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
287.84 - this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
287.85 - }
287.86 -}
288.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/Tomcat50.java Thu Jul 10 04:29:52 2008 -0700
288.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
288.3 @@ -1,93 +0,0 @@
288.4 -/*
288.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
288.6 - *
288.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
288.8 - *
288.9 - * The contents of this file are subject to the terms of either the GNU
288.10 - * General Public License Version 2 only ("GPL") or the Common
288.11 - * Development and Distribution License("CDDL") (collectively, the
288.12 - * "License"). You may not use this file except in compliance with the
288.13 - * License. You can obtain a copy of the License at
288.14 - * http://www.netbeans.org/cddl-gplv2.html
288.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
288.16 - * specific language governing permissions and limitations under the
288.17 - * License. When distributing the software, include this License Header
288.18 - * Notice in each file and include the License file at
288.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
288.20 - * particular file as subject to the "Classpath" exception as provided
288.21 - * by Sun in the GPL Version 2 section of the License file that
288.22 - * accompanied this code. If applicable, add the following below the
288.23 - * License Header, with the fields enclosed by brackets [] replaced by
288.24 - * your own identifying information:
288.25 - * "Portions Copyrighted [year] [name of copyright owner]"
288.26 - *
288.27 - * Contributor(s):
288.28 - *
288.29 - * The Original Software is NetBeans. The Initial Developer of the Original
288.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
288.31 - * Microsystems, Inc. All Rights Reserved.
288.32 - *
288.33 - * If you wish your version of this file to be governed by only the CDDL
288.34 - * or only the GPL Version 2, indicate your decision by adding
288.35 - * "[Contributor] elects to include this software in this distribution
288.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
288.37 - * single choice of license, a recipient has the option to distribute
288.38 - * your version of this file under either the CDDL, the GPL Version 2 or
288.39 - * to extend the choice of license to its licensees as provided above.
288.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
288.41 - * Version 2 license, then the option applies only if the new code is
288.42 - * made subject to such option by the copyright holder.
288.43 - */
288.44 -
288.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
288.46 -
288.47 -/**
288.48 - * Class representing Tomcat 5.0 Application Servers.
288.49 - */
288.50 -
288.51 -public class Tomcat50 extends ApplicationServer {
288.52 -
288.53 - public final static String SERVER_START_PROFILE = "Start in Profile Mode";
288.54 - public final static String SERVER_EDIT_XML = "Edit server.xml";
288.55 - public final static String SERVER_VIEW_CONTEXT_LOG = "View Shared Context Log";
288.56 - public final static String SERVER_TERMINATE = "Terminate";
288.57 - public final static String APPLICATION_OPEN = "Open in Browser";
288.58 - public final static String APPLICATION_VIEW_LOG = "View Context Log";
288.59 - public final static String web_applications_node = "Web Applications";
288.60 -
288.61 - {
288.62 - this.SERVER_VIEW_LOG = "View Server Output";
288.63 - this.APPLICATION_DISABLE = "Stop";
288.64 - this.APPLICATION_ENABLE = "Start";
288.65 - if (System.getProperty("os.name").indexOf("Windows") == -1)
288.66 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
288.67 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
288.68 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
288.69 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
288.70 - {PROPERTIES, "true", "true"},*/ {SERVER_TERMINATE, "true", "false"},
288.71 - {SERVER_EDIT_XML, "true", "true"}, {SERVER_VIEW_CONSOLE, "true", "true"},
288.72 - {SERVER_VIEW_CONTEXT_LOG, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
288.73 - {PROPERTIES, "true", "true"}};
288.74 - else
288.75 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
288.76 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
288.77 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
288.78 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
288.79 - {PROPERTIES, "true", "true"},*/ {SERVER_EDIT_XML, "true", "true"},
288.80 - {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_CONTEXT_LOG, "true", "true"},
288.81 - {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
288.82 - this.application_popup = new String[] {APPLICATION_ENABLE, APPLICATION_DISABLE, APPLICATION_OPEN, APPLICATION_VIEW_LOG, APPLICATION_UNDEPLOY};
288.83 - this.app_pref = "/";
288.84 - }
288.85 -
288.86 - /**
288.87 - * Creates Tomcat50 with specified descriptor.
288.88 - * @param DTDescriptor Descriptor of Tomcat 5.0 Application Server.
288.89 - */
288.90 - public Tomcat50(DeploymentTargetDescriptor DTDescriptor) {
288.91 - setDescriptor(DTDescriptor);
288.92 - this.web_applications_path = getName() + "|" + web_applications_node;
288.93 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
288.94 - this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
288.95 - }
288.96 -}
289.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/Tomcat55.java Thu Jul 10 04:29:52 2008 -0700
289.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
289.3 @@ -1,93 +0,0 @@
289.4 -/*
289.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
289.6 - *
289.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
289.8 - *
289.9 - * The contents of this file are subject to the terms of either the GNU
289.10 - * General Public License Version 2 only ("GPL") or the Common
289.11 - * Development and Distribution License("CDDL") (collectively, the
289.12 - * "License"). You may not use this file except in compliance with the
289.13 - * License. You can obtain a copy of the License at
289.14 - * http://www.netbeans.org/cddl-gplv2.html
289.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
289.16 - * specific language governing permissions and limitations under the
289.17 - * License. When distributing the software, include this License Header
289.18 - * Notice in each file and include the License file at
289.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
289.20 - * particular file as subject to the "Classpath" exception as provided
289.21 - * by Sun in the GPL Version 2 section of the License file that
289.22 - * accompanied this code. If applicable, add the following below the
289.23 - * License Header, with the fields enclosed by brackets [] replaced by
289.24 - * your own identifying information:
289.25 - * "Portions Copyrighted [year] [name of copyright owner]"
289.26 - *
289.27 - * Contributor(s):
289.28 - *
289.29 - * The Original Software is NetBeans. The Initial Developer of the Original
289.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
289.31 - * Microsystems, Inc. All Rights Reserved.
289.32 - *
289.33 - * If you wish your version of this file to be governed by only the CDDL
289.34 - * or only the GPL Version 2, indicate your decision by adding
289.35 - * "[Contributor] elects to include this software in this distribution
289.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
289.37 - * single choice of license, a recipient has the option to distribute
289.38 - * your version of this file under either the CDDL, the GPL Version 2 or
289.39 - * to extend the choice of license to its licensees as provided above.
289.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
289.41 - * Version 2 license, then the option applies only if the new code is
289.42 - * made subject to such option by the copyright holder.
289.43 - */
289.44 -
289.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
289.46 -
289.47 -/**
289.48 - * Class representing Tomcat 5.5 Application Servers.
289.49 - */
289.50 -
289.51 -public class Tomcat55 extends ApplicationServer {
289.52 -
289.53 - public final static String SERVER_START_PROFILE = "Start in Profile Mode";
289.54 - public final static String SERVER_EDIT_XML = "Edit server.xml";
289.55 - public final static String SERVER_VIEW_CONTEXT_LOG = "View Server Log";
289.56 - public final static String SERVER_TERMINATE = "Terminate";
289.57 - public final static String APPLICATION_OPEN = "Open in Browser";
289.58 - public final static String web_applications_node = "Web Applications";
289.59 -
289.60 -
289.61 - {
289.62 - this.SERVER_VIEW_LOG = "View Server Output";
289.63 - this.APPLICATION_DISABLE = "Stop";
289.64 - this.APPLICATION_ENABLE = "Start";
289.65 - if (System.getProperty("os.name").indexOf("Windows") == -1)
289.66 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
289.67 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
289.68 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
289.69 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
289.70 - {PROPERTIES, "true", "true"},*/ {SERVER_TERMINATE, "true", "false"},
289.71 - {SERVER_EDIT_XML, "true", "true"}, {SERVER_VIEW_CONSOLE, "true", "true"},
289.72 - {SERVER_VIEW_CONTEXT_LOG, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
289.73 - {PROPERTIES, "true", "true"}};
289.74 - else
289.75 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
289.76 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
289.77 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
289.78 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
289.79 - {PROPERTIES, "true", "true"},*/ {SERVER_EDIT_XML, "true", "true"},
289.80 - {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_CONTEXT_LOG, "true", "true"},
289.81 - {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
289.82 - this.application_popup = new String[] {APPLICATION_ENABLE, APPLICATION_DISABLE, APPLICATION_OPEN, APPLICATION_UNDEPLOY};
289.83 - this.app_pref = "/";
289.84 - }
289.85 -
289.86 - /**
289.87 - * Creates Tomcat55 with specified descriptor.
289.88 - * @param DTDescriptor Descriptor of Tomcat 5.5 Application Server.
289.89 - */
289.90 - public Tomcat55(DeploymentTargetDescriptor DTDescriptor) {
289.91 - setDescriptor(DTDescriptor);
289.92 - this.web_applications_path = getName() + "|" + web_applications_node;
289.93 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
289.94 - this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
289.95 - }
289.96 -}
290.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/Tomcat60.java Thu Jul 10 04:29:52 2008 -0700
290.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
290.3 @@ -1,90 +0,0 @@
290.4 -/*
290.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
290.6 - *
290.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
290.8 - *
290.9 - * The contents of this file are subject to the terms of either the GNU
290.10 - * General Public License Version 2 only ("GPL") or the Common
290.11 - * Development and Distribution License("CDDL") (collectively, the
290.12 - * "License"). You may not use this file except in compliance with the
290.13 - * License. You can obtain a copy of the License at
290.14 - * http://www.netbeans.org/cddl-gplv2.html
290.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
290.16 - * specific language governing permissions and limitations under the
290.17 - * License. When distributing the software, include this License Header
290.18 - * Notice in each file and include the License file at
290.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
290.20 - * particular file as subject to the "Classpath" exception as provided
290.21 - * by Sun in the GPL Version 2 section of the License file that
290.22 - * accompanied this code. If applicable, add the following below the
290.23 - * License Header, with the fields enclosed by brackets [] replaced by
290.24 - * your own identifying information:
290.25 - * "Portions Copyrighted [year] [name of copyright owner]"
290.26 - *
290.27 - * Contributor(s):
290.28 - *
290.29 - * The Original Software is NetBeans. The Initial Developer of the Original
290.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
290.31 - * Microsystems, Inc. All Rights Reserved.
290.32 - *
290.33 - * If you wish your version of this file to be governed by only the CDDL
290.34 - * or only the GPL Version 2, indicate your decision by adding
290.35 - * "[Contributor] elects to include this software in this distribution
290.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
290.37 - * single choice of license, a recipient has the option to distribute
290.38 - * your version of this file under either the CDDL, the GPL Version 2 or
290.39 - * to extend the choice of license to its licensees as provided above.
290.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
290.41 - * Version 2 license, then the option applies only if the new code is
290.42 - * made subject to such option by the copyright holder.
290.43 - */
290.44 -
290.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
290.46 -
290.47 -/**
290.48 - * Class representing Tomcat 6.0 Application Servers.
290.49 - */
290.50 -
290.51 -public class Tomcat60 extends ApplicationServer {
290.52 -
290.53 - public final static String SERVER_START_PROFILE = "Start in Profile Mode";
290.54 - public final static String SERVER_EDIT_XML = "Edit server.xml";
290.55 - public final static String SERVER_TERMINATE = "Terminate";
290.56 - public final static String APPLICATION_OPEN = "Open in Browser";
290.57 - public final static String web_applications_node = "Web Applications";
290.58 -
290.59 - {
290.60 - this.SERVER_VIEW_LOG = "View Server Output";
290.61 - this.APPLICATION_DISABLE = "Stop";
290.62 - this.APPLICATION_ENABLE = "Start";
290.63 - if (System.getProperty("os.name").indexOf("Windows") == -1)
290.64 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
290.65 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
290.66 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
290.67 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
290.68 - {PROPERTIES, "true", "true"},*/ {SERVER_TERMINATE, "true", "false"},
290.69 - {SERVER_EDIT_XML, "true", "true"}, {SERVER_VIEW_CONSOLE, "true", "true"},
290.70 - {SERVER_VIEW_LOG, "true", "true"}, {PROPERTIES, "true", "true"}};
290.71 - else
290.72 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
290.73 - {SERVER_START_PROFILE, "false", "true"}, {SERVER_RESTART, "true", "false"},
290.74 - {SERVER_STOP, "true", "false"}, {REFRESH, "true", "true"},
290.75 - {SERVER_REMOVE, "true", "true"},/* {SERVER_CUSTOMIZE, "true", "true"},
290.76 - {PROPERTIES, "true", "true"},*/ {SERVER_EDIT_XML, "true", "true"},
290.77 - {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
290.78 - {PROPERTIES, "true", "true"}};
290.79 - this.application_popup = new String[] {APPLICATION_ENABLE, APPLICATION_DISABLE, APPLICATION_OPEN, APPLICATION_UNDEPLOY};
290.80 - this.app_pref = "/";
290.81 - }
290.82 -
290.83 - /**
290.84 - * Creates Tomcat55 with specified descriptor.
290.85 - * @param DTDescriptor Descriptor of Tomcat 5.5 Application Server.
290.86 - */
290.87 - public Tomcat60(DeploymentTargetDescriptor DTDescriptor) {
290.88 - setDescriptor(DTDescriptor);
290.89 - this.web_applications_path = getName() + "|" + web_applications_node;
290.90 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
290.91 - this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
290.92 - }
290.93 -}
291.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/deployment/WebLogic9.java Thu Jul 10 04:29:52 2008 -0700
291.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
291.3 @@ -1,69 +0,0 @@
291.4 -/*
291.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
291.6 - *
291.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
291.8 - *
291.9 - * The contents of this file are subject to the terms of either the GNU
291.10 - * General Public License Version 2 only ("GPL") or the Common
291.11 - * Development and Distribution License("CDDL") (collectively, the
291.12 - * "License"). You may not use this file except in compliance with the
291.13 - * License. You can obtain a copy of the License at
291.14 - * http://www.netbeans.org/cddl-gplv2.html
291.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
291.16 - * specific language governing permissions and limitations under the
291.17 - * License. When distributing the software, include this License Header
291.18 - * Notice in each file and include the License file at
291.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
291.20 - * particular file as subject to the "Classpath" exception as provided
291.21 - * by Sun in the GPL Version 2 section of the License file that
291.22 - * accompanied this code. If applicable, add the following below the
291.23 - * License Header, with the fields enclosed by brackets [] replaced by
291.24 - * your own identifying information:
291.25 - * "Portions Copyrighted [year] [name of copyright owner]"
291.26 - *
291.27 - * Contributor(s):
291.28 - *
291.29 - * The Original Software is NetBeans. The Initial Developer of the Original
291.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
291.31 - * Microsystems, Inc. All Rights Reserved.
291.32 - *
291.33 - * If you wish your version of this file to be governed by only the CDDL
291.34 - * or only the GPL Version 2, indicate your decision by adding
291.35 - * "[Contributor] elects to include this software in this distribution
291.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
291.37 - * single choice of license, a recipient has the option to distribute
291.38 - * your version of this file under either the CDDL, the GPL Version 2 or
291.39 - * to extend the choice of license to its licensees as provided above.
291.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
291.41 - * Version 2 license, then the option applies only if the new code is
291.42 - * made subject to such option by the copyright holder.
291.43 - */
291.44 -
291.45 -package org.netbeans.modules.visualweb.gravy.model.deployment;
291.46 -
291.47 -/**
291.48 - * Class representing BEA WebLogic Application Servers.
291.49 - */
291.50 -
291.51 -public class WebLogic9 extends ApplicationServer {
291.52 -
291.53 - {
291.54 - this.SERVER_VIEW_LOG = "View Server Log";
291.55 - this.server_popup = new String[][] {{SERVER_START, "false", "true"}, {SERVER_START_DEBUG, "false", "true"},
291.56 - {SERVER_RESTART, "true", "false"}, {SERVER_STOP, "true", "false"},
291.57 - {REFRESH, "true", "true"}, {SERVER_REMOVE, "true", "true"},/*
291.58 - {SERVER_CUSTOMIZE, "true", "true"}, {PROPERTIES, "true", "true"},*/
291.59 - {SERVER_VIEW_CONSOLE, "true", "true"}, {SERVER_VIEW_LOG, "true", "true"},
291.60 - {PROPERTIES, "true", "true"}};
291.61 - }
291.62 -
291.63 - /**
291.64 - * Creates WebLogic9 with specified descriptor.
291.65 - * @param DTDescriptor Descriptor of WebLogic Application Server.
291.66 - */
291.67 - public WebLogic9(DeploymentTargetDescriptor DTDescriptor) {
291.68 - setDescriptor(DTDescriptor);
291.69 - String serverType = DTDescriptor.getProperty(DTDescriptor.SERVER_TYPE_KEY);
291.70 - this.requestPrefix = DTDescriptor.getProperty(DTDescriptor.REQUEST_PREFIX_KEY + serverType);
291.71 - }
291.72 -}
292.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/Bundle.properties Thu Jul 10 04:29:52 2008 -0700
292.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
292.3 @@ -1,58 +0,0 @@
292.4 -/*
292.5 -
292.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
292.7 - *
292.8 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
292.9 -
292.10 - *
292.11 - * The contents of this file are subject to the terms of either the GNU
292.12 - * General Public License Version 2 only ("GPL") or the Common
292.13 - * Development and Distribution License("CDDL") (collectively, the
292.14 - * "License"). You may not use this file except in compliance with the
292.15 - * License. You can obtain a copy of the License at
292.16 - * http://www.netbeans.org/cddl-gplv2.html
292.17 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
292.18 - * specific language governing permissions and limitations under the
292.19 - * License. When distributing the software, include this License Header
292.20 - * Notice in each file and include the License file at
292.21 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
292.22 - * particular file as subject to the "Classpath" exception as provided
292.23 - * by Sun in the GPL Version 2 section of the License file that
292.24 - * accompanied this code. If applicable, add the following below the
292.25 - * License Header, with the fields enclosed by brackets [] replaced by
292.26 - * your own identifying information:
292.27 - * "Portions Copyrighted [year] [name of copyright owner]"
292.28 - *
292.29 - * Contributor(s):
292.30 -
292.31 - *
292.32 -
292.33 - * The Original Software is NetBeans. The Initial Developer of the Original
292.34 -
292.35 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
292.36 -
292.37 - * Microsystems, Inc. All Rights Reserved.
292.38 - *
292.39 - * If you wish your version of this file to be governed by only the CDDL
292.40 - * or only the GPL Version 2, indicate your decision by adding
292.41 - * "[Contributor] elects to include this software in this distribution
292.42 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
292.43 - * single choice of license, a recipient has the option to distribute
292.44 - * your version of this file under either the CDDL, the GPL Version 2 or
292.45 - * to extend the choice of license to its licensees as provided above.
292.46 - * However, if you add GPL Version 2 code and therefore, elected the GPL
292.47 - * Version 2 license, then the option applies only if the new code is
292.48 - * made subject to such option by the copyright holder.
292.49 -
292.50 - */
292.51 -
292.52 -
292.53 -
292.54 -#properties for navigation and rave navigation bundle
292.55 -
292.56 -NavigationBundle=org.netbeans.modules.visualweb.project.navigationloader.Bundle
292.57 -
292.58 -PageNavigation=CTL_NavigationTCDisplayName
292.59 -
292.60 -OpenPopupItem=Open
292.61 -
293.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/Link.java Thu Jul 10 04:29:52 2008 -0700
293.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
293.3 @@ -1,83 +0,0 @@
293.4 -/*
293.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
293.6 - *
293.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
293.8 - *
293.9 - * The contents of this file are subject to the terms of either the GNU
293.10 - * General Public License Version 2 only ("GPL") or the Common
293.11 - * Development and Distribution License("CDDL") (collectively, the
293.12 - * "License"). You may not use this file except in compliance with the
293.13 - * License. You can obtain a copy of the License at
293.14 - * http://www.netbeans.org/cddl-gplv2.html
293.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
293.16 - * specific language governing permissions and limitations under the
293.17 - * License. When distributing the software, include this License Header
293.18 - * Notice in each file and include the License file at
293.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
293.20 - * particular file as subject to the "Classpath" exception as provided
293.21 - * by Sun in the GPL Version 2 section of the License file that
293.22 - * accompanied this code. If applicable, add the following below the
293.23 - * License Header, with the fields enclosed by brackets [] replaced by
293.24 - * your own identifying information:
293.25 - * "Portions Copyrighted [year] [name of copyright owner]"
293.26 - *
293.27 - * Contributor(s):
293.28 - *
293.29 - * The Original Software is NetBeans. The Initial Developer of the Original
293.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
293.31 - * Microsystems, Inc. All Rights Reserved.
293.32 - *
293.33 - * If you wish your version of this file to be governed by only the CDDL
293.34 - * or only the GPL Version 2, indicate your decision by adding
293.35 - * "[Contributor] elects to include this software in this distribution
293.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
293.37 - * single choice of license, a recipient has the option to distribute
293.38 - * your version of this file under either the CDDL, the GPL Version 2 or
293.39 - * to extend the choice of license to its licensees as provided above.
293.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
293.41 - * Version 2 license, then the option applies only if the new code is
293.42 - * made subject to such option by the copyright holder.
293.43 - */
293.44 -
293.45 -package org.netbeans.modules.visualweb.gravy.model.navigation;
293.46 -
293.47 -/**
293.48 - * Class for links.
293.49 - */
293.50 -
293.51 -public class Link {
293.52 -
293.53 - String name;
293.54 - LinkableSource source;
293.55 - LinkableTarget target;
293.56 -
293.57 - /**
293.58 - * Create new link from source to target with specified name.
293.59 - */
293.60 - Link(LinkableSource source, LinkableTarget target, String name) {
293.61 - this.source = source;
293.62 - this.target = target;
293.63 - this.name = name;
293.64 - }
293.65 -
293.66 - /**
293.67 - * Get link name.
293.68 - */
293.69 - public String getName() {
293.70 - return name;
293.71 - }
293.72 -
293.73 - /**
293.74 - * Get link source.
293.75 - */
293.76 - public LinkableSource getSource() {
293.77 - return source;
293.78 - }
293.79 -
293.80 - /**
293.81 - * Get link target.
293.82 - */
293.83 - public LinkableTarget getTarget() {
293.84 - return target;
293.85 - }
293.86 -}
294.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/LinkManager.java Thu Jul 10 04:29:52 2008 -0700
294.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
294.3 @@ -1,180 +0,0 @@
294.4 -/*
294.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
294.6 - *
294.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
294.8 - *
294.9 - * The contents of this file are subject to the terms of either the GNU
294.10 - * General Public License Version 2 only ("GPL") or the Common
294.11 - * Development and Distribution License("CDDL") (collectively, the
294.12 - * "License"). You may not use this file except in compliance with the
294.13 - * License. You can obtain a copy of the License at
294.14 - * http://www.netbeans.org/cddl-gplv2.html
294.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
294.16 - * specific language governing permissions and limitations under the
294.17 - * License. When distributing the software, include this License Header
294.18 - * Notice in each file and include the License file at
294.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
294.20 - * particular file as subject to the "Classpath" exception as provided
294.21 - * by Sun in the GPL Version 2 section of the License file that
294.22 - * accompanied this code. If applicable, add the following below the
294.23 - * License Header, with the fields enclosed by brackets [] replaced by
294.24 - * your own identifying information:
294.25 - * "Portions Copyrighted [year] [name of copyright owner]"
294.26 - *
294.27 - * Contributor(s):
294.28 - *
294.29 - * The Original Software is NetBeans. The Initial Developer of the Original
294.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
294.31 - * Microsystems, Inc. All Rights Reserved.
294.32 - *
294.33 - * If you wish your version of this file to be governed by only the CDDL
294.34 - * or only the GPL Version 2, indicate your decision by adding
294.35 - * "[Contributor] elects to include this software in this distribution
294.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
294.37 - * single choice of license, a recipient has the option to distribute
294.38 - * your version of this file under either the CDDL, the GPL Version 2 or
294.39 - * to extend the choice of license to its licensees as provided above.
294.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
294.41 - * Version 2 license, then the option applies only if the new code is
294.42 - * made subject to such option by the copyright holder.
294.43 - */
294.44 -
294.45 -package org.netbeans.modules.visualweb.gravy.model.navigation;
294.46 -
294.47 -import org.netbeans.modules.visualweb.gravy.model.project.*;
294.48 -import org.netbeans.modules.visualweb.gravy.Bundle;
294.49 -import org.netbeans.modules.visualweb.gravy.TestUtils;
294.50 -import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
294.51 -import org.netbeans.modules.visualweb.gravy.navigation.NavigatorOperator;
294.52 -
294.53 -import org.netbeans.jemmy.operators.Operator;
294.54 -import org.netbeans.jemmy.JemmyException;
294.55 -
294.56 -import java.util.ArrayList;
294.57 -import java.util.Hashtable;
294.58 -
294.59 -/**
294.60 - * Class for link managers.
294.61 - */
294.62 -
294.63 -public class LinkManager {
294.64 -
294.65 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.navigation.Bundle";
294.66 - private final static String navigationBundle = Bundle.getStringTrimmed(bundle, "NavigationBundle");
294.67 - private final static String nodeNavigation = Bundle.getStringTrimmed(navigationBundle,
294.68 - Bundle.getStringTrimmed(bundle, "PageNavigation"));
294.69 - private final static String popupOpen = Bundle.getStringTrimmed(bundle, "OpenPopupItem");
294.70 -
294.71 - private Project project;
294.72 - private Hashtable links = new Hashtable();
294.73 -
294.74 - /**
294.75 - * Create new LinkManager for the project.
294.76 - */
294.77 - public LinkManager(Project project) {
294.78 - this.project = project;
294.79 - }
294.80 -
294.81 - /**
294.82 - * Create link with specified parameters.
294.83 - * @param source LinkableSource which link link to.
294.84 - * @param target LinkableTaget which link link from.
294.85 - * @param name Link's name.
294.86 - * @return Created link.
294.87 - */
294.88 - public Link createLink(LinkableSource source, LinkableTarget target, String name) {
294.89 - ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
294.90 - TestUtils.wait(1000);
294.91 - try {
294.92 - prjNav.pressPopupItemOnNode(project.getName() + "|" + nodeNavigation, popupOpen, new Operator.DefaultStringComparator(true, true));
294.93 - }
294.94 - catch(Exception e) {
294.95 - throw new JemmyException(popupOpen + " item in popup menu of " + nodeNavigation + " node can't be found!", e);
294.96 - }
294.97 - TestUtils.wait(1000);
294.98 - NavigatorOperator no = new NavigatorOperator();
294.99 - TestUtils.wait(1000);
294.100 - try {
294.101 - no.linkUsingXmlSource(source.getLinkableSourceName(), target.getLinkableTargetName(), name);
294.102 - }
294.103 - catch(Exception e) {
294.104 - throw new JemmyException("Link can't be created!", e);
294.105 - }
294.106 - TestUtils.wait(1000);
294.107 - Link newLink = new Link(source, target, name);
294.108 - links.put(name, newLink);
294.109 - return newLink;
294.110 - }
294.111 -
294.112 - /**
294.113 - * Change link's source.
294.114 - * @param link Link for modification.
294.115 - * @param source New LinkableSource which link should link to.
294.116 - */
294.117 - public void changeSource(Link link, LinkableSource source) {
294.118 - link.source = source;
294.119 - }
294.120 -
294.121 - /**
294.122 - * Change link's target.
294.123 - * @param link Link for modification.
294.124 - * @param target New LinkableTarget which link should link from.
294.125 - */
294.126 - public void changeTarget(Link link, LinkableTarget target) {
294.127 - link.target = target;
294.128 - }
294.129 -
294.130 - /**
294.131 - * Change link's name.
294.132 - * @param link Link for modification.
294.133 - * @param name New link's name.
294.134 - */
294.135 - public void changeName(Link link, String name) {
294.136 - link.name = name;
294.137 - }
294.138 -
294.139 - /**
294.140 - * Remove link.
294.141 - * @param link Link which should be removed.
294.142 - */
294.143 - public void deleteLink(Link link) {
294.144 - links.remove(link.getName());
294.145 - }
294.146 -
294.147 - /**
294.148 - * Return all links.
294.149 - */
294.150 - public Link[] getLinks() {
294.151 - return ((Link[]) links.values().toArray(new Link[links.size()]));
294.152 - }
294.153 -
294.154 - /**
294.155 - * Return all links with specified source.
294.156 - * @param source LinkableSource which links link to.
294.157 - * @return Array of links.
294.158 - */
294.159 - public Link[] getFromLinks(LinkableSource source) {
294.160 - ArrayList srcLinks = new ArrayList();
294.161 - Link[] tmpLinks = ((Link[]) links.values().toArray(new Link[links.size()]));
294.162 - for (int i = 0; i < tmpLinks.length; i++) {
294.163 - if (tmpLinks[i].getSource().equals(source))
294.164 - srcLinks.add(tmpLinks[i]);
294.165 - }
294.166 - return ((Link[]) srcLinks.toArray(new Link[srcLinks.size()]));
294.167 - }
294.168 -
294.169 - /**
294.170 - * Return all links with specified target.
294.171 - * @param target LinkableTarget which links link from.
294.172 - * @return Array of links.
294.173 - */
294.174 - public Link[] getToLinks(LinkableTarget target) {
294.175 - ArrayList trgLinks = new ArrayList();
294.176 - Link[] tmpLinks = ((Link[]) links.values().toArray(new Link[links.size()]));
294.177 - for (int i = 0; i < tmpLinks.length; i++) {
294.178 - if (tmpLinks[i].getTarget().equals(target))
294.179 - trgLinks.add(tmpLinks[i]);
294.180 - }
294.181 - return ((Link[]) trgLinks.toArray(new Link[trgLinks.size()]));
294.182 - }
294.183 -}
295.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/LinkableSource.java Thu Jul 10 04:29:52 2008 -0700
295.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
295.3 @@ -1,55 +0,0 @@
295.4 -/*
295.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
295.6 - *
295.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
295.8 - *
295.9 - * The contents of this file are subject to the terms of either the GNU
295.10 - * General Public License Version 2 only ("GPL") or the Common
295.11 - * Development and Distribution License("CDDL") (collectively, the
295.12 - * "License"). You may not use this file except in compliance with the
295.13 - * License. You can obtain a copy of the License at
295.14 - * http://www.netbeans.org/cddl-gplv2.html
295.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
295.16 - * specific language governing permissions and limitations under the
295.17 - * License. When distributing the software, include this License Header
295.18 - * Notice in each file and include the License file at
295.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
295.20 - * particular file as subject to the "Classpath" exception as provided
295.21 - * by Sun in the GPL Version 2 section of the License file that
295.22 - * accompanied this code. If applicable, add the following below the
295.23 - * License Header, with the fields enclosed by brackets [] replaced by
295.24 - * your own identifying information:
295.25 - * "Portions Copyrighted [year] [name of copyright owner]"
295.26 - *
295.27 - * Contributor(s):
295.28 - *
295.29 - * The Original Software is NetBeans. The Initial Developer of the Original
295.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
295.31 - * Microsystems, Inc. All Rights Reserved.
295.32 - *
295.33 - * If you wish your version of this file to be governed by only the CDDL
295.34 - * or only the GPL Version 2, indicate your decision by adding
295.35 - * "[Contributor] elects to include this software in this distribution
295.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
295.37 - * single choice of license, a recipient has the option to distribute
295.38 - * your version of this file under either the CDDL, the GPL Version 2 or
295.39 - * to extend the choice of license to its licensees as provided above.
295.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
295.41 - * Version 2 license, then the option applies only if the new code is
295.42 - * made subject to such option by the copyright holder.
295.43 - */
295.44 -
295.45 -package org.netbeans.modules.visualweb.gravy.model.navigation;
295.46 -
295.47 -/**
295.48 - * Common interface for linkable source objects.
295.49 - */
295.50 -
295.51 -public interface LinkableSource {
295.52 -
295.53 - /**
295.54 - * Get name of linkable source.
295.55 - * @return Name of linkable source.
295.56 - */
295.57 - public String getLinkableSourceName();
295.58 -}
296.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/navigation/LinkableTarget.java Thu Jul 10 04:29:52 2008 -0700
296.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
296.3 @@ -1,55 +0,0 @@
296.4 -/*
296.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
296.6 - *
296.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
296.8 - *
296.9 - * The contents of this file are subject to the terms of either the GNU
296.10 - * General Public License Version 2 only ("GPL") or the Common
296.11 - * Development and Distribution License("CDDL") (collectively, the
296.12 - * "License"). You may not use this file except in compliance with the
296.13 - * License. You can obtain a copy of the License at
296.14 - * http://www.netbeans.org/cddl-gplv2.html
296.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
296.16 - * specific language governing permissions and limitations under the
296.17 - * License. When distributing the software, include this License Header
296.18 - * Notice in each file and include the License file at
296.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
296.20 - * particular file as subject to the "Classpath" exception as provided
296.21 - * by Sun in the GPL Version 2 section of the License file that
296.22 - * accompanied this code. If applicable, add the following below the
296.23 - * License Header, with the fields enclosed by brackets [] replaced by
296.24 - * your own identifying information:
296.25 - * "Portions Copyrighted [year] [name of copyright owner]"
296.26 - *
296.27 - * Contributor(s):
296.28 - *
296.29 - * The Original Software is NetBeans. The Initial Developer of the Original
296.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
296.31 - * Microsystems, Inc. All Rights Reserved.
296.32 - *
296.33 - * If you wish your version of this file to be governed by only the CDDL
296.34 - * or only the GPL Version 2, indicate your decision by adding
296.35 - * "[Contributor] elects to include this software in this distribution
296.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
296.37 - * single choice of license, a recipient has the option to distribute
296.38 - * your version of this file under either the CDDL, the GPL Version 2 or
296.39 - * to extend the choice of license to its licensees as provided above.
296.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
296.41 - * Version 2 license, then the option applies only if the new code is
296.42 - * made subject to such option by the copyright holder.
296.43 - */
296.44 -
296.45 -package org.netbeans.modules.visualweb.gravy.model.navigation;
296.46 -
296.47 -/**
296.48 - * Common interface for linkable target objects.
296.49 - */
296.50 -
296.51 -public interface LinkableTarget {
296.52 -
296.53 - /**
296.54 - * Get name of linkable target.
296.55 - * @return Name of linkable target.
296.56 - */
296.57 - public String getLinkableTargetName();
296.58 -}
297.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/Bundle.properties Thu Jul 10 04:29:52 2008 -0700
297.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
297.3 @@ -1,96 +0,0 @@
297.4 -/*
297.5 -
297.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
297.7 - *
297.8 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
297.9 -
297.10 - *
297.11 - * The contents of this file are subject to the terms of either the GNU
297.12 - * General Public License Version 2 only ("GPL") or the Common
297.13 - * Development and Distribution License("CDDL") (collectively, the
297.14 - * "License"). You may not use this file except in compliance with the
297.15 - * License. You can obtain a copy of the License at
297.16 - * http://www.netbeans.org/cddl-gplv2.html
297.17 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
297.18 - * specific language governing permissions and limitations under the
297.19 - * License. When distributing the software, include this License Header
297.20 - * Notice in each file and include the License file at
297.21 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
297.22 - * particular file as subject to the "Classpath" exception as provided
297.23 - * by Sun in the GPL Version 2 section of the License file that
297.24 - * accompanied this code. If applicable, add the following below the
297.25 - * License Header, with the fields enclosed by brackets [] replaced by
297.26 - * your own identifying information:
297.27 - * "Portions Copyrighted [year] [name of copyright owner]"
297.28 - *
297.29 - * Contributor(s):
297.30 -
297.31 - *
297.32 -
297.33 - * The Original Software is NetBeans. The Initial Developer of the Original
297.34 -
297.35 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
297.36 -
297.37 - * Microsystems, Inc. All Rights Reserved.
297.38 - *
297.39 - * If you wish your version of this file to be governed by only the CDDL
297.40 - * or only the GPL Version 2, indicate your decision by adding
297.41 - * "[Contributor] elects to include this software in this distribution
297.42 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
297.43 - * single choice of license, a recipient has the option to distribute
297.44 - * your version of this file under either the CDDL, the GPL Version 2 or
297.45 - * to extend the choice of license to its licensees as provided above.
297.46 - * However, if you add GPL Version 2 code and therefore, elected the GPL
297.47 - * Version 2 license, then the option applies only if the new code is
297.48 - * made subject to such option by the copyright holder.
297.49 -
297.50 - */
297.51 -
297.52 -
297.53 -
297.54 -#properties for Projects window and rave bundle
297.55 -
297.56 -NBProjectsBundle=org.netbeans.modules.project.ui.actions.Bundle
297.57 -
297.58 -ProjectWizardBundle=org.netbeans.modules.web.project.ui.wizards.Bundle
297.59 -
297.60 -CustomizerBundle=org.netbeans.modules.web.project.ui.customizer.Bundle
297.61 -
297.62 -WebProjectsBundle=org.netbeans.modules.web.project.ui.Bundle
297.63 -
297.64 -JSFResBundle=org.netbeans.modules.visualweb.project.jsf.resources.Bundle
297.65 -
297.66 -J2EEProjectsBundle=org.netbeans.modules.j2ee.common.project.ui.Bundle
297.67 -
297.68 -New=New
297.69 -
297.70 -FinishButton=Finish
297.71 -
297.72 -CancelButton=Cancel
297.73 -
297.74 -CloseProjectPopupItem=LBL_CloseProjectAction_Popup_Name
297.75 -
297.76 -RunProjectPopupItem=LBL_RunAction_Name
297.77 -
297.78 -ProjectType=Templates/Project/Web
297.79 -
297.80 -ProjectCategory=TXT_NewWebApp
297.81 -
297.82 -JavaBluePrints=SourceStructure_0
297.83 -
297.84 -Jakarta=SourceStructure_1
297.85 -
297.86 -JavaEE5=JavaEESpecLevel_50
297.87 -
297.88 -J2EE14=J2EESpecLevel_14
297.89 -
297.90 -J2EE13=J2EESpecLevel_13
297.91 -
297.92 -SourcePackages=LBL_Node_Sources
297.93 -
297.94 -WebPages=LBL_Node_DocBase
297.95 -
297.96 -Page=Templates/JSF/Page.jsp
297.97 -
297.98 -Folder=Folder
297.99 -
298.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/DefaultProjectFactory.java Thu Jul 10 04:29:52 2008 -0700
298.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
298.3 @@ -1,156 +0,0 @@
298.4 -/*
298.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
298.6 - *
298.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
298.8 - *
298.9 - * The contents of this file are subject to the terms of either the GNU
298.10 - * General Public License Version 2 only ("GPL") or the Common
298.11 - * Development and Distribution License("CDDL") (collectively, the
298.12 - * "License"). You may not use this file except in compliance with the
298.13 - * License. You can obtain a copy of the License at
298.14 - * http://www.netbeans.org/cddl-gplv2.html
298.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
298.16 - * specific language governing permissions and limitations under the
298.17 - * License. When distributing the software, include this License Header
298.18 - * Notice in each file and include the License file at
298.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
298.20 - * particular file as subject to the "Classpath" exception as provided
298.21 - * by Sun in the GPL Version 2 section of the License file that
298.22 - * accompanied this code. If applicable, add the following below the
298.23 - * License Header, with the fields enclosed by brackets [] replaced by
298.24 - * your own identifying information:
298.25 - * "Portions Copyrighted [year] [name of copyright owner]"
298.26 - *
298.27 - * Contributor(s):
298.28 - *
298.29 - * The Original Software is NetBeans. The Initial Developer of the Original
298.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
298.31 - * Microsystems, Inc. All Rights Reserved.
298.32 - *
298.33 - * If you wish your version of this file to be governed by only the CDDL
298.34 - * or only the GPL Version 2, indicate your decision by adding
298.35 - * "[Contributor] elects to include this software in this distribution
298.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
298.37 - * single choice of license, a recipient has the option to distribute
298.38 - * your version of this file under either the CDDL, the GPL Version 2 or
298.39 - * to extend the choice of license to its licensees as provided above.
298.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
298.41 - * Version 2 license, then the option applies only if the new code is
298.42 - * made subject to such option by the copyright holder.
298.43 - */
298.44 -
298.45 -package org.netbeans.modules.visualweb.gravy.model.project;
298.46 -
298.47 -import org.netbeans.jemmy.operators.JButtonOperator;
298.48 -import org.netbeans.jemmy.operators.JCheckBoxOperator;
298.49 -import org.netbeans.jemmy.operators.JDialogOperator;
298.50 -import org.netbeans.jemmy.operators.JTreeOperator;
298.51 -import org.netbeans.jemmy.operators.JComboBoxOperator;
298.52 -import org.netbeans.jemmy.operators.JTextFieldOperator;
298.53 -import org.netbeans.jemmy.JemmyException;
298.54 -import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
298.55 -import org.netbeans.modules.visualweb.gravy.TestUtils;
298.56 -import org.netbeans.modules.visualweb.gravy.Bundle;
298.57 -
298.58 -import java.io.File;
298.59 -
298.60 -/**
298.61 - * Default factory for creation of projects.
298.62 - */
298.63 -
298.64 -public class DefaultProjectFactory extends ProjectFactory {
298.65 -
298.66 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
298.67 -
298.68 - /**
298.69 - * Type of project.
298.70 - */
298.71 - private final static String projectType = Bundle.getStringTrimmed(
298.72 - Bundle.getStringTrimmed(bundle, "ProjectWizardBundle"),
298.73 - Bundle.getStringTrimmed(bundle, "ProjectType"));
298.74 -
298.75 - /**
298.76 - * Category of project.
298.77 - */
298.78 - private final static String projectCategory = Bundle.getStringTrimmed(
298.79 - Bundle.getStringTrimmed(bundle, "ProjectWizardBundle"),
298.80 - Bundle.getStringTrimmed(bundle, "ProjectCategory"));
298.81 -
298.82 - private final static String blueprintsStructure = Bundle.getStringTrimmed(
298.83 - Bundle.getStringTrimmed(bundle, "J2EEProjectsBundle"),
298.84 - Bundle.getStringTrimmed(bundle, "JavaBluePrints"));
298.85 -
298.86 - private final static String jakartaStructure = Bundle.getStringTrimmed(
298.87 - Bundle.getStringTrimmed(bundle, "J2EEProjectsBundle"),
298.88 - Bundle.getStringTrimmed(bundle, "Jakarta"));
298.89 -
298.90 - /**
298.91 - * Default project factory.
298.92 - */
298.93 - private static DefaultProjectFactory defaultPFactory;
298.94 -
298.95 - /**
298.96 - * Create new DefaultProjectFactory.
298.97 - */
298.98 - public DefaultProjectFactory() {
298.99 - }
298.100 -
298.101 - /**
298.102 - * Create instance of DefaultProjectFactory or return it, if it is already exist.
298.103 - * Singleton.
298.104 - * @return DefaultProjectFactory.
298.105 - */
298.106 - public static DefaultProjectFactory getFactory() {
298.107 - if (defaultPFactory != null) return defaultPFactory;
298.108 - else return (defaultPFactory = new DefaultProjectFactory());
298.109 - }
298.110 -
298.111 - /**
298.112 - * Create new project.
298.113 - * @param projectDescriptor Descriptor of project.
298.114 - * @return created project.
298.115 - */
298.116 - protected Project createProject(ProjectDescriptor projectDescriptor) {
298.117 - String _projectPath = projectDescriptor.getProperty(projectDescriptor.LOCATION_KEY);
298.118 - String _projectName = projectDescriptor.getProperty(projectDescriptor.NAME_KEY);
298.119 - String _J2EEVersion = projectDescriptor.getProperty(projectDescriptor.J2EEVERSION_KEY);
298.120 - String _targetServer = projectDescriptor.getProperty(projectDescriptor.SERVER_KEY);
298.121 - if (_projectPath.lastIndexOf(File.separator) != _projectPath.length() - 1) _projectPath = _projectPath + File.separator;
298.122 - try {
298.123 - TestUtils.createNewProject(_projectPath, _projectName, true, projectType, projectCategory, blueprintsStructure, _J2EEVersion, _targetServer);
298.124 - }
298.125 - catch(Exception e) {
298.126 - throw new JemmyException("Project can't be created!", e);
298.127 - }
298.128 - return new JSFWebProject(projectDescriptor);
298.129 - }
298.130 -
298.131 - /**
298.132 - * Open existing project.
298.133 - * @param pathToProject Path to project's folder.
298.134 - * @return opened project.
298.135 - */
298.136 - protected Project openProject(String pathToProject) {
298.137 - try {
298.138 - TestUtils.openProject(pathToProject);
298.139 - }
298.140 - catch(Exception e) {
298.141 - throw new JemmyException("Project can't be opened!", e);
298.142 - }
298.143 - String projectName = pathToProject.substring(pathToProject.lastIndexOf(File.separator) + 1, pathToProject.length());
298.144 - String projectLocation = pathToProject.substring(0, pathToProject.lastIndexOf(File.separator) + 1);
298.145 - ProjectNavigatorOperator.pressPopupItemOnNode(projectName, "Properties");
298.146 - JDialogOperator propertiesDialog = new JDialogOperator("Project Properties - "+projectName);
298.147 - TestUtils.wait(1000);
298.148 - JTreeOperator tree = new JTreeOperator(propertiesDialog);
298.149 - tree.selectPath(tree.findPath("Run"));
298.150 - TestUtils.wait(1000);
298.151 - String targetServer = new JComboBoxOperator(propertiesDialog).getSelectedItem().toString();
298.152 - String J2EEVersion = new JTextFieldOperator(propertiesDialog, 0).getText();
298.153 - new JButtonOperator(propertiesDialog, "OK").pushNoBlock();
298.154 - TestUtils.wait(1000);
298.155 - System.out.println("projectName="+projectName+"; projectLocation="+projectLocation+"; J2EEVersion="+J2EEVersion+"; targetServer="+targetServer);
298.156 - ProjectDescriptor projectDescriptor = new ProjectDescriptor(projectName, projectLocation, J2EEVersion, targetServer);
298.157 - return new JSFWebProject(projectDescriptor);
298.158 - }
298.159 -}
299.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/Folder.java Thu Jul 10 04:29:52 2008 -0700
299.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
299.3 @@ -1,133 +0,0 @@
299.4 -/*
299.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
299.6 - *
299.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
299.8 - *
299.9 - * The contents of this file are subject to the terms of either the GNU
299.10 - * General Public License Version 2 only ("GPL") or the Common
299.11 - * Development and Distribution License("CDDL") (collectively, the
299.12 - * "License"). You may not use this file except in compliance with the
299.13 - * License. You can obtain a copy of the License at
299.14 - * http://www.netbeans.org/cddl-gplv2.html
299.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
299.16 - * specific language governing permissions and limitations under the
299.17 - * License. When distributing the software, include this License Header
299.18 - * Notice in each file and include the License file at
299.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
299.20 - * particular file as subject to the "Classpath" exception as provided
299.21 - * by Sun in the GPL Version 2 section of the License file that
299.22 - * accompanied this code. If applicable, add the following below the
299.23 - * License Header, with the fields enclosed by brackets [] replaced by
299.24 - * your own identifying information:
299.25 - * "Portions Copyrighted [year] [name of copyright owner]"
299.26 - *
299.27 - * Contributor(s):
299.28 - *
299.29 - * The Original Software is NetBeans. The Initial Developer of the Original
299.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
299.31 - * Microsystems, Inc. All Rights Reserved.
299.32 - *
299.33 - * If you wish your version of this file to be governed by only the CDDL
299.34 - * or only the GPL Version 2, indicate your decision by adding
299.35 - * "[Contributor] elects to include this software in this distribution
299.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
299.37 - * single choice of license, a recipient has the option to distribute
299.38 - * your version of this file under either the CDDL, the GPL Version 2 or
299.39 - * to extend the choice of license to its licensees as provided above.
299.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
299.41 - * Version 2 license, then the option applies only if the new code is
299.42 - * made subject to such option by the copyright holder.
299.43 - */
299.44 -
299.45 -package org.netbeans.modules.visualweb.gravy.model.project;
299.46 -
299.47 -import java.util.ArrayList;
299.48 -import java.util.List;
299.49 -import javax.swing.tree.TreePath;
299.50 -
299.51 -/**
299.52 - * Class for folders included in Project.
299.53 - */
299.54 -
299.55 -public class Folder implements ProjectEntry {
299.56 -
299.57 - TreePath path;
299.58 - String name;
299.59 -
299.60 - /**
299.61 - * Parent of the folder.
299.62 - */
299.63 - private ProjectEntry parent;
299.64 -
299.65 - /**
299.66 - * Child project entries of the folder.
299.67 - */
299.68 - List childList = new ArrayList();
299.69 -
299.70 - /**
299.71 - * Creates a new instance of folder.
299.72 - * @param path Path to folder in project.
299.73 - * @param name Name of folder.
299.74 - */
299.75 - Folder(TreePath path, String name, ProjectEntry parent) {
299.76 - this.path = path;
299.77 - this.name = name;
299.78 - setParent(parent);
299.79 - }
299.80 -
299.81 - /**
299.82 - * Save folder.
299.83 - */
299.84 - public void save() {
299.85 - }
299.86 -
299.87 - /**
299.88 - * Save folder as folder with specified name.
299.89 - */
299.90 - public void saveAs(String name) {
299.91 - }
299.92 -
299.93 - /**
299.94 - * Get name of folder.
299.95 - * @return Name of the folder.
299.96 - */
299.97 - public String getName() {
299.98 - return name;
299.99 - }
299.100 -
299.101 - /**
299.102 - * @return TreePath of the folder.
299.103 - */
299.104 - public TreePath getTreePath() {
299.105 - return path;
299.106 - }
299.107 -
299.108 - /**
299.109 - * @return Parent of the folder.
299.110 - */
299.111 - public ProjectEntry getParent() {
299.112 - return parent;
299.113 - }
299.114 -
299.115 - /**
299.116 - * Set parent of the folder.
299.117 - */
299.118 - protected void setParent(ProjectEntry parent) {
299.119 - this.parent = parent;
299.120 - }
299.121 -
299.122 - /**
299.123 - * @return Child project entries of the folder.
299.124 - */
299.125 - public ProjectEntry[] getChildren() {
299.126 - return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
299.127 - }
299.128 -
299.129 -
299.130 -
299.131 - /**
299.132 - * Remove folder.
299.133 - */
299.134 - public void delete() {
299.135 - }
299.136 -}
300.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/JSFWebProject.java Thu Jul 10 04:29:52 2008 -0700
300.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
300.3 @@ -1,83 +0,0 @@
300.4 -/*
300.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
300.6 - *
300.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
300.8 - *
300.9 - * The contents of this file are subject to the terms of either the GNU
300.10 - * General Public License Version 2 only ("GPL") or the Common
300.11 - * Development and Distribution License("CDDL") (collectively, the
300.12 - * "License"). You may not use this file except in compliance with the
300.13 - * License. You can obtain a copy of the License at
300.14 - * http://www.netbeans.org/cddl-gplv2.html
300.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
300.16 - * specific language governing permissions and limitations under the
300.17 - * License. When distributing the software, include this License Header
300.18 - * Notice in each file and include the License file at
300.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
300.20 - * particular file as subject to the "Classpath" exception as provided
300.21 - * by Sun in the GPL Version 2 section of the License file that
300.22 - * accompanied this code. If applicable, add the following below the
300.23 - * License Header, with the fields enclosed by brackets [] replaced by
300.24 - * your own identifying information:
300.25 - * "Portions Copyrighted [year] [name of copyright owner]"
300.26 - *
300.27 - * Contributor(s):
300.28 - *
300.29 - * The Original Software is NetBeans. The Initial Developer of the Original
300.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
300.31 - * Microsystems, Inc. All Rights Reserved.
300.32 - *
300.33 - * If you wish your version of this file to be governed by only the CDDL
300.34 - * or only the GPL Version 2, indicate your decision by adding
300.35 - * "[Contributor] elects to include this software in this distribution
300.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
300.37 - * single choice of license, a recipient has the option to distribute
300.38 - * your version of this file under either the CDDL, the GPL Version 2 or
300.39 - * to extend the choice of license to its licensees as provided above.
300.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
300.41 - * Version 2 license, then the option applies only if the new code is
300.42 - * made subject to such option by the copyright holder.
300.43 - */
300.44 -
300.45 -package org.netbeans.modules.visualweb.gravy.model.project;
300.46 -
300.47 -import javax.swing.tree.TreePath;
300.48 -
300.49 -/**
300.50 - * Web JSF project.
300.51 - */
300.52 -
300.53 -public class JSFWebProject extends Project {
300.54 -
300.55 - public JSFWebProject(ProjectDescriptor prjDescriptor) {
300.56 - super(prjDescriptor);
300.57 - root = getRoot();
300.58 - WebPageFolder wpf = new WebPageFolder(new TreePath(getName()), root.webPagesName, root);
300.59 - wpf.addWebPage("Page1");
300.60 - root.childList.add(wpf);
300.61 - SourceFolder sf = root.getSourceRootFolder().getSourceSubFolder(getName().toLowerCase());
300.62 - sf.addJavaFile("ApplicationBean1");
300.63 - sf.addJavaFile("RequestBean1");
300.64 - sf.addJavaFile("SessionBean1");
300.65 - }
300.66 -
300.67 - public JSFWebProject saveAs(String newName) {
300.68 - return null;
300.69 - }
300.70 -
300.71 - public JSFWebProject saveAs(String newName, String newLocation) {
300.72 - return null;
300.73 - }
300.74 -
300.75 - /**
300.76 - * Instance of JSFWebProject is compared with project, passed with parameter.
300.77 - * @param prj Object for comparison.
300.78 - * @return true if Object equals to Project.
300.79 - */
300.80 - public boolean equals(Object prj) {
300.81 - if ((prj instanceof Project) && ((Project) prj).getName().equals(this.getName())) {
300.82 - return true;
300.83 - }
300.84 - return false;
300.85 - }
300.86 -}
301.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/JSPFile.java Thu Jul 10 04:29:52 2008 -0700
301.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
301.3 @@ -1,325 +0,0 @@
301.4 -/*
301.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
301.6 - *
301.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
301.8 - *
301.9 - * The contents of this file are subject to the terms of either the GNU
301.10 - * General Public License Version 2 only ("GPL") or the Common
301.11 - * Development and Distribution License("CDDL") (collectively, the
301.12 - * "License"). You may not use this file except in compliance with the
301.13 - * License. You can obtain a copy of the License at
301.14 - * http://www.netbeans.org/cddl-gplv2.html
301.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
301.16 - * specific language governing permissions and limitations under the
301.17 - * License. When distributing the software, include this License Header
301.18 - * Notice in each file and include the License file at
301.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
301.20 - * particular file as subject to the "Classpath" exception as provided
301.21 - * by Sun in the GPL Version 2 section of the License file that
301.22 - * accompanied this code. If applicable, add the following below the
301.23 - * License Header, with the fields enclosed by brackets [] replaced by
301.24 - * your own identifying information:
301.25 - * "Portions Copyrighted [year] [name of copyright owner]"
301.26 - *
301.27 - * Contributor(s):
301.28 - *
301.29 - * The Original Software is NetBeans. The Initial Developer of the Original
301.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
301.31 - * Microsystems, Inc. All Rights Reserved.
301.32 - *
301.33 - * If you wish your version of this file to be governed by only the CDDL
301.34 - * or only the GPL Version 2, indicate your decision by adding
301.35 - * "[Contributor] elects to include this software in this distribution
301.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
301.37 - * single choice of license, a recipient has the option to distribute
301.38 - * your version of this file under either the CDDL, the GPL Version 2 or
301.39 - * to extend the choice of license to its licensees as provided above.
301.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
301.41 - * Version 2 license, then the option applies only if the new code is
301.42 - * made subject to such option by the copyright holder.
301.43 - */
301.44 -
301.45 -package org.netbeans.modules.visualweb.gravy.model.project;
301.46 -
301.47 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
301.48 -import org.netbeans.modules.visualweb.gravy.EditorOperator;
301.49 -import org.netbeans.modules.visualweb.gravy.TestUtils;
301.50 -
301.51 -import javax.swing.tree.TreePath;
301.52 -import java.util.ArrayList;
301.53 -import java.util.List;
301.54 -
301.55 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
301.56 -import org.netbeans.jemmy.TimeoutExpiredException;
301.57 -
301.58 -/**
301.59 - * Class for JSP files.
301.60 - */
301.61 -
301.62 -public class JSPFile extends SourceFile implements ProjectEntry {
301.63 -
301.64 - private final static String reformatCode = "Reformat Code";
301.65 -
301.66 - WebPage webpage = null;
301.67 -
301.68 - private EditorOperator editor = null;
301.69 -
301.70 - /**
301.71 - * Parent of the jsp file.
301.72 - */
301.73 - protected ProjectEntry parent;
301.74 -
301.75 - /**
301.76 - * Child project entries of the jsp file.
301.77 - */
301.78 - protected List childList = new ArrayList();
301.79 -
301.80 - /**
301.81 - * Creates a new instance of web page.
301.82 - * @param path Path to web page in project.
301.83 - * @param name Name of web page.
301.84 - */
301.85 - JSPFile(TreePath path, String name, ProjectEntry parent) {
301.86 - super(path, name);
301.87 - setParent(parent);
301.88 - }
301.89 -
301.90 - /**
301.91 - * Save project entry.
301.92 - */
301.93 - public void save() {
301.94 - }
301.95 -
301.96 - /**
301.97 - * Save project entry as project entry with specified name.
301.98 - */
301.99 - public void saveAs(String name) {
301.100 - }
301.101 -
301.102 - /**
301.103 - * @return Name of the project entry.
301.104 - */
301.105 - public String getName() {
301.106 - return name;
301.107 - }
301.108 -
301.109 - /**
301.110 - * @return TreePath of the project entry.
301.111 - */
301.112 - public TreePath getTreePath() {
301.113 - return path;
301.114 - }
301.115 -
301.116 - /**
301.117 - * @return Parent of the jsp file.
301.118 - */
301.119 - public ProjectEntry getParent() {
301.120 - return parent;
301.121 - }
301.122 -
301.123 - /**
301.124 - * Set parent of the jsp file.
301.125 - */
301.126 - private void setParent(ProjectEntry parent) {
301.127 - this.parent = parent;
301.128 - }
301.129 -
301.130 - /**
301.131 - * @return Child project entries of the jsp file.
301.132 - */
301.133 - public ProjectEntry[] getChildren() {
301.134 - return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
301.135 - }
301.136 -
301.137 - /**
301.138 - * Remove project entry.
301.139 - */
301.140 - public void delete() {
301.141 - }
301.142 -
301.143 - /**
301.144 - * Open jsp file editor.
301.145 - */
301.146 - private void doOpenJSPEditor() {
301.147 - webpage.open();
301.148 - editor = webpage.page.getJSPEditor();
301.149 - editor.setVerification(false);
301.150 - editor.requestFocus();
301.151 - }
301.152 -
301.153 - /**
301.154 - * Open jsp code of web page.
301.155 - */
301.156 - private EditorOperator openJSP() {
301.157 - long tmpTimeout = 0;
301.158 - try {
301.159 - tmpTimeout = RaveWindowOperator.getDefaultRave().getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
301.160 - RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
301.161 - if (editor == null) {
301.162 - doOpenJSPEditor();
301.163 - }
301.164 - else {
301.165 - try {
301.166 - editor.makeComponentVisible();
301.167 - }
301.168 - catch(Exception e) {throw new TimeoutExpiredException("");}
301.169 - }
301.170 - }
301.171 - catch (TimeoutExpiredException e) {
301.172 - doOpenJSPEditor();
301.173 - }
301.174 - finally {
301.175 - RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", tmpTimeout);
301.176 - }
301.177 - return editor;
301.178 - }
301.179 -
301.180 - /**
301.181 - * Gets text from the currently opened jsp file of web page.
301.182 - * @return String representing whole content of the jsp file of web page.
301.183 - * (including new line characters)
301.184 - */
301.185 - public String getText() {
301.186 - editor = openJSP();
301.187 - return editor.getText();
301.188 - }
301.189 -
301.190 - /**
301.191 - * Gets text from specified line.
301.192 - * @param lineNumber Number of line.
301.193 - * @return String representing content of the line.
301.194 - */
301.195 - public String getText(int lineNumber) {
301.196 - editor = openJSP();
301.197 - return editor.getText(lineNumber);
301.198 - }
301.199 -
301.200 - /**
301.201 - * Checks if jsp file of web page contains text specified as parameter text.
301.202 - * @param text Text to compare to.
301.203 - * @return true if text was found, false otherwise.
301.204 - */
301.205 - public boolean contains(String text) {
301.206 - editor = openJSP();
301.207 - return editor.contains(text);
301.208 - }
301.209 -
301.210 - /**
301.211 - * Replaces first occurence of oldText by newText.
301.212 - * @param oldText Text to be replaced.
301.213 - * @param newText Text to write instead.
301.214 - */
301.215 - public void replace(String oldText, String newText) {
301.216 - editor = openJSP();
301.217 - editor.replace(oldText, newText);
301.218 - }
301.219 -
301.220 - /**
301.221 - * Replaced index-th occurence of oldText by newText.
301.222 - * @param oldText Text to be replaced
301.223 - * @param newText Text to write instead
301.224 - * @param index Index of oldText occurence.
301.225 - */
301.226 - public void replace(String oldText, String newText, int index) {
301.227 - editor = openJSP();
301.228 - editor.replace(oldText, newText, index);
301.229 - }
301.230 -
301.231 - /**
301.232 - * Insert text to current position.
301.233 - * @param text String to be inserted.
301.234 - */
301.235 - public void insert(String text) {
301.236 - editor = openJSP();
301.237 - editor.insert(text);
301.238 - }
301.239 -
301.240 - /**
301.241 - * Inserts text to position specified by line number and column.
301.242 - * @param text String to be inserted.
301.243 - * @param lineNumber Number of line.
301.244 - * @param column Column position.
301.245 - */
301.246 - public void insert(String text, int lineNumber, int column) {
301.247 - editor = openJSP();
301.248 - editor.insert(text, lineNumber, column);
301.249 - }
301.250 -
301.251 - /**
301.252 - * Deletes given number of characters from specified possition.
301.253 - * @param offset Position inside document.
301.254 - * @param length Number of characters to be deleted.
301.255 - */
301.256 - public void delete(int offset, int length) {
301.257 - editor = openJSP();
301.258 - editor.delete(offset, length);
301.259 - }
301.260 -
301.261 - /**
301.262 - * Deletes given number of characters from current caret possition.
301.263 - * @param length Number of characters to be deleted.
301.264 - */
301.265 - public void delete(int length) {
301.266 - editor = openJSP();
301.267 - editor.delete(length);
301.268 - }
301.269 -
301.270 - /**
301.271 - * Delete specified line.
301.272 - * @param line Number of line.
301.273 - */
301.274 - public void deleteLine(int line) {
301.275 - editor = openJSP();
301.276 - editor.deleteLine(line);
301.277 - }
301.278 -
301.279 - /**
301.280 - * Deletes characters between column1 and column2 on the specified line.
301.281 - * @param lineNumber Number of line.
301.282 - * @param column1 Column position where to start deleting.
301.283 - * @param column2 Column position where to stop deleting.
301.284 - */
301.285 - public void delete(int lineNumber, int column1, int column2) {
301.286 - editor = openJSP();
301.287 - editor.delete(lineNumber, column1, column2);
301.288 - }
301.289 -
301.290 - /**
301.291 - * Pushs key.
301.292 - * @param keyCode Key code (KeyEvent.VK_* value)
301.293 - * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
301.294 - */
301.295 - public void pushKey(int keyCode, int modifiers) {
301.296 - editor = openJSP();
301.297 - editor.pushKey(keyCode, modifiers);
301.298 - }
301.299 -
301.300 - /**
301.301 - * Pushs key.
301.302 - * @param keyCode Key code (KeyEvent.VK_* value)
301.303 - */
301.304 - public void pushKey(int keyCode) {
301.305 - editor = openJSP();
301.306 - editor.pushKey(keyCode);
301.307 - }
301.308 -
301.309 - /**
301.310 - * Get position of caret.
301.311 - * @return int Position of caret.
301.312 - */
301.313 - public int getCaretPosition() {
301.314 - editor = openJSP();
301.315 - return editor.txtEditorPane().getCaretPosition();
301.316 - }
301.317 -
301.318 - /**
301.319 - * Reformat code in JSP editor accordingly to specified rules.
301.320 - */
301.321 - public void reformatCode() {
301.322 - editor = openJSP();
301.323 - editor.txtEditorPane().clickForPopup();
301.324 - TestUtils.wait(1000);
301.325 - new JPopupMenuOperator().pushMenu(reformatCode);
301.326 - TestUtils.wait(1000);
301.327 - }
301.328 -}
302.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/JavaFile.java Thu Jul 10 04:29:52 2008 -0700
302.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
302.3 @@ -1,325 +0,0 @@
302.4 -/*
302.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
302.6 - *
302.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
302.8 - *
302.9 - * The contents of this file are subject to the terms of either the GNU
302.10 - * General Public License Version 2 only ("GPL") or the Common
302.11 - * Development and Distribution License("CDDL") (collectively, the
302.12 - * "License"). You may not use this file except in compliance with the
302.13 - * License. You can obtain a copy of the License at
302.14 - * http://www.netbeans.org/cddl-gplv2.html
302.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
302.16 - * specific language governing permissions and limitations under the
302.17 - * License. When distributing the software, include this License Header
302.18 - * Notice in each file and include the License file at
302.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
302.20 - * particular file as subject to the "Classpath" exception as provided
302.21 - * by Sun in the GPL Version 2 section of the License file that
302.22 - * accompanied this code. If applicable, add the following below the
302.23 - * License Header, with the fields enclosed by brackets [] replaced by
302.24 - * your own identifying information:
302.25 - * "Portions Copyrighted [year] [name of copyright owner]"
302.26 - *
302.27 - * Contributor(s):
302.28 - *
302.29 - * The Original Software is NetBeans. The Initial Developer of the Original
302.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
302.31 - * Microsystems, Inc. All Rights Reserved.
302.32 - *
302.33 - * If you wish your version of this file to be governed by only the CDDL
302.34 - * or only the GPL Version 2, indicate your decision by adding
302.35 - * "[Contributor] elects to include this software in this distribution
302.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
302.37 - * single choice of license, a recipient has the option to distribute
302.38 - * your version of this file under either the CDDL, the GPL Version 2 or
302.39 - * to extend the choice of license to its licensees as provided above.
302.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
302.41 - * Version 2 license, then the option applies only if the new code is
302.42 - * made subject to such option by the copyright holder.
302.43 - */
302.44 -
302.45 -package org.netbeans.modules.visualweb.gravy.model.project;
302.46 -
302.47 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
302.48 -import org.netbeans.modules.visualweb.gravy.EditorOperator;
302.49 -import org.netbeans.modules.visualweb.gravy.TestUtils;
302.50 -
302.51 -import javax.swing.tree.TreePath;
302.52 -import java.util.ArrayList;
302.53 -import java.util.List;
302.54 -
302.55 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
302.56 -import org.netbeans.jemmy.TimeoutExpiredException;
302.57 -
302.58 -/**
302.59 - * Class for Java files.
302.60 - */
302.61 -
302.62 -public class JavaFile extends SourceFile implements ProjectEntry {
302.63 -
302.64 - private final static String reformatCode = "Reformat Code";
302.65 -
302.66 - WebPage webpage = null;
302.67 -
302.68 - private EditorOperator editor = null;
302.69 -
302.70 - /**
302.71 - * Parent of the java file.
302.72 - */
302.73 - private ProjectEntry parent;
302.74 -
302.75 - /**
302.76 - * Child project entries of the java file.
302.77 - */
302.78 - private List childList = new ArrayList();
302.79 -
302.80 - /**
302.81 - * Creates a new instance of web page.
302.82 - * @param path Path to web page in project.
302.83 - * @param name Name of web page.
302.84 - */
302.85 - JavaFile(TreePath path, String name, ProjectEntry parent) {
302.86 - super(path, name);
302.87 - setParent(parent);
302.88 - }
302.89 -
302.90 - /**
302.91 - * Save java file.
302.92 - */
302.93 - public void save() {
302.94 - }
302.95 -
302.96 - /**
302.97 - * Save java file as java file with specified name.
302.98 - */
302.99 - public void saveAs(String name) {
302.100 - }
302.101 -
302.102 - /**
302.103 - * @return Name of the java file.
302.104 - */
302.105 - public String getName() {
302.106 - return name;
302.107 - }
302.108 -
302.109 - /**
302.110 - * @return TreePath of the java file.
302.111 - */
302.112 - public TreePath getTreePath() {
302.113 - return path;
302.114 - }
302.115 -
302.116 - /**
302.117 - * @return Parent of the java file.
302.118 - */
302.119 - public ProjectEntry getParent() {
302.120 - return parent;
302.121 - }
302.122 -
302.123 - /**
302.124 - * Set parent of the xml file.
302.125 - */
302.126 - private void setParent(ProjectEntry parent) {
302.127 - this.parent = parent;
302.128 - }
302.129 -
302.130 - /**
302.131 - * @return Child project entries of the java file.
302.132 - */
302.133 - public ProjectEntry[] getChildren() {
302.134 - return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
302.135 - }
302.136 -
302.137 - /**
302.138 - * Remove java file.
302.139 - */
302.140 - public void delete() {
302.141 - }
302.142 -
302.143 - /**
302.144 - * Open java file editor.
302.145 - */
302.146 - private void doOpenJavaEditor() {
302.147 - webpage.open();
302.148 - editor = webpage.page.getJavaEditor();
302.149 - editor.setVerification(false);
302.150 - editor.requestFocus();
302.151 - }
302.152 -
302.153 - /**
302.154 - * Open java file of web page.
302.155 - */
302.156 - private EditorOperator openJava() {
302.157 - long tmpTimeout = 0;
302.158 - try {
302.159 - tmpTimeout = RaveWindowOperator.getDefaultRave().getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
302.160 - RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
302.161 - if (editor == null) {
302.162 - doOpenJavaEditor();
302.163 - }
302.164 - else {
302.165 - try {
302.166 - editor.makeComponentVisible();
302.167 - }
302.168 - catch(Exception e) {throw new TimeoutExpiredException("");}
302.169 - }
302.170 - }
302.171 - catch (TimeoutExpiredException e) {
302.172 - doOpenJavaEditor();
302.173 - }
302.174 - finally {
302.175 - RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", tmpTimeout);
302.176 - }
302.177 - return editor;
302.178 - }
302.179 -
302.180 - /**
302.181 - * Gets text from the currently opened java file.
302.182 - * @return String representing whole content of the java file.
302.183 - * (including new line characters)
302.184 - */
302.185 - public String getText() {
302.186 - editor = openJava();
302.187 - return editor.getText();
302.188 - }
302.189 -
302.190 - /**
302.191 - * Gets text from specified line.
302.192 - * @param lineNumber Number of line.
302.193 - * @return String representing content of the line.
302.194 - */
302.195 - public String getText(int lineNumber) {
302.196 - editor = openJava();
302.197 - return editor.getText(lineNumber);
302.198 - }
302.199 -
302.200 - /**
302.201 - * Checks if java file contains text specified as parameter text.
302.202 - * @param text Text to compare to.
302.203 - * @return true if text was found, false otherwise.
302.204 - */
302.205 - public boolean contains(String text) {
302.206 - editor = openJava();
302.207 - return editor.contains(text);
302.208 - }
302.209 -
302.210 - /**
302.211 - * Replaces first occurence of oldText by newText.
302.212 - * @param oldText Text to be replaced.
302.213 - * @param newText Text to write instead.
302.214 - */
302.215 - public void replace(String oldText, String newText) {
302.216 - editor = openJava();
302.217 - editor.replace(oldText, newText);
302.218 - }
302.219 -
302.220 - /**
302.221 - * Replaced index-th occurence of oldText by newText.
302.222 - * @param oldText Text to be replaced
302.223 - * @param newText Text to write instead
302.224 - * @param index Tndex of oldText occurence.
302.225 - */
302.226 - public void replace(String oldText, String newText, int index) {
302.227 - editor = openJava();
302.228 - editor.replace(oldText, newText, index);
302.229 - }
302.230 -
302.231 - /**
302.232 - * Insert text to current position.
302.233 - * @param text String to be inserted.
302.234 - */
302.235 - public void insert(String text) {
302.236 - editor = openJava();
302.237 - editor.insert(text);
302.238 - }
302.239 -
302.240 - /**
302.241 - * Inserts text to position specified by line number and column.
302.242 - * @param text String to be inserted.
302.243 - * @param lineNumber Number of line.
302.244 - * @param column Column position.
302.245 - */
302.246 - public void insert(String text, int lineNumber, int column) {
302.247 - editor = openJava();
302.248 - editor.insert(text, lineNumber, column);
302.249 - }
302.250 -
302.251 - /**
302.252 - * Deletes given number of characters from specified possition.
302.253 - * @param offset Position inside document.
302.254 - * @param length Number of characters to be deleted.
302.255 - */
302.256 - public void delete(int offset, int length) {
302.257 - editor = openJava();
302.258 - editor.delete(offset, length);
302.259 - }
302.260 -
302.261 - /**
302.262 - * Deletes given number of characters from current caret possition.
302.263 - * @param length Number of characters to be deleted.
302.264 - */
302.265 - public void delete(int length) {
302.266 - editor = openJava();
302.267 - editor.delete(length);
302.268 - }
302.269 -
302.270 - /**
302.271 - * Delete specified line.
302.272 - * @param line Number of line.
302.273 - */
302.274 - public void deleteLine(int line) {
302.275 - editor = openJava();
302.276 - editor.deleteLine(line);
302.277 - }
302.278 -
302.279 - /**
302.280 - * Deletes characters between column1 and column2 on the specified line.
302.281 - * @param lineNumber Number of line.
302.282 - * @param column1 Column position where to start deleting.
302.283 - * @param column2 Column position where to stop deleting.
302.284 - */
302.285 - public void delete(int lineNumber, int column1, int column2) {
302.286 - editor = openJava();
302.287 - editor.delete(lineNumber, column1, column2);
302.288 - }
302.289 -
302.290 - /**
302.291 - * Pushs key.
302.292 - * @param keyCode Key code (KeyEvent.VK_* value)
302.293 - * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
302.294 - */
302.295 - public void pushKey(int keyCode, int modifiers) {
302.296 - editor = openJava();
302.297 - editor.pushKey(keyCode, modifiers);
302.298 - }
302.299 -
302.300 - /**
302.301 - * Pushs key.
302.302 - * @param keyCode Key code (KeyEvent.VK_* value)
302.303 - */
302.304 - public void pushKey(int keyCode) {
302.305 - editor = openJava();
302.306 - editor.pushKey(keyCode);
302.307 - }
302.308 -
302.309 - /**
302.310 - * Get position of caret.
302.311 - * @return int Position of caret.
302.312 - */
302.313 - public int getCaretPosition() {
302.314 - editor = openJava();
302.315 - return editor.txtEditorPane().getCaretPosition();
302.316 - }
302.317 -
302.318 - /**
302.319 - * Reformat code in Java editor accordingly to specified rules.
302.320 - */
302.321 - public void reformatCode() {
302.322 - editor = openJava();
302.323 - editor.txtEditorPane().clickForPopup();
302.324 - TestUtils.wait(1000);
302.325 - new JPopupMenuOperator().pushMenu(reformatCode);
302.326 - TestUtils.wait(1000);
302.327 - }
302.328 -}
303.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/Project.java Thu Jul 10 04:29:52 2008 -0700
303.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
303.3 @@ -1,264 +0,0 @@
303.4 -/*
303.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
303.6 - *
303.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
303.8 - *
303.9 - * The contents of this file are subject to the terms of either the GNU
303.10 - * General Public License Version 2 only ("GPL") or the Common
303.11 - * Development and Distribution License("CDDL") (collectively, the
303.12 - * "License"). You may not use this file except in compliance with the
303.13 - * License. You can obtain a copy of the License at
303.14 - * http://www.netbeans.org/cddl-gplv2.html
303.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
303.16 - * specific language governing permissions and limitations under the
303.17 - * License. When distributing the software, include this License Header
303.18 - * Notice in each file and include the License file at
303.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
303.20 - * particular file as subject to the "Classpath" exception as provided
303.21 - * by Sun in the GPL Version 2 section of the License file that
303.22 - * accompanied this code. If applicable, add the following below the
303.23 - * License Header, with the fields enclosed by brackets [] replaced by
303.24 - * your own identifying information:
303.25 - * "Portions Copyrighted [year] [name of copyright owner]"
303.26 - *
303.27 - * Contributor(s):
303.28 - *
303.29 - * The Original Software is NetBeans. The Initial Developer of the Original
303.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
303.31 - * Microsystems, Inc. All Rights Reserved.
303.32 - *
303.33 - * If you wish your version of this file to be governed by only the CDDL
303.34 - * or only the GPL Version 2, indicate your decision by adding
303.35 - * "[Contributor] elects to include this software in this distribution
303.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
303.37 - * single choice of license, a recipient has the option to distribute
303.38 - * your version of this file under either the CDDL, the GPL Version 2 or
303.39 - * to extend the choice of license to its licensees as provided above.
303.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
303.41 - * Version 2 license, then the option applies only if the new code is
303.42 - * made subject to such option by the copyright holder.
303.43 - */
303.44 -
303.45 -package org.netbeans.modules.visualweb.gravy.model.project;
303.46 -
303.47 -import org.netbeans.modules.visualweb.gravy.model.navigation.LinkManager;
303.48 -import org.netbeans.modules.visualweb.gravy.Bundle;
303.49 -import org.netbeans.modules.visualweb.gravy.Util;
303.50 -import org.netbeans.modules.visualweb.gravy.TestUtils;
303.51 -import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
303.52 -
303.53 -import org.netbeans.jemmy.JemmyException;
303.54 -import org.netbeans.jemmy.operators.JLabelOperator;
303.55 -
303.56 -/**
303.57 - * Common class for all project types, describing all general actions and methods.
303.58 - */
303.59 -
303.60 -public abstract class Project {
303.61 -
303.62 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
303.63 - private final static String popupClose = Bundle.getStringTrimmed(
303.64 - Bundle.getStringTrimmed(bundle, "NBProjectsBundle"),
303.65 - Bundle.getStringTrimmed(bundle, "CloseProjectPopupItem"));
303.66 - private final static String popupRun = Bundle.getStringTrimmed(
303.67 - Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
303.68 - Bundle.getStringTrimmed(bundle, "RunProjectPopupItem"));
303.69 -
303.70 - private final static String STR_NO_VIEW = "<No View Available>";
303.71 - private final static String STR_MAIN = " [Main]";
303.72 -
303.73 - /**
303.74 - * Descriptor of project.
303.75 - */
303.76 - private ProjectDescriptor prjDescriptor;
303.77 -
303.78 - /**
303.79 - * Root entry of the project.
303.80 - */
303.81 - protected RootEntry root;
303.82 -
303.83 - /**
303.84 - * Link manager of project.
303.85 - */
303.86 - private LinkManager linkMng;
303.87 -
303.88 - /**
303.89 - * Creates project with specified descriptor.
303.90 - * @param prjDescriptor Descriptor of project.
303.91 - */
303.92 - public Project(ProjectDescriptor prjDescriptor) {
303.93 - setDescriptor(prjDescriptor);
303.94 - root = new RootEntry(this);
303.95 - }
303.96 -
303.97 - /**
303.98 - * Get root of project tree.
303.99 - */
303.100 - public RootEntry getRoot() {
303.101 - return root;
303.102 - }
303.103 -
303.104 - /**
303.105 - * Get link manager of project tree.
303.106 - */
303.107 - public LinkManager getLinkManager() {
303.108 - if (linkMng == null) return linkMng = new LinkManager(this);
303.109 - else return linkMng;
303.110 - }
303.111 -
303.112 - /**
303.113 - * Rename project.
303.114 - * @param newProjectName New project name.
303.115 - */
303.116 - public void rename(String newProjectName){
303.117 - String name = prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
303.118 - if (!name.equals(newProjectName)) setName(newProjectName);
303.119 - }
303.120 -
303.121 - /**
303.122 - * Close project.
303.123 - */
303.124 - public void close() {
303.125 - try {
303.126 - new ProjectNavigatorOperator().pressPopupItemOnNode(getName(), popupClose);
303.127 - }
303.128 - catch(Exception e) {
303.129 - throw new JemmyException("Project can't be closed!", e);
303.130 - }
303.131 - }
303.132 -
303.133 - /**
303.134 - * Run project.
303.135 - */
303.136 - public void run() {
303.137 - try {
303.138 - new ProjectNavigatorOperator().pressPopupItemOnNode(getName(), popupRun);
303.139 - TestUtils.wait(2000);
303.140 - String[] runFinished = {getName() + STR_MAIN, STR_NO_VIEW, ""};
303.141 - waitLabelString(1, runFinished);
303.142 - }
303.143 - catch(Exception e) {
303.144 - throw new JemmyException("Project can't be run!", e);
303.145 - }
303.146 - TestUtils.wait(3000);
303.147 - }
303.148 -
303.149 - /**
303.150 - * Check label with specified index for correspondence to specified string.
303.151 - * Method wait when specified string appears in label.
303.152 - */
303.153 - private void waitLabelString(int index, String compareString) {
303.154 - String[] compareStrings = {compareString};
303.155 - waitLabelString(index, compareStrings);
303.156 - }
303.157 -
303.158 - /**
303.159 - * Check label with specified index for correspondence to one of a specified string.
303.160 - * Method wait when one of a specified string appears in label.
303.161 - */
303.162 - private void waitLabelString(int index, String[] compareStrings) {
303.163 - JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), index);
303.164 - boolean isStringAppeared = false;
303.165 - while (true) {
303.166 - jlo = new JLabelOperator(Util.getMainWindow(), index);
303.167 - TestUtils.wait(1000);
303.168 - String labelText = jlo.getText();
303.169 - for (int i = 0; i < compareStrings.length; i++) {
303.170 - if (labelText == null || !labelText.equals(compareStrings[i]))
303.171 - continue;
303.172 - else {
303.173 - isStringAppeared = true;
303.174 - break;
303.175 - }
303.176 - }
303.177 - if (isStringAppeared) break;
303.178 - }
303.179 - }
303.180 -
303.181 - /**
303.182 - * Check label with specified index for correspondence to specified string.
303.183 - * Method wait when specified string appears in label and then wait until it disappears.
303.184 - */
303.185 - private void waitLabelStringDisappear(int index, String compareString) {
303.186 - JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), index);
303.187 - while (jlo.getText() == null || !jlo.getText().equals(compareString)) {
303.188 - jlo = new JLabelOperator(Util.getMainWindow(), index);
303.189 - TestUtils.wait(1000);
303.190 - }
303.191 - while (jlo.getText() != null && jlo.getText().equals(compareString)) {
303.192 - jlo = new JLabelOperator(Util.getMainWindow(), index);
303.193 - TestUtils.wait(1000);
303.194 - }
303.195 - }
303.196 -
303.197 - /**
303.198 - * Save All project entries.
303.199 - */
303.200 - public void saveAll() {
303.201 - }
303.202 -
303.203 - /**
303.204 - * Get descriptor of project.
303.205 - * @return descriptor of project.
303.206 - */
303.207 - public ProjectDescriptor getDescriptor() {
303.208 - return prjDescriptor;
303.209 - }
303.210 -
303.211 - /**
303.212 - * Set descriptor of project.
303.213 - * @param prjDescriptor New descriptor of project.
303.214 - */
303.215 - private void setDescriptor(ProjectDescriptor prjDescriptor) {
303.216 - this.prjDescriptor = prjDescriptor;
303.217 - }
303.218 -
303.219 - /**
303.220 - * Get project name.
303.221 - * @return project name.
303.222 - */
303.223 - public String getName() {
303.224 - return prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
303.225 - }
303.226 -
303.227 - /**
303.228 - * Set project name.
303.229 - * @param name New project name.
303.230 - */
303.231 - private void setName(String name) {
303.232 - String location = prjDescriptor.getProperty(prjDescriptor.LOCATION_KEY);
303.233 - prjDescriptor = new ProjectDescriptor(name, location);
303.234 - }
303.235 -
303.236 - /**
303.237 - * Get project location.
303.238 - * @return Absolute project location.
303.239 - */
303.240 - public String getLocation() {
303.241 - return prjDescriptor.getProperty(prjDescriptor.LOCATION_KEY);
303.242 - }
303.243 -
303.244 - /**
303.245 - * Set project location.
303.246 - * @param location Absolute project location.
303.247 - */
303.248 - private void setLocation(String location) {
303.249 - String name = prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
303.250 - prjDescriptor = new ProjectDescriptor(name, location);
303.251 - }
303.252 -
303.253 - /**
303.254 - * Makes copy of the current project.
303.255 - * @param newName Project name.
303.256 - * @return Copy of the current project.
303.257 - */
303.258 - public abstract Project saveAs(String newName);
303.259 -
303.260 - /**
303.261 - * Makes copy of the current project.
303.262 - * @param newName Project name.
303.263 - * @param newLocation absolute project location.
303.264 - * @return Copy of the current project.
303.265 - */
303.266 - public abstract Project saveAs(String newName, String newLocation);
303.267 -}
304.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectDescriptor.java Thu Jul 10 04:29:52 2008 -0700
304.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
304.3 @@ -1,143 +0,0 @@
304.4 -/*
304.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
304.6 - *
304.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
304.8 - *
304.9 - * The contents of this file are subject to the terms of either the GNU
304.10 - * General Public License Version 2 only ("GPL") or the Common
304.11 - * Development and Distribution License("CDDL") (collectively, the
304.12 - * "License"). You may not use this file except in compliance with the
304.13 - * License. You can obtain a copy of the License at
304.14 - * http://www.netbeans.org/cddl-gplv2.html
304.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
304.16 - * specific language governing permissions and limitations under the
304.17 - * License. When distributing the software, include this License Header
304.18 - * Notice in each file and include the License file at
304.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
304.20 - * particular file as subject to the "Classpath" exception as provided
304.21 - * by Sun in the GPL Version 2 section of the License file that
304.22 - * accompanied this code. If applicable, add the following below the
304.23 - * License Header, with the fields enclosed by brackets [] replaced by
304.24 - * your own identifying information:
304.25 - * "Portions Copyrighted [year] [name of copyright owner]"
304.26 - *
304.27 - * Contributor(s):
304.28 - *
304.29 - * The Original Software is NetBeans. The Initial Developer of the Original
304.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
304.31 - * Microsystems, Inc. All Rights Reserved.
304.32 - *
304.33 - * If you wish your version of this file to be governed by only the CDDL
304.34 - * or only the GPL Version 2, indicate your decision by adding
304.35 - * "[Contributor] elects to include this software in this distribution
304.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
304.37 - * single choice of license, a recipient has the option to distribute
304.38 - * your version of this file under either the CDDL, the GPL Version 2 or
304.39 - * to extend the choice of license to its licensees as provided above.
304.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
304.41 - * Version 2 license, then the option applies only if the new code is
304.42 - * made subject to such option by the copyright holder.
304.43 - */
304.44 -
304.45 -package org.netbeans.modules.visualweb.gravy.model.project;
304.46 -
304.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
304.48 -import org.netbeans.modules.visualweb.gravy.model.Descriptor;
304.49 -
304.50 -import java.util.Hashtable;
304.51 -
304.52 -/**
304.53 - * Descriptor for projects.
304.54 - */
304.55 -
304.56 -public class ProjectDescriptor implements Descriptor{
304.57 -
304.58 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
304.59 -
304.60 - public final static String J2EE13 = Bundle.getStringTrimmed(
304.61 - Bundle.getStringTrimmed(bundle, "CustomizerBundle"),
304.62 - Bundle.getStringTrimmed(bundle, "J2EE13"));
304.63 -
304.64 - public final static String J2EE14 = Bundle.getStringTrimmed(
304.65 - Bundle.getStringTrimmed(bundle, "CustomizerBundle"),
304.66 - Bundle.getStringTrimmed(bundle, "J2EE14"));
304.67 -
304.68 - public final static String JavaEE5 = Bundle.getStringTrimmed(
304.69 - Bundle.getStringTrimmed(bundle, "CustomizerBundle"),
304.70 - Bundle.getStringTrimmed(bundle, "JavaEE5"));
304.71 -
304.72 - /**
304.73 - * Key for getting project's name property from properties.
304.74 - */
304.75 - public static final String NAME_KEY = "projectName";
304.76 -
304.77 - /**
304.78 - * Key for getting project's location property from properties.
304.79 - */
304.80 - public static final String LOCATION_KEY = "projectLocation";
304.81 -
304.82 - /**
304.83 - * Key for getting project's J2EE version property from properties.
304.84 - */
304.85 - public static final String J2EEVERSION_KEY = "J2EEVersion";
304.86 -
304.87 - /**
304.88 - * Key for getting project's target server property from properties.
304.89 - */
304.90 - public static final String SERVER_KEY = "targetServer";
304.91 -
304.92 - /**
304.93 - * Project's properties.
304.94 - */
304.95 - private Hashtable properties = new Hashtable();
304.96 -
304.97 - /**
304.98 - * Create descriptor of the project with default J2EE version (1.4).
304.99 - * @param projectName Name of the project.
304.100 - * @param projectLocation Location of the project.
304.101 - */
304.102 - public ProjectDescriptor(String projectName, String projectLocation) {
304.103 - this(projectName, projectLocation, J2EE14);
304.104 - }
304.105 -
304.106 - /**
304.107 - * Create descriptor of the project.
304.108 - * @param projectName Name of the project.
304.109 - * @param projectLocation Location of the project.
304.110 - * @param J2EEVersion Version of J2EE (can be "J2EE 1.3", "J2EE 1.4", "Java EE 5").
304.111 - */
304.112 - public ProjectDescriptor(String projectName, String projectLocation, String J2EEVersion) {
304.113 - this(projectName, projectLocation, J2EEVersion, null);
304.114 - }
304.115 -
304.116 - /**
304.117 - * Create descriptor of the project.
304.118 - * @param projectName Name of the project.
304.119 - * @param projectLocation Location of the project.
304.120 - * @param J2EEVersion Version of J2EE (can be "J2EE 1.3", "J2EE 1.4", "Java EE 5").
304.121 - * @param targetServer Target Server for deploying of application.
304.122 - */
304.123 - public ProjectDescriptor(String projectName, String projectLocation, String J2EEVersion, String targetServer) {
304.124 - properties.put(NAME_KEY, projectName);
304.125 - properties.put(LOCATION_KEY, projectLocation);
304.126 - properties.put(J2EEVERSION_KEY, J2EEVersion);
304.127 - properties.put(SERVER_KEY, targetServer);
304.128 - }
304.129 -
304.130 - /**
304.131 - * Get project's properties.
304.132 - * @return Hashtable of properties.
304.133 - */
304.134 - public Hashtable getProperties() {
304.135 - return properties;
304.136 - }
304.137 -
304.138 - /**
304.139 - * Get value of specified project's property.
304.140 - * @param propertyName Name of necessary property.
304.141 - * @return String value of property.
304.142 - */
304.143 - public String getProperty(String propertyName) {
304.144 - return properties.get(propertyName).toString();
304.145 - }
304.146 -}
305.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectEntry.java Thu Jul 10 04:29:52 2008 -0700
305.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
305.3 @@ -1,79 +0,0 @@
305.4 -/*
305.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
305.6 - *
305.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
305.8 - *
305.9 - * The contents of this file are subject to the terms of either the GNU
305.10 - * General Public License Version 2 only ("GPL") or the Common
305.11 - * Development and Distribution License("CDDL") (collectively, the
305.12 - * "License"). You may not use this file except in compliance with the
305.13 - * License. You can obtain a copy of the License at
305.14 - * http://www.netbeans.org/cddl-gplv2.html
305.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
305.16 - * specific language governing permissions and limitations under the
305.17 - * License. When distributing the software, include this License Header
305.18 - * Notice in each file and include the License file at
305.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
305.20 - * particular file as subject to the "Classpath" exception as provided
305.21 - * by Sun in the GPL Version 2 section of the License file that
305.22 - * accompanied this code. If applicable, add the following below the
305.23 - * License Header, with the fields enclosed by brackets [] replaced by
305.24 - * your own identifying information:
305.25 - * "Portions Copyrighted [year] [name of copyright owner]"
305.26 - *
305.27 - * Contributor(s):
305.28 - *
305.29 - * The Original Software is NetBeans. The Initial Developer of the Original
305.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
305.31 - * Microsystems, Inc. All Rights Reserved.
305.32 - *
305.33 - * If you wish your version of this file to be governed by only the CDDL
305.34 - * or only the GPL Version 2, indicate your decision by adding
305.35 - * "[Contributor] elects to include this software in this distribution
305.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
305.37 - * single choice of license, a recipient has the option to distribute
305.38 - * your version of this file under either the CDDL, the GPL Version 2 or
305.39 - * to extend the choice of license to its licensees as provided above.
305.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
305.41 - * Version 2 license, then the option applies only if the new code is
305.42 - * made subject to such option by the copyright holder.
305.43 - */
305.44 -
305.45 -package org.netbeans.modules.visualweb.gravy.model.project;
305.46 -
305.47 -/**
305.48 - * Interface for entries included in Project.
305.49 - */
305.50 -
305.51 -public interface ProjectEntry {
305.52 -
305.53 - /**
305.54 - * Save project entry.
305.55 - */
305.56 - public void save();
305.57 -
305.58 - /**
305.59 - * Save project entry as project entry with specified name.
305.60 - */
305.61 - public void saveAs(String name);
305.62 -
305.63 - /**
305.64 - * @return Name of the project entry.
305.65 - */
305.66 - public String getName();
305.67 -
305.68 - /**
305.69 - * @return Parent of the project entry.
305.70 - */
305.71 - public ProjectEntry getParent();
305.72 -
305.73 - /**
305.74 - * @return Child project entries of the project entry.
305.75 - */
305.76 - public ProjectEntry[] getChildren();
305.77 -
305.78 - /**
305.79 - * Remove project entry.
305.80 - */
305.81 - public void delete();
305.82 -}
306.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectFactory.java Thu Jul 10 04:29:52 2008 -0700
306.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
306.3 @@ -1,87 +0,0 @@
306.4 -/*
306.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
306.6 - *
306.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
306.8 - *
306.9 - * The contents of this file are subject to the terms of either the GNU
306.10 - * General Public License Version 2 only ("GPL") or the Common
306.11 - * Development and Distribution License("CDDL") (collectively, the
306.12 - * "License"). You may not use this file except in compliance with the
306.13 - * License. You can obtain a copy of the License at
306.14 - * http://www.netbeans.org/cddl-gplv2.html
306.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
306.16 - * specific language governing permissions and limitations under the
306.17 - * License. When distributing the software, include this License Header
306.18 - * Notice in each file and include the License file at
306.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
306.20 - * particular file as subject to the "Classpath" exception as provided
306.21 - * by Sun in the GPL Version 2 section of the License file that
306.22 - * accompanied this code. If applicable, add the following below the
306.23 - * License Header, with the fields enclosed by brackets [] replaced by
306.24 - * your own identifying information:
306.25 - * "Portions Copyrighted [year] [name of copyright owner]"
306.26 - *
306.27 - * Contributor(s):
306.28 - *
306.29 - * The Original Software is NetBeans. The Initial Developer of the Original
306.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
306.31 - * Microsystems, Inc. All Rights Reserved.
306.32 - *
306.33 - * If you wish your version of this file to be governed by only the CDDL
306.34 - * or only the GPL Version 2, indicate your decision by adding
306.35 - * "[Contributor] elects to include this software in this distribution
306.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
306.37 - * single choice of license, a recipient has the option to distribute
306.38 - * your version of this file under either the CDDL, the GPL Version 2 or
306.39 - * to extend the choice of license to its licensees as provided above.
306.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
306.41 - * Version 2 license, then the option applies only if the new code is
306.42 - * made subject to such option by the copyright holder.
306.43 - */
306.44 -
306.45 -package org.netbeans.modules.visualweb.gravy.model.project;
306.46 -
306.47 -/**
306.48 - * Factory for creation projects.
306.49 - */
306.50 -
306.51 -public abstract class ProjectFactory {
306.52 -
306.53 - /**
306.54 - * Create new project.
306.55 - * Add created project to List, if project isn't contained in it.
306.56 - * @param projectDescriptor Descriptor of project.
306.57 - * @return created project.
306.58 - */
306.59 - public final Project create(ProjectDescriptor projectDescriptor){
306.60 - Project project = createProject(projectDescriptor);
306.61 - if (!ProjectList.getList().contains(project)) ProjectList.add(project);
306.62 - return project;
306.63 - }
306.64 -
306.65 - /**
306.66 - * Create new project.
306.67 - * @param projectDescriptor Descriptor of project.
306.68 - * @return created project.
306.69 - */
306.70 - abstract protected Project createProject(ProjectDescriptor projectDescriptor);
306.71 -
306.72 - /**
306.73 - * Open existing project.
306.74 - * Add this project to List, if project isn't contained in it.
306.75 - * @param pathToProject Path to project's folder.
306.76 - * @return opened project.
306.77 - */
306.78 - public final Project open(String pathToProject){
306.79 - Project project = openProject(pathToProject);
306.80 - if (!ProjectList.getList().contains(project)) ProjectList.add(project);
306.81 - return project;
306.82 - }
306.83 -
306.84 - /**
306.85 - * Open existing project.
306.86 - * @param pathToProject Path to project's folder.
306.87 - * @return opened project.
306.88 - */
306.89 - abstract protected Project openProject(String pathToProject);
306.90 -}
307.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/ProjectList.java Thu Jul 10 04:29:52 2008 -0700
307.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
307.3 @@ -1,108 +0,0 @@
307.4 -/*
307.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
307.6 - *
307.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
307.8 - *
307.9 - * The contents of this file are subject to the terms of either the GNU
307.10 - * General Public License Version 2 only ("GPL") or the Common
307.11 - * Development and Distribution License("CDDL") (collectively, the
307.12 - * "License"). You may not use this file except in compliance with the
307.13 - * License. You can obtain a copy of the License at
307.14 - * http://www.netbeans.org/cddl-gplv2.html
307.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
307.16 - * specific language governing permissions and limitations under the
307.17 - * License. When distributing the software, include this License Header
307.18 - * Notice in each file and include the License file at
307.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
307.20 - * particular file as subject to the "Classpath" exception as provided
307.21 - * by Sun in the GPL Version 2 section of the License file that
307.22 - * accompanied this code. If applicable, add the following below the
307.23 - * License Header, with the fields enclosed by brackets [] replaced by
307.24 - * your own identifying information:
307.25 - * "Portions Copyrighted [year] [name of copyright owner]"
307.26 - *
307.27 - * Contributor(s):
307.28 - *
307.29 - * The Original Software is NetBeans. The Initial Developer of the Original
307.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
307.31 - * Microsystems, Inc. All Rights Reserved.
307.32 - *
307.33 - * If you wish your version of this file to be governed by only the CDDL
307.34 - * or only the GPL Version 2, indicate your decision by adding
307.35 - * "[Contributor] elects to include this software in this distribution
307.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
307.37 - * single choice of license, a recipient has the option to distribute
307.38 - * your version of this file under either the CDDL, the GPL Version 2 or
307.39 - * to extend the choice of license to its licensees as provided above.
307.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
307.41 - * Version 2 license, then the option applies only if the new code is
307.42 - * made subject to such option by the copyright holder.
307.43 - */
307.44 -
307.45 -package org.netbeans.modules.visualweb.gravy.model.project;
307.46 -
307.47 -import java.util.List;
307.48 -import java.util.ArrayList;
307.49 -
307.50 -/**
307.51 - * List of projects.
307.52 - */
307.53 -
307.54 -public class ProjectList {
307.55 -
307.56 - /**
307.57 - * Main project.
307.58 - */
307.59 - private Project mainProject;
307.60 -
307.61 - /**
307.62 - * List of projects.
307.63 - */
307.64 - private static List projectList = new ArrayList();
307.65 -
307.66 - /**
307.67 - * Create new ProjectList.
307.68 - */
307.69 - public ProjectList() {
307.70 - }
307.71 -
307.72 - /**
307.73 - * Get list of projects.
307.74 - * @return List of projects.
307.75 - */
307.76 - public static List getList() {
307.77 - return projectList;
307.78 - }
307.79 -
307.80 - /**
307.81 - * Add project to List.
307.82 - * @param project Project for add.
307.83 - */
307.84 - public static void add(Project project) {
307.85 - projectList.add(project);
307.86 - }
307.87 -
307.88 - /**
307.89 - * Remove project from List.
307.90 - * @param project Project for remove.
307.91 - */
307.92 - public static void remove(Project project) {
307.93 - projectList.remove(project);
307.94 - }
307.95 -
307.96 - /**
307.97 - * Get main project.
307.98 - * @return mainProject variable.
307.99 - */
307.100 - public Project getMainProject() {
307.101 - return mainProject;
307.102 - }
307.103 -
307.104 - /**
307.105 - * Set main project.
307.106 - * @param project Project to be set as main.
307.107 - */
307.108 - public void setMainProject(Project project) {
307.109 - mainProject = project;
307.110 - }
307.111 -}
308.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/RootEntry.java Thu Jul 10 04:29:52 2008 -0700
308.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
308.3 @@ -1,163 +0,0 @@
308.4 -/*
308.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
308.6 - *
308.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
308.8 - *
308.9 - * The contents of this file are subject to the terms of either the GNU
308.10 - * General Public License Version 2 only ("GPL") or the Common
308.11 - * Development and Distribution License("CDDL") (collectively, the
308.12 - * "License"). You may not use this file except in compliance with the
308.13 - * License. You can obtain a copy of the License at
308.14 - * http://www.netbeans.org/cddl-gplv2.html
308.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
308.16 - * specific language governing permissions and limitations under the
308.17 - * License. When distributing the software, include this License Header
308.18 - * Notice in each file and include the License file at
308.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
308.20 - * particular file as subject to the "Classpath" exception as provided
308.21 - * by Sun in the GPL Version 2 section of the License file that
308.22 - * accompanied this code. If applicable, add the following below the
308.23 - * License Header, with the fields enclosed by brackets [] replaced by
308.24 - * your own identifying information:
308.25 - * "Portions Copyrighted [year] [name of copyright owner]"
308.26 - *
308.27 - * Contributor(s):
308.28 - *
308.29 - * The Original Software is NetBeans. The Initial Developer of the Original
308.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
308.31 - * Microsystems, Inc. All Rights Reserved.
308.32 - *
308.33 - * If you wish your version of this file to be governed by only the CDDL
308.34 - * or only the GPL Version 2, indicate your decision by adding
308.35 - * "[Contributor] elects to include this software in this distribution
308.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
308.37 - * single choice of license, a recipient has the option to distribute
308.38 - * your version of this file under either the CDDL, the GPL Version 2 or
308.39 - * to extend the choice of license to its licensees as provided above.
308.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
308.41 - * Version 2 license, then the option applies only if the new code is
308.42 - * made subject to such option by the copyright holder.
308.43 - */
308.44 -
308.45 -package org.netbeans.modules.visualweb.gravy.model.project;
308.46 -
308.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
308.48 -
308.49 -import java.util.ArrayList;
308.50 -import java.util.List;
308.51 -import javax.swing.tree.TreePath;
308.52 -
308.53 -/**
308.54 - * Class for root entry of the Project.
308.55 - */
308.56 -
308.57 -public class RootEntry implements ProjectEntry {
308.58 -
308.59 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
308.60 -
308.61 - public final static String sourcePackagesName = Bundle.getStringTrimmed(
308.62 - Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
308.63 - Bundle.getStringTrimmed(bundle, "SourcePackages"));
308.64 - public final static String webPagesName = Bundle.getStringTrimmed(
308.65 - Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
308.66 - Bundle.getStringTrimmed(bundle, "WebPages"));
308.67 -
308.68 - /**
308.69 - * Project which the root entry created for.
308.70 - */
308.71 - Project project;
308.72 -
308.73 - /**
308.74 - * Child project entries of the root entry.
308.75 - */
308.76 - List childList = new ArrayList();
308.77 -
308.78 - /**
308.79 - * Creates a new instance of root entry.
308.80 - */
308.81 - public RootEntry(Project project) {
308.82 - this.project = project;
308.83 - }
308.84 -
308.85 - /**
308.86 - * Save root entry.
308.87 - */
308.88 - public void save() {
308.89 - }
308.90 -
308.91 - /**
308.92 - * Save root entry as root entry with specified name.
308.93 - */
308.94 - public void saveAs(String name) {
308.95 - }
308.96 -
308.97 - /**
308.98 - * @return Project which the root entry belong to.
308.99 - */
308.100 - public Project getProject() {
308.101 - return project;
308.102 - }
308.103 -
308.104 - /**
308.105 - * Get name of root entry.
308.106 - * @return Name of the root entry.
308.107 - */
308.108 - public String getName() {
308.109 - return null;
308.110 - }
308.111 -
308.112 - /**
308.113 - * @return TreePath of the root entry.
308.114 - */
308.115 - public TreePath getTreePath() {
308.116 - return null;
308.117 - }
308.118 -
308.119 - /**
308.120 - * @return Parent of the root entry.
308.121 - */
308.122 - public ProjectEntry getParent() {
308.123 - return null;
308.124 - }
308.125 -
308.126 - /**
308.127 - * @return Child project entries of the root entry.
308.128 - */
308.129 - public ProjectEntry[] getChildren() {
308.130 - return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
308.131 - }
308.132 -
308.133 - /**
308.134 - * @return Web Page root folder.
308.135 - */
308.136 - public WebPageFolder getWebPageRootFolder() {
308.137 - ProjectEntry[] prjEntries = getChildren();
308.138 - for (int i = 0; i < prjEntries.length ; i++) {
308.139 - if (prjEntries[i] instanceof WebPageFolder &&
308.140 - ((WebPageFolder) prjEntries[i]).getName().equals(webPagesName)) {
308.141 - return ((WebPageFolder) prjEntries[i]);
308.142 - }
308.143 - }
308.144 - return null;
308.145 - }
308.146 -
308.147 - /**
308.148 - * @return Source root folder.
308.149 - */
308.150 - public SourceFolder getSourceRootFolder() {
308.151 - ProjectEntry[] prjEntries = getChildren();
308.152 - for (int i = 0; i < prjEntries.length ; i++) {
308.153 - if (prjEntries[i] instanceof SourceFolder &&
308.154 - ((SourceFolder) prjEntries[i]).getName().equals(sourcePackagesName)) {
308.155 - return ((SourceFolder) prjEntries[i]);
308.156 - }
308.157 - }
308.158 - return null;
308.159 - }
308.160 -
308.161 - /**
308.162 - * Remove root entry.
308.163 - */
308.164 - public void delete() {
308.165 - }
308.166 -}
309.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/SourceFile.java Thu Jul 10 04:29:52 2008 -0700
309.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
309.3 @@ -1,171 +0,0 @@
309.4 -/*
309.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
309.6 - *
309.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
309.8 - *
309.9 - * The contents of this file are subject to the terms of either the GNU
309.10 - * General Public License Version 2 only ("GPL") or the Common
309.11 - * Development and Distribution License("CDDL") (collectively, the
309.12 - * "License"). You may not use this file except in compliance with the
309.13 - * License. You can obtain a copy of the License at
309.14 - * http://www.netbeans.org/cddl-gplv2.html
309.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
309.16 - * specific language governing permissions and limitations under the
309.17 - * License. When distributing the software, include this License Header
309.18 - * Notice in each file and include the License file at
309.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
309.20 - * particular file as subject to the "Classpath" exception as provided
309.21 - * by Sun in the GPL Version 2 section of the License file that
309.22 - * accompanied this code. If applicable, add the following below the
309.23 - * License Header, with the fields enclosed by brackets [] replaced by
309.24 - * your own identifying information:
309.25 - * "Portions Copyrighted [year] [name of copyright owner]"
309.26 - *
309.27 - * Contributor(s):
309.28 - *
309.29 - * The Original Software is NetBeans. The Initial Developer of the Original
309.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
309.31 - * Microsystems, Inc. All Rights Reserved.
309.32 - *
309.33 - * If you wish your version of this file to be governed by only the CDDL
309.34 - * or only the GPL Version 2, indicate your decision by adding
309.35 - * "[Contributor] elects to include this software in this distribution
309.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
309.37 - * single choice of license, a recipient has the option to distribute
309.38 - * your version of this file under either the CDDL, the GPL Version 2 or
309.39 - * to extend the choice of license to its licensees as provided above.
309.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
309.41 - * Version 2 license, then the option applies only if the new code is
309.42 - * made subject to such option by the copyright holder.
309.43 - */
309.44 -
309.45 -package org.netbeans.modules.visualweb.gravy.model.project;
309.46 -
309.47 -import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
309.48 -import org.netbeans.modules.visualweb.gravy.TestUtils;
309.49 -
309.50 -import org.netbeans.jemmy.operators.Operator;
309.51 -import org.netbeans.jemmy.JemmyException;
309.52 -
309.53 -import javax.swing.tree.TreePath;
309.54 -
309.55 -/**
309.56 - * Common class for all source files.
309.57 - */
309.58 -
309.59 -abstract class SourceFile {
309.60 -
309.61 - private final String popupOpen = "Open";
309.62 -
309.63 - TreePath path;
309.64 - String name;
309.65 -
309.66 - /**
309.67 - * Creates a new instance of web page.
309.68 - * @param path Path to web page in project.
309.69 - * @param name Name of web page.
309.70 - */
309.71 - SourceFile(TreePath path, String name) {
309.72 - this.path = path;
309.73 - this.name = name;
309.74 - }
309.75 -
309.76 - /**
309.77 - * Open source file.
309.78 - */
309.79 - public void open() {
309.80 - try {
309.81 - ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
309.82 - TestUtils.wait(500);
309.83 - String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
309.84 - prjNav.pressPopupItemOnNode(full_path, popupOpen, new Operator.DefaultStringComparator(true, true));
309.85 - }
309.86 - catch(Exception e) {
309.87 - throw new JemmyException("Source file can't be opened!", e);
309.88 - }
309.89 - TestUtils.wait(500);
309.90 - }
309.91 -
309.92 - /**
309.93 - * Close source file.
309.94 - */
309.95 - public void close() {
309.96 - }
309.97 -
309.98 - /**
309.99 - * Gets text from the currently opened source file.
309.100 - * @return String representing whole content of the source fiole.
309.101 - * (including new line characters)
309.102 - */
309.103 - public abstract String getText();
309.104 -
309.105 - /**
309.106 - * Gets text from specified line.
309.107 - * @param lineNumber Number of line.
309.108 - * @return String representing content of the line.
309.109 - */
309.110 - public abstract String getText(int lineNumber);
309.111 -
309.112 - /**
309.113 - * Checks if source file contains text specified as parameter text.
309.114 - * @param text Text to compare to.
309.115 - * @return true if text was found, false otherwise.
309.116 - */
309.117 - public abstract boolean contains(String text);
309.118 -
309.119 - /**
309.120 - * Replaces first occurence of oldText by newText.
309.121 - * @param oldText Text to be replaced.
309.122 - * @param newText Text to write instead.
309.123 - */
309.124 - public abstract void replace(String oldText, String newText);
309.125 -
309.126 - /**
309.127 - * Replaced index-th occurence of oldText by newText.
309.128 - * @param oldText Text to be replaced
309.129 - * @param newText Text to write instead
309.130 - * @param index Index of oldText occurence.
309.131 - */
309.132 - public abstract void replace(String oldText, String newText, int index);
309.133 -
309.134 - /**
309.135 - * Insert text to current position.
309.136 - * @param text String to be inserted.
309.137 - */
309.138 - public abstract void insert(String text);
309.139 -
309.140 - /**
309.141 - * Inserts text to position specified by line number and column.
309.142 - * @param text String to be inserted.
309.143 - * @param lineNumber Number of line.
309.144 - * @param column Column position.
309.145 - */
309.146 - public abstract void insert(String text, int lineNumber, int column);
309.147 -
309.148 - /**
309.149 - * Deletes given number of characters from specified possition.
309.150 - * @param offset Position inside document.
309.151 - * @param length Number of characters to be deleted.
309.152 - */
309.153 - public abstract void delete(int offset, int length);
309.154 -
309.155 - /**
309.156 - * Deletes given number of characters from current caret possition.
309.157 - * @param length Number of characters to be deleted.
309.158 - */
309.159 - public abstract void delete(int length);
309.160 -
309.161 - /**
309.162 - * Delete specified line.
309.163 - * @param line Number of line.
309.164 - */
309.165 - public abstract void deleteLine(int line);
309.166 -
309.167 - /**
309.168 - * Deletes characters between column1 and column2 on the specified line.
309.169 - * @param lineNumber Number of line.
309.170 - * @param column1 Column position where to start deleting.
309.171 - * @param column2 Column position where to stop deleting.
309.172 - */
309.173 - public abstract void delete(int lineNumber, int column1, int column2);
309.174 -}
310.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/SourceFolder.java Thu Jul 10 04:29:52 2008 -0700
310.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
310.3 @@ -1,201 +0,0 @@
310.4 -/*
310.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
310.6 - *
310.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
310.8 - *
310.9 - * The contents of this file are subject to the terms of either the GNU
310.10 - * General Public License Version 2 only ("GPL") or the Common
310.11 - * Development and Distribution License("CDDL") (collectively, the
310.12 - * "License"). You may not use this file except in compliance with the
310.13 - * License. You can obtain a copy of the License at
310.14 - * http://www.netbeans.org/cddl-gplv2.html
310.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
310.16 - * specific language governing permissions and limitations under the
310.17 - * License. When distributing the software, include this License Header
310.18 - * Notice in each file and include the License file at
310.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
310.20 - * particular file as subject to the "Classpath" exception as provided
310.21 - * by Sun in the GPL Version 2 section of the License file that
310.22 - * accompanied this code. If applicable, add the following below the
310.23 - * License Header, with the fields enclosed by brackets [] replaced by
310.24 - * your own identifying information:
310.25 - * "Portions Copyrighted [year] [name of copyright owner]"
310.26 - *
310.27 - * Contributor(s):
310.28 - *
310.29 - * The Original Software is NetBeans. The Initial Developer of the Original
310.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
310.31 - * Microsystems, Inc. All Rights Reserved.
310.32 - *
310.33 - * If you wish your version of this file to be governed by only the CDDL
310.34 - * or only the GPL Version 2, indicate your decision by adding
310.35 - * "[Contributor] elects to include this software in this distribution
310.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
310.37 - * single choice of license, a recipient has the option to distribute
310.38 - * your version of this file under either the CDDL, the GPL Version 2 or
310.39 - * to extend the choice of license to its licensees as provided above.
310.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
310.41 - * Version 2 license, then the option applies only if the new code is
310.42 - * made subject to such option by the copyright holder.
310.43 - */
310.44 -
310.45 -package org.netbeans.modules.visualweb.gravy.model.project;
310.46 -
310.47 -import org.netbeans.modules.visualweb.gravy.TestUtils;
310.48 -import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
310.49 -
310.50 -import org.netbeans.jemmy.TimeoutExpiredException;
310.51 -import org.netbeans.jemmy.JemmyException;
310.52 -import org.netbeans.jemmy.operators.Operator;
310.53 -import org.netbeans.jemmy.operators.JButtonOperator;
310.54 -import org.netbeans.jemmy.operators.JDialogOperator;
310.55 -import org.netbeans.jemmy.operators.JTextFieldOperator;
310.56 -
310.57 -import javax.swing.tree.TreePath;
310.58 -
310.59 -/**
310.60 - * Class for source folders included in Project.
310.61 - */
310.62 -
310.63 -public class SourceFolder extends Folder {
310.64 -
310.65 - private final String popupNewPackage = "New|Java Package...";
310.66 - private final String dlgNewPackage = "New Java Package";
310.67 - private final String popupNewClass = "New|Java Class...";
310.68 - private final String dlgNewClass = "New Java Class";
310.69 - private final String btnFinish = "Finish";
310.70 - private final String btnCancel = "Cancel";
310.71 -
310.72 - SourceFolder(TreePath path, String name, ProjectEntry parent) {
310.73 - super(path, name, parent);
310.74 - }
310.75 -
310.76 - /**
310.77 - * Add new source subfolder to current folder.
310.78 - * @param name Name of new source subfolder.
310.79 - * @return Added source subfolder.
310.80 - */
310.81 - public SourceFolder addSourceSubFolder(String name) {
310.82 - if (getSourceSubFolder(name) == null) {
310.83 - String path_part1 = "", path_part2 = "", full_path = "", path_to_find = "";
310.84 - ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
310.85 - TestUtils.wait(1000);
310.86 - full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
310.87 - path_to_find = full_path + "|" + name;
310.88 - if (full_path.indexOf("|", full_path.indexOf("|") + 1) != -1) {
310.89 - path_part1 = full_path.substring(0, full_path.indexOf("|", full_path.indexOf("|") + 1) + 1);
310.90 - path_part2 = full_path.substring(full_path.indexOf("|", full_path.indexOf("|") + 1) +1, full_path.length()).replace('|', '.');
310.91 - full_path = path_part1.concat(path_part2);
310.92 - path_to_find = full_path + "." + name;
310.93 - }
310.94 - try {
310.95 - prjNav.tree().findPath(path_to_find);
310.96 - }
310.97 - catch(TimeoutExpiredException tee) {
310.98 - try {
310.99 - prjNav.pressPopupItemOnNode(full_path, popupNewPackage, new Operator.DefaultStringComparator(true, true));
310.100 - }
310.101 - catch(Exception e) {
310.102 - throw new JemmyException(popupNewPackage + " item in popup menu of " + full_path + " node can't be found!", e);
310.103 - }
310.104 - TestUtils.wait(1000);
310.105 - try {
310.106 - JDialogOperator jdo = new JDialogOperator(dlgNewPackage);
310.107 - if (!path_part2.equals("")) path_part2 = path_part2 + ".";
310.108 - new JTextFieldOperator(jdo, 0).setText(path_part2 + name);
310.109 - TestUtils.wait(500);
310.110 - new JButtonOperator(jdo, btnFinish).pushNoBlock();
310.111 - }
310.112 - catch(Exception e) {
310.113 - throw new JemmyException("Error occurs in " + dlgNewPackage + " dialog!", e);
310.114 - }
310.115 - TestUtils.wait(1000);
310.116 - }
310.117 - SourceFolder newSourceFolder = new SourceFolder(new TreePath(full_path), name, this);
310.118 - childList.add(newSourceFolder);
310.119 - return newSourceFolder;
310.120 - }
310.121 - else return getSourceSubFolder(name);
310.122 - }
310.123 -
310.124 - /**
310.125 - * Get source subfolder with specified name.
310.126 - * @param name Name of source subfolder.
310.127 - * @return Source folder with specified name.
310.128 - */
310.129 - public SourceFolder getSourceSubFolder(String name) {
310.130 - for (int i = 0; i < childList.size(); i++) {
310.131 - if (childList.get(i) instanceof SourceFolder && ((SourceFolder) childList.get(i)).getName().equals(name))
310.132 - return ((SourceFolder) childList.get(i));
310.133 - }
310.134 - return null;
310.135 - }
310.136 -
310.137 - /**
310.138 - * Add Java file to folder.
310.139 - * @param name Name of Java file.
310.140 - * @return Added Java file.
310.141 - */
310.142 - public JavaFile addJavaFile(String name) {
310.143 - if (getJavaFile(name) == null) {
310.144 - String path_part1 = "", path_part2 = "", full_path = "";
310.145 - ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
310.146 - TestUtils.wait(1000);
310.147 - full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
310.148 - if (full_path.indexOf("|", full_path.indexOf("|") + 1) != -1) {
310.149 - path_part1 = full_path.substring(0, full_path.indexOf("|", full_path.indexOf("|") + 1) + 1);
310.150 - path_part2 = full_path.substring(full_path.indexOf("|", full_path.indexOf("|") + 1) +1, full_path.length()).replace('|', '.');
310.151 - full_path = path_part1.concat(path_part2);
310.152 - }
310.153 - try {
310.154 - prjNav.tree().findPath(full_path + "|" + name + ".java");
310.155 - }
310.156 - catch(TimeoutExpiredException tee) {
310.157 - try {
310.158 - prjNav.pressPopupItemOnNode(full_path, popupNewClass, new Operator.DefaultStringComparator(true, true));
310.159 - }
310.160 - catch(Exception e) {
310.161 - throw new JemmyException(popupNewClass + " item in popup menu of " + full_path + " node can't be found!", e);
310.162 - }
310.163 - TestUtils.wait(1000);
310.164 - try {
310.165 - JDialogOperator jdo = new JDialogOperator(dlgNewClass);
310.166 - new JTextFieldOperator(jdo, 0).setText(name);
310.167 - TestUtils.wait(500);
310.168 - new JButtonOperator(jdo, btnFinish).pushNoBlock();
310.169 - }
310.170 - catch(Exception e) {
310.171 - throw new JemmyException("Error occurs in " + dlgNewClass + " dialog!", e);
310.172 - }
310.173 - TestUtils.wait(1000);
310.174 - }
310.175 - JavaFile newJavaFile;
310.176 - if (getParent() instanceof RootEntry) newJavaFile = new JavaFile(new TreePath(full_path + "|<default package>"), name, this);
310.177 - else newJavaFile = new JavaFile(new TreePath(full_path), name, this);
310.178 - childList.add(newJavaFile);
310.179 - return newJavaFile;
310.180 - }
310.181 - else return getJavaFile(name);
310.182 - }
310.183 -
310.184 - /**
310.185 - * Get Java file with specified name.
310.186 - * @param name Name of Java file.
310.187 - * @return Java file with specified name.
310.188 - */
310.189 - public JavaFile getJavaFile(String name) {
310.190 - for (int i = 0; i < childList.size(); i++) {
310.191 - if (childList.get(i) instanceof JavaFile && ((JavaFile) childList.get(i)).getName().equals(name))
310.192 - return ((JavaFile) childList.get(i));
310.193 - }
310.194 - if ((getParent().getParent() instanceof RootEntry) &&
310.195 - (name.equals("ApplicationBean1") || name.equals("RequestBean1") ||
310.196 - name.equals("SessionBean1"))) {
310.197 - String str_path = this.path.toString().substring(1, this.path.toString().length() - 1);
310.198 - JavaFile newJavaFile = new JavaFile(new TreePath(str_path + "|" + this.name), name, this);
310.199 - childList.add(newJavaFile);
310.200 - return newJavaFile;
310.201 - }
310.202 - return null;
310.203 - }
310.204 -}
311.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/WebPage.java Thu Jul 10 04:29:52 2008 -0700
311.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
311.3 @@ -1,284 +0,0 @@
311.4 -/*
311.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
311.6 - *
311.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
311.8 - *
311.9 - * The contents of this file are subject to the terms of either the GNU
311.10 - * General Public License Version 2 only ("GPL") or the Common
311.11 - * Development and Distribution License("CDDL") (collectively, the
311.12 - * "License"). You may not use this file except in compliance with the
311.13 - * License. You can obtain a copy of the License at
311.14 - * http://www.netbeans.org/cddl-gplv2.html
311.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
311.16 - * specific language governing permissions and limitations under the
311.17 - * License. When distributing the software, include this License Header
311.18 - * Notice in each file and include the License file at
311.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
311.20 - * particular file as subject to the "Classpath" exception as provided
311.21 - * by Sun in the GPL Version 2 section of the License file that
311.22 - * accompanied this code. If applicable, add the following below the
311.23 - * License Header, with the fields enclosed by brackets [] replaced by
311.24 - * your own identifying information:
311.25 - * "Portions Copyrighted [year] [name of copyright owner]"
311.26 - *
311.27 - * Contributor(s):
311.28 - *
311.29 - * The Original Software is NetBeans. The Initial Developer of the Original
311.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
311.31 - * Microsystems, Inc. All Rights Reserved.
311.32 - *
311.33 - * If you wish your version of this file to be governed by only the CDDL
311.34 - * or only the GPL Version 2, indicate your decision by adding
311.35 - * "[Contributor] elects to include this software in this distribution
311.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
311.37 - * single choice of license, a recipient has the option to distribute
311.38 - * your version of this file under either the CDDL, the GPL Version 2 or
311.39 - * to extend the choice of license to its licensees as provided above.
311.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
311.41 - * Version 2 license, then the option applies only if the new code is
311.42 - * made subject to such option by the copyright holder.
311.43 - */
311.44 -
311.45 -package org.netbeans.modules.visualweb.gravy.model.project;
311.46 -
311.47 -import org.netbeans.modules.visualweb.gravy.model.navigation.*;
311.48 -import org.netbeans.modules.visualweb.gravy.model.components.*;
311.49 -import org.netbeans.modules.visualweb.gravy.model.project.components.*;
311.50 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
311.51 -import org.netbeans.modules.visualweb.gravy.PageTopComponentOperator;
311.52 -import org.netbeans.modules.visualweb.gravy.TestUtils;
311.53 -import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
311.54 -import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
311.55 -import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
311.56 -
311.57 -import org.netbeans.jemmy.TimeoutExpiredException;
311.58 -import org.netbeans.jemmy.JemmyException;
311.59 -
311.60 -import javax.swing.tree.TreePath;
311.61 -import java.awt.Point;
311.62 -import java.io.File;
311.63 -import java.util.ArrayList;
311.64 -import java.util.List;
311.65 -
311.66 -/**
311.67 - * Web pages included in Project.
311.68 - */
311.69 -
311.70 -public class WebPage extends JSPFile implements LinkableSource, LinkableTarget {
311.71 -
311.72 - private final static String propID = "id";
311.73 -
311.74 - PageTopComponentOperator page = null;
311.75 -
311.76 - private JavaFile jf;
311.77 -
311.78 - private String sep = File.separator;
311.79 -
311.80 - /**
311.81 - * Creates a new instance of web page.
311.82 - * @param path Path to web page in project.
311.83 - * @param name Name of web page.
311.84 - */
311.85 - WebPage(TreePath path, String name, ProjectEntry parent) {
311.86 - super(path, name, parent);
311.87 - SourceFolder sf = ((WebPageFolder) parent).getSourceFolder();
311.88 - JavaFile jf = sf.addJavaFile(name);
311.89 - jf.webpage = this;
311.90 - this.jf = jf;
311.91 - webpage = this;
311.92 - }
311.93 -
311.94 - /**
311.95 - * Get Java file for this web page.
311.96 - * @return Java file for this web page.
311.97 - */
311.98 - public JavaFile getJavaFile() {
311.99 - return jf;
311.100 - }
311.101 -
311.102 - /**
311.103 - * Return added component.
311.104 - * @param webcomponent Component in palette to add.
311.105 - * @return Component which was added.
311.106 - */
311.107 - public Component add(WebComponent webcomponent){
311.108 - return add(webcomponent, new Point(0, 0));
311.109 - }
311.110 -
311.111 - /**
311.112 - * Return added component.
311.113 - * @param webcomponent Component in palette to add.
311.114 - * @param point Point to place component.
311.115 - * @return Component which was added.
311.116 - */
311.117 - public Component add(WebComponent webcomponent, Point point){
311.118 - return add(webcomponent, point, null);
311.119 - }
311.120 -
311.121 - /**
311.122 - * Return added component.
311.123 - * @param webcomponent Component in palette to add.
311.124 - * @param point Point to place component.
311.125 - * @param name Name of component.
311.126 - * @return Component which was added.
311.127 - */
311.128 - public Component add(WebComponent webcomponent, Point point, String name){
311.129 - open();
311.130 - DesignerPaneOperator designer = page.getDesigner();
311.131 - TestUtils.wait(1000);
311.132 - PaletteContainerOperator palette = null;
311.133 - try {
311.134 - palette = new PaletteContainerOperator(webcomponent.getComponentSet().getID());
311.135 - }
311.136 - catch(Exception e) {
311.137 - throw new JemmyException("Palette category with name " + webcomponent.getComponentSet().getID()+ " can't be found!", e);
311.138 - }
311.139 - TestUtils.wait(2000);
311.140 - try {
311.141 - palette.addComponent(webcomponent.getID(), designer, point);
311.142 - }
311.143 - catch(Exception e) {
311.144 - throw new JemmyException("Component " + webcomponent.getID()+ " can't be added!", e);
311.145 - }
311.146 - TestUtils.wait(2000);
311.147 - try {
311.148 - SheetTableOperator sheet = new SheetTableOperator();
311.149 - if (name == null) name = sheet.getValue(propID);
311.150 - else sheet.setTextValue(propID, name);
311.151 - }
311.152 - catch(Exception e) {
311.153 - throw new JemmyException("Name for component " + webcomponent.getID()+ " can't be set!", e);
311.154 - }
311.155 - Component newComponent;
311.156 - if (webcomponent.isVisual()) {
311.157 - if (webcomponent.isEventHadling()) newComponent = new VisualEventHandlingComponent(webcomponent, name);
311.158 - else newComponent = new VisualComponent(webcomponent, name);
311.159 - ((VisualComponent) newComponent).setCoordinates(point);
311.160 - }
311.161 - else newComponent = new NonVisualComponent(webcomponent, name);
311.162 - newComponent.Page = this;
311.163 - childList.add(newComponent);
311.164 - return newComponent;
311.165 - }
311.166 -
311.167 - /**
311.168 - * Return all component on web page.
311.169 - * @return Array of Component on web page.
311.170 - */
311.171 - public Component[] getComponents(){
311.172 - return ((Component[]) childList.toArray(new Component[childList.size()]));
311.173 - }
311.174 -
311.175 - /**
311.176 - * Return component on web page with specified index.
311.177 - * @param index Index of necessary component.
311.178 - * @return Component on web page with specified index.
311.179 - */
311.180 - public Component getComponent(int index){
311.181 - return ((Component) childList.get(index));
311.182 - }
311.183 -
311.184 - /**
311.185 - * Return component on web page with specified type and index.
311.186 - * @param index Index of necessary component.
311.187 - * @param type Type of necessary component.
311.188 - * @return Component on web page with specified type and index.
311.189 - */
311.190 - public Component getComponent(Component type, int index){
311.191 - List tmpComponents = new ArrayList();
311.192 - for (int i = 0; i < childList.size(); i++) {
311.193 - if (((Component) childList.get(i)).getType().equals(type.getType()))
311.194 - tmpComponents.add(childList.get(i));
311.195 - }
311.196 - return ((Component) tmpComponents.get(index));
311.197 - }
311.198 -
311.199 - /**
311.200 - * Return component on web page with specified ID.
311.201 - * @param ID ID of necessary component.
311.202 - * @return Component on web page with specified ID.
311.203 - */
311.204 - public Component getComponent(String ID){
311.205 - return null;
311.206 - }
311.207 -
311.208 - /**
311.209 - * Get name of linkable source web page.
311.210 - * @return Name of linkable source web page.
311.211 - */
311.212 - public String getLinkableSourceName() {
311.213 - String folder_path = getTreePath().toString();
311.214 - if (folder_path.indexOf("|", folder_path.indexOf("|") + 1) == -1) return getName() + ".jsp";
311.215 - folder_path = folder_path.substring(folder_path.indexOf("|", folder_path.indexOf("|") + 1) + 1, folder_path.length() - 1).replace('|', '/');
311.216 - return folder_path + "/" + getName() + ".jsp";
311.217 - }
311.218 -
311.219 - /**
311.220 - * Get name of linkable target web page.
311.221 - * @return Name of linkable target web page.
311.222 - */
311.223 - public String getLinkableTargetName() {
311.224 - String folder_path = getTreePath().toString();
311.225 - if (folder_path.indexOf("|", folder_path.indexOf("|") + 1) == -1) return getName() + ".jsp";
311.226 - folder_path = folder_path.substring(folder_path.indexOf("|", folder_path.indexOf("|") + 1) + 1, folder_path.length() - 1).replace('|', '/');
311.227 - return folder_path + "/" + getName() + ".jsp";
311.228 - }
311.229 -
311.230 - /**
311.231 - * Get project, which this web page belongs to.
311.232 - * @return Project Project, which this web page belongs to.
311.233 - */
311.234 - private Project getProject() {
311.235 - ProjectEntry tmp = this;
311.236 - while (!((tmp = tmp.getParent()) instanceof RootEntry));
311.237 - return ((RootEntry) tmp).getProject();
311.238 - }
311.239 -
311.240 - /**
311.241 - * Open web page file.
311.242 - */
311.243 - public void open() {
311.244 - long tmpTimeout = 0;
311.245 - String tmp_path = getTreePath().toString();
311.246 - int start_compare = tmp_path.indexOf(RootEntry.webPagesName) + RootEntry.webPagesName.length() + 1;
311.247 - String compare_tooltip;
311.248 - if (start_compare != tmp_path.length())
311.249 - compare_tooltip = ((tmp_path.substring(start_compare, tmp_path.length() - 1)) + "|" + this.name + ".jsp").replace('|', File.separatorChar);
311.250 - else
311.251 - compare_tooltip = this.name + ".jsp";
311.252 - String project_path = getProject().getLocation() + getProject().getName() + sep + "web" + sep;
311.253 - compare_tooltip = project_path + compare_tooltip;
311.254 - try {
311.255 - tmpTimeout = RaveWindowOperator.getDefaultRave().getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
311.256 - RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
311.257 - if (page == null) {
311.258 - int i = 0;
311.259 - while (!((String) (page = new PageTopComponentOperator(getName(), i++)).getDump().get("Tooltip text")).equals(compare_tooltip));
311.260 - }
311.261 - else {
311.262 - try {
311.263 - page.makeComponentVisible();
311.264 - }
311.265 - catch(Exception e) {throw new TimeoutExpiredException("");}
311.266 - }
311.267 - }
311.268 - catch (TimeoutExpiredException e) {
311.269 - int i = 0;
311.270 - super.open();
311.271 - while (!((String) (page = new PageTopComponentOperator(getName(), i++)).getDump().get("Tooltip text")).equals(compare_tooltip));
311.272 - }
311.273 - finally {
311.274 - RaveWindowOperator.getDefaultRave().getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", tmpTimeout);
311.275 - }
311.276 - page.getDesigner();
311.277 - }
311.278 -
311.279 - /**
311.280 - * Close web page file.
311.281 - */
311.282 - public void close() {
311.283 - open();
311.284 - TestUtils.wait(500);
311.285 - page.close();
311.286 - }
311.287 -}
312.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/WebPageFolder.java Thu Jul 10 04:29:52 2008 -0700
312.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
312.3 @@ -1,194 +0,0 @@
312.4 -/*
312.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
312.6 - *
312.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
312.8 - *
312.9 - * The contents of this file are subject to the terms of either the GNU
312.10 - * General Public License Version 2 only ("GPL") or the Common
312.11 - * Development and Distribution License("CDDL") (collectively, the
312.12 - * "License"). You may not use this file except in compliance with the
312.13 - * License. You can obtain a copy of the License at
312.14 - * http://www.netbeans.org/cddl-gplv2.html
312.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
312.16 - * specific language governing permissions and limitations under the
312.17 - * License. When distributing the software, include this License Header
312.18 - * Notice in each file and include the License file at
312.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
312.20 - * particular file as subject to the "Classpath" exception as provided
312.21 - * by Sun in the GPL Version 2 section of the License file that
312.22 - * accompanied this code. If applicable, add the following below the
312.23 - * License Header, with the fields enclosed by brackets [] replaced by
312.24 - * your own identifying information:
312.25 - * "Portions Copyrighted [year] [name of copyright owner]"
312.26 - *
312.27 - * Contributor(s):
312.28 - *
312.29 - * The Original Software is NetBeans. The Initial Developer of the Original
312.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
312.31 - * Microsystems, Inc. All Rights Reserved.
312.32 - *
312.33 - * If you wish your version of this file to be governed by only the CDDL
312.34 - * or only the GPL Version 2, indicate your decision by adding
312.35 - * "[Contributor] elects to include this software in this distribution
312.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
312.37 - * single choice of license, a recipient has the option to distribute
312.38 - * your version of this file under either the CDDL, the GPL Version 2 or
312.39 - * to extend the choice of license to its licensees as provided above.
312.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
312.41 - * Version 2 license, then the option applies only if the new code is
312.42 - * made subject to such option by the copyright holder.
312.43 - */
312.44 -
312.45 -package org.netbeans.modules.visualweb.gravy.model.project;
312.46 -
312.47 -import org.netbeans.modules.visualweb.gravy.Bundle;
312.48 -import org.netbeans.modules.visualweb.gravy.TestUtils;
312.49 -import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
312.50 -
312.51 -import org.netbeans.jemmy.JemmyException;
312.52 -import org.netbeans.jemmy.operators.Operator;
312.53 -import org.netbeans.jemmy.operators.JButtonOperator;
312.54 -import org.netbeans.jemmy.operators.JDialogOperator;
312.55 -import org.netbeans.jemmy.operators.JTextFieldOperator;
312.56 -
312.57 -import javax.swing.tree.TreePath;
312.58 -
312.59 -/**
312.60 - * Class for web page folders included in Project.
312.61 - */
312.62 -
312.63 -public class WebPageFolder extends Folder {
312.64 -
312.65 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
312.66 - private final static String popupNew = Bundle.getStringTrimmed(bundle, "New");
312.67 - private final static String popupFolder = Bundle.getStringTrimmed(bundle, "Folder");
312.68 - private final static String popupNewFolder = popupNew + "|" + popupFolder + "...";
312.69 - private final static String dlgNewFolder = popupNew + " " + popupFolder;
312.70 - private final static String popupPage = Bundle.getStringTrimmed(
312.71 - Bundle.getStringTrimmed(bundle, "JSFResBundle"),
312.72 - Bundle.getStringTrimmed(bundle, "Page"));
312.73 - private final static String popupNewPage = popupNew + "|" + popupPage + "...";
312.74 - private final static String dlgNewPage = popupNew + " " + popupPage;
312.75 - private final static String btnFinish = Bundle.getStringTrimmed(bundle, "FinishButton");
312.76 - private final static String btnCancel = Bundle.getStringTrimmed(bundle, "CancelButton");
312.77 -
312.78 - private SourceFolder sf;
312.79 -
312.80 - WebPageFolder(TreePath path, String name, ProjectEntry parent) {
312.81 - super(path, name, parent);
312.82 - if (parent instanceof RootEntry) {
312.83 - RootEntry root = (RootEntry) parent;
312.84 - SourceFolder srf = new SourceFolder(new TreePath(root.getProject().getName()), root.sourcePackagesName, root);
312.85 - SourceFolder sf = new SourceFolder(new TreePath(root.getProject().getName() + "|" + root.sourcePackagesName), root.getProject().getName().toLowerCase(), srf);
312.86 - srf.childList.add(sf);
312.87 - root.childList.add(srf);
312.88 - this.sf = sf;
312.89 - }
312.90 - else this.sf = ((WebPageFolder) parent).getSourceFolder().addSourceSubFolder(name);
312.91 - }
312.92 -
312.93 - /**
312.94 - * Add new web page to folder.
312.95 - * @param name Name of new web page.
312.96 - * @return Added web page.
312.97 - */
312.98 - public WebPage addWebPage(String name) {
312.99 - if (getWebPage(name) == null) {
312.100 - ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
312.101 - TestUtils.wait(4000);
312.102 - String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
312.103 - try {
312.104 - prjNav.pressPopupItemOnNode(full_path, popupNewPage, new Operator.DefaultStringComparator(true, true));
312.105 - }
312.106 - catch(Exception e) {
312.107 - throw new JemmyException(popupNewPage + " item in popup menu of " + full_path + " node can't be found!", e);
312.108 - }
312.109 - TestUtils.wait(1000);
312.110 - try {
312.111 - JDialogOperator jdo = new JDialogOperator(dlgNewPage);
312.112 - new JTextFieldOperator(jdo, 0).setText(name);
312.113 - TestUtils.wait(500);
312.114 - new JButtonOperator(jdo, btnFinish).pushNoBlock();
312.115 - }
312.116 - catch(Exception e) {
312.117 - throw new JemmyException("Error occurs in " + dlgNewPage + " dialog!", e);
312.118 - }
312.119 - TestUtils.wait(1000);
312.120 - WebPage newWebPage = new WebPage(new TreePath(full_path), name, this);
312.121 - childList.add(newWebPage);
312.122 - return newWebPage;
312.123 - }
312.124 - else return getWebPage(name);
312.125 - }
312.126 -
312.127 - /**
312.128 - * Get web page with specified name.
312.129 - * @param name Name of web page.
312.130 - * @return Web page with specified name.
312.131 - */
312.132 - public WebPage getWebPage(String name) {
312.133 - for (int i = 0; i < childList.size(); i++) {
312.134 - if ((childList.get(i) instanceof WebPage) && ((WebPage) childList.get(i)).getName().equals(name))
312.135 - return ((WebPage) childList.get(i));
312.136 - }
312.137 - if (getParent() instanceof RootEntry && name.equals("Page1")) {
312.138 - String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
312.139 - WebPage newWebPage = new WebPage(new TreePath(full_path), name, this);
312.140 - childList.add(newWebPage);
312.141 - return newWebPage;
312.142 - }
312.143 - return null;
312.144 - }
312.145 -
312.146 - /**
312.147 - * Add web page folder to folder.
312.148 - * @param name Name of web page folder.
312.149 - * @return Added web page folder.
312.150 - */
312.151 - public WebPageFolder addWebPageSubFolder(String name) {
312.152 - ProjectNavigatorOperator prjNav = ProjectNavigatorOperator.showProjectNavigator();
312.153 - TestUtils.wait(1000);
312.154 - String full_path = this.path.toString().substring(1, this.path.toString().length() - 1) + "|" + this.name;
312.155 - try {
312.156 - prjNav.pressPopupItemOnNode(full_path, popupNewFolder, new Operator.DefaultStringComparator(true, true));
312.157 - }
312.158 - catch(Exception e) {
312.159 - throw new JemmyException(popupNewFolder + " item in popup menu of " + full_path + " node can't be found!", e);
312.160 - }
312.161 - TestUtils.wait(1000);
312.162 - try {
312.163 - JDialogOperator jdo = new JDialogOperator(dlgNewFolder);
312.164 - new JTextFieldOperator(jdo, 0).setText(name);
312.165 - TestUtils.wait(500);
312.166 - new JButtonOperator(jdo, btnFinish).pushNoBlock();
312.167 - }
312.168 - catch(Exception e) {
312.169 - throw new JemmyException("Error occurs in " + dlgNewFolder + " dialog!", e);
312.170 - }
312.171 - TestUtils.wait(1000);
312.172 - WebPageFolder newWebPageFolder = new WebPageFolder(new TreePath(full_path), name, this);
312.173 - childList.add(newWebPageFolder);
312.174 - return newWebPageFolder;
312.175 - }
312.176 -
312.177 - /**
312.178 - * Get web page subfolder with specified name.
312.179 - * @param name Name of web page subfolder.
312.180 - * @return Web page folder with specified name.
312.181 - */
312.182 - public WebPageFolder getWebPageSubFolder(String name) {
312.183 - for (int i = 0; i < childList.size(); i++) {
312.184 - if (childList.get(i) instanceof WebPageFolder && ((WebPageFolder) childList.get(i)).getName().equals(name))
312.185 - return ((WebPageFolder) childList.get(i));
312.186 - }
312.187 - return null;
312.188 - }
312.189 -
312.190 - /**
312.191 - * Get source folder for this web page folder.
312.192 - * @return Source folder for this web page folder.
312.193 - */
312.194 - public SourceFolder getSourceFolder() {
312.195 - return sf;
312.196 - }
312.197 -}
313.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/XMLFile.java Thu Jul 10 04:29:52 2008 -0700
313.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
313.3 @@ -1,217 +0,0 @@
313.4 -/*
313.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
313.6 - *
313.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
313.8 - *
313.9 - * The contents of this file are subject to the terms of either the GNU
313.10 - * General Public License Version 2 only ("GPL") or the Common
313.11 - * Development and Distribution License("CDDL") (collectively, the
313.12 - * "License"). You may not use this file except in compliance with the
313.13 - * License. You can obtain a copy of the License at
313.14 - * http://www.netbeans.org/cddl-gplv2.html
313.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
313.16 - * specific language governing permissions and limitations under the
313.17 - * License. When distributing the software, include this License Header
313.18 - * Notice in each file and include the License file at
313.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
313.20 - * particular file as subject to the "Classpath" exception as provided
313.21 - * by Sun in the GPL Version 2 section of the License file that
313.22 - * accompanied this code. If applicable, add the following below the
313.23 - * License Header, with the fields enclosed by brackets [] replaced by
313.24 - * your own identifying information:
313.25 - * "Portions Copyrighted [year] [name of copyright owner]"
313.26 - *
313.27 - * Contributor(s):
313.28 - *
313.29 - * The Original Software is NetBeans. The Initial Developer of the Original
313.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
313.31 - * Microsystems, Inc. All Rights Reserved.
313.32 - *
313.33 - * If you wish your version of this file to be governed by only the CDDL
313.34 - * or only the GPL Version 2, indicate your decision by adding
313.35 - * "[Contributor] elects to include this software in this distribution
313.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
313.37 - * single choice of license, a recipient has the option to distribute
313.38 - * your version of this file under either the CDDL, the GPL Version 2 or
313.39 - * to extend the choice of license to its licensees as provided above.
313.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
313.41 - * Version 2 license, then the option applies only if the new code is
313.42 - * made subject to such option by the copyright holder.
313.43 - */
313.44 -
313.45 -package org.netbeans.modules.visualweb.gravy.model.project;
313.46 -
313.47 -import java.util.ArrayList;
313.48 -import java.util.List;
313.49 -import javax.swing.tree.TreePath;
313.50 -
313.51 -/**
313.52 - * Class for XML files.
313.53 - */
313.54 -
313.55 -public class XMLFile extends SourceFile implements ProjectEntry {
313.56 -
313.57 - /**
313.58 - * Parent of the xml file.
313.59 - */
313.60 - private ProjectEntry parent;
313.61 -
313.62 - /**
313.63 - * Child project entries of the xml file.
313.64 - */
313.65 - private List childList = new ArrayList();
313.66 -
313.67 - /**
313.68 - * Creates a new instance of web page.
313.69 - * @param path Path to web page in project.
313.70 - * @param name Name of web page.
313.71 - */
313.72 - XMLFile(TreePath path, String name, ProjectEntry parent) {
313.73 - super(path, name);
313.74 - setParent(parent);
313.75 - }
313.76 -
313.77 - /**
313.78 - * Save project entry.
313.79 - */
313.80 - public void save() {
313.81 - }
313.82 -
313.83 - /**
313.84 - * Save project entry as project entry with specified name.
313.85 - */
313.86 - public void saveAs(String name) {
313.87 - }
313.88 -
313.89 - /**
313.90 - * @return Name of the project entry.
313.91 - */
313.92 - public String getName() {
313.93 - return name;
313.94 - }
313.95 -
313.96 - /**
313.97 - * @return TreePath of the project entry.
313.98 - */
313.99 - public TreePath getTreePath() {
313.100 - return path;
313.101 - }
313.102 -
313.103 - /**
313.104 - * @return Parent of the xml file.
313.105 - */
313.106 - public ProjectEntry getParent() {
313.107 - return parent;
313.108 - }
313.109 -
313.110 - /**
313.111 - * Set parent of the xml file.
313.112 - */
313.113 - private void setParent(ProjectEntry parent) {
313.114 - this.parent = parent;
313.115 - }
313.116 -
313.117 - /**
313.118 - * @return Child project entries of the xml file.
313.119 - */
313.120 - public ProjectEntry[] getChildren() {
313.121 - return ((ProjectEntry[]) childList.toArray(new ProjectEntry[childList.size()]));
313.122 - }
313.123 -
313.124 - /**
313.125 - * Remove project entry.
313.126 - */
313.127 - public void delete() {
313.128 - }
313.129 -
313.130 - /**
313.131 - * Gets text from the currently opened xml file.
313.132 - * @return String representing whole content of the xml file.
313.133 - * (including new line characters)
313.134 - */
313.135 - public String getText() {
313.136 - return null;
313.137 - }
313.138 -
313.139 - /**
313.140 - * Gets text from specified line.
313.141 - * @param lineNumber Number of line.
313.142 - * @return String representing content of the line.
313.143 - */
313.144 - public String getText(int lineNumber) {
313.145 - return null;
313.146 - }
313.147 -
313.148 - /**
313.149 - * Checks if xml file contains text specified as parameter text.
313.150 - * @param text Text to compare to.
313.151 - * @return true if text was found, false otherwise.
313.152 - */
313.153 - public boolean contains(String text) {
313.154 - return true;
313.155 - }
313.156 -
313.157 - /**
313.158 - * Replaces first occurence of oldText by newText.
313.159 - * @param oldText Text to be replaced.
313.160 - * @param newText Text to write instead.
313.161 - */
313.162 - public void replace(String oldText, String newText) {
313.163 - }
313.164 -
313.165 - /**
313.166 - * Replaced index-th occurence of oldText by newText.
313.167 - * @param oldText Text to be replaced
313.168 - * @param newText Text to write instead
313.169 - * @param index Tndex of oldText occurence.
313.170 - */
313.171 - public void replace(String oldText, String newText, int index) {
313.172 - }
313.173 -
313.174 - /**
313.175 - * Insert text to current position.
313.176 - * @param text String to be inserted.
313.177 - */
313.178 - public void insert(String text) {
313.179 - }
313.180 -
313.181 - /**
313.182 - * Inserts text to position specified by line number and column.
313.183 - * @param text String to be inserted.
313.184 - * @param lineNumber Number of line.
313.185 - * @param column Column position.
313.186 - */
313.187 - public void insert(String text, int lineNumber, int column) {
313.188 - }
313.189 -
313.190 - /**
313.191 - * Deletes given number of characters from specified possition.
313.192 - * @param offset Position inside document.
313.193 - * @param length Number of characters to be deleted.
313.194 - */
313.195 - public void delete(int offset, int length) {
313.196 - }
313.197 -
313.198 - /**
313.199 - * Deletes given number of characters from current caret possition.
313.200 - * @param length Number of characters to be deleted.
313.201 - */
313.202 - public void delete(int length) {
313.203 - }
313.204 -
313.205 - /**
313.206 - * Delete specified line.
313.207 - * @param line Number of line.
313.208 - */
313.209 - public void deleteLine(int line) {
313.210 - }
313.211 -
313.212 - /**
313.213 - * Deletes characters between column1 and column2 on the specified line.
313.214 - * @param lineNumber Number of line.
313.215 - * @param column1 Column position where to start deleting.
313.216 - * @param column2 Column position where to stop deleting.
313.217 - */
313.218 - public void delete(int lineNumber, int column1, int column2) {
313.219 - }
313.220 -}
314.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/Bundle.properties Thu Jul 10 04:29:52 2008 -0700
314.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
314.3 @@ -1,62 +0,0 @@
314.4 -/*
314.5 -
314.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
314.7 - *
314.8 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
314.9 -
314.10 - *
314.11 - * The contents of this file are subject to the terms of either the GNU
314.12 - * General Public License Version 2 only ("GPL") or the Common
314.13 - * Development and Distribution License("CDDL") (collectively, the
314.14 - * "License"). You may not use this file except in compliance with the
314.15 - * License. You can obtain a copy of the License at
314.16 - * http://www.netbeans.org/cddl-gplv2.html
314.17 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
314.18 - * specific language governing permissions and limitations under the
314.19 - * License. When distributing the software, include this License Header
314.20 - * Notice in each file and include the License file at
314.21 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
314.22 - * particular file as subject to the "Classpath" exception as provided
314.23 - * by Sun in the GPL Version 2 section of the License file that
314.24 - * accompanied this code. If applicable, add the following below the
314.25 - * License Header, with the fields enclosed by brackets [] replaced by
314.26 - * your own identifying information:
314.27 - * "Portions Copyrighted [year] [name of copyright owner]"
314.28 - *
314.29 - * Contributor(s):
314.30 -
314.31 - *
314.32 -
314.33 - * The Original Software is NetBeans. The Initial Developer of the Original
314.34 -
314.35 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
314.36 -
314.37 - * Microsystems, Inc. All Rights Reserved.
314.38 - *
314.39 - * If you wish your version of this file to be governed by only the CDDL
314.40 - * or only the GPL Version 2, indicate your decision by adding
314.41 - * "[Contributor] elects to include this software in this distribution
314.42 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
314.43 - * single choice of license, a recipient has the option to distribute
314.44 - * your version of this file under either the CDDL, the GPL Version 2 or
314.45 - * to extend the choice of license to its licensees as provided above.
314.46 - * However, if you add GPL Version 2 code and therefore, elected the GPL
314.47 - * Version 2 license, then the option applies only if the new code is
314.48 - * made subject to such option by the copyright holder.
314.49 -
314.50 - */
314.51 -
314.52 -
314.53 -
314.54 -#properties for Projects window and rave bundle
314.55 -
314.56 -InsyncBundle=org.netbeans.modules.visualweb.insync.action.Bundle
314.57 -
314.58 -OutlineBundle=org.netbeans.modules.visualweb.outline.Bundle
314.59 -
314.60 -ViewOutline=LBL_OutlinePanel
314.61 -
314.62 -EditEventHandler=LBL_EditEventHandlerAction
314.63 -
314.64 -EditDefEventHandler=LBL_EditEventHandlerActionName
314.65 -
315.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/Component.java Thu Jul 10 04:29:52 2008 -0700
315.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
315.3 @@ -1,148 +0,0 @@
315.4 -/*
315.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
315.6 - *
315.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
315.8 - *
315.9 - * The contents of this file are subject to the terms of either the GNU
315.10 - * General Public License Version 2 only ("GPL") or the Common
315.11 - * Development and Distribution License("CDDL") (collectively, the
315.12 - * "License"). You may not use this file except in compliance with the
315.13 - * License. You can obtain a copy of the License at
315.14 - * http://www.netbeans.org/cddl-gplv2.html
315.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
315.16 - * specific language governing permissions and limitations under the
315.17 - * License. When distributing the software, include this License Header
315.18 - * Notice in each file and include the License file at
315.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
315.20 - * particular file as subject to the "Classpath" exception as provided
315.21 - * by Sun in the GPL Version 2 section of the License file that
315.22 - * accompanied this code. If applicable, add the following below the
315.23 - * License Header, with the fields enclosed by brackets [] replaced by
315.24 - * your own identifying information:
315.25 - * "Portions Copyrighted [year] [name of copyright owner]"
315.26 - *
315.27 - * Contributor(s):
315.28 - *
315.29 - * The Original Software is NetBeans. The Initial Developer of the Original
315.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
315.31 - * Microsystems, Inc. All Rights Reserved.
315.32 - *
315.33 - * If you wish your version of this file to be governed by only the CDDL
315.34 - * or only the GPL Version 2, indicate your decision by adding
315.35 - * "[Contributor] elects to include this software in this distribution
315.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
315.37 - * single choice of license, a recipient has the option to distribute
315.38 - * your version of this file under either the CDDL, the GPL Version 2 or
315.39 - * to extend the choice of license to its licensees as provided above.
315.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
315.41 - * Version 2 license, then the option applies only if the new code is
315.42 - * made subject to such option by the copyright holder.
315.43 - */
315.44 -
315.45 -package org.netbeans.modules.visualweb.gravy.model.project.components;
315.46 -
315.47 -import org.netbeans.modules.visualweb.gravy.model.project.WebPage;
315.48 -import org.netbeans.modules.visualweb.gravy.model.components.*;
315.49 -import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
315.50 -import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
315.51 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
315.52 -import org.netbeans.modules.visualweb.gravy.TestUtils;
315.53 -
315.54 -import org.netbeans.jemmy.operators.JTreeOperator;
315.55 -import org.netbeans.jemmy.JemmyException;
315.56 -
315.57 -import java.awt.Container;
315.58 -import javax.swing.JLabel;
315.59 -import java.util.Hashtable;
315.60 -
315.61 -/**
315.62 - * Common class for all components on web page.
315.63 - */
315.64 -
315.65 -public class Component {
315.66 -
315.67 - final static String OS_MAC = "Mac OS X";
315.68 - final static String OS_SOL = "SunOS";
315.69 - final static String OS_WIN = "Windows";
315.70 - final static String OS_LIN = "Linux";
315.71 - final String propName = "id";
315.72 - public WebPage Page;
315.73 - protected String Type = "";
315.74 -
315.75 -
315.76 - /**
315.77 - * Component's properties.
315.78 - */
315.79 - private Hashtable properties = new Hashtable();
315.80 -
315.81 - /**
315.82 - * Create component on web page using web component from palette.
315.83 - * @param webcomponent Web component from palette.
315.84 - * @param name Name of component.
315.85 - */
315.86 - public Component(WebComponent webcomponent, String name) {
315.87 - Type = webcomponent.getID();
315.88 - properties.put(propName, name);
315.89 - }
315.90 -
315.91 - /**
315.92 - * Get name of component.
315.93 - * @return Name of component.
315.94 - */
315.95 - public String getName() {
315.96 - return ((String) getProperty(propName));
315.97 - }
315.98 -
315.99 - /**
315.100 - * Get type of component.
315.101 - * @return Type of component.
315.102 - */
315.103 - public String getType() {
315.104 - return Type;
315.105 - }
315.106 -
315.107 - /**
315.108 - * Return property value.
315.109 - * @param name Name of property.
315.110 - * @return Property value.
315.111 - */
315.112 - public String getProperty(String name) {
315.113 - return properties.get(name).toString();
315.114 - }
315.115 -
315.116 - /**
315.117 - * Set property value.
315.118 - * @param name Name of property.
315.119 - * @param value Value of property.
315.120 - */
315.121 - public void setProperty(String name, String value) {
315.122 - Page.open();
315.123 - DocumentOutlineOperator outline = new DocumentOutlineOperator(RaveWindowOperator.getDefaultRave());
315.124 - TestUtils.wait(1000);
315.125 - JTreeOperator aotree = outline.getStructTreeOperator();
315.126 - try {
315.127 - aotree.selectPath(aotree.findPath(Page.getName() + "|page1|html1|body1|form1|" + getName()));
315.128 - }
315.129 - catch(Exception e) {
315.130 - throw new JemmyException("Path " + Page.getName() + "|page1|html1|body1|form1|" + getName() + " can't be selected!", e);
315.131 - }
315.132 - TestUtils.wait(1000);
315.133 - try {
315.134 - SheetTableOperator sheet = new SheetTableOperator();
315.135 - String class_0 = ((Container) sheet.getRenderedComponent(sheet.findCell("name:"+name, 0).y, 1)).getComponent(0).getClass().getName();
315.136 - String class_1 = ((Container) sheet.getRenderedComponent(sheet.findCell("name:"+name, 0).y, 1)).getComponent(1).getClass().getName();
315.137 - String propName = ((JLabel) sheet.getRenderedComponent(sheet.findCell("name:"+name, 0).y, 0)).getText();
315.138 - if (class_1.equals("org.openide.explorer.propertysheet.RendererFactory$StringRenderer")) sheet.setTextValue(propName, value);
315.139 - if (class_1.equals("org.openide.explorer.propertysheet.RendererFactory$CheckboxRenderer")) sheet.setCheckBoxValue(propName, value);
315.140 - if (class_1.equals("org.openide.explorer.propertysheet.RendererFactory$ComboboxRenderer") ||
315.141 - (class_0.indexOf("AquaComboBoxButton") != -1 && System.getProperty("os.name").equals(OS_MAC)) ||
315.142 - (class_0.indexOf("javax.swing.JButton") != -1 && System.getProperty("os.name").equals(OS_SOL)) ||
315.143 - (class_0.indexOf("WindowsComboBoxUI") != -1 && class_0.indexOf("ComboBoxButton") != -1 && System.getProperty("os.name").indexOf(OS_WIN) != -1) ||
315.144 - (class_0.indexOf("javax.swing.JButton") != -1 && System.getProperty("os.name").equals(OS_LIN))) sheet.setComboBoxValue(propName, value);
315.145 - }
315.146 - catch(Exception e) {
315.147 - throw new JemmyException("Property can't be set!", e);
315.148 - }
315.149 - properties.put(name, value);
315.150 - }
315.151 -}
316.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/NonVisualComponent.java Thu Jul 10 04:29:52 2008 -0700
316.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
316.3 @@ -1,60 +0,0 @@
316.4 -/*
316.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
316.6 - *
316.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
316.8 - *
316.9 - * The contents of this file are subject to the terms of either the GNU
316.10 - * General Public License Version 2 only ("GPL") or the Common
316.11 - * Development and Distribution License("CDDL") (collectively, the
316.12 - * "License"). You may not use this file except in compliance with the
316.13 - * License. You can obtain a copy of the License at
316.14 - * http://www.netbeans.org/cddl-gplv2.html
316.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
316.16 - * specific language governing permissions and limitations under the
316.17 - * License. When distributing the software, include this License Header
316.18 - * Notice in each file and include the License file at
316.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
316.20 - * particular file as subject to the "Classpath" exception as provided
316.21 - * by Sun in the GPL Version 2 section of the License file that
316.22 - * accompanied this code. If applicable, add the following below the
316.23 - * License Header, with the fields enclosed by brackets [] replaced by
316.24 - * your own identifying information:
316.25 - * "Portions Copyrighted [year] [name of copyright owner]"
316.26 - *
316.27 - * Contributor(s):
316.28 - *
316.29 - * The Original Software is NetBeans. The Initial Developer of the Original
316.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
316.31 - * Microsystems, Inc. All Rights Reserved.
316.32 - *
316.33 - * If you wish your version of this file to be governed by only the CDDL
316.34 - * or only the GPL Version 2, indicate your decision by adding
316.35 - * "[Contributor] elects to include this software in this distribution
316.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
316.37 - * single choice of license, a recipient has the option to distribute
316.38 - * your version of this file under either the CDDL, the GPL Version 2 or
316.39 - * to extend the choice of license to its licensees as provided above.
316.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
316.41 - * Version 2 license, then the option applies only if the new code is
316.42 - * made subject to such option by the copyright holder.
316.43 - */
316.44 -
316.45 -package org.netbeans.modules.visualweb.gravy.model.project.components;
316.46 -
316.47 -import org.netbeans.modules.visualweb.gravy.model.components.*;
316.48 -
316.49 -/**
316.50 - * Common class for all non visual components on web page.
316.51 - */
316.52 -
316.53 -public class NonVisualComponent extends Component {
316.54 -
316.55 - /**
316.56 - * Create non visual component on web page using web component from palette.
316.57 - * @param webcomponent
316.58 - * @param name
316.59 - */
316.60 - public NonVisualComponent(WebComponent webcomponent, String name) {
316.61 - super(webcomponent, name);
316.62 - }
316.63 -}
317.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/VisualComponent.java Thu Jul 10 04:29:52 2008 -0700
317.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
317.3 @@ -1,80 +0,0 @@
317.4 -/*
317.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
317.6 - *
317.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
317.8 - *
317.9 - * The contents of this file are subject to the terms of either the GNU
317.10 - * General Public License Version 2 only ("GPL") or the Common
317.11 - * Development and Distribution License("CDDL") (collectively, the
317.12 - * "License"). You may not use this file except in compliance with the
317.13 - * License. You can obtain a copy of the License at
317.14 - * http://www.netbeans.org/cddl-gplv2.html
317.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
317.16 - * specific language governing permissions and limitations under the
317.17 - * License. When distributing the software, include this License Header
317.18 - * Notice in each file and include the License file at
317.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
317.20 - * particular file as subject to the "Classpath" exception as provided
317.21 - * by Sun in the GPL Version 2 section of the License file that
317.22 - * accompanied this code. If applicable, add the following below the
317.23 - * License Header, with the fields enclosed by brackets [] replaced by
317.24 - * your own identifying information:
317.25 - * "Portions Copyrighted [year] [name of copyright owner]"
317.26 - *
317.27 - * Contributor(s):
317.28 - *
317.29 - * The Original Software is NetBeans. The Initial Developer of the Original
317.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
317.31 - * Microsystems, Inc. All Rights Reserved.
317.32 - *
317.33 - * If you wish your version of this file to be governed by only the CDDL
317.34 - * or only the GPL Version 2, indicate your decision by adding
317.35 - * "[Contributor] elects to include this software in this distribution
317.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
317.37 - * single choice of license, a recipient has the option to distribute
317.38 - * your version of this file under either the CDDL, the GPL Version 2 or
317.39 - * to extend the choice of license to its licensees as provided above.
317.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
317.41 - * Version 2 license, then the option applies only if the new code is
317.42 - * made subject to such option by the copyright holder.
317.43 - */
317.44 -
317.45 -package org.netbeans.modules.visualweb.gravy.model.project.components;
317.46 -
317.47 -import org.netbeans.modules.visualweb.gravy.model.components.*;
317.48 -
317.49 -import java.awt.Point;
317.50 -
317.51 -/**
317.52 - * Common class for all components on web page.
317.53 - */
317.54 -
317.55 -public class VisualComponent extends Component {
317.56 -
317.57 - private Point point;
317.58 -
317.59 - /**
317.60 - * Create visual component on web page using web component from palette.
317.61 - * @param webcomponent Web component from palette.
317.62 - * @param name Name of component.
317.63 - */
317.64 - public VisualComponent(WebComponent webcomponent, String name) {
317.65 - super(webcomponent, name);
317.66 - }
317.67 -
317.68 - /**
317.69 - * Get coordinates of component.
317.70 - * @return Point of component.
317.71 - */
317.72 - public Point getCoordinates() {
317.73 - return point;
317.74 - }
317.75 -
317.76 - /**
317.77 - * Set coordiantes of component.
317.78 - * @param point of component.
317.79 - */
317.80 - public void setCoordinates(Point point) {
317.81 - this.point = point;
317.82 - }
317.83 -}
318.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/model/project/components/VisualEventHandlingComponent.java Thu Jul 10 04:29:52 2008 -0700
318.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
318.3 @@ -1,154 +0,0 @@
318.4 -/*
318.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
318.6 - *
318.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
318.8 - *
318.9 - * The contents of this file are subject to the terms of either the GNU
318.10 - * General Public License Version 2 only ("GPL") or the Common
318.11 - * Development and Distribution License("CDDL") (collectively, the
318.12 - * "License"). You may not use this file except in compliance with the
318.13 - * License. You can obtain a copy of the License at
318.14 - * http://www.netbeans.org/cddl-gplv2.html
318.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
318.16 - * specific language governing permissions and limitations under the
318.17 - * License. When distributing the software, include this License Header
318.18 - * Notice in each file and include the License file at
318.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
318.20 - * particular file as subject to the "Classpath" exception as provided
318.21 - * by Sun in the GPL Version 2 section of the License file that
318.22 - * accompanied this code. If applicable, add the following below the
318.23 - * License Header, with the fields enclosed by brackets [] replaced by
318.24 - * your own identifying information:
318.25 - * "Portions Copyrighted [year] [name of copyright owner]"
318.26 - *
318.27 - * Contributor(s):
318.28 - *
318.29 - * The Original Software is NetBeans. The Initial Developer of the Original
318.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
318.31 - * Microsystems, Inc. All Rights Reserved.
318.32 - *
318.33 - * If you wish your version of this file to be governed by only the CDDL
318.34 - * or only the GPL Version 2, indicate your decision by adding
318.35 - * "[Contributor] elects to include this software in this distribution
318.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
318.37 - * single choice of license, a recipient has the option to distribute
318.38 - * your version of this file under either the CDDL, the GPL Version 2 or
318.39 - * to extend the choice of license to its licensees as provided above.
318.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
318.41 - * Version 2 license, then the option applies only if the new code is
318.42 - * made subject to such option by the copyright holder.
318.43 - */
318.44 -
318.45 -package org.netbeans.modules.visualweb.gravy.model.project.components;
318.46 -
318.47 -import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
318.48 -import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
318.49 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
318.50 -import org.netbeans.modules.visualweb.gravy.TestUtils;
318.51 -import org.netbeans.modules.visualweb.gravy.Bundle;
318.52 -import org.netbeans.modules.visualweb.gravy.Util;
318.53 -import org.netbeans.modules.visualweb.gravy.model.components.*;
318.54 -import org.netbeans.modules.visualweb.gravy.model.project.JavaFile;
318.55 -
318.56 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
318.57 -import org.netbeans.jemmy.operators.JTreeOperator;
318.58 -import org.netbeans.jemmy.JemmyException;
318.59 -
318.60 -import java.awt.event.KeyEvent;
318.61 -
318.62 -/**
318.63 - * Common class for all components on web page.
318.64 - */
318.65 -
318.66 -public class VisualEventHandlingComponent extends VisualComponent {
318.67 -
318.68 - private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.components.Bundle";
318.69 - private final static String viewOutline = Bundle.getStringTrimmed(
318.70 - Bundle.getStringTrimmed(bundle, "OutlineBundle"),
318.71 - Bundle.getStringTrimmed(bundle, "ViewOutline"));
318.72 - private final static String popupEventHandler = Bundle.getStringTrimmed(
318.73 - Bundle.getStringTrimmed(bundle, "InsyncBundle"),
318.74 - Bundle.getStringTrimmed(bundle, "EditEventHandler"));
318.75 - private final static String[] action = {"action"};
318.76 - private final static String popupActionEventHandler = Bundle.getStringTrimmed(
318.77 - Bundle.getStringTrimmed(bundle, "InsyncBundle"),
318.78 - Bundle.getStringTrimmed(bundle, "EditDefEventHandler"), action);
318.79 - private final static String openOutline = "Window|" + viewOutline;
318.80 -
318.81 - /**
318.82 - * Create visual component on web page using web component from palette.
318.83 - * @param webcomponent Web component from palette.
318.84 - * @param name Name of component.
318.85 - */
318.86 - public VisualEventHandlingComponent(WebComponent webcomponent, String name) {
318.87 - super(webcomponent, name);
318.88 - }
318.89 -
318.90 - /**
318.91 - * Set event handler for component.
318.92 - * @param handlerText Text of event handler.
318.93 - */
318.94 - public void setEventHandler(String handlerText) {
318.95 - setEventHandler("", handlerText);
318.96 - }
318.97 -
318.98 - /**
318.99 - * Set event handler for component.
318.100 - * @param eventType Type of event.
318.101 - * @param handlerText Text of event handler.
318.102 - */
318.103 - public void setEventHandler(String eventType, String handlerText) {
318.104 - Page.open();
318.105 - try {
318.106 - Util.getMainMenu().pushMenu(openOutline);
318.107 - }
318.108 - catch(Exception e) {
318.109 - throw new JemmyException(openOutline + " menu can't be found!", e);
318.110 - }
318.111 - DocumentOutlineOperator outline = new DocumentOutlineOperator(RaveWindowOperator.getDefaultRave());
318.112 - TestUtils.wait(1000);
318.113 - try {
318.114 - JTreeOperator aotree = outline.getStructTreeOperator();
318.115 - aotree.callPopupOnPath(aotree.findPath(Page.getName() + "|page1|html1|body1|form1|" + getName()));
318.116 - TestUtils.wait(1000);
318.117 - if (!eventType.equals("")) new JPopupMenuOperator().pushMenu(popupEventHandler + "|" + eventType);
318.118 - else new JPopupMenuOperator().pushMenu(popupActionEventHandler);
318.119 - TestUtils.wait(1000);
318.120 - }
318.121 - catch(Exception e) {
318.122 - throw new JemmyException("Item for action handler in popup menu can't be found!", e);
318.123 - }
318.124 - try {
318.125 - JavaFile jf = Page.getJavaFile();
318.126 - jf.insert(handlerText);
318.127 - TestUtils.wait(1000);
318.128 - jf.pushKey(KeyEvent.VK_DOWN);
318.129 - TestUtils.wait(500);
318.130 - jf.pushKey(KeyEvent.VK_END);
318.131 - TestUtils.wait(500);
318.132 - if (!jf.getText().substring(jf.getCaretPosition() - 1, jf.getCaretPosition()).equals("}")) {
318.133 - jf.pushKey(KeyEvent.VK_HOME, KeyEvent.SHIFT_MASK);
318.134 - TestUtils.wait(500);
318.135 - jf.pushKey(KeyEvent.VK_DELETE);
318.136 - }
318.137 -
318.138 - //Workaround: switch to design gives an error
318.139 - //Workaround start
318.140 - TestUtils.wait(500);
318.141 - jf.pushKey(KeyEvent.VK_LEFT);
318.142 - TestUtils.wait(500);
318.143 - jf.pushKey(KeyEvent.VK_SPACE);
318.144 - TestUtils.wait(500);
318.145 - jf.pushKey(KeyEvent.VK_BACK_SPACE);
318.146 - //Workaround end
318.147 -
318.148 - TestUtils.wait(1000);
318.149 - jf.reformatCode();
318.150 - }
318.151 - catch(Exception e) {
318.152 - throw new JemmyException("Event Handler can't be added!", e);
318.153 - }
318.154 - DesignerPaneOperator.switchToDesignerPane();
318.155 - TestUtils.wait(1000);
318.156 - }
318.157 -}
319.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/navigation/NavigatorOperator.java Thu Jul 10 04:29:52 2008 -0700
319.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
319.3 @@ -1,434 +0,0 @@
319.4 -/*
319.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
319.6 - *
319.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
319.8 - *
319.9 - * The contents of this file are subject to the terms of either the GNU
319.10 - * General Public License Version 2 only ("GPL") or the Common
319.11 - * Development and Distribution License("CDDL") (collectively, the
319.12 - * "License"). You may not use this file except in compliance with the
319.13 - * License. You can obtain a copy of the License at
319.14 - * http://www.netbeans.org/cddl-gplv2.html
319.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
319.16 - * specific language governing permissions and limitations under the
319.17 - * License. When distributing the software, include this License Header
319.18 - * Notice in each file and include the License file at
319.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
319.20 - * particular file as subject to the "Classpath" exception as provided
319.21 - * by Sun in the GPL Version 2 section of the License file that
319.22 - * accompanied this code. If applicable, add the following below the
319.23 - * License Header, with the fields enclosed by brackets [] replaced by
319.24 - * your own identifying information:
319.25 - * "Portions Copyrighted [year] [name of copyright owner]"
319.26 - *
319.27 - * Contributor(s):
319.28 - *
319.29 - * The Original Software is NetBeans. The Initial Developer of the Original
319.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
319.31 - * Microsystems, Inc. All Rights Reserved.
319.32 - *
319.33 - * If you wish your version of this file to be governed by only the CDDL
319.34 - * or only the GPL Version 2, indicate your decision by adding
319.35 - * "[Contributor] elects to include this software in this distribution
319.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
319.37 - * single choice of license, a recipient has the option to distribute
319.38 - * your version of this file under either the CDDL, the GPL Version 2 or
319.39 - * to extend the choice of license to its licensees as provided above.
319.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
319.41 - * Version 2 license, then the option applies only if the new code is
319.42 - * made subject to such option by the copyright holder.
319.43 - */
319.44 -
319.45 -package org.netbeans.modules.visualweb.gravy.navigation;
319.46 -
319.47 -import org.netbeans.modules.visualweb.gravy.Util;
319.48 -
319.49 -import org.netbeans.modules.visualweb.navigation.*;
319.50 -//import org.netbeans.modules.web.jsf.navigation.NavigationView;
319.51 -import org.netbeans.modules.visualweb.xhtml.FormNamePanel;
319.52 -import org.netbeans.modules.visualweb.gravy.DNDDriver;
319.53 -import org.netbeans.modules.visualweb.gravy.*;
319.54 -import java.awt.*;
319.55 -import java.awt.event.*;
319.56 -import java.util.List;
319.57 -import org.netbeans.jemmy.*;
319.58 -import org.netbeans.jemmy.operators.*;
319.59 -import org.netbeans.jemmy.operators.JToggleButtonOperator;
319.60 -import org.netbeans.jemmy.operators.JComponentOperator;
319.61 -import org.netbeans.jellytools.TopComponentOperator;
319.62 -
319.63 -/**
319.64 - * Operator for "Page Navigation" pane.
319.65 - */
319.66 -public class NavigatorOperator extends JComponentOperator{
319.67 - private static final String
319.68 - DEFAULT_LINK_ID = "case1",
319.69 - PAGE_NAVIGATION_TITLE = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.navigation.Bundle","NavigationView"),
319.70 - NAVIGATION_BUTTON = org.netbeans.modules.visualweb.gravy.Bundle.getStringTrimmed("org.netbeans.modules.visualweb.navigation.Bundle","ViewNavigation");
319.71 -
319.72 - ComponentOperator desktop = null;
319.73 - private JToggleButtonOperator _btSource;
319.74 - private JToggleButtonOperator _btNavigation;
319.75 -
319.76 - public NavigatorOperator(ContainerOperator parent) {
319.77 - super(parent, new NavigatorChooser());
319.78 - this.setComparator(new Operator.DefaultStringComparator(true, true));
319.79 - }
319.80 -
319.81 - public NavigatorOperator() {
319.82 - this(Util.getMainWindow());
319.83 - }
319.84 -
319.85 - /**
319.86 - * Get "XML" button.
319.87 - */
319.88 - public JToggleButtonOperator btSource() {
319.89 - if (_btSource == null) {
319.90 - TopComponentOperator topComponent = new TopComponentOperator(Util.getMainWindow());
319.91 - _btSource = new JToggleButtonOperator(topComponent, "XML");
319.92 - }
319.93 - return _btSource;
319.94 - }
319.95 -
319.96 - /**
319.97 - * Get "Navigation" button.
319.98 - */
319.99 - public JToggleButtonOperator btNavigation() {
319.100 - if (_btNavigation == null) {
319.101 - TopComponentOperator topComponent = new TopComponentOperator(Util.getMainWindow());
319.102 - _btNavigation = new JToggleButtonOperator(topComponent, NAVIGATION_BUTTON);
319.103 - }
319.104 - return _btNavigation;
319.105 - }
319.106 -
319.107 - /**
319.108 - * Switch to source code of navigation rules.
319.109 - */
319.110 - public void switchToSource() {
319.111 - btSource().pushNoBlock();
319.112 - Util.wait(1000);
319.113 - new QueueTool().waitEmpty();
319.114 - }
319.115 -
319.116 - /**
319.117 - * Switch to visual designer of navigation rules.
319.118 - */
319.119 - public void switchToNavigation() {
319.120 - btNavigation().pushNoBlock();
319.121 - Util.wait(1000);
319.122 - new QueueTool().waitEmpty();
319.123 - }
319.124 -
319.125 - /**
319.126 - * Show "Page Navigation" pane.
319.127 - */
319.128 - public static NavigatorOperator show() {
319.129 - Util.getMainTab().setSelectedIndex(Util.getMainTab().findPage("Page Navigation"));
319.130 - return(new NavigatorOperator());
319.131 - }
319.132 -
319.133 - private ComponentOperator getDesktop() {
319.134 - if(desktop == null) {
319.135 - desktop = new NavigatorGraphFrameOperator();
319.136 - }
319.137 - return(desktop);
319.138 - }
319.139 -
319.140 - /**
319.141 - * Push given item of popup menu.
319.142 - * @param menuText Name of given item.
319.143 - */
319.144 - public void pushPopup(String menuText) {
319.145 - /* No need to handle Mac differently, comment it out
319.146 - if (System.getProperty("os.name").equals("Mac OS X"))
319.147 - getDesktop().typeKey(' ', InputEvent.CTRL_MASK);
319.148 - else */
319.149 -
319.150 - getDesktop().clickForPopup(1, 1);
319.151 - try { Thread.sleep(500); } catch(Exception e) {}
319.152 - new JPopupMenuOperator().pushMenuNoBlock(menuText);
319.153 - try { Thread.sleep(500); } catch(Exception e) {}
319.154 - }
319.155 -
319.156 - /**
319.157 - * Call popup menu in given position of "Page Navigation" pane.
319.158 - * @param x x-coordinate of necessary position.
319.159 - * @param y y-coordinate of necessary position.
319.160 - */
319.161 - public void clickForPopup(int x, int y) {
319.162 - getDesktop().clickForPopup(x,y);
319.163 - }
319.164 -
319.165 - /**
319.166 - * Click mouse in given position of "Page Navigation" pane.
319.167 - * @param x x-coordinate of necessary position.
319.168 - * @param y y-coordinate of necessary position.
319.169 - */
319.170 - public void clickMouse(int x, int y) {
319.171 - getDesktop().clickMouse(x,y,1);
319.172 - }
319.173 -
319.174 - /**
319.175 - * Click mouse specified times in given position of "Page Navigation" pane.
319.176 - * @param x x-coordinate of necessary position.
319.177 - * @param y y-coordinate of necessary position.
319.178 - * @param count Number of clicks.
319.179 - */
319.180 - public void clickMouse(int x, int y, int count) {
319.181 - getDesktop().clickMouse(x,y,count);
319.182 - }
319.183 -
319.184 - /**
319.185 - * Select given page in "Page Navigation" pane.
319.186 - * @param page Name of the page.
319.187 - */
319.188 - /*
319.189 - public void select(String page) {
319.190 - PageOperator pp = new PageOperator(this, page);
319.191 - pp.select();
319.192 - }
319.193 - */
319.194 -
319.195 - /**
319.196 - * Create link from one given page to another.
319.197 - * @param page1 Name of the page where link will be created from.
319.198 - * @param page2 Name of the page where link will be created to.
319.199 - */
319.200 - public void link(String page1, String page2) {
319.201 -
319.202 - linkUsingXmlSource(page1, page2);
319.203 - /*
319.204 - PageOperator p1 = new PageOperator(this, page1);
319.205 - PageOperator p2 = new PageOperator(this, page2);
319.206 - p1.select();
319.207 - Util.wait(5000);
319.208 - //Util.wait(500);
319.209 -
319.210 - getDesktop().pressMouse(p1.getX()+40, p1.getY()+40);
319.211 - getDesktop().moveMouse(p1.getX()+41, p1.getY()+41);
319.212 - getDesktop().moveMouse(p2.getX()+41, p2.getY()+41);
319.213 - getDesktop().moveMouse(p2.getX()+40, p2.getY()+40);
319.214 - getDesktop().releaseMouse(p2.getX()+40, p2.getY()+40);
319.215 - Util.wait(1000);
319.216 - */
319.217 - //new DNDDriver().dnd(this, new Point(p1.getX()+40, p1.getY()+40), this, new Point(p2.getX()+40, p2.getY()+40));
319.218 - }
319.219 -
319.220 - /**
319.221 - * Create link with specified name from one given page to another.
319.222 - * @param page1 Name of the page where link will be created from.
319.223 - * @param page2 Name of the page where link will be created to.
319.224 - * @param linkId Name of the link.
319.225 - */
319.226 - public void link(String page1, String page2, String linkId) {
319.227 - linkUsingXmlSource(page1, page2, linkId);
319.228 - /* TODO need to fix it
319.229 - link(page1,page2);
319.230 - Util.wait(1000);
319.231 - for (int i = 0; i < linkId.length(); i++) {
319.232 - typeKey(linkId.charAt(i));
319.233 - Util.wait(500);
319.234 - }
319.235 - pushKey(KeyEvent.VK_ENTER);
319.236 - Util.wait(1000);
319.237 - */
319.238 - }
319.239 -
319.240 - /**
319.241 - * Create links from one given page to another.
319.242 - * Even elements in the list are names of pages where links will be created from.
319.243 - * Odd elements in the list are names of pages where links will be created to.
319.244 - * @param webPageNameList List names of the pages.
319.245 - */
319.246 - public void linkUsingXmlSource(List webPageNameList) {
319.247 - linkUsingXmlSource(webPageNameList, DEFAULT_LINK_ID);
319.248 - }
319.249 -
319.250 - /**
319.251 - * Create links with specified name from one given page to another.
319.252 - * Even elements in the list are names of pages where links will be created from.
319.253 - * Odd elements in the list are names of pages where links will be created to.
319.254 - * @param webPageNameList List names of the pages.
319.255 - * @param linkId Name of the link.
319.256 - */
319.257 - public void linkUsingXmlSource(List webPageNameList, String linkId) {
319.258 - switchToSource();
319.259 - Util.wait(1000);
319.260 - new QueueTool().waitEmpty();
319.261 -
319.262 - EditorOperator editor = getEditorOperator();
319.263 - for (int i = 0; i < webPageNameList.size() - 1; ++i) {
319.264 - String masterWebPageName = (String) webPageNameList.get(i),
319.265 - slaveWebPageName = (String) webPageNameList.get(i + 1);
319.266 - appendLinkXmlTags(editor, masterWebPageName, slaveWebPageName, linkId);
319.267 - TestUtils.outMsg("+++ Web page link [" + linkId + "] from [" +
319.268 - masterWebPageName + "] to [" + slaveWebPageName + "] is created");
319.269 - }
319.270 - switchToNavigation();
319.271 - Util.wait(1000);
319.272 - new QueueTool().waitEmpty();
319.273 - }
319.274 -
319.275 - /**
319.276 - * Create link from one given page to another with source code editor.
319.277 - * @param fromPageName Name of the page where link will be created from.
319.278 - * @param toPageName Name of the page where link will be created to.
319.279 - */
319.280 - public void linkUsingXmlSource(String fromPageName, String toPageName) {
319.281 - linkUsingXmlSource(fromPageName, toPageName, DEFAULT_LINK_ID);
319.282 - }
319.283 -
319.284 - /**
319.285 - * Create link with specified name from one given page to another with source code editor.
319.286 - * @param fromPageName Name of the page where link will be created from.
319.287 - * @param toPageName Name of the page where link will be created to.
319.288 - * @param linkId Name of the link.
319.289 - */
319.290 - public void linkUsingXmlSource(String fromPageName, String toPageName, String linkId) {
319.291 - switchToSource();
319.292 - Util.wait(1000);
319.293 - new QueueTool().waitEmpty();
319.294 -
319.295 - EditorOperator editor = getEditorOperator();
319.296 - appendLinkXmlTags(editor, fromPageName, toPageName, linkId);
319.297 -
319.298 - switchToNavigation();
319.299 - Util.wait(1000);
319.300 - new QueueTool().waitEmpty();
319.301 - }
319.302 -
319.303 - /**
319.304 - * Add string for link with specified name from one given page to another into source code editor.
319.305 - * @param editor Operator for navigation source code editor.
319.306 - * @param fromPageName Name of the page where link will be created from.
319.307 - * @param toPageName Name of the page where link will be created to.
319.308 - * @param linkId Name of the link.
319.309 - */
319.310 - private void appendLinkXmlTags(EditorOperator editor, String fromPageName,
319.311 - String toPageName, String linkId) {
319.312 - // put editor's caret to the start position of the last line
319.313 - putCaretToBeginOfLastLine(editor);
319.314 - Util.wait(500);
319.315 - new QueueTool().waitEmpty();
319.316 -
319.317 - String linkXmlTags = getLinkXmlTags(fromPageName, toPageName, linkId);
319.318 - TestUtils.outMsg("+++ xml-tags used for link [" + linkId + "] between pages [" +
319.319 - fromPageName + "] and [" + toPageName + "]: " + linkXmlTags);
319.320 - editor.insert(linkXmlTags);
319.321 - Util.wait(1000);
319.322 - new QueueTool().waitEmpty();
319.323 - }
319.324 -
319.325 - /**
319.326 - * Put caret to begin of last line in source code editor.
319.327 - * @param editor Operator for navigation source code editor.
319.328 - */
319.329 - private void putCaretToBeginOfLastLine(EditorOperator editor) {
319.330 - if (System.getProperty("os.name").equalsIgnoreCase("Mac OS X"))
319.331 - editor.pushKey(KeyEvent.VK_END, KeyEvent.META_DOWN_MASK);
319.332 - else
319.333 - editor.pushKey(KeyEvent.VK_END, KeyEvent.CTRL_DOWN_MASK);
319.334 - Util.wait(1000);
319.335 - new QueueTool().waitEmpty();
319.336 - editor.pushUpArrowKey();
319.337 - Util.wait(1000);
319.338 - new QueueTool().waitEmpty();
319.339 - }
319.340 -
319.341 - /**
319.342 - * Return prepared tag for link with specified name from one given page to another.
319.343 - * @param fromPageName Name of the page where link will be created from.
319.344 - * @param toPageName Name of the page where link will be created to.
319.345 - * @param linkId Name of the link.
319.346 - * @return String Tag of navigation rule.
319.347 - */
319.348 - private String getLinkXmlTags(String fromPageName, String toPageName, String linkId) {
319.349 - String[] xmlTags = new String[] {
319.350 - " <navigation-rule>",
319.351 - " <from-view-id>/" + fromPageName + "</from-view-id>",
319.352 - " <navigation-case>",
319.353 - " <from-outcome>" + linkId + "</from-outcome>",
319.354 - " <to-view-id>/" + toPageName + "</to-view-id>",
319.355 - " </navigation-case>",
319.356 - " </navigation-rule>"
319.357 - };
319.358 - StringBuffer buffer = new StringBuffer();
319.359 - for (int i = 0; i < xmlTags.length; ++i) {
319.360 - buffer.append(xmlTags[i]);
319.361 - buffer.append("\n");
319.362 - }
319.363 - return buffer.toString();
319.364 - }
319.365 -
319.366 - /**
319.367 - * Get navigation source code editor.
319.368 - * @return Operator for navigation source code editor.
319.369 - */
319.370 - private EditorOperator getEditorOperator() {
319.371 - //TopComponentOperator topComponent = new TopComponentOperator(PAGE_NAVIGATION_TITLE);
319.372 - TopComponentOperator topComponent = new TopComponentOperator(Util.getMainWindow());
319.373 - EditorOperator editor = new EditorOperator(topComponent, PAGE_NAVIGATION_TITLE);
319.374 - Util.wait(1000);
319.375 - new QueueTool().waitEmpty();
319.376 - TestUtils.outMsg("+++ Source editor for [" + PAGE_NAVIGATION_TITLE + "] found");
319.377 - return editor;
319.378 - }
319.379 -
319.380 - /**
319.381 - * Create static link with specified name from one given page to another.
319.382 - * @param page1 Name of the page where link will be created from.
319.383 - * @param page2 Name of the page where link will be created to.
319.384 - * @param linkId Name of the link.
319.385 - */
319.386 - /*
319.387 - public void staticLink(String page1, String page2,String linkId) {
319.388 - PageOperator p1 = new PageOperator(this, page1);
319.389 - PageOperator p2 = new PageOperator(this, page2);
319.390 -
319.391 - p1.select();
319.392 -
319.393 - Util.wait(300);
319.394 -
319.395 - new DNDDriver().dnd(this, new Point(p1.getX()+10, p1.getY()+33), this, new Point(p2.getX()+5, p2.getY()+5));
319.396 -
319.397 - Util.wait(300);
319.398 -
319.399 - for (int i=0; i<linkId.length(); i++){
319.400 - typeKey(linkId.charAt(i));
319.401 - }
319.402 - }*/
319.403 -
319.404 - public class NavigatorGraphFrameOperator extends ComponentOperator {
319.405 - public NavigatorGraphFrameOperator() {
319.406 - super(NavigatorOperator.this, new NavigatorGraphFrameChooser());
319.407 - }
319.408 - }
319.409 - public class NavigatorGraphFrameChooser implements ComponentChooser {
319.410 - public boolean checkComponent(Component comp) {
319.411 - //return(comp instanceof PageFlowGraph);
319.412 - //return(comp instanceof org.netbeans.graph.JGraphView);
319.413 - //Hotfix for sanity to pass. There should be no test for Navigation.
319.414 - return false;
319.415 - }
319.416 - public String getDescription() {
319.417 - //return(FormNamePanel.class.getName());
319.418 - return(FormNamePanel.class.getName());
319.419 - }
319.420 - }
319.421 - public static class NavigatorChooser implements ComponentChooser {
319.422 - public NavigatorChooser() {
319.423 - }
319.424 -
319.425 - public boolean checkComponent(Component comp) {
319.426 - // TODO:
319.427 -// boolean res = comp instanceof NavigationView;
319.428 -// return res;
319.429 - return false;
319.430 - }
319.431 -
319.432 - public String getDescription() {
319.433 - // return(NavigationView.class.getName());
319.434 - return(null);
319.435 - }
319.436 - }
319.437 -}
320.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/navigation/PageOperator.java Thu Jul 10 04:29:52 2008 -0700
320.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
320.3 @@ -1,163 +0,0 @@
320.4 - /* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
320.5 - /*
320.6 - /* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
320.7 - *
320.8 - /* The contents of this file are subject to the terms of either the GNU
320.9 - /* General Public License Version 2 only ("GPL") or the Common
320.10 - /* Development and Distribution License("CDDL") (collectively, the
320.11 - /* "License"). You may not use this file except in compliance with the
320.12 - /* License. You can obtain a copy of the License at
320.13 - /* http://www.netbeans.org/cddl-gplv2.html
320.14 - /* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
320.15 - /* specific language governing permissions and limitations under the
320.16 - /* License. When distributing the software, include this License Header
320.17 - /* Notice in each file and include the License file at
320.18 - /* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
320.19 - /* particular file as subject to the "Classpath" exception as provided
320.20 - /* by Sun in the GPL Version 2 section of the License file that
320.21 - /* accompanied this code. If applicable, add the following below the
320.22 - /* License Header, with the fields enclosed by brackets [] replaced by
320.23 - /* your own identifying information:
320.24 - /* "Portions Copyrighted [year] [name of copyright owner]"
320.25 - /*
320.26 - /* Contributor(s):
320.27 - *
320.28 - * The Original Software is NetBeans. The Initial Developer of the Original
320.29 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
320.30 - * Microsystems, Inc. All Rights Reserved.
320.31 - /*
320.32 - /* If you wish your version of this file to be governed by only the CDDL
320.33 - /* or only the GPL Version 2, indicate your decision by adding
320.34 - /* "[Contributor] elects to include this software in this distribution
320.35 - /* under the [CDDL or GPL Version 2] license." If you do not indicate a
320.36 - /* single choice of license, a recipient has the option to distribute
320.37 - /* your version of this file under either the CDDL, the GPL Version 2 or
320.38 - /* to extend the choice of license to its licensees as provided above.
320.39 - /* However, if you add GPL Version 2 code and therefore, elected the GPL
320.40 - /* Version 2 license, then the option applies only if the new code is
320.41 - /* made subject to such option by the copyright holder.
320.42 - */
320.43 -
320.44 -package org.netbeans.modules.visualweb.gravy.navigation;
320.45 -
320.46 -//import org.netbeans.modules.web.jsf.navigation.NavigationView;
320.47 -//import org.netbeans.modules.visualweb.navigation.archive.Page;
320.48 -import org.netbeans.jemmy.Waiter;
320.49 -import org.netbeans.jemmy.Waitable;
320.50 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
320.51 -
320.52 -/**
320.53 - * Operator for pages onto "Page Navigation" pane.
320.54 - */
320.55 -
320.56 -public class PageOperator {
320.57 - private NavigatorOperator nav = null;
320.58 - private String name = null;
320.59 - public PageOperator(NavigatorOperator navOperator, String name) {
320.60 - nav = navOperator;
320.61 - this.name = name;
320.62 - // findPage();
320.63 - }
320.64 -
320.65 -// /**
320.66 -// * Push given item of popup menu.
320.67 -// * @param menuText Name of given item.
320.68 -// */
320.69 -// public void pushPopup(String menuText) {
320.70 -// clickForPopup();
320.71 -// new JPopupMenuOperator().pushMenu(menuText);
320.72 -// }
320.73 -//
320.74 -// /**
320.75 -// * Call popup menu on page.
320.76 -// */
320.77 -// public void clickForPopup() {
320.78 -// nav.clickForPopup(getX()+3,getY()+3);
320.79 -// }
320.80 -//
320.81 -// /**
320.82 -// * Double click on page.
320.83 -// */
320.84 -// public void mouseDoubleClick() {
320.85 -// nav.clickMouse(getX()+3,getY()+3, 2);
320.86 -// }
320.87 -//
320.88 -// /**
320.89 -// * Select this page.
320.90 -// */
320.91 -// public void select() {
320.92 -// nav.clickMouse(getX(), getY());
320.93 -// }
320.94 -//
320.95 -// /**
320.96 -// * Get x-coordinate of this page.
320.97 -// * return x-coordinate of the page.
320.98 -// */
320.99 -// public int getX() {
320.100 -// return findPage().x();
320.101 -// }
320.102 -//
320.103 -// /**
320.104 -// * Get y-coordinate of this page.
320.105 -// * return y-coordinate of the page.
320.106 -// */
320.107 -// public int getY() {
320.108 -// return findPage().y();
320.109 -// }
320.110 -//
320.111 -// /**
320.112 -// * Get width of this page.
320.113 -// * return Width of the page.
320.114 -// */
320.115 -// public int getWidth() {
320.116 -// return findPage().w();
320.117 -// }
320.118 -//
320.119 -// /**
320.120 -// * Get height of this page.
320.121 -// * return Height of the page.
320.122 -// */
320.123 -// public int getHeight() {
320.124 -// return findPage().h();
320.125 -// }
320.126 -//
320.127 -// /**
320.128 -// * Get necessary page.
320.129 -// * return Page.
320.130 -// */
320.131 -// private Page findPage() {
320.132 -// Page page = waitPage();
320.133 -// / return page;
320.134 -// }
320.135 -//
320.136 -// private Page waitPage() {
320.137 -// Waiter waiter = new Waiter (new Waitable() {
320.138 -// public Object actionProduced(Object obj) {
320.139 -// //TODO: Uncommnet once naviation module refactory complete
320.140 -//// if(nav != null) {
320.141 -//// NavigationModel navModel = ((NavigationView)nav.getSource()).getNavigationModel();
320.142 -//// List<Page> pages = navModel.getPages();
320.143 -//// if(pages.size() == 0) {
320.144 -//// return null;
320.145 -//// }
320.146 -//// for(int i=0;i <pages.size(); i++) {
320.147 -//// Page p = (Page)pages.get(i);
320.148 -//// if((p.toString()).indexOf(name) >= 0) {
320.149 -//// return p;
320.150 -//// }
320.151 -//// }
320.152 -//// }
320.153 -// return null;
320.154 -// }
320.155 -// public String getDescription() {
320.156 -// return "Waiting for navigation Page";
320.157 -// }
320.158 -// });
320.159 -// try {
320.160 -// Page page = (Page)waiter.waitAction(null);
320.161 -// return page;
320.162 -// } catch (InterruptedException e) {
320.163 -// return null;
320.164 -// }
320.165 -// }
320.166 -}
321.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/nodes/Node.java Thu Jul 10 04:29:52 2008 -0700
321.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
321.3 @@ -1,506 +0,0 @@
321.4 -/*
321.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
321.6 - *
321.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
321.8 - *
321.9 - * The contents of this file are subject to the terms of either the GNU
321.10 - * General Public License Version 2 only ("GPL") or the Common
321.11 - * Development and Distribution License("CDDL") (collectively, the
321.12 - * "License"). You may not use this file except in compliance with the
321.13 - * License. You can obtain a copy of the License at
321.14 - * http://www.netbeans.org/cddl-gplv2.html
321.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
321.16 - * specific language governing permissions and limitations under the
321.17 - * License. When distributing the software, include this License Header
321.18 - * Notice in each file and include the License file at
321.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
321.20 - * particular file as subject to the "Classpath" exception as provided
321.21 - * by Sun in the GPL Version 2 section of the License file that
321.22 - * accompanied this code. If applicable, add the following below the
321.23 - * License Header, with the fields enclosed by brackets [] replaced by
321.24 - * your own identifying information:
321.25 - * "Portions Copyrighted [year] [name of copyright owner]"
321.26 - *
321.27 - * Contributor(s):
321.28 - *
321.29 - * The Original Software is NetBeans. The Initial Developer of the Original
321.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
321.31 - * Microsystems, Inc. All Rights Reserved.
321.32 - *
321.33 - * If you wish your version of this file to be governed by only the CDDL
321.34 - * or only the GPL Version 2, indicate your decision by adding
321.35 - * "[Contributor] elects to include this software in this distribution
321.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
321.37 - * single choice of license, a recipient has the option to distribute
321.38 - * your version of this file under either the CDDL, the GPL Version 2 or
321.39 - * to extend the choice of license to its licensees as provided above.
321.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
321.41 - * Version 2 license, then the option applies only if the new code is
321.42 - * made subject to such option by the copyright holder.
321.43 - */
321.44 -
321.45 -package org.netbeans.modules.visualweb.gravy.nodes;
321.46 -
321.47 -import java.awt.Component;
321.48 -import java.awt.event.KeyEvent;
321.49 -import java.util.ArrayList;
321.50 -import javax.swing.tree.TreePath;
321.51 -import org.netbeans.jellytools.Bundle;
321.52 -import org.netbeans.modules.visualweb.gravy.actions.Action;
321.53 -import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
321.54 -import org.netbeans.jemmy.*;
321.55 -import org.netbeans.jemmy.operators.*;
321.56 -import org.openide.explorer.view.Visualizer;
321.57 -
321.58 -/** Ancestor class for all nodes.<p>
321.59 - * Nodes should help to easier testing of JTree's.
321.60 - * The most frequent usage in IDE is in the Explorer Window but nodes can be
321.61 - * used in any component which includes a JTree instance.
321.62 - * Nodes are also used as parameters for action's performing.
321.63 - * <p>
321.64 - * Example:<p>
321.65 - * <pre>
321.66 - * Node node = new Node(RepositoryTabOperator.invoke().getRootNode(), "jellytools/src|org|netbeans|jellytools");
321.67 - * System.out.println(node.getText());
321.68 - * new NewTemplateAction().performAPI(node);
321.69 - * </pre>
321.70 - */
321.71 -public class Node {
321.72 -
321.73 - static final String linkSuffix = Bundle.getString("org.openide.loaders.Bundle", "FMT_shadowName", new String[]{""});
321.74 -
321.75 - /** JTreeOperator of tree where node lives */
321.76 - protected JTreeOperator treeOperator;
321.77 - /** TreePath of node */
321.78 - protected TreePath treePath;
321.79 - /** Comparator used for this node instance. */
321.80 - private Operator.StringComparator comparator;
321.81 -
321.82 - /** creates new Node instance
321.83 - * @param treeOperator JTreeOperator of tree where node lives
321.84 - * @param treePath String tree path of node */
321.85 - public Node(JTreeOperator treeOperator, String treePath) {
321.86 - this(treeOperator, treeOperator.findPath(treePath, "|"));
321.87 - }
321.88 -
321.89 - /** creates new Node instance
321.90 - * @param treeOperator JTreeOperator of tree where node lives
321.91 - * @param treePath String tree path of node
321.92 - * @param indexes String list of indexes of nodes in each level */
321.93 - public Node(JTreeOperator treeOperator, String treePath, String indexes) {
321.94 - this(treeOperator, treeOperator.findPath(treePath, indexes, "|"));
321.95 - }
321.96 -
321.97 - /** creates new Node instance
321.98 - * @param parent parent Node
321.99 - * @param treeSubPath String tree sub-path from parent */
321.100 - public Node(Node parent, String treeSubPath) {
321.101 - this(parent.tree(), parent.findSubPath(treeSubPath, "|"));
321.102 - }
321.103 -
321.104 - /** creates new Node instance
321.105 - * @param parent parent Node
321.106 - * @param childIndex int index of child under parent node */
321.107 - public Node(Node parent, int childIndex) {
321.108 - this(parent.tree(), parent.tree().getChildPath(parent.getTreePath(), childIndex));
321.109 - }
321.110 -
321.111 - /** creates new Node instance
321.112 - * @param treeOperator JTreeOperator of tree where node lives
321.113 - * @param path TreePath of node */
321.114 - public Node(JTreeOperator treeOperator, TreePath path) {
321.115 - this.treeOperator=treeOperator;
321.116 - this.treePath=path;
321.117 - }
321.118 -
321.119 - /** Sets comparator fot this node. Comparator is used for all methods
321.120 - * after this method is called.
321.121 - * @param comparator new comparator to be set (e.g.
321.122 - * new Operator.DefaultStringComparator(true, true);
321.123 - * to search string item exactly and case sensitive)
321.124 - */
321.125 - public void setComparator(Operator.StringComparator comparator) {
321.126 - this.comparator = comparator;
321.127 - tree().setComparator(comparator);
321.128 - }
321.129 -
321.130 - /** Gets comparator for this node instance.
321.131 - * @return comparator for this node instance.
321.132 - */
321.133 - public Operator.StringComparator getComparator() {
321.134 - if(comparator == null) {
321.135 - comparator = tree().getComparator();
321.136 - }
321.137 - return comparator;
321.138 - }
321.139 -
321.140 - /** Getter for JTreeOperator of tree where node lives
321.141 - * @return JTreeOperator of tree where node lives */
321.142 - public JTreeOperator tree() {
321.143 - return(treeOperator);
321.144 - }
321.145 -
321.146 - /** Getter for TreePath of node.
321.147 - * @return TreePath of node */
321.148 - public TreePath getTreePath() {
321.149 - return(treePath);
321.150 - }
321.151 -
321.152 - /** Getter for node text
321.153 - * @return String node text */
321.154 - public String getText() {
321.155 - return(treePath.getLastPathComponent().toString());
321.156 - }
321.157 -
321.158 - /** Convert TreePath to string
321.159 - * @return String TreePath converted to string */
321.160 - private static String convertPath(TreePath path) {
321.161 - if (path==null) return null;
321.162 - int pathCount=path.getPathCount();
321.163 - if (pathCount<2) return "";
321.164 - String result = path.getPathComponent(1).toString();
321.165 - for(int i = 2; i < pathCount; i++) {
321.166 - result += "|" + path.getPathComponent(i).toString();
321.167 - }
321.168 - return result;
321.169 - }
321.170 -
321.171 - /** Getter for node path
321.172 - * @return String node path */
321.173 - public String getPath() {
321.174 - return convertPath(treePath);
321.175 - }
321.176 -
321.177 - /** Getter for path of parent node
321.178 - * @return String path of parent node */
321.179 - public String getParentPath() {
321.180 - return convertPath(treePath.getParentPath());
321.181 - }
321.182 -
321.183 - /** Returns Object instance which represents org.openide.nodes.Node
321.184 - * for this jellytools node.
321.185 - * @return Object instance which represents org.openide.nodes.Node
321.186 - */
321.187 - public Object getOpenideNode() {
321.188 - return Visualizer.findNode(this.getTreePath().getLastPathComponent());
321.189 - }
321.190 -
321.191 - /** calls popup menu on node
321.192 - * @return JPopupMenuOperator */
321.193 - public JPopupMenuOperator callPopup() {
321.194 - return new JPopupMenuOperator(treeOperator.callPopupOnPath(treePath));
321.195 - }
321.196 -
321.197 - /** performs action on node through main menu
321.198 - * @param menuPath main menu path of action */
321.199 - public void performMenuAction(String menuPath) {
321.200 - new Action(menuPath, null).performMenu(this);
321.201 - }
321.202 -
321.203 - /** performs action on node through popup menu
321.204 - * @param popupPath popup menu path of action */
321.205 - public void performPopupAction(String popupPath) {
321.206 - new Action(null, popupPath).performPopup(this);
321.207 - }
321.208 -
321.209 - /** performs action on node through API menu
321.210 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
321.211 - public void performAPIAction(String systemActionClass) {
321.212 - new Action(null, null, systemActionClass).performAPI(this);
321.213 - }
321.214 -
321.215 - /** performs action on node through main menu
321.216 - * @param menuPath main menu path of action */
321.217 - public void performMenuActionNoBlock(String menuPath) {
321.218 - new ActionNoBlock(menuPath, null).performMenu(this);
321.219 - }
321.220 -
321.221 - /** performs action on node through popup menu
321.222 - * @param popupPath popup menu path of action */
321.223 - public void performPopupActionNoBlock(String popupPath) {
321.224 - new ActionNoBlock(null, popupPath).performPopup(this);
321.225 - }
321.226 -
321.227 - /** performs action on node through API menu
321.228 - * @param systemActionClass String class name of SystemAction (use null value if API mode is not supported) */
321.229 - public void performAPIActionNoBlock(String systemActionClass) {
321.230 - new ActionNoBlock(null, null, systemActionClass).performAPI(this);
321.231 - }
321.232 -
321.233 - /**
321.234 - * Selects node.
321.235 - */
321.236 - public void select() {
321.237 - tree().selectPath(getTreePath());
321.238 - // sleep to workaround IDE's behavior. IDE consider as double click
321.239 - // two single clicks on the same position with delay shorter than 300 ms.
321.240 - // See org.openide.awt.MouseUtils.isDoubleClick().
321.241 - try {
321.242 - Thread.sleep(300);
321.243 - } catch (Exception e) {
321.244 - throw new JemmyException("Sleeping interrupted", e);
321.245 - }
321.246 - }
321.247 -
321.248 - /** adds node into set of selected nodes */
321.249 - public void addSelectionPath() {
321.250 - tree().addSelectionPath(getTreePath());
321.251 - }
321.252 -
321.253 - /** tests if node is leaf
321.254 - * @return boolean true when node does not have children */
321.255 - public boolean isLeaf() {
321.256 - return tree().getChildCount(treePath)<1;
321.257 - }
321.258 -
321.259 - /** returns list of names of children
321.260 - * @return String[] list of names of children */
321.261 - public String[] getChildren() {
321.262 - tree().expandPath(treePath);
321.263 - Object o[]=tree().getChildren(treePath.getLastPathComponent());
321.264 - if (o==null) return new String[0];
321.265 - String s[]=new String[o.length];
321.266 - for (int i=0; i<o.length; i++)
321.267 - s[i]=o[i].toString();
321.268 - return s;
321.269 - }
321.270 -
321.271 - /** determines if current node is link
321.272 - * @return boolean true if node is link */
321.273 - public boolean isLink() {
321.274 - return getText().endsWith(linkSuffix);
321.275 - }
321.276 -
321.277 - /** verifies if node is still present. It expands parent path of the node
321.278 - * during verification.
321.279 - * @return boolean true when node is still present */
321.280 - public boolean isPresent() {
321.281 - tree().expandPath(treePath.getParentPath());
321.282 - return tree().getRowForPath(treePath)>=0;
321.283 - }
321.284 -
321.285 - /** verifies node's popup path for presence (without invocation)
321.286 - * @param popupPath String popup path */
321.287 - public void verifyPopup(String popupPath) {
321.288 - verifyPopup(new String[]{popupPath});
321.289 - }
321.290 -
321.291 - /** verifies node's popup paths for presence (without invocation)
321.292 - * @param popupPaths String[] popup paths
321.293 - */
321.294 - public void verifyPopup(String[] popupPaths) {
321.295 - //invocation of root popup
321.296 - final JPopupMenuOperator popup=callPopup();
321.297 - for (int i=0; i<popupPaths.length; i++) {
321.298 - try {
321.299 - popup.showMenuItem(popupPaths[i], "|");
321.300 - } catch (NullPointerException npe) {
321.301 - throw new JemmyException("Popup path ["+popupPaths[i]+"] not found.");
321.302 - }
321.303 - }
321.304 - //closing popup
321.305 - popup.waitState(new ComponentChooser() {
321.306 - public boolean checkComponent(Component comp) {
321.307 - try {
321.308 - popup.pushKey(KeyEvent.VK_ESCAPE);
321.309 - return false;
321.310 - } catch (JemmyException e) {}
321.311 - return true;
321.312 - }
321.313 - public String getDescription() {
321.314 - return "Popup menu closer";
321.315 - }
321.316 - });
321.317 - }
321.318 -
321.319 - class StringArraySubPathChooser implements JTreeOperator.TreePathChooser {
321.320 - String[] arr;
321.321 - int[] indices;
321.322 - JTreeOperator.StringComparator comparator;
321.323 - TreePath parentPath;
321.324 - int parentPathCount;
321.325 - StringArraySubPathChooser(TreePath parentPath, String[] arr, int[] indices, JTreeOperator.StringComparator comparator) {
321.326 - this.arr = arr;
321.327 - this.comparator = comparator;
321.328 - this.indices = indices;
321.329 - this.parentPath=parentPath;
321.330 - this.parentPathCount=parentPath.getPathCount();
321.331 - }
321.332 - /** implementation of JTreeOperator.TreePathChooser
321.333 - * @param path TreePath
321.334 - * @param indexInParent int
321.335 - * @return boolean */
321.336 - public boolean checkPath(TreePath path, int indexInParent) {
321.337 - return(path.getPathCount() == arr.length + parentPathCount &&
321.338 - hasAsParent(path, indexInParent));
321.339 - }
321.340 - /** implementation of JTreeOperator.TreePathChooser
321.341 - * @param path TreePath
321.342 - * @param indexInParent int
321.343 - * @return boolean */
321.344 - public boolean hasAsParent(TreePath path, int indexInParent) {
321.345 - if (path.getPathCount()<=parentPathCount)
321.346 - return path.isDescendant(parentPath);
321.347 - if(arr.length+parentPathCount < path.getPathCount()) {
321.348 - return(false);
321.349 - }
321.350 - if(indices.length >= path.getPathCount()-parentPathCount &&
321.351 - indices[path.getPathCount()-parentPathCount-1] != indexInParent) {
321.352 - return(false);
321.353 - }
321.354 - Object[] comps = path.getPath();
321.355 - for(int i = parentPathCount; i < comps.length; i++) {
321.356 - if(!comparator.equals(comps[i].toString(), arr[i-parentPathCount])) {
321.357 - return(false);
321.358 - }
321.359 - }
321.360 - return(true);
321.361 - }
321.362 -
321.363 - /** implementation of JTreeOperator.TreePathChooser
321.364 - * @return String description */
321.365 - public String getDescription() {
321.366 - String desc = "";
321.367 - Object parr[]=parentPath.getPath();
321.368 - for(int i = 0; i < parr.length; i++) {
321.369 - desc = desc + parr[i].toString() + ", ";
321.370 - }
321.371 - for(int i = 0; i < arr.length; i++) {
321.372 - desc = desc + arr[i] + ", ";
321.373 - }
321.374 - if(desc.length() > 0) {
321.375 - desc = desc.substring(0, desc.length() - 2);
321.376 - }
321.377 - return("[ " + desc + " ]");
321.378 - }
321.379 -
321.380 - }
321.381 -
321.382 - TreePath findSubPath(String subPath, String delimiter) {
321.383 - return findSubPath(subPath, "", delimiter);
321.384 - }
321.385 -
321.386 - TreePath findSubPath(String subPath, String indexes, String delimiter) {
321.387 - JTreeOperator o=tree();
321.388 - String indexStr[]=o.parseString(indexes, delimiter);
321.389 - int indexInt[]= new int[indexStr.length];
321.390 - for (int i=0; i<indexStr.length; i++)
321.391 - indexInt[i]=Integer.parseInt(indexStr[i]);
321.392 - return o.findPath(new Node.StringArraySubPathChooser(treePath, o.parseString(subPath, delimiter), indexInt, getComparator()));
321.393 - }
321.394 -
321.395 - /** Expands current node to see children */
321.396 - public void expand() {
321.397 - treeOperator.expandPath(treePath);
321.398 - waitExpanded();
321.399 - }
321.400 -
321.401 - /** Collapse current node to hide children */
321.402 - public void collapse() {
321.403 - treeOperator.collapsePath(treePath);
321.404 - waitCollapsed();
321.405 - }
321.406 -
321.407 - /** Waits for node to be expanded */
321.408 - public void waitExpanded() {
321.409 - treeOperator.waitExpanded(treePath);
321.410 - }
321.411 -
321.412 - /** Waits for node to be collapsed */
321.413 - public void waitCollapsed() {
321.414 - treeOperator.waitCollapsed(treePath);
321.415 - }
321.416 -
321.417 - /** Informs if current node is expanded
321.418 - * @return boolean true when node is expanded
321.419 - */
321.420 - public boolean isExpanded() {
321.421 - return treeOperator.isExpanded(treePath);
321.422 - }
321.423 -
321.424 - /** Informs if current node is collapsed
321.425 - * @return boolean true when node is collapsed
321.426 - */
321.427 - public boolean isCollapsed() {
321.428 - return treeOperator.isCollapsed(treePath);
321.429 - }
321.430 -
321.431 - /*protected Action[] getActions() {
321.432 - return null;
321.433 - }
321.434 -
321.435 - public boolean hasAction(Class actionClass) {
321.436 - Action actions[] = getActions();
321.437 - for (int i=0; actions!=null && i<actions.length; i++)
321.438 - if (actionClass.equals(actions[i].getClass()))
321.439 - return true;
321.440 - return false;
321.441 - }*/
321.442 -
321.443 - /** verifies node's popup paths (of all actions) for presence (without invocation)
321.444 - * @param actions array of actions to be verified
321.445 - */
321.446 - public void verifyPopup(Action actions[]) {
321.447 - ArrayList popupPaths=new ArrayList();
321.448 - String path;
321.449 - for (int i=0; i<actions.length; i++) {
321.450 - path=actions[i].getPopupPath();
321.451 - if (path!=null) {
321.452 - popupPaths.add(path);
321.453 - }
321.454 - }
321.455 - verifyPopup((String[])popupPaths.toArray(new String[0]));
321.456 - }
321.457 -
321.458 -
321.459 - /** Checks whether child with specified name is present under this node.
321.460 - * @param childName name of child node
321.461 - * @return true if child is present; false otherwise
321.462 - */
321.463 - public boolean isChildPresent(String childName) {
321.464 - String[] children = this.getChildren();
321.465 - for(int i=0;i<children.length;i++) {
321.466 - if(getComparator().equals(children[i], childName)) {
321.467 - return true;
321.468 - }
321.469 - }
321.470 - return false;
321.471 - }
321.472 -
321.473 - /** Waits until child with specified name is not present under this node.
321.474 - * It can throw TimeoutExpiredException, if child is still present.
321.475 - * @param childName name of child node
321.476 - */
321.477 - public void waitChildNotPresent(final String childName) {
321.478 - try {
321.479 - new Waiter(new Waitable() {
321.480 - public Object actionProduced(Object anObject) {
321.481 - return isChildPresent(childName) ? null : Boolean.TRUE;
321.482 - }
321.483 - public String getDescription() {
321.484 - return("Child \""+childName+"\" not present under parent \""+getPath()+"\"");
321.485 - }
321.486 - }).waitAction(null);
321.487 - } catch (InterruptedException e) {
321.488 - throw new JemmyException("Interrupted.", e);
321.489 - }
321.490 - }
321.491 -
321.492 - /** Waits until this node is no longer present.
321.493 - * It can throw TimeoutExpiredException, if the node is still present.
321.494 - */
321.495 - public void waitNotPresent() {
321.496 - try {
321.497 - new Waiter(new Waitable() {
321.498 - public Object actionProduced(Object anObject) {
321.499 - return isPresent() ? null : Boolean.TRUE;
321.500 - }
321.501 - public String getDescription() {
321.502 - return("Wait node "+getPath()+" not present.");
321.503 - }
321.504 - }).waitAction(null);
321.505 - } catch (InterruptedException e) {
321.506 - throw new JemmyException("Interrupted.", e);
321.507 - }
321.508 - }
321.509 -}
322.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/nodes/WebServicesNode.java Thu Jul 10 04:29:52 2008 -0700
322.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
322.3 @@ -1,110 +0,0 @@
322.4 -/*
322.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
322.6 - *
322.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
322.8 - *
322.9 - * The contents of this file are subject to the terms of either the GNU
322.10 - * General Public License Version 2 only ("GPL") or the Common
322.11 - * Development and Distribution License("CDDL") (collectively, the
322.12 - * "License"). You may not use this file except in compliance with the
322.13 - * License. You can obtain a copy of the License at
322.14 - * http://www.netbeans.org/cddl-gplv2.html
322.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
322.16 - * specific language governing permissions and limitations under the
322.17 - * License. When distributing the software, include this License Header
322.18 - * Notice in each file and include the License file at
322.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
322.20 - * particular file as subject to the "Classpath" exception as provided
322.21 - * by Sun in the GPL Version 2 section of the License file that
322.22 - * accompanied this code. If applicable, add the following below the
322.23 - * License Header, with the fields enclosed by brackets [] replaced by
322.24 - * your own identifying information:
322.25 - * "Portions Copyrighted [year] [name of copyright owner]"
322.26 - *
322.27 - * Contributor(s):
322.28 - *
322.29 - * The Original Software is NetBeans. The Initial Developer of the Original
322.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
322.31 - * Microsystems, Inc. All Rights Reserved.
322.32 - *
322.33 - * If you wish your version of this file to be governed by only the CDDL
322.34 - * or only the GPL Version 2, indicate your decision by adding
322.35 - * "[Contributor] elects to include this software in this distribution
322.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
322.37 - * single choice of license, a recipient has the option to distribute
322.38 - * your version of this file under either the CDDL, the GPL Version 2 or
322.39 - * to extend the choice of license to its licensees as provided above.
322.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
322.41 - * Version 2 license, then the option applies only if the new code is
322.42 - * made subject to such option by the copyright holder.
322.43 - */
322.44 -
322.45 -package org.netbeans.modules.visualweb.gravy.nodes;
322.46 -
322.47 -import org.netbeans.jemmy.operators.JTreeOperator;
322.48 -
322.49 -import javax.swing.tree.TreePath;
322.50 -
322.51 -import org.netbeans.modules.visualweb.gravy.websvc.actions.AddWebServiceAction;
322.52 -import org.netbeans.modules.visualweb.gravy.websvc.actions.CreateGroupAction;
322.53 -import org.netbeans.modules.visualweb.gravy.actions.Action;
322.54 -
322.55 -
322.56 -public class WebServicesNode extends Node{
322.57 - /** creates new FormNode
322.58 - * @param treeOperator JTreeOperator tree
322.59 - * @param treePath String tree path */
322.60 - public WebServicesNode(JTreeOperator treeOperator, String treePath) {
322.61 - super(treeOperator, treePath);
322.62 - }
322.63 -
322.64 - /** creates new FormNode
322.65 - * @param parent parent Node
322.66 - * @param treeSubPath String tree path from parent node */
322.67 - public WebServicesNode(Node parent, String treeSubPath) {
322.68 - super(parent, treeSubPath);
322.69 - }
322.70 -
322.71 - /** creates new FormNode
322.72 - * @param treeOperator JTreeOperator tree
322.73 - * @param path TreePath */
322.74 - public WebServicesNode(JTreeOperator treeOperator, TreePath path) {
322.75 - super(treeOperator, path);
322.76 - }
322.77 -
322.78 - static final AddWebServiceAction addWebServiceAction = new AddWebServiceAction();
322.79 - static final CreateGroupAction createGroupAction = new CreateGroupAction();
322.80 -
322.81 - /**
322.82 - * tests popup menu items for presence
322.83 - */
322.84 - public void verifyPopup() {
322.85 - verifyPopup(new Action[]{
322.86 - addWebServiceAction,
322.87 - createGroupAction,
322.88 - });
322.89 - }
322.90 -
322.91 - /*protected static final Action[] javaActions = new Action[] {
322.92 - cutAction,
322.93 - copyAction,
322.94 - deleteAction,
322.95 - compileAction,
322.96 - };
322.97 -
322.98 - Action[] getActions() {
322.99 - return javaActions;
322.100 - }*/
322.101 -
322.102 - /** performs addWebServiceAction with this node */
322.103 - public void addWebService() {
322.104 - addWebServiceAction.perform(this);
322.105 - }
322.106 -
322.107 - /** performs createGroupAction with this node */
322.108 - public void createGroup() {
322.109 - createGroupAction.perform(this);
322.110 - }
322.111 -
322.112 -
322.113 -}
323.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/plugins/PluginsOperator.java Thu Jul 10 04:29:52 2008 -0700
323.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
323.3 @@ -1,465 +0,0 @@
323.4 -/*
323.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
323.6 -
323.7 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
323.8 -
323.9 -
323.10 -The contents of this file are subject to the terms of either the GNU
323.11 -General Public License Version 2 only ("GPL") or the Common
323.12 -Development and Distribution License("CDDL") (collectively, the
323.13 -"License"). You may not use this file except in compliance with the
323.14 -License. You can obtain a copy of the License at
323.15 -http://www.netbeans.org/cddl-gplv2.html
323.16 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
323.17 -specific language governing permissions and limitations under the
323.18 -License. When distributing the software, include this License Header
323.19 -Notice in each file and include the License file at
323.20 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
323.21 -particular file as subject to the "Classpath" exception as provided
323.22 -by Sun in the GPL Version 2 section of the License file that
323.23 -accompanied this code. If applicable, add the following below the
323.24 -License Header, with the fields enclosed by brackets [] replaced by
323.25 -your own identifying information:
323.26 -"Portions Copyrighted [year] [name of copyright owner]"
323.27 -
323.28 -Contributor(s):
323.29 -
323.30 -The Original Software is NetBeans. The Initial Developer of the Original
323.31 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
323.32 -Microsystems, Inc. All Rights Reserved.
323.33 -
323.34 -If you wish your version of this file to be governed by only the CDDL
323.35 -or only the GPL Version 2, indicate your decision by adding
323.36 -"[Contributor] elects to include this software in this distribution
323.37 -under the [CDDL or GPL Version 2] license." If you do not indicate a
323.38 -single choice of license, a recipient has the option to distribute
323.39 -your version of this file under either the CDDL, the GPL Version 2 or
323.40 -to extend the choice of license to its licensees as provided above.
323.41 -However, if you add GPL Version 2 code and therefore, elected the GPL
323.42 -Version 2 license, then the option applies only if the new code is
323.43 -made subject to such option by the copyright holder.
323.44 -*/
323.45 -package org.netbeans.modules.visualweb.gravy.plugins;
323.46 -
323.47 -import java.util.*;
323.48 -import java.io.*;
323.49 -import java.awt.*;
323.50 -import javax.swing.*;
323.51 -import org.netbeans.jemmy.*;
323.52 -import org.netbeans.jemmy.operators.*;
323.53 -import org.netbeans.modules.visualweb.gravy.*;
323.54 -
323.55 -public class PluginsOperator extends JDialogOperator {
323.56 - private static final String
323.57 - MAIN_MENU_ITEM_TOOLS = "Tools",
323.58 - MAIN_MENU_ITEM_TOOLS_PLUGINS = MAIN_MENU_ITEM_TOOLS + "|Plugins",
323.59 - DIALOG_TITLE_PLUGINS = "Plugins",
323.60 - DIALOG_TITLE_NETBEANS_IDE_INSTALLER = "NetBeans IDE Installer",
323.61 - DIALOG_TITLE_VALIDATION_WARNING = "Validation Warning",
323.62 -
323.63 - TAB_TITLE_AVAILABLE_PLUGINS = "Available Plugins",
323.64 - TAB_TITLE_DOWNLOADED_PLUGINS = "Downloaded",
323.65 -
323.66 - COLUMN_TITLE_NAME = "Name",
323.67 - COLUMN_TITLE_INSTALL = "Install",
323.68 -
323.69 - RADIO_BUTTON_LICENSE_AGREEMENT_ACCEPT_TEXT = "I accept",
323.70 -
323.71 - BUTTON_LABEL_ADD_PLUGINS = "Add Plugins",
323.72 - BUTTON_LABEL_RELOAD_CATALOG = "Reload Catalog",
323.73 - BUTTON_LABEL_INSTALL = "Install",
323.74 - BUTTON_LABEL_NEXT = "Next",
323.75 - BUTTON_LABEL_CONTINUE = "Continue",
323.76 - BUTTON_LABEL_FINISH = "Finish",
323.77 - BUTTON_LABEL_CLOSE = "Close";
323.78 -
323.79 - private JTabbedPaneOperator tabbedPane;
323.80 - private JButtonOperator btnClose;
323.81 - private boolean pluginsAvailable;
323.82 -
323.83 - public static PluginsOperator getInstance() {
323.84 - display(); // check whether the appropriate dialog is opened or not
323.85 - return (new PluginsOperator());
323.86 - }
323.87 -
323.88 - private PluginsOperator() {
323.89 - super(DIALOG_TITLE_PLUGINS);
323.90 - verify();
323.91 - }
323.92 -
323.93 - public void installAvailablePlugins() {
323.94 - installAvailablePlugins(Collections.EMPTY_LIST);
323.95 - }
323.96 - public void installAvailablePlugins(String pluginName) {
323.97 - installAvailablePlugins(new String[] {pluginName});
323.98 - }
323.99 - public void installAvailablePlugins(String[] pluginNames) {
323.100 - installAvailablePlugins(Arrays.asList(pluginNames));
323.101 - }
323.102 - public void installAvailablePlugins(java.util.List<String> pluginNames) {
323.103 - ContainerOperator containerOp = waitTabEnabled(TAB_TITLE_AVAILABLE_PLUGINS);
323.104 - JTableOperator pluginTable = new JTableOperator(containerOp);
323.105 - fillAvailablePluginsTable(containerOp, pluginTable);
323.106 - selectPlugins(pluginTable, pluginNames);
323.107 - if (pluginsAvailable) installSelectedPlugins(containerOp);
323.108 - else System.out.println("WARNING: Necessary plugins are absent!");
323.109 - closeDialog();
323.110 - }
323.111 -
323.112 - public void installDownloadedPlugins(String nbmPath) {
323.113 - ContainerOperator containerOp = waitTabEnabled(TAB_TITLE_DOWNLOADED_PLUGINS);
323.114 - new JButtonOperator(containerOp, BUTTON_LABEL_ADD_PLUGINS).pushNoBlock();
323.115 - Util.wait(500);
323.116 - new QueueTool().waitEmpty();
323.117 -
323.118 - addDownloadedPlugins(nbmPath, containerOp);
323.119 - JTableOperator pluginTable = new JTableOperator(containerOp);
323.120 - waitPluginsTableFilling(pluginTable);
323.121 -
323.122 - installSelectedPlugins(containerOp);
323.123 - closeDialog();
323.124 - }
323.125 -
323.126 - private ContainerOperator waitTabEnabled(String tabTitle) {
323.127 - for (int i = 0; i < 200; i++) {
323.128 - int cursorType = tabbedPane.getCursor().getType();
323.129 - //debugOutput("Cursor Name = " + tabbedPane.getCursor().getName());
323.130 - if (cursorType == Cursor.WAIT_CURSOR) {
323.131 - Util.wait(1000);
323.132 - new QueueTool().waitEmpty();
323.133 - } else {
323.134 - break;
323.135 - }
323.136 - }
323.137 - int tabIndex = findTab(tabTitle);
323.138 - if (tabIndex > -1) {
323.139 - tabbedPane.setSelectedIndex(tabIndex);
323.140 - ContainerOperator containerOp = new ContainerOperator(
323.141 - (Container) tabbedPane.getComponentAt(tabIndex));
323.142 - Util.wait(500);
323.143 - new QueueTool().waitEmpty();
323.144 - return containerOp;
323.145 - } else {
323.146 - throw new RuntimeException("Tab with title [" + tabTitle +
323.147 - "] isn't found in the dialog [" + this.getTitle() + "]");
323.148 - }
323.149 - }
323.150 -
323.151 - private int findTab(String tabTitle) {
323.152 - // int tabIndex = tabbedPane.indexOfTab(tabTitle); // only j2sdk 1.6
323.153 - // return tabIndex;
323.154 - int tabCount = tabbedPane.getTabCount();
323.155 - for (int i = 0; i < tabCount; i++) {
323.156 - // Component component = tabbedPane.getComponentAt(i);
323.157 - // only j2sdk 1.6: Component tabComponent = ((JTabbedPane) tabbedPane.getSource()).getTabComponentAt(i);
323.158 - String title = tabbedPane.getTitleAt(i);
323.159 - //debugOutput("+++ Tab Title = [" + title + "]");
323.160 - //if (title.equals(tabTitle)) {
323.161 - if (title.indexOf(tabTitle) > -1) {
323.162 - return i;
323.163 - }
323.164 - }
323.165 - return (-1);
323.166 - }
323.167 -
323.168 - private int getColumnIndexByName(JTableOperator tableOp, String columnName) {
323.169 - int colCount = tableOp.getColumnCount();
323.170 - for (int i = 0; i < colCount; i++) {
323.171 - String name = tableOp.getColumnName(i);
323.172 - if (name.indexOf(columnName) > -1) {
323.173 - return i;
323.174 - }
323.175 - }
323.176 - return (-1);
323.177 - }
323.178 -
323.179 - private void fillAvailablePluginsTable(ContainerOperator containerOp, JTableOperator pluginTable) {
323.180 - int rowCount = pluginTable.getRowCount();
323.181 - //debugOutput("pluginTable.getRowCount() = " + rowCount,
323.182 - // "pluginTable.getColumnCount() = " + pluginTable.getColumnCount());
323.183 - if (rowCount == 0) {
323.184 - new JButtonOperator(containerOp, BUTTON_LABEL_RELOAD_CATALOG).pushNoBlock();
323.185 - Util.wait(500);
323.186 - new QueueTool().waitEmpty();
323.187 - waitPluginsTableFilling(pluginTable);
323.188 - }
323.189 - }
323.190 -
323.191 - private void waitPluginsTableFilling(JTableOperator pluginTable) {
323.192 - for (int i = 0; i < 200; i++) {
323.193 - int rowCount = pluginTable.getRowCount();
323.194 - //debugOutput("pluginTable.getRowCount() = " + rowCount);
323.195 - if (rowCount < 1) {
323.196 - Util.wait(1000);
323.197 - new QueueTool().waitEmpty();
323.198 - } else {
323.199 - break;
323.200 - }
323.201 - }
323.202 - }
323.203 -
323.204 - private void selectPlugins(JTableOperator pluginTable,
323.205 - java.util.List<String> pluginNames) {
323.206 - java.util.List<String> selectedPlugins = new ArrayList();
323.207 - int nameColumnIndex = getColumnIndexByName(pluginTable, COLUMN_TITLE_NAME);
323.208 - int installColumnIndex = getColumnIndexByName(pluginTable, COLUMN_TITLE_INSTALL),
323.209 - rowCount = pluginTable.getRowCount();
323.210 - for (int row = 0; row < rowCount; row++) {
323.211 - Object cellValue = pluginTable.getValueAt(row, nameColumnIndex);
323.212 - //debugOutput("cellValue[" + row + "] = [" + cellValue + "]");
323.213 - if (isPluginInList(pluginNames, cellValue.toString())) {
323.214 - int rowIndex = row;
323.215 - pluginTable.clickOnCell(rowIndex, installColumnIndex);
323.216 - Util.wait(500);
323.217 - new QueueTool().waitEmpty();
323.218 - selectedPlugins.add(cellValue.toString());
323.219 - }
323.220 - }
323.221 - if (selectedPlugins.isEmpty()) pluginsAvailable = false;
323.222 - else pluginsAvailable = true;
323.223 - }
323.224 -
323.225 - private boolean isPluginInList(java.util.List<String> pluginNames, String checkedPluginName) {
323.226 - // if a list of plugin names is empty, it means that
323.227 - // all plugins in a table should be selected
323.228 - if (pluginNames.isEmpty()) return true;
323.229 - return pluginNames.contains(checkedPluginName);
323.230 - }
323.231 -
323.232 - private void addDownloadedPlugins(String nbmPath, ContainerOperator containerOp) {
323.233 - new JButtonOperator(containerOp, BUTTON_LABEL_ADD_PLUGINS).pushNoBlock();
323.234 - Util.wait(500);
323.235 - new QueueTool().waitEmpty();
323.236 -
323.237 - JFileChooserOperator fileChooserOp = new JFileChooserOperator();
323.238 - fileChooserOp.setSelectedFile(new File(nbmPath));
323.239 - Util.wait(500);
323.240 - new QueueTool().waitEmpty();
323.241 -
323.242 - fileChooserOp.approve();
323.243 - Util.wait(500);
323.244 - new QueueTool().waitEmpty();
323.245 - }
323.246 -
323.247 - private void installSelectedPlugins(ContainerOperator containerOp) {
323.248 - JButtonOperator btnInstall = new JButtonOperator(containerOp, BUTTON_LABEL_INSTALL);
323.249 - if (btnInstall.isEnabled()) {
323.250 - btnInstall.pushNoBlock();
323.251 - Util.wait(500);
323.252 - new QueueTool().waitEmpty();
323.253 - } else {
323.254 - throw new RuntimeException("The button [" + BUTTON_LABEL_INSTALL +
323.255 - "] isn't enabled in the dialog [" + DIALOG_TITLE_PLUGINS + "]");
323.256 - }
323.257 - workInstallerDialog();
323.258 - }
323.259 -
323.260 - private void workInstallerDialog() {
323.261 - JDialogOperator installerDialog = new JDialogOperator(DIALOG_TITLE_NETBEANS_IDE_INSTALLER);
323.262 - Util.wait(3000);
323.263 - new QueueTool().waitEmpty();
323.264 -
323.265 - String timeoutName = "ComponentOperator.WaitComponentTimeout";
323.266 - long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
323.267 - newTimeoutValue = 1000;
323.268 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
323.269 - try {
323.270 - new JButtonOperator(installerDialog, BUTTON_LABEL_NEXT).pushNoBlock();
323.271 - Util.wait(1000);
323.272 - new QueueTool().waitEmpty();
323.273 -
323.274 - JCheckBoxOperator cbLicenseAgreements = new JCheckBoxOperator(
323.275 - installerDialog, RADIO_BUTTON_LICENSE_AGREEMENT_ACCEPT_TEXT);
323.276 - cbLicenseAgreements.changeSelection(true);
323.277 - Util.wait(500);
323.278 - new QueueTool().waitEmpty();
323.279 -
323.280 - Util.wait(500);
323.281 - new QueueTool().waitEmpty();
323.282 - } catch(TimeoutExpiredException tee) {
323.283 - tee.printStackTrace(System.out);
323.284 - } catch(Exception e) {
323.285 - e.printStackTrace(System.out);
323.286 - throw new RuntimeException(e);
323.287 - } finally {
323.288 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, previousTimeoutValue);
323.289 - }
323.290 - new JButtonOperator(installerDialog, BUTTON_LABEL_INSTALL).pushNoBlock();
323.291 - Util.wait(500);
323.292 - new QueueTool().waitEmpty();
323.293 -
323.294 - waitInstallationFinish(installerDialog);
323.295 - }
323.296 -
323.297 - private void waitInstallationFinish(JDialogOperator dialogOp) {
323.298 - String timeoutName = "DialogWaiter.WaitDialogTimeout";
323.299 - long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
323.300 - newTimeoutValue = 1000;
323.301 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
323.302 -
323.303 - //DialogWatcher warningDialogThread = new DialogWatcher(
323.304 - // DIALOG_TITLE_VALIDATION_WARNING, BUTTON_LABEL_CONTINUE);
323.305 - //warningDialogThread.startWatch();
323.306 -
323.307 - JButtonOperator btnFinish = null;
323.308 - for (int i = 0; i < 600; i++) {
323.309 - btnFinish = checkButtonFinishAppearance(dialogOp);
323.310 - if ((btnFinish != null) && (btnFinish.isEnabled())) break;
323.311 - }
323.312 - //warningDialogThread.stopWatch();
323.313 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
323.314 - previousTimeoutValue > 0 ? previousTimeoutValue : 60000);
323.315 - //debugOutput("btnFinish = [" + btnFinish + "]", "btnFinish.isEnabled() = [" + btnFinish.isEnabled() + "]");
323.316 - if ((btnFinish != null) && (btnFinish.isEnabled())) {
323.317 - btnFinish.pushNoBlock();
323.318 - Util.wait(500);
323.319 - new QueueTool().waitEmpty();
323.320 - } else {
323.321 - throw new RuntimeException("The button [" + BUTTON_LABEL_FINISH +
323.322 - "] is not found or disabled in the dialog [" + DIALOG_TITLE_NETBEANS_IDE_INSTALLER + "]");
323.323 - }
323.324 - }
323.325 -
323.326 - private JButtonOperator checkButtonFinishAppearance(JDialogOperator dialogOp) {
323.327 - String timeoutName = "ComponentOperator.WaitComponentTimeout";
323.328 - long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
323.329 - newTimeoutValue = 1000;
323.330 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
323.331 - JButtonOperator btnFinish = null;
323.332 - try {
323.333 - btnFinish = new JButtonOperator(dialogOp, BUTTON_LABEL_FINISH);
323.334 - return btnFinish;
323.335 - } catch(TimeoutExpiredException tee) {
323.336 - Util.wait(500);
323.337 - new QueueTool().waitEmpty();
323.338 - } catch(Exception e) {
323.339 - e.printStackTrace(System.out);
323.340 - throw new RuntimeException(e);
323.341 - } finally {
323.342 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, previousTimeoutValue);
323.343 - }
323.344 - return null;
323.345 - }
323.346 -
323.347 - private void closeDialog() {
323.348 - btnClose.pushNoBlock();
323.349 - Util.wait(500);
323.350 - new QueueTool().waitEmpty();
323.351 - }
323.352 -
323.353 - public static void display() {
323.354 - String timeoutName = "DialogWaiter.WaitDialogTimeout";
323.355 - long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
323.356 - newTimeoutValue = 1500;
323.357 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
323.358 - try {
323.359 - new JDialogOperator(DIALOG_TITLE_PLUGINS);
323.360 - } catch(TimeoutExpiredException tee) { // dialog isn't open yet
323.361 - Util.getMainMenu().pushMenuNoBlock(MAIN_MENU_ITEM_TOOLS_PLUGINS);
323.362 - Util.wait(1000);
323.363 - new QueueTool().waitEmpty();
323.364 - } catch(Exception e) {
323.365 - e.printStackTrace(System.out);
323.366 - throw new RuntimeException(e);
323.367 - } finally {
323.368 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName,
323.369 - previousTimeoutValue > 0 ? previousTimeoutValue : 60000);
323.370 - }
323.371 - }
323.372 -
323.373 - public JTabbedPaneOperator checkTabbedPane() {
323.374 - if (tabbedPane == null) {
323.375 - tabbedPane = new JTabbedPaneOperator(this);
323.376 - }
323.377 - return tabbedPane;
323.378 - }
323.379 -
323.380 - private JButtonOperator checkButtonClose() {
323.381 - if (btnClose == null) {
323.382 - btnClose = new JButtonOperator(this, BUTTON_LABEL_CLOSE);
323.383 - }
323.384 - return btnClose;
323.385 - }
323.386 -
323.387 - /**
323.388 - * Initializes all necessary controls.
323.389 - */
323.390 - public void verify() {
323.391 - checkTabbedPane();
323.392 - checkButtonClose();
323.393 - }
323.394 -
323.395 - private void debugOutput(Object... dataArray) {
323.396 - System.out.println();
323.397 - for (Object obj : dataArray) {
323.398 - System.out.println(obj.toString());
323.399 - }
323.400 - System.out.println();
323.401 - }
323.402 -//============================================================================//
323.403 - private class DialogWatcher implements Runnable {
323.404 - private String dialogTitle, buttonLabel;
323.405 - private boolean stopWatch = true;
323.406 - private Thread watchThread = new Thread(this);
323.407 -
323.408 - public DialogWatcher(String dialogTitle, String buttonLabel) {
323.409 - this.dialogTitle = dialogTitle;
323.410 - this.buttonLabel = buttonLabel;
323.411 - }
323.412 -
323.413 - public void startWatch() {
323.414 - stopWatch = false;
323.415 - watchThread.start();
323.416 - }
323.417 - public void stopWatch() {
323.418 - stopWatch = true;
323.419 - do { // wait until a thread, which is used in this internal class, is died
323.420 - //debugOutput("+++ watchThread.isAlive() = " + watchThread.isAlive());
323.421 - Util.wait(500);
323.422 - } while (watchThread.isAlive());
323.423 - //debugOutput("+++ watchThread.isAlive() = " + watchThread.isAlive());
323.424 - Util.wait(1000);
323.425 - }
323.426 -
323.427 - public void run() {
323.428 - while (true) {
323.429 - if (stopWatch) return;
323.430 - synchronized (this) {
323.431 - try {
323.432 - wait(1000);
323.433 - } catch (Exception e) {
323.434 - e.printStackTrace(System.out);
323.435 - throw new RuntimeException(e);
323.436 - }
323.437 - }
323.438 - JDialogOperator dialogOp = checkDialogAppearance();
323.439 - if (dialogOp != null) {
323.440 - new JButtonOperator(dialogOp, buttonLabel).pushNoBlock();
323.441 - Util.wait(500);
323.442 - new QueueTool().waitEmpty();
323.443 - stopWatch = true;
323.444 - }
323.445 - }
323.446 - }
323.447 -
323.448 - private JDialogOperator checkDialogAppearance() {
323.449 - String timeoutName = "DialogWaiter.WaitDialogTimeout";
323.450 - long previousTimeoutValue = JemmyProperties.getCurrentTimeout(timeoutName),
323.451 - newTimeoutValue = 1000;
323.452 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, newTimeoutValue);
323.453 - try {
323.454 - JDialogOperator dialogOp = new JDialogOperator(dialogTitle);
323.455 - return dialogOp;
323.456 - } catch(TimeoutExpiredException tee) {
323.457 - Util.wait(500);
323.458 - new QueueTool().waitEmpty();
323.459 - } catch(Exception e) {
323.460 - e.printStackTrace(System.out);
323.461 - throw new RuntimeException(e);
323.462 - } finally {
323.463 - JemmyProperties.getCurrentTimeouts().setTimeout(timeoutName, previousTimeoutValue);
323.464 - }
323.465 - return null;
323.466 - }
323.467 - }
323.468 -}
323.469 \ No newline at end of file
324.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/CheckBoxProperty.java Thu Jul 10 04:29:52 2008 -0700
324.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
324.3 @@ -1,113 +0,0 @@
324.4 -/*
324.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
324.6 - *
324.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
324.8 - *
324.9 - * The contents of this file are subject to the terms of either the GNU
324.10 - * General Public License Version 2 only ("GPL") or the Common
324.11 - * Development and Distribution License("CDDL") (collectively, the
324.12 - * "License"). You may not use this file except in compliance with the
324.13 - * License. You can obtain a copy of the License at
324.14 - * http://www.netbeans.org/cddl-gplv2.html
324.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
324.16 - * specific language governing permissions and limitations under the
324.17 - * License. When distributing the software, include this License Header
324.18 - * Notice in each file and include the License file at
324.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
324.20 - * particular file as subject to the "Classpath" exception as provided
324.21 - * by Sun in the GPL Version 2 section of the License file that
324.22 - * accompanied this code. If applicable, add the following below the
324.23 - * License Header, with the fields enclosed by brackets [] replaced by
324.24 - * your own identifying information:
324.25 - * "Portions Copyrighted [year] [name of copyright owner]"
324.26 - *
324.27 - * Contributor(s):
324.28 - *
324.29 - * The Original Software is NetBeans. The Initial Developer of the Original
324.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
324.31 - * Microsystems, Inc. All Rights Reserved.
324.32 - *
324.33 - * If you wish your version of this file to be governed by only the CDDL
324.34 - * or only the GPL Version 2, indicate your decision by adding
324.35 - * "[Contributor] elects to include this software in this distribution
324.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
324.37 - * single choice of license, a recipient has the option to distribute
324.38 - * your version of this file under either the CDDL, the GPL Version 2 or
324.39 - * to extend the choice of license to its licensees as provided above.
324.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
324.41 - * Version 2 license, then the option applies only if the new code is
324.42 - * made subject to such option by the copyright holder.
324.43 - */
324.44 -
324.45 -package org.netbeans.modules.visualweb.gravy.properties;
324.46 -
324.47 -import org.netbeans.jemmy.JemmyException;
324.48 -import org.netbeans.jemmy.operators.ContainerOperator;
324.49 -import org.netbeans.jemmy.operators.JCheckBoxOperator;
324.50 -import java.lang.Boolean;
324.51 -import java.lang.String;
324.52 -/**
324.53 - * Can be used to set all properties which use JComboBox to change value.
324.54 - * <p>
324.55 - * Usage:<br>
324.56 - * <pre>
324.57 - * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
324.58 - * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Properties");
324.59 - * ComboBoxProperty pr = new ComboBoxProperty(psto, "Template");
324.60 - * pr.setValue("True");
324.61 - * pr.setValue(1);
324.62 - * </pre>
324.63 - *
324.64 - * @deprecated Use {@link Property} instead
324.65 - */
324.66 -public class CheckBoxProperty extends Property {
324.67 -
324.68 - /** Waits for property with given name in specified container.
324.69 - * @param contOper ContainerOperator where to find property. It is
324.70 - * recommended to use {@link PropertySheetTabOperator}.
324.71 - * @param name property name
324.72 - * @deprecated Use {@link Property} instead
324.73 - */
324.74 - public CheckBoxProperty(ContainerOperator contOper, String name) {
324.75 - super(contOper, name);
324.76 - }
324.77 -
324.78 - /** Starts editing the property and waits for JComboBox
324.79 - * @return JComboBoxOperator of property combo box
324.80 - * @deprecated Use {@link #setValue} to change property value
324.81 - */
324.82 - public JCheckBoxOperator checkBox() {
324.83 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
324.84 - /*
324.85 - startEditing();
324.86 - return new JComboBoxOperator(contOper);
324.87 - */
324.88 - }
324.89 -
324.90 - /** Sets value of the property. It makes property editable, finds
324.91 - * JCheckBox and selects specified item.
324.92 - * @param value item to be selected
324.93 - */
324.94 - public void setValue(String value) {
324.95 - JCheckBoxOperator checkOper = checkBox();
324.96 - checkOper.setSelected(new Boolean(value).booleanValue());
324.97 - }
324.98 -
324.99 - /** Gets value of the property.
324.100 - * @return String Value of the item's state.
324.101 - */
324.102 - public String getValue() {
324.103 - JCheckBoxOperator checkOper = checkBox();
324.104 - return new Boolean(checkOper.isSelected()).toString();
324.105 - }
324.106 -
324.107 - /** Sets value of the property. It makes property editable, finds
324.108 - * JComboBox and selects index-th item.
324.109 - * @param index index of item to be selected (Start at 0)
324.110 - */
324.111 - /*public void setValue(int index) {
324.112 - JComboBoxOperator comboOper = comboBox();
324.113 - comboOper.setSelectedIndex(index);
324.114 - }
324.115 - */
324.116 -}
325.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/ComboBoxProperty.java Thu Jul 10 04:29:52 2008 -0700
325.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
325.3 @@ -1,103 +0,0 @@
325.4 -/*
325.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
325.6 - *
325.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
325.8 - *
325.9 - * The contents of this file are subject to the terms of either the GNU
325.10 - * General Public License Version 2 only ("GPL") or the Common
325.11 - * Development and Distribution License("CDDL") (collectively, the
325.12 - * "License"). You may not use this file except in compliance with the
325.13 - * License. You can obtain a copy of the License at
325.14 - * http://www.netbeans.org/cddl-gplv2.html
325.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
325.16 - * specific language governing permissions and limitations under the
325.17 - * License. When distributing the software, include this License Header
325.18 - * Notice in each file and include the License file at
325.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
325.20 - * particular file as subject to the "Classpath" exception as provided
325.21 - * by Sun in the GPL Version 2 section of the License file that
325.22 - * accompanied this code. If applicable, add the following below the
325.23 - * License Header, with the fields enclosed by brackets [] replaced by
325.24 - * your own identifying information:
325.25 - * "Portions Copyrighted [year] [name of copyright owner]"
325.26 - *
325.27 - * Contributor(s):
325.28 - *
325.29 - * The Original Software is NetBeans. The Initial Developer of the Original
325.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
325.31 - * Microsystems, Inc. All Rights Reserved.
325.32 - *
325.33 - * If you wish your version of this file to be governed by only the CDDL
325.34 - * or only the GPL Version 2, indicate your decision by adding
325.35 - * "[Contributor] elects to include this software in this distribution
325.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
325.37 - * single choice of license, a recipient has the option to distribute
325.38 - * your version of this file under either the CDDL, the GPL Version 2 or
325.39 - * to extend the choice of license to its licensees as provided above.
325.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
325.41 - * Version 2 license, then the option applies only if the new code is
325.42 - * made subject to such option by the copyright holder.
325.43 - */
325.44 -
325.45 -package org.netbeans.modules.visualweb.gravy.properties;
325.46 -
325.47 -import org.netbeans.jemmy.JemmyException;
325.48 -import org.netbeans.jemmy.operators.ContainerOperator;
325.49 -import org.netbeans.jemmy.operators.JComboBoxOperator;
325.50 -
325.51 -/**
325.52 - * Can be used to set all properties which use JComboBox to change value.
325.53 - * <p>
325.54 - * Usage:<br>
325.55 - * <pre>
325.56 - * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
325.57 - * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Properties");
325.58 - * ComboBoxProperty pr = new ComboBoxProperty(psto, "Template");
325.59 - * pr.setValue("True");
325.60 - * pr.setValue(1);
325.61 - * </pre>
325.62 - *
325.63 - * @deprecated Use {@link Property} instead
325.64 - */
325.65 -public class ComboBoxProperty extends Property {
325.66 -
325.67 - /** Waits for property with given name in specified container.
325.68 - * @param contOper ContainerOperator where to find property. It is
325.69 - * recommended to use {@link PropertySheetTabOperator}.
325.70 - * @param name property name
325.71 - * @deprecated Use {@link Property} instead
325.72 - */
325.73 - public ComboBoxProperty(ContainerOperator contOper, String name) {
325.74 - super(contOper, name);
325.75 - }
325.76 -
325.77 - /** Starts editing the property and waits for JComboBox
325.78 - * @return JComboBoxOperator of property combo box
325.79 - * @deprecated Use {@link #setValue} to change property value
325.80 - */
325.81 - public JComboBoxOperator comboBox() {
325.82 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
325.83 - /*
325.84 - startEditing();
325.85 - return new JComboBoxOperator(contOper);
325.86 - */
325.87 - }
325.88 -
325.89 - /** Sets value of the property. It makes property editable, finds
325.90 - * JComboBox and selects specified item.
325.91 - * @param value item to be selected
325.92 - */
325.93 - /*public void setValue(String value) {
325.94 - JComboBoxOperator comboOper = comboBox();
325.95 - comboOper.setSelectedItem(value);
325.96 - }*/
325.97 -
325.98 - /** Sets value of the property. It makes property editable, finds
325.99 - * JComboBox and selects index-th item.
325.100 - * @param index index of item to be selected (Start at 0)
325.101 - */
325.102 - /*public void setValue(int index) {
325.103 - JComboBoxOperator comboOper = comboBox();
325.104 - comboOper.setSelectedIndex(index);
325.105 - }*/
325.106 -}
326.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/DebugReaderWriter.java Thu Jul 10 04:29:52 2008 -0700
326.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
326.3 @@ -1,102 +0,0 @@
326.4 -/*
326.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
326.6 - *
326.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
326.8 - *
326.9 - * The contents of this file are subject to the terms of either the GNU
326.10 - * General Public License Version 2 only ("GPL") or the Common
326.11 - * Development and Distribution License("CDDL") (collectively, the
326.12 - * "License"). You may not use this file except in compliance with the
326.13 - * License. You can obtain a copy of the License at
326.14 - * http://www.netbeans.org/cddl-gplv2.html
326.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
326.16 - * specific language governing permissions and limitations under the
326.17 - * License. When distributing the software, include this License Header
326.18 - * Notice in each file and include the License file at
326.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
326.20 - * particular file as subject to the "Classpath" exception as provided
326.21 - * by Sun in the GPL Version 2 section of the License file that
326.22 - * accompanied this code. If applicable, add the following below the
326.23 - * License Header, with the fields enclosed by brackets [] replaced by
326.24 - * your own identifying information:
326.25 - * "Portions Copyrighted [year] [name of copyright owner]"
326.26 - *
326.27 - * Contributor(s):
326.28 - *
326.29 - * The Original Software is NetBeans. The Initial Developer of the Original
326.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
326.31 - * Microsystems, Inc. All Rights Reserved.
326.32 - *
326.33 - * If you wish your version of this file to be governed by only the CDDL
326.34 - * or only the GPL Version 2, indicate your decision by adding
326.35 - * "[Contributor] elects to include this software in this distribution
326.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
326.37 - * single choice of license, a recipient has the option to distribute
326.38 - * your version of this file under either the CDDL, the GPL Version 2 or
326.39 - * to extend the choice of license to its licensees as provided above.
326.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
326.41 - * Version 2 license, then the option applies only if the new code is
326.42 - * made subject to such option by the copyright holder.
326.43 - */
326.44 -
326.45 -package org.netbeans.modules.visualweb.gravy.properties;
326.46 -
326.47 -import java.io.OutputStreamWriter;
326.48 -import java.io.FileWriter;
326.49 -import java.io.IOException;
326.50 -
326.51 -/**
326.52 - * DebugReaderWriter class
326.53 - * <p>
326.54 - *
326.55 - */
326.56 -
326.57 -public class DebugReaderWriter implements PropertyReaderWriter {
326.58 - private OutputStreamWriter osw = null;
326.59 - private String elementName = null;
326.60 -
326.61 - /**
326.62 - * Create DebugReaderWriter for output to specified file.
326.63 - * @param elementName Name of the element what DebugReaderWriter is created for.
326.64 - * @param filename Name of the file for output.
326.65 - */
326.66 - public DebugReaderWriter(String elementName, String filename) throws IOException {
326.67 - this(elementName, new FileWriter(filename));
326.68 - }
326.69 -
326.70 - /**
326.71 - * Create DebugReaderWriter for output to specified OutputStreamWriter.
326.72 - * @param elementName Name of the element what DebugReaderWriter is created for.
326.73 - * @param osw OutputStreamWriter for output.
326.74 - */
326.75 - public DebugReaderWriter(String elementName, OutputStreamWriter osw) {
326.76 - this.elementName = elementName;
326.77 - this.osw = osw;
326.78 - }
326.79 -
326.80 - /**
326.81 - * Write debugging information that given value for given property was set for element.
326.82 - */
326.83 - public void setPropertyValue(String name, Object value) {
326.84 - try {
326.85 - osw.write("setPropertyValue: Element name = "+elementName+", Property name = "+name+", PropertyValue = "+value+"\n");
326.86 - } catch (IOException e) {
326.87 - }
326.88 - }
326.89 -
326.90 - /**
326.91 - * Write debugging information that given value for given property was get from element.
326.92 - */
326.93 - public Object getPropertyValue(String name) {
326.94 - try {
326.95 - osw.write("getPropertyValue: Element name = "+elementName+", Property name = "+name+"\n");
326.96 - } catch (IOException e) {
326.97 - }
326.98 -
326.99 - return null;
326.100 - }
326.101 -
326.102 - public String getName() {
326.103 - return "DebugReaderWriter";
326.104 - }
326.105 -}
327.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/Property.java Thu Jul 10 04:29:52 2008 -0700
327.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
327.3 @@ -1,559 +0,0 @@
327.4 -/*
327.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
327.6 - *
327.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
327.8 - *
327.9 - * The contents of this file are subject to the terms of either the GNU
327.10 - * General Public License Version 2 only ("GPL") or the Common
327.11 - * Development and Distribution License("CDDL") (collectively, the
327.12 - * "License"). You may not use this file except in compliance with the
327.13 - * License. You can obtain a copy of the License at
327.14 - * http://www.netbeans.org/cddl-gplv2.html
327.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
327.16 - * specific language governing permissions and limitations under the
327.17 - * License. When distributing the software, include this License Header
327.18 - * Notice in each file and include the License file at
327.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
327.20 - * particular file as subject to the "Classpath" exception as provided
327.21 - * by Sun in the GPL Version 2 section of the License file that
327.22 - * accompanied this code. If applicable, add the following below the
327.23 - * License Header, with the fields enclosed by brackets [] replaced by
327.24 - * your own identifying information:
327.25 - * "Portions Copyrighted [year] [name of copyright owner]"
327.26 - *
327.27 - * Contributor(s):
327.28 - *
327.29 - * The Original Software is NetBeans. The Initial Developer of the Original
327.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
327.31 - * Microsystems, Inc. All Rights Reserved.
327.32 - *
327.33 - * If you wish your version of this file to be governed by only the CDDL
327.34 - * or only the GPL Version 2, indicate your decision by adding
327.35 - * "[Contributor] elects to include this software in this distribution
327.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
327.37 - * single choice of license, a recipient has the option to distribute
327.38 - * your version of this file under either the CDDL, the GPL Version 2 or
327.39 - * to extend the choice of license to its licensees as provided above.
327.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
327.41 - * Version 2 license, then the option applies only if the new code is
327.42 - * made subject to such option by the copyright holder.
327.43 - */
327.44 -
327.45 -package org.netbeans.modules.visualweb.gravy.properties;
327.46 -
327.47 -import java.awt.Component;
327.48 -import java.awt.event.ActionEvent;
327.49 -import java.beans.PropertyEditor;
327.50 -import java.lang.reflect.InvocationTargetException;
327.51 -import java.lang.reflect.Method;
327.52 -import javax.swing.Action;
327.53 -import javax.swing.JComponent;
327.54 -import javax.swing.JTable;
327.55 -import javax.swing.table.TableCellRenderer;
327.56 -import org.netbeans.jemmy.JemmyException;
327.57 -import org.netbeans.jemmy.JemmyProperties;
327.58 -import org.netbeans.jemmy.Waitable;
327.59 -import org.netbeans.jemmy.Waiter;
327.60 -import org.netbeans.jemmy.operators.ContainerOperator;
327.61 -import org.netbeans.jemmy.operators.JTableOperator;
327.62 -import org.netbeans.jemmy.operators.JTextFieldOperator;
327.63 -import org.openide.ErrorManager;
327.64 -import org.openide.nodes.Node;
327.65 -
327.66 -/**
327.67 - * Handles properties in IDE property sheets. Properties are grouped in
327.68 - * property sheet. Their are identified by their display names. Once you
327.69 - * have created a Property instance you can get value, set a new text value,
327.70 - * set a new value by index of possible options or open custom editor.
327.71 - * <p>
327.72 - * Usage:<br>
327.73 - * <pre>
327.74 - PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
327.75 - Property p = new Property(pso, "Name");
327.76 - System.out.println("\nProperty name="+p.getName());
327.77 - System.out.println("\nProperty value="+p.getValue());
327.78 - p.setValue("ANewValue");
327.79 - // set a new value by index where it is applicable
327.80 - //p.setValue(2);
327.81 - // open custom editor where it is applicable
327.82 - //p.openEditor();
327.83 - * </pre>
327.84 - *
327.85 - * @see PropertySheetOperator
327.86 - */
327.87 -public class Property {
327.88 -
327.89 - // DEPRECATED>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
327.90 - /** Container to find property in */
327.91 - protected ContainerOperator contOper;
327.92 - /** Display name of the property */
327.93 - private String name;
327.94 - /** Operator of name button */
327.95 - private SheetButtonOperator nameButtonOperator;
327.96 - /** Operator of value button */
327.97 - private SheetButtonOperator valueButtonOperator;
327.98 - // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<DEPRECATED
327.99 -
327.100 - /** Class name of string renderer. */
327.101 - public static final String STRING_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$StringRenderer"; // NOI18N
327.102 - /** Class name of check box renderer. */
327.103 - public static final String CHECKBOX_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$CheckboxRenderer"; // NOI18N
327.104 - /** Class name of combo box renderer. */
327.105 - public static final String COMBOBOX_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$ComboboxRenderer"; // NOI18N
327.106 - /** Class name of radio button renderer. */
327.107 - public static final String RADIOBUTTON_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$RadioButtonRenderer"; // NOI18N
327.108 - /** Class name of set renderer. */
327.109 - public static final String SET_RENDERER = "org.openide.explorer.propertysheet.RendererFactory$SetRenderer"; // NOI18N
327.110 -
327.111 - /** Instance of Node.Property. */
327.112 - protected Node.Property property;
327.113 - /** Property sheet where this property resides. */
327.114 - protected PropertySheetOperator propertySheetOper;
327.115 -
327.116 - /** Waits for property with given name in specified property sheet.
327.117 - * @param propertySheetOper PropertySheetOperator where to find property.
327.118 - * @param name property display name
327.119 - */
327.120 - public Property(PropertySheetOperator propertySheetOper, String name) {
327.121 - this.propertySheetOper = propertySheetOper;
327.122 - this.property = waitProperty(propertySheetOper, name);
327.123 - }
327.124 -
327.125 - /** Waits for index-th property in specified property sheet.
327.126 - * @param propertySheetOper PropertySheetOperator where to find property.
327.127 - * @param index index (row number) of property inside property sheet
327.128 - * (starts at 0). If there categories shown in property sheet,
327.129 - * rows occupied by their names must by added to index.
327.130 - */
327.131 - public Property(PropertySheetOperator propertySheetOper, int index) {
327.132 - this.propertySheetOper = propertySheetOper;
327.133 - this.property = waitProperty(propertySheetOper, index);
327.134 - }
327.135 -
327.136 - /** Waits for property with given name in specified container.
327.137 - * @param contOper ContainerOperator where to find property. It is
327.138 - * recommended to use {@link PropertySheetOperator}.
327.139 - * @param name property name
327.140 - * @deprecated Use {@link #Property(PropertySheetOperator, String)} instead
327.141 - */
327.142 - public Property(ContainerOperator contOper, String name) {
327.143 - this(new PropertySheetOperator(contOper), name);
327.144 - /*
327.145 - this.contOper = contOper;
327.146 - this.name = name;
327.147 - this.name = nameButtonOperator().getLabel();
327.148 - */
327.149 - }
327.150 -
327.151 - /** Waits for index-th property in specified container.
327.152 - * @param contOper ContainerOperator whete to find property. It is
327.153 - * recommended to use {@link PropertySheetOperator}.
327.154 - * @param index index (row number) of property inside property sheet
327.155 - * (starts at 0)
327.156 - * @deprecated Use {@link #Property(PropertySheetOperator, int)} instead
327.157 - */
327.158 - public Property(ContainerOperator contOper, int index) {
327.159 - this(new PropertySheetOperator(contOper), index);
327.160 - }
327.161 -
327.162 - /** Waits for property with given name in specified property sheet.
327.163 - * @param propSheetOper PropertySheetOperator where to find property.
327.164 - * @param name property display name
327.165 - */
327.166 - private Node.Property waitProperty(final PropertySheetOperator propSheetOper, final String name) {
327.167 - try {
327.168 - Waiter waiter = new Waiter(new Waitable() {
327.169 - public Object actionProduced(Object param) {
327.170 - Node.Property property = null;
327.171 - JTableOperator table = propSheetOper.tblSheet();
327.172 - for(int row=0;row<table.getRowCount();row++) {
327.173 - if(table.getValueAt(row, 1) instanceof Node.Property) {
327.174 - property = (Node.Property)table.getValueAt(row, 1);
327.175 - if(propSheetOper.getComparator().equals(property.getDisplayName(), name)) {
327.176 - return property;
327.177 - }
327.178 - }
327.179 - }
327.180 - return null;
327.181 - }
327.182 - public String getDescription() {
327.183 - return("Wait property "+name);
327.184 - }
327.185 - });
327.186 - return (Node.Property)waiter.waitAction(null);
327.187 - } catch (InterruptedException e) {
327.188 - throw new JemmyException("Interrupted.", e);
327.189 - }
327.190 - }
327.191 -
327.192 - /** Waits for index-th property in specified property sheet.
327.193 - * @param propSheetOper PropertySheetOperator where to find property.
327.194 - * @param index index (row number) of property inside property sheet
327.195 - * (starts at 0). If there are categories shown in property sheet,
327.196 - * rows occupied by their names must by added to index.
327.197 - */
327.198 - private Node.Property waitProperty(final PropertySheetOperator propSheetOper, final int index) {
327.199 - try {
327.200 - Waiter waiter = new Waiter(new Waitable() {
327.201 - public Object actionProduced(Object param) {
327.202 - JTableOperator table = propSheetOper.tblSheet();
327.203 - if(table.getRowCount() <= index) {
327.204 - // If table is empty or index out of bounds,
327.205 - // it returns null to wait until table is populated by values
327.206 - return null;
327.207 - }
327.208 - Object property = table.getValueAt(index, 1);
327.209 - if(property instanceof Node.Property) {
327.210 - return (Node.Property)property;
327.211 - } else {
327.212 - throw new JemmyException("On row "+index+" in table there is no property");
327.213 - }
327.214 - }
327.215 - public String getDescription() {
327.216 - return("Wait property on row "+index+" in property sheet.");
327.217 - }
327.218 - });
327.219 - //waiter.setOutput(TestOut.getNullOutput());
327.220 - return (Node.Property)waiter.waitAction(null);
327.221 - } catch (InterruptedException e) {
327.222 - throw new JemmyException("Interrupted.", e);
327.223 - }
327.224 - }
327.225 -
327.226 - /** Gets SheetButtonOperator instance of property's name button. It returns
327.227 - * valid button even if properties were reordered.
327.228 - * @return SheetButtonOperator instance of name button
327.229 - * @deprecated JTable used for property sheet instead of SheetButtons
327.230 - */
327.231 - public SheetButtonOperator nameButtonOperator() {
327.232 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
327.233 - //return null;
327.234 - /*
327.235 - if(nameButtonOperator != null) {
327.236 - if(!nameButtonOperator.isValid()) {
327.237 - nameButtonOperator = null;
327.238 - }
327.239 - }
327.240 - if(nameButtonOperator == null) {
327.241 - nameButtonOperator = SheetButtonOperator.nameButton(contOper, name);
327.242 - }
327.243 - return nameButtonOperator;
327.244 - */
327.245 - }
327.246 -
327.247 - /** Gets SheetButtonOperator instance of property's value button. It returns
327.248 - * valid button even if properties were reordered.
327.249 - * @return SheetButtonOperator instance of value button
327.250 - * @deprecated JTable used for property sheet instead of SheetButtons
327.251 - */
327.252 - public SheetButtonOperator valueButtonOperator() {
327.253 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
327.254 - /*
327.255 - if(valueButtonOperator != null) {
327.256 - if(!valueButtonOperator.isValid()) {
327.257 - valueButtonOperator = null;
327.258 - }
327.259 - }
327.260 - if(valueButtonOperator == null) {
327.261 - // Button can be changed (reordered, changed value, etc.).
327.262 - // We need to call nameButtonOperator().getNameButtonIndex()
327.263 - // to find valid name button for this property.
327.264 - valueButtonOperator = SheetButtonOperator.valueButton(contOper,
327.265 - nameButtonOperator().getNameButtonIndex());
327.266 - }
327.267 - return valueButtonOperator;
327.268 - */
327.269 - }
327.270 -
327.271 - /** Gets display name of this property.
327.272 - * It can differ from name given in constructor when only
327.273 - * substring of property name is used there.
327.274 - * @return display name of property
327.275 - */
327.276 - public String getName() {
327.277 - return property.getDisplayName();
327.278 - }
327.279 -
327.280 - /** Gets string representation of property value.
327.281 - * @return value of property
327.282 - */
327.283 - public String getValue() {
327.284 - PropertyEditor pe = property.getPropertyEditor();
327.285 - try {
327.286 - if(property.getValue() != pe.getValue()) {
327.287 - // Need to synchronize property and its property editor.
327.288 - // Otherwise it may cause problem when called pe.getAsText().
327.289 - pe.setValue(property.getValue());
327.290 - }
327.291 - } catch (Exception e) {
327.292 - throw new JemmyException("Exception while synchronizing value of property and property editor - property.getValue() != pe.getValue()", e);
327.293 - }
327.294 - return pe.getAsText();
327.295 - }
327.296 -
327.297 - /** Sets value of this property to specified text. If a new value is
327.298 - * not accepted, an information or error dialog is displayed by IDE.
327.299 - * If property is not writable JemmyException is thrown.
327.300 - * @param textValue text to be set in property (e.g. "a new value",
327.301 - * "a new item from list", "false", "TRUE")
327.302 - */
327.303 - public void setValue(String textValue) {
327.304 - propertySheetOper.getOutput().printTrace("Setting value \""+textValue+
327.305 - "\" of property \""+getName()+"\".");
327.306 - if(!isEnabled()) {
327.307 - throw new JemmyException("Property \""+getName()+"\" is read only.");
327.308 - }
327.309 - PropertyEditor pe = property.getPropertyEditor();
327.310 - try {
327.311 - if(property.getValue() != pe.getValue()) {
327.312 - // Need to synchronize property and its property editor.
327.313 - // Otherwise it may cause IAE when called pe.setAsText(textValue).
327.314 - pe.setValue(property.getValue());
327.315 - }
327.316 - } catch (Exception e) {
327.317 - throw new JemmyException("Exception while synchronizing value of property and property editor - property.getValue() != pe.getValue()", e);
327.318 - }
327.319 - try {
327.320 - JemmyProperties.getCurrentOutput().printTrace("Setting property \""+getName()+"\" to value \""+textValue+"\".");
327.321 - pe.setAsText(textValue);
327.322 - property.setValue(pe.getValue());
327.323 - } catch (IllegalAccessException iae) {
327.324 - ErrorManager.getDefault().notify(iae);
327.325 - } catch (IllegalArgumentException iare) {
327.326 - ErrorManager.getDefault().notify(iare);
327.327 - } catch (InvocationTargetException ite) {
327.328 - ErrorManager.getDefault().notify(ite);
327.329 - } catch (Exception e) {
327.330 - throw new JemmyException("Exception while setting value of property.", e);
327.331 - }
327.332 - }
327.333 -
327.334 - /** Sets value of this property by given index.
327.335 - * It is applicable for properties which can be changed by combo box.
327.336 - * If property doesn't support changing value by index JemmyException
327.337 - * is thrown.
327.338 - * @param index index of item to be selected from possible options
327.339 - */
327.340 - public void setValue(int index) {
327.341 - PropertyEditor pe = property.getPropertyEditor();
327.342 - String[] tags = pe.getTags();
327.343 - if(tags != null) {
327.344 - setValue(tags[index]);
327.345 - } else {
327.346 - throw new JemmyException("Property doesn't support changing value by index.");
327.347 - }
327.348 - }
327.349 -
327.350 - /** Returns true if this property is in editable state (it is being edited).
327.351 - * It is detected by presence of PropertySheetButton which stands
327.352 - * for property value in non editable state.
327.353 - * @return true - this property is being edited; false otherwise
327.354 - * @deprecated Use {@link #setValue} to change property value
327.355 - */
327.356 - public boolean isEditable() {
327.357 - throw new JemmyException("Don't use this! Use setValue() to change property value.");
327.358 - /*
327.359 - // wait for name button index-th PropertyPanel
327.360 - Component propertyPanel = SheetButtonOperator.waitPropertyPanel(contOper,
327.361 - nameButtonOperator().getNameButtonIndex());
327.362 - ComponentChooser chooser = new ComponentChooser() {
327.363 - public boolean checkComponent(Component comp) {
327.364 - return comp.getClass().getName().indexOf("PropertySheetButton") != -1;
327.365 - }
327.366 -
327.367 - public String getDescription() {
327.368 - return "PropertySheetButton";
327.369 - }
327.370 - };
327.371 - // if PropertySheetButton not found, property is editable
327.372 - return contOper.findComponent((Container)propertyPanel, chooser) == null;
327.373 - */
327.374 - }
327.375 -
327.376 - /** If this property is not editable, it scrolls to property and clicks
327.377 - * on name button. Otherwise does nothing.
327.378 - * @deprecated Use {@link #setValue} to change property value
327.379 - */
327.380 - public void startEditing() {
327.381 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
327.382 - /*
327.383 - if(!isEditable()) {
327.384 - nameButtonOperator().push();
327.385 - }
327.386 - */
327.387 - }
327.388 -
327.389 - /** If this property is editable, it scrolls to property if needed and
327.390 - * clicks on name button. It cancels editing and sets original value back.
327.391 - * @deprecated Use {@link #setValue} to change property value
327.392 - */
327.393 - public void stopEditing() {
327.394 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
327.395 - /*
327.396 - if(isEditable()) {
327.397 - nameButtonOperator().push();
327.398 - }
327.399 - */
327.400 - }
327.401 -
327.402 -
327.403 - /** Opens custom property editor for the property by click on "..." button.
327.404 - * It checks whether this property supports custom editor by method
327.405 - * {@link #supportsCustomEditor}.
327.406 - */
327.407 - public void openEditor() {
327.408 - if(supportsCustomEditor()) {
327.409 - final JTableOperator table = this.propertySheetOper.tblSheet();
327.410 - for(int row=0;row<table.getRowCount();row++) {
327.411 - if(table.getValueAt(row, 1) instanceof Node.Property) {
327.412 - if(this.property == (Node.Property)table.getValueAt(row, 1)) {
327.413 - // Need to request focus before selection because invokeCustomEditor action works
327.414 - // only when table is focused
327.415 - /* mdk
327.416 - table.makeComponentVisible();
327.417 - table.requestFocus();
327.418 - table.waitHasFocus();
327.419 - */
327.420 - // need to select property first
327.421 - ((javax.swing.JTable)table.getSource()).changeSelection(row, 0, false, false);
327.422 - // find action
327.423 - final Action customEditorAction = ((JComponent)table.getSource()).getActionMap().get("invokeCustomEditor"); // NOI18N
327.424 - // run action in a separate thread (no block)
327.425 - new Thread(new Runnable() {
327.426 - public void run() {
327.427 - customEditorAction.actionPerformed(new ActionEvent(table.getSource(), 0, null));
327.428 - }
327.429 - }, "Thread to open custom editor no block").start(); // NOI18N
327.430 - return;
327.431 - }
327.432 - }
327.433 - }
327.434 - }
327.435 - }
327.436 -
327.437 - /** Checks whether this property supports custom editor.
327.438 - * @return true is property supports custom editor, false otherwise
327.439 - */
327.440 - public boolean supportsCustomEditor() {
327.441 - return this.property.getPropertyEditor().supportsCustomEditor();
327.442 - }
327.443 -
327.444 - /** Sets default value for this property. If default value is not available,
327.445 - * it does nothing.
327.446 - */
327.447 - public void setDefaultValue() {
327.448 - try {
327.449 - property.restoreDefaultValue();
327.450 - } catch (Exception e) {
327.451 - throw new JemmyException("Exception while restoring default value.", e);
327.452 - }
327.453 - }
327.454 -
327.455 - /** Returns true if this property is enabled in property sheet, that means
327.456 - * it is possible to change its value by inplace editor.
327.457 - * @return true if this property is enabled, false otherwise
327.458 - */
327.459 - public boolean isEnabled() {
327.460 - return property.canWrite();
327.461 - }
327.462 -
327.463 - /** Returns true if this property can be edited as text by inplace text field.
327.464 - * It can be both for string renderer or combo box renderer.
327.465 - * @return true if this property can be edited, false otherwise
327.466 - */
327.467 - public boolean canEditAsText() {
327.468 - // if not enabled, it cannot be edited
327.469 - if(!isEnabled()) {
327.470 - return false;
327.471 - }
327.472 - final JTableOperator table = propertySheetOper.tblSheet();
327.473 - for(int row=0;row<table.getRowCount();row++) {
327.474 - if(table.getValueAt(row, 1) instanceof Node.Property) {
327.475 - if(property == (Node.Property)table.getValueAt(row, 1)) {
327.476 - table.clickForEdit(row, 1);
327.477 - long oldTimeout = propertySheetOper.getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
327.478 - propertySheetOper.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 1000);
327.479 - try {
327.480 - new JTextFieldOperator(propertySheetOper);
327.481 - return true;
327.482 - } catch (JemmyException e) {
327.483 - // property cannot be edited as text by inplace editor
327.484 - return false;
327.485 - } finally {
327.486 - // push ESC to stop editing
327.487 - table.pushKey(java.awt.event.KeyEvent.VK_ESCAPE);
327.488 - // reset timeout
327.489 - propertySheetOper.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", oldTimeout);
327.490 - }
327.491 - }
327.492 - }
327.493 - }
327.494 - // never should happen
327.495 - throw new JemmyException("Property "+getName()+" not found in this sheet:\n"+propertySheetOper.getSource().toString());
327.496 - }
327.497 -
327.498 - /** Returns class name of renderer used to render this property. It can
327.499 - * be used to determine whether correct renderer is used. Possible values
327.500 - * are defined in constants {@link #STRING_RENDERER}, {@link #CHECKBOX_RENDERER},
327.501 - * {@link #COMBOBOX_RENDERER}, {@link #RADIOBUTTON_RENDERER}, {@link #SET_RENDERER}.
327.502 - * @return class name of renderer used to render this property:
327.503 - * <UL>
327.504 - * <LI>org.openide.explorer.propertysheet.RendererFactory$StringRenderer</LI>
327.505 - * <LI>org.openide.explorer.propertysheet.RendererFactory$CheckboxRenderer</LI>
327.506 - * <LI>org.openide.explorer.propertysheet.RendererFactory$ComboboxRenderer</LI>
327.507 - * <LI>org.openide.explorer.propertysheet.RendererFactory$RadioButtonRenderer</LI>
327.508 - * <LI>org.openide.explorer.propertysheet.RendererFactory$SetRenderer</LI>
327.509 - * </UL>
327.510 - * @see #STRING_RENDERER
327.511 - * @see #CHECKBOX_RENDERER
327.512 - * @see #COMBOBOX_RENDERER
327.513 - * @see #RADIOBUTTON_RENDERER
327.514 - * @see #SET_RENDERER
327.515 - */
327.516 - public String getRendererName() {
327.517 - return getRenderer().getClass().getName();
327.518 - }
327.519 -
327.520 - /** Returns component which represents renderer for this property. */
327.521 - private Component getRenderer() {
327.522 - final JTableOperator table = propertySheetOper.tblSheet();
327.523 - for(int row=0;row<table.getRowCount();row++) {
327.524 - if(table.getValueAt(row, 1) instanceof Node.Property) {
327.525 - if(property == (Node.Property)table.getValueAt(row, 1)) {
327.526 - // gets component used to render a value
327.527 - TableCellRenderer renderer = table.getCellRenderer(row,1);
327.528 - Component comp = renderer.getTableCellRendererComponent(
327.529 - (JTable)table.getSource(),
327.530 - table.getValueAt(row, 1),
327.531 - false,
327.532 - false,
327.533 - row,
327.534 - 1
327.535 - );
327.536 - // We need to find a real renderer because it can be embedded
327.537 - // in ButtonPanel (supplies custom editor button "...")
327.538 - // or IconPanel(supplies property marking).
327.539 - try {
327.540 - Class clazz = Class.forName("org.openide.explorer.propertysheet.RendererPropertyDisplayer");
327.541 - Method findInnermostRendererMethod = clazz.getDeclaredMethod("findInnermostRenderer", new Class[] {JComponent.class});
327.542 - findInnermostRendererMethod.setAccessible(true);
327.543 - comp = (Component)findInnermostRendererMethod.invoke(null, new Object[] {comp});
327.544 - } catch (Exception e) {
327.545 - throw new JemmyException("RendererPropertyDisplayer.findInnermostRenderer() by reflection failed.", e);
327.546 - }
327.547 - return comp;
327.548 - }
327.549 - }
327.550 - }
327.551 - // never should happen
327.552 - throw new JemmyException("Property "+getName()+" not found in this sheet:\n"+propertySheetOper.getSource().toString());
327.553 - }
327.554 -
327.555 - /** Gets short description for this property. Short description is also
327.556 - * used in tooltip.
327.557 - * @return short description for this property.
327.558 - */
327.559 - public String getShortDescription() {
327.560 - return this.property.getShortDescription();
327.561 - }
327.562 -}
328.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertyFactory.java Thu Jul 10 04:29:52 2008 -0700
328.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
328.3 @@ -1,187 +0,0 @@
328.4 -/*
328.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
328.6 - *
328.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
328.8 - *
328.9 - * The contents of this file are subject to the terms of either the GNU
328.10 - * General Public License Version 2 only ("GPL") or the Common
328.11 - * Development and Distribution License("CDDL") (collectively, the
328.12 - * "License"). You may not use this file except in compliance with the
328.13 - * License. You can obtain a copy of the License at
328.14 - * http://www.netbeans.org/cddl-gplv2.html
328.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
328.16 - * specific language governing permissions and limitations under the
328.17 - * License. When distributing the software, include this License Header
328.18 - * Notice in each file and include the License file at
328.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
328.20 - * particular file as subject to the "Classpath" exception as provided
328.21 - * by Sun in the GPL Version 2 section of the License file that
328.22 - * accompanied this code. If applicable, add the following below the
328.23 - * License Header, with the fields enclosed by brackets [] replaced by
328.24 - * your own identifying information:
328.25 - * "Portions Copyrighted [year] [name of copyright owner]"
328.26 - *
328.27 - * Contributor(s):
328.28 - *
328.29 - * The Original Software is NetBeans. The Initial Developer of the Original
328.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
328.31 - * Microsystems, Inc. All Rights Reserved.
328.32 - *
328.33 - * If you wish your version of this file to be governed by only the CDDL
328.34 - * or only the GPL Version 2, indicate your decision by adding
328.35 - * "[Contributor] elects to include this software in this distribution
328.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
328.37 - * single choice of license, a recipient has the option to distribute
328.38 - * your version of this file under either the CDDL, the GPL Version 2 or
328.39 - * to extend the choice of license to its licensees as provided above.
328.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
328.41 - * Version 2 license, then the option applies only if the new code is
328.42 - * made subject to such option by the copyright holder.
328.43 - */
328.44 -
328.45 -package org.netbeans.modules.visualweb.gravy.properties;
328.46 -
328.47 -import java.io.IOException;
328.48 -
328.49 -import java.util.Hashtable;
328.50 -
328.51 -/**
328.52 - * PropertyFactory class
328.53 - * <p>
328.54 - *
328.55 - *
328.56 - */
328.57 -
328.58 -public class PropertyFactory {
328.59 -
328.60 - // Debug info reader/writer
328.61 - private PropertyReaderWriter debugrw = null;
328.62 -
328.63 - // Element name
328.64 - private String elementName;
328.65 -
328.66 - // Property readers array
328.67 - private PropertyReader preaders[] = null;
328.68 -
328.69 - // Property writers array
328.70 - private PropertyReaderWriter pwriters[] = null;
328.71 -
328.72 - // Property readers hashtable
328.73 - private Hashtable prhash = new Hashtable();
328.74 -
328.75 - // Property writers hashtable
328.76 - private Hashtable prwhash = new Hashtable();
328.77 -
328.78 - /**
328.79 - * Constructs PropertyFactory object
328.80 - *
328.81 - * @param elementName name of component
328.82 - */
328.83 - public PropertyFactory(String elementName) {
328.84 - this.elementName = elementName;
328.85 - initialize();
328.86 - }
328.87 -
328.88 - protected void initialize() {
328.89 - // Creates arrays of Readers and ReadersWriters
328.90 - preaders = new PropertyReader[1];
328.91 - pwriters = new PropertyReaderWriter[1];
328.92 -
328.93 - preaders[0] = pwriters[0] = new PropertySheetReaderWriter();
328.94 -
328.95 -
328.96 - // Creates hashtables using arrays of Readers and ReadersWriters
328.97 - for (int i = 0; i < getReadersNum(); i++) {
328.98 - prhash.put(preaders[i].getName(), preaders[i]);
328.99 - }
328.100 - for (int i = 0; i < getWritersNum(); i++) {
328.101 - prwhash.put(pwriters[i].getName(), pwriters[i]);
328.102 - }
328.103 -
328.104 - // Insert debugging enable/disable code
328.105 - if (false) {
328.106 - try {
328.107 - debugrw = new DebugReaderWriter(elementName, "c:/temp/testdebug.out");
328.108 - } catch (IOException e) {
328.109 - throw new RuntimeException(e);
328.110 - }
328.111 - }
328.112 - }
328.113 -
328.114 - /**
328.115 - * Return number of available PropertyReaders
328.116 - *
328.117 - * @return number of readers
328.118 - */
328.119 - public int getReadersNum() {
328.120 - return (preaders == null)?0:preaders.length;
328.121 - }
328.122 -
328.123 - /**
328.124 - * Return number of available PropertyReaderWriters
328.125 - *
328.126 - * @return number of writers
328.127 - */
328.128 - public int getWritersNum() {
328.129 - return (pwriters == null)?0:pwriters.length;
328.130 - }
328.131 -
328.132 - /**
328.133 - * Set property value by specified writer
328.134 - *
328.135 - * @param writer writer index
328.136 - * @param name property name
328.137 - * @param value property value to set
328.138 - */
328.139 - public void setValue(int writer, String name, Object value) {
328.140 - if (writer < 0 || writer >= getWritersNum())
328.141 - throw new ArrayIndexOutOfBoundsException(writer);
328.142 - pwriters[writer].setPropertyValue(name, value);
328.143 - if (debugrw != null)
328.144 - debugrw.setPropertyValue(name, value);
328.145 - }
328.146 -
328.147 - /**
328.148 - * Get property value by specified reader
328.149 - *
328.150 - * @param reader reader index
328.151 - * @param name property name
328.152 - * @return property value
328.153 - */
328.154 - public Object getValue(int reader, String name) {
328.155 - if (reader < 0 || reader >= getReadersNum())
328.156 - throw new ArrayIndexOutOfBoundsException(reader);
328.157 - if (debugrw != null)
328.158 - debugrw.getPropertyValue(name);
328.159 - return preaders[reader].getPropertyValue(name);
328.160 - }
328.161 - /**
328.162 - * Set property value by specified writer
328.163 - *
328.164 - * @param writer writer name
328.165 - * @param name property name
328.166 - * @param value property value to set
328.167 - */
328.168 - public void setValue(String writer, String name, Object value) {
328.169 - if (!prwhash.containsKey(writer))
328.170 - throw new IllegalArgumentException("There is no PropertyReaderWriter with name "+writer);
328.171 - ((PropertyReaderWriter)prwhash.get(writer)).setPropertyValue(name, value);
328.172 - if (debugrw != null)
328.173 - debugrw.setPropertyValue(name, value);
328.174 - }
328.175 -
328.176 - /**
328.177 - * Get property value by specified reader
328.178 - *
328.179 - * @param reader reader name
328.180 - * @param name property name
328.181 - * @return property value
328.182 - */
328.183 - public Object getValue(String reader, String name) {
328.184 - if (!prhash.containsKey(reader))
328.185 - throw new IllegalArgumentException("There is no PropertyReader with name "+reader);
328.186 - if (debugrw != null)
328.187 - debugrw.getPropertyValue(name);
328.188 - return ((PropertyReader)prhash.get(reader)).getPropertyValue(name);
328.189 - }
328.190 -}
329.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertyReader.java Thu Jul 10 04:29:52 2008 -0700
329.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
329.3 @@ -1,66 +0,0 @@
329.4 -/*
329.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
329.6 - *
329.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
329.8 - *
329.9 - * The contents of this file are subject to the terms of either the GNU
329.10 - * General Public License Version 2 only ("GPL") or the Common
329.11 - * Development and Distribution License("CDDL") (collectively, the
329.12 - * "License"). You may not use this file except in compliance with the
329.13 - * License. You can obtain a copy of the License at
329.14 - * http://www.netbeans.org/cddl-gplv2.html
329.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
329.16 - * specific language governing permissions and limitations under the
329.17 - * License. When distributing the software, include this License Header
329.18 - * Notice in each file and include the License file at
329.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
329.20 - * particular file as subject to the "Classpath" exception as provided
329.21 - * by Sun in the GPL Version 2 section of the License file that
329.22 - * accompanied this code. If applicable, add the following below the
329.23 - * License Header, with the fields enclosed by brackets [] replaced by
329.24 - * your own identifying information:
329.25 - * "Portions Copyrighted [year] [name of copyright owner]"
329.26 - *
329.27 - * Contributor(s):
329.28 - *
329.29 - * The Original Software is NetBeans. The Initial Developer of the Original
329.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
329.31 - * Microsystems, Inc. All Rights Reserved.
329.32 - *
329.33 - * If you wish your version of this file to be governed by only the CDDL
329.34 - * or only the GPL Version 2, indicate your decision by adding
329.35 - * "[Contributor] elects to include this software in this distribution
329.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
329.37 - * single choice of license, a recipient has the option to distribute
329.38 - * your version of this file under either the CDDL, the GPL Version 2 or
329.39 - * to extend the choice of license to its licensees as provided above.
329.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
329.41 - * Version 2 license, then the option applies only if the new code is
329.42 - * made subject to such option by the copyright holder.
329.43 - */
329.44 -
329.45 -package org.netbeans.modules.visualweb.gravy.properties;
329.46 -
329.47 -/**
329.48 - * PropertyReader interface
329.49 - * <p>
329.50 - * If class implementing this interface then it can read property values.
329.51 - *
329.52 - */
329.53 -
329.54 -public interface PropertyReader {
329.55 - /**
329.56 - * Read value of specified property
329.57 - *
329.58 - * @param name Name of property to read
329.59 - * @return value of specified property
329.60 - */
329.61 - Object getPropertyValue(String name);
329.62 -
329.63 - /**
329.64 - * Returns name of Reader
329.65 - *
329.66 - * @return name of Reader
329.67 - */
329.68 - String getName();
329.69 -}
330.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertyReaderWriter.java Thu Jul 10 04:29:52 2008 -0700
330.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
330.3 @@ -1,59 +0,0 @@
330.4 -/*
330.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
330.6 - *
330.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
330.8 - *
330.9 - * The contents of this file are subject to the terms of either the GNU
330.10 - * General Public License Version 2 only ("GPL") or the Common
330.11 - * Development and Distribution License("CDDL") (collectively, the
330.12 - * "License"). You may not use this file except in compliance with the
330.13 - * License. You can obtain a copy of the License at
330.14 - * http://www.netbeans.org/cddl-gplv2.html
330.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
330.16 - * specific language governing permissions and limitations under the
330.17 - * License. When distributing the software, include this License Header
330.18 - * Notice in each file and include the License file at
330.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
330.20 - * particular file as subject to the "Classpath" exception as provided
330.21 - * by Sun in the GPL Version 2 section of the License file that
330.22 - * accompanied this code. If applicable, add the following below the
330.23 - * License Header, with the fields enclosed by brackets [] replaced by
330.24 - * your own identifying information:
330.25 - * "Portions Copyrighted [year] [name of copyright owner]"
330.26 - *
330.27 - * Contributor(s):
330.28 - *
330.29 - * The Original Software is NetBeans. The Initial Developer of the Original
330.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
330.31 - * Microsystems, Inc. All Rights Reserved.
330.32 - *
330.33 - * If you wish your version of this file to be governed by only the CDDL
330.34 - * or only the GPL Version 2, indicate your decision by adding
330.35 - * "[Contributor] elects to include this software in this distribution
330.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
330.37 - * single choice of license, a recipient has the option to distribute
330.38 - * your version of this file under either the CDDL, the GPL Version 2 or
330.39 - * to extend the choice of license to its licensees as provided above.
330.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
330.41 - * Version 2 license, then the option applies only if the new code is
330.42 - * made subject to such option by the copyright holder.
330.43 - */
330.44 -
330.45 -package org.netbeans.modules.visualweb.gravy.properties;
330.46 -
330.47 -/**
330.48 - * PropertyReaderWriter interface
330.49 - * <p>
330.50 - * If class implementing this interface then it can read and write property values.
330.51 - *
330.52 - */
330.53 -
330.54 -public interface PropertyReaderWriter extends PropertyReader{
330.55 - /**
330.56 - * Set value for specified property
330.57 - *
330.58 - * @param name Name of property to read
330.59 - * value Property value
330.60 - */
330.61 - void setPropertyValue(String name, Object value);
330.62 -}
331.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetOperator.java Thu Jul 10 04:29:52 2008 -0700
331.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
331.3 @@ -1,455 +0,0 @@
331.4 -/*
331.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
331.6 - *
331.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
331.8 - *
331.9 - * The contents of this file are subject to the terms of either the GNU
331.10 - * General Public License Version 2 only ("GPL") or the Common
331.11 - * Development and Distribution License("CDDL") (collectively, the
331.12 - * "License"). You may not use this file except in compliance with the
331.13 - * License. You can obtain a copy of the License at
331.14 - * http://www.netbeans.org/cddl-gplv2.html
331.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
331.16 - * specific language governing permissions and limitations under the
331.17 - * License. When distributing the software, include this License Header
331.18 - * Notice in each file and include the License file at
331.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
331.20 - * particular file as subject to the "Classpath" exception as provided
331.21 - * by Sun in the GPL Version 2 section of the License file that
331.22 - * accompanied this code. If applicable, add the following below the
331.23 - * License Header, with the fields enclosed by brackets [] replaced by
331.24 - * your own identifying information:
331.25 - * "Portions Copyrighted [year] [name of copyright owner]"
331.26 - *
331.27 - * Contributor(s):
331.28 - *
331.29 - * The Original Software is NetBeans. The Initial Developer of the Original
331.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
331.31 - * Microsystems, Inc. All Rights Reserved.
331.32 - *
331.33 - * If you wish your version of this file to be governed by only the CDDL
331.34 - * or only the GPL Version 2, indicate your decision by adding
331.35 - * "[Contributor] elects to include this software in this distribution
331.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
331.37 - * single choice of license, a recipient has the option to distribute
331.38 - * your version of this file under either the CDDL, the GPL Version 2 or
331.39 - * to extend the choice of license to its licensees as provided above.
331.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
331.41 - * Version 2 license, then the option applies only if the new code is
331.42 - * made subject to such option by the copyright holder.
331.43 - */
331.44 -
331.45 -package org.netbeans.modules.visualweb.gravy.properties;
331.46 -
331.47 -import java.awt.Component;
331.48 -import java.awt.Frame;
331.49 -import java.awt.Window;
331.50 -import javax.swing.JComponent;
331.51 -import org.netbeans.jellytools.Bundle;
331.52 -import org.netbeans.modules.visualweb.gravy.Util;
331.53 -import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
331.54 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
331.55 -import org.netbeans.modules.visualweb.gravy.actions.HelpAction;
331.56 -import org.netbeans.modules.visualweb.gravy.actions.PropertiesAction;
331.57 -import org.netbeans.modules.visualweb.gravy.actions.ShowDescriptionAreaAction;
331.58 -import org.netbeans.modules.visualweb.gravy.actions.SortByCategoryAction;
331.59 -import org.netbeans.modules.visualweb.gravy.actions.SortByNameAction;
331.60 -import org.netbeans.jemmy.ComponentChooser;
331.61 -import org.netbeans.jemmy.JemmyException;
331.62 -import org.netbeans.jemmy.JemmyProperties;
331.63 -import org.netbeans.jemmy.TestOut;
331.64 -import org.netbeans.jemmy.Timeouts;
331.65 -import org.netbeans.jemmy.Waitable;
331.66 -import org.netbeans.jemmy.Waiter;
331.67 -import org.netbeans.jemmy.operators.ContainerOperator;
331.68 -import org.netbeans.jemmy.operators.JButtonOperator;
331.69 -import org.netbeans.jemmy.operators.JLabelOperator;
331.70 -import org.netbeans.jemmy.operators.JTabbedPaneOperator;
331.71 -import org.netbeans.jemmy.operators.JTableOperator;
331.72 -import org.netbeans.jemmy.operators.JTextAreaOperator;
331.73 -import org.netbeans.jemmy.operators.WindowOperator;
331.74 -import org.openide.explorer.propertysheet.PropertySheet;
331.75 -import org.openide.windows.TopComponent;
331.76 -
331.77 -/**
331.78 - * Handles org.openide.explorer.propertysheet.PropertySheet which
331.79 - * represents IDE property sheet TopComponent.
331.80 - * It includes JTable with properties and optional description area.
331.81 - * Use {@link Property} class or its descendants to work with properties.
331.82 - * <p>
331.83 - * Usage:<br>
331.84 - * <pre>
331.85 - PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
331.86 - new Property(pso, "Arguments").setValue("arg1 arg2");
331.87 - pso.sortByName();
331.88 - System.out.println("Number of properties="+pso.tblSheet().getRowCount());
331.89 - pso.sortByCategory();
331.90 - * </pre>
331.91 - *
331.92 - * @see Property
331.93 - * @see PropertiesAction
331.94 - * @see SortByCategoryAction
331.95 - * @see SortByNameAction
331.96 - * @see ShowDescriptionAreaAction
331.97 - * @see HelpAction
331.98 - */
331.99 -public class PropertySheetOperator extends TopComponentOperator {
331.100 - // In IDE PropertySheet extends JPanel (parent org.netbeans.core.NbSheet extends TopComponent).
331.101 - /* In new window system global property sheet resides in main window and extends TopComponent.
331.102 - * Other property sheets are opened in dialog and they do not behave as TopComponents.
331.103 - */
331.104 -
331.105 - /** JTable representing property sheet. */
331.106 - private JTableOperator _tblSheet;
331.107 - private JLabelOperator _lblDescriptionHeader;
331.108 - private JTextAreaOperator _txtDescription;
331.109 - private JButtonOperator _btHelp;
331.110 -
331.111 - /** "No Properties" property sheet. */
331.112 - public static final int MODE_NO_PROPERTIES = 0;
331.113 - /** "Properties of" property sheet. */
331.114 - public static final int MODE_PROPERTIES_OF_ONE_OBJECT = 1;
331.115 - /** "Properties of Multiple Objects" property sheet. */
331.116 - public static final int MODE_PROPERTIES_OF_MULTIPLE_OBJECTS = 2;
331.117 -
331.118 - /** "Properties" */
331.119 - private static final String propertiesText = Bundle.getStringTrimmed("org.openide.actions.Bundle",
331.120 - "Properties");
331.121 -
331.122 - /** Generic constructor
331.123 - * @param sheet instance of PropertySheet
331.124 - */
331.125 - public PropertySheetOperator(JComponent sheet) {
331.126 - super(sheet);
331.127 - }
331.128 -
331.129 - /** Waits for property sheet anywhere in IDE. */
331.130 - public PropertySheetOperator() {
331.131 - this(waitPropertySheet(null, 0));
331.132 - }
331.133 -
331.134 - /** Waits for property sheet with name according to given mode ("No Properties",
331.135 - * "Properties of" or "Properties of Multiple Objects").
331.136 - * @param mode type of shown properties
331.137 - * @see #MODE_NO_PROPERTIES
331.138 - * @see #MODE_PROPERTIES_OF_ONE_OBJECT
331.139 - * @see #MODE_PROPERTIES_OF_MULTIPLE_OBJECTS
331.140 - */
331.141 - public PropertySheetOperator(int mode) {
331.142 - this(mode, "");
331.143 - }
331.144 -
331.145 - /** Waits for property sheet with name according to given mode ("No Properties",
331.146 - * "Properties of" or "Properties of Multiple Objects") plus objectName
331.147 - * in case of one object property sheet. In case of usage
331.148 - * <code>
331.149 - * new PropertySheetOperator(PropertySheetOperator.MODE_PROPERTIES_OF_ONE_OBJECT, "MyClass");
331.150 - * </code>
331.151 - * will be searched property sheet with name "Properties of MyClass" (on
331.152 - * English locale).
331.153 - * @param mode type of shown properties
331.154 - * @param objectName name of object for that properties are shown (e.g. "MyClass")
331.155 - * @see #MODE_NO_PROPERTIES
331.156 - * @see #MODE_PROPERTIES_OF_ONE_OBJECT
331.157 - * @see #MODE_PROPERTIES_OF_MULTIPLE_OBJECTS
331.158 - */
331.159 - public PropertySheetOperator(int mode, String objectName) {
331.160 - this(Bundle.getString("org.netbeans.core.Bundle", "CTL_FMT_GlobalProperties",
331.161 - new Object[]{new Integer(mode), objectName}));
331.162 - }
331.163 -
331.164 - /** Waits for property sheet with given name. Typically sheet
331.165 - * name is used as window title.
331.166 - * @param sheetName name of sheet to find (e.g. "Properties of MyClass")
331.167 - */
331.168 - public PropertySheetOperator(String sheetName) {
331.169 - this(waitPropertySheet(sheetName, 0));
331.170 - }
331.171 -
331.172 - /** Waits for property sheet with given name in specified
331.173 - * container.
331.174 - * @param contOper where to find
331.175 - * @param sheetName name of sheet to find (e.g. "Properties of MyClass")
331.176 - */
331.177 - public PropertySheetOperator(ContainerOperator contOper, String sheetName) {
331.178 - super((JComponent)contOper.waitSubComponent(new PropertySheetSubchooser(sheetName, contOper.getComparator())));
331.179 - copyEnvironment(contOper);
331.180 - }
331.181 -
331.182 - /** Waits for property sheet in specified ContainerOperator.
331.183 - * It is for example PropertySheet in Options window.
331.184 - * @param contOper where to find
331.185 - */
331.186 - public PropertySheetOperator(ContainerOperator contOper) {
331.187 - this(contOper, 0);
331.188 - }
331.189 -
331.190 - /** Waits for index-th property sheet in specified ContainerOperator.
331.191 - * @param contOper where to find
331.192 - * @param index int index
331.193 - */
331.194 - public PropertySheetOperator(ContainerOperator contOper, int index) {
331.195 - super((JComponent)contOper.waitSubComponent(new PropertySheetSubchooser(), index));
331.196 - copyEnvironment(contOper);
331.197 - }
331.198 -
331.199 - /** Invokes properties by default action on currently selected object.
331.200 - * @return instance of PropertySheetOperator
331.201 - * @see org.netbeans.modules.visualweb.gravy.actions.PropertiesAction
331.202 - */
331.203 - public static PropertySheetOperator invoke() {
331.204 - new PropertiesAction().perform();
331.205 - return new PropertySheetOperator();
331.206 - }
331.207 -
331.208 - /** Returns JTableOperator representing SheetTable of this property sheet.
331.209 - * @return instance of JTableOperator
331.210 - */
331.211 - public JTableOperator tblSheet() {
331.212 - if(_tblSheet == null) {
331.213 - _tblSheet = new JTableOperator(this);
331.214 - }
331.215 - return _tblSheet;
331.216 - }
331.217 -
331.218 - /** Returns JLabelOperator representing header of description area.
331.219 - * @return instance of JLabelOperator
331.220 - */
331.221 - public JLabelOperator lblDescriptionHeader() {
331.222 - if(_lblDescriptionHeader == null) {
331.223 - _lblDescriptionHeader = new JLabelOperator(this);
331.224 - }
331.225 - return _lblDescriptionHeader;
331.226 - }
331.227 -
331.228 - /** Returns JTextAreaOperator representing text from description area.
331.229 - * @return instance of JTextAreaOperator
331.230 - */
331.231 - public JTextAreaOperator txtDescription() {
331.232 - if(_txtDescription == null) {
331.233 - _txtDescription = new JTextAreaOperator(this);
331.234 - }
331.235 - return _txtDescription;
331.236 - }
331.237 -
331.238 - /** Returns JButtonOperator representing help button of description area.
331.239 - * @return instance of JButtonOperator
331.240 - */
331.241 - public JButtonOperator btHelp() {
331.242 - if(_btHelp == null) {
331.243 - _btHelp = new JButtonOperator(this);
331.244 - }
331.245 - return _btHelp;
331.246 - }
331.247 -
331.248 - /** Gets JTabbedPaneOperator of this property sheet.
331.249 - * @return instance of JTabbedPaneOperator
331.250 - * @deprecated JTabbedPane is no more used in property sheet.
331.251 - */
331.252 - public JTabbedPaneOperator tbpPropertySheetTabbedPane() {
331.253 - throw new JemmyException("Don't use this! JTabbedPane no more used in property sheet.");
331.254 - /*
331.255 - if(_tbpPropertySheetTabPane == null) {
331.256 - _tbpPropertySheetTabPane = new JTabbedPaneOperator(this);
331.257 - }
331.258 - return _tbpPropertySheetTabPane;
331.259 - */
331.260 - }
331.261 -
331.262 - /** Gets PropertySheetTabOperator with given name. It selects requested tab
331.263 - * if exist and it is not active.
331.264 - * @param tabName name of tab to find.
331.265 - * @return instance of PropertySheetTabOperator
331.266 - * @deprecated will be removed because of property sheet rewrite
331.267 - */
331.268 - public PropertySheetTabOperator getPropertySheetTabOperator(String tabName) {
331.269 - return new PropertySheetTabOperator(this, tabName);
331.270 - }
331.271 -
331.272 - /** Gets PropertySheetToolbarOperator for this property sheet.
331.273 - * @return instance of PropertySheetToolbarOperator
331.274 - * @deprecated Tool bar no more used in property sheet.
331.275 - */
331.276 - public PropertySheetToolbarOperator getToolbar() {
331.277 - throw new JemmyException("Don't use this! Tool bar no more used in property sheet.");
331.278 - //return new PropertySheetToolbarOperator(this);
331.279 - }
331.280 -
331.281 - /** Gets text of header from description area.
331.282 - * @return text of header from description area
331.283 - */
331.284 - public String getDescriptionHeader() {
331.285 - return lblDescriptionHeader().getText();
331.286 - }
331.287 -
331.288 - /** Gest description from description area.
331.289 - * @return description from description area.
331.290 - */
331.291 - public String getDescription() {
331.292 - return txtDescription().getText();
331.293 - }
331.294 -
331.295 - /** Sorts properties by name by calling of popup menu on property sheet. */
331.296 - public void sortByName() {
331.297 - new SortByNameAction().perform(this);
331.298 - }
331.299 -
331.300 - /** Sorts properties by category by calling of popup menu on property sheet. */
331.301 - public void sortByCategory() {
331.302 - new SortByCategoryAction().perform(this);
331.303 - }
331.304 -
331.305 - /** Shows or hides description area depending on whether it is already shown
331.306 - * or not. It just invokes Show description area popup menu item.
331.307 - */
331.308 - public void showDescriptionArea() {
331.309 - new ShowDescriptionAreaAction().perform(this);
331.310 - }
331.311 -
331.312 - /** Shows help by calling popup menu on property sheet. */
331.313 - public void help() {
331.314 - new HelpAction().performPopup(this);
331.315 - }
331.316 -
331.317 - /** Performs verification by accessing all sub-components */
331.318 - public void verify() {
331.319 - tblSheet();
331.320 - }
331.321 -
331.322 - /** Closes this property sheet and waits until
331.323 - * it is not closed. In fact it closes container in which this property
331.324 - * sheet is placed. It can be a TopComponent in the main window or in a separate
331.325 - * frame, or a dialog.
331.326 - */
331.327 -
331.328 -
331.329 - public void close() {
331.330 - if(getSource() instanceof TopComponent) {
331.331 - // run in dispatch thread
331.332 - boolean canClose = runMapping(new MapBooleanAction("canClose") {
331.333 - public boolean map() {
331.334 - return ((TopComponent)getSource()).canClose(null, true);
331.335 - }
331.336 - });
331.337 - if(canClose) {
331.338 - // if it is regular TopComponent and it can be closed
331.339 - super.close();
331.340 - return;
331.341 - }
331.342 - }
331.343 - // close window where property sheet is hosted but not main window
331.344 - if(getWindow() != Util.getMainWindow().getSource()) {
331.345 - new WindowOperator(getWindow()).close();
331.346 - }
331.347 - }
331.348 -
331.349 -
331.350 - /** Finds property sheet anywhere in IDE. First it tries to find TopComponent
331.351 - * representing global properties and if not found, it tries to find
331.352 - * property sheet in all dialogs owned by Main Window or other frames in SDI.
331.353 - * @param sheetName name of property sheet
331.354 - * @param index index of property sheet
331.355 - */
331.356 - private static JComponent findPropertySheet(String sheetName, int index) {
331.357 - // try to find PS in MainWindow
331.358 - JComponent comp = findTopComponent(null, sheetName, index, new PropertySheetSubchooser());
331.359 - if(comp != null) {
331.360 - return comp;
331.361 - }
331.362 - /* mdk - isCompactMode
331.363 - // Try to find PS in a dialog which is owned by Main window or by other
331.364 - // frame in SDI.
331.365 - Frame[] frames;
331.366 - MainWindowOperator mwo = Util.getMainWindow();
331.367 - if(mwo.isCompactMode()) {
331.368 - frames = new Frame[] {(Frame)mwo.getSource()};
331.369 - } else {
331.370 - frames = Frame.getFrames();
331.371 - }
331.372 - for(int frameIndex=0;frameIndex<frames.length;frameIndex++) {
331.373 - Window[] windows = frames[frameIndex].getOwnedWindows();
331.374 - for(int i=0;i<windows.length;i++) {
331.375 - if(windows[i].isShowing()) {
331.376 - // only showing windows are interesting
331.377 - // create windows operator for found window
331.378 - WindowOperator wo = new WindowOperator(windows[i]);
331.379 - // supress output
331.380 - wo.setOutput(TestOut.getNullOutput());
331.381 - // try to find PropertySheet subcomponent
331.382 - comp = (JComponent)wo.findSubComponent(
331.383 - new PropertySheetSubchooser(sheetName, mwo.getComparator()),
331.384 - index);
331.385 - if(comp != null) {
331.386 - return comp;
331.387 - }
331.388 - }
331.389 - }
331.390 - }*/
331.391 - return null;
331.392 - }
331.393 -
331.394 - /** Waits for property sheet anywhere in IDE. First it tries to find TopComponent
331.395 - * representing global properties and if not found, it tries to find
331.396 - * property sheet in all dialogs owned by Main Window or other frames in SDI.
331.397 - * @param sheetName name of property sheet
331.398 - * @param index index of property sheet
331.399 - */
331.400 - private static JComponent waitPropertySheet(final String sheetName, final int index) {
331.401 - try {
331.402 - Waiter waiter = new Waiter(new Waitable() {
331.403 - public Object actionProduced(Object obj) {
331.404 - return findPropertySheet(sheetName, index);
331.405 - }
331.406 - public String getDescription() {
331.407 - return("Wait PropertySheet with name="+sheetName+
331.408 - " index="+index+" loaded");
331.409 - }
331.410 - });
331.411 - Timeouts times = JemmyProperties.getCurrentTimeouts().cloneThis();
331.412 - times.setTimeout("Waiter.WaitingTime", times.getTimeout("ComponentOperator.WaitComponentTimeout"));
331.413 - waiter.setTimeouts(times);
331.414 - waiter.setOutput(JemmyProperties.getCurrentOutput());
331.415 - return (JComponent)waiter.waitAction(null);
331.416 - } catch(InterruptedException e) {
331.417 - throw new JemmyException("Interrupted.", e);
331.418 - }
331.419 - }
331.420 -
331.421 - /** SubChooser to determine find property sheet.
331.422 - * Used in constructors.
331.423 - */
331.424 - private static final class PropertySheetSubchooser implements ComponentChooser {
331.425 -
331.426 - private String sheetName;
331.427 - private StringComparator comparator;
331.428 -
331.429 - public PropertySheetSubchooser() {
331.430 - }
331.431 -
331.432 - public PropertySheetSubchooser(String sheetName, StringComparator comparator) {
331.433 - this.sheetName = sheetName;
331.434 - this.comparator = comparator;
331.435 - }
331.436 -
331.437 - public boolean checkComponent(Component comp) {
331.438 - if(comp instanceof PropertySheet) {
331.439 - if(sheetName == null) {
331.440 - return true;
331.441 - } else {
331.442 - if(comp instanceof TopComponent) {
331.443 - String name = ((TopComponent)comp).getName();
331.444 - if(name == null) {
331.445 - name = comp.getName();
331.446 - }
331.447 - return comparator.equals(name, sheetName);
331.448 - }
331.449 - }
331.450 - }
331.451 - return false;
331.452 - }
331.453 -
331.454 - public String getDescription() {
331.455 - return "org.openide.explorer.propertysheet.PropertySheet";
331.456 - }
331.457 - }
331.458 -}
332.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetReaderWriter.java Thu Jul 10 04:29:52 2008 -0700
332.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
332.3 @@ -1,110 +0,0 @@
332.4 -/*
332.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
332.6 - *
332.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
332.8 - *
332.9 - * The contents of this file are subject to the terms of either the GNU
332.10 - * General Public License Version 2 only ("GPL") or the Common
332.11 - * Development and Distribution License("CDDL") (collectively, the
332.12 - * "License"). You may not use this file except in compliance with the
332.13 - * License. You can obtain a copy of the License at
332.14 - * http://www.netbeans.org/cddl-gplv2.html
332.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
332.16 - * specific language governing permissions and limitations under the
332.17 - * License. When distributing the software, include this License Header
332.18 - * Notice in each file and include the License file at
332.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
332.20 - * particular file as subject to the "Classpath" exception as provided
332.21 - * by Sun in the GPL Version 2 section of the License file that
332.22 - * accompanied this code. If applicable, add the following below the
332.23 - * License Header, with the fields enclosed by brackets [] replaced by
332.24 - * your own identifying information:
332.25 - * "Portions Copyrighted [year] [name of copyright owner]"
332.26 - *
332.27 - * Contributor(s):
332.28 - *
332.29 - * The Original Software is NetBeans. The Initial Developer of the Original
332.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
332.31 - * Microsystems, Inc. All Rights Reserved.
332.32 - *
332.33 - * If you wish your version of this file to be governed by only the CDDL
332.34 - * or only the GPL Version 2, indicate your decision by adding
332.35 - * "[Contributor] elects to include this software in this distribution
332.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
332.37 - * single choice of license, a recipient has the option to distribute
332.38 - * your version of this file under either the CDDL, the GPL Version 2 or
332.39 - * to extend the choice of license to its licensees as provided above.
332.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
332.41 - * Version 2 license, then the option applies only if the new code is
332.42 - * made subject to such option by the copyright holder.
332.43 - */
332.44 -
332.45 -package org.netbeans.modules.visualweb.gravy.properties;
332.46 -
332.47 -
332.48 -import org.netbeans.modules.visualweb.gravy.properties.Property;
332.49 -import org.netbeans.modules.visualweb.gravy.Util;
332.50 -import org.netbeans.modules.visualweb.gravy.MainWindowOperator;
332.51 -
332.52 -import javax.swing.*;
332.53 -
332.54 -import org.netbeans.jemmy.operators.JTableOperator;
332.55 -
332.56 -/**
332.57 - * PropertySheetReaderWriter class
332.58 - * <p>
332.59 - * This class can read and write properties on property sheet.
332.60 - *
332.61 - */
332.62 -
332.63 -public class PropertySheetReaderWriter implements PropertyReaderWriter {
332.64 - //private PropertySheetOperator pso;
332.65 - private SheetTableOperator pso;
332.66 -
332.67 - /**
332.68 - * Constructs PropertySheetReaderWriter object
332.69 - */
332.70 - public PropertySheetReaderWriter() {
332.71 - pso = new SheetTableOperator();//new PropertySheetOperator(Util.getMainWindow());
332.72 - pso.setCompareStyle(true, false);
332.73 - // descr = pso.getDescriptionHeader();
332.74 - }
332.75 -
332.76 -
332.77 - /**
332.78 - * Read value of specified property
332.79 - *
332.80 - * @param name Name of property to read
332.81 - * @return value of specified property
332.82 - */
332.83 - public Object getPropertyValue(String name) {
332.84 - String value = (new Property(new PropertySheetOperator(Util.getMainWindow()), name)).getValue();//pso.getValue(name);
332.85 - return value;//(new Property(pso, name)).getValue();
332.86 - }
332.87 -
332.88 - /**
332.89 - * Set value for specified property
332.90 - *
332.91 - * @param name Name of property to read
332.92 - * value Property value
332.93 - */
332.94 - public void setPropertyValue(String name, Object value) {
332.95 - System.out.println("Setting value of " + name + " TO " +value);
332.96 - //if(!(getPropertyValue(name).equals(value))) {
332.97 - //(new Property(pso, name)).setValue(value.toString());
332.98 - //pso.setTextValue(name, value.toString());
332.99 - //new SheetTableOperator().setTextValue(name, value.toString());
332.100 - new Property (
332.101 - new PropertySheetOperator(Util.getMainWindow()),name).setValue(value.toString());
332.102 - //}
332.103 - }
332.104 -
332.105 - /**
332.106 - * Returns name of Reader
332.107 - *
332.108 - * @return name of Reader
332.109 - */
332.110 - public String getName() {
332.111 - return "PropertySheet";
332.112 - }
332.113 -}
333.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetTabOperator.java Thu Jul 10 04:29:52 2008 -0700
333.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
333.3 @@ -1,193 +0,0 @@
333.4 -/*
333.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
333.6 - *
333.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
333.8 - *
333.9 - * The contents of this file are subject to the terms of either the GNU
333.10 - * General Public License Version 2 only ("GPL") or the Common
333.11 - * Development and Distribution License("CDDL") (collectively, the
333.12 - * "License"). You may not use this file except in compliance with the
333.13 - * License. You can obtain a copy of the License at
333.14 - * http://www.netbeans.org/cddl-gplv2.html
333.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
333.16 - * specific language governing permissions and limitations under the
333.17 - * License. When distributing the software, include this License Header
333.18 - * Notice in each file and include the License file at
333.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
333.20 - * particular file as subject to the "Classpath" exception as provided
333.21 - * by Sun in the GPL Version 2 section of the License file that
333.22 - * accompanied this code. If applicable, add the following below the
333.23 - * License Header, with the fields enclosed by brackets [] replaced by
333.24 - * your own identifying information:
333.25 - * "Portions Copyrighted [year] [name of copyright owner]"
333.26 - *
333.27 - * Contributor(s):
333.28 - *
333.29 - * The Original Software is NetBeans. The Initial Developer of the Original
333.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
333.31 - * Microsystems, Inc. All Rights Reserved.
333.32 - *
333.33 - * If you wish your version of this file to be governed by only the CDDL
333.34 - * or only the GPL Version 2, indicate your decision by adding
333.35 - * "[Contributor] elects to include this software in this distribution
333.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
333.37 - * single choice of license, a recipient has the option to distribute
333.38 - * your version of this file under either the CDDL, the GPL Version 2 or
333.39 - * to extend the choice of license to its licensees as provided above.
333.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
333.41 - * Version 2 license, then the option applies only if the new code is
333.42 - * made subject to such option by the copyright holder.
333.43 - */
333.44 -
333.45 -package org.netbeans.modules.visualweb.gravy.properties;
333.46 -
333.47 -import java.awt.Component;
333.48 -import java.awt.Container;
333.49 -import javax.swing.JComponent;
333.50 -import javax.swing.JTabbedPane;
333.51 -import org.netbeans.jellytools.Bundle;
333.52 -import org.netbeans.jemmy.ComponentChooser;
333.53 -import org.netbeans.jemmy.ComponentSearcher;
333.54 -import org.netbeans.jemmy.JemmyException;
333.55 -import org.netbeans.jemmy.JemmyProperties;
333.56 -import org.netbeans.jemmy.TestOut;
333.57 -import org.netbeans.jemmy.Waitable;
333.58 -import org.netbeans.jemmy.Waiter;
333.59 -import org.netbeans.jemmy.operators.ContainerOperator;
333.60 -import org.netbeans.jemmy.operators.JComponentOperator;
333.61 -import org.netbeans.jemmy.operators.JTabbedPaneOperator;
333.62 -
333.63 -/**
333.64 - * Handles org.openide.explorer.propertysheet.PropertySheetTab which
333.65 - * represents a single tab of properties in a IDE property sheet.
333.66 - * PropertySheetTab extends JPanel in IDE.
333.67 - * <p>
333.68 - * Usage:<br>
333.69 - * <pre>
333.70 - * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
333.71 - * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
333.72 - * Property pr = new Property(psto, "Template");
333.73 - * System.out.println("\nProperty name="+pr.getName());
333.74 - * System.out.println("\nProperty value="+pr.getValue());
333.75 - * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Other Properties");
333.76 - * </pre>
333.77 - *
333.78 - * @deprecated Use {@link PropertySheetOperator} instead
333.79 - */
333.80 -public class PropertySheetTabOperator extends ContainerOperator {//JComponentOperator {
333.81 -
333.82 - /** Waits for PropertySheetTab with given name in specified container. If tab
333.83 - * exist and it is not active, it selects it.
333.84 - * @param contOper where to find
333.85 - * @param tabName name of tab
333.86 - * @deprecated Use {@link PropertySheetOperator} instead
333.87 - */
333.88 - public PropertySheetTabOperator(ContainerOperator contOper, String tabName) {
333.89 - super(resolveParent(contOper));
333.90 - //super(contOper.getParent());
333.91 - //super((Container)contOper.getSource());
333.92 - /*super(waitPropertySheetTab(contOper, tabName));
333.93 - copyEnvironment(contOper);*/
333.94 - }
333.95 -
333.96 - /** Waits for PropertySheetTab with name "Properties" in specified container.
333.97 - * If tab exist and it is not active, it selects it.
333.98 - * @param contOper where to find
333.99 - * @deprecated Use {@link PropertySheetOperator} instead
333.100 - */
333.101 - public PropertySheetTabOperator(ContainerOperator contOper) {
333.102 - super(resolveParent(contOper));
333.103 - //super(contOper.getParent());
333.104 - //super((Container)contOper.getSource());
333.105 - /*super(waitPropertySheetTab(contOper,
333.106 - Bundle.getString("org.openide.nodes.Bundle", "Properties")));
333.107 - copyEnvironment(contOper);*/
333.108 - }
333.109 -
333.110 - /** In case contOper is operator of PropertySheet instance we need to
333.111 - * return parent because in Property we search for PropertySheet in that
333.112 - * parent.
333.113 - */
333.114 - private static Container resolveParent(ContainerOperator contOper) {
333.115 - if(contOper.getParent() == null) {
333.116 - return (Container)contOper.getSource();
333.117 - } else {
333.118 - return contOper.getParent();
333.119 - }
333.120 - }
333.121 -
333.122 - /** Finds org.openide.explorer.propertysheet.PropertySheetTab in given
333.123 - * container. On its parent (JTabbedPane) find a pane with given tabName
333.124 - * and select that tab.
333.125 - * @return JComponent representing PropertySheetTab, null if not found.
333.126 - */
333.127 - private static JComponent findPropertySheetTab(ContainerOperator contOper, String tabName) {
333.128 - ComponentChooser chooser = new PropertySheetTabChooser();
333.129 - ComponentSearcher searcher = new ComponentSearcher((Container)contOper.getSource());
333.130 - searcher.setOutput(TestOut.getNullOutput());
333.131 - Component comp = searcher.findComponent(chooser);
333.132 - if(comp == null) {
333.133 - return null;
333.134 - }
333.135 - JTabbedPaneOperator tabbed = new JTabbedPaneOperator((JTabbedPane)comp.getParent());
333.136 - int count = tabbed.getTabCount();
333.137 - for(int i=0; i < count; i++) {
333.138 - if(contOper.getComparator().equals(tabbed.getTitleAt(i), tabName)) {
333.139 - tabbed.selectPage(i);
333.140 - return (JComponent)tabbed.getSelectedComponent();
333.141 - }
333.142 - }
333.143 - return null;
333.144 - }
333.145 -
333.146 - /** Waits for PropertySheetTab.
333.147 - * @see #findPropertySheetTab()
333.148 - */
333.149 - private static JComponent waitPropertySheetTab(final ContainerOperator contOper,
333.150 - final String tabName) {
333.151 - try {
333.152 - Waiter waiter = new Waiter(new Waitable() {
333.153 - public Object actionProduced(Object obj) {
333.154 - return findPropertySheetTab(contOper, tabName);
333.155 - }
333.156 - public String getDescription() {
333.157 - return("Wait PropertySheetTab \""+tabName+"\".");
333.158 - }
333.159 - });
333.160 - waiter.setOutput(JemmyProperties.getCurrentOutput());
333.161 - return((JComponent)waiter.waitAction(null));
333.162 - } catch(InterruptedException e) {
333.163 - throw new JemmyException("Interrupted waiting for PropertySheetTab");
333.164 - }
333.165 - }
333.166 -
333.167 - /** Chooser to find any instance of
333.168 - * org.openide.explorer.propertysheet.PropertySheetTab.
333.169 - */
333.170 - private static class PropertySheetTabChooser implements ComponentChooser {
333.171 - public PropertySheetTabChooser() {
333.172 - }
333.173 -
333.174 - public boolean checkComponent(Component comp) {
333.175 - return comp.getClass().getName().equals("org.openide.explorer.propertysheet.SheetTable");
333.176 - }
333.177 -
333.178 - public String getDescription() {
333.179 - return "SheetTable";
333.180 - }
333.181 - }
333.182 -
333.183 - /** Count number of properties on the tab.
333.184 - * @return number or properties
333.185 - * @deprecated Use {@link PropertySheetOperator} instead
333.186 - */
333.187 - public int getCount() {
333.188 - throw new JemmyException("Don't use this! No JTabbedPane is used in property sheet.");
333.189 - /*// Trying to find non sense name it goes through all properties and
333.190 - // returned index represents the count.
333.191 - SheetButtonOperator.SheetButtonChooser chooser =
333.192 - new SheetButtonOperator.SheetButtonChooser("Nonsense name @#$%^&", getComparator());
333.193 - findComponent((Container)getSource(), chooser);
333.194 - return chooser.getIndex()+1;*/
333.195 - }
333.196 -}
334.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/PropertySheetToolbarOperator.java Thu Jul 10 04:29:52 2008 -0700
334.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
334.3 @@ -1,230 +0,0 @@
334.4 -/*
334.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
334.6 - *
334.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
334.8 - *
334.9 - * The contents of this file are subject to the terms of either the GNU
334.10 - * General Public License Version 2 only ("GPL") or the Common
334.11 - * Development and Distribution License("CDDL") (collectively, the
334.12 - * "License"). You may not use this file except in compliance with the
334.13 - * License. You can obtain a copy of the License at
334.14 - * http://www.netbeans.org/cddl-gplv2.html
334.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
334.16 - * specific language governing permissions and limitations under the
334.17 - * License. When distributing the software, include this License Header
334.18 - * Notice in each file and include the License file at
334.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
334.20 - * particular file as subject to the "Classpath" exception as provided
334.21 - * by Sun in the GPL Version 2 section of the License file that
334.22 - * accompanied this code. If applicable, add the following below the
334.23 - * License Header, with the fields enclosed by brackets [] replaced by
334.24 - * your own identifying information:
334.25 - * "Portions Copyrighted [year] [name of copyright owner]"
334.26 - *
334.27 - * Contributor(s):
334.28 - *
334.29 - * The Original Software is NetBeans. The Initial Developer of the Original
334.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
334.31 - * Microsystems, Inc. All Rights Reserved.
334.32 - *
334.33 - * If you wish your version of this file to be governed by only the CDDL
334.34 - * or only the GPL Version 2, indicate your decision by adding
334.35 - * "[Contributor] elects to include this software in this distribution
334.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
334.37 - * single choice of license, a recipient has the option to distribute
334.38 - * your version of this file under either the CDDL, the GPL Version 2 or
334.39 - * to extend the choice of license to its licensees as provided above.
334.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
334.41 - * Version 2 license, then the option applies only if the new code is
334.42 - * made subject to such option by the copyright holder.
334.43 - */
334.44 -
334.45 -package org.netbeans.modules.visualweb.gravy.properties;
334.46 -
334.47 -import java.awt.Component;
334.48 -import java.awt.Container;
334.49 -import javax.swing.JComponent;
334.50 -import org.netbeans.jemmy.ComponentChooser;
334.51 -import org.netbeans.jemmy.JemmyException;
334.52 -import org.netbeans.jemmy.operators.ContainerOperator;
334.53 -import org.netbeans.jemmy.operators.JButtonOperator;
334.54 -import org.netbeans.jemmy.operators.JComponentOperator;
334.55 -import org.netbeans.jemmy.operators.JToggleButtonOperator;
334.56 -
334.57 -/**
334.58 - * Handles org.openide.explorer.propertysheet.PropertySheetToolbar which
334.59 - * represents toolbar in the properties sheet. It includes three sort option
334.60 - * toggle buttons, show editable toggle button, customizer button and help
334.61 - * button.
334.62 - * <p>
334.63 - * Usage:<br>
334.64 - * <pre>
334.65 - * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
334.66 - * PropertySheetToolbarOperator psto = new PropertySheetToolbarOperator(pso);
334.67 - * psto.unsorted();
334.68 - * psto.sortByType();
334.69 - * System.out.println("Help enabled="+psto.btHelp().isEnabled());
334.70 - * </pre>
334.71 - *
334.72 - * @deprecated Tool bar is no more present in property sheet.
334.73 - */
334.74 -public class PropertySheetToolbarOperator extends JComponentOperator {
334.75 - // in IDE PropertySheetToolbar extends JPanel
334.76 -
334.77 - /** Component operators */
334.78 - private JToggleButtonOperator _btUnsorted;
334.79 - private JToggleButtonOperator _btSortByName;
334.80 - private JToggleButtonOperator _btSortByType;
334.81 - private JToggleButtonOperator _btShowEditable;
334.82 - private JButtonOperator _btCustomizer;
334.83 - private JButtonOperator _btHelp;
334.84 -
334.85 -
334.86 - /** Waits for PropertySheetToolbar in given container.
334.87 - * @param contOper where to find
334.88 - * @deprecated Tool bar is no more present in property sheet.
334.89 - */
334.90 - public PropertySheetToolbarOperator(ContainerOperator contOper) {
334.91 - super((JComponent)waitPropertySheetToolbar(contOper));
334.92 - }
334.93 -
334.94 - /** Gets instance of JToggleButtonOperator of "Unsorted" button.
334.95 - * @return JToggleButtonOperator instance
334.96 - * @deprecated Tool bar is no more present in property sheet.
334.97 - */
334.98 - public JToggleButtonOperator btUnsorted() {
334.99 - if(_btUnsorted == null) {
334.100 - _btUnsorted = new JToggleButtonOperator(this, 0);
334.101 - }
334.102 - return _btUnsorted;
334.103 - }
334.104 -
334.105 - /** Gets instance of JToggleButtonOperator of "Sort by Name" button.
334.106 - * @return JToggleButtonOperator instance
334.107 - * @deprecated Tool bar is no more present in property sheet.
334.108 - */
334.109 - public JToggleButtonOperator btSortByName() {
334.110 - if(_btSortByName == null) {
334.111 - _btSortByName = new JToggleButtonOperator(this, 1);
334.112 - }
334.113 - return _btSortByName;
334.114 - }
334.115 -
334.116 - /** Gets instance of JToggleButtonOperator of "Sort by Type" button.
334.117 - * @return JToggleButtonOperator instance
334.118 - * @deprecated Tool bar is no more present in property sheet.
334.119 - */
334.120 - public JToggleButtonOperator btSortByType() {
334.121 - if(_btSortByType == null) {
334.122 - _btSortByType = new JToggleButtonOperator(this, 2);
334.123 - }
334.124 - return _btSortByType;
334.125 - }
334.126 -
334.127 - /** Gets instance of JToggleButtonOperator of "Show Editable Properties
334.128 - * Only" button.
334.129 - * @return JToggleButtonOperator instance
334.130 - * @deprecated Tool bar is no more present in property sheet.
334.131 - */
334.132 - public JToggleButtonOperator btShowEditable() {
334.133 - if(_btShowEditable == null) {
334.134 - _btShowEditable = new JToggleButtonOperator(this, 3);
334.135 - }
334.136 - return _btShowEditable;
334.137 - }
334.138 -
334.139 - /** Gets instance of JButtonOperator of "Customizer" button.
334.140 - * @return JButtonOperator instance
334.141 - * @deprecated Tool bar is no more present in property sheet.
334.142 - */
334.143 - public JButtonOperator btCustomizer() {
334.144 - if(_btCustomizer == null) {
334.145 - _btCustomizer = new JButtonOperator(this, 0);
334.146 - }
334.147 - return _btCustomizer;
334.148 - }
334.149 -
334.150 - /** Gets instance of JButtonOperator of "Help" button.
334.151 - * @return JButtonOperator instance
334.152 - * @deprecated Tool bar is no more present in property sheet.
334.153 - */
334.154 - public JButtonOperator btHelp() {
334.155 - if(_btHelp == null) {
334.156 - _btHelp = new JButtonOperator(this, 1);
334.157 - }
334.158 - return _btHelp;
334.159 - }
334.160 -
334.161 - /** Pushes "Unsorted" button.
334.162 - * @deprecated Tool bar is no more present in property sheet.
334.163 - */
334.164 - public void unsorted() {
334.165 - btUnsorted().push();
334.166 - }
334.167 -
334.168 - /** Pushes "Sort by Name" button.
334.169 - * @deprecated Tool bar is no more present in property sheet.
334.170 - */
334.171 - public void sortByName() {
334.172 - btSortByName().push();
334.173 - }
334.174 -
334.175 - /** Pushes "Sort by Type" button.
334.176 - * @deprecated Tool bar is no more present in property sheet.
334.177 - */
334.178 - public void sortByType() {
334.179 - btSortByType().push();
334.180 - }
334.181 -
334.182 - /** Sets "Show Editable Properties Only" toggle button to desired state.
334.183 - * @param show true - select button (show only editable properties);
334.184 - * false - unselect button (show all properties)
334.185 - * @deprecated Tool bar is no more present in property sheet.
334.186 - */
334.187 - public void showEditable(boolean show) {
334.188 - btShowEditable().setSelected(show);
334.189 - }
334.190 -
334.191 - /** Pushes "Customizer" button and no block further execution.
334.192 - * @deprecated Tool bar is no more present in property sheet.
334.193 - */
334.194 - public void customizer() {
334.195 - btCustomizer().pushNoBlock();
334.196 - }
334.197 -
334.198 - /** Pushes "Help" button.
334.199 - * @deprecated Tool bar is no more present in property sheet.
334.200 - */
334.201 - public void help() {
334.202 - btHelp().push();
334.203 - }
334.204 -
334.205 - /** Waits for instance of PropertySheetToolbar in a container. */
334.206 - private static Component waitPropertySheetToolbar(ContainerOperator contOper) {
334.207 - throw new JemmyException("Don't use this! No tool bar is present in property sheet.");
334.208 - /*
334.209 - ComponentChooser chooser = new ComponentChooser() {
334.210 - public boolean checkComponent(Component comp) {
334.211 - return comp.getClass().getName().indexOf("PropertySheetToolbar") != -1;
334.212 - }
334.213 -
334.214 - public String getDescription() {
334.215 - return "org.openide.explorer.propertysheet.PropertySheetToolbar";
334.216 - }
334.217 - };
334.218 - return contOper.waitComponent((Container)contOper.getSource(), chooser);
334.219 - */
334.220 - }
334.221 -
334.222 - /** Performs verification by accessing all sub-components
334.223 - * @deprecated Tool bar is no more present in property sheet.
334.224 - */
334.225 - public void verify() {
334.226 - btCustomizer();
334.227 - btHelp();
334.228 - btShowEditable();
334.229 - btSortByName();
334.230 - btSortByType();
334.231 - btUnsorted();
334.232 - }
334.233 -}
335.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/SheetButtonOperator.java Thu Jul 10 04:29:52 2008 -0700
335.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
335.3 @@ -1,296 +0,0 @@
335.4 -/*
335.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
335.6 - *
335.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
335.8 - *
335.9 - * The contents of this file are subject to the terms of either the GNU
335.10 - * General Public License Version 2 only ("GPL") or the Common
335.11 - * Development and Distribution License("CDDL") (collectively, the
335.12 - * "License"). You may not use this file except in compliance with the
335.13 - * License. You can obtain a copy of the License at
335.14 - * http://www.netbeans.org/cddl-gplv2.html
335.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
335.16 - * specific language governing permissions and limitations under the
335.17 - * License. When distributing the software, include this License Header
335.18 - * Notice in each file and include the License file at
335.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
335.20 - * particular file as subject to the "Classpath" exception as provided
335.21 - * by Sun in the GPL Version 2 section of the License file that
335.22 - * accompanied this code. If applicable, add the following below the
335.23 - * License Header, with the fields enclosed by brackets [] replaced by
335.24 - * your own identifying information:
335.25 - * "Portions Copyrighted [year] [name of copyright owner]"
335.26 - *
335.27 - * Contributor(s):
335.28 - *
335.29 - * The Original Software is NetBeans. The Initial Developer of the Original
335.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
335.31 - * Microsystems, Inc. All Rights Reserved.
335.32 - *
335.33 - * If you wish your version of this file to be governed by only the CDDL
335.34 - * or only the GPL Version 2, indicate your decision by adding
335.35 - * "[Contributor] elects to include this software in this distribution
335.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
335.37 - * single choice of license, a recipient has the option to distribute
335.38 - * your version of this file under either the CDDL, the GPL Version 2 or
335.39 - * to extend the choice of license to its licensees as provided above.
335.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
335.41 - * Version 2 license, then the option applies only if the new code is
335.42 - * made subject to such option by the copyright holder.
335.43 - */
335.44 -
335.45 -package org.netbeans.modules.visualweb.gravy.properties;
335.46 -
335.47 -import java.awt.Component;
335.48 -import java.awt.Container;
335.49 -import java.lang.reflect.Method;
335.50 -import javax.swing.JComponent;
335.51 -import org.netbeans.jemmy.Action;
335.52 -import org.netbeans.jemmy.ActionProducer;
335.53 -import org.netbeans.jemmy.ComponentChooser;
335.54 -import org.netbeans.jemmy.JemmyException;
335.55 -import org.netbeans.jemmy.operators.ContainerOperator;
335.56 -import org.netbeans.jemmy.operators.JComponentOperator;
335.57 -import org.netbeans.jemmy.operators.Operator;
335.58 -import org.netbeans.jemmy.util.MouseVisualizer;
335.59 -import org.openide.explorer.propertysheet.PropertyPanel;
335.60 -
335.61 -/**
335.62 - * Handle sheet button in IDE property sheets. SheetButton extends JPanel
335.63 - * and it can show property name, property value or customizer button ("..." button).
335.64 - * It is not recommended to use it directly but to use Property class and its
335.65 - * descendants.
335.66 - *
335.67 - * @deprecated JTable used instead of array of SheetButtons.
335.68 - * Use {@link Property} to change value of property.
335.69 - */
335.70 -public class SheetButtonOperator extends JComponentOperator {
335.71 -
335.72 - /** Index of name button (number of row) */
335.73 - private int nameButtonIndex;
335.74 - /** Temporary storage */
335.75 - private static int temporaryNameButtonIndex;
335.76 -
335.77 - /** Create new instance. Use getters below to construct a new instance.
335.78 - * @deprecated JTable used instead of array of SheetButtons.
335.79 - * Use {@link Property} to change value of property.
335.80 - */
335.81 - private SheetButtonOperator(Component button) {
335.82 - super((JComponent)button);
335.83 - }
335.84 -
335.85 - /** Waits for sheet button representing specified property name. It sets
335.86 - * index of button in sheet.
335.87 - * @param contOper where to find button
335.88 - * @param propertyName name of property
335.89 - * @return SheetButtonOperator instance
335.90 - * @see #getNameButtonIndex()
335.91 - * @deprecated JTable used instead of array of SheetButtons.
335.92 - * Use {@link Property} to change value of property.
335.93 - */
335.94 - public static synchronized SheetButtonOperator nameButton(ContainerOperator contOper,
335.95 - String propertyName) {
335.96 - SheetButtonOperator sbo =
335.97 - new SheetButtonOperator(waitNameButton(contOper, propertyName, 0));
335.98 - sbo.nameButtonIndex = temporaryNameButtonIndex;
335.99 - return sbo;
335.100 - }
335.101 -
335.102 - /** Waits for index-th sheet button representing property name. It sets
335.103 - * index of button in sheet.
335.104 - * @param contOper where to find button
335.105 - * @param index index of button (row in sheet - starts at 0)
335.106 - * @return SheetButtonOperator instance
335.107 - * @see #getNameButtonIndex()
335.108 - * @deprecated JTable used instead of array of SheetButtons.
335.109 - * Use {@link Property} to change value of property.
335.110 - */
335.111 - public static SheetButtonOperator nameButton(ContainerOperator contOper, int index) {
335.112 - SheetButtonOperator sbo = new SheetButtonOperator(waitNameButton(contOper, null, index));
335.113 - sbo.nameButtonIndex = index;
335.114 - return sbo;
335.115 - }
335.116 -
335.117 - /** Waits for sheet button representing value of property. It is identified
335.118 - * by index which can be found by name button.
335.119 - * @param contOper where to find
335.120 - * @param nameButtonIndex index of property in sheet
335.121 - * @return SheetButtonOperator instance
335.122 - * @deprecated JTable used instead of array of SheetButtons.
335.123 - * Use {@link Property} to change value of property.
335.124 - */
335.125 - public static SheetButtonOperator valueButton(ContainerOperator contOper, int nameButtonIndex) {
335.126 - return new SheetButtonOperator(waitValueButton(contOper, nameButtonIndex));
335.127 - }
335.128 -
335.129 - /** Waits for customizer button ("..." button) in given ContainerOperator.
335.130 - * @param contOper where to find button
335.131 - * @return SheetButtonOperator instance
335.132 - * @deprecated JTable used instead of array of SheetButtons.
335.133 - * Use {@link Property} to change value of property.
335.134 - */
335.135 - public static SheetButtonOperator customizerButton(ContainerOperator contOper) {
335.136 - return new SheetButtonOperator(waitCustomizerButton(contOper));
335.137 - }
335.138 -
335.139 - /** Waits LazyToolTipSheetButton by its name and index. Sets index of
335.140 - * property in sheet. */
335.141 - private static Component waitNameButton(ContainerOperator contOper, String name, int index) {
335.142 - throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
335.143 - /*SheetButtonChooser chooser = new SheetButtonChooser(name, contOper.getComparator());
335.144 - Component comp = contOper.waitComponent((Container)contOper.getSource(), chooser, index);
335.145 - temporaryNameButtonIndex = chooser.getIndex();
335.146 - return comp;*/
335.147 - }
335.148 -
335.149 - /** Waits "..." button which is SheetButton class. */
335.150 - private static Component waitCustomizerButton(ContainerOperator contOper) {
335.151 - throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
335.152 - /*ComponentChooser chooser = new ComponentChooser() {
335.153 - public boolean checkComponent(Component comp) {
335.154 - return comp.getClass().getName().indexOf("propertysheet.SheetButton") != -1;
335.155 - }
335.156 -
335.157 - public String getDescription() {
335.158 - return "SheetButton \"...\"";
335.159 - }
335.160 - };
335.161 - return contOper.waitComponent((Container)contOper.getSource(), chooser);*/
335.162 - }
335.163 -
335.164 - /** Waits value button which is instance of PropertySheetButton. First
335.165 - * it finds nameButtonIndex-th PropertyPanel and inside it it tries to find
335.166 - * PropertySheetButton.
335.167 - */
335.168 - private static Component waitValueButton(ContainerOperator contOper, int nameButtonIndex) {
335.169 - throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
335.170 - /*ComponentChooser chooser = new ComponentChooser() {
335.171 - public boolean checkComponent(Component comp) {
335.172 - return comp.getClass().getName().indexOf("PropertySheetButton") != -1;
335.173 - }
335.174 -
335.175 - public String getDescription() {
335.176 - return "PropertySheetButton";
335.177 - }
335.178 - };
335.179 - Component propertyPanel = waitPropertyPanel(contOper, nameButtonIndex);
335.180 - return contOper.waitComponent((Container)propertyPanel, chooser);*/
335.181 - }
335.182 -
335.183 - /** Waits org.openide.explorer.propertysheet.PropertyPanel with given index.
335.184 - * PropertyPanel represents container for a value both in editable and
335.185 - * non editable states.
335.186 - */
335.187 - static Component waitPropertyPanel(ContainerOperator contOper, int nameButtonIndex) {
335.188 - throw new JemmyException("Don't use this! SheetButton no more used in property sheet.");
335.189 - /*ComponentChooser chooser = new ComponentChooser() {
335.190 - public boolean checkComponent(Component comp) {
335.191 - return comp instanceof PropertyPanel;
335.192 - }
335.193 -
335.194 - public String getDescription() {
335.195 - return "org.openide.explorer.propertysheet.PropertyPanel";
335.196 - }
335.197 - };
335.198 - return contOper.waitComponent((Container)contOper.getSource(), chooser, nameButtonIndex);*/
335.199 - }
335.200 -
335.201 - /** Chooser to find instance LazyToolTipSheetButton by property name.
335.202 - * getIndex() method can be used to get index of found button.
335.203 - * It is also used by PropertySheetTabOperator. */
335.204 - static class SheetButtonChooser implements ComponentChooser {
335.205 - private String propertyName;
335.206 - private int index = -1;
335.207 - private StringComparator comparator;
335.208 -
335.209 - public SheetButtonChooser(String propertyName, StringComparator comparator) {
335.210 - this.propertyName = propertyName;
335.211 - this.comparator = comparator;
335.212 - }
335.213 -
335.214 - public boolean checkComponent(Component comp) {
335.215 - if(comp.getClass().getName().indexOf("LazyToolTipSheetButton") != -1) {
335.216 - index++;
335.217 - return comparator.equals(getButtonLabel(comp), propertyName);
335.218 - }
335.219 - return false;
335.220 - }
335.221 -
335.222 - public String getDescription() {
335.223 - return "\""+(propertyName == null ? "index-th" : propertyName)+"\" SheetButton";
335.224 - }
335.225 -
335.226 - public int getIndex() {
335.227 - return index;
335.228 - }
335.229 - }
335.230 -
335.231 - /** Gets label of given sheet button by reflection call. */
335.232 - private static String getButtonLabel(Component sheetButton) {
335.233 - try {
335.234 - Class clazz = Class.forName("org.openide.explorer.propertysheet.SheetButton");
335.235 - Method getLabelMethod = clazz.getDeclaredMethod("getLabel", null);
335.236 - getLabelMethod.setAccessible(true);
335.237 - return getLabelMethod.invoke(sheetButton, null).toString();
335.238 - } catch (Exception e) {
335.239 - throw new JemmyException("SheetButton.getLabel() by reflection failed.", e);
335.240 - }
335.241 - }
335.242 -
335.243 - /** Gets label of this sheet button.
335.244 - * @return label of this button
335.245 - */
335.246 - public String getLabel() {
335.247 - return getButtonLabel(getSource());
335.248 - }
335.249 -
335.250 - /** Gets index (row) of name button in property sheet. Each row represents
335.251 - * one property.
335.252 - * @return index (row) of name button
335.253 - */
335.254 - public int getNameButtonIndex() {
335.255 - return nameButtonIndex;
335.256 - }
335.257 -
335.258 - /** If needed, it scrolls to be this button visible, and clicks on
335.259 - * this button by mouse.
335.260 - */
335.261 - public void push() {
335.262 - // Possibly we don't need to scroll and makeVisible, if we use only
335.263 - // setText, setSelectedItem (not typeText, selectItem) in Property
335.264 - // and its descendants
335.265 - MouseVisualizer mv = new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false);
335.266 - mv.scroll(true);
335.267 - mv.makeVisible(this);
335.268 - clickMouse();
335.269 - }
335.270 -
335.271 - /** If needed, it scrolls to be this button visible, and clicks
335.272 - * on this button by mouse and no block further execution. */
335.273 - public void pushNoBlock() {
335.274 - try {
335.275 - new ActionProducer(new Action() {
335.276 - public Object launch(Object obj) {
335.277 - push();
335.278 - return null;
335.279 - }
335.280 - public String getDescription() {
335.281 - return("Push \""+getLabel()+"\" button - don't wait");
335.282 - }
335.283 - }, false).produceAction(null);
335.284 - } catch (Exception e) {
335.285 - throw new JemmyException("Push \""+getLabel()+"\" button action failed.", e);
335.286 - }
335.287 - }
335.288 -
335.289 - /** If needed, it scrolls to be this button visible, and clicks for popup
335.290 - * on this button.
335.291 - */
335.292 - public void clickForPopup() {
335.293 - MouseVisualizer mv = new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false);
335.294 - mv.scroll(true);
335.295 - mv.makeVisible(this);
335.296 - super.clickForPopup();
335.297 - }
335.298 -
335.299 -}
336.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/SheetTableOperator.java Thu Jul 10 04:29:52 2008 -0700
336.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
336.3 @@ -1,328 +0,0 @@
336.4 -/*
336.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
336.6 - *
336.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
336.8 - *
336.9 - * The contents of this file are subject to the terms of either the GNU
336.10 - * General Public License Version 2 only ("GPL") or the Common
336.11 - * Development and Distribution License("CDDL") (collectively, the
336.12 - * "License"). You may not use this file except in compliance with the
336.13 - * License. You can obtain a copy of the License at
336.14 - * http://www.netbeans.org/cddl-gplv2.html
336.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
336.16 - * specific language governing permissions and limitations under the
336.17 - * License. When distributing the software, include this License Header
336.18 - * Notice in each file and include the License file at
336.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
336.20 - * particular file as subject to the "Classpath" exception as provided
336.21 - * by Sun in the GPL Version 2 section of the License file that
336.22 - * accompanied this code. If applicable, add the following below the
336.23 - * License Header, with the fields enclosed by brackets [] replaced by
336.24 - * your own identifying information:
336.25 - * "Portions Copyrighted [year] [name of copyright owner]"
336.26 - *
336.27 - * Contributor(s):
336.28 - *
336.29 - * The Original Software is NetBeans. The Initial Developer of the Original
336.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
336.31 - * Microsystems, Inc. All Rights Reserved.
336.32 - *
336.33 - * If you wish your version of this file to be governed by only the CDDL
336.34 - * or only the GPL Version 2, indicate your decision by adding
336.35 - * "[Contributor] elects to include this software in this distribution
336.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
336.37 - * single choice of license, a recipient has the option to distribute
336.38 - * your version of this file under either the CDDL, the GPL Version 2 or
336.39 - * to extend the choice of license to its licensees as provided above.
336.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
336.41 - * Version 2 license, then the option applies only if the new code is
336.42 - * made subject to such option by the copyright holder.
336.43 - */
336.44 -
336.45 -package org.netbeans.modules.visualweb.gravy.properties;
336.46 -
336.47 -import org.netbeans.modules.visualweb.gravy.TestUtils;
336.48 -import org.netbeans.modules.visualweb.gravy.Util;
336.49 -import java.awt.Component;
336.50 -import java.awt.event.KeyEvent;
336.51 -import java.awt.event.InputEvent;
336.52 -import java.util.*;
336.53 -import java.util.List;
336.54 -import java.lang.reflect.*;
336.55 -import javax.swing.*;
336.56 -import javax.swing.table.TableCellRenderer;
336.57 -import org.netbeans.jemmy.ComponentChooser;
336.58 -import org.netbeans.jemmy.drivers.DriverManager;
336.59 -import org.netbeans.jemmy.operators.JComboBoxOperator;
336.60 -import org.netbeans.jemmy.operators.JTableOperator;
336.61 -import org.netbeans.jemmy.operators.JTextComponentOperator;
336.62 -import org.netbeans.jemmy.operators.*;
336.63 -import org.netbeans.jemmy.*;
336.64 -import org.netbeans.jellytools.Bundle;
336.65 -
336.66 -import org.openide.explorer.propertysheet.InplaceEditor;
336.67 -
336.68 -/**
336.69 - * Class represented sheet of properties.
336.70 - */
336.71 -public class SheetTableOperator extends JTableOperator {
336.72 -
336.73 - /**
336.74 - * Look for SheetTable in main window.
336.75 - */
336.76 - public SheetTableOperator() {
336.77 - super(Util.getMainWindow(), new SheetTableChooser());
336.78 - }
336.79 -
336.80 - /**
336.81 - * Look for SheetTable in specified container.
336.82 - * @param container Container where SheetTable is looked for.
336.83 - */
336.84 - public SheetTableOperator(ContainerOperator container) {
336.85 - super(container, new SheetTableChooser());
336.86 - }
336.87 -
336.88 - /**
336.89 - * Set comparison style.
336.90 - * @param compareExactly Make comparison by exact match. If false, comparison is made by entry.
336.91 - * @param caseSensitive Make case sensitive comparison.
336.92 - */
336.93 - public void setCompareStyle(boolean compareExactly, boolean caseSensitive){
336.94 - setComparator(new DefaultStringComparator(compareExactly,caseSensitive));
336.95 - }
336.96 -
336.97 - /**
336.98 - * Find row for specified property in this SheetTable.
336.99 - * @param propName Name of the property.
336.100 - */
336.101 - private int findRow(String propName){
336.102 - return findCell(new PropertyCellChooser(propName), null, new int[] {0}, 0).y;
336.103 - }
336.104 -
336.105 - /**
336.106 - * Click on row for specified property in this SheetTable.
336.107 - * @param propName Name of the property.
336.108 - */
336.109 - public void clickCell(String propName){
336.110 - clickOnCell(findRow(propName), 1);
336.111 - //TODO need second click to let component exit from inline editing mode
336.112 - clickOnCell(findRow(propName), 1);
336.113 - }
336.114 -
336.115 - /**
336.116 - * Make row for specified property editable.
336.117 - * @param propName Name of the property.
336.118 - */
336.119 - public void startEditing(String propName) {
336.120 - //clicknCell(findRow(propName), 1);
336.121 - clickCell(propName);
336.122 - pushKey(KeyEvent.VK_SPACE);
336.123 - }
336.124 -
336.125 - /**
336.126 - * Push dotten button in row for specified property.
336.127 - * @param propName Name of the property.
336.128 - */
336.129 - public void pushDotted(String propName) {
336.130 - clickOnCell(findRow(propName), 0);
336.131 - TestUtils.wait(2000);
336.132 - pushKey(KeyEvent.VK_SPACE,InputEvent.CTRL_MASK);
336.133 - }
336.134 -
336.135 - /**
336.136 - * Get value of specified property.
336.137 - * @param propName Name of the property.
336.138 - * @return String Value of specified property.
336.139 - */
336.140 - public String getValue(String propName) {
336.141 - return(((InplaceEditor)getRenderedComponent(findRow(propName), 1)).getValue().toString());
336.142 - }
336.143 -
336.144 - /**
336.145 - * Set value of specified property.
336.146 - * @param propName Name of the property.
336.147 - * @param value Value for specified property.
336.148 - */
336.149 - public void setValue(String propName, String value) {
336.150 - int row = findRow(propName);
336.151 - //((InplaceEditor)getRenderedComponent(row, 1)).setValue(value);
336.152 - System.out.println("Class: "+((InplaceEditor)getRenderedComponent(row, 1)).getClass());
336.153 - }
336.154 -
336.155 - /**
336.156 - * Set value of specified property with Text Component.
336.157 - * @param propName Name of the property.
336.158 - * @param value Value for specified property.
336.159 - */
336.160 - public void setTextValue(String propName, String value) {
336.161 - startEditing(propName);
336.162 - new JTextComponentOperator(this).enterText(value);
336.163 - Util.wait(500);
336.164 - }
336.165 -
336.166 - /**
336.167 - * Set value of specified property where is a button for call dialog for set value.
336.168 - * @param propName Name of the property.
336.169 - * @param value Value for specified property.
336.170 - */
336.171 - public void setButtonValue(String propName, String value) {
336.172 - clickForEdit(findCell(propName, 2).y, 1);
336.173 - //second click added to let component exit from inline editing mode
336.174 - clickForEdit(findCell(propName, 2).y, 1);
336.175 - new JTextComponentOperator(this).enterText(value);
336.176 - }
336.177 -
336.178 - /**
336.179 - * Set value of specified property with ComboBox.
336.180 - * @param propName Name of the property.
336.181 - * @param value Value for specified property.
336.182 - */
336.183 - public void setComboBoxValue(String propName, String value) {
336.184 - clickOnCell(findRow(propName), 1);
336.185 - new JComboBoxOperator(this).selectItem(value);
336.186 - }
336.187 -
336.188 - /**
336.189 - * Set value of specified property with CheckBox.
336.190 - * @param propName Name of the property.
336.191 - * @param value Value for specified property.
336.192 - */
336.193 - public void setCheckBoxValue(String propName, String value) {
336.194 - if (!getValue(propName).equals(value)) switchCheckBox(propName);
336.195 - }
336.196 -
336.197 - /**
336.198 - * Switch value of CheckBox for specified property.
336.199 - * @param propName Name of the property.
336.200 - */
336.201 - public void switchCheckBox(String propName){
336.202 - clickOnCell(findRow(propName), 1);
336.203 - }
336.204 -
336.205 - /**
336.206 - * Set image
336.207 - * @param componentID ID of component.
336.208 - * @param propertyName url for image component and imageURL for imagehyperlink component.
336.209 - * @param imagePath Path to image.
336.210 - */
336.211 - public void setImage(String componentID, String propertyName, String imagePath) {
336.212 - pushDotted(propertyName);
336.213 - JDialogOperator dialog1 = new JDialogOperator(componentID);
336.214 - new JButtonOperator(dialog1, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","PropertySheet_AddFile")).pushNoBlock();
336.215 - JDialogOperator dialog2 = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","PropertySheet_AddFile"));
336.216 - new JTextFieldOperator(dialog2, 0).setText(imagePath);
336.217 - Util.wait(1000);
336.218 - new JButtonOperator(dialog2, Bundle.getStringTrimmed("org.netbeans.modules.visualweb.gravy.Bundle","PropertySheet_AddFile")).pushNoBlock();
336.219 - dialog2.waitClosed();
336.220 - Util.wait(1000);
336.221 - new JButtonOperator(dialog1, "OK").pushNoBlock();
336.222 - dialog1.waitClosed();
336.223 - }
336.224 -
336.225 - /**
336.226 - * Set specified value of specified property with ComboBox.
336.227 - * @param propName Name of the property.
336.228 - * @param item Item for specified property.
336.229 - */
336.230 - public void selectCombo(String propName, final String item) {
336.231 - int row = findRow(propName);
336.232 - // ((InplaceEditor)getRenderedComponent(row, 1)).setValue(value);
336.233 - // JComboBoxOperator combo = new JComboBoxOperator(((JComboBox)getRenderedComponent(row, 1)));
336.234 - // combo.setVerification(false);
336.235 - // combo.selectItem(item);
336.236 - }
336.237 -
336.238 - /**
336.239 - * Get current component's id
336.240 - */
336.241 - public String getSelectedComponentID() {
336.242 - setCompareStyle(true, true);
336.243 - String id = getValue("id");
336.244 - return id;
336.245 - }
336.246 -
336.247 -
336.248 - /**
336.249 - * Prints all properties from propertysheet to string
336.250 - * @return String with names and values
336.251 - */
336.252 - public String printAllProperties() {
336.253 - String output = "";
336.254 -
336.255 - for (int row = 0; row < getRowCount(); row++) {
336.256 -
336.257 - Object currentValue = null;
336.258 - String currentStringValue = "";
336.259 - String currentName = "";
336.260 - Object renderedComponent = null;
336.261 -
336.262 - currentName = ((JLabel) getRenderedComponent(row, 0)).getText();
336.263 -
336.264 - try {
336.265 - renderedComponent = getRenderedComponent(row, 1);
336.266 - currentValue = ( (InplaceEditor) renderedComponent ).getValue();
336.267 -
336.268 - try {
336.269 - currentStringValue = (String) currentValue;
336.270 - } catch (ClassCastException e) {
336.271 - currentStringValue = "Can't cast class " + currentValue.getClass().getName() +
336.272 - " to String. toString returns: \"" + currentValue.toString() + "\"";
336.273 - }
336.274 -
336.275 - } catch (ClassCastException e) {
336.276 - if(renderedComponent instanceof TableCellRenderer) {
336.277 - currentStringValue = "$TableCellRenderer";
336.278 - } else {
336.279 - currentStringValue = "Can't cast class " + renderedComponent.getClass().getName() + " to InplaceEditor.";
336.280 - }
336.281 - }
336.282 -
336.283 - output += "Property: " + currentName + "; Value: " + currentStringValue + "\r\n";
336.284 - } // for
336.285 -
336.286 - return output;
336.287 - }
336.288 -
336.289 -
336.290 - /**
336.291 - * Open SheetTable.
336.292 - * @return Opened SheetTable.
336.293 - */
336.294 - public static SheetTableOperator createInstance() {
336.295 - Util.getMainMenu().pushMenuNoBlock("Window|Properties"); // show if hidden (collapse if already shown)
336.296 -
336.297 - SheetTableOperator props = new SheetTableOperator();
336.298 - int propsCnt = props.getRowCount();
336.299 - Util.getMainMenu().pushMenuNoBlock("Window|Properties"); // toggle expansion
336.300 - if(propsCnt > props.getRowCount()) {
336.301 - Util.getMainMenu().pushMenuNoBlock("Window|Properties"); // toggle expansion another time if was collapsed
336.302 - }
336.303 -
336.304 - return props;
336.305 - }
336.306 -
336.307 - protected static class PropertyCellChooser implements JTableOperator.TableCellChooser {
336.308 - String text;
336.309 - public PropertyCellChooser(String text) {
336.310 - this.text = text;
336.311 - }
336.312 - public boolean checkCell(JTableOperator oper, int row, int column) {
336.313 - JLabel label = (JLabel)oper.getRenderedComponent(row, column);
336.314 - return(label!=null && oper.getComparator().equals(label.getText(), text));
336.315 - }
336.316 - public String getDescription() {
336.317 - return(text + " property");
336.318 - }
336.319 - }
336.320 -
336.321 - static class SheetTableChooser implements ComponentChooser {
336.322 - public SheetTableChooser() {
336.323 - }
336.324 - public boolean checkComponent(Component comp) {
336.325 - return(comp.getClass().getName().equals("org.openide.explorer.propertysheet.SheetTable"));
336.326 - }
336.327 - public String getDescription() {
336.328 - return("org.openide.explorer.propertysheet.SheetTable");
336.329 - }
336.330 - }
336.331 -}
337.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/TextFieldProperty.java Thu Jul 10 04:29:52 2008 -0700
337.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
337.3 @@ -1,94 +0,0 @@
337.4 -/*
337.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
337.6 - *
337.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
337.8 - *
337.9 - * The contents of this file are subject to the terms of either the GNU
337.10 - * General Public License Version 2 only ("GPL") or the Common
337.11 - * Development and Distribution License("CDDL") (collectively, the
337.12 - * "License"). You may not use this file except in compliance with the
337.13 - * License. You can obtain a copy of the License at
337.14 - * http://www.netbeans.org/cddl-gplv2.html
337.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
337.16 - * specific language governing permissions and limitations under the
337.17 - * License. When distributing the software, include this License Header
337.18 - * Notice in each file and include the License file at
337.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
337.20 - * particular file as subject to the "Classpath" exception as provided
337.21 - * by Sun in the GPL Version 2 section of the License file that
337.22 - * accompanied this code. If applicable, add the following below the
337.23 - * License Header, with the fields enclosed by brackets [] replaced by
337.24 - * your own identifying information:
337.25 - * "Portions Copyrighted [year] [name of copyright owner]"
337.26 - *
337.27 - * Contributor(s):
337.28 - *
337.29 - * The Original Software is NetBeans. The Initial Developer of the Original
337.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
337.31 - * Microsystems, Inc. All Rights Reserved.
337.32 - *
337.33 - * If you wish your version of this file to be governed by only the CDDL
337.34 - * or only the GPL Version 2, indicate your decision by adding
337.35 - * "[Contributor] elects to include this software in this distribution
337.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
337.37 - * single choice of license, a recipient has the option to distribute
337.38 - * your version of this file under either the CDDL, the GPL Version 2 or
337.39 - * to extend the choice of license to its licensees as provided above.
337.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
337.41 - * Version 2 license, then the option applies only if the new code is
337.42 - * made subject to such option by the copyright holder.
337.43 - */
337.44 -
337.45 -package org.netbeans.modules.visualweb.gravy.properties;
337.46 -
337.47 -import java.awt.event.KeyEvent;
337.48 -import org.netbeans.jemmy.JemmyException;
337.49 -import org.netbeans.jemmy.operators.ContainerOperator;
337.50 -import org.netbeans.jemmy.operators.JTextFieldOperator;
337.51 -
337.52 -/**
337.53 - * Can be used to set all properties which use JTextField to change value.
337.54 - * <p>
337.55 - * Usage:<br>
337.56 - * <pre>
337.57 - * PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
337.58 - * PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Properties");
337.59 - * TextFieldProperty pr = new TextFieldProperty(psto, "Name");
337.60 - * pr.setValue("NewValue");
337.61 - * </pre>
337.62 - *
337.63 - * @deprecated Use {@link Property} instead
337.64 - */
337.65 -public class TextFieldProperty extends Property {
337.66 -
337.67 - /** Waits for property with given name in specified container.
337.68 - * @param contOper ContainerOperator where to find property. It is
337.69 - * recommended to use {@link PropertySheetTabOperator}.
337.70 - * @param name property name
337.71 - * @deprecated Use {@link Property} instead
337.72 - */
337.73 - public TextFieldProperty(ContainerOperator contOper, String name) {
337.74 - super(contOper, name);
337.75 - }
337.76 -
337.77 - /** Starts editing the property and waits for JTextField
337.78 - * @return JTextFieldOperator of property text field
337.79 - * @deprecated Use {@link Property} instead
337.80 - */
337.81 - public JTextFieldOperator textField() {
337.82 - throw new JemmyException("Don't use this! Property sheet uses JTable instead of SheetButton.");
337.83 - /*startEditing();
337.84 - return new JTextFieldOperator(contOper);*/
337.85 - }
337.86 -
337.87 -
337.88 - /** Sets value of the property. It makes property editable, finds
337.89 - * JTextField, sets its value and pushes Enter key.
337.90 - * @param value new value of property
337.91 - */
337.92 - /*public void setValue(String value) {
337.93 - JTextFieldOperator textOper = textField();
337.94 - textOper.enterText(value);
337.95 - }*/
337.96 -
337.97 -}
338.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/AbbreviationsEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
338.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
338.3 @@ -1,451 +0,0 @@
338.4 -/*
338.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
338.6 - *
338.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
338.8 - *
338.9 - * The contents of this file are subject to the terms of either the GNU
338.10 - * General Public License Version 2 only ("GPL") or the Common
338.11 - * Development and Distribution License("CDDL") (collectively, the
338.12 - * "License"). You may not use this file except in compliance with the
338.13 - * License. You can obtain a copy of the License at
338.14 - * http://www.netbeans.org/cddl-gplv2.html
338.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
338.16 - * specific language governing permissions and limitations under the
338.17 - * License. When distributing the software, include this License Header
338.18 - * Notice in each file and include the License file at
338.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
338.20 - * particular file as subject to the "Classpath" exception as provided
338.21 - * by Sun in the GPL Version 2 section of the License file that
338.22 - * accompanied this code. If applicable, add the following below the
338.23 - * License Header, with the fields enclosed by brackets [] replaced by
338.24 - * your own identifying information:
338.25 - * "Portions Copyrighted [year] [name of copyright owner]"
338.26 - *
338.27 - * Contributor(s):
338.28 - *
338.29 - * The Original Software is NetBeans. The Initial Developer of the Original
338.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
338.31 - * Microsystems, Inc. All Rights Reserved.
338.32 - *
338.33 - * If you wish your version of this file to be governed by only the CDDL
338.34 - * or only the GPL Version 2, indicate your decision by adding
338.35 - * "[Contributor] elects to include this software in this distribution
338.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
338.37 - * single choice of license, a recipient has the option to distribute
338.38 - * your version of this file under either the CDDL, the GPL Version 2 or
338.39 - * to extend the choice of license to its licensees as provided above.
338.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
338.41 - * Version 2 license, then the option applies only if the new code is
338.42 - * made subject to such option by the copyright holder.
338.43 - */
338.44 -
338.45 -/*
338.46 - * Abbreviations.java
338.47 - *
338.48 - * Created on 1/2/03 4:04 PM
338.49 - */
338.50 -package org.netbeans.modules.visualweb.gravy.properties.editors;
338.51 -
338.52 -import java.util.*;
338.53 -import javax.swing.table.TableModel;
338.54 -import org.netbeans.modules.visualweb.gravy.OptionsOperator;
338.55 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
338.56 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetTabOperator;
338.57 -import org.netbeans.modules.visualweb.gravy.properties.TextFieldProperty;
338.58 -import org.netbeans.jemmy.EventTool;
338.59 -import org.netbeans.jemmy.operators.*;
338.60 -
338.61 -import javax.swing.JDialog;
338.62 -import org.netbeans.jellytools.Bundle;
338.63 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
338.64 -import org.netbeans.jemmy.operators.*;
338.65 -/** Class implementing all necessary methods for handling "Abbreviations" NbDialog.
338.66 - */
338.67 -public class AbbreviationsEditorOperator extends NbDialogOperator {
338.68 -
338.69 - /** Creates new Abbreviations that can handle it.
338.70 - */
338.71 - public AbbreviationsEditorOperator() {
338.72 - super(java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("PROP_Abbreviations"));
338.73 - }
338.74 -
338.75 - /** Creates new StringArrayCustomEditorOperator
338.76 - * @param wrapper JDialogOperator wrapper for custom editor */
338.77 - public AbbreviationsEditorOperator(JDialogOperator wrapper) {
338.78 - super((JDialog)wrapper.getSource());
338.79 - }
338.80 -
338.81 - private JTableOperator _tabAbbreviations;
338.82 - private JButtonOperator _btMetalScrollButton;
338.83 - private JButtonOperator _btMetalScrollButton2;
338.84 - private JButtonOperator _btAdd;
338.85 - private JButtonOperator _btEdit;
338.86 - private JButtonOperator _btRemove;
338.87 - private JButtonOperator _btOK;
338.88 - private JButtonOperator _btCancel;
338.89 - private JButtonOperator _btHelp;
338.90 -
338.91 -
338.92 - //******************************
338.93 - // Subcomponents definition part
338.94 - //******************************
338.95 -
338.96 - /** Tries to find null JTable in this dialog.
338.97 - * @return JTableOperator
338.98 - */
338.99 - public JTableOperator tabAbbreviations() {
338.100 - if (_tabAbbreviations==null) {
338.101 - _tabAbbreviations = new JTableOperator(this);
338.102 - }
338.103 - return _tabAbbreviations;
338.104 - }
338.105 -
338.106 - /** Tries to find "" MetalScrollButton in this dialog.
338.107 - * @return JButtonOperator
338.108 - */
338.109 - public JButtonOperator btMetalScrollButton() {
338.110 - if (_btMetalScrollButton==null) {
338.111 - _btMetalScrollButton = new JButtonOperator(this, "");
338.112 - }
338.113 - return _btMetalScrollButton;
338.114 - }
338.115 -
338.116 - /** Tries to find "" MetalScrollButton in this dialog.
338.117 - * @return JButtonOperator
338.118 - */
338.119 - public JButtonOperator btMetalScrollButton2() {
338.120 - if (_btMetalScrollButton2==null) {
338.121 - _btMetalScrollButton2 = new JButtonOperator(this, "", 1);
338.122 - }
338.123 - return _btMetalScrollButton2;
338.124 - }
338.125 -
338.126 - /** Tries to find "Add..." JButton in this dialog.
338.127 - * @return JButtonOperator
338.128 - */
338.129 - public JButtonOperator btAdd() {
338.130 - if (_btAdd==null) {
338.131 - _btAdd = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Add"));
338.132 - }
338.133 - return _btAdd;
338.134 - }
338.135 -
338.136 - /** Tries to find "Edit..." JButton in this dialog.
338.137 - * @return JButtonOperator
338.138 - */
338.139 - public JButtonOperator btEdit() {
338.140 - if (_btEdit==null) {
338.141 - _btEdit = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("AEP_Edit"));
338.142 - }
338.143 - return _btEdit;
338.144 - }
338.145 -
338.146 - /** Tries to find "Remove" JButton in this dialog.
338.147 - * @return JButtonOperator
338.148 - */
338.149 - public JButtonOperator btRemove() {
338.150 - if (_btRemove==null) {
338.151 - _btRemove = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("Remove"));
338.152 - }
338.153 - return _btRemove;
338.154 - }
338.155 -
338.156 - /** Tries to find "OK" JButton in this dialog.
338.157 - * @return JButtonOperator
338.158 - */
338.159 - public JButtonOperator btOK() {
338.160 - if (_btOK==null) {
338.161 - _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("KBEP_OK_LABEL"));
338.162 - }
338.163 - return _btOK;
338.164 - }
338.165 -
338.166 - /** Tries to find "Cancel" JButton in this dialog.
338.167 - * @return JButtonOperator
338.168 - */
338.169 - public JButtonOperator btCancel() {
338.170 - if (_btCancel==null) {
338.171 - _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
338.172 - }
338.173 - return _btCancel;
338.174 - }
338.175 -
338.176 - /** Tries to find "Help" JButton in this dialog.
338.177 - * @return JButtonOperator
338.178 - */
338.179 - public JButtonOperator btHelp() {
338.180 - if (_btHelp==null) {
338.181 - _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
338.182 - }
338.183 - return _btHelp;
338.184 - }
338.185 -
338.186 -
338.187 - //****************************************
338.188 - // Low-level functionality definition part
338.189 - //****************************************
338.190 -
338.191 - /** clicks on "" MetalScrollButton
338.192 - */
338.193 - public void metalScrollButton() {
338.194 - btMetalScrollButton().push();
338.195 - }
338.196 -
338.197 - /** clicks on "" MetalScrollButton
338.198 - */
338.199 - public void metalScrollButton2() {
338.200 - btMetalScrollButton2().push();
338.201 - }
338.202 -
338.203 - /** clicks on "Add..." JButton
338.204 - */
338.205 - public void add() {
338.206 - btAdd().push();
338.207 - }
338.208 -
338.209 - /** clicks on "Edit..." JButton
338.210 - */
338.211 - public void edit() {
338.212 - btEdit().push();
338.213 - }
338.214 -
338.215 - /** clicks on "Remove" JButton
338.216 - */
338.217 - public void remove() {
338.218 - btRemove().push();
338.219 - }
338.220 -
338.221 - /** clicks on "OK" JButton
338.222 - */
338.223 - public void oK() {
338.224 - btOK().push();
338.225 - }
338.226 -
338.227 - /** clicks on "Cancel" JButton
338.228 - */
338.229 - public void cancel() {
338.230 - btCancel().push();
338.231 - }
338.232 -
338.233 - /** clicks on "Help" JButton
338.234 - */
338.235 - public void help() {
338.236 - btHelp().push();
338.237 - }
338.238 -
338.239 -
338.240 - //*****************************************
338.241 - // High-level functionality definition part
338.242 - //*****************************************
338.243 -
338.244 - /** Performs verification of Abbreviations by accessing all its components.
338.245 - */
338.246 - public void verify() {
338.247 - tabAbbreviations();
338.248 - btMetalScrollButton();
338.249 - btMetalScrollButton2();
338.250 - btAdd();
338.251 - btEdit();
338.252 - btRemove();
338.253 - btOK();
338.254 - btCancel();
338.255 - btHelp();
338.256 - }
338.257 -
338.258 - /**
338.259 - * Add specified abbreviation with specified expansion.
338.260 - * @param abbreviation Name of abbreviation.
338.261 - * @param expansion Name of expansion.
338.262 - */
338.263 - public void addAbbreviation(String abbreviation, String expansion) {
338.264 - btAdd().pushNoBlock();
338.265 - EnterAbbreviation enter = new EnterAbbreviation();
338.266 - enter.fillAbbreviation(abbreviation, expansion);
338.267 - enter.oK();
338.268 - }
338.269 -
338.270 - /**
338.271 - * Edit specified abbreviation.
338.272 - * @param abbreviationName Name of abbreviations.
338.273 - * @param newAbbreviationName New name of abbreviations.
338.274 - * @param newExpansion New name of expansion.
338.275 - */
338.276 - public boolean editAbbreviation(String abbreviationName, String newAbbreviationName, String newExpansion) {
338.277 - int row = tabAbbreviations().findCellRow(abbreviationName);
338.278 -
338.279 - if (row == (-1))
338.280 - return false;
338.281 -
338.282 - tabAbbreviations().selectCell(row, 0);
338.283 - btEdit().pushNoBlock();
338.284 -
338.285 - EnterAbbreviation enter = new EnterAbbreviation();
338.286 -
338.287 - enter.fillAbbreviation(newAbbreviationName, newExpansion);
338.288 - enter.oK();
338.289 -
338.290 - return true;
338.291 - }
338.292 -
338.293 - /**
338.294 - * Edit specified abbreviation or add if it isn't exist.
338.295 - * @param abbreviationName Name of abbreviations.
338.296 - * @param newAbbreviationName New name of abbreviations.
338.297 - * @param newExpansion New name of expansion.
338.298 - */
338.299 - public void addOrEditAbbreviation(String abbreviationName, String newAbbreviationName, String newExpansion) {
338.300 - if (!editAbbreviation(abbreviationName, newAbbreviationName, newExpansion))
338.301 - addAbbreviation(newAbbreviationName, newExpansion);
338.302 - }
338.303 -
338.304 - /**
338.305 - * Remove specified abbreviation.
338.306 - * @param abbreviation Name of abbreviations.
338.307 - * @return True if abbreviation was removed.
338.308 - */
338.309 - public boolean removeAbbreviation(String abbreviation) {
338.310 - int row = tabAbbreviations().findCellRow(abbreviation,
338.311 - new Operator.DefaultStringComparator(true, true));
338.312 -
338.313 - if (row == (-1))
338.314 - return false;
338.315 -
338.316 - tabAbbreviations().selectCell(row, 0);
338.317 - btRemove().pushNoBlock();
338.318 -
338.319 - return true;
338.320 - }
338.321 -
338.322 - /**
338.323 - * Get map of abbreviations.
338.324 - * @return Map of abbreviations.
338.325 - */
338.326 - public Map listAbbreviations() {
338.327 - TableModel model = tabAbbreviations().getModel();
338.328 - int rowCount = model.getRowCount();
338.329 - Map result = new HashMap();
338.330 -
338.331 - for (int cntr = 0; cntr < rowCount; cntr++) {
338.332 - result.put((String) model.getValueAt(cntr, 0), (String) model.getValueAt(cntr, 1));
338.333 - }
338.334 -
338.335 - return result;
338.336 - }
338.337 -
338.338 - /**
338.339 - * Get abbreviations editor.
338.340 - * @return AbbreviationsEditorOperator.
338.341 - */
338.342 - public static AbbreviationsEditorOperator invoke(String editorName) {
338.343 - OptionsOperator options = OptionsOperator.invoke();
338.344 - new EventTool().waitNoEvent(500);
338.345 -
338.346 - options.advanced();
338.347 - new EventTool().waitNoEvent(500);
338.348 -
338.349 - options.selectOption(ResourceBundle.getBundle("org/netbeans/core/Bundle").getString("UI/Services/Editing")+
338.350 - "|"+ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("OPTIONS_all")+
338.351 - "|" + editorName);
338.352 - new EventTool().waitNoEvent(500);
338.353 - PropertySheetOperator property = new PropertySheetOperator(options);
338.354 - PropertySheetTabOperator psto = new PropertySheetTabOperator(property);
338.355 - new TextFieldProperty(psto,ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("PROP_Abbreviations")).openEditor();
338.356 -
338.357 - AbbreviationsEditorOperator abbs = new AbbreviationsEditorOperator();
338.358 -
338.359 - options.close(); /*??? not sure whether this is assured to work*/
338.360 - return abbs;
338.361 - }
338.362 -
338.363 - /**
338.364 - * Add specified abbreviation with specified expansion with specified editor.
338.365 - * @param editorName Name of editor.
338.366 - * @param abbreviation Name of abbreviation.
338.367 - * @param expansion Name of expansion.
338.368 - */
338.369 - public static void addAbbreviation(String editorName, String abbreviation, String expansion) {
338.370 - AbbreviationsEditorOperator instance = invoke(editorName);
338.371 -
338.372 - instance.addAbbreviation(abbreviation, expansion);
338.373 - instance.oK();
338.374 - }
338.375 -
338.376 - /**
338.377 - * Edit specified abbreviation or add if it isn't exist with specified editor.
338.378 - * @param editorName Name of editor.
338.379 - * @param abbreviationName Name of abbreviations.
338.380 - * @param newAbbreviationName New name of abbreviations.
338.381 - * @param newExpansion New name of expansion.
338.382 - */
338.383 - public static void addOrEditAbbreviation(String editorName, String abbreviationName, String newAbbreviationName, String newExpansion) {
338.384 - AbbreviationsEditorOperator instance = invoke(editorName);
338.385 -
338.386 - instance.addOrEditAbbreviation(abbreviationName, newAbbreviationName, newExpansion);
338.387 - instance.oK();
338.388 - }
338.389 -
338.390 - /**
338.391 - * Remove specified abbreviation with specified editor.
338.392 - * @param editorName Name of editor.
338.393 - * @param abbreviation Name of abbreviations.
338.394 - * @return True if abbreviation was removed.
338.395 - */
338.396 - public static boolean removeAbbreviation(String editorName, String abbreviation) {
338.397 - AbbreviationsEditorOperator instance = invoke(editorName);
338.398 - boolean result = instance.removeAbbreviation(abbreviation);
338.399 -
338.400 - instance.oK();
338.401 - return result;
338.402 - }
338.403 -
338.404 - /**
338.405 - * Edit specified abbreviation with specified editor.
338.406 - * @param editorName Name of editor.
338.407 - * @param abbreviationName Name of abbreviations.
338.408 - * @param newAbbreviationName New name of abbreviations.
338.409 - * @param newExpansion New name of expansion.
338.410 - */
338.411 - public static boolean editAbbreviation(String editorName, String abbreviationName, String newAbbreviationName, String newExpansion) {
338.412 - AbbreviationsEditorOperator instance = invoke(editorName);
338.413 - boolean result = instance.editAbbreviation(abbreviationName, newAbbreviationName, newExpansion);
338.414 -
338.415 - instance.oK();
338.416 - return result;
338.417 - }
338.418 -
338.419 - /**
338.420 - * Get map of abbreviations.
338.421 - * @param editorName Name of AbbreviationsEditor.
338.422 - * @return Map of abbreviations.
338.423 - */
338.424 - public static Map listAbbreviations(String editorName) {
338.425 - AbbreviationsEditorOperator instance = invoke(editorName);
338.426 - Map result = instance.listAbbreviations();
338.427 -
338.428 - instance.oK();
338.429 -
338.430 - return result;
338.431 - }
338.432 -
338.433 - /** Performs simple test of Abbreviations
338.434 - * @param args the command line arguments
338.435 - */
338.436 - public static void main(String args[]) {
338.437 - AbbreviationsEditorOperator.addAbbreviation("Java Editor","aaa","All abbrev");
338.438 - /*try {
338.439 - //java.io.PrintWriter pw= new java.io.PrintWriter(new java.io.FileWriter("/tmp/abbrevs.java"));
338.440 - Map map=Abbreviations.listAbbreviations(java.util.ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("OPTIONS_java"));
338.441 - java.util.Iterator keys=map.keySet().iterator();
338.442 - String key;
338.443 - while (keys.hasNext()) {
338.444 - key=(String)(keys.next());
338.445 - System.out.println(key+" "+map.get(key));
338.446 - // pw.println("new Abbreviation(\""+key+"\", \""+map.get(key)+"\", \"\", \"\"),");
338.447 - }
338.448 - //pw.close();
338.449 - } catch (Exception ex) {
338.450 - ex.printStackTrace();
338.451 - }*/
338.452 - }
338.453 -}
338.454 -
339.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/AddKeybinding.java Thu Jul 10 04:29:52 2008 -0700
339.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
339.3 @@ -1,240 +0,0 @@
339.4 -/*
339.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
339.6 - *
339.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
339.8 - *
339.9 - * The contents of this file are subject to the terms of either the GNU
339.10 - * General Public License Version 2 only ("GPL") or the Common
339.11 - * Development and Distribution License("CDDL") (collectively, the
339.12 - * "License"). You may not use this file except in compliance with the
339.13 - * License. You can obtain a copy of the License at
339.14 - * http://www.netbeans.org/cddl-gplv2.html
339.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
339.16 - * specific language governing permissions and limitations under the
339.17 - * License. When distributing the software, include this License Header
339.18 - * Notice in each file and include the License file at
339.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
339.20 - * particular file as subject to the "Classpath" exception as provided
339.21 - * by Sun in the GPL Version 2 section of the License file that
339.22 - * accompanied this code. If applicable, add the following below the
339.23 - * License Header, with the fields enclosed by brackets [] replaced by
339.24 - * your own identifying information:
339.25 - * "Portions Copyrighted [year] [name of copyright owner]"
339.26 - *
339.27 - * Contributor(s):
339.28 - *
339.29 - * The Original Software is NetBeans. The Initial Developer of the Original
339.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
339.31 - * Microsystems, Inc. All Rights Reserved.
339.32 - *
339.33 - * If you wish your version of this file to be governed by only the CDDL
339.34 - * or only the GPL Version 2, indicate your decision by adding
339.35 - * "[Contributor] elects to include this software in this distribution
339.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
339.37 - * single choice of license, a recipient has the option to distribute
339.38 - * your version of this file under either the CDDL, the GPL Version 2 or
339.39 - * to extend the choice of license to its licensees as provided above.
339.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
339.41 - * Version 2 license, then the option applies only if the new code is
339.42 - * made subject to such option by the copyright holder.
339.43 - */
339.44 -
339.45 -/*
339.46 - * AddKeybinding.java
339.47 - *
339.48 - * Created on 10/17/02 12:54 PM
339.49 - */
339.50 -package org.netbeans.modules.visualweb.gravy.properties.editors;
339.51 -
339.52 -import org.netbeans.jemmy.operators.*;
339.53 -
339.54 -/** Class implementing all necessary methods for handling "Add Keybinding" NbDialog.
339.55 - */
339.56 -public class AddKeybinding extends JDialogOperator {
339.57 -
339.58 - /** Creates new AddKeybinding that can handle it.
339.59 - */
339.60 - public AddKeybinding() {
339.61 - super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("MSP_AddTitle"));
339.62 - }
339.63 -
339.64 - private JLabelOperator _lblShortcutSequence;
339.65 - private JTextFieldOperator _txtShortcutSequence;
339.66 - private JTextAreaOperator _txtJTextArea;
339.67 - private JButtonOperator _btOK;
339.68 - private JButtonOperator _btClear;
339.69 - private JButtonOperator _btCancel;
339.70 - private JButtonOperator _btHelp;
339.71 -
339.72 -
339.73 - //******************************
339.74 - // Subcomponents definition part
339.75 - //******************************
339.76 -
339.77 - /** Tries to find "Shortcut Sequence:" JLabel in this dialog.
339.78 - * @return JLabelOperator
339.79 - */
339.80 - public JLabelOperator lblShortcutSequence() {
339.81 - if (_lblShortcutSequence==null) {
339.82 - _lblShortcutSequence = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("LBL_KSIP_Sequence"));
339.83 - }
339.84 - return _lblShortcutSequence;
339.85 - }
339.86 -
339.87 - /** Tries to find null JTextField in this dialog.
339.88 - * @return JTextFieldOperator
339.89 - */
339.90 - public JTextFieldOperator txtShortcutSequence() {
339.91 - if (_txtShortcutSequence==null) {
339.92 - _txtShortcutSequence = new JTextFieldOperator(this);
339.93 - }
339.94 - return _txtShortcutSequence;
339.95 - }
339.96 -
339.97 - /** Tries to find null JTextArea in this dialog.
339.98 - * @return JTextAreaOperator
339.99 - */
339.100 - public JTextAreaOperator txtJTextArea() {
339.101 - if (_txtJTextArea==null) {
339.102 - _txtJTextArea = new JTextAreaOperator(this);
339.103 - }
339.104 - return _txtJTextArea;
339.105 - }
339.106 -
339.107 - /** Tries to find "OK" JButton in this dialog.
339.108 - * @return JButtonOperator
339.109 - */
339.110 - public JButtonOperator btOK() {
339.111 - if (_btOK==null) {
339.112 - _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
339.113 - }
339.114 - return _btOK;
339.115 - }
339.116 -
339.117 - /** Tries to find "Clear" JButton in this dialog.
339.118 - * @return JButtonOperator
339.119 - */
339.120 - public JButtonOperator btClear() {
339.121 - if (_btClear==null) {
339.122 - _btClear = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_CLEAR_LABEL"));
339.123 - }
339.124 - return _btClear;
339.125 - }
339.126 -
339.127 - /** Tries to find "Cancel" JButton in this dialog.
339.128 - * @return JButtonOperator
339.129 - */
339.130 - public JButtonOperator btCancel() {
339.131 - if (_btCancel==null) {
339.132 - _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
339.133 - }
339.134 - return _btCancel;
339.135 - }
339.136 -
339.137 - /** Tries to find "Help" JButton in this dialog.
339.138 - * @return JButtonOperator
339.139 - */
339.140 - public JButtonOperator btHelp() {
339.141 - if (_btHelp==null) {
339.142 - _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
339.143 - }
339.144 - return _btHelp;
339.145 - }
339.146 -
339.147 -
339.148 - //****************************************
339.149 - // Low-level functionality definition part
339.150 - //****************************************
339.151 -
339.152 - /** gets text for txtShortcutSequence
339.153 - * @return String text
339.154 - */
339.155 - public String getShortcutSequence() {
339.156 - return txtShortcutSequence().getText();
339.157 - }
339.158 -
339.159 - /** sets text for txtShortcutSequence
339.160 - * @param text String text
339.161 - */
339.162 - public void setShortcutSequence(String text) {
339.163 - txtShortcutSequence().setText(text);
339.164 - }
339.165 -
339.166 - /** types text for txtShortcutSequence
339.167 - * @param text String text
339.168 - */
339.169 - public void typeShortcutSequence(String text) {
339.170 - txtShortcutSequence().typeText(text);
339.171 - }
339.172 -
339.173 - /** gets text for txtJTextArea
339.174 - * @return String text
339.175 - */
339.176 - public String getJTextArea() {
339.177 - return txtJTextArea().getText();
339.178 - }
339.179 -
339.180 - /** sets text for txtJTextArea
339.181 - * @param text String text
339.182 - */
339.183 - public void setJTextArea(String text) {
339.184 - txtJTextArea().setText(text);
339.185 - }
339.186 -
339.187 - /** types text for txtJTextArea
339.188 - * @param text String text
339.189 - */
339.190 - public void typeJTextArea(String text) {
339.191 - txtJTextArea().typeText(text);
339.192 - }
339.193 -
339.194 - /** clicks on "OK" JButton
339.195 - */
339.196 - public void oK() {
339.197 - btOK().push();
339.198 - }
339.199 -
339.200 - /** clicks on "Clear" JButton
339.201 - */
339.202 - public void clear() {
339.203 - btClear().push();
339.204 - }
339.205 -
339.206 - /** clicks on "Cancel" JButton
339.207 - */
339.208 - public void cancel() {
339.209 - btCancel().push();
339.210 - }
339.211 -
339.212 - /** clicks on "Help" JButton
339.213 - */
339.214 - public void help() {
339.215 - btHelp().push();
339.216 - }
339.217 -
339.218 -
339.219 - //*****************************************
339.220 - // High-level functionality definition part
339.221 - //*****************************************
339.222 -
339.223 - /** Performs verification of AddKeybinding by accessing all its components.
339.224 - */
339.225 - public void verify() {
339.226 - lblShortcutSequence();
339.227 - txtShortcutSequence();
339.228 - txtJTextArea();
339.229 - btOK();
339.230 - btClear();
339.231 - btCancel();
339.232 - btHelp();
339.233 - }
339.234 -
339.235 - /** Performs simple test of AddKeybinding
339.236 - * @param args the command line arguments
339.237 - */
339.238 - public static void main(String args[]) {
339.239 - new AddKeybinding().verify();
339.240 - System.out.println("AddKeybinding verification finished.");
339.241 - }
339.242 -}
339.243 -
340.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ClasspathCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
340.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
340.3 @@ -1,294 +0,0 @@
340.4 -/*
340.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
340.6 - *
340.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
340.8 - *
340.9 - * The contents of this file are subject to the terms of either the GNU
340.10 - * General Public License Version 2 only ("GPL") or the Common
340.11 - * Development and Distribution License("CDDL") (collectively, the
340.12 - * "License"). You may not use this file except in compliance with the
340.13 - * License. You can obtain a copy of the License at
340.14 - * http://www.netbeans.org/cddl-gplv2.html
340.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
340.16 - * specific language governing permissions and limitations under the
340.17 - * License. When distributing the software, include this License Header
340.18 - * Notice in each file and include the License file at
340.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
340.20 - * particular file as subject to the "Classpath" exception as provided
340.21 - * by Sun in the GPL Version 2 section of the License file that
340.22 - * accompanied this code. If applicable, add the following below the
340.23 - * License Header, with the fields enclosed by brackets [] replaced by
340.24 - * your own identifying information:
340.25 - * "Portions Copyrighted [year] [name of copyright owner]"
340.26 - *
340.27 - * Contributor(s):
340.28 - *
340.29 - * The Original Software is NetBeans. The Initial Developer of the Original
340.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
340.31 - * Microsystems, Inc. All Rights Reserved.
340.32 - *
340.33 - * If you wish your version of this file to be governed by only the CDDL
340.34 - * or only the GPL Version 2, indicate your decision by adding
340.35 - * "[Contributor] elects to include this software in this distribution
340.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
340.37 - * single choice of license, a recipient has the option to distribute
340.38 - * your version of this file under either the CDDL, the GPL Version 2 or
340.39 - * to extend the choice of license to its licensees as provided above.
340.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
340.41 - * Version 2 license, then the option applies only if the new code is
340.42 - * made subject to such option by the copyright holder.
340.43 - */
340.44 -
340.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
340.46 -
340.47 -import java.io.File;
340.48 -/*
340.49 - * ClasspathCustomEditorOperator.java
340.50 - *
340.51 - * Created on 6/13/02 4:40 PM
340.52 - */
340.53 -
340.54 -import java.util.ArrayList;
340.55 -import javax.swing.JDialog;
340.56 -import javax.swing.ListModel;
340.57 -import org.netbeans.jellytools.Bundle;
340.58 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
340.59 -import org.netbeans.jemmy.operators.*;
340.60 -
340.61 -/** Class implementing all necessary methods for handling Classpath Custom Editor
340.62 - */
340.63 -public class ClasspathCustomEditorOperator extends NbDialogOperator {
340.64 -
340.65 - /** Creates new ClasspathCustomEditorOperator
340.66 - * @throws TimeoutExpiredException when NbDialog not found
340.67 - * @param title String title of custom editor */
340.68 - public ClasspathCustomEditorOperator(String title) {
340.69 - super(title);
340.70 - }
340.71 -
340.72 - /** Creates new ClasspathCustomEditorOperator
340.73 - * @param wrapper JDialogOperator wrapper for custom editor */
340.74 - public ClasspathCustomEditorOperator(JDialogOperator wrapper) {
340.75 - super((JDialog)wrapper.getSource());
340.76 - }
340.77 -
340.78 - private JButtonOperator _btAddDirectory;
340.79 - private JButtonOperator _btMoveDown;
340.80 - private JListOperator _lstClasspath;
340.81 - private JButtonOperator _btAddJARZIP;
340.82 - private JButtonOperator _btRemove;
340.83 - private JButtonOperator _btMoveUp;
340.84 -
340.85 -
340.86 - /** Tries to find Add Directory... JButton in this dialog.
340.87 - * @throws TimeoutExpiredException when component not found
340.88 - * @return JButtonOperator
340.89 - */
340.90 - public JButtonOperator btAddDirectory() {
340.91 - if (_btAddDirectory==null) {
340.92 - _btAddDirectory = new JButtonOperator(this, Bundle.getString(
340.93 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.94 - "CTL_AddDirectory"));
340.95 - }
340.96 - return _btAddDirectory;
340.97 - }
340.98 -
340.99 - /** Tries to find "Move Down" JButton in this dialog.
340.100 - * @throws TimeoutExpiredException when component not found
340.101 - * @return JButtonOperator
340.102 - */
340.103 - public JButtonOperator btMoveDown() {
340.104 - if (_btMoveDown==null) {
340.105 - _btMoveDown = new JButtonOperator(this, Bundle.getString(
340.106 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.107 - "CTL_MoveDown"));
340.108 - }
340.109 - return _btMoveDown;
340.110 - }
340.111 -
340.112 - /** Tries to find null JList in this dialog.
340.113 - * @throws TimeoutExpiredException when component not found
340.114 - * @return JListOperator
340.115 - */
340.116 - public JListOperator lstClasspath() {
340.117 - if (_lstClasspath==null) {
340.118 - _lstClasspath = new JListOperator(this);
340.119 - }
340.120 - return _lstClasspath;
340.121 - }
340.122 -
340.123 - /** Tries to find Add JAR/ZIP... JButton in this dialog.
340.124 - * @throws TimeoutExpiredException when component not found
340.125 - * @return JButtonOperator
340.126 - */
340.127 - public JButtonOperator btAddJARZIP() {
340.128 - if (_btAddJARZIP==null) {
340.129 - _btAddJARZIP = new JButtonOperator(this, Bundle.getString(
340.130 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.131 - "CTL_AddJAR"));
340.132 - }
340.133 - return _btAddJARZIP;
340.134 - }
340.135 -
340.136 - /** Tries to find "Remove" JButton in this dialog.
340.137 - * @throws TimeoutExpiredException when component not found
340.138 - * @return JButtonOperator
340.139 - */
340.140 - public JButtonOperator btRemove() {
340.141 - if (_btRemove==null) {
340.142 - _btRemove = new JButtonOperator(this, Bundle.getString(
340.143 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.144 - "CTL_Remove"));
340.145 - }
340.146 - return _btRemove;
340.147 - }
340.148 -
340.149 - /** Tries to find "Move Up" JButton in this dialog.
340.150 - * @throws TimeoutExpiredException when component not found
340.151 - * @return JButtonOperator
340.152 - */
340.153 - public JButtonOperator btMoveUp() {
340.154 - if (_btMoveUp==null) {
340.155 - _btMoveUp = new JButtonOperator(this, Bundle.getString(
340.156 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.157 - "CTL_MoveUp"));
340.158 - }
340.159 - return _btMoveUp;
340.160 - }
340.161 -
340.162 - /** clicks on Add Directory... JButton
340.163 - * @throws TimeoutExpiredException when JButton not found
340.164 - * @return FileCustomEditorOperator of directory selector */
340.165 - public FileCustomEditorOperator addDirectory() {
340.166 - btAddDirectory().pushNoBlock();
340.167 - return new FileCustomEditorOperator(Bundle.getString(
340.168 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.169 - "CTL_FileSystemPanel.Local_Dialog_Title"));
340.170 - }
340.171 -
340.172 - /** clicks on "Move Down" JButton
340.173 - * @throws TimeoutExpiredException when JButton not found
340.174 - */
340.175 - public void moveDown() {
340.176 - btMoveDown().push();
340.177 - }
340.178 -
340.179 - /** clicks on Add JAR/ZIP... JButton
340.180 - * @throws TimeoutExpiredException when JButton not found
340.181 - * @return FileCustomEditorOperator of JAR or ZIP file selector */
340.182 - public FileCustomEditorOperator addJARZIP() {
340.183 - btAddJARZIP().pushNoBlock();
340.184 - return new FileCustomEditorOperator(Bundle.getString(
340.185 - "org.netbeans.core.execution.beaninfo.editors.Bundle",
340.186 - "CTL_FileSystemPanel.Jar_Dialog_Title"));
340.187 - }
340.188 -
340.189 - /** adds directory into classpath list
340.190 - * @param directoryPath String directory path to be added */
340.191 - public void addDirectory(String directoryPath) {
340.192 - FileCustomEditorOperator editor=addDirectory();
340.193 - editor.setFileValue(directoryPath);
340.194 - editor.ok();
340.195 - }
340.196 -
340.197 - /** adds JAR or ZIP file into classpath list
340.198 - * @param filePath String path of JAR or ZIP file to be added */
340.199 - public void addJARZIP(String filePath) {
340.200 - FileCustomEditorOperator editor=addJARZIP();
340.201 - editor.setFileValue(filePath);
340.202 - editor.ok();
340.203 - }
340.204 -
340.205 - /** adds directory into classpath list
340.206 - * @param directory File directory to be added */
340.207 - public void addDirectory(File directory) {
340.208 - FileCustomEditorOperator editor=addDirectory();
340.209 - editor.setFileValue(directory);
340.210 - editor.ok();
340.211 - }
340.212 -
340.213 - /** adds JAR or ZIP file into classpath list
340.214 - * @param jarZip File JAR or ZIP to be added */
340.215 - public void addJARZIP(File jarZip) {
340.216 - FileCustomEditorOperator editor=addJARZIP();
340.217 - editor.setFileValue(jarZip);
340.218 - editor.ok();
340.219 - }
340.220 -
340.221 - /** sets complete classpath in custom editor
340.222 - * @param classPathElements File[] array of directories or JAR or ZIP files
340.223 - * to be included in classapth */
340.224 - public void setClasspathValue(File[] classPathElements) {
340.225 - removeAll();
340.226 - for (int i=0; i<classPathElements.length; i++) {
340.227 - if (classPathElements[i].isFile())
340.228 - addJARZIP(classPathElements[i]);
340.229 - else
340.230 - addDirectory(classPathElements[i]);
340.231 - }
340.232 - }
340.233 -
340.234 - /** sets complete classpath in custom editor
340.235 - * @param classPathElements String[] array of paths of directories or JAR
340.236 - * or ZIP files to be included in classapth */
340.237 - public void setClasspathValue(String[] classPathElements) {
340.238 - removeAll();
340.239 - for (int i=0; i<classPathElements.length; i++) {
340.240 - String lower=classPathElements[i].toLowerCase();
340.241 - if (lower.endsWith(".jar")||lower.endsWith(".zip"))
340.242 - addJARZIP(classPathElements[i]);
340.243 - else
340.244 - addDirectory(classPathElements[i]);
340.245 - }
340.246 - }
340.247 -
340.248 - /** clicks on "Remove" JButton
340.249 - * @throws TimeoutExpiredException when JButton not found
340.250 - */
340.251 - public void remove() {
340.252 - btRemove().push();
340.253 - }
340.254 -
340.255 - /** clicks on "Move Up" JButton
340.256 - * @throws TimeoutExpiredException when JButton not found
340.257 - */
340.258 - public void moveUp() {
340.259 - btMoveUp().push();
340.260 - }
340.261 -
340.262 - /** removes given item from classpath
340.263 - * @param value String item to be removed */
340.264 - public void remove(String value) {
340.265 - lstClasspath().selectItem(value);
340.266 - remove();
340.267 - }
340.268 -
340.269 - /** removes complete classpath */
340.270 - public void removeAll() {
340.271 - while (lstClasspath().getModel().getSize()>0) {
340.272 - lstClasspath().selectItem(0);
340.273 - remove();
340.274 - }
340.275 - }
340.276 -
340.277 - /** returns complete class path from editor
340.278 - * @return String[] class paths */
340.279 - public String[] getClasspathValue() {
340.280 - ArrayList data=new ArrayList();
340.281 - ListModel model=lstClasspath().getModel();
340.282 - for (int i=0; i<model.getSize(); i++)
340.283 - data.add(model.getElementAt(i).toString());
340.284 - return (String[])data.toArray(new String[data.size()]);
340.285 - }
340.286 -
340.287 - /** Performs verification by accessing all sub-components */
340.288 - public void verify() {
340.289 - btAddDirectory();
340.290 - btAddJARZIP();
340.291 - btMoveDown();
340.292 - btMoveUp();
340.293 - btRemove();
340.294 - lstClasspath();
340.295 - }
340.296 -}
340.297 -
341.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ColorCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
341.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
341.3 @@ -1,106 +0,0 @@
341.4 -/*
341.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
341.6 - *
341.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
341.8 - *
341.9 - * The contents of this file are subject to the terms of either the GNU
341.10 - * General Public License Version 2 only ("GPL") or the Common
341.11 - * Development and Distribution License("CDDL") (collectively, the
341.12 - * "License"). You may not use this file except in compliance with the
341.13 - * License. You can obtain a copy of the License at
341.14 - * http://www.netbeans.org/cddl-gplv2.html
341.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
341.16 - * specific language governing permissions and limitations under the
341.17 - * License. When distributing the software, include this License Header
341.18 - * Notice in each file and include the License file at
341.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
341.20 - * particular file as subject to the "Classpath" exception as provided
341.21 - * by Sun in the GPL Version 2 section of the License file that
341.22 - * accompanied this code. If applicable, add the following below the
341.23 - * License Header, with the fields enclosed by brackets [] replaced by
341.24 - * your own identifying information:
341.25 - * "Portions Copyrighted [year] [name of copyright owner]"
341.26 - *
341.27 - * Contributor(s):
341.28 - *
341.29 - * The Original Software is NetBeans. The Initial Developer of the Original
341.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
341.31 - * Microsystems, Inc. All Rights Reserved.
341.32 - *
341.33 - * If you wish your version of this file to be governed by only the CDDL
341.34 - * or only the GPL Version 2, indicate your decision by adding
341.35 - * "[Contributor] elects to include this software in this distribution
341.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
341.37 - * single choice of license, a recipient has the option to distribute
341.38 - * your version of this file under either the CDDL, the GPL Version 2 or
341.39 - * to extend the choice of license to its licensees as provided above.
341.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
341.41 - * Version 2 license, then the option applies only if the new code is
341.42 - * made subject to such option by the copyright holder.
341.43 - */
341.44 -
341.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
341.46 -
341.47 -/*
341.48 - * ColorCustomEditorOperator.java
341.49 - *
341.50 - * Created on June 13, 2002, 4:01 PM
341.51 - */
341.52 -
341.53 -import java.awt.Color;
341.54 -import javax.swing.JDialog;
341.55 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
341.56 -import org.netbeans.jemmy.operators.*;
341.57 -
341.58 -/** Class implementing all necessary methods for handling Color Custom Editor
341.59 - */
341.60 -public class ColorCustomEditorOperator extends NbDialogOperator {
341.61 -
341.62 - private JColorChooserOperator _colorChooser=null;
341.63 -
341.64 - /** Creates a new instance of FileCustomEditorOperator
341.65 - * @param title String title of custom editor */
341.66 - public ColorCustomEditorOperator(String title) {
341.67 - super(title);
341.68 - }
341.69 -
341.70 - /** Creates a new instance of FileCustomEditorOperator
341.71 - * @param wrapper JDialogOperator wrapper for custom editor */
341.72 - public ColorCustomEditorOperator(JDialogOperator wrapper) {
341.73 - super((JDialog)wrapper.getSource());
341.74 - }
341.75 -
341.76 - /** locates and returns JColorChooserOperator
341.77 - * @return JColorChooserOperator */
341.78 - public JColorChooserOperator colorChooser() {
341.79 - if (_colorChooser==null) {
341.80 - _colorChooser=new JColorChooserOperator(this);
341.81 - }
341.82 - return _colorChooser;
341.83 - }
341.84 -
341.85 - /** returns edited color
341.86 - * @return Color */
341.87 - public Color getColorValue() {
341.88 - return colorChooser().getColor();
341.89 - }
341.90 -
341.91 - /** sets edited color
341.92 - * @param color Color */
341.93 - public void setColorValue(Color color) {
341.94 - colorChooser().setColor(color);
341.95 - }
341.96 -
341.97 - /** sets edited color
341.98 - * @param r int red
341.99 - * @param g int green
341.100 - * @param b int blue */
341.101 - public void setRGBValue(int r, int g, int b) {
341.102 - colorChooser().setColor(r, g, b);
341.103 - }
341.104 -
341.105 - /** Performs verification by accessing all sub-components */
341.106 - public void verify() {
341.107 - colorChooser();
341.108 - }
341.109 -}
342.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/DimensionCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
342.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
342.3 @@ -1,124 +0,0 @@
342.4 -/*
342.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
342.6 - *
342.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
342.8 - *
342.9 - * The contents of this file are subject to the terms of either the GNU
342.10 - * General Public License Version 2 only ("GPL") or the Common
342.11 - * Development and Distribution License("CDDL") (collectively, the
342.12 - * "License"). You may not use this file except in compliance with the
342.13 - * License. You can obtain a copy of the License at
342.14 - * http://www.netbeans.org/cddl-gplv2.html
342.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
342.16 - * specific language governing permissions and limitations under the
342.17 - * License. When distributing the software, include this License Header
342.18 - * Notice in each file and include the License file at
342.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
342.20 - * particular file as subject to the "Classpath" exception as provided
342.21 - * by Sun in the GPL Version 2 section of the License file that
342.22 - * accompanied this code. If applicable, add the following below the
342.23 - * License Header, with the fields enclosed by brackets [] replaced by
342.24 - * your own identifying information:
342.25 - * "Portions Copyrighted [year] [name of copyright owner]"
342.26 - *
342.27 - * Contributor(s):
342.28 - *
342.29 - * The Original Software is NetBeans. The Initial Developer of the Original
342.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
342.31 - * Microsystems, Inc. All Rights Reserved.
342.32 - *
342.33 - * If you wish your version of this file to be governed by only the CDDL
342.34 - * or only the GPL Version 2, indicate your decision by adding
342.35 - * "[Contributor] elects to include this software in this distribution
342.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
342.37 - * single choice of license, a recipient has the option to distribute
342.38 - * your version of this file under either the CDDL, the GPL Version 2 or
342.39 - * to extend the choice of license to its licensees as provided above.
342.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
342.41 - * Version 2 license, then the option applies only if the new code is
342.42 - * made subject to such option by the copyright holder.
342.43 - */
342.44 -
342.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
342.46 -
342.47 -import javax.swing.JDialog;
342.48 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
342.49 -import org.netbeans.jemmy.JemmyException;
342.50 -import org.netbeans.jemmy.operators.*;
342.51 -
342.52 -// editor for Dimension
342.53 -/** Class implementing all necessary methods for handling Dimension Custom Editor */
342.54 -public class DimensionCustomEditorOperator extends NbDialogOperator {
342.55 -
342.56 - JTextFieldOperator _txtFieldWidth;
342.57 - JTextFieldOperator _txtFieldHeight;
342.58 -
342.59 - /** Creates a new instance of DimensionCustomEditorOperator
342.60 - * @param title String title of custom editor */
342.61 - public DimensionCustomEditorOperator(String title) {
342.62 - super(title);
342.63 - }
342.64 -
342.65 - /** Creates a new instance of DimensionCustomEditorOperator
342.66 - * @param wrapper JDialogOperator wrapper for custom editor */
342.67 - public DimensionCustomEditorOperator(JDialogOperator wrapper) {
342.68 - super((JDialog)wrapper.getSource());
342.69 - }
342.70 -
342.71 - /** sets dimension value
342.72 - * @param width int width
342.73 - * @param height int height */
342.74 - public void setDimensionValue(String width, String height) {
342.75 - txtFieldWidth().setText(width);
342.76 - txtFieldHeight().setText(height);
342.77 - }
342.78 -
342.79 - /** returns width value
342.80 - * @return ind width */
342.81 - public String getWidthValue() {
342.82 - return txtFieldWidth().getText();
342.83 - }
342.84 -
342.85 - /** sets width value
342.86 - * @param value int width */
342.87 - public void setWidthValue(String value) {
342.88 - txtFieldWidth().setText(value);
342.89 - }
342.90 -
342.91 - /** returns height value
342.92 - * @return int height */
342.93 - public String getHeightValue() {
342.94 - return txtFieldHeight().getText();
342.95 - }
342.96 -
342.97 - /** sets height value
342.98 - * @param value int height */
342.99 - public void setHeightValue(String value) {
342.100 - txtFieldHeight().setText(value);
342.101 - }
342.102 -
342.103 - /** getter for height text field operator
342.104 - * @return JTextFieldOperator */
342.105 - public JTextFieldOperator txtFieldWidth() {
342.106 - if(_txtFieldWidth==null) {
342.107 - _txtFieldWidth = new JTextFieldOperator(this, 0);
342.108 - }
342.109 - return _txtFieldWidth;
342.110 - }
342.111 -
342.112 - /** getter for width text field operator
342.113 - * @return JTextFieldOperator */
342.114 - public JTextFieldOperator txtFieldHeight() {
342.115 - if(_txtFieldHeight==null) {
342.116 - _txtFieldHeight = new JTextFieldOperator(this, 1);
342.117 - }
342.118 - return _txtFieldHeight;
342.119 - }
342.120 -
342.121 - /** Performs verification by accessing all sub-components */
342.122 - public void verify() {
342.123 - txtFieldHeight();
342.124 - txtFieldWidth();
342.125 - }
342.126 -
342.127 -}
343.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/EnterAbbreviation.java Thu Jul 10 04:29:52 2008 -0700
343.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
343.3 @@ -1,250 +0,0 @@
343.4 -/*
343.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
343.6 - *
343.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
343.8 - *
343.9 - * The contents of this file are subject to the terms of either the GNU
343.10 - * General Public License Version 2 only ("GPL") or the Common
343.11 - * Development and Distribution License("CDDL") (collectively, the
343.12 - * "License"). You may not use this file except in compliance with the
343.13 - * License. You can obtain a copy of the License at
343.14 - * http://www.netbeans.org/cddl-gplv2.html
343.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
343.16 - * specific language governing permissions and limitations under the
343.17 - * License. When distributing the software, include this License Header
343.18 - * Notice in each file and include the License file at
343.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
343.20 - * particular file as subject to the "Classpath" exception as provided
343.21 - * by Sun in the GPL Version 2 section of the License file that
343.22 - * accompanied this code. If applicable, add the following below the
343.23 - * License Header, with the fields enclosed by brackets [] replaced by
343.24 - * your own identifying information:
343.25 - * "Portions Copyrighted [year] [name of copyright owner]"
343.26 - *
343.27 - * Contributor(s):
343.28 - *
343.29 - * The Original Software is NetBeans. The Initial Developer of the Original
343.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
343.31 - * Microsystems, Inc. All Rights Reserved.
343.32 - *
343.33 - * If you wish your version of this file to be governed by only the CDDL
343.34 - * or only the GPL Version 2, indicate your decision by adding
343.35 - * "[Contributor] elects to include this software in this distribution
343.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
343.37 - * single choice of license, a recipient has the option to distribute
343.38 - * your version of this file under either the CDDL, the GPL Version 2 or
343.39 - * to extend the choice of license to its licensees as provided above.
343.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
343.41 - * Version 2 license, then the option applies only if the new code is
343.42 - * made subject to such option by the copyright holder.
343.43 - */
343.44 -
343.45 -/*
343.46 - * EnterAbbreviation.java
343.47 - *
343.48 - * Created on 8/28/02 11:08 AM
343.49 - */
343.50 -package org.netbeans.modules.visualweb.gravy.properties.editors;
343.51 -
343.52 -import org.netbeans.jemmy.operators.*;
343.53 -
343.54 -/** Class implementing all necessary methods for handling "Enter Abbreviation" NbDialog.
343.55 - */
343.56 -public class EnterAbbreviation extends JDialogOperator {
343.57 -
343.58 - /** Creates new EnterAbbreviation that can handle it.
343.59 - */
343.60 - public EnterAbbreviation() {
343.61 - super(java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AEP_EnterAbbrev"));
343.62 - }
343.63 -
343.64 - private JLabelOperator _lblAbbreviation;
343.65 - private JTextFieldOperator _txtAbbreviation;
343.66 - private JLabelOperator _lblExpansion;
343.67 - private JTextAreaOperator _txtExpansion;
343.68 - private JButtonOperator _btOK;
343.69 - private JButtonOperator _btCancel;
343.70 - private JButtonOperator _btHelp;
343.71 -
343.72 -
343.73 - //******************************
343.74 - // Subcomponents definition part
343.75 - //******************************
343.76 -
343.77 - /** Tries to find "Abbreviation:" JLabel in this dialog.
343.78 - * @return JLabelOperator
343.79 - */
343.80 - public JLabelOperator lblAbbreviation() {
343.81 - if (_lblAbbreviation==null) {
343.82 - _lblAbbreviation = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AIP_Abbrev"));
343.83 - }
343.84 - return _lblAbbreviation;
343.85 - }
343.86 -
343.87 - /** Tries to find null JTextField in this dialog.
343.88 - * @return JTextFieldOperator
343.89 - */
343.90 - public JTextFieldOperator txtAbbreviation() {
343.91 - if (_txtAbbreviation==null) {
343.92 - _txtAbbreviation = new JTextFieldOperator(this);
343.93 - }
343.94 - return _txtAbbreviation;
343.95 - }
343.96 -
343.97 - /** Tries to find "Expansion:" JLabel in this dialog.
343.98 - * @return JLabelOperator
343.99 - */
343.100 - public JLabelOperator lblExpansion() {
343.101 - if (_lblExpansion==null) {
343.102 - _lblExpansion = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AIP_Expand"));
343.103 - }
343.104 - return _lblExpansion;
343.105 - }
343.106 -
343.107 - /** Tries to find null JTextArea in this dialog.
343.108 - * @return JTextAreaOperator
343.109 - */
343.110 - public JTextAreaOperator txtExpansion() {
343.111 - if (_txtExpansion==null) {
343.112 - _txtExpansion = new JTextAreaOperator(this);
343.113 - }
343.114 - return _txtExpansion;
343.115 - }
343.116 -
343.117 - /** Tries to find "OK" JButton in this dialog.
343.118 - * @return JButtonOperator
343.119 - */
343.120 - public JButtonOperator btOK() {
343.121 - if (_btOK==null) {
343.122 - _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
343.123 - }
343.124 - return _btOK;
343.125 - }
343.126 -
343.127 - /** Tries to find "Cancel" JButton in this dialog.
343.128 - * @return JButtonOperator
343.129 - */
343.130 - public JButtonOperator btCancel() {
343.131 - if (_btCancel==null) {
343.132 - _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
343.133 - }
343.134 - return _btCancel;
343.135 - }
343.136 -
343.137 - /** Tries to find "Help" JButton in this dialog.
343.138 - * @return JButtonOperator
343.139 - */
343.140 - public JButtonOperator btHelp() {
343.141 - if (_btHelp==null) {
343.142 - _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
343.143 - }
343.144 - return _btHelp;
343.145 - }
343.146 -
343.147 -
343.148 - //****************************************
343.149 - // Low-level functionality definition part
343.150 - //****************************************
343.151 -
343.152 - /** gets text for txtAbbreviation
343.153 - * @return String text
343.154 - */
343.155 - public String getAbbreviation() {
343.156 - return txtAbbreviation().getText();
343.157 - }
343.158 -
343.159 - /** sets text for txtAbbreviation
343.160 - * @param text String text
343.161 - */
343.162 - public void setAbbreviation(String text) {
343.163 - txtAbbreviation().setText(text);
343.164 - }
343.165 -
343.166 - /** types text for txtAbbreviation
343.167 - * @param text String text
343.168 - */
343.169 - public void typeAbbreviation(String text) {
343.170 - txtAbbreviation().typeText(text);
343.171 - }
343.172 -
343.173 - /** gets text for txtExpansion
343.174 - * @return String text
343.175 - */
343.176 - public String getExpansion() {
343.177 - return txtExpansion().getText();
343.178 - }
343.179 -
343.180 - /** sets text for txtExpansion
343.181 - * @param text String text
343.182 - */
343.183 - public void setExpansion(String text) {
343.184 - txtExpansion().setText(text);
343.185 - }
343.186 -
343.187 - /** types text for txtExpansion
343.188 - * @param text String text
343.189 - */
343.190 - public void typeExpansion(String text) {
343.191 - txtExpansion().typeText(text);
343.192 - }
343.193 -
343.194 - /** clicks on "OK" JButton
343.195 - */
343.196 - public void oK() {
343.197 - btOK().push();
343.198 -
343.199 - try {
343.200 - Thread.sleep(2000);
343.201 - } catch (InterruptedException e) {
343.202 - e.printStackTrace(System.err);
343.203 - }
343.204 - }
343.205 -
343.206 - /** clicks on "Cancel" JButton
343.207 - */
343.208 - public void cancel() {
343.209 - btCancel().push();
343.210 - }
343.211 -
343.212 - /** clicks on "Help" JButton
343.213 - */
343.214 - public void help() {
343.215 - btHelp().push();
343.216 - }
343.217 -
343.218 -
343.219 - //*****************************************
343.220 - // High-level functionality definition part
343.221 - //*****************************************
343.222 -
343.223 - /** Performs verification of EnterAbbreviation by accessing all its components.
343.224 - */
343.225 - public void verify() {
343.226 - lblAbbreviation();
343.227 - txtAbbreviation();
343.228 - lblExpansion();
343.229 - txtExpansion();
343.230 - btOK();
343.231 - btCancel();
343.232 - btHelp();
343.233 - }
343.234 -
343.235 - public void fillAbbreviation(String abbreviation, String expansion) {
343.236 - if (!"".equals(txtAbbreviation().getText()))
343.237 - txtAbbreviation().clearText();
343.238 - typeAbbreviation(abbreviation);
343.239 -
343.240 - if (!"".equals(txtExpansion().getText()))
343.241 - txtExpansion().clearText();
343.242 - typeExpansion(expansion);
343.243 - }
343.244 -
343.245 - /** Performs simple test of EnterAbbreviation
343.246 - * @param args the command line arguments
343.247 - */
343.248 - public static void main(String args[]) {
343.249 - new EnterAbbreviation().verify();
343.250 - System.out.println("EnterAbbreviation verification finished.");
343.251 - }
343.252 -}
343.253 -
344.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FileCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
344.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
344.3 @@ -1,113 +0,0 @@
344.4 -/*
344.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
344.6 - *
344.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
344.8 - *
344.9 - * The contents of this file are subject to the terms of either the GNU
344.10 - * General Public License Version 2 only ("GPL") or the Common
344.11 - * Development and Distribution License("CDDL") (collectively, the
344.12 - * "License"). You may not use this file except in compliance with the
344.13 - * License. You can obtain a copy of the License at
344.14 - * http://www.netbeans.org/cddl-gplv2.html
344.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
344.16 - * specific language governing permissions and limitations under the
344.17 - * License. When distributing the software, include this License Header
344.18 - * Notice in each file and include the License file at
344.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
344.20 - * particular file as subject to the "Classpath" exception as provided
344.21 - * by Sun in the GPL Version 2 section of the License file that
344.22 - * accompanied this code. If applicable, add the following below the
344.23 - * License Header, with the fields enclosed by brackets [] replaced by
344.24 - * your own identifying information:
344.25 - * "Portions Copyrighted [year] [name of copyright owner]"
344.26 - *
344.27 - * Contributor(s):
344.28 - *
344.29 - * The Original Software is NetBeans. The Initial Developer of the Original
344.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
344.31 - * Microsystems, Inc. All Rights Reserved.
344.32 - *
344.33 - * If you wish your version of this file to be governed by only the CDDL
344.34 - * or only the GPL Version 2, indicate your decision by adding
344.35 - * "[Contributor] elects to include this software in this distribution
344.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
344.37 - * single choice of license, a recipient has the option to distribute
344.38 - * your version of this file under either the CDDL, the GPL Version 2 or
344.39 - * to extend the choice of license to its licensees as provided above.
344.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
344.41 - * Version 2 license, then the option applies only if the new code is
344.42 - * made subject to such option by the copyright holder.
344.43 - */
344.44 -
344.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
344.46 -
344.47 -/*
344.48 - * FileCustomEditorOperator.java
344.49 - *
344.50 - * Created on June 13, 2002, 4:01 PM
344.51 - */
344.52 -
344.53 -import java.io.File;
344.54 -import javax.swing.JDialog;
344.55 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
344.56 -import org.netbeans.jemmy.operators.*;
344.57 -
344.58 -/** Class implementing all necessary methods for handling File Custom Editor
344.59 - */
344.60 -public class FileCustomEditorOperator extends NbDialogOperator {
344.61 -
344.62 - private JFileChooserOperator _fileChooser=null;
344.63 -
344.64 - /** Creates a new instance of FileCustomEditorOperator
344.65 - * @param title String title of custom editor */
344.66 - public FileCustomEditorOperator(String title) {
344.67 - super(title);
344.68 - }
344.69 -
344.70 - /** Creates a new instance of FileCustomEditorOperator
344.71 - * @param wrapper JDialogOperator wrapper for custom editor */
344.72 - public FileCustomEditorOperator(JDialogOperator wrapper) {
344.73 - super((JDialog)wrapper.getSource());
344.74 - }
344.75 -
344.76 - /** getter for JFileChooserOperator
344.77 - * @return JFileChooserOperator */
344.78 - public JFileChooserOperator fileChooser() {
344.79 - if (_fileChooser==null) {
344.80 - _fileChooser=new JFileChooserOperator(this);
344.81 - }
344.82 - return _fileChooser;
344.83 - }
344.84 -
344.85 - /** returns edited file
344.86 - * @return File */
344.87 - public File getFileValue() {
344.88 - return fileChooser().getSelectedFile();
344.89 - }
344.90 -
344.91 - /** sets edited file
344.92 - * @param file File */
344.93 - public void setFileValue(File file) {
344.94 - // Need to go from parent to file because events are not fired when
344.95 - // only setSelectedFile(file) is used.
344.96 - // select parent directory
344.97 - fileChooser().setSelectedFile(file.getParentFile());
344.98 - // go into dir
344.99 - fileChooser().enterSubDir(file.getParentFile().getName());
344.100 - // wait file is displayed
344.101 - fileChooser().waitFileDisplayed(file.getName());
344.102 - // select file
344.103 - fileChooser().selectFile(file.getName());
344.104 - }
344.105 -
344.106 - /** sets edited file
344.107 - * @param fileName String file name */
344.108 - public void setFileValue(String fileName) {
344.109 - setFileValue(new File(fileName));
344.110 - }
344.111 -
344.112 - /** Performs verification by accessing all sub-components */
344.113 - public void verify() {
344.114 - fileChooser();
344.115 - }
344.116 -}
345.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FilesystemCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
345.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
345.3 @@ -1,286 +0,0 @@
345.4 -/*
345.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
345.6 - *
345.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
345.8 - *
345.9 - * The contents of this file are subject to the terms of either the GNU
345.10 - * General Public License Version 2 only ("GPL") or the Common
345.11 - * Development and Distribution License("CDDL") (collectively, the
345.12 - * "License"). You may not use this file except in compliance with the
345.13 - * License. You can obtain a copy of the License at
345.14 - * http://www.netbeans.org/cddl-gplv2.html
345.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
345.16 - * specific language governing permissions and limitations under the
345.17 - * License. When distributing the software, include this License Header
345.18 - * Notice in each file and include the License file at
345.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
345.20 - * particular file as subject to the "Classpath" exception as provided
345.21 - * by Sun in the GPL Version 2 section of the License file that
345.22 - * accompanied this code. If applicable, add the following below the
345.23 - * License Header, with the fields enclosed by brackets [] replaced by
345.24 - * your own identifying information:
345.25 - * "Portions Copyrighted [year] [name of copyright owner]"
345.26 - *
345.27 - * Contributor(s):
345.28 - *
345.29 - * The Original Software is NetBeans. The Initial Developer of the Original
345.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
345.31 - * Microsystems, Inc. All Rights Reserved.
345.32 - *
345.33 - * If you wish your version of this file to be governed by only the CDDL
345.34 - * or only the GPL Version 2, indicate your decision by adding
345.35 - * "[Contributor] elects to include this software in this distribution
345.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
345.37 - * single choice of license, a recipient has the option to distribute
345.38 - * your version of this file under either the CDDL, the GPL Version 2 or
345.39 - * to extend the choice of license to its licensees as provided above.
345.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
345.41 - * Version 2 license, then the option applies only if the new code is
345.42 - * made subject to such option by the copyright holder.
345.43 - */
345.44 -
345.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
345.46 -
345.47 -import javax.swing.JDialog;
345.48 -import org.netbeans.jellytools.Bundle;
345.49 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
345.50 -import org.netbeans.jemmy.operators.*;
345.51 -import org.netbeans.jemmy.operators.JDialogOperator;
345.52 -
345.53 -/** Class implementing all necessary methods for handling FileSystem Custom Editor.
345.54 - * It is editor for bean org.openide.filesystems.FileSystem.
345.55 - */
345.56 -public class FilesystemCustomEditorOperator extends NbDialogOperator {
345.57 -
345.58 - /** Creates new FilesystemCustomEditorOperator that can handle it.
345.59 - * Throws TimeoutExpiredException when NbDialog not found
345.60 - * @param title title of custom editor */
345.61 - public FilesystemCustomEditorOperator(String title) {
345.62 - super(title);
345.63 - }
345.64 -
345.65 - /** Creates new FilesytemCustomEditorOperator
345.66 - * @param wrapper JDialogOperator wrapper for custom editor */
345.67 - public FilesystemCustomEditorOperator(JDialogOperator wrapper) {
345.68 - super((JDialog)wrapper.getSource());
345.69 - }
345.70 -
345.71 - private JRadioButtonOperator _rbAddLocalDirectory;
345.72 - private JTextFieldOperator _txtDirectory;
345.73 - private JButtonOperator _btBrowse;
345.74 - private JRadioButtonOperator _rbAddJARFile;
345.75 - private JTextFieldOperator _txtJARFile;
345.76 - private JButtonOperator _btBrowse2;
345.77 - private JRadioButtonOperator _rbAddOtherFileSystemType;
345.78 - private JComboBoxOperator _cboType;
345.79 -
345.80 -
345.81 - //******************************
345.82 - // Subcomponents definition part
345.83 - //******************************
345.84 -
345.85 - /** Tries to find "Add Local Directory" JRadioButton in this dialog.
345.86 - * @return JRadioButtonOperator instance
345.87 - */
345.88 - public JRadioButtonOperator rbAddLocalDirectory() {
345.89 - if (_rbAddLocalDirectory==null) {
345.90 - _rbAddLocalDirectory = new JRadioButtonOperator(this,
345.91 - Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
345.92 - "CTL_FileSystemPanel.dirRadioButton.text"));
345.93 - }
345.94 - return _rbAddLocalDirectory;
345.95 - }
345.96 -
345.97 - /** Tries to find JTextField for Directory in this dialog.
345.98 - * @return JTextFieldOperator instance
345.99 - */
345.100 - public JTextFieldOperator txtDirectory() {
345.101 - if (_txtDirectory==null) {
345.102 - _txtDirectory = new JTextFieldOperator(this);
345.103 - }
345.104 - return _txtDirectory;
345.105 - }
345.106 -
345.107 - /** Tries to find "Browse" JButton to select Directory in this dialog.
345.108 - * @return JButtonOperator instance
345.109 - */
345.110 - public JButtonOperator btBrowse() {
345.111 - if (_btBrowse==null) {
345.112 - _btBrowse = new JButtonOperator(this,
345.113 - Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
345.114 - "CTL_FileSystemPanel.browseDirButton.text"));
345.115 - }
345.116 - return _btBrowse;
345.117 - }
345.118 -
345.119 - /** Tries to find "Add JAR File" JRadioButton in this dialog.
345.120 - * @return JRadioButtonOperator instance
345.121 - */
345.122 - public JRadioButtonOperator rbAddJARFile() {
345.123 - if (_rbAddJARFile==null) {
345.124 - _rbAddJARFile = new JRadioButtonOperator(this,
345.125 - Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
345.126 - "CTL_FileSystemPanel.jarRadioButton.text"));
345.127 - }
345.128 - return _rbAddJARFile;
345.129 - }
345.130 -
345.131 - /** Tries to find JTextField for JAR File in this dialog.
345.132 - * @return JTextFieldOperator instance
345.133 - */
345.134 - public JTextFieldOperator txtJARFile() {
345.135 - if (_txtJARFile==null) {
345.136 - _txtJARFile = new JTextFieldOperator(this, 1);
345.137 - }
345.138 - return _txtJARFile;
345.139 - }
345.140 -
345.141 - /** Tries to find "Browse" JButton to select JAR File in this dialog.
345.142 - * @return JButtonOperator instance
345.143 - */
345.144 - public JButtonOperator btBrowse2() {
345.145 - if (_btBrowse2==null) {
345.146 - _btBrowse2 = new JButtonOperator(this,
345.147 - Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
345.148 - "CTL_FileSystemPanel.browseJarButton.text"),
345.149 - 1);
345.150 - }
345.151 - return _btBrowse2;
345.152 - }
345.153 -
345.154 - /** Tries to find "Add (other file system type)" JRadioButton in this dialog.
345.155 - * @return JRadioButtonOperator instance
345.156 - */
345.157 - public JRadioButtonOperator rbAddOtherFileSystemType() {
345.158 - if (_rbAddOtherFileSystemType==null) {
345.159 - _rbAddOtherFileSystemType = new JRadioButtonOperator(this,
345.160 - Bundle.getString("org.netbeans.beaninfo.editors.Bundle",
345.161 - "CTL_FileSystemPanel.otherRadioButton.text"));
345.162 - }
345.163 - return _rbAddOtherFileSystemType;
345.164 - }
345.165 -
345.166 - /** Tries to find JComboBox for Type of filesystem in this dialog.
345.167 - * @return JComboBoxOperator instance
345.168 - */
345.169 - public JComboBoxOperator cboType() {
345.170 - if (_cboType==null) {
345.171 - _cboType = new JComboBoxOperator(this);
345.172 - }
345.173 - return _cboType;
345.174 - }
345.175 -
345.176 -
345.177 - //****************************************
345.178 - // Low-level functionality definition part
345.179 - //****************************************
345.180 -
345.181 - /** clicks on "Add Local Directory" JRadioButton.
345.182 - */
345.183 - public void addLocalDirectory() {
345.184 - rbAddLocalDirectory().push();
345.185 - }
345.186 -
345.187 - /** Gets text from Directory text field.
345.188 - * @return text from Directory text field.
345.189 - */
345.190 - public String getDirectory() {
345.191 - return txtDirectory().getText();
345.192 - }
345.193 -
345.194 - /** Sets text in Directory text field.
345.195 - * @param directory file path to directory
345.196 - */
345.197 - public void setDirectory(String directory) {
345.198 - txtDirectory().setText(directory);
345.199 - }
345.200 -
345.201 - /** Types text in Directory text field.
345.202 - * @param directory file path to directory
345.203 - */
345.204 - public void typeDirectory(String directory) {
345.205 - txtDirectory().typeText(directory);
345.206 - }
345.207 -
345.208 - /** Clicks on "Browse" JButton to set Directory. */
345.209 - public void browse() {
345.210 - btBrowse().pushNoBlock();
345.211 - }
345.212 -
345.213 - /** Clicks on "Add JAR File" JRadioButton. */
345.214 - public void addJARFile() {
345.215 - rbAddJARFile().push();
345.216 - }
345.217 -
345.218 - /** Gets text from JAR File text field.
345.219 - * @return text from JAR File text field
345.220 - */
345.221 - public String getJARFile() {
345.222 - return txtJARFile().getText();
345.223 - }
345.224 -
345.225 - /** Sets text in JAR File text field.
345.226 - * @param jarFile file path to JAR file
345.227 - */
345.228 - public void setJARFile(String jarFile) {
345.229 - txtJARFile().setText(jarFile);
345.230 - }
345.231 -
345.232 - /** Types text in JAR File text field.
345.233 - * @param jarFile file path to JAR file
345.234 - */
345.235 - public void typeJARFile(String jarFile) {
345.236 - txtJARFile().typeText(jarFile);
345.237 - }
345.238 -
345.239 - /** Clicks on "Browse" JButton to select JAR File */
345.240 - public void browse2() {
345.241 - btBrowse2().pushNoBlock();
345.242 - }
345.243 -
345.244 - /** Clicks on "Add (other file system type)" JRadioButton. */
345.245 - public void addOtherFileSystemType() {
345.246 - rbAddOtherFileSystemType().push();
345.247 - }
345.248 -
345.249 - /** Returns selected item from combo box of filesystem type.
345.250 - * @return selected item from combo box of filesystem type
345.251 - */
345.252 - public String getSelectedType() {
345.253 - return cboType().getSelectedItem().toString();
345.254 - }
345.255 -
345.256 - /** Selects item in combo box of filesystem type.
345.257 - * @param item item to be selected
345.258 - */
345.259 - public void selectType(String item) {
345.260 - cboType().selectItem(item);
345.261 - }
345.262 -
345.263 - /** Types text in combo box of filesystem type.
345.264 - * @param filesystemType type of filesystem
345.265 - */
345.266 - public void typeType(String filesystemType) {
345.267 - cboType().typeText(filesystemType);
345.268 - }
345.269 -
345.270 -
345.271 - //*****************************************
345.272 - // High-level functionality definition part
345.273 - //*****************************************
345.274 -
345.275 - /** Performs verification of this operator by accessing all its components.
345.276 - */
345.277 - public void verify() {
345.278 - rbAddLocalDirectory();
345.279 - txtDirectory();
345.280 - btBrowse();
345.281 - rbAddJARFile();
345.282 - txtJARFile();
345.283 - btBrowse2();
345.284 - rbAddOtherFileSystemType();
345.285 - cboType();
345.286 - }
345.287 -
345.288 -}
345.289 -
346.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FindEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
346.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
346.3 @@ -1,437 +0,0 @@
346.4 -/*
346.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
346.6 - *
346.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
346.8 - *
346.9 - * The contents of this file are subject to the terms of either the GNU
346.10 - * General Public License Version 2 only ("GPL") or the Common
346.11 - * Development and Distribution License("CDDL") (collectively, the
346.12 - * "License"). You may not use this file except in compliance with the
346.13 - * License. You can obtain a copy of the License at
346.14 - * http://www.netbeans.org/cddl-gplv2.html
346.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
346.16 - * specific language governing permissions and limitations under the
346.17 - * License. When distributing the software, include this License Header
346.18 - * Notice in each file and include the License file at
346.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
346.20 - * particular file as subject to the "Classpath" exception as provided
346.21 - * by Sun in the GPL Version 2 section of the License file that
346.22 - * accompanied this code. If applicable, add the following below the
346.23 - * License Header, with the fields enclosed by brackets [] replaced by
346.24 - * your own identifying information:
346.25 - * "Portions Copyrighted [year] [name of copyright owner]"
346.26 - *
346.27 - * Contributor(s):
346.28 - *
346.29 - * The Original Software is NetBeans. The Initial Developer of the Original
346.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
346.31 - * Microsystems, Inc. All Rights Reserved.
346.32 - *
346.33 - * If you wish your version of this file to be governed by only the CDDL
346.34 - * or only the GPL Version 2, indicate your decision by adding
346.35 - * "[Contributor] elects to include this software in this distribution
346.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
346.37 - * single choice of license, a recipient has the option to distribute
346.38 - * your version of this file under either the CDDL, the GPL Version 2 or
346.39 - * to extend the choice of license to its licensees as provided above.
346.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
346.41 - * Version 2 license, then the option applies only if the new code is
346.42 - * made subject to such option by the copyright holder.
346.43 - */
346.44 -
346.45 -/*
346.46 - * Find.java
346.47 - *
346.48 - * Created on 2/11/03 1:29 PM
346.49 - */
346.50 -package org.netbeans.modules.visualweb.gravy.properties.editors;
346.51 -
346.52 -import java.awt.Robot;
346.53 -import java.awt.event.InputEvent;
346.54 -import java.awt.event.KeyEvent;
346.55 -import org.netbeans.jemmy.operators.*;
346.56 -
346.57 -
346.58 -import javax.swing.JDialog;
346.59 -import org.netbeans.jellytools.Bundle;
346.60 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
346.61 -import org.netbeans.jemmy.operators.*;
346.62 -
346.63 -/** Class implementing all necessary methods for handling "Find" NbDialog.
346.64 - */
346.65 -public class FindEditorOperator extends NbDialogOperator {
346.66 -
346.67 - /** Creates new Find that can handle it.
346.68 - */
346.69 - public FindEditorOperator() {
346.70 - super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-title"));
346.71 - }
346.72 -
346.73 - /** Creates new StringArrayCustomEditorOperator
346.74 - * @param wrapper JDialogOperator wrapper for custom editor */
346.75 - public FindEditorOperator(JDialogOperator wrapper) {
346.76 - super((JDialog)wrapper.getSource());
346.77 - }
346.78 -
346.79 - private JLabelOperator _lblFindWhat;
346.80 - private JComboBoxOperator _cboFindWhat;
346.81 - public static final String ITEM_ = "";
346.82 - private JCheckBoxOperator _cbHighlightSearch;
346.83 - private JCheckBoxOperator _cbIncrementalSearch;
346.84 - private JCheckBoxOperator _cbMatchCase;
346.85 - private JCheckBoxOperator _cbSmartCase;
346.86 - private JCheckBoxOperator _cbMatchWholeWordsOnly;
346.87 - private JCheckBoxOperator _cbBackwardSearch;
346.88 - private JCheckBoxOperator _cbWrapSearch;
346.89 - private JButtonOperator _btFind;
346.90 - private JButtonOperator _btClose;
346.91 - private JButtonOperator _btHelp;
346.92 -
346.93 -
346.94 - //******************************
346.95 - // Subcomponents definition part
346.96 - //******************************
346.97 -
346.98 - /** Tries to find "Find What:" JLabel in this dialog.
346.99 - * @return JLabelOperator
346.100 - */
346.101 - public JLabelOperator lblFindWhat() {
346.102 - if (_lblFindWhat==null) {
346.103 - _lblFindWhat = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-what"));
346.104 - }
346.105 - return _lblFindWhat;
346.106 - }
346.107 -
346.108 - /** Tries to find null JComboBox in this dialog.
346.109 - * @return JComboBoxOperator
346.110 - */
346.111 - public JComboBoxOperator cboFindWhat() {
346.112 - if (_cboFindWhat==null) {
346.113 - _cboFindWhat = new JComboBoxOperator(this);
346.114 - }
346.115 - return _cboFindWhat;
346.116 - }
346.117 -
346.118 - /** Tries to find " Highlight Search" JCheckBox in this dialog.
346.119 - * @return JCheckBoxOperator
346.120 - */
346.121 - public JCheckBoxOperator cbHighlightSearch() {
346.122 - if (_cbHighlightSearch==null) {
346.123 - _cbHighlightSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-highlight-search"));
346.124 - }
346.125 - return _cbHighlightSearch;
346.126 - }
346.127 -
346.128 - /** Tries to find " Incremental Search" JCheckBox in this dialog.
346.129 - * @return JCheckBoxOperator
346.130 - */
346.131 - public JCheckBoxOperator cbIncrementalSearch() {
346.132 - if (_cbIncrementalSearch==null) {
346.133 - _cbIncrementalSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-inc-search"));
346.134 - }
346.135 - return _cbIncrementalSearch;
346.136 - }
346.137 -
346.138 - /** Tries to find " Match Case" JCheckBox in this dialog.
346.139 - * @return JCheckBoxOperator
346.140 - */
346.141 - public JCheckBoxOperator cbMatchCase() {
346.142 - if (_cbMatchCase==null) {
346.143 - _cbMatchCase = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-match-case"));
346.144 - }
346.145 - return _cbMatchCase;
346.146 - }
346.147 -
346.148 - /** Tries to find " Smart Case" JCheckBox in this dialog.
346.149 - * @return JCheckBoxOperator
346.150 - */
346.151 - public JCheckBoxOperator cbSmartCase() {
346.152 - if (_cbSmartCase==null) {
346.153 - _cbSmartCase = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-smart-case"));
346.154 - }
346.155 - return _cbSmartCase;
346.156 - }
346.157 -
346.158 - /** Tries to find " Match Whole Words Only" JCheckBox in this dialog.
346.159 - * @return JCheckBoxOperator
346.160 - */
346.161 - public JCheckBoxOperator cbMatchWholeWordsOnly() {
346.162 - if (_cbMatchWholeWordsOnly==null) {
346.163 - _cbMatchWholeWordsOnly = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-whole-words"));
346.164 - }
346.165 - return _cbMatchWholeWordsOnly;
346.166 - }
346.167 -
346.168 - /** Tries to find " Backward Search" JCheckBox in this dialog.
346.169 - * @return JCheckBoxOperator
346.170 - */
346.171 - public JCheckBoxOperator cbBackwardSearch() {
346.172 - if (_cbBackwardSearch==null) {
346.173 - _cbBackwardSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-backward-search"));
346.174 - }
346.175 - return _cbBackwardSearch;
346.176 - }
346.177 -
346.178 - /** Tries to find " Wrap Search" JCheckBox in this dialog.
346.179 - * @return JCheckBoxOperator
346.180 - */
346.181 - public JCheckBoxOperator cbWrapSearch() {
346.182 - if (_cbWrapSearch==null) {
346.183 - _cbWrapSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-wrap-search"));
346.184 - }
346.185 - return _cbWrapSearch;
346.186 - }
346.187 -
346.188 - /** Tries to find "Find" JButton in this dialog.
346.189 - * @return JButtonOperator
346.190 - */
346.191 - public JButtonOperator btFind() {
346.192 - if (_btFind==null) {
346.193 - _btFind = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-find"));
346.194 - }
346.195 - return _btFind;
346.196 - }
346.197 -
346.198 - /** Tries to find "Close" JButton in this dialog.
346.199 - * @return JButtonOperator
346.200 - */
346.201 - public JButtonOperator btClose() {
346.202 - if (_btClose==null) {
346.203 - _btClose = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-cancel"));
346.204 - }
346.205 - return _btClose;
346.206 - }
346.207 -
346.208 - /** Tries to find "Help" JButton in this dialog.
346.209 - * @return JButtonOperator
346.210 - */
346.211 - public JButtonOperator btHelp() {
346.212 - if (_btHelp==null) {
346.213 - _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
346.214 - }
346.215 - return _btHelp;
346.216 - }
346.217 -
346.218 -
346.219 - //****************************************
346.220 - // Low-level functionality definition part
346.221 - //****************************************
346.222 -
346.223 - /** returns selected item for cboFindWhat
346.224 - * @return String item
346.225 - */
346.226 - public String getSelectedFindWhat() {
346.227 - return cboFindWhat().getSelectedItem().toString();
346.228 - }
346.229 -
346.230 - /** selects item for cboFindWhat
346.231 - * @param item String item
346.232 - */
346.233 - public void selectFindWhat(String item) {
346.234 - cboFindWhat().selectItem(item);
346.235 - }
346.236 -
346.237 - /** types text for cboFindWhat
346.238 - * @param text String text
346.239 - */
346.240 - public void typeFindWhat(String text) {
346.241 - cboFindWhat().typeText(text);
346.242 - }
346.243 -
346.244 - /** checks or unchecks given JCheckBox
346.245 - * @param state boolean requested state
346.246 - */
346.247 - public void checkHighlightSearch(boolean state) {
346.248 - if (cbHighlightSearch().isSelected()!=state) {
346.249 - cbHighlightSearch().push();
346.250 - }
346.251 - }
346.252 -
346.253 - /** checks or unchecks given JCheckBox
346.254 - * @param state boolean requested state
346.255 - */
346.256 - public void checkIncrementalSearch(boolean state) {
346.257 - if (cbIncrementalSearch().isSelected()!=state) {
346.258 - cbIncrementalSearch().push();
346.259 - }
346.260 - }
346.261 -
346.262 - /** checks or unchecks given JCheckBox
346.263 - * @param state boolean requested state
346.264 - */
346.265 - public void checkMatchCase(boolean state) {
346.266 - if (cbMatchCase().isSelected()!=state) {
346.267 - cbMatchCase().push();
346.268 - }
346.269 - }
346.270 -
346.271 - /** checks or unchecks given JCheckBox
346.272 - * @param state boolean requested state
346.273 - */
346.274 - public void checkSmartCase(boolean state) {
346.275 - if (cbSmartCase().isSelected()!=state) {
346.276 - cbSmartCase().push();
346.277 - }
346.278 - }
346.279 -
346.280 - /** checks or unchecks given JCheckBox
346.281 - * @param state boolean requested state
346.282 - */
346.283 - public void checkMatchWholeWordsOnly(boolean state) {
346.284 - if (cbMatchWholeWordsOnly().isSelected()!=state) {
346.285 - cbMatchWholeWordsOnly().push();
346.286 - }
346.287 - }
346.288 -
346.289 - /** checks or unchecks given JCheckBox
346.290 - * @param state boolean requested state
346.291 - */
346.292 - public void checkBackwardSearch(boolean state) {
346.293 - if (cbBackwardSearch().isSelected()!=state) {
346.294 - cbBackwardSearch().push();
346.295 - }
346.296 - }
346.297 -
346.298 - /** checks or unchecks given JCheckBox
346.299 - * @param state boolean requested state
346.300 - */
346.301 - public void checkWrapSearch(boolean state) {
346.302 - if (cbWrapSearch().isSelected()!=state) {
346.303 - cbWrapSearch().push();
346.304 - }
346.305 - }
346.306 -
346.307 - /** checks or unchecks All JCheckBoxes
346.308 - * @param state boolean requested state
346.309 - */
346.310 - public void checkAll(boolean state) {
346.311 - checkMatchCase(state);
346.312 - checkSmartCase(state);
346.313 - checkMatchWholeWordsOnly(state);
346.314 -
346.315 - checkHighlightSearch(state);
346.316 - checkIncrementalSearch(state);
346.317 - checkBackwardSearch(state);
346.318 - checkWrapSearch(state);
346.319 - }
346.320 -
346.321 - /** clicks on "Find" JButton
346.322 - */
346.323 - public void find() {
346.324 - btFind().pushNoBlock();
346.325 - }
346.326 -
346.327 - /** clicks on "Close" JButton
346.328 - */
346.329 - public void close() {
346.330 - btClose().push();
346.331 - }
346.332 -
346.333 - /** clicks on "Help" JButton
346.334 - */
346.335 - public void help() {
346.336 - btHelp().push();
346.337 - }
346.338 -
346.339 -
346.340 - //*****************************************
346.341 - // High-level functionality definition part
346.342 - //*****************************************
346.343 -
346.344 - /** Performs verification of Find by accessing all its components.
346.345 - */
346.346 - public void verify() {
346.347 - lblFindWhat();
346.348 - cboFindWhat();
346.349 - cbHighlightSearch();
346.350 - cbIncrementalSearch();
346.351 - cbMatchCase();
346.352 - cbSmartCase();
346.353 - cbMatchWholeWordsOnly();
346.354 - cbBackwardSearch();
346.355 - cbWrapSearch();
346.356 - btFind();
346.357 - btClose();
346.358 - btHelp();
346.359 - }
346.360 -
346.361 - public static void find(String text) {
346.362 - FindEditorOperator op=new FindEditorOperator();
346.363 - op.typeFindWhat(text);
346.364 - op.find();
346.365 - }
346.366 -
346.367 - public static void find(String text,Robot robot) {
346.368 - FindEditorOperator op=new FindEditorOperator();
346.369 - robot.waitForIdle();
346.370 - java.awt.Point p=op.cboFindWhat().getLocationOnScreen();
346.371 - int x=p.x+op.cboFindWhat().getWidth()/2;
346.372 - int y=p.y+op.cboFindWhat().getHeight()/2;
346.373 - robot.mouseMove(x,y);
346.374 - robot.mousePress(InputEvent.BUTTON1_MASK);
346.375 - robot.delay(50);
346.376 - robot.mouseRelease(InputEvent.BUTTON1_MASK);
346.377 - char c;
346.378 - boolean upper;
346.379 - for (int i=0;i < text.length();i++) {
346.380 - c=text.charAt(i);
346.381 - if (Character.isUpperCase(c)) {
346.382 - upper=true;
346.383 - } else {
346.384 - upper=false;
346.385 - c=(char)(Character.toUpperCase((char)c));
346.386 - }
346.387 - if (upper) {
346.388 - robot.keyPress(KeyEvent.VK_SHIFT);
346.389 - }
346.390 - robot.keyPress((int)c);
346.391 - robot.delay(5);
346.392 - robot.keyRelease((int)c);
346.393 - robot.delay(5);
346.394 - if (upper) {
346.395 - robot.keyRelease(KeyEvent.VK_SHIFT);
346.396 - }
346.397 - }
346.398 - p=op.btFind().getLocationOnScreen();
346.399 - x=p.x+op.btFind().getWidth()/2;
346.400 - y=p.y+op.btFind().getHeight()/2;
346.401 - robot.mouseMove(x,y);
346.402 - robot.mousePress(InputEvent.BUTTON1_MASK);
346.403 - robot.delay(50);
346.404 - robot.mouseRelease(InputEvent.BUTTON1_MASK);
346.405 - robot.delay(50);
346.406 - robot.waitForIdle();
346.407 - }
346.408 -
346.409 -
346.410 - /** Performs simple test of Find
346.411 - * @param args the command line arguments
346.412 - */
346.413 - public static void main(String args[]) {
346.414 - //new Find().verify();
346.415 - System.out.println("Find verification finished.");
346.416 - try {
346.417 - Robot robot=new Robot();
346.418 - System.out.println("Start delay.");
346.419 - robot.delay(2000);
346.420 - System.out.println("Delayed");
346.421 - robot.waitForIdle();
346.422 - robot.keyPress(KeyEvent.VK_CONTROL);
346.423 - robot.delay(1);
346.424 - robot.keyPress(KeyEvent.VK_F);
346.425 - robot.delay(20);
346.426 - robot.keyRelease(KeyEvent.VK_F);
346.427 - robot.delay(1);
346.428 - robot.keyRelease(KeyEvent.VK_CONTROL);
346.429 - System.out.println("1");
346.430 - robot.waitForIdle();
346.431 - System.out.println("2");
346.432 - FindEditorOperator.find("aaa",robot);
346.433 - System.out.println("3");
346.434 -
346.435 - } catch (Exception ex) {
346.436 - ex.printStackTrace();
346.437 - }
346.438 - }
346.439 -}
346.440 -
347.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/FontCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
347.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
347.3 @@ -1,202 +0,0 @@
347.4 -/*
347.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
347.6 - *
347.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
347.8 - *
347.9 - * The contents of this file are subject to the terms of either the GNU
347.10 - * General Public License Version 2 only ("GPL") or the Common
347.11 - * Development and Distribution License("CDDL") (collectively, the
347.12 - * "License"). You may not use this file except in compliance with the
347.13 - * License. You can obtain a copy of the License at
347.14 - * http://www.netbeans.org/cddl-gplv2.html
347.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
347.16 - * specific language governing permissions and limitations under the
347.17 - * License. When distributing the software, include this License Header
347.18 - * Notice in each file and include the License file at
347.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
347.20 - * particular file as subject to the "Classpath" exception as provided
347.21 - * by Sun in the GPL Version 2 section of the License file that
347.22 - * accompanied this code. If applicable, add the following below the
347.23 - * License Header, with the fields enclosed by brackets [] replaced by
347.24 - * your own identifying information:
347.25 - * "Portions Copyrighted [year] [name of copyright owner]"
347.26 - *
347.27 - * Contributor(s):
347.28 - *
347.29 - * The Original Software is NetBeans. The Initial Developer of the Original
347.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
347.31 - * Microsystems, Inc. All Rights Reserved.
347.32 - *
347.33 - * If you wish your version of this file to be governed by only the CDDL
347.34 - * or only the GPL Version 2, indicate your decision by adding
347.35 - * "[Contributor] elects to include this software in this distribution
347.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
347.37 - * single choice of license, a recipient has the option to distribute
347.38 - * your version of this file under either the CDDL, the GPL Version 2 or
347.39 - * to extend the choice of license to its licensees as provided above.
347.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
347.41 - * Version 2 license, then the option applies only if the new code is
347.42 - * made subject to such option by the copyright holder.
347.43 - */
347.44 -
347.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
347.46 -
347.47 -/*
347.48 - * FontCustomEditorOperator.java
347.49 - *
347.50 - * Created on 6/13/02 4:29 PM
347.51 - */
347.52 -
347.53 -import javax.swing.JDialog;
347.54 -import org.netbeans.jellytools.Bundle;
347.55 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
347.56 -import org.netbeans.jemmy.operators.*;
347.57 -
347.58 -/** Class implementing all necessary methods for handling Font Custom Editor
347.59 - */
347.60 -public class FontCustomEditorOperator extends NbDialogOperator {
347.61 -
347.62 - /** Creates new FontCustomEditorOperator
347.63 - * @throws TimeoutExpiredException when NbDialog not found
347.64 - * @param title String title of custom editor */
347.65 - public FontCustomEditorOperator(String title) {
347.66 - super(title);
347.67 - }
347.68 -
347.69 - /** Creates a new instance of FontCustomEditorOperator
347.70 - * @param wrapper JDialogOperator wrapper for custom editor */
347.71 - public FontCustomEditorOperator(JDialogOperator wrapper) {
347.72 - super((JDialog)wrapper.getSource());
347.73 - }
347.74 -
347.75 - private JListOperator _lstFontName;
347.76 - private JListOperator _lstFontSize;
347.77 - private JTextFieldOperator _txtFontName;
347.78 - private JTextFieldOperator _txtFontSize;
347.79 - private JTextFieldOperator _txtFontStyle;
347.80 - private JListOperator _lstFontStyle;
347.81 - /** String constant for plain font style */
347.82 - public static final String STYLE_PLAIN = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Plain");
347.83 - /** String constant for bold font style */
347.84 - public static final String STYLE_BOLD = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Bold");
347.85 - /** String constant for italic font style */
347.86 - public static final String STYLE_ITALIC = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Italic");
347.87 - /** String constant for bold italic font style */
347.88 - public static final String STYLE_BOLDITALIC = Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_BoldItalic");
347.89 -
347.90 -
347.91 - /** Tries to find null JList in this dialog.
347.92 - * @throws TimeoutExpiredException when component not found
347.93 - * @return JListOperator
347.94 - */
347.95 - public JListOperator lstFontName() {
347.96 - if (_lstFontName==null) {
347.97 - _lstFontName = new JListOperator( this, 0 );
347.98 - }
347.99 - return _lstFontName;
347.100 - }
347.101 -
347.102 - /** Tries to find null JList in this dialog.
347.103 - * @throws TimeoutExpiredException when component not found
347.104 - * @return JListOperator
347.105 - */
347.106 - public JListOperator lstFontSize() {
347.107 - if (_lstFontSize==null) {
347.108 - _lstFontSize = new JListOperator( this, 2 );
347.109 - }
347.110 - return _lstFontSize;
347.111 - }
347.112 -
347.113 - /** Tries to find null JTextField in this dialog.
347.114 - * @throws TimeoutExpiredException when component not found
347.115 - * @return JTextFieldOperator
347.116 - */
347.117 - public JTextFieldOperator txtFontName() {
347.118 - if (_txtFontName==null) {
347.119 - _txtFontName = new JTextFieldOperator( this, 0 );
347.120 - }
347.121 - return _txtFontName;
347.122 - }
347.123 -
347.124 - /** Tries to find null JTextField in this dialog.
347.125 - * @throws TimeoutExpiredException when component not found
347.126 - * @return JTextFieldOperator
347.127 - */
347.128 - public JTextFieldOperator txtFontSize() {
347.129 - if (_txtFontSize==null) {
347.130 - _txtFontSize = new JTextFieldOperator( this, 2 );
347.131 - }
347.132 - return _txtFontSize;
347.133 - }
347.134 -
347.135 - /** Tries to find null JTextField in this dialog.
347.136 - * @throws TimeoutExpiredException when component not found
347.137 - * @return JTextFieldOperator
347.138 - */
347.139 - public JTextFieldOperator txtFontStyle() {
347.140 - if (_txtFontStyle==null) {
347.141 - _txtFontStyle = new JTextFieldOperator( this, 1 );
347.142 - }
347.143 - return _txtFontStyle;
347.144 - }
347.145 -
347.146 - /** Tries to find null JList in this dialog.
347.147 - * @throws TimeoutExpiredException when component not found
347.148 - * @return JListOperator
347.149 - */
347.150 - public JListOperator lstFontStyle() {
347.151 - if (_lstFontStyle==null) {
347.152 - _lstFontStyle = new JListOperator( this, 1 );
347.153 - }
347.154 - return _lstFontStyle;
347.155 - }
347.156 -
347.157 - /** returns edited font name
347.158 - * @return String font name */
347.159 - public String getFontName() {
347.160 - return txtFontName().getText();
347.161 - }
347.162 -
347.163 - /** returns edited font style
347.164 - * @return String font style */
347.165 - public String getFontStyle() {
347.166 - return txtFontStyle().getText();
347.167 - }
347.168 -
347.169 - /** returns edited font size
347.170 - * @return String font size */
347.171 - public String getFontSize() {
347.172 - return txtFontSize().getText();
347.173 - }
347.174 -
347.175 - /** tries to find and set text of txtFontName
347.176 - * @param name String font name */
347.177 - public void setFontName( String name ) {
347.178 - lstFontName().selectItem(name);
347.179 - }
347.180 -
347.181 - /** tries to find and set text of txtFontSize
347.182 - * @param size String font size */
347.183 - public void setFontSize( String size ) {
347.184 - txtFontSize().setText("");
347.185 - txtFontSize().typeText(size);
347.186 - }
347.187 -
347.188 - /** tries to find and set text of txtFontStyle
347.189 - * @param style String font style */
347.190 - public void setFontStyle( String style ) {
347.191 - lstFontStyle().selectItem(style);
347.192 - }
347.193 -
347.194 - /** Performs verification by accessing all sub-components */
347.195 - public void verify() {
347.196 - txtFontName();
347.197 - txtFontSize();
347.198 - txtFontStyle();
347.199 - lstFontName();
347.200 - lstFontSize();
347.201 - lstFontStyle();
347.202 - }
347.203 -
347.204 -}
347.205 -
348.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/GoToLineEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
348.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
348.3 @@ -1,252 +0,0 @@
348.4 -/*
348.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
348.6 - *
348.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
348.8 - *
348.9 - * The contents of this file are subject to the terms of either the GNU
348.10 - * General Public License Version 2 only ("GPL") or the Common
348.11 - * Development and Distribution License("CDDL") (collectively, the
348.12 - * "License"). You may not use this file except in compliance with the
348.13 - * License. You can obtain a copy of the License at
348.14 - * http://www.netbeans.org/cddl-gplv2.html
348.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
348.16 - * specific language governing permissions and limitations under the
348.17 - * License. When distributing the software, include this License Header
348.18 - * Notice in each file and include the License file at
348.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
348.20 - * particular file as subject to the "Classpath" exception as provided
348.21 - * by Sun in the GPL Version 2 section of the License file that
348.22 - * accompanied this code. If applicable, add the following below the
348.23 - * License Header, with the fields enclosed by brackets [] replaced by
348.24 - * your own identifying information:
348.25 - * "Portions Copyrighted [year] [name of copyright owner]"
348.26 - *
348.27 - * Contributor(s):
348.28 - *
348.29 - * The Original Software is NetBeans. The Initial Developer of the Original
348.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
348.31 - * Microsystems, Inc. All Rights Reserved.
348.32 - *
348.33 - * If you wish your version of this file to be governed by only the CDDL
348.34 - * or only the GPL Version 2, indicate your decision by adding
348.35 - * "[Contributor] elects to include this software in this distribution
348.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
348.37 - * single choice of license, a recipient has the option to distribute
348.38 - * your version of this file under either the CDDL, the GPL Version 2 or
348.39 - * to extend the choice of license to its licensees as provided above.
348.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
348.41 - * Version 2 license, then the option applies only if the new code is
348.42 - * made subject to such option by the copyright holder.
348.43 - */
348.44 -
348.45 -/*
348.46 - * GoToLine.java
348.47 - *
348.48 - * Created on 2/11/03 10:58 AM
348.49 - */
348.50 -package org.netbeans.modules.visualweb.gravy.properties.editors;
348.51 -
348.52 -import java.awt.Robot;
348.53 -import java.awt.event.InputEvent;
348.54 -import org.netbeans.jemmy.operators.*;
348.55 -
348.56 -import javax.swing.JDialog;
348.57 -import org.netbeans.jellytools.Bundle;
348.58 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
348.59 -import org.netbeans.jemmy.operators.*;
348.60 -
348.61 -
348.62 -/** Class implementing all necessary methods for handling "Go to Line" NbDialog.
348.63 - */
348.64 -public class GoToLineEditorOperator extends NbDialogOperator {
348.65 -
348.66 - /** Creates new GoToLine that can handle it.
348.67 - */
348.68 - public GoToLineEditorOperator() {
348.69 - super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-title"));
348.70 - }
348.71 -
348.72 - /** Creates new StringArrayCustomEditorOperator
348.73 - * @param wrapper JDialogOperator wrapper for custom editor */
348.74 - public GoToLineEditorOperator(JDialogOperator wrapper) {
348.75 - super((JDialog)wrapper.getSource());
348.76 - }
348.77 -
348.78 - private JLabelOperator _lblGoToLine;
348.79 - private JComboBoxOperator _cboGoToLine;
348.80 - private JButtonOperator _btGoto;
348.81 - private JButtonOperator _btClose;
348.82 - private JButtonOperator _btHelp;
348.83 -
348.84 -
348.85 - //******************************
348.86 - // Subcomponents definition part
348.87 - //******************************
348.88 -
348.89 - /** Tries to find "Go to Line:" JLabel in this dialog.
348.90 - * @return JLabelOperator
348.91 - */
348.92 - public JLabelOperator lblGoToLine() {
348.93 - if (_lblGoToLine==null) {
348.94 - _lblGoToLine = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-line"));
348.95 - }
348.96 - return _lblGoToLine;
348.97 - }
348.98 -
348.99 - /** Tries to find null JComboBox in this dialog.
348.100 - * @return JComboBoxOperator
348.101 - */
348.102 - public JComboBoxOperator cboGoToLine() {
348.103 - if (_cboGoToLine==null) {
348.104 - _cboGoToLine = new JComboBoxOperator(this);
348.105 - }
348.106 - return _cboGoToLine;
348.107 - }
348.108 -
348.109 - /** Tries to find "Goto" JButton in this dialog.
348.110 - * @return JButtonOperator
348.111 - */
348.112 - public JButtonOperator btGoto() {
348.113 - if (_btGoto==null) {
348.114 - _btGoto = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-button-goto"));
348.115 - }
348.116 - return _btGoto;
348.117 - }
348.118 -
348.119 - /** Tries to find "Close" JButton in this dialog.
348.120 - * @return JButtonOperator
348.121 - */
348.122 - public JButtonOperator btClose() {
348.123 - if (_btClose==null) {
348.124 - _btClose = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("goto-button-cancel"));
348.125 - }
348.126 - return _btClose;
348.127 - }
348.128 -
348.129 - /** Tries to find "Help" JButton in this dialog.
348.130 - * @return JButtonOperator
348.131 - */
348.132 - public JButtonOperator btHelp() {
348.133 - if (_btHelp==null) {
348.134 - _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
348.135 - }
348.136 - return _btHelp;
348.137 - }
348.138 -
348.139 -
348.140 - //****************************************
348.141 - // Low-level functionality definition part
348.142 - //****************************************
348.143 -
348.144 - /** returns selected item for cboGoToLine
348.145 - * @return String item
348.146 - */
348.147 - public String getSelectedGoToLine() {
348.148 - return cboGoToLine().getSelectedItem().toString();
348.149 - }
348.150 -
348.151 - /** selects item for cboGoToLine
348.152 - * @param item String item
348.153 - */
348.154 - public void selectGoToLine(String item) {
348.155 - cboGoToLine().selectItem(item);
348.156 - }
348.157 -
348.158 - /** types text for cboGoToLine
348.159 - * @param text String text
348.160 - */
348.161 - public void typeGoToLine(String text) {
348.162 - cboGoToLine().typeText(text);
348.163 - }
348.164 -
348.165 - /** clicks on "Goto" JButton
348.166 - */
348.167 - public void goTo() {
348.168 - btGoto().push();
348.169 - }
348.170 -
348.171 - /** clicks on "Close" JButton
348.172 - */
348.173 - public void close() {
348.174 - btClose().push();
348.175 - }
348.176 -
348.177 - /** clicks on "Help" JButton
348.178 - */
348.179 - public void help() {
348.180 - btHelp().push();
348.181 - }
348.182 -
348.183 -
348.184 - //*****************************************
348.185 - // High-level functionality definition part
348.186 - //*****************************************
348.187 -
348.188 - /** Performs verification of GoToLine by accessing all its components.
348.189 - */
348.190 - public void verify() {
348.191 - lblGoToLine();
348.192 - cboGoToLine();
348.193 - btGoto();
348.194 - btClose();
348.195 - btHelp();
348.196 - }
348.197 -
348.198 - /**
348.199 - * Get to specified line.
348.200 - * @param line Number of line.
348.201 - */
348.202 - public static void goToLine(int line) {
348.203 - GoToLineEditorOperator op=new GoToLineEditorOperator();
348.204 - op.typeGoToLine(String.valueOf(line));
348.205 - op.goTo();
348.206 - while (op.isVisible()) {
348.207 - op.goTo();
348.208 - }
348.209 - }
348.210 -
348.211 - /**
348.212 - * Get to specified line with specified robot.
348.213 - * @param line Number of line.
348.214 - * @param robot Robot which will get line.
348.215 - */
348.216 - public static void goToLine(int line,Robot robot) {
348.217 - GoToLineEditorOperator op=new GoToLineEditorOperator();
348.218 - java.awt.Point p;
348.219 - int x,y;
348.220 -
348.221 - String s=String.valueOf(line);
348.222 - int c;
348.223 - robot.waitForIdle();
348.224 - robot.delay(200);
348.225 - for (int i=0;i < s.length();i++) {
348.226 - c=(int)s.charAt(i);
348.227 - robot.keyPress(c);
348.228 - robot.delay(50);
348.229 - robot.keyRelease(c);
348.230 - }
348.231 - p=op.btGoto().getLocationOnScreen();
348.232 - x=p.x+op.btGoto().getWidth()/2;
348.233 - y=p.y+op.btGoto().getHeight()/2;
348.234 - robot.mouseMove(x,y);
348.235 - robot.mousePress(InputEvent.BUTTON1_MASK);
348.236 - robot.delay(50);
348.237 - robot.mouseRelease(InputEvent.BUTTON1_MASK);
348.238 - robot.delay(50);
348.239 - robot.waitForIdle();
348.240 - while (op.isVisible()) {
348.241 - robot.delay(50);
348.242 - }
348.243 - }
348.244 -
348.245 - /** Performs simple test of GoToLine
348.246 - * @param args the command line arguments
348.247 - */
348.248 - public static void main(String args[]) {
348.249 - //new GoToLine().verify();
348.250 - System.out.println("GoToLine verification finished.");
348.251 - char c='0';
348.252 - System.out.println("Char c="+Integer.toHexString((int)c));
348.253 - }
348.254 -}
348.255 -
349.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/IconCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
349.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
349.3 @@ -1,205 +0,0 @@
349.4 -/*
349.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
349.6 - *
349.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
349.8 - *
349.9 - * The contents of this file are subject to the terms of either the GNU
349.10 - * General Public License Version 2 only ("GPL") or the Common
349.11 - * Development and Distribution License("CDDL") (collectively, the
349.12 - * "License"). You may not use this file except in compliance with the
349.13 - * License. You can obtain a copy of the License at
349.14 - * http://www.netbeans.org/cddl-gplv2.html
349.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
349.16 - * specific language governing permissions and limitations under the
349.17 - * License. When distributing the software, include this License Header
349.18 - * Notice in each file and include the License file at
349.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
349.20 - * particular file as subject to the "Classpath" exception as provided
349.21 - * by Sun in the GPL Version 2 section of the License file that
349.22 - * accompanied this code. If applicable, add the following below the
349.23 - * License Header, with the fields enclosed by brackets [] replaced by
349.24 - * your own identifying information:
349.25 - * "Portions Copyrighted [year] [name of copyright owner]"
349.26 - *
349.27 - * Contributor(s):
349.28 - *
349.29 - * The Original Software is NetBeans. The Initial Developer of the Original
349.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
349.31 - * Microsystems, Inc. All Rights Reserved.
349.32 - *
349.33 - * If you wish your version of this file to be governed by only the CDDL
349.34 - * or only the GPL Version 2, indicate your decision by adding
349.35 - * "[Contributor] elects to include this software in this distribution
349.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
349.37 - * single choice of license, a recipient has the option to distribute
349.38 - * your version of this file under either the CDDL, the GPL Version 2 or
349.39 - * to extend the choice of license to its licensees as provided above.
349.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
349.41 - * Version 2 license, then the option applies only if the new code is
349.42 - * made subject to such option by the copyright holder.
349.43 - */
349.44 -
349.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
349.46 -
349.47 -import javax.swing.JDialog;
349.48 -import org.netbeans.jellytools.Bundle;
349.49 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
349.50 -import org.netbeans.jemmy.operators.*;
349.51 -
349.52 -/** Class implementing all necessary methods for handling Icon Custom Editor.
349.53 - */
349.54 -public class IconCustomEditorOperator extends NbDialogOperator {
349.55 -
349.56 - /** Creates new IconCustomEditorOperator that can handle it.
349.57 - * Throws TimeoutExpiredException when NbDialog not found.
349.58 - * @param title title of custom editor
349.59 - */
349.60 - public IconCustomEditorOperator(String title) {
349.61 - super(title);
349.62 - }
349.63 -
349.64 - /** Creates new IconCustomEditorOperator.
349.65 - * @param wrapper JDialogOperator wrapper for custom editor
349.66 - */
349.67 - public IconCustomEditorOperator(JDialogOperator wrapper) {
349.68 - super((JDialog)wrapper.getSource());
349.69 - }
349.70 -
349.71 - private JRadioButtonOperator _rbURL;
349.72 - private JRadioButtonOperator _rbFile;
349.73 - private JRadioButtonOperator _rbClasspath;
349.74 - private JRadioButtonOperator _rbNoPicture;
349.75 - private JTextFieldOperator _txtName;
349.76 - private JButtonOperator _btSelectFile;
349.77 -
349.78 - //******************************
349.79 - // Subcomponents definition part
349.80 - //******************************
349.81 -
349.82 - /** Tries to find "URL" JRadioButton in this dialog.
349.83 - * @return JRadioButtonOperator instance
349.84 - */
349.85 - public JRadioButtonOperator rbURL() {
349.86 - if (_rbURL==null) {
349.87 - _rbURL = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_URL"));
349.88 - }
349.89 - return _rbURL;
349.90 - }
349.91 -
349.92 - /** Tries to find "File" JRadioButton in this dialog.
349.93 - * @return JRadioButtonOperator instance
349.94 - */
349.95 - public JRadioButtonOperator rbFile() {
349.96 - if (_rbFile==null) {
349.97 - _rbFile = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_File"));
349.98 - }
349.99 - return _rbFile;
349.100 - }
349.101 -
349.102 - /** Tries to find "Classpath" JRadioButton in this dialog.
349.103 - * @return JRadioButtonOperator instance
349.104 - */
349.105 - public JRadioButtonOperator rbClasspath() {
349.106 - if (_rbClasspath==null) {
349.107 - _rbClasspath = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_Classpath"));
349.108 - }
349.109 - return _rbClasspath;
349.110 - }
349.111 -
349.112 - /** Tries to find "No picture" JRadioButton in this dialog.
349.113 - * @return JRadioButtonOperator instance
349.114 - */
349.115 - public JRadioButtonOperator rbNoPicture() {
349.116 - if (_rbNoPicture==null) {
349.117 - _rbNoPicture = new JRadioButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_NoPicture"));
349.118 - }
349.119 - return _rbNoPicture;
349.120 - }
349.121 -
349.122 - /** Tries to find Name JTextField in this dialog.
349.123 - * @return JTextFieldOperator instance
349.124 - */
349.125 - public JTextFieldOperator txtName() {
349.126 - if (_txtName==null) {
349.127 - _txtName = new JTextFieldOperator(this);
349.128 - }
349.129 - return _txtName;
349.130 - }
349.131 -
349.132 - /** Tries to find "Select File" JButton in this dialog.
349.133 - * @return JButtonOperator instance
349.134 - */
349.135 - public JButtonOperator btSelectFile() {
349.136 - if (_btSelectFile==null) {
349.137 - _btSelectFile = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_ButtonSelect"));
349.138 - }
349.139 - return _btSelectFile;
349.140 - }
349.141 -
349.142 - //****************************************
349.143 - // Low-level functionality definition part
349.144 - //****************************************
349.145 -
349.146 - /** Clicks on "URL" JRadioButton. */
349.147 - public void uRL() {
349.148 - rbURL().push();
349.149 - }
349.150 -
349.151 - /** Clicks on "File" JRadioButton. */
349.152 - public void file() {
349.153 - rbFile().push();
349.154 - }
349.155 -
349.156 - /** Clicks on "Classpath" JRadioButton. */
349.157 - public void classpath() {
349.158 - rbClasspath().push();
349.159 - }
349.160 -
349.161 - /** Clicks on "No picture" JRadioButton. */
349.162 - public void noPicture() {
349.163 - rbNoPicture().push();
349.164 - }
349.165 -
349.166 - /** Gets text from Name text field.
349.167 - * @return text from Name text field.
349.168 - */
349.169 - public String getName() {
349.170 - return txtName().getText();
349.171 - }
349.172 -
349.173 - /** Sets text in Name text field.
349.174 - * @param text text to be written to Name text field
349.175 - */
349.176 - public void setName(String text) {
349.177 - txtName().setText(text);
349.178 - }
349.179 -
349.180 - /** Types text in Name text field.
349.181 - * @param text text to be written to Name text field
349.182 - */
349.183 - public void typeName(String text) {
349.184 - txtName().typeText(text);
349.185 - }
349.186 -
349.187 - /** Clicks on "Select File" JButton. */
349.188 - public void selectFile() {
349.189 - btSelectFile().pushNoBlock();
349.190 - }
349.191 -
349.192 - //*****************************************
349.193 - // High-level functionality definition part
349.194 - //*****************************************
349.195 -
349.196 - /** Performs verification of this operator by accessing all its components.
349.197 - */
349.198 - public void verify() {
349.199 - rbURL();
349.200 - rbFile();
349.201 - rbClasspath();
349.202 - rbNoPicture();
349.203 - txtName();
349.204 - btSelectFile();
349.205 - btOK();
349.206 - btCancel();
349.207 - }
349.208 -}
350.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/KeyBindingsEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
350.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
350.3 @@ -1,414 +0,0 @@
350.4 -/*
350.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
350.6 - *
350.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
350.8 - *
350.9 - * The contents of this file are subject to the terms of either the GNU
350.10 - * General Public License Version 2 only ("GPL") or the Common
350.11 - * Development and Distribution License("CDDL") (collectively, the
350.12 - * "License"). You may not use this file except in compliance with the
350.13 - * License. You can obtain a copy of the License at
350.14 - * http://www.netbeans.org/cddl-gplv2.html
350.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
350.16 - * specific language governing permissions and limitations under the
350.17 - * License. When distributing the software, include this License Header
350.18 - * Notice in each file and include the License file at
350.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
350.20 - * particular file as subject to the "Classpath" exception as provided
350.21 - * by Sun in the GPL Version 2 section of the License file that
350.22 - * accompanied this code. If applicable, add the following below the
350.23 - * License Header, with the fields enclosed by brackets [] replaced by
350.24 - * your own identifying information:
350.25 - * "Portions Copyrighted [year] [name of copyright owner]"
350.26 - *
350.27 - * Contributor(s):
350.28 - *
350.29 - * The Original Software is NetBeans. The Initial Developer of the Original
350.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
350.31 - * Microsystems, Inc. All Rights Reserved.
350.32 - *
350.33 - * If you wish your version of this file to be governed by only the CDDL
350.34 - * or only the GPL Version 2, indicate your decision by adding
350.35 - * "[Contributor] elects to include this software in this distribution
350.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
350.37 - * single choice of license, a recipient has the option to distribute
350.38 - * your version of this file under either the CDDL, the GPL Version 2 or
350.39 - * to extend the choice of license to its licensees as provided above.
350.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
350.41 - * Version 2 license, then the option applies only if the new code is
350.42 - * made subject to such option by the copyright holder.
350.43 - */
350.44 -
350.45 -/*
350.46 - * KeyBindings.java
350.47 - *
350.48 - * Created on 10/17/02 12:54 PM
350.49 - */
350.50 -package org.netbeans.modules.visualweb.gravy.properties.editors;
350.51 -
350.52 -import java.io.File;
350.53 -import java.io.FileWriter;
350.54 -import java.io.PrintWriter;
350.55 -import org.netbeans.jemmy.operators.*;
350.56 -import java.util.*;
350.57 -
350.58 -import javax.swing.ListModel;
350.59 -import org.netbeans.modules.visualweb.gravy.OptionsOperator;
350.60 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
350.61 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetTabOperator;
350.62 -import org.netbeans.modules.visualweb.gravy.properties.TextFieldProperty;
350.63 -import org.netbeans.jemmy.EventTool;
350.64 -
350.65 -import javax.swing.JDialog;
350.66 -import org.netbeans.jellytools.Bundle;
350.67 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
350.68 -import org.netbeans.jemmy.operators.*;
350.69 -
350.70 -/** Class implementing all necessary methods for handling "Key Bindings" NbDialog.
350.71 - */
350.72 -public class KeyBindingsEditorOperator extends NbDialogOperator {
350.73 -
350.74 - /** Creates new KeyBindings that can handle it.
350.75 - */
350.76 - public KeyBindingsEditorOperator() {
350.77 - super("Key Bindings");
350.78 -// java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("PROP_keyBindings"));
350.79 - }
350.80 -
350.81 - /** Creates new StringArrayCustomEditorOperator
350.82 - * @param wrapper JDialogOperator wrapper for custom editor */
350.83 - public KeyBindingsEditorOperator(JDialogOperator wrapper) {
350.84 - super((JDialog)wrapper.getSource());
350.85 - }
350.86 - private JRadioButtonOperator _rbSortByName;
350.87 - private JRadioButtonOperator _rbSortByAction;
350.88 - private JListOperator _lstActions;
350.89 - private JButtonOperator _btMetalScrollButton;
350.90 - private JButtonOperator _btMetalScrollButton2;
350.91 - private JLabelOperator _lblKeybindings;
350.92 - private JListOperator _lstKeybindings;
350.93 - private JButtonOperator _btAdd;
350.94 - private JButtonOperator _btRemove;
350.95 - private JButtonOperator _btOK;
350.96 - private JButtonOperator _btCancel;
350.97 - private JButtonOperator _btHelp;
350.98 -
350.99 -
350.100 - //******************************
350.101 - // Subcomponents definition part
350.102 - //******************************
350.103 -
350.104 - /** Tries to find " Sort by Name" JRadioButton in this dialog.
350.105 - * @return JRadioButtonOperator
350.106 - */
350.107 - public JRadioButtonOperator rbSortByName() {
350.108 - if (_rbSortByName==null) {
350.109 - _rbSortByName = new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_name_sort_button"));
350.110 - }
350.111 - return _rbSortByName;
350.112 - }
350.113 -
350.114 - /** Tries to find " Sort by Action" JRadioButton in this dialog.
350.115 - * @return JRadioButtonOperator
350.116 - */
350.117 - public JRadioButtonOperator rbSortByAction() {
350.118 - if (_rbSortByAction==null) {
350.119 - _rbSortByAction = new JRadioButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_action_sort_button"));
350.120 - }
350.121 - return _rbSortByAction;
350.122 - }
350.123 -
350.124 - /** Tries to find null JList in this dialog.
350.125 - * @return JListOperator
350.126 - */
350.127 - public JListOperator lstActions() {
350.128 - if (_lstActions==null) {
350.129 - _lstActions = new JListOperator(this);
350.130 - }
350.131 - return _lstActions;
350.132 - }
350.133 -
350.134 - /** Tries to find "" MetalScrollButton in this dialog.
350.135 - * @return JButtonOperator
350.136 - */
350.137 - public JButtonOperator btMetalScrollButton() {
350.138 - if (_btMetalScrollButton==null) {
350.139 - _btMetalScrollButton = new JButtonOperator(this, "");
350.140 - }
350.141 - return _btMetalScrollButton;
350.142 - }
350.143 -
350.144 - /** Tries to find "" MetalScrollButton in this dialog.
350.145 - * @return JButtonOperator
350.146 - */
350.147 - public JButtonOperator btMetalScrollButton2() {
350.148 - if (_btMetalScrollButton2==null) {
350.149 - _btMetalScrollButton2 = new JButtonOperator(this, "", 1);
350.150 - }
350.151 - return _btMetalScrollButton2;
350.152 - }
350.153 -
350.154 - /** Tries to find "Keybindings:" JLabel in this dialog.
350.155 - * @return JLabelOperator
350.156 - */
350.157 - public JLabelOperator lblKeybindings() {
350.158 - if (_lblKeybindings==null) {
350.159 - _lblKeybindings = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Sequences"));
350.160 - }
350.161 - return _lblKeybindings;
350.162 - }
350.163 -
350.164 - /** Tries to find null JList in this dialog.
350.165 - * @return JListOperator
350.166 - */
350.167 - public JListOperator lstKeybindings() {
350.168 - if (_lstKeybindings==null) {
350.169 - _lstKeybindings = new JListOperator(this, 1);
350.170 - }
350.171 - return _lstKeybindings;
350.172 - }
350.173 -
350.174 - /** Tries to find "Add..." JButton in this dialog.
350.175 - * @return JButtonOperator
350.176 - */
350.177 - public JButtonOperator btAdd() {
350.178 - if (_btAdd==null) {
350.179 - _btAdd = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Add"));
350.180 - }
350.181 - return _btAdd;
350.182 - }
350.183 -
350.184 - /** Tries to find "Remove" JButton in this dialog.
350.185 - * @return JButtonOperator
350.186 - */
350.187 - public JButtonOperator btRemove() {
350.188 - if (_btRemove==null) {
350.189 - _btRemove = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_Remove"));
350.190 - }
350.191 - return _btRemove;
350.192 - }
350.193 -
350.194 - /** Tries to find "OK" JButton in this dialog.
350.195 - * @return JButtonOperator
350.196 - */
350.197 - public JButtonOperator btOK() {
350.198 - if (_btOK==null) {
350.199 - _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
350.200 - }
350.201 - return _btOK;
350.202 - }
350.203 -
350.204 - /** Tries to find "Cancel" JButton in this dialog.
350.205 - * @return JButtonOperator
350.206 - */
350.207 - public JButtonOperator btCancel() {
350.208 - if (_btCancel==null) {
350.209 - _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.core.awt.Bundle").getString("CancelButton"));
350.210 - }
350.211 - return _btCancel;
350.212 - }
350.213 -
350.214 - /** Tries to find "Help" JButton in this dialog.
350.215 - * @return JButtonOperator
350.216 - */
350.217 - public JButtonOperator btHelp() {
350.218 - if (_btHelp==null) {
350.219 - _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
350.220 - }
350.221 - return _btHelp;
350.222 - }
350.223 -
350.224 -
350.225 - //****************************************
350.226 - // Low-level functionality definition part
350.227 - //****************************************
350.228 -
350.229 - /** clicks on " Sort by Name" JRadioButton
350.230 - */
350.231 - public void sortByName() {
350.232 - rbSortByName().push();
350.233 - }
350.234 -
350.235 - /** clicks on " Sort by Action" JRadioButton
350.236 - */
350.237 - public void sortByAction() {
350.238 - rbSortByAction().push();
350.239 - }
350.240 -
350.241 - /** clicks on "" MetalScrollButton
350.242 - */
350.243 - public void metalScrollButton() {
350.244 - btMetalScrollButton().push();
350.245 - }
350.246 -
350.247 - /** clicks on "" MetalScrollButton
350.248 - */
350.249 - public void metalScrollButton2() {
350.250 - btMetalScrollButton2().push();
350.251 - }
350.252 -
350.253 - /** clicks on "Add..." JButton
350.254 - */
350.255 - public void add() {
350.256 - btAdd().push();
350.257 - }
350.258 -
350.259 - /** clicks on "Remove" JButton
350.260 - */
350.261 - public void remove() {
350.262 - btRemove().push();
350.263 - }
350.264 -
350.265 - /** clicks on "OK" JButton
350.266 - */
350.267 - public void oK() {
350.268 - btOK().push();
350.269 - }
350.270 -
350.271 - /** clicks on "Cancel" JButton
350.272 - */
350.273 - public void cancel() {
350.274 - btCancel().push();
350.275 - }
350.276 -
350.277 - /** clicks on "Help" JButton
350.278 - */
350.279 - public void help() {
350.280 - btHelp().push();
350.281 - }
350.282 -
350.283 -
350.284 - //*****************************************
350.285 - // High-level functionality definition part
350.286 - //*****************************************
350.287 -
350.288 - /** Performs verification of KeyBindings by accessing all its components.
350.289 - */
350.290 - public void verify() {
350.291 - rbSortByName();
350.292 - rbSortByAction();
350.293 - lstActions();
350.294 - btMetalScrollButton();
350.295 - btMetalScrollButton2();
350.296 - lblKeybindings();
350.297 - lstKeybindings();
350.298 - btAdd();
350.299 - btRemove();
350.300 - btOK();
350.301 - btCancel();
350.302 - btHelp();
350.303 - }
350.304 -
350.305 - public List listActions() {
350.306 - ListModel model = lstActions().getModel();
350.307 - List ret=new Vector();
350.308 - for (int i=0;i < model.getSize();i++) {
350.309 - ret.add(model.getElementAt(i));
350.310 - }
350.311 - return ret;
350.312 - }
350.313 -
350.314 - public List listKeyBindings(String actionName) {
350.315 - JListOperator jlist=lstActions();
350.316 - jlist.selectItem(actionName);
350.317 - ListModel model = lstKeybindings().getModel();
350.318 - List ret=new Vector();
350.319 - for (int i=0;i < model.getSize();i++) {
350.320 - ret.add(model.getElementAt(i));
350.321 - }
350.322 - return ret;
350.323 - }
350.324 -
350.325 - /**
350.326 - * @param editorName
350.327 - * @return KeyBindingEditorOperator
350.328 - */
350.329 - public static KeyBindingsEditorOperator invoke(String editorName) {
350.330 - OptionsOperator options = OptionsOperator.invoke();
350.331 - options.advanced();
350.332 - try {
350.333 - Thread.sleep(1000);
350.334 - } catch (Exception ex) {
350.335 - }
350.336 - options.selectOption(ResourceBundle.getBundle("org/netbeans/core/Bundle").getString("UI/Services/Editing")+"|"+ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("OPTIONS_all")+"|" + editorName);
350.337 - //new EventTool().waitNoEvent(500);
350.338 - try {
350.339 - Thread.sleep(1000);
350.340 - } catch (Exception ex) {
350.341 - }
350.342 - PropertySheetOperator property = new PropertySheetOperator(options);
350.343 - PropertySheetTabOperator psto = new PropertySheetTabOperator(property);
350.344 - TextFieldProperty tfp=new TextFieldProperty(psto, ResourceBundle.getBundle("org/netbeans/modules/editor/options/Bundle").getString("PROP_KeyBindings"));
350.345 - tfp.openEditor();
350.346 - KeyBindingsEditorOperator ret=new KeyBindingsEditorOperator();
350.347 - //options.close();
350.348 - return ret;
350.349 - }
350.350 -
350.351 - /**
350.352 - * Get list of KeyBindingsEditor's actions.
350.353 - * @param editorName Name of KeyBindingsEditor.
350.354 - * @return List of KeyBindingsEditor's actions.
350.355 - */
350.356 - public static List listActions(String editorName) {
350.357 - KeyBindingsEditorOperator instance = invoke(editorName);
350.358 - List result = instance.listActions();
350.359 - instance.oK();
350.360 - return result;
350.361 - }
350.362 -
350.363 - /**
350.364 - * Get list of KeyBindingsEditor's bindings.
350.365 - * @param editorName Name of KeyBindingsEditor.
350.366 - * @return List of KeyBindingsEditor's bindings.
350.367 - */
350.368 - public static Hashtable listAllKeyBindings(String editorName) {
350.369 - KeyBindingsEditorOperator instance = invoke(editorName);
350.370 - List result = instance.listActions();
350.371 - Hashtable ret=new Hashtable();
350.372 - for (int i=0;i < result.size();i++) {
350.373 - ret.put(result.get(i).toString(),instance.listKeyBindings(result.get(i).toString()));
350.374 - }
350.375 - instance.oK();
350.376 - return ret;
350.377 - }
350.378 -
350.379 - /** Performs simple test of KeyBindings
350.380 - * @param args the command line arguments
350.381 - */
350.382 - public static void main(String args[]) {
350.383 - //repeating test
350.384 - String[] names=new String[] {"Plain Editor","HTML Editor","Java Editor"};
350.385 - List list;
350.386 - for (int j=0;j < 20;j++) {
350.387 -
350.388 - for (int i=0;i < names.length;i++) {
350.389 - list = KeyBindingsEditorOperator.listActions(names[i]);
350.390 - System.out.println("step "+j+" output size="+list.size());
350.391 - }
350.392 - }
350.393 -
350.394 - /*String name="Java Editor";
350.395 - Hashtable table;
350.396 - table = KeyBindings.listAllKeyBindings(name);
350.397 - Object[] keys=table.keySet().toArray();
350.398 - Arrays.sort(keys);
350.399 - List list;
350.400 - try {
350.401 - File out=new File("/tmp/"+name+" actions.lst");
350.402 - PrintWriter pw=new PrintWriter(new FileWriter(out));
350.403 - for (int i=0;i < keys.length;i++) {
350.404 - pw.print(keys[i]+": ");
350.405 - list=(List)table.get(keys[i]);
350.406 - for (int j=0;j < list.size();j++) {
350.407 - pw.print(list.get(j)+" ");
350.408 - }
350.409 - pw.println();
350.410 - }
350.411 - pw.close();
350.412 - } catch (Exception ex) {
350.413 - ex.printStackTrace();
350.414 - }*/
350.415 - }
350.416 -}
350.417 -
351.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ProcessDescriptorCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
351.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
351.3 @@ -1,172 +0,0 @@
351.4 -/*
351.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
351.6 - *
351.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
351.8 - *
351.9 - * The contents of this file are subject to the terms of either the GNU
351.10 - * General Public License Version 2 only ("GPL") or the Common
351.11 - * Development and Distribution License("CDDL") (collectively, the
351.12 - * "License"). You may not use this file except in compliance with the
351.13 - * License. You can obtain a copy of the License at
351.14 - * http://www.netbeans.org/cddl-gplv2.html
351.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
351.16 - * specific language governing permissions and limitations under the
351.17 - * License. When distributing the software, include this License Header
351.18 - * Notice in each file and include the License file at
351.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
351.20 - * particular file as subject to the "Classpath" exception as provided
351.21 - * by Sun in the GPL Version 2 section of the License file that
351.22 - * accompanied this code. If applicable, add the following below the
351.23 - * License Header, with the fields enclosed by brackets [] replaced by
351.24 - * your own identifying information:
351.25 - * "Portions Copyrighted [year] [name of copyright owner]"
351.26 - *
351.27 - * Contributor(s):
351.28 - *
351.29 - * The Original Software is NetBeans. The Initial Developer of the Original
351.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
351.31 - * Microsystems, Inc. All Rights Reserved.
351.32 - *
351.33 - * If you wish your version of this file to be governed by only the CDDL
351.34 - * or only the GPL Version 2, indicate your decision by adding
351.35 - * "[Contributor] elects to include this software in this distribution
351.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
351.37 - * single choice of license, a recipient has the option to distribute
351.38 - * your version of this file under either the CDDL, the GPL Version 2 or
351.39 - * to extend the choice of license to its licensees as provided above.
351.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
351.41 - * Version 2 license, then the option applies only if the new code is
351.42 - * made subject to such option by the copyright holder.
351.43 - */
351.44 -
351.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
351.46 -
351.47 -/*
351.48 - * ProcessDescriptorCustomEditorOperator.java
351.49 - *
351.50 - * Created on 6/12/02 5:00 PM
351.51 - */
351.52 -
351.53 -import javax.swing.JDialog;
351.54 -import org.netbeans.jellytools.Bundle;
351.55 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
351.56 -import org.netbeans.jemmy.operators.*;
351.57 -
351.58 -/** Class implementing all necessary methods for handling Process Descriptor Custom
351.59 - * Editor
351.60 - */
351.61 -public class ProcessDescriptorCustomEditorOperator extends NbDialogOperator {
351.62 -
351.63 - /** Creates new ProcessDescriptorCustomEditorOperator
351.64 - * @throws TimeoutExpiredException when NbDialog not found
351.65 - * @param title String title of custom editor */
351.66 - public ProcessDescriptorCustomEditorOperator(String title) {
351.67 - super(title);
351.68 - }
351.69 -
351.70 - /** creates new ProcessDescriptorCustomEditorOperator
351.71 - * @param wrapper JDialogOperator wrapper for custom editor */
351.72 - public ProcessDescriptorCustomEditorOperator(JDialogOperator wrapper) {
351.73 - super((JDialog)wrapper.getSource());
351.74 - }
351.75 -
351.76 - private JTextAreaOperator _txtArgumentKey;
351.77 - private JButtonOperator _btSelectProcessExecutable;
351.78 - private JTextFieldOperator _txtProcess;
351.79 - private JTextAreaOperator _txtArguments;
351.80 -
351.81 - /** Tries to find null JTextArea in this dialog.
351.82 - * @throws TimeoutExpiredException when component not found
351.83 - * @return JTextAreaOperator
351.84 - */
351.85 - public JTextAreaOperator txtArgumentKey() {
351.86 - if (_txtArgumentKey==null) {
351.87 - _txtArgumentKey = new JTextAreaOperator( this, 1 );
351.88 - }
351.89 - return _txtArgumentKey;
351.90 - }
351.91 -
351.92 - /** Tries to find ... JButton in this dialog.
351.93 - * @throws TimeoutExpiredException when component not found
351.94 - * @return JButtonOperator
351.95 - */
351.96 - public JButtonOperator btSelectProcessExecutable() {
351.97 - if (_btSelectProcessExecutable==null) {
351.98 - _btSelectProcessExecutable = new JButtonOperator(this,
351.99 - Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle",
351.100 - "CTL_NbProcessDescriptorCustomEditor.jButton1.text"));
351.101 - }
351.102 - return _btSelectProcessExecutable;
351.103 - }
351.104 -
351.105 - /** Tries to find null JTextField in this dialog.
351.106 - * @throws TimeoutExpiredException when component not found
351.107 - * @return JTextFieldOperator
351.108 - */
351.109 - public JTextFieldOperator txtProcess() {
351.110 - if (_txtProcess==null) {
351.111 - _txtProcess = new JTextFieldOperator( this, 0 );
351.112 - }
351.113 - return _txtProcess;
351.114 - }
351.115 -
351.116 - /** Tries to find null JTextArea in this dialog.
351.117 - * @throws TimeoutExpiredException when component not found
351.118 - * @return JTextAreaOperator
351.119 - */
351.120 - public JTextAreaOperator txtArguments() {
351.121 - if (_txtArguments==null) {
351.122 - _txtArguments = new JTextAreaOperator( this, 0 );
351.123 - }
351.124 - return _txtArguments;
351.125 - }
351.126 -
351.127 - /** getter for Argument Key text
351.128 - * @return String text of Argument Key */
351.129 - public String getArgumentKey() {
351.130 - return txtArgumentKey().getText();
351.131 - }
351.132 -
351.133 - /** clicks on ... JButton
351.134 - * @throws TimeoutExpiredException when JButton not found
351.135 - * @return FileCustomEditorOperator */
351.136 - public FileCustomEditorOperator selectProcessExecutable() {
351.137 - btSelectProcessExecutable().pushNoBlock();
351.138 - return new FileCustomEditorOperator(Bundle.getString("org.openide.actions.Bundle", "Open"));
351.139 - }
351.140 -
351.141 - /** getter of edited process text
351.142 - * @return String process text */
351.143 - public String getProcess() {
351.144 - return txtProcess().getText();
351.145 - }
351.146 -
351.147 - /** tries to find and set text of txtProcess
351.148 - * @param text String text
351.149 - */
351.150 - public void setProcess( String text ) {
351.151 - txtProcess().setText(text);
351.152 - }
351.153 -
351.154 - /** getter of edited arguments text
351.155 - * @return String argumentstext */
351.156 - public String getArguments() {
351.157 - return txtArguments().getText();
351.158 - }
351.159 -
351.160 - /** tries to find and set text of txtArguments
351.161 - * @param text String text
351.162 - */
351.163 - public void setArguments( String text ) {
351.164 - txtArguments().setText(text);
351.165 - }
351.166 -
351.167 - /** Performs verification by accessing all sub-components */
351.168 - public void verify() {
351.169 - txtArgumentKey();
351.170 - txtArguments();
351.171 - txtProcess();
351.172 - btSelectProcessExecutable();
351.173 - }
351.174 -}
351.175 -
352.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/RectangleCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
352.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
352.3 @@ -1,175 +0,0 @@
352.4 -/*
352.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
352.6 - *
352.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
352.8 - *
352.9 - * The contents of this file are subject to the terms of either the GNU
352.10 - * General Public License Version 2 only ("GPL") or the Common
352.11 - * Development and Distribution License("CDDL") (collectively, the
352.12 - * "License"). You may not use this file except in compliance with the
352.13 - * License. You can obtain a copy of the License at
352.14 - * http://www.netbeans.org/cddl-gplv2.html
352.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
352.16 - * specific language governing permissions and limitations under the
352.17 - * License. When distributing the software, include this License Header
352.18 - * Notice in each file and include the License file at
352.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
352.20 - * particular file as subject to the "Classpath" exception as provided
352.21 - * by Sun in the GPL Version 2 section of the License file that
352.22 - * accompanied this code. If applicable, add the following below the
352.23 - * License Header, with the fields enclosed by brackets [] replaced by
352.24 - * your own identifying information:
352.25 - * "Portions Copyrighted [year] [name of copyright owner]"
352.26 - *
352.27 - * Contributor(s):
352.28 - *
352.29 - * The Original Software is NetBeans. The Initial Developer of the Original
352.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
352.31 - * Microsystems, Inc. All Rights Reserved.
352.32 - *
352.33 - * If you wish your version of this file to be governed by only the CDDL
352.34 - * or only the GPL Version 2, indicate your decision by adding
352.35 - * "[Contributor] elects to include this software in this distribution
352.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
352.37 - * single choice of license, a recipient has the option to distribute
352.38 - * your version of this file under either the CDDL, the GPL Version 2 or
352.39 - * to extend the choice of license to its licensees as provided above.
352.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
352.41 - * Version 2 license, then the option applies only if the new code is
352.42 - * made subject to such option by the copyright holder.
352.43 - */
352.44 -
352.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
352.46 -
352.47 -import javax.swing.JDialog;
352.48 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
352.49 -import org.netbeans.jemmy.JemmyException;
352.50 -import org.netbeans.jemmy.operators.*;
352.51 -
352.52 -// editor for Rectangle
352.53 -/** Class implementing all necessary methods for handling Rectangle Custom Editor
352.54 - */
352.55 -public class RectangleCustomEditorOperator extends NbDialogOperator {
352.56 -
352.57 - JTextFieldOperator _txtFieldX;
352.58 - JTextFieldOperator _txtFieldY;
352.59 - JTextFieldOperator _txtFieldWidth;
352.60 - JTextFieldOperator _txtFieldHeight;
352.61 -
352.62 - /** creates new RectangleCustomEditorOperator
352.63 - * @param title String title of custom editor */
352.64 - public RectangleCustomEditorOperator(String title) {
352.65 - super(title);
352.66 - }
352.67 -
352.68 - /** creates new RectangleCustomEditorOperator
352.69 - * @param wrapper JDialogOperator wrapper for custom editor */
352.70 - public RectangleCustomEditorOperator(JDialogOperator wrapper) {
352.71 - super((JDialog)wrapper.getSource());
352.72 - }
352.73 -
352.74 - /** setter for edited rectangle value
352.75 - * @param x int x
352.76 - * @param y int y
352.77 - * @param width int width
352.78 - * @param height int height */
352.79 - public void setRectangleValue(String x, String y, String width, String height) {
352.80 - txtFieldX().setText(x);
352.81 - txtFieldY().setText(y);
352.82 - txtFieldWidth().setText(width);
352.83 - txtFieldHeight().setText(height);
352.84 - }
352.85 -
352.86 - /** getter for edited X value
352.87 - * @return int X */
352.88 - public String getXValue() {
352.89 - return txtFieldX().getText();
352.90 - }
352.91 -
352.92 - /** setter for edited X value
352.93 - * @param value int X */
352.94 - public void setXValue(String value) {
352.95 - txtFieldX().setText(value);
352.96 - }
352.97 -
352.98 - /** getter for edited Y value
352.99 - * @return int Y */
352.100 - public String getYValue() {
352.101 - return txtFieldY().getText();
352.102 - }
352.103 -
352.104 - /** setter for edited Y value
352.105 - * @param value int Y */
352.106 - public void setYValue(String value) {
352.107 - txtFieldY().setText(value);
352.108 - }
352.109 -
352.110 - /** getter for edited Width value
352.111 - * @return int Width */
352.112 - public String getWidthValue() {
352.113 - return txtFieldWidth().getText();
352.114 - }
352.115 -
352.116 - /** setter for edited Width value
352.117 - * @param value int Width */
352.118 - public void setWidthValue(String value) {
352.119 - txtFieldWidth().setText(value);
352.120 - }
352.121 -
352.122 - /** getter for edited Height value
352.123 - * @return int Height */
352.124 - public String getHeightValue() {
352.125 - return txtFieldHeight().getText();
352.126 - }
352.127 -
352.128 - /** setter for edited Height value
352.129 - * @param value int Height */
352.130 - public void setHeightValue(String value) {
352.131 - txtFieldHeight().setText(value);
352.132 - }
352.133 -
352.134 - /** getter for X JTextFieldOperator
352.135 - * @return JTextFieldOperator */
352.136 - public JTextFieldOperator txtFieldX() {
352.137 - if(_txtFieldX==null) {
352.138 - _txtFieldX = new JTextFieldOperator(this, 0);
352.139 - }
352.140 - return _txtFieldX;
352.141 - }
352.142 -
352.143 - /** getter for Y JTextFieldOperator
352.144 - * @return JTextFieldOperator */
352.145 - public JTextFieldOperator txtFieldY() {
352.146 - if(_txtFieldY==null) {
352.147 - _txtFieldY = new JTextFieldOperator(this, 1);
352.148 - }
352.149 - return _txtFieldY;
352.150 - }
352.151 -
352.152 - /** getter for Width JTextFieldOperator
352.153 - * @return JTextFieldOperator */
352.154 - public JTextFieldOperator txtFieldWidth() {
352.155 - if(_txtFieldWidth==null) {
352.156 - _txtFieldWidth = new JTextFieldOperator(this, 2);
352.157 - }
352.158 - return _txtFieldWidth;
352.159 - }
352.160 -
352.161 - /** getter for Height JTextFieldOperator
352.162 - * @return JTextFieldOperator */
352.163 - public JTextFieldOperator txtFieldHeight() {
352.164 - if(_txtFieldHeight==null) {
352.165 - _txtFieldHeight = new JTextFieldOperator(this, 3);
352.166 - }
352.167 - return _txtFieldHeight;
352.168 - }
352.169 -
352.170 - /** Performs verification by accessing all sub-components */
352.171 - public void verify() {
352.172 - txtFieldHeight();
352.173 - txtFieldWidth();
352.174 - txtFieldX();
352.175 - txtFieldY();
352.176 - }
352.177 -
352.178 -}
353.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/ServiceTypeCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
353.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
353.3 @@ -1,146 +0,0 @@
353.4 -/*
353.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
353.6 - *
353.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
353.8 - *
353.9 - * The contents of this file are subject to the terms of either the GNU
353.10 - * General Public License Version 2 only ("GPL") or the Common
353.11 - * Development and Distribution License("CDDL") (collectively, the
353.12 - * "License"). You may not use this file except in compliance with the
353.13 - * License. You can obtain a copy of the License at
353.14 - * http://www.netbeans.org/cddl-gplv2.html
353.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
353.16 - * specific language governing permissions and limitations under the
353.17 - * License. When distributing the software, include this License Header
353.18 - * Notice in each file and include the License file at
353.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
353.20 - * particular file as subject to the "Classpath" exception as provided
353.21 - * by Sun in the GPL Version 2 section of the License file that
353.22 - * accompanied this code. If applicable, add the following below the
353.23 - * License Header, with the fields enclosed by brackets [] replaced by
353.24 - * your own identifying information:
353.25 - * "Portions Copyrighted [year] [name of copyright owner]"
353.26 - *
353.27 - * Contributor(s):
353.28 - *
353.29 - * The Original Software is NetBeans. The Initial Developer of the Original
353.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
353.31 - * Microsystems, Inc. All Rights Reserved.
353.32 - *
353.33 - * If you wish your version of this file to be governed by only the CDDL
353.34 - * or only the GPL Version 2, indicate your decision by adding
353.35 - * "[Contributor] elects to include this software in this distribution
353.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
353.37 - * single choice of license, a recipient has the option to distribute
353.38 - * your version of this file under either the CDDL, the GPL Version 2 or
353.39 - * to extend the choice of license to its licensees as provided above.
353.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
353.41 - * Version 2 license, then the option applies only if the new code is
353.42 - * made subject to such option by the copyright holder.
353.43 - */
353.44 -
353.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
353.46 -
353.47 -/*
353.48 - * ServiceTypeCustomEditorOperator.java
353.49 - *
353.50 - * Created on 6/12/02 4:39 PM
353.51 - */
353.52 -
353.53 -import javax.swing.JDialog;
353.54 -import org.netbeans.jellytools.Bundle;
353.55 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
353.56 -import org.netbeans.modules.visualweb.gravy.properties.PropertySheetOperator;
353.57 -import org.netbeans.jemmy.operators.*;
353.58 -
353.59 -/** Class implementing all necessary methods for handling Service Type Custom Editor
353.60 - */
353.61 -public class ServiceTypeCustomEditorOperator extends NbDialogOperator {
353.62 -
353.63 - /** Creates new ServiceTypeCustomEditorOperator
353.64 - * @throws TimeoutExpiredException when NbDialog not found
353.65 - * @param title String title of custom editor */
353.66 - public ServiceTypeCustomEditorOperator(String title) {
353.67 - super(title);
353.68 - }
353.69 -
353.70 - /** creates new ServiceTypeCustomEditorOperator
353.71 - * @param wrapper JDialogOperator wrapper for custom editor */
353.72 - public ServiceTypeCustomEditorOperator(JDialogOperator wrapper) {
353.73 - super((JDialog)wrapper.getSource());
353.74 - }
353.75 -
353.76 - private JButtonOperator _btDefault;
353.77 - private JSplitPaneOperator _splitPane;
353.78 - private JListOperator _lstServices;
353.79 - private PropertySheetOperator _propertySheet;
353.80 -
353.81 - /** Tries to find "Default" JButton in this dialog.
353.82 - * @throws TimeoutExpiredException when component not found
353.83 - * @return JButtonOperator
353.84 - */
353.85 - public JButtonOperator btDefault() {
353.86 - if (_btDefault==null) {
353.87 - _btDefault = new JButtonOperator( this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "LAB_DefaultServiceType"));
353.88 - }
353.89 - return _btDefault;
353.90 - }
353.91 -
353.92 - /** getter for JSplitPaneOperator
353.93 - * @return JSplitPaneOperator */
353.94 - public JSplitPaneOperator splitPane() {
353.95 - if (_splitPane==null) {
353.96 - _splitPane=new JSplitPaneOperator(this);
353.97 - }
353.98 - return _splitPane;
353.99 - }
353.100 -
353.101 - /** Tries to find null ListView$NbList in this dialog.
353.102 - * @throws TimeoutExpiredException when component not found
353.103 - * @return JListOperator
353.104 - */
353.105 - public JListOperator lstServices() {
353.106 - if (_lstServices==null) {
353.107 - _lstServices = new JListOperator(splitPane());
353.108 - }
353.109 - return _lstServices;
353.110 - }
353.111 -
353.112 - /** getter for PropertySheetOperator
353.113 - * @return PropertySheetOperator */
353.114 - public PropertySheetOperator propertySheet() {
353.115 - if (_propertySheet==null) {
353.116 - _propertySheet=new PropertySheetOperator(splitPane());
353.117 - }
353.118 - return _propertySheet;
353.119 - }
353.120 -
353.121 - /** clicks on "Default" JButton
353.122 - * @throws TimeoutExpiredException when JButton not found
353.123 - */
353.124 - public void setDefault() {
353.125 - btDefault().push();
353.126 - }
353.127 -
353.128 - /** getter for selected service type name
353.129 - * @return String service type name */
353.130 - public String getServiceTypeValue() {
353.131 - Object o=lstServices().getSelectedValue();
353.132 - if (o!=null) return o.toString();
353.133 - return null;
353.134 - }
353.135 -
353.136 - /** setter for service type name
353.137 - * @param serviceName String name of service type to be set */
353.138 - public void setServiceTypeValue(String serviceName) {
353.139 - lstServices().selectItem(serviceName);
353.140 - }
353.141 -
353.142 - /** Performs verification by accessing all sub-components */
353.143 - public void verify() {
353.144 - btDefault();
353.145 - lstServices();
353.146 - propertySheet();
353.147 - }
353.148 -}
353.149 -
354.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/StringArrayCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
354.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
354.3 @@ -1,289 +0,0 @@
354.4 -/*
354.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
354.6 - *
354.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
354.8 - *
354.9 - * The contents of this file are subject to the terms of either the GNU
354.10 - * General Public License Version 2 only ("GPL") or the Common
354.11 - * Development and Distribution License("CDDL") (collectively, the
354.12 - * "License"). You may not use this file except in compliance with the
354.13 - * License. You can obtain a copy of the License at
354.14 - * http://www.netbeans.org/cddl-gplv2.html
354.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
354.16 - * specific language governing permissions and limitations under the
354.17 - * License. When distributing the software, include this License Header
354.18 - * Notice in each file and include the License file at
354.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
354.20 - * particular file as subject to the "Classpath" exception as provided
354.21 - * by Sun in the GPL Version 2 section of the License file that
354.22 - * accompanied this code. If applicable, add the following below the
354.23 - * License Header, with the fields enclosed by brackets [] replaced by
354.24 - * your own identifying information:
354.25 - * "Portions Copyrighted [year] [name of copyright owner]"
354.26 - *
354.27 - * Contributor(s):
354.28 - *
354.29 - * The Original Software is NetBeans. The Initial Developer of the Original
354.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
354.31 - * Microsystems, Inc. All Rights Reserved.
354.32 - *
354.33 - * If you wish your version of this file to be governed by only the CDDL
354.34 - * or only the GPL Version 2, indicate your decision by adding
354.35 - * "[Contributor] elects to include this software in this distribution
354.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
354.37 - * single choice of license, a recipient has the option to distribute
354.38 - * your version of this file under either the CDDL, the GPL Version 2 or
354.39 - * to extend the choice of license to its licensees as provided above.
354.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
354.41 - * Version 2 license, then the option applies only if the new code is
354.42 - * made subject to such option by the copyright holder.
354.43 - */
354.44 -
354.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
354.46 -
354.47 -import java.util.ResourceBundle;
354.48 -import javax.swing.JDialog;
354.49 -import javax.swing.ListModel;
354.50 -import org.netbeans.jellytools.Bundle;
354.51 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
354.52 -import org.netbeans.jemmy.operators.*;
354.53 -
354.54 -/** Class implementing all necessary methods for handling String Array Custom Editor
354.55 - */
354.56 -public class StringArrayCustomEditorOperator extends NbDialogOperator {
354.57 -
354.58 - /** Creates new StringArrayCustomEditorOperator
354.59 - * @throws TimeoutExpiredException when NbDialog not found
354.60 - * @param title String title of custom editor */
354.61 - public StringArrayCustomEditorOperator(String title) {
354.62 - super(title);
354.63 - }
354.64 -
354.65 - /** Creates new StringArrayCustomEditorOperator
354.66 - * @param wrapper JDialogOperator wrapper for custom editor */
354.67 - public StringArrayCustomEditorOperator(JDialogOperator wrapper) {
354.68 - super((JDialog)wrapper.getSource());
354.69 - }
354.70 -
354.71 - private JButtonOperator _btAdd;
354.72 - private JButtonOperator _btRemove;
354.73 - private JButtonOperator _btEdit;
354.74 - private JButtonOperator _btUp;
354.75 - private JButtonOperator _btDown;
354.76 - private JListOperator _lstItemList;
354.77 - private JTextFieldOperator _txtItemText;
354.78 - private static final ResourceBundle _bundle = Bundle.getBundle("org.netbeans.beaninfo.editors.Bundle");
354.79 -
354.80 - //******************************
354.81 - // Subcomponents definition part
354.82 - //******************************
354.83 -
354.84 - /** Tries to find "Edit" JButton in this dialog.
354.85 - * @throws TimeoutExpiredException when component not found
354.86 - * @return JButtonOperator
354.87 - */
354.88 - public JButtonOperator btEdit() {
354.89 - if (_btEdit==null) {
354.90 - _btEdit = new JButtonOperator(this, _bundle.getString("CTL_Change_StringArrayCustomEditor"));
354.91 - }
354.92 - return _btEdit;
354.93 - }
354.94 -
354.95 - /** Tries to find "Down" JButton in this dialog.
354.96 - * @throws TimeoutExpiredException when component not found
354.97 - * @return JButtonOperator
354.98 - */
354.99 - public JButtonOperator btDown() {
354.100 - if (_btDown==null) {
354.101 - _btDown = new JButtonOperator(this, _bundle.getString("CTL_MoveDown"));
354.102 - }
354.103 - return _btDown;
354.104 - }
354.105 -
354.106 - /** Tries to find "Up" JButton in this dialog.
354.107 - * @throws TimeoutExpiredException when component not found
354.108 - * @return JButtonOperator
354.109 - */
354.110 - public JButtonOperator btUp() {
354.111 - if (_btUp==null) {
354.112 - _btUp = new JButtonOperator(this, _bundle.getString("CTL_MoveUp"));
354.113 - }
354.114 - return _btUp;
354.115 - }
354.116 -
354.117 - /** Tries to find "Add" JButton in this dialog.
354.118 - * @throws TimeoutExpiredException when component not found
354.119 - * @return JButtonOperator
354.120 - */
354.121 - public JButtonOperator btAdd() {
354.122 - if (_btAdd==null) {
354.123 - _btAdd = new JButtonOperator(this, _bundle.getString("CTL_Add_StringArrayCustomEditor"));
354.124 - }
354.125 - return _btAdd;
354.126 - }
354.127 -
354.128 - /** Tries to find JList in this dialog.
354.129 - * @throws TimeoutExpiredException when component not found
354.130 - * @return JListOperator
354.131 - */
354.132 - public JListOperator lstItemList() {
354.133 - if (_lstItemList==null) {
354.134 - _lstItemList = new JListOperator(this);
354.135 - }
354.136 - return _lstItemList;
354.137 - }
354.138 -
354.139 - /** Tries to find "Remove" JButton in this dialog.
354.140 - * @throws TimeoutExpiredException when component not found
354.141 - * @return JButtonOperator
354.142 - */
354.143 - public JButtonOperator btRemove() {
354.144 - if (_btRemove==null) {
354.145 - _btRemove = new JButtonOperator(this, _bundle.getString("CTL_Remove"));
354.146 - }
354.147 - return _btRemove;
354.148 - }
354.149 -
354.150 - /** Tries to find null JTextField in this dialog.
354.151 - * @throws TimeoutExpiredException when component not found
354.152 - * @return JTextFieldOperator
354.153 - */
354.154 - public JTextFieldOperator txtItemText() {
354.155 - if (_txtItemText==null) {
354.156 - _txtItemText = new JTextFieldOperator(this);
354.157 - }
354.158 - return _txtItemText;
354.159 - }
354.160 -
354.161 - /** clicks on "Edit" JButton
354.162 - * @throws TimeoutExpiredException when JButton not found
354.163 - */
354.164 - public void edit() {
354.165 - btEdit().push();
354.166 - }
354.167 -
354.168 - /** clicks on "Down" JButton
354.169 - * @throws TimeoutExpiredException when JButton not found
354.170 - */
354.171 - public void down() {
354.172 - btDown().push();
354.173 - }
354.174 -
354.175 - /** clicks on "Up" JButton
354.176 - * @throws TimeoutExpiredException when JButton not found
354.177 - */
354.178 - public void up() {
354.179 - btUp().push();
354.180 - }
354.181 -
354.182 - /** clicks on "Add" JButton
354.183 - * @throws TimeoutExpiredException when JButton not found
354.184 - */
354.185 - public void add() {
354.186 - btAdd().push();
354.187 - }
354.188 -
354.189 - /** clicks on "Remove" JButton
354.190 - * @throws TimeoutExpiredException when JButton not found
354.191 - */
354.192 - public void remove() {
354.193 - btRemove().push();
354.194 - }
354.195 -
354.196 - /** Gets text from text field.
354.197 - * @return String edited item text */
354.198 - public String getItemText() {
354.199 - return txtItemText().getText();
354.200 - }
354.201 -
354.202 - /** tries to find and set text of txtItem
354.203 - * @param text String text
354.204 - */
354.205 - public void setItemText( String text ) {
354.206 - txtItemText().clearText();
354.207 - txtItemText().typeText(text);
354.208 - }
354.209 -
354.210 -
354.211 - /** getter for array of Strings
354.212 - * @return String[] array of strings from custom editor */
354.213 - public String[] getStringArrayValue() {
354.214 - ListModel lm=lstItemList().getModel();
354.215 - String value[]=new String[lm.getSize()];
354.216 - for (int i=0; i<lm.getSize(); i++) {
354.217 - value[i]=lm.getElementAt(i).toString();
354.218 - }
354.219 - return value;
354.220 - }
354.221 -
354.222 - /** adds String to the edited array
354.223 - * @param value String value to be added */
354.224 - public void add(String value) {
354.225 - setItemText(value);
354.226 - add();
354.227 - }
354.228 -
354.229 - /** removes String from array
354.230 - * @param value String value to be removed */
354.231 - public void remove(String value) {
354.232 - lstItemList().selectItem(value);
354.233 - remove();
354.234 - }
354.235 -
354.236 - /** removes all Strings from array */
354.237 - public void removeAll() {
354.238 - while (lstItemList().getModel().getSize()>0) {
354.239 - lstItemList().selectItem(0);
354.240 - remove();
354.241 - }
354.242 - }
354.243 -
354.244 - /** Replaces oldValue by newValue. It selects oldValue item in the list,
354.245 - * types newValue into text field and pushes Edit button.
354.246 - * @param oldValue value from list to be replaced
354.247 - * @param newValue new value
354.248 - */
354.249 - public void edit(String oldValue, String newValue) {
354.250 - lstItemList().selectItem(oldValue);
354.251 - setItemText(newValue);
354.252 - edit();
354.253 - }
354.254 -
354.255 - /** Moves given item one position up. It select value item and pushes
354.256 - * Up button. It fails, if item is the topmost and Up button is disabled.
354.257 - * @param value item to be moved up
354.258 - */
354.259 - public void up(String value) {
354.260 - lstItemList().selectItem(value);
354.261 - up();
354.262 - }
354.263 -
354.264 - /** Moves given item one position down. It select value item and pushes
354.265 - * Down button. It fails, if item is the bottommost and Down button is disabled.
354.266 - * @param value item to be moved down
354.267 - */
354.268 - public void down(String value) {
354.269 - lstItemList().selectItem(value);
354.270 - down();
354.271 - }
354.272 -
354.273 - /** setter for String array
354.274 - * @param value String[] array os Strings to be set */
354.275 - public void setStringArrayValue(String[] value) {
354.276 - removeAll();
354.277 - for (int i=0; i<value.length; i++)
354.278 - add(value[i]);
354.279 - }
354.280 -
354.281 - /** Performs verification by accessing all sub-components */
354.282 - public void verify() {
354.283 - btAdd();
354.284 - btRemove();
354.285 - btEdit();
354.286 - btUp();
354.287 - btDown();
354.288 - lstItemList();
354.289 - txtItemText();
354.290 - }
354.291 -}
354.292 -
355.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/properties/editors/StringCustomEditorOperator.java Thu Jul 10 04:29:52 2008 -0700
355.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
355.3 @@ -1,92 +0,0 @@
355.4 -/*
355.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
355.6 - *
355.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
355.8 - *
355.9 - * The contents of this file are subject to the terms of either the GNU
355.10 - * General Public License Version 2 only ("GPL") or the Common
355.11 - * Development and Distribution License("CDDL") (collectively, the
355.12 - * "License"). You may not use this file except in compliance with the
355.13 - * License. You can obtain a copy of the License at
355.14 - * http://www.netbeans.org/cddl-gplv2.html
355.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
355.16 - * specific language governing permissions and limitations under the
355.17 - * License. When distributing the software, include this License Header
355.18 - * Notice in each file and include the License file at
355.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
355.20 - * particular file as subject to the "Classpath" exception as provided
355.21 - * by Sun in the GPL Version 2 section of the License file that
355.22 - * accompanied this code. If applicable, add the following below the
355.23 - * License Header, with the fields enclosed by brackets [] replaced by
355.24 - * your own identifying information:
355.25 - * "Portions Copyrighted [year] [name of copyright owner]"
355.26 - *
355.27 - * Contributor(s):
355.28 - *
355.29 - * The Original Software is NetBeans. The Initial Developer of the Original
355.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
355.31 - * Microsystems, Inc. All Rights Reserved.
355.32 - *
355.33 - * If you wish your version of this file to be governed by only the CDDL
355.34 - * or only the GPL Version 2, indicate your decision by adding
355.35 - * "[Contributor] elects to include this software in this distribution
355.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
355.37 - * single choice of license, a recipient has the option to distribute
355.38 - * your version of this file under either the CDDL, the GPL Version 2 or
355.39 - * to extend the choice of license to its licensees as provided above.
355.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
355.41 - * Version 2 license, then the option applies only if the new code is
355.42 - * made subject to such option by the copyright holder.
355.43 - */
355.44 -
355.45 -package org.netbeans.modules.visualweb.gravy.properties.editors;
355.46 -
355.47 -import javax.swing.JDialog;
355.48 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
355.49 -import org.netbeans.jemmy.operators.*;
355.50 -
355.51 -/** Class implementing all necessary methods for handling String Custom Editor
355.52 - */
355.53 -public class StringCustomEditorOperator extends NbDialogOperator {
355.54 -
355.55 - private JTextAreaOperator _txtArea;
355.56 -
355.57 - /** Creates new StringCustomEditorOperator
355.58 - * @param title String title of custom editor */
355.59 - public StringCustomEditorOperator(String title) {
355.60 - super(title);
355.61 - }
355.62 -
355.63 - /** Creates new StringCustomEditorOperator
355.64 - * @param wrapper JDialogOperator wrapper for custom editor */
355.65 - public StringCustomEditorOperator(JDialogOperator wrapper) {
355.66 - super((JDialog)wrapper.getSource());
355.67 - }
355.68 -
355.69 - /** setter for edited String value
355.70 - * @return String */
355.71 - public String getStringValue() {
355.72 - return txtArea().getText();
355.73 - }
355.74 -
355.75 - /** getter for edited String value
355.76 - * @param text String */
355.77 - public void setStringValue(String text) {
355.78 - txtArea().setText(text);
355.79 - }
355.80 -
355.81 - /** getter for JTextFieldOperator with edited text
355.82 - * @return JTextFieldOperator */
355.83 - public JTextAreaOperator txtArea() {
355.84 - if(_txtArea==null) {
355.85 - _txtArea = new JTextAreaOperator(this);
355.86 - }
355.87 - return _txtArea;
355.88 - }
355.89 -
355.90 - /** Performs verification by accessing all sub-components */
355.91 - public void verify() {
355.92 - txtArea();
355.93 - }
355.94 -
355.95 -}
356.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/search/SearchPanelOperator.java Thu Jul 10 04:29:52 2008 -0700
356.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
356.3 @@ -1,200 +0,0 @@
356.4 -/*
356.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
356.6 - *
356.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
356.8 - *
356.9 - * The contents of this file are subject to the terms of either the GNU
356.10 - * General Public License Version 2 only ("GPL") or the Common
356.11 - * Development and Distribution License("CDDL") (collectively, the
356.12 - * "License"). You may not use this file except in compliance with the
356.13 - * License. You can obtain a copy of the License at
356.14 - * http://www.netbeans.org/cddl-gplv2.html
356.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
356.16 - * specific language governing permissions and limitations under the
356.17 - * License. When distributing the software, include this License Header
356.18 - * Notice in each file and include the License file at
356.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
356.20 - * particular file as subject to the "Classpath" exception as provided
356.21 - * by Sun in the GPL Version 2 section of the License file that
356.22 - * accompanied this code. If applicable, add the following below the
356.23 - * License Header, with the fields enclosed by brackets [] replaced by
356.24 - * your own identifying information:
356.25 - * "Portions Copyrighted [year] [name of copyright owner]"
356.26 - *
356.27 - * Contributor(s):
356.28 - *
356.29 - * The Original Software is NetBeans. The Initial Developer of the Original
356.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
356.31 - * Microsystems, Inc. All Rights Reserved.
356.32 - *
356.33 - * If you wish your version of this file to be governed by only the CDDL
356.34 - * or only the GPL Version 2, indicate your decision by adding
356.35 - * "[Contributor] elects to include this software in this distribution
356.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
356.37 - * single choice of license, a recipient has the option to distribute
356.38 - * your version of this file under either the CDDL, the GPL Version 2 or
356.39 - * to extend the choice of license to its licensees as provided above.
356.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
356.41 - * Version 2 license, then the option applies only if the new code is
356.42 - * made subject to such option by the copyright holder.
356.43 - */
356.44 -
356.45 -package org.netbeans.modules.visualweb.gravy.search;
356.46 -
356.47 -import java.awt.Point;
356.48 -
356.49 -import org.netbeans.modules.visualweb.gravy.Util;
356.50 -
356.51 -import org.netbeans.modules.search.SearchPanel;
356.52 -
356.53 -import java.awt.Component;
356.54 -
356.55 -import org.netbeans.jellytools.Bundle;
356.56 -
356.57 -import org.netbeans.jemmy.ComponentChooser;
356.58 -
356.59 -import org.netbeans.jemmy.operators.JComboBoxOperator;
356.60 -import org.netbeans.jemmy.operators.ContainerOperator;
356.61 -import org.netbeans.jemmy.operators.JButtonOperator;
356.62 -import org.netbeans.jemmy.operators.JCheckBoxOperator;
356.63 -import org.netbeans.jemmy.operators.JDialogOperator;
356.64 -import org.netbeans.jemmy.operators.JTabbedPaneOperator;
356.65 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
356.66 -import org.netbeans.jemmy.operators.JRadioButtonOperator;
356.67 -import org.netbeans.jemmy.operators.JTextFieldOperator;
356.68 -import org.netbeans.jemmy.operators.Operator;
356.69 -
356.70 -
356.71 -/**
356.72 - * SearchPanelOperator class
356.73 - * @author <a href="mailto:sva@sparc.spb.su">Vladimir Strigun</a>
356.74 - */
356.75 -public class SearchPanelOperator extends JDialogOperator {
356.76 -
356.77 - JTabbedPaneOperator tabbedPane;
356.78 -
356.79 - public SearchPanelOperator() {
356.80 - super("Find In FIles");
356.81 - }
356.82 -
356.83 -
356.84 - public void switchToObjectNameTab(){
356.85 - switchToTab(1);
356.86 - }
356.87 -
356.88 - public void switchToTypeTab(){
356.89 - switchToTab(2);
356.90 - }
356.91 -
356.92 - public Component switchToTab(int index){
356.93 - SearchPanelOperator searchPanel = new SearchPanelOperator();
356.94 - if(tabbedPane == null ) this.tabbedPane = new JTabbedPaneOperator(searchPanel, 0);
356.95 - return tabbedPane.selectPage(index);
356.96 - }
356.97 -
356.98 - public void close(){
356.99 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_CANCEL"));
356.100 - }
356.101 -
356.102 - public void search(){
356.103 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SEARCH"));
356.104 - }
356.105 -
356.106 - public void help(){
356.107 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_HELP"));
356.108 - }
356.109 -
356.110 - private void pushButton(String title){
356.111 - (new JButtonOperator(new SearchPanelOperator(), title)).push();
356.112 - }
356.113 -
356.114 - public static class SearchPanelChooser implements ComponentChooser {
356.115 - public SearchPanelChooser() {
356.116 - }
356.117 - public boolean checkComponent(Component comp) {
356.118 - return(comp instanceof org.netbeans.modules.search.SearchPanel);
356.119 - }
356.120 - public String getDescription() {
356.121 - return(SearchPanel.class.getName());
356.122 - }
356.123 - }
356.124 -
356.125 - public void setDateBetween(int dateNum, String date){
356.126 - switchToTab(3);
356.127 - (new JTextFieldOperator(this, dateNum)).typeText(date);
356.128 - }
356.129 -
356.130 - public void setWithinDate(String date){
356.131 - switchToTab(3);
356.132 - (new JTextFieldOperator(this, 0)).typeText(date);
356.133 - }
356.134 -
356.135 - public void pressCriterion(int tabNumber, boolean check){
356.136 - switchToTab(tabNumber);
356.137 - (new JCheckBoxOperator(this, 2)).changeSelection(check);
356.138 - }
356.139 -
356.140 - public void setSubstringText(int tabNumber, String text){
356.141 - switchToTab(tabNumber);
356.142 - (new JTextFieldOperator(this, 0)).typeText(text);
356.143 - }
356.144 -
356.145 - public String getSubstringText(int tabNumber){
356.146 - switchToTab(tabNumber);
356.147 - return (new JTextFieldOperator(this, 0)).getText();
356.148 - }
356.149 -
356.150 - public void setRegularExpression(int tabNumber, String text){
356.151 - switchToTab(tabNumber);
356.152 - (new JTextFieldOperator(this, 1)).typeText(text);
356.153 - }
356.154 -
356.155 - public void matchCase(int tabNumber, boolean matchCase){
356.156 - Component tab = switchToTab(tabNumber);
356.157 - (new JRadioButtonOperator(this, 0)).doClick();
356.158 - (new JCheckBoxOperator(this, 0)).changeSelection(matchCase);
356.159 - }
356.160 -
356.161 - public boolean getCaseState(int tabNumber){
356.162 - Component tab = switchToTab(tabNumber);
356.163 - (new JRadioButtonOperator(this, 0)).doClick();
356.164 - return (new JCheckBoxOperator(this, 0)).isSelected();
356.165 - }
356.166 -
356.167 - public void matchWholeWords(int tabNumber, boolean wholeWords){
356.168 - Component tab = switchToTab(tabNumber);
356.169 - (new JRadioButtonOperator(this, 0)).doClick();
356.170 - (new JCheckBoxOperator(this, 1)).changeSelection(wholeWords);
356.171 - }
356.172 -
356.173 -
356.174 - public boolean getWholeWordsState(int tabNumber){
356.175 - Component tab = switchToTab(tabNumber);
356.176 - (new JRadioButtonOperator(this, 0)).doClick();
356.177 - return (new JCheckBoxOperator(this, 1)).isSelected();
356.178 - }
356.179 -
356.180 - public boolean getCriterionState(int tabNumber){
356.181 - Component tab = switchToTab(tabNumber);
356.182 - (new JRadioButtonOperator(this, 0)).doClick();
356.183 - return (new JCheckBoxOperator(this, 2)).isSelected();
356.184 - }
356.185 -
356.186 - public void saveSettings(int tabNumber, String name){
356.187 - Component tab = switchToTab(tabNumber);
356.188 - (new JButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SAVE_AS"))).push();
356.189 - JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_LABEL_SAVE_CRITERION"));
356.190 - (new JTextFieldOperator(dialog)).typeText(name);
356.191 - (new JButtonOperator(dialog, "OK")).push();
356.192 - }
356.193 -
356.194 - public void restoreSettings(int tabNumber, String name){
356.195 - Component tab = switchToTab(tabNumber);
356.196 - (new JButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_RESTORE"))).push();
356.197 - JDialogOperator dialog = new JDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_LABEL_RESTORE_CRITERION"));
356.198 - (new JComboBoxOperator(dialog)).selectItem(name);
356.199 - (new JButtonOperator(dialog, "OK")).push();
356.200 - }
356.201 -
356.202 -}
356.203 -
357.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/search/SearchResultsOperator.java Thu Jul 10 04:29:52 2008 -0700
357.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
357.3 @@ -1,162 +0,0 @@
357.4 -/*
357.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
357.6 - *
357.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
357.8 - *
357.9 - * The contents of this file are subject to the terms of either the GNU
357.10 - * General Public License Version 2 only ("GPL") or the Common
357.11 - * Development and Distribution License("CDDL") (collectively, the
357.12 - * "License"). You may not use this file except in compliance with the
357.13 - * License. You can obtain a copy of the License at
357.14 - * http://www.netbeans.org/cddl-gplv2.html
357.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
357.16 - * specific language governing permissions and limitations under the
357.17 - * License. When distributing the software, include this License Header
357.18 - * Notice in each file and include the License file at
357.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
357.20 - * particular file as subject to the "Classpath" exception as provided
357.21 - * by Sun in the GPL Version 2 section of the License file that
357.22 - * accompanied this code. If applicable, add the following below the
357.23 - * License Header, with the fields enclosed by brackets [] replaced by
357.24 - * your own identifying information:
357.25 - * "Portions Copyrighted [year] [name of copyright owner]"
357.26 - *
357.27 - * Contributor(s):
357.28 - *
357.29 - * The Original Software is NetBeans. The Initial Developer of the Original
357.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
357.31 - * Microsystems, Inc. All Rights Reserved.
357.32 - *
357.33 - * If you wish your version of this file to be governed by only the CDDL
357.34 - * or only the GPL Version 2, indicate your decision by adding
357.35 - * "[Contributor] elects to include this software in this distribution
357.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
357.37 - * single choice of license, a recipient has the option to distribute
357.38 - * your version of this file under either the CDDL, the GPL Version 2 or
357.39 - * to extend the choice of license to its licensees as provided above.
357.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
357.41 - * Version 2 license, then the option applies only if the new code is
357.42 - * made subject to such option by the copyright holder.
357.43 - */
357.44 -
357.45 -package org.netbeans.modules.visualweb.gravy.search;
357.46 -
357.47 -import java.awt.Point;
357.48 -
357.49 -import org.netbeans.modules.visualweb.gravy.Util;
357.50 -
357.51 -//import org.netbeans.modules.search.ResultView;
357.52 -import org.netbeans.modules.visualweb.gravy.TopComponentOperator;
357.53 -
357.54 -import java.awt.Component;
357.55 -import org.netbeans.jellytools.Bundle;
357.56 -
357.57 -import org.netbeans.jemmy.ComponentChooser;
357.58 -
357.59 -import org.netbeans.jemmy.operators.ContainerOperator;
357.60 -import org.netbeans.jemmy.operators.JComponentOperator;
357.61 -import org.netbeans.jemmy.operators.JButtonOperator;
357.62 -import org.netbeans.jemmy.operators.JPopupMenuOperator;
357.63 -import org.netbeans.jemmy.operators.JRadioButtonOperator;
357.64 -import org.netbeans.jemmy.operators.JTreeOperator;
357.65 -import org.netbeans.jemmy.operators.Operator;
357.66 -
357.67 -import javax.swing.*;
357.68 -
357.69 -/**
357.70 - * SearchResultsOperator class
357.71 - * @author <a href="mailto:sva@sparc.spb.su">Vladimir Strigun</a>
357.72 - */
357.73 -public class SearchResultsOperator extends TopComponentOperator{
357.74 -
357.75 - JTreeOperator tree;
357.76 -
357.77 - public SearchResultsOperator(ContainerOperator cont) {
357.78 - super(cont, new SearchResultsChooser());
357.79 - }
357.80 - public SearchResultsOperator() {
357.81 - //this(Util.getMainTab());
357.82 - this(Util.getMainWindow());
357.83 - }
357.84 -
357.85 - public static class SearchResultsChooser implements ComponentChooser {
357.86 - public SearchResultsChooser() {
357.87 - }
357.88 - public boolean checkComponent(Component comp) {
357.89 - Class curClass = comp.getClass();
357.90 - while(curClass != null) {
357.91 - if(curClass.getName().equals("org.netbeans.modules.search.ResultView")) {
357.92 - return(true);
357.93 - }
357.94 - curClass = curClass.getSuperclass();
357.95 - }
357.96 - return(false);
357.97 - }
357.98 - public String getDescription() {
357.99 - return("org.netbeans.modules.search.ResultView");
357.100 - }
357.101 - }
357.102 -
357.103 - public JTreeOperator getTree() {
357.104 - if(tree == null) {
357.105 - makeComponentVisible();
357.106 - tree = new JTreeOperator(this);
357.107 - }
357.108 - return(tree);
357.109 - }
357.110 -
357.111 - public void close(){
357.112 - //pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_CANCEL"));
357.113 - super.close();
357.114 - }
357.115 -
357.116 - public void pushButton(String title){
357.117 - Util.getMainTab().setSelectedIndex(Util.getMainTab().findPage("Search Results"));
357.118 - (new JButtonOperator(this, title)).push();
357.119 - }
357.120 -
357.121 - public void help(){
357.122 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_HELP"));
357.123 - }
357.124 -
357.125 - public void modifySearch(){
357.126 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_CUSTOMIZE"));
357.127 - }
357.128 -
357.129 - public void showAllDetails(){
357.130 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_FILL"));
357.131 - }
357.132 -
357.133 - public void stopSearch(){
357.134 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_STOP"));
357.135 - }
357.136 -
357.137 - public void showInExplorer(){
357.138 - pushButton(Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SHOW"));
357.139 - }
357.140 -
357.141 - public void sortByName(){
357.142 - (new JRadioButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_SORT"))).doClick();
357.143 - }
357.144 -
357.145 - public void sortByDefault(){
357.146 - (new JRadioButtonOperator(this, Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "TEXT_BUTTON_UNSORT"))).doClick();
357.147 - }
357.148 -
357.149 - public void selectFoundedFile(String node){
357.150 - JTreeOperator resTree = getTree();
357.151 - tree.selectPath(tree.findPath(node));
357.152 - }
357.153 -
357.154 - public String getFoundedFileName(int index){
357.155 - JTreeOperator resTree = getTree();
357.156 - return (tree.getChild(tree.getRoot(), index)).toString();
357.157 - }
357.158 -
357.159 - public int getFoundedFilesCount(){
357.160 - JTreeOperator resTree = getTree();
357.161 - return tree.getChildCount(tree.getRoot());
357.162 - }
357.163 -
357.164 -}
357.165 -
358.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/toolbox/PaletteContainerOperator.java Thu Jul 10 04:29:52 2008 -0700
358.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
358.3 @@ -1,395 +0,0 @@
358.4 -/*
358.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
358.6 - *
358.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
358.8 - *
358.9 - * The contents of this file are subject to the terms of either the GNU
358.10 - * General Public License Version 2 only ("GPL") or the Common
358.11 - * Development and Distribution License("CDDL") (collectively, the
358.12 - * "License"). You may not use this file except in compliance with the
358.13 - * License. You can obtain a copy of the License at
358.14 - * http://www.netbeans.org/cddl-gplv2.html
358.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
358.16 - * specific language governing permissions and limitations under the
358.17 - * License. When distributing the software, include this License Header
358.18 - * Notice in each file and include the License file at
358.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
358.20 - * particular file as subject to the "Classpath" exception as provided
358.21 - * by Sun in the GPL Version 2 section of the License file that
358.22 - * accompanied this code. If applicable, add the following below the
358.23 - * License Header, with the fields enclosed by brackets [] replaced by
358.24 - * your own identifying information:
358.25 - * "Portions Copyrighted [year] [name of copyright owner]"
358.26 - *
358.27 - * Contributor(s):
358.28 - *
358.29 - * The Original Software is NetBeans. The Initial Developer of the Original
358.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
358.31 - * Microsystems, Inc. All Rights Reserved.
358.32 - *
358.33 - * If you wish your version of this file to be governed by only the CDDL
358.34 - * or only the GPL Version 2, indicate your decision by adding
358.35 - * "[Contributor] elects to include this software in this distribution
358.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
358.37 - * single choice of license, a recipient has the option to distribute
358.38 - * your version of this file under either the CDDL, the GPL Version 2 or
358.39 - * to extend the choice of license to its licensees as provided above.
358.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
358.41 - * Version 2 license, then the option applies only if the new code is
358.42 - * made subject to such option by the copyright holder.
358.43 - */
358.44 -
358.45 -package org.netbeans.modules.visualweb.gravy.toolbox;
358.46 -
358.47 -import org.netbeans.modules.visualweb.gravy.*;
358.48 -import org.netbeans.modules.visualweb.gravy.DNDDriver;
358.49 -import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
358.50 -//import com.sun.rave.toolbox.PaletteContainer;
358.51 -import org.netbeans.modules.visualweb.gravy.actions.PropertiesAction;
358.52 -import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
358.53 -import java.awt.Component;
358.54 -import java.awt.Container;
358.55 -import java.awt.Point;
358.56 -import java.awt.Rectangle;
358.57 -import java.awt.event.*;
358.58 -import java.beans.*;
358.59 -import java.util.StringTokenizer;
358.60 -import org.netbeans.jemmy.ComponentChooser;
358.61 -import org.netbeans.jemmy.QueueTool;
358.62 -import org.netbeans.jemmy.drivers.input.MouseRobotDriver;
358.63 -import org.netbeans.jemmy.operators.*;
358.64 -import org.netbeans.jellytools.Bundle;
358.65 -import javax.swing.*;
358.66 -import org.netbeans.jemmy.Timeout;
358.67 -
358.68 -/**
358.69 - *
358.70 - * @author Alexandre (Shura) Iline (alexandre.iline@sun.com)
358.71 - */
358.72 -public class PaletteContainerOperator extends ContainerOperator {
358.73 -
358.74 - private static final String PALETTE_TITLE = "Palette";
358.75 - JListOperator theTree = null;
358.76 - JCheckBoxOperator categoryButton = null;
358.77 - private String name;
358.78 - static String defaultPaletteCategory = "Basic";
358.79 -
358.80 - private PaletteContainerOperator(ContainerOperator cont, String name) {
358.81 - super(cont, new PaletteContainerChooser(name));
358.82 - this.name=name;
358.83 - }
358.84 -
358.85 - /**
358.86 - * @param name of the section in Palette
358.87 - * @return Container containing CheckBox with section name and JList of the components
358.88 - */
358.89 - private static Container findPaletteContainer(String name) {
358.90 - return new JCheckBoxOperator(new org.netbeans.jellytools.TopComponentOperator(PALETTE_TITLE), name).getParent();
358.91 - }
358.92 -
358.93 - public PaletteContainerOperator(String name) {
358.94 - super(findPaletteContainer(name));
358.95 - this.name=name;
358.96 - }
358.97 -
358.98 - public static String getDefaultPaletteCategory() {
358.99 - return defaultPaletteCategory;
358.100 - }
358.101 -
358.102 - public void showComponents() {
358.103 - if (categoryButton == null) {
358.104 - categoryButton = new JCheckBoxOperator(this, name);
358.105 - }
358.106 - categoryButton.changeSelection(true);
358.107 - }
358.108 -
358.109 - public void hideComponents() {
358.110 - if (categoryButton == null) {
358.111 - categoryButton = new JCheckBoxOperator(this, name);
358.112 - }
358.113 - categoryButton.changeSelection(false);
358.114 - }
358.115 -
358.116 - public Point getClickPoint(String componentName) {
358.117 - JListOperator theTree = getComponentsTree();
358.118 - return(theTree.getClickPoint(theTree.findItemIndex(componentName)));
358.119 - }
358.120 - /**
358.121 - * TODO:
358.122 - */
358.123 - public Point getClickPoint(String componentName, int index) {
358.124 - return(getComponentsTree().getClickPoint(
358.125 - getComponentsTree().findItemIndex(componentName, index)));
358.126 - }
358.127 -
358.128 - public Point getClickPointOfClass(Class clz) {
358.129 - return(getClickPoint(getDisplayNameOfClass(clz)));
358.130 - }
358.131 -
358.132 - public Point getClickPointOfClass(String className) {
358.133 - try {
358.134 - return(getClickPointOfClass(Class.forName(className)));
358.135 - } catch(ClassNotFoundException e) {
358.136 - return(getClickPoint(getShortClassName(className)));
358.137 - }
358.138 - }
358.139 -
358.140 - private JViewport findViewportOfPalette() {
358.141 - JViewport viewPort = (JViewport)ContainerOperator.findContainerUnder(getSource(),
358.142 - new ComponentChooser() {
358.143 - public boolean checkComponent(Component comp) {
358.144 - return (JViewport.class.isInstance(comp));
358.145 - }
358.146 - public String getDescription() {
358.147 - return ("JViewport");
358.148 - }
358.149 - });
358.150 - return viewPort;
358.151 - }
358.152 -
358.153 - public void dndPaletteComponent(String componentName,
358.154 - ComponentOperator designer, Point designerPoint) {
358.155 - Point clickPoint = getClickPoint(componentName);
358.156 - Util.wait(1000);
358.157 - dndPaletteComponent(clickPoint, designer, designerPoint);
358.158 - }
358.159 -
358.160 - public void dndComponentOfClass(String componentClassName,
358.161 - ComponentOperator designer, Point designerPoint) {
358.162 - Point clickPoint = getClickPointOfClass(componentClassName);
358.163 - Util.wait(1000);
358.164 - dndPaletteComponent(clickPoint, designer, designerPoint);
358.165 - }
358.166 -
358.167 - private void dndPaletteComponent(Point componentClickPoint, ComponentOperator designer,
358.168 - Point designerPoint) {
358.169 - JViewport viewPort = findViewportOfPalette();
358.170 - ComponentOperator component = getComponentsTree();
358.171 - int compX = (component.getLocationOnScreen().x - viewPort.getLocationOnScreen().x) +
358.172 - componentClickPoint.x;
358.173 - int compY = (component.getLocationOnScreen().y - viewPort.getLocationOnScreen().y) +
358.174 - componentClickPoint.y;
358.175 -
358.176 - System.out.println();
358.177 - System.out.println("+++ coordinates of component in Palette Panel = [" +
358.178 - compX + ", " + compY + "]");
358.179 - System.out.println();
358.180 -
358.181 - viewPort.setViewPosition(new Point(compX, compY));
358.182 - Util.wait(1000);
358.183 - //TODO Somehow it goes to previous component so need to shift y a bit
358.184 - //componentClickPoint = new Point(componentClickPoint.x,componentClickPoint.y+5);
358.185 - component.clickMouse(componentClickPoint.x, componentClickPoint.y, 1);
358.186 - Util.wait(2000);
358.187 - System.out.println();
358.188 - System.out.println("+++ Component in Palette Panel should be visible and selected");
358.189 - System.out.println("+++ Left-top position in Palette Panel = " + viewPort.getViewPosition());
358.190 - System.out.println();
358.191 -
358.192 - DNDDriver dndDriver = new DNDDriver();
358.193 - Util.wait(1000);
358.194 - dndDriver.dnd(component, componentClickPoint, designer, designerPoint,
358.195 - InputEvent.BUTTON1_MASK, 0);
358.196 - Util.wait(3000);
358.197 - System.out.println();
358.198 - System.out.println("+++ Component should be put from Palette on Designer Pane");
358.199 - System.out.println();
358.200 -
358.201 - }
358.202 -
358.203 - public JListOperator getComponentsTree() {
358.204 - showComponents();
358.205 - if(theTree == null) {
358.206 - theTree = new JListOperator(this);
358.207 - }
358.208 - return(theTree);
358.209 - }
358.210 -
358.211 - public void addComponent(String componentName) {
358.212 - Point clickPoint = getClickPoint(componentName);
358.213 - theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
358.214 - }
358.215 -
358.216 - public void addComponent(String componentName, int index) {
358.217 - Point clickPoint = getClickPoint(componentName, index);
358.218 - theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
358.219 - }
358.220 - public void addComponentOfClass(Class clz) {
358.221 - Point clickPoint = getClickPointOfClass(clz);
358.222 - theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
358.223 - TestUtils.wait(2000);
358.224 - }
358.225 -
358.226 - public void addComponentOfClass(String className) {
358.227 - Point clickPoint = getClickPointOfClass(className);
358.228 - theTree.clickMouse(clickPoint.x, clickPoint.y, 2);
358.229 - TestUtils.wait(2000);
358.230 - }
358.231 -
358.232 - public void addComponent(String componentName, DesignerPaneOperator designer, Point location) {
358.233 - Point clickPoint = getClickPoint(componentName);
358.234 - //getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
358.235 - JListOperator tree = getComponentsTree();
358.236 - if (tree.isSelectionEmpty()) {
358.237 - tree.selectItem(componentName);
358.238 - } else {
358.239 - tree.clearSelection();
358.240 - tree.selectItem(componentName);
358.241 - }
358.242 - TestUtils.wait(2000);
358.243 - designer.clickMouse(location.x, location.y, 1);
358.244 - TestUtils.wait(2000);
358.245 - //Second click added because when component added on designer it is not in focus
358.246 - designer.clickMouse(1, 100, 1);
358.247 - TestUtils.wait(2000);
358.248 - designer.clickMouse(location.x+5, location.y+5, 1);
358.249 - TestUtils.wait(2000);
358.250 - }
358.251 -
358.252 - /**
358.253 - * Add component which beginning text is same as others.
358.254 - * i.g., Image and Image Hyperlink. It always selects Image Hyperlink when
358.255 - * use addComponent("Image", designer, new Point(x,y))
358.256 - * as Image Hyperlink is listed in front of Image in Palette.
358.257 - * Example: <BR>
358.258 - * <pre>
358.259 - * String componentName = "Image" ;
358.260 - * int index = 1 ;
358.261 - * palette.addComponent(componentName, indes, designer, new Point(x,y));
358.262 - * </pre>
358.263 - */
358.264 - public void addComponent(String componentName, int index, DesignerPaneOperator designer, Point location) {
358.265 - Point clickPoint = getClickPoint(componentName, index);
358.266 - getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
358.267 - TestUtils.wait(2000);
358.268 - designer.clickMouse(location.x, location.y, 1);
358.269 - TestUtils.wait(2000);
358.270 - }
358.271 -
358.272 - public void addComponentOfClass(Class clz, DesignerPaneOperator designer, Point location) {
358.273 - Point clickPoint = getClickPointOfClass(clz);
358.274 - getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
358.275 - designer.clickMouse(location.x, location.y, 1);
358.276 - TestUtils.wait(2000);
358.277 - }
358.278 -
358.279 - public void addComponentOfClass(String className, DesignerPaneOperator designer, Point location) {
358.280 -
358.281 - Point clickPoint = getClickPointOfClass(className);
358.282 - getComponentsTree().clickMouse(clickPoint.x, clickPoint.y, 1);
358.283 - designer.clickMouse(location.x, location.y, 1);
358.284 - TestUtils.wait(2000);
358.285 - }
358.286 -
358.287 -/*
358.288 - public void addComponent(String componentName) {
358.289 - getComponentButton(componentName).clickMouse(2);
358.290 - }
358.291 -
358.292 - public void addComponentOfClass(Class clz) {
358.293 - getComponentButtonOfClass(clz).clickMouse(2);
358.294 - }
358.295 -
358.296 - public void addComponentOfClass(String className) {
358.297 - getComponentButtonOfClass(className).clickMouse(2);
358.298 - }
358.299 -
358.300 - public void addComponent(String componentName, DesignerPaneOperator designer, Point location) {
358.301 - //new DNDDriver().dnd(getComponentButton(componentName), new Point(1, 1),
358.302 - //designer, location);
358.303 - getComponentButton(componentName).clickMouse();
358.304 - designer.clickMouse(location.x, location.y, 1);
358.305 - }
358.306 -
358.307 - public void addComponentOfClass(Class clz, DesignerPaneOperator designer, Point location) {
358.308 - getComponentButtonOfClass(clz).clickMouse();
358.309 - designer.clickMouse(location.x, location.y, 1);
358.310 - }
358.311 -
358.312 - public void addComponentOfClass(String className, DesignerPaneOperator designer, Point location) {
358.313 - getComponentButtonOfClass(className).clickMouse();
358.314 - designer.clickMouse(location.x, location.y, 1);
358.315 - }
358.316 - */
358.317 - public void placeClip(String clipName, JEditorPaneOperator editor, int caretPosition) {
358.318 - Rectangle rect = editor.modelToView(caretPosition);
358.319 - Point location = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
358.320 - dndComponentOfClass(clipName, editor, location);
358.321 - }
358.322 -/*
358.323 - public void placeClip(String clipName, JEditorPaneOperator editor, int caretPosition) {
358.324 - Rectangle rect = editor.modelToView(caretPosition);
358.325 - Point location = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
358.326 - new DNDDriver().dnd(getComponentButton(clipName), new Point(1, 1), editor, location);
358.327 - }
358.328 - */
358.329 - public void placeClip(String clipName, JEditorPaneOperator editor) {
358.330 - placeClip(clipName, editor, editor.getCaretPosition());
358.331 - }
358.332 -
358.333 - private String getDisplayNameOfClass(Class clz) {
358.334 - String name = null;
358.335 - try {
358.336 - name = java.beans.Introspector.getBeanInfo(clz).getBeanDescriptor().getDisplayName();
358.337 - } catch(IntrospectionException e) {
358.338 - }
358.339 - if(name == null) {
358.340 - name = getShortClassName(clz.getName());
358.341 - }
358.342 - return(name);
358.343 - }
358.344 -
358.345 - private String getShortClassName(String className) {
358.346 - String name = null;
358.347 - StringTokenizer token = new StringTokenizer(className, ".");
358.348 - while(token.hasMoreTokens()) {
358.349 - name=token.nextToken();
358.350 - }
358.351 - return(name);
358.352 - }
358.353 -
358.354 - /**
358.355 - * TODO: need to be updated
358.356 - *
358.357 - */
358.358 - public static void showPalette() {
358.359 - Util.getMainMenu().pushMenu("Window|Palette" );
358.360 - new QueueTool().waitEmpty();
358.361 - }
358.362 -
358.363 - public static PaletteContainerOperator showPalette(String buttName, String paletteName) {
358.364 - new org.netbeans.modules.visualweb.gravy.toolbox.actions.ShowPaletteAction().perform();
358.365 - new QueueTool().waitEmpty();
358.366 - new JToggleButtonOperator(new ToolBoxOperator(), buttName).push();
358.367 - //new JButtonOperator(new ToolBoxOperator(), buttName).push();
358.368 - return(new PaletteContainerOperator(paletteName));
358.369 - }
358.370 -
358.371 - public static PaletteContainerOperator showCodeClips() {
358.372 - new org.netbeans.modules.visualweb.gravy.toolbox.actions.ShowPaletteAction().perform();
358.373 - new QueueTool().waitEmpty();
358.374 - new JToggleButtonOperator(new ToolBoxOperator(), Bundle.getStringTrimmed("com.sun.rave.toolbox.Bundle", "CODE_CLIPS")).push();
358.375 - return(new PaletteContainerOperator("Samples"));
358.376 - }
358.377 -
358.378 - /**
358.379 - * TODO: maked private because doesn't work properly
358.380 - */
358.381 - private static class PaletteContainerChooser implements ComponentChooser {
358.382 - String name;
358.383 - public PaletteContainerChooser(String name) {
358.384 - this.name = name;
358.385 - }
358.386 - public boolean checkComponent(Component comp) {
358.387 - System.out.println("Class ="+ comp.getClass()+" Name="+comp.getClass().getName());
358.388 - if (comp.getClass().getName().equals("org.netbeans.modules.palette.ui.CategoryDescriptor$1")){
358.389 - return true;
358.390 - }
358.391 - return false;//(comp.getClass().getName().equals("org.netbeans.modules.palette.ui.CategoryButton"));
358.392 -
358.393 - }
358.394 - public String getDescription() {
358.395 - return(/*PaletteContainer.class.getName() + */" with \"" + name + "\" name");
358.396 - }
358.397 - }
358.398 -}
359.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/toolbox/ToolBoxOperator.java Thu Jul 10 04:29:52 2008 -0700
359.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
359.3 @@ -1,75 +0,0 @@
359.4 -/*
359.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
359.6 - *
359.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
359.8 - *
359.9 - * The contents of this file are subject to the terms of either the GNU
359.10 - * General Public License Version 2 only ("GPL") or the Common
359.11 - * Development and Distribution License("CDDL") (collectively, the
359.12 - * "License"). You may not use this file except in compliance with the
359.13 - * License. You can obtain a copy of the License at
359.14 - * http://www.netbeans.org/cddl-gplv2.html
359.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
359.16 - * specific language governing permissions and limitations under the
359.17 - * License. When distributing the software, include this License Header
359.18 - * Notice in each file and include the License file at
359.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
359.20 - * particular file as subject to the "Classpath" exception as provided
359.21 - * by Sun in the GPL Version 2 section of the License file that
359.22 - * accompanied this code. If applicable, add the following below the
359.23 - * License Header, with the fields enclosed by brackets [] replaced by
359.24 - * your own identifying information:
359.25 - * "Portions Copyrighted [year] [name of copyright owner]"
359.26 - *
359.27 - * Contributor(s):
359.28 - *
359.29 - * The Original Software is NetBeans. The Initial Developer of the Original
359.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
359.31 - * Microsystems, Inc. All Rights Reserved.
359.32 - *
359.33 - * If you wish your version of this file to be governed by only the CDDL
359.34 - * or only the GPL Version 2, indicate your decision by adding
359.35 - * "[Contributor] elects to include this software in this distribution
359.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
359.37 - * single choice of license, a recipient has the option to distribute
359.38 - * your version of this file under either the CDDL, the GPL Version 2 or
359.39 - * to extend the choice of license to its licensees as provided above.
359.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
359.41 - * Version 2 license, then the option applies only if the new code is
359.42 - * made subject to such option by the copyright holder.
359.43 - */
359.44 -
359.45 -package org.netbeans.modules.visualweb.gravy.toolbox;
359.46 -
359.47 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
359.48 -
359.49 -import java.awt.Component;
359.50 -
359.51 -import org.netbeans.jemmy.ComponentChooser;
359.52 -
359.53 -import org.netbeans.jemmy.operators.ContainerOperator;
359.54 -
359.55 -/**
359.56 - *
359.57 - * @author Alexandre (Shura) Iline (alexandre.iline@sun.com)
359.58 - */
359.59 -public class ToolBoxOperator extends ContainerOperator {
359.60 - public ToolBoxOperator(ContainerOperator cont) {
359.61 - super(cont, new ToolBoxChooser());
359.62 - }
359.63 - public ToolBoxOperator() {
359.64 - this(RaveWindowOperator.getDefaultRave());
359.65 - }
359.66 -
359.67 - public static class ToolBoxChooser implements ComponentChooser {
359.68 - public ToolBoxChooser() {
359.69 - }
359.70 - public boolean checkComponent(Component comp) {
359.71 - return(comp.getClass().getName().equals("com.sun.rave.toolbox.ToolBox"));
359.72 - }
359.73 - public String getDescription() {
359.74 - return("com.sun.rave.toolbox.ToolBox");
359.75 - }
359.76 - }
359.77 -
359.78 -}
360.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/toolbox/actions/ShowPaletteAction.java Thu Jul 10 04:29:52 2008 -0700
360.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
360.3 @@ -1,51 +0,0 @@
360.4 -/*
360.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
360.6 - *
360.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
360.8 - *
360.9 - * The contents of this file are subject to the terms of either the GNU
360.10 - * General Public License Version 2 only ("GPL") or the Common
360.11 - * Development and Distribution License("CDDL") (collectively, the
360.12 - * "License"). You may not use this file except in compliance with the
360.13 - * License. You can obtain a copy of the License at
360.14 - * http://www.netbeans.org/cddl-gplv2.html
360.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
360.16 - * specific language governing permissions and limitations under the
360.17 - * License. When distributing the software, include this License Header
360.18 - * Notice in each file and include the License file at
360.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
360.20 - * particular file as subject to the "Classpath" exception as provided
360.21 - * by Sun in the GPL Version 2 section of the License file that
360.22 - * accompanied this code. If applicable, add the following below the
360.23 - * License Header, with the fields enclosed by brackets [] replaced by
360.24 - * your own identifying information:
360.25 - * "Portions Copyrighted [year] [name of copyright owner]"
360.26 - *
360.27 - * Contributor(s):
360.28 - *
360.29 - * The Original Software is NetBeans. The Initial Developer of the Original
360.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
360.31 - * Microsystems, Inc. All Rights Reserved.
360.32 - *
360.33 - * If you wish your version of this file to be governed by only the CDDL
360.34 - * or only the GPL Version 2, indicate your decision by adding
360.35 - * "[Contributor] elects to include this software in this distribution
360.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
360.37 - * single choice of license, a recipient has the option to distribute
360.38 - * your version of this file under either the CDDL, the GPL Version 2 or
360.39 - * to extend the choice of license to its licensees as provided above.
360.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
360.41 - * Version 2 license, then the option applies only if the new code is
360.42 - * made subject to such option by the copyright holder.
360.43 - */
360.44 -
360.45 -package org.netbeans.modules.visualweb.gravy.toolbox.actions;
360.46 -public class ShowPaletteAction extends org.netbeans.jellytools.actions.Action {
360.47 - private static final String menuString = "Window|Creator Palette";
360.48 - private static final Shortcut shortcut = new Shortcut(java.awt.event.KeyEvent.VK_X, java.awt.event.KeyEvent.CTRL_MASK);
360.49 -
360.50 - /** creates new CopyAction instance */
360.51 - public ShowPaletteAction() {
360.52 - super(menuString, null, null, shortcut);
360.53 - }
360.54 -}
361.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/websvc/AddWebServiceOperator.java Thu Jul 10 04:29:52 2008 -0700
361.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
361.3 @@ -1,324 +0,0 @@
361.4 -/*
361.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
361.6 - *
361.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
361.8 - *
361.9 - * The contents of this file are subject to the terms of either the GNU
361.10 - * General Public License Version 2 only ("GPL") or the Common
361.11 - * Development and Distribution License("CDDL") (collectively, the
361.12 - * "License"). You may not use this file except in compliance with the
361.13 - * License. You can obtain a copy of the License at
361.14 - * http://www.netbeans.org/cddl-gplv2.html
361.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
361.16 - * specific language governing permissions and limitations under the
361.17 - * License. When distributing the software, include this License Header
361.18 - * Notice in each file and include the License file at
361.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
361.20 - * particular file as subject to the "Classpath" exception as provided
361.21 - * by Sun in the GPL Version 2 section of the License file that
361.22 - * accompanied this code. If applicable, add the following below the
361.23 - * License Header, with the fields enclosed by brackets [] replaced by
361.24 - * your own identifying information:
361.25 - * "Portions Copyrighted [year] [name of copyright owner]"
361.26 - *
361.27 - * Contributor(s):
361.28 - *
361.29 - * The Original Software is NetBeans. The Initial Developer of the Original
361.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
361.31 - * Microsystems, Inc. All Rights Reserved.
361.32 - *
361.33 - * If you wish your version of this file to be governed by only the CDDL
361.34 - * or only the GPL Version 2, indicate your decision by adding
361.35 - * "[Contributor] elects to include this software in this distribution
361.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
361.37 - * single choice of license, a recipient has the option to distribute
361.38 - * your version of this file under either the CDDL, the GPL Version 2 or
361.39 - * to extend the choice of license to its licensees as provided above.
361.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
361.41 - * Version 2 license, then the option applies only if the new code is
361.42 - * made subject to such option by the copyright holder.
361.43 - */
361.44 -
361.45 -package org.netbeans.modules.visualweb.gravy.websvc;
361.46 -
361.47 -import org.netbeans.jellytools.NbDialogOperator;
361.48 -import org.netbeans.jemmy.operators.*;
361.49 -import org.netbeans.modules.visualweb.gravy.TestUtils;
361.50 -import org.netbeans.modules.visualweb.gravy.Util;
361.51 -
361.52 -/**
361.53 - * AddWebServiceOperator class
361.54 - * Implements test functionality for "Add Web Service" dialog
361.55 - *
361.56 - * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a>
361.57 - */
361.58 -public class AddWebServiceOperator extends NbDialogOperator{
361.59 -
361.60 - private JRadioButtonOperator _rbtURL;
361.61 - private JRadioButtonOperator _rbtLocal;
361.62 - private JButtonOperator _btBrowse;
361.63 - //private JButtonOperator _btGetWSInf;
361.64 - private JButtonOperator _btSetProxy;
361.65 - private JButtonOperator _btAdd;
361.66 - private JButtonOperator _btCancel;
361.67 - private JButtonOperator _btHelp;
361.68 - private JTextFieldOperator _txtURL;
361.69 - private JTextFieldOperator _txtLocal;
361.70 - //private JTextFieldOperator _txtWSName;
361.71 - private JTextFieldOperator _txtWSPackageName;
361.72 - private boolean _isProxySet = false;
361.73 - private String STR_BROWSE = "Browse...";
361.74 - private String STR_PROXY = "Set Proxy...";
361.75 - private String STR_ADD = "Add";
361.76 - private String STR_CANCEL = "Cancel";
361.77 - private String STR_HELP = "Help";
361.78 - private String STR_OPEN = "Open";
361.79 - private String STR_OK = "OK";
361.80 - private String STR_OPTIONS = "Options";
361.81 - private String STR_FILE = "Local File:";
361.82 - private String STR_URL = "URL:";
361.83 - private String STR_SYSTEM_PROXY = "Use System Proxy Settings";
361.84 - private String STR_MANUAL_PROXY = "Manual Proxy Settings";
361.85 - private String wsLabel = "Services tab web services compiling script";
361.86 -
361.87 - //private JTextComponentOperator _txtResults;
361.88 -
361.89 - public AddWebServiceOperator() {
361.90 - super("Add Web Service");
361.91 - }
361.92 -
361.93 - public JRadioButtonOperator rbtURL() {
361.94 - if (_rbtURL == null) {
361.95 - _rbtURL = new JRadioButtonOperator(this, STR_URL);
361.96 - }
361.97 - return _rbtURL;
361.98 - }
361.99 -
361.100 - public JRadioButtonOperator rbtLocal() {
361.101 - if (_rbtLocal == null) {
361.102 - _rbtLocal = new JRadioButtonOperator(this, STR_FILE);
361.103 - }
361.104 - return _rbtLocal;
361.105 - }
361.106 -
361.107 - public JButtonOperator btBrowse() {
361.108 - if (_btBrowse == null) {
361.109 - _btBrowse = new JButtonOperator(this, STR_BROWSE);
361.110 - }
361.111 - return _btBrowse;
361.112 - }
361.113 -
361.114 - /*public JButtonOperator btGetWSInf() {
361.115 - if (_btGetWSInf == null) {
361.116 - _btGetWSInf = new JButtonOperator(this, "Get Web Service Information");
361.117 - }
361.118 - return _btGetWSInf;
361.119 - }*/
361.120 -
361.121 - public JButtonOperator btSetProxy() {
361.122 - if (_btSetProxy == null) {
361.123 - _btSetProxy = new JButtonOperator(this, STR_PROXY);
361.124 -
361.125 - }
361.126 - return _btSetProxy;
361.127 - }
361.128 -
361.129 - public JButtonOperator btAdd() {
361.130 - if (_btAdd == null) {
361.131 - _btAdd = new JButtonOperator(this, STR_ADD);
361.132 - }
361.133 - return _btAdd;
361.134 - }
361.135 -
361.136 - public JButtonOperator btCancel() {
361.137 - if (_btCancel == null) {
361.138 - _btCancel = new JButtonOperator(this, STR_CANCEL);
361.139 - }
361.140 - return _btCancel;
361.141 - }
361.142 -
361.143 - public JButtonOperator btHelp() {
361.144 - if (_btHelp == null) {
361.145 - _btHelp = new JButtonOperator(this, STR_HELP);
361.146 - }
361.147 - return _btHelp;
361.148 - }
361.149 -
361.150 - public JTextFieldOperator txtURL() {
361.151 - if (_txtURL == null) {
361.152 - _txtURL = new JTextFieldOperator(this, 0);
361.153 - }
361.154 - return _txtURL;
361.155 - }
361.156 -
361.157 - public JTextFieldOperator txtLocal() {
361.158 - if (_txtLocal == null) {
361.159 - _txtLocal = new JTextFieldOperator(this, 1);
361.160 - }
361.161 - return _txtLocal;
361.162 - }
361.163 -
361.164 - /*public JTextFieldOperator txtWSName() {
361.165 - if (_txtWSName == null) {
361.166 - //System.out.println("TRACE: "+new JTextFieldOperator(this, 0).getText());
361.167 - //System.out.println("TRACE: "+new JTextFieldOperator(this, 1).getText());
361.168 - //System.out.println("TRACE: "+new JTextFieldOperator(this, 2).getText());
361.169 - //System.out.println("TRACE: "+new JTextFieldOperator(this, 3).getText());
361.170 - //System.out.println("TRACE: "+new JTextFieldOperator(this, 4).getText());
361.171 - //_txtWSName = new JTextFieldOperator(this, 4);
361.172 - try{
361.173 - _txtWSName = new JTextFieldOperator(this, 6);
361.174 - }catch(Exception e){
361.175 - _txtWSName = null;
361.176 - }
361.177 - }
361.178 - return _txtWSName;
361.179 - }*/
361.180 -
361.181 - public JTextFieldOperator txtWSPackageName() {
361.182 - if (_txtWSPackageName == null) {
361.183 - _txtWSPackageName = new JTextFieldOperator(this, 2);
361.184 - }
361.185 - return _txtWSPackageName;
361.186 - }
361.187 -
361.188 - /*public JTextComponentOperator txtResults() {
361.189 - if (_txtResults == null) {
361.190 - //_txtResults = new JTextComponentOperator(this,9);
361.191 - _txtResults = new JTextComponentOperator(this,8);
361.192 - }
361.193 - return _txtResults;
361.194 - }*/
361.195 -
361.196 - public boolean isProxySet() {
361.197 - return _isProxySet;
361.198 - }
361.199 -
361.200 -
361.201 - public void verify() {
361.202 - btAdd();
361.203 - btCancel();
361.204 - btHelp();
361.205 - //btGetWSInf();
361.206 - btBrowse();
361.207 - btSetProxy();
361.208 - rbtLocal();
361.209 - rbtURL();
361.210 - txtLocal();
361.211 - txtURL();
361.212 - //txtWSName();
361.213 - txtWSPackageName();
361.214 - //txtResults();
361.215 - }
361.216 -
361.217 - public String addLocalWebService(String name) {
361.218 - JRadioButtonOperator wsType = rbtLocal();
361.219 - wsType.requestFocus();
361.220 - wsType.setSelected(true);
361.221 - wsType.doClick();
361.222 - TestUtils.wait(2000);
361.223 - /*btBrowse().pushNoBlock();
361.224 - TestUtils.wait(2000);
361.225 - JDialogOperator open = new JDialogOperator(STR_OPEN);
361.226 - JTextFieldOperator wsdlFileName = new JTextFieldOperator(open, 0);
361.227 - wsdlFileName.typeText(name);
361.228 - TestUtils.wait(1000);
361.229 - new JButtonOperator(open, STR_OPEN).pushNoBlock();*/
361.230 - JTextFieldOperator wsdlUrl = txtLocal();
361.231 - wsdlUrl.clearText();
361.232 - wsdlUrl.setText(name);
361.233 - TestUtils.wait(1000);
361.234 - //TODO hardcoded?
361.235 - //if ((new JTextComponentOperator(this, 2)).getText().indexOf("error occurred")!= -1) return null;
361.236 - //String wsName = "empty";
361.237 - //JTextFieldOperator wsNameOper = txtWSName();
361.238 - //if (wsNameOper!=null ) {wsName = wsNameOper.getText();}
361.239 - // btAdd().pushNoBlock();
361.240 - btAdd().pushNoBlock();
361.241 - isWebServiceClientGenerated();
361.242 - //return wsName;
361.243 - return null;
361.244 - }
361.245 -
361.246 - public String addWebService(String url) {
361.247 - return addWebService(url, "websvc");
361.248 - }
361.249 -
361.250 - public String addWebService(String url, String packageName) {
361.251 - JRadioButtonOperator wsType = rbtURL();
361.252 - wsType.requestFocus();
361.253 - wsType.setSelected(true);
361.254 - wsType.doClick();
361.255 - TestUtils.wait(2000);
361.256 - JTextFieldOperator wsdlUrl = txtURL();
361.257 - wsdlUrl.clearText();
361.258 - wsdlUrl.setText(url);
361.259 - TestUtils.wait(1000);
361.260 - JTextFieldOperator pkgName = txtWSPackageName();
361.261 - pkgName.clearText();
361.262 - pkgName.setText(packageName);
361.263 - TestUtils.wait(1000);
361.264 - btAdd().pushNoBlock();;
361.265 - isWebServiceClientGenerated();
361.266 - return null;
361.267 - }
361.268 -
361.269 - public void setProxy(String proxyHost, String proxyPort) {
361.270 - if (isProxySet()) clearProxy();
361.271 - btSetProxy().pushNoBlock();
361.272 - //JDialogOperator proxyConfig = new JDialogOperator("Proxy Configuration");
361.273 - JDialogOperator proxyConfig = new JDialogOperator(STR_OPTIONS);
361.274 - //JCheckBoxOperator proxyCb = new JCheckBoxOperator(proxyConfig);
361.275 - TestUtils.wait(1000);
361.276 - JRadioButtonOperator proxyRb = new JRadioButtonOperator(proxyConfig, STR_MANUAL_PROXY);
361.277 - proxyRb.requestFocus();
361.278 - proxyRb.setSelected(true);
361.279 - proxyRb.doClick();
361.280 - //proxyCb.requestFocus();
361.281 - //proxyCb.setSelected(true);
361.282 - // proxyCb.doClick();
361.283 - _isProxySet = true;
361.284 - TestUtils.wait(2000);
361.285 - new JTextFieldOperator(proxyConfig, 0).setText(proxyHost);
361.286 - TestUtils.wait(1000);
361.287 - new JTextFieldOperator(proxyConfig,1).setText(proxyPort);
361.288 - TestUtils.wait(1000);
361.289 - new JButtonOperator(proxyConfig, STR_OK).pushNoBlock();
361.290 - }
361.291 -
361.292 - public void clearProxy() {
361.293 - if (isProxySet()) {
361.294 - btSetProxy().pushNoBlock();
361.295 - //JDialogOperator proxyConfig = new JDialogOperator("Proxy Configuration");
361.296 - JDialogOperator proxyConfig = new JDialogOperator(STR_OPTIONS);
361.297 - //JCheckBoxOperator proxyCb = new JCheckBoxOperator(proxyConfig);
361.298 - TestUtils.wait(1000);
361.299 - JRadioButtonOperator proxyRb = new JRadioButtonOperator(proxyConfig, STR_SYSTEM_PROXY);
361.300 - //proxyCb.requestFocus();
361.301 - //proxyCb.setSelected(false);
361.302 - //proxyCb.doClick();
361.303 - proxyRb.requestFocus();
361.304 - proxyRb.setSelected(true);
361.305 - proxyRb.doClick();
361.306 - _isProxySet = false;
361.307 - TestUtils.wait(1000);
361.308 - new JButtonOperator(proxyConfig, STR_OK).pushNoBlock();
361.309 - }
361.310 - }
361.311 -
361.312 - private boolean isWebServiceClientGenerated() {
361.313 - TestUtils.wait(500);
361.314 - JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(), 1);
361.315 - while (jlo.getText() == null || jlo.getText().indexOf(wsLabel) == -1) {
361.316 - jlo = new JLabelOperator(Util.getMainWindow(), 1);
361.317 - System.out.println("label in first cycle = " + jlo.getText());
361.318 - TestUtils.wait(1000);
361.319 - }
361.320 - while (jlo.getText() != null && jlo.getText().indexOf(wsLabel) != -1) {
361.321 - jlo = new JLabelOperator(Util.getMainWindow(), 1);
361.322 - TestUtils.wait(1000);
361.323 - }
361.324 - TestUtils.wait(1000);
361.325 - return true;
361.326 - }
361.327 -}
362.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/websvc/TestMethodOperator.java Thu Jul 10 04:29:52 2008 -0700
362.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
362.3 @@ -1,113 +0,0 @@
362.4 -/*
362.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
362.6 - *
362.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
362.8 - *
362.9 - * The contents of this file are subject to the terms of either the GNU
362.10 - * General Public License Version 2 only ("GPL") or the Common
362.11 - * Development and Distribution License("CDDL") (collectively, the
362.12 - * "License"). You may not use this file except in compliance with the
362.13 - * License. You can obtain a copy of the License at
362.14 - * http://www.netbeans.org/cddl-gplv2.html
362.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
362.16 - * specific language governing permissions and limitations under the
362.17 - * License. When distributing the software, include this License Header
362.18 - * Notice in each file and include the License file at
362.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
362.20 - * particular file as subject to the "Classpath" exception as provided
362.21 - * by Sun in the GPL Version 2 section of the License file that
362.22 - * accompanied this code. If applicable, add the following below the
362.23 - * License Header, with the fields enclosed by brackets [] replaced by
362.24 - * your own identifying information:
362.25 - * "Portions Copyrighted [year] [name of copyright owner]"
362.26 - *
362.27 - * Contributor(s):
362.28 - *
362.29 - * The Original Software is NetBeans. The Initial Developer of the Original
362.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
362.31 - * Microsystems, Inc. All Rights Reserved.
362.32 - *
362.33 - * If you wish your version of this file to be governed by only the CDDL
362.34 - * or only the GPL Version 2, indicate your decision by adding
362.35 - * "[Contributor] elects to include this software in this distribution
362.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
362.37 - * single choice of license, a recipient has the option to distribute
362.38 - * your version of this file under either the CDDL, the GPL Version 2 or
362.39 - * to extend the choice of license to its licensees as provided above.
362.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
362.41 - * Version 2 license, then the option applies only if the new code is
362.42 - * made subject to such option by the copyright holder.
362.43 - */
362.44 -
362.45 -package org.netbeans.modules.visualweb.gravy.websvc;
362.46 -
362.47 -import org.netbeans.jellytools.Bundle;
362.48 -import org.netbeans.jemmy.operators.JButtonOperator;
362.49 -import org.netbeans.jemmy.operators.JTableOperator;
362.50 -import org.netbeans.modules.visualweb.gravy.NbDialogOperator;
362.51 -
362.52 -/**
362.53 - * TestMethodOperator class
362.54 - * Implements test functionality for "Test Web Service Method" dialog
362.55 - *
362.56 - * @author <a href="mailto:alexey.butenko@sun.com">Alexey Butenko</a>
362.57 - */
362.58 -public class TestMethodOperator extends NbDialogOperator{
362.59 -
362.60 - private JButtonOperator _btSubmit;
362.61 - private JButtonOperator _btClose;
362.62 - private JButtonOperator _btHelp;
362.63 - private JTableOperator _tblValues;
362.64 - private JTableOperator _tblResults;
362.65 - private String STR_SUBMIT = "Submit";
362.66 - private String STR_CLOSE = "Close";
362.67 - private String STR_HELP = "Help";
362.68 -
362.69 - public TestMethodOperator() {
362.70 - super(Bundle.getStringTrimmed("org.netbeans.modules.visualweb.websvcmgr.ui.Bundle","TEST_WEB_SERVICE_METHOD"));
362.71 - }
362.72 -
362.73 - public JButtonOperator btSubmit() {
362.74 - if (_btSubmit == null) {
362.75 - _btSubmit = new JButtonOperator(this, STR_SUBMIT);
362.76 - }
362.77 - return _btSubmit;
362.78 - }
362.79 -
362.80 - public JButtonOperator btClose() {
362.81 - if (_btClose == null) {
362.82 - _btClose = new JButtonOperator(this, STR_CLOSE);
362.83 - }
362.84 - return _btClose;
362.85 - }
362.86 -
362.87 - public JButtonOperator btHelp() {
362.88 - if (_btHelp == null) {
362.89 - _btHelp = new JButtonOperator(this, STR_HELP);
362.90 - }
362.91 - return _btHelp;
362.92 - }
362.93 -
362.94 - public JTableOperator tblValues() {
362.95 - if (_tblValues == null) {
362.96 - _tblValues = new JTableOperator(this, 0);
362.97 - }
362.98 - return _tblValues;
362.99 - }
362.100 -
362.101 - public JTableOperator tblResults() {
362.102 - if (_tblResults == null) {
362.103 - _tblResults = new JTableOperator(this, 1);
362.104 - }
362.105 - return _tblResults;
362.106 - }
362.107 -
362.108 -
362.109 - public void verify() {
362.110 - btSubmit();
362.111 - btClose();
362.112 - btHelp();
362.113 - tblValues();
362.114 - tblResults();
362.115 - }
362.116 -}
363.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/websvc/actions/AddWebServiceAction.java Thu Jul 10 04:29:52 2008 -0700
363.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
363.3 @@ -1,60 +0,0 @@
363.4 -/*
363.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
363.6 - *
363.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
363.8 - *
363.9 - * The contents of this file are subject to the terms of either the GNU
363.10 - * General Public License Version 2 only ("GPL") or the Common
363.11 - * Development and Distribution License("CDDL") (collectively, the
363.12 - * "License"). You may not use this file except in compliance with the
363.13 - * License. You can obtain a copy of the License at
363.14 - * http://www.netbeans.org/cddl-gplv2.html
363.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
363.16 - * specific language governing permissions and limitations under the
363.17 - * License. When distributing the software, include this License Header
363.18 - * Notice in each file and include the License file at
363.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
363.20 - * particular file as subject to the "Classpath" exception as provided
363.21 - * by Sun in the GPL Version 2 section of the License file that
363.22 - * accompanied this code. If applicable, add the following below the
363.23 - * License Header, with the fields enclosed by brackets [] replaced by
363.24 - * your own identifying information:
363.25 - * "Portions Copyrighted [year] [name of copyright owner]"
363.26 - *
363.27 - * Contributor(s):
363.28 - *
363.29 - * The Original Software is NetBeans. The Initial Developer of the Original
363.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
363.31 - * Microsystems, Inc. All Rights Reserved.
363.32 - *
363.33 - * If you wish your version of this file to be governed by only the CDDL
363.34 - * or only the GPL Version 2, indicate your decision by adding
363.35 - * "[Contributor] elects to include this software in this distribution
363.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
363.37 - * single choice of license, a recipient has the option to distribute
363.38 - * your version of this file under either the CDDL, the GPL Version 2 or
363.39 - * to extend the choice of license to its licensees as provided above.
363.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
363.41 - * Version 2 license, then the option applies only if the new code is
363.42 - * made subject to such option by the copyright holder.
363.43 - */
363.44 -
363.45 -package org.netbeans.modules.visualweb.gravy.websvc.actions;
363.46 -
363.47 -import org.netbeans.modules.visualweb.gravy.actions.Action;
363.48 -import org.netbeans.jellytools.Bundle;
363.49 -
363.50 -/** Used to call "Add Web Service" popup menu item
363.51 - * @see org.netbeans.modules.visualweb.gravy.actions.Action
363.52 - * @author Alexey.Butenko@sun.com
363.53 - */
363.54 -public class AddWebServiceAction extends Action{
363.55 - private static final String _popup = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.websvcmgr.actions.Bundle", "ADD_WEB_SERVICE_Action");
363.56 - private static final String _menu = null; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
363.57 - private static final Action.Shortcut _shortcut = null;
363.58 -
363.59 - /** Creates new SaveAction instance. */
363.60 - public AddWebServiceAction() {
363.61 - super(_menu, _popup, null, _shortcut);
363.62 - }
363.63 -}
364.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/websvc/actions/CreateGroupAction.java Thu Jul 10 04:29:52 2008 -0700
364.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
364.3 @@ -1,60 +0,0 @@
364.4 -/*
364.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
364.6 - *
364.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
364.8 - *
364.9 - * The contents of this file are subject to the terms of either the GNU
364.10 - * General Public License Version 2 only ("GPL") or the Common
364.11 - * Development and Distribution License("CDDL") (collectively, the
364.12 - * "License"). You may not use this file except in compliance with the
364.13 - * License. You can obtain a copy of the License at
364.14 - * http://www.netbeans.org/cddl-gplv2.html
364.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
364.16 - * specific language governing permissions and limitations under the
364.17 - * License. When distributing the software, include this License Header
364.18 - * Notice in each file and include the License file at
364.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
364.20 - * particular file as subject to the "Classpath" exception as provided
364.21 - * by Sun in the GPL Version 2 section of the License file that
364.22 - * accompanied this code. If applicable, add the following below the
364.23 - * License Header, with the fields enclosed by brackets [] replaced by
364.24 - * your own identifying information:
364.25 - * "Portions Copyrighted [year] [name of copyright owner]"
364.26 - *
364.27 - * Contributor(s):
364.28 - *
364.29 - * The Original Software is NetBeans. The Initial Developer of the Original
364.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
364.31 - * Microsystems, Inc. All Rights Reserved.
364.32 - *
364.33 - * If you wish your version of this file to be governed by only the CDDL
364.34 - * or only the GPL Version 2, indicate your decision by adding
364.35 - * "[Contributor] elects to include this software in this distribution
364.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
364.37 - * single choice of license, a recipient has the option to distribute
364.38 - * your version of this file under either the CDDL, the GPL Version 2 or
364.39 - * to extend the choice of license to its licensees as provided above.
364.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
364.41 - * Version 2 license, then the option applies only if the new code is
364.42 - * made subject to such option by the copyright holder.
364.43 - */
364.44 -
364.45 -package org.netbeans.modules.visualweb.gravy.websvc.actions;
364.46 -
364.47 -import org.netbeans.modules.visualweb.gravy.actions.Action;
364.48 -import org.netbeans.jellytools.Bundle;
364.49 -
364.50 -/** Used to call "Create Group" popup menu item
364.51 - * @see org.netbeans.modules.visualweb.gravy.actions.Action
364.52 - * @author Alexey.Butenko@sun.com
364.53 - */
364.54 -public class CreateGroupAction extends Action {
364.55 - private static final String _popup = Bundle.getStringTrimmed("org.netbeans.modules.visualweb.websvcmgr.actions.Bundle", "ADD_GROUP");
364.56 - private static final String _menu = null; //Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/File") + "|" + savePopup; by ois
364.57 - private static final Action.Shortcut _shortcut = null;
364.58 -
364.59 - /** Creates new SaveAction instance. */
364.60 - public CreateGroupAction() {
364.61 - super(_menu, _popup, null, _shortcut);
364.62 - }
364.63 -}
365.1 --- a/visualweb.kit/gravy/src/org/netbeans/modules/visualweb/gravy/welcome/WelcomeOperator.java Thu Jul 10 04:29:52 2008 -0700
365.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
365.3 @@ -1,91 +0,0 @@
365.4 -/*
365.5 -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
365.6 -*
365.7 -* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
365.8 -*
365.9 -* The contents of this file are subject to the terms of either the GNU
365.10 -* General Public License Version 2 only ("GPL") or the Common
365.11 -* Development and Distribution License("CDDL") (collectively, the
365.12 -* "License"). You may not use this file except in compliance with the
365.13 -* License. You can obtain a copy of the License at
365.14 -* http://www.netbeans.org/cddl-gplv2.html
365.15 -* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
365.16 -* specific language governing permissions and limitations under the
365.17 -* License. When distributing the software, include this License Header
365.18 -* Notice in each file and include the License file at
365.19 -* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
365.20 -* particular file as subject to the "Classpath" exception as provided
365.21 -* by Sun in the GPL Version 2 section of the License file that
365.22 -* accompanied this code. If applicable, add the following below the
365.23 -* License Header, with the fields enclosed by brackets [] replaced by
365.24 -* your own identifying information:
365.25 -* "Portions Copyrighted [year] [name of copyright owner]"
365.26 -*
365.27 -* Contributor(s):
365.28 -*
365.29 -* The Original Software is NetBeans. The Initial Developer of the Original
365.30 -* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
365.31 -* Microsystems, Inc. All Rights Reserved.
365.32 -*
365.33 -* If you wish your version of this file to be governed by only the CDDL
365.34 -* or only the GPL Version 2, indicate your decision by adding
365.35 -* "[Contributor] elects to include this software in this distribution
365.36 -* under the [CDDL or GPL Version 2] license." If you do not indicate a
365.37 -* single choice of license, a recipient has the option to distribute
365.38 -* your version of this file under either the CDDL, the GPL Version 2 or
365.39 -* to extend the choice of license to its licensees as provided above.
365.40 -* However, if you add GPL Version 2 code and therefore, elected the GPL
365.41 -* Version 2 license, then the option applies only if the new code is
365.42 -* made subject to such option by the copyright holder.
365.43 -*/
365.44 -
365.45 -package org.netbeans.modules.visualweb.gravy.welcome;
365.46 -
365.47 -import org.netbeans.modules.visualweb.gravy.RaveWindowOperator;
365.48 -import org.netbeans.jemmy.operators.JButtonOperator;
365.49 -import org.netbeans.jemmy.operators.JTableOperator;
365.50 -
365.51 -/**
365.52 - * This class implements test functionality for the window "Welcome".
365.53 - */
365.54 -public class WelcomeOperator extends org.netbeans.jellytools.TopComponentOperator {
365.55 - /**
365.56 - * Creates an instance of this class.
365.57 - */
365.58 - public WelcomeOperator() {
365.59 - super(RaveWindowOperator.getDefaultRave(), "Welcome");
365.60 - }
365.61 -
365.62 - /**
365.63 - * Returns a list of recently opened/created projects.
365.64 - * @return the appropriate object JTableOperator
365.65 - */
365.66 - public JTableOperator getRecentProjectsList() {
365.67 - return(new JTableOperator(this));
365.68 - }
365.69 -
365.70 - /**
365.71 - * Creates and returns an instance of this class.
365.72 - * @return an instance of this class
365.73 - */
365.74 - public static WelcomeOperator showWelcome() {
365.75 -/*
365.76 - JTabbedPaneOperator tabbed = Util.getMainTab();
365.77 - //JemmyProperties.setCurrentDispatchingModel(3);
365.78 - //TBD - not working!
365.79 - //tabbed.selectPage("Welcome");
365.80 - tabbed.setSelectedIndex(tabbed.findPage("Welcome"));
365.81 -*/
365.82 - new org.netbeans.jellytools.TopComponentOperator("Welcome");
365.83 - return(new WelcomeOperator());
365.84 - }
365.85 -
365.86 - /**
365.87 - * Returns a button, placed on the window "Welcome"
365.88 - * @param text a text of a required button
365.89 - * @return an object JButtonOperator
365.90 - */
365.91 - public static JButtonOperator getWelcomeButton(String text) {
365.92 - return(new JButtonOperator(showWelcome(), text));
365.93 - }
365.94 -}
366.1 --- a/visualweb.kit/nbproject/project.properties Thu Jul 10 04:29:52 2008 -0700
366.2 +++ b/visualweb.kit/nbproject/project.properties Thu Jul 10 04:32:50 2008 -0700
366.3 @@ -38,6 +38,7 @@
366.4 # made subject to such option by the copyright holder.
366.5
366.6 nbm.needs.restart=true
366.7 -test.qa-functional.cp.extra=${nb_all}/visualweb.kit/gravy/builds/gravy.jar:\
366.8 +test.qa-functional.extra.clusters=nb.cluster.testlibs
366.9 +test.qa-functional.cp.extra=\
366.10 ${visualweb.kit.dir}/modules/ext/tidy-mod.jar:\
366.11 ${nb_all}/testtools/external/httpunit.jar
366.12 \ No newline at end of file
367.1 --- a/visualweb.kit/nbproject/project.xml Thu Jul 10 04:29:52 2008 -0700
367.2 +++ b/visualweb.kit/nbproject/project.xml Thu Jul 10 04:32:50 2008 -0700
367.3 @@ -345,6 +345,66 @@
367.4 </run-dependency>
367.5 </dependency>
367.6 </module-dependencies>
367.7 + <test-dependencies>
367.8 + <test-type>
367.9 + <name>qa-functional</name>
367.10 + <test-dependency>
367.11 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
367.12 + <compile-dependency/>
367.13 + </test-dependency>
367.14 + <!--test-dependency>
367.15 + <code-name-base>org.netbeans.modules.j2eeserver</code-name-base>
367.16 + <compile-dependency/>
367.17 + </test-dependency>
367.18 + <test-dependency>
367.19 + <code-name-base>org.netbeans.modules.java.j2seproject</code-name-base>
367.20 + <compile-dependency/>
367.21 + <test/>
367.22 + </test-dependency-->
367.23 + <test-dependency>
367.24 + <code-name-base>org.netbeans.modules.visualweb.gravy</code-name-base>
367.25 + <compile-dependency/>
367.26 + </test-dependency>
367.27 + <test-dependency>
367.28 + <code-name-base>org.netbeans.modules.jellytools</code-name-base>
367.29 + <compile-dependency/>
367.30 + <test/>
367.31 + </test-dependency>
367.32 + <test-dependency>
367.33 + <code-name-base>org.netbeans.modules.jemmy</code-name-base>
367.34 + <compile-dependency/>
367.35 + </test-dependency>
367.36 + <test-dependency>
367.37 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
367.38 + <recursive/>
367.39 + <compile-dependency/>
367.40 + </test-dependency>
367.41 + <!--test-dependency>
367.42 + <code-name-base>org.openide.awt</code-name-base>
367.43 + <compile-dependency/>
367.44 + </test-dependency>
367.45 + <test-dependency>
367.46 + <code-name-base>org.openide.util</code-name-base>
367.47 + <compile-dependency/>
367.48 + </test-dependency>
367.49 + <test-dependency>
367.50 + <code-name-base>org.openide.loaders</code-name-base>
367.51 + <compile-dependency/>
367.52 + </test-dependency>
367.53 + <test-dependency>
367.54 + <code-name-base>org.openide.filesystems</code-name-base>
367.55 + <compile-dependency/>
367.56 + </test-dependency>
367.57 + <test-dependency>
367.58 + <code-name-base>org.openide.text</code-name-base>
367.59 + <compile-dependency/>
367.60 + </test-dependency>
367.61 + <test-dependency>
367.62 + <code-name-base>org.openide.nodes</code-name-base>
367.63 + <compile-dependency/>
367.64 + </test-dependency-->
367.65 + </test-type>
367.66 + </test-dependencies>
367.67 <public-packages/>
367.68 </data>
367.69 </configuration>
368.1 --- a/visualweb.kit/test/qa-functional/src/org/netbeans/test/sanity/SanityTests.java Thu Jul 10 04:29:52 2008 -0700
368.2 +++ b/visualweb.kit/test/qa-functional/src/org/netbeans/test/sanity/SanityTests.java Thu Jul 10 04:32:50 2008 -0700
368.3 @@ -41,12 +41,6 @@
368.4
368.5 package org.netbeans.test.sanity;
368.6
368.7 -import com.meterware.httpunit.HttpUnitOptions;
368.8 -import com.meterware.httpunit.SubmitButton;
368.9 -import com.meterware.httpunit.WebConversation;
368.10 -import com.meterware.httpunit.WebForm;
368.11 -import com.meterware.httpunit.WebResponse;
368.12 -import java.awt.Component;
368.13 import javax.swing.JComponent;
368.14 import junit.framework.Test;
368.15 import junit.framework.TestSuite;
368.16 @@ -67,8 +61,6 @@
368.17 import org.netbeans.modules.visualweb.gravy.model.deployment.*;
368.18 import org.netbeans.modules.visualweb.gravy.navigation.NavigatorOperator;
368.19 import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
368.20 -import java.awt.event.KeyEvent;
368.21 -import java.io.IOException;
368.22 import java.io.IOException;
368.23 import java.util.regex.Matcher;
368.24 import java.util.regex.Pattern;
368.25 @@ -103,7 +95,6 @@
368.26
368.27 public SanityTests(String testName) {
368.28 super(testName);
368.29 - doFullThreadDump = true;
368.30 }
368.31
368.32 public static Test suite() {
369.1 --- a/visualweb.rowset/build.xml Thu Jul 10 04:29:52 2008 -0700
369.2 +++ b/visualweb.rowset/build.xml Thu Jul 10 04:32:50 2008 -0700
369.3 @@ -72,7 +72,9 @@
369.4 </target>
369.5
369.6 <target name="javadoc-zip-init">
369.7 - <ant dir="library" target="javadoc-zip" inheritAll="false"/>
369.8 + <ant dir="library" target="javadoc-zip" inheritAll="false">
369.9 + <property name="no.javadoc.preview" value="true"/>
369.10 + </ant>
369.11 </target>
369.12
369.13 <target name="clean" depends="projectized-common.clean,library-clean"/>
370.1 --- a/visualweb.web.ui.appbase/build.xml Thu Jul 10 04:29:52 2008 -0700
370.2 +++ b/visualweb.web.ui.appbase/build.xml Thu Jul 10 04:32:50 2008 -0700
370.3 @@ -57,7 +57,9 @@
370.4 </target>
370.5
370.6 <target name="javadoc-zip-init">
370.7 - <ant dir="library" target="javadoc-zip" inheritAll="false"/>
370.8 + <ant dir="library" target="javadoc-zip" inheritAll="false">
370.9 + <property name="no.javadoc.preview" value="true"/>
370.10 + </ant>
370.11 </target>
370.12
370.13 <target name="netbeans-extra" depends="init">
371.1 --- a/visualweb.webui/build.xml Thu Jul 10 04:29:52 2008 -0700
371.2 +++ b/visualweb.webui/build.xml Thu Jul 10 04:32:50 2008 -0700
371.3 @@ -59,7 +59,9 @@
371.4 </target>
371.5
371.6 <target name="javadoc-zip-init">
371.7 - <ant dir="library" target="javadoc-zip" inheritAll="false"/>
371.8 + <ant dir="library" target="javadoc-zip" inheritAll="false">
371.9 + <property name="no.javadoc.preview" value="true"/>
371.10 + </ant>
371.11 </target>
371.12
371.13 <target name="netbeans-extra" depends="init">