|
||||||||||
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.dialogs.LayerListDialog.LayerListModel
public class LayerListDialog.LayerListModel
The layer list model. The model manages a list of layers and provides methods for
moving layers up and down, for toggling their visibility, and for activating a layer.
The model is a TableModel
and it provides a ListSelectionModel
. It expects
to be configured with a DefaultListSelectionModel
. The selection model is used
to update the selection state of views depending on messages sent to the model.
The model manages a list of LayerListDialog.LayerListModelListener
which are mainly notified if
the model requires views to make a specific list entry visible.
It also listens to PropertyChangeEvent
s of every Layer
it manages, in particular to
the properties Layer.VISIBLE_PROP
and Layer.NAME_PROP
.
Field Summary | |
---|---|
private java.util.concurrent.CopyOnWriteArrayList<LayerListDialog.LayerListModelListener> |
listeners
|
private javax.swing.DefaultListSelectionModel |
selectionModel
manages list selection state |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
private |
LayerListDialog.LayerListModel(javax.swing.DefaultListSelectionModel selectionModel)
constructor |
Method Summary | |
---|---|
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed. |
void |
addLayerListModelListener(LayerListDialog.LayerListModelListener listener)
Adds a listener to this model |
boolean |
canMoveDown()
Replies true if the currently selected layers can move down by one position |
boolean |
canMoveUp()
Replies true if the currently selected layers can move up by one position |
protected void |
ensureActiveSelected()
Ensures that at least one layer is selected in the layer dialog |
protected void |
ensureSelectedIsVisible()
Make sure the first of the selected layers is visible in the views of this model. |
protected void |
fireMakeVisible(int index,
Layer layer)
Fires a make visible event to listeners |
protected void |
fireRefresh()
Fires a refresh event to listeners of this model |
protected Layer |
getActiveLayer()
Replies the active layer. |
int |
getColumnCount()
|
Layer |
getFirstLayer()
Replies the first layer. |
Layer |
getLayer(int index)
Replies the layer at position index |
java.util.List<Layer> |
getLayers()
Replies the list of layers currently managed by MapView . |
java.util.List<Layer> |
getPossibleMergeTargets(Layer source)
Replies a list of layers which are possible merge targets for source |
int |
getRowCount()
|
java.util.List<Layer> |
getSelectedLayers()
Replies the list of currently selected layers. |
java.util.List<java.lang.Integer> |
getSelectedRows()
Replies a the list of indices of the selected rows. |
java.lang.Object |
getValueAt(int row,
int col)
|
boolean |
isCellEditable(int row,
int col)
|
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. |
void |
moveDown()
Move down the currently selected layers by one position |
void |
moveUp()
Move up the currently selected layers by one position |
protected void |
onAddLayer(Layer layer)
Invoked when a layer managed by MapView is added |
protected void |
onRemoveLayer(Layer layer)
Invoked if a layer managed by MapView is removed |
void |
populate()
Populates the model with the current layers managed by MapView . |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
|
void |
removeLayerListModelListener(LayerListDialog.LayerListModelListener listener)
removes a listener from this model |
void |
setSelectedLayer(Layer layer)
Marks layer as selected layer. |
void |
setValueAt(java.lang.Object value,
int row,
int col)
|
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 |
---|
private javax.swing.DefaultListSelectionModel selectionModel
private java.util.concurrent.CopyOnWriteArrayList<LayerListDialog.LayerListModelListener> listeners
Constructor Detail |
---|
private LayerListDialog.LayerListModel(javax.swing.DefaultListSelectionModel selectionModel)
selectionModel
- the list selection modelMethod Detail |
---|
public void addLayerListModelListener(LayerListDialog.LayerListModelListener listener)
listener
- the listenerpublic void removeLayerListModelListener(LayerListDialog.LayerListModelListener listener)
listener
- the listenerprotected void fireMakeVisible(int index, Layer layer)
index
- the index of the row to make visiblelayer
- the layer at this indexLayerListDialog.LayerListModelListener.makeVisible(int, Layer)
protected void fireRefresh()
LayerListDialog.LayerListModelListener.refresh()
public void populate()
MapView
.
public void setSelectedLayer(Layer layer)
layer
as selected layer. Ignored, if
layer is null.
layer
- the layer.public java.util.List<Layer> getSelectedLayers()
public java.util.List<java.lang.Integer> getSelectedRows()
protected void onRemoveLayer(Layer layer)
MapView
is removed
layer
- the layer which is removedprotected void onAddLayer(Layer layer)
MapView
is added
layer
- the layerpublic Layer getFirstLayer()
public Layer getLayer(int index)
index
index
- the index
index
. Null,
if index is out of range.public boolean canMoveUp()
public void moveUp()
public boolean canMoveDown()
public void moveDown()
protected void ensureSelectedIsVisible()
public java.util.List<Layer> getPossibleMergeTargets(Layer source)
source
source
- the source layer
source
. Never null, but can be empty.public java.util.List<Layer> getLayers()
MapView
.
Never null, but can be empty.
MapView
.
Never null, but can be empty.protected void ensureActiveSelected()
protected Layer getActiveLayer()
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int row, int col)
getValueAt
in interface javax.swing.table.TableModel
public boolean isCellEditable(int row, int col)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
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 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 void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |