Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
NewLinkEvent.java
1 
16 package net.squiz.matrix.matrixtree;
17 
18 import net.squiz.matrix.assetmap.*;
19 import java.util.EventObject;
20 import javax.swing.tree.TreeNode;
21 
22 public class NewLinkEvent extends EventObject {
23 
24  public static final String LINK_TYPE_MOVE = "move asset";
25  public static final String LINK_TYPE_NEW_LINK = "new link";
26  public static final String LINK_TYPE_CLONE = "clone";
27 
28  private String type;
29  private MatrixTreeNode[] sourceNodes;
30  private MatrixTreeNode parentNode;
31  private int index, prevIndex;
32  private String[] parentIds;
33 
34  public NewLinkEvent(
35  Object source,
36  String type,
37  MatrixTreeNode[] sourceNodes,
38  MatrixTreeNode parentNode,
39  int index,
40  int prevIndex,
41  String[] parentIds) {
42 
43  super(source);
44  if (type != LINK_TYPE_MOVE &&
45  type != LINK_TYPE_NEW_LINK &&
46  type != LINK_TYPE_CLONE) {
47  throw new IllegalArgumentException("type must be one of " +
48  "LINK_TYPE_MOVE or LINK_TYPE_NEW_LINK or LINK_TYPE_CLONE");
49  }
50 
51  this.type = type;
52  this.sourceNodes = sourceNodes;
53  this.parentNode = parentNode;
54  this.index = index;
55  this.prevIndex = prevIndex;
56  this.parentIds = parentIds;
57  }
58 
59  public String getType() {
60  return type;
61  }
62 
63  public MatrixTreeNode[] getSourceNodes() {
64  return sourceNodes;
65  }
66 
67  public MatrixTreeNode getParentNode() {
68  return parentNode;
69  }
70 
71  public int getIndex() {
72  return index;
73  }
74 
75  public int getPrevIndex() {
76  return prevIndex;
77  }
78 
79  public String[] getParentIds() {
80  return parentIds;
81  }
82 }