Search in sources :

Example 6 with IconController

use of org.freeplane.features.icon.IconController in project freeplane by freeplane.

the class DefaultNodeMouseMotionListener method mouseClicked.

public void mouseClicked(final MouseEvent e) {
    final ModeController mc = Controller.getCurrentController().getModeController();
    if (Compat.isMacOsX()) {
        final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
        if (popupmenu.isShowing()) {
            return;
        }
    }
    final MainView component = (MainView) e.getComponent();
    NodeView nodeView = component.getNodeView();
    if (nodeView == null)
        return;
    final NodeModel node = nodeView.getModel();
    final boolean plainEvent = Compat.isPlainEvent(e);
    final boolean inside = nodeSelector.isInside(e);
    final MapController mapController = mc.getMapController();
    if (e.getButton() == 1) {
        if (plainEvent) {
            UIIcon uiIcon = component.getUIIconAt(e.getPoint());
            if (uiIcon != null) {
                final IconController iconController = mc.getExtension(IconController.class);
                if (iconController.onIconClicked(node, uiIcon))
                    return;
            } else if (component.isClickableLink(e.getX())) {
                LinkController.getController(mc).loadURL(node, e);
                e.consume();
                return;
            }
            final String link = component.getLink(e.getPoint());
            if (link != null) {
                doubleClickTimer.start(new Runnable() {

                    public void run() {
                        loadLink(node, link);
                    }
                });
                e.consume();
                return;
            }
            if (inside && e.getClickCount() == 1 && ResourceController.getResourceController().getBooleanProperty(FOLD_ON_CLICK_INSIDE)) {
                if (!nodeSelector.shouldSelectOnClick(e)) {
                    doubleClickTimer.start(new Runnable() {

                        public void run() {
                            mapController.toggleFolded(node);
                        }
                    });
                }
            }
        } else if (Compat.isShiftEvent(e)) {
            if (isInFoldingRegion(e)) {
                if (!mapController.showNextChild(node))
                    mapController.fold(node);
                e.consume();
            }
        }
    }
    final boolean inFoldingRegion = isInFoldingRegion(e);
    if ((plainEvent && inFoldingRegion || (inFoldingRegion || inside) && Compat.isCtrlShiftEvent(e)) && !nodeSelector.shouldSelectOnClick(e)) {
        doubleClickTimer.cancel();
        mapController.toggleFolded(node);
        e.consume();
        return;
    }
    if (inside && e.getButton() == 1 && !e.isAltDown())
        nodeSelector.extendSelection(e);
}
Also used : IconController(org.freeplane.features.icon.IconController) NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView) JPopupMenu(javax.swing.JPopupMenu) UIIcon(org.freeplane.features.icon.UIIcon) MapController(org.freeplane.features.map.MapController)

Aggregations

IconController (org.freeplane.features.icon.IconController)6 JPopupMenu (javax.swing.JPopupMenu)3 LinkController (org.freeplane.features.link.LinkController)3 MapController (org.freeplane.features.map.MapController)3 NodeModel (org.freeplane.features.map.NodeModel)3 Controller (org.freeplane.features.mode.Controller)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 TextController (org.freeplane.features.text.TextController)3 ViewController (org.freeplane.features.ui.ViewController)3 LengthUnits (org.freeplane.core.ui.LengthUnits)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 MindIcon (org.freeplane.features.icon.MindIcon)2 ModeController (org.freeplane.features.mode.ModeController)2 LocationController (org.freeplane.features.nodelocation.LocationController)2 FrameController (org.freeplane.features.ui.FrameController)2