Examples of FocusedRange


Examples of org.waveprotocol.wave.model.document.util.FocusedRange

    insert(1, 7);
    undoManager.maybeCheckpoint(2, 2);
    insert(2, 8);

    undoManager.undo();
    assertEquals(new FocusedRange(2, 2), selectionHelper.getSelectionRange());
    assertEquals("<doc>ahello</doc>", XmlStringBuilder.innerXml(doc).toString());

    undoManager.maybeCheckpoint(3, 4);
    insert(3, 8);

    undoManager.undo();
    assertEquals(new FocusedRange(3, 4), selectionHelper.getSelectionRange());
    assertEquals("<doc>ahello</doc>", XmlStringBuilder.innerXml(doc).toString());

    undoManager.undo();
    assertEquals(new FocusedRange(1, 1), selectionHelper.getSelectionRange());
    assertEquals("<doc>hello</doc>", XmlStringBuilder.innerXml(doc).toString());

    responsibility.endDirectSequence();
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

    responsibility.endDirectSequence();
  }

  public void testUndoWithNoCheckpoints() {
    undoManager.undo();
    assertEquals(new FocusedRange(0, 0), selectionHelper.getSelectionRange());
    assertEquals("<doc>hello</doc>", XmlStringBuilder.innerXml(doc).toString());
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

    insert(3, 9);

    undoManager.undo();

    assertEquals(new FocusedRange(0), selectionHelper.getSelectionRange());
    assertEquals("<doc>haaello</doc>", XmlStringBuilder.innerXml(doc).toString());
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

    undoManager.maybeCheckpoint(1, 1);
    insert(1, 7);
    undoManager.maybeCheckpoint(2, 2);
    insert(2, 8);

    FocusedRange oldSelection = selectionHelper.getSelectionRange();
    undoManager.undo();
    assertEquals(new FocusedRange(2, 2), selectionHelper.getSelectionRange());
    assertEquals("<doc>ahello</doc>", XmlStringBuilder.innerXml(doc).toString());

    undoManager.redo();
    assertEquals(oldSelection, selectionHelper.getSelectionRange());
    assertEquals("<doc>aahello</doc>", XmlStringBuilder.innerXml(doc).toString());

    selectionHelper.setSelectionRange(new FocusedRange(5));
    undoManager.undo();
    assertEquals(new FocusedRange(2, 2), selectionHelper.getSelectionRange());
    assertEquals("<doc>ahello</doc>", XmlStringBuilder.innerXml(doc).toString());
    responsibility.endDirectSequence();

    insert(1, 8);

    undoManager.redo();
    assertEquals(new FocusedRange(6), selectionHelper.getSelectionRange());
    assertEquals("<doc>aaahello</doc>", XmlStringBuilder.innerXml(doc).toString());

    undoManager.redo();
    assertEquals(new FocusedRange(6), selectionHelper.getSelectionRange());
    assertEquals("<doc>aaahello</doc>", XmlStringBuilder.innerXml(doc).toString());
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

  public FocusedRange getSelectionRange() {
    FocusedContentRange contentRange = getSelectionPoints();
    if (contentRange == null) {
      return null;
    }
    return new FocusedRange(
        mapper.getLocation(contentRange.getAnchor()),
        mapper.getLocation(contentRange.getFocus())
    );
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

    );
  }

  @Override
  public Range getOrderedSelectionRange() {
    FocusedRange selection = getSelectionRange();
    return selection != null ? selection.asRange() : null;
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

      }
    }

    // TODO(user): investigate the cause of the loop.
    if (savedSelection != null) {
      FocusedRange range = new FocusedRange(mapper.getLocation(anchor), mapper.getLocation(focus));
      savedSelection.trackRange(range);
    }
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

   * selection setting methods, but they are four different versions so the code
   * would be somewhat uglier. Do it if speed becomes a problem.
   */
  private void saveSelection() {
    if (savedSelection != null) {
      FocusedRange range = getSelectionRange();
      if (range != null) {
        savedSelection.trackRange(range);
      }
    }
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

public class DocumentFreeSelectionHelper implements SelectionHelper {
  /** Track the simple range directly. */
  FocusedRange selection = null;

  public DocumentFreeSelectionHelper(int start, int end) {
    selection = new FocusedRange(start, end);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.util.FocusedRange

   * @param editorDiv editor
   * @param end end of selection range
   */
  public static void webdriverEditorSetSelection(Element editorDiv, int start, int end) {
    EditorContext editor = getByEditorDiv(editorDiv);
    editor.getSelectionHelper().setSelectionRange(new FocusedRange(start, end));
  }
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.