示例#1
0
文件: Menu.java 项目: mxro/osgi-maven
 protected boolean onAutoHide(PreviewEvent pe) {
   if ((pe.getEventTypeInt() == Event.ONMOUSEDOWN
           || pe.getEventTypeInt() == Event.ONMOUSEWHEEL
           || pe.getEventTypeInt() == Event.ONSCROLL
           || pe.getEventTypeInt() == Event.ONKEYPRESS)
       && !(pe.within(getElement())
           || (fly(pe.getTarget()).findParent(".x-ignore", -1) != null))) {
     MenuEvent me = new MenuEvent(this);
     me.setEvent(pe.getEvent());
     if (fireEvent(Events.AutoHide, me)) {
       hide(true);
       return true;
     }
   }
   return false;
 }
示例#2
0
 private void itemSelected(ComponentEvent ce) {
   Window w;
   if (ce instanceof MenuEvent) {
     MenuEvent me = (MenuEvent) ce;
     w = me.getItem().getData("window");
   } else {
     w = ce.getComponent().getData("window");
   }
   if (!desktop.getWindows().contains(w)) {
     desktop.addWindow(w);
   }
   if (w != null && !w.isVisible()) {
     w.show();
   } else {
     w.toFront();
   }
 }