use of org.freeplane.features.nodestyle.NodeSizeModel in project freeplane by freeplane.
the class MNodeStyleController method createOwnSizeModel.
private NodeSizeModel createOwnSizeModel(final NodeModel node) {
{
final NodeSizeModel sizeModel = NodeSizeModel.getModel(node);
if (sizeModel != null) {
return sizeModel;
}
}
final ModeController modeController = Controller.getCurrentModeController();
final IActor actor = new IActor() {
public void act() {
node.addExtension(new NodeSizeModel());
}
public String getDescription() {
return null;
}
public void undo() {
node.removeExtension(NodeSizeModel.class);
}
};
modeController.execute(actor, node.getMap());
return NodeSizeModel.getModel(node);
}
use of org.freeplane.features.nodestyle.NodeSizeModel in project freeplane by freeplane.
the class MNodeStyleController method copySizeModel.
private void copySizeModel(final NodeModel source, final NodeModel target) {
final NodeSizeModel sourceSizeModel = NodeSizeModel.getModel(source);
if (sourceSizeModel != null) {
setMaxNodeWidth(target, sourceSizeModel.getMaxNodeWidth());
setMinNodeWidth(target, sourceSizeModel.getMinNodeWidth());
}
}
use of org.freeplane.features.nodestyle.NodeSizeModel in project freeplane by freeplane.
the class MNodeStyleController method setMaxNodeWidth.
public void setMaxNodeWidth(final NodeModel node, final Quantity<LengthUnits> maxNodeWidth) {
Quantity.assertNonNegativeOrNull(maxNodeWidth);
final NodeSizeModel sizeModel = createOwnSizeModel(node);
final Quantity<LengthUnits> oldValue = NodeSizeModel.getMaxNodeWidth(node);
final IActor actor = new IActor() {
public void act() {
sizeModel.setMaxNodeWidth(maxNodeWidth);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setMaxNodeWidth";
}
public void undo() {
sizeModel.setMaxNodeWidth(oldValue);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
final Quantity<LengthUnits> minNodeWidth = getMinWidth(node);
if (maxNodeWidth != null && minNodeWidth != null && maxNodeWidth.toBaseUnitsRounded() < minNodeWidth.toBaseUnitsRounded()) {
setMinNodeWidth(node, maxNodeWidth);
}
}
use of org.freeplane.features.nodestyle.NodeSizeModel in project freeplane by freeplane.
the class MNodeStyleController method setMinNodeWidth.
public void setMinNodeWidth(final NodeModel node, final Quantity<LengthUnits> minNodeWidth) {
Quantity.assertNonNegativeOrNull(minNodeWidth);
final NodeSizeModel sizeModel = createOwnSizeModel(node);
final Quantity<LengthUnits> oldValue = NodeSizeModel.getMinNodeWidth(node);
final IActor actor = new IActor() {
public void act() {
sizeModel.setMinNodeWidth(minNodeWidth);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setMinNodeWidth";
}
public void undo() {
sizeModel.setMinNodeWidth(oldValue);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
final Quantity<LengthUnits> maxNodeWidth = getMaxWidth(node);
if (maxNodeWidth != null && minNodeWidth != null && maxNodeWidth.toBaseUnits() < minNodeWidth.toBaseUnits()) {
setMaxNodeWidth(node, minNodeWidth);
}
}
Aggregations