Package org.waveprotocol.wave.client.editor

Examples of org.waveprotocol.wave.client.editor.Editor


        new RegistriesImpl(Editor.ROOT_HANDLER_REGISTRY,
            Editor.ROOT_ANNOTATION_REGISTRY, paintRegistry);

    StyleAnnotationHandler.register(registries);

    Editor editor = Editors.create();
    editor.init(registries, KeyBindingRegistry.NONE, EditorSettings.DEFAULT);

    // Now the actual test

    ContentSerialisationUtil.setContentString(editor, "<body><line/>abc</body>");
    CMutableDocument doc = editor.getDocument();
    doc.setAnnotation(3, 4, "style/color", "red");

    editor.getContent().debugCheckHealthy2();
    timerService.tick(1000);
    ContentView fullDoc = ((EditorImpl) editor).getContent().getFullContentView();
    assertNotNull(
        DocHelper.getElementWithTagName(fullDoc, AnnotationPaint.SPREAD_FULL_TAGNAME));
    doc.setAnnotation(3, 4, "style/color", null);
    timerService.tick(1000);
    assertNull(DocHelper.getElementWithTagName(fullDoc, AnnotationPaint.SPREAD_FULL_TAGNAME));

    doc.setAnnotation(3, 5, "style/color", "red");
    editor.removeContentAndUnrender();
    editor.reset();
    timerService.tick(1000);
    assertNull(DocHelper.getElementWithTagName(fullDoc, AnnotationPaint.SPREAD_FULL_TAGNAME));

  }
View Full Code Here


      @Override
      public void setRootPanel(Panel rootPanel) {
        // Not used as we use our own popup implementation.
      }
    });
    Editor editor = Editors.create();
    initEditor(editor, Editor.ROOT_REGISTRIES, keyBinding);
    return (EditorImpl) editor;
  }
View Full Code Here

    LineContainers.setTopLevelContainerTagname(Blips.BODY_TAGNAME);
    EditorStaticDeps.setPopupProvider(Popup.LIGHTWEIGHT_POPUP_PROVIDER);
    LineRendering.registerContainer(Blips.BODY_TAGNAME,
        Editor.ROOT_HANDLER_REGISTRY);
    Editors.initRootRegistries();
    Editor editor = Editors.create();
    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());
View Full Code Here

  }

  public void testEditModeStartsAndStopsDiffSuppression() {
    target.install();

    Editor e = mock(Editor.class);
    MockDoc doc = mock(MockDoc.class);
    ConversationBlip blip = mock(ConversationBlip.class);
    BlipView blipUi = mock(BlipView.class);
    when(models.getBlip(blipUi)).thenReturn(blip);
    when(documents.get(blip)).thenReturn(doc);
View Full Code Here

        (Editor) editorDiv.getPropertyObject(EDITOR_WEBDRIVER_PROPERTY);
  }

  /** Utility that flushes an editor div before getting the selected range. */
  private static Range getSelectionWithFlush(Element editorDiv) {
    Editor editor = getByEditorDiv(editorDiv);
    if (editor != null) {
      EditorTestingUtil.forceFlush(editor);
      return editor.getSelectionHelper().getOrderedSelectionRange();
    }
    return null;
  }
View Full Code Here

  /**
   * @param editorDiv
   * @return content of editor owning doc div
   */
  public static String webdriverEditorGetContent(Element editorDiv) {
    Editor editor = getByEditorDiv(editorDiv);
    if (editor != null) {
      // This must not be called synchronously in the same key event before
      // the dom is modified.
      EditorTestingUtil.forceFlush(editor);

      // NOTE(patcoleman): it seems empty strings get converted to null objects here by webdriver,
      //   this code removes the prefix that avoids that problem.
      // TODO(patcoleman): investigate where this happens with Simon.
      String content = XmlStringBuilder.innerXml(editor.getPersistentDocument()).toString();
      return content == null ? null : "_" + content;
    } else {
      return "Error in webdriverEditorGetContent";
    }
  }
View Full Code Here

  /**
   * @param editorDiv
   * @return local annotations of the editor owning div
   */
  public static String webdriverEditorGetLocalDiffAnnotations(Element editorDiv) {
    Editor editor = getByEditorDiv(editorDiv);
    if (editor == null) {
      return "Error in webdriverEditorGetContent";
    }
    // This must not be called synchronously in the same key event before the dom is modified.
    EditorTestingUtil.forceFlush(editor);

    StringBuilder ans = new StringBuilder("");
    ReadableStringSet keys = CollectionUtils.newStringSet(
        DiffHighlightingFilter.DIFF_INSERT_KEY,
        DiffHighlightingFilter.DIFF_DELETE_KEY);
    MutableAnnotationSet.Local annotations = editor.getContent().getLocalAnnotations();
    annotations.annotationIntervals(0, annotations.size(), keys);
    for (AnnotationInterval<Object> interval :
        annotations.annotationIntervals(0, annotations.size(), keys)) {

      boolean isInsertion = interval.annotations()
View Full Code Here

   *
   * @param editorDiv
   * @return div of editor's document
   */
  public static Element webdriverEditorGetDocDiv(Element editorDiv) {
    Editor editor = getByEditorDiv(editorDiv);
    return editor.getDocumentHtmlElement();
  }
View Full Code Here

  /**
   * @param editorDiv editor
   * @param content content to set
   */
  public static void webdriverEditorSetContent(Element editorDiv, String content) {
    Editor editor = getByEditorDiv(editorDiv);
    if (editor != null) {
      Preconditions.checkNotNull(documentSchema, "documentSchema is not set");
      editor.setContent(DocProviders.POJO.parse(content).asOperation(), documentSchema);
    }
  }
View Full Code Here

  /**
   * @param editorDiv
   * @return local content of editor owning doc div
   */
  public static String webdriverEditorGetLocalContent(Element editorDiv) {
    Editor editor = getByEditorDiv(editorDiv);
    if (editor != null) {
      // This must not be called synchronously in the same key event before
      // the dom is modified.
      EditorTestingUtil.forceFlush(editor);
      return XmlStringBuilder.innerXml(editor.getContent().getFullContentView()).toString();
    } else {
      return "Error in webdriverEditorGetLocalContent";
    }
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.Editor

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.