• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HTMLCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getEffectiveUrl

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
private String getEffectiveUrl() throws IOException {
    StringBuffer spec = new StringBuffer( getAction() );
    if ("get".equalsIgnoreCase( getMethod() )) {
        URLEncodedString parameters = new URLEncodedString();
        HTMLCollection controls = getElements();
        for (int i = 0; i < controls.getLength(); i++) {
            ((HTMLControl) controls.item( i )).addValues( parameters, "us-ascii" );
        }
        if ((spec.indexOf( "?" ) >= 0) && !(spec.toString().endsWith( "?" ))) {
            spec.append( '&' );
        } else {
            spec.append( '?' );
        }
        spec.append( parameters.getString() );
    }
    return new URL( getDomWindow().getUrl(), spec.toString() ).toExternalForm();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:HTMLFormElementImpl.java


示例2: setCells

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public void setCells( HTMLCollection cells )
{
    Node    child;
    int        i;
    
    child = getFirstChild();
    while ( child != null ) {
        removeChild( child );
        child = child.getNextSibling();
    }
    i = 0;
    child = cells.item( i );
    while ( child != null ) {
        appendChild ( child );
        ++i;
        child = cells.item( i );
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:19,代码来源:HTMLTableRowElementImpl.java


示例3: getFormControls

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
/**
 * Returns an array of form parameter attributes for this form.
 **/
private FormControl[] getFormControls() {
    HTMLCollection controlElements = _domElement.getElements();
    FormControl[] controls = new FormControl[ controlElements.getLength() ];
    for (int i = 0; i < controls.length; i++) {
        controls[i] = getControlForNode( controlElements.item( i ) );
    }
    return controls;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:WebForm.java


示例4: get

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public Object get( String propertyName, Scriptable scriptable ) {
    HTMLCollection elements = getElements();
    for (int i=0; i < elements.getLength(); i++) {
        Node node = elements.item( i );
        NamedNodeMap attributes = node.getAttributes();
        AttrImpl nameAttribute = (AttrImpl) attributes.getNamedItem( "name" );
        if (nameAttribute != null && propertyName.equals( nameAttribute.getValue() )) return node;
        AttrImpl idAttribute = (AttrImpl) attributes.getNamedItem( "id" );
        if (idAttribute != null && propertyName.equals( idAttribute.getValue() )) return node;
    }
    return  super.get( propertyName, scriptable );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:HTMLFormElementImpl.java


示例5: getElements

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
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 ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:HTMLFormElementImpl.java


示例6: reset

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public void reset() {
    HTMLCollection elements = getElements();
    for (int i = 0; i < elements.getLength(); i++) {
        Node node = elements.item(i);
        if (node instanceof HTMLControl) ((HTMLControl) node).reset();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLFormElementImpl.java


示例7: getPreviousForm

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLControl.java


示例8: getSelectedIndex

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public int getSelectedIndex() {
    HTMLCollection options = getOptions();
    for (int i = 0; i < options.getLength(); i++) {
        if (((HTMLOptionElement)options.item(i)).getSelected()) return i;
    }
    return isMultiSelect() ? -1 : 0;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLSelectElementImpl.java


示例9: getValue

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public String getValue() {
    HTMLCollection options = getOptions();
    for (int i = 0; i < options.getLength(); i++) {
        HTMLOptionElement optionElement = ((HTMLOptionElement)options.item(i));
        if (optionElement.getSelected()) return optionElement.getValue();
    }
    return (isMultiSelect() || options.getLength() == 0) ? null : ((HTMLOptionElement)options.item(0)).getValue();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:HTMLSelectElementImpl.java


示例10: setSelectedIndex

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public void setSelectedIndex( int selectedIndex ) {
    HTMLCollection options = getOptions();
    for (int i = 0; i < options.getLength(); i++) {
        HTMLOptionElementImpl optionElement = (HTMLOptionElementImpl) options.item(i);
        optionElement.setSelected( i == selectedIndex );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLSelectElementImpl.java


示例11: getIndexOf

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
int getIndexOf( HTMLOptionElementImpl option ) {
    HTMLCollection options = getOptions();
    for (int i = 0; i < options.getLength(); i++) {
        if (options.item(i) == option) return i;
    }
    throw new IllegalStateException( "option is not part of this select" );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLSelectElementImpl.java


示例12: addValues

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
void addValues( ParameterProcessor processor, String characterSet ) throws IOException {
    HTMLCollection options = getOptions();
    String name = getName();
    for (int i = 0; i < options.getLength();i++) {
        ((HTMLOptionElementImpl) options.item( i )).addValueIfSelected( processor, name, characterSet );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLSelectElementImpl.java


示例13: reset

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public void reset() {
    HTMLCollection options = getOptions();
    for (int i = 0; i < options.getLength(); i++) {
        HTMLControl optionElement = (HTMLControl) options.item(i);
        optionElement.reset();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLSelectElementImpl.java


示例14: setChecked

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public void setChecked( boolean checked ) {
    if (checked) {
        HTMLCollection elements = getForm().getElements();
        for (int i = 0; i < elements.getLength(); i++) {
            Node node = elements.item(i);
            if (!(node instanceof HTMLInputElementImpl)) continue;
            HTMLInputElementImpl input = (HTMLInputElementImpl) node;
            if (getName().equals( input.getName() ) && input.getType().equalsIgnoreCase( "radio" )) input.setState( false );
        }
    }
    setState( checked );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:HTMLInputElementImpl.java


示例15: getLinks

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
/**
 * get Links for a given Node
 * @param rootNode
 * @return
 */
HTMLCollection getLinks( NodeImpl rootNode ) {
    ArrayList elements = new ArrayList();
    for (Iterator each = rootNode.preOrderIteratorAfterNode( _iteratorMask ); each.hasNext();) {
        Node node = (Node) each.next();
        if (node.getNodeType() != Node.ELEMENT_NODE) continue;

        if (ParsedHTML.isWebLink(node)) {
            elements.add( node );
        }
    }
    return HTMLCollectionImpl.createHTMLCollectionImpl( new NodeListImpl( elements ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:HTMLContainerDelegate.java


示例16: getForms

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
HTMLCollection getForms( NodeImpl rootNode ) {
    ArrayList elements = new ArrayList();
    for (Iterator each = rootNode.preOrderIteratorAfterNode( _iteratorMask ); each.hasNext();) {
        Node node = (Node) each.next();
        if (node.getNodeType() != Node.ELEMENT_NODE) continue;

        if ("form".equalsIgnoreCase( ((Element) node).getTagName() )) {
            elements.add( node );
        }
    }
    return HTMLCollectionImpl.createHTMLCollectionImpl( new NodeListImpl( elements ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:HTMLContainerDelegate.java


示例17: getAnchors

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
HTMLCollection getAnchors( NodeImpl rootNode ) {
    NodeList nodeList = rootNode.getElementsByTagName( "A" );
    ArrayList elements = new ArrayList();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node node = nodeList.item( i );
        if (node.getAttributes().getNamedItem( "name" ) != null) {
            elements.add( node );
        }
    }
    return HTMLCollectionImpl.createHTMLCollectionImpl( new NodeListImpl( elements ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:HTMLContainerDelegate.java


示例18: navigateImpl

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
private void navigateImpl(final @NonNull URL href, final String target, final RequestType requestType, final Object linkObject) {
  if (logger.isLoggable(Level.INFO)) {
    logger.info("navigateImpl(): href=" + href + ",target=" + target);
  }
  // First check if target is a frame identifier.
  TargetType targetType;
  if (target != null) {
    final HtmlRendererContext topCtx = this.getTop();
    final HTMLCollection frames = topCtx.getFrames();
    if (frames != null) {
      final Node frame = frames.namedItem(target);
      if (frame instanceof FrameNode) {
        final BrowserFrame bframe = ((FrameNode) frame).getBrowserFrame();
        if (bframe == null) {
          throw new IllegalStateException("Frame node without a BrowserFrame instance: " + frame);
        }
        if (bframe.getHtmlRendererContext() != this) {
          bframe.loadURL(href);
          return;
        }
      }
    }
    // Now try special target types.
    targetType = HtmlRendererContextImpl.getTargetType(target);
  } else {
    targetType = TargetType.SELF;
  }
  if (requestType == RequestType.CLICK) {
    this.clientletFrame.linkClicked(href, targetType, linkObject);
  } else {
    this.clientletFrame.navigate(href, "GET", null, targetType, requestType);
  }
}
 
开发者ID:lobobrowser,项目名称:LoboBrowser,代码行数:34,代码来源:HtmlRendererContextImpl.java


示例19: getFrames

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public HTMLCollection getFrames() {
  final Object rootNode = this.htmlPanel.getRootNode();
  if (rootNode instanceof HTMLDocumentImpl) {
    return ((HTMLDocumentImpl) rootNode).getFrames();
  } else {
    return null;
  }
}
 
开发者ID:lobobrowser,项目名称:LoboBrowser,代码行数:9,代码来源:HtmlRendererContextImpl.java


示例20: getImages

import org.w3c.dom.html.HTMLCollection; //导入依赖的package包/类
public HTMLCollection getImages()
{
    // For more information see HTMLCollection#collectionMatch
    if ( _images == null )
        _images = new HTMLCollectionImpl( getBody(), HTMLCollectionImpl.IMAGE );
    return _images;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:8,代码来源:HTMLDocumentImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientCallStreamObserver类代码示例发布时间:2022-05-22
下一篇:
Java CatalogException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap