Package org.waveprotocol.wave.client.editor.content

Examples of org.waveprotocol.wave.client.editor.content.ContentDocument


    for (int i = 0; i < SIZE; i++) {
      builder.elementStart("line", Attributes.EMPTY_MAP).elementEnd();
    }
    builder.elementEnd();

    content1 = new ContentDocument(ConversationSchemas.BLIP_SCHEMA_CONSTRAINTS);
    content1.setRegistries(Editor.ROOT_REGISTRIES);
    content1.consume(builder.build());
    doc1 = content1.getMutableDoc();

    content2 = new ContentDocument(ConversationSchemas.BLIP_SCHEMA_CONSTRAINTS);
    content2.setRegistries(Editor.ROOT_REGISTRIES);
    content2.consume(builder.build());
    doc2 = content2.getMutableDoc();

    doc = doc1;
View Full Code Here


  public String getModuleName() {
    return "org.waveprotocol.wave.client.editor.impl.Tests";
  }

  public void testFindsTextNodeWrapperNormally() throws HtmlInserted, HtmlMissing {
    ContentDocument dom = TestEditors.createTestDocument();
    c = dom.debugGetRawDocument();
    ContentElement root = c.getDocumentElement();
    m = dom.getContext().rendering().getNodeManager();

    String s1 = "some text", s2 = "other writings", s3 = "more information";

    // t1
    ContentTextNode t1 = c.createTextNode(s1, root, null);
View Full Code Here

    checkWrapper(t1, n1);

  }

  public void testRepairsWherePossible() throws HtmlInserted, HtmlMissing {
    ContentDocument dom = TestEditors.createTestDocument();
    c = dom.debugGetRawDocument();
    ContentElement root = c.getDocumentElement();
    m = dom.getContext().rendering().getNodeManager();

    // TODO(danilatos): Expand this and other test cases

    String s1 = "some text", s2 = "other writings", s3 = "more information";
    ContentTextNode t1 = c.createTextNode(s1, root, null);
View Full Code Here

  public void testThrowsExceptionsWhenNecessary() {
    //TODO(danilatos)
  }

  public void testWrapperElementPointToNodeletPoint() {
    ContentDocument dom = TestEditors.createTestDocument();
    c = dom.debugGetRawDocument();

    ContentElement root = c.getDocumentElement();
    m = dom.getContext().rendering().getNodeManager();

    Element rootNodelet = root.getImplNodelet();
    // meta element, null impl nodelet
    ContentElement n1 = c.createElement("m", root, null);
    n1.setImplNodelets(null, null);
View Full Code Here

    StyleAnnotationHandler.register(registries);
  }

  /** For testing purposes only. */
  public static ContentDocument createTestDocument() {
    ContentDocument doc = new ContentDocument(DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    Registries registries = Editor.ROOT_REGISTRIES.createExtension();
    for (String t : new String[] {"q", "a", "b", "c", "x"}) {
      final String tag = t;
      registries.getElementHandlerRegistry().registerRenderer(tag,
          new Renderer() {
            @Override
            public Element createDomImpl(Renderable element) {
              return element.setAutoAppendContainer(Document.get().createElement(tag));
            }
          });
    }
    doc.setRegistries(registries);
    Editor editor = getMinimalEditor();
    editor.setContent(doc);
    return doc;
  }
View Full Code Here

  }

  @Override
  public void setContent(final DocInitialization op, DocumentSchema schema) {
    Preconditions.checkState(ownsDocument, "Can not replace content not owned");
    setContent(new ContentDocument(registries, op, schema));
  }
View Full Code Here

    return content;
  }

  @Override
  public ContentDocument removeContent() {
    ContentDocument oldDoc = content;

    clearContent();

    if (ownsDocument) {
      oldDoc.setRendering();
      oldDoc.replaceOutgoingSink(SilentOperationSink.Void.get());
    } else {
      oldDoc.setInteractive();
    }

    // TODO(danilatos): Clear all the stuff initialised in setContent()
    return oldDoc;
  }
View Full Code Here

    return oldDoc;
  }

  @Override
  public ContentDocument removeContentAndUnrender() {
    ContentDocument oldDoc = content;

    clearContent();
    oldDoc.setShelved();

    return oldDoc;
  }
View Full Code Here

            ? nodeManager.findElementWrapper(Element.as(rawEvent.getEventTarget())) : null;
        if (el == null) {
          repairListener.onFullDocumentRevert(mutable());

          // Destroy all rendering
          ContentDocument savedDoc = removeContent();
          savedDoc.setShelved();

          // Re-insert document to re-render from scratch
          setContent(savedDoc);

          repairer.flashShowRepair(full().getDocumentElement());
View Full Code Here

   */
  // Type conversion with flattened generics in setDelegate();
  @SuppressWarnings("unchecked")
  private void loadWith(Registries registries) {
    assert !isLoaded() : "already loaded";
    ContentDocument core = new ContentDocument(DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    document = DiffContentDocument.create(core);
    if (outputSink != null) {
      core.setOutgoingSink(outputSink);
    }
    core.setRegistries(registries);
    setDelegate((MutableDocument) core.getMutableDoc());
    if (spec != null) {
      spec.applyTo(document);
      spec = null;
    }
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.content.ContentDocument

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.