public class ColorPreference extends java.lang.Object implements SubPreferenceSetting, javax.swing.event.ListSelectionListener, javax.swing.event.TableModelListener
NamedColorProperty
Modifier and Type | Class and Description |
---|---|
private static class |
ColorPreference.ColorEntry |
private static class |
ColorPreference.ColorTableModel |
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 javax.swing.JButton |
remove |
private ColorPreference.ColorTableModel |
tableModel |
Constructor and Description |
---|
ColorPreference() |
Modifier and Type | Method and Description |
---|---|
void |
addGui(PreferenceTabbedPane gui)
Add the GUI elements to the dialog.
|
private static void |
fixColorPrefixes()
Add all missing color entries.
|
private static int |
getCategoryPriority(java.lang.String category) |
java.util.Map<java.lang.String,ColorInfo> |
getColors()
Returns a map with the colors in the table (key = preference key, value = color info).
|
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.
|
private static boolean |
isRemoveColor(ColorPreference.ColorEntry ce) |
boolean |
ok()
Called when OK is pressed to save the setting in the preferences file.
|
void |
setColors(java.util.Map<java.lang.String,ColorInfo> colorMap)
Set the colors to be shown in the preference table.
|
void |
tableChanged(javax.swing.event.TableModelEvent e) |
private void |
updateEnabledState() |
void |
valueChanged(javax.swing.event.ListSelectionEvent e) |
private ColorPreference.ColorTableModel tableModel
private javax.swing.JTable colors
private javax.swing.JButton colorEdit
private javax.swing.JButton defaultSet
private javax.swing.JButton remove
public ColorPreference()
public void setColors(java.util.Map<java.lang.String,ColorInfo> colorMap)
colorMap
- the map holding the colors
(key = preference key, value = ColorInfo
instance)private static int getCategoryPriority(java.lang.String category)
public java.util.Map<java.lang.String,ColorInfo> getColors()
public void addGui(PreferenceTabbedPane gui)
PreferenceSetting
addGui
in interface PreferenceSetting
gui
- the preferences tab paneprivate static boolean isRemoveColor(ColorPreference.ColorEntry ce)
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 panepublic void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged
in interface javax.swing.event.ListSelectionListener
public void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged
in interface javax.swing.event.TableModelListener
private void updateEnabledState()