Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ActiveBinding

An ActiveBinding is a type of binding that can determine for itself when it needs to update the game component because of a change to the state of the UI control. For example, the binding might install a listener on the control that will be notified when the control is updated. The listener would then call update when it is notified of a change in the control state.

To create a new type of active binding, subclass ActiveBinding and override the installActivationHandler method to make the binding active.

Hierarchy

Index

Constructors

constructor

  • Creates a Binding instance. When you create a binding, you provide a key name, a UI control, a game component, and an array of numbers. The array of numbers is a list of card faces (0 for front, 1 for back, and so on) that need to be updated when the bound state changes. For example, if the bound state represented content that is drawn only on the component's back face, then you would use [1].

    Parameters

    • keyName: string

      the setting key that the control is bound to; if it starts with $, the $ will be removed and any underscores (_) replaced with dashes (-)

    • uiControl: JavaObject<"java.awt.Component">

      the UI component that will take part in the binding

    • gameComponent: JavaObject<"arkham.component.GameComponent">

      the game component that will take part in the binding

    • sheetsToUpdate: number[]

      an array of the indices of the game component's sheets which should be repainted when the bound setting changes

    Returns ActiveBinding

Methods

controlToSetting

  • Converts the state of the control to a setting string. Subclasses override this to customize how the control's state is represented in the game component's private settings.

    Parameters

    Returns string

    the string representing the state of the control

initComponent

  • initComponent(): void
  • Updates the UI component using the current setting value.

    Returns void

installActivationHandler

  • installActivationHandler(): void
  • Called to installs the mechanism which makes the binding active (such as an event listener) on this.control. The base class attempts to install an ActionListener on the component, which is sufficient for many types on control.

    Returns void

settingToControl

  • Changes the state of the control to reflect the provided setting value. Subclasses override this to customize how the control's state is represented in the game component's private settings.

    Parameters

    Returns void

update

  • update(): boolean
  • Updates the UI component setting using the current value of the control.

    Returns boolean

    true if the setting has changed