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);
}
}
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);
}
}
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);
}
}
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);
}
}
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));
}
}
Aggregations