Examples of FocusedContentRange


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

    final Point<ContentNode> start =
        Point.<ContentNode> end(newParaElement());
    final Point<ContentNode> end =
        Point.<ContentNode> end(newParaElement());

    FocusedContentRange selection = new FocusedContentRange(start, end);
    ContentRange range = selection.asOrderedRange(true);
    FakeEditorInteractor interactor = setupFakeEditorInteractor(selection);
    FakeEditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);

    subHandler.call(FakeEditorEventsSubHandler.HANDLE_COMMAND).nOf(1).withArgs(editorEvent)
View Full Code Here

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

  private void testNonCharacterMoveUnitIsCancelledHelper(EditorEvent event, boolean backspace) {
    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());

    FocusedContentRange selection = new FocusedContentRange(caret);
    FakeEditorInteractor interactor = setupFakeEditorInteractor(selection);
    FakeEditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);

    if (backspace) {
View Full Code Here

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

   * Test that paste events are routed correctly.
   */
  public void testRoutePasteEvent() {
    final Point<ContentNode> caret =
      Point.<ContentNode> end(newParaElement());
    FocusedContentRange selection = new FocusedContentRange(caret);

    FakeEditorEvent pasteEvent = FakeEditorEvent.createPasteEvent();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(selection);
    FakeEditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);
View Full Code Here

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

    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());

    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
    EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);

    interactor.call(FakeEditorInteractor.COMPOSITION_START).nOf(1);
    interactor.call(FakeEditorInteractor.COMPOSITION_UPDATE).nOf(2);
    interactor.call(FakeEditorInteractor.COMPOSITION_END).nOf(1);
View Full Code Here

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

      // Uncomment for verbose debugging
      // if (Debug.isOn(LogSeverity.DEBUG)) {
      //   logger.logXml("SELECTION: " + start + " - " + end);
      // }

      FocusedContentRange ret = range.isCollapsed()
          ? new FocusedContentRange(anchor) : new FocusedContentRange(anchor, focus);

      if (needsCorrection && ret != null) {
        setSelectionPoints(ret.getAnchor(), ret.getFocus());
      }

      return ret;
    } finally {
      needsCorrection = false;
View Full Code Here

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

    }
  }

  @Override
  public ContentRange getOrderedSelectionPoints() {
    FocusedContentRange selection = getSelectionPoints();
    return selection == null ? null : selection.asOrderedRange(NativeSelectionUtil.isOrdered());
  }
View Full Code Here

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

    return selection == null ? null : selection.asOrderedRange(NativeSelectionUtil.isOrdered());
  }

  /** {@inheritDoc} */
  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.client.editor.content.FocusedContentRange

    if (keySignalType == KeySignalType.DELETE) {
      refreshEditorWithCaret(event);
      caret = cachedSelection.getFocus();
      ContentNode node = caret.getContainer();

      editorInteractor.checkpoint(new FocusedContentRange(caret));

      switch (EventWrapper.getKeyCombo(event)) {
        case BACKSPACE:
        case SHIFT_BACKSPACE:
          editorInteractor.rebiasSelection(CursorDirection.FROM_RIGHT);
View Full Code Here

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

    // TODO(danilatos): This is still a slight anomaly, to call a
    // node.handleXYZ method here.
    if (event.isOnly(KeyCodes.KEY_ENTER)) {
      refreshEditorWithCaret(event);
      caret = event.getCaret().asPoint();
      editorInteractor.checkpoint(new FocusedContentRange(caret));
      router.handleEnter(caret.getContainer(), event);
      editorInteractor.rebiasSelection(CursorDirection.FROM_LEFT);
      return true;
    } else if (event.isCombo(KeyCodes.KEY_ENTER, KeyModifier.SHIFT)) {
      // shift+enter inserts a "newline" (such as a <br/>) by default
View Full Code Here

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

                /*
                 * From UploadToolbarAction in Walkaround
                 * @author hearnden@google.com (David Hearnden)
                 */
                CMutableDocument doc = editor.getDocument();
                FocusedContentRange selection = editor.getSelectionHelper().getSelectionPoints();
                Point<ContentNode> point;
                if (selection != null) {
                  point = selection.getFocus();
                } else {
                  // Focus was probably lost.  Bring it back.
                  editor.focus(false);
                  selection = editor.getSelectionHelper().getSelectionPoints();
                  if (selection != null) {
                    point = selection.getFocus();
                  } else {
                    // Still no selection.  Oh well, put it at the end.
                    point = doc.locate(doc.size() - 1);
                  }
                }
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.