Search in sources :

Example 1 with MNodeStyleController

use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.

the class MUIFactory method changeToolbar.

private void changeToolbar(final NodeModel node) {
    final Controller controller = Controller.getCurrentController();
    final MNodeStyleController styleController = (MNodeStyleController) controller.getModeController().getExtension(NodeStyleController.class);
    selectFontSize(Integer.toString(styleController.getFontSize(node)));
    selectFontName(styleController.getFontFamilyName(node));
    final LogicalStyleController logicalStyleController = LogicalStyleController.getController();
    ignoreChangeEvent = true;
    styles.setSelectedItem(logicalStyleController.getFirstStyle(node));
    ignoreChangeEvent = false;
}
Also used : MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController)

Example 2 with MNodeStyleController

use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.

the class HeadlessMModeControllerFactory method createStandardControllers.

private void createStandardControllers() {
    final Controller controller = Controller.getCurrentController();
    modeController = new MModeController(controller);
    modeController.setUserInputListenerFactory(new UserInputListenerFactory(modeController));
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MMapController(modeController);
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    new MIconController(modeController).install(modeController);
    new ProgressFactory().installActions(modeController);
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    new MTextController(modeController).install(modeController);
    LinkController.install(new MLinkController(modeController));
    NodeStyleController.install(new MNodeStyleController(modeController));
    ClipboardController.install(new MClipboardController());
    LocationController.install(new MLocationController());
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    LogicalStyleController.install(logicalStyleController);
    logicalStyleController.initM();
    AttributeController.install(new MAttributeController(modeController));
    modeController.addAction(new EditAttributesAction());
    SpellCheckerController.install(modeController);
    ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
    MapStyle.install(true);
    new RevisionPlugin();
    FoldingController.install(new FoldingController());
}
Also used : MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) ProgressFactory(org.freeplane.view.swing.features.progress.mindmapmode.ProgressFactory) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) AttributeController(org.freeplane.features.attribute.AttributeController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MEncryptionController(org.freeplane.features.encrypt.mindmapmode.MEncryptionController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ChangeNodeLevelController(org.freeplane.features.map.mindmapmode.ChangeNodeLevelController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) LocationController(org.freeplane.features.nodelocation.LocationController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) FoldingController(org.freeplane.features.map.FoldingController) Controller(org.freeplane.features.mode.Controller) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) SpellCheckerController(org.freeplane.features.spellchecker.mindmapmode.SpellCheckerController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) FoldingController(org.freeplane.features.map.FoldingController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) RevisionPlugin(org.freeplane.features.nodestyle.mindmapmode.RevisionPlugin) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ExportController(org.freeplane.features.export.mindmapmode.ExportController)

Example 3 with MNodeStyleController

use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.

the class MModeControllerFactory method createStandardControllers.

private void createStandardControllers() {
    final Controller controller = Controller.getCurrentController();
    modeController = new MModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    final IMouseListener nodeMouseMotionListener = new MNodeMotionListener();
    userInputListenerFactory.setNodeMouseMotionListener(nodeMouseMotionListener);
    userInputListenerFactory.setNodeMouseWheelListener(new MNodeMouseWheelListener(userInputListenerFactory.getMapMouseWheelListener()));
    final JPopupMenu popupmenu = new JPopupMenu();
    userInputListenerFactory.setNodePopupMenu(popupmenu);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MMapController(modeController);
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    new MIconController(modeController).install(modeController);
    new ProgressFactory().installActions(modeController);
    final MapController mapController = modeController.getMapController();
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
    final MTextController textController = new MTextController(modeController);
    textController.install(modeController);
    LinkController.install(new MLinkController(modeController));
    NodeStyleController.install(new MNodeStyleController(modeController));
    ClipboardController.install(new MClipboardController());
    userInputListenerFactory.setNodeDragListener(new MNodeDragListener());
    userInputListenerFactory.setNodeDropTargetListener(new MNodeDropListener());
    LocationController.install(new MLocationController());
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    LogicalStyleController.install(logicalStyleController);
    logicalStyleController.initM();
    AttributeController.install(new MAttributeController(modeController));
    userInputListenerFactory.setNodeKeyListener(new DefaultNodeKeyListener(new IEditHandler() {

        public void edit(final KeyEvent e, final FirstAction action, final boolean editLong) {
            ((MTextController) MTextController.getController(modeController)).getEventQueue().activate(e);
            textController.edit(action, editLong);
        }
    }));
    userInputListenerFactory.setNodeMotionListener(new MNodeMotionListener());
    modeController.addAction(new EditAttributesAction());
    SpellCheckerController.install(modeController);
    ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
    MapStyle.install(true);
    final FreeplaneToolBar toolbar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    final 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, frameController.getStatusBar());
    final JTabbedPane formattingPanel = new JTabbedPane();
    Box resisableTabs = new CollapseableBoxBuilder(frameController).setPropertyNameBase("styleScrollPaneVisible").createBox(formattingPanel, Direction.RIGHT);
    userInputListenerFactory.addToolBar("/format", ViewController.RIGHT, resisableTabs);
    final JRootPane rootPane = ((RootPaneContainer) frameController.getMenuComponent()).getRootPane();
    final FButtonBar fButtonToolBar = new FButtonBar(rootPane);
    UIComponentVisibilityDispatcher.install(frameController, fButtonToolBar, "fbarVisible");
    fButtonToolBar.setVisible(ResourceController.getResourceController().getBooleanProperty("fbarVisible"));
    userInputListenerFactory.addToolBar("/fbuttons", ViewController.TOP, fButtonToolBar);
    userInputListenerFactory.setKeyEventProcessor(new IKeyStrokeProcessor() {

        @Override
        public boolean processKeyBinding(KeyStroke ks, KeyEvent e) {
            return ResourceController.getResourceController().getAcceleratorManager().processKeyBinding(ks, e) || fButtonToolBar.processKeyBinding(ks, e);
        }
    });
    controller.addAction(new ToggleToolbarAction("ToggleFBarAction", "/fbuttons"));
    SModeControllerFactory.install();
    modeController.addAction(new SetAcceleratorOnNextClickAction());
    modeController.addAction(new ShowNotesInMapAction());
    // userInputListenerFactory.getMenuBuilder().setAcceleratorChangeListener(fButtonToolBar);
    ResourceController.getResourceController().getAcceleratorManager().addAcceleratorChangeListener(modeController, fButtonToolBar);
    userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController.getController()).getIconToolBarScrollPane());
    modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
    new RevisionPlugin();
    FoldingController.install(new FoldingController());
    uiFactory = new MUIFactory();
    mapController.addNodeChangeListener(uiFactory);
    mapController.addNodeSelectionListener(uiFactory);
    mapController.addMapChangeListener(uiFactory);
    controller.getMapViewManager().addMapSelectionListener(uiFactory);
    modeController.addExtension(MUIFactory.class, uiFactory);
    modeController.addUiBuilder(Phase.ACTIONS, "main_toolbar_font_name", new ComponentBuilder(new ComponentProvider() {

        @Override
        public Component createComponent(Entry entry) {
            final Container fontBox = uiFactory.createFontBox();
            return fontBox;
        }
    }), EntryVisitor.EMTPY);
    modeController.addUiBuilder(Phase.ACTIONS, "main_toolbar_font_size", new ComponentBuilder(new ComponentProvider() {

        @Override
        public Component createComponent(Entry entry) {
            return uiFactory.createSizeBox();
        }
    }), EntryVisitor.EMTPY);
    modeController.addUiBuilder(Phase.ACTIONS, "main_toolbar_style", new ComponentBuilder(new ComponentProvider() {

        @Override
        public Component createComponent(Entry entry) {
            return uiFactory.createStyleBox();
        }
    }), EntryVisitor.EMTPY);
    modeController.addUiBuilder(Phase.UI, "main_toolbar_zoom", new JToolbarComponentBuilder(new ComponentProvider() {

        @Override
        public Component createComponent(Entry entry) {
            return controller.getMapViewManager().createZoomBox();
        }
    }));
// IconController.getController(modeController).addStateIconProvider(new IStateIconProvider() {
// public UIIcon getStateIcon(NodeModel node) {
// final URI link = NodeLinks.getLink(node);
// return wrapIcon(LinkController.getLinkIcon(link, node));
// }
// 
// private UIIcon wrapIcon(final Icon linkIcon) {
// UIIcon icon = null;
// if(linkIcon != null) {
// if(linkIcon instanceof UIIcon) {
// icon = (UIIcon) linkIcon;
// }
// else {
// icon = new UIIcon("ownIcon", null) {
// public Icon getIcon() {
// return linkIcon;
// }
// };
// }
// }
// return icon;
// }
// });
}
Also used : MUIFactory(org.freeplane.features.styles.mindmapmode.MUIFactory) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) ProgressFactory(org.freeplane.view.swing.features.progress.mindmapmode.ProgressFactory) MMapController(org.freeplane.features.map.mindmapmode.MMapController) IKeyStrokeProcessor(org.freeplane.core.ui.IKeyStrokeProcessor) Container(java.awt.Container) RootPaneContainer(javax.swing.RootPaneContainer) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) SetAcceleratorOnNextClickAction(org.freeplane.core.ui.SetAcceleratorOnNextClickAction) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) RootPaneContainer(javax.swing.RootPaneContainer) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) Box(javax.swing.Box) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) KeyStroke(javax.swing.KeyStroke) RevisionPlugin(org.freeplane.features.nodestyle.mindmapmode.RevisionPlugin) MNodeDropListener(org.freeplane.view.swing.ui.mindmapmode.MNodeDropListener) ShowNotesInMapAction(org.freeplane.view.swing.map.ShowNotesInMapAction) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) ComponentBuilder(org.freeplane.core.ui.menubuilders.action.ComponentBuilder) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MMapMouseListener(org.freeplane.view.swing.ui.mindmapmode.MMapMouseListener) JTabbedPane(javax.swing.JTabbedPane) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) IEditHandler(org.freeplane.core.ui.IEditHandler) KeyEvent(java.awt.event.KeyEvent) FoldingController(org.freeplane.features.map.FoldingController) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) MNodeMotionListener(org.freeplane.view.swing.ui.mindmapmode.MNodeMotionListener) MNodeMouseWheelListener(org.freeplane.view.swing.ui.mindmapmode.MNodeMouseWheelListener) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) FrameController(org.freeplane.features.ui.FrameController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MEncryptionController(org.freeplane.features.encrypt.mindmapmode.MEncryptionController) ChangeNodeLevelController(org.freeplane.features.map.mindmapmode.ChangeNodeLevelController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) FilterController(org.freeplane.features.filter.FilterController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) PresentationController(org.freeplane.features.presentations.mindmapmode.PresentationController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) FrameController(org.freeplane.features.ui.FrameController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) AttributeController(org.freeplane.features.attribute.AttributeController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) MapController(org.freeplane.features.map.MapController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) FoldingController(org.freeplane.features.map.FoldingController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) SpellCheckerController(org.freeplane.features.spellchecker.mindmapmode.SpellCheckerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) LinkController(org.freeplane.features.link.LinkController) LocationController(org.freeplane.features.nodelocation.LocationController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MNodeDragListener(org.freeplane.view.swing.ui.mindmapmode.MNodeDragListener) FButtonBar(org.freeplane.core.ui.components.FButtonBar) JPopupMenu(javax.swing.JPopupMenu) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) ToggleToolbarAction(org.freeplane.features.ui.ToggleToolbarAction) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) IMouseListener(org.freeplane.core.ui.IMouseListener) ComponentProvider(org.freeplane.core.ui.menubuilders.menu.ComponentProvider) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) DefaultNodeKeyListener(org.freeplane.view.swing.ui.DefaultNodeKeyListener) JRootPane(javax.swing.JRootPane) MTextController(org.freeplane.features.text.mindmapmode.MTextController) CollapseableBoxBuilder(org.freeplane.features.ui.CollapseableBoxBuilder)

Example 4 with MNodeStyleController

use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.

the class SModeControllerFactory method createController.

Controller createController(final JDialog dialog) {
    Controller currentController = Controller.getCurrentController();
    final Controller controller = new Controller(ResourceController.getResourceController());
    Controller.setCurrentController(controller);
    final MapViewController mapViewController = new MMapViewController(controller);
    final DialogController viewController = new DialogController(controller, mapViewController, dialog);
    controller.setViewController(viewController);
    controller.addExtension(HighlightController.class, new HighlightController());
    controller.addAction(currentController.getAction("AboutAction"));
    FilterController.install();
    TextController.install();
    controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
    controller.addAction(new ShowSelectionAsRectangleAction());
    modeController = new SModeController(controller);
    controller.selectModeForBuild(modeController);
    modeController.addAction(new NewUserStyleAction());
    modeController.addAction(new DeleteUserStyleAction());
    modeController.addAction(new NewLevelStyleAction());
    modeController.addAction(new DeleteLevelStyleAction());
    modeController.addAction(new SetAcceleratorOnNextClickAction());
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    userInputListenerFactory.setNodeMouseMotionListener(new DefaultNodeMouseMotionListener());
    userInputListenerFactory.setNodeMouseWheelListener(new MNodeMouseWheelListener(userInputListenerFactory.getMapMouseWheelListener()));
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addExtension(ModelessAttributeController.class, new ModelessAttributeController());
    new MMapController(modeController);
    ModelessAttributeController.installConditions();
    new MTextController(modeController).install(modeController);
    SpellCheckerController.install(modeController);
    new MIconController(modeController).install(modeController);
    NodeStyleController.install(new MNodeStyleController(modeController));
    LocationController.install(new MLocationController());
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    LinkController.install(new MLinkController(modeController));
    MFileManager.install(new MFileManager());
    MMapIO.install(modeController);
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    logicalStyleController.initS();
    LogicalStyleController.install(logicalStyleController);
    AttributeController.install(new MAttributeController(modeController));
    FormatController.install(new FormatController());
    IconController.installConditionControllers();
    final ScannerController scannerController = new ScannerController();
    ScannerController.install(scannerController);
    scannerController.addParsersForStandardFormats();
    modeController.addAction(new EditAttributesAction());
    userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
    final JPopupMenu popupmenu = new JPopupMenu();
    userInputListenerFactory.setNodePopupMenu(popupmenu);
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    UIComponentVisibilityDispatcher.install(viewController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController.getController()).getIconToolBarScrollPane());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
    MapStyle.install(false);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    if (extentionInstaller != null)
        extentionInstaller.installExtensions(controller);
    final SModeController modeController = this.modeController;
    final StyleEditorPanel styleEditorPanel = new StyleEditorPanel(modeController, null, false);
    modeController.addAction(new ShowFormatPanelAction());
    final MapController mapController = modeController.getMapController();
    mapController.addNodeSelectionListener(new INodeSelectionListener() {

        @Override
        public void onSelect(final NodeModel node) {
            final IMapSelection selection = controller.getSelection();
            if (selection == null) {
                return;
            }
            if (selection.size() == 1 && node.depth() >= 2) {
                return;
            }
            final NodeModel nextSelection;
            if (node.depth() < 2) {
                if (node.depth() == 1 && node.hasChildren()) {
                    nextSelection = node.getChildAt(0);
                } else {
                    nextSelection = (node.getMap().getRootNode().getChildAt(0).getChildAt(0));
                }
            } else {
                nextSelection = node;
            }
            EventQueue.invokeLater(new Runnable() {

                @Override
                public void run() {
                    selection.selectAsTheOnlyOneSelected(nextSelection);
                }
            });
        }

        @Override
        public void onDeselect(final NodeModel node) {
        }
    });
    mapController.addNodeChangeListener(new INodeChangeListener() {

        @Override
        public void nodeChanged(NodeChangeEvent event) {
            final NodeModel node = event.getNode();
            if (node.getUserObject().equals(MapStyleModel.DEFAULT_STYLE)) {
                mapController.fireMapChanged(new MapChangeEvent(this, node.getMap(), MapStyle.MAP_STYLES, null, null));
            }
        }
    });
    final JScrollPane styleScrollPane = new JScrollPane(styleEditorPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    UITools.setScrollbarIncrement(styleScrollPane);
    // styleEditorPanel.setPreferredSize(new Dimension(200, 200));
    userInputListenerFactory.addToolBar("/format", ViewController.RIGHT, styleScrollPane);
    UIComponentVisibilityDispatcher.install(viewController, styleScrollPane, "styleScrollPaneVisible");
    modeController.addExtension(MUIFactory.class, new MUIFactory());
    final Set<String> emptySet = Collections.emptySet();
    modeController.updateMenus("/xml/stylemodemenu.xml", emptySet);
    this.modeController = null;
    return controller;
}
Also used : MUIFactory(org.freeplane.features.styles.mindmapmode.MUIFactory) StyleEditorPanel(org.freeplane.features.styles.mindmapmode.styleeditorpanel.StyleEditorPanel) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) ShowFormatPanelAction(org.freeplane.features.styles.mindmapmode.ShowFormatPanelAction) ModelessAttributeController(org.freeplane.features.attribute.ModelessAttributeController) NodeModel(org.freeplane.features.map.NodeModel) MapChangeEvent(org.freeplane.features.map.MapChangeEvent) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) SetAcceleratorOnNextClickAction(org.freeplane.core.ui.SetAcceleratorOnNextClickAction) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) DefaultNodeMouseMotionListener(org.freeplane.view.swing.ui.DefaultNodeMouseMotionListener) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) MapViewController(org.freeplane.view.swing.map.MapViewController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) INodeSelectionListener(org.freeplane.features.map.INodeSelectionListener) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ViewLayoutTypeAction(org.freeplane.view.swing.map.ViewLayoutTypeAction) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) IMapSelection(org.freeplane.features.map.IMapSelection) FormatController(org.freeplane.features.format.FormatController) MMapMouseListener(org.freeplane.view.swing.ui.mindmapmode.MMapMouseListener) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) MNodeMouseWheelListener(org.freeplane.view.swing.ui.mindmapmode.MNodeMouseWheelListener) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) NodeChangeEvent(org.freeplane.features.map.NodeChangeEvent) JScrollPane(javax.swing.JScrollPane) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) HighlightController(org.freeplane.features.highlight.HighlightController) AttributeController(org.freeplane.features.attribute.AttributeController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) EdgeController(org.freeplane.features.edge.EdgeController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) FilterController(org.freeplane.features.filter.FilterController) MapController(org.freeplane.features.map.MapController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) TextController(org.freeplane.features.text.TextController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ModelessAttributeController(org.freeplane.features.attribute.ModelessAttributeController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) SpellCheckerController(org.freeplane.features.spellchecker.mindmapmode.SpellCheckerController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) NoteController(org.freeplane.features.note.NoteController) FormatController(org.freeplane.features.format.FormatController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) MapViewController(org.freeplane.view.swing.map.MapViewController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) HighlightController(org.freeplane.features.highlight.HighlightController) LocationController(org.freeplane.features.nodelocation.LocationController) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) ScannerController(org.freeplane.features.format.ScannerController) ScannerController(org.freeplane.features.format.ScannerController) JPopupMenu(javax.swing.JPopupMenu) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) ToggleToolbarAction(org.freeplane.features.ui.ToggleToolbarAction) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) INodeChangeListener(org.freeplane.features.map.INodeChangeListener) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ShowSelectionAsRectangleAction(org.freeplane.core.ui.ShowSelectionAsRectangleAction)

Example 5 with MNodeStyleController

use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.

the class MNodeMouseWheelListener method mouseWheelMoved.

@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (!e.isAltDown()) {
        super.mouseWheelMoved(e);
        return;
    }
    final MainView view = (MainView) e.getComponent();
    final MapView map = (MapView) SwingUtilities.getAncestorOfClass(MapView.class, view);
    if (map.usesLayoutSpecificMaxNodeWidth())
        return;
    final int wheelRotation = e.getWheelRotation();
    final NodeView nodeView = view.getNodeView();
    if (!nodeView.isSelected())
        map.selectAsTheOnlyOneSelected(nodeView);
    final double factor = e.isControlDown() ? 1 : 6 * LengthUnits.pt.factor();
    double newZoomedWidth = Math.max((view.getWidth() - wheelRotation * factor) / map.getZoom(), 0);
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    Quantity<LengthUnits> newZoomedWidthQuantity = LengthUnits.pixelsInPt(newZoomedWidth);
    final ModeController modeController = map.getModeController();
    final MNodeStyleController styleController = (MNodeStyleController) modeController.getExtension(NodeStyleController.class);
    selection.keepNodePosition(nodeView.getModel(), 0f, 0f);
    for (final NodeModel node : selection.getSelection()) {
        styleController.setMinNodeWidth(node, newZoomedWidthQuantity);
        styleController.setMaxNodeWidth(node, newZoomedWidthQuantity);
    }
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeModel(org.freeplane.features.map.NodeModel) MainView(org.freeplane.view.swing.map.MainView) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) IMapSelection(org.freeplane.features.map.IMapSelection) MapView(org.freeplane.view.swing.map.MapView) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView)

Aggregations

MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)8 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)6 MMapController (org.freeplane.features.map.mindmapmode.MMapController)5 ModeController (org.freeplane.features.mode.ModeController)5 NodeModel (org.freeplane.features.map.NodeModel)4 Controller (org.freeplane.features.mode.Controller)4 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)4 AttributeController (org.freeplane.features.attribute.AttributeController)3 MAttributeController (org.freeplane.features.attribute.mindmapmode.MAttributeController)3 CloudController (org.freeplane.features.cloud.CloudController)3 MCloudController (org.freeplane.features.cloud.mindmapmode.MCloudController)3 EdgeController (org.freeplane.features.edge.EdgeController)3 MEdgeController (org.freeplane.features.edge.mindmapmode.MEdgeController)3 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)3 LinkController (org.freeplane.features.link.LinkController)3 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)3 LocationController (org.freeplane.features.nodelocation.LocationController)3 MLocationController (org.freeplane.features.nodelocation.mindmapmode.MLocationController)3 NoteController (org.freeplane.features.note.NoteController)3 MNoteController (org.freeplane.features.note.mindmapmode.MNoteController)3