< prev index next >

src/org/netbeans/jemmy/operators/JComponentOperator.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation. Oracle designates this

@@ -45,11 +45,10 @@
 import javax.swing.border.Border;
 import javax.swing.event.AncestorListener;
 
 import org.netbeans.jemmy.ComponentChooser;
 import org.netbeans.jemmy.ComponentSearcher;
-import org.netbeans.jemmy.JemmyProperties;
 import org.netbeans.jemmy.Outputable;
 import org.netbeans.jemmy.TestOut;
 import org.netbeans.jemmy.TimeoutExpiredException;
 import org.netbeans.jemmy.Timeoutable;
 import org.netbeans.jemmy.Timeouts;

@@ -305,19 +304,11 @@
                 getCenterYForClick());
         return waitToolTip();
     }
 
     public JToolTip waitToolTip() {
-        return ((JToolTip) waitComponent(WindowOperator.
-                waitWindow(new JToolTipWindowFinder(),
-                        0,
-                        getTimeouts(),
-                        getOutput()),
-                new JToolTipFinder(),
-                0,
-                getTimeouts(),
-                getOutput()));
+        return JToolTipOperator.waitJToolTip(this);
     }
 
     /**
      * Looks for a first window-like container.
      *

@@ -1226,63 +1217,6 @@
         public JComponentFinder() {
             super(JComponent.class);
         }
     }
 
-    static class JToolTipWindowFinder implements ComponentChooser {
-
-        ComponentChooser ppFinder;
-
-        public JToolTipWindowFinder() {
-            ppFinder = new ComponentChooser() {
-                @Override
-                public boolean checkComponent(Component comp) {
-                    return (comp.isShowing()
-                            && comp.isVisible()
-                            && comp instanceof JToolTip);
-                }
-
-                @Override
-                public String getDescription() {
-                    return "A tool tip";
-                }
-
-                @Override
-                public String toString() {
-                    return "JComponentOperator.JToolTipWindowFinder.ComponentChooser{description = " + getDescription() + '}';
-                }
-            };
-        }
-
-        @Override
-        public boolean checkComponent(Component comp) {
-            if (comp.isShowing() && comp instanceof Window) {
-                ComponentSearcher cs = new ComponentSearcher((Container) comp);
-                cs.setOutput(JemmyProperties.getCurrentOutput().createErrorOutput());
-                return (cs.findComponent(ppFinder)
-                        != null);
-            }
-            return false;
-        }
-
-        @Override
-        public String getDescription() {
-            return "A tool tip window";
-        }
-
-        @Override
-        public String toString() {
-            return "JToolTipWindowFinder{" + "ppFinder=" + ppFinder + '}';
-        }
-    }
-
-    class JToolTipFinder extends Finder {
-
-        public JToolTipFinder(ComponentChooser sf) {
-            super(JToolTip.class, sf);
-        }
-
-        public JToolTipFinder() {
-            super(JToolTip.class);
-        }
-    }
 }
< prev index next >