001 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.tapestry5.internal;
016
017 import org.apache.tapestry5.ComponentResources;
018 import org.apache.tapestry5.internal.bindings.PropBinding;
019 import org.apache.tapestry5.internal.services.PersistentFieldManager;
020 import org.apache.tapestry5.internal.structure.Page;
021 import org.apache.tapestry5.internal.structure.PageResetListener;
022 import org.apache.tapestry5.internal.transform.ParameterConduit;
023 import org.apache.tapestry5.runtime.PageLifecycleListener;
024 import org.apache.tapestry5.runtime.RenderCommand;
025 import org.apache.tapestry5.runtime.RenderQueue;
026
027 /**
028 * An extension of {@link org.apache.tapestry5.ComponentResources} that represents additional
029 * methods that are private
030 * to the framework and not exposed in any public APIs.
031 */
032 public interface InternalComponentResources extends ComponentResources,
033 InternalComponentResourcesCommon, RenderCommand
034 {
035 /**
036 * Get the current persisted value of the field.
037 *
038 * @param fieldName
039 * the name of the field to access
040 * @return the value stored for the field, or null if no value is currently stored
041 */
042 Object getFieldChange(String fieldName);
043
044 /**
045 * Checks to see if there is a value stored for the indicated field.
046 */
047 boolean hasFieldChange(String fieldName);
048
049 /**
050 * Posts a change to a persistent field. If the component is still loading, then this change is
051 * ignored. Otherwise,
052 * it is propagated, via the
053 * {@link Page#persistFieldChange(org.apache.tapestry5.ComponentResources, String, Object)
054 * page} to the {@link PersistentFieldManager}.
055 */
056 void persistFieldChange(String fieldName, Object newValue);
057
058 /**
059 * Allows the resources to cleanup any render-time only data.
060 */
061 void postRenderCleanup();
062
063
064 /**
065 * Delegates to {@link Page#addResetListener(org.apache.tapestry5.internal.structure.PageResetListener)}.
066 *
067 * @param listener
068 * to register
069 */
070 void addPageResetListener(PageResetListener listener);
071
072 /**
073 * Gets a previously stored ParameterConduit, allowing PCs to be shared between a component
074 * and a mixin of that component.
075 *
076 * @since 5.2.0
077 */
078 ParameterConduit getParameterConduit(String parameterName);
079
080 /**
081 * Stores a ParameterConduit for later access. Tthis occurs inside a component's
082 * {@link PageLifecycleListener#containingPageDidLoad()} lifecycle
083 * method.
084 *
085 * @since 5.2.0
086 */
087 void setParameterConduit(String parameterName, ParameterConduit conduit);
088
089
090 /**
091 * Returns the name of the bound property if {@link PropBinding} is used and the expression points to a property on a bean (e.g. user.name).
092 * Otherwise this method returns null.
093 *
094 * @param parameterName name of the parameter
095 *
096 * @since 5.2.0
097 */
098 String getPropertyName(String parameterName);
099 }