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

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


   * Test that handleLeft/Right are triggered on the correct node.
   */
  public void testHandleLeftRightTriggeredOnNode() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.NAVIGATION, KeyCodes.KEY_LEFT);
    FakeRouter router = new FakeRouter();
    ContentElement fakeContentElement = newElement();
    final Point<ContentNode> caret = Point.<ContentNode> end(fakeContentElement);

    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
    EditorEventHandler handler = createEditorEventHandler(router, interactor, subHandler);
View Full Code Here


    EditorEvent signal = FakeSignalEvent.createKeyPress(FakeEditorEvent.ED_FACTORY,
        KeySignalType.DELETE, isBackspace ? KeyCodes.KEY_BACKSPACE : KeyCodes.KEY_DELETE,
        isShiftDown ? EnumSet.of(KeyModifier.SHIFT) : null);

    FakeRouter router = new FakeRouter();
    ContentElement fakeContentElement = newElement();
    final Point<ContentNode> caret = Point.<ContentNode> end(fakeContentElement);

    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    EditorEventHandler handler = createEditorEventHandler(router, interactor, subHandler);
View Full Code Here

    editor.init(Editor.ROOT_REGISTRIES, KeyBindingRegistry.NONE, EditorSettings.DEFAULT);

    // seed editor and find image in content:
    ContentSerialisationUtil.setContentString(editor,
        "<body><line/><img src=\"imageSource\"></img></body>");
    ContentElement imgTag = editor.getDocument().getDocumentElement()
        .getFirstChild().getLastChild().getFirstChild().asElement();

    // check image in html:
    Element elt = imgTag.getImplNodelet();
    assertEquals("IMG", elt.getTagName().toUpperCase());
    assertEquals("imageSource", elt.getAttribute("src"));
  }
View Full Code Here

        move(hpoint(t1, 0)),
        type("abc"),
        bksp(3)
    );

    ContentElement b = c.createElement("b", root, null);
    runSimpleTest(
        move(hpoint(b, null)),
        type("abc"),
        bksp(3)
    );
View Full Code Here

  private String renderPasteHtml(Editor editor) {
    ReadableDocumentView<ContentNode, ContentElement, ContentTextNode> view =
        editor.getContent().getRenderedView();

    System.out.println("doc: " + XmlStringBuilder.innerXml(view).toString());
    ContentElement topLevelElement = view.getDocumentElement().getFirstChild().asElement();
    assertEquals(LineContainers.topLevelContainerTagname(), topLevelElement.getTagName());
    Point<ContentNode> start = Point.inElement(topLevelElement, topLevelElement.getFirstChild());
    Point<ContentNode> end = Point.<ContentNode> end(topLevelElement);

    Element fragment =
        PasteFormatRenderer.get().renderTree(view, topLevelElement,
            new SelectionMatcher(start, end));
View Full Code Here

  }

  public void testFindsTextNodeWrapperNormally() throws HtmlInserted, HtmlMissing {
    ContentDocument dom = TestEditors.createTestDocument();
    c = dom.debugGetRawDocument();
    ContentElement root = c.getDocumentElement();
    m = dom.getContext().rendering().getNodeManager();

    String s1 = "some text", s2 = "other writings", s3 = "more information";

    // t1
    ContentTextNode t1 = c.createTextNode(s1, root, null);
    Text n1 = t1.getImplNodelet();
    checkWrapper(t1, n1);

    // b1 t1
    ContentElement b1 = c.createElement("b", root, t1);
    checkWrapper(t1, n1);

    // b1 t1 b2
    ContentElement b2 = c.createElement("b", root, null);
    checkWrapper(t1, n1);
    Text n1b = n1.splitText(2);
    checkWrapper(t1, n1b);

    // b1 t1 t2 b2
View Full Code Here

  }

  public void testRepairsWherePossible() throws HtmlInserted, HtmlMissing {
    ContentDocument dom = TestEditors.createTestDocument();
    c = dom.debugGetRawDocument();
    ContentElement root = c.getDocumentElement();
    m = dom.getContext().rendering().getNodeManager();

    // TODO(danilatos): Expand this and other test cases

    String s1 = "some text", s2 = "other writings", s3 = "more information";
View Full Code Here

  public void testWrapperElementPointToNodeletPoint() {
    ContentDocument dom = TestEditors.createTestDocument();
    c = dom.debugGetRawDocument();

    ContentElement root = c.getDocumentElement();
    m = dom.getContext().rendering().getNodeManager();

    Element rootNodelet = root.getImplNodelet();
    // meta element, null impl nodelet
    ContentElement n1 = c.createElement("m", root, null);
    n1.setImplNodelets(null, null);

    // regular node
    ContentNode n2 = c.createElement("a", root, null);

    // basic check
View Full Code Here

    public boolean isTabTarget(ContentNode node) {
      if (node == null || node.asElement() == null) {
        return false;
      }
      ContentElement elem = node.asElement();
      String nodeTagName = elem.getTagName();
      return TAB_TARGETS.contains(nodeTagName);
    }
View Full Code Here

  }

  @Override
  public void showSuggestionsFor(HasSuggestions suggestable) {
    popupCloser.cancelScheduledClose();
    ContentElement element = suggestable.getSuggestionElement();
    // NOTE(user): If content is not attached, then at the moment, we don't
    // bring up any suggestions. In the future, we may decide to look for other
    // suggestions that are sufficiently near.
    if (element.isContentAttached()) {
      setCurrent(suggestables.getElement(element));
    }
  }
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.