Search in sources :

Example 1 with FilterModel

use of org.gephi.filters.api.FilterModel in project gephi by gephi.

the class FiltersPanel method stateChanged.

@Override
public void stateChanged(ChangeEvent e) {
    if (e.getSource() instanceof FilterUIModel) {
        if (uiModel.getSelectedQuery() != null && stopButton.isVisible()) {
            FilterController controller = Lookup.getDefault().lookup(FilterController.class);
            controller.filterVisible(uiModel.getSelectedRoot());
        } else if (uiModel.getSelectedQuery() != null && selectButton.isSelected()) {
            FilterController controller = Lookup.getDefault().lookup(FilterController.class);
            controller.selectVisible(uiModel.getSelectedRoot());
        }
    } else if (e.getSource() instanceof FilterModel) {
        if (uiModel.getSelectedQuery() != null && filterModel.getCurrentQuery() == null) {
            //Remove case
            if (!Arrays.asList(filterModel.getQueries()).contains(uiModel.getSelectedRoot())) {
                uiModel.setSelectedQuery(null);
            }
        } else if (filterModel.getCurrentQuery() != null && filterModel.getCurrentQuery() != uiModel.getSelectedQuery() && filterModel.getCurrentQuery() != uiModel.getSelectedRoot()) {
            uiModel.setSelectedQuery(filterModel.getCurrentQuery());
        }
    }
    updateControls();
    updateEnabled(true);
}
Also used : FilterController(org.gephi.filters.api.FilterController) FilterModel(org.gephi.filters.api.FilterModel)

Example 2 with FilterModel

use of org.gephi.filters.api.FilterModel in project gephi by gephi.

the class FilterControllerImpl method getModel.

@Override
public synchronized FilterModel getModel(Workspace workspace) {
    FilterModel filterModel = workspace.getLookup().lookup(FilterModel.class);
    if (filterModel == null) {
        filterModel = new FilterModelImpl(workspace);
        workspace.add(filterModel);
    }
    return filterModel;
}
Also used : FilterModel(org.gephi.filters.api.FilterModel)

Example 3 with FilterModel

use of org.gephi.filters.api.FilterModel in project gephi by gephi.

the class QueryNode method isSelected.

private boolean isSelected() {
    FilterController fc = Lookup.getDefault().lookup(FilterController.class);
    FilterModel fm = fc.getModel();
    return (fm.isFiltering() || fm.isSelecting()) && fc.getModel().getCurrentQuery() == query;
//return FiltersTopComponent.findInstance().getUiModel().getSelectedRoot() == query;
}
Also used : FilterController(org.gephi.filters.api.FilterController) FilterModel(org.gephi.filters.api.FilterModel)

Aggregations

FilterModel (org.gephi.filters.api.FilterModel)3 FilterController (org.gephi.filters.api.FilterController)2