use of org.freeplane.features.map.IMapSelection.NodePosition in project freeplane by freeplane.
the class PresentationWriter method writeSlide.
private void writeSlide(XMLElement xmlPresentation, Slide s) {
XMLElement xmlSlide = xmlPresentation.createElement(SLIDE);
xmlPresentation.addChild(xmlSlide);
xmlSlide.setAttribute(NAME, s.getName());
if (s.showsAncestors())
xmlSlide.setAttribute(SHOWS_ANCESTORS, TRUE);
if (s.showsDescendants())
xmlSlide.setAttribute(SHOWS_DESCENDANTS, TRUE);
if (s.showsOnlySpecificNodes())
xmlSlide.setAttribute(SHOWS_ONLY_SPECIFIC_NODES, TRUE);
if (s.changesZoom())
xmlSlide.setAttribute(CHANGES_ZOOM, TRUE);
final String placedNodeId = s.getPlacedNodeId();
if (placedNodeId != null) {
xmlSlide.setAttribute(PLACED_NODE_ID, placedNodeId);
}
final NodePosition placedNodePosition = s.getPlacedNodePosition();
if (placedNodePosition != NodePosition.CENTER) {
xmlSlide.setAttribute(PLACED_NODE_POSITION, placedNodePosition.name());
}
float zoom = s.getZoom();
if (zoom != 1f)
xmlSlide.setAttribute(ZOOM, Float.toString(zoom));
ASelectableCondition filterCondition = s.getFilterCondition();
if (filterCondition != null) {
XMLElement xmlCondition = new XMLElement(SLIDE_CONDITION);
filterCondition.toXml(xmlCondition);
xmlSlide.addChild(xmlCondition);
}
XMLElement xmlNodes = new XMLElement(NODES_ON_SLIDE);
for (String nodeId : s.getSelectedNodeIds()) {
if (map.getNodeForID(nodeId) != null) {
XMLElement xmlNode = new XMLElement(NODE_ON_SLIDE);
xmlNode.setAttribute(NODE_ID, nodeId);
xmlNodes.addChild(xmlNode);
}
}
if (xmlNodes.hasChildren())
xmlSlide.addChild(xmlNodes);
if (s.foldsNodes()) {
XMLElement xmlFoldedNodes = new XMLElement(FOLDED_NODES);
for (String nodeId : s.getFoldedNodeIds()) {
if (map.getNodeForID(nodeId) != null) {
XMLElement xmlNode = new XMLElement(NODE_ON_SLIDE);
xmlNode.setAttribute(NODE_ID, nodeId);
xmlFoldedNodes.addChild(xmlNode);
}
}
xmlSlide.addChild(xmlFoldedNodes);
}
}
use of org.freeplane.features.map.IMapSelection.NodePosition in project freeplane by freeplane.
the class UndoableSlide method setPlacedNodePosition.
public void setPlacedNodePosition(final NodePosition placedNodePosition) {
final NodePosition oldPlacedNodePosition = slide.getPlacedNodePosition();
if (oldPlacedNodePosition == placedNodePosition)
return;
IActor actor = new IActor() {
@Override
public String getDescription() {
return "setPlacesNodeAtMargin";
}
@Override
public void act() {
slide.setPlacedNodePosition(placedNodePosition);
}
@Override
public void undo() {
slide.setPlacedNodePosition(oldPlacedNodePosition);
}
};
controller.execute(actor, mapModel);
}
Aggregations