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