Package org.freeplane.core.resources

Examples of org.freeplane.core.resources.ResourceController


    super("SetNoteWindowPosition." + position);
    this.position = position;
  };

  public void actionPerformed(final ActionEvent e) {
    final ResourceController resourceController = ResourceController.getResourceController();
    resourceController.setProperty("note_location", position);
    final ViewController viewController = Controller.getCurrentModeController().getController().getViewController();
    viewController.changeNoteWindowLocation();
  }
View Full Code Here


    viewController.changeNoteWindowLocation();
  }

  @Override
  public void setSelected() {
    final ResourceController resourceController = ResourceController.getResourceController();
    final boolean isSelected = resourceController.getProperty("note_location").equals(position);
    setSelected(isSelected);
  }
View Full Code Here

  private boolean transformMapWithXslt(final String xsltFileName, final File saveFile, final String areaCode,
                                         final Mode mode, String[] parameters) throws IOException,
            TransformerFactoryConfigurationError {
      final String map = getMapXml(mode);
    final StringReader reader = new StringReader(map);
    ResourceController resourceController = ResourceController.getResourceController();
    final URL xsltUrl = resourceController.getResource(xsltFileName);
    if (xsltUrl == null) {
      LogUtils.severe("Can't find " + xsltFileName + " as resource.");
      throw new IllegalArgumentException("Can't find " + xsltFileName + " as resource.");
    }
    final InputStream xsltFile = new BufferedInputStream(xsltUrl.openStream());
    final Source xsltSource = new StreamSource(xsltFile);
    final Result result = new StreamResult(saveFile);
    try {
      final TransformerFactory transFact = TransformerFactory.newInstance();
      final Transformer trans = transFact.newTransformer(xsltSource);
      trans.setParameter("destination_dir", saveFile.getName() + "_files/");
      trans.setParameter("area_code", areaCode);
      trans.setParameter("folding_type", resourceController.getProperty(
      "html_export_folding"));
      StringBuilder sb = new StringBuilder();
      for(String p : parameters){
        String value = resourceController.getProperty(p, null);
        if(value != null && ! value.equals(resourceController.getDefaultProperty(p))){
          sb.append(p);
          sb.append('=');
          sb.append(value);
          sb.append("$$$");
        }
View Full Code Here

    final String freeplaneUserDirectory = ResourceController.getResourceController().getFreeplaneUserDirectory();
    // applets have no user directory and no file access anyhow
    pathToFile = freeplaneUserDirectory == null ? null : freeplaneUserDirectory + File.separator + FORMATS_XML;
    locale = FormatUtils.getFormatLocaleFromResources();
    initPatternFormats();
        final ResourceController resourceController = ResourceController.getResourceController();
        resourceController.addPropertyChangeListener(this);
  }
View Full Code Here

  }

  public SimpleDateFormat getDefaultDateFormat() {
    if (defaultDateFormat != null)
      return defaultDateFormat;
    final ResourceController resourceController = ResourceController.getResourceController();

    // DateFormatParser cannot handle empty date format!
    fixEmptyDataFormatProperty(resourceController, RESOURCES_DATE_FORMAT, "SHORT");

    String datePattern = resourceController.getProperty(RESOURCES_DATE_FORMAT);
    defaultDateFormat = createDateFormat(datePattern);
    return defaultDateFormat;
  }
View Full Code Here

  }

  public SimpleDateFormat getDefaultDateTimeFormat() {
    if (defaultDateTimeFormat != null)
      return defaultDateTimeFormat;
    final ResourceController resourceController = ResourceController.getResourceController();

    // DateFormatParser cannot handle empty date format!
    fixEmptyDataFormatProperty(resourceController, RESOURCES_DATETIME_FORMAT, "SHORT,SHORT");

    String datetimePattern = resourceController.getProperty(RESOURCES_DATETIME_FORMAT);
    defaultDateTimeFormat = createDefaultDateTimeFormat(datetimePattern);
    return defaultDateTimeFormat;
  }
View Full Code Here

  }

  public DecimalFormat getDefaultNumberFormat() {
    if (defaultNumberFormat != null)
      return defaultNumberFormat;
      final ResourceController resourceController = ResourceController.getResourceController();

    // an empty number format does not make sense!
    fixEmptyDataFormatProperty(resourceController, RESOURCES_NUMBER_FORMAT, "#0.####");

    defaultNumberFormat = getDecimalFormat(resourceController.getProperty(RESOURCES_NUMBER_FORMAT));
      return defaultNumberFormat;
    }
View Full Code Here

  private void init() {
    if (spellCheckerInitialized == true) {
      return;
    }
    spellCheckerInitialized = true;
    final ResourceController resourceController = ResourceController.getResourceController();
    final File orthoDir = new File(resourceController.getResourceBaseDir(), "ortho");
    registerDictionaries(orthoDir);
    final File userOrthoDir = new File(resourceController.getFreeplaneUserDirectory(), "ortho");
    registerDictionaries(userOrthoDir);
    if (!spellCheckerEnabled) {
      return;
    }
    setSpellCheckOptions(resourceController);
    resourceController.addPropertyChangeListener(new IFreeplanePropertyListener() {
      public void propertyChanged(final String propertyName, final String newValue, final String oldValue) {
        if (propertyName.startsWith("spelling_opt")) {
          setSpellCheckOptions(resourceController);
        }
      }
    });
    String spellingLanguage = resourceController.getProperty(SPELLING_LANGUAGE, null);
    if (spellingLanguage == null) {
      spellingLanguage = resourceController.getLanguageCode();
    }
    if (!spellingLanguage.equals("disabled")) {
      SpellChecker.setLanguage(spellingLanguage);
    }
    languageChangeListener = new LanguageChangeListener() {
      public void languageChanged(final LanguageChangeEvent ev) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            final Locale currentLocale = ev.getCurrentLocale();
            if (currentLocale == null) {
              resourceController.setProperty(SPELLING_LANGUAGE, "disabled");
              return;
            }
            resourceController.setProperty(SPELLING_LANGUAGE, currentLocale.getLanguage());
          }
        });
      }
    };
    SpellChecker.addLanguageChangeLister(languageChangeListener);
View Full Code Here

      }
    });
    if (dictionaryList.length == 0) {
      return;
    }
    final ResourceController resourceController = ResourceController.getResourceController();
    SpellChecker.setUserDictionaryProvider(new FileUserDictionary(resourceController.getFreeplaneUserDirectory()));
    final StringBuilder availableLocales = new StringBuilder();
    for (int i = 0; i < dictionaryList.length; i++) {
      final String language = dictionaryList[i].substring("dictionary_".length(), "dictionary_".length() + 2);
      availableLocales.append(language);
      availableLocales.append(",");
View Full Code Here

    return Collections.unmodifiableList(new ArrayList<AddOnProperties>(installedAddOns));
  }

  public void registerInstalledAddOn(final AddOnProperties addOn) {
    installedAddOns.add(addOn);
    final ResourceController resourceController = ResourceController.getResourceController();
    if (addOn.getDefaultProperties() != null)
      resourceController.addDefaults(addOn.getDefaultProperties());
    if (addOn.getPreferencesXml() != null) {
      final ModeController modeController = Controller.getCurrentModeController();
      if (modeController instanceof MModeController) {
        ((MModeController)modeController).getOptionPanelBuilder().load(new StringReader(addOn.getPreferencesXml()));
      }
View Full Code Here

TOP

Related Classes of org.freeplane.core.resources.ResourceController

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.