public class TagEditHelper extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
TagEditHelper.AbstractTagsDialog |
protected class |
TagEditHelper.AddTagsDialog |
protected class |
TagEditHelper.EditTagDialog |
protected static interface |
TagEditHelper.IEditTagDialog
Extracted interface of
TagEditHelper.EditTagDialog . |
private static class |
TagEditHelper.RecentExisting
What to do with recent tags where keys already exist
|
private static class |
TagEditHelper.RefreshRecent
What to do after applying tag
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
changedKey |
(package private) static java.util.Comparator<AutoCompletionItem> |
DEFAULT_AC_ITEM_COMPARATOR |
static int |
DEFAULT_LRU_TAGS_NUMBER
Default number of recent tags
|
static int |
MAX_LRU_TAGS_NUMBER
Maximum number of recent tags
|
private java.lang.String |
objKey |
static BooleanProperty |
PROPERTY_FIX_TAG_LOCALE
Use English language for tag by default
|
static EnumProperty<TagEditHelper.RecentExisting> |
PROPERTY_RECENT_EXISTING
Preference setting for popup menu item "Recent tags with existing key"
|
static ListProperty |
PROPERTY_RECENT_TAGS
The preference storage of recent tags
|
static IntegerProperty |
PROPERTY_RECENT_TAGS_NUMBER
Number of recent tags
|
static EnumProperty<TagEditHelper.RefreshRecent> |
PROPERTY_REFRESH_RECENT
Preference setting for popup menu item "Refresh recent tags list after applying tag"
|
static BooleanProperty |
PROPERTY_REMEMBER_TAGS
Whether recent tags must be remembered
|
static StringProperty |
PROPERTY_TAGS_TO_IGNORE |
(package private) RecentTagCollection |
recentTags |
protected java.util.Collection<OsmPrimitive> |
sel |
private javax.swing.table.DefaultTableModel |
tagData |
private java.util.List<Tag> |
tags
Copy of recently added tags in sorted from newest to oldest order.
|
(package private) SearchSetting |
tagsToIgnore |
private javax.swing.JTable |
tagTable |
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> |
valueCount |
Constructor and Description |
---|
TagEditHelper(javax.swing.JTable tagTable,
javax.swing.table.DefaultTableModel propertyData,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> valueCount)
Constructs a new
TagEditHelper . |
Modifier and Type | Method and Description |
---|---|
void |
addTag()
Open the add selection dialog and add a new key/value to the table (and
to the dataset, of course).
|
private void |
cacheRecentTags()
Update cache of recent tags used for displaying tags.
|
(package private) boolean |
containsDataKey(java.lang.String key)
Determines if the given tag key is already used (by all selected primitives, not just some of them)
|
void |
editTag(int row,
boolean focusOnKey)
Edit the value in the tags table row.
|
protected TagEditHelper.AddTagsDialog |
getAddTagsDialog()
Returns a new
AddTagsDialog . |
private static java.util.List<java.lang.String> |
getAutocompletionKeys(java.lang.String key)
For a given key k, return a list of keys which are used as keys for
auto-completing values to increase the search space.
|
java.lang.String |
getChangedKey()
If during last editProperty call user changed the key name, this key will be returned
Elsewhere, returns null.
|
java.lang.String |
getDataKey(int viewRow)
Finds the key from given row of tag editor.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getDataValues(int viewRow)
Finds the values from given row of tag editor.
|
protected TagEditHelper.IEditTagDialog |
getEditTagDialog(int row,
boolean focusOnKey,
java.lang.String key) |
void |
loadTagsIfNeeded()
Load recently used tags from preferences if needed.
|
(package private) void |
loadTagsToIgnore() |
void |
resetChangedKey()
Reset last changed key.
|
void |
saveTagsIfNeeded()
Store recently used tags in preferences if needed.
|
private static void |
warnAboutParseError(SearchParseError parseError) |
private static boolean |
warnOverwriteKey(java.lang.String action,
java.lang.String togglePref)
Warns user about a key being overwritten.
|
private final javax.swing.JTable tagTable
private final javax.swing.table.DefaultTableModel tagData
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> valueCount
protected java.util.Collection<OsmPrimitive> sel
private java.lang.String changedKey
private java.lang.String objKey
static final java.util.Comparator<AutoCompletionItem> DEFAULT_AC_ITEM_COMPARATOR
public static final int DEFAULT_LRU_TAGS_NUMBER
public static final int MAX_LRU_TAGS_NUMBER
public static final BooleanProperty PROPERTY_FIX_TAG_LOCALE
public static final BooleanProperty PROPERTY_REMEMBER_TAGS
public static final IntegerProperty PROPERTY_RECENT_TAGS_NUMBER
public static final ListProperty PROPERTY_RECENT_TAGS
public static final StringProperty PROPERTY_TAGS_TO_IGNORE
public static final EnumProperty<TagEditHelper.RecentExisting> PROPERTY_RECENT_EXISTING
public static final EnumProperty<TagEditHelper.RefreshRecent> PROPERTY_REFRESH_RECENT
final RecentTagCollection recentTags
SearchSetting tagsToIgnore
public TagEditHelper(javax.swing.JTable tagTable, javax.swing.table.DefaultTableModel propertyData, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> valueCount)
TagEditHelper
.tagTable
- tag tablepropertyData
- table modelvalueCount
- tag value countpublic final java.lang.String getDataKey(int viewRow)
viewRow
- index of rowboolean containsDataKey(java.lang.String key)
key
- the key to checktrue
if the key is used by all selected primitives (key not unset for at least one primitive)public final java.util.Map<java.lang.String,java.lang.Integer> getDataValues(int viewRow)
viewRow
- index of rowpublic void addTag()
protected TagEditHelper.AddTagsDialog getAddTagsDialog()
AddTagsDialog
.AddTagsDialog
public void editTag(int row, boolean focusOnKey)
row
- The row of the table from which the value is edited.focusOnKey
- Determines if the initial focus should be set on key instead of valueprotected TagEditHelper.IEditTagDialog getEditTagDialog(int row, boolean focusOnKey, java.lang.String key)
public java.lang.String getChangedKey()
null
public void resetChangedKey()
private static java.util.List<java.lang.String> getAutocompletionKeys(java.lang.String key)
key
- the key kpublic void loadTagsIfNeeded()
void loadTagsToIgnore()
private static void warnAboutParseError(SearchParseError parseError)
public void saveTagsIfNeeded()
private void cacheRecentTags()
private static boolean warnOverwriteKey(java.lang.String action, java.lang.String togglePref)
action
- The action done by the user. Must state what key is changedtogglePref
- The preference to save the checkbox state totrue
if the user accepts to overwrite key, false
otherwise