Пример #1
0
  @Override
  public void mousePressed(MouseEvent e) {
    // ------------------
    // Check Header click
    // ------------------

    Component comp = (Component) e.getSource();

    UIProperties uiSettings = table.getGuiSettings();

    // boolean ctrl=((e.getModifiersEx() & e.CTRL_DOWN_MASK) !=0);

    // Show Header Popup!
    if (isHeader(e) && (uiSettings.isPopupTrigger(e))) {
      String name = this.getColumnNameOf(e);
      if (name != null) {
        HeaderPopupMenu popupMenu = new HeaderPopupMenu(table, name);
        popupMenu.show(comp, e.getX(), e.getY());
      } else {
        // debug("No Column Header name!:"+e);
      }
    } else if (comp.equals(table)) {
      super.doMousePressed(e);
    } else if (comp.equals(table.getParent())) {
      super.doMousePressed(e);
    } else {
      logger.warnPrintf("Spurious Event:%s\n", e);
    }
  }
Пример #2
0
  @Override
  public void mouseClicked(MouseEvent e) {
    // ------------------
    // Check Header click
    // ------------------

    if (isHeader(e) && (table.getGuiSettings().isSelection(e))) {
      // Header Click:
      String name = this.getColumnNameOf(e);
      if (name != null) {
        String prevCol = this.table.getSortColumnName();
        boolean reverse = false;

        // click on already sorted column name -> reverse sorting.
        if (StringUtil.compare(prevCol, name) == 0) {
          reverse = (table.getColumnSortOrderIsReversed() == false);
        }
        this.table.doSortColumn(name, reverse);
      }
    } else {
      super.doMouseClicked(e);
    }
  }