本文整理汇总了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]);
}
}
示例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();
}
}
示例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]);
}
}
示例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]);
}
}
示例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());
}
示例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();
}