public class ValuePickerImpl<V> extends AbstractField<JmixPickerField<V>,V,V> implements ValuePicker<V>, SecuredActionsHolder, org.springframework.beans.factory.InitializingBean
Modifier and Type | Class and Description |
---|---|
class |
ValuePickerImpl.WebValuePickerActionHandler |
ValuePicker.FieldValueChangeEvent<V>, ValuePicker.ValuePickerAction
HasValue.ValueChangeEvent<V>
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<Action,JmixButton> |
actionButtons |
protected ValuePickerImpl.WebValuePickerActionHandler |
actionHandler |
protected java.util.function.Consumer<java.beans.PropertyChangeEvent> |
actionPropertyChangeListener |
protected java.util.List<Action> |
actions |
protected ActionsPermissions |
actionsPermissions |
protected java.util.function.Function<? super V,java.lang.String> |
fieldIconProvider |
protected com.vaadin.shared.Registration |
fieldListenerRegistration |
protected Formatter<? super V> |
formatter |
protected io.jmix.core.MetadataTools |
metadataTools |
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITY
internalValue, uiTestIdsSupport, valueBinding
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
NAME, TYPE_STRING
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
ValuePickerImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
actionPropertyChanged(java.beans.PropertyChangeEvent evt) |
void |
addAction(Action action)
Add an action to the component
|
void |
addAction(Action action,
int index)
Add an action to the component with index.
|
io.jmix.core.common.event.Subscription |
addFieldValueChangeListener(java.util.function.Consumer<ValuePicker.FieldValueChangeEvent<V>> listener)
Adds a listener that will be fired in case field is editable.
|
void |
afterPropertiesSet() |
protected java.lang.String |
applyDefaultValueFormat(V value) |
void |
commit()
Updates all changes since the previous commit to the data source.
|
protected JmixPickerField<V> |
createComponent() |
void |
discard()
Discards all changes since last commit.
|
void |
focus()
Sets focus to this component
|
protected java.lang.String |
formatValue(V value) |
protected com.vaadin.server.Resource |
generateOptionIcon(V item) |
Action |
getAction(java.lang.String id) |
java.util.Collection<Action> |
getActions() |
ActionsPermissions |
getActionsPermissions() |
java.util.function.Function<? super V,java.lang.String> |
getFieldIconProvider() |
Formatter<V> |
getFormatter() |
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
protected void |
initComponent(JmixPickerField<V> component) |
boolean |
isBuffered() |
boolean |
isFieldEditable() |
boolean |
isModified()
Tests if the value stored in the object has been modified since it was
last updated from the data source.
|
protected void |
onFieldValueChange(JmixPickerField.FieldValueChangeEvent<V> e) |
protected void |
refreshActionsState() |
void |
removeAction(Action action)
Remove the action from the component
|
void |
removeAction(java.lang.String id)
Remove the action by its ID.
|
void |
removeAllActions()
Remove all actions from the component
|
void |
setBuffered(boolean buffered)
Sets the buffered mode.
|
protected void |
setButtonIcon(JmixButton button,
java.lang.String icon) |
void |
setDebugId(java.lang.String id)
INTERNAL.
|
protected void |
setEditableToComponent(boolean editable) |
void |
setFieldEditable(boolean editable)
Sets whether a user can input the value manually.
|
void |
setFieldIconProvider(java.util.function.Function<? super V,java.lang.String> iconProvider)
Sets a function that provides an icon for the field.
|
void |
setFormatter(Formatter<? super V> formatter) |
void |
setFrame(Frame frame) |
void |
setMetadataTools(io.jmix.core.MetadataTools metadataTools) |
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
protected void |
setUiComponentProperties(UiComponentProperties componentProperties) |
protected void |
setupButtonAction(JmixButton button,
Action action) |
void |
setValue(V value) |
void |
setValueFromUser(V value)
Sets the value of this component as if the user had set it.
|
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validate
addValueChangeListener, componentValueChanged, convertToModel, convertToPresentation, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDescription, setDescriptionAsHtml, setEnabled, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
of
getValueSource, setValueSource
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty
isEditable, isEditableWithParent, setEditable
getFrame
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
isValid, isValidateOnCommit, validate
getIcon, setIcon, setIconFromSet
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
addValidator, addValidators, getValidators, removeValidator
getRequiredMessage, isRequired, setRequired, setRequiredMessage
isFocusable, setFocusable
getActionNN, getSubPart
protected io.jmix.core.MetadataTools metadataTools
protected java.util.List<Action> actions
protected java.util.Map<Action,JmixButton> actionButtons
protected ActionsPermissions actionsPermissions
protected ValuePickerImpl.WebValuePickerActionHandler actionHandler
protected java.util.function.Consumer<java.beans.PropertyChangeEvent> actionPropertyChangeListener
protected java.util.function.Function<? super V,java.lang.String> fieldIconProvider
protected com.vaadin.shared.Registration fieldListenerRegistration
protected JmixPickerField<V> createComponent()
@Autowired public void setMetadataTools(io.jmix.core.MetadataTools metadataTools)
@Autowired protected void setUiComponentProperties(UiComponentProperties componentProperties)
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
protected void initComponent(JmixPickerField<V> component)
protected java.lang.String formatValue(@Nullable V value)
protected java.lang.String applyDefaultValueFormat(@Nullable V value)
@Nullable public Formatter<V> getFormatter()
getFormatter
in interface HasFormatter<V>
public void setFormatter(@Nullable Formatter<? super V> formatter)
setFormatter
in interface HasFormatter<V>
public void setValue(@Nullable V value)
setValue
in interface HasValue<V>
setValue
in class AbstractValueComponent<JmixPickerField<V>,V,V>
public void setValueFromUser(@Nullable V value)
SupportsUserAction
HasValue.ValueChangeEvent
.setValueFromUser
in interface SupportsUserAction<V>
value
- the new valuepublic void addAction(Action action)
ActionsHolder
addAction
in interface ActionsHolder
public void addAction(Action action, int index)
ActionsHolder
addAction
in interface ActionsHolder
protected void setupButtonAction(JmixButton button, Action action)
protected void setButtonIcon(JmixButton button, @Nullable java.lang.String icon)
protected void actionPropertyChanged(java.beans.PropertyChangeEvent evt)
public void removeAction(Action action)
ActionsHolder
removeAction
in interface ActionsHolder
public void removeAction(java.lang.String id)
ActionsHolder
removeAction
in interface ActionsHolder
public void removeAllActions()
ActionsHolder
removeAllActions
in interface ActionsHolder
public java.util.Collection<Action> getActions()
getActions
in interface ActionsHolder
@Nullable public Action getAction(java.lang.String id)
getAction
in interface ActionsHolder
protected void refreshActionsState()
public void focus()
Component.Focusable
focus
in interface Component.Focusable
public int getTabIndex()
Component.Focusable
HasTabIndex
component.getTabIndex
in interface Component.Focusable
HasTabIndex
componentpublic void setTabIndex(int tabIndex)
Component.Focusable
Focusable
component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.setTabIndex
in interface Component.Focusable
tabIndex
- tab indexpublic ActionsPermissions getActionsPermissions()
getActionsPermissions
in interface SecuredActionsHolder
@Nullable public java.util.function.Function<? super V,java.lang.String> getFieldIconProvider()
getFieldIconProvider
in interface ValuePicker<V>
public void setFieldIconProvider(@Nullable java.util.function.Function<? super V,java.lang.String> iconProvider)
ValuePicker
setFieldIconProvider
in interface ValuePicker<V>
iconProvider
- icon provider to set@Nullable protected com.vaadin.server.Resource generateOptionIcon(@Nullable V item)
public boolean isFieldEditable()
isFieldEditable
in interface ValuePicker<V>
public void setFieldEditable(boolean editable)
ValuePicker
false
by default.
Doesn't set entered value to the model. To handle user input,
the ValuePicker.FieldValueChangeEvent
listener must be used.setFieldEditable
in interface ValuePicker<V>
editable
- true
to enable manual input, false
otherwiseValuePicker.addFieldValueChangeListener(Consumer)
public io.jmix.core.common.event.Subscription addFieldValueChangeListener(java.util.function.Consumer<ValuePicker.FieldValueChangeEvent<V>> listener)
ValuePicker
addFieldValueChangeListener
in interface ValuePicker<V>
listener
- a listener to addSubscription
objectValuePicker.setFieldEditable(boolean)
protected void onFieldValueChange(JmixPickerField.FieldValueChangeEvent<V> e)
public void commit()
Buffered
commit
in interface Buffered
commit
in class AbstractValueComponent<JmixPickerField<V>,V,V>
public void discard()
Buffered
discard
in interface Buffered
discard
in class AbstractValueComponent<JmixPickerField<V>,V,V>
public boolean isBuffered()
isBuffered
in interface Buffered
isBuffered
in class AbstractValueComponent<JmixPickerField<V>,V,V>
true
if buffered mode is on, false
otherwisepublic void setBuffered(boolean buffered)
Buffered
When in buffered mode, an internal buffer will be used to store changes
until Buffered.commit()
is called. Calling Buffered.discard()
will revert
the internal buffer to the value of the data source.
When in non-buffered mode both read and write operations will be done
directly on the data source. In this mode the Buffered.commit()
and
Buffered.discard()
methods serve no purpose.
setBuffered
in interface Buffered
setBuffered
in class AbstractValueComponent<JmixPickerField<V>,V,V>
buffered
- true
if buffered mode should be turned on, false
otherwisepublic boolean isModified()
Buffered
isModified
in interface Buffered
isModified
in class AbstractValueComponent<JmixPickerField<V>,V,V>
true
if the value in the object has been modified
since the last data source update, false
if not.public void setFrame(@Nullable Frame frame)
setFrame
in interface Component.BelongToFrame
setFrame
in class AbstractComponent<JmixPickerField<V>>
protected void setEditableToComponent(boolean editable)
setEditableToComponent
in class AbstractField<JmixPickerField<V>,V,V>
public void setDebugId(@Nullable java.lang.String id)
HasDebugId
setDebugId
in interface HasDebugId
setDebugId
in class AbstractComponent<JmixPickerField<V>>