use of org.gephi.filters.api.FilterController 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);
}
use of org.gephi.filters.api.FilterController in project gephi by gephi.
the class SavedQueryNodeDefaultAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent ev) {
SavedQueryNode node = (SavedQueryNode) ev.getSource();
FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
filterController.add(node.getQuery());
}
use of org.gephi.filters.api.FilterController in project gephi by gephi.
the class FiltersPanel method initEvents.
private void initEvents() {
resetButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
for (Query query : filterModel.getQueries()) {
controller.remove(query);
}
// uiModel.setSelectedQuery(null);
controller.selectVisible(null);
controller.filterVisible(null);
((FiltersExplorer) libraryTree).setup(manager, filterModel, uiModel);
stopButton.setVisible(false);
filterButton.setVisible(true);
}
});
filterButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//selectButton.setSelected(false);
if (uiModel.getSelectedQuery() != null) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
controller.filterVisible(uiModel.getSelectedRoot());
stopButton.setSelected(false);
stopButton.setVisible(true);
filterButton.setVisible(false);
}
}
});
stopButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
controller.filterVisible(null);
controller.selectVisible(null);
stopButton.setVisible(false);
filterButton.setSelected(true);
filterButton.setVisible(true);
}
});
selectButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//filterButton.setSelected(false);
if (uiModel.getSelectedQuery() != null) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
controller.selectVisible(uiModel.getSelectedRoot());
}
}
});
exportColumnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (uiModel.getSelectedQuery() != null) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
NotifyDescriptor.InputLine question = new NotifyDescriptor.InputLine(NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.exportColumn.input"), NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.exportColumn.input.title"));
if (DialogDisplayer.getDefault().notify(question) == NotifyDescriptor.OK_OPTION) {
String input = question.getInputText();
if (input != null && !input.isEmpty()) {
controller.exportToColumn(input, uiModel.getSelectedRoot());
}
}
}
}
});
exportWorkspaceButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (uiModel.getSelectedQuery() != null) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
controller.exportToNewWorkspace(uiModel.getSelectedRoot());
}
}
});
exportLabelVisible.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (uiModel.getSelectedQuery() != null) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
controller.exportToLabelVisible(uiModel.getSelectedRoot());
}
}
});
/*autoRefreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (filterModel.isAutoRefresh() != autoRefreshButton.isSelected()) {
FilterController controller = Lookup.getDefault().lookup(FilterController.class);
controller.setAutoRefresh(autoRefreshButton.isSelected());
}
}
});*/
updateEnabled(false);
}
use of org.gephi.filters.api.FilterController in project gephi by gephi.
the class CategoryNode method getDropType.
@Override
public PasteType getDropType(final Transferable t, int action, int index) {
if (category == null || !category.equals(FiltersExplorer.QUERIES)) {
return null;
}
final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE);
if (dropNode != null && dropNode instanceof QueryNode) {
return new PasteType() {
@Override
public Transferable paste() throws IOException {
QueryNode queryNode = (QueryNode) dropNode;
FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
FilterLibrary library = filterController.getModel().getLibrary();
library.saveQuery(queryNode.getQuery());
return null;
}
};
}
return null;
}
use of org.gephi.filters.api.FilterController in project gephi by gephi.
the class FilterBuilderNodeDefaultAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent ev) {
FilterBuilderNode node = (FilterBuilderNode) ev.getSource();
FilterBuilder builder = node.getBuilder();
FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
Query function = filterController.createQuery(builder);
filterController.add(function);
}
Aggregations