Search in sources :

Example 41 with SwingElementState

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

the class SwingTabbedPane method selectTabUsingSubElement.

/**
 * Select tab by title using SubElement described in the map file. The required property is 'title'
 *
 * @param mapId the sub-element mapID. This element must have property 'title'
 * @throws VerificationException if the table element doesn't exist
 */
@PublicAtsApi
public void selectTabUsingSubElement(String mapId) {
    new SwingElementState(this).waitToBecomeExisting();
    try {
        String elementMapId = properties.getInternalProperty(UiElementProperties.MAP_ID_INTERNAL_PARAM);
        if (elementMapId == null) {
            throw new UiElementException("The element must be in the MAP file", this);
        }
        UiElementProperties elProperties = ElementsMap.getInstance().getSubElementProperties(elementMapId, mapId);
        String tabTitle = elProperties.getProperty("title");
        if (tabTitle == null) {
            throw new UiElementException("The Sub-Element doesn't have 'title' attribute, " + "which is required for tab selection.", this);
        }
        ((JTabbedPaneFixture) SwingElementLocator.findFixture(this)).selectTab(tabTitle);
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementProperties(com.axway.ats.uiengine.elements.UiElementProperties) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 42 with SwingElementState

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

the class SwingTabbedPane method selectTabUsingSubElement.

/**
 * Select tab by title using sub-element properties. The required property is 'title'
 *
 * @param elementProperties the sub-element {@link UiElementProperties} which contains property 'title'
 * @throws VerificationException if the table element doesn't exist
 */
@PublicAtsApi
public void selectTabUsingSubElement(UiElementProperties elementProperties) {
    new SwingElementState(this).waitToBecomeExisting();
    try {
        String tabTitle = elementProperties.getProperty("title");
        if (tabTitle == null) {
            throw new UiElementException("The Sub-Element doesn't have 'title' attribute, " + "which is required for tab selection.", this);
        }
        ((JTabbedPaneFixture) SwingElementLocator.findFixture(this)).selectTab(tabTitle);
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 43 with SwingElementState

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

the class SwingTree method select.

/**
 * Select tree elements by labels
 *
 * @param labels the tree element labels
 * @throws VerificationException if the tree element doesn't exist
 */
@Override
@PublicAtsApi
public void select(String... labels) {
    new SwingElementState(this).waitToBecomeExisting();
    JTreeFixture treeFixture = (JTreeFixture) SwingElementLocator.findFixture(this);
    // sometimes it is necessary
    expandTree(treeFixture, labels);
    treeFixture.selectPath(buildPath(labels));
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 44 with SwingElementState

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

the class SwingTree method click.

@PublicAtsApi
public void click(int rowIndex) {
    new SwingElementState(this).waitToBecomeExisting();
    ((JTreeFixture) SwingElementLocator.findFixture(this)).clickRow(rowIndex);
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 45 with SwingElementState

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

the class SwingTree method rightClick.

@PublicAtsApi
public void rightClick(String[] path, String... contextMenuItems) {
    new SwingElementState(this).waitToBecomeExisting();
    JTreeFixture treeFixture = (JTreeFixture) SwingElementLocator.findFixture(this);
    // sometimes it is necessary
    expandTree(treeFixture, path);
    JPopupMenuFixture popUpMenu = treeFixture.showPopupMenuAt(buildPath(path));
    popUpMenu.menuItemWithPath(contextMenuItems).click();
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) JPopupMenuFixture(org.fest.swing.fixture.JPopupMenuFixture) 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