Package org.sgx.yuigwt.yui.node

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


      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

* @param table the table in which to add the new tr
* @param tdHtml the tds html strings
* @return the new &lt;tr> element
*/
public Node appendRow(Node table, String ... tdHtml) {
  Node tr = table.appendChild(getOpenCloseTag("tr"));
  for (int i = 0; i < tdHtml.length; i++) {
    tr.appendChild(getOpenCloseTag("td", tdHtml[i]));//"<td>"+tdHtml[i]+"</td>");
  }
  return tr;
}
View Full Code Here

    Object o = JsUtil.cloneObject(attrsObj);
    String tag = (String) JsUtil.get(attrsObj, "tag"),
      cdata = (String) JsUtil.get(attrsObj, "cdata");
    if(tag==null) //required
      return null;
    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

          testsArr.push(testObj);
          testNames.push(test.getName());
        }

        // an autocomplete and button search box
        final Node byNameInput = parent.appendChild("<input type=\"\"></input>");
        AutoComplete ac = Y
            .newAutoComplete(AutoCompleteConfig.create().resultHighlighter("phraseMatch").resultFilters("phraseMatch").inputNode(byNameInput).source(testNames))
            .render(parent).cast();

        Y.newButton(ButtonConfig.create().label("search").render(parent).on("click", new EventCallback<ButtonEvent>() {
          @Override
          public void call(ButtonEvent e) {
            String keywords = byNameInput.get("value");
            JsArray<JsObject> results = JsArray.createArray().cast();
            for (Test test : tests) {
              if (test.getName().contains(keywords))
                results.push(testToJsObject(test));
            }
View Full Code Here

  @Override
  public void ready(final YuiContext Y_) {
    this.Y = Y_.cast();

    Node body = Y.one("body");
    // Document.get().getBody().addClassName("yui3-skin-sam");
    body.addClass("yui3-skin-sam");

    // create a dyn stylesheet
    ssheet1 = Y.newStyleSheet();

    // set the YUI skin to use
    body.addClass("yui3-skin-sam");

    mainPanel = body.one("#layout");
    navContent = body.one("#nav>.content");
    mainContent = body.one("#main>.content");
    mainContent.getDOMNode().setId("main-example-panel");
    extraContent = body.one("#extra>.content");
    footer = body.one("#ft");

    drawTestNav(Y);

    // //java source button
    Button showJavaButton = Y.newButton(Button.config().label(constants.showJava()).render(extraContent).on("click", new EventCallback() {
View Full Code Here

    for (Test t : util.getTests()) {
      allTestNames[i] = t.getName();
      i++;
    }
    getNavContent().append("<span>Filter by name: </span><br/>");
    final Node inputEl = getNavContent().appendChild("<input type=\"text\"></input>");

    inputEl.setStyles(Style.create().width("90%"));
    AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().resultHighlighter("phraseMatch").resultFilters("phraseMatch").inputNode(inputEl).source(allTestNames)
        .render(true));
    ac.after(AutoComplete.EVENT_SELECT, new EventCallback<AutoCompleteEvent>() {
      @Override
      public void call(AutoCompleteEvent e) {
        Test test = util.getTestByName(inputEl.get("value"));
        setCurrentTest(test);
      }
    });

    TabView tb = Y.newTabView(TabViewConfig.create(new TabConfig[] {
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.