Package org.waveprotocol.wave.model.document.MutableDocument

Examples of org.waveprotocol.wave.model.document.MutableDocument.Action


    return doc.getNextSibling(line);
  }

  public static void properAppendLine(final MutableDocument<?, ?, ?> doc,
      final XmlStringBuilder content) {
    doc.with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        appendLine(doc, content);
      }
    });
View Full Code Here


   *
   * @return thread ids and their anchor locations
   */
  private Map<String, Integer> findAnchors() {
    final Map<String, Integer> anchors = CollectionUtils.newHashMap();
    blip.getContent().with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        for (E el : DocIterate.deepElements(doc, doc.getDocumentElement(), null)) {
          if (Blips.THREAD_INLINE_ANCHOR_TAGNAME.equals(doc.getTagName(el))) {
            String threadId = doc.getAttribute(el,
View Full Code Here

   *
   * @param threadId id of the reply thread
   * @param location location at which to insert anchor
   */
  private void createInlineReplyAnchor(final String threadId, final int location) {
    blip.getContent().with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        Point<N> point = doc.locate(location);
        doc.createElement(point, Blips.THREAD_INLINE_ANCHOR_TAGNAME,
            Collections.singletonMap(Blips.THREAD_INLINE_ANCHOR_ID_ATTR, threadId));
View Full Code Here

   * document.
   *
   * @param threadIds ids of the anchors to delete
   */
  private void clearInlineReplyAnchors(final Set<String> threadIds) {
    blip.getContent().with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        List<E> elementsToDelete = CollectionUtils.newArrayList();
        for (E el : DocIterate.deepElements(doc, doc.getDocumentElement(), null)) {
          if (Blips.THREAD_INLINE_ANCHOR_TAGNAME.equals(doc.getTagName(el))) {
View Full Code Here

  /**
   * Deletes all inline reply anchor elements from the blip document.
   */
  private void clearAllInlineReplyAnchors() {
    blip.getContent().with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        List<E> elementsToDelete = CollectionUtils.newArrayList();
        for (E el : DocIterate.deepElements(doc, doc.getDocumentElement(), null)) {
          if (Blips.THREAD_INLINE_ANCHOR_TAGNAME.equals(doc.getTagName(el))) {
View Full Code Here

   * Tests that WaveletBasedConversation does not die if an additional
   * conversation element is added to the manifest dynamically.
   */
  public void testDynamicAdditionOfExtraConversationElementDoesNotFail() {
    // target is currently listening to the manifest, so we only need to poke it.
    manifestDoc.with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        doc.createChildElement(doc.getDocumentElement(), DocumentBasedManifest.MANIFEST_TOP_TAG,
            Collections.<String, String>emptyMap());
      }
View Full Code Here

  /**
   * Tests that WaveletBasedConversation does not die if it is loaded on a
   * manifest document with multiple conversation elements.
   */
  public void testMultipleConversationElementsDoesNotPreventLoad() {
    manifestDoc.with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        doc.createChildElement(doc.getDocumentElement(), DocumentBasedManifest.MANIFEST_TOP_TAG,
            Collections.<String, String>emptyMap());
      }
View Full Code Here

    WaveletBasedConversationBlip firstReplyFirstBlip = firstReply.appendBlip();
    final WaveletBasedConversationThread secondReply = firstBlip.addReplyThread(
        BlipTestUtils.getBodyPosition(firstBlip) + 1);
    WaveletBasedConversationBlip secondReplyFirstBlip = secondReply.appendBlip();

    firstBlip.getContent().with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        int location = locateAfterLineElement(doc);
        Point<N> point = doc.locate(location);
        E element = doc.createElement(point, "reply",
            Collections.singletonMap("id", secondReply.getId()));
      }
    });

    // Clear attributes on the manifest since we're not interested in testing those.
    manifestDoc.with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        E top = DocHelper.getFirstChildElement(doc, doc.getDocumentElement());
        doc.setElementAttribute(top, "anchorBlip", null);
        doc.setElementAttribute(top, "anchorWavelet", null);
View Full Code Here

  /**
   * Test that we can cope with blips being added to the manifest but not to the
   * wavelet.
   */
  public void testAddingBlipMissingFromWavelet() {
    manifestDoc.with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        N rootThreadNode = doc.getFirstChild(doc.getDocumentElement());
        E rootThread = doc.asElement(rootThreadNode);
        doc.createChildElement(rootThread, "blip", Collections.singletonMap(
View Full Code Here

   * wavelet skips those blips.
   */
  public void testMissingBlipIteration() {
    WaveletBasedConversationThread thread = target.getRootThread();
    WaveletBasedConversationBlip first = thread.appendBlip();
    manifestDoc.with(new Action() {
      @Override
      public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) {
        N rootThreadNode = doc.getFirstChild(doc.getDocumentElement());
        E rootThread = doc.asElement(rootThreadNode);
        doc.createChildElement(rootThread, "blip", Collections.singletonMap(
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.MutableDocument.Action

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.