站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

SearchType (Search API) - NetBeans API Javadoc (Current Development Version)

org.openidex.util/3 3.11

org.openidex.search
Class SearchType

java.lang.Object
  extended by org.openide.ServiceType
      extended by org.openidex.search.SearchType
All Implemented Interfaces:
Serializable, Cloneable, HelpCtx.Provider

public abstract class SearchType
extends ServiceType
implements Cloneable

Search type is service which provides search functionality on set of nodes. It has to provide GUI presentation so user can have the possibility to set/modify criteria. It performs search according to that.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openide.ServiceType
ServiceType.Handle, ServiceType.Registry
 
Field Summary
protected static String PROP_OBJECT_CHANGED
          Name of object changed property.
static String PROP_VALID
          Name of valid property.
 
Fields inherited from class org.openide.ServiceType
PROP_NAME
 
Constructor Summary
SearchType()
           
 
Method Summary
protected  boolean acceptSearchObject(Object searchObject)
          Accepts search object to the search.
protected  Node[] acceptSearchRootNodes(Node[] roots)
          Accepts search root nodes.
 Object clone()
          Clones seach type.
protected abstract  Class[] createSearchTypeClasses()
          Actually creates array of class types of objects this search type can search.
abstract  boolean enabled(Node[] nodes)
          Checks that this search type is able to search the specified set of nodes.
static Enumeration enumerateSearchTypes()
          Deprecated. Please use Lookup instead.
 Node[] getDetails(Node node)
          Creates nodes representing matches found withing an object represented by the specified node.
 Node[] getDetails(Object resultObject)
          Creates nodes representing matches found within the specified object.
 Class[] getSearchTypeClasses()
          Gets class types of objects this search type can search (test) on.
 boolean isValid()
           
protected  void prepareSearchObject(Object searchObject)
          Prepares search object.
 void setValid(boolean state)
          Now the custonized criterion changed validity state.
protected abstract  boolean testObject(Object searchObject)
          Checks whether an object matches the criteria defined in this search type.
 
Methods inherited from class org.openide.ServiceType
addPropertyChangeListener, createClone, displayName, firePropertyChange, getHelpCtx, getName, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_VALID

public static final String PROP_VALID
Name of valid property.

See Also:
Constant Field Values

PROP_OBJECT_CHANGED

protected static final String PROP_OBJECT_CHANGED
Name of object changed property.

See Also:
Constant Field Values
Constructor Detail

SearchType

public SearchType()
Method Detail

getSearchTypeClasses

public final Class[] getSearchTypeClasses()
Gets class types of objects this search type can search (test) on. The classes are used for associating search types working on the same object types to create SearchGroup. Note: the order of classes declares also priority.


createSearchTypeClasses

protected abstract Class[] createSearchTypeClasses()
Actually creates array of class types of objects this search type can search. Note: the order of classes declares also priority.


acceptSearchRootNodes

protected Node[] acceptSearchRootNodes(Node[] roots)
Accepts search root nodes. Subclasses have a chance to exclude some of the non interesting node systems. E.g. CVS search type can exclude non CVS node systems.


acceptSearchObject

protected boolean acceptSearchObject(Object searchObject)
Accepts search object to the search. Subclasses have a chance to exclude the non interesting objects from the search. E.g. Java search type will exclude non Java data objects. Note: the search object instance is of the class type returned by SearchKey.getSearchObjectType method. So there is no necessity to do additional check for that search type.

Returns:
true

prepareSearchObject

protected void prepareSearchObject(Object searchObject)
Prepares search object. Dummy implementation.


testObject

protected abstract boolean testObject(Object searchObject)
Checks whether an object matches the criteria defined in this search type.

Parameters:
searchObject - object to be tested
Returns:
true if the object matches the criteria, false it it does not

getDetails

public Node[] getDetails(Object resultObject)
Creates nodes representing matches found within the specified object.

This is a dummy implementation, subclasses should provide a real implementation.

Parameters:
resultObject - object to create the nodes for
Returns:
null (subclasses should return the created nodes)

getDetails

public Node[] getDetails(Node node)
Creates nodes representing matches found withing an object represented by the specified node.

This is a dummy implementation, subclasses should provide a real implementation. The typical implementation is that the node is validated, an object is extracted from it and passed to method getDetails(Object).

Parameters:
node - node representing object with matches
Returns:
null (subclasses should return the created nodes)
See Also:
getDetails(Object)

enabled

public abstract boolean enabled(Node[] nodes)
Checks that this search type is able to search the specified set of nodes.

This method is usually implemented such that it returns true if it is possible to search at least one of the nodes.

Parameters:
nodes - nodes to be searched
Returns:
true if this search type is able to search the nodes, false otherwise

setValid

public final void setValid(boolean state)
Now the custonized criterion changed validity state.


isValid

public final boolean isValid()
Returns:
true if the criterion is currently valid.

clone

public Object clone()
Clones seach type.

Overrides:
clone in class ServiceType

enumerateSearchTypes

public static Enumeration enumerateSearchTypes()
Deprecated. Please use Lookup instead.

Enumeration of all SearchTypes in the system.

Returns:
enumeration of SearchType instances

org.openidex.util/3 3.11

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.