| 384 | |
| 385 | private class ImageryTableCellRenderer extends DefaultTableCellRenderer { |
| 386 | |
| 387 | private List<ImageryInfo> layers; |
| 388 | |
| 389 | public ImageryTableCellRenderer(List<ImageryInfo> layers) { |
| 390 | this.layers = layers; |
| 391 | } |
| 392 | |
| 393 | @Override |
| 394 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
| 395 | JLabel label = (JLabel) super.getTableCellRendererComponent( |
| 396 | table, value, isSelected, hasFocus, row, column); |
| 397 | String t = value.toString(); |
| 398 | label.setBackground(Main.pref.getUIColor("Table.background")); |
| 399 | if (isSelected) { |
| 400 | label.setForeground(Main.pref.getUIColor("Table.foreground")); |
| 401 | } |
| 402 | for(ImageryInfo l : layers) |
| 403 | { |
| 404 | if(l.getExtendedUrl().equals(t)) { |
| 405 | label.setBackground(Main.pref.getColor( |
| 406 | marktr("Imagery Background: Default"), |
| 407 | new Color(200,255,200))); |
| 408 | break; |
| 409 | } |
| 410 | } |
| 411 | return label; |
| 412 | } |
| 413 | } |
428 | | mod.getColumn(2).setCellRenderer(new DefaultTableCellRenderer() { |
429 | | @Override |
430 | | public Component getTableCellRendererComponent(JTable table, |
431 | | Object value, boolean isSelected, boolean hasFocus, int row, |
432 | | int column) { |
433 | | JLabel label = (JLabel) super.getTableCellRendererComponent( |
434 | | table, value, isSelected, hasFocus, row, column); |
435 | | String t = value.toString(); |
436 | | label.setBackground(Main.pref.getUIColor("Table.background")); |
437 | | for(ImageryInfo l : layerInfo.getLayers()) |
438 | | { |
439 | | if(l.getExtendedUrl().equals(t)) { |
440 | | label.setBackground(Main.pref.getColor( |
441 | | marktr("Imagery Background: Default"), |
442 | | new Color(200,255,200))); |
443 | | break; |
444 | | } |
445 | | } |
446 | | return label; |
447 | | }; |
448 | | }); |
| 461 | mod.getColumn(2).setCellRenderer(new ImageryTableCellRenderer(layerInfo.getLayers())); |
455 | | mod.getColumn(1).setCellRenderer(new DefaultTableCellRenderer() { |
456 | | @Override |
457 | | public Component getTableCellRendererComponent(JTable table, |
458 | | Object value, boolean isSelected, boolean hasFocus, int row, |
459 | | int column) { |
460 | | JLabel label = (JLabel) super.getTableCellRendererComponent( |
461 | | table, value, isSelected, hasFocus, row, column); |
462 | | String t = value.toString(); |
463 | | label.setBackground(Main.pref.getUIColor("Table.background")); |
464 | | for(ImageryInfo l : layerInfo.getDefaultLayers()) |
465 | | { |
466 | | if(l.getExtendedUrl().equals(t)) { |
467 | | label.setBackground(Main.pref.getColor( |
468 | | marktr("Imagery Background: Default"), |
469 | | new Color(200,255,200))); |
470 | | break; |
471 | | } |
472 | | } |
473 | | return label; |
474 | | }; |
475 | | }); |
| 468 | mod.getColumn(1).setCellRenderer(new ImageryTableCellRenderer(layerInfo.getDefaultLayers())); |