Package com._1c.g5.v8.dt.ui.aef.mappers
Class AefLabelMapper<M,T extends ItemViewModel>
- java.lang.Object
-
- com._1c.g5.v8.dt.ui.aef.mappers.AefLabelMapper<M,T>
-
- All Implemented Interfaces:
IMapper<M,T>
,IViewModelsMapper<M,T>
- Direct Known Subclasses:
AefLabelCheckStateMapper
public class AefLabelMapper<M,T extends ItemViewModel> extends Object implements IViewModelsMapper<M,T>
IMapper
implementation that maps model object with the view structure specific.
-
-
Field Summary
Fields Modifier and Type Field Description protected ILabelProvider
labelProvider
-
Constructor Summary
Constructors Constructor Description AefLabelMapper(ILabelProvider labelProvider)
Creates a new mapper.AefLabelMapper(ILabelProvider labelProvider, boolean needDecorate)
Creates a new mapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected T
createItemViewModel()
Creates a view model item.protected Object
createMapKey(M modelValue)
Creates a map key object.protected T
createModelToView(M modelValue)
Creates and updates a view model item.Collection<Object>
getMappedModels()
Returns the mapped models collection, nevernull
Collection<T>
getMappedViewModels()
Return the mapped viewModels.T
mapModelToView(M modelValue)
Maps the model value to some projected view value.M
mapViewToModel(T viewValue)
Maps the view value to associated model value.void
updateItemViewModel(T item, M modelValue)
Updates item view model.
-
-
-
Field Detail
-
labelProvider
protected final ILabelProvider labelProvider
-
-
Constructor Detail
-
AefLabelMapper
public AefLabelMapper(ILabelProvider labelProvider)
Creates a new mapper.- Parameters:
labelProvider
- the label provider for mapping labels of domain model object to view model, cannot benull
-
AefLabelMapper
public AefLabelMapper(ILabelProvider labelProvider, boolean needDecorate)
Creates a new mapper.- Parameters:
labelProvider
- the label provider for mapping labels of domain model object to view model, cannot benull
needDecorate
-true
if need to wrappILabelProvider
toDecoratingLabelProvider
,false
otherwise
-
-
Method Detail
-
mapModelToView
public T mapModelToView(M modelValue)
Description copied from interface:IMapper
Maps the model value to some projected view value.- Specified by:
mapModelToView
in interfaceIMapper<M,T extends ItemViewModel>
- Parameters:
modelValue
- the model value to map.- Returns:
- mapped value.
-
mapViewToModel
public M mapViewToModel(T viewValue)
Description copied from interface:IMapper
Maps the view value to associated model value.- Specified by:
mapViewToModel
in interfaceIMapper<M,T extends ItemViewModel>
- Parameters:
viewValue
- the view value to map.- Returns:
- mapped value.
-
getMappedViewModels
public Collection<T> getMappedViewModels()
Description copied from interface:IViewModelsMapper
Return the mapped viewModels.- Specified by:
getMappedViewModels
in interfaceIViewModelsMapper<M,T extends ItemViewModel>
- Returns:
- the mapped viewModels, cannot be
null
-
getMappedModels
public Collection<Object> getMappedModels()
Description copied from interface:IViewModelsMapper
Returns the mapped models collection, nevernull
- Specified by:
getMappedModels
in interfaceIViewModelsMapper<M,T extends ItemViewModel>
- Returns:
- the mapped models collection, never
null
-
updateItemViewModel
public void updateItemViewModel(T item, M modelValue)
Description copied from interface:IViewModelsMapper
Updates item view model.- Specified by:
updateItemViewModel
in interfaceIViewModelsMapper<M,T extends ItemViewModel>
- Parameters:
item
- the item view model, cannot benull
modelValue
- modelValue the model value, cannot benull
-
createMapKey
protected Object createMapKey(M modelValue)
Creates a map key object. Override to implement specific mappings.- Parameters:
modelValue
- the model value, cannot benull
- Returns:
- the key for 'modelValue-to-viewValue' map, cannot be
null
-
createModelToView
protected T createModelToView(M modelValue)
Creates and updates a view model item.- Parameters:
modelValue
- the model value, cannot benull
- Returns:
- the newly created view model, cannot be
null
-
createItemViewModel
protected T createItemViewModel()
Creates a view model item.- Parameters:
modelValue
- the model value, cannot benull
- Returns:
- the newly created view model, cannot be
null
-
-