Esempio n. 1
0
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   ButtonEvent be = (ButtonEvent) ce;
   switch (ce.getEventTypeInt()) {
     case Event.ONMOUSEOVER:
       onMouseOver(ce);
       break;
     case Event.ONMOUSEOUT:
       onMouseOut(ce);
       break;
     case Event.ONMOUSEDOWN:
       ce.stopEvent();
       onMouseDown(ce);
       break;
     case Event.ONMOUSEUP:
       ce.stopEvent();
       onMouseUp(ce);
       break;
     case Event.ONCLICK:
       ce.stopEvent();
       onClick(ce);
       break;
     case Event.ONFOCUS:
       onFocus(ce);
       break;
     case Event.ONBLUR:
       onBlur(be);
   }
 }
Esempio n. 2
0
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   switch (ce.getEventTypeInt()) {
     case Event.ONCLICK:
       onClick(ce);
       break;
     case Event.ONMOUSEMOVE:
       onMouseMove(ce);
       break;
     case Event.ONMOUSEOUT:
       onMouseOut(ce);
       break;
     case Event.ONMOUSEOVER:
       onMouseOver(ce);
       break;
     case Event.ONMOUSEWHEEL:
       if (enableScrolling) {
         scrollMenu(ce.getEvent().getMouseWheelVelocityY() < 0);
       }
   }
   El t = ce.getTargetEl();
   if (enableScrolling && t.is(".x-menu-scroller")) {
     switch (ce.getEventTypeInt()) {
       case Event.ONMOUSEOVER:
         // deactiveActiveItem();
         onScrollerIn(t);
         break;
       case Event.ONMOUSEOUT:
         onScrollerOut(t);
         break;
     }
   }
 }
Esempio n. 3
0
 protected void onClick(ComponentEvent ce) {
   ce.preventDefault();
   if (!disabled) {
     El aElement = ce.getTarget("a", 3);
     String className = aElement.getStyleName();
     if (className.indexOf("color-") != -1) {
       select(
           className.substring(className.indexOf("color-") + 6, className.indexOf("color-") + 12));
     }
   }
 }
Esempio n. 4
0
 @Override
 protected void onRightClick(ComponentEvent ce) {
   ce.stopEvent();
   final int x = ce.getClientX();
   final int y = ce.getClientY();
   DeferredCommand.addCommand(
       new Command() {
         public void execute() {
           tabPanel.onItemContextMenu(TabItem.this, x, y);
         }
       });
 }
Esempio n. 5
0
 protected void onMouseOver(ComponentEvent ce) {
   EventTarget from = ce.getEvent().getRelatedEventTarget();
   if (from == null
       || (Element.is(from) && !DOM.isOrHasChild(getElement(), (Element) Element.as(from)))) {
     Component c = findItem(ce.getTarget());
     if (c != null && c instanceof Item) {
       Item item = (Item) c;
       if (activeItem != item && item.canActivate && item.isEnabled()) {
         setActiveItem(item, true);
       }
     }
   }
 }
Esempio n. 6
0
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   if (ce.getEventTypeInt() == Event.ONCLICK) {
     onClick(ce);
   }
 }
Esempio n. 7
0
 protected void onClick(ComponentEvent ce) {
   if (cancelBubble) {
     ce.cancelBubble();
   }
   removeStyleName(style + "-over");
   fireEvent(Events.Select, ce);
 }
Esempio n. 8
0
 protected void onClick(ComponentEvent ce) {
   if (checkboxToggle && ce.getTarget() == (Element) checkbox.cast()) {
     setExpanded(!isExpanded());
     boolean isExpanded = isExpanded();
     checkbox.setChecked(isExpanded);
     checkbox.setDefaultChecked(isExpanded);
   }
 }
Esempio n. 9
0
 /** {@inheritDoc} */
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   switch (ce.getEventTypeInt()) {
     case Event.ONCHANGE:
       onChange();
       break;
   }
 }
Esempio n. 10
0
 protected void onMouseMove(ComponentEvent ce) {
   Component c = findItem(ce.getTarget());
   if (c != null && c instanceof Item) {
     Item item = (Item) c;
     if (activeItem != item && item.canActivate && item.isEnabled()) {
       setActiveItem(item, true);
     }
   }
 }
Esempio n. 11
0
 protected void onMouseOut(ComponentEvent ce) {
   EventTarget to = ce.getEvent().getRelatedEventTarget();
   if (activeItem != null
       && (to == null
           || (Element.is(to)
               && !DOM.isOrHasChild(activeItem.getElement(), (Element) Element.as(to))))
       && activeItem.shouldDeactivate(ce)) {
     deactiveActiveItem();
   }
 }
Esempio n. 12
0
 /** {@inheritDoc} */
 @Override
 protected void onBlur(ComponentEvent ce) {
   final Rectangle rec = button.el().getBounds();
   if (rec.contains(BaseEventPreview.getLastXY())) {
     ce.stopEvent();
     return;
   }
   super.onBlur(ce);
   focusPreview.remove();
 }
Esempio n. 13
0
  @Override
  public void onComponentEvent(ComponentEvent ce) {
    super.onComponentEvent(ce);
    if (ce.getEventTypeInt() == Event.ONMOUSEDOWN) {

      // dont bring to front on clicks where active is model as active window
      // may have just been opened from this click event
      Window active = manager.getActive();
      if (active != null && active != this && !active.isModal()) {
        manager.bringToFront(this);
      }
    }
  }
Esempio n. 14
0
 protected void onClick(ComponentEvent ce) {
   ce.preventDefault();
   focus();
   hideToolTip();
   if (!disabled) {
     ButtonEvent be = new ButtonEvent(this);
     if (!fireEvent(Events.BeforeSelect, be)) {
       return;
     }
     if (menu != null && !menu.isVisible()) {
       showMenu();
     }
     fireEvent(Events.Select, be);
   }
 }
Esempio n. 15
0
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   switch (ce.getEventTypeInt()) {
     case Event.ONCLICK:
       onClick(ce);
       break;
     case Event.ONMOUSEOVER:
       onMouseOver(ce);
       break;
     case Event.ONMOUSEOUT:
       onMouseOut(ce);
       break;
   }
 }
Esempio n. 16
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();
   }
 }
Esempio n. 17
0
 public void onComponentEvent(ComponentEvent ce) {
   switch (ce.getEventTypeInt()) {
     case Event.ONMOUSEOVER:
       addStyleName(style + "-over");
       break;
     case Event.ONMOUSEOUT:
       removeStyleName(style + "-over");
       break;
     case Event.ONCLICK:
       onClick(ce);
       break;
     case Event.ONFOCUS:
       onFocus(ce);
       break;
     case Event.ONBLUR:
       onBlur(ce);
       break;
     case Event.ONKEYUP:
       onKeyPress(ce);
       break;
   }
 }
 protected void onKeyUp(ComponentEvent e) {
   selectPrevious(e.isShiftKey());
   e.preventDefault();
 }
 protected void onKeyDown(ComponentEvent e) {
   selectNext(e.isShiftKey());
   e.preventDefault();
 }
Esempio n. 20
0
 protected void onKeyPress(ComponentEvent ce) {
   int code = ce.getKeyCode();
   if (code == KeyCodes.KEY_ENTER || code == 32) {
     onClick(ce);
   }
 }
Esempio n. 21
0
 protected void onKeyUp(ComponentEvent ce) {
   ce.stopEvent();
   if (tryActivate(indexOf(activeItem) - 1, -1) == null) {
     tryActivate(getItemCount() - 1, -1);
   }
 }
Esempio n. 22
0
 protected void onKeyDown(ComponentEvent ce) {
   ce.stopEvent();
   if (tryActivate(indexOf(activeItem) + 1, 1) == null) {
     tryActivate(0, 1);
   }
 }
Esempio n. 23
0
 protected void onClick(ComponentEvent ce) {
   Component item = findItem(ce.getTarget());
   if (item != null && item instanceof Item) {
     ((Item) item).onClick(ce);
   }
 }
Esempio n. 24
0
 protected void onMouseOver(ComponentEvent ce) {
   El target = ce.getTarget("a", 3);
   if (target != null) {
     target.addStyleName("x-color-palette-hover");
   }
 }