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

Examples of org.waveprotocol.wave.model.document.operation.impl.AttributesImpl


   *
   * @param location The location at which the insert the fragment.
   * @return The operation.
   */
  private static Nindo structuralSample5(int location) {
    Attributes attributes = new AttributesImpl(
        Collections.singletonMap("href", "http://www.google.com/"));
    Nindo.Builder builder = new Nindo.Builder();
    builder.skip(location);
    builder.elementStart("a", new AttributesImpl(attributes));
    builder.characters("google");
    builder.elementEnd();
    return builder.build();
  }
View Full Code Here


   * update.
   */
  public void testSetAttributes() {
    init("<p t=\"0\" s=\"hi\">hello</p>");
    Element e = (Element) doc.getFirstChild(doc.getDocumentElement());
    doc.setElementAttributes(e, new AttributesImpl("just", "this"));
    assertEquals(null, doc.getAttribute(e, "t"));
    assertEquals(null, doc.getAttribute(e, "s"));
    assertEquals("this", doc.getAttribute(e, "just"));
  }
View Full Code Here

        ti(14 + moreText.length(), moreText2));
    checkDeletions(els);
  }

  private Attributes attrs(String ... strs) {
    return new AttributesImpl(pairs(strs));
  }
View Full Code Here

        toSet("a1", "a2"),
        createValidators(
            "a1", "v1",
            "a2", "v2"));
    checkAttributes(validator, Type.MISSING_REQUIRED_ATTRIBUTE, AttributesImpl.EMPTY_MAP);
    checkAttributes(validator, Type.VALID, new AttributesImpl(
        "a1", "v1",
        "a2", "v2"));
    checkAttributes(validator, Type.INVALID_ATTRIBUTE_VALUE, new AttributesImpl(
        "a1", "v2",
        "a2", "v2"));
    checkAttributes(validator, Type.INVALID_ATTRIBUTE_VALUE, new AttributesImpl(
        "a1", "v1",
        "a2", "v1"));
    checkAttributes(validator, Type.MISSING_REQUIRED_ATTRIBUTE, new AttributesImpl(
        "a2", "v2"));
    checkAttributes(validator, Type.MISSING_REQUIRED_ATTRIBUTE, new AttributesImpl(
        "a1", "v1"));
    checkAttributes(validator, Type.ATTRIBUTE_NOT_ALLOWED, new AttributesImpl(
        "a1", "v1",
        "a2", "v2",
        "bad", "bad"));
    checkUpdate(validator, Type.VALID, AttributesUpdateImpl.EMPTY_MAP);
    checkUpdate(validator, Type.VALID, new AttributesUpdateImpl(
View Full Code Here

        Collections.<String>emptySet(),
        createValidators(
            "a1", "v1",
            "a2", "v2"));
    checkAttributes(validator, Type.VALID, AttributesImpl.EMPTY_MAP);
    checkAttributes(validator, Type.VALID, new AttributesImpl(
        "a1", "v1",
        "a2", "v2"));
    checkAttributes(validator, Type.INVALID_ATTRIBUTE_VALUE, new AttributesImpl(
        "a1", "v2",
        "a2", "v2"));
    checkAttributes(validator, Type.INVALID_ATTRIBUTE_VALUE, new AttributesImpl(
        "a1", "v1",
        "a2", "v1"));
    checkAttributes(validator, Type.VALID, new AttributesImpl(
        "a2", "v2"));
    checkAttributes(validator, Type.VALID, new AttributesImpl(
        "a1", "v1"));
    checkAttributes(validator, Type.ATTRIBUTE_NOT_ALLOWED, new AttributesImpl(
        "a1", "v1",
        "a2", "v2",
        "bad", "bad"));
    checkUpdate(validator, Type.VALID, AttributesUpdateImpl.EMPTY_MAP);
    checkUpdate(validator, Type.VALID, new AttributesUpdateImpl(
View Full Code Here

        toSet("a1"),
        createValidators(
            "a1", "v1",
            "a2", "v2"));
    checkAttributes(validator, Type.MISSING_REQUIRED_ATTRIBUTE, AttributesImpl.EMPTY_MAP);
    checkAttributes(validator, Type.VALID, new AttributesImpl(
        "a1", "v1",
        "a2", "v2"));
    checkAttributes(validator, Type.INVALID_ATTRIBUTE_VALUE, new AttributesImpl(
        "a1", "v2",
        "a2", "v2"));
    checkAttributes(validator, Type.INVALID_ATTRIBUTE_VALUE, new AttributesImpl(
        "a1", "v1",
        "a2", "v1"));
    checkAttributes(validator, Type.MISSING_REQUIRED_ATTRIBUTE, new AttributesImpl(
        "a2", "v2"));
    checkAttributes(validator, Type.VALID, new AttributesImpl(
        "a1", "v1"));
    checkAttributes(validator, Type.ATTRIBUTE_NOT_ALLOWED, new AttributesImpl(
        "a1", "v1",
        "a2", "v2",
        "bad", "bad"));
    checkUpdate(validator, Type.VALID, AttributesUpdateImpl.EMPTY_MAP);
    checkUpdate(validator, Type.VALID, new AttributesUpdateImpl(
View Full Code Here

  private void createEntry(WaveletId waveletId) {
    String waveletIdStr = WaveletBasedConversation.idFor(waveletId);
    ObservableMutableDocument<? super E, E, ?> doc = getDocument();
    E container =
        doc.createChildElement(doc.getDocumentElement(), WaveletBasedSupplement.CONVERSATION_TAG,
            new AttributesImpl(WaveletBasedSupplement.ID_ATTR, waveletIdStr));
  }
View Full Code Here

  }

  private void createEntry(String gadgetId) {
    getDocument().createChildElement(getDocument().getDocumentElement(),
        WaveletBasedSupplement.GADGET_TAG,
        new AttributesImpl(WaveletBasedSupplement.ID_ATTR, gadgetId));
  }
View Full Code Here

        if (textNode != null) {
          b.characters(substrate.getData(textNode));
        } else {
          E elementNode = substrate.asElement(node);
          b.elementStart(substrate.getTagName(elementNode),
              new AttributesImpl(substrate.getAttributes(elementNode)));
          depth++;
        }
      } else {
        // To avoid the sentinel
        depth--;
View Full Code Here

      didSomethingOtherThanDeletionSinceAnnotationBoundary = true;

      beginUpdate();

      E node = substrate.asElement(currentContainer.getValue());
      Attributes oldAttributes = new AttributesImpl(substrate.getAttributes(node));
      // Iterate over oldAttributes here, not attributeMap, since we are modifying
      // the map underlying the latter.
      for (Map.Entry<String, String> attribute : oldAttributes.entrySet()) {
        String key = attribute.getKey();
        if (!newAttrs.containsKey(key)) {
          substrate.removeAttribute(node, attribute.getKey());
        }
      }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.impl.AttributesImpl

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.