Java Code Examples for org.fest.swing.core.GenericTypeMatcher

The following examples show how to use org.fest.swing.core.GenericTypeMatcher. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ats-framework   Source File: SwingElementFinder.java    License: Apache License 2.0 6 votes vote down vote up
public static <T extends Component> T find(
                                            Robot robot,
                                            Container root,
                                            GenericTypeMatcher<T> m ) {

    ComponentHierarchy hierarchy = robot.hierarchy();
    List<Component> found = null;
    if (root == null) {
        found = find(hierarchy, m);
    } else {
        found = find(new SingleComponentHierarchy(root, hierarchy), m);
    }
    if (found.isEmpty()) {
        throw componentNotFound(robot, hierarchy, m);
    }
    if (found.size() > 1) {
        throw multipleComponentsFound(found, m);
    }
    Component component = found.iterator().next();
    return m.supportedType().cast(component);
}
 
Example 2
Source Project: ats-framework   Source File: SwingElementFinder.java    License: Apache License 2.0 5 votes vote down vote up
public static List<Component> find(
                                    ComponentHierarchy hierarchy,
                                    Container root,
                                    GenericTypeMatcher<Component> m ) {

    List<Component> found = null;
    if (root == null) {
        found = find(hierarchy, m);
    } else {
        found = find(new SingleComponentHierarchy(root, hierarchy), m);
    }
    return found;
}
 
Example 3
@NotNull
public IdeSettingsDialogFixture invokeSdkManager() {
  ActionButton sdkButton = waitUntilShowingAndEnabled(robot(), target(), new GenericTypeMatcher<ActionButton>(ActionButton.class) {
    @Override
    protected boolean isMatching(@NotNull ActionButton actionButton) {
      return "SDK Manager".equals(actionButton.getAccessibleContext().getAccessibleName());
    }
  });
  robot().click(sdkButton);
  return IdeSettingsDialogFixture.find(robot());
}
 
Example 4
public void selectPreviousEditor() {
  robot().pressAndReleaseKey(KeyEvent.VK_E, SystemInfo.isMac ? META_MASK : CTRL_MASK);
  GuiTests.waitUntilShowing(robot(), new GenericTypeMatcher<JLabel>(JLabel.class) {
    @Override
    protected boolean isMatching(@NotNull JLabel header) {
      return Objects.equals(header.getText(), "Recent Files");
    }
  });
  robot().pressAndReleaseKey(KeyEvent.VK_ENTER, 0);
}
 
Example 5
Source Project: intellij-xquery   Source File: DataSourceSelectorGuiTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void shouldDisplayNoSelected() {
    window.label(new GenericTypeMatcher<BasicComboBoxRenderer>(BasicComboBoxRenderer.class) {
        @Override
        protected boolean isMatching(BasicComboBoxRenderer component) {
            return true;
        }
    }).requireText(NO_DATA_SOURCE);
}
 
Example 6
@NotNull
public ActionButtonFixture findAttachDebuggerToAndroidProcessButton() {
  GenericTypeMatcher<ActionButton> matcher = Matchers.byText(ActionButton.class, "Attach Debugger to Android Process").andIsShowing();
  return ActionButtonFixture.findByMatcher(matcher, robot(), target());
}