1 16 17 package com.jaspersoft.jasperserver.irplugin.gui.inputcontrols; 18 import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ListItem; 19 23 public class ListItemWrapper { 24 25 private ListItem item; 26 29 public ListItemWrapper(ListItem item ) { 30 this.item = item; 31 } 32 33 public boolean equals(Object obj) 34 { 35 try { 36 if (obj instanceof ListItem) 37 { 38 Object val = ((ListItem)obj).getValue(); 39 return (val == null) ? getItem().getValue() == null : val.equals(getItem().getValue()); 40 } 41 if (obj instanceof ListItemWrapper) 42 { 43 Object val = ((ListItemWrapper)obj).getItem().getValue(); 44 return (val == null) ? getItem().getValue() == null : val.equals(getItem().getValue()); 45 } 46 } catch (Exception ex) 47 { 48 49 } 50 51 return super.equals(obj); 52 } 53 54 public ListItem getItem() { 55 return item; 56 } 57 58 public void setItem(ListItem item) { 59 this.item = item; 60 } 61 62 public String toString() 63 { 64 if (item != null) return ""+item.getLabel(); 65 return super.toString(); 66 } 67 } 68 | Popular Tags |