Search in sources :

Example 1 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar in project freeplane by freeplane.

the class JToolbarComponentBuilderTest method createsToolbarButtonWithAction.

@Test
public void createsToolbarButtonWithAction() {
    Entry actionEntry = new Entry();
    final AFreeplaneAction action = Mockito.mock(AFreeplaneAction.class);
    new EntryAccessor().setAction(actionEntry, action);
    Entry toolbarEntry = new Entry();
    final FreeplaneToolBar toolbar = new FreeplaneToolBar("toolbar", SwingConstants.HORIZONTAL);
    new EntryAccessor().setComponent(toolbarEntry, toolbar);
    toolbarEntry.addChild(actionEntry);
    final JToolbarComponentBuilder toolbarActionGroupBuilder = new JToolbarComponentBuilder();
    toolbarActionGroupBuilder.visit(actionEntry);
    JButton button = (JButton) new EntryAccessor().getComponent(actionEntry);
    assertThat(button.getAction(), CoreMatchers.<Action>equalTo(action));
    assertThat(button.getParent(), CoreMatchers.equalTo((Container) toolbar));
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) Container(java.awt.Container) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) JButton(javax.swing.JButton) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) Test(org.junit.Test)

Example 2 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar 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, UITools.useRibbonsMenu());
    final IMouseListener nodeMouseMotionListener = new MNodeMotionListener();
    userInputListenerFactory.setNodeMouseMotionListener(nodeMouseMotionListener);
    final JPopupMenu popupmenu = new JPopupMenu();
    userInputListenerFactory.setNodePopupMenu(popupmenu);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MMapController(modeController);
    if (userInputListenerFactory.useRibbonMenu()) {
        RibbonBuilder builder = userInputListenerFactory.getMenuBuilder(RibbonBuilder.class);
        final RibbonMapChangeAdapter mapChangeAdapter = builder.getMapChangeAdapter();
        modeController.getMapController().addNodeSelectionListener(mapChangeAdapter);
        modeController.getMapController().addNodeChangeListener(mapChangeAdapter);
        modeController.getMapController().addMapChangeListener(mapChangeAdapter);
        controller.getMapViewManager().addMapSelectionListener(mapChangeAdapter);
    }
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    IconController.install(new MIconController(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(textController);
    LinkController.install(new MLinkController());
    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");
    if (!userInputListenerFactory.useRibbonMenu()) {
        userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolbar);
    }
    userInputListenerFactory.addToolBar("/filter_toolbar", ViewController.BOTTOM, 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);
    modeController.getUserInputListenerFactory().addToolBar("/format", ViewController.RIGHT, resisableTabs);
    KeyBindingProcessor keyProcessor = new KeyBindingProcessor();
    modeController.addExtension(KeyBindingProcessor.class, keyProcessor);
    keyProcessor.addKeyStrokeProcessor(userInputListenerFactory.getAcceleratorManager());
    final FButtonBar fButtonToolBar = new FButtonBar(frameController.getRootPaneContainer().getRootPane(), keyProcessor);
    UIComponentVisibilityDispatcher.install(frameController, fButtonToolBar, "fbarVisible");
    fButtonToolBar.setVisible(ResourceController.getResourceController().getBooleanProperty("fbarVisible"));
    userInputListenerFactory.addToolBar("/fbuttons", ViewController.TOP, fButtonToolBar);
    controller.addAction(new ToggleToolbarAction("ToggleFBarAction", "/fbuttons"));
    SModeControllerFactory.install();
    modeController.addAction(new SetAcceleratorOnNextClickAction());
    modeController.addAction(new ShowNotesInMapAction());
    // userInputListenerFactory.getMenuBuilder().setAcceleratorChangeListener(fButtonToolBar);
    userInputListenerFactory.getAcceleratorManager().addAcceleratorChangeListener(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);
    final MToolbarContributor menuContributor = new MToolbarContributor(uiFactory);
    modeController.addExtension(MUIFactory.class, uiFactory);
    modeController.addMenuContributor(menuContributor);
    new CloneStateIconSupplier().registerStateIconProvider();
// 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) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) ProgressFactory(org.freeplane.view.swing.features.progress.mindmapmode.ProgressFactory) MMapController(org.freeplane.features.map.mindmapmode.MMapController) 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) MNodeMotionListener(org.freeplane.view.swing.ui.mindmapmode.MNodeMotionListener) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) KeyBindingProcessor(org.freeplane.core.ui.KeyBindingProcessor) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) FrameController(org.freeplane.features.ui.FrameController) CloneStateIconSupplier(org.freeplane.features.map.CloneStateIconSupplier) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) SetAcceleratorOnNextClickAction(org.freeplane.core.ui.SetAcceleratorOnNextClickAction) RibbonMapChangeAdapter(org.freeplane.core.ui.ribbon.RibbonMapChangeAdapter) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) Box(javax.swing.Box) 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) 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) TextController(org.freeplane.features.text.TextController) 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) RibbonBuilder(org.freeplane.core.ui.ribbon.RibbonBuilder) JPopupMenu(javax.swing.JPopupMenu) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) ToggleToolbarAction(org.freeplane.features.ui.ToggleToolbarAction) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) IMouseListener(org.freeplane.core.ui.IMouseListener) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) RevisionPlugin(org.freeplane.features.nodestyle.mindmapmode.RevisionPlugin) MNodeDropListener(org.freeplane.view.swing.ui.mindmapmode.MNodeDropListener) DefaultNodeKeyListener(org.freeplane.view.swing.ui.DefaultNodeKeyListener) MTextController(org.freeplane.features.text.mindmapmode.MTextController) CollapseableBoxBuilder(org.freeplane.features.ui.CollapseableBoxBuilder) ShowNotesInMapAction(org.freeplane.view.swing.map.ShowNotesInMapAction) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 3 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar in project freeplane by freeplane.

the class SModeControllerFactory method createController.

Controller createController(final JDialog dialog) {
    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);
    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());
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, false);
    userInputListenerFactory.setNodeMouseMotionListener(new DefaultNodeMouseMotionListener());
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addExtension(ModelessAttributeController.class, new ModelessAttributeController());
    new MMapController(modeController);
    userInputListenerFactory.getMenuBuilder(RibbonBuilder.class).setEnabled(false);
    TextController.install(new MTextController(modeController));
    SpellCheckerController.install(modeController);
    IconController.install(new MIconController(modeController));
    NodeStyleController.install(new MNodeStyleController(modeController));
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    LinkController.install(new MLinkController());
    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());
    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);
    final SModeController modeController = this.modeController;
    final StyleEditorPanel styleEditorPanel = new StyleEditorPanel(modeController, null, false);
    final MapController mapController = modeController.getMapController();
    mapController.addNodeSelectionListener(new INodeSelectionListener() {

        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 = (NodeModel) node.getChildAt(0);
                } else {
                    nextSelection = (NodeModel) (node.getMap().getRootNode().getChildAt(0).getChildAt(0));
                }
            } else {
                nextSelection = node;
            }
            EventQueue.invokeLater(new Runnable() {

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

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

        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);
    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) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) IMapSelection(org.freeplane.features.map.IMapSelection) MMapController(org.freeplane.features.map.mindmapmode.MMapController) FormatController(org.freeplane.features.format.FormatController) MMapMouseListener(org.freeplane.view.swing.ui.mindmapmode.MMapMouseListener) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) 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) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) NodeChangeEvent(org.freeplane.features.map.NodeChangeEvent) JScrollPane(javax.swing.JScrollPane) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) 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) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) ScannerController(org.freeplane.features.format.ScannerController) DefaultNodeMouseMotionListener(org.freeplane.view.swing.ui.DefaultNodeMouseMotionListener) ScannerController(org.freeplane.features.format.ScannerController) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) MapViewController(org.freeplane.view.swing.map.MapViewController) RibbonBuilder(org.freeplane.core.ui.ribbon.RibbonBuilder) JPopupMenu(javax.swing.JPopupMenu) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) ToggleToolbarAction(org.freeplane.features.ui.ToggleToolbarAction) INodeSelectionListener(org.freeplane.features.map.INodeSelectionListener) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ViewLayoutTypeAction(org.freeplane.view.swing.map.ViewLayoutTypeAction) INodeChangeListener(org.freeplane.features.map.INodeChangeListener) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ShowSelectionAsRectangleAction(org.freeplane.core.ui.ShowSelectionAsRectangleAction)

Example 4 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar 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, false);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new FMapController(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    IconController.install(new IconController(modeController));
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    TextController.install(new TextController(modeController));
    LinkController.install(new LinkController());
    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<String, NodeModel>() {

        public String getProperty(final NodeModel node, final String currentValue) {
            return "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", ViewController.BOTTOM, 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) 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 5 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar 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)

Aggregations

FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)9 Controller (org.freeplane.features.mode.Controller)6 JPopupMenu (javax.swing.JPopupMenu)5 CloudController (org.freeplane.features.cloud.CloudController)5 EdgeController (org.freeplane.features.edge.EdgeController)5 FilterController (org.freeplane.features.filter.FilterController)5 IconController (org.freeplane.features.icon.IconController)5 LinkController (org.freeplane.features.link.LinkController)5 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)5 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)5 TextController (org.freeplane.features.text.TextController)5 FrameController (org.freeplane.features.ui.FrameController)5 ViewController (org.freeplane.features.ui.ViewController)5 UserInputListenerFactory (org.freeplane.view.swing.ui.UserInputListenerFactory)5 AttributeController (org.freeplane.features.attribute.AttributeController)4 ClipboardController (org.freeplane.features.clipboard.ClipboardController)4 MapController (org.freeplane.features.map.MapController)4 LocationController (org.freeplane.features.nodelocation.LocationController)4 NoteController (org.freeplane.features.note.NoteController)4 Container (java.awt.Container)3