public class ColorPreference extends java.lang.Object implements SubPreferenceSetting
Modifier and Type | Class and Description |
---|---|
static class |
ColorPreference.Factory
Factory used to create a new
ColorPreference . |
Modifier and Type | Field and Description |
---|---|
private javax.swing.JButton |
colorEdit |
private javax.swing.JTable |
colors |
private javax.swing.JButton |
defaultSet |
private java.util.List<java.lang.String> |
del |
private javax.swing.JButton |
remove |
private javax.swing.table.DefaultTableModel |
tableModel |
Constructor and Description |
---|
ColorPreference() |
Modifier and Type | Method and Description |
---|---|
private void |
addColorRows(java.util.Map<java.lang.String,java.lang.String> colorMap,
java.util.Map<java.lang.String,java.lang.String> keyMap) |
void |
addGui(PreferenceTabbedPane gui)
Add the GUI elements to the dialog.
|
private static 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 static 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.
|
private javax.swing.table.DefaultTableModel tableModel
private javax.swing.JTable colors
private final java.util.List<java.lang.String> del
private javax.swing.JButton colorEdit
private javax.swing.JButton defaultSet
private javax.swing.JButton remove
public ColorPreference()
public void setColorModel(java.util.Map<java.lang.String,java.lang.String> colorMap)
colorMap
- the map holding the colors
(key = color id (without prefixes, so only background
; not color.background
),
value = html representation of the color.private void addColorRows(java.util.Map<java.lang.String,java.lang.String> colorMap, java.util.Map<java.lang.String,java.lang.String> keyMap)
public java.util.Map<java.lang.String,java.lang.String> getColorModel()
private static java.lang.String getName(java.lang.String o)
public void addGui(PreferenceTabbedPane gui)
PreferenceSetting
addGui
in interface PreferenceSetting
gui
- the preferences tab panejava.lang.Boolean isRemoveColor(int row)
private static void fixColorPrefixes()
public boolean ok()
PreferenceSetting
ok
in interface PreferenceSetting
true
if restart is requiredpublic boolean isExpert()
PreferenceSetting
isExpert
in interface PreferenceSetting
public TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui)
SubPreferenceSetting
getTabPreferenceSetting
in interface SubPreferenceSetting
gui
- preferences tabbed pane