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