|
|
|
|
AjaxSwing emulates mouse events via standard java.awt.event.MouseListener interface. However, because MouseListener has 5 different events
AjaxSwing doesn't know which ones of them is the application actually using. Emulating all of them is not going to work because event such as
mouseEntered would always result in Ajax page submission so no other events will be processed until mouseEntered has finished. To provide better
user experience AjaxSwing allows applications to provide a hint about what mouse event is it actually interested in. The hint is provided
using a client property AjaxSwingProperties.COMPONENT_MOUSE_EVENT_LISTENER, with the value set to one of AjaxSwingConstants.Mouse_XXX constants.
The following example illustrates how a text component is configured to trigger MouseListener on mouse over event:
jTextDesc.putClientProperty(AjaxSwingProperties.COMPONENT_MOUSE_EVENT_LISTENER, AjaxSwingConstants.MOUSE_ON_MOUSE_OVER);
AjaxSwingConstants defines the following values for mouse event types
public String MOUSE_IGNORE = "ignore";
public String MOUSE_ON_MOUSE_OVER = "onMouseOver";
public String MOUSE_ON_MOUSE_DOWN = "onMouseDown";
public String MOUSE_ON_MOUSE_UP = "onMouseUp";
public String MOUSE_ON_MOUSE_OUT = "onMouseOut";
public String MOUSE_ON_CLICK = "onClick";
public String MOUSE_ON_DOUBLE_CLICK = "onDblClick";
If no hint is provided for a component that has MouseListener, MOUSE_ON_DOUBLE_CLICK is used as a default value. See LoginDialog.java in src
directory for an example of mouse event handling.
|
|
|
|
|
|