Search in sources :

Example 6 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class MNodeStyleController method setShapeConfiguration.

public void setShapeConfiguration(final NodeModel node, final ShapeConfigurationModel shape) {
    final ModeController modeController = Controller.getCurrentModeController();
    final ShapeConfigurationModel oldShape = NodeStyleModel.getShapeConfiguration(node);
    final IActor actor = new IActor() {

        public void act() {
            NodeStyleModel.setShapeConfiguration(node, shape);
            modeController.getMapController().nodeChanged(node);
            childShapeRefresh(node);
        }

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

        private void childShapeRefresh(final NodeModel node) {
            for (final NodeModel child : modeController.getMapController().childrenUnfolded(node)) {
                if (child.getViewers().isEmpty())
                    continue;
                final Shape childShape = NodeStyleModel.getShape(child);
                if (childShape == null || NodeStyleModel.Shape.as_parent.equals(childShape)) {
                    modeController.getMapController().nodeRefresh(child);
                    childShapeRefresh(child);
                }
            }
        }

        public void undo() {
            NodeStyleModel.setShapeConfiguration(node, oldShape);
            modeController.getMapController().nodeChanged(node);
            childShapeRefresh(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) NodeModel(org.freeplane.features.map.NodeModel) Shape(org.freeplane.features.nodestyle.NodeStyleModel.Shape) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 7 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class MNodeStyleController method setShapeVerticalMargin.

public void setShapeVerticalMargin(NodeModel node, Quantity<LengthUnits> margin) {
    final ShapeConfigurationModel oldShape = NodeStyleModel.getShapeConfiguration(node);
    setShapeConfiguration(node, oldShape.withVerticalMargin(margin));
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel)

Example 8 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class MNodeStyleController method setShapeHorizontalMargin.

public void setShapeHorizontalMargin(NodeModel node, Quantity<LengthUnits> margin) {
    final ShapeConfigurationModel oldShape = NodeStyleModel.getShapeConfiguration(node);
    setShapeConfiguration(node, oldShape.withHorizontalMargin(margin));
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel)

Example 9 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class NodeView method updateShape.

private void updateShape() {
    final ShapeConfigurationModel newShape = NodeStyleController.getController(getMap().getModeController()).getShapeConfiguration(model);
    final ShapeConfigurationModel oldShape;
    if (mainView != null)
        oldShape = mainView.getShapeConfiguration();
    else
        oldShape = null;
    if (mainView != null && oldShape.equals(newShape))
        return;
    final MainView newMainView = NodeViewFactory.getInstance().newMainView(this);
    if (newMainView.getShapeConfiguration().equals(oldShape))
        return;
    setMainView(newMainView);
    if (map.getSelected() == this) {
        requestFocusInWindow();
    }
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel)

Example 10 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class RectangleMainView method getInsets.

public Insets getInsets() {
    int edgeWidthInset = (int) (getUnzoomedBorderWidth() - 1);
    final ShapeConfigurationModel shapeConfiguration = getShapeConfiguration();
    int horizontalMargin = shapeConfiguration.getHorizontalMargin().toBaseUnitsRounded() + edgeWidthInset;
    int verticalMargin = shapeConfiguration.getVerticalMargin().toBaseUnitsRounded() + edgeWidthInset;
    return new Insets(verticalMargin, horizontalMargin, verticalMargin, horizontalMargin);
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) Insets(java.awt.Insets)

Aggregations

ShapeConfigurationModel (org.freeplane.features.nodestyle.ShapeConfigurationModel)10 NodeModel (org.freeplane.features.map.NodeModel)3 ModeController (org.freeplane.features.mode.ModeController)3 Insets (java.awt.Insets)1 JPopupMenu (javax.swing.JPopupMenu)1 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)1 IActor (org.freeplane.core.undo.IActor)1 ClipboardController (org.freeplane.features.clipboard.ClipboardController)1 CloudController (org.freeplane.features.cloud.CloudController)1 EdgeController (org.freeplane.features.edge.EdgeController)1 FilterController (org.freeplane.features.filter.FilterController)1 IconController (org.freeplane.features.icon.IconController)1 LinkController (org.freeplane.features.link.LinkController)1 CenterAction (org.freeplane.features.map.filemode.CenterAction)1 FMapController (org.freeplane.features.map.filemode.FMapController)1 OpenPathAction (org.freeplane.features.map.filemode.OpenPathAction)1 Controller (org.freeplane.features.mode.Controller)1 FModeController (org.freeplane.features.mode.filemode.FModeController)1 LocationController (org.freeplane.features.nodelocation.LocationController)1 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)1