src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java

Print this page
rev 10520 : 8055723[client]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


1146      */
1147     protected void insureUniqueness() {
1148     }
1149 
1150 
1151     /**
1152      * Returns a string that displays and identifies this
1153      * object's properties.
1154      *
1155      * @return a String representation of this object
1156      */
1157     public String toString() {
1158         int                selCount = getSelectionCount();
1159         StringBuilder      sb = new StringBuilder();
1160         int[]              rows;
1161 
1162         if(rowMapper != null)
1163             rows = rowMapper.getRowsForPaths(selection);
1164         else
1165             rows = null;
1166         sb.append(getClass().getName() + " " + hashCode() + " [ ");
1167         for(int counter = 0; counter < selCount; counter++) {
1168             if(rows != null)
1169                 sb.append(selection[counter].toString() + "@" +
1170                           Integer.toString(rows[counter])+ " ");
1171             else
1172                 sb.append(selection[counter].toString() + " ");
1173         }
1174         sb.append("]");
1175         return sb.toString();
1176     }
1177 
1178     /**
1179      * Returns a clone of this object with the same selection.
1180      * This method does not duplicate
1181      * selection listeners and property listeners.
1182      *
1183      * @exception CloneNotSupportedException never thrown by instances of
1184      *                                       this class
1185      */
1186     public Object clone() throws CloneNotSupportedException {
1187         DefaultTreeSelectionModel        clone = (DefaultTreeSelectionModel)
1188                             super.clone();
1189 
1190         clone.changeSupport = null;
1191         if(selection != null) {
1192             int              selLength = selection.length;
1193 
1194             clone.selection = new TreePath[selLength];




1146      */
1147     protected void insureUniqueness() {
1148     }
1149 
1150 
1151     /**
1152      * Returns a string that displays and identifies this
1153      * object's properties.
1154      *
1155      * @return a String representation of this object
1156      */
1157     public String toString() {
1158         int                selCount = getSelectionCount();
1159         StringBuilder      sb = new StringBuilder();
1160         int[]              rows;
1161 
1162         if(rowMapper != null)
1163             rows = rowMapper.getRowsForPaths(selection);
1164         else
1165             rows = null;
1166         sb.append(getClass().getName()).append(' ').append(hashCode()).append(" [ ");
1167         for(int counter = 0; counter < selCount; counter++) {
1168             if(rows != null)
1169                 sb.append(selection[counter]).append('@')
1170                         .append(rows[counter]).append(' ');
1171             else
1172                 sb.append(selection[counter]).append(' ');
1173         }
1174         sb.append(']');
1175         return sb.toString();
1176     }
1177 
1178     /**
1179      * Returns a clone of this object with the same selection.
1180      * This method does not duplicate
1181      * selection listeners and property listeners.
1182      *
1183      * @exception CloneNotSupportedException never thrown by instances of
1184      *                                       this class
1185      */
1186     public Object clone() throws CloneNotSupportedException {
1187         DefaultTreeSelectionModel        clone = (DefaultTreeSelectionModel)
1188                             super.clone();
1189 
1190         clone.changeSupport = null;
1191         if(selection != null) {
1192             int              selLength = selection.length;
1193 
1194             clone.selection = new TreePath[selLength];