Package org.gephi.filters.api
Interface FilterController
-
public interface FilterController
Use filters and queries for filtering the Graph. This controller managesFilterModel
instances. 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
GraphView
and 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 void
add(Query query)
Addsquery
as a new query in the system.Query
createQuery(Filter filter)
Creates a query fromfilter
.Query
createQuery(FilterBuilder builder)
Creates a query frombuilder
.void
exportToColumn(String title, Query query)
Exportsquery
result in a new columntitle
.void
exportToLabelVisible(Query query)
Exportsquery
result to visible/hidden labels.void
exportToNewWorkspace(Query query)
Exportsquery
result in a new workspace.GraphView
filter(Query query)
Filtering method for API users.void
filterVisible(Query query)
Filters main graph withquery
and set result as the new visible graph.FilterModel
getModel()
Returns the filter's model.FilterModel
getModel(Workspace workspace)
Returns the filter's model forworkspace
.void
remove(Query query)
Removesquery
from the system if exists.void
removeSubQuery(Query query, Query parent)
Removesquery
fromparent
query.void
rename(Query query, String name)
Renamesquery
withname
.void
selectVisible(Query query)
Selectsquery
results on the main graph visualization window.void
setAutoRefresh(boolean autoRefresh)
void
setCurrentQuery(Query query)
void
setSubQuery(Query query, Query subQuery)
SetssubQuery
as 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)
Addsquery
as 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)
Removesquery
from the system if exists.- Parameters:
query
- the query that is to be removed
-
rename
void rename(Query query, String name)
Renamesquery
withname
.- Parameters:
query
- the query that is to be renamedname
- the new query's name
-
setSubQuery
void setSubQuery(Query query, Query subQuery)
SetssubQuery
as a child ofquery
. IfsubQuery
already has a parent query, it will be removed first.- Parameters:
query
- the query thatsubQuery
is 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)
Removesquery
fromparent
query.- Parameters:
query
- the query that is to be removed fromparent
parent
- the query thatquery
is to be removed as a child
-
filterVisible
void filterVisible(Query query)
Filters main graph withquery
and 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,query
is 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)
Selectsquery
results 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,query
is 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. Thequery
is executed and theGraphView
result 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)
Exportsquery
result in a new columntitle
. Nodes and edges that pass thequery
have true value and false for others.- Parameters:
title
- the column's titlequery
- the query that is to be executed
-
exportToNewWorkspace
void exportToNewWorkspace(Query query)
Exportsquery
result 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)
Exportsquery
result to visible/hidden labels. Each node and edge not present in the query result has its label set hidden. Label visibility is controlled fromTextData
object, accessible fromNodeData
orEdgeData
.- 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
-
-