Search in sources :

Example 1 with PropertyModifier

use of org.gephi.filters.FilterThread.PropertyModifier in project gephi by gephi.

the class FilterControllerImpl method setValue.

@Override
public void setValue(FilterProperty property, Object value, Callback callback) {
    if (model != null) {
        Query query = model.getQuery(property.getFilter());
        if (query == null) {
            callback.setValue(value);
            return;
        }
        AbstractQueryImpl rootQuery = ((AbstractQueryImpl) query).getRoot();
        FilterThread filterThread;
        if ((filterThread = model.getFilterThread()) != null && model.getCurrentQuery() == rootQuery) {
            if (Thread.currentThread().equals(filterThread)) {
                // Called inside of the thread, in init for instance. Update normally.
                callback.setValue(value);
                model.updateParameters(query);
            } else {
                // The query is currently being filtered by the thread, or finished to do it
                filterThread.addModifier(new PropertyModifier(query, property, value, callback));
                filterThread.setRootQuery(rootQuery);
            }
        } else {
            // Update normally
            callback.setValue(value);
            model.updateParameters(query);
        }
    } else {
        callback.setValue(value);
    }
}
Also used : PropertyModifier(org.gephi.filters.FilterThread.PropertyModifier) Query(org.gephi.filters.api.Query)

Aggregations

PropertyModifier (org.gephi.filters.FilterThread.PropertyModifier)1 Query (org.gephi.filters.api.Query)1