Search in sources :

Example 1 with NodePosition

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);
    }
}
Also used : XMLElement(org.freeplane.n3.nanoxml.XMLElement) NodePosition(org.freeplane.features.map.IMapSelection.NodePosition) ASelectableCondition(org.freeplane.features.filter.condition.ASelectableCondition)

Example 2 with NodePosition

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);
}
Also used : IActor(org.freeplane.core.undo.IActor) NodePosition(org.freeplane.features.map.IMapSelection.NodePosition)

Aggregations

NodePosition (org.freeplane.features.map.IMapSelection.NodePosition)2 IActor (org.freeplane.core.undo.IActor)1 ASelectableCondition (org.freeplane.features.filter.condition.ASelectableCondition)1 XMLElement (org.freeplane.n3.nanoxml.XMLElement)1