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

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


        ImageThumbnail.register(registries.getElementHandlerRegistry(), attachmentManager,
            new ThumbnailActionHandler() {
          @Override
          public boolean onClick(ImageThumbnailWrapper thumbnail) {
            ContentElement e = thumbnail.getElement();
            String newId = Window.prompt("New attachment id, or 'remove' to remove the attribute",
                e.getAttribute(ImageThumbnail.ATTACHMENT_ATTR));

            if (newId == null) {
              // They hit escape
              return true;
            }

            if ("remove".equals(newId)) {
              newId = null;
            }

            e.getMutableDoc().setElementAttribute(e, ImageThumbnail.ATTACHMENT_ATTR, newId);
            return true;
          }
        });

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

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

    /**
     * Notifies parent that this events node has changed, if parent implements
     */
    private void onContentEventsChanged(ContentElement element) {
      ContentElement parent = element.getParentElement();
      // TODO(user): Notify parent if parent cares.
    }
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

    this.replacementRangeHelper = getOrCreateRangeTracker(documentContext);
   }

  private RangeTracker getOrCreateRangeTracker(
      DocumentContext<ContentNode, ContentElement, ContentTextNode> context) {
    ContentElement docElement = context.document().getDocumentElement();
    RangeTracker ret =
        docElement.getProperty(LINK_RANGE_TRACKER_PROP);

    if (ret == null) {
      ret = new RangeTracker(context.localAnnotations(), CURRENT_LINK_DEBUG_ID);
      docElement.setProperty(LINK_RANGE_TRACKER_PROP, ret);
    }
    return ret;
  }
View Full Code Here

  public void cleanup(ContentElement e, Attachment a) {
    doodads.remove(a);
  }

  private ContentElement getElement(Attachment c) {
    ContentElement e = doodads.get(c);
    if (e != null) {
      if (!e.isContentAttached()) {
        // Lazy removal. Perhaps do it from the node mutation event handler?
        doodads.remove(c);
      } else {
        return e;
      }
View Full Code Here

    return null;
  }

  @Override
  public void onContentUpdated(Attachment c) {
    ContentElement e = getElement(c);
    // TODO(nigeltao): can e ever be null?
    if (e == null) {
      return;
    }
View Full Code Here

    }
  }

  @Override
  public void onThumbnailUpdated(Attachment c) {
    ContentElement e = getElement(c);
    if (e == null) {
      return;
    }

    if (c.isMalware()) {
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.