/** * Overriden to determine an offset that tree would place the editor at. The * offset is determined from the <code>getRowBounds</code> JTree method, * and additionaly from the icon DefaultTreeCellRenderer will use. * <p> * The offset is then set on the TreeTableTextField component created in the * constructor, and returned. */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component component = super.getTableCellEditorComponent(table, value, isSelected, row, column); // JW: this implementation is not bidi-compliant, need to do better initEditorOffset(table, row, column, isSelected); return component; }
/** * @param row * @param isSelected */ protected void initEditorOffset(JTable table, int row, int column, boolean isSelected) { if (tree == null) return; // Rectangle bounds = tree.getRowBounds(row); // int offset = bounds.x; Object node = tree.getPathForRow(row).getLastPathComponent(); boolean leaf = tree.getModel().isLeaf(node); boolean expanded = tree.isExpanded(row); TreeCellRenderer tcr = tree.getCellRenderer(); Component editorComponent = tcr.getTreeCellRendererComponent(tree, node, isSelected, expanded, leaf, row, false); ((TreeTableTextField) getComponent()).init(row, column, table, tree, editorComponent); }
hierarchicalEditor = new TreeTableCellEditor(renderer);
/** * @param row * @param isSelected */ protected void initEditorOffset(JTable table, int row, int column, boolean isSelected) { if (tree == null) return; // Rectangle bounds = tree.getRowBounds(row); // int offset = bounds.x; Object node = tree.getPathForRow(row).getLastPathComponent(); boolean leaf = tree.getModel().isLeaf(node); boolean expanded = tree.isExpanded(row); TreeCellRenderer tcr = tree.getCellRenderer(); Component editorComponent = tcr.getTreeCellRendererComponent(tree, node, isSelected, expanded, leaf, row, false); ((TreeTableTextField) getComponent()).init(row, column, table, tree, editorComponent); }
hierarchicalEditor = new TreeTableCellEditor(renderer);
/** * Overriden to determine an offset that tree would place the editor at. The * offset is determined from the <code>getRowBounds</code> JTree method, * and additionaly from the icon DefaultTreeCellRenderer will use. * <p> * The offset is then set on the TreeTableTextField component created in the * constructor, and returned. */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component component = super.getTableCellEditorComponent(table, value, isSelected, row, column); // JW: this implementation is not bidi-compliant, need to do better initEditorOffset(table, row, column, isSelected); return component; }
/** * @param row * @param isSelected */ protected void initEditorOffset(JTable table, int row, int column, boolean isSelected) { if (tree == null) return; // Rectangle bounds = tree.getRowBounds(row); // int offset = bounds.x; Object node = tree.getPathForRow(row).getLastPathComponent(); boolean leaf = tree.getModel().isLeaf(node); boolean expanded = tree.isExpanded(row); TreeCellRenderer tcr = tree.getCellRenderer(); Component editorComponent = tcr.getTreeCellRendererComponent(tree, node, isSelected, expanded, leaf, row, false); ((TreeTableTextField) getComponent()).init(row, column, table, tree, editorComponent); }
hierarchicalEditor = new TreeTableCellEditor(renderer);
/** * Overriden to determine an offset that tree would place the editor at. The * offset is determined from the <code>getRowBounds</code> JTree method, * and additionaly from the icon DefaultTreeCellRenderer will use. * <p> * The offset is then set on the TreeTableTextField component created in the * constructor, and returned. */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component component = super.getTableCellEditorComponent(table, value, isSelected, row, column); // JW: this implementation is not bidi-compliant, need to do better initEditorOffset(table, row, column, isSelected); return component; }
/** * @param row * @param isSelected */ protected void initEditorOffset(JTable table, int row, int column, boolean isSelected) { if (tree == null) return; // Rectangle bounds = tree.getRowBounds(row); // int offset = bounds.x; Object node = tree.getPathForRow(row).getLastPathComponent(); boolean leaf = tree.getModel().isLeaf(node); boolean expanded = tree.isExpanded(row); TreeCellRenderer tcr = tree.getCellRenderer(); Component editorComponent = tcr.getTreeCellRendererComponent(tree, node, isSelected, expanded, leaf, row, false); ((TreeTableTextField) getComponent()).init(row, column, table, tree, editorComponent); }
hierarchicalEditor = new TreeTableCellEditor(renderer);
/** * Overriden to determine an offset that tree would place the editor at. The * offset is determined from the <code>getRowBounds</code> JTree method, * and additionaly from the icon DefaultTreeCellRenderer will use. * <p> * The offset is then set on the TreeTableTextField component created in the * constructor, and returned. */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component component = super.getTableCellEditorComponent(table, value, isSelected, row, column); // JW: this implementation is not bidi-compliant, need to do better initEditorOffset(table, row, column, isSelected); return component; }
((TreeTableTextField) getComponent()).init(offset, column, bounds.width, table);
hierarchicalEditor = new TreeTableCellEditor(renderer);
/** * Overriden to determine an offset that tree would place the editor at. The * offset is determined from the <code>getRowBounds</code> JTree method, * and additionaly from the icon DefaultTreeCellRenderer will use. * <p> * The offset is then set on the TreeTableTextField component created in the * constructor, and returned. */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component component = super.getTableCellEditorComponent(table, value, isSelected, row, column); // JW: this implementation is not bidi-compliant, need to do better initEditorOffset(table, row, column, isSelected); return component; }