public class TaggingPreset extends 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 |
---|---|
List<TaggingPresetItem> |
data |
static int |
DIALOG_ANSWER_APPLY |
static int |
DIALOG_ANSWER_CANCEL |
static int |
DIALOG_ANSWER_NEW_RELATION |
TaggingPresetMenu |
group |
String |
locale_name |
String |
name |
String |
name_context |
TemplateEntry |
nameTemplate |
SearchCompiler.Match |
nameTemplateFilter |
static String |
OPTIONAL_TOOLTIP_TEXT |
private boolean |
originalSelectionEmpty
True whenever the original selection given into createSelection was empty
|
boolean |
preset_name_label |
TaggingPresetItems.Roles |
roles |
EnumSet<TaggingPresetType> |
types
The types as preparsed collection.
|
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
TaggingPreset()
Create an empty tagging preset.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
static Command |
createCommand(Collection<OsmPrimitive> sel,
List<Tag> changedTags) |
TaggingPreset.PresetPanel |
createPanel(Collection<OsmPrimitive> selected) |
Collection<OsmPrimitive> |
createSelection(Collection<OsmPrimitive> participants)
Removes all unsuitable OsmPrimitives from the given list
|
boolean |
evaluate(OsmPrimitive p)
Determines whether the object passes the test or not
|
List<Tag> |
getChangedTags() |
ImageIcon |
getIcon()
Returns the preset icon.
|
String |
getLocaleName() |
static Collection<TaggingPreset> |
getMatchingPresets(Collection<TaggingPresetType> t,
Map<String,String> tags,
boolean onlyShowable) |
String |
getName() |
String |
getRawName() |
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(Collection<TaggingPresetType> t,
Map<String,String> tags,
boolean onlyShowable) |
void |
setDisplayName()
Change the display name without changing the toolbar value.
|
void |
setIcon(String iconName)
Called from the XML parser to set the icon.
|
void |
setName_template_filter(String filter) |
void |
setName_template(String pattern) |
void |
setType(String types)
Called from the XML parser to set the types this preset affects.
|
int |
showDialog(Collection<OsmPrimitive> sel,
boolean showNewRelation) |
String |
suggestRoleForOsmPrimitive(OsmPrimitive osm) |
private boolean |
supportsRelation() |
String |
toString() |
boolean |
typeMatches(Collection<TaggingPresetType> t) |
protected void |
updateEnabledState() |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public static final int DIALOG_ANSWER_APPLY
public static final int DIALOG_ANSWER_NEW_RELATION
public static final int DIALOG_ANSWER_CANCEL
public TaggingPresetMenu group
public String name_context
public String locale_name
public boolean preset_name_label
public static final String OPTIONAL_TOOLTIP_TEXT
public EnumSet<TaggingPresetType> types
public List<TaggingPresetItem> data
public TaggingPresetItems.Roles roles
public TemplateEntry nameTemplate
public SearchCompiler.Match nameTemplateFilter
private boolean originalSelectionEmpty
public TaggingPreset()
public void setDisplayName()
public String getLocaleName()
public String getRawName()
public final ImageIcon getIcon()
null
if none definedpublic void setIcon(String iconName)
public void setType(String types) throws SAXException
SAXException
public void setName_template(String pattern) throws SAXException
SAXException
public void setName_template_filter(String filter) throws SAXException
SAXException
public TaggingPreset.PresetPanel createPanel(Collection<OsmPrimitive> selected)
public boolean isShowable()
public String suggestRoleForOsmPrimitive(OsmPrimitive osm)
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public int showDialog(Collection<OsmPrimitive> sel, boolean showNewRelation)
public Collection<OsmPrimitive> createSelection(Collection<OsmPrimitive> participants)
participants
- List of possible OsmPrimitives to tagpublic List<Tag> getChangedTags()
public static Command createCommand(Collection<OsmPrimitive> sel, 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 boolean typeMatches(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(Collection<TaggingPresetType> t, Map<String,String> tags, boolean onlyShowable)
public static Collection<TaggingPreset> getMatchingPresets(Collection<TaggingPresetType> t, Map<String,String> tags, boolean onlyShowable)
public String getToolbarString()