32 import java.util.Vector;
33
34 import org.netbeans.jemmy.Action;
35 import org.netbeans.jemmy.ActionProducer;
36 import org.netbeans.jemmy.CharBindingMap;
37 import org.netbeans.jemmy.ClassReference;
38 import org.netbeans.jemmy.ComponentChooser;
39 import org.netbeans.jemmy.ComponentSearcher;
40 import org.netbeans.jemmy.JemmyException;
41 import org.netbeans.jemmy.JemmyProperties;
42 import org.netbeans.jemmy.Outputable;
43 import org.netbeans.jemmy.QueueTool;
44 import org.netbeans.jemmy.TestOut;
45 import org.netbeans.jemmy.TimeoutExpiredException;
46 import org.netbeans.jemmy.Timeoutable;
47 import org.netbeans.jemmy.Timeouts;
48 import org.netbeans.jemmy.Waitable;
49 import org.netbeans.jemmy.Waiter;
50 import org.netbeans.jemmy.util.DefaultVisualizer;
51 import org.netbeans.jemmy.util.MouseVisualizer;
52
53 /**
54 * Keeps all environment and low-level methods.
55 *
56 * @author Alexandre Iline (alexandre.iline@oracle.com)
57 */
58 public abstract class Operator
59 implements Timeoutable, Outputable {
60
61 /**
62 * Identifier for a "class" property.
63 *
64 * @see #getDump
65 */
66 public static final String CLASS_DPROP = "Class";
67
68 /**
69 * Identifier for a "toString" property.
70 *
71 * @see #getDump
286 */
287 public static void addOperatorPackage(String pkgName) {
288 operatorPkgs.add(pkgName);
289 }
290
291 /**
292 * Returns an operator containing default environment.
293 *
294 * @return an empty operator (not having any component source) having
295 * default environment.
296 */
297 public static Operator getEnvironmentOperator() {
298 return new NullOperator();
299 }
300
301 static {
302 //init visualizer depending on OS:
303 //Linux - new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false)
304 //solaris - new MouseVisualizer()
305 //others - new DefaultVisualizer()
306 String os = System.getProperty("os.name").toUpperCase();
307 if (os.startsWith("LINUX")) {
308 setDefaultComponentVisualizer(new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false));
309 } else if (os.startsWith("SUNOS")) {
310 setDefaultComponentVisualizer(new MouseVisualizer());
311 } else {
312 setDefaultComponentVisualizer(new DefaultVisualizer());
313 }
314 operatorPkgs = new Vector<>();
315 setDefaultStringComparator(new DefaultStringComparator(false, false));
316 setDefaultPathParser(new DefaultPathParser("|"));
317 addOperatorPackage("org.netbeans.jemmy.operators");
318 setDefaultVerification(true);
319 }
320
321 /**
322 * Returns object operator is used for.
323 *
324 * @return an instance of java.awt.Component subclass which this operator
325 * was created for.
326 */
327 public abstract Component getSource();
328
329 ////////////////////////////////////////////////////////
|
32 import java.util.Vector;
33
34 import org.netbeans.jemmy.Action;
35 import org.netbeans.jemmy.ActionProducer;
36 import org.netbeans.jemmy.CharBindingMap;
37 import org.netbeans.jemmy.ClassReference;
38 import org.netbeans.jemmy.ComponentChooser;
39 import org.netbeans.jemmy.ComponentSearcher;
40 import org.netbeans.jemmy.JemmyException;
41 import org.netbeans.jemmy.JemmyProperties;
42 import org.netbeans.jemmy.Outputable;
43 import org.netbeans.jemmy.QueueTool;
44 import org.netbeans.jemmy.TestOut;
45 import org.netbeans.jemmy.TimeoutExpiredException;
46 import org.netbeans.jemmy.Timeoutable;
47 import org.netbeans.jemmy.Timeouts;
48 import org.netbeans.jemmy.Waitable;
49 import org.netbeans.jemmy.Waiter;
50 import org.netbeans.jemmy.util.DefaultVisualizer;
51 import org.netbeans.jemmy.util.MouseVisualizer;
52 import org.netbeans.jemmy.util.Platform;
53
54 /**
55 * Keeps all environment and low-level methods.
56 *
57 * @author Alexandre Iline (alexandre.iline@oracle.com)
58 */
59 public abstract class Operator
60 implements Timeoutable, Outputable {
61
62 /**
63 * Identifier for a "class" property.
64 *
65 * @see #getDump
66 */
67 public static final String CLASS_DPROP = "Class";
68
69 /**
70 * Identifier for a "toString" property.
71 *
72 * @see #getDump
287 */
288 public static void addOperatorPackage(String pkgName) {
289 operatorPkgs.add(pkgName);
290 }
291
292 /**
293 * Returns an operator containing default environment.
294 *
295 * @return an empty operator (not having any component source) having
296 * default environment.
297 */
298 public static Operator getEnvironmentOperator() {
299 return new NullOperator();
300 }
301
302 static {
303 //init visualizer depending on OS:
304 //Linux - new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false)
305 //solaris - new MouseVisualizer()
306 //others - new DefaultVisualizer()
307 if (Platform.isLinux()) {
308 setDefaultComponentVisualizer(new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false));
309 } else if (Platform.isSolaris()) {
310 setDefaultComponentVisualizer(new MouseVisualizer());
311 } else {
312 setDefaultComponentVisualizer(new DefaultVisualizer());
313 }
314 operatorPkgs = new Vector<>();
315 setDefaultStringComparator(new DefaultStringComparator(false, false));
316 setDefaultPathParser(new DefaultPathParser("|"));
317 addOperatorPackage("org.netbeans.jemmy.operators");
318 setDefaultVerification(true);
319 }
320
321 /**
322 * Returns object operator is used for.
323 *
324 * @return an instance of java.awt.Component subclass which this operator
325 * was created for.
326 */
327 public abstract Component getSource();
328
329 ////////////////////////////////////////////////////////
|