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


Java Waitable类代码示例

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


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

示例1: setCaret

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
public static void setCaret(EditorOperator eo, final int line) {
    eo.makeComponentVisible();
    eo.setCaretPositionToLine(line);
    new EventTool().waitNoEvent(100);

    try {
        new Waiter(new Waitable() {

            public Object actionProduced(Object editorOper) {
                EditorOperator op = (EditorOperator) editorOper;
                if (op.getLineNumber() == line) {
                    return Boolean.TRUE;
                }
                return null;
            }

            public String getDescription() {
                return "Wait caret position on line " + line;
            }
        }).waitAction(eo);
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:Utilities.java

示例2: waitStatusTextPrefix

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
public static void waitStatusTextPrefix(final String text) {
    try {
        new Waiter(new Waitable() {

            public Object actionProduced(Object anObject) {
                JemmyProperties.getProperties().getOutput().print(">>>>> status text: " + StatusDisplayer.getDefault().getStatusText() + " > " + anObject + "\n");
                if (StatusDisplayer.getDefault().getStatusText().startsWith(text)) {
                    return Boolean.TRUE;
                }
                return null;
            }

            public String getDescription() {
                return "Wait status text prefix: " + text;
            }
        }).waitAction(StatusDisplayer.getDefault());
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Utilities.java

示例3: waitBreakpoint

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/**
 * Waits for breakpoint at specified line in editor.
 *
 * @param line line with breakpoint
 * @param eo EditorOperator instance
 */
private static void waitBreakpoint(EditorOperator eo, final int line) throws Exception {
    new Waiter(new Waitable() {

        @Override
        public Object actionProduced(Object editorOper) {
            Object[] annotations = ((EditorOperator) editorOper).getAnnotations(line);
            for (int i = 0; i < annotations.length; i++) {
                if ("Breakpoint".equals(EditorOperator.getAnnotationType(annotations[i]))) { // NOI18N
                    return Boolean.TRUE;
                }
            }
            return null;
        }

        @Override
        public String getDescription() {
            return ("Wait breakpoint established on line " + line); // NOI18N
        }
    }).waitAction(eo);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:PerfIDEValidation.java

示例4: testWaiting

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Wait for something using Jemmy. If time to wait expires and condition
 * is not true, it throws JemmyException.
 */
public void testWaiting() throws Exception {
    final ProjectsTabOperator pto = new ProjectsTabOperator();
    new Waiter(new Waitable() {

        @Override
        public Object actionProduced(Object obj) {
            // it should be true in general
            return pto.isShowing() ? Boolean.TRUE : null;
        }

        @Override
        public String getDescription() {
            return ("Wait Projects tab is showing");
        }
    }).waitAction(null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:OperatorsTest.java

示例5: tearDown

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
@Override
public void tearDown() throws Exception {
    Waiter waiter = new Waiter(new Waitable() {

        @Override
        public Object actionProduced(Object obj) {
            Object clipboard2 = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
            return clipboard1 != clipboard2 ? Boolean.TRUE : null;
        }

        @Override
        public String getDescription() {
            return ("Wait clipboard contains data");
        }
    });
    waiter.waitAction(null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CopyActionTest.java

示例6: getPropertySheet

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Selects an option in the options tree, waits for property sheet
 * corresponding to selected node and returns instance of PropertySheetOperator.
 * @param optionPath Path to the option in left (tree-like) column.
 * @return PropertySheetOperator of selected option
 */
public PropertySheetOperator getPropertySheet(String optionPath) {
    selectOption(optionPath);
    // wait for property sheet corresponding with selected node
    final String nodeName = treeTable().tree().getSelectionPath().getLastPathComponent().toString();
    try {
        return (PropertySheetOperator)new Waiter(new Waitable() {
            public Object actionProduced(Object optionsOper) {
                PropertySheetOperator pso = new PropertySheetOperator((OptionsOperator)optionsOper);
                return pso.getDescriptionHeader().equals(nodeName) ? pso: null;
            }
            public String getDescription() {
                return("Wait Property sheet for \""+nodeName+"\" is showing.");
            }
        }
        ).waitAction(this);
    } catch (InterruptedException e) {
        throw new JemmyException("Interrupted.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:OptionsOperator.java

示例7: waitFinished

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/**
 * Waits until SaveAllAction is finished.
 */
private void waitFinished() {
    try {
        new Waiter(new Waitable() {
            @Override
            public Object actionProduced(Object systemAction) {
                return DataObject.getRegistry().getModifiedSet().isEmpty() ? Boolean.TRUE : null;
            }

            @Override
            public String getDescription() {
                return "SaveAllAction is finished";
            }
        }).waitAction(null);
    } catch (InterruptedException e) {
        throw new JemmyException("Waiting interrupted.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:SaveAllAction.java

示例8: waitProperty

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Waits for property with given name in specified property sheet.
 * @param propSheetOper PropertySheetOperator where to find property.
 * @param name property display name
 */
private Node.Property waitProperty(final PropertySheetOperator propSheetOper, final String name) {
    try {
        Waiter waiter = new Waiter(new Waitable() {
            public Object actionProduced(Object param) {
                Node.Property property = null;
                JTableOperator table = propSheetOper.tblSheet();
                for(int row=0;row<table.getRowCount();row++) {
                    if(table.getValueAt(row, 1) instanceof Node.Property) {
                        property = (Node.Property)table.getValueAt(row, 1);
                        if(propSheetOper.getComparator().equals(property.getDisplayName(), name)) {
                            return property;
                        }
                    }
                }
                return null;
            }
            public String getDescription() {
                return("Wait property "+name);
            }
        });
        return (Node.Property)waiter.waitAction(null);
    } catch (InterruptedException e) {
        throw new JemmyException("Interrupted.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:Property.java

示例9: waitPropertySheet

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Waits for property sheet anywhere in IDE. First it tries to find TopComponent
 * representing global properties and if not found, it tries to find 
 * property sheet in all dialogs owned by Main Window or other frames.
 * @param sheetName name of property sheet
 * @param index index of property sheet 
 */
private static JComponent waitPropertySheet(final String sheetName, final int index) {
    try {
        Waiter waiter = new Waiter(new Waitable() {
            public Object actionProduced(Object obj) {
                return findPropertySheet(sheetName, index);
            }
            public String getDescription() {
                return("Wait PropertySheet with name="+sheetName+
                       " index="+index+" 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) {
        throw new JemmyException("Interrupted.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:PropertySheetOperator.java

示例10: waitWidget

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/**
 * Waits for index-th widget specified by WidgetChooser under given parent
 * widget.
 *
 * @param parentWidget parent Widget
 * @param widgetChooser WidgetChooser implementation
 * @param index index to be found
 * @return Widget instance if found or throws JemmyException if not found.
 */
private static Widget waitWidget(final Widget parentWidget, final WidgetChooser widgetChooser, final int index) {
    try {
        Waiter waiter = new Waiter(new Waitable() {

            @Override
            public Object actionProduced(Object obj) {
                return findWidget(parentWidget, widgetChooser, index);
            }

            @Override
            public String getDescription() {
                return (index > 0 ? index + "-th " : "")
                        + (widgetChooser == null ? "Widget " : widgetChooser.getDescription())
                        + " displayed";
            }
        });
        Timeouts timeouts = JemmyProperties.getCurrentTimeouts().cloneThis();
        timeouts.setTimeout("Waiter.WaitingTime", timeouts.getTimeout("WidgetOperator.WaitWidgetTimeout"));
        waiter.setTimeouts(timeouts);
        waiter.setOutput(JemmyProperties.getCurrentOutput());
        return (Widget) waiter.waitAction(null);
    } catch (InterruptedException ex) {
        throw new JemmyException("Interrupted.", ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:WidgetOperator.java

示例11: getClipboardText

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Wait until clipboard contains string data and returns the text. */
private String getClipboardText() throws Exception {
    Waiter waiter = new Waiter(new Waitable() {

        @Override
        public Object actionProduced(Object obj) {
            Transferable contents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
            if (contents == null) {
                return null;
            } else {
                return contents.isDataFlavorSupported(DataFlavor.stringFlavor) ? Boolean.TRUE : null;
            }
        }

        @Override
        public String getDescription() {
            return ("Wait clipboard contains string data");
        }
    });
    waiter.waitAction(null);
    return Toolkit.getDefaultToolkit().getSystemClipboard().
            getContents(null).getTransferData(DataFlavor.stringFlavor).toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:OutputOperatorTest.java

示例12: getAnnotations

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
protected Object[] getAnnotations(EditorOperator eOp, int limit) {
    eOp.makeComponentVisible();
    try {
        final EditorOperator eo = new EditorOperator(eOp.getName());
        final int _limit = limit;
        new Waiter(new Waitable() {
            @Override
            public Object actionProduced(Object oper) {
                return eo.getAnnotations().length > _limit ? Boolean.TRUE : null;
            }

            @Override
            public String getDescription() {
                return ("Wait parser annotations."); // NOI18N
            }
        }).waitAction(null);
    } catch (InterruptedException ex) {
        Exceptions.printStackTrace(ex);
    }
    Object[] anns = eOp.getAnnotations();
    return anns;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:GeneralCSSPrep.java

示例13: waitProfilerStopped

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/**
 * Waits until profiler is not stopped.
 */
private void waitProfilerStopped() {
    try {
        new Waiter(new Waitable() {
            @Override
            public Object actionProduced(Object object) {
                final int state = Profiler.getDefault().getProfilingState();
                final int mode = Profiler.getDefault().getProfilingMode();
                if ((state == Profiler.PROFILING_PAUSED) || (state == Profiler.PROFILING_RUNNING)) {
                    if (mode == Profiler.MODE_PROFILE) {
                        return null;
                    }
                }
                return Boolean.TRUE;
            }

            @Override
            public String getDescription() {
                return ("Wait profiler stopped."); // NOI18N
            }
        }).waitAction(null);
    } catch (InterruptedException ex) {
        throw new JemmyException("Waiting for profiler stopped failed.", ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ProfilerValidationTest.java

示例14: selectCategory

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Selects given project category
 * @param category name of the category to select
 */
public void selectCategory(String category) {
    // we need to wait until some node is selected because 'please, wait' node
    // is shown before tree is initialized. Then we can change selection.
    try {
        new Waiter(new Waitable() {

            @Override
            public Object actionProduced(Object param) {
                return treeCategories().isSelectionEmpty() ? null : Boolean.TRUE;
            }

            @Override
            public String getDescription() {
                return ("Wait node is selected");
            }
        }).waitAction(null);
    } catch (InterruptedException e) {
        throw new JemmyException("Interrupted.", e);
    } catch (TimeoutExpiredException tee) {
        // ignore it because sometimes can happen that no category is selected by default
    }
    new Node(treeCategories(), category).select();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NewProjectWizardOperator.java

示例15: testClipboard

import org.netbeans.jemmy.Waitable; //导入依赖的package包/类
/** Test cut */
public static void testClipboard(final Object clipboard1) {        
    Waiter waiter = new Waiter(new Waitable() {
            public Object actionProduced(Object obj) {
                Object clipboard2 = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
                return clipboard1 != clipboard2 ? Boolean.TRUE : null;
            }
            public String getDescription() {
                return("Wait clipboard contains data"); // NOI18N
            }
    });
    try {
        waiter.waitAction(null);
    } catch (InterruptedException e) {
        throw new JemmyException("Waiting interrupted.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NodeUtils.java


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