JDK-Style Event Model

A comprehensive event architecture with familiar listener patterns—just like Swing or JavaFX.

Events You Already Know

If you've used Swing, JavaFX, or AWT, Oorian's event model will feel immediately familiar.

Listener Interfaces

Implement typed listener interfaces. Your IDE shows exactly which methods to override.

Register & Unregister

Add and remove listeners dynamically. Control exactly when you respond to events.

Event Source

Every event includes its source element. Handle multiple controls with one listener.

Type Safety

Events carry typed data. No string parsing or JSON decoding—just Java objects.

Multiple Scopes

Events flow at different levels: client, server, page, session, and application.

Consistent Patterns

Every extension uses the same event model. Learn once, use everywhere.

Event Architecture

Oorian's event system operates at multiple levels, from browser interactions to application-wide notifications.

Client Events

Browser → Server

Sent from the browser to the server. Mouse clicks, keyboard input, form submissions, and other user interactions.

Server Events

Server → Listeners

Generated by the server and received by any listener that registers for it. Internal server-side communication.

Page Events

Within a Page

Can be received by any component on a page. Enables communication between components on the same page.

Session Events

Across Pages/Tabs

Received by all pages for a specific user session. Enables inter-page and inter-tab communication.

Application Events

All Sessions

Received by all pages in all sessions. Used to notify all users of application-wide events.

Commands

Server → Browser

Sent from the server to the browser. Instructions to update the DOM, execute scripts, or perform client-side actions.

Events Usage

Using events in Oorian follows the familiar listener pattern. Implement a listener interface, register for the events you want to receive, and handle them in your onEvent method.

java
public class MyPage extends HtmlPage implements MouseClickListener
{
    private Button saveButton;

    @Override
    protected void createBody(Body body)
    {
        saveButton = new Button("Save");
        saveButton.registerListener(this, MouseClickedEvent.class);
        body.addElement(saveButton);
    }

    @Override
    public void onEvent(MouseClickedEvent event)
    {
        if (event.getSource() == saveButton)
        {
            saveData();
        }
    }
}