tools/Jemmy/JemmyFX/src/org/jemmy/fx/Lookups.java

Print this page




  43      * @param <T>
  44      * @param parent
  45      * @param id
  46      * @param type
  47      * @return
  48      */
  49     public static <T extends Node> Wrap<? extends T> byID(Parent<Node> parent, String id, Class<T> type) {
  50         return parent.lookup(type, new ByID<T>(id)).wrap(0);
  51     }
  52     /**
  53      * Takes <code>parent</code> as <code>Parent</code>. May throw an exception if not a parent.
  54      * @see #byID(org.jemmy.interfaces.Parent, java.lang.String, java.lang.Class)
  55      * @param <T>
  56      * @param parent
  57      * @param id
  58      * @param type
  59      * @return
  60      */
  61     @SuppressWarnings("unchecked")
  62     public static <T extends Node> Wrap<? extends T> byID(Wrap<?> parent, String id, Class<T> type) {
  63         return byID(parent.as(Parent.class, Node.class), id, type);
  64     }
  65     /**
  66      * Equivalent to <code>parent.lookup(type, new ByText<T>(text)).wrap(0)</code>
  67      * @param <T>
  68      * @param parent
  69      * @param text
  70      * @param type
  71      * @return
  72      */
  73     public static <T extends Node> Wrap<? extends T> byText(Parent<Node> parent, String text, Class<T> type) {
  74         return parent.lookup(type, new ByText<T>(text)).wrap(0);
  75     }
  76     /**
  77      * Takes <code>parent</code> as <code>Parent</code>. May throw an exception if not a parent.
  78      * @see #byID(org.jemmy.interfaces.Parent, java.lang.String, java.lang.Class)
  79      * @param <T>
  80      * @param parent
  81      * @param id
  82      * @param type
  83      * @return
  84      */
  85     @SuppressWarnings("unchecked")
  86     public static <T extends Node> Wrap<? extends T> byText(Wrap<?> parent, String id, Class<T> type) {
  87         return byText(parent.as(Parent.class, Node.class), id, type);
  88     }
  89     /**
  90      * Equivalent to <code>FXRoot.ROOT.lookup(new ByTitleSceneLookup<Scene>(title)).wrap(0).as(Parent.class, Node.class)</code>
  91      * @param title
  92      * @return
  93      */
  94     public static Wrap<? extends Scene> byTitle(String title) {
  95         return Root.ROOT.lookup(new ByTitleSceneLookup<Scene>(title)).wrap(0);
  96     }
  97 }


  43      * @param <T>
  44      * @param parent
  45      * @param id
  46      * @param type
  47      * @return
  48      */
  49     public static <T extends Node> Wrap<? extends T> byID(Parent<Node> parent, String id, Class<T> type) {
  50         return parent.lookup(type, new ByID<T>(id)).wrap(0);
  51     }
  52     /**
  53      * Takes <code>parent</code> as <code>Parent</code>. May throw an exception if not a parent.
  54      * @see #byID(org.jemmy.interfaces.Parent, java.lang.String, java.lang.Class)
  55      * @param <T>
  56      * @param parent
  57      * @param id
  58      * @param type
  59      * @return
  60      */
  61     @SuppressWarnings("unchecked")
  62     public static <T extends Node> Wrap<? extends T> byID(Wrap<?> parent, String id, Class<T> type) {
  63         return byID((Parent<Node>) parent.as(Parent.class, Node.class), id, type);
  64     }
  65     /**
  66      * Equivalent to <code>parent.lookup(type, new ByText<T>(text)).wrap(0)</code>
  67      * @param <T>
  68      * @param parent
  69      * @param text
  70      * @param type
  71      * @return
  72      */
  73     public static <T extends Node> Wrap<? extends T> byText(Parent<Node> parent, String text, Class<T> type) {
  74         return parent.lookup(type, new ByText<T>(text)).wrap(0);
  75     }
  76     /**
  77      * Takes <code>parent</code> as <code>Parent</code>. May throw an exception if not a parent.
  78      * @see #byID(org.jemmy.interfaces.Parent, java.lang.String, java.lang.Class)
  79      * @param <T>
  80      * @param parent
  81      * @param id
  82      * @param type
  83      * @return
  84      */
  85     @SuppressWarnings("unchecked")
  86     public static <T extends Node> Wrap<? extends T> byText(Wrap<?> parent, String id, Class<T> type) {
  87         return byText((Parent<Node>) parent.as(Parent.class, Node.class), id, type);
  88     }
  89     /**
  90      * Equivalent to <code>FXRoot.ROOT.lookup(new ByTitleSceneLookup<Scene>(title)).wrap(0).as(Parent.class, Node.class)</code>
  91      * @param title
  92      * @return
  93      */
  94     public static Wrap<? extends Scene> byTitle(String title) {
  95         return Root.ROOT.lookup(new ByTitleSceneLookup<Scene>(title)).wrap(0);
  96     }
  97 }