• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GenericTypeMatcher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: find

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public static AvdManagerDialogFixture find(@NotNull Robot robot) {
  JFrame frame = waitUntilFound(robot, new GenericTypeMatcher<JFrame>(JFrame.class) {
    @Override
    protected boolean isMatching(@NotNull JFrame dialog) {
      return "Android Virtual Device Manager".equals(dialog.getTitle()) && dialog.isShowing();
    }
  });
  return new AvdManagerDialogFixture(robot, frame);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AvdManagerDialogFixture.java


示例17: showAdvancedSettings

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public ConfigureAvdOptionsStepFixture showAdvancedSettings() {
  try {
    JButton showAdvancedSettingsButton = robot().finder().find(new GenericTypeMatcher<JButton>(JButton.class) {
      @Override
      protected boolean isMatching(@NotNull JButton component) {
        return "Show Advanced Settings".equals(component.getText());
      }
    });
    robot().click(showAdvancedSettingsButton);
  } catch (ComponentLookupException e) {
    throw new RuntimeException("Show Advanced Settings called when advanced settings are already shown.", e);
  }
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ConfigureAvdOptionsStepFixture.java


示例18: hideAdvancedSettings

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public ConfigureAvdOptionsStepFixture hideAdvancedSettings() {
  try {
    JButton showAdvancedSettingsButton = robot().finder().find(new GenericTypeMatcher<JButton>(JButton.class) {
      @Override
      protected boolean isMatching(@NotNull JButton component) {
        return "Hide Advanced Settings".equals(component.getText());
      }
    });
    robot().click(showAdvancedSettingsButton);
  } catch (ComponentLookupException e) {
    throw new RuntimeException("Hide Advanced Settings called when advanced settings are already hidden.", e);
  }
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ConfigureAvdOptionsStepFixture.java


示例19: addAttachment

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
public LibraryPropertiesDialogFixture addAttachment(@NotNull File path) {
  final ActionButton addButton = robot().finder().find(target(), new GenericTypeMatcher<ActionButton>(ActionButton.class) {
    @Override
    protected boolean isMatching(@NotNull ActionButton button) {
      String toolTipText = button.getToolTipText();
      return button.isShowing() && isNotEmpty(toolTipText) && toolTipText.startsWith("Add");
    }
  });
  robot().moveMouse(addButton);
  //noinspection SSBasedInspection
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      addButton.click();
    }
  });

  VirtualFile attachment = findFileByIoFile(path, true);
  FileChooserDialogFixture fileChooser = FileChooserDialogFixture.findDialog(robot(), new GenericTypeMatcher<JDialog>(JDialog.class) {
    @Override
    protected boolean isMatching(@NotNull JDialog dialog) {
      String title = dialog.getTitle();
      return dialog.isShowing() && isNotEmpty(title) && title.startsWith("Attach Files or Directories to Library");
    }
  });
  assertNotNull("Failed to find VirtualFile with path " + quote(path.getPath()), attachment);
  fileChooser.select(attachment)
             .clickOk();
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:LibraryPropertiesDialogFixture.java


示例20: findStepWithTitle

import org.fest.swing.core.GenericTypeMatcher; //导入依赖的package包/类
@NotNull
protected JRootPane findStepWithTitle(@NotNull final String title) {
  JRootPane rootPane = target().getRootPane();
  waitUntilFound(robot(), rootPane, new GenericTypeMatcher<JLabel>(JLabel.class) {
    @Override
    protected boolean isMatching(@NotNull JLabel label) {
      return title.equals(label.getText());
    }
  });
  return rootPane;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AbstractWizardFixture.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AmazonGlacierClient类代码示例发布时间:2022-05-22
下一篇:
Java BlockMappingStartToken类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap