Saturday, June 26, 2010

Re: uiBinder and clickevent

see this!
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xml:lang="it" dir="ltr"  
               
xmlns="http://www.w3.org/1999/xhtml"  
               
xmlns:ui='urn:ui:com.google.gwt.uibinder' 
               
xmlns:gwt='urn:import:com.google.gwt.user.client.ui'> 
    
       
<head> 
               
<title>Use case for GWT + UiBinder + XHTML</title> 
               
<script type="text/javascript" src="mymodule/mymodule.nocache.js"></script> 
       
</head> 
         
       
<body> 
               
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' 
                       
style="position: absolute; width: 0; height: 0; border: 0"></iframe> 
         
               
<div id="sample_content_1"> 
                       
<!-- same example of the hello world --> 
                       
<ui:UiBinder> 
                               
<div> 
                                        Hello,
<span ui:field='nameSpan'/>
                               
</div> 
                       
</ui:UiBinder> 
               
</div> 
                 
               
<div id="sample_content_2"> 
                       
<!--  
                                creating a declarative layout for an app, intended to produce a layout 
                                similar to http://gwt.google.com/samples/Showcase/Showcase.html#CwVerticalPanel  
                        -->
 
                       
<ui:UiBinder> 
                               
<gwt:VerticalPanel spacing="5" debugId="cwVerticalPanel"> 
                                       
<gwt:Button text="Button 1" /> 
                                       
<gwt:Button text="Button 2" /> 
                                       
<gwt:Button text="Button 3" /> 
                                       
<gwt:Button text="Button 4" /> 
                                       
<gwt:Button text="Button 5" /> 
                                       
<gwt:Button text="Button 6" /> 
                                       
<gwt:Button text="Button 7" /> 
                                       
<gwt:Button text="Button 8" /> 
                                       
<gwt:Button text="Button 9" />                           
                               
</gwt:VerticalPanel> 
                       
</ui:UiBinder> 
               
<div> 
       
</body> 
</html>
//////////////////////////
 
 


 
2010/6/26 janjan <marjan.f.r@gmail.com>
Hello all,

I'm trying to use uiBinder. I followed the tutorial provided by
google, but I don't know why clickevent doesn't work? Can anyone help
me? It's couple of hours I'm working on it but can't find the problem!

Thanks you so much

P.S.
I'm using NetBeans 6.9, gwt 2.0.3
------------------------------------------------------------------------------------------
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
       xmlns:g="urn:import:com.google.gwt.user.client.ui">
       <ui:style>
       </ui:style>
       <g:HTMLPanel>
        <table>
            <tr>
                <td><img ui:field='imgPrd'/></td>
                <td>
                   <span ui:field='lblNum'>0</span>
                    <g:Button ui:field='btnAdd'>Add to basket</
g:Button>
                </td>
            </tr>
        </table>
       </g:HTMLPanel>
</ui:UiBinder>
-------------------------------------------------------------------------------
public class uiProductList extends Composite {

   @UiField Button btnAdd;
   @UiField ImageElement imgPrd;
   @UiField SpanElement lblNum;

   int count;
   private static uiProductListUiBinder uiBinder =
GWT.create(uiProductListUiBinder.class);

   interface uiProductListUiBinder extends UiBinder<Widget,
uiProductList> {
   }

   public uiProductList() {
       initWidget(uiBinder.createAndBindUi(this));
   }


  @UiHandler("btnAdd")
   void handleClick(ClickEvent e) {
      Window.alert("test");
 }

}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment