Changeset 15211 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
- Timestamp:
- 2019-07-06T22:15:55+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r14214 r15211 3 3 4 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 8 import java.awt.Color; 7 9 import java.awt.Component; 8 10 import java.awt.Dimension; … … 42 44 import javax.swing.DefaultListModel; 43 45 import javax.swing.DefaultListSelectionModel; 44 import javax.swing.ImageIcon;45 46 import javax.swing.JButton; 46 47 import javax.swing.JCheckBox; … … 58 59 import javax.swing.ListCellRenderer; 59 60 import javax.swing.ListSelectionModel; 61 import javax.swing.UIManager; 60 62 import javax.swing.event.CellEditorListener; 61 63 import javax.swing.event.ChangeEvent; … … 74 76 import org.openstreetmap.josm.actions.ExtensionFileFilter; 75 77 import org.openstreetmap.josm.data.Version; 78 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 76 79 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 77 80 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; … … 1353 1356 static class SourceEntryListCellRenderer extends JLabel implements ListCellRenderer<ExtendedSourceEntry> { 1354 1357 1355 private final ImageIcon GREEN_CHECK = ImageProvider.getIfAvailable("misc", "green_check"); 1356 private final ImageIcon GRAY_CHECK = ImageProvider.getIfAvailable("misc", "gray_check"); 1358 private static final NamedColorProperty SOURCE_ENTRY_ACTIVE_BACKGROUND_COLOR = new NamedColorProperty( 1359 marktr("External resource entry: Active"), 1360 new Color(200, 255, 200)); 1361 private static final NamedColorProperty SOURCE_ENTRY_INACTIVE_BACKGROUND_COLOR = new NamedColorProperty( 1362 marktr("External resource entry: Inactive"), 1363 new Color(200, 200, 200)); 1364 1357 1365 private final Map<String, SourceEntry> entryByUrl = new HashMap<>(); 1358 1366 … … 1374 1382 setOpaque(true); 1375 1383 setToolTipText(value.getTooltip()); 1376 final SourceEntry sourceEntry = entryByUrl.get(value.url); 1377 setIcon(sourceEntry == null ? null : sourceEntry.active ? GREEN_CHECK : GRAY_CHECK); 1384 if (!isSelected) { 1385 final SourceEntry sourceEntry = entryByUrl.get(value.url); 1386 GuiHelper.setBackgroundReadable(this, sourceEntry == null ? UIManager.getColor("Table.background") : 1387 sourceEntry.active ? SOURCE_ENTRY_ACTIVE_BACKGROUND_COLOR.get() : SOURCE_ENTRY_INACTIVE_BACKGROUND_COLOR.get()); 1388 } 1389 final ImageSizes size = ImageSizes.TABLE; 1390 setIcon(value.icon == null ? ImageProvider.getEmpty(size) : value.icon.getImageIcon(size.getImageDimension())); 1378 1391 return this; 1379 1392 } … … 1475 1488 } else if ("version".equals(key)) { 1476 1489 last.version = value; 1490 } else if ("icon".equals(key) && last.icon == null) { 1491 last.icon = new ImageProvider(value).setOptional(true).getResource(); 1477 1492 } else if ("link".equals(key) && last.link == null) { 1478 1493 last.link = value;
Note:
See TracChangeset
for help on using the changeset viewer.