|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ContainedComponent.java | 83.3% | 88.2% | 90.9% | 88.2% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.tapestry.spec;
|
|
16 |
|
|
17 |
import java.util.Collection;
|
|
18 |
import java.util.Collections;
|
|
19 |
import java.util.HashMap;
|
|
20 |
import java.util.Map;
|
|
21 |
|
|
22 |
/**
|
|
23 |
* Defines a contained component. This includes the information needed to get the contained
|
|
24 |
* component's specification, as well as any bindings for the component.
|
|
25 |
*
|
|
26 |
* @author Howard Lewis Ship
|
|
27 |
*/
|
|
28 |
|
|
29 |
public class ContainedComponent extends LocatablePropertyHolder implements IContainedComponent |
|
30 |
{ |
|
31 |
private String type;
|
|
32 |
|
|
33 |
private String copyOf;
|
|
34 |
|
|
35 |
private boolean inheritInformalParameters; |
|
36 |
|
|
37 |
protected Map bindings;
|
|
38 |
|
|
39 |
private static final int MAP_SIZE = 3; |
|
40 |
|
|
41 |
/** @since 4.0 */
|
|
42 |
private String _propertyName;
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Returns the named binding, or null if the binding does not exist.
|
|
46 |
*/
|
|
47 |
|
|
48 | 582 |
public IBindingSpecification getBinding(String name)
|
49 |
{ |
|
50 | 582 |
if (bindings == null) |
51 | 0 |
return null; |
52 |
|
|
53 | 582 |
return (IBindingSpecification) bindings.get(name);
|
54 |
} |
|
55 |
|
|
56 |
/**
|
|
57 |
* Returns an umodifiable <code>Collection</code> of Strings, each the name of one binding for
|
|
58 |
* the component.
|
|
59 |
*/
|
|
60 |
|
|
61 | 416 |
public Collection getBindingNames()
|
62 |
{ |
|
63 | 416 |
if (bindings == null) |
64 | 55 |
return Collections.EMPTY_LIST;
|
65 |
|
|
66 | 361 |
return Collections.unmodifiableCollection(bindings.keySet());
|
67 |
} |
|
68 |
|
|
69 | 421 |
public String getType()
|
70 |
{ |
|
71 | 421 |
return type;
|
72 |
} |
|
73 |
|
|
74 | 420 |
public void setBinding(String name, IBindingSpecification spec) |
75 |
{ |
|
76 | 420 |
if (bindings == null) |
77 | 269 |
bindings = new HashMap(MAP_SIZE);
|
78 |
|
|
79 | 420 |
bindings.put(name, spec); |
80 |
} |
|
81 |
|
|
82 | 312 |
public void setType(String value) |
83 |
{ |
|
84 | 312 |
type = value; |
85 |
} |
|
86 |
|
|
87 |
/**
|
|
88 |
* Sets the String Id of the component being copied from. For use by IDE tools like Spindle.
|
|
89 |
*
|
|
90 |
* @since 1.0.9
|
|
91 |
*/
|
|
92 |
|
|
93 | 310 |
public void setCopyOf(String id) |
94 |
{ |
|
95 | 310 |
copyOf = id; |
96 |
} |
|
97 |
|
|
98 |
/**
|
|
99 |
* Returns the id of the component being copied from. For use by IDE tools like Spindle.
|
|
100 |
*
|
|
101 |
* @since 1.0.9
|
|
102 |
*/
|
|
103 |
|
|
104 | 0 |
public String getCopyOf()
|
105 |
{ |
|
106 | 0 |
return copyOf;
|
107 |
} |
|
108 |
|
|
109 |
/**
|
|
110 |
* Returns whether the contained component will inherit the informal parameters of its parent.
|
|
111 |
*
|
|
112 |
* @since 3.0
|
|
113 |
*/
|
|
114 | 418 |
public boolean getInheritInformalParameters() |
115 |
{ |
|
116 | 418 |
return inheritInformalParameters;
|
117 |
} |
|
118 |
|
|
119 |
/**
|
|
120 |
* Sets whether the contained component will inherit the informal parameters of its parent.
|
|
121 |
*
|
|
122 |
* @since 3.0
|
|
123 |
*/
|
|
124 | 310 |
public void setInheritInformalParameters(boolean value) |
125 |
{ |
|
126 | 310 |
inheritInformalParameters = value; |
127 |
} |
|
128 |
|
|
129 |
/** @since 4.0 */
|
|
130 | 298 |
public String getPropertyName()
|
131 |
{ |
|
132 | 298 |
return _propertyName;
|
133 |
} |
|
134 |
|
|
135 |
/** @since 4.0 */
|
|
136 | 313 |
public void setPropertyName(String propertyName) |
137 |
{ |
|
138 | 313 |
_propertyName = propertyName; |
139 |
} |
|
140 |
} |
|