Ignore:
Timestamp:
2008-12-23T15:07:05+01:00 (17 years ago)
Author:
stoecker
Message:

removed usage of tab stops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r1165 r1169  
    3434public class PreferenceDialog extends JTabbedPane {
    3535
    36         public final static Collection<PreferenceSetting> settings = new LinkedList<PreferenceSetting>();
     36    public final static Collection<PreferenceSetting> settings = new LinkedList<PreferenceSetting>();
    3737
    38         public boolean requiresRestart = false;
    39         public final RequireRestartAction requireRestartAction = new RequireRestartAction();
     38    public boolean requiresRestart = false;
     39    public final RequireRestartAction requireRestartAction = new RequireRestartAction();
    4040
    41         // some common tabs
    42         public final JPanel display = createPreferenceTab("display", tr("Display Settings"), tr("Various settings that influence the visual representation of the whole program."));
    43         public final JPanel connection = createPreferenceTab("connection", I18n.tr("Connection Settings"), I18n.tr("Connection Settings for the OSM server."));
    44         public final JPanel map = createPreferenceTab("map", I18n.tr("Map Settings"), I18n.tr("Settings for the map projection and data interpretation."));
    45         public final JPanel audio = createPreferenceTab("audio", I18n.tr("Audio Settings"), I18n.tr("Settings for the audio player and audio markers."));
     41    // some common tabs
     42    public final JPanel display = createPreferenceTab("display", tr("Display Settings"), tr("Various settings that influence the visual representation of the whole program."));
     43    public final JPanel connection = createPreferenceTab("connection", I18n.tr("Connection Settings"), I18n.tr("Connection Settings for the OSM server."));
     44    public final JPanel map = createPreferenceTab("map", I18n.tr("Map Settings"), I18n.tr("Settings for the map projection and data interpretation."));
     45    public final JPanel audio = createPreferenceTab("audio", I18n.tr("Audio Settings"), I18n.tr("Settings for the audio player and audio markers."));
    4646
    4747  public final javax.swing.JTabbedPane displaycontent = new javax.swing.JTabbedPane();
    4848
    49         /**
    50         * Construct a JPanel for the preference settings. Layout is GridBagLayout
    51         * and a centered title label and the description are added. The panel 
    52         * will be shown inside a {@link ScrollPane} 
    53         * @param icon The name of the icon.
    54         * @param title The title of this preference tab.
    55         * @param desc A description in one sentence for this tab. Will be displayed
    56          *              italic under the title.
    57         * @return The created panel ready to add other controls.
    58         */
    59         public JPanel createPreferenceTab(String icon, String title, String desc) {
    60                 return createPreferenceTab(icon, title, desc, true);
    61         }
     49    /**
     50    * Construct a JPanel for the preference settings. Layout is GridBagLayout
     51    * and a centered title label and the description are added. The panel
     52    * will be shown inside a {@link ScrollPane}
     53    * @param icon The name of the icon.
     54    * @param title The title of this preference tab.
     55    * @param desc A description in one sentence for this tab. Will be displayed
     56     *      italic under the title.
     57    * @return The created panel ready to add other controls.
     58    */
     59    public JPanel createPreferenceTab(String icon, String title, String desc) {
     60        return createPreferenceTab(icon, title, desc, true);
     61    }
    6262
    6363    /**
     
    6868     * @param desc A description in one sentence for this tab. Will be displayed
    6969     *      italic under the title.
    70      * @param inScrollPane if <code>true</code> the added tab will show scroll bars 
     70     * @param inScrollPane if <code>true</code> the added tab will show scroll bars
    7171     *        if the panel content is larger than the available space
    7272     * @return The created panel ready to add other controls.
     
    9393
    9494
    95         private final class RequireRestartAction implements ActionListener {
    96                 public void actionPerformed(ActionEvent e) {
    97                         requiresRestart = true;
    98                 }
    99         }
     95    private final class RequireRestartAction implements ActionListener {
     96        public void actionPerformed(ActionEvent e) {
     97            requiresRestart = true;
     98        }
     99    }
    100100
    101         public void ok() {
    102                 for (PreferenceSetting setting : settings)
    103                         setting.ok();
    104                 if (requiresRestart)
    105                         JOptionPane.showMessageDialog(Main.parent,tr("You have to restart JOSM for some settings to take effect."));
    106                 Main.parent.repaint();
    107         }
     101    public void ok() {
     102        for (PreferenceSetting setting : settings)
     103            setting.ok();
     104        if (requiresRestart)
     105            JOptionPane.showMessageDialog(Main.parent,tr("You have to restart JOSM for some settings to take effect."));
     106        Main.parent.repaint();
     107    }
    108108
    109         /**
    110         * If the dialog is closed with Ok, the preferences will be stored to the preferences-
    111         * file, otherwise no change of the file happens.
    112         */
    113         public PreferenceDialog() {
    114                 super(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT);
    115                 display.add(displaycontent, GBC.eol().fill(GBC.BOTH));
    116                 for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) {
    117                         try {
    118                     it.next().addGui(this);
     109    /**
     110    * If the dialog is closed with Ok, the preferences will be stored to the preferences-
     111    * file, otherwise no change of the file happens.
     112    */
     113    public PreferenceDialog() {
     114        super(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT);
     115        display.add(displaycontent, GBC.eol().fill(GBC.BOTH));
     116        for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) {
     117            try {
     118                it.next().addGui(this);
    119119            } catch (SecurityException e) {
    120                 it.remove();
     120                it.remove();
    121121            }
    122                 }
    123         }
     122        }
     123    }
    124124
    125         static {
    126                 // order is important!
    127                 settings.add(new DrawingPreference());
    128                 settings.add(new ColorPreference());
    129                 settings.add(new LafPreference());
    130                 settings.add(new LanguagePreference());
    131                 settings.add(new MapPaintPreference());
    132                 settings.add(new ServerAccessPreference());
    133                 settings.add(new FilePreferences());
    134                 settings.add(new ProxyPreferences());
    135                 settings.add(new ProjectionPreference());
    136                 settings.add(new TaggingPresetPreference());
    137                 settings.add(new PluginPreference());
    138                 settings.add(Main.toolbar);
    139                 settings.add(new AudioPreference());
    140                 settings.add(new ShortcutPreference());
     125    static {
     126        // order is important!
     127        settings.add(new DrawingPreference());
     128        settings.add(new ColorPreference());
     129        settings.add(new LafPreference());
     130        settings.add(new LanguagePreference());
     131        settings.add(new MapPaintPreference());
     132        settings.add(new ServerAccessPreference());
     133        settings.add(new FilePreferences());
     134        settings.add(new ProxyPreferences());
     135        settings.add(new ProjectionPreference());
     136        settings.add(new TaggingPresetPreference());
     137        settings.add(new PluginPreference());
     138        settings.add(Main.toolbar);
     139        settings.add(new AudioPreference());
     140        settings.add(new ShortcutPreference());
    141141
    142                 for (PluginProxy plugin : Main.plugins) {
    143                         PreferenceSetting p = plugin.getPreferenceSetting();
    144                         if (p != null)
    145                                 settings.add(p);
    146                 }
     142        for (PluginProxy plugin : Main.plugins) {
     143            PreferenceSetting p = plugin.getPreferenceSetting();
     144            if (p != null)
     145                settings.add(p);
     146        }
    147147
    148                 // always the last: advanced tab
    149                 settings.add(new AdvancedPreference());
    150         }
     148        // always the last: advanced tab
     149        settings.add(new AdvancedPreference());
     150    }
    151151}
Note: See TracChangeset for help on using the changeset viewer.