public class TaggingPreset extends javax.swing.AbstractAction implements MapView.LayerChangeListener, Predicate<OsmPrimitive>
Modifier and Type | Class and Description |
---|---|
private static class |
TaggingPreset.PresetDialog |
private static class |
TaggingPreset.PresetPanel |
class |
TaggingPreset.ToolbarButtonAction
Action that adds or removes the button on main toolbar
|
Modifier and Type | Field and Description |
---|---|
java.util.List<TaggingPresetItem> |
data |
static int |
DIALOG_ANSWER_APPLY |
static int |
DIALOG_ANSWER_CANCEL |
static int |
DIALOG_ANSWER_NEW_RELATION |
TaggingPresetMenu |
group |
java.lang.String |
iconName |
java.lang.String |
locale_name |
java.lang.String |
name |
java.lang.String |
name_context |
TemplateEntry |
nameTemplate |
SearchCompiler.Match |
nameTemplateFilter |
static java.lang.String |
OPTIONAL_TOOLTIP_TEXT |
private boolean |
originalSelectionEmpty
True whenever the original selection given into createSelection was empty
|
static java.lang.String |
PRESET_ICON_ERROR_MSG_PREFIX
Prefix of preset icon loading failure error message
|
boolean |
preset_name_label |
Roles |
roles |
java.util.Set<TaggingPresetType> |
types
The types as preparsed collection.
|
Constructor and Description |
---|
TaggingPreset()
Create an empty tagging preset.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
static Command |
createCommand(java.util.Collection<OsmPrimitive> sel,
java.util.List<Tag> changedTags) |
TaggingPreset.PresetPanel |
createPanel(java.util.Collection<OsmPrimitive> selected) |
java.util.Collection<OsmPrimitive> |
createSelection(java.util.Collection<OsmPrimitive> participants)
Removes all unsuitable OsmPrimitives from the given list
|
boolean |
evaluate(OsmPrimitive p)
Determines whether the object passes the test or not
|
java.util.List<Tag> |
getChangedTags() |
javax.swing.ImageIcon |
getIcon()
Returns the preset icon.
|
java.lang.String |
getLocaleName() |
static java.util.Collection<TaggingPreset> |
getMatchingPresets(java.util.Collection<TaggingPresetType> t,
java.util.Map<java.lang.String,java.lang.String> tags,
boolean onlyShowable) |
java.lang.String |
getName()
Returns the translated name of this preset, prefixed with the group names it belongs to.
|
java.lang.String |
getRawName()
Returns the non translated name of this preset, prefixed with the (non translated) group names it belongs to.
|
java.lang.String |
getToolbarString() |
boolean |
isShowable() |
void |
layerAdded(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
Notifies this listener that a layer has been removed.
|
boolean |
matches(java.util.Collection<TaggingPresetType> t,
java.util.Map<java.lang.String,java.lang.String> tags,
boolean onlyShowable) |
void |
setDisplayName()
Change the display name without changing the toolbar value.
|
void |
setIcon(java.lang.String iconName)
Called from the XML parser to set the icon.
|
void |
setName_template_filter(java.lang.String filter) |
void |
setName_template(java.lang.String pattern) |
void |
setType(java.lang.String types)
Called from the XML parser to set the types this preset affects.
|
int |
showDialog(java.util.Collection<OsmPrimitive> sel,
boolean showNewRelation) |
java.lang.String |
suggestRoleForOsmPrimitive(OsmPrimitive osm) |
private boolean |
supportsRelation() |
java.lang.String |
toString() |
boolean |
typeMatches(java.util.Collection<TaggingPresetType> t) |
protected void |
updateEnabledState() |
public static final int DIALOG_ANSWER_APPLY
public static final int DIALOG_ANSWER_NEW_RELATION
public static final int DIALOG_ANSWER_CANCEL
public static final java.lang.String OPTIONAL_TOOLTIP_TEXT
public static final java.lang.String PRESET_ICON_ERROR_MSG_PREFIX
public TaggingPresetMenu group
public java.lang.String name
public java.lang.String iconName
public java.lang.String name_context
public java.lang.String locale_name
public boolean preset_name_label
public java.util.Set<TaggingPresetType> types
public transient java.util.List<TaggingPresetItem> data
public transient TemplateEntry nameTemplate
public transient SearchCompiler.Match nameTemplateFilter
private boolean originalSelectionEmpty
public TaggingPreset()
public void setDisplayName()
public java.lang.String getLocaleName()
public java.lang.String getName()
public java.lang.String getRawName()
public final javax.swing.ImageIcon getIcon()
null
if none definedpublic void setIcon(java.lang.String iconName)
iconName
- icon namepublic void setType(java.lang.String types) throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if any SAX error occurspublic void setName_template(java.lang.String pattern) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void setName_template_filter(java.lang.String filter) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public TaggingPreset.PresetPanel createPanel(java.util.Collection<OsmPrimitive> selected)
public boolean isShowable()
public java.lang.String suggestRoleForOsmPrimitive(OsmPrimitive osm)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public int showDialog(java.util.Collection<OsmPrimitive> sel, boolean showNewRelation)
public java.util.Collection<OsmPrimitive> createSelection(java.util.Collection<OsmPrimitive> participants)
participants
- List of possible OsmPrimitives to tagpublic java.util.List<Tag> getChangedTags()
public static Command createCommand(java.util.Collection<OsmPrimitive> sel, java.util.List<Tag> changedTags)
private boolean supportsRelation()
protected final void updateEnabledState()
public void activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListener
activeLayerChange
in interface MapView.LayerChangeListener
oldLayer
- The previous active layernewLayer
- The new activer layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListener
layerAdded
in interface MapView.LayerChangeListener
newLayer
- The new added layerpublic void layerRemoved(Layer oldLayer)
MapView.LayerChangeListener
layerRemoved
in interface MapView.LayerChangeListener
oldLayer
- The old removed layerpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean typeMatches(java.util.Collection<TaggingPresetType> t)
public boolean evaluate(OsmPrimitive p)
Predicate
evaluate
in interface Predicate<OsmPrimitive>
p
- The object to evaluatetrue
if the object passes the test, false
otherwisepublic boolean matches(java.util.Collection<TaggingPresetType> t, java.util.Map<java.lang.String,java.lang.String> tags, boolean onlyShowable)
public static java.util.Collection<TaggingPreset> getMatchingPresets(java.util.Collection<TaggingPresetType> t, java.util.Map<java.lang.String,java.lang.String> tags, boolean onlyShowable)
public java.lang.String getToolbarString()