KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > core > icon > lib > BasicIconFileDescription


1 /*====================================================================
2
3 Objectweb Explorer Framework
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Moroy, Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.objectweb.util.explorer.core.icon.lib;
27
28 import java.net.URL JavaDoc;
29
30 import org.objectweb.util.explorer.ExplorerUtils;
31 import org.objectweb.util.explorer.core.icon.api.IconFileDescription;
32
33 /**
34  * Basic implementation of the <code>IconFileDescription</code> interface.
35  *
36  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>,
37  * <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>.
38  *
39  * @version 0.1
40  */

41 public class BasicIconFileDescription
42      extends BasicIconDescription
43   implements IconFileDescription
44 {
45
46     //==================================================================
47
//
48
// Internal States.
49
//
50
// ==================================================================
51

52     /** The URL of the image file. */
53     protected URL JavaDoc url_;
54         
55     // ==================================================================
56
//
57
// Constructors.
58
//
59
// ==================================================================
60

61     // ==================================================================
62
//
63
// Internal methods.
64
//
65
// ==================================================================
66

67     /**
68      * Compares two BasicIconFileDescription objects.
69      * Two BasicIconFileDescription objects are considered as equal
70      * only if they have the same URL (not null).
71      */

72     protected boolean equals(BasicIconFileDescription iconFileDescription){
73         return ExplorerUtils.compareObjects(url_, iconFileDescription.url_);
74     }
75
76     // ==================================================================
77
//
78
// Public methods for Description interface.
79
//
80
// ==================================================================
81

82     /* (non-Javadoc)
83      * @see boolean#isNull()
84      */

85     public boolean isEmpty() {
86         return url_==null;
87     }
88      
89     // ==================================================================
90
//
91
// Public methods for ... interface.
92
//
93
// ==================================================================
94

95     /* (non-Javadoc)
96      * @see org.objectweb.util.explorer.core.icon.api.IconFileDescription#setURL(java.net.URL)
97      */

98     public void setURL(URL JavaDoc url) {
99         url_ = url;
100     }
101
102     /* (non-Javadoc)
103      * @see org.objectweb.util.explorer.core.icon.api.IconFileDescription#getURL()
104      */

105     public URL JavaDoc getURL() {
106         return url_;
107     }
108
109     // ==================================================================
110
//
111
// Public methods surcharging Object class.
112
//
113
// ==================================================================
114

115     /**
116      * Surcharging the Object.equals method.
117      * @see Object#equals(java.lang.Object)
118      */

119     public boolean equals(Object JavaDoc o){
120         if(o!=null && o instanceof BasicIconFileDescription){
121             return equals((BasicIconFileDescription)o);
122         }
123         return false;
124     }
125    
126     /**
127      * Return a String representation of a BasicImageIcon
128      * @see Object#toString()
129      */

130     public String JavaDoc toString(){
131         return "BasicIconFileDescription[url=" +
132             ExplorerUtils.toString(url_) + "]";
133     }
134     
135 }
136
137
138
Popular Tags