Class NameVisitor
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.util.NameVisitor
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
- Direct Known Subclasses:
MultipleNameVisitor
public class NameVisitor extends java.lang.Object implements OsmPrimitiveVisitor
Able to create a name and an icon for each data element.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
className
The name of the item classjava.lang.String
classNamePlural
The plural name of the item classjavax.swing.Icon
icon
The icon of this item.java.lang.String
name
The name of this item.
-
Constructor Summary
Constructors Constructor Description NameVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
setIcon(OsmPrimitive p)
javax.swing.JLabel
toLabel()
Returns an horizontalJLabel
with icon and name.void
visit(Node n)
If the node has a name-key or id-key, this is displayed.void
visit(Relation e)
Visiting call for relations.void
visit(Way w)
If the way has a name-key or id-key, this is displayed.
-
-
-
Field Detail
-
className
public java.lang.String className
The name of the item class
-
classNamePlural
public java.lang.String classNamePlural
The plural name of the item class
-
name
public java.lang.String name
The name of this item.
-
icon
public javax.swing.Icon icon
The icon of this item.
-
-
Constructor Detail
-
NameVisitor
public NameVisitor()
-
-
Method Detail
-
setIcon
protected void setIcon(OsmPrimitive p)
-
visit
public void visit(Node n)
If the node has a name-key or id-key, this is displayed. If not, (lat,lon) is displayed.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Parameters:
n
- The node to inspect.
-
visit
public void visit(Way w)
If the way has a name-key or id-key, this is displayed. If not, (x nodes) is displayed with x being the number of nodes in the way.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Parameters:
w
- The way to inspect.
-
visit
public void visit(Relation e)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for relations.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Parameters:
e
- The relation to inspect.
-
toLabel
public javax.swing.JLabel toLabel()
Returns an horizontalJLabel
with icon and name.- Returns:
- horizontal
JLabel
with icon and name
-
-