Skip to content
Paolo Ciccarese edited this page Jul 11, 2013 · 5 revisions

The directory named 'search' normally contains tools for helping the client in understanding on how to search (currently only text-search) the different annotation types.

The search component extends the ASearchComponent:

public class PostItSearchComponent extends ASearchComponent {

	public PostItSearchComponent(IDomeo domeo) {
		super(domeo);
	}
	
	/**
	 * The search on the text match is NOT case sensitive.
	 */
	public boolean filterByText(MAnnotation annotation, String textSearch) {
		// Returns true if the search matches the text match in the document
		// If this behavior is undesired, the line can be commented out
		if(super.filterByText(annotation, textSearch)) return true;

		// Verifies if the annotation type is the right one and then applies
		// the desired text match criteria
		if(annotation instanceof MPostItAnnotation) {
			return ((MPostItAnnotation)annotation).getText().toLowerCase()
					.contains(textSearch.toLowerCase());
		}
		return false;
	}
}