private void addMapCoordinateElement ( final MapCoordinateElement mapCoordinateElement ) { final String id = mapCoordinateElement . getId ( ) ; // create change listeners for the coordinate and the visibility and store them with the // marker's id. final ChangeListener < Coordinate > coordinateChangeListener = ( observable , oldValue , newValue ) -> moveMapCoordinateElementInMap ( id ) ; final ChangeListener < Boolean > visibileChangeListener = ( observable , oldValue , newValue ) -> setMarkerVisibleInMap ( id ) ; final ChangeListener < String > cssChangeListener = ( observable , oldValue , newValue ) -> setMapCoordinateElementCss ( id , newValue ) ; mapCoordinateElementListeners . put ( id , new MapCoordinateElementListener ( coordinateChangeListener , visibileChangeListener , cssChangeListener ) ) ; // observe the mapCoordinateElements position, visibility and cssClass with the listeners mapCoordinateElement . positionProperty ( ) . addListener ( coordinateChangeListener ) ; mapCoordinateElement . visibleProperty ( ) . addListener ( visibileChangeListener ) ; mapCoordinateElement . cssClassProperty ( ) . addListener ( cssChangeListener ) ; // keep a weak ref of the mapCoordinateELement mapCoordinateElements . put ( id , new WeakReference <> ( mapCoordinateElement , weakReferenceQueue ) ) ; }
sets up the internal information about a MapCoordinate Element .