001    // Copyright 2006, 2007, 2008, 2009, 2010 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.Binding;
018    import org.apache.tapestry5.internal.structure.ComponentPageElement;
019    import org.apache.tapestry5.runtime.Component;
020    
021    import java.util.Map;
022    
023    /**
024     * Operations shared by {@link InternalComponentResources} and {@link ComponentPageElement}. Typically, these means
025     * methods of InternalComponentResources that are delegated to the component page element.
026     */
027    public interface InternalComponentResourcesCommon
028    {
029        /**
030         * Returns true if the component has finished loading. Initially, this value will be false.
031         * 
032         * @see org.apache.tapestry5.runtime.PageLifecycleListener#containingPageDidLoad()
033         */
034        boolean isLoaded();
035    
036        /**
037         * Used during construction of the page to identify the binding for a particular parameter.
038         * <p/>
039         */
040        void bindParameter(String parameterName, Binding binding);
041    
042        /**
043         * Returns the binding for the given parameter name, or null.
044         * 
045         * @param parameterName
046         *            name of component parameter
047         * @return binding if bound, or null
048         * @since 5.1.0.0
049         */
050        Binding getBinding(String parameterName);
051    
052        /**
053         * Returns the mixin instance for the fully qualfied mixin class name.
054         * 
055         * @param mixinClassName
056         *            fully qualified class name
057         * @return IllegalArgumentException if no such mixin is associated with the core component
058         */
059        Component getMixinByClassName(String mixinClassName);
060    
061        /**
062         * Constructs a map linking informal parameters to the corresponding bindings.
063         * 
064         * @return map, possible empty
065         */
066        Map<String, Binding> getInformalParameterBindings();
067    
068    }