org.openstreetmap.josm.gui.preferences.display
Class ColorPreference

java.lang.Object
  extended by org.openstreetmap.josm.gui.preferences.display.ColorPreference
All Implemented Interfaces:
PreferenceSetting, SubPreferenceSetting

public class ColorPreference
extends java.lang.Object
implements SubPreferenceSetting


Nested Class Summary
static class ColorPreference.Factory
           
 
Field Summary
(package private)  javax.swing.JButton colorEdit
           
private  javax.swing.JTable colors
           
(package private)  javax.swing.JButton defaultSet
           
private  java.util.ArrayList<java.lang.String> del
           
(package private)  javax.swing.JButton remove
           
private  javax.swing.table.DefaultTableModel tableModel
           
 
Constructor Summary
ColorPreference()
           
 
Method Summary
 void addGui(PreferenceTabbedPane gui)
          Add the GUI elements to the dialog.
private  void fixColorPrefixes()
          Add all missing color entries.
 java.util.Map<java.lang.String,java.lang.String> getColorModel()
          Returns a map with the colors in the table (key = color name without prefix, value = html color code).
private  java.lang.String getName(java.lang.String o)
           
 TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui)
          Returns the preference setting (displayed in the specified preferences tab pane) that contains this preference setting.
 boolean isExpert()
          Called to know if the preferences tab has only to be displayed in expert mode.
(package private)  java.lang.Boolean isRemoveColor(int row)
           
 boolean ok()
          Called when OK is pressed to save the setting in the preferences file.
 void setColorModel(java.util.Map<java.lang.String,java.lang.String> colorMap)
          Set the colors to be shown in the preference table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableModel

private javax.swing.table.DefaultTableModel tableModel

colors

private javax.swing.JTable colors

del

private java.util.ArrayList<java.lang.String> del

colorEdit

javax.swing.JButton colorEdit

defaultSet

javax.swing.JButton defaultSet

remove

javax.swing.JButton remove
Constructor Detail

ColorPreference

public ColorPreference()
Method Detail

setColorModel

public void setColorModel(java.util.Map<java.lang.String,java.lang.String> colorMap)
Set the colors to be shown in the preference table. This method creates a table model if none exists and overwrites all existing values.

Parameters:
colorMap - the map holding the colors (key = color id (without prefixes, so only background; not color.background), value = html representation of the color.

getColorModel

public java.util.Map<java.lang.String,java.lang.String> getColorModel()
Returns a map with the colors in the table (key = color name without prefix, value = html color code).

Returns:
a map holding the colors.

getName

private java.lang.String getName(java.lang.String o)

addGui

public void addGui(PreferenceTabbedPane gui)
Description copied from interface: PreferenceSetting
Add the GUI elements to the dialog. The elements should be initialized after the current preferences.

Specified by:
addGui in interface PreferenceSetting

isRemoveColor

java.lang.Boolean isRemoveColor(int row)

fixColorPrefixes

private void fixColorPrefixes()
Add all missing color entries.


ok

public boolean ok()
Description copied from interface: PreferenceSetting
Called when OK is pressed to save the setting in the preferences file. Return true when restart is required.

Specified by:
ok in interface PreferenceSetting

isExpert

public boolean isExpert()
Description copied from interface: PreferenceSetting
Called to know if the preferences tab has only to be displayed in expert mode.

Specified by:
isExpert in interface PreferenceSetting
Returns:
true if the tab has only to be displayed in expert mode, false otherwise.

getTabPreferenceSetting

public TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui)
Description copied from interface: SubPreferenceSetting
Returns the preference setting (displayed in the specified preferences tab pane) that contains this preference setting.

Specified by:
getTabPreferenceSetting in interface SubPreferenceSetting


JOSM