|
Last change
on this file since 86 was 86, checked in by imi, 20 years ago |
- added conflicts and resolve conflict dialog
This is one of those "changed everything" checkpoint.
|
|
File size:
948 bytes
|
| Line | |
|---|
| 1 | package org.openstreetmap.josm.gui;
|
|---|
| 2 |
|
|---|
| 3 | import java.awt.Component;
|
|---|
| 4 |
|
|---|
| 5 | import javax.swing.DefaultListCellRenderer;
|
|---|
| 6 | import javax.swing.JLabel;
|
|---|
| 7 | import javax.swing.JList;
|
|---|
| 8 |
|
|---|
| 9 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
|---|
| 10 | import org.openstreetmap.josm.data.osm.visitor.SelectionComponentVisitor;
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * Renderer that renders the objects from an OsmPrimitive as data.
|
|---|
| 14 | * @author imi
|
|---|
| 15 | */
|
|---|
| 16 | public class OsmPrimitivRenderer extends DefaultListCellRenderer {
|
|---|
| 17 |
|
|---|
| 18 | private SelectionComponentVisitor visitor = new SelectionComponentVisitor();
|
|---|
| 19 |
|
|---|
| 20 | @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
|---|
| 21 | Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
|---|
| 22 | if (c instanceof JLabel && value != null) {
|
|---|
| 23 | ((OsmPrimitive)value).visit(visitor);
|
|---|
| 24 | ((JLabel)c).setText(visitor.name);
|
|---|
| 25 | ((JLabel)c).setIcon(visitor.icon);
|
|---|
| 26 | }
|
|---|
| 27 | return c;
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.