Package org.freeplane.features.ui

Examples of org.freeplane.features.ui.IMapViewManager


    final boolean fChangeModule = changeModule;
    final MapView newView;
    if (fChangeModule) {
      newView = newModule;
      final Controller controller = newView.getModeController().getController();
      final IMapViewManager mapViewManager = controller.getMapViewManager();
      final boolean res = mapViewManager.changeToMapView(newView);
      if (!res) {
        LogUtils.warn("Can't change to map mapView " + newView);
        return;
      }
    }
View Full Code Here


   * freeplane.modes.mindmapmode.actions.MultipleNodeAction#actionPerformed
   * (freeplane.modes.NodeModel)
   */
  @Override
  protected void actionPerformed(final ActionEvent e, final NodeModel node) {
    final IMapViewManager viewController = Controller.getCurrentController().getMapViewManager();
    final Component mapView = viewController.getMapViewComponent();
    final Color mapColor = mapView.getBackground();
    Color nodeColor = NodeStyleModel.getColor(node);
    final MNodeStyleController mNodeStyleController = (MNodeStyleController) NodeStyleController
        .getController();
    if (nodeColor == null) {
      nodeColor = viewController.getBackgroundColor(node);
    }
    mNodeStyleController.setColor(node, new Color((3 * mapColor.getRed() + nodeColor.getRed()) / 4, (3 * mapColor
        .getGreen() + nodeColor.getGreen()) / 4, (3 * mapColor.getBlue() + nodeColor.getBlue()) / 4));
  }
View Full Code Here

  private void updateMapList(final String mapsMenuPosition) {
    if(! getMenuBuilder(MenuBuilder.class).contains(mapsMenuPosition))
      return;
    getMenuBuilder(MenuBuilder.class).removeChildElements(mapsMenuPosition);
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final List<? extends Component> mapViewVector = mapViewManager.getMapViewVector();
    if (mapViewVector == null) {
      return;
    }
    final ButtonGroup group = new ButtonGroup();
    int i = 0;
    for (final Component mapView : mapViewVector) {
      final String displayName = mapView.getName();
      final JRadioButtonMenuItem newItem = new JRadioButtonMenuItem(displayName);
      newItem.setSelected(false);
      group.add(newItem);
      newItem.addActionListener(mapsMenuActionListener);
      if (displayName.length() > 0) {
        newItem.setMnemonic(displayName.charAt(0));
      }
      final MapView currentMapView = (MapView) mapViewManager.getMapViewComponent();
      if (currentMapView != null) {
        if (mapView == currentMapView) {
          newItem.setSelected(true);
        }
      }
View Full Code Here

      getMenuBuilder(MenuBuilder.class).addToolbar((JToolBar) getToolBar("/main_toolbar"), "/main_toolbar");
      final URL menuStructure = ResourceController.getResourceController().getResource(menuStructureResource);
      loadStructure(plugins, menuStructure);
      final URL toolbarStructure = ResourceController.getResourceController().getResource(menuStructureResource.replace("menu.xml", "toolbar.xml"));
      loadStructure(plugins, toolbarStructure);
      final IMapViewManager viewController = Controller.getCurrentController().getMapViewManager();
      viewController.updateMenus(getMenuBuilder(MenuBuilder.class));
    }
    mapsPopupMenu.setName(TextUtils.getText("mindmaps"));
  }
View Full Code Here

  private void hideMe() {
    if (textfield == null) {
      return;
    }
    textfield.getDocument().removeDocumentListener(documentListener);
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    mapViewManager.removeMapViewChangeListener(mapViewChangeListener);
    mapViewChangeListener = null;
    parent.setPreferredSize(null);
    if(SwingUtilities.getAncestorOfClass(MapView.class, nodeView) != null)
      nodeView.update();
    if(nodeView.isRoot() && parent instanceof MainView)
View Full Code Here

   */
  @SuppressWarnings("serial")
    @Override
  public void show(final RootPaneContainer frame) {
    final ModeController modeController = Controller.getCurrentModeController();
    final IMapViewManager viewController = modeController.getController().getMapViewManager();
    final MTextController textController = (MTextController) TextController.getController(modeController);
    nodeView = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, parent);
    font = parent.getFont();
    zoom = viewController.getZoom();
    if (zoom != 1F) {
      final float fontSize = (int) (Math.rint(font.getSize() * zoom));
      font = font.deriveFont(fontSize);
    }
    final HTMLEditorKit kit = new ScaledEditorKit(){
      @Override
      public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException {
        if (doc instanceof HTMLDocument) {
          HTMLWriter w = new SHTMLWriter(out, (HTMLDocument) doc, pos, len);
          w.write();
        }
        else {
          super.write(out, doc, pos, len);
        }
      }
    };
    textfield.setEditorKit(kit);

    final InputMap inputMap = textfield.getInputMap();
    final ActionMap actionMap = textfield.getActionMap();
    actionMap.put(DefaultEditorKit.pasteAction, pasteAction);
   
    inputMap.put((KeyStroke) boldAction.getValue(Action.ACCELERATOR_KEY), "boldAction");
    actionMap.put("boldAction",boldAction);
   
    inputMap.put((KeyStroke) italicAction.getValue(Action.ACCELERATOR_KEY), "italicAction");
    actionMap.put("italicAction", italicAction);
   
    inputMap.put((KeyStroke) underlineAction.getValue(Action.ACCELERATOR_KEY), "underlineAction");
    actionMap.put("underlineAction", underlineAction);
   
    inputMap.put((KeyStroke) redAction.getValue(Action.ACCELERATOR_KEY), "redAction");
    actionMap.put("redAction", redAction);
   
    inputMap.put((KeyStroke) greenAction.getValue(Action.ACCELERATOR_KEY), "greenAction");
    actionMap.put("greenAction", greenAction);
   
    inputMap.put((KeyStroke) blueAction.getValue(Action.ACCELERATOR_KEY), "blueAction");
    actionMap.put("blueAction", blueAction);
   
    inputMap.put((KeyStroke) blackAction.getValue(Action.ACCELERATOR_KEY), "blackAction");
    actionMap.put("blackAction", blackAction);
   
    inputMap.put((KeyStroke) defaultColorAction.getValue(Action.ACCELERATOR_KEY), "defaultColorAction");
    actionMap.put("defaultColorAction", defaultColorAction);
   
    inputMap.put((KeyStroke) removeFormattingAction.getValue(Action.ACCELERATOR_KEY), "removeFormattingAction");
    actionMap.put("removeFormattingAction", removeFormattingAction);
   
    final Color nodeTextColor = parent.getForeground();
    textfield.setCaretColor(nodeTextColor);
    final StringBuilder ruleBuilder = new StringBuilder(100);
    ruleBuilder.append("body {");
    ruleBuilder.append("font-family: ").append(font.getFamily()).append(";");
    final int fontSize = Math.round(font.getSize() / UITools.FONT_SCALE_FACTOR);
    ruleBuilder.append("font-size: ").append(fontSize).append("pt;");
    if (font.isItalic()) {
      ruleBuilder.append("font-style: italic; ");
    }
    if (font.isBold()) {
      ruleBuilder.append("font-weight: bold; ");
    }
    ruleBuilder.append("color: ").append(ColorUtils.colorToString(nodeTextColor)).append(";");
      final Color bgColor = getBackground();
    ruleBuilder.append("background-color: ").append(ColorUtils.colorToString(bgColor)).append(";");
    ruleBuilder.append("}\n");
    final HTMLDocument document = (HTMLDocument) textfield.getDocument();
    final StyleSheet styleSheet = document.getStyleSheet();
    styleSheet.addRule(ruleBuilder.toString());
    textfield.setText(text);
    final MapView mapView = (MapView) viewController.getMapViewComponent();
    if(! mapView.isValid())
      mapView.validate();
    final NodeStyleController nsc = NodeStyleController.getController(modeController);
    maxWidth = nsc.getMaxWidth(node);
    final Icon icon = parent.getIcon();
View Full Code Here

        final NodeModel node = selection.getSelected();
        setStyle(node);
            }
     
    });
    final IMapViewManager mapViewManager = controller.getMapViewManager();
    mapViewManager.addMapViewChangeListener(new IMapViewChangeListener() {
      public void beforeViewChange(final Component oldView, final Component newView) {
      }

      public void afterViewCreated(final Component mapView) {
      }
View Full Code Here

  public void afterViewChange(final Component oldView, final Component newView) {
    if (newView == null) {
      updateMenus();
      return;
    }
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final MapModel map = mapViewManager.getModel(newView);
    final String restoreString = getRestoreable(map);
    updateList(map, restoreString);
  }
View Full Code Here

      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);
          mapViewManager.close(true);
          Controller.setCurrentController(AEditStylesAction.this.controller);
          super.componentHidden(e);
          switch (modeController.getStatus()) {
            case JOptionPane.OK_OPTION:
              if (undoHandler.canUndo()) {
View Full Code Here

  public void setStatus(int status) {
     this.status = status;
    }
 
  void tryToCloseDialog() {
      final IMapViewManager mapViewManager = getController().getMapViewManager();
      final MapModel map = mapViewManager.getModel();
      final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
      final Window dialog = ((DialogController) getController().getViewController()).getDialog();
      if (! undoHandler.canUndo()){
        dialog.setVisible(false);
        return;
View Full Code Here

TOP

Related Classes of org.freeplane.features.ui.IMapViewManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.