Skip to main content

Class JtvApplication

public class JtvApplication
extends JtvProgram

The concrete top-level application class that initialises platform subsystems and runs the event loop.

TApplication extends JtvProgram by initialising the Screen and EventQueue platform subsystems before constructing subviews, and shutting them down after the event loop exits. Most applications should subclass TApplication and override JtvProgram.initMenuBar, JtvProgram.initStatusLine, and/or JtvProgram.initDesktop to supply custom subviews.

idle() is overridden to automatically enable or disable the cmTile and cmCascade commands based on whether any ViewFlags.ofTileable windows are currently visible on the desktop.

org.viktor44.jtvision.core.JtvApplication

Summary​

Constructors​

VisibilitySignature
publicJtvApplication()
privateJtvApplication(boolean platformReady)

Methods​

ModifiersMethod signatureReturn type
private staticinitPlatform()boolean
publicshutdown()void
public staticshutdownPlatform()void
publicsuspend()void
publicresume()void
publiccascade()void
publictile()void
publicgetTileRect()org.viktor44.jtvision.core.JtvRect
publicidle()void
publichandleEvent(JtvEvent event)void
publicrun()void

Constructors​

JtvApplication()​

Constructs a TApplication, initialising the platform Screen and EventQueue before the parent constructor builds the subviews.

JtvApplication(boolean platformReady)​

Delegates to JtvProgram.JtvProgram() after the platform has been initialised.

Parameters

  • platformReady

Methods​

initPlatform()​

Initialises the Screen and EventQueue platform subsystems.

shutdown()​

Shuts down the application: shuts down the Screen and EventQueue platform subsystems.

shutdownPlatform()​

Statically shuts down the platform subsystems (Screen and EventQueue).

This is useful when the application fails to start (e.g. during framework initialisation) and no JtvApplication instance is available to call shutdown() on. Each subsystem's shutdown method is a no-op when not initialised, so calling this is always safe.

suspend()​

Suspends the application for OS shell-out: pauses the EventQueue then the Screen. Call resume() to restore normal operation.

resume()​

Resumes the application after a shell-out: restores the Screen then restarts the EventQueue.

cascade()​

Cascades all tileable visible windows within the tile rectangle returned by getTileRect().

tile()​

Tiles all tileable visible windows within the tile rectangle returned by getTileRect().

getTileRect()​

Returns the rectangle used for tile and cascade operations. Default is the full desktop extent; override to restrict the area.

Returns

the tile/cascade boundary rectangle

idle()​

Overrides:

idle() in org.viktor44.jtvision.core.JtvProgram

Extends the base idle handler to enable cmTile and cmCascade when at least one ViewFlags.ofTileable window is visible on the desktop, and to disable them when none are.

handleEvent(JtvEvent event)​

Overrides:

handleEvent(JtvEvent event) in org.viktor44.jtvision.core.JtvProgram

Handles cmCascade and cmTile commands, delegating to cascade() and tile() respectively. All other events are passed to the inherited handler.

Parameters

  • event - the event to handle

run()​

Overrides:

run() in org.viktor44.jtvision.core.JtvProgram

Runs the application event loop and ensures shutdown() is called on exit, even if an exception is thrown.