|
What this is
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. */ /* * MethodCustomizerOperator.java * * Created on 9/30/02 3:57 PM */ package org.netbeans.jellytools.modules.java; import org.netbeans.jellytools.Bundle; import org.netbeans.jellytools.NbDialogOperator; import org.netbeans.jemmy.operators.*; /** Class implementing all necessary methods for handling "Add New Method" NbPresenter. * * @author jb105785 * @version 1.0 */ public class MethodCustomizerOperator extends NbDialogOperator { /** Creates new MethodCustomizerOperator that can handle it. */ public MethodCustomizerOperator(String title) { super(title); } private JLabelOperator _lblName; private JTextFieldOperator _txtName; private JLabelOperator _lblReturnType; private JComboBoxOperator _cboReturnType; private JCheckBoxOperator _cbAbstract; private JCheckBoxOperator _cbFinal; private JCheckBoxOperator _cbStatic; private JCheckBoxOperator _cbSynchronized; private JCheckBoxOperator _cbTransient; private JCheckBoxOperator _cbVolatile; private JCheckBoxOperator _cbNative; private JLabelOperator _lblAccess; private JComboBoxOperator _cboAccess; private JListOperator _lstJList; private JButtonOperator _btUp; private JButtonOperator _btDown; private JButtonOperator _btAdd; private JButtonOperator _btRemove; private JButtonOperator _btEdit; private JListOperator _lstJList2; private JButtonOperator _btUp2; private JButtonOperator _btDown2; private JButtonOperator _btAdd2; private JButtonOperator _btRemove2; private JButtonOperator _btEdit2; private JButtonOperator _btOK; private JButtonOperator _btCancel; //****************************** // Subcomponents definition part //****************************** /** Tries to find "Name:" JLabel in this dialog. * @return JLabelOperator */ public JLabelOperator lblName() { if (_lblName==null) { _lblName = new JLabelOperator(this, Bundle.getString("org.openide.src.nodes.Bundle", "CTL_Name")); } return _lblName; } /** Tries to find null JTextField in this dialog. * @return JTextFieldOperator */ public JTextFieldOperator txtName() { if (_txtName==null) { _txtName = new JTextFieldOperator(this); } return _txtName; } /** Tries to find "Return Type:" JLabel in this dialog. * @return JLabelOperator */ public JLabelOperator lblReturnType() { if (_lblReturnType==null) { _lblReturnType = new JLabelOperator(this, Bundle.getString("org.openide.src.nodes.Bundle", "CTL_ReturnType")); } return _lblReturnType; } /** Tries to find null JComboBox in this dialog. * @return JComboBoxOperator */ public JComboBoxOperator cboReturnType() { if (_cboReturnType==null) { _cboReturnType = new JComboBoxOperator(this); } return _cboReturnType; } /** Tries to find "abstract" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbAbstract() { if (_cbAbstract==null) { _cbAbstract = new JCheckBoxOperator(this, "abstract"); //NO18N } return _cbAbstract; } /** Tries to find "final" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbFinal() { if (_cbFinal==null) { _cbFinal = new JCheckBoxOperator(this, "final"); //NO18N } return _cbFinal; } /** Tries to find "static" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbStatic() { if (_cbStatic==null) { _cbStatic = new JCheckBoxOperator(this, "static"); //NO18N } return _cbStatic; } /** Tries to find "synchronized" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbSynchronized() { if (_cbSynchronized==null) { _cbSynchronized = new JCheckBoxOperator(this, "synchronized"); //NO18N } return _cbSynchronized; } /** Tries to find "transient" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbTransient() { if (_cbTransient==null) { _cbTransient = new JCheckBoxOperator(this, "transient"); //NO18N } return _cbTransient; } /** Tries to find "volatile" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbVolatile() { if (_cbVolatile==null) { _cbVolatile = new JCheckBoxOperator(this, "volatile"); //NO18N } return _cbVolatile; } /** Tries to find "native" JCheckBox in this dialog. * @return JCheckBoxOperator */ public JCheckBoxOperator cbNative() { if (_cbNative==null) { _cbNative = new JCheckBoxOperator(this, "native"); //NO18N } return _cbNative; } /** Tries to find "Access:" JLabel in this dialog. * @return JLabelOperator */ public JLabelOperator lblAccess() { if (_lblAccess==null) { _lblAccess = new JLabelOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "LAB_AccessRights")); } return _lblAccess; } /** Tries to find null JComboBox in this dialog. * @return JComboBoxOperator */ public JComboBoxOperator cboAccess() { if (_cboAccess==null) { _cboAccess = new JComboBoxOperator(this, 1); } return _cboAccess; } /** Tries to find null JList in this dialog. * @return JListOperator */ public JListOperator lstJList() { if (_lstJList==null) { _lstJList = new JListOperator(this); } return _lstJList; } /** Tries to find "Up" JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btUp() { if (_btUp==null) { _btUp = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "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.openide.explorer.propertysheet.editors.Bundle2", "CTL_MoveDown")); } return _btDown; } /** Tries to find "Add..." JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btAdd() { if (_btAdd==null) { _btAdd = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_Add")); } return _btAdd; } /** Tries to find "Remove" JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btRemove() { if (_btRemove==null) { _btRemove = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_Remove")); } return _btRemove; } /** Tries to find "Edit..." JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btEdit() { if (_btEdit==null) { _btEdit = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_Change")); } return _btEdit; } /** Tries to find null JList in this dialog. * @return JListOperator */ public JListOperator lstJList2() { if (_lstJList2==null) { _lstJList2 = new JListOperator(this, 1); } return _lstJList2; } /** Tries to find "Up" JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btUp2() { if (_btUp2==null) { _btUp2 = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_MoveUp"), 1); } return _btUp2; } /** Tries to find "Down" JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btDown2() { if (_btDown2==null) { _btDown2 = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_MoveDown"), 1); } return _btDown2; } /** Tries to find "Add..." JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btAdd2() { if (_btAdd2==null) { _btAdd2 = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_Add"), 1); } return _btAdd2; } /** Tries to find "Remove" JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btRemove2() { if (_btRemove2==null) { _btRemove2 = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_Remove"), 1); } return _btRemove2; } /** Tries to find "Edit..." JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btEdit2() { if (_btEdit2==null) { _btEdit2 = new JButtonOperator(this, Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle2", "CTL_Change"), 1); } return _btEdit2; } /** Tries to find "OK" JButton in this dialog. * @return JButtonOperator */ public JButtonOperator btOK() { if (_btOK==null) { _btOK = new JButtonOperator(this, Bundle.getString("org.openide.Bundle", "CTL_OK")); } 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 txtName * @return String text */ public String getName() { return txtName().getText(); } /** sets text for txtName * @param text String text */ public void setName(String text) { txtName().setText(text); } /** types text for txtName * @param text String text */ public void typeName(String text) { txtName().typeText(text); } /** returns selected item for cboReturnType * @return String item */ public String getSelectedReturnType() { return cboReturnType().getSelectedItem().toString(); } /** selects item for cboReturnType * @param item String item */ public void selectReturnType(String item) { cboReturnType().selectItem(item); } /** types text for cboReturnType * @param text String text */ public void typeReturnType(String text) { cboReturnType().typeText(text); } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkAbstract(boolean state) { if (cbAbstract().isSelected()!=state) { cbAbstract().push(); } } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkFinal(boolean state) { if (cbFinal().isSelected()!=state) { cbFinal().push(); } } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkStatic(boolean state) { if (cbStatic().isSelected()!=state) { cbStatic().push(); } } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkSynchronized(boolean state) { if (cbSynchronized().isSelected()!=state) { cbSynchronized().push(); } } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkTransient(boolean state) { if (cbTransient().isSelected()!=state) { cbTransient().push(); } } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkVolatile(boolean state) { if (cbVolatile().isSelected()!=state) { cbVolatile().push(); } } /** checks or unchecks given JCheckBox * @param state boolean requested state */ public void checkNative(boolean state) { if (cbNative().isSelected()!=state) { cbNative().push(); } } /** returns selected item for cboAccess * @return String item */ public String getSelectedAccess() { return cboAccess().getSelectedItem().toString(); } /** selects item for cboAccess * @param item String item */ public void selectAccess(String item) { cboAccess().selectItem(item); } /** types text for cboAccess * @param text String text */ public void typeAccess(String text) { cboAccess().typeText(text); } /** clicks on "Up" JButton */ public void up() { btUp().push(); } /** clicks on "Down" JButton */ public void down() { btDown().push(); } /** clicks on "Add..." JButton */ public void add() { btAdd().push(); } /** clicks on "Remove" JButton */ public void remove() { btRemove().push(); } /** clicks on "Edit..." JButton */ public void edit() { btEdit().push(); } /** clicks on "Up" JButton */ public void up2() { btUp2().push(); } /** clicks on "Down" JButton */ public void down2() { btDown2().push(); } /** clicks on "Add..." JButton */ public void add2() { btAdd2().push(); } /** clicks on "Remove" JButton */ public void remove2() { btRemove2().push(); } /** clicks on "Edit..." JButton */ public void edit2() { btEdit2().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 MethodCustomizerOperator by accessing all its components. */ public void verify() { lblName(); txtName(); lblReturnType(); cboReturnType(); cbAbstract(); cbFinal(); cbStatic(); cbSynchronized(); cbTransient(); cbVolatile(); cbNative(); lblAccess(); cboAccess(); lstJList(); btUp(); btDown(); btAdd(); btRemove(); btEdit(); lstJList2(); btUp2(); btDown2(); btAdd2(); btRemove2(); btEdit2(); btOK(); btCancel(); } /** Performs simple test of MethodCustomizerOperator * @param args the command line arguments */ public static void main(String args[]) { new MethodCustomizerOperator("Add New Method").verify(); System.out.println("MethodCustomizerOperator verification finished."); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.