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

Print this page




  30 import java.util.LinkedList;
  31 import java.util.List;
  32 import javafx.scene.Scene;
  33 import javafx.stage.Window;
  34 import org.jemmy.action.GetAction;
  35 import org.jemmy.lookup.ControlList;
  36 
  37 
  38 /**
  39  * Gets the scenes.
  40  * @author shura
  41  */
  42 class SceneList implements ControlList {
  43 
  44     public List<?> getControls() {
  45         GetAction<List<?>> scenes = new GetAction<List<?>>() {
  46 
  47             @Override
  48             public void run(Object... parameters) {
  49                 LinkedList<Scene> res = new LinkedList<Scene>();
  50                 Iterator<Window> windows = Window.impl_getWindows();
  51                 while(windows.hasNext()) {
  52                     res.add(windows.next().getScene());
  53                 }
  54                 setResult(res);
  55             }
  56         };
  57         try {
  58             Root.ROOT.getEnvironment().getExecutor().execute(Root.ROOT.getEnvironment(), true, scenes);
  59             return scenes.getResult();
  60         } catch (Throwable th) {
  61             th.printStackTrace(System.err);
  62             return new ArrayList();
  63         }
  64     }
  65 }


  30 import java.util.LinkedList;
  31 import java.util.List;
  32 import javafx.scene.Scene;
  33 import javafx.stage.Window;
  34 import org.jemmy.action.GetAction;
  35 import org.jemmy.lookup.ControlList;
  36 
  37 
  38 /**
  39  * Gets the scenes.
  40  * @author shura
  41  */
  42 class SceneList implements ControlList {
  43 
  44     public List<?> getControls() {
  45         GetAction<List<?>> scenes = new GetAction<List<?>>() {
  46 
  47             @Override
  48             public void run(Object... parameters) {
  49                 LinkedList<Scene> res = new LinkedList<Scene>();
  50                 for (Window w : Window.getWindows()) {
  51                     res.add(w.getScene());

  52                 }
  53                 setResult(res);
  54             }
  55         };
  56         try {
  57             Root.ROOT.getEnvironment().getExecutor().execute(Root.ROOT.getEnvironment(), true, scenes);
  58             return scenes.getResult();
  59         } catch (Throwable th) {
  60             th.printStackTrace(System.err);
  61             return new ArrayList();
  62         }
  63     }
  64 }