1 32 33 package it.businesslogic.ireport.gui.documentstructure; 34 35 import it.businesslogic.ireport.ElementGroup; 36 import it.businesslogic.ireport.ReportElement; 37 38 42 public class DocumentStructureTreeNode extends javax.swing.tree.DefaultMutableTreeNode { 43 44 45 public DocumentStructureTreeNode() { 46 super(); 47 } 48 49 public DocumentStructureTreeNode(Object userObject) { 50 super(userObject); 51 } 52 53 public DocumentStructureTreeNode(Object userObject, boolean allowChilds) { 54 super(userObject, allowChilds); 55 } 56 57 public String getNodeId() 58 { 59 if (this.getUserObject() == null) return ""; 60 if (this.getUserObject() instanceof ElementGroup) 61 { 62 return "group-" + ((ElementGroup)(this.getUserObject())).getName(); 63 } 64 if (this.getUserObject() instanceof ReportElement) 65 { 66 return "element-" + ((ReportElement)(this.getUserObject())).getElementID()+""; 67 } 68 69 70 return "" + this.getUserObject(); 71 } 72 78 79 public boolean equals(Object obj) 80 { 81 if (obj instanceof DocumentStructureTreeNode) 82 { 83 return ((DocumentStructureTreeNode)obj).getNodeId().equalsIgnoreCase( getNodeId() ); 84 } 85 return super.equals( obj ); 86 } 87 } 88 | Popular Tags |