Package com.sencha.gxt.widget.core.client.event

Examples of com.sencha.gxt.widget.core.client.event.XEvent


      setValue(activeDate.addMonths(-1).asDate(), false);
    }
  }

  protected void onKeyRight(NativeEvent evt) {
    XEvent e = evt.cast();
    e.stopEvent();
    if (e.getCtrlOrMetaKey()) {
      showNextMonth();
    } else {
      setValue(activeDate.addDays(1).asDate(), false);
    }
  }
View Full Code Here


      setValue(activeDate.addDays(1).asDate(), false);
    }
  }

  protected void onKeyUp(NativeEvent evt) {
    XEvent e = evt.cast();
    e.stopEvent();
    if (e.getCtrlOrMetaKey()) {
      showNextYear();
    } else {
      setValue(activeDate.addDays(-7).asDate(), false);
    }
  }
View Full Code Here

  protected void onClear(StoreClearEvent<M> event) {
    clear();
  }

  protected void onClick(Event event) {
    XEvent e = event.<XEvent> cast();
    TreeNode<M> node = findNode(event.getEventTarget().<Element> cast());
    if (node != null) {
      Element jointEl = view.getJointElement(node);
      if (jointEl != null && e.within(jointEl)) {
        toggle((M) node.getModel());
      }
      Element checkEl = view.getCheckElement(node);
      if (checkable && checkEl != null && e.within(checkEl)) {
        onCheckClick(event, node);
      }
    }
    ensureFocusElement();
    focusEl.setXY(event.getClientX(), event.getClientY());
View Full Code Here

      }
    }
  }

  protected void handleMouseDown(CellMouseDownEvent event) {
    XEvent e = event.getEvent().<XEvent> cast();
    if (e.getButton() != Event.BUTTON_LEFT || isLocked()) {
      return;
    }
    if (selection != null && selection.getRow() == event.getRowIndex() && selection.getCell() == event.getCellIndex()
        && e.getCtrlOrMetaKey()) {
      deselectAll();
      return;
    }
    selectCell(event.getRowIndex(), event.getCellIndex());
  }
View Full Code Here

  protected void onMouseClick(NativeEvent e) {
    if (isLocked()) {
      return;
    }

    XEvent xe = e.<XEvent> cast();

    if (selectionMode == SelectionMode.MULTI) {
      TreeNode<M> node = tree.findNode((Element) e.getEventTarget().cast());
      if (node != null && isSelected(node.getModel()) && getSelectedItems().size() > 1) {
        if (!xe.getCtrlOrMetaKey() && !e.getShiftKey()) {
          select(Collections.singletonList(node.getModel()), false);
        }
      }
    }
  }
View Full Code Here

      }
    }
  }

  protected void onMouseDown(NativeEvent e) {
    XEvent xe = e.<XEvent> cast();
    Element target = e.getEventTarget().cast();
    TreeNode<M> node = tree.findNode(target);
    if (node == null) {
      return;
    }
    M item = (M) node.getModel();
    if (item == null) return;
    if (!tree.getView().isSelectableTarget(item, target)) {
      return;
    }
    if (e.<XEvent> cast().isRightClick() && isSelected((M) item)) {
      return;
    }
    M sel = item;
    switch (selectionMode) {
      case SIMPLE:
        if (isSelected(sel)) {
          deselect(sel);
        } else {
          doSelect(Collections.singletonList(sel), true, false);
        }
        break;
      case SINGLE:
        tree.focus();
        doSingleSelect(sel, false);
        break;
      case MULTI:
        if (isSelected(sel) && !xe.getCtrlOrMetaKey() && !e.getShiftKey()) {
          return;
        }
        if (e.getShiftKey() && lastSelected != null) {
          List<M> items = new ArrayList<M>();
          if (lastSelected == sel) {
            return;
          }
          TreeNode<M> selNode = tree.findNode(lastSelected);
          TreeNode<M> itemNode = tree.findNode(sel);
          if (selNode.getElement() != null && itemNode.getElement() != null) {
            if (selNode.getElement().getAbsoluteTop() < itemNode.getElement().getAbsoluteTop()) {
              M next = next();
              while (next != null) {
                items.add(next);
                lastSelected = next;
                if (next == sel) break;
                next = next();
              }
            } else {
              M prev = prev();
              while (prev != null) {
                items.add(prev);
                lastSelected = prev;
                if (prev == sel) break;
                prev = prev();
              }
            }
            tree.focus();
            doSelect(items, true, false);
          }
        } else if (xe.getCtrlOrMetaKey() && isSelected(sel)) {
          tree.focus();
          doDeselect(Collections.singletonList(sel), false);
        } else {
          tree.focus();
          doSelect(Collections.singletonList(sel), xe.getCtrlOrMetaKey(), false);
        }
        break;
    }
  }
View Full Code Here

TOP

Related Classes of com.sencha.gxt.widget.core.client.event.XEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.