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

Examples of org.waveprotocol.wave.client.editor.content.ContentElement$Action


      // HACK(danilatos): I had to patch MenuBar to make this method public.
      // Getting more and more tempting to write own menu class...
      // Calling this makes the first item in the menu selected by default,
      // so just pressing enter will choose it.
      menu.moveSelectionDown();
      ContentElement element = suggestable.getSuggestionElement();

      popupAnchor = element.getImplNodelet();
      // If savedSelection is null, it should be the first time we are showing a popup (not moving
      // around). So, we save the selection because it becomes null later when we lose focus,
      // at least in IE.
      if (savedSelection == null) {
        savedSelection = selectionHelper.getSelectionRange();
View Full Code Here


  @Override
  protected ContentElement maybePlaceMissingCursorContainer(Point.El<ContentNode> at) {
    logger.error().log("PROBLEM: Had to create a line container to accommodate the cursor!");

    ContentElement line = null;
    if (!LineContainers.isLineContainer(FullContentView.INSTANCE, at.getContainer())) {
      // create line container and line atomically:
      line = LineContainers.appendLine(mutableDocument, null, Attributes.EMPTY_MAP);
    } else {
      line = LineContainers.appendLine(mutableDocument, (ContentElement) at.getContainer(), null);
    }
    // return the local p element as the target for the cursor:
    ContentElement inserted = Line.fromLineElement(line).getParagraph();
    needsCorrection = true;
    return inserted;
  }
View Full Code Here

  @VisibleForTesting
  Point<ContentNode> findOrCreateValidSelectionPoint(Point.El<ContentNode> point) {
    // TODO(patcoleman): refactor this into cleaner code - possible separating find and create.
    ValidSelectionContainerView validContainerView =
      new ValidSelectionContainerView(renderedContentView);
    ContentElement container = (ContentElement) point.getContainer();
    assert renderedContentView.getVisibleNode(container) == container : "Container: " + container;

    // Valid position for cursor, so stop where we are:
    if (!isKnownInvalidTopContainerForCursor(container)) {
      return point;
View Full Code Here

    return null;
  }

  /** {@inheritDoc} */
  public Point<ContentNode> getFirstValidSelectionPoint() {
    ContentElement root = renderedContentView.getDocumentElement();
    // Must use filtered view, because of assertion in findOrCreateValidSelectionPoint
    ContentNode first = renderedContentView.getFirstChild(root);

    // assert there's no transparent wrapper, which would render the point invalid
    // for many uses
View Full Code Here

  /** Private constructor, build through the static factory instead to ensure correct product. */
  private ValidSelectionStrategy() {}

  @Override
  public Skip resolveSkip(ContentNode node, Skip[] skipLevels) {
    ContentElement elt = node.asElement();
    if (elt == null) {
      return Skip.NONE; // selection ok in text node
    }

    boolean isRendered = (skipLevels[RENDERED_INDEX] == Skip.NONE);
View Full Code Here

     * Handles a left arrow that occurred with the caret immediately
     * after this node, by moving caret to end of caption
     */
    @Override
    public boolean handleLeftAfterNode(ContentElement element, EditorEvent event) {
      ContentElement caption = getCaption(element);

      if (caption != null) {
        // If we have a caption, move the selection into the caption
        element.getSelectionHelper().setCaret(
            Point.<ContentNode> end(getCaption(element)));
View Full Code Here

    /**
     * Similar to {@link #handleLeftAfterNode(ContentElement, EditorEvent)}
     */
    @Override
    public boolean handleRightBeforeNode(ContentElement element, EditorEvent event) {
      ContentElement caption = getCaption(element);

      if (caption != null) {
        // If we have a caption, move the selection into the caption
        element.getSelectionHelper().setCaret(
            Point.start(element.getRenderedContentView(), caption));
View Full Code Here

  /**
   * Sets the caption text of this doodad.
   */
  public void setCaptionText(String text) {
    CMutableDocument doc = element.getMutableDoc();
    ContentElement caption = DocHelper.getElementWithTagName(doc, Caption.TAGNAME, element);
    if (caption != null) {
      doc.emptyElement(caption);
      doc.insertText(Point.<ContentNode> end(caption), text);
    }
  }
View Full Code Here

    Element parentNodelet = filteredHtml.getParentElement(target);
    if (parentNodelet == null) {
      throw new RuntimeException(
          "Somehow we are asking for the wrapper of something not in the editor??");
    }
    ContentElement parentElement = NodeManager.getBackReference(parentNodelet);

    // Find our foothold in wrapper land
    if (nodeletBeforeTextNodes == null) {
      // reached the beginning
      wrapperBeforeTextNodes = null;
View Full Code Here

    } else {
      nodeletAfter = point.getNodeAfter().getImplNodeletRightwards();
    }

    if (nodeletAfter == null) {
      ContentElement visibleNode = renderedContentView.getVisibleNode(
          point.getContainer()).asElement();
      assert visibleNode != null;

      Element el = visibleNode.getContainerNodelet();
      return el != null ? Point.<Node>inElement(el, null) : null;
    } else {
      Node parentNode = nodeletAfter.getParentNode();
      // NOTE(danilatos): Instead, getImplNodeletRightwards(), (or the use of
      // some other utility method) should probably instead be guaranteeing nodeletAfter
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.content.ContentElement$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.