Search in sources :

Example 36 with MapController

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

the class UrlManager method selectNode.

private void selectNode(final String target) {
    try {
        final MapController mapController = getMapController();
        final NodeModel node = mapController.getNodeFromID(target);
        if (node != null) {
            mapController.select(node);
        } else {
            final String errorMessage = TextUtils.format("link_not_found", target);
            Controller.getCurrentController().getViewController().err(errorMessage);
        }
    } catch (final Exception e) {
        LogUtils.severe("link " + target + " not found", e);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) XMLParseException(org.freeplane.n3.nanoxml.XMLParseException) XMLException(org.freeplane.n3.nanoxml.XMLException) URISyntaxException(java.net.URISyntaxException) HeadlessException(java.awt.HeadlessException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) MapController(org.freeplane.features.map.MapController)

Example 37 with MapController

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

the class RedoAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    if (UITools.isEditingText())
        return;
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    final MapController mapController = Controller.getCurrentModeController().getMapController();
    mapController.addNodeChangeListener(this);
    try {
        undoHandler.getRedoAction().actionPerformed(e);
        if (lastChangedNode != null) {
            mapController.displayNode(lastChangedNode);
            controller.getSelection().selectAsTheOnlyOneSelected(lastChangedNode);
            lastChangedNode = null;
        }
        undo.setEnabled(undoHandler.canUndo());
        setEnabled(undoHandler.canRedo());
    } finally {
        mapController.removeNodeChangeListener(this);
    }
}
Also used : IUndoHandler(org.freeplane.core.undo.IUndoHandler) MapModel(org.freeplane.features.map.MapModel) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) MapController(org.freeplane.features.map.MapController)

Example 38 with MapController

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

the class UndoAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    if (UITools.isEditingText())
        return;
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    final MapController mapController = Controller.getCurrentModeController().getMapController();
    mapController.addNodeChangeListener(this);
    try {
        undoHandler.getUndoAction().actionPerformed(e);
        if (lastChangedNode != null) {
            mapController.displayNode(lastChangedNode);
            controller.getSelection().selectAsTheOnlyOneSelected(lastChangedNode);
            lastChangedNode = null;
        }
    } finally {
        mapController.removeNodeChangeListener(this);
    }
}
Also used : IUndoHandler(org.freeplane.core.undo.IUndoHandler) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) MapController(org.freeplane.features.map.MapController)

Example 39 with MapController

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

the class MNodeStyleController method setMinNodeWidth.

public void setMinNodeWidth(final NodeModel node, final int minNodeWidth) {
    final NodeSizeModel sizeModel = createOwnSizeModel(node);
    final int oldValue = NodeSizeModel.getMinNodeWidth(node);
    final IActor actor = new IActor() {

        public void act() {
            sizeModel.setMinNodeWidth(minNodeWidth);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }

        public String getDescription() {
            return "setMinNodeWidth";
        }

        public void undo() {
            sizeModel.setMinNodeWidth(oldValue);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }
    };
    getModeController().execute(actor, node.getMap());
    final int maxWidth = getMaxWidth(node);
    if (maxWidth < minNodeWidth) {
        setMaxNodeWidth(node, minNodeWidth);
    }
}
Also used : NodeSizeModel(org.freeplane.features.nodestyle.NodeSizeModel) IActor(org.freeplane.core.undo.IActor) MapController(org.freeplane.features.map.MapController)

Example 40 with MapController

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

the class MainView method paintFoldingMark.

protected void paintFoldingMark(final NodeView nodeView, final Graphics2D g) {
    if (!hasChildren())
        return;
    final MapView map = getMap();
    final MapController mapController = map.getModeController().getMapController();
    final NodeModel node = nodeView.getModel();
    final FoldingMark markType = foldingMarkType(mapController, node);
    Point mousePosition = null;
    try {
        mousePosition = getMousePosition();
    } catch (Exception e) {
    }
    if (mousePosition != null && !map.isPrinting()) {
        final int width = Math.max(FOLDING_CIRCLE_WIDTH, getZoomedFoldingSymbolHalfWidth() * 2);
        final Point p = getNodeView().isLeft() ? getLeftPoint() : getRightPoint();
        if (p.y + width / 2 > getHeight())
            p.y = getHeight() - width;
        else
            p.y -= width / 2;
        if (nodeView.isLeft())
            p.x -= width;
        final FoldingMark foldingCircle;
        if (markType.equals(FoldingMark.UNFOLDED)) {
            if (mapController.hasHiddenChildren(node))
                foldingCircle = FoldingMark.FOLDING_CIRCLE_HIDDEN_CHILD;
            else
                foldingCircle = FoldingMark.FOLDING_CIRCLE_UNFOLDED;
        } else {
            foldingCircle = FoldingMark.FOLDING_CIRCLE_FOLDED;
        }
        foldingCircle.draw(g, nodeView, new Rectangle(p.x, p.y, width, width));
    } else {
        final int halfWidth = getZoomedFoldingSymbolHalfWidth();
        final Point p = getNodeView().isLeft() ? getLeftPoint() : getRightPoint();
        if (p.x <= 0) {
            p.x -= halfWidth;
        } else {
            p.x += halfWidth;
        }
        markType.draw(g, nodeView, new Rectangle(p.x - halfWidth, p.y - halfWidth, halfWidth * 2, halfWidth * 2));
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) Rectangle(java.awt.Rectangle) Point(java.awt.Point) MalformedURLException(java.net.MalformedURLException) Point(java.awt.Point) GradientPaint(java.awt.GradientPaint) MapController(org.freeplane.features.map.MapController)

Aggregations

MapController (org.freeplane.features.map.MapController)60 NodeModel (org.freeplane.features.map.NodeModel)30 ModeController (org.freeplane.features.mode.ModeController)22 Controller (org.freeplane.features.mode.Controller)16 IActor (org.freeplane.core.undo.IActor)13 MapModel (org.freeplane.features.map.MapModel)10 LinkController (org.freeplane.features.link.LinkController)9 TextController (org.freeplane.features.text.TextController)9 MMapController (org.freeplane.features.map.mindmapmode.MMapController)8 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)8 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)8 ResourceController (org.freeplane.core.resources.ResourceController)7 IconController (org.freeplane.features.icon.IconController)7 INodeSelectionListener (org.freeplane.features.map.INodeSelectionListener)7 ViewController (org.freeplane.features.ui.ViewController)7 URI (java.net.URI)6 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)6 MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)6 JPopupMenu (javax.swing.JPopupMenu)5 CloudController (org.freeplane.features.cloud.CloudController)5