Ignore:
Timestamp:
2012-02-19T18:43:41+01:00 (12 years ago)
Author:
stoecker
Message:

fix build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ColumbusCSV/src/org/openstreetmap/josm/plugins/columbusCSV/ColumbusCSVPreferences.java

    r27101 r27882  
    1616import static org.openstreetmap.josm.tools.I18n.tr;
    1717
    18 import java.awt.event.ItemEvent;
    19 import java.awt.event.ItemListener;
    20 
    2118import javax.swing.ButtonGroup;
    2219import javax.swing.JCheckBox;
     
    3128 * @author Oliver Wieland <oliver.wieland@online.de>
    3229 */
    33 public class ColumbusCSVPreferences implements PreferenceSetting, ItemListener {
    34         public static final String PREFIX = "columbuscsv.";
    35        
    36         /**
    37          * Show summary after import.
    38          */
    39         public static final String SHOW_SUMMARY = PREFIX + "import.showSummary";
    40         /**
    41          * Disable auto zoom after import.
    42          */
    43         public static final String ZOOM_AFTER_IMPORT = PREFIX + "import.dontZoomAfterImport";
    44         /**
    45          * If <tt>true</tt>, all DOP values (hdop, vdop, pdop) are ignored. If the V-900 runs in simple mode,
    46          * this setting has no effect.
    47          */
    48         public static final String IGNORE_VDOP = PREFIX + "import.ignoreVDOP";
    49         /**
    50          * Issue warning on missing audio files.
    51          */
    52         public static final String WARN_MISSING_AUDIO = PREFIX + "warn.missingAudio";
    53         /**
    54          * Issue warning on conversion errors.
    55          */
    56         public static final String WARN_CONVERSION_ERRORS = PREFIX + "warn.conversionErrors";
    57        
    58         /**
    59          * Ui elements for each flag.
    60          */
    61         private JCheckBox colCSVShowSummary = new JCheckBox(tr("Show summary after import"));
    62         private JCheckBox colCSVDontZoomAfterImport = new JCheckBox(tr("Do not zoom after import"));
    63         private JCheckBox colCSVIgnoreVDOP = new JCheckBox(tr("Ignore hdop/vdop/pdop entries"));
    64         private JCheckBox colCSVWarnMissingAudio = new JCheckBox(tr("Warn on missing audio files"));
    65         private JCheckBox colCSVWarnConversionErrors = new JCheckBox(tr("Warn on conversion errors"));
    66        
    67         /**
    68          * Creates a new preferences instance.
    69          */
    70         public ColumbusCSVPreferences() {
    71                 super();
    72        
    73         }
     30public class ColumbusCSVPreferences implements PreferenceSetting {
     31    public static final String PREFIX = "columbuscsv.";
     32   
     33    /**
     34     * Show summary after import.
     35     */
     36    public static final String SHOW_SUMMARY = PREFIX + "import.showSummary";
     37    /**
     38     * Disable auto zoom after import.
     39     */
     40    public static final String ZOOM_AFTER_IMPORT = PREFIX + "import.dontZoomAfterImport";
     41    /**
     42     * If <tt>true</tt>, all DOP values (hdop, vdop, pdop) are ignored. If the V-900 runs in simple mode,
     43     * this setting has no effect.
     44     */
     45    public static final String IGNORE_VDOP = PREFIX + "import.ignoreVDOP";
     46    /**
     47     * Issue warning on missing audio files.
     48     */
     49    public static final String WARN_MISSING_AUDIO = PREFIX + "warn.missingAudio";
     50    /**
     51     * Issue warning on conversion errors.
     52     */
     53    public static final String WARN_CONVERSION_ERRORS = PREFIX + "warn.conversionErrors";
     54   
     55    /**
     56     * Ui elements for each flag.
     57     */
     58    private JCheckBox colCSVShowSummary = new JCheckBox(tr("Show summary after import"));
     59    private JCheckBox colCSVDontZoomAfterImport = new JCheckBox(tr("Do not zoom after import"));
     60    private JCheckBox colCSVIgnoreVDOP = new JCheckBox(tr("Ignore hdop/vdop/pdop entries"));
     61    private JCheckBox colCSVWarnMissingAudio = new JCheckBox(tr("Warn on missing audio files"));
     62    private JCheckBox colCSVWarnConversionErrors = new JCheckBox(tr("Warn on conversion errors"));
     63   
     64    /**
     65     * Creates a new preferences instance.
     66     */
     67    public ColumbusCSVPreferences() {
     68       super();
     69    }
    7470
    75         /**
    76          * Applies the (new) settings after settings dialog has been closed successfully.
    77          */
    78         public boolean ok() {
    79                 Main.pref.put(SHOW_SUMMARY, colCSVShowSummary.isSelected());
    80                 Main.pref.put(ZOOM_AFTER_IMPORT, colCSVDontZoomAfterImport.isSelected());
    81                 Main.pref.put(IGNORE_VDOP, colCSVIgnoreVDOP.isSelected());
    82                 Main.pref.put(WARN_CONVERSION_ERRORS, colCSVWarnConversionErrors.isSelected());
    83                 Main.pref.put(WARN_MISSING_AUDIO, colCSVWarnMissingAudio.isSelected());         
    84                 return false;
    85         }
    86        
    87         /**
    88          * Handles state changes of check buttons
    89          */
    90         public void itemStateChanged(ItemEvent itemEv) {
    91                 /*
    92                 if (itemEv.getSource() == colCSVShowSummary) {
    93                         colCSVWarnMissingAudio.setEnabled(colCSVIgnoreAudio.isSelected());
    94                 }*/
    95         }
     71    /**
     72     * Applies the (new) settings after settings dialog has been closed successfully.
     73     */
     74    @Override
     75    public boolean ok() {
     76        Main.pref.put(SHOW_SUMMARY, colCSVShowSummary.isSelected());
     77        Main.pref.put(ZOOM_AFTER_IMPORT, colCSVDontZoomAfterImport.isSelected());
     78        Main.pref.put(IGNORE_VDOP, colCSVIgnoreVDOP.isSelected());
     79        Main.pref.put(WARN_CONVERSION_ERRORS, colCSVWarnConversionErrors.isSelected());
     80        Main.pref.put(WARN_MISSING_AUDIO, colCSVWarnMissingAudio.isSelected());         
     81        return false;
     82    }
     83   
     84    /**
     85     * If <tt>true</tt>, a summary dialog is shown after import. Default is <tt>true</tt>.
     86     * @return
     87     */
     88    public static boolean showSummary() {
     89            return Main.pref.getBoolean(SHOW_SUMMARY, true);
     90    }
     91   
     92    /**
     93     * If <tt>true</tt>, a the bounding box will not be scaled to the imported data.
     94     * @return
     95     */
     96    public static boolean zoomAfterImport() {
     97            return Main.pref.getBoolean(ZOOM_AFTER_IMPORT, true);
     98    }
     99   
     100    /**
     101     * If <tt>true</tt>, all DOP values (hdop, vdop, pdop) are ignored. If the V-900 runs in simple mode,
     102     * this setting has no effect.
     103     * Default is <tt>false</tt>.
     104     * @return
     105     */
     106    public static boolean ignoreDOP() {
     107        return Main.pref.getBoolean(IGNORE_VDOP, false);
     108    }
     109   
     110    /**
     111     * If <tt>true</tt>, the plugin issues warnings if either date or position errors have been occurred.
     112     * Default is <tt>true</tt>.
     113     * @return
     114     */
     115    public static boolean warnConversion() {
     116        return Main.pref.getBoolean(WARN_CONVERSION_ERRORS, false);
     117    }
     118   
     119    /**
     120     * If <tt>true</tt>, the plugin issues a warning if a referenced audio file is missing.
     121     * Default is <tt>true</tt>.
     122     * @return
     123     */
     124    public static boolean warnMissingAudio() {
     125        return Main.pref.getBoolean(WARN_MISSING_AUDIO, false);
     126    }
    96127
    97         /**
    98          * If <tt>true</tt>, a summary dialog is shown after import. Default is <tt>true</tt>.
    99          * @return
    100          */
    101         public static boolean showSummary() {
    102                 return Main.pref.getBoolean(SHOW_SUMMARY, true);
    103         }
    104        
    105         /**
    106          * If <tt>true</tt>, a the bounding box will not be scaled to the imported data.
    107          * @return
    108          */
    109         public static boolean zoomAfterImport() {
    110                 return Main.pref.getBoolean(ZOOM_AFTER_IMPORT, true);
    111         }
    112        
    113         /**
    114          * If <tt>true</tt>, all DOP values (hdop, vdop, pdop) are ignored. If the V-900 runs in simple mode,
    115          * this setting has no effect.
    116          * Default is <tt>false</tt>.
    117          * @return
    118          */
    119         public static boolean ignoreDOP() {
    120                 return Main.pref.getBoolean(IGNORE_VDOP, false);
    121         }
    122        
    123         /**
    124          * If <tt>true</tt>, the plugin issues warnings if either date or position errors have been occurred.
    125          * Default is <tt>true</tt>.
    126          * @return
    127          */
    128         public static boolean warnConversion() {
    129                 return Main.pref.getBoolean(WARN_CONVERSION_ERRORS, false);
    130         }
    131        
    132         /**
    133          * If <tt>true</tt>, the plugin issues a warning if a referenced audio file is missing.
    134          * Default is <tt>true</tt>.
    135          * @return
    136          */
    137         public static boolean warnMissingAudio() {
    138                 return Main.pref.getBoolean(WARN_MISSING_AUDIO, false);
    139         }
    140 
    141         /**
    142          * Populates the UI with our settings.
    143          * @param gui The dialog to populate.
    144          */
    145         public void addGui(PreferenceDialog gui) {
    146                 addPrefs();
    147         }       
    148        
    149         /**
    150          * Populates the UI with our settings.
    151          * @param gui The pane to populate.
    152          */
    153         public void addGui(PreferenceTabbedPane gui) {
    154                 addPrefs();
    155         }
    156        
    157         private void addPrefs() {
    158                 // Import settings
     128    /**
     129     * Populates the UI with our settings.
     130     * @param gui The pane to populate.
     131     */
     132    @Override
     133    public void addGui(PreferenceTabbedPane gui) {
     134        // Import settings
    159135        ButtonGroup gpsImportGroup = new ButtonGroup();
    160136        gpsImportGroup.add(colCSVShowSummary);
    161137        gpsImportGroup.add(colCSVDontZoomAfterImport);
    162138        gpsImportGroup.add(colCSVIgnoreVDOP);
    163        
     139     
    164140        // Warning settings
    165141        ButtonGroup gpsWarningsGroup = new ButtonGroup();
     
    173149        colCSVWarnConversionErrors.setSelected(Main.pref.getBoolean(WARN_CONVERSION_ERRORS, true));
    174150        colCSVWarnMissingAudio.setSelected(Main.pref.getBoolean(WARN_MISSING_AUDIO, true));
    175         }
    176                        
     151    }
     152   
     153    @Override
     154    public boolean isExpert() {
     155        return false;
     156    }
    177157}
Note: See TracChangeset for help on using the changeset viewer.