Java 类org.w3c.dom.html.HTMLFormElement 实例源码

项目:lams    文件:WebForm.java   
/**
 * Contructs a web form given the URL of its source page and the DOM extracted
 * from that page.
 **/
WebForm( WebResponse response, URL baseURL, Node node, FrameSelector frame, String defaultTarget, String characterSet, ElementRegistry registry ) {
    super( response, node, baseURL, "action", frame, defaultTarget );
    _characterSet = characterSet;
    _registry = registry;
    _domElement = (HTMLFormElement) node;
}
项目:lams    文件:HTMLFormElementImpl.java   
public HTMLCollection getElements() {
    ArrayList elements = new ArrayList();
    String[] names = new String[]{"INPUT", "TEXTAREA", "BUTTON", "SELECT"};
    for (Iterator each = preOrderIteratorAfterNode(); each.hasNext();) {
        Node node = (Node) each.next();
        if (node instanceof HTMLFormElement) break;

        if (node.getNodeType() != ELEMENT_NODE) continue;
        String tagName = ((Element) node).getTagName();
        for (int i = 0; i < names.length; i++) {
            if (tagName.equalsIgnoreCase( names[i] )) elements.add( node );
        }
    }
    return HTMLCollectionImpl.createHTMLCollectionImpl( new NodeListImpl( elements ) );
}
项目:lams    文件:HTMLControl.java   
public HTMLFormElement getForm() {
    Node parent = getParentNode();
    while (parent != null && !("form".equalsIgnoreCase( parent.getNodeName() ))) parent = parent.getParentNode();
    if (parent != null) return (HTMLFormElement) parent;

    for (Iterator here = preOrderIterator(); here.hasNext();) {
        Object o = here.next();
        if (o instanceof HTMLFormElement) return getPreviousForm( (HTMLFormElement) o );
    }
    return getLastFormInDocument();
}
项目:lams    文件:HTMLControl.java   
private HTMLFormElement getPreviousForm( HTMLFormElement nextForm ) {
    HTMLCollection forms = getHtmlDocument().getForms();
    for (int i = 0; i < forms.getLength(); i++) {
        if (nextForm == forms.item( i )) return i == 0 ? null : (HTMLFormElement) forms.item( i-1 );
    }
    return null;
}
项目:SplitCharater    文件:HTMLElementImpl.java   
/**
 * Convenience method returns the form in which this form element is contained.
 * This method is exposed for form elements through the DOM API, but other
 * elements have no access to it through the API.
 */
public HTMLFormElement getForm() {
    Node parent = getParentNode(); 
    while ( parent != null ) {
        if ( parent instanceof HTMLFormElement ) {
            return (HTMLFormElement) parent;
        }
        parent = parent.getParentNode();
    }
    return null;
}
项目:ui4j    文件:WebKitElement.java   
@Override
public Optional<Form> getForm() {
    if (element instanceof HTMLFormElement) {
        return Optional.of(new Form(this));
    }
    return Optional.empty();
}
项目:lams    文件:HTMLControl.java   
private HTMLFormElement getLastFormInDocument() {
    HTMLCollection forms = getHtmlDocument().getForms();
    return forms.getLength() == 0 ? null : (HTMLFormElement) forms.item( forms.getLength()-1 );
}
项目:teavm    文件:HTMLButtonElement.java   
@JSProperty
HTMLFormElement getForm();