Class FormElementSearchEngine

  • All Implemented Interfaces:
    org.eclipse.emf.edit.provider.IDisposable

    public class FormElementSearchEngine
    extends Object
    implements org.eclipse.emf.edit.provider.IDisposable
    Represents an engine to search the elements of form.
    • Constructor Detail

      • FormElementSearchEngine

        public FormElementSearchEngine​(Comparator<PropertyInfo> attributesComparator)
        Initializes a new instance of class.
        Parameters:
        attributesComparator - the attributes comparator, can not be null.
    • Method Detail

      • init

        public void init​(MappingController mappingController,
                         Consumer<Object> foundElementConsumer)
        Full initialization of engine.
        Parameters:
        mappingController - the mapping controller, can not be null.
        foundElementConsumer - consumer of found element, can not be null.
      • getFilterData

        public FilterData getFilterData()
        Gets current filter data.
        Returns:
        curent filter data, never null.
      • setFilterData

        public void setFilterData​(FilterData filterData)
        Sets new filter data. The search will be repositioned to the begining if the filter data was changed.
        Parameters:
        filterData - the new filter data, can not be null.
      • performSearchFromTheBegining

        public void performSearchFromTheBegining()
        Performs searching from the begining.
      • canSearch

        public boolean canSearch()
        Gets a value indicating whether the searching can be executed.
        Returns:
        true if this engine was initialized and the filter was set from non-empty data; otherwise, false.
      • search

        public Object search​(boolean backwardDirection)
        Forward or backward searching.
        Parameters:
        backwardDirection - the backward direction.
        Returns:
        Found element of form.
        After seach was happend then method delegates found object (or null if found nothing) to the consumer that was specified in #init(List, Consumer). Execution will back to this method after the consumer work has done.
        See Also:
        canSearch()
      • repositionSearchTo

        public void repositionSearchTo​(Object targetElement)
        Repositions searching to specific element. Automatically switches to the concrete searcher and sets the current filter data for it.
        Parameters:
        targetElement - the element to which to reposition.
      • refreshInputByElementType

        public void refreshInputByElementType​(Class<?> elementType)

        Refreshes the input by element type:

      • FormMapping, Item for items searcher.
      • PropertyInfo for attributes searcher.
Parameters:
elementType - the element type to refresh concrete searcher input.
Parameters:
elementType - the element type to switch searcher.