当前位置: 首页>>代码示例>>Java>>正文


Java JSObject类代码示例

本文整理汇总了Java中netscape.javascript.JSObject的典型用法代码示例。如果您正苦于以下问题:Java JSObject类的具体用法?Java JSObject怎么用?Java JSObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JSObject类属于netscape.javascript包,在下文中一共展示了JSObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadResults

import netscape.javascript.JSObject; //导入依赖的package包/类
public void loadResults() {
    try {
        JSObject windowObj = (JSObject)webEngine.executeScript("window");
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writeValueAsString(testResult);
        windowObj.setMember("result", json);
        try {
            webEngine.executeScript("refreshResult()");
        } catch (JSException js) {
            Logger.error(js, "error updating result");
        }

    } catch (JsonProcessingException e) {
        return;
    }
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:17,代码来源:ViewResultsPanel.java

示例2: testGetSlotNoSuchSlot2

import netscape.javascript.JSObject; //导入依赖的package包/类
/**
 * Test for JSObject.getSlot call with an absent slot as parameter.
 */
@Test(timeout=10000)
public void testGetSlotNoSuchSlot2(){
    Platform.runLater(new Runnable() {
        public void run() {
            initWebEngine();
            JSObject arrO = getArray(engine);
            resultObject = arrO.getSlot(1000);
            System.out.println(resultObject);
        }
    });
    doWait(new Tester() {
        public boolean isPassed() {
            return (resultObject != null);
        }
    });
    Assert.assertEquals(UNDEFINED, resultObject);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:BridgeGetSlotTest.java

示例3: showHisoty

import netscape.javascript.JSObject; //导入依赖的package包/类
private void showHisoty() {
	debug = new HistorySearch(cmboHistoryMonth.getValue(), cmboFilterList.getValue());

	webEngine.getLoadWorker().stateProperty().addListener(
       	    new ChangeListener<Worker.State>() {
       	        @Override
       	        public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
       	            if (newValue == Worker.State.SUCCEEDED) {
       	                JSObject windowObject = (JSObject) webEngine.executeScript("window");
       	                windowObject.setMember("HistorySearch", debug); // insert object
       	                windowObject.call("ready"); // execute callback
       	            }
       	        }
       	    }
       	);
       URL url = getClass().getResource("/html/index.html");
       webEngine.load(url.toString());
}
 
开发者ID:krHasan,项目名称:Money-Manager,代码行数:19,代码来源:TransactionHistoryController.java

示例4: btnGo

import netscape.javascript.JSObject; //导入依赖的package包/类
@FXML
	private void btnGo(ActionEvent event) {
		historyByDate = new HistorySearchByDate(datePicker.getValue());
		
		webEngine.getLoadWorker().stateProperty().addListener(
        	    new ChangeListener<Worker.State>() {
        	        @Override
        	        public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
        	            if (newValue == Worker.State.SUCCEEDED) {
        	                JSObject windowObject = (JSObject) webEngine.executeScript("window");
        	                windowObject.setMember("HistorySearchByDate", historyByDate); // insert object
        	                windowObject.call("searchHistoryByDate"); // execute callback
        	            }
        	        }
        	    }
        	);
		URL url = getClass().getResource("/html/index.html");
        webEngine.load(url.toString());
		
//        String url = getClass().getResource("../html/index.html").toExternalForm();
//        webEngine.load(url);
	}
 
开发者ID:krHasan,项目名称:Money-Manager,代码行数:23,代码来源:TransactionHistoryController.java

示例5: initComponent

import netscape.javascript.JSObject; //导入依赖的package包/类
private void initComponent() {
    webView = new WebView();
    String externalForm = ACEEditor.class.getResource("/Ace.html").toExternalForm();
    WebEngine engine = webView.getEngine();
    engine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
        @Override public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {
            if (newValue != State.SUCCEEDED) {
                return;
            }
            JSObject window = (JSObject) engine.executeScript("window");
            window.setMember("java", ACEEditor.this);
            engine.executeScript("console.log = function(message)\n" + "{\n" + "    java.log(message);\n" + "};");
            ACEEditor.this.engine = engine;
            setOptions(new JSONObject().put("showLineNumbers", showLinenumbers).put("firstLineNumber", startLineNumber)
                    .put("overwrite", false));
            loadPreferences();
            hookKeyBindings();
        }
    });
    engine.load(externalForm);
    ToolBarContainer container = ToolBarContainer.createDefaultContainer(Orientation.RIGHT);
    if (withToolbar) {
        ToolBarPanel toolBarPanel = container.getToolBarPanel();
        createToolBars(toolBarPanel);
    }
    container.setContent(webView);
    this.node = container;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:ACEEditor.java

示例6: getMaxZoomAtLatLng

import netscape.javascript.JSObject; //导入依赖的package包/类
public void getMaxZoomAtLatLng(LatLong loc, MaxZoomServiceCallback callback) {
        
        this.callback = callback;
        
        JSObject doc = (JSObject) getJSObject().eval("document");
        doc.setMember(getVariableName(), this);
        
        StringBuilder r = new StringBuilder(getVariableName())
              .append(".")
              .append("getMaxZoomAtLatLng(")
              .append(loc.getVariableName())
              .append(", ")
              .append("function(result) {document.")
              .append(getVariableName())
              .append(".processResponse(result);});");
        
//        System.out.println("MaxZoomService direct call: " + r.toString());
        
        getJSObject().eval(r.toString());
        
    }
 
开发者ID:anand9522,项目名称:MapsApplication,代码行数:22,代码来源:MaxZoomService.java

示例7: getElevationForLocations

import netscape.javascript.JSObject; //导入依赖的package包/类
/** Create a request for elevations for multiple locations.
     * 
     * @param req
     * @param callback 
     */
    public void getElevationForLocations(LocationElevationRequest req, ElevationServiceCallback callback) {
        
        this.callback = callback;
        
        JSObject doc = (JSObject) getJSObject().eval("document");
        doc.setMember(getVariableName(), this);
        
        StringBuilder r = new StringBuilder(getVariableName())
              .append(".")
              .append("getElevationForLocations(")
              .append(req.getVariableName())
              .append(", ")
              .append("function(results, status) {alert('rec:'+status);\ndocument.")
              .append(getVariableName())
              .append(".processResponse(results, status);});");
        
//        System.out.println("ElevationService direct call: " + r.toString());
        
        getJSObject().eval(r.toString());
        
    }
 
开发者ID:ryanwc,项目名称:GraphSearch,代码行数:27,代码来源:ElevationService.java

示例8: processXml

import netscape.javascript.JSObject; //导入依赖的package包/类
@Override
protected void processXml(Object DOMNode) {
  atomSetCollection = new AtomSetCollection(readerName, this);
  String className = null;
  Class<?> atomSetCollectionReaderClass;
  XmlReader thisReader = null;
  String name = readerName.substring(0, readerName.indexOf("("));
  try {
    className = Resolver.getReaderClassBase(name);
    atomSetCollectionReaderClass = Class.forName(className);//,true, Thread.currentThread().getContextClassLoader());
    thisReader = (XmlReader) atomSetCollectionReaderClass
        .newInstance();
    thisReader.processXml(this, atomSetCollection, reader, (JSObject) DOMNode);
  } catch (Exception e) {
    atomSetCollection.errorMessage = "File reader was not found:" + className;
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:XmlReader.java

示例9: walkDOMTree

import netscape.javascript.JSObject; //导入依赖的package包/类
protected void walkDOMTree(JSObject DOMNode) {
  String namespaceURI = (String) DOMNode.getMember("namespaceURI");
  String localName = (String) DOMNode.getMember("localName");
  String qName = (String) DOMNode.getMember("nodeName");
  JSObject attributes = (JSObject) DOMNode.getMember("attributes");
  getAttributes(attributes);
  startElement(namespaceURI, localName, qName);
  if (((Boolean) DOMNode.call("hasChildNodes", null))
      .booleanValue()) {
    for (JSObject nextNode = (JSObject) DOMNode.getMember("firstChild"); 
           nextNode != null; 
           nextNode = (JSObject) nextNode.getMember("nextSibling"))
      walkDOMTree(nextNode);
  }
  endElement(namespaceURI, localName, qName);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:XmlReader.java

示例10: sendJsTextStatus

import netscape.javascript.JSObject; //导入依赖的package包/类
void sendJsTextStatus(String message) {
  if (!haveDocumentAccess || statusForm == null || statusText == null)
    return;
  try {
    JSObject jsoWindow = JSObject.getWindow(appletWrapper);
    JSObject jsoDocument = (JSObject) jsoWindow.getMember("document");
    JSObject jsoForm = (JSObject) jsoDocument.getMember(statusForm);
    if (statusText != null) {
      JSObject jsoText = (JSObject) jsoForm.getMember(statusText);
      jsoText.setMember("value", message);
    }
  } catch (Exception e) {
    Logger.error("error indicating status at document." + statusForm + "."
        + statusText + ":" + e.toString());
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:Jmol.java

示例11: testGetSlotById

import netscape.javascript.JSObject; //导入依赖的package包/类
/**
 * Test for simple JSObject.getSlot call.
 */
@Test(timeout=10000)
public void testGetSlotById(){
    Platform.runLater(new Runnable() {
        public void run() {
            initWebEngine();
            JSObject arrO = getArray(engine);
            resultObject = arrO.getSlot(0);
            System.out.println(resultObject);
        }
    });
    doWait(new Tester() {
        public boolean isPassed() {
            return (resultObject != null);
        }
    });
    Assert.assertEquals(ELEM_AT_0, resultObject);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:BridgeGetSlotTest.java

示例12: testGetSlotNoSuchSlot1

import netscape.javascript.JSObject; //导入依赖的package包/类
/**
 * Test for JSObject.getSlot call with -1 slot number as parameter.
 */
@Test(timeout=10000)
public void testGetSlotNoSuchSlot1(){
    Platform.runLater(new Runnable() {
        public void run() {
            initWebEngine();
            JSObject arrO = getArray(engine);
            resultObject = arrO.getSlot(-1);
            System.out.println(resultObject);
        }
    });
    doWait(new Tester() {
        public boolean isPassed() {
            return (resultObject != null);
        }
    });
    Assert.assertEquals(UNDEFINED, resultObject);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:BridgeGetSlotTest.java

示例13: testGetSlotNoSlots

import netscape.javascript.JSObject; //导入依赖的package包/类
/**
 * Test for JSObject.getSlot call on an object which has no indexed slots.
 */
@Test(timeout=10000)
public void testGetSlotNoSlots(){
    Platform.runLater(new Runnable() {
        public void run() {
            initWebEngine();
            JSObject arrO = getWindow(engine);
            resultObject = arrO.getSlot(0);
            System.out.println(resultObject);
        }
    });
    doWait(new Tester() {
        public boolean isPassed() {
            return (resultObject != null);
        }
    });
    Assert.assertEquals(UNDEFINED, resultObject);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:BridgeGetSlotTest.java

示例14: testSetAbsentMember

import netscape.javascript.JSObject; //导入依赖的package包/类
/**
 * Test for JSObject.setMember call with an absent member name as a parameter.
 */
@Test(timeout=10000)
public void testSetAbsentMember(){
    Platform.runLater(new Runnable() {
        public void run() {
            initWebEngine();
            JSObject strO = getString(engine);
            strO.setMember("iAmWrongMember", TEST_STRING);
            resultObject = strO.getMember("iAmWrongMember");
            System.out.println(resultObject);
        }
    });
    doWait(new Tester() {
        public boolean isPassed() {
            return (resultObject != null);
        }
    });
    Assert.assertEquals(TEST_STRING, resultObject);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:BridgeSetMemberTest.java

示例15: testSetMemberNull

import netscape.javascript.JSObject; //导入依赖的package包/类
/**
 * Test for JSObject.setMember call with null as value.
 * CR associated with this test failure:
 * http://javafx-jira.kenai.com/browse/RT-14178
 */
@Test(timeout=10000)
public void testSetMemberNull(){
    resultObject = new Object();
    Platform.runLater(new Runnable() {
        public void run() {
            initWebEngine();
            JSObject strO = getString(engine);
            strO.setMember("iAmWrongMember", null);
            resultObject = strO.getMember("iAmWrongMember");
            System.out.println(resultObject);
        }
    });
    doWait(new Tester() {
        public boolean isPassed() {
            return (resultObject == null);
        }
    });
    Assert.assertNull(resultObject);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:25,代码来源:BridgeSetMemberTest.java


注:本文中的netscape.javascript.JSObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。