Package org.sgx.yuigwt.yui.node

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


  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());
    //we want to work with NodeTransform2d nod extension, so we simply cast the node to that class:   
    final NodeTransform2d n1 = p.appendChild("<p>click me first</p>").cast();
   
    //set fixed bounds
    n1.setStyles(Style.create().backgroundColor("red").fontSize("24px").
      width("100px").height("70px"));
   
    n1.on("click", new EventCallback<YuiEvent>() {

      @Override
      public void call(YuiEvent e) {
        n1.rotate(25, TransitionVal.create().duration(0.5).easing("linear"));
      }
    });
   
    final NodeTransform2d n2 = p.appendChild("<p>and then click me also</p>").cast();
   
    //set fixed bounds
    n2.setStyles(Style.create().backgroundColor("blue").fontSize("18px").
      width("100px").height("140px"));
   
    n2.on("click", new EventCallback<YuiEvent>() {

      @Override
      public void call(YuiEvent e) {
        CSSMatrix2d matrix = n1.getMatrix().scale(2.5).skewX(1.5);
        n2.transform(matrix, TransitionVal.create().duration(0.5).easing("linear"));
      }
    });
   
    //AND NOW TRANSFORM A THIRD NODE, USING ONLY THE API OF gallery-cssmatrix2d   
    final NodeTransform2d n3 = p.appendChild("<p>mouse over me once</p>").cast();
    n3.setStyles(Style.create().left("200px").top("100px").backgroundColor("green"));
    n3.once("mouseover", new EventCallback<YuiEvent>() {

      @Override
      public void call(YuiEvent e) {
View Full Code Here


    JsObject module = moduleInfo.get(i);
    leafs1.push(buildLeaf(module));
  }
  TreeView treeView1 = Y.newTreeView(TreeLeafConfig.create().collapsed(false)
    .label("Yui Modules metainformation").children(leafs1).id("tree1"));    
  Node treeViewParentNode = Y.one(parent.getDOMNode());
  treeView1.collapsed(false);
  treeView1.render(treeViewParentNode);
  treeViewParentNode.setStyles(Style.create().overflow("scroll"));  
}
View Full Code Here

      TreeLeafConfig.create().label("haha1").id("child1"),
      TreeLeafConfig.create().label("haha2").id("child2")
    ).id("tree1"));    
   
    //we need to "re-node" the parent to the new sandbox - this is not a bug
    Node treeViewParentNode = Y.one(parent.getDOMNode());
    treeView1.render(treeViewParentNode);
  }
});
}
View Full Code Here

    List<String> props = model.getProperties().keys();
    for (final String name : props) {
      final Object val = model.getProperty(name);

      Node row = htmlutil.appendRow(srcNode, "<div class=\"left\"></div>", "<div class=\"right\"></div>");
      Node labelParent = row.one(".left"), valueParent = row.one(".right");

      Editor<Object> ed = null;
      try {
        ed = (Editor<Object>) Types.getInstance().newPropertyEditor(model, name);
      } catch (EditorNotFound e) {
        // logger.log(Level.WARNING,
        // " exception building editor for prop " + name + " of class "
        // + model.getClass() + " value: " + val + ". Exception cause: "
        // + e.getCause());
        // e.printStackTrace();
        // throw new RuntimeException(e);
      }
      /* if editor not found then perhaps the model is a property haver ? */
      if (ed == null && model instanceof PropertyHaver) {
        ed = new PropertyHaverEditor2(y);
      }
      if (ed == null) {
        String msg = "Couldn't create editor for propery " + name + ". ";
        logger.log(Level.SEVERE, msg);
        continue;
      }

      final Editor<Object> finalEd = ed;

      EditorEventManager.getInstance().addValueChangeListener(ed, this);

      editors.put(name, ed);

      labelParent.append(name + ":");
      if (!ed.isSimple()) {

        Node tb = valueParent.appendChild("<input type=\"text\"></input>");

        tb.set("value", val + "");
        tb.set("title", name);

        tb.on("click", new EventCallback<EventFacade>() {

          @Override
          public void call(EventFacade e) {

            final Panel panel = y.newPanel((PanelConfig) PanelConfig.create().centered(true).width("400px"));
            panel.headerContent("<h1>" + name + "</h1>");
            panel.bodyContent("<div class=\"bodyContent\"></div>");
            panel.footerContent("<i>small</i>");

            Button acceptButton = getContext().newButton(ButtonConfig.create().label("Accept").on("click", new EventCallback<ButtonEvent>() {
              @Override
              public void call(ButtonEvent e) {
                panel.hide();
              }
            })).render().cast();
            panel.addButton(acceptButton);

            panel.render(y.one("body"));
//            Node bodyNode = (Node) panel.bodyContent();
            Node bodyNode2 = panel.srcNode().one(".bodyContent");
            finalEd.render(bodyNode2);
            finalEd.load(val);

          }
        });
View Full Code Here

  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+"");
    }
View Full Code Here

 
  public void render() {

    styleSheet = Y.newStyleSheet();
   
    Node body = Y.one("body");
    body.addClass("yui3-skin-sam");
   
    mainPanel = body.one("#layout");
    navContent = body.one("#nav>.content");
    navContent.setStyle("border", "4px solid pink");
    mainContent = body.one("#main>.content");
    mainContent.getDOMNode().setId("main-example-panel");
    extraContent = body.one("#extra>.content");
    footer = body.one("#ft");
   
    Y.newButton(ButtonConfig.create().label("search1").
      on("click", new EventCallback<ButtonEvent>() {
      @Override
      public void call(ButtonEvent e) {
View Full Code Here

      "<li id=\"search1-by-tag\"><b class=\"label\">by tags: </b><br/></li>" +
      "<li id=\"search1-by-requires\"><b class=\"label\">by required modules: </b><br/></li>" +
    "</ul>"+
    "<div id=\"search1-result-container\"></div>"
  );
  Node byName = parent.one("#search1-by-name")
  Node byTag = parent.one("#search1-by-tag");
  Node byRequires = parent.one("#search1-by-requires")
  resultContainer = parent.one("#search1-result-container");
 
  //search by name:
  final ByNameSearcher byNameSearcher = new ByNameSearcher(util, "");
  final Node byNameInput = byName.appendChild("<input type=\"text\" value=\"\"></input>");
 
  AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").
    inputNode(byNameInput).
    source(byNameSearcher.autocompleteData()).
    render(true)
  );  
  Y.newButton(ButtonConfig.create().label("Search").
    on("click", new EventCallback<ButtonEvent>() {
    @Override
    public void call(ButtonEvent e) {
      String keyword = byNameInput.get("value");
      byNameSearcher.setName(keyword);
      JsArray<Module> results = SearchUtil.search(util.getModules(), byNameSearcher);
      console.log("search by name keyword: "+keyword+", results: "+results.length());
      resultTable.data(results);
      resultTable.render();
    }
  })).render(byName);
 
  //search by tags
  final ByTagsSearcher byTagsSearcher = new ByTagsSearcher(util, "");
  final Node byTagsInput = byTag.appendChild("<input type=\"text\" value=\"\"></input>");
 
  AutoComplete acTags = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").
    inputNode(byTagsInput).
    source(byTagsSearcher.autocompleteData()).
    render(true)
  );  
  Y.newButton(ButtonConfig.create().label("Search").
    on("click", new EventCallback<ButtonEvent>() {
    @Override
    public void call(ButtonEvent e) {
      String keyword = byTagsInput.get("value");
      byTagsSearcher.setTag(keyword);
      JsArray<Module> results = SearchUtil.search(util.getModules(), byTagsSearcher);
      console.log("search by tag keyword: "+keyword+", results: "+results.length());
      resultTable.data(results);
      resultTable.render();
    }
  })).render(byTag);
 
  //search by requires
  final ByRequiresSearcher byRequiresSearcher = new ByRequiresSearcher(util, "");
  final Node byRequiresInput = byRequires.appendChild("<input type=\"text\" value=\"\"></input>");
 
  AutoComplete acRequires = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").
    inputNode(byRequiresInput).
    source(byRequiresSearcher.autocompleteData()).
    render(true)
  );  
  Y.newButton(ButtonConfig.create().label("Search").
    on("click", new EventCallback<ButtonEvent>() {
    @Override
    public void call(ButtonEvent e) {
      String keyword = byRequiresInput.get("value");
      byRequiresSearcher.setRequire(keyword);
      JsArray<Module> results = SearchUtil.search(util.getModules(), byRequiresSearcher);
      console.log("search by Requires keyword: "+keyword+", results: "+results.length());
      resultTable.data(results);
      resultTable.render();
View Full Code Here

  }

  @Override
  public void ready(YuiContext Y_) {
    YuiGalleryContext Y = (YuiGalleryContext)Y_;
    Node rootNode = Y.one("body");
    gallery = new Gallery(Y,rootNode);
//    gal.render();
  }
View Full Code Here

      }
    });

    for (int i = 0; i < els.length; i++) {
      Element el = els[i];
      Node n = y.one("#" + el.getId());
      bindYUI(y, n);
    }

    if (listener != null)
      listener.yuiBinded();
View Full Code Here

   
    YuiLoader.load(yuiUrl, modules, this);
  }
  @Override
  public void ready(YuiContext Y) {
    Node parentNode = Y.one(RootPanel.get());
   
    //remember to add yui3 skin class name to your root node      
    parentNode.addClass("yui3-skin-sam");
   
    Button button1 = (Button) Y.newButton(
      ButtonConfig.create().label("a YUI3 button widget")
    ).render(parentNode)
    button1.on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        Window.alert(e.domEvent().getClientX()+"");
      }
    });
   
    parentNode.append("<p>First a horizontal default slider...");
    Y.newSlider().render(parentNode);
   
    parentNode.append("<p>Now a vertical, custom slider...");
    Y.newSlider(Slider.config().axis("y").min(1).
      max(5).value(3).length(200)).render(parentNode);   
  }
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.