/** * Return a decorated form of the component returned by the data * {@link TableCellEditor}. */ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, 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 editor accepts TreeNodeData, give it if (delegate instanceof TreeTableNodeDataEditor) ((TreeTableNodeDataEditor) delegate).setTreeNodeData(treeNodeData); // ask the delegate editor to produce the data component final Component c = delegate.getTableCellEditorComponent(table, value, isSelected, 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, false, indent, spacer); return component; }
/** * Return a decorated form of the component returned by the data * {@link TableCellEditor}. */ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, 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 editor accepts TreeNodeData, give it if (delegate instanceof TreeTableNodeDataEditor) ((TreeTableNodeDataEditor) delegate).setTreeNodeData(treeNodeData); // ask the delegate editor to produce the data component final Component c = delegate.getTableCellEditorComponent(table, value, isSelected, 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, false, indent, spacer); return component; }
/** * Return a decorated form of the component returned by the data * {@link TableCellEditor}. */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, 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 editor accepts TreeNodeData, give it if (delegate instanceof TreeTableNodeDataEditor) ((TreeTableNodeDataEditor) delegate).setTreeNodeData(treeNodeData); // ask the delegate editor to produce the data component final Component c = delegate.getTableCellEditorComponent(table, value, isSelected, 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, false, indent, spacer); return component; }