Package org.sgx.yuigwt.yui.console

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


*
*/
public class ABCModuleListing {
public void render(Node parent, Gallery gallery) {
  YuiGalleryContext Y = gallery.Y;
  final Console console = gallery.console;
  GalleryUtil util = gallery.util;
  Map<String, Module> modules = util.getModulesByName();
  parent.setStyle("columnCount", "3");
  parent.setStyle("columnGap", "20px");
  Node list = parent.appendChild("<ul></ul>");
  console.log("ABCModuleListing module count: "+modules.keySet().size());
  for(String moduleName : modules.keySet()) {
    Module module = modules.get(moduleName);
    list.append("<li class=\"\" ><a href=\""+module.url()+
      "\" id=\"module-"+moduleName+"\">"+moduleName+"</a></li>");
  }
  list.delegate("click", new NodeEventDelegateCallback() {   
    @Override
    public void call(Node n, YuiEvent evt, Object arg) {
      evt.preventDefault();
      console.log(n+"");
    }
  }, "a", null);
}
View Full Code Here


  public void ready(final YuiContext Y) {
    Node node1 = parent.appendChild("<p>dragme1</p>");
    Drag dd = Y.newDDDrag(DragConfig.create().node(node1));
   
    //now a console dragable only at its title - using drag handle
    final Console console1 = Y.newConsole(ConsoleConfig.create()).render().cast();
    console1.plug(Y.Plugin().Drag(), DragConfig.create().handles(new String[]{"h4"}));
    console1.log("this console is only draggable by its title.");
  }
});
}
View Full Code Here

@Override
public void test(final Node parent) {
YUI.Use(new String[]{"console", "editor"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {
    final Console console1 = Y.newConsole(ConsoleConfig.create().width("50%"));
    console1.render();
   
    EditorBase editor = Y.newEditorBase(EditorBaseConfig.create().
      content("<strong class=\"foo\">This is <em>a test</em></strong>. Please edit me. <strong>This is <em>a test</em></strong>")
    );
   
     //Add the BiDi plugin
      editor.plug(Y.Plugin().EditorBidi());
           
      editor.on(EditorBase.EVENT_NODECHANGE, new EventCallback<EditorBaseEvent>() {
      @Override
      public void call(EditorBaseEvent e) {
        console1.log("node changed: "+e.changedType());
      }     
    });      
     
      editor.on("dom:keydown", new EventCallback<EditorBaseEvent>() {
      @Override
      public void call(EditorBaseEvent e) {
        console1.log("dom:keydown: target: "+e.frameTarget().get("id")+
          " - keycode: "+e.frameEvent().keyCode());
      }     
    });      
     
      editor.render(parent);
View Full Code Here

public void test(final Node parent) {
YUI.Use(new String[]{"yql", "console", "dump", "json"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {

    final Console console = Y.newConsole()
//        .collapsed(true)
        .render().cast();       
       
    /* simple YQL query weather.forecast */
    YQLParams params1 = YQLParams.create()
      .format("json").diagnostics("true");
    YQL yql1 = Y.newYQL("select * from weather.forecast where location=90210", new YQLCallback() {     
      @Override
      public void call(YQLResult r) {
//        console.log(Y.JSON().stringify(r));
        WheatherForecastResult fresult = r.query().results().cast();
        Channel channel = fresult.channel();
        parent.append(
          "<a href=\""+channel.link()+"\">"+
            channel.title()+"</a> - Wind speed: "+channel.wind().speed()+" kph. " +
   
          //or not using any Java API at all, just the js object api 
          "Direction: "+r.query().results().objGetObj("channel").
            objGetObj("wind").objGetString("direction")+
           
          //and because we use diagnostics("true"),  we can access diagnostic info
          "<p>Diagnostic - servicetime: "+r.query().diagnostics().serviceTime()+" ms."
        );        
      }
    }, params1);
   
   
    /* an example using datatables.org, this time yui.gallery.all for information
     * about yui gallery modules. We use the parameter "env". */
   
    String query2 = "select * from yui.gallery.all";
    YQLCallback yqlCallback2 = new YQLCallback() {     
      @Override
      public void call(YQLResult r) {
        JsObject o = r.query().results().objGetObj("json"); //type, count, modules, }
        JsArray<JsObject> modules = o.objGetObj("modules").cast();
        JsObject module0 = modules.get(0);
        console.log("first module title is "+module0.objGetString("title"));         
      }
    };
    YQLParams yqlParams2 = YQLParams.create().env("http://datatables.org/alltables.env");
    yqlParams2.format("json")
    YQL yql2 = Y.newYQL(query2, yqlCallback2, yqlParams2);

   
    /* handle an yql request that gives error */   
    YQL yql3 = Y.newYQL("select * from weather.nonexist123 where nonexists=90210", new YQLCallback() {     
      @Override
      public void call(YQLResult r) {
        if(r.error()!=null)
          console.log("ERROR (it is ok..):"+r.error().description());
      }
    });
  }
});
}
View Full Code Here

      .centerButtonDiameter(2)
      .min(-100)
      .max(100)
      .stepsPerRevolution(10)
    );
    final Console console = Y.newConsole().render().cast();
    dial.on("valueChange", new EventCallback<WidgetEvent>() {
      @Override
      public void call(WidgetEvent e) {
        console.log("valuechange : "+e.newValInt());
      }
    });
    dial.render(parent);
  }
});
View Full Code Here

public void test(final Node parent) {
YUI.Use(new String[]{"scrollview-base", "button", "console"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {

    final Console console1 = Y.newConsole(ConsoleConfig.create());
    console1.render();
   
    Node sv1Node = parent.appendChild("<div id=\"scrollview1\"></div>");    
   
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < 100; i++) {
      sb.append("<p>This is a long line "+i+" </p>");
    }
    sv1Node.set("innerHTML", sb.toString());
   
    sv1 = Y.newScrollView(ScrollViewConfig.create().
      flick(Flick.create().minDistance(8).minVelocity(0.3).axis("y")).
      srcNode(sv1Node).height("100px"));
    sv1.render();
    sv1.on(ScrollView.EVENT_SCROLLYCHANGE, new EventCallback<AttributeEvent>() {
      @Override
      public void call(AttributeEvent e) {
        console1.log("scrollX changed: "+e.newValDouble());
      }
    });
   
    Y.newButton(
      ButtonConfig.create().label("up").
View Full Code Here

public void test(final Node parent) {
YUI.Use(new String[]{"button", "node-focusmanager", "console"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {

    final Console console1 = Y.newConsole(ConsoleConfig.create());
    console1.render();
   
    Widget button1 = Y.newButton(
      ButtonConfig.create().label("a simple button")
    ).render(parent)
   
    parent.append("<input type=\"text\" value=\"editme1\"></input><br/>" +
        "<input type=\"text\" value=\"editme2\"></input>");
   
    parent.plug(Y.Plugin().NodeFocusManager(), NodeFocusManagerConfig.create().
      descendants("input, button").
      keys(Keys.create().
        next("down:39").
        previous("down:37")
      )
    );
    NodeFocusManager fm = NodeFocusManager.getFor(parent);
    fm.set("activeDescendant", 1);
    fm.on(NodeFocusManager.EVENT_FOCUSEDCHANGE, new EventCallback<AttributeEvent>() {

      @Override
      public void call(AttributeEvent e) {
        if(!e.newValBoolean()) {
          console1.log("parent has lost focus");
        }
        else {
          console1.log("parent has gain focus");
        }
      }
    });
  }
});
View Full Code Here

public void test(final Node parent) {
YUI.Use(new String[]{"button", "console"}, new YUICallback() {

  @Override
  public void ready(final YuiContext Y) {
final Console console = Y.newConsole().render().cast();

Widget button1 = Y.newButton(
  ButtonConfig.create().label("button1")
).render(parent);

//using "normal" yuigwt infrastructure
button1.on(new String[]{"click", "mouseover"}, new EventCallback<ButtonEvent>() {
  @Override
  public void call(ButtonEvent e) {
    console.log("1 "+e.type()+" at X="+e.domEvent().clientX());
  }
});

Widget button2 = Y.newButton(
  ButtonConfig.create().label("button2")
).render(parent);
//using util.Callback generic callback definition
button2.on("click", new Callback() {     
  @Override
  public void call(JsArrayMixed args) {
    ButtonEvent e = args.getObject(0).cast();
    console.log("2 clicked at X="+e.domEvent().clientX());
  }
});
   
Widget button3 = Y.newButton(
  ButtonConfig.create().label("button3")
View Full Code Here

public void test(final Node parent) {
YUI.Use(new String[]{"get", "button", "console"}, new YUICallback() { 
   
  @Override
  public void ready(final YuiContext Y) {
    final Console console1 = Y.newConsole(ConsoleConfig.create());
    console1.render();
   
    Button b1 = Y.newButton(ButtonConfig.create().label("loadScript1")).render(parent).cast();
    b1.on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
View Full Code Here

  private ScrollViewPaginator pages;

  @Override
  public void ready(final YuiContext Y) {

    final Console console1 = Y.newConsole(ConsoleConfig.create());
    console1.render();
   
    //install some html list markup to scroll with paginator
    Node sv1Node = parent.appendChild("<ul id=\"scrollview1\"></ul>");    
   
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < 100; i++) {
      sb.append("<li>This is a long line "+i+" </li>");
    }
    sv1Node.set("innerHTML", sb.toString());
   
    parent.all("li").setStyles(Style.create().width("100px").display("inline"))
   
    sv1 = Y.newScrollView(ScrollViewConfig.create().
      flick(Flick.create().minDistance(8).minVelocity(0.3).axis("x")).
      srcNode(sv1Node).height("100px"));
    sv1.render();
   
    sv1.plug(Y.Plugin().ScrollViewPaginator(),
      ScrollViewPaginatorConfig.create().selector("li"));
   
    sv1.on(ScrollViewPaginator.EVENT_INDEXCHANGE, new EventCallback<AttributeEvent>() {
      @Override
      public void call(AttributeEvent e) {
        console1.log("index changed changed: "+e.newValInt());
      }
    });
    pages = sv1.pages();
   
    Y.newButton(
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.