Class MappingGridContentProvider<T extends IGridItem,​ME,​M extends IGridModel<ME>>

    • Constructor Detail

      • MappingGridContentProvider

        public MappingGridContentProvider​(M model)
        Creates a new provider.
        Parameters:
        model - the IGridModel, cannot be null.
    • Method Detail

      • getChildren

        public Collection<T> getChildren​(T parentElement)
        Description copied from interface: IAefGridContentProvider
        Retrieves collection of children for a given parentElement.
        Specified by:
        getChildren in interface IAefGridContentProvider<T extends IGridItem>
        Parameters:
        parentElement - the parent element, cannot be null.
        Returns:
        the collection of children of the parent element, never null.
      • mapModelToItem

        public T mapModelToItem​(ME element)
        Maps the model element to item.
        Parameters:
        element - the model element, cannot be null.
        Returns:
        the view model item.
      • mapItemToModel

        public ME mapItemToModel​(T item)
        Maps the item to element.
        Parameters:
        item - the item, cannot be null.
        Returns:
        the mapped element.
      • createItem

        protected abstract T createItem​(ME element)
        Creates an item for the given {code element}.
        Parameters:
        element - the element, cannot be null.
        Returns:
        the created item.
      • updateMappedItem

        protected abstract void updateMappedItem​(ME element,
                                                 T item)
        Updates the given item by the given element.
        Parameters:
        element - the element, cannot be null.
        item - the item, cannot be null.
      • 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 given item for the specified color.

        Function caller is responsible for disposing of created image.

        Parameters:
        item - the grid item, cannot be null.
        imageFeature - the feature, cannot be null.
        color - the color.
        Returns:
        a newly created image for the specified color.