Exemple #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);
   }
 }
Exemple #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;
     }
   }
 }
 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));
     }
   }
 }
Exemple #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);
         }
       });
 }
Exemple #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);
       }
     }
   }
 }
Exemple #6
0
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   if (ce.getEventTypeInt() == Event.ONCLICK) {
     onClick(ce);
   }
 }
Exemple #7
0
 protected void onClick(ComponentEvent ce) {
   if (cancelBubble) {
     ce.cancelBubble();
   }
   removeStyleName(style + "-over");
   fireEvent(Events.Select, ce);
 }
Exemple #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);
   }
 }
 /** {@inheritDoc} */
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   switch (ce.getEventTypeInt()) {
     case Event.ONCHANGE:
       onChange();
       break;
   }
 }
Exemple #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);
     }
   }
 }
Exemple #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();
   }
 }
 /** {@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();
 }
Exemple #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);
      }
    }
  }
Exemple #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);
   }
 }
 @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;
   }
 }
 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();
   }
 }
Exemple #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();
 }
Exemple #20
0
 protected void onKeyPress(ComponentEvent ce) {
   int code = ce.getKeyCode();
   if (code == KeyCodes.KEY_ENTER || code == 32) {
     onClick(ce);
   }
 }
Exemple #21
0
 protected void onKeyUp(ComponentEvent ce) {
   ce.stopEvent();
   if (tryActivate(indexOf(activeItem) - 1, -1) == null) {
     tryActivate(getItemCount() - 1, -1);
   }
 }
Exemple #22
0
 protected void onKeyDown(ComponentEvent ce) {
   ce.stopEvent();
   if (tryActivate(indexOf(activeItem) + 1, 1) == null) {
     tryActivate(0, 1);
   }
 }
Exemple #23
0
 protected void onClick(ComponentEvent ce) {
   Component item = findItem(ce.getTarget());
   if (item != null && item instanceof Item) {
     ((Item) item).onClick(ce);
   }
 }
 protected void onMouseOver(ComponentEvent ce) {
   El target = ce.getTarget("a", 3);
   if (target != null) {
     target.addStyleName("x-color-palette-hover");
   }
 }