Search in sources :

Example 81 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class MNodeMotionListener method mouseDragged.

@Override
public void mouseDragged(final MouseEvent e) {
    if (!isDragActive())
        return;
    if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == (InputEvent.BUTTON1_DOWN_MASK)) {
        final MainView mainView = (MainView) e.getSource();
        final NodeView nodeV = getNodeView(e);
        final MapView mapView = nodeV.getMap();
        final Point point = e.getPoint();
        findGridPoint(point);
        UITools.convertPointToAncestor(nodeV, point, JScrollPane.class);
        ModeController c = Controller.getCurrentController().getModeController();
        final Point dragNextPoint = point;
        if (!Compat.isCtrlEvent(e)) {
            final NodeModel node = nodeV.getModel();
            final LocationModel locationModel = LocationModel.createLocationModel(node);
            final int hGapChange = getHGapChange(dragNextPoint, node);
            if (hGapChange != 0) {
                locationModel.setHGap(originalHGap + hGapChange);
            }
            final int shiftYChange = getNodeShiftYChange(dragNextPoint, node);
            if (shiftYChange != 0) {
                locationModel.setShiftY(originalShiftY + shiftYChange);
            }
            if (hGapChange != 0 || shiftYChange != 0)
                c.getMapController().nodeRefresh(node);
            else
                return;
        } else {
            final NodeModel parentNode = nodeV.getVisibleParentView().getModel();
            final int vGapChange = getVGapChange(dragNextPoint, parentNode);
            if (vGapChange != 0) {
                LocationModel.createLocationModel(parentNode).setVGap(Math.max(0, originalParentVGap - vGapChange));
                final MapController mapController = c.getMapController();
                mapController.nodeRefresh(parentNode);
                mapController.nodeRefresh(nodeV.getModel());
            } else
                return;
        }
        EventQueue.invokeLater(new Runnable() {

            public void run() {
                final Rectangle r = mainView.getBounds();
                UITools.convertRectangleToAncestor(mainView.getParent(), r, mapView);
                final boolean isEventPointVisible = mapView.getVisibleRect().contains(r);
                if (!isEventPointVisible) {
                    mapView.scrollRectToVisible(r);
                }
            }
        });
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) Rectangle(java.awt.Rectangle) MapView(org.freeplane.view.swing.map.MapView) Point(java.awt.Point) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView) LocationModel(org.freeplane.features.nodelocation.LocationModel) Point(java.awt.Point) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController)

Example 82 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class DetailsViewMouseListener method mouseClicked.

@Override
public void mouseClicked(MouseEvent e) {
    final ModeController mc = Controller.getCurrentController().getModeController();
    if (Compat.isMacOsX()) {
        final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
        if (popupmenu.isShowing()) {
            return;
        }
    }
    final NodeView nodeView = nodeSelector.getRelatedNodeView(e);
    if (nodeView == null)
        return;
    final NodeModel model = nodeView.getModel();
    TextController controller = TextController.getController();
    if (eventFromHideDisplayArea(e)) {
        final IMapSelection selection = Controller.getCurrentController().getSelection();
        selection.keepNodePosition(model, 0.0f, 0.0f);
        controller.setDetailsHidden(model, !DetailTextModel.getDetailText(model).isHidden());
    } else {
        nodeSelector.extendSelection(e);
        if (canEdit(controller) && isEditingStartEvent(e)) {
            ((MTextController) controller).editDetails(model, e, e.isAltDown());
        } else
            super.mouseClicked(e);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) TextController(org.freeplane.features.text.TextController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ModeController(org.freeplane.features.mode.ModeController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) NodeView(org.freeplane.view.swing.map.NodeView) JPopupMenu(javax.swing.JPopupMenu)

Example 83 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class WorkspaceController method shutdown.

public void shutdown() {
    for (String modeName : Controller.getCurrentController().getModes()) {
        ModeController modeController = Controller.getCurrentController().getModeController(modeName);
        AWorkspaceModeExtension modeExt = modeController.getExtension(AWorkspaceModeExtension.class);
        if (modeExt == null) {
            continue;
        }
        modeExt.shutdown();
    }
}
Also used : AWorkspaceModeExtension(org.freeplane.plugin.workspace.features.AWorkspaceModeExtension) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 84 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class Activator method start.

public void start(final BundleContext context) throws Exception {
    registerClasspathUrlHandler(context);
    context.registerService(IControllerExtensionProvider.class.getName(), new IControllerExtensionProvider() {

        public void installExtension(Controller controller) {
            WorkspaceController.install(controller);
            UserAccountController.install(controller);
            LogUtils.info("Workspace controller installed.");
            startControllerExtensions(context, controller);
        }
    }, null);
    final Hashtable<String, String[]> props = new Hashtable<String, String[]>();
    // WORKSPACE - todo(low): list all modes from freeplane controller
    props.put("mode", new String[] { MModeController.MODENAME });
    context.registerService(IModeControllerExtensionProvider.class.getName(), new IModeControllerExtensionProvider() {

        public void installExtension(ModeController modeController) {
            addToQuitChain();
            WorkspaceController.getController().installMode(modeController);
            startPluginServices(context, modeController);
            WorkspaceController.getController().startModeExtension(modeController);
        }
    }, props);
}
Also used : IControllerExtensionProvider(org.freeplane.main.osgi.IControllerExtensionProvider) Hashtable(java.util.Hashtable) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) UserAccountController(org.freeplane.core.user.UserAccountController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) IModeControllerExtensionProvider(org.freeplane.main.osgi.IModeControllerExtensionProvider)

Example 85 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class MNoteController method startupController.

public void startupController() {
    final ModeController modeController = Controller.getCurrentModeController();
    if (shouldUseSplitPane()) {
        showNotesPanel(false);
    }
    modeController.getMapController().addNodeSelectionListener(noteManager);
    noteManager.mNoteDocumentListener = new NoteDocumentListener();
}
Also used : ModeController(org.freeplane.features.mode.ModeController)

Aggregations

ModeController (org.freeplane.features.mode.ModeController)222 NodeModel (org.freeplane.features.map.NodeModel)90 Controller (org.freeplane.features.mode.Controller)56 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)48 MapModel (org.freeplane.features.map.MapModel)37 IActor (org.freeplane.core.undo.IActor)31 MapController (org.freeplane.features.map.MapController)30 ResourceController (org.freeplane.core.resources.ResourceController)29 MMapController (org.freeplane.features.map.mindmapmode.MMapController)20 File (java.io.File)17 TextController (org.freeplane.features.text.TextController)17 Color (java.awt.Color)16 Point (java.awt.Point)16 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)15 MapView (org.freeplane.view.swing.map.MapView)13 NodeView (org.freeplane.view.swing.map.NodeView)13 Component (java.awt.Component)12 URL (java.net.URL)12 LinkController (org.freeplane.features.link.LinkController)12 MenuBuilder (org.freeplane.core.ui.MenuBuilder)11