2005-09-02 Lillian Angel <[EMAIL PROTECTED]> * javax/swing/plaf/basic/BasicTreeUI.java (mousepressed): Fixed, so that clicking on control icon will not start editing.
On Fri, 2005-09-02 at 14:00 -0400, Lillian Angel wrote: > JTree editing is complete and key handling is also complete. > - F2 starts editing, Enter completes the editing. > - Triple clicking and click-pause-click also start editing. > - clicking anywhere while editing, cancels the editing. > > The patch is really annoying to read. Alot of code was moved around and > many comments were reformatted. If you need further clarification on how > I implemented some of these functions, feel free to ask. > > 2005-09-02 Lillian Angel <[EMAIL PROTECTED]> > > * javax/swing/JTree.java > (installUI): TreeSelectionListener removed because added too > many times. > * javax/swing/plaf/basic/BasicLookAndFeel.java: > Fixed names for some tree defaults. > * javax/swing/plaf/basic/BasicTreeUI.java: > Added new fields for editing and keyboard actions. > (setCellEditor): Took out unneeded if statement. > (isEditing): Returned boolean instead. > (updateCellEditor): Used set method. > (installDefaults): Set focus to tree. > (installKeyBoardActions): Implemented. > (convertModifiers): New function implemented. > (installUI): Used set method and initialized isEditing. > (startEditing): set isEditing. > (TreeAction): New class implemented to perform keyboard actions. > (ActionListenerProxy): New private class used to distribute the > keyboard actions to the true receiver. > (editingStopped): Added code to prevent NPEs. set isEditing and > focus to tree. Also, removed TreeSelectionListeners for > cellEditor. > (editingCanceled): Likewise. > (keyPressed): Removed code, not needed anymore. > (actionPerformed): Implemented for up/down keyboard actions. > (actionPerformed): Implemented for left/right keyboard actions. > * javax/swing/tree/DefaultTreeCellEditor.java > (DefaultTreeCellEditor): Set lastPath. > (isCellEditable): editingComponent should be configured if has > not been. > (stopCellEditing): No need to set cell editor to null here. > (cancelCellEditing): Likewise. > (valueChanged): Set tPath to the path that was last selected. > Used for the click-pause-click implementation. > (actionPerformed): Re-implemented in a simplier fashion. > * javax/swing/tree/DefaultTreeCellRenderer.java > (getTreeCellRendererComponent): Only set border color if val is > lead selection path. > > _______________________________________________ > Classpath-patches mailing list > Classpath-patches@gnu.org > http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: javax/swing/plaf/basic/BasicTreeUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v retrieving revision 1.73 diff -u -r1.73 BasicTreeUI.java --- javax/swing/plaf/basic/BasicTreeUI.java 2 Sep 2005 18:03:25 -0000 1.73 +++ javax/swing/plaf/basic/BasicTreeUI.java 2 Sep 2005 18:40:29 -0000 @@ -1487,8 +1487,7 @@ count++; Object nextNode = getNextVisibleNode(node); if (nextNode != null) - maxWidth = Math.max(maxWidth, + maxWidth = Math.max(maxWidth, (int) (getCellBounds(0, 0, nextNode).getWidth())); node = nextNode; } @@ -2286,7 +2285,7 @@ tree.expandPath(path); } - if (tree.isEditable()) + if (!cntlClick && tree.isEditable()) startEditing(path, e); } }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches