Java源码示例:org.fest.swing.core.GenericTypeMatcher

示例1
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);
}
 
示例2
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;
}
 
示例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());
}
 
示例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);
}
 
示例5
@Test
public void shouldDisplayNoSelected() {
    window.label(new GenericTypeMatcher<BasicComboBoxRenderer>(BasicComboBoxRenderer.class) {
        @Override
        protected boolean isMatching(BasicComboBoxRenderer component) {
            return true;
        }
    }).requireText(NO_DATA_SOURCE);
}
 
示例6
@NotNull
public ActionButtonFixture findAttachDebuggerToAndroidProcessButton() {
  GenericTypeMatcher<ActionButton> matcher = Matchers.byText(ActionButton.class, "Attach Debugger to Android Process").andIsShowing();
  return ActionButtonFixture.findByMatcher(matcher, robot(), target());
}