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.
 */

/*
 * EnvironmentVariablesOperator.java
 *
 * Created on 12/18/02 5:05 PM
 */
package org.netbeans.jellytools.modules.java;

import org.netbeans.jellytools.Bundle;
import org.netbeans.jemmy.operators.*;

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

    /** Creates new EnvironmentVariablesOperator that can handle it.
     */
    public EnvironmentVariablesOperator() {
        super(Bundle.getString("org.netbeans.core.execution.beaninfo.Bundle", "PROP_PEBI_environmentVariables"));
    }

    private JListOperator _lstItemList;
    private JLabelOperator _lblItem;
    private JTextFieldOperator _txtItem;
    private JLabelOperator _lblItemList;
    private JButtonOperator _btAdd;
    private JButtonOperator _btEdit;
    private JButtonOperator _btRemove;
    private JButtonOperator _btUp;
    private JButtonOperator _btDown;
    private JButtonOperator _btOK;
    private JButtonOperator _btCancel;


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

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

    /** Tries to find "Item:" JLabel in this dialog.
     * @return JLabelOperator
     */
    public JLabelOperator lblItem() {
        if (_lblItem==null) {
            _lblItem = new JLabelOperator(this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_Item"));
        }
        return _lblItem;
    }

    /** Tries to find null JTextField in this dialog.
     * @return JTextFieldOperator
     */
    public JTextFieldOperator txtItem() {
        if (_txtItem==null) {
            _txtItem = new JTextFieldOperator(this);
        }
        return _txtItem;
    }

    /** Tries to find "Item List" JLabel in this dialog.
     * @return JLabelOperator
     */
    public JLabelOperator lblItemList() {
        if (_lblItemList==null) {
            _lblItemList = new JLabelOperator(this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_ItemList"));
        }
        return _lblItemList;
    }

    /** Tries to find "Add" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btAdd() {
        if (_btAdd==null) {
            _btAdd = new JButtonOperator(this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_ELCE_Add"));
        }
        return _btAdd;
    }

    /** Tries to find "Edit" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btEdit() {
        if (_btEdit==null) {
            _btEdit = new JButtonOperator(this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_ELCE_Change"));
        }
        return _btEdit;
    }

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

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

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

    /** Tries to find "OK" JButton in this dialog.
     * @return JButtonOperator
     */
    public JButtonOperator btOK() {
        if (_btOK==null) {
            _btOK = new JButtonOperator(this, Bundle.getString("org.netbeans.beaninfo.editors.Bundle", "CTL_FileSystemPanel.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.Bundle", "CTL_CANCEL"));
        }
        return _btCancel;
    }


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

    /** gets text for txtItem
     * @return String text
     */
    public String getItem() {
        return txtItem().getText();
    }

    /** sets text for txtItem
     * @param text String text
     */
    public void setItem(String text) {
        txtItem().setText(text);
    }

    /** types text for txtItem
     * @param text String text
     */
    public void typeItem(String text) {
        txtItem().typeText(text);
    }

    /** clicks on "Add" JButton
     */
    public void add() {
        btAdd().push();
    }

    /** clicks on "Edit" JButton
     */
    public void edit() {
        btEdit().push();
    }

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

    /** clicks on "Up" JButton
     */
    public void up() {
        btUp().push();
    }

    /** clicks on "Down" JButton
     */
    public void down() {
        btDown().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 EnvironmentVariablesOperator by accessing all its components.
     */
    public void verify() {
        lstItemList();
        lblItem();
        txtItem();
        lblItemList();
        btAdd();
        btEdit();
        btRemove();
        btUp();
        btDown();
        btOK();
        btCancel();
    }

    /** Performs simple test of EnvironmentVariablesOperator
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        new EnvironmentVariablesOperator().verify();
        System.out.println("EnvironmentVariablesOperator 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.