Search in sources :

Example 1 with LocationController

use of org.freeplane.features.nodelocation.LocationController in project freeplane by freeplane.

the class FModeControllerFactory method createModeController.

public static FModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new FModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new FMapController(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    new IconController(modeController).install(modeController);
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    CloudController.install(new CloudController(modeController));
    ClipboardController.install(new ClipboardController());
    LocationController.install(new LocationController());
    LogicalStyleController.install(new LogicalStyleController(modeController));
    MapStyle.install(true);
    NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<ShapeConfigurationModel, NodeModel>() {

        public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
            return ShapeConfigurationModel.FORK;
        }
    });
    modeController.addAction(new CenterAction());
    modeController.addAction(new OpenPathAction());
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    NodeHistory.install(modeController);
    return modeController;
}
Also used : OpenPathAction(org.freeplane.features.map.filemode.OpenPathAction) ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) EdgeController(org.freeplane.features.edge.EdgeController) TextController(org.freeplane.features.text.TextController) LinkController(org.freeplane.features.link.LinkController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) LocationController(org.freeplane.features.nodelocation.LocationController) FMapController(org.freeplane.features.map.filemode.FMapController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) FModeController(org.freeplane.features.mode.filemode.FModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) LocationController(org.freeplane.features.nodelocation.LocationController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FMapController(org.freeplane.features.map.filemode.FMapController) JPopupMenu(javax.swing.JPopupMenu) IconController(org.freeplane.features.icon.IconController) CenterAction(org.freeplane.features.map.filemode.CenterAction) NodeModel(org.freeplane.features.map.NodeModel) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FModeController(org.freeplane.features.mode.filemode.FModeController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) FrameController(org.freeplane.features.ui.FrameController)

Example 2 with LocationController

use of org.freeplane.features.nodelocation.LocationController in project freeplane by freeplane.

the class BModeControllerFactory method createModeController.

public static BModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new BModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MapController(modeController);
    new IconController(modeController).install(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    AttributeController.install(new AttributeController(modeController));
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    CloudController.install(new CloudController(modeController));
    NoteController.install(new NoteController());
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    LogicalStyleController.install(new LogicalStyleController(modeController));
    try {
        ClipboardController.install(new ClipboardController());
    } catch (final AccessControlException e) {
        LogUtils.warn("can not access system clipboard, clipboard controller disabled");
    }
    LocationController.install(new LocationController());
    SummaryNode.install();
    FreeNode.install();
    MapStyle.install(true);
    final BToolbarContributor toolbarContributor = new BToolbarContributor();
    modeController.addUiBuilder(Phase.ACTIONS, "main_toolbar_url", toolbarContributor);
    controller.getMapViewManager().addMapViewChangeListener(toolbarContributor);
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getController(controller).getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    FoldingController.install(new FoldingController());
    new ViewerController();
    EncryptionController.install(new EncryptionController(modeController));
    new AutomaticLayoutController();
    return modeController;
}
Also used : UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) LinkController(org.freeplane.features.link.LinkController) LocationController(org.freeplane.features.nodelocation.LocationController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) IconController(org.freeplane.features.icon.IconController) FoldingController(org.freeplane.features.map.FoldingController) FrameController(org.freeplane.features.ui.FrameController) NoteController(org.freeplane.features.note.NoteController) EdgeController(org.freeplane.features.edge.EdgeController) AttributeController(org.freeplane.features.attribute.AttributeController) TextController(org.freeplane.features.text.TextController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) AccessControlException(java.security.AccessControlException) AttributeController(org.freeplane.features.attribute.AttributeController) EncryptionController(org.freeplane.features.encrypt.EncryptionController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) FoldingController(org.freeplane.features.map.FoldingController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) JPopupMenu(javax.swing.JPopupMenu) MapController(org.freeplane.features.map.MapController) EncryptionController(org.freeplane.features.encrypt.EncryptionController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar)

Example 3 with LocationController

use of org.freeplane.features.nodelocation.LocationController in project freeplane by freeplane.

the class MNodeMotionListener method mouseClicked.

@Override
public void mouseClicked(final MouseEvent e) {
    boolean shoudResetPosition = e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2 && doubleClickTimer.getDelay() > 0;
    if (shoudResetPosition) {
        final MainView mainView = (MainView) e.getComponent();
        if (mainView.getMouseArea().equals(MouseArea.MOTION)) {
            final Controller controller = Controller.getCurrentController();
            MLocationController locationController = (MLocationController) LocationController.getController(controller.getModeController());
            if (e.getModifiersEx() == 0) {
                final NodeView nodeV = getNodeView(e);
                final NodeModel node = nodeV.getModel();
                locationController.moveNodePosition(node, LocationModel.DEFAULT_HGAP, LocationModel.DEFAULT_SHIFT_Y);
                return;
            }
            if (Compat.isCtrlEvent(e)) {
                final NodeView nodeV = getNodeView(e);
                NodeModel childDistanceContainer = nodeV.getParentView().getChildDistanceContainer().getModel();
                locationController.setMinimalDistanceBetweenChildren(childDistanceContainer, LocationModel.DEFAULT_VGAP);
                return;
            }
        } else {
            if (Compat.isPlainEvent(e) && !isInFoldingRegion(e)) {
                final MTextController textController = MTextController.getController();
                textController.getEventQueue().activate(e);
                textController.edit(FirstAction.EDIT_CURRENT, false);
            }
        }
    }
    super.mouseClicked(e);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ResourceController(org.freeplane.core.resources.ResourceController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) NodeView(org.freeplane.view.swing.map.NodeView)

Example 4 with LocationController

use of org.freeplane.features.nodelocation.LocationController in project freeplane by freeplane.

the class MNodeMotionListener method mouseReleased.

@Override
public void mouseReleased(final MouseEvent e) {
    final MainView v = (MainView) e.getSource();
    if (!v.contains(e.getX(), e.getY())) {
        v.setMouseArea(MouseArea.OUT);
    }
    if (!isDragActive()) {
        super.mouseReleased(e);
        return;
    }
    final NodeView nodeV = getNodeView(e);
    final NodeModel node = nodeV.getModel();
    final ModeController modeController = nodeV.getMap().getModeController();
    final Controller controller = modeController.getController();
    MLocationController locationController = (MLocationController) LocationController.getController(controller.getModeController());
    final NodeView parentView = nodeV.getParentView();
    final NodeView childDistanceContainerView = parentView.getChildDistanceContainer();
    NodeModel childDistanceContainer = childDistanceContainerView.getModel();
    final Quantity<LengthUnits> parentVGap = locationController.getMinimalDistanceBetweenChildren(childDistanceContainer);
    Quantity<LengthUnits> hgap = LocationModel.getModel(node).getHGap();
    final Quantity<LengthUnits> shiftY = LocationModel.getModel(node).getShiftY();
    adjustNodeIndices(nodeV);
    resetPositions(node);
    final Quantity<LengthUnits> hGap = hgap;
    locationController.moveNodePosition(node, hGap, shiftY);
    locationController.setMinimalDistanceBetweenChildren(childDistanceContainer, parentVGap);
    stopDrag();
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) LengthUnits(org.freeplane.core.ui.LengthUnits) MainView(org.freeplane.view.swing.map.MainView) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ResourceController(org.freeplane.core.resources.ResourceController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController)

Aggregations

Controller (org.freeplane.features.mode.Controller)4 LocationController (org.freeplane.features.nodelocation.LocationController)4 MapController (org.freeplane.features.map.MapController)3 NodeModel (org.freeplane.features.map.NodeModel)3 JPopupMenu (javax.swing.JPopupMenu)2 ResourceController (org.freeplane.core.resources.ResourceController)2 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)2 ClipboardController (org.freeplane.features.clipboard.ClipboardController)2 CloudController (org.freeplane.features.cloud.CloudController)2 EdgeController (org.freeplane.features.edge.EdgeController)2 FilterController (org.freeplane.features.filter.FilterController)2 IconController (org.freeplane.features.icon.IconController)2 LinkController (org.freeplane.features.link.LinkController)2 MMapController (org.freeplane.features.map.mindmapmode.MMapController)2 ModeController (org.freeplane.features.mode.ModeController)2 MLocationController (org.freeplane.features.nodelocation.mindmapmode.MLocationController)2 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 TextController (org.freeplane.features.text.TextController)2 MTextController (org.freeplane.features.text.mindmapmode.MTextController)2