Package netscape.javascript

Examples of netscape.javascript.JSObject


   * @param eventType
   *          the type of event (click, blur, mouseOver...)
   */
  public void addEvent( String idTarget, String method, String eventType )
  {
    JSObject obj = JSObject.getWindow( XApplet.getApplet() );
    eventType = eventType.toLowerCase();
    String upper = eventType.substring( 0, 1 ).toUpperCase();
    String event = upper + eventType.substring( 1 );
    obj.eval( "add" + event + "Event( \"" + idTarget + "\", \"" + method + "\" )" );
  }
View Full Code Here


      }
     
    @Override
    public void start(){
      logger.fine("Version " + VERSION);
      JSObject window = JSObject.getWindow(this);
          JSObject doc = (JSObject) window.getMember("location");
          String host_port = (String) doc.getMember("host");
          String[] h_p = host_port.split(":");
          host = h_p[0];
          if(host.equals("localhost") || host.endsWith("zaranux.com"))
            authorized = true;
          port = h_p.length >1 ? Integer.parseInt(h_p[1]) : 80;
View Full Code Here

                }
                   
                      try
                      {
                      final String jsCommand = "window['SUCCESS_CALLBACK']('" + callbackID + "' , '" + URLEncoder.encode(output.toString(),"UTF-8") + "')";
                        final JSObject win = JSObject.getWindow(Zaranuxlet.this);
                          win.eval(jsCommand);
                      }catch(JSException e)
                      {
                        logger.severe("callbackOnSuccess(): Unable to do window.eval : " + e.getMessage());
                      }
                      catch(UnsupportedEncodingException e)
View Full Code Here

        previewEngine = previewView.getEngine();
        previewEngine.load(String.format("http://localhost:%d/index.html", tomcatPort));

        previewEngine.getLoadWorker().stateProperty().addListener((observableValue1, state, state2) -> {
            if (state2 == Worker.State.SUCCEEDED) {
                JSObject window = (JSObject) previewEngine.executeScript("window");
                window.setMember("app", this);
            }
        });

        previewEngine.getLoadWorker().exceptionProperty().addListener((ov, t, t1) -> {
            t1.printStackTrace();
View Full Code Here

        WebView webView = new WebView();


        WebEngine webEngine = webView.getEngine();
        JSObject window = (JSObject) webEngine.executeScript("window");
        window.setMember("app", this);
        webEngine.load(String.format("http://localhost:%d/editor.html", tomcatPort));

        return webView;
    }
View Full Code Here

        return this;
    }

    protected void embedJQuery(int eventId) {
        JSObject jsWindow = (JSObject) webEngine.executeScript("window");

        jsWindow.setMember("simpleBrowser", SimpleBrowser.this);

        String script = "" +
            "if(typeof jQuery == 'undefined'){" +
            "script = document.createElement('script');\n" +
            "\n" +
View Full Code Here

    else if (f.type == 0 || f.type > 4)
      new ErrorWindow(text("edit_enormal"));
    else if (is_html_filename(f.path) && !force_text) {
      // Open HTML editor
      try {
        JSObject win = JSObject.getWindow(this);
        String params[] = { f.path, "" };
        win.call("htmledit", params);
        }
      catch(Exception e) {
        new ErrorWindow(text("html_efailed",
                 e.getMessage()));
        }
      }
    else {
      // Open text editor
      new EditorWindow(f, this);
      }
    }
  else if (b == down_b) {
    // Force download of the selected file
    if (f == null) return;
    download_file(f);
    }
  else if (b == preview_b) {
    // Open preview window for selected file
    if (f == null) return;
    if (f.type == RemoteFile.DIR)
      new ErrorWindow(text("preview_eimage"));
    else
      new PreviewWindow(this, f);
    }
  else if (b == refresh_b) {
    // Refesh the selected directory (and thus any subdirs)
    if (d == null) return;
    d.refresh();
    show_files(d.file);
    }
  else if (b == props_b) {
    // Display the properties window
    if (f == null) return;
    new PropertiesWindow(f, this);
    }
  else if (b == acl_b) {
    // Display the ACL window (if filesystem supports them)
    if (f == null) return;
    FileSystem filefs = find_filesys(f);
    if (filefs == null) return;
    if (filefs.acls)
      new ACLWindow(this, f);
    else
      new ErrorWindow(text("eacl_efs", filefs.mount));
    }
  else if (b == attr_b) {
    // Display the attributes window (if filesystem supports them)
    if (f == null) return;
    FileSystem filefs = find_filesys(f);
    if (filefs == null) return;
    if (filefs.attrs)
      new AttributesWindow(this, f);
    else
      new ErrorWindow(text("attr_efs", filefs.mount));
    }
  else if (b == ext_b) {
    // Display EXT attributes window (if filesystem supports them)
    if (f == null) return;
    FileSystem filefs = find_filesys(f);
    if (filefs == null) return;
    if (filefs.ext)
      new EXTWindow(this, f);
    else
      new ErrorWindow(text("ext_efs", filefs.mount));
    }
  else if (b == copy_b) {
    // Copy the selected files
    if (f == null) return;
    cut_buffer = ff;
    cut_mode = false;
    }
  else if (b == cut_b) {
    // Cut the selected file
    if (f == null) return;
    cut_buffer = ff;
    cut_mode = true;
    }
  else if (b == paste_b) {
    // Paste the copied file
    if (cut_buffer == null) {
      new ErrorWindow(text("paste_ecopy"));
      return;
      }

    // Check for existing file clashes
    // XXX

    // Go through all the files to paste
    for(int i=0; i<cut_buffer.length; i++) {
      RemoteFile cf = cut_buffer[i];

      // Check for an existing file
      RemoteFile already = showing_files.find(cf.name);
      String sp = showing_files.path;
      String dest_path = sp.equals("/") ? sp+cf.name
                : sp+"/"+cf.name;
      if (already != null) {
        // File exists .. offer to rename
        new OverwriteWindow(this, already, cf, i);
        }
      else {
        // do the move or copy
        RemoteFile nf = paste_file(cf, showing_files,
               dest_path, null, cut_mode);
        if (cut_mode && nf != null) {
          // Paste from the destination path
          // from now on
          cut_buffer[i] = nf;
          }
        }
      }
    cut_mode = false;
    }
  else if (b == delete_b) {
    // Delete the selected files
    if (f == null) return;
    new DeleteWindow(this, ff);
    }
  else if (b == new_b) {
    // Open a window for creating a text file
    new EditorWindow(showing_files.path, this);
    }
  else if (b == hnew_b) {
    // Open a window for creating an HTML file
    try {
      JSObject win = JSObject.getWindow(this);
      String params[] = { "", showing_files.path };
      win.call("htmledit", params);
      }
    catch(Exception e) {
      new ErrorWindow(text("html_efailed",
               e.getMessage()));
      }
    }
  else if (b == upload_b) {
    // Call javascript to open an upload window
    try {
      JSObject win = JSObject.getWindow(this);
      String params[] = { showing_files.path };
      win.call("upload", params);
      }
    catch(Exception e) {
      new ErrorWindow(text("upload_efailed", e.getMessage()));
      }
    }
View Full Code Here

        if (applicationHostApplet == null) {
            throw new IllegalArgumentException("No applet is hosting the given application.");
        }

        try {
            JSObject window = JSObject.getWindow(applicationHostApplet);
            return window.eval(script);
        } catch (Throwable throwable) {
            throw new UnsupportedOperationException(throwable);
        }
    }
View Full Code Here

            @Override
            public void changed(ObservableValue<? extends Worker.State> ov, Worker.State t, Worker.State t1) {
                System.out.println("[JAVA INIT] setting...");
                if (t1 == Worker.State.SUCCEEDED) {
                    // get the window object is a global variable in JS
                    JSObject window = (JSObject) webEngine.executeScript("window");

                    // bind our Java objects as fields in the window object
                    // in JS this would look like
                    // window.foo = new Foo()
                    window.setMember("fooWhichIsOK", new FooWhichIsOk());
                    window.setMember("foo", new Foo());
                }
            }
        });
    }
View Full Code Here

                    @Override
                    public void changed(ObservableValue<? extends Worker.State> ov, Worker.State t, Worker.State t1) {
                        logger.debug("[JAVA INIT] setting...");

                        if (t1 == Worker.State.SUCCEEDED) {
                            JSObject window = (JSObject) webEngine.executeScript("window");

                            window.setMember("bearFX", bearFX);
                            window.setMember("Bindings", bindings);

                            logger.info("creating fx appender...");

                            configureFxAppenders();
View Full Code Here

TOP

Related Classes of netscape.javascript.JSObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.