001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /*
043: * DeploymentDialogOperator.java
044: *
045: * Created on November 11, 2003, 9:35 PM
046: */
047:
048: package org.netbeans.modules.visualweb.gravy;
049:
050: import java.awt.Component;
051: import java.awt.Container;
052: import javax.swing.JDialog;
053: import javax.swing.JFrame;
054:
055: import org.netbeans.jemmy.ComponentChooser;
056: import org.netbeans.jemmy.ComponentSearcher;
057: import org.netbeans.jemmy.JemmyProperties;
058: import org.netbeans.jemmy.operators.JCheckBoxOperator;
059: import org.netbeans.jemmy.operators.JDialogOperator;
060: import org.netbeans.jemmy.operators.JLabelOperator;
061:
062: public class DeploymentDialogOperator extends JDialogOperator {
063:
064: JCheckBoxOperator autoHide;
065:
066: /** Creates a new instance of DeploymentDialogOperator */
067: public DeploymentDialogOperator() {
068: super (new DeploymentDialogFinder());
069: copyEnvironment(Util.getMainWindow());
070: getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout",
071: 600000);
072: getTimeouts().setTimeout(
073: "ComponentOperator.WaitComponentTimeout", 600000);
074: }
075:
076: /**
077: * Creates a new instance of DeploymentDialogOperator
078: */
079: public static DeploymentDialogOperator deploy() {
080: return (Util.getMainWindow().deploy());
081: }
082:
083: /**
084: * Get checkbox for autoHide deployment dialog.
085: * @return JCheckBoxOperator
086: */
087: public JCheckBoxOperator chbAutoHide() {
088: if (autoHide == null) {
089: autoHide = new JCheckBoxOperator(this ,
090: "Automatically close this window when finished");
091: }
092: return (autoHide);
093: }
094:
095: /**
096: * Check or uncheck checkbox for autoHide deployment dialog.
097: * @param isAutoHide Boolean value for checkbox's state.
098: */
099: public void setAutoHide(boolean isAutoHide) {
100: chbAutoHide().changeSelection(isAutoHide);
101: }
102:
103: /**
104: * Wait specified status.
105: * @param status Status which will be waited.
106: * @return JLabelOperator Label with specified state.
107: */
108: public JLabelOperator waitStatus(String status) {
109: return (new JLabelOperator(this , status));
110: }
111:
112: /**
113: * Wait state "Completed".
114: * @return JLabelOperator Label with state "Completed".
115: */
116: public JLabelOperator waitCompleted() {
117: return (waitStatus("Completed"));
118: }
119:
120: public static class DeploymentDialogFinder implements
121: ComponentChooser {
122: public boolean checkComponent(Component comp) {
123: ComponentSearcher searcher = new ComponentSearcher(
124: (Container) comp);
125:
126: searcher.setOutput(JemmyProperties.getCurrentOutput()
127: .createErrorOutput());
128: /* return(comp instanceof JFrame &&
129: searcher.findComponent(new ComponentChooser() {
130: public boolean checkComponent(Component comp) {
131:
132: return(comp.getClass().getName().endsWith("ProgressUI"));
133: }
134: public String getDescription() {
135: return("ProgressUI");
136: }
137: }) != null);*/
138: return (comp instanceof JDialog);
139: }
140:
141: public String getDescription() {
142: return ("Deployment dialog");
143: }
144: }
145: }
|