Search in sources :

Example 1 with IMapViewManager

use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.

the class MapController method canBeUnfoldedOnCurrentView.

public boolean canBeUnfoldedOnCurrentView(final NodeModel node) {
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final boolean isFolded = mapViewManager.isFoldedOnCurrentView(node) || mapViewManager.hasHiddenChildren(node);
    for (int i = 0; i < node.getChildCount(); i++) {
        final NodeModel child = node.getChildAt(i);
        if (child.hasVisibleContent()) {
            if (isFolded)
                return true;
        } else if (node.getFilterInfo().isAncestor() && canBeUnfoldedOnCurrentView(child)) {
            return true;
        }
    }
    return false;
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager)

Example 2 with IMapViewManager

use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.

the class EditStylesAction method init.

private void init() {
    this.mainController = Controller.getCurrentController();
    if (dialog != null) {
        Controller.setCurrentController((Controller) dialog.getRootPane().getClientProperty(Controller.class));
        return;
    }
    dialog = new JDialog(UITools.getCurrentFrame());
    final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
    windowConfigurationStorage.restoreDialogPositions(dialog);
    dialog.setModal(true);
    dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(final WindowEvent e) {
            getModeController().tryToCloseDialog();
        }
    });
    Controller styleDialogController = SModeControllerFactory.getInstance().createController(dialog);
    modeController = (SModeController) styleDialogController.getModeController();
    final ViewController viewController = styleDialogController.getViewController();
    viewController.init(styleDialogController);
    dialog.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentHidden(final ComponentEvent e) {
            final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
            windowConfigurationStorage.storeDialogPositions(dialog);
            final IMapViewManager mapViewManager = modeController.getController().getMapViewManager();
            final MapModel map = mapViewManager.getModel();
            final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
            modeController.getMapController().closeWithoutSaving(map);
            Controller.setCurrentController(mainController);
            super.componentHidden(e);
            mainController.getMapViewManager().changeToMapView(currentMapView);
            currentMapView = null;
            switch(modeController.getStatus()) {
                case JOptionPane.OK_OPTION:
                    if (undoHandler.canUndo()) {
                        commit();
                        break;
                    }
                // $FALL-THROUGH$
                case JOptionPane.CANCEL_OPTION:
                    rollback();
            }
        }
    });
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) ViewController(org.freeplane.features.ui.ViewController) WindowEvent(java.awt.event.WindowEvent) WindowConfigurationStorage(org.freeplane.core.resources.WindowConfigurationStorage) WindowAdapter(java.awt.event.WindowAdapter) IUndoHandler(org.freeplane.core.undo.IUndoHandler) ComponentEvent(java.awt.event.ComponentEvent) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) ViewController(org.freeplane.features.ui.ViewController) JDialog(javax.swing.JDialog) ComponentAdapter(java.awt.event.ComponentAdapter)

Example 3 with IMapViewManager

use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.

the class UserInputListenerFactory method createMapActions.

private void createMapActions(final Entry mapsMenuEntry) {
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final ViewController viewController = Controller.getCurrentController().getViewController();
    final List<? extends Component> mapViewVector = viewController.getMapViewVector();
    if (mapViewVector == null) {
        return;
    }
    EntryAccessor entryAccessor = new EntryAccessor();
    for (final Component mapView : mapViewVector) {
        final String displayName = mapView.getName();
        Entry actionEntry = new Entry();
        final MapsMenuAction action = new MapsMenuAction(displayName);
        actionEntry.setName(action.getKey());
        modeController.addActionIfNotAlreadySet(action);
        entryAccessor.setAction(actionEntry, action);
        final MapView currentMapView = (MapView) mapViewManager.getMapViewComponent();
        if (currentMapView != null) {
            if (mapView == currentMapView) {
                actionEntry.setAttribute("selected", true);
            }
        }
        mapsMenuEntry.addChild(actionEntry);
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) ViewController(org.freeplane.features.ui.ViewController) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) MapView(org.freeplane.view.swing.map.MapView) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Example 4 with IMapViewManager

use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.

the class ImportAttributesDialog method createMapSubTrees.

private void createMapSubTrees(final DefaultMutableTreeNode top) {
    top.removeAllChildren();
    final TreeNodeInfo topInfo = (TreeNodeInfo) top.getUserObject();
    topInfo.setSelected(TreeNodeInfo.NOT_SELECTED);
    Controller controller = Controller.getCurrentController();
    final IMapViewManager mapViewManager = controller.getMapViewManager();
    final MapModel currentMap = controller.getMap();
    currentAttributes = AttributeRegistry.getRegistry(currentMap);
    final Iterator<Entry<String, MapModel>> iterator = mapViewManager.getMaps().entrySet().iterator();
    while (iterator.hasNext()) {
        final Entry<String, MapModel> entry = iterator.next();
        final String nextmapName = entry.getKey();
        final MapModel nextMap = entry.getValue();
        if (nextMap == currentMap) {
            continue;
        }
        final TreeNodeInfo treeNodeInfo = new TreeNodeInfo(nextmapName);
        final DefaultMutableTreeNode mapInfo = new DefaultMutableTreeNode(treeNodeInfo);
        createAttributeSubTrees(mapInfo, AttributeRegistry.getRegistry(nextMap));
        if (mapInfo.getChildCount() != 0) {
            top.add(mapInfo);
        }
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Entry(java.util.Map.Entry) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller)

Example 5 with IMapViewManager

use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.

the class UITools method showInputDialog.

public static String showInputDialog(final NodeModel node, final String message, final String initialValue) {
    if (node == null) {
        return null;
    }
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    viewController.scrollNodeToVisible(node);
    final Component parentComponent = viewController.getComponent(node);
    return JOptionPane.showInputDialog(parentComponent, message, initialValue);
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) JComponent(javax.swing.JComponent) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent)

Aggregations

IMapViewManager (org.freeplane.features.ui.IMapViewManager)35 Component (java.awt.Component)13 Controller (org.freeplane.features.mode.Controller)13 MapModel (org.freeplane.features.map.MapModel)12 ModeController (org.freeplane.features.mode.ModeController)11 JComponent (javax.swing.JComponent)7 URL (java.net.URL)5 ResourceController (org.freeplane.core.resources.ResourceController)5 NodeModel (org.freeplane.features.map.NodeModel)5 MapView (org.freeplane.view.swing.map.MapView)5 Point (java.awt.Point)4 JTextComponent (javax.swing.text.JTextComponent)4 IUndoHandler (org.freeplane.core.undo.IUndoHandler)3 LinkController (org.freeplane.features.link.LinkController)3 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)3 ViewController (org.freeplane.features.ui.ViewController)3 Color (java.awt.Color)2 Dimension (java.awt.Dimension)2 ComponentAdapter (java.awt.event.ComponentAdapter)2 ComponentEvent (java.awt.event.ComponentEvent)2