Search in sources :

Example 1 with NodeHighlighter

use of org.freeplane.features.highlight.NodeHighlighter in project freeplane by freeplane.

the class PresentationController method install.

public static void install(final ModeController modeController) {
    final PresentationController presentationController = new PresentationController(modeController);
    modeController.addExtension(PresentationController.class, presentationController);
    presentationController.registerActions();
    presentationController.addMapSelectionListener();
    new PresentationBuilder().register(modeController.getMapController(), presentationController);
    HighlightController highlightController = modeController.getController().getExtension(HighlightController.class);
    final PresentationState presentationState = presentationController.presentationState;
    new PresentationPngExporter.ActionInstaller().installActions(modeController, presentationState);
    final JTabbedPane tabs = (JTabbedPane) modeController.getUserInputListenerFactory().getToolBar("/format").getComponent(1);
    tabs.add("Presentations", presentationController.createPanel());
    highlightController.addNodeHighlighter(new NodeHighlighter() {

        @Override
        public boolean isNodeHighlighted(NodeModel node, boolean isPrinting) {
            return !isPrinting && presentationState.shouldHighlightNodeContainedOnSlide(node);
        }

        @Override
        public void configure(Graphics2D g, boolean isPrinting) {
            g.setColor(NODE_HIGHLIGHTING_COLOR);
        }
    });
    highlightController.addNodeHighlighter(new NodeHighlighter() {

        @Override
        public boolean isNodeHighlighted(NodeModel node, boolean isPrinting) {
            return !isPrinting && presentationState.shouldHighlightNodeFoldedOnSlide(node);
        }

        @Override
        public void configure(Graphics2D g, boolean isPrinting) {
            g.setColor(NODE_HIGHLIGHTING_COLOR);
            g.setStroke(FOLDED_NODE_STROKE);
        }
    });
    KeyEventDispatcher navigationKeyEventDispatcher = new NavigationKeyEventDispatcher(presentationState);
    KeyEventDispatcher escapeKeyEventDispatcher = new EscapeKeyEventDispatcher(presentationState);
    final PresentationAutomation presentationKeyHandler = new PresentationAutomation(presentationState, PresentationKeyEventDispatcher.of(navigationKeyEventDispatcher, PROCESS_NAVIGATION_KEYS_PROPERTY), PresentationKeyEventDispatcher.of(escapeKeyEventDispatcher, PROCESS_ESCAPE_KEY_PROPERTY));
    presentationState.addPresentationStateListener(presentationKeyHandler);
}
Also used : JTabbedPane(javax.swing.JTabbedPane) KeyEventDispatcher(java.awt.KeyEventDispatcher) HighlightController(org.freeplane.features.highlight.HighlightController) Graphics2D(java.awt.Graphics2D) NodeModel(org.freeplane.features.map.NodeModel) NodeHighlighter(org.freeplane.features.highlight.NodeHighlighter)

Example 2 with NodeHighlighter

use of org.freeplane.features.highlight.NodeHighlighter in project freeplane by freeplane.

the class FilterController method install.

public static void install() {
    final Controller controller = Controller.getCurrentController();
    final FilterController extension = new FilterController();
    controller.addExtension(FilterController.class, extension);
    controller.getExtension(HighlightController.class).addNodeHighlighter(new NodeHighlighter() {

        @Override
        public boolean isNodeHighlighted(NodeModel node, boolean isPrinting) {
            return !isPrinting && FilterController.getController(controller).isNodeHighlighted(node);
        }

        @Override
        public void configure(Graphics2D g, boolean isPrinting) {
            g.setColor(Color.MAGENTA);
        }
    });
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) NodeHighlighter(org.freeplane.features.highlight.NodeHighlighter) HighlightController(org.freeplane.features.highlight.HighlightController) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) HighlightController(org.freeplane.features.highlight.HighlightController) FrameController(org.freeplane.features.ui.FrameController) Graphics2D(java.awt.Graphics2D)

Aggregations

Graphics2D (java.awt.Graphics2D)2 HighlightController (org.freeplane.features.highlight.HighlightController)2 NodeHighlighter (org.freeplane.features.highlight.NodeHighlighter)2 NodeModel (org.freeplane.features.map.NodeModel)2 KeyEventDispatcher (java.awt.KeyEventDispatcher)1 JTabbedPane (javax.swing.JTabbedPane)1 ResourceController (org.freeplane.core.resources.ResourceController)1 Controller (org.freeplane.features.mode.Controller)1 FrameController (org.freeplane.features.ui.FrameController)1 ViewController (org.freeplane.features.ui.ViewController)1