Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SpinnerBinding

Binds swing.JSpinners that use integer models (including those made with the spinner() function in the uicontrols library) to an integer digit string that can be fetched with gameComponent.settings.getInt(keyName).

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 SpinnerBinding

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