Search in sources :

Example 21 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class PresentationPngExporter method restorePreviousPresentation.

private void restorePreviousPresentation() {
    presentationState.restore();
    presentationZoomFactor = 1f;
    final IMapSelection selectionController = Controller.getCurrentController().getSelection();
    selectionController.replaceSelection(selection);
    if (!presentationState.isPresentationRunning())
        Controller.getCurrentController().getMapViewManager().setZoom(zoom);
    ResourceController.getResourceController().setProperty(Slide.PRESENTATION_SLOW_MOTION_KEY, presentationSlowMotionEnabled);
    if (spotlightEnabledForExport)
        mapViewComponent.putClientProperty(MapView.SPOTLIGHT_ENABLED, null);
    selectionController.scrollNodeToVisible(selectionController.getSelected());
}
Also used : IMapSelection(org.freeplane.features.map.IMapSelection)

Example 22 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class Slide method scrollMapToSelectedNode.

private void scrollMapToSelectedNode() {
    if (placedNodeId == null) {
        final Controller controller = Controller.getCurrentController();
        final IMapSelection selection = controller.getSelection();
        if (selection != null) {
            final NodeModel selected = selection.getSelected();
            controller.getMapViewManager().scrollNodeToVisible(selected);
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController)

Example 23 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class Slide method getCurrentPlacedNode.

public NodeModel getCurrentPlacedNode() {
    if (placedNodeId != null) {
        MapModel map = getMap();
        NodeModel currentPlacedNode = map.getNodeForID(placedNodeId);
        final IMapSelection selection = Controller.getCurrentController().getSelection();
        if (currentPlacedNode != null && currentPlacedNode.hasVisibleContent()) {
            return currentPlacedNode;
        } else {
            return selection.getSelected();
        }
    } else
        return null;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) MapModel(org.freeplane.features.map.MapModel)

Example 24 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class SelectionActor method restoreSelection.

private void restoreSelection() {
    final Controller controller = Controller.getCurrentController();
    if (!map.equals(controller.getMap()))
        return;
    final IMapSelection selection = controller.getSelection();
    if (this.equals(new SelectionActor(selection)))
        return;
    NodeModel[] nodes = new NodeModel[nodeIDs.length];
    int index = 0;
    for (String id : nodeIDs) nodes[index++] = map.getNodeForID(id);
    selection.replaceSelection(nodes);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller)

Example 25 with IMapSelection

use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.

the class StyleEditorPanel method addListeners.

private void addListeners() {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = Controller.getCurrentModeController();
    final MapController mapController = modeController.getMapController();
    mapController.addNodeSelectionListener(new INodeSelectionListener() {

        public void onSelect(final NodeModel node) {
            final IMapSelection selection = controller.getSelection();
            if (selection == null) {
                return;
            }
            if (selection.size() == 1) {
                setComponentsEnabled(true);
                setStyle(node);
            }
        }

        public void setComponentsEnabled(boolean enabled) {
            final Container panel = (Container) getComponent(0);
            for (int i = 0; i < panel.getComponentCount(); i++) {
                panel.getComponent(i).setEnabled(enabled);
            }
        }

        public void onDeselect(final NodeModel node) {
            setComponentsEnabled(false);
        }
    });
    mapController.addNodeChangeListener(new INodeChangeListener() {

        public void nodeChanged(final NodeChangeEvent event) {
            final IMapSelection selection = controller.getSelection();
            if (selection == null) {
                return;
            }
            final NodeModel node = event.getNode();
            if (selection.getSelected().equals(node)) {
                setStyle(node);
            }
        }
    });
    mapController.addMapChangeListener(new AMapChangeListenerAdapter() {

        @Override
        public void mapChanged(MapChangeEvent event) {
            if (!MapStyle.MAP_STYLES.equals(event.getProperty()))
                return;
            final IMapSelection selection = controller.getSelection();
            if (selection == null) {
                return;
            }
            final NodeModel node = selection.getSelected();
            setStyle(node);
        }
    });
}
Also used : NodeChangeEvent(org.freeplane.features.map.NodeChangeEvent) IMapSelection(org.freeplane.features.map.IMapSelection) ModeController(org.freeplane.features.mode.ModeController) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) AMapChangeListenerAdapter(org.freeplane.features.map.AMapChangeListenerAdapter) MapController(org.freeplane.features.map.MapController) INodeSelectionListener(org.freeplane.features.map.INodeSelectionListener) NodeModel(org.freeplane.features.map.NodeModel) Container(java.awt.Container) INodeChangeListener(org.freeplane.features.map.INodeChangeListener) MapChangeEvent(org.freeplane.features.map.MapChangeEvent)

Aggregations

IMapSelection (org.freeplane.features.map.IMapSelection)47 NodeModel (org.freeplane.features.map.NodeModel)33 Controller (org.freeplane.features.mode.Controller)12 ModeController (org.freeplane.features.mode.ModeController)12 ResourceController (org.freeplane.core.resources.ResourceController)7 MapController (org.freeplane.features.map.MapController)7 Component (java.awt.Component)6 MapModel (org.freeplane.features.map.MapModel)4 Container (java.awt.Container)3 ASelectableCondition (org.freeplane.features.filter.condition.ASelectableCondition)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 MTextController (org.freeplane.features.text.mindmapmode.MTextController)3 NodeView (org.freeplane.view.swing.map.NodeView)3 Point (java.awt.Point)2 Window (java.awt.Window)2 WindowEvent (java.awt.event.WindowEvent)2 ArrayList (java.util.ArrayList)2 JComponent (javax.swing.JComponent)2 JPopupMenu (javax.swing.JPopupMenu)2 JRootPane (javax.swing.JRootPane)2