use of org.freeplane.features.nodestyle.NodeStyleModel.HorizontalTextAlignment in project freeplane by freeplane.
the class MNodeStyleController method setHorizontalTextAlignment.
public void setHorizontalTextAlignment(final NodeModel node, final HorizontalTextAlignment textAlignment) {
final HorizontalTextAlignment oldTextAlignment = NodeStyleModel.getHorizontalTextAlignment(node);
final IActor actor = new IActor() {
public void act() {
NodeStyleModel.setHorizontalTextAlignment(node, textAlignment);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setHorizontalTextAlignment";
}
public void undo() {
NodeStyleModel.setHorizontalTextAlignment(node, oldTextAlignment);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
}
use of org.freeplane.features.nodestyle.NodeStyleModel.HorizontalTextAlignment in project freeplane by freeplane.
the class MainView method updateHorizontalTextAlignment.
void updateHorizontalTextAlignment(NodeView node) {
final HorizontalTextAlignment textAlignment = NodeStyleController.getController(node.getMap().getModeController()).getHorizontalTextAlignment(node.getModel());
final boolean isCenteredByDefault = textAlignment == HorizontalTextAlignment.DEFAULT && node.isRoot();
setHorizontalAlignment(isCenteredByDefault ? HorizontalTextAlignment.CENTER.swingConstant : textAlignment.swingConstant);
}
use of org.freeplane.features.nodestyle.NodeStyleModel.HorizontalTextAlignment in project freeplane by freeplane.
the class NodeStyleController method getHorizontalTextAlignment.
private HorizontalTextAlignment getHorizontalTextAlignment(final MapModel map, final Collection<IStyle> style) {
final MapStyleModel model = MapStyleModel.getExtension(map);
for (IStyle styleKey : style) {
final NodeModel styleNode = model.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
if (styleModel == null) {
continue;
}
final HorizontalTextAlignment textAlignment = styleModel.getHorizontalTextAlignment();
if (textAlignment == null) {
continue;
}
return textAlignment;
}
return null;
}
Aggregations