Package space.maxus.flare.ui.compose
Interface TextInput
- All Superinterfaces:
Composable,ComposableLike,Configurable<TextInput>,Disable,ProviderRendered
A text input is a component that can handle user input.
See more in Flare docs: Text Input
See more in Flare docs: Text Input
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe builder for text inputNested classes/interfaces inherited from interface space.maxus.flare.ui.compose.Configurable
Configurable.Configurator<S> -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull TextInput.Builderbuilder()Constructs a new text input builderstatic @NotNull TextInput.BuilderConstructs a new text input builderstatic @NotNull TextInput.Builderbuilder(@Nullable ItemProvider provider) Constructs a new text input builderdefault voidclick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) Called each time this item is clicked, no matter if it is a right click, left click, middle click, etc.default TextInputconfigure(@NotNull Configurable.Configurator<TextInput> configurator) Configures this composable element.default @NotNull StringReturns the default promptdefault @NotNull StringgetText()Returns current text value@Nullable ValidatorReturns the input validatorstatic @NotNull ItemProviderinputItem(@NotNull ReactiveState<String> text, String name, String description) Returns an item provider for a text inputstatic @NotNull ItemStackBuilderinputItemBuilder(@NotNull String currentText, String name, String description) Returns an item builder for a text inputstatic @NotNull TextInputof(ItemProvider provider) Constructs a new text input with an item providerstatic @NotNull TextInputof(ItemProvider provider, boolean disabled) Constructs a new text input with an item providerdefault voidonTextChange(ReactiveSubscriber<@NotNull String> change) Adds a handler to text changeReturns the prompt reactive statedefault voidSets the default promptdefault voidSets current textReturns the input text reactive stateMethods inherited from interface space.maxus.flare.ui.Composable
asComposable, bind, context, contextOrNull, destroy, drag, injectRoot, inside, into, leftClick, markDirty, restore, rightClick, root, shiftFrom, shiftInto, viewerMethods inherited from interface space.maxus.flare.ui.compose.Configurable
configureTypedMethods inherited from interface space.maxus.flare.ui.compose.Disable
disabledState, isDisabled, isNotDisabled, setDisabledMethods inherited from interface space.maxus.flare.ui.compose.ProviderRendered
getProvider, renderAt
-
Method Details
-
inputItemBuilder
@NotNull static @NotNull ItemStackBuilder inputItemBuilder(@NotNull @NotNull String currentText, String name, String description) Returns an item builder for a text input- Parameters:
currentText- Current text valuename- Extra message in item namedescription- Description in item lore- Returns:
- An item builder for a text input
-
inputItem
@NotNull static @NotNull ItemProvider inputItem(@NotNull @NotNull ReactiveState<String> text, String name, String description) Returns an item provider for a text input- Parameters:
text- Reactive state of the text valuename- Extra message in item namedescription- Description in item lore- Returns:
- An item builder for a text input
-
of
Constructs a new text input with an item provider- Parameters:
provider- The item provider to use- Returns:
- A new text input
-
of
@Contract("_, _ -> new") @NotNull static @NotNull TextInput of(ItemProvider provider, boolean disabled) Constructs a new text input with an item provider- Parameters:
provider- The item provider to usedisabled- Whether the text input should be disabled- Returns:
- A new text input
-
builder
Constructs a new text input builder- Parameters:
provider- Item provider to use- Returns:
- A new text input builder
-
builder
@NotNull static @NotNull TextInput.Builder builder(@Nullable @Nullable String name, @Nullable @Nullable String description) Constructs a new text input builder- Parameters:
name- Extra message in item namedescription- Extra message in item lore- Returns:
- A new text input builder
-
builder
Constructs a new text input builder- Returns:
- A new text input builder
-
getText
Returns current text value- Returns:
- Current text value
-
setText
Sets current text- Parameters:
text- Text to be set
-
getPrompt
Returns the default prompt- Returns:
- The default prompt
-
setPrompt
Sets the default prompt- Parameters:
prompt- The prompt to set
-
textState
ReactiveState<String> textState()Returns the input text reactive state- Returns:
- The input text reactive state
-
promptState
ReactiveState<String> promptState()Returns the prompt reactive state- Returns:
- The input text reactive state
-
getValidator
Returns the input validator- Returns:
- The input validator
-
configure
Description copied from interface:ConfigurableConfigures this composable element.- Specified by:
configurein interfaceConfigurable<TextInput>- Parameters:
configurator- Configurator to be applied- Returns:
- The configured object
-
onTextChange
Adds a handler to text change- Parameters:
change- Handler for the text change
-
click
default void click(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Description copied from interface:ComposableCalled each time this item is clicked, no matter if it is a right click, left click, middle click, etc.- Specified by:
clickin interfaceComposable- Parameters:
e- The click event
-