public abstract class SwingEventAdapter extends Object
The base class for Swing event adapters.
An event adapter is responsible for transforming a Swing specific event notification into a platform independent form builder event. This base class provides a great deal of common functionality useful for different event types. Concrete sub classes will deal with specific event types.
This base class already stores important information (e.g. about the component this event adapter is associated with) in member fields. It also supports two different ways to map Swing events to platform-independent events:
FormEventManager
is specified, its fireEvent()
method is invoked. This automatically calls all listeners registered for
specific or all components.Modifier | Constructor and Description |
---|---|
protected |
SwingEventAdapter(FormEventListener l,
ComponentHandler<?> handler,
String name)
Creates a new instance of
SwingEventAdapter that serves a
specific event listener. |
protected |
SwingEventAdapter(FormEventManager eventManager,
ComponentHandler<?> handler,
String name)
Creates a new instance of
SwingEventAdapter that uses the FormEventManager to broadcast events. |
Modifier and Type | Method and Description |
---|---|
protected void |
fireEvent(FormEvent event)
Notifies the event manager about a new event.
|
FormEventListener |
getEventListener()
Returns the event listener this adapter is associated with.
|
FormEventManager |
getEventManager()
Returns a reference to the form event manager.
|
ComponentHandler<?> |
getHandler()
Returns a reference to the associated component handler.
|
protected abstract FormListenerType |
getListenerType()
Returns the event listener type used by this adapter.
|
String |
getName()
Returns the name of the component this adapter is registered at.
|
protected SwingEventAdapter(FormEventManager eventManager, ComponentHandler<?> handler, String name)
SwingEventAdapter
that uses the FormEventManager
to broadcast events.eventManager
- the event manager (must not be null)handler
- the component handlername
- the component's nameIllegalArgumentException
- if the FormEventManager
is
nullprotected SwingEventAdapter(FormEventListener l, ComponentHandler<?> handler, String name)
SwingEventAdapter
that serves a
specific event listener.l
- the event listener (must not be null)handler
- the ComponentHandler
name
- the name of the componentIllegalArgumentException
- if the event listener is nullpublic FormEventManager getEventManager()
public FormEventListener getEventListener()
public ComponentHandler<?> getHandler()
public String getName()
protected void fireEvent(FormEvent event)
event
- the event to sendprotected abstract FormListenerType getListenerType()
Copyright © 2016 The JGUIraffe Team. All rights reserved.