public abstract class TLcyGenericMapManager<S extends ILcdView,T extends ILcdLayer> extends Object implements ILcdPropertyChangeSource
Manager of the ILcyGenericMapComponent
s that currently exist. A map manager offers
functionality to:
Whenever a new ILcyGenericMapComponent
is created, it needs to be added to the
TLcyGenericMapManager
. When a map is removed, it needs to be removed from the
TLcyGenericMapManager
. The responsibility to do this belongs to whoever created or
disposed the map, for example the TLcyMapAddOn
.
ILcyGenericMapComponent
Modifier | Constructor and Description |
---|---|
protected |
TLcyGenericMapManager()
The Default Constructor for TLcyGenericMapManager.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapComponent(ILcyGenericMapComponent<S,T> aMapComponent)
Adds the given map to this
TLcyGeneralMapManager . |
void |
addMapManagerListener(ILcyGenericMapManagerListener<? super S,? super T> aMapManagerListener)
Adds the given
ILcyGeneralMapManagerListener to this
TLcyGeneralMapManager . |
void |
addMapManagerListener(ILcyGenericMapManagerListener<? super S,? super T> aListener,
boolean aFireEventForExistingMaps)
Adds the given
ILcyGeneralMapManagerListener to this
TLcyGeneralMapManager . |
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers the given
PropertyChangeListener to be notified when this object's
properties change. |
boolean |
containsMapComponent(ILcyGenericMapComponent<? extends ILcdView,? extends ILcdLayer> aMapComponent)
Returns
true when the map component aMapComponent is registered to
this map manager. |
protected void |
fireMapManagerEvent(TLcyGenericMapManagerEvent<S,T> aMapManagerEvent)
Fires the given event to all associated listeners.
|
protected void |
firePropertyChange(String aPropertyName,
Object aOldValue,
Object aNewValue)
Fires a property change event.
|
ILcyGenericMapComponent<S,T> |
getActiveMapComponent()
Returns null, or the active
ILcyGenericMapComponent . |
ILcyGenericMapComponent<S,T> |
getMapComponent(int aIndex)
Returns the
ILcyGenericMapComponent at the given index. |
int |
getMapComponentCount()
Returns the number of currently existing
ILcyGenericMapComponent s. |
void |
removeMapComponent(ILcyGenericMapComponent<S,T> aMapComponent)
Removes the given map from this
TLcyGeneralMapManager . |
void |
removeMapManagerListener(ILcyGenericMapManagerListener<? super S,? super T> aMapManagerListener)
Removes the given
ILcyGeneralMapManagerListener to this
TLcyGeneralMapManager . |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
De-registers the given
PropertyChangeListener from receiving property change events
for this object. |
void |
setActiveMapComponent(ILcyGenericMapComponent<S,T> aActiveMapComponent)
Sets the active map component.
|
protected TLcyGenericMapManager()
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
ILcdPropertyChangeSource
Registers the given PropertyChangeListener
to be notified when this object's
properties change.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source,
you can use a ALcdWeakPropertyChangeListener
instance as property change listener.
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
ILcdPropertyChangeSource
De-registers the given PropertyChangeListener
from receiving property change events
for this object.
If the listener was added more than once, it will be notified one less time after being
removed.
If the listener is null
, or was never added, no exception is thrown and no action is taken.
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
protected void firePropertyChange(String aPropertyName, Object aOldValue, Object aNewValue)
aPropertyName
- The property name. First letter is lower case, unless there are at least
two capitals in the beginning. E.g. for setSelectedIndex, aPropertyName
must be "selectedIndex". For setXYWorldReference, aPropertyName must be
"XYWorldReference".aOldValue
- The old value of the property.aNewValue
- The new value of the property.public void addMapManagerListener(ILcyGenericMapManagerListener<? super S,? super T> aMapManagerListener)
ILcyGeneralMapManagerListener
to this
TLcyGeneralMapManager
.aMapManagerListener
- The listener to add.addMapManagerListener(ILcyGenericMapManagerListener, boolean)
public void addMapManagerListener(ILcyGenericMapManagerListener<? super S,? super T> aListener, boolean aFireEventForExistingMaps)
Adds the given ILcyGeneralMapManagerListener
to this
TLcyGeneralMapManager
.
For every existing map a MAP_COMPONENT_ADDED event will be fired to aListener
when
aFireEventForExistingMaps
is true
. A use-case for this is when you
want to use the listener to perform an action on any existing map and on all future maps.
aListener
- The listener to be registeredaFireEventForExistingMaps
- true
when aListener
must be warned
about all existing maps, false
otherwiseaddMapManagerListener(ILcyGenericMapManagerListener)
public void removeMapManagerListener(ILcyGenericMapManagerListener<? super S,? super T> aMapManagerListener)
ILcyGeneralMapManagerListener
to this
TLcyGeneralMapManager
.aMapManagerListener
- The listener to remove.public int getMapComponentCount()
ILcyGenericMapComponent
s.ILcyGenericMapComponent
s.public ILcyGenericMapComponent<S,T> getMapComponent(int aIndex)
ILcyGenericMapComponent
at the given index.aIndex
- the index of the ILcyGenericMapComponent
to return.ILcyGenericMapComponent
at the given index.public void addMapComponent(ILcyGenericMapComponent<S,T> aMapComponent)
Adds the given map to this TLcyGeneralMapManager
. Whenever a new
ILcyGenericMapComponent
is instantiated, this method needs to be invoked. The
responsibility to do this belongs to whoever created the map, for example the
TLcyMapAddOn
.
Once an ILcyGenericMapComponent
has been removed, it must not be re-added.
Note: normally you do not need to call this method yourself.
If you want to create new map components, consult the class javadoc of
TLcyLspMapAddOn
or TLcyMapAddOn
for a snippet on how to achieve this.
aMapComponent
- The ILcyGenericMapComponent
to add.public void removeMapComponent(ILcyGenericMapComponent<S,T> aMapComponent)
Removes the given map from this TLcyGeneralMapManager
. Whenever a
ILcyGenericMapComponent
is removed, this method needs to be invoked. The
responsibility to do this belongs to whoever disposed the map, for example the
TLcyMapAddOn
.
Once an ILcyGenericMapComponent
has been removed, it must not be re-added.
Note: normally you do not need to call this method yourself.
If you want to remove a map component from the UI, consult the class javadoc of
TLcyLspMapAddOn
or TLcyMapAddOn
for a snippet on how to achieve this.
aMapComponent
- The ILcyGenericMapComponent
to remove.protected void fireMapManagerEvent(TLcyGenericMapManagerEvent<S,T> aMapManagerEvent)
aMapManagerEvent
- The event to fire.public ILcyGenericMapComponent<S,T> getActiveMapComponent()
ILcyGenericMapComponent
. The active map is the one
that the user is working on, or has recently worked on. The active map component is typically
null if there are no maps.ILcyGenericMapComponent
.public void setActiveMapComponent(ILcyGenericMapComponent<S,T> aActiveMapComponent)
TLcyMapAddOn
, as the user starts working on a different map.
Fires a property change event.aActiveMapComponent
- The active map component, or null.public boolean containsMapComponent(ILcyGenericMapComponent<? extends ILcdView,? extends ILcdLayer> aMapComponent)
true
when the map component aMapComponent
is registered to
this map manager.aMapComponent
- The map componenttrue
when the map component aMapComponent
us registered to
this map manager, false
in all other cases.