Package com._1c.g5.v8.dt.form.search
Class FormElementSearchEngine
- java.lang.Object
-
- com._1c.g5.v8.dt.form.search.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 Summary
Constructors Constructor Description FormElementSearchEngine(Comparator<PropertyInfo> attributesComparator)
Initializes a new instance of class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canSearch()
Gets a value indicating whether the searching can be executed.void
dispose()
FilterData
getFilterData()
Gets current filter data.void
init(MappingController mappingController, Consumer<Object> foundElementConsumer)
Full initialization of engine.void
performSearchFromTheBegining()
Performs searching from the begining.void
refreshInputByElementType(Class<?> elementType)
Refreshes the input by element type: FormMapping, Item for items searcher. PropertyInfo for attributes searcher.void
repositionSearchTo(Object targetElement)
Repositions searching to specific element.Object
search(boolean backwardDirection)
Forward or backward searching.void
setFilterData(FilterData filterData)
Sets new filter data.void
switchSearcherByElementType(Class<?> elementType)
Switches to the concrete searcher by element type: FormMapping, Item switch to search for items. PropertyInfo switch to search for attributes.
-
-
-
Constructor Detail
-
FormElementSearchEngine
public FormElementSearchEngine(Comparator<PropertyInfo> attributesComparator)
Initializes a new instance of class.- Parameters:
attributesComparator
- the attributes comparator, can not benull
.
-
-
Method Detail
-
init
public void init(MappingController mappingController, Consumer<Object> foundElementConsumer)
Full initialization of engine.- Parameters:
mappingController
- the mapping controller, can not benull
.foundElementConsumer
- consumer of found element, can not benull
.
-
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 benull
.
-
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.
-
switchSearcherByElementType
public void switchSearcherByElementType(Class<?> elementType)
Switches to the concrete searcher by element type:
- FormMapping, Item switch to search for items.
- PropertyInfo switch to search for attributes.
- Parameters:
elementType
- the element type to switch searcher.
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.eclipse.emf.edit.provider.IDisposable
-
-