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

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


    return stringListToJSO(getDataNames(), caja);
  }

  public String getData(String name) {
    Preconditions.checkNotNull(name, "Name of data values may not be null");
    ContentElement nameValuePair = doFindNameValuePair(name);
    if (nameValuePair == null) {
      return null;
    }
    return nameValuePair.getAttribute(HtmlTemplate.NAMEVALUEPAIR_VALUE_ATTR);
  }
View Full Code Here


  }

  public void putData(String name, String value) {
    Preconditions.checkNotNull(name, "Name of data values may not be null");
    if (value == getData(name) || (value != null && value.equals(getData(name)))) { return; }
    ContentElement nameValuePair = doFindNameValuePair(name);
    if (value == null && nameValuePair != null) {
      htmlTemplateElement.getMutableDoc().deleteNode(nameValuePair);
    } else {
      if (nameValuePair == null) {
        doAddNameValuePair(name, value);
View Full Code Here

  public JavaScriptObject getPartIdentifiersJSO() {
    return stringListToJSO(getPartIdentifiers(), caja);
  }

  public Element getPartRendering(String id) {
    ContentElement part = doFindPart(id);
    if (part == null) { return null; }
    return part.getImplNodelet();
  }
View Full Code Here

    return id;
  }

  public void removePart(String id) {
    Preconditions.checkNotNull(id, "Identifier of part rendering may not be null");
    ContentElement part = doFindPart(id);
    if (part != null) {
      htmlTemplateElement.getMutableDoc().deleteNode(part);
    }
  }
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

    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

     * 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

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.