1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """A named theme dependent resource."""
17
18 from muntjac.terminal.resource import IResource
19
20
22 """C{ThemeResource} is a named theme dependent resource
23 provided and managed by a theme. The actual resource contents are
24 dynamically resolved to comply with the used theme by the terminal
25 adapter. This is commonly used to provide static images, flash,
26 java-applets, etc for the terminals.
27
28 @author: Vaadin Ltd.
29 @author: Richard Lincoln
30 @version: 1.1.2
31 """
32
34 """Creates a resource.
35
36 @param resourceId:
37 the Id of the resource.
38 """
39
40 self._resourceID = None
41
42 if resourceId is None:
43 raise ValueError, 'IResource ID must not be null'
44
45 if len(resourceId) == 0:
46 raise ValueError, 'IResource ID can not be empty'
47
48 if resourceId[0] == '/':
49 raise ValueError, \
50 'IResource ID must be relative (can not begin with /)'
51
52 self._resourceID = resourceId
53
54
56 """Tests if the given object equals this IResource.
57
58 @param obj:
59 the object to be tested for equality.
60 @return: C{True} if the given object equals this Icon,
61 C{False} if not.
62 """
63 return (isinstance(obj, ThemeResource)
64 and self._resourceID == obj.resourceID)
65
66
68 return (not isinstance(obj, ThemeResource)
69 or self._resourceID != obj.resourceID)
70
71
73 return hash(self._resourceID)
74
75
77 return str(self._resourceID)
78
79
81 """Gets the resource id.
82
83 @return: the resource id.
84 """
85 return self._resourceID
86
87
95