final class LensApplication extends Application
Modifier and Type | Class and Description |
---|---|
private static class |
LensApplication.DragActions |
private static class |
LensApplication.Event |
private class |
LensApplication.LensDeviceEvent |
private class |
LensApplication.LensDragEvent |
private static class |
LensApplication.LensKeyEvent
This class is used to handle key events
|
private class |
LensApplication.LensMenuEvent |
private static class |
LensApplication.LensMouseEvent |
private static class |
LensApplication.LensMultiTouchEvent |
private class |
LensApplication.LensScreenEvent |
private static class |
LensApplication.LensScrollEvent |
private static class |
LensApplication.LensTouchEvent |
private static class |
LensApplication.LensViewEvent |
private static class |
LensApplication.LensWindowEvent
This class is used to handle window related events
|
private static class |
LensApplication.RunLoopControl |
private static class |
LensApplication.RunnableEvent |
Application.EventHandler
Modifier and Type | Field and Description |
---|---|
private static java.lang.Object |
activeEventLoopLock |
private static int |
activeEventLoopThreads |
(package private) java.util.LinkedList<LensApplication.RunLoopControl> |
activeRunLoops |
private int |
cachedButtonPressed |
private boolean |
cursorVisible
True if the application wishes to show the cursor
|
private static int |
DEVICE_5WAY
Bit to indicate that a device has arrow keys and a select key
|
private static int |
DEVICE_MAX
Largest bit used in device capability bitmasks
|
private static int |
DEVICE_MULTITOUCH
Bit to indicate that a device has multitouch support
|
private static int |
DEVICE_PC_KEYBOARD
Bit to indicate that a device has a full PC keyboard
|
private static int |
DEVICE_POINTER
Bit to indicate that a device has relative motion pointer support
|
private static int |
DEVICE_TOUCH
Bit to indicate that a device has touch support
|
private int[] |
deviceFlags
A running count of the numbers of devices with each device capability
|
private EventLoop |
dndEventLoop |
private static boolean |
doComposite |
private int |
dragActionsPreformed |
private boolean |
dragStarted |
private LensView |
dragView |
(package private) Menu |
editMenu |
private java.util.LinkedList<LensApplication.Event> |
eventList |
(package private) Menu |
fileMenu |
private static java.lang.Object |
invokeAndWaitLock |
private static boolean |
isInitialized |
private static int |
nativeThreadCounter |
private int |
previousTouchMoveScreenX |
private int |
previousTouchMoveScreenY |
private int |
previousTouchMoveX
Values of -1 mean that these variables are not set.
|
private int |
previousTouchMoveY |
private static java.lang.Runnable |
waitingFor |
(package private) Menu |
windowMenu |
name
Constructor and Description |
---|
LensApplication() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
_enterNestedEventLoop() |
protected int |
_getKeyCodeForChar(char c) |
private static boolean |
_initialize() |
private static void |
_initIDs() |
protected void |
_invokeAndWait(java.lang.Runnable runnable) |
protected void |
_invokeLater(java.lang.Runnable runnable) |
protected void |
_leaveNestedEventLoop(java.lang.Object retValue) |
private void |
_notfyPlatformDnDEnded() |
private void |
_notfyPlatformDnDStarted() |
private static void |
_notifyRenderingEnd() |
private java.lang.Object |
_runLoop() |
protected boolean |
_supportsTransparentWindows() |
protected boolean |
_supportsUnifiedWindows() |
Cursor |
createCursor(int type) |
Cursor |
createCursor(int x,
int y,
Pixels pixels) |
private static void |
createNativeEventThread(long nativeEventHandler,
long data) |
Pixels |
createPixels(int width,
int height,
java.nio.ByteBuffer data) |
Pixels |
createPixels(int width,
int height,
java.nio.IntBuffer data) |
Pixels |
createPixels(int width,
int height,
java.nio.IntBuffer data,
float scale) |
Robot |
createRobot() |
Timer |
createTimer(java.lang.Runnable runnable) |
View |
createView() |
Window |
createWindow(long parent) |
Window |
createWindow(Window owner,
Screen screen,
int styleMask)
Create a window.
|
(package private) java.lang.Object |
enterDnDEventLoop() |
protected void |
finishTerminating() |
Menu |
getWindowMenu() |
private boolean |
handleDragEvents(LensView view,
int eventType,
int x,
int y,
int absx,
int absy,
int button,
int modifiers)
Transforms mouse events into drag events when drag detected.
|
boolean |
hasMultiTouch() |
boolean |
hasPointer() |
boolean |
hasTouch() |
boolean |
hasTwoLevelFocus() |
boolean |
hasVirtualKeyboard() |
boolean |
hasWindowManager() |
private static void |
initLibrary() |
void |
installDefaultMenus(MenuBar menubar)
Install app's default native menus:
on Mac OS X - Apple menu (showing the app name) with a single Quit menu item
on Windows - NOP
on Linux - NOP
|
void |
installWindowMenu(MenuBar menubar) |
(package private) void |
leaveDndEventLoop(java.lang.Object value) |
private void |
nativeEventLoop(LensApplication lensApp,
long nativeEventHandler,
long nativeWindow) |
private void |
notifyDeviceEvent(int flags,
boolean attach)
Notify device event from native
A device event is sent when an input device is attached or detached.
|
(package private) void |
notifyDragStart()
This function should be only called from LensDnDClipboard after it has
been initialized.
|
private void |
notifyKeyEvent(LensView view,
int type,
int keyCode,
int modifiers,
char[] chars)
Notify key event from native layer
|
private void |
notifyMenuEvent(LensView view,
int x,
int y,
int xAbs,
int yAbs,
boolean isKeyboardTrigger) |
(package private) void |
notifyMouseEvent(LensView view,
int eventType,
int x,
int y,
int absx,
int absy,
int button,
int modifiers,
boolean isPopupTrigger,
boolean isSynthesized)
Notify mouse event from native layer
|
private void |
notifyMultiTouchEvent(LensView view,
int[] states,
long[] ids,
int[] xs,
int[] ys,
int dx,
int dy)
Notify multitouch event from native layer
|
private void |
notifyScreenSettingsChanged()
Notify changes in screen settings from native layer
This method is triggered when native code detects a change in e.g.
|
private void |
notifyScrollEvent(LensView view,
int x,
int y,
int absx,
int absy,
double deltaX,
double deltaY,
int modifiers,
int lines,
int chars,
int defaultLines,
int defaultChars,
double xMultiplier,
double yMultiplier)
Notify scroll event from native layer
|
private void |
notifyTouchEvent(LensView view,
int state,
long id,
int x,
int y,
int absX,
int absY)
Notify touch event from native layer
|
private void |
notifyViewEvent(LensView view,
int viewEventType,
int x,
int y,
int width,
int height)
Notify view event from native
View events are one of the events listed in ViewEvent.java
|
protected void |
notifyWindowEvent(LensWindow window,
int windowEvent)
This notification informs JFX on window events that doesn't
requires additional information for handling the
notification.
|
protected void |
notifyWindowMove(LensWindow window,
int x,
int y)
Notify JFX that the window have been moved and provide the
new coordinates.
|
protected void |
notifyWindowResize(LensWindow window,
int eventType,
int width,
int height)
handles the following window events WindowEvent.MINIMIZE /
MAXIMIZE /RESTORE / RESIZE
See Window.java::notifyResize() for more information
|
private void |
postEvent(LensApplication.Event e) |
private void |
postMouseEvent(LensView view,
int eventType,
int x,
int y,
int absx,
int absy,
int button,
int modifiers,
boolean isPopupTrigger,
boolean isSynthesized)
Posts a mouse event, filtering out sequences of similar motion or drag
events.
|
private void |
postTouchMoveEvent(LensView view,
long id,
int x,
int y,
int absX,
int absY)
Posts the touch move event.
|
(package private) void |
registerApplication() |
private static void |
registerEventLoop() |
protected void |
runLoop(java.lang.Runnable launchable) |
(package private) void |
shutdown() |
protected CommonDialogs.FileChooserResult |
staticCommonDialogs_showFileChooser(Window owner,
java.lang.String folder,
java.lang.String filename,
java.lang.String title,
int type,
boolean multipleMode,
CommonDialogs.ExtensionFilter[] extensionFilters,
int defaultFilterIndex) |
protected java.io.File |
staticCommonDialogs_showFolderChooser(Window owner,
java.lang.String folder,
java.lang.String title) |
protected Size |
staticCursor_getBestSize(int width,
int height) |
protected void |
staticCursor_setVisible(boolean visible) |
protected int |
staticPixels_getNativeFormat() |
protected Screen[] |
staticScreen_getScreens() |
protected double |
staticScreen_getVideoRefreshPeriod() |
protected int |
staticTimer_getMaxPeriod() |
protected int |
staticTimer_getMinPeriod() |
protected int |
staticView_getMultiClickMaxX() |
protected int |
staticView_getMultiClickMaxY() |
protected long |
staticView_getMultiClickTime() |
private static void |
unregisterEventLoop() |
private static void |
waitEventLoopsToFinish() |
protected void |
windowExpose(LensWindow window,
int x,
int y,
int width,
int height) |
_supportsInputMethods, _supportsSystemMenu, checkEventThread, createAccessible, createEventLoop, createMenu, createMenu, createMenuBar, createMenuItem, createMenuItem, createMenuItem, createMenuItem, createWindow, GetApplication, getDataDirectory, getDeviceDetails, getEventHandler, getEventThread, getHighContrastTheme, getKeyCodeForChar, getName, invokeAndWait, invokeLater, isEventThread, isNestedLoopRunning, loadNativeLibrary, loadNativeLibrary, menuAboutAction, notifyRenderingFinished, reportException, run, setDeviceDetails, setEventHandler, setEventThread, setName, setTerminateWhenLastWindowClosed, shouldTerminateWhenLastWindowClosed, shouldUpdateWindow, supportsInputMethods, supportsSystemMenu, supportsTransparentWindows, supportsUnifiedWindows, terminate
private static final int DEVICE_TOUCH
private static final int DEVICE_MULTITOUCH
private static final int DEVICE_POINTER
private static final int DEVICE_5WAY
private static final int DEVICE_PC_KEYBOARD
private static final int DEVICE_MAX
private int[] deviceFlags
private int previousTouchMoveX
private int previousTouchMoveY
private int previousTouchMoveScreenX
private int previousTouchMoveScreenY
private boolean cursorVisible
Menu windowMenu
Menu editMenu
Menu fileMenu
private static final java.lang.Object invokeAndWaitLock
private static java.lang.Runnable waitingFor
private static int activeEventLoopThreads
private static final java.lang.Object activeEventLoopLock
private static boolean doComposite
private static boolean isInitialized
private EventLoop dndEventLoop
private final java.util.LinkedList<LensApplication.Event> eventList
java.util.LinkedList<LensApplication.RunLoopControl> activeRunLoops
private static int nativeThreadCounter
private int cachedButtonPressed
private LensView dragView
private int dragActionsPreformed
private boolean dragStarted
private static void _initIDs()
private static boolean _initialize()
private static void _notifyRenderingEnd()
private static void initLibrary()
void registerApplication()
public boolean hasWindowManager()
hasWindowManager
in class Application
private void postEvent(LensApplication.Event e)
private void postMouseEvent(LensView view, int eventType, int x, int y, int absx, int absy, int button, int modifiers, boolean isPopupTrigger, boolean isSynthesized)
protected java.lang.Object _enterNestedEventLoop()
_enterNestedEventLoop
in class Application
protected void _leaveNestedEventLoop(java.lang.Object retValue)
_leaveNestedEventLoop
in class Application
private java.lang.Object _runLoop()
private static void registerEventLoop()
private static void unregisterEventLoop()
private static void waitEventLoopsToFinish()
protected void runLoop(java.lang.Runnable launchable)
runLoop
in class Application
private void nativeEventLoop(LensApplication lensApp, long nativeEventHandler, long nativeWindow)
private static void createNativeEventThread(long nativeEventHandler, long data)
java.lang.Object enterDnDEventLoop()
void leaveDndEventLoop(java.lang.Object value)
void shutdown()
protected void finishTerminating()
finishTerminating
in class Application
protected boolean _supportsTransparentWindows()
_supportsTransparentWindows
in class Application
protected boolean _supportsUnifiedWindows()
_supportsUnifiedWindows
in class Application
protected void notifyWindowResize(LensWindow window, int eventType, int width, int height)
window
- the window object which this event belongs toeventType
- WindowEvent.MINIMIZE / MAXIMIZE /RESTORE /
RESIZEwidth
- new widthheight
- new heightprotected void notifyWindowMove(LensWindow window, int x, int y)
window
- The window which this event belongs tox
- new X coordinate of the windowy
- new Y Coordinate of the windowprotected void notifyWindowEvent(LensWindow window, int windowEvent)
window
- The window which this event belongs towindowEvent
- the event type as defined in WindowEvent
class.protected void windowExpose(LensWindow window, int x, int y, int width, int height)
private void notifyKeyEvent(LensView view, int type, int keyCode, int modifiers, char[] chars)
view
- the window which the view is related totype
- event type (KeyEvent.PRESS ...)keyCode
- key code for the event (KeyEvent.VK_*)modifiers
- bit mask of key modifiers
(KeyEvent.MODIFIER_*)chars
- char sequence buffer. can be 0 length, must not
be nullvoid notifyMouseEvent(LensView view, int eventType, int x, int y, int absx, int absy, int button, int modifiers, boolean isPopupTrigger, boolean isSynthesized)
view
- the window which the view is related toeventType
- one of MouseEvent constantsx
- location of event inside the viewy
- location of event inside the viewabsx
- location of event on the screenabsy
- location of event on the screenbutton
- currently pressed button, required only in applicable events
such as MouseEvent.DOWNmodifiers
- mask of currently pressed special keys and mouse
buttons. always requiredisPopupTrigger
- true when event is context menu hint (usually right
button release)isSynthesized
- used when event is logical such MouseEvent.CLICKprivate void _notfyPlatformDnDStarted()
private void _notfyPlatformDnDEnded()
void notifyDragStart()
private boolean handleDragEvents(LensView view, int eventType, int x, int y, int absx, int absy, int button, int modifiers)
view
- the view which owns the eventeventType
- type of event, one of MouseEvent constantsx
- location of event inside the viewy
- location of event inside the viewabsx
- location of event on the screenabsy
- location of event on the screenbutton
- currently pressed button, required only in applicable
events such as MouseEvent.DOWNmodifiers
- mask of currently pressed special keys and mouse
buttons. always requiredprivate void notifyScrollEvent(LensView view, int x, int y, int absx, int absy, double deltaX, double deltaY, int modifiers, int lines, int chars, int defaultLines, int defaultChars, double xMultiplier, double yMultiplier)
view
- the window which the view is related tox
- y
- absx
- absy
- deltaX
- deltaY
- modifiers
- lines
- chars
- defaultLines
- defaultChars
- xMultiplier
- yMultiplier
- modifiers
- private void postTouchMoveEvent(LensView view, long id, int x, int y, int absX, int absY)
view
- the view which owns the eventid
- the id of the finger slot (usually 1)x
- the x coordinate of the eventy
- the y coordinate of the eventabsX
- not sureabsY
- not sureprivate void notifyTouchEvent(LensView view, int state, long id, int x, int y, int absX, int absY)
view
- the window which the view is related tostate
- the finger state (e.g. TouchEvent.TOUCH_PRESSED)id
- the id of the finger slotx
- the x coordinate relative to the view originy
- the y coordinate relative to the view originabsX
- the x coordinate relative to the screen originabsY
- the y coordinate relative to the screen originprivate void notifyMultiTouchEvent(LensView view, int[] states, long[] ids, int[] xs, int[] ys, int dx, int dy)
view
- the window which the view is related tostates
- list of the finger states of each touch pointids
- list of the IDs of each touch pointxs
- list of of the absolute X coordinates of each touch pointys
- list of of the absolute Y coordinates of each touch pointdx
- value to be added to X coordinates to convert them to relativedy
- value to be added to Y coordinates to convert them to relativeprivate void notifyViewEvent(LensView view, int viewEventType, int x, int y, int width, int height)
view
- the event occurred inviewEventType
- the type of event as listed in
ViewEvent.javaprivate void notifyMenuEvent(LensView view, int x, int y, int xAbs, int yAbs, boolean isKeyboardTrigger)
private void notifyDeviceEvent(int flags, boolean attach)
flags
- the device type flags (a bitmask containing values up to 2^DEVICE_MAX)attach
- true is the device was attached, false if it was detached.private void notifyScreenSettingsChanged()
public void installWindowMenu(MenuBar menubar)
public Menu getWindowMenu()
public void installDefaultMenus(MenuBar menubar)
Application
installDefaultMenus
in class Application
public Window createWindow(Window owner, Screen screen, int styleMask)
Application
createWindow
in class Application
public Window createWindow(long parent)
createWindow
in class Application
public View createView()
createView
in class Application
public Cursor createCursor(int type)
createCursor
in class Application
public Cursor createCursor(int x, int y, Pixels pixels)
createCursor
in class Application
protected void staticCursor_setVisible(boolean visible)
staticCursor_setVisible
in class Application
protected Size staticCursor_getBestSize(int width, int height)
staticCursor_getBestSize
in class Application
public Pixels createPixels(int width, int height, java.nio.ByteBuffer data)
createPixels
in class Application
public Pixels createPixels(int width, int height, java.nio.IntBuffer data)
createPixels
in class Application
public Pixels createPixels(int width, int height, java.nio.IntBuffer data, float scale)
createPixels
in class Application
protected int staticPixels_getNativeFormat()
staticPixels_getNativeFormat
in class Application
public Robot createRobot()
createRobot
in class Application
protected double staticScreen_getVideoRefreshPeriod()
staticScreen_getVideoRefreshPeriod
in class Application
protected Screen[] staticScreen_getScreens()
staticScreen_getScreens
in class Application
public Timer createTimer(java.lang.Runnable runnable)
createTimer
in class Application
protected int staticTimer_getMinPeriod()
staticTimer_getMinPeriod
in class Application
protected int staticTimer_getMaxPeriod()
staticTimer_getMaxPeriod
in class Application
protected CommonDialogs.FileChooserResult staticCommonDialogs_showFileChooser(Window owner, java.lang.String folder, java.lang.String filename, java.lang.String title, int type, boolean multipleMode, CommonDialogs.ExtensionFilter[] extensionFilters, int defaultFilterIndex)
staticCommonDialogs_showFileChooser
in class Application
protected java.io.File staticCommonDialogs_showFolderChooser(Window owner, java.lang.String folder, java.lang.String title)
staticCommonDialogs_showFolderChooser
in class Application
protected long staticView_getMultiClickTime()
staticView_getMultiClickTime
in class Application
protected int staticView_getMultiClickMaxX()
staticView_getMultiClickMaxX
in class Application
protected int staticView_getMultiClickMaxY()
staticView_getMultiClickMaxY
in class Application
protected void _invokeAndWait(java.lang.Runnable runnable)
_invokeAndWait
in class Application
protected void _invokeLater(java.lang.Runnable runnable)
_invokeLater
in class Application
public boolean hasTwoLevelFocus()
hasTwoLevelFocus
in class Application
public boolean hasVirtualKeyboard()
hasVirtualKeyboard
in class Application
public boolean hasTouch()
hasTouch
in class Application
public boolean hasMultiTouch()
hasMultiTouch
in class Application
public boolean hasPointer()
hasPointer
in class Application
protected int _getKeyCodeForChar(char c)
_getKeyCodeForChar
in class Application