xhtmlcollection.java

来自「java写的浏览器」· Java 代码 · 共 74 行

JAVA
74
字号
/*****************************************************************              XBrowser  -  eXtended web Browser                **                                                               **           Copyright (c) 2000-2001  Armond Avanes              **     Refer to ReadMe & License files for more information      **                                                               **                                                               **                 By: Uladzimir V. Kavalchuk                    **               Uladzimir_Kavalchuk@ep.minsk.by                 **               http://xbrowser.sourceforge.net/                ******************************************************************/package xbrowser.renderer.custom.js;import java.util.*;import java.lang.reflect.*;import org.mozilla.javascript.*;import xbrowser.renderer.custom.*;/** W3C-compatible interface implementation to handle 'document' collections. */public class XHTMLCollection extends ScriptableObject {	public XHTMLCollection() {		try {			defineProperty( "length", getClass(), DONTENUM);		} catch( PropertyException p) {			XRendererSupport.getContext().getLogger().error(this, p);		}	}	public String getClassName() {	    return "XHTMLCollection";	}    public long getLength() {		return names.size();	}	public Object get( int index, Scriptable start) {	    Object result = super.get( index, start);		if( result == null || result == NOT_FOUND)			result = item( index);		XRendererSupport.getContext().getLogger().message(this, "Getting images/" + index + ", res = " + result);		return result;	}	public Object get( String name, Scriptable start) {	    Object result = super.get( name, start);		if( result == null)			result = getNamedItem( name);		return result;	}	// This is w3c functions	public ScriptableObject item( long index) {		return (ScriptableObject)objects.get( (int)index);	}	public ScriptableObject getNamedItem( String name) {		return item( names.indexOf( name));	}	/** Internal method, not exposed for JS. */	public void add( ScriptableObject object, String id) {		names.add( id);		objects.add( object);	}// Attributes:    protected Vector /*<String>*/names = new Vector();	protected ArrayList /*<ScriptableObjects>*/ objects = new ArrayList();	final static Class[] params = new Class[] { };}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?