Search in sources :

Example 1 with LocationModel

use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.

the class ChangeShiftYActor method setShiftY.

private void setShiftY(final NodeModel node, final Quantity<LengthUnits> shiftY) {
    final LocationModel locationModel = LocationModel.createLocationModel(node);
    locationModel.setShiftY(shiftY);
    Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
Also used : LocationModel(org.freeplane.features.nodelocation.LocationModel)

Example 2 with LocationModel

use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.

the class ChangeShiftXActor method setShiftX.

private void setShiftX(final NodeModel node, final int hGap) {
    final LocationModel locationModel = LocationModel.createLocationModel(node);
    locationModel.setHGap(hGap);
    Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
Also used : LocationModel(org.freeplane.features.nodelocation.LocationModel)

Example 3 with LocationModel

use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.

the class MNodeMotionListener method resetPositions.

/**
 */
private void resetPositions(final NodeModel node) {
    final LocationModel locationModel = LocationModel.getModel(node.getParentNode());
    locationModel.setVGap(originalParentVGap);
    LocationModel.getModel(node).setHGap(originalHGap);
    LocationModel.getModel(node).setShiftY(originalShiftY);
}
Also used : LocationModel(org.freeplane.features.nodelocation.LocationModel)

Example 4 with LocationModel

use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.

the class MNodeMotionListener method mouseDragged.

@Override
public void mouseDragged(final MouseEvent e) {
    if (!isDragActive())
        return;
    if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == (InputEvent.BUTTON1_DOWN_MASK)) {
        final MainView mainView = (MainView) e.getSource();
        final NodeView nodeV = getNodeView(e);
        final MapView mapView = nodeV.getMap();
        final Point point = e.getPoint();
        findGridPoint(point);
        UITools.convertPointToAncestor(nodeV, point, JScrollPane.class);
        ModeController c = Controller.getCurrentController().getModeController();
        final Point dragNextPoint = point;
        if (!Compat.isCtrlEvent(e)) {
            final NodeModel node = nodeV.getModel();
            final LocationModel locationModel = LocationModel.createLocationModel(node);
            final int hGapChange = getHGapChange(dragNextPoint, node);
            if (hGapChange != 0) {
                locationModel.setHGap(originalHGap + hGapChange);
            }
            final int shiftYChange = getNodeShiftYChange(dragNextPoint, node);
            if (shiftYChange != 0) {
                locationModel.setShiftY(originalShiftY + shiftYChange);
            }
            if (hGapChange != 0 || shiftYChange != 0)
                c.getMapController().nodeRefresh(node);
            else
                return;
        } else {
            final NodeModel parentNode = nodeV.getVisibleParentView().getModel();
            final int vGapChange = getVGapChange(dragNextPoint, parentNode);
            if (vGapChange != 0) {
                LocationModel.createLocationModel(parentNode).setVGap(Math.max(0, originalParentVGap - vGapChange));
                final MapController mapController = c.getMapController();
                mapController.nodeRefresh(parentNode);
                mapController.nodeRefresh(nodeV.getModel());
            } else
                return;
        }
        EventQueue.invokeLater(new Runnable() {

            public void run() {
                final Rectangle r = mainView.getBounds();
                UITools.convertRectangleToAncestor(mainView.getParent(), r, mapView);
                final boolean isEventPointVisible = mapView.getVisibleRect().contains(r);
                if (!isEventPointVisible) {
                    mapView.scrollRectToVisible(r);
                }
            }
        });
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) Rectangle(java.awt.Rectangle) MapView(org.freeplane.view.swing.map.MapView) Point(java.awt.Point) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView) LocationModel(org.freeplane.features.nodelocation.LocationModel) Point(java.awt.Point) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController)

Example 5 with LocationModel

use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.

the class ChangeShiftXActor method setShiftX.

private void setShiftX(final NodeModel node, final Quantity<LengthUnits> hGap) {
    final LocationModel locationModel = LocationModel.createLocationModel(node);
    locationModel.setHGap(hGap);
    Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
Also used : LocationModel(org.freeplane.features.nodelocation.LocationModel)

Aggregations

LocationModel (org.freeplane.features.nodelocation.LocationModel)6 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 MapController (org.freeplane.features.map.MapController)1 NodeModel (org.freeplane.features.map.NodeModel)1 MMapController (org.freeplane.features.map.mindmapmode.MMapController)1 ModeController (org.freeplane.features.mode.ModeController)1 MainView (org.freeplane.view.swing.map.MainView)1 MapView (org.freeplane.view.swing.map.MapView)1 NodeView (org.freeplane.view.swing.map.NodeView)1