Search in sources :

Example 66 with NodeModel

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

the class MNodeMouseWheelListener method mouseWheelMoved.

@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (!e.isAltDown()) {
        super.mouseWheelMoved(e);
        return;
    }
    final MainView view = (MainView) e.getComponent();
    final MapView map = (MapView) SwingUtilities.getAncestorOfClass(MapView.class, view);
    if (map.usesLayoutSpecificMaxNodeWidth())
        return;
    final int wheelRotation = e.getWheelRotation();
    final NodeView nodeView = view.getNodeView();
    if (!nodeView.isSelected())
        map.selectAsTheOnlyOneSelected(nodeView);
    final double factor = e.isControlDown() ? 1 : 6 * LengthUnits.pt.factor();
    double newZoomedWidth = Math.max((view.getWidth() - wheelRotation * factor) / map.getZoom(), 0);
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    Quantity<LengthUnits> newZoomedWidthQuantity = LengthUnits.pixelsInPt(newZoomedWidth);
    final ModeController modeController = map.getModeController();
    final MNodeStyleController styleController = (MNodeStyleController) modeController.getExtension(NodeStyleController.class);
    selection.keepNodePosition(nodeView.getModel(), 0f, 0f);
    for (final NodeModel node : selection.getSelection()) {
        styleController.setMinNodeWidth(node, newZoomedWidthQuantity);
        styleController.setMaxNodeWidth(node, newZoomedWidthQuantity);
    }
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) IMapSelection(org.freeplane.features.map.IMapSelection) MapView(org.freeplane.view.swing.map.MapView) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView)

Example 67 with NodeModel

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

the class VerticalNodeViewLayoutStrategy method calculateLayoutData.

public void calculateLayoutData() {
    final NodeModel node = view.getModel();
    viewLevels = view.isFolded() ? SummaryLevels.ignoringChildNodes(node) : SummaryLevels.of(node);
    for (boolean isLeft : viewLevels.sides) calculateLayoutData(isLeft);
    applyLayoutToChildComponents();
}
Also used : NodeModel(org.freeplane.features.map.NodeModel)

Example 68 with NodeModel

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

the class NodeProxy method appendAsCloneImpl.

private Node appendAsCloneImpl(NodeModel toBeCloned, boolean withSubtree) {
    final NodeModel target = getDelegate();
    final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
    if (toBeCloned.getParentNode() == null || toBeCloned.isRoot())
        throw new IllegalArgumentException("can't clone root node or node without parent");
    if (!toBeCloned.getMap().equals(getDelegate().getMap()))
        throw new IllegalArgumentException("can't clone a node from another map");
    if (toBeCloned.subtreeContainsCloneOf(target))
        throw new IllegalArgumentException("can't clone a node which has this node as child");
    final NodeModel clone = withSubtree ? toBeCloned.cloneTree() : toBeCloned.cloneContent();
    mapController.addNewNode(clone, target, target.getChildCount(), target.isNewChildLeft());
    return new NodeProxy(clone, getScriptContext());
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MMapController(org.freeplane.features.map.mindmapmode.MMapController)

Example 69 with NodeModel

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

the class ControllerProxy method select.

public void select(final Collection<Node> toSelect) {
    final Iterator<Node> it = toSelect.iterator();
    if (!it.hasNext()) {
        return;
    }
    final Node firstNode = it.next();
    select(firstNode);
    while (it.hasNext()) {
        final Node nextNode = it.next();
        final NodeModel nodeModel = ((NodeProxy) nextNode).getDelegate();
        Controller.getCurrentModeController().getMapController().displayNode(nodeModel);
        Controller.getCurrentController().getSelection().toggleSelected(nodeModel);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 70 with NodeModel

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

the class RemoveAllAttributesAction method setEnabled.

@Override
public void setEnabled() {
    boolean enable = false;
    final AttributeUtilities atrUtil = new AttributeUtilities();
    final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
    for (final NodeModel node : nodes) {
        if (node != null && atrUtil.hasAttributes(node)) {
            enable = true;
            break;
        }
    }
    setEnabled(enable);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel)

Aggregations

NodeModel (org.freeplane.features.map.NodeModel)450 ModeController (org.freeplane.features.mode.ModeController)100 MapModel (org.freeplane.features.map.MapModel)53 Controller (org.freeplane.features.mode.Controller)46 MapStyleModel (org.freeplane.features.styles.MapStyleModel)46 MMapController (org.freeplane.features.map.mindmapmode.MMapController)39 MapController (org.freeplane.features.map.MapController)38 Point (java.awt.Point)37 IStyle (org.freeplane.features.styles.IStyle)36 IActor (org.freeplane.core.undo.IActor)34 IMapSelection (org.freeplane.features.map.IMapSelection)33 ArrayList (java.util.ArrayList)22 NodeView (org.freeplane.view.swing.map.NodeView)20 URI (java.net.URI)19 Color (java.awt.Color)18 Component (java.awt.Component)17 ResourceController (org.freeplane.core.resources.ResourceController)17 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)16 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)15 MTextController (org.freeplane.features.text.mindmapmode.MTextController)15