java - Vaadin MenuBar Acting Strangely with IE -
good evening everyone!
i have deployed application made vaadin7 , , during testing, encountered weird when running app on ie.
the menu bar shows three(3) items , rest viewed via triangular button. happens on ie (we have ie11 on office btw, if helps).. on firefox , chrome, works perfectly, shown in picture below:
this code used header:
import java.io.file; import java.util.arraylist; import java.util.list; import no.solarsoft.studentweb.listener.menuitemselectionlistener; import no.solarsoft.studentweb.manager.resourcemanager; import no.solarsoft.studentweb.manager.sessionhelper; import no.solarsoft.studentweb.theme.studentwebtheme; import org.apache.logging.log4j.logmanager; import org.apache.logging.log4j.logger; import com.vaadin.server.fileresource; import com.vaadin.server.page; import com.vaadin.server.themeresource; import com.vaadin.server.vaadinservice; import com.vaadin.ui.menubar.menuitem; import com.vaadin.ui.customcomponent; import com.vaadin.ui.image; import com.vaadin.ui.menubar; import com.vaadin.ui.panel; import com.vaadin.ui.ui; import com.vaadin.ui.verticallayout; public class header extends customcomponent{ private static final long serialversionuid = 4573713330320823676l; list<menuitemselectionlistener> menuitemlisteners = new arraylist<menuitemselectionlistener>(); private menubar barmenu ; private verticallayout headerlayout; private panel panel; private logger logger ; image imgorganisation; private menuitem previous = null; private static final string base_path = vaadinservice.getcurrent().getbasedirectory().getabsolutepath(); public header(){ logger = logmanager.getlogger(header.class); menubar.command mycommand = new menubar.command() { private static final long serialversionuid = -1224979160403018369l; @override public void menuselected(menuitem selecteditem) { // todo auto-generated method stub int id = selecteditem.getid(); (menuitemselectionlistener l : menuitemlisteners) { l.handlemenuitemselection(id); } if(previous!=null){ previous.setstylename(null); } selecteditem.setstylename(studentwebtheme.header_highlight); previous = selecteditem; } }; barmenu = new menubar(); barmenu.addstylename("mybarmenu"); panel = new panel(); headerlayout = new verticallayout(); imgorganisation = resourcemanager.getinstance().getlogoasimage(sessionhelper.getorganisationcode()+".png"); if(barmenu.getitems().size()==0){ barmenu.additem("persondetaljer", null,mycommand); barmenu.additem("studieplan", null,mycommand); barmenu.additem("studieprogrammer", null,mycommand); barmenu.additem("gjennomføringer", null,mycommand); barmenu.additem("eksamener", null,mycommand); barmenu.additem("endelige karakterer", null,mycommand); barmenu.additem("lånekassen", null,mycommand); barmenu.additem("artikkel", null,mycommand); barmenu.additem("instillinger", null,mycommand); barmenu.additem("logg av", null,mycommand); } logger.info("menu bar size: {} ", barmenu.getitems().size()); barmenu.setsizefull(); imgorganisation .setsizeundefined(); barmenu.setvisible(false); headerlayout.addcomponents(imgorganisation,barmenu); headerlayout.setspacing(true); panel.setcontent(headerlayout); panel.setsizeundefined(); panel.setwidth("100%"); panel.getcontent().setsizeundefined(); setcompositionroot(panel); } public void setmenubarvisible(boolean visible){ barmenu.setvisible(visible); } public void setmenuitemstyle(string uri){ for(menuitem item : barmenu.getitems()){ logger.info(" \nitem: {} \nuri:{} \nprevious: {} ", item.gettext(), uri,previous==null?"null":previous.gettext()); if(uri.equalsignorecase(itemtouri(item.gettext()))){ logger.info("bingo! "); item.setstylename(studentwebtheme.header_highlight); previous=item; }else{ item.setstylename(null); logger.info("style name: {}", item.getstylename()); logger.info("null style"); } } } public string itemtouri(string itemname){ string newitemname=""; for(int index =0;index<itemname.length();index++){ switch(itemname.charat(index)){ case 'Å': case 'å': newitemname+="aa"; break; case 'Ø': case 'ø': newitemname+="oe"; break; case 'Æ': case 'æ': newitemname+="ae"; break; case ' ': break; default: newitemname+=itemname.charat(index); } } return newitemname; } public void addmenuitemselectionlistener(menuitemselectionlistener l) { menuitemlisteners.add(l); }
i wonder why appears "weird" on ie. hope can me. thanks!
Comments
Post a Comment