Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bindings

Bindings( editor, [gameComponent] ) [ctor] A collection of bindings for a group of custom controls in editor that are bound to settings in gameComponent. If gameComponent is not specified, the game component currently installed in the editor will be used.

editor : the editor that will contain the bound controls gameComponent : the game component that that will be edited using the controls

Hierarchy

  • Bindings

Index

Constructors

constructor

Methods

add

  • Creates a new Binding using the supplied constructor function and adds it to this set of bindings. The binding is created as if by calling new bindClassConstructor(keyName, uiControl, this.component, sheets).

    If uiControl is a scroll pane, then the component contained by the scroll pane will be bound rather than the scroll pane itself.

    If bindClassConstructor is not specified, then a default class will be searched for using Bindings.getBindingClass. Most standard control types have a suitable default binding class available.

    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

    • Optional sheetsToUpdate: number[]

      an array of the indices of the game component's sheets which should be repainted when the bound setting changes; by default all sheets are updated

    • Optional bindClassConstructor: object

      the constructor function for the Binding subclass that will be used to create the binding; by default a default binding class for the UI control type is looked up from the registry

    Returns void

addAll

  • Adds multiple bindings to this set of bindings. The argument to this method is an array in which each element is an array of arguments as they would be passed to Bindings.add(). For example:

    bindings.bindAll(
        ["determination", detmCtrl, [0]],
        ["special-effect", effectField, [1]],
        ["hint", hintField, [0,1]]
    );

    Parameters

    Returns void

bind

  • bind(): void
  • Binds the editor and game component together, loading the component's current state into the bound controls and installing event listeners that will update the game component when the UI controls are manipulated. A Bindings instance can only be bound once.

    Returns void

createPopulateFunction

  • createPopulateFunction(): function
  • Returns a function that will call initComponent() for all of the bindings in this set.

    Returns function

    a control populator function for these bindings

      • (): void
      • Returns void

createUpdateFunction

  • createUpdateFunction(): function
  • Returns a function that will update all of the bindings in this set and return whether any of the bound settings were changed.

    Returns function

    an update function for the managed bindings

      • (): boolean
      • Returns boolean

Static getBindingClass

  • Returns the default binding class for a particular component type, as determined by the specified class. If there is no default binding for the component class, or one of its superclasses, returns null.

    Parameters

    Returns object

    the binding class constructor for the default binding, or null

Static registerBindingClass

  • Registers a binding class constructor to be the default Binding class for a particular type of UI control.

    Parameters

    • controlClass: string | JavaObject<"java.awt.Component">

      the UI control class that will have a default Binding registered; this may be a Java class or a string that names one

    • bindingClassConstructor: object

      a constructor for a Binding class that can convert between setting strings and control state

    Returns void