Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // Copyright 2006, 2007, 2008, 2010 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.tapestry5.internal.services;
 
 
 public class ComponentEventImpl extends EventImpl implements ComponentEvent
 {
     private final String eventType;
 
     private final String originatingComponentId;
 
     private final EventContext context;
 
     private final ComponentPageElementResources elementResources;

    

Parameters:
eventType non blank string used to identify the type of event that was triggered
originatingComponentId the id of the component that triggered the event
context provides access to parameter values
handler invoked when a non-null return value is obtained from an event handler method
elementResources provides access to common resources and services
logger used to log method invocations
 
     public ComponentEventImpl(String eventTypeString originatingComponentIdEventContext context,
             ComponentEventCallback handlerComponentPageElementResources elementResourcesLogger logger)
     {
         super(handlerlogger);
 
         this. = eventType;
         this. = originatingComponentId;
         this. = elementResources;
         this. = context;
     }
 
     @Override
     public String toString()
     {
         return String.format("ComponentEvent[%s from %s]".length() == 0 ? "(self)"
                 : );
     }
 
     public boolean matches(String eventTypeString componentIdint parameterCount)
     {
         if (isAborted())
             return false;
 
         return this..equalsIgnoreCase(eventType) && .getCount() >= parameterCount
                 && (.equalsIgnoreCase(componentId) || componentId.equals(""));
     }
 
     @SuppressWarnings("unchecked")
     public Object coerceContext(int indexString desiredTypeName)
     {
         if (index >= .getCount())
             throw new IllegalArgumentException(ServicesMessages.contextIndexOutOfRange(getMethodDescription()));
         try
         {
             Class desiredType = .toClass(desiredTypeName);
 
             return .get(desiredTypeindex);
         }
         catch (Exception ex)
         {
             throw new IllegalArgumentException(ServicesMessages.exceptionInMethodParameter(getMethodDescription(),
                     indexex), ex);
         }
     }
 
     public Object[] getContext()
     {
         int count = .getCount();
 
         Object[] result = new Object[count];
 
         for (int i = 0; i < counti++)
             result[i] = .get(Object.classi);
        return result;
    }
    public EventContext getEventContext()
    {
        return ;
    }
New to GrepCode? Check out our FAQ X