/[classpath]/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
ViewVC logotype

Diff of /classpath/javax/swing/tree/DefaultTreeSelectionModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by mark, Sat Jul 2 20:32:52 2005 UTC revision 1.16 by langel, Mon Jul 4 14:41:24 2005 UTC
# Line 274  public class DefaultTreeSelectionModel Line 274  public class DefaultTreeSelectionModel
274                                  selection = new TreePath[temp.length];                                  selection = new TreePath[temp.length];
275                                  System.arraycopy(temp, 0, selection, 0, temp.length);                                  System.arraycopy(temp, 0, selection, 0, temp.length);
276                          }                          }
277                            leadPath = value0;
278                          fireValueChanged(new TreeSelectionEvent(this, value0, true,                          fireValueChanged(new TreeSelectionEvent(this, value0, true,
279                                          leadPath, value0));                                          leadPath, value0));
280                  }                  }
# Line 291  public class DefaultTreeSelectionModel Line 291  public class DefaultTreeSelectionModel
291           */           */
292          public void addSelectionPaths(TreePath[] value0)          public void addSelectionPaths(TreePath[] value0)
293          {          {
294                  TreePath v0 = null;                  if (value0 != null)
                 for (int i = 0; i < value0.length; i++)  
295                  {                  {
296                          v0 = value0[i];                          TreePath v0 = null;
297                          if (!isPathSelected(v0))                          for (int i = 0; i < value0.length; i++)
298                          {                          {
299                                  if (isSelectionEmpty())                                  v0 = value0[i];
300                                          setSelectionPath(v0);                                  if (!isPathSelected(v0))
                                 else  
301                                  {                                  {
302                                          TreePath[] temp = new TreePath[selection.length + 1];                                          if (isSelectionEmpty())
303                                          System.arraycopy(selection, 0, temp, 0, selection.length);                                                  setSelectionPath(v0);
304                                          temp[temp.length - 1] = v0;                                          else
305                                          selection = new TreePath[temp.length];                                          {
306                                          System.arraycopy(temp, 0, selection, 0, temp.length);                                                  TreePath[] temp = new TreePath[selection.length + 1];
307                                                    System.arraycopy(selection, 0, temp, 0,
308                                                                    selection.length);
309                                                    temp[temp.length - 1] = v0;
310                                                    selection = new TreePath[temp.length];
311                                                    System.arraycopy(temp, 0, selection, 0, temp.length);
312                                            }
313                                            leadPath = value0[value0.length - 1];
314                                            fireValueChanged(new TreeSelectionEvent(this, v0, true,
315                                                            leadPath, value0[0]));
316                                  }                                  }
   
                                 fireValueChanged(new TreeSelectionEvent(this, v0, true,  
                                                 leadPath, value0[0]));  
317                          }                          }
318                  }                  }
319          }          }
# Line 357  public class DefaultTreeSelectionModel Line 361  public class DefaultTreeSelectionModel
361           */           */
362          public void removeSelectionPaths(TreePath[] value0)          public void removeSelectionPaths(TreePath[] value0)
363          {          {
364                  int index = -1;                  if (value0 != null)
                 TreePath v0 = null;  
                 for (int i = 0; i < value0.length; i++)  
365                  {                  {
366                          v0 = value0[i];                          int index = -1;
367                          if (isPathSelected(v0))                          TreePath v0 = null;
368                            for (int i = 0; i < value0.length; i++)
369                          {                          {
370                                  for (int x = 0; x < selection.length; x++)                                  v0 = value0[i];
371                                    if (isPathSelected(v0))
372                                  {                                  {
373                                          if (selection[i].equals(v0))                                          for (int x = 0; x < selection.length; x++)
374                                          {                                          {
375                                                  index = x;                                                  if (selection[i].equals(v0))
376                                                  break;                                                  {
377                                                            index = x;
378                                                            break;
379                                                    }
380                                          }                                          }
381                                  }                                          TreePath[] temp = new TreePath[selection.length - 1];
382                                  TreePath[] temp = new TreePath[selection.length - 1];                                          System.arraycopy(selection, 0, temp, 0, index);
383                                  System.arraycopy(selection, 0, temp, 0, index);                                          System.arraycopy(selection, index + 1, temp, index,
384                                  System.arraycopy(selection, index + 1, temp, index,                                                          selection.length - index - 1);
385                                                  selection.length - index - 1);                                          selection = new TreePath[temp.length];
386                                  selection = new TreePath[temp.length];                                          System.arraycopy(temp, 0, selection, 0, temp.length);
                                 System.arraycopy(temp, 0, selection, 0, temp.length);  
387    
388                                  fireValueChanged(new TreeSelectionEvent(this, v0, false,                                          fireValueChanged(new TreeSelectionEvent(this, v0, false,
389                                                  leadPath, value0[0]));                                                          leadPath, value0[0]));
390                                    }
391                          }                          }
392                  }                  }
393          }          }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26