Search in sources :

Example 6 with RootPaneContainer

use of javax.swing.RootPaneContainer in project freeplane by freeplane.

the class EditNodeWYSIWYG method createHtmlEditor.

public HTMLDialog createHtmlEditor(final RootPaneContainer frame) throws Exception {
    final JRootPane rootPane = ((RootPaneContainer) frame).getRootPane();
    HTMLDialog htmlEditorWindow = (HTMLDialog) rootPane.getClientProperty(HTMLDialog.class);
    if (htmlEditorWindow == null) {
        htmlEditorWindow = new HTMLDialog(this, "", "", frame);
        rootPane.putClientProperty(HTMLDialog.class, htmlEditorWindow);
        // make sure that SHTML gets notified of relevant config changes!
        ResourceController.getResourceController().addPropertyChangeListener(new FreeplaneToSHTMLPropertyChangeAdapter(htmlEditorWindow.getHtmlEditorPanel()));
    }
    return htmlEditorWindow;
}
Also used : RootPaneContainer(javax.swing.RootPaneContainer) JRootPane(javax.swing.JRootPane)

Example 7 with RootPaneContainer

use of javax.swing.RootPaneContainer in project freeplane by freeplane.

the class MTextController method edit.

public void edit(final NodeModel nodeModel, final NodeModel prevSelectedModel, final boolean isNewNode, final boolean parentFolded, final boolean editLong) {
    if (nodeModel == null || mCurrentEditor != null) {
        return;
    }
    final Controller controller = Controller.getCurrentController();
    if (controller.getMap() != nodeModel.getMap()) {
        return;
    }
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component map = viewController.getMapViewComponent();
    map.validate();
    map.invalidate();
    final Component node = viewController.getComponent(nodeModel);
    if (node == null) {
        return;
    }
    node.requestFocus();
    stopEditing();
    if (isNewNode && !eventQueue.isActive() && !ResourceController.getResourceController().getBooleanProperty("display_inline_editor_for_all_new_nodes")) {
        keyEventDispatcher = new EditEventDispatcher(Controller.getCurrentModeController(), nodeModel, prevSelectedModel, isNewNode, parentFolded, editLong);
        keyEventDispatcher.install();
        return;
    }
    ;
    final IEditControl editControl = new IEditControl() {

        @Override
        public void cancel() {
            if (isNewNode && nodeModel.getMap().equals(controller.getMap())) {
                if (nodeModel.getParentNode() != null) {
                    controller.getSelection().selectAsTheOnlyOneSelected(nodeModel);
                    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
                    modeController.undo();
                    modeController.resetRedo();
                }
                final MapController mapController = Controller.getCurrentModeController().getMapController();
                if (parentFolded) {
                    mapController.fold(prevSelectedModel);
                }
            }
            stop();
        }

        private void stop() {
            Controller.getCurrentModeController().setBlocked(false);
            viewController.obtainFocusForSelected();
            mCurrentEditor = null;
        }

        @Override
        public void ok(final String text) {
            String processedText = makePlainIfNoFormattingFound(text);
            keepNodePosition();
            setGuessedNodeObject(nodeModel, processedText);
            stop();
        }

        private void keepNodePosition() {
            Controller.getCurrentController().getSelection().keepNodePosition(nodeModel, 0, 0);
        }

        @Override
        public void split(final String text, final int position) {
            String processedText = HtmlUtils.isHtmlNode(text) ? removeHtmlHead(text) : text;
            splitNode(nodeModel, position, processedText);
            viewController.obtainFocusForSelected();
            stop();
        }

        @Override
        public boolean canSplit() {
            return true;
        }

        @Override
        public EditedComponent getEditType() {
            return EditedComponent.TEXT;
        }
    };
    mCurrentEditor = createEditor(nodeModel, editControl, nodeModel.getText(), isNewNode, editLong, true);
    final RootPaneContainer frame = (RootPaneContainer) UITools.getCurrentRootComponent();
    mCurrentEditor.show(frame);
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) RootPaneContainer(javax.swing.RootPaneContainer) MMapController(org.freeplane.features.map.mindmapmode.MMapController) 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) TextController(org.freeplane.features.text.TextController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FormatController(org.freeplane.features.format.FormatController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) LinkController(org.freeplane.features.link.LinkController) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ScannerController(org.freeplane.features.format.ScannerController) EditedComponent(org.freeplane.features.text.mindmapmode.EditNodeBase.EditedComponent) Component(java.awt.Component) IEditControl(org.freeplane.features.text.mindmapmode.EditNodeBase.IEditControl) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController)

Example 8 with RootPaneContainer

use of javax.swing.RootPaneContainer in project freeplane by freeplane.

the class FilterConditionEditor method setSearchingBusyCursor.

public void setSearchingBusyCursor() {
    RootPaneContainer root = (RootPaneContainer) getTopLevelAncestor();
    root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    root.getGlassPane().setVisible(true);
}
Also used : RootPaneContainer(javax.swing.RootPaneContainer)

Example 9 with RootPaneContainer

use of javax.swing.RootPaneContainer 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 10 with RootPaneContainer

use of javax.swing.RootPaneContainer in project CodenameOne by codenameone.

the class BlockingAction method actionPerformed.

public final void actionPerformed(ActionEvent e) {
    RootPaneContainer r = (RootPaneContainer) ResourceEditorApp.getApplication().getMainFrame();
    glassPane = r.getGlassPane();
    final ImageIcon progress = new ImageIcon(getClass().getResource("/progress.gif"));
    final JComponent c = new JLabel(progress);
    c.addMouseListener(new MouseAdapter() {
    });
    c.addKeyListener(new KeyAdapter() {
    });
    r.setGlassPane(c);
    c.setVisible(true);
    t = new Timer(100, new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            rotation += 10;
            if (rotation > 359) {
                rotation = 0;
            }
            c.repaint();
        }
    });
    t.setRepeats(true);
    t.start();
    start();
    new Thread(this).start();
}
Also used : ImageIcon(javax.swing.ImageIcon) Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) KeyAdapter(java.awt.event.KeyAdapter) JComponent(javax.swing.JComponent) MouseAdapter(java.awt.event.MouseAdapter) RootPaneContainer(javax.swing.RootPaneContainer) JLabel(javax.swing.JLabel)

Aggregations

RootPaneContainer (javax.swing.RootPaneContainer)25 Component (java.awt.Component)5 Window (java.awt.Window)5 Controller (org.freeplane.features.mode.Controller)4 JComponent (javax.swing.JComponent)3 ResourceController (org.freeplane.core.resources.ResourceController)3 IconController (org.freeplane.features.icon.IconController)3 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)3 LinkController (org.freeplane.features.link.LinkController)3 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)3 MapController (org.freeplane.features.map.MapController)3 MMapController (org.freeplane.features.map.mindmapmode.MMapController)3 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 ViewController (org.freeplane.features.ui.ViewController)3 Container (java.awt.Container)2 Cursor (java.awt.Cursor)2 ImageIcon (javax.swing.ImageIcon)2