|
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. */ package org.netbeans.web.test; import org.netbeans.jellytools.NbDialogOperator; import org.netbeans.jellytools.Bundle; import org.netbeans.jemmy.operators.JScrollPaneOperator; import org.netbeans.jemmy.operators.JButtonOperator; import org.netbeans.jemmy.operators.JTableOperator; import javax.swing.JDialog; import java.awt.Point; /** Enable to manipulate dialogs with table of properties Examples: "Deployment Entries", "Edit Servlet Mappings" */ public class PropertyTableDialogOperator extends NbDialogOperator { private JButtonOperator _btAdd = null; private JButtonOperator _btRemove = null; private JButtonOperator _btEdit = null; private JTableOperator _table = null; /** Generic constructor * @param dialog instance of NbDialog */ public PropertyTableDialogOperator(JDialog dialog) { super(dialog); } /** Creates a new instance of WizardOperator. * It waits for a dialog with given title. * @param title title of a wizard window */ public PropertyTableDialogOperator(String title) { super(title); } /** Returns operator of "Add..." button. * @return JButtonOperator instance of "Add... " button */ public JButtonOperator btAdd() { if (_btAdd == null) { String addCaption = Bundle.getString("com.sun.forte4j.j2ee.lib.ui.Bundle", "CTL_Add"); _btAdd = new JButtonOperator(this, addCaption); } return _btAdd; } /** Returns operator of "Remove..." button. * @return JButtonOperator instance of "Remove..." button */ public JButtonOperator btRemove() { if (_btRemove == null) { String removeCaption = Bundle.getString("com.sun.forte4j.j2ee.lib.ui.Bundle", "CTL_Remove"); _btRemove = new JButtonOperator(this, removeCaption); } return _btRemove; } /** Returns operator of "Edit" button. * @return JButtonOperator instance of "Edit" button */ public JButtonOperator btEdit() { if (_btEdit == null) { String editCaption = Bundle.getString("com.sun.forte4j.j2ee.lib.ui.Bundle", "CTL_Edit"); _btEdit = new JButtonOperator(this, editCaption); } return _btEdit; } public JTableOperator table() { if (_table == null) { _table = new JTableOperator(new JScrollPaneOperator(this)); } return _table; } public void selectCell(String text) { Point p = table().findCell(text,0); table().selectCell(p.x, p.y); } /** Pushes "Add..." button. */ public void add() { btAdd().push(); } /** Pushes "Remove..." button. */ public void remove() { btRemove().push(); } /** Pushes "Edit" button. */ public void edit() { btEdit().push(); } /** Performs verification by accessing all sub-components */ public void verify() { btAdd(); btRemove(); btEdit(); table(); btOK(); btCancel(); btHelp(); } } |
... 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.