org.gnu.glib

Class EventMap


public class EventMap
extends java.lang.Object

An EventMap is a Java-GNOME implementation class which encapsulates all static information that maps GTK signals to Java-GNOME events. There should be one private static EventMap for each Java-GNOME class which fires events. Besides reducing the code needed to add event handling to a widget instance, this mapping is needed by libglade to look up which event is associated with which signal for a given class. It should not be used by client code, however.

Method Summary

void
addEvent(String signal, String method, EventType eventType, Class listenerClass)
void
addEvent(EventType eventType, Class listenerClass)
Adds an event to the EventMap.
Class
getEventListenerClass(String signal)
Return the event listener class for a given signal.
EventType
getEventType(String signal)
Get the event type for a given signal.
void
initialize(GObject source)
Connect all event handlers to this event source.
void
initialize(GObject source, EventType type)
Connect an event handler of the type provided.
void
initialize(GObject source, EventType type, boolean shouldCopyIfBoxed)
Connect an event handler of the type provided.
void
uninitialize(GObject source, EventType type)
Disconnect an event handler of the type provided.

Method Details

addEvent

public void addEvent(String signal,
                     String method,
                     EventType eventType,
                     Class listenerClass)

addEvent

public void addEvent(EventType eventType,
                     Class listenerClass)
Adds an event to the EventMap. This is a convenience method that uses addEvent(String,String,EventType,Class) internally. It gets the signal name by calling EventType.getName() and it expects the callback method to be named in a very specific format. It should start with 'handle' and then be followed by the signal name in camel case format.

For example, if the signal name is 'file-activated', the generated method name will be 'handleFileActivated'.
Parameters:
eventType -
listenerClass -

getEventListenerClass

public Class getEventListenerClass(String signal)
Return the event listener class for a given signal.

getEventType

public EventType getEventType(String signal)
Get the event type for a given signal.

initialize

public void initialize(GObject source)
Connect all event handlers to this event source.

initialize

public void initialize(GObject source,
                       EventType type)
Connect an event handler of the type provided.

initialize

public void initialize(GObject source,
                       EventType type,
                       boolean shouldCopyIfBoxed)
Connect an event handler of the type provided.

uninitialize

public void uninitialize(GObject source,
                         EventType type)
Disconnect an event handler of the type provided.