private AnchorLink getAbsoluteAnchorLinkWithCell ( int dragOffsetX ) { AnchorLink absoluteAnchorLink ; TableModel tableModel = table . getModel ( ) ; if ( ( 0 <= modelRowIndex ) && ( modelRowIndex < tableModel . getRowCount ( ) ) && ( 0 <= modelColumnIndex ) && ( modelColumnIndex < tableModel . getColumnCount ( ) ) ) { int viewRowIndex = table . convertRowIndexToView ( modelRowIndex ) ; int viewColumnIndex = table . convertColumnIndexToView ( modelColumnIndex ) ; Rectangle cellBounds = table . getCellRect ( viewRowIndex , viewColumnIndex , true ) ; Anchor relativeCellAnchor = anchorLinkWithCell . getMasterAnchor ( ) ; Anchor absoluteCellAnchor = new Anchor ( 0.0f , cellBounds . x + dragOffsetX + ( int ) ( cellBounds . width * relativeCellAnchor . getRelativeX ( ) ) + relativeCellAnchor . getOffsetX ( ) , 0.0f , cellBounds . y + ( int ) ( cellBounds . height * relativeCellAnchor . getRelativeY ( ) ) + relativeCellAnchor . getOffsetY ( ) ) ; absoluteAnchorLink = new AnchorLink ( absoluteCellAnchor , anchorLinkWithCell . getSlaveAnchor ( ) ) ; } else { // Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index? LOGGER . debug ( "Cell at model row and/or column indices is not visible: (" + modelRowIndex + "," + modelColumnIndex + ") for table dimensions (" + tableModel . getRowCount ( ) + "," + tableModel . getColumnCount ( ) + ")" ) ; // Decoration will not be shown absoluteAnchorLink = null ; } return absoluteAnchorLink ; }
Retrieves the absolute anchor link to attach the decoration to the cell .