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


Java ContentModel类代码示例

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


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

示例1: testContentModelElement003

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)'*
 * ContentModel(Element( "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1") .
 * It checks if an instance is created, content is equal to el ,type is 0
 * and next is null.
 */
public void testContentModelElement003() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(el);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(cm2, el.content);
    assertEquals(el, cm.content);
    assertEquals(0, cm.type);
    assertNull(cm.next);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:ContentModelCompatilityTest.java

示例2: testFirstObject042

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first(Object)'
 * ContentModel(0,ContentModel(Element("1",0,true,true,null,null,null,null)))
 * parameter: ContentModel(Element("1",0,true,true,null,null,null,null))
 * expected: true
 */

public void testFirstObject042() {
    dtd = new DTDGetter("TestContentModelSemantic");
    Element el = dtd.defineElement("1", 0, true, true, null, null,
            null, null);
    cm = new ContentModel(el);
    ContentModel cm2 = new ContentModel(0, cm);
    assertTrue(cm2.first(cm));
    assertFalse(cm2.first(cm2));
    assertFalse(cm2.first(el));
    assertFalse(cm2.first(""));
    assertFalse(cm2.first("1"));

    assertFalse(cm2.first(dtd));
    assertFalse(cm2.first(null));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:ContentModelCompatilityTest.java

示例3: testFirstObject005

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first(Object)'
 * ContentModel("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1"))
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")
 * Expected: true
 */
public void testFirstObject005() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(el);
    assertTrue(cm.first(el));
    assertFalse(cm.first(cm));
    assertFalse(cm.first(cm2));
    assertFalse(cm.first(dtd));

    assertFalse(cm.first(bs1));
    assertFalse(cm.first(bs2));
    assertFalse(cm.first(al));
    assertFalse(cm.first(""));
    assertFalse(cm.first("elemento"));
    assertFalse(cm.first(null));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:32,代码来源:ContentModelCompatilityTest.java

示例4: testContentModelIntObjectContentModel045

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=-38, (element is defined in a dtd as el=
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")),
 * null Verifies that an instance is created. content is equal to element,
 * type is -38 and next is null
 */
public void testContentModelIntObjectContentModel045() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(-38, el, null);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(-38, cm.type);
    assertNull(cm.next);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:ContentModelCompatilityTest.java

示例5: testContentModelIntObjectContentModel080

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MIN_VALUE, el=
 * "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), new ContentModel() Verifies that an
 * instance is created. content is equal to el= "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), type is Integer.MIN_VALUE and next is
 * new ContentModel()
 */
public void testContentModelIntObjectContentModel080() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cmnext = new ContentModel();
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(Integer.MIN_VALUE, el, cmnext);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(Integer.MIN_VALUE, cm.type);
    assertEquals(cmnext, cm.next);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:30,代码来源:ContentModelCompatilityTest.java

示例6: main

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    final DTD html32 = DTD.getDTD("html32");
    ContentModel contentModel = new ContentModel('&', new ContentModel());

    Element elem1 = html32.getElement("html-element");
    contentModel.first(elem1);

    Element elem2 = html32.getElement("test-element");
    // Shouldn't throw ArrayIndexOutOfBoundsException
    contentModel.first(elem2);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:bug8074956.java

示例7: defElement

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Defines a new element and adds it to the element table.
 * If the element alredy exists,
 * overrides it settings with the specified values.
 * @param name the name of the new element
 * @param type the type of the element
 * @param headless true if the element needs no starting tag
 * @param tailless true if the element needs no closing tag
 * @param content the element content.
 * @param exclusions the elements that must be excluded from the
 * content of this element, in all levels of the hierarchy.
 * @param inclusions the elements that can be included as the
 * content of this element.
 * @param attributes the element attributes (an array and not a
 * linked list). The attributes are chained into the linked list
 * inside this method.
 * @return the created or updated element.
 */
public Element defElement(String name, int type, boolean headless,
                          boolean tailless, ContentModel content,
                          String[] exclusions, String[] inclusions,
                          AttributeList[] attributes
                         )
{
  AttributeList list;

  if (attributes == null || attributes.length == 0)
    list = null;
  else
    {
      if (attributes.length > 1)
        for (int i = 1; i < attributes.length; i++)
          {
            attributes [ i - 1 ].next = attributes [ i ];
          }
      list = attributes [ 0 ];
    }

  Element e =
    super.defElement(name, type, headless, tailless, content, exclusions,
                     inclusions, list
                    );
  return e;
}
 
开发者ID:vilie,项目名称:javify,代码行数:45,代码来源:gnuDTD.java

示例8: measureChainLength

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Measure length of the linked list of the content models.
 * @param c The heading element of the linked list.
 * @return the length of the list (0 for null 1 if c!=null and c.next==null,
 * etc.
 */
public static int measureChainLength(ContentModel c)
{
  if (c == null)
    return 0;
  else
    return measureChainLength(c.next) + 1;
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:transformer.java

示例9: optionalTransform

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
private static node optionalTransform(ContentModel c, DTD dtd)
{
  node n;
  if (c.content instanceof ContentModel)
    n = transform((ContentModel) c.content, dtd);
  else

    /* A single token with the specified operation */
    n = new node((char) 0, (char) 0, c.content);
  return n;
}
 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:transformer.java

示例10: model

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Crate a chain from the two content models,
 * the last containing the given element and
 * the specified unary operation.
 */
private ContentModel model(String element, int unary)
{
  ContentModel ct = model(element);
  ct.type = unary;
  return new ContentModel(0, ct);
}
 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:HTML_401F.java

示例11: createHtmlContentModel

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Create the model HEAD, BODY
 * @return the HTML content model of the whole document
 */
protected ContentModel createHtmlContentModel()
{
  ContentModel head = model(HEAD);
  ContentModel body = model(BODY);
  head.next = body;
  head.type = ',';
  return head;
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:HTML_401F.java

示例12: createDefListModel

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Creates a model for &lt;DL&gt; tag:
 * <code> DT+ | DL+ </code>.
 * @return
 */
protected ContentModel createDefListModel()
{
  ContentModel dt = model(DT, '+');
  ContentModel dd = model(DD, '+');

  dt.next = dd;
  dt.type = dd.type = '|';
  return dt;
}
 
开发者ID:vilie,项目名称:javify,代码行数:15,代码来源:HTML_401F.java

示例13: createListModel

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * This model is used for UL, OL, MENU and DIR.
 *  HTML 4.01 specifies LI only, but the nested
 * list seems rendered correctly only if
 * it is not enclosed into <LI>-</LI> of the
 * parent list.
 */
protected ContentModel createListModel()
{
  ContentModel li = model(LI, '+');
  ContentModel ul = model(UL, '+');
  ContentModel ol = model(OL, '+');

  li.next = ul;
  ul.next = ol;
  li.type = ul.type = ol.type = '|';
  return li;
}
 
开发者ID:vilie,项目名称:javify,代码行数:19,代码来源:HTML_401F.java

示例14: testContentModelElement001

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)' Null is
 * passed as parameter Verifies that an instance is created. Fields content
 * and next are null and type is 0.
 */
public void testContentModelElement001() {
    cm = new ContentModel(null);
    assertNotNull(cm);
    assertNull(cm.content);
    assertEquals(0, cm.type);
    assertNull(cm.next);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:ContentModelCompatilityTest.java

示例15: testGetElements028

import javax.swing.text.html.parser.ContentModel; //导入依赖的package包/类
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel(63,null) parameter: new Vector() expected:
 * NullPointerException
 */
public void testGetElements028() {
    try {
        cm = new ContentModel(63, null);
        Vector v = new Vector();
        cm.getElements(v);
        fail("Should raise NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:ContentModelCompatilityTest.java


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