01: // Copyright 2006 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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.internal;
16:
17: import org.apache.tapestry.ComponentResources;
18: import org.apache.tapestry.internal.structure.Page;
19: import org.apache.tapestry.runtime.Component;
20: import org.apache.tapestry.services.PersistentFieldManager;
21:
22: /**
23: * An extension of {@link org.apache.tapestry.ComponentResources} that represents additional methods
24: * that are private to the framework and not exposed in any public APIs. Ideally, there will not be
25: * any need for this interface (we'll see as we go).
26: */
27: public interface InternalComponentResources extends ComponentResources,
28: InternalComponentResourcesCommon {
29: /**
30: * Reads the value of a parameter, via the parameter's {@link org.apache.tapestry.Binding}.
31: *
32: * @param <T>
33: * @param parameterName
34: * the name of the parameter to read
35: * @param expectedType
36: * the expected type of parameter
37: * @return the value for the parameter, or null if the parameter is not bound.
38: */
39: <T> T readParameter(String parameterName, Class<T> expectedType);
40:
41: /**
42: * Updates a parameter. It is an error to update a parameter which is not bound. The parameter
43: * {@link org.apache.tapestry.Binding binding} may also not support updates.
44: *
45: * @param <T>
46: * @param parameterName
47: * of parameter to update
48: * @param parameterValue
49: * new value (which may be null)
50: */
51: <T> void writeParameter(String parameterName, T parameterValue);
52:
53: /**
54: * Returns true if the named parameter's {@link org.apache.tapestry.Binding} is invariant, false
55: * if otherwise, or if the parameter is not bound. Invariant bindings are cached more
56: * aggresively than variant bindings.
57: *
58: * @param parameterName
59: * the name of parameter to check for invariance
60: * @return
61: */
62: boolean isInvariant(String parameterName);
63:
64: /**
65: * For a normal component, the same as {@link #getComponent()}, but for a mixin, returns the
66: * component to which the mixin is attached.
67: */
68: Component getCoreComponent();
69:
70: /**
71: * Posts a change to a persistent field. If the component is still loading, then this change is
72: * ignored. Otherwise, it is propogated, via the
73: * {@link Page#persistFieldChange(org.apache.tapestry.internal.structure.ComponentPageElement, String, Object) page}
74: * to the {@link PersistentFieldManager}.
75: */
76: void persistFieldChange(String fieldName, Object newValue);
77: }
|