Class TLcyGenericMapManager<S extends ILcdView,T extends ILcdLayer>
- All Implemented Interfaces:
ILcdPropertyChangeSource
- Direct Known Subclasses:
TLcyLspMapManager
Manager of the ILcyGenericMapComponents that currently exist. A map manager offers
functionality to:
- retrieve all existing maps,
- listen to the creation of new maps,
- listen for the removal of existing maps,
- retrieve the active map or
- listen to changes in the active map.
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.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThe Default Constructor for TLcyGenericMapManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMapComponent(ILcyGenericMapComponent<S, T> aMapComponent) Adds the given map to thisTLcyGeneralMapManager.voidaddMapManagerListener(ILcyGenericMapManagerListener<? super S, ? super T> aMapManagerListener) Adds the givenILcyGeneralMapManagerListenerto thisTLcyGeneralMapManager.voidaddMapManagerListener(ILcyGenericMapManagerListener<? super S, ? super T> aListener, boolean aFireEventForExistingMaps) Adds the givenILcyGeneralMapManagerListenerto thisTLcyGeneralMapManager.voidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListenerto be notified when this object's properties change.booleancontainsMapComponent(ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent) Returnstruewhen the map componentaMapComponentis registered to this map manager.protected voidfireMapManagerEvent(TLcyGenericMapManagerEvent<S, T> aMapManagerEvent) Fires the given event to all associated listeners.protected voidfirePropertyChange(String aPropertyName, Object aOldValue, Object aNewValue) Fires a property change event.Returns null, or the activeILcyGenericMapComponent.getMapComponent(int aIndex) Returns theILcyGenericMapComponentat the given index.intReturns the number of currently existingILcyGenericMapComponents.Returns aListof the map components.voidremoveMapComponent(ILcyGenericMapComponent<S, T> aMapComponent) Removes the given map from thisTLcyGeneralMapManager.voidremoveMapManagerListener(ILcyGenericMapManagerListener<? super S, ? super T> aMapManagerListener) Removes the givenILcyGeneralMapManagerListenerto thisTLcyGeneralMapManager.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListenerfrom receiving property change events for this object.voidsetActiveMapComponent(ILcyGenericMapComponent<S, T> aActiveMapComponent) Sets the active map component.
-
Constructor Details
-
TLcyGenericMapManager
protected TLcyGenericMapManager()The Default Constructor for TLcyGenericMapManager.
-
-
Method Details
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceRegisters the given
PropertyChangeListenerto 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
ALcdWeakPropertyChangeListenerinstance as property change listener.- Specified by:
addPropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceDe-registers the given
PropertyChangeListenerfrom 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.- Specified by:
removePropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- the listener that should no longer be notified of changes of this object's properties- See Also:
-
firePropertyChange
Fires a property change event. This method must be invoked after a property has been changed.- Parameters:
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.
-
addMapManagerListener
public void addMapManagerListener(ILcyGenericMapManagerListener<? super S, ? super T> aMapManagerListener) Adds the givenILcyGeneralMapManagerListenerto thisTLcyGeneralMapManager.- Parameters:
aMapManagerListener- The listener to add.- See Also:
-
addMapManagerListener
public void addMapManagerListener(ILcyGenericMapManagerListener<? super S, ? super T> aListener, boolean aFireEventForExistingMaps) Adds the given
ILcyGeneralMapManagerListenerto thisTLcyGeneralMapManager.For every existing map a MAP_COMPONENT_ADDED event will be fired to
aListenerwhenaFireEventForExistingMapsistrue. 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.- Parameters:
aListener- The listener to be registeredaFireEventForExistingMaps-truewhenaListenermust be warned about all existing maps,falseotherwise- See Also:
-
removeMapManagerListener
public void removeMapManagerListener(ILcyGenericMapManagerListener<? super S, ? super T> aMapManagerListener) Removes the givenILcyGeneralMapManagerListenerto thisTLcyGeneralMapManager.- Parameters:
aMapManagerListener- The listener to remove.
-
getMapComponentCount
public int getMapComponentCount()Returns the number of currently existingILcyGenericMapComponents.- Returns:
- the number of currently existing
ILcyGenericMapComponents.
-
getMapComponent
Returns theILcyGenericMapComponentat the given index.- Parameters:
aIndex- the index of theILcyGenericMapComponentto return.- Returns:
- the
ILcyGenericMapComponentat the given index.
-
getMapComponents
Returns aListof the map components.- Returns:
- an unmodifiable
Listof the map components known to this manager. - Since:
- 2025.0
-
addMapComponent
Adds the given map to this
TLcyGeneralMapManager. Whenever a newILcyGenericMapComponentis instantiated, this method needs to be invoked. The responsibility to do this belongs to whoever created the map, for example theTLcyMapAddOn.Once an
ILcyGenericMapComponenthas 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
TLcyLspMapAddOnorTLcyMapAddOnfor a snippet on how to achieve this.- Parameters:
aMapComponent- TheILcyGenericMapComponentto add.
-
removeMapComponent
Removes the given map from this
TLcyGeneralMapManager. Whenever aILcyGenericMapComponentis removed, this method needs to be invoked. The responsibility to do this belongs to whoever disposed the map, for example theTLcyMapAddOn.Once an
ILcyGenericMapComponenthas 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
TLcyLspMapAddOnorTLcyMapAddOnfor a snippet on how to achieve this.- Parameters:
aMapComponent- TheILcyGenericMapComponentto remove.
-
fireMapManagerEvent
Fires the given event to all associated listeners.- Parameters:
aMapManagerEvent- The event to fire.
-
getActiveMapComponent
Returns null, or the activeILcyGenericMapComponent. 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.- Returns:
- null, or the active
ILcyGenericMapComponent.
-
setActiveMapComponent
Sets the active map component. This property is typically set by the responsible for the maps, for example theTLcyMapAddOn, as the user starts working on a different map. Fires a property change event.- Parameters:
aActiveMapComponent- The active map component, or null.
-
containsMapComponent
public boolean containsMapComponent(ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent) Returnstruewhen the map componentaMapComponentis registered to this map manager.- Parameters:
aMapComponent- The map component- Returns:
truewhen the map componentaMapComponentus registered to this map manager,falsein all other cases.
-