Examples of replaceAttributes()


Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer.replaceAttributes()

    b.deleteElementEnd();

    // Now some replaceAttributes with different size and case.
    b.replaceAttributes(new AttributesImpl("a", "b"), new AttributesImpl("b", "c", "c", "d"));
    b.replaceAttributes(Attributes.EMPTY_MAP, new AttributesImpl("Aa", "aA"));
    b.replaceAttributes(new AttributesImpl("B", "A"), new AttributesImpl());
    // Try both a fresh empty AttributesImpl() instance and the preallocated
    // EMPTY_MAP.
    b.replaceAttributes(new AttributesImpl(), Attributes.EMPTY_MAP);
    // Now we add similar cases for annotation boundaries.  Since consecutive annotation
    // boundaries would make the operation ill-formed, we interleave them with further
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer.replaceAttributes()

    b.replaceAttributes(new AttributesImpl("a", "b"), new AttributesImpl("b", "c", "c", "d"));
    b.replaceAttributes(Attributes.EMPTY_MAP, new AttributesImpl("Aa", "aA"));
    b.replaceAttributes(new AttributesImpl("B", "A"), new AttributesImpl());
    // Try both a fresh empty AttributesImpl() instance and the preallocated
    // EMPTY_MAP.
    b.replaceAttributes(new AttributesImpl(), Attributes.EMPTY_MAP);
    // Now we add similar cases for annotation boundaries.  Since consecutive annotation
    // boundaries would make the operation ill-formed, we interleave them with further
    // updateAttributes tests.
    b.annotationBoundary(AnnotationBoundaryMapImpl.builder().build());
    b.updateAttributes(new AttributesUpdateImpl());
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

    b1.retain(5);
    b2.retain(5);

    b1.replaceAttributes(ATTRS, ATTRS);
    b2.replaceAttributes(ATTRS_SCRUBBED, ATTRS_SCRUBBED);

    b1.updateAttributes(ATTRSUP);
    b2.updateAttributes(ATTRSUP_SCRUBBED);

    b1.annotationBoundary(ANNO);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

    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);

    assertReversible(makeBlipOp("replaceAttributes", m.build()));
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

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

    m.retain(4);
    m.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
    m.retain(4);

    assertReversible(makeBlipOp("emptyReplaceAttributes", m.build()));
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

      } else if (c.hasDeleteElementEnd()) {
        output.deleteElementEnd();
      } else if (c.hasReplaceAttributes()) {
        ReplaceAttributes r = c.getReplaceAttributes();
        if (r.getEmpty()) {
          output.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
        } else {
          output.replaceAttributes(new AttributesImpl(deserialize(r.getOldAttribute())),
              new AttributesImpl(deserialize(r.getNewAttribute())));
        }
      } else if (c.hasUpdateAttributes()) {
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

      } else if (c.hasReplaceAttributes()) {
        ReplaceAttributes r = c.getReplaceAttributes();
        if (r.getEmpty()) {
          output.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
        } else {
          output.replaceAttributes(new AttributesImpl(deserialize(r.getOldAttribute())),
              new AttributesImpl(deserialize(r.getNewAttribute())));
        }
      } else if (c.hasUpdateAttributes()) {
        UpdateAttributes u = c.getUpdateAttributes();
        if (u.getEmpty()) {
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

            new AttributesImpl(attributesMap));
      } else if (c.hasDeleteElementEnd()) {
        output.deleteElementEnd();
      } else if (c.hasReplaceAttributes()) {
        if (c.getReplaceAttributes().getEmpty()) {
          output.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
        } else {
          Map<String, String> oldAttributesMap = Maps.newHashMap();
          Map<String, String> newAttributesMap = Maps.newHashMap();
          for (ProtocolDocumentOperation.Component.KeyValuePair pair :
              c.getReplaceAttributes().getOldAttributeList()) {
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

          }
          for (ProtocolDocumentOperation.Component.KeyValuePair pair :
              c.getReplaceAttributes().getNewAttributeList()) {
            newAttributesMap.put(pair.getKey(), pair.getValue());
          }
          output.replaceAttributes(new AttributesImpl(oldAttributesMap),
              new AttributesImpl(newAttributesMap));
        }
      } else if (c.hasUpdateAttributes()) {
        if (c.getUpdateAttributes().getEmpty()) {
          output.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder.replaceAttributes()

            new AttributesImpl(attributesMap));
      } else if (c.hasDeleteElementEnd()) {
        output.deleteElementEnd();
      } else if (c.hasReplaceAttributes()) {
        if (c.getReplaceAttributes().getEmpty()) {
          output.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
        } else {
          Map<String, String> oldAttributesMap = Maps.newHashMap();
          Map<String, String> newAttributesMap = Maps.newHashMap();
          for (ProtocolDocumentOperation.Component.KeyValuePair pair :
              c.getReplaceAttributes().getOldAttributeList()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.