KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > irplugin > gui > inputcontrols > ListItemWrapper


1 /*
2  * ListItemWrapper.java
3  *
4  * All rights reserved.
5  * Copyright (C) 2005 JasperSoft Corporation
6  *
7  * JasperSoft Corporation
8  * 303 Second Street, Suite 450 North
9  * San Francisco, CA 94107
10  * http://www.jaspersoft.com
11  *
12  *
13  * Created on June 7, 2006, 6:54 PM
14  *
15  */

16
17 package com.jaspersoft.jasperserver.irplugin.gui.inputcontrols;
18 import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ListItem;
19 /**
20  *
21  * @author gtoffoli
22  */

23 public class ListItemWrapper {
24     
25     private ListItem item;
26     /**
27      * Creates a new instance of ListItemWrapper
28      */

29     public ListItemWrapper(ListItem item ) {
30         this.item = item;
31     }
32     
33     public boolean equals(Object JavaDoc obj)
34     {
35         try {
36         if (obj instanceof ListItem)
37         {
38             Object JavaDoc val = ((ListItem)obj).getValue();
39             return (val == null) ? getItem().getValue() == null : val.equals(getItem().getValue());
40         }
41         if (obj instanceof ListItemWrapper)
42         {
43             Object JavaDoc val = ((ListItemWrapper)obj).getItem().getValue();
44             return (val == null) ? getItem().getValue() == null : val.equals(getItem().getValue());
45         }
46         } catch (Exception JavaDoc 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 JavaDoc toString()
63     {
64         if (item != null) return ""+item.getLabel();
65         return super.toString();
66     }
67 }
68
Popular Tags