Class MappingGridContentProvider<T extends IGridItem,ME,M extends IGridModel<ME>>
- java.lang.Object
-
- com._1c.g5.v8.dt.ui.aef.providers.MappingGridContentProvider<T,ME,M>
-
- Type Parameters:
T- the type of view model (extendsIGridItem).ME- the type of model elements.M- the type of grid model (extendsIGridModel).
- All Implemented Interfaces:
IAefGridContentProvider<T>
public abstract class MappingGridContentProvider<T extends IGridItem,ME,M extends IGridModel<ME>> extends Object implements IAefGridContentProvider<T>
The implementation ofIAefGridContentProviderthat maps domain model elements to view model items.
-
-
Constructor Summary
Constructors Constructor Description MappingGridContentProvider(M model)Creates a new provider.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TcreateItem(ME element)Creates an item for the given {code element}.voiddispose()Disposes the provider.Collection<T>getChildren(T parentElement)Retrieves collection of children for a givenparentElement.Collection<T>getElements()Retrieves collection of top level elements.protected MgetModel()Returns the grid model.TgetParent(T element)Returns the parent of the givenelement.booleanhasChildren(T element)Returnstrueif the element has children.MEmapItemToModel(T item)Maps the item to element.TmapModelToItem(ME element)Maps the model element to item.protected static org.eclipse.swt.graphics.ImageupdateItemImageForColor(IGridItem item, org.eclipse.emf.ecore.EStructuralFeature imageFeature, Color color)Updates the image of givenitemfor the specifiedcolor.protected abstract voidupdateMappedItem(ME element, T item)Updates the givenitemby the givenelement.
-
-
-
Constructor Detail
-
MappingGridContentProvider
public MappingGridContentProvider(M model)
Creates a new provider.- Parameters:
model- theIGridModel, cannot benull.
-
-
Method Detail
-
getElements
public Collection<T> getElements()
Description copied from interface:IAefGridContentProviderRetrieves collection of top level elements.- Specified by:
getElementsin interfaceIAefGridContentProvider<T extends IGridItem>- Returns:
- the top level elements, never
null.
-
getChildren
public Collection<T> getChildren(T parentElement)
Description copied from interface:IAefGridContentProviderRetrieves collection of children for a givenparentElement.- Specified by:
getChildrenin interfaceIAefGridContentProvider<T extends IGridItem>- Parameters:
parentElement- the parent element, cannot benull.- Returns:
- the collection of children of the parent element, never
null.
-
getParent
public T getParent(T element)
Description copied from interface:IAefGridContentProviderReturns the parent of the givenelement.- Specified by:
getParentin interfaceIAefGridContentProvider<T extends IGridItem>- Parameters:
element- the element, cannot benull.- Returns:
- the parent element or
null.
-
hasChildren
public boolean hasChildren(T element)
Description copied from interface:IAefGridContentProviderReturnstrueif the element has children.- Specified by:
hasChildrenin interfaceIAefGridContentProvider<T extends IGridItem>- Parameters:
element- the element, cannot benull.- Returns:
trueif the element has children
-
dispose
public void dispose()
Description copied from interface:IAefGridContentProviderDisposes the provider.- Specified by:
disposein interfaceIAefGridContentProvider<T extends IGridItem>
-
mapModelToItem
public T mapModelToItem(ME element)
Maps the model element to item.- Parameters:
element- the model element, cannot benull.- Returns:
- the view model item.
-
mapItemToModel
public ME mapItemToModel(T item)
Maps the item to element.- Parameters:
item- the item, cannot benull.- Returns:
- the mapped element.
-
createItem
protected abstract T createItem(ME element)
Creates an item for the given {code element}.- Parameters:
element- the element, cannot benull.- Returns:
- the created item.
-
updateMappedItem
protected abstract void updateMappedItem(ME element, T item)
Updates the givenitemby the givenelement.- Parameters:
element- the element, cannot benull.item- the item, cannot benull.
-
getModel
protected M getModel()
Returns the grid model.- Returns:
- the grid model, never
null.
-
updateItemImageForColor
protected static org.eclipse.swt.graphics.Image updateItemImageForColor(IGridItem item, org.eclipse.emf.ecore.EStructuralFeature imageFeature, Color color)
Updates the image of givenitemfor the specifiedcolor.Function caller is responsible for disposing of created image.
- Parameters:
item- the grid item, cannot benull.imageFeature- the feature, cannot benull.color- the color.- Returns:
- a newly created image for the specified
color.
-
-