18 |
import java.beans.PropertyChangeListener; |
import java.beans.PropertyChangeListener; |
19 |
import java.util.Collection; |
import java.util.Collection; |
20 |
import java.util.HashSet; |
import java.util.HashSet; |
|
import java.util.Set; |
|
21 |
import java.util.Vector; |
import java.util.Vector; |
22 |
|
|
23 |
import javax.swing.event.EventListenerList; |
import javax.swing.event.EventListenerList; |
47 |
protected EventListenerList listenerList = new EventListenerList(); |
protected EventListenerList listenerList = new EventListenerList(); |
48 |
|
|
49 |
/** Holds the current selection (e.g. {@link Feature Features}). */ |
/** Holds the current selection (e.g. {@link Feature Features}). */ |
50 |
protected final Set<E> selectionObjects; |
protected final HashSet<E> selectionObjects; |
51 |
|
|
52 |
/** Holds the styled map whose selection is managed by this class. */ |
/** Holds the styled map whose selection is managed by this class. */ |
53 |
protected final StyledMapInterface<?> styledMap; |
protected final StyledMapInterface<?> styledMap; |
108 |
|
|
109 |
|
|
110 |
/** |
/** |
111 |
* Returns whether the current selection changes are a part of multiple |
* Returns whether the current selection change is a part of multiple |
112 |
* changes. If {@code true} {@link #refreshSelection()} has no effect |
* changes. If {@code true} {@link #refreshSelection()} has no effect |
113 |
* and no {@link StyledLayerSelectionEvent} is fired until |
* and no {@link StyledLayerSelectionEvent} is fired until |
114 |
* {@link #setValueIsAdjusting(boolean) setValueIsAdjusting(false)} |
* {@link #setValueIsAdjusting(boolean) setValueIsAdjusting(false)} |
119 |
} |
} |
120 |
|
|
121 |
/** |
/** |
122 |
* Sets whether the following selection changes are a part of multiple |
* Sets whether the following selection changes are part of multiple |
123 |
* changes. If {@code true} {@link #refreshSelection()} has no effect |
* changes. If {@code true} {@link #refreshSelection()} has no effect |
124 |
* and no {@link StyledLayerSelectionEvent} event is fired. |
* and no {@link StyledLayerSelectionEvent} event is fired. |
125 |
* If the value is set from {@code true} to {@code false} an automatic |
* If the value is set from {@code true} to {@code false} an automatic |
141 |
* @return {@code true} if selection has changed by calling this method |
* @return {@code true} if selection has changed by calling this method |
142 |
*/ |
*/ |
143 |
public boolean addSelection(E selectedObject) { |
public boolean addSelection(E selectedObject) { |
144 |
|
|
145 |
if ( selectionObjects.add(selectedObject) ) { |
if ( selectionObjects.add(selectedObject) ) { |
146 |
refreshSelection(); |
refreshSelection(); |
147 |
return true; |
return true; |