Search in sources :

Example 21 with ASelectableCondition

use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.

the class QuickFindAllAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final ASelectableCondition condition = filterEditor.getCondition();
    if (condition == null) {
        return;
    }
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    final MapController mapController = Controller.getCurrentModeController().getMapController();
    final NodeModel selected = selection.getSelected();
    final NodeModel rootNode = selected.getMap().getRootNode();
    boolean nodeFound = condition.checkNode(rootNode);
    if (nodeFound) {
        selection.selectAsTheOnlyOneSelected(rootNode);
    }
    NodeModel next = rootNode;
    for (; ; ) {
        next = filterController.findNext(next, rootNode, Direction.FORWARD, condition);
        if (next == null) {
            break;
        }
        mapController.displayNode(next);
        if (nodeFound) {
            selection.toggleSelected(next);
        } else {
            selection.selectAsTheOnlyOneSelected(next);
            nodeFound = true;
        }
    }
    if (condition.checkNode(selected))
        selection.makeTheSelected(selected);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) ASelectableCondition(org.freeplane.features.filter.condition.ASelectableCondition) MapController(org.freeplane.features.map.MapController)

Aggregations

ASelectableCondition (org.freeplane.features.filter.condition.ASelectableCondition)21 XMLElement (org.freeplane.n3.nanoxml.XMLElement)5 NodeModel (org.freeplane.features.map.NodeModel)4 IOException (java.io.IOException)3 IMapSelection (org.freeplane.features.map.IMapSelection)3 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 LinkedHashSet (java.util.LinkedHashSet)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 JComponent (javax.swing.JComponent)2 FilterComposerDialog (org.freeplane.features.filter.FilterComposerDialog)2 ConditionFactory (org.freeplane.features.filter.condition.ConditionFactory)2 BorderLayout (java.awt.BorderLayout)1 Component (java.awt.Component)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 Window (java.awt.Window)1 WindowEvent (java.awt.event.WindowEvent)1 WindowFocusListener (java.awt.event.WindowFocusListener)1 BufferedInputStream (java.io.BufferedInputStream)1