Interface NetworkSearchTaskFactory
-
- All Superinterfaces:
TaskFactory
- All Known Implementing Classes:
AbstractNetworkSearchTaskFactory
public interface NetworkSearchTaskFactory extends TaskFactory
Task Factory that has to be implemented in order to create and register a Network Search provider.
-
-
Field Summary
Fields Modifier and Type Field Description static String
QUERY_PROPERTY
Name of the property that indicates that the provided query or options component changed the query parameters.static String
SEARCH_REQUESTED_PROPERTY
Name of the property that indicates that a search action has been requested by the custom query component.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getDescription()
An optional short text describing what this search provider does.Icon
getIcon()
An icon that represents this search provider.String
getId()
Returns the unique id of this network search provider.String
getName()
A short name to be displayed to the user.JComponent
getOptionsComponent()
You can use this method to return a component that contains extra search parameters.JComponent
getQueryComponent()
Use this method to return a component that contains the main or mandatory search fields.
If this task factory provides its own query component, make sure the returnedJComponent
fires aPropertyChangeEvent
for the propertyQUERY_PROPERTY
whenever its fields change in a way that affects the return of theTaskFactory.isReady()
method.TaskObserver
getTaskObserver()
If you want to be notified when the search task is finished, you should return a TaskObserver here.URL
getWebsite()
An optional URL the user can use to find more information about this search provider.-
Methods inherited from interface org.cytoscape.work.TaskFactory
createTaskIterator, isReady
-
-
-
-
Field Detail
-
QUERY_PROPERTY
static final String QUERY_PROPERTY
Name of the property that indicates that the provided query or options component changed the query parameters. The providedJComponent
s should fire aPropertyChangeEvent
for this property if it wants Cytoscape to check this TaskFactory'sTaskFactory.isReady()
method again.
-
SEARCH_REQUESTED_PROPERTY
static final String SEARCH_REQUESTED_PROPERTY
Name of the property that indicates that a search action has been requested by the custom query component. If a query component is provided by this factory, the component can fire aPropertyChangeEvent
for this property whenever it wants Cytoscape to execute the search (i.e. run the tasks created by this factory's implementation). Note that theTaskFactory.isReady()
method must also return true when the event is fired).
-
-
Method Detail
-
getId
String getId()
Returns the unique id of this network search provider. Use namespaces to make sure it is unique (e.g. "org.myCompany.mySearch").- Returns:
- A unique id for this search provider.
-
getName
String getName()
A short name to be displayed to the user.- Returns:
- The name of this search provider.
-
getDescription
String getDescription()
An optional short text describing what this search provider does.- Returns:
- A text that describes this search provider, which can be null.
-
getIcon
Icon getIcon()
An icon that represents this search provider.- Returns:
- If null, Cytoscape may provide a default or random icon for this search provider.
-
getWebsite
URL getWebsite()
An optional URL the user can use to find more information about this search provider.- Returns:
- A URL to a website, which can be null.
-
getTaskObserver
TaskObserver getTaskObserver()
If you want to be notified when the search task is finished, you should return a TaskObserver here. For example, you may want to display a dialog with a list of multiple network results, in case the user has to select one of them before the final network is created.- Returns:
- Optional
TaskObserver
to be passed to theTaskManager
when running the search task(s) created by this TaskFactory.
-
getQueryComponent
JComponent getQueryComponent()
Use this method to return a component that contains the main or mandatory search fields.
If this task factory provides its own query component, make sure the returnedJComponent
fires aPropertyChangeEvent
for the propertyQUERY_PROPERTY
whenever its fields change in a way that affects the return of theTaskFactory.isReady()
method. That way, Cytoscape can listen to this property change event and callTaskFactory.isReady()
again to update the Network Search widget accordingly (e.g. by enabling or disabling the search button). All the query component needs to do is callfirePropertyChange(NetworkSearchTaskFactory.QUERY_PROPERTY, null, null);
The query component can also fire aPropertyChangeEvent
for the propertySEARCH_REQUESTED_PROPERTY
in order to ask Cytoscape to run the search as soon as possible--for instance, you can do this when the user presses the ENTER key on your custom query fields.- Returns:
- If null, Cytoscape will create a basic search field for you.
-
getOptionsComponent
JComponent getOptionsComponent()
You can use this method to return a component that contains extra search parameters. It's usually a good idea to add only optional parameters to the options component. Mandatory fields should, if possible, be included into the component returned bygetQueryComponent()
.
If this task factory provides its own options component, make sure the returnedJComponent
fires aPropertyChangeEvent
for the propertyQUERY_PROPERTY
whenever its fields change in a way that affects the return of theTaskFactory.isReady()
method. That way, Cytoscape can listen to this property change event and callTaskFactory.isReady()
again to update the Network Search widget accordingly (e.g. by enabling or disabling the search button). All the options component needs to do is callfirePropertyChange(NetworkSearchTaskFactory.QUERY_PROPERTY, null, null);
- Returns:
- If null, extra search options will not be available to the end user.
-
-