|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
org.openstreetmap.josm.gui.tagging.TagEditorModel
public class TagEditorModel
TagEditorModel is a table model.
Nested Class Summary | |
---|---|
(package private) class |
TagEditorModel.SelectionStateMemento
|
Field Summary | |
---|---|
private javax.swing.DefaultListSelectionModel |
colSelectionModel
|
private boolean |
dirty
indicates whether the model is dirty |
static java.lang.String |
PROP_DIRTY
|
private java.beans.PropertyChangeSupport |
propChangeSupport
|
private javax.swing.DefaultListSelectionModel |
rowSelectionModel
|
protected java.util.ArrayList<TagModel> |
tags
the list holding the tags |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
TagEditorModel()
Creates a new tag editor model. |
|
TagEditorModel(javax.swing.DefaultListSelectionModel rowSelectionModel,
javax.swing.DefaultListSelectionModel colSelectionModel)
Creates a new tag editor model. |
Method Summary | |
---|---|
void |
add(java.lang.String name,
java.lang.String value)
adds a tag given by a name/value pair to the tag editor model. |
void |
add(TagModel tag)
adds a tag to the model |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
appendNewTag()
creates a new tag and appends it to the model |
void |
applyToPrimitive(Tagged primitive)
applies the current state of the tag editor model to a primitive |
void |
applyToTags(java.util.Map<java.lang.String,java.lang.String> tags)
applies the current state of the tag editor model to a map of tags |
void |
clear()
removes all tags in the model |
protected Command |
createDeleteTagsCommand(java.util.Collection<OsmPrimitive> primitives)
|
protected Command |
createUpdateTagCommand(java.util.Collection<OsmPrimitive> primitives,
TagModel tag)
|
void |
delete(java.lang.String name)
Deletes all tags with name name |
void |
deleteTagNames(int[] tagIndices)
deletes the names of the tags given by tagIndices |
void |
deleteTags(int[] tagIndices)
deletes the tags given by tagIndices |
void |
deleteTagValues(int[] tagIndices)
deletes the values of the tags given by tagIndices |
void |
ensureOneTag()
makes sure the model includes at least one (empty) tag |
protected void |
fireDirtyStateChanged(boolean oldValue,
boolean newValue)
|
TagModel |
get(int idx)
|
TagModel |
get(java.lang.String name)
replies the tag with name name ; null, if no such tag exists |
int |
getColumnCount()
|
javax.swing.DefaultListSelectionModel |
getColumnSelectionModel()
Replies the column selection model used by this tag editor model |
java.util.List<java.lang.String> |
getKeys()
replies the list of keys of the tags managed by this model |
int |
getRowCount()
|
javax.swing.DefaultListSelectionModel |
getRowSelectionModel()
Replies the row selection model used by this tag editor model |
TagCollection |
getTagCollection()
Replies the tags in this tag editor model as TagCollection . |
java.util.Map<java.lang.String,java.lang.String> |
getTags()
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
|
boolean |
includesTag(java.lang.String key)
checks whether the tag model includes a tag with a given key |
void |
initFromPrimitive(Tagged primitive)
initializes the model with the tags of an OSM primitive |
void |
initFromTags(java.util.Map<java.lang.String,java.lang.String> tags)
initializes the model with the tags of an OSM primitive |
void |
initFromTags(TagCollection tags)
Initializes the model with the tags in a tag collection. |
boolean |
isCellEditable(int row,
int col)
|
boolean |
isDirty()
replies true, if this model has been updated |
void |
prepend(TagModel tag)
|
void |
removeProperyChangeListener(java.beans.PropertyChangeListener listener)
|
protected void |
setDirty(boolean newValue)
|
void |
setValueAt(java.lang.Object value,
int row,
int col)
|
protected void |
sort()
sorts the current tags according alphabetical order of names |
void |
updateTagName(TagModel tag,
java.lang.String newName)
updates the name of a tag and sets the dirty state to true if the new name is different from the old name. |
void |
updateTagValue(TagModel tag,
java.lang.String newValue)
updates the value value of a tag and sets the dirty state to true if the new name is different from the old name |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROP_DIRTY
protected final java.util.ArrayList<TagModel> tags
private boolean dirty
private final java.beans.PropertyChangeSupport propChangeSupport
private javax.swing.DefaultListSelectionModel rowSelectionModel
private javax.swing.DefaultListSelectionModel colSelectionModel
Constructor Detail |
---|
public TagEditorModel()
JTable
with this model:
TagEditorModel model = new TagEditorModel(); TagTable tbl = new TagTabel(model);
getRowSelectionModel()
,
getColumnSelectionModel()
public TagEditorModel(javax.swing.DefaultListSelectionModel rowSelectionModel, javax.swing.DefaultListSelectionModel colSelectionModel) throws java.lang.IllegalArgumentException
rowSelectionModel
- the row selection model. Must not be null.colSelectionModel
- the column selection model. Must not be null.
java.lang.IllegalArgumentException
- thrown if rowSelectionModel
is null
java.lang.IllegalArgumentException
- thrown if colSelectionModel
is nullMethod Detail |
---|
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public javax.swing.DefaultListSelectionModel getRowSelectionModel()
public javax.swing.DefaultListSelectionModel getColumnSelectionModel()
public void removeProperyChangeListener(java.beans.PropertyChangeListener listener)
protected void fireDirtyStateChanged(boolean oldValue, boolean newValue)
protected void setDirty(boolean newValue)
public int getColumnCount()
public int getRowCount()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
public void setValueAt(java.lang.Object value, int row, int col)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
public void clear()
public void add(TagModel tag)
tag
- the tag. Must not be null.
java.lang.IllegalArgumentException
- thrown, if tag is nullpublic void prepend(TagModel tag)
public void add(java.lang.String name, java.lang.String value)
name yet, a new TagModel
is created
and append to this model.
If there is a tag with name name, value
is merged to the list
of values for this tag.
- Parameters:
name
- the name; converted to "" if nullvalue
- the value; converted to "" if null
public TagModel get(java.lang.String name)
name
; null, if no such tag exists
name
- the tag name
name
; null, if no such tag existspublic TagModel get(int idx)
public boolean isCellEditable(int row, int col)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
public void deleteTagNames(int[] tagIndices)
tagIndices
- a list of tag indicespublic void deleteTagValues(int[] tagIndices)
tagIndices
- the lit of tag indicespublic void delete(java.lang.String name)
name
name
- the name. Ignored if null.public void deleteTags(int[] tagIndices)
tagIndices
- the list of tag indicespublic void appendNewTag()
public void ensureOneTag()
public void initFromPrimitive(Tagged primitive)
primitive
- the OSM primitivepublic void initFromTags(java.util.Map<java.lang.String,java.lang.String> tags)
primitive
- the OSM primitivepublic void initFromTags(TagCollection tags)
tags
is null.
tags
- the tagspublic void applyToPrimitive(Tagged primitive)
primitive
- the primitivepublic void applyToTags(java.util.Map<java.lang.String,java.lang.String> tags)
tags
- the map of key/value pairspublic java.util.Map<java.lang.String,java.lang.String> getTags()
public TagCollection getTagCollection()
TagCollection
.
TagCollection
public boolean includesTag(java.lang.String key)
key
- the key
protected Command createUpdateTagCommand(java.util.Collection<OsmPrimitive> primitives, TagModel tag)
protected Command createDeleteTagsCommand(java.util.Collection<OsmPrimitive> primitives)
public java.util.List<java.lang.String> getKeys()
protected void sort()
public void updateTagName(TagModel tag, java.lang.String newName)
tag
- the tagnewName
- the new namepublic void updateTagValue(TagModel tag, java.lang.String newValue)
tag
- the tagnewValue
- the new valuepublic boolean isDirty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |