Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 // Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 //     http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry.pageload;
Used to defer connection of inherited informal bindings.

Author(s):
Howard Lewis Ship
Since:
4.0
    private IComponent _component;
    {
         = component;
    }
    public void connect()
    {
        IComponent container = .getContainer();
        for(Iterator it = container.getBindingNames().iterator(); it.hasNext();)
        {
            String bindingName = (Stringit.next();
            connectInformalBinding(containerbindingName);
        }
    }
    private void connectInformalBinding(IComponent container,
            IComponent componentString bindingName)
    {
        IComponentSpecification componentSpec = component.getSpecification();
        IComponentSpecification containerSpec = container.getSpecification();
        // check if binding already exists in the component
        if (component.getBinding(bindingName) != nullreturn;
        // check if parameter is informal for the component
        if (componentSpec.getParameter(bindingName) != null
                || componentSpec.isReservedParameterName(bindingName)) return;
        // check if parameter is informal for the container
        if (containerSpec.getParameter(bindingName) != null
                || containerSpec.isReservedParameterName(bindingName)) return;
        // if everything passes, establish binding
        IBinding binding = container.getBinding(bindingName);
        component.setBinding(bindingNamebinding);
    }
New to GrepCode? Check out our FAQ X