Examples of FocusedRange


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

   *
   * @return false if the editor has no selection, or the selection is
   *         collapsed.
   */
  public static boolean hasRangeSelected(ContentDocument doc) {
    FocusedRange range = createSelectionHelper(doc).getSelectionRange();
    return range == null ? false : !range.isCollapsed();
  }
View Full Code Here

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

   * @return (copy of) range transformed against modifier
   */
  public static FocusedRange applyModifier(DocOp modifier, FocusedRange range) {
    int anchor = LocationModifier.transformLocation(modifier, range.getAnchor());
    int focus  = LocationModifier.transformLocation(modifier, range.getFocus());
    return new FocusedRange(anchor, focus);
  }
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

    }
  }

  @Override
  public void maybeCheckpoint(int startLocation, int endLocation) {
    pendingCheckpoint = new FocusedRange(startLocation, endLocation);
  }
View Full Code Here

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

    DocOp undo = pair.first;
    DocOp transformedNonUndoable = pair.second;

    {
      FocusedRange selection = selectionHelper.getSelectionRange();

      if (selection != null) {
        redoSelectionStack.push(selection);
      } else {
        redoSelectionStack.push(UNKNOWN_SELECTION);
View Full Code Here

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

    DocOp redo = pair.first;
    DocOp transformedNonUndoable = pair.second;

    {
      FocusedRange selection = selectionHelper.getSelectionRange();

      if (selection != null) {
        undoSelectionStack.push(selection);
      } else {
        undoSelectionStack.push(UNKNOWN_SELECTION);
View Full Code Here

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

    if (selectionStack.isEmpty()) {
      logger.log(Level.ERROR,
          "SelectionStack empty! This probably shouldn't be reached, but we can live with it.");
      return null;
    }
    FocusedRange selection = selectionStack.pop();
    if (selection == UNKNOWN_SELECTION) {
      logger.log(Level.TRACE, "unknown selection");
      return null;
    } else {
      if (transformedNonUndoable != null) {
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.