Search in sources :

Example 36 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class ToggleDetailsAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    checkDetailsEnabled();
    if (!foundDetails)
        return;
    isHidden = !isHidden;
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    selection.keepNodePosition(selection.getSelected(), 0.0f, 0.0f);
    super.actionPerformed(e);
}
Also used : IMapSelection(org.freeplane.features.map.IMapSelection)

Example 37 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class MUIFactory method nodeChanged.

public void nodeChanged(final NodeChangeEvent event) {
    IMapSelection selection = Controller.getCurrentController().getSelection();
    if (selection != null) {
        if (event.getNode() != selection.getSelected()) {
            return;
        }
    }
    changeToolbar(event.getNode());
}
Also used : IMapSelection(org.freeplane.features.map.IMapSelection)

Example 38 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class NodeSelector method extendSelection.

public void extendSelection(final MouseEvent e) {
    final Controller controller = Controller.getCurrentController();
    final NodeView nodeView = getRelatedNodeView(e);
    final NodeModel newlySelectedNode = nodeView.getModel();
    final boolean extend = Compat.isMacOsX() ? e.isMetaDown() : e.isControlDown();
    final boolean range = e.isShiftDown();
    final IMapSelection selection = controller.getSelection();
    if (range && !extend) {
        selection.selectContinuous(newlySelectedNode);
    } else if (extend && !range) {
        selection.toggleSelected(newlySelectedNode);
    }
    if (extend == range) {
        if (selection.isSelected(newlySelectedNode) && selection.size() == 1 && FocusManager.getCurrentManager().getFocusOwner() instanceof MainView)
            return;
        else {
            selection.selectAsTheOnlyOneSelected(newlySelectedNode);
        }
        e.consume();
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) NodeView(org.freeplane.view.swing.map.NodeView)

Example 39 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class MMapController method addNewSummaryNodeStartEditing.

public void addNewSummaryNodeStartEditing(final int summaryLevel, final int start, final int end) {
    stopEditing();
    ModeController modeController = getMModeController();
    final IMapSelection selection = modeController.getController().getSelection();
    NodeModel selected = selection.getSelected();
    final NodeModel parentNode = selected.getParentNode();
    final boolean isLeft = selected.isLeft();
    final NodeModel newNode = addNewNode(parentNode, end + 1, isLeft);
    final SummaryNode summary = modeController.getExtension(SummaryNode.class);
    summary.undoableActivateHook(newNode, summary);
    final FirstGroupNode firstGroup = modeController.getExtension(FirstGroupNode.class);
    final NodeModel firstNode = parentNode.getChildAt(start);
    firstGroup.undoableActivateHook(firstNode, firstGroup);
    int level = summaryLevel;
    for (int i = start + 1; i < end; i++) {
        NodeModel node = parentNode.getChildAt(i);
        if (isLeft != node.isLeft())
            continue;
        if (SummaryNode.isSummaryNode(node))
            level++;
        else
            level = 0;
        if (level == summaryLevel && SummaryNode.isFirstGroupNode(node))
            firstGroup.undoableActivateHook(node, firstGroup);
    }
    startEditingAfterSelect(newNode);
    select(newNode);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) SummaryNode(org.freeplane.features.map.SummaryNode) IMapSelection(org.freeplane.features.map.IMapSelection) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) FirstGroupNode(org.freeplane.features.map.FirstGroupNode) Point(java.awt.Point)

Example 40 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class SelectBranchAction method actionPerformed.

@Override
protected void actionPerformed(ActionEvent e, NodeModel node) {
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    selection.selectBranch(node, true);
}
Also used : IMapSelection(org.freeplane.features.map.IMapSelection)

Aggregations

IMapSelection (org.freeplane.features.map.IMapSelection)47 NodeModel (org.freeplane.features.map.NodeModel)33 Controller (org.freeplane.features.mode.Controller)12 ModeController (org.freeplane.features.mode.ModeController)12 ResourceController (org.freeplane.core.resources.ResourceController)7 MapController (org.freeplane.features.map.MapController)7 Component (java.awt.Component)6 MapModel (org.freeplane.features.map.MapModel)4 Container (java.awt.Container)3 ASelectableCondition (org.freeplane.features.filter.condition.ASelectableCondition)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 MTextController (org.freeplane.features.text.mindmapmode.MTextController)3 NodeView (org.freeplane.view.swing.map.NodeView)3 Point (java.awt.Point)2 Window (java.awt.Window)2 WindowEvent (java.awt.event.WindowEvent)2 ArrayList (java.util.ArrayList)2 JComponent (javax.swing.JComponent)2 JPopupMenu (javax.swing.JPopupMenu)2 JRootPane (javax.swing.JRootPane)2