Search in sources :

Example 1 with IMapChangeListener

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

the class NodeTooltipManager method getSharedInstance.

public static NodeTooltipManager getSharedInstance(ModeController modeController) {
    {
        final NodeTooltipManager instance = modeController.getExtension(NodeTooltipManager.class);
        if (instance != null) {
            return instance;
        }
    }
    final NodeTooltipManager instance = new NodeTooltipManager();
    setTooltipDelays(instance);
    UIManager.put("PopupMenu.consumeEventOnClose", Boolean.FALSE);
    ResourceController.getResourceController().addPropertyChangeListener(new IFreeplanePropertyListener() {

        public void propertyChanged(final String propertyName, final String newValue, final String oldValue) {
            if (propertyName.startsWith(TOOL_TIP_MANAGER)) {
                setTooltipDelays(instance);
            }
        }
    });
    IMapChangeListener mapChangeListener = new AMapChangeListenerAdapter() {

        @Override
        public void onNodeDeleted(NodeDeletionEvent nodeDeletionEvent) {
            instance.hideTipWindow();
        }

        @Override
        public void onNodeInserted(NodeModel parent, NodeModel child, int newIndex) {
            instance.hideTipWindow();
        }

        @Override
        public void onNodeMoved(NodeMoveEvent nodeMoveEvent) {
            instance.hideTipWindow();
        }
    };
    MapController mapController = modeController.getMapController();
    mapController.addMapChangeListener(mapChangeListener);
    INodeSelectionListener nodeSelectionListener = new INodeSelectionListener() {

        public void onSelect(NodeModel node) {
            NodeView view = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, instance.insideComponent);
            if (view != null && node.equals(view.getModel()))
                return;
            instance.hideTipWindow();
        }

        public void onDeselect(NodeModel node) {
        }
    };
    mapController.addNodeSelectionListener(nodeSelectionListener);
    modeController.addExtension(NodeTooltipManager.class, instance);
    return instance;
}
Also used : NodeMoveEvent(org.freeplane.features.map.NodeMoveEvent) INodeSelectionListener(org.freeplane.features.map.INodeSelectionListener) NodeModel(org.freeplane.features.map.NodeModel) NodeDeletionEvent(org.freeplane.features.map.NodeDeletionEvent) IFreeplanePropertyListener(org.freeplane.core.resources.IFreeplanePropertyListener) IMapChangeListener(org.freeplane.features.map.IMapChangeListener) AMapChangeListenerAdapter(org.freeplane.features.map.AMapChangeListenerAdapter) MapController(org.freeplane.features.map.MapController)

Example 2 with IMapChangeListener

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

the class LogicalStyleController method registerChangeListener.

private void registerChangeListener() {
    ModeController modeController = Controller.getCurrentModeController();
    final MapController mapController = modeController.getMapController();
    mapController.addMapChangeListener(new IMapChangeListener() {

        public void onPreNodeMoved(NodeMoveEvent nodeMoveEvent) {
            clearCache();
        }

        public void onPreNodeDelete(NodeDeletionEvent nodeDeletionEvent) {
            clearCache();
        }

        public void onNodeMoved(NodeMoveEvent nodeMoveEvent) {
            clearCache();
        }

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

        public void onNodeDeleted(NodeDeletionEvent nodeDeletionEvent) {
            clearCache();
        }

        public void mapChanged(MapChangeEvent event) {
            clearCache();
        }
    });
    mapController.addNodeChangeListener(new INodeChangeListener() {

        public void nodeChanged(NodeChangeEvent event) {
            clearCache();
        }
    });
}
Also used : NodeChangeEvent(org.freeplane.features.map.NodeChangeEvent) NodeMoveEvent(org.freeplane.features.map.NodeMoveEvent) NodeModel(org.freeplane.features.map.NodeModel) NodeDeletionEvent(org.freeplane.features.map.NodeDeletionEvent) IMapChangeListener(org.freeplane.features.map.IMapChangeListener) INodeChangeListener(org.freeplane.features.map.INodeChangeListener) ModeController(org.freeplane.features.mode.ModeController) MapChangeEvent(org.freeplane.features.map.MapChangeEvent) MapController(org.freeplane.features.map.MapController)

Example 3 with IMapChangeListener

use of org.freeplane.features.map.IMapChangeListener 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)

Aggregations

IMapChangeListener (org.freeplane.features.map.IMapChangeListener)3 MapController (org.freeplane.features.map.MapController)3 NodeDeletionEvent (org.freeplane.features.map.NodeDeletionEvent)3 NodeModel (org.freeplane.features.map.NodeModel)3 NodeMoveEvent (org.freeplane.features.map.NodeMoveEvent)3 INodeSelectionListener (org.freeplane.features.map.INodeSelectionListener)2 MapChangeEvent (org.freeplane.features.map.MapChangeEvent)2 ModeController (org.freeplane.features.mode.ModeController)2 IFreeplanePropertyListener (org.freeplane.core.resources.IFreeplanePropertyListener)1 IUserInputListenerFactory (org.freeplane.core.ui.IUserInputListenerFactory)1 ChildActionEntryRemover (org.freeplane.core.ui.menubuilders.generic.ChildActionEntryRemover)1 AMapChangeListenerAdapter (org.freeplane.features.map.AMapChangeListenerAdapter)1 IExtensionCopier (org.freeplane.features.map.IExtensionCopier)1 IMapSelectionListener (org.freeplane.features.map.IMapSelectionListener)1 INodeChangeListener (org.freeplane.features.map.INodeChangeListener)1 MapModel (org.freeplane.features.map.MapModel)1 NodeChangeEvent (org.freeplane.features.map.NodeChangeEvent)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