Package org.freeplane.features.mode

Examples of org.freeplane.features.mode.Controller


  final private String mTitleId;

  private OptionalDontShowMeAgainDialog( final String pMessageId, final String pTitleId,
                                        final String pPropertyName, final int pMessageType) {
//    this.controller = controller;
    Controller controller = Controller.getCurrentController();
    mParent = controller.getViewController().getFrame();
    final IMapSelection selection = controller.getSelection();
    if (selection != null) {
      mNode = selection.getSelected();
    }
    else {
      mNode = null;
View Full Code Here


    super("ConnectorColorAction");
    this.arrowLink = arrowLink;
  }

  public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MLinkController linkController = (MLinkController) LinkController.getController();
    final Color selectedColor = linkController.getColor(arrowLink);
    final Color color = ColorTracker.showCommonJColorChooserDialog(controller.getSelection()
        .getSelected(), (String) this.getValue(Action.NAME), selectedColor, linkController.getStandardConnectorColor());
    if(color != null){
      linkController.setConnectorColor(arrowLink, color);
    }
  }
View Full Code Here

    super("ExportBranchAction");
  }

  public void actionPerformed(final ActionEvent e) {
    final NodeModel existingNode = Controller.getCurrentModeController().getMapController().getSelectedNode();
    final Controller controller = Controller.getCurrentController();
    final MapModel parentMap = controller.getMap();
    if (parentMap == null || existingNode == null || existingNode.isRoot()) {
      controller.getViewController().err("Could not export branch.");
      return;
    }
    if (parentMap.getFile() == null) {
      controller.getViewController().out("You must save the current map first!");
      ((MModeController) Controller.getCurrentModeController()).save();
    }
    JFileChooser chooser;
    final File file = parentMap.getFile();
    if (file == null) {
      return;
    }
    chooser = new JFileChooser(file.getParentFile());
    chooser.setSelectedFile(new File(createFileName(TextController.getController().getShortText(existingNode))));
    if (((MFileManager) UrlManager.getController()).getFileFilter() != null) {
      chooser.addChoosableFileFilter(((MFileManager) UrlManager.getController())
          .getFileFilter());
    }
    final int returnVal = chooser.showSaveDialog(controller.getViewController().getContentPane());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File chosenFile = chooser.getSelectedFile();
      final String ext = FileUtils.getExtension(chosenFile.getName());
      if (!ext.equals(org.freeplane.features.url.UrlManager.FREEPLANE_FILE_EXTENSION_WITHOUT_DOT)) {
        chosenFile = new File(chosenFile.getParent(), chosenFile.getName()
                + org.freeplane.features.url.UrlManager.FREEPLANE_FILE_EXTENSION);
      }
      try {
        Compat.fileToUrl(chosenFile);
      }
      catch (final MalformedURLException ex) {
        UITools.errorMessage(TextUtils.getText("invalid_url"));
        return;
      }
      if (chosenFile.exists()) {
        final int overwriteMap = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(),
            TextUtils.getText("map_already_exists"), "Freeplane", JOptionPane.YES_NO_OPTION);
        if (overwriteMap != JOptionPane.YES_OPTION) {
          return;
        }
      }
View Full Code Here

    super("SaveAction");
  }

  public void actionPerformed(final ActionEvent e) {
    final boolean success = ((MModeController) Controller.getCurrentModeController()).save();
    final Controller controller = Controller.getCurrentController();
    if (success) {
      controller.getViewController().out(TextUtils.getText("saved"));
    }
    else {
      controller.getViewController().out(TextUtils.getText("saving_canceled"));
    }
    controller.getMapViewManager().setTitle();
  }
View Full Code Here

    controller.getMapViewManager().setTitle();
  }
 
  @Override
  public void setEnabled() {
    final Controller controller = Controller.getCurrentController();
    MapModel map = controller.getMap();
    setEnabled(map != null && ! map.isSaved() && ! map.isReadOnly());
  }
View Full Code Here

    Controller.getCurrentModeController().execute(unregistryActor, map);
  }

  @Override
  public void performReplaceAttributeValue(final String name, final String oldValue, final String newValue) {
    Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    ModeController modeController = controller.getModeController();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    final IActor actor = new ReplaceAttributeValueActor(registry, name, oldValue, newValue);
    Controller.getCurrentModeController().execute(actor, map);
    final IVisitor replacer = new AttributeChanger(name, oldValue, newValue);
    final Iterator iterator = new Iterator(replacer);
View Full Code Here

  }

  final static public void install() {
    final File[] dirs = { LoadAcceleratorPresetsAction.getAcceleratorsUserDirectory(),
            LoadAcceleratorPresetsAction.getAcceleratorsSysDirectory() };
    final Controller controller = Controller.getCurrentController();
    ModeController modecontroller = controller.getModeController(MModeController.MODENAME);
    final MenuBuilder menuBuilder = modecontroller.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    //TODO RIBBONS: impl. eventually
    for (final File dir : dirs) {
      final File[] fileList = dir.listFiles();
      if (fileList == null) {
        continue;
      }
      for (final File prop : fileList) {
        final String fileName = prop.getName();
        if (prop.isDirectory()) {
          continue;
        }
        if (!fileName.endsWith(".properties")) {
          continue;
        }
        try {
          final int propNameLength = fileName.lastIndexOf('.');
          final String propName = fileName.substring(0, propNameLength);
          final String key = "LoadAcceleratorPresetsAction." + propName;
          if (controller.getAction(key) == null) {
            final String title = TextUtils.getText(key + ".text", propName);
            final LoadAcceleratorPresetsAction loadAcceleratorPresetsAction = new LoadAcceleratorPresetsAction(
              prop.toURL(), key, title);
            controller.addAction(loadAcceleratorPresetsAction);
            menuBuilder.addAction("main_menu_new_load_accelerator_presets", key,
              loadAcceleratorPresetsAction, MenuBuilder.AS_CHILD);
          }
        }
        catch (final Exception e) {
View Full Code Here

   * @see
   * freeplane.controller.actions.ActorXml#act(freeplane.controller.actions.
   * generated.instance.XmlAction)
   */
  public void actionPerformed(final ActionEvent arg0) {
    final Controller controller = Controller.getCurrentController();
    final NodeModel nodeModel = controller.getSelection().getSelected();
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component node = viewController.getComponent(nodeModel);
    node.requestFocus();
    final MTextController textController = (MTextController) MTextController.getController();
    textController.editDetails(nodeModel, null, useDialog);
  }
View Full Code Here

    final int backupFileNumber = ResourceController.getResourceController().getIntProperty(BACKUP_FILE_NUMBER, 0);
    MFileManager.backupFile(file, backupFileNumber, BACKUP_EXTENSION);
  }

  private void createActions() {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    controller.addAction(new OpenAction());
    controller.addAction(new OpenURLMapAction());
    controller.addAction(new NewMapAction());
    final File userTemplates = defaultUserTemplateDir();
    userTemplates.mkdir();
    modeController.addAction(new NewMapFromTemplateAction("new_map_from_user_templates", userTemplates));
    modeController.addAction(new SaveAction());
    modeController.addAction(new SaveAsAction());
View Full Code Here

      file = startFile;
    }
    try {
      final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
      mapController.newUntitledMap(Compat.fileToUrl(file));
      final Controller controller = Controller.getCurrentController();
      final MapModel map = controller.getMap();
      final Object rootText = map.getRootNode().getUserObject();
      if(rootText instanceof NamedObject){
        map.getRootNode().setText(rootText.toString());
      }
      controller.getModeController().getMapController().setSaved(map, true);
      return map;
    }
    catch (Exception e) {
      handleLoadingException(e);
    }
View Full Code Here

TOP

Related Classes of org.freeplane.features.mode.Controller

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.