Class AbstractNetworkSearchTaskFactory
- java.lang.Object
-
- org.cytoscape.work.AbstractTaskFactory
-
- org.cytoscape.application.swing.search.AbstractNetworkSearchTaskFactory
-
- All Implemented Interfaces:
NetworkSearchTaskFactory
,TaskFactory
public abstract class AbstractNetworkSearchTaskFactory extends AbstractTaskFactory implements NetworkSearchTaskFactory
This abstract implementation ofNetworkSearchTaskFactory
makes the methodgetQueryComponent()
optional. If your Network Search provider extends this class and doesn't overwrite thegetQueryComponent()
method, Cytoscape will use a default text field instead. It will also pass the new query text to thesetQuery(String)
method every time the content of the default text field changes.
-
-
Field Summary
-
Fields inherited from interface org.cytoscape.application.swing.search.NetworkSearchTaskFactory
QUERY_PROPERTY, SEARCH_REQUESTED_PROPERTY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNetworkSearchTaskFactory(String id, String name, String description, Icon icon)
protected
AbstractNetworkSearchTaskFactory(String id, String name, String description, Icon icon, URL website)
protected
AbstractNetworkSearchTaskFactory(String id, String name, Icon icon)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
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()
This implementation simply returns null, which means that no options component will be displayed, unless the subclass overwrites this method to return a custom component.String
getQuery()
JComponent
getQueryComponent()
This implementation simply returns null, which means Cytoscape will provide a default query component, unless the subclass overwrites this method to return a custom component.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.int
hashCode()
boolean
isReady()
A default implementation that simply checks whether or not the String returned bygetQuery()
is empty.void
setQuery(String query)
This method is called by Cytoscape whenever the user changes the query text.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.cytoscape.work.TaskFactory
createTaskIterator
-
-
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:NetworkSearchTaskFactory
Returns the unique id of this network search provider. Use namespaces to make sure it is unique (e.g. "org.myCompany.mySearch").- Specified by:
getId
in interfaceNetworkSearchTaskFactory
- Returns:
- A unique id for this search provider.
-
getName
public String getName()
Description copied from interface:NetworkSearchTaskFactory
A short name to be displayed to the user.- Specified by:
getName
in interfaceNetworkSearchTaskFactory
- Returns:
- The name of this search provider.
-
getDescription
public String getDescription()
Description copied from interface:NetworkSearchTaskFactory
An optional short text describing what this search provider does.- Specified by:
getDescription
in interfaceNetworkSearchTaskFactory
- Returns:
- A text that describes this search provider, which can be null.
-
getIcon
public Icon getIcon()
Description copied from interface:NetworkSearchTaskFactory
An icon that represents this search provider.- Specified by:
getIcon
in interfaceNetworkSearchTaskFactory
- Returns:
- If null, Cytoscape may provide a default or random icon for this search provider.
-
getWebsite
public URL getWebsite()
Description copied from interface:NetworkSearchTaskFactory
An optional URL the user can use to find more information about this search provider.- Specified by:
getWebsite
in interfaceNetworkSearchTaskFactory
- Returns:
- A URL to a website, which can be null.
-
getQuery
public String getQuery()
-
setQuery
public void setQuery(String query)
This method is called by Cytoscape whenever the user changes the query text.- Parameters:
query
-
-
getTaskObserver
public TaskObserver getTaskObserver()
Description copied from interface:NetworkSearchTaskFactory
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.- Specified by:
getTaskObserver
in interfaceNetworkSearchTaskFactory
- Returns:
- Optional
TaskObserver
to be passed to theTaskManager
when running the search task(s) created by this TaskFactory.
-
getQueryComponent
public JComponent getQueryComponent()
This implementation simply returns null, which means Cytoscape will provide a default query component, unless the subclass overwrites this method to return a custom component.- Specified by:
getQueryComponent
in interfaceNetworkSearchTaskFactory
- Returns:
- If null, Cytoscape will create a basic search field for you.
-
getOptionsComponent
public JComponent getOptionsComponent()
This implementation simply returns null, which means that no options component will be displayed, unless the subclass overwrites this method to return a custom component.- Specified by:
getOptionsComponent
in interfaceNetworkSearchTaskFactory
- Returns:
- If null, extra search options will not be available to the end user.
-
isReady
public boolean isReady()
A default implementation that simply checks whether or not the String returned bygetQuery()
is empty.- Specified by:
isReady
in interfaceTaskFactory
- Overrides:
isReady
in classAbstractTaskFactory
- Returns:
- true if the TaskFactory has all necessary preconditions needed to generate a task that will execute properly, false otherwise.
-
-