java.lang.Object
org.proto4j.swing.AbstractEntry<G>
- Type Parameters:
G
- the GUI's type
- All Implemented Interfaces:
Entry<G>
public abstract class AbstractEntry<G> extends java.lang.Object implements Entry<G>
This class provides basic operations for the
Entry
.
It comes with two important methods: linkAction(Object)
and
start(Object...)
. Their implementation is standardized, so there
is no need for external implementation.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEntry(java.lang.Class<G> type)
Create a newAbstractEntry
object. -
Method Summary
Modifier and Type Method Description protected void
addListener(java.lang.Object listener, AnnotationContext<ActionHandler> ctx)
abstract <E extends java.util.EventListener>
EcreateListener(java.lang.Class<E> cls, java.lang.Object ls, java.lang.Object parent)
A simple delegation method to provide theEventListener
object.java.lang.Class<G>
getType()
void
linkAction(java.lang.Object src)
Searches for theActionHandler
annotation and tries to link the given EventListener to the specified target.<T extends java.util.EventListener>
booleanlinkAction(java.lang.String fieldName, java.lang.Class<T> cls, T listener)
Tries to link the given EventListener to the specified target.void
start(java.lang.Object... args)
Searches for theEntryPoint
annotation and executes the method with it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.proto4j.swing.Entry
getDeclaredField, getDeclaredField, getDeclaredFields, getGUI, getNestedGUI, getNestedGUI, getNestedGUIs, putField, putNestedGUI, setGUI
-
Constructor Details
-
AbstractEntry
Create a newAbstractEntry
object.- Parameters:
type
- the GUI's type
-
-
Method Details
-
createListener
public abstract <E extends java.util.EventListener> E createListener(java.lang.Class<E> cls, java.lang.Object ls, java.lang.Object parent)A simple delegation method to provide theEventListener
object.- Type Parameters:
E
- the event listener type- Parameters:
cls
- theEventListener
classls
- the listener object - currently either directly theEventListener
or aMethod
that should be casted to theEventListener
.parent
- the declaring object- Returns:
- the
EventListener
instance
-
getType
-
start
public void start(java.lang.Object... args) throws java.lang.NullPointerExceptionSearches for theEntryPoint
annotation and executes the method with it. -
linkAction
public void linkAction(java.lang.Object src)Searches for theActionHandler
annotation and tries to link the given EventListener to the specified target.- Specified by:
linkAction
in interfaceEntry<G>
- Parameters:
src
- the event listener object
-
linkAction
public <T extends java.util.EventListener> boolean linkAction(java.lang.String fieldName, java.lang.Class<T> cls, T listener)Description copied from interface:Entry
Tries to link the given EventListener to the specified target.- Specified by:
linkAction
in interfaceEntry<G>
- Type Parameters:
T
- the listener type- Parameters:
fieldName
- the target field namecls
- the listener base classlistener
- the event listener object- Returns:
true
if the listener has been added successfully
-
addListener
-