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

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


  /** 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

    Point<ContentNode> point = DocHelper.ensureNodeBoundary(
        DocHelper.transparentSlice(location, cxt),
        cxt.annotatableContent(), cxt.textNodeOrganiser());

    // NOTE(danilatos): Needed as a workaround to bug 2152316
    ContentElement container = point.getContainer().asElement();
    ContentNode nodeAfter = point.getNodeAfter();
    if (nodeAfter != null) {
      container = nodeAfter.getParentElement();
    }
    ////
View Full Code Here

    if (event.isMouseEvent()) {
      // Flush because the selection location may have changed to somewhere
      // else in the same text node. We MUST handle mouse down events for
      // this.
      editorInteractor.forceFlush();
      ContentElement node = editorInteractor.findElementWrapper(event.getTarget());
      event.setCaret(new ContentPoint(node, null));
      if (node != null && event.isClickEvent()) {
        router.handleClick(node, event);
        editorInteractor.clearCaretAnnotations();
        editorInteractor.rebiasSelection(CursorDirection.NEUTRAL);
View Full Code Here

        // using the client after it shinies, and some clients using the editor might
        // have a different uncaught exception behaviour.
        EditorStaticDeps.logger.error().log("Repairing: " + e);

        // TODO(danilatos): This is a bit coarse, do more accurate/user friendly handling
        ContentElement el = Element.is(rawEvent.getEventTarget())
            ? nodeManager.findElementWrapper(Element.as(rawEvent.getEventTarget())) : null;
        if (el == null) {
          repairListener.onFullDocumentRevert(mutable());

          // Destroy all rendering
          ContentDocument savedDoc = removeContent();
          savedDoc.setShelved();

          // Re-insert document to re-render from scratch
          setContent(savedDoc);

          repairer.flashShowRepair(full().getDocumentElement());
        } else {
          repairer.revert(
              Point.inElement(el, el.getFirstChild()),
              Point.inElement(el, (ContentNode)null));
        }

        rawEvent.preventDefault();
      } finally {
View Full Code Here

  }

  private void scheduleElementForRevert(Element e) {
    // We get the back reference of the target's parent, because even if this
    // element is just inserted, the parent should have a corresponding content node.
    final ContentElement content = NodeManager.getBackReference(e);
    if (content == null) {
      return;
    }

    Iterator<ContentElement> i = toRevert.iterator();
    while (i.hasNext()) {
      ContentElement current = i.next();
      if (isAncestorOf(current, content)) {
        // Ancestor has already been scheduled for revert, we can return early.
        return;
      } else if (isAncestorOf(content, current)){
        // We no longer need to revert his node, as we will revert the ancestor
View Full Code Here

TOP

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

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.