public void mouseMoved(MouseEvent e) { JTable table = (JTable) e.getSource(); Object tag = getTagAt(e); if (tag == myTag) { table.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { table.setCursor(Cursor.getDefaultCursor()); } }
@Nullable private SvnFileRevision getSelectedRevision(final MouseEvent e) { JTable table = (JTable) e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); final Object value = table.getModel().getValueAt(row, column); if (value instanceof SvnFileRevision) { return (SvnFileRevision) value; } return null; }
protected void customizeCellRenderer( final JTable table, final Object value, final boolean selected, final boolean hasFocus, final int row, final int column) { if (myListener == null) { myListener = new MergeSourceDetailsLinkListener(MERGE_SOURCE_DETAILS_TAG, myFile); myListener.install(table); } if (!(value instanceof SvnFileRevision)) { append("", SimpleTextAttributes.REGULAR_ATTRIBUTES); return; } final SvnFileRevision revision = (SvnFileRevision) value; final String text = getText(revision); if (text.length() == 0) { append("", SimpleTextAttributes.REGULAR_ATTRIBUTES); return; } append( cutString(text, table.getCellRect(row, column, false).getWidth()), SimpleTextAttributes.REGULAR_ATTRIBUTES); }
private void appendMergeSourceText(JTable table, int row, int column, @Nullable String text) { if (StringUtil.isEmpty(text)) { append("", SimpleTextAttributes.REGULAR_ATTRIBUTES); } else { append( cutString(text, table.getCellRect(row, column, false).getWidth()), SimpleTextAttributes.REGULAR_ATTRIBUTES, MERGE_SOURCE_DETAILS_TAG); } }