Search in sources :

Example 1 with CloudModel

use of org.freeplane.features.cloud.CloudModel in project freeplane by freeplane.

the class CloudShapeAction method setSelected.

@Override
public void setSelected() {
    final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
    final CloudModel model = CloudModel.getModel(node);
    if (model != null) {
        if (actionShape.equals(model.getShape())) {
            setSelected(true);
            return;
        }
    }
    setSelected(false);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) CloudModel(org.freeplane.features.cloud.CloudModel)

Example 2 with CloudModel

use of org.freeplane.features.cloud.CloudModel in project freeplane by freeplane.

the class NodeView method getCoordinates.

private void getCoordinates(final LinkedList<Point> inList, int additionalDistanceForConvexHull, final boolean byChildren, final int transX, final int transY) {
    if (!isVisible()) {
        return;
    }
    if (isContentVisible()) {
        if (byChildren) {
            final ModeController modeController = getMap().getModeController();
            final CloudController cloudController = CloudController.getController(modeController);
            final CloudModel cloud = cloudController.getCloud(getModel());
            if (cloud != null) {
                additionalDistanceForConvexHull += CloudView.getAdditionalHeigth(cloud, this) / 5;
            }
        }
        final int x = transX + getContent().getX() - getDeltaX();
        final int y = transY + getContent().getY() - getDeltaY();
        final int width = mainView.getMainViewWidthWithFoldingMark();
        final int heightWithFoldingMark = mainView.getMainViewHeightWithFoldingMark();
        final int height = Math.max(heightWithFoldingMark, getContent().getHeight());
        inList.addLast(new Point(-additionalDistanceForConvexHull + x, -additionalDistanceForConvexHull + y));
        inList.addLast(new Point(-additionalDistanceForConvexHull + x, additionalDistanceForConvexHull + y + height));
        inList.addLast(new Point(additionalDistanceForConvexHull + x + width, additionalDistanceForConvexHull + y + height));
        inList.addLast(new Point(additionalDistanceForConvexHull + x + width, -additionalDistanceForConvexHull + y));
    }
    for (final NodeView child : getChildrenViews()) {
        child.getCoordinates(inList, additionalDistanceForConvexHull, true, transX + child.getX(), transY + child.getY());
    }
}
Also used : CloudController(org.freeplane.features.cloud.CloudController) ModeController(org.freeplane.features.mode.ModeController) Point(java.awt.Point) CloudModel(org.freeplane.features.cloud.CloudModel) INodeView(org.freeplane.features.map.INodeView) Point(java.awt.Point)

Example 3 with CloudModel

use of org.freeplane.features.cloud.CloudModel in project freeplane by freeplane.

the class MCloudController method setCloud.

public void setCloud(final NodeModel node, final boolean enable) {
    final CloudModel cloud = CloudModel.getModel(node);
    if ((cloud != null) == enable) {
        return;
    }
    final Color color = cloud != null ? cloud.getColor() : CloudController.getStandardColor();
    final Shape shape = cloud != null ? cloud.getShape() : CloudController.getStandardShape();
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            if (enable) {
                enable();
            } else {
                disable();
            }
        }

        private void disable() {
            final MapController mapController = modeController.getMapController();
            CloudModel.setModel(node, null);
            mapController.nodeChanged(node);
        }

        private void enable() {
            final CloudModel cloud = new CloudModel();
            cloud.setColor(color);
            cloud.setShape(shape);
            final MapController mapController = modeController.getMapController();
            CloudModel.setModel(node, cloud);
            mapController.nodeChanged(node);
        }

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

        public void undo() {
            if (enable) {
                disable();
            } else {
                enable();
            }
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : Shape(org.freeplane.features.cloud.CloudModel.Shape) Color(java.awt.Color) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) CloudModel(org.freeplane.features.cloud.CloudModel) MapController(org.freeplane.features.map.MapController)

Example 4 with CloudModel

use of org.freeplane.features.cloud.CloudModel in project freeplane by freeplane.

the class NodeView method updateCloud.

private void updateCloud() {
    final CloudModel cloudModel = CloudController.getController(getMap().getModeController()).getCloud(model);
    putClientProperty(CloudModel.class, cloudModel);
}
Also used : CloudModel(org.freeplane.features.cloud.CloudModel)

Example 5 with CloudModel

use of org.freeplane.features.cloud.CloudModel in project freeplane by freeplane.

the class NodeView method paintCloud.

private void paintCloud(final Graphics g) {
    if (!isContentVisible()) {
        return;
    }
    final CloudModel cloudModel = getCloudModel();
    if (cloudModel == null) {
        return;
    }
    final CloudView cloud = new CloudViewFactory().createCloudView(cloudModel, this);
    cloud.paint(g);
}
Also used : CloudViewFactory(org.freeplane.view.swing.map.cloud.CloudViewFactory) CloudView(org.freeplane.view.swing.map.cloud.CloudView) CloudModel(org.freeplane.features.cloud.CloudModel)

Aggregations

CloudModel (org.freeplane.features.cloud.CloudModel)5 ModeController (org.freeplane.features.mode.ModeController)2 Color (java.awt.Color)1 Point (java.awt.Point)1 IActor (org.freeplane.core.undo.IActor)1 CloudController (org.freeplane.features.cloud.CloudController)1 Shape (org.freeplane.features.cloud.CloudModel.Shape)1 INodeView (org.freeplane.features.map.INodeView)1 MapController (org.freeplane.features.map.MapController)1 NodeModel (org.freeplane.features.map.NodeModel)1 CloudView (org.freeplane.view.swing.map.cloud.CloudView)1 CloudViewFactory (org.freeplane.view.swing.map.cloud.CloudViewFactory)1