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


Java ParserCallback.flush方法代码示例

本文整理汇总了Java中javax.swing.text.html.HTMLEditorKit.ParserCallback.flush方法的典型用法代码示例。如果您正苦于以下问题:Java ParserCallback.flush方法的具体用法?Java ParserCallback.flush怎么用?Java ParserCallback.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.html.HTMLEditorKit.ParserCallback的用法示例。


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

示例1: testHTMLReaderIntIntIntTag_PushPopParameter_BlockParagraph

import javax.swing.text.html.HTMLEditorKit.ParserCallback; //导入方法依赖的package包/类
public void testHTMLReaderIntIntIntTag_PushPopParameter_BlockParagraph() throws Exception {
    // trailing specs cutting for block and paragraph tags
    if (!isHarmony()) { 
        return;
    }
    final String str = "<P>link</P>";
    init();
    editable = false;
    ParserCallback reader = doc.getReader(0, 2, 3, Tag.P);
    SimpleAttributeSet attr = new SimpleAttributeSet();
    attr.addAttribute(StyleConstants.NameAttribute, Tag.S.toString());
    doc.insertString(0, "0000", attr);
    assertFalse(insertMarker.isOccurred());
    parse(str, reader);
    reader.flush();
    assertTrue(insertMarker.isOccurred());
    ElementSpec[] specs = (ElementSpec[])insertMarker.getAuxiliary();
    String specsDescr = "cpeoeosnsnsnsoco";
    assertEquals(specsDescr.length()/2, specs.length);
    insertMarker.reset();
    for (int i = 0; i < specs.length; i++) {
        checkSpecType(specsDescr, i, (ElementSpec)specs[i]);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:HTMLDocument_ReaderTest.java

示例2: checkConstructorTagParameter

import javax.swing.text.html.HTMLEditorKit.ParserCallback; //导入方法依赖的package包/类
private void checkConstructorTagParameter(final Tag tag, final String str, final int numSpecs) throws Exception {
    init();
    editable = false;
    ParserCallback reader = doc.getReader(0, 0, 0, tag);
    SimpleAttributeSet attr = new SimpleAttributeSet();
    attr.addAttribute(StyleConstants.NameAttribute, Tag.B.toString());
    doc.insertString(0, "0000", attr);
    assertFalse("no inserts", insertMarker.isOccurred());
    parse(str, reader);
    reader.flush();
    if (numSpecs == 0 && isHarmony()) {
        assertFalse("inserted", insertMarker.isOccurred());
    } else {
        assertTrue("inserted", insertMarker.isOccurred());
        ElementSpec[] specs = (ElementSpec[])insertMarker.getAuxiliary();
        assertEquals("number of specs inserted", numSpecs, specs.length);
        insertMarker.reset();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:HTMLDocument_ReaderTest.java

示例3: checkConstructorPopPushParameter

import javax.swing.text.html.HTMLEditorKit.ParserCallback; //导入方法依赖的package包/类
private void checkConstructorPopPushParameter(final Tag tag, final String str, final int pop, final int push, final String specsDescr) throws Exception {
    init();
    editable = false;
    ParserCallback reader = doc.getReader(0, pop, push, tag);
    SimpleAttributeSet attr = new SimpleAttributeSet();
    attr.addAttribute(StyleConstants.NameAttribute, Tag.S.toString());
    doc.insertString(0, "0000", attr);
    assertFalse(insertMarker.isOccurred());
    parse(str, reader);
    reader.flush();
    assertTrue(insertMarker.isOccurred());
    ElementSpec[] specs = (ElementSpec[])insertMarker.getAuxiliary();
    assertEquals(specsDescr.length()/2, specs.length);
    insertMarker.reset();
    for (int i = 0; i < specs.length; i++) {
        checkSpecType(specsDescr, i, (ElementSpec)specs[i]);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:HTMLDocument_ReaderTest.java

示例4: checkConstructorOffsetPopPushParameter

import javax.swing.text.html.HTMLEditorKit.ParserCallback; //导入方法依赖的package包/类
private void checkConstructorOffsetPopPushParameter(final Tag tag, final String str, final int offset, final int pop, final int push, final String specsDescr) throws Exception {
    init();
    ParserCallback reader = doc.getReader(offset, pop, push, tag);
    SimpleAttributeSet attr = new SimpleAttributeSet();
    attr.addAttribute(StyleConstants.NameAttribute, Tag.S.toString());
    editable = false;
    insertMarker.reset();
    parse(str, reader);
    reader.flush();
    assertTrue(insertMarker.isOccurred());
    ElementSpec[] specs = (ElementSpec[])insertMarker.getAuxiliary();
    assertEquals(specsDescr.length()/2, specs.length);
    insertMarker.reset();
    for (int i = 0; i < specs.length; i++) {
        checkSpecType(specsDescr, i, (ElementSpec)specs[i]);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:HTMLDocument_ReaderTest.java

示例5: checkConstructorOffsetParameter

import javax.swing.text.html.HTMLEditorKit.ParserCallback; //导入方法依赖的package包/类
private void checkConstructorOffsetParameter(final Tag tag, final String str, final int offset) throws Exception {
    insertMarker.reset();
    doc = new HTMLDocument() {
        protected void insert(int offset, ElementSpec[] data) throws BadLocationException {
            insertMarker.setOccurred();
            insertMarker.setAuxiliary(new Integer(offset));
        }
    };
    ParserCallback reader = doc.getReader(offset, 0, 0, tag);
    parse(str, reader);
    reader.flush();
    assertTrue(insertMarker.isOccurred());
    assertEquals(new Integer(offset), insertMarker.getAuxiliary());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:HTMLDocument_ReaderTest.java

示例6: loadDocument

import javax.swing.text.html.HTMLEditorKit.ParserCallback; //导入方法依赖的package包/类
public static void loadDocument(final HTMLDocument doc, final String content) throws Exception {
    final ParserCallback reader = doc.getReader(0);
    new ParserDelegator().parse(new StringReader(content), reader, true);
    reader.flush();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:HTMLDocumentTestCase.java


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