Skip to content

LockButtonWidgetHelper.LockButtonBuilder ​

com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder

Since1.8.4

Builder for a lock button bound to its screen. It starts unlocked unless the boolean overload of IScreen.lockButtonBuilder() specifies otherwise.

Nested type declared in LockButtonWidgetHelper.

Constructors ​

new LockButtonWidgetHelper.LockButtonBuilder ​

new LockButtonWidgetHelper.LockButtonBuilder(IScreen screen)#
Stores the screen to which build() will add the created widget.

Parameters:

  • screen: the screen associated with this builder

Methods ​

action ​

Parameters:

  • action: callback invoked when the button is pressed; null disables it
Returns: self for chaining.

createWidget ​

createWidget(): LockButtonWidgetHelper#
Creates the lock-button helper using the configured position, z-index, and initial locked state. If an action is configured, it receives this helper and the associated screen; exceptions are logged. The callback then marks the next release to be skipped only for container screens. This method does not add the widget to the screen or apply the builder's label, size, alpha, active, or visible settings; build() performs the addition and applies alpha, active, and visible settings.
Returns: the helper for the newly created lock button

getAction ​

Returns: the configured callback, or null if none is set.

isLocked ​

isLocked(): booleanSince1.8.4#
Returns the initial locked state configured for this builder. The default is unlocked; this does not track the button after it is built.
Returns: the initial state of the lock button.

locked ​

locked(boolean locked): LockButtonWidgetHelper.LockButtonBuilderSince1.8.4#
Sets the button's initial locked state; it does not constrain later changes.

Parameters:

  • locked: whether to initially lock the button or not
Returns: self for chaining.