Package org.gephi.filters.api
Interface FilterController
-
public interface FilterControllerUse filters and queries for filtering the Graph. This controller managesFilterModelinstances. A model is defined for each workspace.This controller is a singleton and can therefore be found in Lookup:
FilterController fc = Lookup.getDefault().lookup(FilterController.class);
The controller has two ways to execute filtering, a one-shot one that immediately returns the
GraphViewand a more complex one suitable for user interface interaction, with live parameter change.The one-shot filtering can be executed like below:
Filter filter = ... Query query = controller.createQuery(filter); GraphView view = controller.filter(query);
The normal mode is to callfilterVisible(org.gephi.filters.api.Query)which let this controller manage the execution. The benefit of this of this mode is that properties change on filters are listened and filtering is automatically reexecuted if values changes. See how to execute a filter with two different values:Filter filter = ... filter.getProperties()[0].setValue(1); //Set value 1, for example a threshold Query query = controller.createQuery(filter); controller.add(query); controller.filterVisible(query); //A background thread executes the query filter.getProperties[0].setValue(2) //The background thread reexecute the query
- Author:
- Mathieu Bastian
- See Also:
GraphView
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(Query query)Addsqueryas a new query in the system.QuerycreateQuery(Filter filter)Creates a query fromfilter.QuerycreateQuery(FilterBuilder builder)Creates a query frombuilder.voidexportToColumn(String title, Query query)Exportsqueryresult in a new columntitle.voidexportToLabelVisible(Query query)Exportsqueryresult to visible/hidden labels.voidexportToNewWorkspace(Query query)Exportsqueryresult in a new workspace.GraphViewfilter(Query query)Filtering method for API users.voidfilterVisible(Query query)Filters main graph withqueryand set result as the new visible graph.FilterModelgetModel()Returns the filter's model.FilterModelgetModel(Workspace workspace)Returns the filter's model forworkspace.voidremove(Query query)Removesqueryfrom the system if exists.voidremoveSubQuery(Query query, Query parent)Removesqueryfromparentquery.voidrename(Query query, String name)Renamesquerywithname.voidselectVisible(Query query)Selectsqueryresults on the main graph visualization window.voidsetAutoRefresh(boolean autoRefresh)voidsetCurrentQuery(Query query)voidsetSubQuery(Query query, Query subQuery)SetssubQueryas a child ofquery.
-
-
-
Method Detail
-
createQuery
Query createQuery(FilterBuilder builder)
Creates a query frombuilder. The created query is a root query.- Parameters:
builder- the builder that can create the filter that is to be wrapped in a new query- Returns:
- a query that is wrapping
builder
-
createQuery
Query createQuery(Filter filter)
Creates a query fromfilter. The created query is a root query.- Parameters:
filter- the filter that is to be wrapped in a new query- Returns:
- a query that is wrapping
filter
-
add
void add(Query query)
Addsqueryas a new query in the system. The query should be a root query.- Parameters:
query- the query that is to be added
-
remove
void remove(Query query)
Removesqueryfrom the system if exists.- Parameters:
query- the query that is to be removed
-
rename
void rename(Query query, String name)
Renamesquerywithname.- Parameters:
query- the query that is to be renamedname- the new query's name
-
setSubQuery
void setSubQuery(Query query, Query subQuery)
SetssubQueryas a child ofquery. IfsubQueryalready has a parent query, it will be removed first.- Parameters:
query- the query thatsubQueryis to be added as a new childsubQuery- the query that is to be added as a child ofquery
-
removeSubQuery
void removeSubQuery(Query query, Query parent)
Removesqueryfromparentquery.- Parameters:
query- the query that is to be removed fromparentparent- the query thatqueryis to be removed as a child
-
filterVisible
void filterVisible(Query query)
Filters main graph withqueryand set result as the new visible graph. Note that the query will be executed in a background thread and results delivered as soon as ready. Then,queryis defined as the currently active query and property's value changes are watched. If a query's property is changed the query is automatically reexecuted.- Parameters:
query- the query that is to be executed
-
selectVisible
void selectVisible(Query query)
Selectsqueryresults on the main graph visualization window. Note that the query will be executed in a background thread and results delivered as soon as ready. Then,queryis defined as the currently active query and property's value changes are watched. If a query's property is changed the query is automatically reexecuted.- Parameters:
query- the query that is to be executed
-
filter
GraphView filter(Query query)
Filtering method for API users. Thequeryis executed and theGraphViewresult is returned.- Parameters:
query- the query that is to be executed- Returns:
- a graph view that represents the query result
-
exportToColumn
void exportToColumn(String title, Query query)
Exportsqueryresult in a new columntitle. Nodes and edges that pass thequeryhave true value and false for others.- Parameters:
title- the column's titlequery- the query that is to be executed
-
exportToNewWorkspace
void exportToNewWorkspace(Query query)
Exportsqueryresult in a new workspace. Note that query is executed in a separate thread and the workspace may not be ready immediately when this method returns.- Parameters:
query- the query that is to be executed
-
exportToLabelVisible
void exportToLabelVisible(Query query)
Exportsqueryresult to visible/hidden labels. Each node and edge not present in the query result has its label set hidden. Label visibility is controlled fromTextDataobject, accessible fromNodeDataorEdgeData.- Parameters:
query- the query that is to be used to hide labels
-
setAutoRefresh
void setAutoRefresh(boolean autoRefresh)
-
setCurrentQuery
void setCurrentQuery(Query query)
-
getModel
FilterModel getModel()
Returns the filter's model.- Returns:
- the filter's model
-
getModel
FilterModel getModel(Workspace workspace)
Returns the filter's model forworkspace.- Parameters:
workspace- workspace- Returns:
- the filter's model in the given workspace
-
-