use of org.gephi.filters.spi.FilterBuilder in project gephi by gephi.
the class CategoryChildFactory method createKeys.
@Override
protected boolean createKeys(List<Object> toPopulate) {
Object[] children = utils.getChildren(category);
Arrays.sort(children, new Comparator() {
@Override
public int compare(Object o1, Object o2) {
String s1;
String s2;
if (o1 == FiltersExplorer.QUERIES || o2 == FiltersExplorer.QUERIES) {
return o1 == FiltersExplorer.QUERIES ? 1 : -1;
} else if (o1 instanceof Category && o2 instanceof Category) {
s1 = ((Category) o1).getName();
s2 = ((Category) o2).getName();
return s1.compareTo(s2);
} else if (o1 instanceof FilterBuilder && o2 instanceof FilterBuilder) {
s1 = ((FilterBuilder) o1).getName();
s2 = ((FilterBuilder) o2).getName();
return s1.compareTo(s2);
} else if (o1 instanceof Query && o2 instanceof Query) {
s1 = ((Query) o1).getName();
s2 = ((Query) o2).getName();
return s1.compareTo(s2);
} else if (o1 instanceof Category) {
return -1;
}
return 1;
}
});
toPopulate.addAll(Arrays.asList(children));
return true;
}
use of org.gephi.filters.spi.FilterBuilder in project gephi by gephi.
the class FilterLibraryImpl method buildBuildersMap.
private void buildBuildersMap() {
for (FilterBuilder builder : lookup.lookupAll(FilterBuilder.class)) {
try {
Filter f = builder.getFilter(workspace);
buildersMap.put(f.getClass(), builder);
builder.destroy(f);
} catch (Exception e) {
}
}
for (CategoryBuilder catBuilder : Lookup.getDefault().lookupAll(CategoryBuilder.class)) {
for (FilterBuilder builder : catBuilder.getBuilders(workspace)) {
try {
Filter f = builder.getFilter(workspace);
buildersMap.put(f.getClass(), builder);
builder.destroy(f);
} catch (Exception e) {
}
}
}
}
use of org.gephi.filters.spi.FilterBuilder in project gephi by gephi.
the class FilterModelImpl method destroyQuery.
private void destroyQuery(Query query) {
if (query instanceof AbstractQueryImpl) {
AbstractQueryImpl absQuery = (AbstractQueryImpl) query;
for (Query q : absQuery.getDescendantsAndSelf()) {
if (q instanceof FilterQueryImpl) {
Filter f = ((FilterQueryImpl) q).getFilter();
FilterBuilder builder = ((FilterQueryImpl) q).getBuilder();
if (builder != null) {
builder.destroy(f);
}
}
}
}
}
use of org.gephi.filters.spi.FilterBuilder in project gephi by gephi.
the class DynamicRangeBuilder method getBuilders.
@Override
public FilterBuilder[] getBuilders(Workspace workspace) {
List<FilterBuilder> builders = new ArrayList<>();
GraphModel am = Lookup.getDefault().lookup(GraphController.class).getGraphModel(workspace);
if (am.isDynamic()) {
builders.add(new DynamicRangeFilterBuilder(am));
}
return builders.toArray(new FilterBuilder[0]);
}
use of org.gephi.filters.spi.FilterBuilder in project gephi by gephi.
the class InterEdgesBuilder method getBuilders.
@Override
public FilterBuilder[] getBuilders(Workspace workspace) {
List<FilterBuilder> builders = new ArrayList<>();
GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getGraphModel(workspace);
Graph graph = gm.getGraph();
AppearanceModel am = Lookup.getDefault().lookup(AppearanceController.class).getModel(workspace);
// Force refresh
am.getNodeFunctions(graph);
for (Column nodeCol : gm.getNodeTable()) {
if (!nodeCol.isProperty()) {
if (am.getNodePartition(graph, nodeCol) != null) {
InterEdgesFilterBuilder builder = new InterEdgesFilterBuilder(nodeCol, am);
builders.add(builder);
}
}
}
return builders.toArray(new FilterBuilder[0]);
}
Aggregations