public interface FilterController
FilterModel
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 call
filterVisible(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
GraphView
Modifier and Type | Method and Description |
---|---|
void |
add(Query query)
Adds
query as a new query in the system. |
Query |
createQuery(Filter filter)
Creates a query from
filter . |
Query |
createQuery(FilterBuilder builder)
Creates a query from
builder . |
void |
exportToColumn(String title,
Query query)
Exports
query result in a new column title . |
void |
exportToLabelVisible(Query query)
Exports
query result to visible/hidden labels. |
void |
exportToNewWorkspace(Query query)
Exports
query result in a new workspace. |
GraphView |
filter(Query query)
Filtering method for API users.
|
void |
filterVisible(Query query)
Filters main graph with
query and set result as the new
visible graph. |
FilterModel |
getModel()
Returns the filter's model.
|
FilterModel |
getModel(Workspace workspace)
Returns the filter's model for
workspace . |
void |
remove(Query query)
Removes
query from the system if exists. |
void |
removeSubQuery(Query query,
Query parent)
Removes
query from parent query. |
void |
rename(Query query,
String name)
Renames
query with name . |
void |
selectVisible(Query query)
Selects
query results on the main graph visualization
window. |
void |
setAutoRefresh(boolean autoRefresh) |
void |
setCurrentQuery(Query query) |
void |
setSubQuery(Query query,
Query subQuery)
Sets
subQuery as a child of query . |
Query createQuery(FilterBuilder builder)
builder
. The created query is a root
query.builder
- the builder that can create the filter that is to be
wrapped in a new querybuilder
Query createQuery(Filter filter)
filter
. The created query is a root
query.filter
- the filter that is to be wrapped in a new queryfilter
void add(Query query)
query
as a new query in the system. The query should be
a root query.query
- the query that is to be addedvoid remove(Query query)
query
from the system if exists.query
- the query that is to be removedvoid rename(Query query, String name)
query
with name
.query
- the query that is to be renamedname
- the new query's namevoid setSubQuery(Query query, Query subQuery)
subQuery
as a child of query
. If
subQuery
already has a parent query, it will be removed
first.query
- the query that subQuery
is to be added as a new
childsubQuery
- the query that is to be added as a child of
query
void removeSubQuery(Query query, Query parent)
query
from parent
query.query
- the query that is to be removed from parent
parent
- the query that query
is to be removed as a
childvoid filterVisible(Query query)
query
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.query
- the query that is to be executedvoid selectVisible(Query query)
query
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.query
- the query that is to be executedGraphView filter(Query query)
query
is executed and
the GraphView
result is returned.query
- the query that is to be executedvoid exportToColumn(String title, Query query)
query
result in a new column title
.
Nodes and edges that pass the query
have true value
and
false for others.title
- the column's titlequery
- the query that is to be executedvoid exportToNewWorkspace(Query query)
query
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.query
- the query that is to be executedvoid exportToLabelVisible(Query query)
query
result to visible/hidden labels. Each node and
edge not present in the query result has its label set hidden. Label
visibility is controlled from TextData
object, accessible
from NodeData
or EdgeData
.query
- the query that is to be used to hide labelsvoid setAutoRefresh(boolean autoRefresh)
void setCurrentQuery(Query query)
FilterModel getModel()
FilterModel getModel(Workspace workspace)
workspace
.workspace
- workspaceCopyright © 2007–2017 Gephi Consortium. All rights reserved.