Class AbstractValueComponentPart<VM extends ValueControlViewModel,T extends Value>
- java.lang.Object
-
- com._1c.g5.v8.dt.md.ui.aef.components.value.AbstractValueComponentPart<VM,T>
-
- All Implemented Interfaces:
IValueComponentPart<VM,IValueModel,T>
- Direct Known Subclasses:
AbstractReferenceValueComponentPart
,BooleanValueComponentPart
,BorderValueComponentPart
,ColorValueComponentPart
,DateValueComponentPart
,FontValueComponentPart
,NumberValueComponentPart
,StringValueComponentPart
,SysEnumValueComponentPart
,TypeSelectionValueComponentPart
public abstract class AbstractValueComponentPart<VM extends ValueControlViewModel,T extends Value> extends Object implements IValueComponentPart<VM,IValueModel,T>
TheIValueComponentPart
abstract implementation with basic functionality.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractValueComponentPart(Class<? extends T> valueClass, String... supportedTypeNames)
Creates a new component part.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindViewModel(VM viewModel, IValueModel model, IMapper<T,?> mapper)
Binds the given view model to model.protected String
getTypeName(TypeItem item)
Returns the type name of the item.void
handleButtonPressed(VM viewModel, IValueModel model)
Handles the button events.boolean
hasClearAction(VM viewModel, IValueModel model)
Returnstrue
if the value component should create clear action button for the given model.protected boolean
isEditable(IValueModel model)
Checks is component editable.boolean
isSuitable(IValueModel model)
Returns thetrue
if the part is suitable for the givenmodel
.protected boolean
isSuitableTypeName(IValueModel model)
Returnstrue
if the model is suitable by theIValueModel.getCurrentTypeItem()
.protected boolean
isSuitableValue(IValueModel model)
Returnstrue
if the model is suitable by valueIValue.get()
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com._1c.g5.v8.dt.md.ui.aef.components.value.IValueComponentPart
createMapper, createViewModel, getViewModelBindingFeature
-
-
-
-
Method Detail
-
bindViewModel
public void bindViewModel(VM viewModel, IValueModel model, IMapper<T,?> mapper)
Description copied from interface:IValueComponentPart
Binds the given view model to model. It is the extra binding that is needed to fill view model with additional data.
NOTE: implement this functionality only if the default component binding usingIValueComponentPart.getViewModelBindingFeature()
and#createMapper()
is not enough.- Specified by:
bindViewModel
in interfaceIValueComponentPart<VM extends ValueControlViewModel,IValueModel,T extends Value>
- Parameters:
viewModel
- the view model to bind.model
- theIValueModel
.mapper
- theIMapper
instance.
-
handleButtonPressed
public void handleButtonPressed(VM viewModel, IValueModel model)
Description copied from interface:IValueComponentPart
Handles the button events.- Specified by:
handleButtonPressed
in interfaceIValueComponentPart<VM extends ValueControlViewModel,IValueModel,T extends Value>
- Parameters:
viewModel
- the view model.model
- theIValueModel
.
-
hasClearAction
public boolean hasClearAction(VM viewModel, IValueModel model)
Description copied from interface:IValueComponentPart
Returnstrue
if the value component should create clear action button for the given model.- Specified by:
hasClearAction
in interfaceIValueComponentPart<VM extends ValueControlViewModel,IValueModel,T extends Value>
- Parameters:
viewModel
- the view model.model
- theIValueModel
.- Returns:
true
if the clear action button is required.
-
isSuitable
public boolean isSuitable(IValueModel model)
Description copied from interface:IValueComponentPart
Returns thetrue
if the part is suitable for the givenmodel
.- Specified by:
isSuitable
in interfaceIValueComponentPart<VM extends ValueControlViewModel,IValueModel,T extends Value>
- Parameters:
model
- theIValueModel
.- Returns:
- the
true
if the part is suitable for the givenmodel
.
-
getTypeName
protected String getTypeName(TypeItem item)
Returns the type name of the item. It uses the {@link McoreUtil#getTypeName(TypeItem))- Parameters:
item
- theTypeItem
- Returns:
- the type name
-
isSuitableTypeName
protected boolean isSuitableTypeName(IValueModel model)
Returnstrue
if the model is suitable by theIValueModel.getCurrentTypeItem()
.- Parameters:
model
- theIValueModel
.- Returns:
true
if the given model is suitable by type.
-
isSuitableValue
protected boolean isSuitableValue(IValueModel model)
Returnstrue
if the model is suitable by valueIValue.get()
.- Parameters:
model
- theIValueModel
.- Returns:
true
if the given model is suitable by value.
-
isEditable
protected boolean isEditable(IValueModel model)
Checks is component editable.- Parameters:
model
- the value model, cannot benull
- Returns:
true
if editable,false
otherwise
-
-