jakarta.faces.component.behavior.ClientBehaviorHolder Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.component.behavior;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
*
* The ClientBehaviorHolder interface may be implemented by any concrete
* {@link jakarta.faces.component.UIComponent} that wishes to support client behaviors as defined by
* {@link ClientBehavior}.
*
*
* @since 2.0
*/
public interface ClientBehaviorHolder {
/**
*
* Attaches a {@link ClientBehavior} to the component implementing this interface for the specified event. Valid event
* names for a UIComponent implementation are defined by {@code ClientBehaviorHolder.getEventNames()}.
*
*
* @param eventName the logical name of the client-side event to attach the behavior to.
* @param behavior the {@link ClientBehavior} instance to attach for the specified event name.
*
* @since 2.0
*/
void addClientBehavior(String eventName, ClientBehavior behavior);
/**
*
* Returns a non-null, unmodifiable Collection
containing the names of the logical events supported by the
* component implementing this interface.
*
*
* @return an unmodifiable collection of event names.
* @since 2.0
*/
Collection getEventNames();
/**
*
* Returns a non-null, unmodifiable Map
that contains the the {@link ClientBehavior}s that have been
* attached to the component implementing this interface. The keys in this Map
are event names defined by
* {@link #getEventNames}.
*
*
* @return an unmodifiable map of client behaviors.
* @since 2.0
*/
Map> getClientBehaviors();
/**
*
* Returns the default event name for this ClientBehaviorHolder
implementation. This must be one of the
* event names returned by {@link #getEventNames} or null if the component does not have a default event.
*
* @return the default event name.
* @since 2.0
*/
String getDefaultEventName();
}