[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] RFC: TreeSelectionEvent
From: |
Ka-Hing Cheung |
Subject: |
[cp-patches] RFC: TreeSelectionEvent |
Date: |
Sat, 4 Jun 2005 16:38:05 -0700 |
User-agent: |
Mutt/1.5.6+20040907i |
Included in the email body is generated with diff -uNwb so it's easier to see
what's changed, the real diff is attached.
20050604 Ka-Hing Cheung <address@hidden>
* javax/swing/event/TreeSelectionEvent: javadoc update, reformat
(getPaths): Return a cloned copy.
(isAddedPath): Implemented.
(cloneWithSource): Likewise.
Index: javax/swing/event/TreeSelectionEvent.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/event/TreeSelectionEvent.java,v
retrieving revision 1.3
diff -u -w -b -r1.3 TreeSelectionEvent.java
--- javax/swing/event/TreeSelectionEvent.java 22 Oct 2004 12:44:00 -0000
1.3
+++ javax/swing/event/TreeSelectionEvent.java 4 Jun 2005 23:25:48 -0000
@@ -108,8 +108,8 @@
boolean isNew, TreePath oldLeadSelectionPath,
TreePath newLeadSelectionPath) {
super(source);
-//TODO this.paths = new
TreePath[1]{path};
-//TODO this.areNew = new
boolean[1]{isNew};
+ this.paths = new TreePath[]{path};
+ this.areNew = new boolean[]{isNew};
this.oldLeadSelectionPath = oldLeadSelectionPath;
this.newLeadSelectionPath = newLeadSelectionPath;
} // TreeSelectionEvent()
@@ -120,70 +120,69 @@
//-------------------------------------------------------------
/**
- * getPath
- * @returns TreePath
+ * @returns the first path element
*/
public TreePath getPath() {
return paths[0];
} // getPath()
/**
- * getPaths
- * @returns TreePath[]
+ *
+ * @returns the paths with selection changed
*/
public TreePath[] getPaths() {
- return paths;
+ return (TreePath[])paths.clone();
} // getPaths()
/**
- * isAddedPath
- * @returns boolean
+ * @return true if the first path is added to the selection, false otherwise
*/
public boolean isAddedPath() {
- return false; // TODO
+ return areNew[0];
} // isAddedPath()
/**
- * isAddedPath
- * @param path TODO
- * @returns boolean
+ * @param path the path to check
+ * @return true if the path is added to the selection, false otherwise
*/
public boolean isAddedPath(TreePath path) {
- return false; // TODO
+ for (int i = paths.length - 1; i >= 0; i--)
+ if (paths[i].equals(path))
+ return areNew[i];
+
+ return false;
} // isAddedPath()
/**
- * isAddedPath
- * @param index TODO
- * @returns boolean
+ * @param index the index'th path
+ * @return true if the path is added to the selection, false otherwise
*/
public boolean isAddedPath(int index) {
- return false; // TODO
+ return areNew[index];
} // isAddedPath()
/**
- * getOldLeadSelectionPath
- * @returns TreePath
+ * @return the previous lead selection path
*/
public TreePath getOldLeadSelectionPath() {
return oldLeadSelectionPath;
} // getOldLeadSelectionPath()
/**
- * getNewLeadSelectionPath
- * @returns TreePath
+ * @returns the current lead selection path
*/
public TreePath getNewLeadSelectionPath() {
return newLeadSelectionPath;
} // getNewLeadSelectionPath()
/**
- * cloneWithSource
- * @param source TODO
- * @returns Object
+ * @param source the new event source
+ * @return a cloned event with another event source
*/
public Object cloneWithSource(Object source) {
- return null; // TODO
+ return new TreeSelectionEvent (source, paths, areNew,
+ oldLeadSelectionPath,
+ newLeadSelectionPath);
} // cloneWithSource()
javax.swing.event.treeselectionevent-20050604
Description: Text document
- [cp-patches] RFC: TreeSelectionEvent,
Ka-Hing Cheung <=