Servoy 5.x Public API

com.servoy.j2db.scripting
Class JSEvent

java.lang.Object
  extended by com.servoy.j2db.scripting.JSEvent
All Implemented Interfaces:
IConstantsObject, IJavaScriptType, IPrefixedConstantsObject

public class JSEvent
extends Object
implements IPrefixedConstantsObject

JSEvent, used as first argument to user-event callbacks.

Since:
5.0

Nested Class Summary
static class JSEvent.EventType
           
 
Field Summary
static String ACTION
          Constant returned by JSEvent.getType() in a method that is attached to an onAction event.
static String DATACHANGE
          Constant returned by JSEvent.getType() in a method that is attached to an onDataChange event.
static String DOUBLECLICK
          Constant returned by JSEvent.getType() in a method that is attached to an onDoubleClick event.
static String FOCUSGAINED
          Constant returned by JSEvent.getType() in a method that is attached to an onFocusGained or the forms onElementFocusGained event.
static String FOCUSLOST
          Constant returned by JSEvent.getType() in a method that is attached to an onFocusLost or the forms onElementFocusLost event.
static String FORM
          Constant returned by JSEvent.getType() in a method that is attached to a form event (like onShow) or command (like onDeleteRecord)
static int MODIFIER_ALT
          Constant for the ALT modifier that can be returned by JSEvent.getModifiers();
static int MODIFIER_CTRL
          Constant for the CTRL modifier that can be returned by JSEvent.getModifiers();
static int MODIFIER_META
          Constant for the META modifier that can be returned by JSEvent.getModifiers();
static int MODIFIER_SHIFT
          Constant for the SHIFT modifier that can be returned by JSEvent.getModifiers();
static String NONE
          Constant returned by JSEvent.getType() if the event is not used in a known event or command.
static String ONDRAG
          Constant returned by JSEvent.getType() in a method that is attached to an onDrag event.
static String ONDRAGOVER
          Constant returned by JSEvent.getType() in a method that is attached to an onDragOver event.
static String ONDROP
          Constant returned by JSEvent.getType() in a method that is attached to an onDrop event.
static String RIGHTCLICK
          Constant returned by JSEvent.getType() in a method that is attached to an onRightClick event.
 
Constructor Summary
JSEvent()
           
 
Method Summary
 Object getData()
           
 String getPrefix()
           
 Object js_getData()
          A data object that specific events can set, a user can set data back to the system for events that supports this.
 String js_getElementName()
          returns the name of the element, can be null if the form was the source of the event.
 String js_getFormName()
          returns the name of the form the element was placed on.
 int js_getModifiers()
          Returns the modifiers of the event, see JSEvent.MODIFIER_XXXX for the modifiers that can be returned.
 Object js_getSource()
          returns the source component/element of the event.
 Date js_getTimestamp()
          Returns the time the event occurred.
 String js_getType()
          returns the event type see the JSEvents constants what it can return.
 int js_getX()
          Returns the x position of the event if applicable.
 int js_getY()
          Returns the x position of the event if applicable.
 void js_setData(Object object)
           
 void setData(Object object)
           
 void setElementName(String elementName)
           
 void setFormName(String formName)
           
 void setLocation(Point point)
           
 void setModifiers(int modifiers)
           
 void setSource(Object source)
           
 void setTimestamp(Date timestamp)
           
 void setType(JSEvent.EventType type)
           
 void setType(String type)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION

public static final String ACTION
Constant returned by JSEvent.getType() in a method that is attached to an onAction event.


DATACHANGE

public static final String DATACHANGE
Constant returned by JSEvent.getType() in a method that is attached to an onDataChange event.


DOUBLECLICK

public static final String DOUBLECLICK
Constant returned by JSEvent.getType() in a method that is attached to an onDoubleClick event.


FOCUSGAINED

public static final String FOCUSGAINED
Constant returned by JSEvent.getType() in a method that is attached to an onFocusGained or the forms onElementFocusGained event.


FOCUSLOST

public static final String FOCUSLOST
Constant returned by JSEvent.getType() in a method that is attached to an onFocusLost or the forms onElementFocusLost event.


FORM

public static final String FORM
Constant returned by JSEvent.getType() in a method that is attached to a form event (like onShow) or command (like onDeleteRecord)


MODIFIER_ALT

public static final int MODIFIER_ALT
Constant for the ALT modifier that can be returned by JSEvent.getModifiers();

See Also:
js_getModifiers(), Constant Field Values

MODIFIER_CTRL

public static final int MODIFIER_CTRL
Constant for the CTRL modifier that can be returned by JSEvent.getModifiers();

See Also:
js_getModifiers(), Constant Field Values

MODIFIER_META

public static final int MODIFIER_META
Constant for the META modifier that can be returned by JSEvent.getModifiers();

See Also:
js_getModifiers(), Constant Field Values

MODIFIER_SHIFT

public static final int MODIFIER_SHIFT
Constant for the SHIFT modifier that can be returned by JSEvent.getModifiers();

See Also:
js_getModifiers(), Constant Field Values

NONE

public static final String NONE
Constant returned by JSEvent.getType() if the event is not used in a known event or command.


ONDRAG

public static final String ONDRAG
Constant returned by JSEvent.getType() in a method that is attached to an onDrag event.


ONDRAGOVER

public static final String ONDRAGOVER
Constant returned by JSEvent.getType() in a method that is attached to an onDragOver event.


ONDROP

public static final String ONDROP
Constant returned by JSEvent.getType() in a method that is attached to an onDrop event.


RIGHTCLICK

public static final String RIGHTCLICK
Constant returned by JSEvent.getType() in a method that is attached to an onRightClick event.

Constructor Detail

JSEvent

public JSEvent()
Method Detail

getData

public Object getData()

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface IPrefixedConstantsObject
See Also:
IPrefixedConstantsObject.getPrefix()

js_getData

public Object js_getData()
A data object that specific events can set, a user can set data back to the system for events that supports this.


js_getElementName

public String js_getElementName()
returns the name of the element, can be null if the form was the source of the event.

Returns:
a String representing the element name.

js_getFormName

public String js_getFormName()
returns the name of the form the element was placed on.

Returns:
a String representing the form name.

js_getModifiers

public int js_getModifiers()
Returns the modifiers of the event, see JSEvent.MODIFIER_XXXX for the modifiers that can be returned.

Returns:
an int which holds the modifiers as a bitset.

js_getSource

public Object js_getSource()
returns the source component/element of the event. If it has a name the getElementName() is the name of this component.

Returns:
an Object representing the source of this event.

js_getTimestamp

public Date js_getTimestamp()
Returns the time the event occurred.

Returns:
a Date when this event happened.

js_getType

public String js_getType()
returns the event type see the JSEvents constants what it can return. Plugins can create events with there own types.

Returns:
a String representing the type of this event.

js_getX

public int js_getX()
Returns the x position of the event if applicable. For example drag'n'drop events will set the x,y positions.

Returns:
an int representing the X position.

js_getY

public int js_getY()
Returns the x position of the event if applicable. For example drag'n'drop events will set the x,y positions.

Returns:
an int representing the Y position.

js_setData

public void js_setData(Object object)

setData

public void setData(Object object)

setElementName

public void setElementName(String elementName)

setFormName

public void setFormName(String formName)

setLocation

public void setLocation(Point point)

setModifiers

public void setModifiers(int modifiers)

setSource

public void setSource(Object source)

setTimestamp

public void setTimestamp(Date timestamp)

setType

public void setType(JSEvent.EventType type)

setType

public void setType(String type)

toString

public String toString()
Overrides:
toString in class Object

Copyright © 2010 Servoy B.V.