Example #1
0
  static {
    // order is important!
    settingsFactory.add(new DisplayPreference.Factory());
    settingsFactory.add(new DrawingPreference.Factory());
    settingsFactory.add(new ColorPreference.Factory());
    settingsFactory.add(new LafPreference.Factory());
    settingsFactory.add(new LanguagePreference.Factory());
    settingsFactory.add(new ServerAccessPreference.Factory());
    settingsFactory.add(new MapPreference.Factory());
    settingsFactory.add(new ProjectionPreference.Factory());
    settingsFactory.add(new MapPaintPreference.Factory());
    settingsFactory.add(new TaggingPresetPreference.Factory());
    settingsFactory.add(new BackupPreference.Factory());
    if (!Main.applet) {
      settingsFactory.add(new PluginPreference.Factory());
    }
    settingsFactory.add(Main.toolbar);
    settingsFactory.add(new AudioPreference.Factory());
    settingsFactory.add(new ShortcutPreference.Factory());
    settingsFactory.add(new ValidatorPreference.Factory());
    settingsFactory.add(new RemoteControlPreference.Factory());
    settingsFactory.add(new ImageryPreference.Factory());

    PluginHandler.getPreferenceSetting(settingsFactory);

    // always the last: advanced tab
    settingsFactory.add(new AdvancedPreference.Factory());
  }
Example #2
0
 @Override
 public void actionPerformed(ActionEvent e) {
   // Select/unselect corresponding plugin in the model
   model.setPluginSelected(cb.pi.getName(), cb.isSelected());
   // Does the newly selected plugin require other plugins ?
   if (cb.isSelected() && cb.pi.requires != null) {
     // Select required plugins
     selectRequiredPlugins(cb.pi);
     // Alert user if plugin requirements are not met
     PluginHandler.checkRequiredPluginsPreconditions(
         PluginListPanel.this, model.getAvailablePlugins(), cb.pi, false);
   }
   // If the plugin has been unselected, was it required by other plugins still selected ?
   else if (!cb.isSelected()) {
     Set<String> otherPlugins = new HashSet<>();
     for (PluginInformation pi : model.getAvailablePlugins()) {
       if (!pi.equals(cb.pi) && pi.requires != null && model.isSelectedPlugin(pi.getName())) {
         for (String s : pi.getRequiredPlugins()) {
           if (s.equals(cb.pi.getName())) {
             otherPlugins.add(pi.getName());
             break;
           }
         }
       }
     }
     if (!otherPlugins.isEmpty()) {
       alertPluginStillRequired(PluginListPanel.this, cb.pi.getName(), otherPlugins);
     }
   }
 }
 private static Class<?> loadRendererClass(String className) {
   for (ClassLoader cl : PluginHandler.getResourceClassLoaders()) {
     try {
       return Class.forName(className, true, cl);
     } catch (final NoClassDefFoundError | ClassNotFoundException e) {
       Main.trace(e.getMessage());
     }
   }
   Main.error(
       tr("Failed to load map renderer class ''{0}''. The class wasn''t found.", className));
   return null;
 }
Example #4
0
  protected final JPanel buildMainPanel() {
    JPanel pnl = new JPanel();
    pnl.setLayout(new GridBagLayout());

    // adding the download tasks
    pnl.add(new JLabel(tr("Data Sources and Types:")), GBC.std().insets(5, 5, 1, 5));
    cbDownloadOsmData = new JCheckBox(tr("OpenStreetMap data"), true);
    cbDownloadOsmData.setToolTipText(
        tr("Select to download OSM data in the selected download area."));
    pnl.add(cbDownloadOsmData, GBC.std().insets(1, 5, 1, 5));
    cbDownloadGpxData = new JCheckBox(tr("Raw GPS data"));
    cbDownloadGpxData.setToolTipText(
        tr("Select to download GPS traces in the selected download area."));
    pnl.add(cbDownloadGpxData, GBC.eol().insets(5, 5, 1, 5));

    // hook for subclasses
    buildMainPanelAboveDownloadSelections(pnl);

    slippyMapChooser = new SlippyMapChooser();

    // predefined download selections
    downloadSelections.add(slippyMapChooser);
    downloadSelections.add(new BookmarkSelection());
    downloadSelections.add(new BoundingBoxSelection());
    downloadSelections.add(new PlaceSelection());
    downloadSelections.add(new TileSelection());

    // add selections from plugins
    PluginHandler.addDownloadSelection(downloadSelections);

    // now everybody may add their tab to the tabbed pane
    // (not done right away to allow plugins to remove one of
    // the default selectors!)
    for (DownloadSelection s : downloadSelections) {
      s.addGui(this);
    }

    pnl.add(tpDownloadAreaSelectors, GBC.eol().fill());

    try {
      tpDownloadAreaSelectors.setSelectedIndex(Main.pref.getInteger("download.tab", 0));
    } catch (Exception ex) {
      Main.pref.putInteger("download.tab", 0);
    }

    Font labelFont = sizeCheck.getFont();
    sizeCheck.setFont(labelFont.deriveFont(Font.PLAIN, labelFont.getSize()));

    cbNewLayer = new JCheckBox(tr("Download as new layer"));
    cbNewLayer.setToolTipText(
        tr(
            "<html>Select to download data into a new data layer.<br>"
                + "Unselect to download into the currently active data layer.</html>"));

    cbStartup = new JCheckBox(tr("Open this dialog on startup"));
    cbStartup.setToolTipText(
        tr(
            "<html>Autostart ''Download from OSM'' dialog every time JOSM is started.<br>You can open it manually from File menu or toolbar.</html>"));
    cbStartup.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            Main.pref.put("download.autorun", cbStartup.isSelected());
          }
        });

    pnl.add(cbNewLayer, GBC.std().anchor(GBC.WEST).insets(5, 5, 5, 5));
    pnl.add(cbStartup, GBC.std().anchor(GBC.WEST).insets(15, 5, 5, 5));

    pnl.add(sizeCheck, GBC.eol().anchor(GBC.EAST).insets(5, 5, 5, 2));

    if (!ExpertToggleAction.isExpert()) {
      JLabel infoLabel =
          new JLabel(
              tr(
                  "Use left click&drag to select area, arrows or right mouse button to scroll map, wheel or +/- to zoom."));
      pnl.add(infoLabel, GBC.eol().anchor(GBC.SOUTH).insets(0, 0, 0, 0));
    }
    return pnl;
  }