Package org.sgx.yuigwt.yuigallery

Examples of org.sgx.yuigwt.yuigallery.YuiGalleryContext


   
  @Override
  public void ready(YuiContext Y_) {
   
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
    console = Y.newConsole().render().cast();
    console.boundingBox().setStyles(Style.create().left("70px"));
   
    cp1 = Y.newColorPicker();
    cp1.render(parent);
   
    Y.newButton(ButtonConfig.create().
      label("get color").
      on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        console.log("color hex: "+cp1.hex());
View Full Code Here


new String[]{"gallery-node-tokeninput", "button", "autocomplete",
  "autocomplete-filters", "autocomplete-highlighters"}, new YUICallback() {
  @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

YUI.YUI(YuiConfig.create().gallery("gallery-2012.08.15-20-00")).use(
new String[]{"console", "gallery-imagecropper"}, new YUICallback() {
  @Override
  public void ready(YuiContext Y_) {
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
final Console console = Y.newConsole(ConsoleConfig.create());
console.render();

String src1 = "http://cabopolonio.com/ovejasenelcabo.jpg";
ImageCropper ic1 = Y.newImageCropper(ImageCropperConfig.create().source(src1).
  width("743px").height("517px"));
ic1.render(parent);

ic1.on(ImageCropper.EVENT_CROPEND, new EventCallback<ImageCropperEvent>() {
  @Override
View Full Code Here

new String[]{"gallery-itsaselectlist", "console", "stylesheet"}, new YUICallback() {
  @Override
  public void ready(YuiContext Y_) {
   
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
    final Console console = Y.newConsole();
    console.render();
   
    String[] months = new String[]{
      "Januar", "Februar", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
    };
   
    ITSASelectlist selectlist = Y.newITSASelectlist(ITSASelectlistConfig.create().items(months));
    selectlist.on(ITSASelectlist.EVENT_SELECTCHANGE, new EventCallback<ITSASelectlistEvent>() {
      @Override
      public void call(ITSASelectlistEvent e) {
        console.log("selected item index "+e.index()+" - value: "+e.value());
      }
    });
    selectlist.render(parent);
   
   
    //now another select list using custom items
   
//    String[] colors = new String[]{
//      "#FF0000", "#ff6600", "#ff77ee", "#66ff66", "#00ff66", "#66000ff"
//    }; 
   
    JsArray<ITSASelectlistItem> items = JsArray.createArray().cast();
    for (int i = 0; i < 20; i++) {
      String color = "#"+testUtil.randomColor().getHex();//colors[i];
      ITSASelectlistItem item = ITSASelectlistItem.create()
        .text("<div style='background-color:"+color+";'></div>")
        .returnValue(color);
      items.push(item);
    }
    ITSASelectlist selList2 = Y.newITSASelectlist(ITSASelectlistConfig.create()
      .items(items)
      .className("mycolors")
      .listWidth(256)
      .btnSize(2)
      .iconClassName("itsa-icon-textcolor")
      .defaultButtonText("")
    );
    selList2.on(ITSASelectlist.EVENT_SELECTCHANGE, new EventCallback<ITSASelectlistEvent>() {
      @Override
      public void call(ITSASelectlistEvent e) {
        console.log("selected color: "+e.value());
      }
    });
    selList2.render(parent.appendChild("<div id=\"divcolorpicker\"></div>"));
   
    StyleSheet sty = Y.newStyleSheet();
   
    //the main color label
    sty.set("#divcolorpicker .itsa-selectlist-selectedmain div",
        Style.create().width("12px").height("10px").marginLeft("18px"));
   
View Full Code Here

new String[]{"gallery-form"}, new YUICallback() {
  @Override
  public void ready(YuiContext Y_) {   
   
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
    FormField checkbox1 = Y.newCheckboxField(FormFieldConfig.create().
      name("myCheckbox").value("check").label("Do you like sports?"));
   
    Window.alert(Y.FormField().INVALID_DATE_MESSAGE()+" - "+checkbox1.label());
   
    Form form1 = Y.newForm(FormConfig.create().method("post").
      action("/test.php?action=submit").
      inlineValidation(true).
      children(

        checkbox1,
View Full Code Here

new String[]{"gallery-node-transform2d", "gallery-cssmatrix2d", "transition"}, new YUICallback() {
  @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());
    //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) {
        CSSMatrix2d m = Y.newCSSMatrix2d().setMatrixValue(n3.getString("transform"));
        n3.setStyle("transform", m.rotate(20).translate(0, 20).toString_());
      }
    });
  }
});
View Full Code Here

        }, new YUICallback() {
      @Override
      public void ready(YuiContext Y_) {

        // cast to YuiGalleryContext for using the yui gallery java api.
        final YuiGalleryContext Y = Y_.cast();

        Accordion acc1 = Y.newAccordion(AccordionConfig.create().useAnimation(true).reorderItems(true));
        acc1.render(parent);

        AccordionItem item1 = Y.newAccordionItem(AccordionItemConfig.create().label("Item1, added from script").contentHeight("fixed", 80));

        item1.set("bodyContent", "This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"fixed, 80px\".");

        acc1.addItem(item1);

        AccordionItem item2 = Y.newAccordionItem(AccordionItemConfig.create().label("Item2, added from script").expanded(true).contentHeight("stretch").id("dinnode2"));

        item2.set("bodyContent", "This is the body of the item, added dynamically to accordion, before item1.<br>Content height has been set as \"stretch\".");

        acc1.addItem(item2);

        AccordionItem item3 = Y.newAccordionItem(AccordionItemConfig.create().label("Item2, added from script").expanded(true).alwaysVisible(true).contentHeight("auto")
            .id("dinnode3"));

        item3.set("bodyContent",
            "<div style='position:relative;'>This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"auto\".</div>");
View Full Code Here

      "gallery-deferred", "io", "console", "button", "json", "io-base"}, new YUICallback() {
   
  @Override
  public void ready(YuiContext Y_) {
   
    final YuiGalleryContext Y = Y_.cast();    
    console = Y.newConsole().render().cast();
   
    Y.newButton(ButtonConfig.create().label("do deferred 1").on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        doDeferred1(parent, Y);
      }
    })).render(parent);
   
    Y.newButton(ButtonConfig.create().label("do deferred 2").on("click", new EventCallback<EventFacade>() {
      @Override
      public void call(EventFacade e) {
        doDeferred2(parent, Y);
      }
    })).render(parent);
View Full Code Here

new String[]{"gallery-yui-treeview"/*, "resetcss"*/}, new YUICallback() {
  @Override
  public void ready(YuiContext Y_) {   
   
    //cast to YuiGalleryContext for using the yui gallery java api.
    final YuiGalleryContext Y = Y_.cast();
   
    TreeView treeView1 = Y.newTreeView(TreeLeafConfig.create().label("haha").children(
      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

* @author sg
*
*/
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");
View Full Code Here

TOP

Related Classes of org.sgx.yuigwt.yuigallery.YuiGalleryContext

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.