alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

/*
 * ClassPathOperator.java
 *

 */
package org.netbeans.jellytools.modules.java;

import org.netbeans.jellytools.Bundle;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JDialogOperator;
import org.netbeans.jemmy.operators.JLabelOperator;
import org.netbeans.jemmy.operators.JListOperator;

/** Class implementing all necessary methods for handling "Class Path" NbDialog.
 *
 * @author jb105785
 * @version 1.0
 */
public class ClassPathOperator extends JDialogOperator {

    /** Creates new ClassPathOperator that can handle it.
     */
    public ClassPathOperator() {
        super(Bundle.getString("org.netbeans.modules.java.Bundle", "PROP_CLASSPATH"));
    }

    private JButtonOperator _btAddDirectory;
    private JButtonOperator _btAddJARZIP;
    private JButtonOperator _btMoveUp;
    private JButtonOperator _btMoveDown;
    private JButtonOperator _btRemove;
    private JListOperator _lstClasspath;
    private JLabelOperator _lblClasspath;
    private JButtonOperator _btOK;
    private JButtonOperator _btCancel;


    //******************************
    // Subcomponents definition part
    //******************************

    /** Tries to find "Add Directory..." JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btAddDirectory() {
        if (_btAddDirectory==null) {
            _btAddDirectory = new JButtonOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle", "CTL_AddDirectory"));
        }
        return _btAddDirectory;
    }

    /** Tries to find "Add JAR/ZIP..." JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btAddJARZIP() {
        if (_btAddJARZIP==null) {
            _btAddJARZIP = new JButtonOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle", "CTL_AddJAR"));
        }
        return _btAddJARZIP;
    }

    /** Tries to find "Move Up" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btMoveUp() {
        if (_btMoveUp==null) {
            _btMoveUp = new JButtonOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle", "CTL_MoveUp"));
        }
        return _btMoveUp;
    }

    /** Tries to find "Move Down" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btMoveDown() {
        if (_btMoveDown==null) {
            _btMoveDown = new JButtonOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle", "CTL_MoveDown"));
        }
        return _btMoveDown;
    }

    /** Tries to find "Remove" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btRemove() {
        if (_btRemove==null) {
            _btRemove = new JButtonOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle", "CTL_Remove"));
        }
        return _btRemove;
    }

    /** Tries to find null JList in this dialog.
     * @return JListOperator
     */
    public JListOperator lstClasspath() {
        if (_lstClasspath==null) {
            _lstClasspath = new JListOperator(this);
        }
        return _lstClasspath;
    }

    /** Tries to find "Classpath" JLabel in this dialog.
     * @return JLabelOperator
     */
    public JLabelOperator lblClasspath() {
        if (_lblClasspath==null) {
            _lblClasspath = new JLabelOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.Bundle", "PROP_PEBI_classPath"));
        }
        return _lblClasspath;
    }

    /** Tries to find "OK" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btOK() {
        if (_btOK==null) {
            _btOK = new JButtonOperator(this, Bundle.getString("org.netbeans.core.execution.beaninfo.editors.Bundle", "CTL_Approve_Button_Title"));
        }
        return _btOK;
    }

    /** Tries to find "Cancel" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btCancel() {
        if (_btCancel==null) {
            _btCancel = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.Bundle", "CTL_Cancel"));
        }
        return _btCancel;
    }


    //****************************************
    // Low-level functionality definition part
    //****************************************

    /** clicks on "Add Directory..." JButton
     */
    public void addDirectory() {
        btAddDirectory().push();
    }

    /** clicks on "Add JAR/ZIP..." JButton
     */
    public void addJARZIP() {
        btAddJARZIP().push();
    }

    /** clicks on "Move Up" JButton
     */
    public void moveUp() {
        btMoveUp().push();
    }

    /** clicks on "Move Down" JButton
     */
    public void moveDown() {
        btMoveDown().push();
    }

    /** clicks on "Remove" JButton
     */
    public void remove() {
        btRemove().push();
    }

    /** clicks on "OK" JButton
     */
    public void ok() {
        btOK().push();
    }

    /** clicks on "Cancel" JButton
     */
    public void cancel() {
        btCancel().push();
    }


    //*****************************************
    // High-level functionality definition part
    //*****************************************

    /** Performs verification of ClassPathOperator by accessing all its components.
     */
    public void verify() {
        btAddDirectory();
        btAddJARZIP();
        btMoveUp();
        btMoveDown();
        btRemove();
        lstClasspath();
        lblClasspath();
        btOK();
        btCancel();
    }

    /** Performs simple test of ClassPathOperator
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        new ClassPathOperator().verify();
        System.out.println("ClassPathOperator verification finished.");  //NOI18N
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.