Search in sources :

Example 26 with MapView

use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.

the class UserInputListenerFactory method createMapActions.

private void createMapActions(final Entry mapsMenuEntry) {
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final ViewController viewController = Controller.getCurrentController().getViewController();
    final List<? extends Component> mapViewVector = viewController.getMapViewVector();
    if (mapViewVector == null) {
        return;
    }
    EntryAccessor entryAccessor = new EntryAccessor();
    for (final Component mapView : mapViewVector) {
        final String displayName = mapView.getName();
        Entry actionEntry = new Entry();
        final MapsMenuAction action = new MapsMenuAction(displayName);
        actionEntry.setName(action.getKey());
        modeController.addActionIfNotAlreadySet(action);
        entryAccessor.setAction(actionEntry, action);
        final MapView currentMapView = (MapView) mapViewManager.getMapViewComponent();
        if (currentMapView != null) {
            if (mapView == currentMapView) {
                actionEntry.setAttribute("selected", true);
            }
        }
        mapsMenuEntry.addChild(actionEntry);
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) ViewController(org.freeplane.features.ui.ViewController) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) MapView(org.freeplane.view.swing.map.MapView) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Example 27 with MapView

use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.

the class MapViewDockingWindows method createTitle.

private String createTitle(Component mapViewComponent) {
    MapView mapView = (MapView) mapViewComponent;
    String name = mapView.getName();
    String title;
    if (mapView.getModel().isSaved() || mapView.getModel().isReadOnly())
        title = name;
    else
        title = name + " *";
    return title;
}
Also used : MapView(org.freeplane.view.swing.map.MapView)

Example 28 with MapView

use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.

the class MapViewDockingWindows method selectMap.

private void selectMap(final int tabIndexChange) {
    final Controller controller = Controller.getCurrentController();
    MapView mapView = (MapView) controller.getMapViewManager().getMapViewComponent();
    if (mapView != null) {
        AbstractTabWindow tabWindow = (AbstractTabWindow) SwingUtilities.getAncestorOfClass(AbstractTabWindow.class, mapView);
        if (tabWindow != null) {
            final DockingWindow selectedWindow = tabWindow.getSelectedWindow();
            final int childWindowIndex = tabWindow.getChildWindowIndex(selectedWindow);
            final int childWindowCount = tabWindow.getChildWindowCount();
            final int nextWindowIndex = (childWindowIndex + childWindowCount + tabIndexChange) % childWindowCount;
            final View nextWindow = (View) tabWindow.getChildWindow(nextWindowIndex);
            final Component nextMapView = getContainedMapView(nextWindow);
            Controller.getCurrentController().getMapViewManager().changeToMapView(nextMapView);
        }
    }
}
Also used : AbstractTabWindow(net.infonode.docking.AbstractTabWindow) DockingWindow(net.infonode.docking.DockingWindow) MapView(org.freeplane.view.swing.map.MapView) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) Component(java.awt.Component) JComponent(javax.swing.JComponent) NodeView(org.freeplane.view.swing.map.NodeView) MapView(org.freeplane.view.swing.map.MapView) View(net.infonode.docking.View)

Example 29 with MapView

use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.

the class MapViewDockingWindows method setTitle.

public void setTitle() {
    if (loadingLayoutFromObjectInpusStream)
        return;
    for (Component mapViewComponent : mapViews) {
        if (mapViewComponent instanceof MapView) {
            MapView mapView = (MapView) mapViewComponent;
            String name = mapView.getName();
            String title;
            if (mapView.getModel().isSaved())
                title = name;
            else
                title = name + " *";
            View containingDockedWindow = getContainingDockedWindow(mapViewComponent);
            containingDockedWindow.getViewProperties().setTitle(title);
        }
    }
}
Also used : MapView(org.freeplane.view.swing.map.MapView) Component(java.awt.Component) JComponent(javax.swing.JComponent) NodeView(org.freeplane.view.swing.map.NodeView) MapView(org.freeplane.view.swing.map.MapView) View(net.infonode.docking.View)

Example 30 with MapView

use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.

the class MapViewDockingWindows method focusMapViewLater.

public void focusMapViewLater(final MapView mapView) {
    Timer timer = new Timer(40, new ActionListener() {

        int retryCount = 5;

        public void actionPerformed(final ActionEvent event) {
            final Timer eventTimer = (Timer) event.getSource();
            focusMapLater(mapView, eventTimer);
        }

        private void focusMapLater(final MapView mapView, final Timer eventTimer) {
            if (mapView.isShowing() && Controller.getCurrentController().getMapViewManager().getMapViewComponent() == mapView) {
                final NodeView selected = mapView.getSelected();
                if (selected != null) {
                    final Frame frame = JOptionPane.getFrameForComponent(mapView);
                    if (frame.isFocused())
                        selected.requestFocusInWindow();
                    else
                        frame.addWindowFocusListener(new WindowAdapter() {

                            @Override
                            public void windowGainedFocus(WindowEvent e) {
                                frame.removeWindowFocusListener(this);
                                selected.requestFocusInWindow();
                                retryCount = 2;
                                eventTimer.start();
                            }
                        });
                }
            }
            if (retryCount > 1) {
                retryCount--;
                eventTimer.start();
            }
        }
    });
    timer.setRepeats(false);
    timer.start();
}
Also used : Frame(java.awt.Frame) Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) WindowEvent(java.awt.event.WindowEvent) MapView(org.freeplane.view.swing.map.MapView) WindowAdapter(java.awt.event.WindowAdapter) DockingWindowAdapter(net.infonode.docking.DockingWindowAdapter) NodeView(org.freeplane.view.swing.map.NodeView)

Aggregations

MapView (org.freeplane.view.swing.map.MapView)55 NodeView (org.freeplane.view.swing.map.NodeView)20 ModeController (org.freeplane.features.mode.ModeController)19 Point (java.awt.Point)15 NodeModel (org.freeplane.features.map.NodeModel)13 Controller (org.freeplane.features.mode.Controller)11 Component (java.awt.Component)9 MainView (org.freeplane.view.swing.map.MainView)9 Dimension (java.awt.Dimension)8 JComponent (javax.swing.JComponent)8 MMapController (org.freeplane.features.map.mindmapmode.MMapController)7 ResourceController (org.freeplane.core.resources.ResourceController)6 MapController (org.freeplane.features.map.MapController)6 MTextController (org.freeplane.features.text.mindmapmode.MTextController)5 IMapViewManager (org.freeplane.features.ui.IMapViewManager)5 Color (java.awt.Color)4 Rectangle (java.awt.Rectangle)4 LocationController (org.freeplane.features.nodelocation.LocationController)4 MLocationController (org.freeplane.features.nodelocation.mindmapmode.MLocationController)4 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)4