Klasse SwingEventAdapter
java.lang.Object
net.sf.jguiraffe.gui.platform.swing.builder.event.SwingEventAdapter
- Bekannte direkte Unterklassen:
MouseEventAdapter
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:
- If a
FormEventManager
is specified, itsfireEvent()
method is invoked. This automatically calls all listeners registered for specific or all components. - It is also possible to map the Swing-specific events to a specific event listener which has to be passed to the constructor. In this case only this listener is invoked.
- Version:
- $Id: SwingEventAdapter.java 205 2012-01-29 18:29:57Z oheger $
- Autor:
- Oliver Heger
-
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotected
SwingEventAdapter
(FormEventListener l, ComponentHandler<?> handler, String name) Creates a new instance ofSwingEventAdapter
that serves a specific event listener.protected
SwingEventAdapter
(FormEventManager eventManager, ComponentHandler<?> handler, String name) Creates a new instance ofSwingEventAdapter
that uses theFormEventManager
to broadcast events. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected void
Notifies the event manager about a new event.Returns the event listener this adapter is associated with.Returns a reference to the form event manager.Returns a reference to the associated component handler.protected abstract FormListenerType
Returns the event listener type used by this adapter.getName()
Returns the name of the component this adapter is registered at.
-
Konstruktordetails
-
SwingEventAdapter
protected SwingEventAdapter(FormEventManager eventManager, ComponentHandler<?> handler, String name) Creates a new instance ofSwingEventAdapter
that uses theFormEventManager
to broadcast events.- Parameter:
eventManager
- the event manager (must not be null)handler
- the component handlername
- the component's name- Löst aus:
IllegalArgumentException
- if theFormEventManager
is null
-
SwingEventAdapter
Creates a new instance ofSwingEventAdapter
that serves a specific event listener.- Parameter:
l
- the event listener (must not be null)handler
- theComponentHandler
name
- the name of the component- Löst aus:
IllegalArgumentException
- if the event listener is null
-
-
Methodendetails
-
getEventManager
Returns a reference to the form event manager. This can be null if this adapter is not associated with the event manager.- Gibt zurück:
- the event manager
-
getEventListener
Returns the event listener this adapter is associated with. This can be null if this listener is not associated with an event listener.- Gibt zurück:
- the event listener
-
getHandler
Returns a reference to the associated component handler.- Gibt zurück:
- the component handler
-
getName
Returns the name of the component this adapter is registered at.- Gibt zurück:
- the component name
-
fireEvent
Notifies the event manager about a new event. With this method an event can be sent to all registered listeners.- Parameter:
event
- the event to send
-
getListenerType
Returns the event listener type used by this adapter. This method must be defined in concrete sub classes.- Gibt zurück:
- the event listener type
-