Search in sources :

Example 36 with SwingElementState

use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.

the class SwingComponent method drag.

/**
 * Simulates a user dragging of this component
 */
@PublicAtsApi
public void drag() {
    new SwingElementState(this).waitToBecomeExisting();
    ComponentFixture<? extends Component> componentFixture = SwingElementLocator.findFixture(this);
    ComponentDragAndDrop componentDragAndDrop = new ComponentDragAndDrop(componentFixture.robot);
    componentDragAndDrop.drag(componentFixture.target, getComponentCenterLocation(componentFixture.target));
}
Also used : ComponentDragAndDrop(org.fest.swing.core.ComponentDragAndDrop) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 37 with SwingElementState

use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.

the class SwingComponent method drop.

/**
 * Simulates a user dropping to this component
 */
@PublicAtsApi
public void drop() {
    new SwingElementState(this).waitToBecomeExisting();
    ComponentFixture<? extends Component> componentFixture = SwingElementLocator.findFixture(this);
    ComponentDragAndDrop componentDragAndDrop = new ComponentDragAndDrop(componentFixture.robot);
    componentDragAndDrop.drop(componentFixture.target, getComponentCenterLocation(componentFixture.target));
}
Also used : ComponentDragAndDrop(org.fest.swing.core.ComponentDragAndDrop) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 38 with SwingElementState

use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.

the class SwingComponent method click.

/**
 * Simulates a user click over the GUI component.
 */
@PublicAtsApi
public void click() {
    new SwingElementState(this).waitToBecomeExisting();
    click(MouseClickInfo.leftButton());
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 39 with SwingElementState

use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.

the class SwingPopupMenu method getVisibleMenuLabels.

/**
 * Getting only visible menu labels/texts
 *
 * @return an array with the visible menu labels/texts only
 */
@PublicAtsApi
public String[] getVisibleMenuLabels() {
    new SwingElementState(this).waitToBecomeExisting();
    JPopupMenuFixture popupMenuFixture = (JPopupMenuFixture) SwingElementLocator.findFixture(this);
    String[] labels = popupMenuFixture.menuLabels();
    List<String> visibleLabels = new ArrayList<String>(labels.length);
    for (final String label : labels) {
        JMenuItemFixture menuItemFixture = popupMenuFixture.menuItem(new GenericTypeMatcher<JMenuItem>(JMenuItem.class, false) {

            @Override
            protected boolean isMatching(JMenuItem menuItem) {
                String text = menuItem.getText();
                if (text != null && text.equals(label)) {
                    return true;
                }
                return false;
            }
        });
        if (menuItemFixture != null && menuItemFixture.component().isVisible()) {
            visibleLabels.add(label);
        }
    }
    return visibleLabels.toArray(new String[0]);
}
Also used : JPopupMenuFixture(org.fest.swing.fixture.JPopupMenuFixture) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) ArrayList(java.util.ArrayList) JMenuItemFixture(org.fest.swing.fixture.JMenuItemFixture) JMenuItem(javax.swing.JMenuItem) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 40 with SwingElementState

use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.

the class SwingComponent method middleClick.

/**
 * Simulates a user middle click over the GUI component.
 */
@PublicAtsApi
public void middleClick() {
    new SwingElementState(this).waitToBecomeExisting();
    click(MouseClickInfo.middleButton());
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)60 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)60 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)16 JTableFixture (org.fest.swing.fixture.JTableFixture)16 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)12 TableCell (org.fest.swing.data.TableCell)12 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)11 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)11 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)10 JTreeFixture (org.fest.swing.fixture.JTreeFixture)8 JListFixture (org.fest.swing.fixture.JListFixture)7 JPopupMenuFixture (org.fest.swing.fixture.JPopupMenuFixture)5 JSpinnerFixture (org.fest.swing.fixture.JSpinnerFixture)4 ArrayList (java.util.ArrayList)2 ComponentDragAndDrop (org.fest.swing.core.ComponentDragAndDrop)2 JCheckBoxFixture (org.fest.swing.fixture.JCheckBoxFixture)2 JFileChooserFixture (org.fest.swing.fixture.JFileChooserFixture)2 JMenuItemFixture (org.fest.swing.fixture.JMenuItemFixture)2 JTabbedPaneFixture (org.fest.swing.fixture.JTabbedPaneFixture)2 JTableHeaderFixture (org.fest.swing.fixture.JTableHeaderFixture)2