Package org.apache.tapestry

Examples of org.apache.tapestry.IBinding


    return null;
  }

  public String getWindowName()
  {
    IBinding aWindowNameBinding = getWindowNameBinding();
    if (aWindowNameBinding != null)
    {
      return aWindowNameBinding.getString();
    }
    else
    {
      return DEFAULT_WINDOW_NAME;
    }
View Full Code Here


    }
  }

  public String getFeatures()
  {
    IBinding aFeaturesBinding = getFeaturesBinding();
    if (aFeaturesBinding != null)
    {
      return aFeaturesBinding.getString();
    }
    else
    {
      return "";
    }
View Full Code Here

                // If the value isn't the elementId of this component, then this link wasn't
                // selected.

                if (value != null && value.equals(name))
                {
                    IBinding selectedBinding = getSelectedBinding();
                    if (selectedBinding != null)
                        selectedBinding.setObject(getTag());
                    IActionListener listener = getListener();
                    if (listener != null)
                        listener.actionTriggered(this, cycle);
                }
            }
View Full Code Here

            String name = (String) i.next();

            if (debug)
                LOG.debug("Connecting parameter " + name + ".");

            IBinding binding = _component.getBinding(name);
            if (binding == null)
            {
                if (debug)
                    LOG.debug("Not bound.");

                continue;
            }

            IParameterSpecification pspec = spec.getParameter(name);
            Direction direction = pspec.getDirection();

            if (direction != Direction.IN && direction != Direction.FORM)
            {
                if (debug)
                    LOG.debug("Parameter is " + pspec.getDirection().getName() + ".");

                continue;
            }

            if (!direction.getAllowInvariant() && binding.isInvariant())
                throw new ConnectedParameterException(
                    Tapestry.format(
                        "ParameterManager.incompatible-direction-and-binding",
                        new Object[] {
                            name,
                            _component.getExtendedId(),
                            direction.getDisplayName(),
                            binding }),
                    _component,
                    name,
                    null,
                    binding.getLocation(),
                    null);

            String propertyName = pspec.getPropertyName();

            if (debug && !name.equals(propertyName))
                LOG.debug("Connecting to property " + propertyName + ".");

            // Next,verify that there is a writable property with the same
            // name as the parameter.

            PropertyInfo propertyInfo =
                PropertyFinder.getPropertyInfo(_component.getClass(), propertyName);

            if (propertyInfo == null)
            {
                throw new ConnectedParameterException(
                    Tapestry.format(
                        "ParameterManager.no-accessor",
                        _component.getExtendedId(),
                        propertyName),
                    _component,
                    name,
                    propertyName,
                    binding.getLocation(),
                    null);
            }

            if (!propertyInfo.isReadWrite())
            {
                throw new ConnectedParameterException(
                    Tapestry.format(
                        "ParameterManager.property-not-read-write",
                        _component.getExtendedId(),
                        propertyName),
                    _component,
                    name,
                    propertyName,
                    binding.getLocation(),
                    null);
            }

            // Check if the parameter type matches the property type

            Class propertyType = propertyInfo.getType();
            Class parameterType = getType(pspec.getType(), resolver);

            if (parameterType == null)
            {
                throw new ConnectedParameterException(
                    Tapestry.format(
                        "ParameterManager.java-type-not-specified",
                        name,
                        _component.getExtendedId()),
                    _component,
                    name,
                    propertyName,
                    binding.getLocation(),
                    null);
            }

            if (!propertyType.equals(parameterType))
            {
                throw new ConnectedParameterException(
                    Tapestry.format(
                        "ParameterManager.type-mismatch",
                        new String[] {
                            name,
                            _component.getExtendedId(),
                            parameterType.toString(),
                            propertyType.toString()}),
                    _component,
                    name,
                    propertyName,
                    binding.getLocation(),
                    null);
            }

            // Here's where we will sniff it for type, for the moment
            // assume its some form of object (not scalar) type.

            IParameterConnector connector =
                createConnector(_component, name, binding, propertyType, parameterType);

            // Static bindings are set here and then forgotten
            // about.  Dynamic bindings are kept for later.

            if (binding.isInvariant())
            {
                if (debug)
                    LOG.debug("Setting invariant value using " + connector + ".");

                try
                {
                    connector.setParameter(cycle);
                }
                catch (BindingException ex)
                {
                    throw new ConnectedParameterException(
                        Tapestry.format(
                            "ParameterManager.static-initialization-failure",
                            propertyName,
                            _component.getExtendedId(),
                            binding.toString()),
                        _component,
                        name,
                        propertyName,
                        ex);
                }
View Full Code Here

     *
     **/

    public boolean getRequiresSession()
    {
      IBinding statefulBinding = getStatefulBinding();
     
        if (statefulBinding == null)
            return true;

        return statefulBinding.getBoolean();
    }
View Full Code Here

            // Skip formal parameters

            if (getSpecification().getParameter(bindingName) != null)
                continue;

            IBinding binding = getBinding(bindingName);

            Object value = binding.getObject();

            result.put(bindingName, value);
        }

        return result;
View Full Code Here

     *
     **/

    public boolean isStateful()
    {
        IBinding statefulBinding = getStatefulBinding();

        if (statefulBinding == null)
            return true;

        return statefulBinding.getBoolean();
    }
View Full Code Here

            // ImageButton is used for its original purpose (as a kind
            // of image map).  In modern usage, we only care about
            // whether the user clicked on the image (and thus submitted
            // the form), not where in the image the user actually clicked.

            IBinding pointBinding = getPointBinding();

            if (pointBinding != null)
            {
                int x = Integer.parseInt(value);

                parameterName = name + ".y";
                value = context.getParameter(parameterName);

                int y = Integer.parseInt(value);

                pointBinding.setObject(new Point(x, y));
            }

            // Notify the application, by setting the select parameter
            // to the tag parameter.

            IBinding selectedBinding = getSelectedBinding();

            if (selectedBinding != null)
                selectedBinding.setObject(getTag());

            IActionListener listener = getListener();

            if (listener != null)
                listener.actionTriggered(this, cycle);
View Full Code Here

                parameterSpec.getLocation(),
                null);
           
            // if there is no binding for this parameter, bind it to the default value
            if (component.getBinding(name) == null) {
                IBinding binding = new ExpressionBinding(_resolver, component, defaultValue, parameterSpec.getLocation());
                component.setBinding(name, binding);
            }
               
        }
    }
View Full Code Here

            // Map.  We're just interested in informal parameters.

            if (specification.getParameter(name) != null)
                continue;

            IBinding binding = (IBinding) entry.getValue();

            Object value = binding.getObject();
            if (value == null)
                continue;

            if (value instanceof IAsset)
            {
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.