Package org.sgx.yuigwt.yui.node

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


      String parentId = "parent-" + tag;
      item1.set("bodyContent", "<div class=\"parent-tag\" id=\"" + parentId + "\"></div>");

      acc1.addItem(item1);

      Node testParent = Y.one("#" + parentId);
      for (final Test test : tests) {
        Y.newButton(Button.config().label(test.getName()).render(testParent).on("click", new EventCallback() {
          @Override
          public void call(EventFacade e) {
            setCurrentTest(test);
View Full Code Here


      }
    }));
  }

  public Panel showPanel(YuiContext Y, String headerContent, String bodyContent) {
    Node parent = Y.one("body");
    Node parentBody = parent.appendChild("<p></p>");
    final Panel panel1 = Y.newPanel((PanelConfig) PanelConfig.create()
    // .centered(true)
        .srcNode(parentBody).width("70%").height("400px").render(true));

    panel1.headerContent(headerContent);
View Full Code Here

    // first render the tb in the
    // most inner one and then render the panel in the outer one and set
    // bodyContent to the tabview's element.
    // see http://jsfiddle.net/cancerbero_sgx/uEPvq/6/

    Node parent = Y.one("body");
    Node panelEl = parent.appendChild("<div></div>");
    Node tbEl = panelEl.appendChild("<div></div>");

    // first, render the tabview
    TabConfig[] tabConfig = new TabConfig[headerContent.size()];

    for (int i = 0; i < tabConfig.length; i++) {
View Full Code Here

//      Callback fn = ;
      timer = Y.later(2000, new Callback() {
       
        @Override
        public void call(JsArrayMixed args) {
          Node n = Y.one(anchor);
//          System.out.println("later: "+anchor+" - "+n);
          if(n!=null) {
//            System.out.println("anchored: "+n);
            n.scrollIntoView(true);
//            n.setStyle("background-color", "red");
            timer.cancel();
          }
        }
      }, JsArrayMixed.createArray(), true);
View Full Code Here

      cdata = (String) JsUtil.get(attrsObj, "cdata");
//    if(tag==null) //required
//      return null;
    if(tag==null)
      tag="span";
    Node thisNode = null;
    thisNode = Y.one("document").create("<"+tag+"></"+tag+">");
   
    JsArrayString attrNames = JsUtil.props(attrsObj);
    for (int i = 0; i < attrNames.length(); i++) {
      String attr = attrNames.get(i);
      if(attr!=null && !attr.equals("tag") && !attr.equals("cdata"))
        thisNode.setAttribute(attr, (String) JsUtil.get(attrsObj, attr));
    }
    if(cdata!=null)
      thisNode.setContent(cdata);
    thisNode.setStyles(cssObj);   
    if(childs!=null)
      for (int i = 0; i < childs.length; i++)
        thisNode.append(childs[i]);
    return thisNode;
  }
View Full Code Here

    //if no children the element is a <li><a...
//    if(childs==null || childs.length==0) {
      String nodeAttrs = href!=null ? ("tag:'a',href:'"+href+"',cdata:'"+label+"'") :
        ("tag:'span',cdata:'"+label+"'");
      Node labelEl = NODE(Y, nodeAttrs, null, null),
        el = NODE(Y, "tag:'li',class:'yui3-menuitem'", null, new Node[]{labelEl});
     
     
      if(clickHandler!=null)
        labelEl.on("click", clickHandler);
     
      if(childs!=null&&childs.length>0) {
//        labelEl.addClass("yui3-menuitem-content");
        labelEl.addClass("yui3-menu-label");
        Node root = NODE(Y, "tag:'div',class:'yui3-menu'", null, null),
        content = NODE(Y, "tag:'div',class:'yui3-menu-content'", null, null),
        list = NODE(Y, "tag:'ul'", null, null);
        root.append(content);
        content.append(list);
        for (int i = 0; i < childs.length; i++) {
          list.append(childs[i]);
        }
        el.append(root);
View Full Code Here

  }
  public static Node makeMenu(YuiContext Y, boolean horizontal) {
    return makeMenu(Y, horizontal, null);
  }
  public static Node makeMenu(YuiContext Y, boolean horizontal, Node[] menuItems) {
    Node root = NODE(Y, "tag:'div',class:'yui3-menu'", null, null),
        content = NODE(Y, "tag:'div',class:'yui3-menu-content'", null, null);
//    Window.alert(root+"");
    root.addClass(horizontal?"yui3-menu-horizontal":"yui3-menu-vertical");
    root.append(content);
    if(menuItems==null || menuItems.length==0)
      return root;
    Node list = NODE(Y, "tag:'ul'", null, null);
//    list.addClass("first-of-type");
    content.append(list);
    for (int i = 0; i < menuItems.length; i++) {
      list.append(menuItems[i]);
    }
    return root;
  }
View Full Code Here

        }
      })
    );    

    //and the last example, an html node plugged with a button plugin   
    Node el1 = parent.appendChild("<button>from html</button>");
    el1.plug(Y.Plugin().Button());
   
    b2.set("label", "lacañada");
  }
});
}
View Full Code Here

  }
 
  @Override
  public void render(Node parent) {   
    super.render(parent);
    Node src = parent.appendChild("<input type=\"text\"></input>");
    src.on("click", new Callback() {     
      @Override
      public void call(JsArrayMixed args) {
        EditorEventManager.<Integer>getInstance().fireValueChangeEvent(IntegerEditor1.this);
      }
    });
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();
    //redefine parent loading the new Y sandbox.
    Node p = Y.one(parent.getDOMNode());
    p.append("<p>Write some tags, comma separated: </p>" );
    Node input1 = p.appendChild("<input type=\"text\"></input>");
    input1.plug(Y.GalleryPlugin().TokenInput(), TokenInputPluginConfig.create().removeButton(true));
    final TokenInputPlugin tiPlugin = input1.getPlugin("tokenInput").cast();
    Y.newButton(ButtonConfig.create().label("Accept").render(parent).on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        String[] selection = JsUtil.toJavaStringArray(tiPlugin.tokens());
        String s = "selection is : ";
        for (int i = 0; i < selection.length; i++) {
          s+=selection[i];
        }
        Window.alert(s)
      }     
    }));
   
    p.append("<p>Now an input with token and autocomplete plugins installed. " +
      "This time '.' (point) separated tags. <a href=\"http://rgrove.github.com/node-tokeninput/examples/example-autocomplete.html\">This is a similar example</a>. </p>");
    Node input2 = p.appendChild("<input type=\"text\"></input>");
    String[] tags = {"apple", "banana", "cherry", "date", "fig", "grapefruit", "jujube",
              "kumquat", "lemon", "mango", "nectarine", "orange", "pineapple",
              "raspberry", "strawberry", "tangerine", "watermelon"};
    input2.
      plug(Y.GalleryPlugin().TokenInput(), TokenInputPluginConfig.create().
        delimiter(".")).
      plug(Y.GalleryPlugin().AutoComplete(), AutoCompleteConfig.create().
        resultFilters("charMatch").resultHighlighter("charMatch").source(tags));
    final TokenInputPlugin tiPlugin2 = input2.getPlugin("tokenInput").cast();
    Y.newButton(ButtonConfig.create().label("Set defaults").render(parent).on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        tiPlugin2.tokens("adan", "eve", "nietzsche");
      }     
View Full Code Here

TOP

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

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.