Plugin Architecture

Plugin Architecture

Every feature module in Storeharmony Desktop follows the Plugin + Chassis pattern — a reusable, entity-agnostic Swing panel (HAGenericApplicationViewComponent) that handles all common UI concerns, while domain-specific logic is injected via a plugin object.

The Flow

  1. Menu Trigger – An action class (e.g. ManageCustomerRecordsAction) extends HeavyApplicationPanelLoaderAction
  2. Chassis Creation – Instantiates HAGenericApplicationViewComponent<T> (the empty chassis)
  3. Plugin Injection – Creates a HarmonyApplicationPlugin<T> implementation and calls chassis.configurePlugin(plugin)
  4. Rendering – The chassis renders a full workspace: search bar, data table, action grid, paging controls, context menus, and side panel — all wired to the plugin

Result: A fully-featured data management view with zero UI boilerplate in the plugin. The plugin only provides data, actions, and configuration.

Window Types

The chassis can be rendered in four modes via HarmonyWindowType:

TypeBehavior
EMBEDAdded as a new tab in the main window
INNERFaded into the current view area
DIALOGShown in a modal dialog
FRAMEOpens a new standalone JFrame

Key Interfaces

  • HarmonyApplicationPlugin – The core plugin contract. Provides table model, data query, action grid items, side panel, and context menu items.
  • HAGenericApplicationViewComponent – The reusable chassis. Handles search, paging, selection, gestures, and UI chrome.
  • HeavyApplicationPanelLoaderAction – Abstract action that bridges menu clicks to panel instantiation.
  • DataViewingComponent – Contract for read-only display panels.
  • DataCapturingComponent – Contract for forms that capture input and return a result.

Building a New Plugin

To add a new feature module:

  1. Create the JPA entity in entities/ and add to persistence.xml
  2. Create the data access operations in operations/{module}/
  3. Create a HarmonyApplicationPlugin implementation that provides table model, query, and actions
  4. Create a menu action extending HeavyApplicationPanelLoaderAction that wires the plugin to the chassis
  5. Register the action in the menu configuration XML