/** * Return a decorated form of the component returned by the data * {@link TableCellRenderer}. */ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { treeList.getReadWriteLock().readLock().lock(); try { // read information about the tree node from the TreeList treeNodeData.setDepth(treeList.depth(row)); treeNodeData.setExpanded(treeList.isExpanded(row)); treeNodeData.setHasChildren(treeList.hasChildren(row)); treeNodeData.setAllowsChildren(treeList.getAllowsChildren(row)); } finally { treeList.getReadWriteLock().readLock().unlock(); } // if the delegate renderer accepts TreeNodeData, give it if (delegate instanceof TreeTableNodeDataRenderer) ((TreeTableNodeDataRenderer) delegate).setTreeNodeData(treeNodeData); // ask the delegate renderer to produce the data component final Component c = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); // fetch the number of pixels to indent final int indent = getIndent(treeNodeData, showExpanderForEmptyParent); // fetch the number of pixels to space over final int spacer = getSpacer(treeNodeData, showExpanderForEmptyParent); // ask our special component to configure itself for this tree node component.configure(treeNodeData, showExpanderForEmptyParent, c, hasFocus, indent, spacer); return component; }
/** * Return a decorated form of the component returned by the data * {@link TableCellRenderer}. */ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { treeList.getReadWriteLock().readLock().lock(); try { // read information about the tree node from the TreeList treeNodeData.setDepth(treeList.depth(row)); treeNodeData.setExpanded(treeList.isExpanded(row)); treeNodeData.setHasChildren(treeList.hasChildren(row)); treeNodeData.setAllowsChildren(treeList.getAllowsChildren(row)); } finally { treeList.getReadWriteLock().readLock().unlock(); } // if the delegate renderer accepts TreeNodeData, give it if (delegate instanceof TreeTableNodeDataRenderer) ((TreeTableNodeDataRenderer) delegate).setTreeNodeData(treeNodeData); // ask the delegate renderer to produce the data component final Component c = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); // fetch the number of pixels to indent final int indent = getIndent(treeNodeData, showExpanderForEmptyParent); // fetch the number of pixels to space over final int spacer = getSpacer(treeNodeData, showExpanderForEmptyParent); // ask our special component to configure itself for this tree node component.configure(treeNodeData, showExpanderForEmptyParent, c, hasFocus, indent, spacer); return component; }
/** * Return a decorated form of the component returned by the data * {@link TableCellRenderer}. */ @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { treeList.getReadWriteLock().readLock().lock(); try { // read information about the tree node from the TreeList treeNodeData.setDepth(treeList.depth(row)); treeNodeData.setExpanded(treeList.isExpanded(row)); treeNodeData.setHasChildren(treeList.hasChildren(row)); treeNodeData.setAllowsChildren(treeList.getAllowsChildren(row)); } finally { treeList.getReadWriteLock().readLock().unlock(); } // if the delegate renderer accepts TreeNodeData, give it if (delegate instanceof TreeTableNodeDataRenderer) ((TreeTableNodeDataRenderer) delegate).setTreeNodeData(treeNodeData); // ask the delegate renderer to produce the data component final Component c = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); // fetch the number of pixels to indent final int indent = getIndent(treeNodeData, showExpanderForEmptyParent); // fetch the number of pixels to space over final int spacer = getSpacer(treeNodeData, showExpanderForEmptyParent); // ask our special component to configure itself for this tree node component.configure(treeNodeData, showExpanderForEmptyParent, c, hasFocus, indent, spacer); return component; }