Navigatin in menu

55 views
Skip to first unread message

abhishek2408

unread,
May 3, 2012, 11:34:49 PM5/3/12
to google-we...@googlegroups.com
The examples given in GWT showcase for menu are for window.alert.  I want a uibinder(ui.xml) file display to be shown below the menu instead of window.alert 

Assiya EL

unread,
May 4, 2012, 4:06:35 AM5/4/12
to google-we...@googlegroups.com
hello ,

---------------- MenuTest .java-----------------------------

package com.ql.client;

import com.google.gwt.core.client.GWT;

import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.Widget;

public  class MenuTest extends Composite implements HasText {
  
  @UiField  MenuItem btnFurn;
  @UiField  MenuItem btnElec;
  @UiField  MenuItem btnAccount;
  @UiField  MenuItem btnshoes;
  @UiField  MenuItem btnShifts;
  @UiField  MenuItem btnLiving;
  @UiField  MenuItem btnBed;
  @UiField  MenuItem btnPhones;
  @UiField  MenuItem btnCam;
  @UiField  MenuItem btnComp;
  @UiField  MenuItem btnGift;
  
  private static MenuTestUiBinder uiBinder = GWT.create(MenuTestUiBinder.class);

  interface MenuTestUiBinder extends UiBinder<Widget, MenuTest> {
  }

  public MenuTest() {
    initWidget(uiBinder.createAndBindUi(this));
    
    
btnFurn.setCommand(cmdbtnFurn);
btnElec.setCommand(cmdbtnElec);
btnShifts.setCommand(cmdbtnShifts);
btnshoes.setCommand(cmdbtnshoes);
btnLiving.setCommand(cmdbtnLiving);
btnBed.setCommand(cmdbtnBed);
btnPhones.setCommand(cmdbtnPhones);
btnCam.setCommand(cmdbtnCam);
btnComp.setCommand(cmdbtnComp);
btnGift.setCommand(cmdbtnGift);
btnAccount.setCommand(cmdbtnAccount);
}
  
  
  Command cmdbtnGift= new Command() {

    @Override
    public void execute() {
      
      Window.alert("  Gifts  ");
    }
  };

  Command cmdbtnComp= new Command() {

    @Override
    public void execute() {
      
      Window.alert("Computers");
    }
  };
  
  
  Command cmdbtnCam= new Command() {

    @Override
    public void execute() {
    
      Window.alert("cameras");
    }
  };
  
  Command cmdbtnPhones= new Command() {

    @Override
    public void execute() {
  
      Window.alert("phones");
    }
  };

  Command cmdbtnBed = new Command() {

    @Override
    public void execute() {

      Window.alert("bedroom");
    }
  };
 
      Command cmdbtnLiving = new Command() {

  @Override
  public void execute() {
   
    Window.alert("living");
  }
};
 
    
    Command cmdbtnFurn= new Command() {
            public void execute() {
               Window.alert("furniture");
            }
          };
     
         Command cmdbtnElec = new Command() {
             public void execute() {
              Window.alert("electronics");
            }
         };
     
         Command cmdbtnShifts = new Command() {
             public void execute() {
                 Window.alert("shifts");
             }
         };
     
         Command cmdbtnshoes = new Command() {
            public void execute() {
                Window.alert(" shoes");
             }
         };

         Command cmdbtnAccount = new Command() {
             public void execute() {
                 Window.alert(" apparel ");
              }
          };

        @Override
        public String getText() {
    
          return null;
        }

        @Override
        public void setText(String text) {
     
          
        }
         
                
  }

------------------------MenuTest.xml -------------------

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.important {
margin: 0px;
padding: 0px;
list-style-type: none;
text-decoration: none;
}
.fils {
display: inline-block;
height: 57px;
position: relative;
}
.menuBorder {
border-top: none;
}
</ui:style>
<g:HTMLPanel>
<g:MenuBar addStyleNames="{style.menuBorder}" title="itsides"
ui:field="menuBar" animationEnabled="true" autoOpen="true">

<g:MenuItem text="FURNITURE" ui:field="btnFurn">
<g:MenuBar vertical="true">
<g:MenuItem ui:field="btnLiving" text="LIVING" />
<g:MenuItem ui:field="btnBed" text="BED ROOM" />
</g:MenuBar>
</g:MenuItem>

<g:MenuItem text="ELECTRONICS" ui:field="btnElec">
<g:MenuBar vertical="true">
<g:MenuItem ui:field="btnPhones" text="PHONES" />
<g:MenuItem ui:field="btnCam" text="CAMERAS" />
<g:MenuItem ui:field="btnComp" text="COMPUTERS" />
</g:MenuBar>
</g:MenuItem>

<g:MenuItem text="APPAREL" ui:field="btnAccount">
<g:MenuBar vertical="true">
<g:MenuItem ui:field="btnShifts" text="SHIFTS" />
<g:MenuItem ui:field="btnshoes" text="SHOES" />
</g:MenuBar>
</g:MenuItem>

<g:MenuItem text="GIFT CARDS" ui:field="btnGift" />
</g:MenuBar>
</g:HTMLPanel>
</ui:UiBinder> 

good luck , it is Ok ?


2012/5/4 abhishek2408 <abhishek...@gmail.com>
The examples given in GWT showcase for menu are for window.alert.  I want a uibinder(ui.xml) file display to be shown below the menu instead of window.alert 

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



--
 
Assiya EL
Master Qualité du Logiciel 



Plz consider environment - Only print this if necessary


abhishek2408

unread,
May 7, 2012, 11:40:22 PM5/7/12
to google-we...@googlegroups.com
Hi assiya,
         I do not want to display window.alert.I want to display a uibinder file contents below menu on selection of menu item. Your answer gives alert on menu selection. I dont want alert. I want only a uibinder page(eg. uibinder with html panel containing site logo).
hello ,

---------------- MenuTest .java-----------------------------

2012/5/4 abhishek2408 <abhishek...@gmail.com>
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Reply all
Reply to author
Forward
0 new messages