changing the style of a menu bar

1,395 views
Skip to first unread message

Magnus

unread,
Oct 9, 2012, 11:05:05 AM10/9/12
to google-we...@googlegroups.com
Hi,

I would like to adopt the menubar style from the GWT Showcase example and I copied the CSS code into my css. But it does not have any effect.

My hostpage includes the CSS:

    <link type="text/css" rel="stylesheet" href="bcs.css">

And the CSS contains the menubar styles (see below).

The menu is created by code with some helper methods (see below).

The CSS has no effect, even if I change some colors or something like that.

Where is the problem?

Magnus

-----

bcs.css (part):
.gwt-MenuBar {
  cursor: default;
}
.gwt-MenuBar .gwt-MenuItem {
  cursor: default;
  font-family: Arial Unicode MS, Arial, sans-serif;
}
.gwt-MenuBar .gwt-MenuItem-selected {
  background: #E3E8F3;
}
.gwt-MenuBar-horizontal {
  background: #e3e8f3 url(images/hborder.png) repeat-x 0px -2003px;
  border: 1px solid #e0e0e0;
}
.gwt-MenuBar-horizontal .gwt-MenuItem {
  padding: 5px 10px;
  vertical-align: bottom;
  color: #000;
  font-weight: bold;
}
.gwt-MenuBar-horizontal .gwt-MenuItemSeparator {
  width: 1px;
  padding: 0px;
  margin: 0px;
  border: 0px;
  border-left: 1px solid #ccc;
  background: white;
}
.gwt-MenuBar-horizontal .gwt-MenuItemSeparator .menuSeparatorInner {
  width: 1px;
  height: 1px;
  background: white; 
}
.gwt-MenuBar-vertical {
  margin-top: 0px;
  margin-left: 0px;
  background: white;
}
.gwt-MenuBar-vertical table {
  border-collapse: collapse;
}
.gwt-MenuBar-vertical .gwt-MenuItem {
  padding: 2px 40px 2px 1px;
}
.gwt-MenuBar-vertical .gwt-MenuItemSeparator {
  padding: 2px 0px;
}
.gwt-MenuBar-vertical .gwt-MenuItemSeparator .menuSeparatorInner {
  height: 1px;
  padding: 0px;
  border: 0px;
  border-top: 1px solid #ccc;
  overflow: hidden;
}
.gwt-MenuBar-vertical .subMenuIcon {
  padding-right: 4px;
}
.gwt-MenuBar-vertical .subMenuIcon-selected {
  background: #E3E8F3;
}
.gwt-MenuBarPopup {
  margin: 0px 0px 0px 3px;
}
.gwt-MenuBarPopup .menuPopupTopCenter {
  background: url(images/hborder.png) 0px -12px repeat-x;
}
.gwt-MenuBarPopup .menuPopupBottomCenter {
  background: url(images/hborder.png) 0px -13px repeat-x;
  -background: url(images/hborder_ie6.png) 0px -13px repeat-x;
}
.gwt-MenuBarPopup .menuPopupMiddleLeft {
  background: url(images/vborder.png) -12px 0px repeat-y;
  -background: url(images/vborder_ie6.png) -12px 0px repeat-y;
}
.gwt-MenuBarPopup .menuPopupMiddleRight {
  background: url(images/vborder.png) -13px 0px repeat-y;
  -background: url(images/vborder_ie6.png) -13px 0px repeat-y;
}
.gwt-MenuBarPopup .menuPopupTopLeftInner {
  width: 5px;
  height: 5px;
  zoom: 1;
}
.gwt-MenuBarPopup .menuPopupTopRightInner {
  width: 8px;
  height: 5px;
  zoom: 1;
}
.gwt-MenuBarPopup .menuPopupBottomLeftInner {
  width: 5px;
  height: 8px;
  zoom: 1;
}
.gwt-MenuBarPopup .menuPopupBottomRightInner {
  width: 8px;
  height: 8px;
  zoom: 1;
}
.gwt-MenuBarPopup .menuPopupTopLeft {
  background: url(images/corner.png) no-repeat 0px -36px;
  -background: url(images/corner_ie6.png) no-repeat 0px -36px;
}
.gwt-MenuBarPopup .menuPopupTopRight {
  background: url(images/corner.png) no-repeat -5px -36px;
  -background: url(images/corner_ie6.png) no-repeat -5px -36px;
}
.gwt-MenuBarPopup .menuPopupBottomLeft {
  background: url(images/corner.png) no-repeat 0px -41px;
  -background: url(images/corner_ie6.png) no-repeat 0px -41px;
}
.gwt-MenuBarPopup .menuPopupBottomRight {
  background: url(images/corner.png) no-repeat -5px -41px;
  -background: url(images/corner_ie6.png) no-repeat -5px -41px;
}
html>body .gwt-MenuBarPopup {
}
* html .gwt-MenuBarPopup .menuPopupTopLeftInner {
  width: 5px;
  height: 5px;
  overflow: hidden;
}
* html .gwt-MenuBarPopup .menuPopupTopRightInner {
  width: 8px;
  height: 5px;
  overflow: hidden;
}
* html .gwt-MenuBarPopup .menuPopupBottomLeftInner {
  width: 5px;
  height: 8px;
  overflow: hidden;
}
* html .gwt-MenuBarPopup .menuPopupBottomRightInner {
  width: 8px;
  height: 8px;
  overflow: hidden;
}

------------------------------

 private boolean createMenu ()
 {
  mnb.clearItems();
  mnb_cur = mnb;
  //Constants con = itn.con;
  Vocabulary voc = itn.lgo.voc;
  Phrasing   phr = itn.lgo.phr;
  MenuBar m;

  addMenu (voc.account);
  addItem (voc.login               ,Command.ACC_LOGIN           ,Role.FOREIGNER);
  addItem (voc.logout              ,Command.ACC_LOGOUT          ,Role.USER);
  addSep  ();
  addItem (voc.identity            ,Command.ACC_IDENTITY        ,Role.ADMIN); //Role.USER);
  addItem (voc.profile             ,Command.ACC_PROFILE         ,Role.USER);
  addItem (voc.registration        ,Command.ACC_REGISTER        ,Role.FOREIGNER);
  addSep  ();
  addItem (voc.changePassword      ,Command.ACC_PASSWORD        ,Role.USER);
  endMenu ();

  addMenu (voc.games);
  addItem (voc.portal              ,Command.GAME_PORTAL         ,Role.USER);
  addSep  ();
  addItem (phr.createInvitation    ,Command.GAME_INVITE         ,Role.USER);
  addSep  ();
  addItem (phr.createGame          ,Command.GAME_CREATE         ,Role.ADMIN);
  addItem (phr.listGames           ,Command.GAME_LIST           ,Role.USER);
  endMenu ();

  addMenu (voc.tournaments );
  addItem (phr.createTournament    ,Command.TOURNAMENT_CREATE   ,Role.ADMIN);
  addItem (phr.listTournaments     ,Command.TOURNAMENT_LIST     ,Role.USER);
  endMenu ();

  addMenu (voc.members);
  addItem (phr.hallOfFame          ,Command.MEMBER_HOE    ,Role.USER);
  endMenu ();
  
  addMenu (voc.community);
  addItem ("Open Chat"             ,Command.COMMUNITY_CHAT      ,Role.USER);
  endMenu ();
  
  addMenu (voc.club );
  addItem ("Create Club"           ,Command.CLUB_CREATE         ,Role.ADMIN);
  addItem ("List Clubs"            ,Command.CLUB_LIST           ,Role.ADMIN);
  endMenu ();
  
//  addMenu ("Werkstatt");
//  addItem ("Entkäferung"            ,Command.DEBUG               ,Role.USER);
//  endMenu ();
  
  addMenu (voc.administration);
  addItem (voc.journal              ,Command.ADM_JOURNAL         ,Role.ADMIN);
  addSep ();
  addItem ("Create User"           ,Command.ADM_USER_CREATE     ,Role.ADMIN);
  addItem ("List Users"            ,Command.ADM_USER_LIST       ,Role.ADMIN);
  addItem ("Manage Users"          ,Command.ADM_USER_MANAGER    ,Role.ADMIN);
  addSep ();
  addItem ("Exchange"              ,Command.ADM_EXCHANGE        ,Role.ADMIN);
  addSep ();
  addItem (voc.reset               ,Command.ADM_RESET           ,Role.ADMIN);
  addItem ("Reorganize"            ,Command.ADM_REORGANIZE       ,Role.ADMIN);
  addSep ();
  addItem ("Statistics"            ,Command.ADM_STATISTICS       ,Role.ADMIN);
  endMenu ();

  addMenu (voc.help);
  addItem (voc.about             ,Command.HLP_ABOUT          ,null); // all
  endMenu ();

  addMenu (voc.test);
  addItem ("Test TabPanel"         ,Command.TST_TABPANEL       ,Role.ADMIN);
  addItem ("Test Session Data"     ,Command.TST_GETSESSIONDATA ,Role.ADMIN);
  addItem ("Test Auto Login"       ,Command.TST_AUTOLOGIN      ,Role.ADMIN);
  addItem ("Test Portal"           ,Command.TST_PORTAL         ,Role.ADMIN);
  addItem ("Test GridLayout"          ,Command.TST_GRIDLAYOUT       ,Role.ADMIN);
  addItem ("Test Locale"           ,Command.TST_LOCALE        ,Role.ADMIN);
   addMenu ("XXX");
   addItem ("Test 1"           ,Command.TST_LOCALE        ,Role.ADMIN);
   addItem ("Test 2"           ,Command.TST_LOCALE        ,Role.ADMIN);
   addItem ("Test 3"           ,Command.TST_LOCALE        ,Role.ADMIN);
   endMenu ();
  endMenu ();
  
  return (true);
 }
 
 private void addMenu (String atr)
 {
  MenuBar m = new MenuBar (true);
  

  String t = atr;

  mnb_cur.addItem (t,m);
  stk.push (mnb_cur);
  mnb_cur = m;
 }

 private void addItem (String txt,Command cmd,Role rol)
 {
  MenuBar m = mnb_cur;
  MenuItem i = m.addItem (txt,new Commando (this,cmd));
  lst.add (i);
  //map_Command.put (cmd,false); //true);
  map_Command.put (cmd,rol);
 }

 private void addSep ()
 {
  MenuBar m = mnb_cur;
  m.addSeparator ();
 }
 
 private void endMenu ()
 {
  mnb_cur = stk.pop ();
 }

Reply all
Reply to author
Forward
0 new messages