Package org.sgx.yuigwt.yui.widget.button

Examples of org.sgx.yuigwt.yui.widget.button.Button


    footer = body.one("#ft");

    drawTestNav(Y);

    // //java source button
    Button showJavaButton = Y.newButton(Button.config().label(constants.showJava()).render(extraContent).on("click", new EventCallback() {
      @Override
      public void call(EventFacade e) {
        doShowCurrentTestSources2();
      }
    }));
    showJavaButton.srcNode().setStyles(Style.create().fontSize("1.2em").fontWeight("bolder").textDecoration("underline").margin("10px 0px"));

    // test description button
    Button descrButton = Y.newButton(Button.config().label("Test description")).render(extraContent).on("click", new EventCallback() {
      @Override
      public void call(EventFacade e) {
        showCurrentTestDescription(Y);
      }
    }).cast();
    // descrButton.contentBox().setStyle("width", "100%");

    // this gallery sources button
    Button showSurceButton = Y.newButton(Button.config().label(constants.thisExampleGallerySources())).render(extraContent).on("click", new EventCallback() {
      @Override
      public void call(EventFacade e) {
        Map<String, ResourcePrototype> r = new HashMap<String, ResourcePrototype>();
        r.put(constants.thisExampleGallerySources(), TestResources.instance.Gallery());
        doShowSources2(r);
        // showJavaSource2(Y, TestResources.instance.Gallery(),
        // constants.thisExampleGallerySources(), 0);
      }
    }).cast();
    // showSurceButton.contentBox().setStyle("width", "100%");

    Button aboutButton = Y.newButton(Button.config().label("About")).render(extraContent).on("click", new EventCallback() {
      @Override
      public void call(EventFacade e) {
        showAboutThisApplication(Y);
      }
    }).cast();
View Full Code Here


    });
    console.log("button's region is : " + button1.boundingBox().region().print());
    button1.boundingBox().setStyles(Style.create().border("3px solid green"));
   
    //another way of register an event listener, this time passing it to the config object
    Button b2 = Y.newButton(ButtonConfig.create().label("another button").render(parent).
      on("click", new EventCallback<ButtonEvent>() {       
        @Override
        public void call(ButtonEvent e) {
          console.log("button pressed at x  ="+e.domEvent().getClientX());
        }
      })
    );    

    //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

            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();
View Full Code Here

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

  public void test(final Node parent) {
    YUI.YUI().use(new String[] { "router", "button" }, new YUICallback() {

      @Override
      public void ready(YuiContext Y) {
        Button b1 = Y.newButton(ButtonConfig.create().label("request /mysite/foo").render(parent)
            .on("click", new EventCallback<ButtonEvent>() {
              @Override
              public void call(ButtonEvent e) {
                router.save("/mysite/foo");
              }
            }));

        Button b2 = Y.newButton(ButtonConfig.create().label("request /mysite/user/sgurin/edit").render(parent)
            .on("click", new EventCallback<ButtonEvent>() {
              @Override
              public void call(ButtonEvent e) {
                router.save("/mysite/user/sgurin/edit");
              }
View Full Code Here

      panel.headerContent("<h1>Add new " + entityName + "</h1>");
      panel.bodyContent("<div class=\"bodyContent\"></div>");
      panel.footerContent("<i>small</i>");


      Button cancelButton = y.newButton(ButtonConfig.create().label("Cancel").on("click", new EventCallback<ButtonEvent>() {
        @Override
        public void call(ButtonEvent e) {
          panel.hide();
          panel.contentBox().remove();
        }
      })).render().cast();
      panel.addButton(cancelButton);
     
      Button acceptButton = y.newButton(ButtonConfig.create().label("Accept").on("click", new EventCallback<ButtonEvent>() {
        @Override
        public void call(ButtonEvent e) {
          T edited = entityEditor.flush();
          all.add(edited);
          notifyAllChange();
View Full Code Here

  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) {
        Window.alert("clicked");
        panel1.hide();

      }
    }));
    acceptButton.render();
    panel1.addButton(acceptButton.srcNode());

    // a panel initially empty but being poblated using the panel
    // api
    Panel panel2 = Y.newPanel((PanelConfig) PanelConfig.create().xy(10, 10).srcNode(parent.appendChild("<p></p>")).width("400px").render(true));
    panel2.headerContent("<h1>Panel header string</h1>");
View Full Code Here

    final GalleryUtil galleryUtil = GalleryUtil.getDefaultInstance();
    final Test test = galleryUtil.getTestByName(testName);
   
     //new GalleryUtil(null);
   
    final Button button1 = getYUIBinder().getWidget(buttonEl).cast();
    final Button acceptButton = getYUIBinder().getWidget(acceptButtonEl).cast();
    final Panel panel1 = getYUIBinder().getWidget(panel1El).cast();
   
    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();
      }
    });
View Full Code Here

  @Override
  public void ready(final YuiContext Y) {
    final Console console1 = Y.newConsole(ConsoleConfig.create());
    console1.render();
   
    Button b1 = Y.newButton(ButtonConfig.create().label("loadScript1")).render(parent).cast();
    b1.on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        Y.Get().js(GWT.getModuleBaseURL()+"testfiles/script1.js");
      }
    }).cast();
   
    Button b2 = Y.newButton(ButtonConfig.create().label("loadcss1")).render(parent).cast();
    b2.on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        Y.Get().css(GWT.getModuleBaseURL()+"testfiles/css1.css");
      }
    });   
   
    //now try to load a non existing file - catch the error using the normal callback for accessing the error
    Button b3 = Y.newButton(ButtonConfig.create().label("nonExisting1")).render(parent).cast();
    b3.on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        Y.Get().css(GWT.getModuleBaseURL()+"testfiles/jsNotExists123.css", GetConfig.create(), new GetCallback() {         
          @Override
          public void call(JsArray err_, Transaction tx) {
            JsArray<GetError> err = (JsArray<GetError>)err_;
            Window.alert("error count: "+err.length()+" - first error: "+
                err.get(0).error());
          }
        });
      };
    });
   
    //or, the same as as above but using the Get's options object for registering an onFailure listener: 
    Button b4 = Y.newButton(ButtonConfig.create().label("nonExisting2")).render(parent).cast();
    b4.on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        Y.Get().css(GWT.getModuleBaseURL()+"testfiles/jsNotExists123.css", GetConfig.create().onFailure(new GetOptionsCallback() {
         
          @Override
View Full Code Here

  @Override
  public void test(final Node parent) {
    YUI.Use(new String[] { "button", "cssgrids", "slider" }, new YUICallback() {
      @Override
      public void ready(final YuiContext Y) {
        Button button1 = Y.newButton(ButtonConfig.create().label("Button1"));
        YButton button2 = new YButton(Y, "button2");
        Slider slider1 = Y.newSlider(SliderConfig.create().axis("x").min(1).max(5).value(3).length(200)).cast();

        GridPanel panel1 = new GridPanel(Y);
View Full Code Here

TOP

Related Classes of org.sgx.yuigwt.yui.widget.button.Button

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.