Package org.sgx.yuigwt.yui.console

Examples of org.sgx.yuigwt.yui.console.Console


@Override
public void test(final Node parent) {
YUI.Use(new String[]{"datasource", "datatable", "console", "dump", "json"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) { 
    final Console console1 = Y.newConsole(ConsoleConfig.create().collapsed(true)).render().cast();
   
    //test 1 : Using DataSource.Local
    JavaScriptObject data1 = data1();
    DataSource ds1 = Y.newDataSourceLocal(DataSourceConfig.create().source(data1));    
   
    ds1.sendRequest(DataSourceRequest.create().callback(new DataSourceCallbackAdapter() {
      @Override
      public void success(DataSourceEvent e) {
        console1.log("success1: "+JsUtil.dumpObj(e.response().meta())+
          " - "+JsUtil.dumpObj(e.response().results(), true));
      }
      @Override
      public void failure(DataSourceEvent e) {
        Window.alert("failure1: "+JsUtil.dumpObj(e));
      }
    }));
   
    //test2: use DataSource.Get for getting data from datatables.org:
    String ds2url =  "http://query.yahooapis.com/v1/public/yql?format=json&",
      yqlQuery = "show tables";
    DataSource ds2 = Y.newDataSourceGet(DataSourceConfig.create().source(ds2url));
    ds2.sendRequest(DataSourceRequest.create()
      .request("q="+yqlQuery)
      .callback(new DataSourceCallbackAdapter() {
      @Override
      public void success(DataSourceEvent e) {
//        JsArray<Result> results = e.response().results().cast();
//        Result result = results.get(0);
//        if(result.error()!=null) {
//          console1.log("test2, YQL returned ERROR: "+result.error());
//          return;
//        }
//        result.query().
       
//        console1.log("success2: "+JsUtil.dumpObj(e.response().meta())+
//          " - "+JsUtil.dumpObj(results.get(0).objGetObj("error"), true));
       
//        console1.log("success2: "+Y.dump(results.get(0), 10));
       
        console1.log("success2: "+Y.JSON().stringify(e.response().results()));
      }
      @Override
      public void failure(DataSourceEvent e) {
        Window.alert("failure2: "+JsUtil.dumpObj(e));
      }
View Full Code Here


      .withCredentials(false)
      .width("200px")
      .height("100px")
    );
//    uploader1.render(parent);
    final Console console = Y.newConsole().render().cast();
   
    final Node selectFilesButtonContainer = parent.appendChild("<div></div>");
   
   
    //if html5 add support from drag&drop files from desktop. see http://yuilibrary.com/yui/docs/uploader/uploader-dd.html
    if(Y.Uploader().TYPE().equals("html5")) {
     
      final Node uploaderMessage = parent.appendChild("<div>Drag and drop files</div>");
      final Node ddarea = parent.appendChild("<div>on this BOX</div>");
      uploader1.set("dragAndDropArea", ddarea);
      console.log("html5 uploader");
     
      uploader1.on(new String[]{UploaderHTML5.EVENT_DRAGENTER, UploaderHTML5.EVENT_DRAGOVER}, new EventCallback<UploaderEvent>() {
        @Override
        public void call(UploaderEvent e) {
          uploaderMessage.text("Files detected, drop them here!");
        }
      });
     
      uploader1.on(new String[]{UploaderHTML5.EVENT_DRAGLEAVE, UploaderHTML5.EVENT_DROP}, new EventCallback<UploaderEvent>() {
        @Override
        public void call(UploaderEvent e) {
          uploaderMessage.text("Drag and drop files here");
        }
      });
     
    }
    else if(Y.Uploader().TYPE().equals("flash")) {
      console.log("flash uploader");
    }
    else {
      console.log("file uploader not supported - "+"No Flash or HTML5 capabilities detected.");
      return;
    }
   
   
    uploader1.render(selectFilesButtonContainer);
   
    uploader1.after("fileselect", new EventCallback<UploaderEvent>() {
      @Override
      public void call(UploaderEvent e) {
        JsArray<File> fl = e.fileList(); //uploader1.fileList() 
        console.log("fileselect: "+fl.length());
      }
    });
   
  }
});
View Full Code Here

TOP

Related Classes of org.sgx.yuigwt.yui.console.Console

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.