Exemplo n.º 1
0
 /**
  * Add a new child menu item. Child item parent is set to <code>this</code>.
  *
  * @param child
  */
 void addChild(MenuItem child) {
   if (children == null) {
     children = new ArrayList<MenuItem>();
   }
   children.add(child);
   child.parent = this;
 }
Exemplo n.º 2
0
 /* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   MenuItem other = (MenuItem) obj;
   if (url == null) {
     if (other.url != null) {
       return false;
     }
   } else if (!url.equals(other.url)) {
     return false;
   }
   if (hidden != other.hidden) {
     return false;
   }
   if (parent == null) {
     if (other.parent != null) {
       return false;
     }
   } else if (!parent.equals(other.parent)) {
     return false;
   }
   if (roles == null) {
     if (other.roles != null) {
       return false;
     }
   } else if (!roles.equals(other.roles)) {
     return false;
   }
   if (id == null) {
     if (other.id != null) {
       return false;
     }
   } else if (!id.equals(other.id)) {
     return false;
   }
   if (labelCode == null) {
     if (other.labelCode != null) {
       return false;
     }
   } else if (!labelCode.equals(other.labelCode)) {
     return false;
   }
   if (messageCode == null) {
     if (other.messageCode != null) {
       return false;
     }
   } else if (!messageCode.equals(other.messageCode)) {
     return false;
   }
   return true;
 }
Exemplo n.º 3
0
 /* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((url == null) ? 0 : url.hashCode());
   result = prime * result + (hidden ? 1231 : 1237);
   result = prime * result + ((parent == null) ? 0 : parent.hashCode());
   result = prime * result + ((roles == null) ? 0 : roles.hashCode());
   result = prime * result + ((id == null) ? 0 : id.hashCode());
   result = prime * result + ((labelCode == null) ? 0 : labelCode.hashCode());
   result = prime * result + ((messageCode == null) ? 0 : messageCode.hashCode());
   return result;
 }