Class TaginfoAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.gui.dialogs.properties.TaginfoAction
-
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
public class TaginfoAction extends AbstractAction
Launch browser with Taginfo statistics for selected object.- Since:
- 13521
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Supplier<String>
relationTypeSupplier
private static StringProperty
TAG_HISTORY_URL_PROP
private static StringProperty
TAGINFO_URL_PROP
protected String
taginfoUrl
private Supplier<Tag>
tagSupplier
-
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
-
Fields inherited from interface javax.swing.Action
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 Summary
Constructors Modifier Constructor Description private
TaginfoAction(String name, Supplier<Tag> tagSupplier, Supplier<String> relationTypeSupplier, String taginfoUrl)
TaginfoAction(Supplier<Tag> tagSupplier, Supplier<String> relationTypeSupplier)
Constructs a newTaginfoAction
.TaginfoAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String,Integer>> tagValuesSupplier, JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier)
Constructs a newTaginfoAction
with a given URL and optional name suffix.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(ActionEvent e)
private static String
encodeKeyValue(String string)
private static Supplier<String>
getRelationTypeSupplier(JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier)
String
getTaginfoUrlForRelationType(String type)
Returns the Taginfo URL for the given relation typeString
getTaginfoUrlForTag(Tag tag)
Returns the Taginfo URL for the given tag or key (if the tag value is null)private static Supplier<Tag>
getTagSupplier(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String,Integer>> tagValuesSupplier)
TaginfoAction
toTagHistoryAction()
Returns a new action which launches https://taghistory.raifer.tech/ for the given tagprivate static String
withoutTrailingSlash(String url)
TaginfoAction
withTaginfoUrl(String name, String taginfoUrl)
Returns a new action which launches the Taginfo instance from the given URL-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
TAGINFO_URL_PROP
private static final StringProperty TAGINFO_URL_PROP
-
TAG_HISTORY_URL_PROP
private static final StringProperty TAG_HISTORY_URL_PROP
-
tagSupplier
private final Supplier<Tag> tagSupplier
-
relationTypeSupplier
private final Supplier<String> relationTypeSupplier
-
taginfoUrl
protected final String taginfoUrl
-
-
Constructor Detail
-
TaginfoAction
private TaginfoAction(String name, Supplier<Tag> tagSupplier, Supplier<String> relationTypeSupplier, String taginfoUrl)
-
TaginfoAction
public TaginfoAction(Supplier<Tag> tagSupplier, Supplier<String> relationTypeSupplier)
Constructs a newTaginfoAction
.- Parameters:
tagSupplier
- Supplies the tag for which Taginfo should be openedrelationTypeSupplier
- Supplies a relation type for which Taginfo should be opened- Since:
- 16275
-
TaginfoAction
public TaginfoAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String,Integer>> tagValuesSupplier, JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier)
Constructs a newTaginfoAction
with a given URL and optional name suffix.- Parameters:
tagTable
- The tag table. Cannot be nulltagKeySupplier
- Finds the key from given row of tag table. Cannot be nulltagValuesSupplier
- Finds the values from given row of tag table (map of values and number of occurrences). Cannot be nullmembershipTable
- The membership table. Can be nullmemberValueSupplier
- Finds the parent relation from given row of membership table. Can be null- Since:
- 16597
-
-
Method Detail
-
getTagSupplier
private static Supplier<Tag> getTagSupplier(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String,Integer>> tagValuesSupplier)
-
getRelationTypeSupplier
private static Supplier<String> getRelationTypeSupplier(JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier)
-
actionPerformed
public void actionPerformed(ActionEvent e)
-
withoutTrailingSlash
private static String withoutTrailingSlash(String url)
-
getTaginfoUrlForTag
public String getTaginfoUrlForTag(Tag tag)
Returns the Taginfo URL for the given tag or key (if the tag value is null)- Parameters:
tag
- the tag- Returns:
- the Taginfo URL for the given tag or key
- Since:
- 16596
-
encodeKeyValue
private static String encodeKeyValue(String string)
-
getTaginfoUrlForRelationType
public String getTaginfoUrlForRelationType(String type)
Returns the Taginfo URL for the given relation type- Parameters:
type
- the relation type- Returns:
- the Taginfo URL for the given relation type
- Since:
- 16596
-
withTaginfoUrl
public TaginfoAction withTaginfoUrl(String name, String taginfoUrl)
Returns a new action which launches the Taginfo instance from the given URL- Parameters:
name
- the action's text as displayed on the menu (if it is added to a menu)taginfoUrl
- Taginfo URL- Returns:
- a new action which launches the Taginfo instance from the given URL
- Since:
- 16597
-
toTagHistoryAction
public TaginfoAction toTagHistoryAction()
Returns a new action which launches https://taghistory.raifer.tech/ for the given tag- Returns:
- a new action
- Since:
- 16596
-
-