private void determineOffset(MouseEvent me) { int row = TreeTable.this.rowAtPoint(me.getPoint()); if (row == -1) { offset = 0; return; } determineOffset(tree.getPathForRow(row).getLastPathComponent(), TreeTable.this.isRowSelected(row), row); }
private void revalidateTextField() { int row = TreeTable.this.editingRow; if (row == -1) { offset = 0; return; } determineOffset(tree.getPathForRow(row).getLastPathComponent(), TreeTable.this.isRowSelected(row), row); ((TreeTableTextField) super.getComponent()).offset = offset; getComponent().setBounds(TreeTable.this.getCellRect(row, getTreeColumnIndex(), false)); }
private boolean shouldStartEditingTimer(EventObject event) { if ((event instanceof MouseEvent) && SwingUtilities.isLeftMouseButton((MouseEvent)event)) { MouseEvent me = (MouseEvent)event; return (me.getID() == me.MOUSE_PRESSED && me.getClickCount() == 1 && inHitRegion(me)); } return false; }
Node n = Visualizer.findNode (lastP.getLastPathComponent()); if (n != null && n.canRename ()) { String newStr = (String) getCellEditorValue(); try {
return true; if (canEdit && shouldStartEditingTimer(e)) { startEditingTimer(); } else if (shouldStopEditingTimer(e)) { timer.stop();
return true; if (canEdit && shouldStartEditingTimer(e)) { startEditingTimer(); } else if (shouldStopEditingTimer(e)) { timer.stop();
if (canEdit && shouldStartEditingTimer(e)) { startEditingTimer(); } else if (shouldStopEditingTimer(e)) { timer.stop();
Node n = Visualizer.findNode (lastP.getLastPathComponent()); if (n != null && n.canRename ()) { String newStr = (String) getCellEditorValue(); try {
/** * Overridden to determine an offset that tree would place the * editor at. The offset is determined from the * <code>getRowBounds</code> JTree method, and additionally * from the icon DefaultTreeCellRenderer will use. * <p>The offset is then set on the TreeTableTextField component * created in the constructor, and returned. */ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int r, int c) { Component component = super.getTableCellEditorComponent (table, value, isSelected, r, c); determineOffset(value, isSelected, r); ((TreeTableTextField)getComponent()).offset = offset; return component; }
/** * Overridden to determine an offset that tree would place the * editor at. The offset is determined from the * <code>getRowBounds</code> JTree method, and additionally * from the icon DefaultTreeCellRenderer will use. * <p>The offset is then set on the TreeTableTextField component * created in the constructor, and returned. */ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int r, int c) { Component component = super.getTableCellEditorComponent (table, value, isSelected, r, c); determineOffset(value, isSelected, r); ((TreeTableTextField)getComponent()).offset = offset; return component; }
/** * Overridden to determine an offset that tree would place the * editor at. The offset is determined from the * <code>getRowBounds</code> JTree method, and additionally * 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 r, int c) { Component component = super.getTableCellEditorComponent(table, value, isSelected, r, c); determineOffset(value, isSelected, r); ((TreeTableTextField) getComponent()).offset = offset; return component; }
public TableCellEditor getDefaultEditor(Class columnClass) { if (!edCreated && columnClass == TreeTableModelAdapter.class) { //Creating this editor in the constructor can take > 100ms even //on a very fast machine, so do it lazily here to improve //performance of creating a TreeTable setDefaultEditor(TreeTableModelAdapter.class, new TreeTableCellEditor()); edCreated = true; } return super.getDefaultEditor(columnClass); }
private void revalidateTextField() { int row = TreeTable.this.editingRow; if (row == -1) { offset = 0; return; } determineOffset(tree.getPathForRow(row).getLastPathComponent(), TreeTable.this.isRowSelected(row), row); ((TreeTableTextField)super.getComponent()).offset = offset; getComponent().setBounds(TreeTable.this.getCellRect(row, getTreeColumnIndex(), false)); }
private void revalidateTextField() { int row = TreeTable.this.editingRow; if (row == -1) { offset = 0; return; } determineOffset(tree.getPathForRow(row).getLastPathComponent(), TreeTable.this.isRowSelected(row), row); ((TreeTableTextField)super.getComponent()).offset = offset; getComponent().setBounds(TreeTable.this.getCellRect(row, getTreeColumnIndex(), false)); }
public TreeTableCellEditor() { super(new TreeTableTextField()); tree.addTreeSelectionListener(this); addCellEditorListener(this); super.getComponent().addFocusListener(this); }
@Override public TableCellEditor getDefaultEditor(Class columnClass) { if (!edCreated && (columnClass == TreeTableModelAdapter.class)) { //Creating this editor in the constructor can take > 100ms even //on a very fast machine, so do it lazily here to improve //performance of creating a TreeTable setDefaultEditor(TreeTableModelAdapter.class, new TreeTableCellEditor()); edCreated = true; } return super.getDefaultEditor(columnClass); }
private boolean inHitRegion(MouseEvent me) { determineOffset(me); if (me.getX() <= offset) { return false; } return true; }
public TreeTableCellEditor() { super(new TreeTableTextField()); tree.addTreeSelectionListener(this); addCellEditorListener(this); super.getComponent().addFocusListener(this); }
public TreeTableCellEditor() { super(new TreeTableTextField()); tree.addTreeSelectionListener(this); addCellEditorListener(this); super.getComponent().addFocusListener(this); }
private boolean inHitRegion(MouseEvent me) { determineOffset(me); if (me.getX() <= offset) { return false; } return true; }