Package org.waveprotocol.wave.client.editor

Examples of org.waveprotocol.wave.client.editor.EditorImpl$EditorEventsSubHandlerImpl


      extractor = local.debugGetPasteExtractor();
    }

    private EditorImpl createEditor() {
      EditorImpl editor = (EditorImpl) TestEditors.getMinimalEditor();
      return editor;
    }
View Full Code Here


      public void execute(EditorContext context) {
        callTracker++;
      }
    };
    bindings.registerAction(KeyCombo.ORDER_G, testAction);
    EditorImpl editor = createEditor(bindings);

    // 103 = g, this event = CTRL_G which is bound to ORDER_G by the EventWrapper
    Event rawEvent = Document.get().createKeyPressEvent(
        true, false, false, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action not called on registered keypress", callTracker, 1);
  }
View Full Code Here

      public void execute(EditorContext context) {
        callTracker++;
      }
    };
    bindings.registerAction(KeyCombo.ORDER_G, testAction);
    EditorImpl editor = createEditor(bindings);

    // This event is not ORDER_G, it has other accelerators thrown in.
    Event rawEvent = Document.get().createKeyPressEvent(
        true, true, true, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action called on unregistered keypress", callTracker, 0);
  }
View Full Code Here

        callTracker++;
      }
    };
    bindings.registerAction(KeyCombo.ORDER_G, testAction);

    EditorImpl editor = createEditor(bindings);
    Event rawEvent = Document.get().createKeyPressEvent(
        true, false, false, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    // callTracker should be 1 assuming the test above passes

    bindings.removeAction(KeyCombo.ORDER_G);
    initEditor(editor, Editor.ROOT_REGISTRIES, bindings);
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action called on deregistered keypress", callTracker, 1);
  }
View Full Code Here

    testHelper("<body><line t=\"li\"/><input>hello</input> world<line/>after</body>",
    "<ul><li><span>hello</span> world</li></ul>after<br>");
  }

  private void testHelper(String content, String expectedResult) {
    EditorImpl editor = (EditorImpl) Editors.create();
    RootPanel.get().add(editor);
    editor.init(Editor.ROOT_REGISTRIES, null, EditorSettings.DEFAULT);
    initWithContent(editor, content);
    String result = renderPasteHtml(editor);
    assertEquals(expectedResult, result);
    RootPanel.get().remove(editor);
  }
View Full Code Here

    boolean inconsistent = true;
    if (EditorTestingUtil.isConsistent(editor)) {
      if (editor instanceof EditorImpl) {
        // specialise for editor impls to have the behaviour of the document but no selection
        // if the editor is not consistent.
        EditorImpl ed = (EditorImpl)editor;
        Point<ContentNode> selStart = null;
        Point<ContentNode> selEnd = null;

        PointRange<Node> seln = ed.getOrderedHtmlSelection();
        try {
          selStart = seln == null ? null :
              ed.getNodeManager().nodeletPointToWrapperPoint(seln.getFirst());
          selEnd = seln == null ? null :
            ed.getNodeManager().nodeletPointToWrapperPoint(seln.getSecond());
          return new Pretty<ContentNode>().select(selStart, selEnd).print(
              editor.getContent().getFullContentView());
        } catch (HtmlInserted e) {
          // fall through to error case
        } catch (HtmlMissing e) {
View Full Code Here

    boolean inconsistent = true;
    if (EditorTestingUtil.isConsistent(editor)) {
      if (editor instanceof EditorImpl) {
        // specialise for editor impls to have the behaviour of the document but no selection
        // if the editor is not consistent.
        EditorImpl ed = (EditorImpl)editor;
        Point<ContentNode> selStart = null;
        Point<ContentNode> selEnd = null;

        PointRange<Node> seln = ed.getOrderedHtmlSelection();
        try {
          selStart = seln == null ? null :
              ed.getNodeManager().nodeletPointToWrapperPoint(seln.getFirst());
          selEnd = seln == null ? null :
            ed.getNodeManager().nodeletPointToWrapperPoint(seln.getSecond());
          return new Pretty<ContentNode>().select(selStart, selEnd).print(
              editor.getContent().getFullContentView());
        } catch (HtmlInserted e) {
          // fall through to error case
        } catch (HtmlMissing e) {
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.EditorImpl$EditorEventsSubHandlerImpl

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.