當前位置: 首頁>>代碼示例>>Java>>正文


Java JSObject.getMember方法代碼示例

本文整理匯總了Java中netscape.javascript.JSObject.getMember方法的典型用法代碼示例。如果您正苦於以下問題:Java JSObject.getMember方法的具體用法?Java JSObject.getMember怎麽用?Java JSObject.getMember使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在netscape.javascript.JSObject的用法示例。


在下文中一共展示了JSObject.getMember方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: getAttributes

import netscape.javascript.JSObject; //導入方法依賴的package包/類
private void getAttributes(JSObject attributes) {
  if (attributes == null) {
    atts = new Hashtable<String, String>(0);
    return;
  }

  // load up only the implemented attributes

  int nAtts = ((Number) attributes.getMember("length")).intValue();
  atts = new Hashtable<String, String>(nAtts);
  for (int i = implementedAttributes.length; --i >= 0;) {
    Object[] attArgs = { implementedAttributes[i] };
    JSObject attNode = (JSObject) attributes.call("getNamedItem", attArgs);
    if (attNode != null) {
      String attLocalName = (String) attNode.getMember("name");
      String attValue = (String) attNode.getMember("value");
      atts.put(attLocalName, attValue);
    }
  }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:21,代碼來源:XmlReader.java

示例3: 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

示例4: sendJsTextareaStatus

import netscape.javascript.JSObject; //導入方法依賴的package包/類
void sendJsTextareaStatus(String message) {
  if (!haveDocumentAccess || statusForm == null || statusTextarea == null)
    return;
  try {
    JSObject jsoWindow = JSObject.getWindow(appletWrapper);
    JSObject jsoDocument = (JSObject) jsoWindow.getMember("document");
    JSObject jsoForm = (JSObject) jsoDocument.getMember(statusForm);
    if (statusTextarea != null) {
      JSObject jsoTextarea = (JSObject) jsoForm.getMember(statusTextarea);
      if (message == null) {
        jsoTextarea.setMember("value", "");
      } else {
        String info = (String) jsoTextarea.getMember("value");
        jsoTextarea.setMember("value", info + "\n" + message);
      }
    }
  } catch (Exception e) {
    Logger.error("error indicating status at document." + statusForm + "."
        + statusTextarea + ":" + e.toString());
  }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:22,代碼來源:Jmol.java

示例5: processResponse

import netscape.javascript.JSObject; //導入方法依賴的package包/類
/** Processess the Javascript response and generates the required objects 
     * that are then passed back to the original callback.
     * 
     * @param results
     * @param status 
     */
    public void processResponse(Object results, Object status) {
        ElevationStatus pStatus = ElevationStatus.UNKNOWN_ERROR;
        
        if (status instanceof String && results instanceof JSObject) {
            pStatus = ElevationStatus.valueOf((String) status);
            if (ElevationStatus.OK.equals(pStatus)) {
                JSObject jsres = (JSObject) results;
                Object len = jsres.getMember("length");
                if (len instanceof Number) {
                    int n = ((Number)len).intValue();
//                    System.out.println("n: " + n);
                    ElevationResult[] ers = new ElevationResult[n];
                    for (int i = 0; i < n; i++) {
                        Object obj = jsres.getSlot(i);
                        if (obj instanceof JSObject) {
                            ers[i] = new ElevationResult((JSObject) obj);
                        }
                    }
                    callback.elevationsReceived(ers, pStatus);
                    return;
                }
            }
        }
        callback.elevationsReceived(new ElevationResult[]{}, pStatus);
    }
 
開發者ID:ryanwc,項目名稱:GraphSearch,代碼行數:32,代碼來源:ElevationService.java

示例6: HTMLWriter

import netscape.javascript.JSObject; //導入方法依賴的package包/類
/**
    * When you create a new HTMLWriter, it pops up a new, blank, Web browser
    * window to display the output in.  You must specify the applet
    * (this specifies the main browser window) and the desired size
    * for the new window.
    **/
   public HTMLWriter(Applet applet, int width, int height) {
       // Verify that we can find the JSObject class we need.  Warn if not.
       try { Class c = Class.forName("netscape.javascript.JSObject"); }
       catch (ClassNotFoundException e) {
           throw new NoClassDefFoundError("HTMLWriter requires " +
       	   "Netscape Navigator 4.0 or higher " +
	   "or a browser that supports LiveConnect technology");
       }

       // Get a reference to the main browser window from the applet.
       main_window = JSObject.getWindow(applet);

       // Create a new window to display output in.  This command sends a
// string of JavaScript to the web browser
       window = (JSObject)
           main_window.eval("self.open(''," +
		     "'HTMLWriter" + window_num++ + "'," +
		     "'menubar,status,resizable,scrollbars," +
		     "width=" + width + ",height=" + height + "')");

       // Obtain the Document object of this new window, and open it.
       document = (JSObject) window.getMember("document");
       document.call("open", null);
   }
 
開發者ID:shashanksingh28,項目名稱:code-similarity,代碼行數:31,代碼來源:HTMLWriter.java

示例7: HTMLWriter

import netscape.javascript.JSObject; //導入方法依賴的package包/類
/**
 * When you create a new HTMLWriter, it pops up a new, blank, Web browser
 * window to display the output in.  You must specify the applet
 * (this specifies the main browser window) and the desired size
 * for the new window.
 **/
public HTMLWriter(Applet applet, int width, int height) {
  // Verify that we can find the JSObject class we need.  Warn if not.
  try { Class c = Class.forName("netscape.javascript.JSObject"); }
  catch (ClassNotFoundException e) {
    throw new NoClassDefFoundError("HTMLWriter requires " +
                                   "Netscape Navigator 4.0 or higher");
  }

  // Get a reference to the main browser window from the applet.
  main_window = JSObject.getWindow(applet);

  // Create a new window to display output in.
  window = (JSObject)
    main_window.eval("self.open(''," +
                     "'HTMLWriter" + window_num++ + "'," +
                     "'menubar,status,resizable,scrollbars," +
                     "width=" + width + ",height=" + height + "')");

  // Obtain the Document object of this new window, and open it.
  document = (JSObject) window.getMember("document");
  document.call("open", null);
}
 
開發者ID:shashanksingh28,項目名稱:code-similarity,代碼行數:29,代碼來源:HTMLWriter.java

示例8: jsArrayToList

import netscape.javascript.JSObject; //導入方法依賴的package包/類
public static List<?> jsArrayToList(JSObject objectArray)
{
	List<Object> javaList = new ArrayList<>();

	int objectArrayLength = (int) objectArray.getMember("length");

	for(int index = 0; index < objectArrayLength; index++)
	{
		Object arrayVariable = objectArray.getSlot(index);
		javaList.add(arrayVariable);
	}

	return javaList;
}
 
開發者ID:dhawal9035,項目名稱:WebPLP,代碼行數:15,代碼來源:JavascriptConversionUtil.java

示例9: JavaVersion

import netscape.javascript.JSObject; //導入方法依賴的package包/類
/**
 * Constructs
 */
public JavaVersion() {

	final JSObject objLwindowJSObject = JSObject.getWindow(this);
	final JSObject objLdocumentJSObject = (JSObject) objLwindowJSObject.getMember("document");
	final JSObject objLformsJSObject = (JSObject) objLdocumentJSObject.getMember("forms");
	final JSObject objLformJSObject = (JSObject) objLformsJSObject.getMember("javaVersionApplet");
	final JSObject objLelementsJSObject = (JSObject) objLformJSObject.getMember("elements");
	final JSObject objLjavaVersionJSObject = (JSObject) objLelementsJSObject.getMember("javaVersion");
	objLjavaVersionJSObject.setMember("value", this.getJavaVersion());
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:14,代碼來源:JavaVersion.java

示例10: getXmlType

import netscape.javascript.JSObject; //導入方法依賴的package包/類
private static String getXmlType(JSObject DOMNode) {
  String namespaceURI = (String) DOMNode.getMember("namespaceURI");
  String localName = (String) DOMNode.getMember("localName");
  if (namespaceURI.startsWith("http://www.molpro.net/"))
    return specialTags[SPECIAL_MOLPRO_DOM][0];
  if ("odyssey_simulation".equals(localName))
    return specialTags[SPECIAL_ODYSSEY_DOM][0];
  if ("arguslab".equals(localName))
    return specialTags[SPECIAL_ARGUS_DOM][0];
  if (namespaceURI.startsWith(CML_NAMESPACE_URI) || "cml".equals(localName))
    return specialTags[SPECIAL_CML_DOM][0];
  return specialTags[SPECIAL_CML_DOM][0] + "(unidentified)";
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:14,代碼來源:Resolver.java

示例11: getIntegerMember

import netscape.javascript.JSObject; //導入方法依賴的package包/類
private Integer getIntegerMember(JSObject bounds, String member) throws JSException {
    final Object value = bounds.getMember(member);
    if (value instanceof Double) {
        return (int) Math.round((Double) value);
    }
    return (Integer) bounds.getMember(member);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:8,代碼來源:WebNodeWrap.java

示例12: getEnumValue

import netscape.javascript.JSObject; //導入方法依賴的package包/類
public Object getEnumValue() {
    if (value == null) {
        JSObject jsObject = runtime.execute(type);
        value = jsObject.getMember(name);
    }
    return value;
}
 
開發者ID:ryanwc,項目名稱:GraphSearch,代碼行數:8,代碼來源:JavascriptEnum.java


注:本文中的netscape.javascript.JSObject.getMember方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。