use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.
the class FilterController method applyFilter.
void applyFilter(final boolean force) {
quickFilterAction.setSelected(isFilterActive());
final ASelectableCondition selectedCondition = getSelectedCondition();
final Filter filter = createFilter(selectedCondition);
final ICondition condition = condition(filter);
if (condition != selectedCondition && condition instanceof ASelectableCondition)
getFilterConditions().setSelectedItem(condition);
else
applyFilter(filter, Controller.getCurrentController().getMap(), force);
}
use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.
the class FilterController method addStandardConditions.
private void addStandardConditions() {
final ASelectableCondition noFiltering = NO_FILTERING;
filterConditions.insertElementAt(noFiltering, 0);
if (selectedViewCondition == null) {
selectedViewCondition = SelectedViewCondition.CreateCondition();
}
filterConditions.insertElementAt(selectedViewCondition, 1);
if (filterConditions.getSelectedItem() == null) {
filterConditions.setSelectedItem(noFiltering);
}
if (cloneOfSelectedViewCondition == null)
cloneOfSelectedViewCondition = CloneOfSelectedViewCondition.CreateCondition();
filterConditions.insertElementAt(cloneOfSelectedViewCondition, 2);
}
use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.
the class FindAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final IMapSelection selection = Controller.getCurrentController().getSelection();
if (selection == null) {
return;
}
final NodeModel start = selection.getSelected();
if (editor == null) {
editor = new FilterConditionEditor(FilterController.getCurrentFilterController());
editor.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 0, 5, 0)));
} else {
editor.mapChanged(start.getMap());
}
editor.addAncestorListener(new AncestorListener() {
public void ancestorAdded(final AncestorEvent event) {
final Component component = event.getComponent();
final Window windowAncestor = SwingUtilities.getWindowAncestor(component);
if (windowAncestor.isFocused())
editor.focusInputField(true);
else {
windowAncestor.addWindowFocusListener(new WindowFocusListener() {
public void windowLostFocus(WindowEvent e) {
}
public void windowGainedFocus(WindowEvent e) {
windowAncestor.removeWindowFocusListener(this);
editor.focusInputField(true);
}
});
windowAncestor.toFront();
}
editor.removeAncestorListener(this);
}
public void ancestorMoved(final AncestorEvent event) {
}
public void ancestorRemoved(final AncestorEvent event) {
}
});
final int run = UITools.showConfirmDialog(start, editor, TextUtils.getText("FindAction.text"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
final Container parent = editor.getParent();
if (parent != null) {
parent.remove(editor);
}
if (run != JOptionPane.OK_OPTION) {
return;
}
final ASelectableCondition condition = editor.getCondition();
findFirst(condition);
}
use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.
the class QuickFilterAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final ASelectableCondition condition = filterEditor.getCondition();
if (condition == null) {
return;
}
if (condition.equals(filterController.getSelectedCondition()))
filterController.applyNoFiltering();
else {
setSelected(false);
filterController.apply(condition);
}
}
use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.
the class QuickFindAction method executeAction.
public void executeAction(final boolean reFocusSearchInputField) {
final ASelectableCondition condition = filterEditor.getCondition();
if (condition == null) {
return;
}
final IMapSelection selection = Controller.getCurrentController().getSelection();
if (selection == null) {
return;
}
final NodeModel selected = selection.getSelected();
final NodeModel next;
try {
filterEditor.setSearchingBusyCursor();
next = filterController.findNext(selected, null, direction, condition);
} finally {
filterEditor.setSearchingDefaultCursor();
}
if (next != null) {
FoundNodes.get(next.getMap()).displayFoundNode(next);
if (reFocusSearchInputField) {
// this is called by Enter key listener in FilterConditionEditor
// => we want to re-focus the search term input field so that one can hit enter
// again to find the next search result!
filterEditor.focusInputField(false);
}
}
}
Aggregations