Class SJColorChooser

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.html.Input, String>
com.vaadin.flow.component.AbstractSinglePropertyField<com.vaadin.flow.component.html.Input, String>
com.vaadin.flow.component.html.Input
com.vaadin.swingbridge.surrogates.SJColorChooser
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.html.Input>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.html.Input>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.html.Input>, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasPlaceholder, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.html.Input, String>, String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.html.Input, String>, String>, com.vaadin.flow.data.value.HasValueChangeMode, ComponentMixin, ContainerMixin, JComponentMixin, Serializable

public class SJColorChooser extends com.vaadin.flow.component.html.Input implements JComponentMixin
Surrogate for JColorChooser (SD_sjcolorchooser). Extends Vaadin Input with type="color" — Vaadin 25 ships no color-picker component, so we re-purpose the browser-native <input type="color"> primitive, whose value property is a #rrggbb hex string. Input is public and already an AbstractSinglePropertyField<Input, String> bound to the value property, so it does the value-property binding + value-changed subscription for us — cleaner than re-hosting a raw <input> the way VaadinRadioButton had to (that re-host only exists because Vaadin's own RadioButton wrapper is package-private).

Model flow (SJSlider / SD_sjslider precedent)

The installed ColorSelectionModel is the source of truth (R_swing_is_truth). A single ChangeListener on the model fans out to user ChangeListeners and pushes the selected color (as hex) to the peer (this Input's own element) under the preventPeerEvents R_swing_is_truth guard. The peer's ValueChangeListener mirrors browser-originated edits back into the model via SHelper.callSwing(Runnable) (R_callswing_envelope); the resulting model ChangeEvent re-enters fanOutModelChange(), hits the guard, and only the Swing-side fan-out runs — no second peer write. Unlike display-only SJProgressBar (no peer→Swing path), this component has a live browser edit path, so it needs both the guard and the callSwing wrap, exactly like SJSlider.

Alpha loss (accepted, SD_sjcolorchooser)

<input type="color"> is opaque #rrggbb only. A model color with alpha < 255 pushes to the peer as its opaque RGB, and a browser round-trip drops alpha — an accepted R_best_effort_behaviour/R_vaadin_first divergence. The model itself retains whatever setColor(Color) last stored until a browser edit overwrites it.

Chooser panels / preview panel: R_vaadin_first drop-and-WARN

AbstractColorChooserPanel content (swatches / HSV / RGB tabs) and the preview panel are pure custom paint — R_match_swing_errors sub-bucket (b). The native color input is the chooser UI here. The setters field-round-trip so introspection works, but WARN and drive nothing.
See Also:
  • Constructor Details

    • SJColorChooser

      public SJColorChooser()
    • SJColorChooser

      public SJColorChooser(Color initialColor)
    • SJColorChooser

      public SJColorChooser(ColorSelectionModel model)
  • Method Details