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)
Creates a panel for this preset.
|
java.util.Collection<OsmPrimitive> |
createSelection(java.util.Collection<OsmPrimitive> participants)
Removes all unsuitable OsmPrimitives from the given list
|
boolean |
evaluate(OsmPrimitive p)
Determines whether this preset matches the given primitive, i.e.,
whether the
type matches and the tags match. |
java.util.List<Tag> |
getChangedTags() |
private java.util.List<Tag> |
getDirectlyAppliedTags()
Returns the tags being directly applied (without UI element) by
Key items |
javax.swing.ImageIcon |
getIcon()
Returns the preset icon.
|
java.lang.String |
getLocaleName() |
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()
Determines whether a dialog can be shown for this preset, i.e., at least one tag can/must be set by the user.
|
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)
Determines whether this preset matches the parameters.
|
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 final 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
types - comma-separated primitive types ("node", "way", "relation" or "closedway")org.xml.sax.SAXException - if any SAX error occursTaggingPresetType.fromString(java.lang.String)public void setName_template(java.lang.String pattern) throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic void setName_template_filter(java.lang.String filter) throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionprivate java.util.List<Tag> getDirectlyAppliedTags()
Key itemspublic TaggingPreset.PresetPanel createPanel(java.util.Collection<OsmPrimitive> selected)
types.
This includes the elements from the individual items.selected - the selected primitivespublic boolean isShowable()
true if a dialog can be shown for this presetpublic java.lang.String suggestRoleForOsmPrimitive(OsmPrimitive osm)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic 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.LayerChangeListeneractiveLayerChange in interface MapView.LayerChangeListeneroldLayer - The previous active layernewLayer - The new activer layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListenerlayerAdded in interface MapView.LayerChangeListenernewLayer - The new added layerpublic void layerRemoved(Layer oldLayer)
MapView.LayerChangeListenerlayerRemoved in interface MapView.LayerChangeListeneroldLayer - The old removed layerpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean typeMatches(java.util.Collection<TaggingPresetType> t)
public boolean evaluate(OsmPrimitive p)
type matches and the tags match.evaluate in interface Predicate<OsmPrimitive>p - the primitivetrue if this preset matches the primitivepublic boolean matches(java.util.Collection<TaggingPresetType> t, java.util.Map<java.lang.String,java.lang.String> tags, boolean onlyShowable)
t - the preset types to include, see typeMatches(Collection)tags - the tags to perform matching on, see TaggingPresetItem.matches(Map)onlyShowable - whether the preset must be showabletrue if this preset matches the parameters.public java.lang.String getToolbarString()