Package org.waveprotocol.wave.client.editor

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


     * Converts the <code>Application</code> XMLBean into a <code>UnitActionPackage</code> object.
     * @param application  the <code>Application</code> XMLBean to convert.
     * @return the converted <code>UnitActionPackage</code> object.
     */
    public static UnitActionPackage convertWADLtoUnitActionPackage(final Application application) {
        Resources resources = application.getResources();
        String baseURL = resources.getBase();
        if (!baseURL.endsWith("/")) {
            baseURL += "/";
        }
        List<Resource> resourceList = resources.getResourceList();

        List<UnitAction> unitActionList = new ArrayList<UnitAction>();
        for (Resource resource : resourceList) {
            unitActionList.addAll(convertResourceToUnitAction(resource));
        }
View Full Code Here


    public static String generateWADLForMashupRESTService(String myCocktailPath, int mashupId) throws DAOException, IOException {
        Mashup mashup = getMashup(mashupId);
       
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        Resources resources = application.addNewResources();
        resources.setBase(myCocktailPath);
       
        Resource resource = resources.addNewResource();
        resource.setPath("RESTService/mashupId="+mashupId);
       
        addResource(resource, "json""format=json",  mashup, "application/json");
        addResource(resource, "xml",   "format=xml",   mashup, "application/xml");
        addResource(resource, "jsonp", "format=jsonp", mashup, "application/javascript");
View Full Code Here

    public static String generateWADLForMashupRESTServiceJSON(String myCocktailPath, int mashupId) throws DAOException, IOException {
        Mashup mashup = getMashup(mashupId);
       
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        Resources resources = application.addNewResources();
        resources.setBase(myCocktailPath);
       
        Resource resource = resources.addNewResource();
        resource.setPath("RESTService/mashupId="+mashupId);
       
        addMethod(resource.addNewMethod(), "json", mashup, "application/json");
       
        return applicationDocument.xmlText(new XmlOptions().setSavePrettyPrint());
View Full Code Here

      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$Resources

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.