Module is.codion.swing.common.ui
Class AbstractComponentValueBuilder<C extends JComponent,T,B extends ComponentValueBuilder<C,T,B>>
java.lang.Object
is.codion.swing.common.ui.component.builder.AbstractComponentBuilder<C,B>
is.codion.swing.common.ui.component.builder.AbstractComponentValueBuilder<C,T,B>
- All Implemented Interfaces:
ComponentBuilder<C,,B> ComponentValueBuilder<C,,T, B> Supplier<C>
- Direct Known Subclasses:
DefaultComboBoxBuilder
public abstract class AbstractComponentValueBuilder<C extends JComponent,T,B extends ComponentValueBuilder<C,T,B>>
extends AbstractComponentBuilder<C,B>
implements ComponentValueBuilder<C,T,B>
-
Field Summary
Fields inherited from interface is.codion.swing.common.ui.component.builder.ComponentValueBuilder
COMPONENT_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ComponentValue<C, T> Builds and returns the component value.final ComponentValue<C, T> buildValue(@Nullable Consumer<ComponentValue<C, T>> onBuild) Builds and returns the component value.protected final CconfigureComponent(C component) final Bprotected abstract ComponentValue<C, T> createComponentValue(C component) Creates the component valuefinal Blink(Observable<T> linkedObservable) Creates a read-only link to the givenObservable.final BCreates a bidirectional link to the given value.final Bfinal BmodifiedIndicator(@Nullable ObservableState modified) Enables a modified indicator based on the given modified state.final BmodifiedIndicatorFactory(@Nullable ModifiedIndicatorFactory modifiedIndicatorFactory) By defaultUnderlineModifiedIndicatorFactory.final BonBuildValue(Consumer<ComponentValue<C, T>> onBuildValue) final Bvalidator(Value.Validator<T> validator) final BEnables a valid indicator based on the given valid state.final BvalidIndicator(@Nullable Predicate<T> validator) Enables a valid indicator based on the given validator.final BvalidIndicatorFactory(@Nullable ValidIndicatorFactory validIndicatorFactory) final BSets the initial value for the component, unless value(s) have been linked viaComponentValueBuilder.link(Value)orComponentValueBuilder.link(Observable), which then control the inital value.Methods inherited from class is.codion.swing.common.ui.component.builder.AbstractComponentBuilder
background, border, build, build, clientProperty, componentListener, componentOrientation, createComponent, enabled, enabled, enableTransferFocusOnEnter, enableValidIndicator, focusable, focusable, focusCycleRoot, focusListener, font, font, foreground, keyEvent, keyListener, label, label, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseListener, mouseMotionListener, mouseWheelListener, name, onBuild, onSetVisible, opaque, popupMenu, popupMenuControl, popupMenuControls, preferredHeight, preferredSize, preferredWidth, propertyChangeListener, propertyChangeListener, scrollPane, self, supportsNull, toolTipText, toolTipText, transferFocusOnEnter, transferFocusOnEnter, transferHandler, visible, visibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface is.codion.swing.common.ui.component.builder.ComponentBuilder
background, border, build, build, clientProperty, componentListener, componentOrientation, enabled, enabled, focusable, focusable, focusCycleRoot, focusListener, font, font, foreground, get, keyEvent, keyListener, label, label, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseListener, mouseMotionListener, mouseWheelListener, name, onBuild, onSetVisible, opaque, popupMenu, popupMenuControl, popupMenuControls, preferredHeight, preferredSize, preferredWidth, propertyChangeListener, propertyChangeListener, scrollPane, toolTipText, toolTipText, transferFocusOnEnter, transferFocusOnEnter, transferHandler, visible, visible
-
Constructor Details
-
AbstractComponentValueBuilder
protected AbstractComponentValueBuilder()
-
-
Method Details
-
validIndicatorFactory
- Specified by:
validIndicatorFactoryin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
validIndicatorFactory- theValidIndicatorFactoryto use, null for none- Returns:
- this builder instance
- See Also:
-
validIndicator
Description copied from interface:ComponentValueBuilderEnables a valid indicator based on the given valid state.- Specified by:
validIndicatorin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
valid- the valid state- Returns:
- this builder instance
- See Also:
-
validIndicator
Description copied from interface:ComponentValueBuilderEnables a valid indicator based on the given validator. Note that this is overridden by
ComponentValueBuilder.validIndicator(ObservableState).The validator gets called each time the value changes and should return true as long as the value is valid.
- Specified by:
validIndicatorin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
validator- called each time the component value changes- Returns:
- this builder instance
- See Also:
-
modifiedIndicatorFactory
public final B modifiedIndicatorFactory(@Nullable ModifiedIndicatorFactory modifiedIndicatorFactory) Description copied from interface:ComponentValueBuilderBy defaultUnderlineModifiedIndicatorFactory.- Specified by:
modifiedIndicatorFactoryin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
modifiedIndicatorFactory- theModifiedIndicatorFactoryto use, null for none- Returns:
- this builder instance
-
modifiedIndicator
Description copied from interface:ComponentValueBuilderEnables a modified indicator based on the given modified state.- Specified by:
modifiedIndicatorin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
modified- the modified state- Returns:
- this builder instance
- See Also:
-
validator
- Specified by:
validatorin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
validator- the validator to use- Returns:
- this builder instance
-
link
Description copied from interface:ComponentValueBuilderCreates a bidirectional link to the given value. Overrides any initial value set.- Specified by:
linkin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
linkedValue- a value to link to the component value- Returns:
- this builder instance
-
link
Description copied from interface:ComponentValueBuilderCreates a read-only link to the givenObservable.- Specified by:
linkin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
linkedObservable- a value to link to the component value- Returns:
- this builder instance
-
listener
- Specified by:
listenerin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
listener- a listener to add to the resulting component value- Returns:
- this builder instance
-
consumer
- Specified by:
consumerin interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
consumer- a consumer to add to the resulting component value- Returns:
- this builder instance
-
value
Description copied from interface:ComponentValueBuilderSets the initial value for the component, unless value(s) have been linked viaComponentValueBuilder.link(Value)orComponentValueBuilder.link(Observable), which then control the inital value. The initial value is set before any listeners are added, so no events are triggered.- Specified by:
valuein interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
value- the initial value- Returns:
- this builder instance
-
onBuildValue
- Specified by:
onBuildValuein interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
onBuildValue- called when the component value has been built.- Returns:
- this builder instance
-
buildValue
Description copied from interface:ComponentValueBuilderBuilds and returns the component value.- Specified by:
buildValuein interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Returns:
- the component value
-
buildValue
Description copied from interface:ComponentValueBuilderBuilds and returns the component value.- Specified by:
buildValuein interfaceComponentValueBuilder<C extends JComponent,T, B extends ComponentValueBuilder<C, T, B>> - Parameters:
onBuild- called after the component value is built.- Returns:
- the component value
-
configureComponent
- Overrides:
configureComponentin classAbstractComponentBuilder<C extends JComponent,B extends ComponentValueBuilder<C, T, B>>
-
createComponentValue
Creates the component value- Parameters:
component- the component- Returns:
- a component value based on the component
-