当前位置: 首页>>代码示例>>Java>>正文


Java GenericTypeMatcher类代码示例

本文整理汇总了Java中org.fest.swing.core.GenericTypeMatcher的典型用法代码示例。如果您正苦于以下问题:Java GenericTypeMatcher类的具体用法?Java GenericTypeMatcher怎么用?Java GenericTypeMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GenericTypeMatcher类属于org.fest.swing.core包,在下文中一共展示了GenericTypeMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: find

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
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);
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:22,代码来源:SwingElementFinder.java

示例2: find

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public static ChooseGradleHomeDialogFixture find(@NotNull final Robot robot) {
  DialogFixture found = findDialog(new GenericTypeMatcher<Dialog>(Dialog.class) {
    @Override
    protected boolean isMatching(@NotNull Dialog dialog) {
      if (!dialog.isVisible() || !dialog.isShowing()) {
        return false;
      }
      ComponentFinder finder = robot.finder();
      finder.find(dialog, new ComponentMatcher() {
        @Override
        public boolean matches(Component c) {
          if (c instanceof JBLabel) {
            return "Gradle home:".equals(((JBLabel)c).getText());
          }
          return false;
        }
      });
      finder.findByType(dialog, TextFieldWithBrowseButton.class);
      return true;
    }
  }).withTimeout(LONG_TIMEOUT.duration()).using(robot);
  return new ChooseGradleHomeDialogFixture(robot, found.target());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ChooseGradleHomeDialogFixture.java

示例3: chooseGradleHome

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public ChooseGradleHomeDialogFixture chooseGradleHome(@NotNull File gradleHomePath) {
  FixedSizeButton browseButton = robot().finder().findByType(target(), FixedSizeButton.class, true);
  robot().click(browseButton);

  FileChooserDialogFixture fileChooserDialog = FileChooserDialogFixture.findDialog(robot(), new GenericTypeMatcher<JDialog>(JDialog.class) {
    @Override
    protected boolean isMatching(@NotNull JDialog dialog) {
      Collection<JLabel> descriptionLabels = robot().finder().findAll(dialog, JLabelMatcher.withText("Gradle home:"));
      return descriptionLabels.size() == 1;
    }
  });

  VirtualFile toSelect = findFileByIoFile(gradleHomePath, true);
  assertNotNull(toSelect);

  fileChooserDialog.select(toSelect);
  fileChooserDialog.clickOk();

  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ChooseGradleHomeDialogFixture.java

示例4: find

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public static IdeFrameFixture find(@NotNull final Robot robot, @NotNull final File projectPath, @Nullable final String projectName) {
  final GenericTypeMatcher<IdeFrameImpl> matcher = new GenericTypeMatcher<IdeFrameImpl>(IdeFrameImpl.class) {
    @Override
    protected boolean isMatching(@NotNull IdeFrameImpl frame) {
      Project project = frame.getProject();
      if (project != null && projectPath.getPath().equals(project.getBasePath())) {
        return projectName == null || projectName.equals(project.getName());
      }
      return false;
    }
  };

  pause(new Condition("IdeFrame " + quote(projectPath.getPath()) + " to show up") {
    @Override
    public boolean test() {
      Collection<IdeFrameImpl> frames = robot.finder().findAll(matcher);
      return !frames.isEmpty();
    }
  }, LONG_TIMEOUT);

  IdeFrameImpl ideFrame = robot.finder().find(matcher);
  return new IdeFrameFixture(robot, ideFrame, projectPath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IdeFrameFixture.java

示例5: removeDeviceByName

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public ChooseDeviceDefinitionStepFixture removeDeviceByName(@NotNull final String deviceName) {
  JTableFixture deviceListFixture = getTableFixture();

  deviceListFixture.cell(deviceName).click(RIGHT_BUTTON);

  JPopupMenu popupMenu = robot().findActivePopupMenu();
  assertNotNull(popupMenu);
  JPopupMenuFixture contextMenuFixture = new JPopupMenuFixture(robot(), popupMenu);
  contextMenuFixture.menuItem(new GenericTypeMatcher<JMenuItem>(JMenuItem.class) {
    @Override
    protected boolean isMatching(@NotNull JMenuItem component) {
      return "Delete".equals(component.getText());
    }
  }).click();

  MessagesFixture.findByTitle(robot(), target(), "Confirm Deletion").clickYes();
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ChooseDeviceDefinitionStepFixture.java

示例6: editAvdWithName

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
public AvdEditWizardFixture editAvdWithName(@NotNull String name) {
  final TableView tableView = robot().finder().findByType(target(), TableView.class, true);
  JTableFixture tableFixture = new JTableFixture(robot(), tableView);
  JTableCellFixture cell = tableFixture.cell(name);
  final TableCell actionCell = TableCell.row(cell.row()).column(7);

  JTableCellFixture actionCellFixture = tableFixture.cell(actionCell);

  execute(new GuiTask() {
    @Override
    protected void executeInEDT() throws Throwable {
      tableView.editCellAt(actionCell.row, actionCell.column);
    }
  });

  JPanel actionPanel = (JPanel)actionCellFixture.editor();
  HyperlinkLabel editButtonLabel = robot().finder().find(actionPanel, new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) {
    @Override
    protected boolean isMatching(@NotNull HyperlinkLabel component) {
      return "Edit this AVD".equals(component.getToolTipText());
    }
  });
  robot().click(editButtonLabel);
  return AvdEditWizardFixture.find(robot());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AvdManagerDialogFixture.java

示例7: deleteAvdByName

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
public void deleteAvdByName(String name) {
  TableView tableView = robot().finder().findByType(target(), TableView.class, true);
  JTableFixture tableFixture = new JTableFixture(robot(), tableView);

  JTableCellFixture cell = tableFixture.cell(name);
  cell.click(RIGHT_BUTTON);

  JPopupMenu contextMenu = robot().findActivePopupMenu();
  assertNotNull(contextMenu);
  JPopupMenuFixture contextMenuFixture = new JPopupMenuFixture(robot(), contextMenu);
  contextMenuFixture.menuItem(new GenericTypeMatcher<JMenuItem>(JMenuItem.class) {
    @Override
    protected boolean isMatching(@NotNull JMenuItem component) {
      return "Delete".equals(component.getText());
    }
  }).click();

  MessagesFixture.findByTitle(robot(), target(), "Confirm Deletion").clickYes();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AvdManagerDialogFixture.java

示例8: enterPackageName

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public ConfigureAndroidProjectStepFixture enterPackageName(@NotNull String text) {
  LabelWithEditLink link = robot().finder().findByType(target(), LabelWithEditLink.class);

  JBLabel editLabel = robot().finder().find(link, new GenericTypeMatcher<JBLabel>(JBLabel.class) {
    @Override
    protected boolean isMatching(@NotNull JBLabel label) {
      return "<html><a>Edit</a></html>".equals(label.getText());
    }
  });
  robot().click(editLabel);

  final JTextField textField = robot().finder().findByType(link, JTextField.class);
  pause(new Condition("'Package name' field is visible") {
    @Override
    public boolean test() {
      return textField.isShowing();
    }
  });
  replaceText(textField, text);

  // click "Done"
  robot().click(editLabel);
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ConfigureAndroidProjectStepFixture.java

示例9: waitUntilFound

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
/** Waits for a first component which passes the given matcher under the given root to become visible. */
@NotNull
public static <T extends Component> T waitUntilFound(@NotNull final Robot robot,
                                                     @Nullable final Container root,
                                                     @NotNull final GenericTypeMatcher<T> matcher) {
  final AtomicReference<T> reference = new AtomicReference<T>();
  pause(new Condition("Find component using " + matcher.toString()) {
    @Override
    public boolean test() {
      ComponentFinder finder = robot.finder();
      Collection<T> allFound = root != null ? finder.findAll(root, matcher) : finder.findAll(matcher);
      boolean found = allFound.size() == 1;
      if (found) {
        reference.set(getFirstItem(allFound));
      }
      else if (allFound.size() > 1) {
        // Only allow a single component to be found, otherwise you can get some really confusing
        // test failures; the matcher should pick a specific enough instance
        fail("Found more than one " + matcher.supportedType().getSimpleName() + " which matches the criteria: " + allFound);
      }
      return found;
    }
  }, SHORT_TIMEOUT);

  return reference.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GuiTests.java

示例10: getButtonMatcher

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
private static GenericTypeMatcher<JButton> getButtonMatcher(final String id)
{
    GenericTypeMatcher<JButton> buttonMatcher = new GenericTypeMatcher<JButton>(JButton.class){
        protected boolean isMatching(JButton jb)
        {
            return id.equals(jb.getText());
        }
    };
    return buttonMatcher;
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:11,代码来源:FestUtils.java

示例11: requireValidationError

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public ChooseGradleHomeDialogFixture requireValidationError(@NotNull final String errorText) {
  pause(new Condition(String.format("Find error message '%1$s'", errorText)) {
    @Override
    public boolean test() {
      ComponentFinder finder = robot().finder();
      Collection<JPanel> errorTextPanels = finder.findAll(target(), new GenericTypeMatcher<JPanel>(JPanel.class) {
        @Override
        protected boolean isMatching(@NotNull JPanel panel) {
          // ErrorText is a private inner class
          return panel.isShowing() && panel.getClass().getSimpleName().endsWith("ErrorText");
        }
      });
      if (errorTextPanels.size() != 1) {
        return false;
      }
      JPanel errorTextPanel = getFirstItem(errorTextPanels);
      assertNotNull(errorTextPanel);
      Collection<JLabel> labels = finder.findAll(errorTextPanel, new GenericTypeMatcher<JLabel>(JLabel.class) {
        @Override
        protected boolean isMatching(@NotNull JLabel label) {
          String text = label.getText();
          return text != null && text.contains(errorText);
        }
      });
      return labels.size() == 1;
    }
  }, SHORT_TIMEOUT);

  // The label with the error message above also has HTML formatting, which makes the check for error not 100% reliable.
  // To ensure that the shown error message is what we expect, we store the message as a client property in the dialog's
  // TextFieldWithBrowseButton component.
  TextFieldWithBrowseButton field = robot().finder().findByType(target(), TextFieldWithBrowseButton.class);
  Object actual = field.getClientProperty(VALIDATION_MESSAGE_CLIENT_PROPERTY);
  assertEquals("Error message", errorText, actual);

  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ChooseGradleHomeDialogFixture.java

示例12: findOpenProjectDialog

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public static FileChooserDialogFixture findOpenProjectDialog(@NotNull Robot robot) {
  return findDialog(robot, new GenericTypeMatcher<JDialog>(JDialog.class) {
    @Override
    protected boolean isMatching(@NotNull JDialog dialog) {
      return dialog.isShowing() && "Open File or Project".equals(dialog.getTitle());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileChooserDialogFixture.java

示例13: findImportProjectDialog

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public static FileChooserDialogFixture findImportProjectDialog(@NotNull Robot robot) {
  return findDialog(robot, new GenericTypeMatcher<JDialog>(JDialog.class) {
    @Override
    protected boolean isMatching(@NotNull JDialog dialog) {
      String title = dialog.getTitle();
      return dialog.isShowing() && title != null && title.startsWith("Select") && title.endsWith("Project to Import");
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FileChooserDialogFixture.java

示例14: performAction

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
public void performAction(@NotNull final String label) {
  HyperlinkLabel link = robot().finder().find(target(), new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) {
    @Override
    protected boolean isMatching(@NotNull HyperlinkLabel hyperlinkLabel) {
      // IntelliJ's HyperLinkLabel class does not expose the getText method (it is package private)
      return hyperlinkLabel.isShowing() &&
             label.equals(Reflection.method("getText").withReturnType(String.class).in(hyperlinkLabel).invoke());
    }
  });
  driver().click(link);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:EditorNotificationPanelFixture.java

示例15: getTableFixture

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
private JTableFixture getTableFixture() {
  final TableView deviceList = robot().finder().find(target(), new GenericTypeMatcher<TableView>(TableView.class) {
    @Override
    protected boolean isMatching(@NotNull TableView component) {
      return component.getRowCount() > 0 && component.getColumnCount() > 1; // There are two tables on this step, but the category table only has 1 column
    }
  });
  return new JTableFixture(robot(), deviceList);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ChooseDeviceDefinitionStepFixture.java


注:本文中的org.fest.swing.core.GenericTypeMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。