예제 #1
0
  public Processing(Box root) {
    super(null);

    Log.log("startup.processing", " processing plugin is starting up ");

    frame = new JFrame("Field/Processing");
    __applet =
        new FieldProcessingApplet(
            sizeX,
            sizeY,
            queue,
            this,
            s -> {
              if (getLastErrorOutput() != null) getLastErrorOutput().accept(new Pair<>(-1, s));
            });

    __applet.init();
    __applet.loop();
    frame.add(__applet, BorderLayout.CENTER);
    frame.setSize(sizeX, sizeY);
    frame.setVisible(true);
    frame.validate();

    applet = new FieldProcessingAppletDelgate(__applet);

    this.properties.put(P, applet);

    Log.log("startup.processing", " searching for boxes that need processing support ");

    Log.log("startup.processing", " processing plugin has finished starting up ");
  }
예제 #2
0
파일: OutputBox.java 프로젝트: EQ4/Field2
  public void inject2(Browser browser) {
    Log.log("glassbrowser.debug", () -> "inject 2 is happening");
    for (String s : playlist) {
      Log.log("glassbrowser.debug", () -> "executing :" + s);
      browser.executeJavaScript(findAndLoad(s, true));
    }
    //		 hide();

    browser.finishBooting();
  }
예제 #3
0
파일: OutputBox.java 프로젝트: EQ4/Field2
  protected Browser make(int w, int h, Box b) {
    Log.log("OutputBox.debug", () -> "initializing browser");

    Browser browser =
        (Browser)
            find(Templates.templateChild, both())
                .findFirst()
                .map(x -> x.apply(b, "html output"))
                .orElseGet(() -> new Browser());

    Rect f = b.properties.get(frame);

    float inset = 10;
    browser.properties.put(Box.frame, new Rect(f.x + f.w - inset, f.y + f.h - inset, w, h));
    browser.properties.put(Boxes.dontSave, true);
    b.connect(browser);
    browser.loaded();
    this.properties.put(Boxes.dontSave, true);

    browser.properties.put(Box.name, "outputbox");
    styles = findAndLoad(styleSheet, false);

    long[] t = {0};

    boot(browser);

    browser.pauseForBoot();

    TextEditorExecution ed = new TextEditorExecution(browser);
    ed.connect(browser);

    return browser;
  }
예제 #4
0
파일: Cursors.java 프로젝트: EQ4/Field2
  public static void arrowUp(Window window) {
    if (arrowUp == 0) arrowUp = loadResource("arrowUp.jpg");

    Log.log("cursors", () -> "setting to arrow");
    if (currentCursor != arrowUp)
      Glfw.glfwSetCursor(window.getGLFWWindowReference(), currentCursor = arrowUp);
  }
예제 #5
0
파일: OutputBox.java 프로젝트: EQ4/Field2
  private String findAndLoad(String f, boolean append) {

    String[] roots = {
      Main.app + "/fielded/internal/",
      Main.app + "/fielded/external/",
      Main.app + "/fieldcef/internal"
    };
    for (String s : roots) {
      if (new File(s + "/" + f).exists()) return readFile(s + "/" + f, append);
    }
    Log.log("glassbrowser.error", () -> "Couldnt' find file in playlist :" + f);
    return null;
  }
예제 #6
0
파일: OutputBox.java 프로젝트: EQ4/Field2
  public void boot(Browser browser) {
    Server s =
        this.find(ServerSupport.server, both())
            .findFirst()
            .orElseThrow(() -> new IllegalArgumentException(" Server not found "));

    String bootstrap =
        "<html class='outputbox' style='background:rgba(0,0,0,0.2);padding:8px;'><head><style>"
            + styles
            + "</style></head><body class='outputbox' style='background:rgba(0,0,0,0.02);'>"
            + postamble;
    String res = UUID.randomUUID().toString();
    s.setFixedResource("/" + res, bootstrap);
    browser.properties.put(Browser.url, "http://localhost:" + s.port + "/" + res);

    tick = 0;
    RunLoop.main
        .getLoop()
        .attach(
            x -> {
              tick++;
              if (browser.browser.getURL().equals("http://localhost:" + s.port + "/" + res)) {

                inject2(browser);
                //					    try {
                //						    Callbacks.call(browser, Callbacks.main, null);
                //					    }
                //					    catch(Throwable e)
                //					    {
                //						    e.printStackTrace();
                //					    };
                return false;
              }
              Log.log("glassBrowser.boot", () -> "WAITING url:" + browser.browser.getURL());
              Drawing.dirty(this);

              return tick < 100;
            });

    Drawing.dirty(this);
  }