Search in sources :

Example 1 with IMapSelectionListener

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

the class PresentationController method addMapSelectionListener.

private void addMapSelectionListener() {
    IMapSelectionListener mapSelectionListener = new IMapSelectionListener() {

        @Override
        public void beforeMapChange(MapModel oldMap, MapModel newMap) {
        }

        @Override
        public void afterMapChange(MapModel oldMap, MapModel newMap) {
            presentationState.stopPresentation();
            if (newMap != null && Controller.getCurrentModeController() == modeController)
                presentationEditorController.setPresentations(getPresentations(newMap).presentations);
            else
                presentationEditorController.setPresentations(null);
        }
    };
    modeController.getController().getMapViewManager().addMapSelectionListener(mapSelectionListener);
}
Also used : IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) MapModel(org.freeplane.features.map.MapModel)

Example 2 with IMapSelectionListener

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

the class MapViewChangeObserverCompound method afterMapViewChange.

void afterMapViewChange(final MapView oldMap, final MapView newMap) {
    final MapModel oldModel = getModel(oldMap);
    final MapModel newModel = getModel(newMap);
    if (oldModel != newModel) {
        for (final IMapSelectionListener observer : mapListeners.toArray(new IMapSelectionListener[] {})) {
            observer.afterMapChange(oldModel, newModel);
        }
    }
    for (final IMapViewChangeListener observer : viewListeners.toArray(new IMapViewChangeListener[] {})) {
        observer.afterViewChange(oldMap, newMap);
    }
}
Also used : IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) IMapViewChangeListener(org.freeplane.features.ui.IMapViewChangeListener) MapModel(org.freeplane.features.map.MapModel)

Example 3 with IMapSelectionListener

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

the class HeadlessMapViewController method changeToMap.

private void changeToMap(final MapModel nextMap, String mapViewDisplayName) {
    MapModel oldMap = currentMap;
    for (IMapSelectionListener mapSelectionListener : mapSelectionListeners) mapSelectionListener.beforeMapChange(oldMap, nextMap);
    currentKey = mapViewDisplayName;
    currentMap = nextMap;
    for (IMapSelectionListener mapSelectionListener : mapSelectionListeners) mapSelectionListener.afterMapChange(oldMap, nextMap);
}
Also used : IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) MapModel(org.freeplane.features.map.MapModel)

Example 4 with IMapSelectionListener

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

the class MLogicalStyleController method initM.

public void initM() {
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.getMapController().addNodeChangeListener(new StyleRemover());
    modeController.registerExtensionCopier(new ExtensionCopier());
    modeController.addAction(new RedefineStyleAction());
    modeController.addAction(new NewUserStyleAction());
    modeController.addAction(new ManageMapConditionalStylesAction());
    modeController.addAction(new ManageNodeConditionalStylesAction());
    modeController.addAction(new CopyStyleExtensionsAction());
    if (modeController.getModeName().equals("MindMap")) {
        modeController.addAction(new MapBackgroundColorAction());
        modeController.addAction(new MapBackgroundImageAction());
        modeController.addAction(new MapBackgroundClearAction());
        modeController.addAction(new SetBooleanMapPropertyAction(MapStyle.FIT_TO_VIEWPORT));
        modeController.addAction(new CopyMapStylesAction());
    }
    if (!modeController.getController().getViewController().isHeadless()) {
        modeController.addUiBuilder(Phase.ACTIONS, "style_actions", new StyleMenuBuilder(modeController), new ChildActionEntryRemover(modeController));
        final IUserInputListenerFactory userInputListenerFactory = modeController.getUserInputListenerFactory();
        Controller.getCurrentController().getMapViewManager().addMapSelectionListener(new IMapSelectionListener() {

            public void beforeMapChange(final MapModel oldMap, final MapModel newMap) {
            }

            public void afterMapChange(final MapModel oldMap, final MapModel newMap) {
                userInputListenerFactory.rebuildMenus(STYLE_ACTIONS);
            }
        });
        final MapController mapController = modeController.getMapController();
        mapController.addMapChangeListener(new IMapChangeListener() {

            public void onPreNodeMoved(NodeMoveEvent nodeMoveEvent) {
            }

            public void onPreNodeDelete(NodeDeletionEvent nodeDeletionEvent) {
            }

            public void onNodeMoved(NodeMoveEvent nodeMoveEvent) {
            }

            public void onNodeInserted(final NodeModel parent, final NodeModel child, final int newIndex) {
            }

            public void onNodeDeleted(NodeDeletionEvent nodeDeletionEvent) {
            }

            public void mapChanged(final MapChangeEvent event) {
                if (event.getProperty().equals(MapStyle.MAP_STYLES)) {
                    userInputListenerFactory.rebuildMenus(STYLE_ACTIONS);
                }
            }
        });
        mapController.addNodeSelectionListener(new INodeSelectionListener() {

            public void onSelect(final NodeModel node) {
                selectActions();
            }

            public void onDeselect(final NodeModel node) {
            }
        });
    }
}
Also used : IMapChangeListener(org.freeplane.features.map.IMapChangeListener) ChildActionEntryRemover(org.freeplane.core.ui.menubuilders.generic.ChildActionEntryRemover) MapBackgroundImageAction(org.freeplane.view.swing.features.filepreview.MapBackgroundImageAction) IExtensionCopier(org.freeplane.features.map.IExtensionCopier) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) NodeModel(org.freeplane.features.map.NodeModel) NodeDeletionEvent(org.freeplane.features.map.NodeDeletionEvent) MapBackgroundClearAction(org.freeplane.view.swing.features.filepreview.MapBackgroundClearAction) MapChangeEvent(org.freeplane.features.map.MapChangeEvent) IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) IUserInputListenerFactory(org.freeplane.core.ui.IUserInputListenerFactory) SetBooleanMapPropertyAction(org.freeplane.features.styles.SetBooleanMapPropertyAction) MapController(org.freeplane.features.map.MapController) NodeMoveEvent(org.freeplane.features.map.NodeMoveEvent) INodeSelectionListener(org.freeplane.features.map.INodeSelectionListener)

Example 5 with IMapSelectionListener

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

the class MapViewChangeObserverCompound method beforeMapViewChange.

void beforeMapViewChange(final MapView oldMap, final MapView newMap) {
    final MapModel oldModel = getModel(oldMap);
    final MapModel newModel = getModel(newMap);
    if (oldModel != newModel) {
        for (final IMapSelectionListener observer : mapListeners.toArray(new IMapSelectionListener[] {})) {
            observer.beforeMapChange(getModel(oldMap), getModel(newMap));
        }
    }
    for (final IMapViewChangeListener observer : viewListeners.toArray(new IMapViewChangeListener[] {})) {
        observer.beforeViewChange(oldMap, newMap);
    }
}
Also used : IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) IMapViewChangeListener(org.freeplane.features.ui.IMapViewChangeListener) MapModel(org.freeplane.features.map.MapModel)

Aggregations

IMapSelectionListener (org.freeplane.features.map.IMapSelectionListener)5 MapModel (org.freeplane.features.map.MapModel)5 IMapViewChangeListener (org.freeplane.features.ui.IMapViewChangeListener)2 IUserInputListenerFactory (org.freeplane.core.ui.IUserInputListenerFactory)1 ChildActionEntryRemover (org.freeplane.core.ui.menubuilders.generic.ChildActionEntryRemover)1 IExtensionCopier (org.freeplane.features.map.IExtensionCopier)1 IMapChangeListener (org.freeplane.features.map.IMapChangeListener)1 INodeSelectionListener (org.freeplane.features.map.INodeSelectionListener)1 MapChangeEvent (org.freeplane.features.map.MapChangeEvent)1 MapController (org.freeplane.features.map.MapController)1 NodeDeletionEvent (org.freeplane.features.map.NodeDeletionEvent)1 NodeModel (org.freeplane.features.map.NodeModel)1 NodeMoveEvent (org.freeplane.features.map.NodeMoveEvent)1 ModeController (org.freeplane.features.mode.ModeController)1 SetBooleanMapPropertyAction (org.freeplane.features.styles.SetBooleanMapPropertyAction)1 MapBackgroundClearAction (org.freeplane.view.swing.features.filepreview.MapBackgroundClearAction)1 MapBackgroundImageAction (org.freeplane.view.swing.features.filepreview.MapBackgroundImageAction)1