Package org.waveprotocol.wave.model.document.operation

Examples of org.waveprotocol.wave.model.document.operation.Attributes


      E nodeToDelete = substrate.asElement(currentContainer.getValue());
      if (nodeToDelete == null) {
        throw new OpCursorException("No element to delete at the current location.");
      }
      String tagName = substrate.getTagName(nodeToDelete);
      Attributes attributes = new AttributesImpl(substrate.getAttributes(nodeToDelete));
      if (deletionDepth == 0) {
        substrate.removeChild(currentParent, nodeToDelete);
      }

      doSingleDelete(tagName, attributes);
View Full Code Here


  }

  public void testElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.elementStart("a", a);
    m.elementStart("b", b);
    m.elementStart("c", c);
    m.elementEnd();
View Full Code Here

  }

  public void testCharactersAndElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.elementStart("a", a);
    m.characters("hello");
    m.elementStart("b", b);
    m.characters("world");
View Full Code Here

  }

  public void testDeleteElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.deleteElementStart("a", a);
    m.deleteElementStart("b", b);
    m.deleteElementStart("c", c);
    m.deleteElementEnd();
View Full Code Here

  }

  public void testDeleteCharactersAndElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.deleteElementStart("a", a);
    m.deleteCharacters("hello");
    m.deleteElementStart("b", b);
    m.deleteCharacters("world");
View Full Code Here

  }

  public void testAnnotationBoundary() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    AnnotationBoundaryMap mapA = new AnnotationBoundaryMapImpl(
        new String[]{},new String[]{"a"},new String[]{null},new String[]{"b"});
    AnnotationBoundaryMap mapB = new AnnotationBoundaryMapImpl(
        new String[]{},new String[]{"a"},new String[]{"b"},new String[]{null});
    AnnotationBoundaryMap mapC = new AnnotationBoundaryMapImpl(
View Full Code Here

  }

  public void testEmptyAnnotationBoundary() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    m.elementStart("a", a);
    m.annotationBoundary(AnnotationBoundaryMapImpl.EMPTY_MAP);
    m.characters("text");
    m.annotationBoundary(AnnotationBoundaryMapImpl.EMPTY_MAP);
    m.elementEnd();
View Full Code Here

  }

  public void testReplaceAttributes() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes oldA = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes newA = new AttributesImpl(ImmutableMap.of("a1", "3", "a2", "4"));

    m.retain(4);
    m.replaceAttributes(oldA, newA);
    m.retain(4);
View Full Code Here

        token(RichTextTokenizer.Type.TEXT, "o"),
        token(RichTextTokenizer.Type.STYLE_FONT_WEIGHT_END));
  }

  public void testListComplex() {
    Attributes listAttribute = new AttributesImpl(Collections.singletonMap("t", "li"));
    verifyTokens(tokenize("<ol><li>fo</li></ol><p>hello</p>"),
        token(RichTextTokenizer.Type.ORDERED_LIST_START),
        token(RichTextTokenizer.Type.LIST_ITEM),
        token(RichTextTokenizer.Type.TEXT, "fo"),
        token(RichTextTokenizer.Type.ORDERED_LIST_END),
View Full Code Here

        }
      }

      RandomizerOperationComponent generate(final DocOpAutomaton a, final boolean valid) {
        final String tag = a.currentElementStartTag();
        final Attributes oldAttrs = a.currentElementStartAttributes();
        if (tag == null) {
          assert oldAttrs == null;
          return null;
        }
        assert oldAttrs != null;
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.Attributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.