Examples of ReplaceAttributes


Examples of com.google.walkaround.proto.ProtocolDocumentOperation.Component.ReplaceAttributes

      @Override
      public void replaceAttributes(Attributes oldAttributes, Attributes newAttributes) {
        Component component =
            MessageFactoryHelper.createDocumentOperationComponent();
        ReplaceAttributes replace =
            MessageFactoryHelper.createDocumentReplaceAttributes();
        if (oldAttributes.isEmpty() && newAttributes.isEmpty()) {
          replace.setEmpty(true);
        } else {
          for (Map.Entry<String, String> e : oldAttributes.entrySet()) {
            replace.addOldAttribute(createKeyValuePair(e.getKey(), e.getValue()));
          }
          for (Map.Entry<String, String> e : newAttributes.entrySet()) {
            replace.addNewAttribute(createKeyValuePair(e.getKey(), e.getValue()));
          }
        }
        component.setReplaceAttributes(replace);
        mutation.addComponent(component);
      }
View Full Code Here

Examples of com.google.walkaround.proto.ProtocolDocumentOperation.Component.ReplaceAttributes

  }

  @Override
  public Attributes getReplaceAttributesNewAttributes(int i) {
    Component component = provider.getContent().getComponent(i);
    ReplaceAttributes r = component.getReplaceAttributes();
    return newAttributesFrom(r);
  }
View Full Code Here

Examples of com.google.walkaround.proto.ProtocolDocumentOperation.Component.ReplaceAttributes

  }

  @Override
  public Attributes getReplaceAttributesOldAttributes(int i) {
    Component component = provider.getContent().getComponent(i);
    ReplaceAttributes r = component.getReplaceAttributes();
    return oldAttributesFrom(r);
  }
View Full Code Here

Examples of com.google.walkaround.proto.ProtocolDocumentOperation.Component.ReplaceAttributes

      if (!component.getDeleteElementEnd()) {
        throw new DelayedInvalidInputException("Delete element end present but false: " + provider);
      }
      cursor.deleteElementEnd();
    } else if (component.hasReplaceAttributes()) {
      ReplaceAttributes r = component.getReplaceAttributes();
      cursor.replaceAttributes(oldAttributesFrom(r), newAttributesFrom(r));
    } else if (component.hasUpdateAttributes()) {
      UpdateAttributes r = component.getUpdateAttributes();
      cursor.updateAttributes(attributesUpdateFrom(r));
    } else {
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolDocumentOperation.Component.ReplaceAttributes

        output.deleteElementStart(c.getDeleteElementStart().getType(), new AttributesImpl(
            deserialize(c.getDeleteElementStart().getAttribute())));
      } 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()) {
        UpdateAttributes u = c.getUpdateAttributes();
        if (u.getEmpty()) {
          output.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolDocumentOperation.Component.ReplaceAttributes

        addComponent().setDeleteElementEnd(true);
      }

      @Override
      public void replaceAttributes(Attributes oldAttributes, Attributes newAttributes) {
        ReplaceAttributes r = ReplaceAttributesJsoImpl.create();
        if (oldAttributes.isEmpty() && newAttributes.isEmpty()) {
          r.setEmpty(true);
        } else {
          for (String name : oldAttributes.keySet()) {
            r.addOldAttribute(keyValuePair(name, oldAttributes.get(name)));
          }

          for (String name : newAttributes.keySet()) {
            r.addNewAttribute(keyValuePair(name, newAttributes.get(name)));
          }
        }
        addComponent().setReplaceAttributes(r);
      }
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolDocumentOperation.Component.ReplaceAttributes

        return this;
      }

      /** Builds a {@link ReplaceAttributes} using this builder and a factory. */
      public ReplaceAttributes build(Factory factory) {
        ReplaceAttributes message = factory.create();
        message.setEmpty(empty);
        message.clearOldAttribute();
        message.addAllOldAttribute(oldAttribute);
        message.clearNewAttribute();
        message.addAllNewAttribute(newAttribute);
        return message;
      }
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolDocumentOperation.Component.ReplaceAttributes

        output.deleteElementStart(c.getDeleteElementStart().getType(), new AttributesImpl(
            deserialize(c.getDeleteElementStart().getAttribute())));
      } 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()) {
        UpdateAttributes u = c.getUpdateAttributes();
        if (u.getEmpty()) {
          output.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolDocumentOperation.Component.ReplaceAttributes

        addComponent().setDeleteElementEnd(true);
      }

      @Override
      public void replaceAttributes(Attributes oldAttributes, Attributes newAttributes) {
        ReplaceAttributes r = ReplaceAttributesJsoImpl.create();
        if (oldAttributes.isEmpty() && newAttributes.isEmpty()) {
          r.setEmpty(true);
        } else {
          for (String name : oldAttributes.keySet()) {
            r.addOldAttribute(keyValuePair(name, oldAttributes.get(name)));
          }

          for (String name : newAttributes.keySet()) {
            r.addNewAttribute(keyValuePair(name, newAttributes.get(name)));
          }
        }
        addComponent().setReplaceAttributes(r);
      }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.OperationComponents.ReplaceAttributes

  public final void deleteElementStart(String type, Attributes attrs) {
    accu.add(new DeleteElementStart(type, attrs));
  }
  @Override
  public final void replaceAttributes(Attributes oldAttrs, Attributes newAttrs) {
    accu.add(new ReplaceAttributes(oldAttrs, newAttrs));
  }
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.