Package org.freeplane.features.map

Examples of org.freeplane.features.map.MapModel


    final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
    undoHandler.undo();
  }

  public void redo() {
    final MapModel map = Controller.getCurrentController().getMap();
    final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
    undoHandler.redo();
  }
View Full Code Here


      scriptContext.accessAll();
    return ProxyUtils.findAll(Controller.getCurrentController().getMap().getRootNode(), scriptContext, false);
    }

  public Map newMap() {
    final MapModel oldMap = Controller.getCurrentController().getMap();
    final MMapIO mapIO = (MMapIO) Controller.getCurrentModeController().getExtension(MapIO.class);
    final MapModel newMap = mapIO.newMapFromDefaultTemplate();
    restartTransaction(oldMap, newMap);
    return new MapProxy(newMap, scriptContext);
  }
View Full Code Here

    return new MapProxy(newMap, scriptContext);
  }

  public Map newMap(URL url) {
    try {
      final MapModel oldMap = Controller.getCurrentController().getMap();
      Controller.getCurrentModeController().getMapController().newMap(url);
      final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
      final String key = mapViewManager.checkIfFileIsAlreadyOpened(url);
      // make the map the current map even if it was already opened
      if (key == null || !mapViewManager.tryToChangeToMapView(key))
        throw new RuntimeException("map " + url + " does not seem to be opened");
      final MapModel newMap = mapViewManager.getModel();
      restartTransaction(oldMap, newMap);
      return new MapProxy(newMap, scriptContext);
    }
    catch (Exception e) {
      throw new RuntimeException("error on newMap", e);
View Full Code Here

    }
    userDefault.getParentFile().mkdirs();
    if(! userDefault.getParentFile().exists()){
      return;
    }
    MapModel defaultStyleMap = new MapModel();
    final File allUserTemplates = fm.defaultStandardTemplateDir();
    final File standardTemplate = new File(allUserTemplates, "standard.mm");
    try {
      fm.loadCatchExceptions(standardTemplate.toURL(), defaultStyleMap);
    }
    catch (Exception e) {
      LogUtils.warn(e);
      try {
        fm.loadCatchExceptions(ResourceController.getResourceController().getResource("/styles/viewer_standard.mm"), defaultStyleMap);
      }
      catch (Exception e2) {
        defaultStyleMap.createNewRoot();
        LogUtils.severe(e);
      }
    }
        final NodeStyleController nodeStyleController = NodeStyleController.getController(modeController);
        updateDefaultStyle(nodeStyleController, defaultStyleMap);
View Full Code Here

      super(NAME);
    }

  public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
    Component pane = createConditionalStylePane(map, conditionalStyleModel);
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.startTransaction();
    try{
View Full Code Here

    if(! file.exists()){
      return;
    }
    try {
          final URL url = Compat.fileToUrl(file);
      final MapModel map = controller.getMap();
      MapStyle mapStyleController = MapStyle.getController(modeController);
      mapStyleController.copyStyle(url, map, true);
        }
        catch (MalformedURLException e1) {
          e1.printStackTrace();
View Full Code Here

      styleSheet.removeStyle("body");
      styleSheet.removeStyle("p");
      // set default font for notes:
      final NodeStyleController style = Controller.getCurrentModeController().getExtension(
          NodeStyleController.class);
      MapModel map = Controller.getCurrentModeController().getController().getMap();
      if(map != null){
          final Font defaultFont;
          defaultFont = style.getDefaultFont(map, MapStyleModel.NOTE_STYLE);
          String rule = "body {";
          rule += "font-family: " + defaultFont.getFamily() + ";";
View Full Code Here

    throw new RuntimeException("Method not implemented");
  }

  public boolean changeToMapView(String mapViewDisplayName) {
    if(mapViewDisplayName != null && maps.containsKey(mapViewDisplayName)) {
      final MapModel nextMap = maps.get(mapViewDisplayName);
      MapModel oldMap = currentMap;
      for(IMapSelectionListener mapSelectionListener : mapSelectionListeners)
        mapSelectionListener.beforeMapChange(oldMap, nextMap);
      currentKey = mapViewDisplayName;
      currentMap = nextMap;
      for(IMapSelectionListener mapSelectionListener : mapSelectionListeners)
View Full Code Here

    createNodeStyleMap(rootNode);
    }

  void createStyleMap(final MapModel parentMap, MapStyleModel mapStyleModel, final String styleMapStr) {
    final ModeController modeController = Controller.getCurrentModeController();
    MapModel styleMap = new StyleMapModel();
    styleMap.createNewRoot();
    final MapReader mapReader = modeController.getMapController().getMapReader();
    final Reader styleReader = new StringReader(styleMapStr);
    NodeModel root;
        try {
          Map<Object, Object> hints = new HashMap<Object, Object>();
          hints.put(Hint.MODE, Mode.FILE);
          hints.put(NodeBuilder.FOLDING_LOADED, Boolean.TRUE);
      root = mapReader.createNodeTreeFromXml(styleMap, styleReader, hints);
      styleMap.setRoot(root);
      insertStyleMap(parentMap, styleMap);
      NodeModel predefinedStyleParentNode = getStyleNodeGroup(styleMap, STYLES_PREDEFINED);
      if(predefinedStyleParentNode == null){
        predefinedStyleParentNode = new NodeModel(styleMap);
        predefinedStyleParentNode.setUserObject(new StyleNamedObject(MapStyleModel.STYLES_PREDEFINED));
View Full Code Here

      super(NAME);
    }

  public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
    Component pane = createConditionalStylePane(map, conditionalStyleModel);
    Controller.getCurrentModeController().startTransaction();
    try{
      final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
View Full Code Here

TOP

Related Classes of org.freeplane.features.map.MapModel

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.