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

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


        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();
    FakeRouter router = new FakeRouter();
    EditorEventHandler handler = new EditorEventHandler(new FakeTimerService(),
        interactor, subHandler, router, cancelNonWhitelistedCombos, true);
View Full Code Here


      boolean isHandledCommand, boolean isHandledBlockLevelCommand) {
    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());

    FocusedContentRange selection = new FocusedContentRange(caret);
    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(tabSignal).returns(
View Full Code Here

        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

    Button insertXmlButton = new Button("Insert");
    insertXmlButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        editor.focus(true);
        ContentRange selection = editor.getSelectionHelper().getOrderedSelectionPoints();
        if (selection == null) {
          errorLabel.setText("Don't know where to insert this");
          return;
        }

        XmlStringBuilder xml;
        try {
           xml = XmlStringBuilder.innerXml(DocProviders.POJO.parse(contentInput.getText()));
        } catch (RuntimeException e) {
          errorLabel.setText("Ill formed XML");
          return;
        }

        try {
          editor.getDocument().insertXml(selection.getSecond(), xml);
          errorLabel.setText("");
        } catch (RuntimeException e) {
          errorLabel.setText("Invalid XML: " + e.getMessage());
        }
      }
View Full Code Here

   * @return true to cancel browser's default, false otherwise. Generally, we'd
   *         only cancel if we cannot paste, i.e. selection not known
   */
  public boolean handlePasteEvent(final BiasDirection cursorBias) {
    // TODO(danilatos): Handle non-collapsed ranges
    final ContentRange previousSelection = aggressiveSelectionHelper.getOrderedSelectionPoints();

    // Selection shouldn't be null here, but its unsafe to make that assumption.
    // Cancel paste if we don't have selection.
    if (previousSelection == null) {
      return true;
View Full Code Here

   *
   * @return true to cancel if the event should be cancelled.
   */
  public boolean handleCopyOrCutEvent(HtmlSelectionHelper selectionHelper, final boolean isCut) {
    // First gather the selection.
    final ContentRange contentSelection =
        aggressiveSelectionHelper.getOrderedSelectionPoints();

    if (contentSelection == null) {
      return true;
    }
View Full Code Here

    // is with respect to the current document state, out of which there may be
    // operations that have not yet been extracted by the typing extractor. The
    // problem is that we can't always safely force the typing extractor to
    // extract out those operations. Therefore, we assume that most of the time,
    // doodads are inserted via selection on a non-editing document.
    ContentRange selectionPoints = createSelectionHelper(content).getOrderedSelectionPoints();
    CMutableDocument document = content.getMutableDoc();
    ContentView view = content.getPersistentView();
    return DocumentUtil.getLocationNearSelection(document, view, selectionPoints);
  }
View Full Code Here

   * @return true to cancel browser's default, false otherwise. Generally, we'd
   *         only cancel if we cannot paste, i.e. selection not known
   */
  public boolean handlePasteEvent(final BiasDirection cursorBias) {
    // TODO(danilatos): Handle non-collapsed ranges
    final ContentRange previousSelection = aggressiveSelectionHelper.getOrderedSelectionPoints();

    // Selection shouldn't be null here, but its unsafe to make that assumption.
    // Cancel paste if we don't have selection.
    if (previousSelection == null) {
      return true;
View Full Code Here

   *
   * @return true to cancel if the event should be cancelled.
   */
  public boolean handleCopyOrCutEvent(HtmlSelectionHelper selectionHelper, final boolean isCut) {
    // First gather the selection.
    final ContentRange contentSelection =
        aggressiveSelectionHelper.getOrderedSelectionPoints();

    if (contentSelection == null) {
      return true;
    }
View Full Code Here

    Button insertXmlButton = new Button("Insert");
    insertXmlButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        editor.focus(true);
        ContentRange selection = editor.getSelectionHelper().getOrderedSelectionPoints();
        if (selection == null) {
          errorLabel.setText("Don't know where to insert this");
          return;
        }

        XmlStringBuilder xml;
        try {
           xml = XmlStringBuilder.innerXml(DocProviders.POJO.parse(contentInput.getText()));
        } catch (RuntimeException e) {
          errorLabel.setText("Ill formed XML");
          return;
        }

        try {
          editor.getDocument().insertXml(selection.getSecond(), xml);
          errorLabel.setText("");
        } catch (RuntimeException e) {
          errorLabel.setText("Invalid XML: " + e.getMessage());
        }
      }
View Full Code Here

TOP

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

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.