Skip to content

Commit

Permalink
Fixes #108 #109 Relocate EventType enumeration to shorten usage
Browse files Browse the repository at this point in the history
declaration and array type to annoation value
  • Loading branch information
sbordes committed Apr 29, 2014
1 parent 73490d1 commit 0c9fb18
Show file tree
Hide file tree
Showing 24 changed files with 576 additions and 499 deletions.
Expand Up @@ -25,7 +25,8 @@

import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventType;

import org.jrebirth.af.core.ui.annotation.type.Action;

/**
* This annotation is used to automatically attached an action event handler to a property node.
Expand All @@ -37,43 +38,12 @@
@Documented
public @interface OnAction {

/**
* The Action event type.<br />
* The Action type will be appended to method name to use.
*/
enum ActionType implements EnumEventType {

/** Unique Action event type. */
Action(ActionEvent.ACTION);

/** The JavaFX internal api name. */
private EventType<?> eventType;

/**
* Default constructor used to link the apiName.
*
* @param eventType the javafx event type
*/
private ActionType(final EventType<?> eventType) {
this.eventType = eventType;
}

/**
* {@inheritDoc}
*/
@Override
public EventType<?> eventType() {
return this.eventType;
}

}

/**
* Define the event type to manage.
*
* The default value is ActionType.Action, no other type can be defined
*/
ActionType[] value() default ActionType.Action;
Action[] value() default Action.Action;

/**
* Define a unique name used to avoid sharing same handler.
Expand Down
Expand Up @@ -24,9 +24,10 @@
import java.lang.annotation.Target;

import javafx.event.Event;
import javafx.event.EventType;
import javafx.scene.input.DragEvent;

import org.jrebirth.af.core.ui.annotation.type.Drag;

/**
* This annotation is used to automatically attached a Drag event handler to a property node.
*
Expand All @@ -37,64 +38,12 @@
@Documented
public @interface OnDrag {

/**
* The Drag event type.<br />
* The Drag type will be appended to method name to use.
*/
enum DragType implements EnumEventType {

/** Any Drag Event. */
Any(DragEvent.ANY),

/** Drag done event. */
Done(DragEvent.DRAG_DONE),

/** Drag dropped event. */
Dropped(DragEvent.DRAG_DROPPED),

/** Drag entered event. */
Entered(DragEvent.DRAG_ENTERED),

/** Drag entered target event. */
EnteredTarget(DragEvent.DRAG_ENTERED_TARGET),

/** Drag exited event. */
Exited(DragEvent.DRAG_EXITED),

/** Drag exited target event. */
ExitedTarget(DragEvent.DRAG_EXITED_TARGET),

/** Drag over event. */
Over(DragEvent.DRAG_OVER);

/** The JavaFX internal api name. */
private EventType<?> eventType;

/**
* Default constructor used to link the apiName.
*
* @param eventType the javafx event type
*/
private DragType(final EventType<?> eventType) {
this.eventType = eventType;
}

/**
* {@inheritDoc}
*/
@Override
public EventType<?> eventType() {
return this.eventType;
}

}

/**
* Define the event type to manage.
*
* The default value is DragType.Any
*/
DragType value() default DragType.Any;
Drag[] value() default Drag.Any;

/**
* Define a unique name used to avoid sharing same handler.
Expand Down
Expand Up @@ -25,7 +25,8 @@

import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventType;

import org.jrebirth.af.core.ui.annotation.type.Finished;

/**
* This annotation is used to automatically attached a Finished event handler to an Animation.
Expand All @@ -37,43 +38,12 @@
@Documented
public @interface OnFinished {

/**
* The Finished event type.<br />
* The Finished type will be appended to method name to use.
*/
enum FinishedType implements EnumEventType {

/** Unique Action event type. */
Action(ActionEvent.ACTION);

/** The JavaFX internal api name. */
private EventType<?> eventType;

/**
* Default constructor used to link the apiName.
*
* @param eventType the javafx event type
*/
private FinishedType(final EventType<?> eventType) {
this.eventType = eventType;
}

/**
* {@inheritDoc}
*/
@Override
public EventType<?> eventType() {
return this.eventType;
}

}

/**
* Define the event type to manage.
*
* The default value is FinishedType.Action, no other type can be defined
*/
FinishedType[] value() default FinishedType.Action;
Finished[] value() default Finished.Action;

/**
* Define a unique name used to avoid sharing same handler.
Expand Down
Expand Up @@ -24,9 +24,10 @@
import java.lang.annotation.Target;

import javafx.event.Event;
import javafx.event.EventType;
import javafx.scene.input.KeyEvent;

import org.jrebirth.af.core.ui.annotation.type.Key;

/**
* This annotation is used to automatically attached a Key event handler to a property node.
*
Expand All @@ -37,52 +38,12 @@
@Documented
public @interface OnKey {

/**
* The Key event type.<br />
* The Key type will be appended to method name to use.
*/
enum KeyType implements EnumEventType {

/** Any Key Event. */
Any(KeyEvent.ANY),

/** Key pressed event. */
Pressed(KeyEvent.KEY_PRESSED),

/** Key released event. */
Released(KeyEvent.KEY_RELEASED),

/** Key typed event. */
Typed(KeyEvent.KEY_TYPED);

/** The JavaFX internal api name. */
private EventType<?> eventType;

/**
* Default constructor used to link the apiName.
*
* @param eventType the javafx event type
*/
private KeyType(final EventType<?> eventType) {
this.eventType = eventType;
}

/**
* {@inheritDoc}
*/
@Override
public EventType<?> eventType() {
return this.eventType;
}

}

/**
* Define the event type to manage.
*
* The default value is KeyType.Any
*/
KeyType value() default KeyType.Any;
Key[] value() default Key.Any;

/**
* Define a unique name used to avoid sharing same handler.
Expand Down
Expand Up @@ -24,9 +24,10 @@
import java.lang.annotation.Target;

import javafx.event.Event;
import javafx.event.EventType;
import javafx.scene.input.MouseEvent;

import org.jrebirth.af.core.ui.annotation.type.Mouse;

/**
* This annotation is used to automatically attached a Mouse event handler to a property node.
*
Expand All @@ -37,73 +38,12 @@
@Documented
public @interface OnMouse {

/**
* The Mouse event type.<br />
* The mouse type will be appended to method name to use.
*/
enum MouseType implements EnumEventType {

/** Any Rotate Event. */
Any(MouseEvent.ANY),

/** Mouse drag detected event. */
DragDetected(MouseEvent.DRAG_DETECTED),

/** Mouse clicked event. */
Clicked(MouseEvent.MOUSE_CLICKED),

/** Mouse dragged event. */
Dragged(MouseEvent.MOUSE_DRAGGED),

/** Mouse entered event. */
Entered(MouseEvent.MOUSE_ENTERED),

/** Mouse entered target event. */
EnteredTarget(MouseEvent.MOUSE_ENTERED_TARGET),

/** Mouse exited event. */
Exited(MouseEvent.MOUSE_EXITED),

/** Mouse exited target event. */
ExitedTarget(MouseEvent.MOUSE_EXITED_TARGET),

/** Mouse moved event. */
Moved(MouseEvent.MOUSE_MOVED),

/** Mouse pressed event. */
Pressed(MouseEvent.MOUSE_PRESSED),

/** Mouse released event. */
Released(MouseEvent.MOUSE_RELEASED);

/** The JavaFX internal api name. */
private EventType<?> eventType;

/**
* Default constructor used to link the apiName.
*
* @param eventType the javafx event type
*/
private MouseType(final EventType<?> eventType) {
this.eventType = eventType;
}

/**
* {@inheritDoc}
*/
@Override
public EventType<?> eventType() {
return this.eventType;
}

}

/**
* Define the event type to manage.
*
* The default value is MouseType.Any
*/
MouseType[] value() default MouseType.Any;
Mouse[] value() default Mouse.Any;

/**
* Define a unique name used to avoid sharing same handler.
Expand Down

0 comments on commit 0c9fb18

Please sign in to comment.