Esempio n. 1
0
        /* ---- InternalWrapperContext --- */

        /// <summary>  returns the user data context that
        /// we are wrapping
        /// </summary>
        /// <summary>  Returns the base context that we are
        /// wrapping. Here, its this, but for other thing
        /// like VM related context contortions, it can
        /// be something else
        /// </summary>
        /* -----  InternalEventContext ---- */
        public EventCartridge AttachEventCartridge(EventCartridge eventCartridge)
        {
            if (internalEventContext != null)
            {
                return(internalEventContext.AttachEventCartridge(eventCartridge));
            }

            return(null);
        }
        /* ---- InternalWrapperContext --- */

        /* -----  InternalEventContext ---- */

        /// <seealso cref="org.apache.velocity.context.InternalEventContext.attachEventCartridge(org.apache.velocity.app.event.EventCartridge)">
        /// </seealso>
        public EventCartridge AttachEventCartridge(EventCartridge ec)
        {
            if (iec != null)
            {
                return(iec.AttachEventCartridge(ec));
            }

            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Attached the EventCartridge to the context
        /// </summary>
        /// <param name="context">context to attach to</param>
        /// <returns>true if successful, false otherwise</returns>
        public bool AttachToContext(IContext context)
        {
            IInternalEventContext internalEventContext = context as IInternalEventContext;

            if (internalEventContext == null)
            {
                return(false);
            }
            else
            {
                internalEventContext.AttachEventCartridge(this);
                return(true);
            }
        }
Esempio n. 4
0
        public bool AttachToContext(IContext context)
        {
            bool result;

            if (context is IInternalEventContext)
            {
                IInternalEventContext internalEventContext = (IInternalEventContext)context;
                internalEventContext.AttachEventCartridge(this);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Esempio n. 5
0
        /// <summary>  Attached the EventCartridge to the context
        ///
        /// Final because not something one should mess with lightly :)
        ///
        /// </summary>
        /// <param name="context">context to attach to
        /// </param>
        /// <returns> true if successful, false otherwise
        /// </returns>
        public bool AttachToContext(IContext context)
        {
            if (context is IInternalEventContext)
            {
                IInternalEventContext iec = (IInternalEventContext)context;

                iec.AttachEventCartridge(this);

                /**
                 * while it's tempting to call setContext on each handler from here,
                 * this needs to be done before each method call.  This is
                 * because the specific context will change as inner contexts
                 * are linked in through macros, foreach, or directly by the user.
                 */

                return(true);
            }
            else
            {
                return(false);
            }
        }