1 19 package org.openide.explorer.view; 20 21 import org.openide.nodes.*; 22 23 import java.util.Comparator ; 24 import java.util.EventObject ; 25 import java.util.LinkedList ; 26 27 28 33 abstract class VisualizerEvent extends EventObject { 34 35 int[] array; 36 37 public VisualizerEvent(VisualizerChildren ch, int[] array) { 38 super(ch); 39 this.array = array; 40 } 41 42 43 public final int[] getArray() { 44 return array; 45 } 46 47 49 public final VisualizerChildren getChildren() { 50 return (VisualizerChildren) getSource(); 51 } 52 53 55 public final VisualizerNode getVisualizer() { 56 return getChildren().parent; 57 } 58 59 62 static final class Added extends VisualizerEvent implements Runnable { 63 static final long serialVersionUID = 5906423476285962043L; 64 65 66 private Node[] added; 67 68 73 public Added(VisualizerChildren ch, Node[] n, int[] indx) { 74 super(ch, indx); 75 added = n; 76 } 77 78 80 public Node[] getAdded() { 81 return added; 82 } 83 84 86 public void run() { 87 super.getChildren().added(this); 88 } 89 } 90 91 94 static final class Removed extends VisualizerEvent implements Runnable { 95 static final long serialVersionUID = 5102881916407672392L; 96 97 99 public LinkedList <VisualizerNode> removed = new LinkedList <VisualizerNode>(); 100 private Node[] removedNodes; 101 102 107 public Removed(VisualizerChildren ch, Node[] removedNodes) { 108 super(ch, null); 109 this.removedNodes = removedNodes; 110 } 111 112 public Node[] getRemovedNodes() { 113 return removedNodes; 114 } 115 116 public void setRemovedIndicies(int[] arr) { 117 super.array = arr; 118 } 119 120 122 public void run() { 123 super.getChildren().removed(this); 124 } 125 } 126 127 130 static final class Reordered extends VisualizerEvent implements Runnable { 131 static final long serialVersionUID = -4572356079752325870L; 132 private Comparator <VisualizerNode> comparator = null; 133 134 139 public Reordered(VisualizerChildren ch, int[] indx) { 140 super(ch, indx); 141 } 142 143 Reordered(VisualizerChildren ch, Comparator <VisualizerNode> comparator) { 146 this(ch, new int[0]); 147 this.comparator = comparator; 148 } 149 150 public Comparator <VisualizerNode> getComparator() { 151 return comparator; 152 } 153 154 156 public void run() { 157 super.getChildren().reordered(this); 158 } 159 } 160 } 161 | Popular Tags |