@Nullable private GraphElement overCell(MouseEvent e) { int y = PositionUtil.getYInsideRow(e); int x = e.getX(); GraphPrintCell row = getGraphPrintCell(e); return row != null ? myGraphPainter.mouseOver(row, x, y) : null; }
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { Node jumpToNode = arrowToNode(e); if (jumpToNode != null) { jumpToRow(jumpToNode.getRowIndex()); return; } GraphElement graphElement = overCell(e); myUI.click(graphElement); if (graphElement == null) { myUI.click(PositionUtil.getRowIndex(e)); } } myTableListener.onClick(e, e.getClickCount()); }
@Nullable private Node arrowToNode(MouseEvent e) { int y = PositionUtil.getYInsideRow(e); int x = e.getX(); GraphPrintCell row = getGraphPrintCell(e); if (row == null) { return null; } SpecialPrintElement printElement = myGraphPainter.mouseOverArrow(row, x, y); if (printElement == null) { return null; } Edge edge = printElement.getGraphElement().getEdge(); if (edge == null) { return null; } return printElement.getType() == SpecialPrintElement.Type.DOWN_ARROW ? edge.getDownNode() : edge.getUpNode(); }
@Nullable private GraphPrintCell getGraphPrintCell(MouseEvent e) { int rowIndex = PositionUtil.getRowIndex(e); return getGraphPrintCellForRow(getModel(), rowIndex); }