Package org.sgx.yuigwt.yui.node

Examples of org.sgx.yuigwt.yui.node.Node$AncestorCallback


@Override
public void test(final Node parent) {
YUI.Use(new String[]{"button", "anim"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {
    final Node p = parent.appendChild("<p>This is a para graph.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..</p>");
    p.setStyle("backgroundColor", "red");    

    final Anim anim1 = Y.newAnim(AnimConfig.create().
        node(p).duration(2.3).
        to(Style.create().width("10px")));
   
View Full Code Here


@Override
public void test(final Node parent) {
YUI.Use(new String[]{"resize", "resize-plugin", "button"}, new YUICallback() { 
  @Override
  public void ready(final YuiContext Y) {
    Node n = parent.appendChild("<div id=\"resizable1\">hello</div>");
    n.setStyles(Style.create().height("100px").position("relative").
        width("80px").backgroundColor("red").margin("30px"));
    Resize r = Y.newResize(ResizeConfig.create().node("#resizable1"));
   
    //and now a resizable button using Resize plugin
    Widget button = Y.newButton(ButtonConfig.create().label("resizable button").on("click", new EventCallback<EventFacade>() {
View Full Code Here

YUI.Use(new String[]{"button", "cache", "cache-offline"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {
    final String cacheKey1 = "cachetestkey1", cacheKey2 = "cachetestkey2"
    parent.append("<p>The online cache tester: </p>");
    final Node p = parent.appendChild(
      "<input type=\"text\" value=\"value to store\"></input>");
    final Cache cache1 = Y.newCache(CacheConfig.create().max(5).expires(3600000));
    Y.newButton(ButtonConfig.create().label("Save").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        cache1.add(cacheKey1, p.get("value"));
      }
    }));
    Y.newButton(ButtonConfig.create().label("Load").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        p.set("value", cache1.retrieve(cacheKey1).responseString());
      }
    }));
   
    parent.append("<p>and the offline cache tester (html5): </p>");
    final Node p2 = parent.appendChild(
      "<input type=\"text\" value=\"value to store\"></input>");
    CacheOfflineConfig occ = (CacheOfflineConfig)CacheOfflineConfig.create();
    final Cache cache2 = Y.newCacheOffline(occ.sandbox("foobar4455z").max(5).expires(3600000));
    Y.newButton(ButtonConfig.create().label("Save").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        cache2.add(cacheKey2, p2.get("value"));
      }
    }));
    Y.newButton(ButtonConfig.create().label("Load").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        p2.set("value", cache2.retrieve(cacheKey2).responseString());
      }
    }));
  }
});
}
View Full Code Here

public void test(final Node parent) {
  YUI.YUI().use(new String[]{"node", "node-event-delegate", "event-key"}, new YUICallback() {

    @Override
    public void ready(YuiContext Y) {
      Node newNode = parent.appendChild(
        "<fieldset id=\"todo-example\">\n"+
        "<legend>Todo List</legend>\n"+
        "<ol>\n"+
        "    <li><button class=\"delete-todo\">remove</button>Read YUI documentation</li>\n"+
        "    <li><button class=\"delete-todo\">remove</button>Build awesome web app</li>\n"+
        "    <li><button class=\"delete-todo\">remove</button>Profit!</li>\n"+
        "</ol>\n"+
        "<input id=\"todo\"> <button id=\"add-todo\" type=\"button\">add</button>\n"+
        "</fieldset>");
      newNode.setStyle("backgroundColor", "pink");
       
      final Node todoList = Y.one("#todo-example ol");
      final Node newTask = Y.one("#todo");
     
      todoList.delegate("click", new NodeEventDelegateCallback() {
       
        @Override
        public void call(Node n, YuiEvent evt, Object arg) {
          n.ancestor("li").remove();
        }
      }, "button", null);
     
      NodeEventCallback addTodo = new NodeEventCallback() {
       
        @Override
        public void call(YuiEvent e) {
          todoList.append(
                  "<li><button class=\"delete-todo\">remove</button>" +
                      newTask.getString("value") +
                  "</li>");

              newTask.set("value", "");
        }
      };
      Y.one("#add-todo").on("click", addTodo);
      newTask.on("key", addTodo, "enter")
    }
 
   
  });
}
View Full Code Here

YUI.YUI().use(new String[] { "panel", "button", "dd-plugin", "resize", "resize-plugin" }, new YUICallback() {

  @Override
  public void ready(YuiContext Y) {
    // a panel with a button which content is taken from markup
    Node parentBody = parent.appendChild("<p>This is the content of the <b>panel</b><i>jhalllll</i>. Well good day...</p>");
    final Panel panel1 = Y.newPanel((PanelConfig) PanelConfig.create().centered(true).srcNode(parentBody).width("400px").render(true));

    Button acceptButton = Y.newButton((WidgetButtonsConfig) WidgetButtonsConfig.create().label("Accept").on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
View Full Code Here

    button1.on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        //cannot work directly in panel1.getStdModNode("body") because we cannot call asHTMLPanel() if the node is already inside a GWT Widget.
//        test.test(panel1.getStdModNode("body"));  
        Node p = y.one("body").appendChild("<div></div>");
//        p.generateID();
        test.test(p);  
       
        panel1.setStdModContent("body", p);
//        panel1.render();
        panel1.show();
      }
    });
    acceptButton.on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        panel1.hide();
      }
    });
    
   
   
    Node parent = y.one(tabviewEl);//getElement()).appendChild("");
   
    final List<String> headers = new LinkedList<String>();
    final List<String> bodies = new LinkedList<String>();
   
    for(final String resName : test.getTestResources().keySet()) {
View Full Code Here

  NODE(Y, Attr.create().tag("li").cdata("item 2")),
  NODE(Y, Attr.create().tag("li").cdata("item 3"), Style.create().backgroundColor("red").color("white")),
}));

//another example
Node n = NODE(Y, Attr.create("form").action("/action1").method("post"), null, new Node[]{
  NODE(Y, Attr.create("div").Class("formbox"), Style.create().backgroundColor("#ededed").marginTop("40px"), new Node[]{
    NODE(Y, Attr.create("input").type("checkbox").id("in1"), Style.create().textDecoration("underline"), new Node[]{}),
    NODE(Y, Attr.create("label").cdata("Like Shakespeare?").For("in1"), Style.create().textDecoration("underline"), new Node[]{})
  }),
  NODE(Y, Attr.create("div").Class("formbox"), Style.create().backgroundColor("#aaaaff").paddingTop("20px"), new Node[]{
View Full Code Here

    prettyPrint();
//    y.one(".main-header").setStyles(Style.create().position("fixed"));
   
    String [] sectionNames = {"sec-intro", "sec-gettingstarted"};
    for (int i = 0; i < sectionNames.length; i++) {
      final Node target = y.one("#"+sectionNames[i]);
      Node nav = y.one("#nav-"+sectionNames[i]);
      if(target!=null && nav!=null) {
        nav.on("click", new EventCallback<EventFacade>() {
          @Override
          public void call(EventFacade e) {
            target.scrollIntoView();
          }
        });
View Full Code Here

    @Override
    public void ready(YuiContext Y) {
     
      parent.append("<p>these are two menus, the markup created using YUIUtil.makeMenu* and using YUI NodeMenuNav plugin for the menues. The first is a horizontal menu and the last is a vertical menu</p>");
      //generate a simple horizontal menu bar and use event delegation for getting who menuitem was clicked
      Node menu1 = YUIUtil.makeMenu(Y, true, new Node[]{
        YUIUtil.makeMenuItem(Y, "File", new Node[]{
          YUIUtil.makeMenuItem(Y, "Open..."),
          YUIUtil.makeMenuItem(Y, "Save..."),         
          YUIUtil.makeMenuItem(Y, "Export", new Node[]{
            YUIUtil.makeMenuItem(Y, "to PNG", null),
            YUIUtil.makeMenuItem(Y, "to PDF", null)
          }),
          YUIUtil.makeMenuItem(Y, "Exit"),
        }),
       
        YUIUtil.makeMenuItem(Y, "Help", new Node[]{
          YUIUtil.makeMenuItem(Y, "About", null),
          YUIUtil.makeMenuItem(Y, "Use manual")
        })         
      });
      parent.append(menu1);
     
      menu1.plug(Y.Plugin().NodeMenuNav());
     
      parent.append("<p>and now the vertical menu...</p>");
     
      //now create another menu but vertical
     
      NodeBase vMenuParent = parent.appendChild(YUIUtil.NODE(Y, "tag: 'div'", "width: '80px'"));
      parent.append(vMenuParent);
      Node menu2 = YUIUtil.makeMenu(Y, false, new Node[]{
        YUIUtil.makeMenuItem(Y, "YAHOO", new Node[]{
          YUIUtil.makeMenuItem(Y, "Search..."),
          YUIUtil.makeMenuItem(Y, "Mail..."),         
          YUIUtil.makeMenuItem(Y, "News", new Node[]{
            YUIUtil.makeMenuItem(Y, "London 2012", null),
            YUIUtil.makeMenuItem(Y, "Uruguay football champion", null)
          }),
          YUIUtil.makeMenuItem(Y, "Other"),
        }),
       
        YUIUtil.makeMenuItem(Y, "Google", new Node[]{
          YUIUtil.makeMenuItem(Y, "News", null),
          YUIUtil.makeMenuItem(Y, "Docs")
        })         
      });
      vMenuParent.append(menu2);
      menu2.plug(Y.Plugin().NodeMenuNav());
     
      for(Node n : new Node[]{menu1, menu2}) {
        n. delegate("click", new NodeEventDelegateCallback() {         
          @Override
          public void call(Node n, YuiEvent evt, Object arg) {
View Full Code Here

YUI.Use(new String[]{"button", "cookie"}, new YUICallback() {
  @Override
  public void ready(final YuiContext Y) {
    final String cookieKey1 = "cookietestkey1", cookieKey2 = "cookietestkey2"
    parent.append("<p>The online cookie tester: </p>");
    final Node p = parent.appendChild(
      "<input type=\"text\" value=\"value to store\"></input>");
//    final Cookie cookie1 = Y.newcookie(cookieConfig.create().max(5).expires(3600000));
   
   
    Y.newButton(ButtonConfig.create().label("Save").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        Y.Cookie().set(cookieKey1, p.get("value"));
      }
    }));
    Y.newButton(ButtonConfig.create().label("Load").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        p.set("value", Y.Cookie().getString(cookieKey1));
      }
    }));
   
  }
});
View Full Code Here

TOP

Related Classes of org.sgx.yuigwt.yui.node.Node$AncestorCallback

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.