本文整理汇总了Java中org.netbeans.jemmy.ComponentChooser类的典型用法代码示例。如果您正苦于以下问题:Java ComponentChooser类的具体用法?Java ComponentChooser怎么用?Java ComponentChooser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentChooser类属于org.netbeans.jemmy包,在下文中一共展示了ComponentChooser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: verifyPopup
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
public static boolean verifyPopup(final JPopupMenuOperator popup, String[] menus) {
for (int i = 0; i < menus.length; i++) {
try {
popup.showMenuItem(menus[i]);
} catch (NullPointerException npe) {
throw new JemmyException("Popup path [" + menus[i] + "] not found.");
}
}
//close popup and wait until is not visible
popup.waitState(new ComponentChooser() {
public boolean checkComponent(Component comp) {
popup.pushKey(KeyEvent.VK_ESCAPE);
return !popup.isVisible();
}
public String getDescription() {
return "Popup menu closed";
}
});
return true;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:Utilities.java
示例2: checkSubchooser
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/** If subchooser is null, return TopComponent.
* Else if c is instance of MultiViewCloneableTopComponent try to find
* and return sub component in MVCTC corresponding to sub chooser. Else
* check TC in sub chooser and return it if matches. MVCTC can host
* several views, e.g. source and design view in form editor or xml, servlets,
* overview views in web.xml editor. Then EditorOperator is able to find
* appropriate CloneableEditor in MVCTC.
* @param c TopComponent to check
* @param subchooser ComponentChooser to check if matches
* @return given TopComponent or appropriate sub component
*/
private static JComponent checkSubchooser(TopComponent c, ComponentChooser subchooser) {
if (subchooser == null) {
return c;
} else {
boolean isMultiView = false;
try {
//isMultiView = c instanceof MultiViewCloneableTopComponent;
isMultiView = isMultyView(c);
} catch (Throwable t) {
// ignore possible NoClassDefFoundError because org.netbeans.core.multiview module is not enabled in IDE
}
if (isMultiView) {
TopComponentOperator tco = new TopComponentOperator((JComponent) c);
// suppress output when finding sub component
tco.setOutput(TestOut.getNullOutput());
return (JComponent) tco.findSubComponent(subchooser);
} else {
if (subchooser.checkComponent(c)) {
return c;
}
}
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:TopComponentOperator.java
示例3: waitCaretPosition
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Wait for caret to be moved to certain position.
*
* @param position a position which caret supposed to be moved to.
*/
public void waitCaretPosition(final int position) {
getOutput().printLine("Wait caret to be at \"" + Integer.toString(position)
+ " position in component \n : "
+ toStringSource());
getOutput().printGolden("Wait caret to be at \"" + Integer.toString(position)
+ " position");
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return getCaretPosition() == position;
}
@Override
public String getDescription() {
return "Has caret at " + Integer.toString(position) + " position";
}
@Override
public String toString() {
return "JTextComponentOperator.waitCaretPosition.ComponentChooser{description = " + getDescription() + '}';
}
});
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:JTextComponentOperator.java
示例4: waitState
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Waits for the frame to have a specified state.
*
* @param state a state for the frame to have.
*/
public void waitState(final int state) {
getOutput().printLine("Wait frame to have "
+ Integer.toString(state)
+ " state \n : "
+ toStringSource());
getOutput().printGolden("Wait frame to have "
+ Integer.toString(state)
+ " state");
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return ((Frame) comp).getExtendedState() == state;
}
@Override
public String getDescription() {
return Integer.toString(state) + " state";
}
@Override
public String toString() {
return "FrameOperator.waitState.ComponentChooser{description = " + getDescription() + '}';
}
});
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:FrameOperator.java
示例5: waitItemSelected
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Waits for item to be selected.
*
* @param index Item index.
*/
public void waitItemSelected(final int index) {
getOutput().printLine("Wait " + Integer.toString(index)
+ "'th item to be selected in component \n : "
+ toStringSource());
getOutput().printGolden("Wait " + Integer.toString(index)
+ "'th item to be selected");
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return getSelectedIndex() == index;
}
@Override
public String getDescription() {
return "Has " + Integer.toString(index) + "'th item selected";
}
@Override
public String toString() {
return "JComboBoxOperator.waitItemSelected.ComponentChooser{description = " + getDescription() + '}';
}
});
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:JComboBoxOperator.java
示例6: pushMenu
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Pushes menu.
*
* @param choosers Array of choosers to find menuItems to push.
* @return Last pushed JMenuItem.
* @throws TimeoutExpiredException
*/
public JMenuItem pushMenu(final ComponentChooser[] choosers) {
makeComponentVisible();
return ((JMenuItem) produceTimeRestricted(new Action<Object, Void>() {
@Override
public Object launch(Void obj) {
//TDB 1.5 menu workaround
getQueueTool().waitEmpty();
Object result = driver.pushMenu(JMenuBarOperator.this,
JMenuOperator.converChoosers(choosers));
getQueueTool().waitEmpty();
return result;
}
@Override
public String getDescription() {
return JMenuOperator.createDescription(choosers);
}
@Override
public String toString() {
return "JMenuBarOperator.pushMenu.Action{description = " + getDescription() + '}';
}
}, "JMenuOperator.PushMenuTimeout"));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:JMenuBarOperator.java
示例7: findDivider
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Searches divider inside split pane.
*
* @return an operator for the divider.
*/
public BasicSplitPaneDivider findDivider() {
return ((BasicSplitPaneDivider) waitSubComponent(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return comp instanceof BasicSplitPaneDivider;
}
@Override
public String getDescription() {
return "";
}
@Override
public String toString() {
return "JSplitPaneOperator.findDivider.ComponentChooser{description = " + getDescription() + '}';
}
}));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:JSplitPaneOperator.java
示例8: waitComponentSize
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Wait till the Size of the component becomes between minSize and maxSize.
*
* @param minSize the minimum allowed size.
* @param maxSize the maximum allowed size.
*/
public void waitComponentSize(Dimension minSize, Dimension maxSize) {
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
Dimension componentSize = comp.getSize();
return componentSize.height >= minSize.height
&& componentSize.height <= maxSize.height
&& componentSize.width >= minSize.width
&& componentSize.width <= maxSize.width;
}
@Override
public String getDescription() {
return "Component Size becomes between: " + minSize
+ "and " + maxSize;
}
@Override
public String toString() {
return "ComponentOperator.waitComponentSize"
+ ".Waitable{description = " + getDescription() + '}';
}
});
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:ComponentOperator.java
示例9: outputPaneOperator
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/** Returns operator for OutputPane component.
* All events should be dispatched to this component.
* @return operator for OutputPane component
*/
public ComponentOperator outputPaneOperator() {
// first make component visible because tab must be visible to dispatch events
makeComponentVisible();
if (outputPaneOperator == null) {
outputPaneOperator = ComponentOperator.createOperator(outputPaneForTab(getSource()));
outputPaneOperator.copyEnvironment(this);
// #217765 - wait for lazy loaded actions
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
try {
Field actionsLoadedField = getSource().getClass().getDeclaredField("actionsLoaded");
actionsLoadedField.setAccessible(true);
return actionsLoadedField.getBoolean(getSource());
} catch (Exception ex) {
throw new JemmyException("Reflection failed: " + ex, ex);
}
}
@Override
public String getDescription() {
return "Output tab actions loaded";
}
});
}
return outputPaneOperator;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:OutputTabOperator.java
示例10: tree
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/** Returns operator for a tree which is showed as a part of
* the table.
* @return JTreeOperator instance
*/
public JTreeOperator tree() {
if(_tree == null) {
// Need to wait until TreeTable is populated. Otherwise it can throw
// NPE from getValueAt(0, 0).
waitState(new ComponentChooser() {
public boolean checkComponent(Component comp) {
return getColumnCount() > 0 && getRowCount() > 0;
}
public String getDescription() {
return "TreeTable contains any rows.";
}
});
// cell renderer component for first column is JTree
Object value = getValueAt(0, 0);
JTree jTree = (JTree)getCellRenderer(0, 0).getTableCellRendererComponent((JTable)this.getSource(), value, false, false, 0, 0);
// Need to set EmptyVisualizer because found JTree doesn't have any parent Container
// and calling makeComponentVisible() throws NPE
// _tree = new JTreeOperator(jTree);
_tree = new RenderedTreeOperator(this, jTree);
_tree.setVisualizer(new EmptyVisualizer());
}
// Everytime make parent container visible because tree has EmptyVisualizer
// and it is need for example for popup menu operations on JTree
makeComponentVisible();
return _tree;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:TreeTableOperator.java
示例11: waitTopComponent
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/** Waits for index-th TopComponent with given name in IDE registry.
* It throws JemmyException when TopComponent is not find until timeout
* expires.
* @param cont container where to search
* @param name name of TopComponent
* @param index index of TopComponent
* @param subchooser ComponentChooser to determine exact TopComponent
* @return TopComponent instance or throws JemmyException if not found
* @see #findTopComponent
*/
protected static JComponent waitTopComponent(final ContainerOperator cont, final String name, final int index, final ComponentChooser subchooser) {
try {
Waiter waiter = new Waiter(new Waitable() {
@Override
public Object actionProduced(Object obj) {
return findTopComponent(cont, name, index, subchooser);
}
@Override
public String getDescription() {
return ("Wait TopComponent with name=" + name
+ " index=" + String.valueOf(index)
+ (subchooser == null ? "" : " subchooser=" + subchooser.getDescription())
+ " loaded");
}
});
Timeouts times = JemmyProperties.getCurrentTimeouts().cloneThis();
times.setTimeout("Waiter.WaitingTime", times.getTimeout("ComponentOperator.WaitComponentTimeout"));
waiter.setTimeouts(times);
waiter.setOutput(JemmyProperties.getCurrentOutput());
return ((JComponent) waiter.waitAction(null));
} catch (InterruptedException e) {
return (null);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:TopComponentOperator.java
示例12: showMenuItems
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
public JMenuItemOperator[] showMenuItems(ComponentChooser[] choosers) {
if (choosers == null || choosers.length == 0) {
return JMenuItemOperator.getMenuItems((MenuElement) getSource(), this);
} else {
return JMenuItemOperator.getMenuItems((JMenu) pushMenu(choosers), this);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:JMenuBarOperator.java
示例13: pushMenuNoBlock
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Executes {@code pushMenu(choosers)} in a separate thread.
*
* @param choosers Array of choosers to find menuItems to push.
* @see #pushMenu(ComponentChooser[])
*/
public void pushMenuNoBlock(final ComponentChooser[] choosers) {
produceNoBlocking(new NoBlockingAction<Object, Void>("Menu pushing") {
@Override
public Object doAction(Void param) {
//TDB 1.5 menu workaround
getQueueTool().waitEmpty();
Object result = driver.pushMenu(JMenuOperator.this, converChoosers(choosers));
getQueueTool().waitEmpty();
return result;
}
});
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:JMenuOperator.java
示例14: waitText
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Wait for text to be displayed starting from certain position.
*
* @param text text to wait.
* @param position starting text position.
*/
public void waitText(final String text, final int position) {
getOutput().printLine("Wait \"" + text + "\" text starting from "
+ Integer.toString(position) + " position in component \n : "
+ toStringSource());
getOutput().printGolden("Wait \"" + text + "\" text starting from "
+ Integer.toString(position) + " position");
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
String alltext = getDisplayedText();
if (position >= 0) {
if (position + text.length() <= alltext.length()) {
return (alltext.substring(position, position + text.length()).
equals(text));
} else {
return false;
}
} else {
return alltext.indexOf(text) >= 0;
}
}
@Override
public String getDescription() {
return ("Has \"" + text + "\" text starting from "
+ Integer.toString(position) + " position");
}
@Override
public String toString() {
return "JTextComponentOperator.waitText.ComponentChooser{description = " + getDescription() + '}';
}
});
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:JTextComponentOperator.java
示例15: callPopup
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Calls popup by clicking on (x, y) point in component.
*
* @param oper Component operator to call popup on.
* @param x X coordinate of click point in the component coordinate system.
* @param y Y coordinate of click point in the component coordinate system.
* @param mouseButton Mouse button mask to call popup.
* @return an opened JPopupMenu
* @throws TimeoutExpiredException
*/
public static JPopupMenu callPopup(final ComponentOperator oper, int x, int y, int mouseButton) {
oper.makeComponentVisible();
//1.5 workaround
if (System.getProperty("java.specification.version").compareTo("1.4") > 0) {
QueueTool qt = new QueueTool();
qt.setOutput(oper.getOutput().createErrorOutput());
qt.waitEmpty(10);
qt.waitEmpty(10);
qt.waitEmpty(10);
}
//end of 1.5 workaround
oper.clickForPopup(x, y, mouseButton);
oper.getTimeouts().sleep("JMenuOperator.WaitBeforePopupTimeout");
return (waitJPopupMenu(waitJPopupWindow(new ComponentChooser() {
@Override
public boolean checkComponent(Component cmp) {
Component invoker = ((JPopupMenu) cmp).getInvoker();
return (invoker == oper.getSource()
|| (invoker instanceof Container
&& ((Container) invoker).isAncestorOf(oper.getSource()))
|| (oper.getSource() instanceof Container
&& ((Container) oper.getSource()).isAncestorOf(invoker)));
}
@Override
public String getDescription() {
return "Popup menu";
}
@Override
public String toString() {
return "JPopupMenuOperator.callPopup.ComponentChooser{description = " + getDescription() + '}';
}
}),
ComponentSearcher.getTrueChooser("Popup menu")));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:47,代码来源:JPopupMenuOperator.java
示例16: waitDialog
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* A method to be used from subclasses. Uses timeouts and output passed as
* parameters during the waiting.
*
* @param chooser org.netbeans.jemmy.ComponentChooser implementation.
* @param index Ordinal component index.
* @param timeouts timeouts to be used during the waiting.
* @param output an output to be used during the waiting.
* @return Component instance or null if component was not found.
*/
protected static Dialog waitDialog(ComponentChooser chooser, int index,
Timeouts timeouts, TestOut output) {
try {
DialogWaiter waiter = new DialogWaiter();
waiter.setTimeouts(timeouts);
waiter.setOutput(output);
return waiter.waitDialog(new DialogFinder(chooser), index);
} catch (InterruptedException e) {
output.printStackTrace(e);
return null;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:DialogOperator.java
示例17: waitWindow
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* A method to be used from subclasses. Uses timeouts and output passed as
* parameters during the waiting.
*
* @param chooser org.netbeans.jemmy.ComponentChooser implementation.
* @param index Ordinal component index.
* @param timeouts timeouts to be used during the waiting.
* @param output an output to be used during the waiting.
* @return Component instance or null if component was not found.
*/
protected static Window waitWindow(ComponentChooser chooser, int index,
Timeouts timeouts, TestOut output) {
try {
WindowWaiter waiter = new WindowWaiter();
waiter.setTimeouts(timeouts);
waiter.setOutput(output);
return waiter.waitWindow(chooser, index);
} catch (InterruptedException e) {
output.printStackTrace(e);
return null;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:WindowOperator.java
示例18: getWindow
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
/**
* Searches the window under component.
*
* @return the component window.
*/
public Window getWindow() {
if (getSource() instanceof Window) {
return (Window) getSource();
}
Window window = (Window) getContainer(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return comp instanceof Window;
}
@Override
public String getDescription() {
return "";
}
@Override
public String toString() {
return "ComponentOperator.getWindow.ComponentChooser{description = " + getDescription() + '}';
}
});
if (window == null && getSource() instanceof Window) {
return (Window) getSource();
} else {
return window;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:ComponentOperator.java
示例19: JToolTipFinder
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
public JToolTipFinder(ComponentChooser sf) {
super(JToolTip.class, sf);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:JComponentOperator.java
示例20: OutlineViewFinder
import org.netbeans.jemmy.ComponentChooser; //导入依赖的package包/类
public OutlineViewFinder(ComponentChooser sf) {
subFinder = sf;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:OutlineViewOperator.java
注:本文中的org.netbeans.jemmy.ComponentChooser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论