Package org.sgx.yuigwt.yui.console

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


  AUI.Use(new String[]{"aui-color-picker", "console"}, new AUICallback() {
   
    @Override
    public void ready(AuiContext Y) {
     
      final Console console = Y.newConsole().render().cast();
     
      //TODO: parent.getDomNode not supported in aui
      Y.one("#"+parent.get("id")).append(
        "<div id=\"demo\"></div>" +
        "<div id=\"color\"></div>");
     
      colorPiker1 = Y.newColorPicker(ColorPickerConfig.create().after(ColorPicker.EVENT_COLORCHANGE, new EventCallback<EventFacade>() {

        @Override
        public void call(EventFacade e) {
          console.log(colorPiker1.get("hex"));
        }
      }));
      colorPiker1.render("#demo");
//      button1.render(parent);
    }
View Full Code Here


public void test(final Node parent) {
YUI.Use(new String[]{"history", "tabview", "console"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {
   
    final Console console = Y.newConsole(ConsoleConfig.create() );
    console.render();
   
    final HistoryBase history = Y.newHistoryHash();
   
    final TabView tb = Y.newTabView(TabViewConfig.create(new TabConfig[]{
      TabConfig.create().label("tab1").content("<p>11111111111 foo content</p>"),
      TabConfig.create().label("tab2").content("<p>2222222222222222<b>Hello</b>foo <i>content</i></p>"),
      TabConfig.create().label("tab3").content("<p>3333333333333<b>ben parker</b>foo <i>holla dooba do</i></p>"),
    }));
    tb.render(parent);
   
    tb.after("selectionChange", new EventCallback<TabViewEvent>() {

      @Override
      public void call(TabViewEvent e) {
       
        /* note e.newVal is the selected child widget - we cast directly.
         * @see http://yuilibrary.com/yui/docs/api/classes/WidgetParent.html#attr_selection
         */
        Widget selChild = e.newValObj().cast();
       
        int newTabIndex = selChild.getInt("index");
       
        console.log("tabview selectionChange: "+newTabIndex);
       
        history.addValue("tab", newTabIndex==0 ? null : newTabIndex+"");
      }
    });    
   
View Full Code Here

      @Override
      public void ready(final YuiContext Y) {
        ta = parent.appendChild("<textarea></textarea>");
        ta.setStyle("width", "100%");

        final Console console = Y.newConsole(ConsoleConfig.create());
        console.render();

        AsyncQueueItem aqItem = AsyncQueueItem.create().id("aq1").iterations(5).timeout(150).fn(new SimpleCallback() {
          @Override
          public void call() {
            ta.set("text", ta.get("text") + " - 1");
          }
        });

        AsyncQueueItem aqItem2 = AsyncQueueItem.create().id("aq2").iterations(6).timeout(100).fn(new SimpleCallback() {
          @Override
          public void call() {
            ta.set("text", ta.get("text") + " - 2");
          }
        });
        AsyncQueueItem aqItem3 = AsyncQueueItem.create().id("aq3").iterations(6).timeout(100).fn(new SimpleCallback() {
          @Override
          public void call() {
            ta.set("text", ta.get("text") + " - 3");
          }
        });

        // All AsyncQueue instances will execute all callbacks
        // synchronously by default
        Y.AsyncQueue().defaults().timeout(-1);

        final AsyncQueue aq = Y.newAsyncQueue().add(aqItem).add(aqItem2).add(aqItem3);
        ta.set("text", "indexOf A = " + aq.indexOf("aq1"));

        EventCallback<AsyncQueueEvent> callback1 = new EventCallback<AsyncQueueEvent>() {
          @Override
          public void call(AsyncQueueEvent e) {
            console.log("Event type: " + e.type(), "", "");
          }
        };

        aq.on(new String[] { AsyncQueue.EVENT_COMPLETE, AsyncQueue.EVENT_SHIFT, AsyncQueue.EVENT_PROMOTE }, callback1);
View Full Code Here

YUI.Use(new String[]{"button", "button-plugin", "node-screen", "dump", "console"}, new YUICallback() {
  private EventHandle handle1;

  @Override
  public void ready(final YuiContext Y) {
    final Console console = Y.newConsole();
    console.render();
    Widget button1 = Y.newButton(
      ButtonConfig.create().label("a simple button 123")
    ).render(parent)
    //register a click listener that will unregister itself after the first event
    handle1 = button1.on("click", new EventCallback<ButtonEvent>() {     
      @Override
      public void call(ButtonEvent e) {
        console.log("button pressed at x  ="+e.domEvent().getClientX()+".\n And this will be THE LAST TIME !!!");
        handle1.detach(); //unregister this event listener!
      }
    });
    console.log("button's region is : " + button1.boundingBox().region().print());
    button1.boundingBox().setStyles(Style.create().border("3px solid green"));
   
    //another way of register an event listener, this time passing it to the config object
    Button b2 = Y.newButton(ButtonConfig.create().label("another button").render(parent).
      on("click", new EventCallback<ButtonEvent>() {       
        @Override
        public void call(ButtonEvent e) {
          console.log("button pressed at x  ="+e.domEvent().getClientX());
        }
      })
    );    

    //and the last example, an html node plugged with a button plugin   
View Full Code Here

@Override
public void test(final Node parent) {
YUI.Use(new String[]{"datasource", "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

YUI.Use(new String[]{"io-base", "io-queue", "console"}, new YUICallback() { 
   
@Override
public void ready(final YuiContext Y) {
 
  final Console console1 = Y.newConsole(ConsoleConfig.create());
  console1.render();
 
  String uri1 = GWT.getModuleBaseURL()+"testfiles/json1.json",
    uri2 = GWT.getModuleBaseURL()+"testfiles/page2.html",
    nonExistentUri = GWT.getModuleBaseURL()+"testfiles/notexistent.json";
 
  //create an io object for working that will notify us for some io events...
  IOConfig ioConfig = IOConfig.create().
      on(IO.EVENT_SUCCESS, new EventCallback<IOEvent>() {         
    @Override
    public void call(IOEvent e) {
      console1.log("SUCCESS, responseText: "+e.data().responseText());
    }
  }).on(IO.EVENT_FAILURE, new EventCallback<IOEvent>() {
    @Override
    public void call(IOEvent e) {
      console1.log("FAILURE. Status: "+e.data().status()+" - "+e.data().statusText(), "", "");
    }
  }).cast();
  IO io1 = Y.newIO(ioConfig);
 
  //send a request.
View Full Code Here

   
    //Y.log will output on firebug's console
    Y.log("using Y.log()", "info", "myapp");
   
    //create a draggable console
    final Console console1 = Y.newConsole(ConsoleConfig.create());
    console1.plug(Y.Plugin().Drag());
   
    //be a nasty console catching each log entry and asking for confirmation.
    console1.before(Console.EVENT_ENTRY, new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        if(!Window.confirm("Do you really want to add the msg: "+((ConsoleEvent)e).message().message()+" ? "))  {
          Window.alert("preventing");
          e.preventDefault();
        }
      }
    });
    //render and log something.
    console1.render();
    console1.log("using Console.log()", "info", "myapp");  
   
    //now install DD and resize plugins for the console
    console1.plug(Y.Plugin().Drag(), DragConfig.create().handles(new String[]{".yui3-console-hd"}));
    console1.plug(Y.Plugin().Resize());
    console1.log("drag the title for move and also resizable. ");
  }
 
});
}
View Full Code Here

  @Override
  public void ready(YuiContext Y_) {
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
final Console console = Y.newConsole(ConsoleConfig.create());
console.render();

String src1 = "http://cabopolonio.com/ovejasenelcabo.jpg";
ImageCropper ic1 = Y.newImageCropper(ImageCropperConfig.create().source(src1).
  width("743px").height("517px"));
ic1.render(parent);

ic1.on(ImageCropper.EVENT_CROPEND, new EventCallback<ImageCropperEvent>() {
  @Override
  public void call(ImageCropperEvent e) {
    console.log(e.left()+", "+e.top()+", "+e.width()+", "+e.height());
  }
});
  }
});
}
View Full Code Here

  public void ready(YuiContext Y_) {
   
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
    final Console console = Y.newConsole();
    console.render();
   
    String[] months = new String[]{
      "Januar", "Februar", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
    };
   
    ITSASelectlist selectlist = Y.newITSASelectlist(ITSASelectlistConfig.create().items(months));
    selectlist.on(ITSASelectlist.EVENT_SELECTCHANGE, new EventCallback<ITSASelectlistEvent>() {
      @Override
      public void call(ITSASelectlistEvent e) {
        console.log("selected item index "+e.index()+" - value: "+e.value());
      }
    });
    selectlist.render(parent);
   
   
    //now another select list using custom items
   
//    String[] colors = new String[]{
//      "#FF0000", "#ff6600", "#ff77ee", "#66ff66", "#00ff66", "#66000ff"
//    }; 
   
    JsArray<ITSASelectlistItem> items = JsArray.createArray().cast();
    for (int i = 0; i < 20; i++) {
      String color = "#"+testUtil.randomColor().getHex();//colors[i];
      ITSASelectlistItem item = ITSASelectlistItem.create()
        .text("<div style='background-color:"+color+";'></div>")
        .returnValue(color);
      items.push(item);
    }
    ITSASelectlist selList2 = Y.newITSASelectlist(ITSASelectlistConfig.create()
      .items(items)
      .className("mycolors")
      .listWidth(256)
      .btnSize(2)
      .iconClassName("itsa-icon-textcolor")
      .defaultButtonText("")
    );
    selList2.on(ITSASelectlist.EVENT_SELECTCHANGE, new EventCallback<ITSASelectlistEvent>() {
      @Override
      public void call(ITSASelectlistEvent e) {
        console.log("selected color: "+e.value());
      }
    });
    selList2.render(parent.appendChild("<div id=\"divcolorpicker\"></div>"));
   
    StyleSheet sty = Y.newStyleSheet();
View Full Code Here

YUI.YUI(YuiConfig.create().gallery("gallery-2011.10.20-23-28"))
.use(new String[]{"yql", "gallery-geo", "handlebars"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {

    final Console console = Y.newConsole().collapsed(true).render().cast();   
   
    String tableMetaTemplStr =
    "<table>" +
    "  <tr><td class=\"title\">TableShow Name: </td><td></td></tr>" +
    "</table>";
   
    //yql desc answers.getquestion
    YQL yql1 = Y.newYQL("desc answers.getquestion", new YQLCallback() {     
      @Override
      public void call(YQLResult r) {   
       
        if(r.error()!=null) {
          console.log("YQL ERROR:"+r.error().description());
          return ;
        }       
        DescResult desc1 = r.query().results().cast();
       
        TableDesc t = desc1.table();
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.