/** * If this instance's image source is a <code>BufferedImage</code>, creates and returns the texture, otherwise * creates a task in a separate thread to retrieve it from its local or remote location. * * @param dc the current draw context. * * @return the new texture, or null if the texture is not yet available. */ protected Texture requestTexture(DrawContext dc) { if (this.isBufferedImageSource()) { return(this.makeBufferedImageTexture(dc)); } if (this.getTextureData() != null && this.getTexture(dc) == null) { return(this.makeTextureFromTextureData(dc)); } if (WorldWind.getTaskService().isFull()) { return(null); } Runnable task = this.createRequestTask(); if (WorldWind.getTaskService().contains(task)) { return(null); } // Use either the current layer or the layer list as the listener to notify when the request completes. The // latter is used when the image source is requested during ordered rendering and the current layer is null. this.listener = dc.getCurrentLayer() != null?dc.getCurrentLayer() : dc.getLayers(); WorldWind.getTaskService().addTask(task); return(null); }
/// <summary> /// Listens for property change. /// </summary> /// <param name="property">Property.</param> /// <typeparam name="TViewModel">The 1st type parameter.</typeparam> protected void ListenForPropertyChange <TObject>(Expression <Func <TObject, object> > property, TObject obj, Action callback) { var changeListener = new PropertyChangeListener(); changeListener.Listen <TObject>(property, obj, callback); _propertyChangeListeners.Add(changeListener); }
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) { lock (propertyChangeListeners) { propertyChangeListeners.Add(propertyChangeListener); } }
public async Task CreateUserCommand_ValidForm_CreateUser() { // Arrange _roleRepository.GetAll().Returns(new List <Role> { Role.Basic, Role.Admin }); await sut.Load(); FillUserInfo(); var createdUserId = 1; var newUser = _mapper.Map <User>(sut.CreateUserInfo); _userRepository.CreateUser(_mapper.Map <User>(sut.CreateUserInfo)).Returns(createdUserId); var listener = PropertyChangeListener.Start(sut); // Act await sut.CreateUserCommand.Execute(); // Assert var changes = listener.Stop().GetChanges <bool>(nameof(CreateUserViewModel.Loading)); await _userRepository.Received().CreateUser(ArgExt.AnyEquivalent(newUser, ignore: nameof(User.CreationDate))); _eventAggregator.Received().Publish(ArgExt.AnyEquivalent(new UserCreatedEvent(newUser), ignore: nameof(User.CreationDate))); FormShouldBeEmpty(); changes.Should().Contain(x => x.Value == true); }
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { lock (this){ if ((listener != null) && (propertyName != null)) { PropertyChangeSupport listeners = children.get(propertyName); if (listeners == null) { listeners = new PropertyChangeSupport(source); children.put(propertyName, listeners); } // RI compatibility if (listener is PropertyChangeListenerProxy) { PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy)listener; listeners .addPropertyChangeListener(new PropertyChangeListenerProxy( proxy.getPropertyName(), (PropertyChangeListener)proxy.getListener())); } else { listeners.addPropertyChangeListener(listener); } } } }
/** * Constructs a SessionCachePostProcessor with a specified cache and cache key, and an optional property listener * and property name. * * @param cache cache that receives the retrieved data. * @param cacheKey cache key to place the retrieved data under. * @param absentResourceList the absent resource list to update. * @param resourceID the resource ID to use in the absent resource list. * @param propertyListener property listener to notify when the data is available. Can be null. * @param propertyName property name to use for the property event when the data is available. Can be null. */ public SessionCacheRetrievalPostProcessor(SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName) { if (cache == null) { String message = Logging.getMessage("nullValue.CacheIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cacheKey == null) { String message = Logging.getMessage("nullValue.CacheKeyIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } this.cache = cache; this.cacheKey = cacheKey; this.absentResourceList = absentResourceList; this.resourceID = resourceID; this.propertyListener = propertyListener; this.propertyName = propertyName; }
protected void notifyTextureLoaded() { if (this.listener != null) { this.listener.propertyChange(new PropertyChangeEvent(this, AVKey.TEXTURE, null, this)); this.listener = null; // forget the listener to avoid dangling references } }
/// <summary> /// Creates a proxy for the given model instance /// </summary> /// <param name="modelElement"></param> protected ModelPropertyChange(TClass modelElement, string propertyName) { ModelElement = modelElement; this.propertyName = propertyName; this.listener = new PropertyChangeListener(this); Successors.Attached += (obj, e) => Attach(); Successors.Detached += (obj, e) => Detach(); }
public void removePropertyChangeListener(PropertyChangeListener listener) { if (listener == null) { String msg = Logging.getMessage("nullValue.ListenerIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } this.getChangeSupport().removePropertyChangeListener(listener); }
private void installListeners() { if (this.window != null) { this.windowListener = createWindowListener(); this.window.addWindowListener(this.windowListener); this.propertyChangeListener = createWindowPropertyChangeListener(); this.window.addPropertyChangeListener(this.propertyChangeListener); } }
protected internal virtual void uninstallListeners() { this.commandButton.removePropertyChangeListener(this.officePropertyChangeListener); this.officePropertyChangeListener = null; foreach (KeyListener keyListener in this.commandButton.KeyListeners) { this.commandButton.removeKeyListener(keyListener); } base.uninstallListeners(); }
virtual public void RemovePropertyChangeListener(String key, PropertyChangeListener listener) { List <PropertyChangeListener> list = null; listeners.TryGetValue(key, out list); if (list != null) { list.Remove(listener); } }
/// <summary> /// Removes a {@code PropertyChangeListener} from the listener list /// for a specific property. /// <para> /// The {@code PropertyChangeListener} must be from this context. /// </para> /// <para> /// If {@code propertyName} or {@code listener} is {@code null} or invalid, /// no exception is thrown and no action is taken. /// /// </para> /// </summary> /// <param name="propertyName"> the specified property </param> /// <param name="listener"> the PropertyChangeListener to be removed /// </param> /// <seealso cref= #addPropertyChangeListener </seealso> /// <seealso cref= #getPropertyChangeListeners </seealso> public virtual void RemovePropertyChangeListener(String propertyName, PropertyChangeListener listener) { lock (this) { if (listener == null) { return; } CurrentChangeSupport.RemovePropertyChangeListener(propertyName, listener); } }
/// <summary> /// Removes a listener for the value change. /// <para> /// If the same listener was added more than once, /// it will be notified one less time after being removed. /// If {@code listener} is {@code null}, or was never added, /// no exception is thrown and no action is taken. /// /// </para> /// </summary> /// <param name="listener"> the <seealso cref="PropertyChangeListener"/> to remove </param> public virtual void RemovePropertyChangeListener(PropertyChangeListener listener) { lock (this) { if (Listeners == null) { return; } Listeners.Remove(listener); } }
//---------------------------------------------------------------------- /// <summary> /// Adds a listener for the value change. /// When the property editor changes its value /// it should fire a <seealso cref="PropertyChangeEvent"/> /// on all registered <seealso cref="PropertyChangeListener"/>s, /// specifying the {@code null} value for the property name. /// If the source property is set, /// it should be used as the source of the event. /// <para> /// The same listener object may be added more than once, /// and will be called as many times as it is added. /// If {@code listener} is {@code null}, /// no exception is thrown and no action is taken. /// /// </para> /// </summary> /// <param name="listener"> the <seealso cref="PropertyChangeListener"/> to add </param> public virtual void AddPropertyChangeListener(PropertyChangeListener listener) { lock (this) { if (Listeners == null) { Listeners = new List <>(); } Listeners.Add(listener); } }
virtual public void AddPropertyChangeListener(String key, PropertyChangeListener listener) { List <PropertyChangeListener> list = null; listeners.TryGetValue(key, out list); if (list == null) { list = new List <PropertyChangeListener>(); listeners[key] = list; } list.Add(listener); }
/// <summary> /// Remove a PropertyChangeListener for a specific property. /// If <code>listener</code> was added more than once to the same event /// source for the specified property, it will be notified one less time /// after being removed. /// If <code>propertyName</code> is null, no exception is thrown and no /// action is taken. /// If <code>listener</code> is null, or was never added for the specified /// property, no exception is thrown and no action is taken. /// </summary> /// <param name="propertyName"> The name of the property that was listened on. </param> /// <param name="listener"> The PropertyChangeListener to be removed </param> public virtual void RemovePropertyChangeListener(String propertyName, PropertyChangeListener listener) { if (listener == null || propertyName == null) { return; } listener = this.Map.Extract(listener); if (listener != null) { this.Map.Remove(propertyName, listener); } }
public virtual void removePropertyChangeListener(PropertyChangeListener listener) { ((PropertyChangeSupport) ((BeanContextChildSupport) this).pcSupport).removePropertyChangeListener(listener); object[] objArray = this.toArray(); int length = objArray.Length; for (int index = 0; index < length; ++index) { object obj = objArray[index]; if (obj is BaseChildSettings) ((BaseChildSettings) obj).removePropertyChangeListener(listener); else if (obj is BaseSettings) ((BaseSettings) obj).addPropertyChangeListener(listener); } }
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { lock (this){ if ((propertyName != null) && (listener != null)) { PropertyChangeSupport listeners = children.get(propertyName); if (listeners != null) { listeners.removePropertyChangeListener(listener); } } } }
public NestedBindingProxy(object source, string nestedPropertyPath) { _synchContext = SynchronizationContext.Current; _source = source; var propNames = nestedPropertyPath.Split('.'); Type type = source.GetType(); foreach (var propName in propNames) { var prop = TypeDescriptor.GetProperties(type)[propName]; var propChangeListener = new PropertyChangeListener(prop); _properties.Add(propChangeListener); propChangeListener.ValueChanged += (sender, e) => OnNestedPropertyChanged(propChangeListener); type = prop.PropertyType; } }
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { if (propertyName == null) { String msg = Logging.getMessage("nullValue.PropertyNameIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } if (listener == null) { String msg = Logging.getMessage("nullValue.ListenerIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } this.getChangeSupport().addPropertyChangeListener(propertyName, listener); }
/** * Initializes this object's fields during construction. * * @param imageSource the image source. * @param useMipMaps the mip-map flag. * @param listener the change listener. * * @throws ArgumentException if the image source is null. */ protected void initialize(Object imageSource, bool useMipMaps, PropertyChangeListener listener) { if (imageSource == null) { String message = Logging.getMessage("nullValue.ImageSource"); Logging.logger().severe(message); throw new ArgumentException(message); } this.imageSource = imageSource; this.useMipMaps = useMipMaps; if (listener != null) { this.addPropertyChangeListener(listener); } }
/// <summary> /// Remove a PropertyChangeListener from the listener list. /// This removes a PropertyChangeListener that was registered /// for all properties. /// If <code>listener</code> was added more than once to the same event /// source, it will be notified one less time after being removed. /// If <code>listener</code> is null, or was never added, no exception is /// thrown and no action is taken. /// </summary> /// <param name="listener"> The PropertyChangeListener to be removed </param> public virtual void RemovePropertyChangeListener(PropertyChangeListener listener) { if (listener == null) { return; } if (listener is PropertyChangeListenerProxy) { PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy)listener; // Call two argument remove method. RemovePropertyChangeListener(proxy.PropertyName, proxy.Listener); } else { this.Map.Remove(null, listener); } }
public void addPropertyChangeListener( PropertyChangeListener listener) { lock (this){ if (listener is PropertyChangeListenerProxy) { String name = ((PropertyChangeListenerProxy)listener) .getPropertyName(); PropertyChangeListener lst = (PropertyChangeListener)((PropertyChangeListenerProxy)listener) .getListener(); addPropertyChangeListener(name, lst); } else if (listener != null) { globalListeners.add(listener); } } }
private void OnNestedPropertyChanged(PropertyChangeListener changedProperty) { ListenToPropertyChanges(false); ListenToPropertyChanges(true); var subscribers = _subscribers; if (subscribers != null) { if (_synchContext != SynchronizationContext.Current) { _synchContext.Post(delegate { subscribers(this, new PropertyChangedEventArgs("Value")); }, null); } else { subscribers(this, new PropertyChangedEventArgs("Value")); } } }
public void removePropertyChangeListener( PropertyChangeListener listener) { lock (this) { if (listener is PropertyChangeListenerProxy) { String name = ((PropertyChangeListenerProxy)listener) .getPropertyName(); PropertyChangeListener lst = (PropertyChangeListener)((PropertyChangeListenerProxy)listener) .getListener(); removePropertyChangeListener(name, lst); } else { globalListeners.remove(listener); } } }
public async Task Load_ShowListOfRoles() { // Arrange var role = Role.Basic; _roleRepository.GetAll().Returns(new List <Role> { role }); var listener = PropertyChangeListener.Start(sut); // Act await sut.Load(); // Assert var changes = listener.Stop().GetChanges <bool>(nameof(sut.Loading)); sut.Roles.Should() .HaveCount(1) .And.ContainEquivalentOfMapped(role, _mapper); changes.Should().Contain(x => x.Value == true); }
/// <summary> /// Report that we have been modified to any interested listeners. /// </summary> public virtual void FirePropertyChange() { List <PropertyChangeListener> targets; lock (this) { if (Listeners == null) { return; } targets = UnsafeClone(Listeners); } // Tell our listeners that "everything" has changed. PropertyChangeEvent evt = new PropertyChangeEvent(Source_Renamed, null, null, null); for (int i = 0; i < targets.Count; i++) { PropertyChangeListener target = targets[i]; target.PropertyChange(evt); } }
public async Task Load_ShowListOfUsers() { // Arrange var user = MakeUser(); _userRepository.GetAll().Returns(new List <User> { user }); var listener = PropertyChangeListener.Start(sut); // Act await sut.Load(); // Assert var changes = listener.Stop().GetChanges <bool>(nameof(sut.Loading)); sut.Users.Should() .HaveCount(1) .And.ContainEquivalentOfMapped(user, _mapper); changes.Should().Contain(x => x.Value == true); }
/** * Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a {@link * WMSCapabilities} document. If the key does not map to a Capabilities document for any reason, this attempts to * asynchronously retrieve the Capabilities from a specified URL, and returns null. * * @param url the URL contents to retrieve. * @param cache the session cache. * @param cacheKey the key to identify the object in the session cache. * @param absentResourceList the absent resource list to update. * @param resourceID the resource ID to use in the absent resource list. * @param propertyListener the property change listener which is fired when the retrieved data is available. * @param propertyName the property name to fire when retrieved data is available. * * @return the Capabilities document in the session cache, or null if the document is not in the cache. * * @throws ArgumentException if either the url, retrieval service, cache or cache key are null. */ public static WMSCapabilities getOrRetrieveSessionCapabilities(java.net.URL url, SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName) { if (url == null) { String message = Logging.getMessage("nullValue.URLIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cache == null) { String message = Logging.getMessage("nullValue.CacheIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cacheKey == null) { String message = Logging.getMessage("nullValue.CacheKeyIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } WMSCapabilities caps = getSessionCapabilities(cache, cacheKey, url.ToString()); if (caps != null) { return(caps); } retrieveSessionData(url, cache, cacheKey, absentResourceList, resourceID, propertyListener, propertyName); // Try to get the caps after the retrieval attempt. return(getSessionCapabilities(cache, cacheKey, url.ToString())); }
public void addPropertyChangeListener(string name, PropertyChangeListener listener) { throw new NotImplementedException(); }
public void removePropertyChangeListener(PropertyChangeListener listener) { throw new NotImplementedException(); }
/// <summary> /// Remove an object from the list of objects registered to receive /// notification of changes to a bounded property /// </summary> /// <seealso cref="Java.Beans.PropertyChangeEvent">Java.Beans.PropertyChangeEvent</seealso> /// <seealso cref="AddPropertyChangeListener(Java.Beans.PropertyChangeListener)">AddPropertyChangeListener(Java.Beans.PropertyChangeListener)</seealso> /// <param name="l">the listener</param> public void RemovePropertyChangeListener(PropertyChangeListener l) { if (@sealed) { OnSealedMutation(); } propertyListeners = Kit.RemoveListener(propertyListeners, l); }
/// <summary> /// Adds a PropertyChangeListener to the listener list. /// </summary> public void addPropertyChangeListener(PropertyChangeListener @listener) { }
/// <summary> /// Adds a PropertyChangeListener to the listener list for a specific /// property. /// </summary> public void addPropertyChangeListener(string @propertyName, PropertyChangeListener @listener) { }
public void addPropertyChangeListener(PropertyChangeListener l) { this.changes.addPropertyChangeListener(l); }
public void ChangeListener(PropertyChangeListener listener) { changeSupport.addPropertyChangeListener(listener); }
public void addPropertyChangeListener(PropertyChangeListener listener) { this.listeners.Add(listener); }
/// <summary> /// Removes a PropertyChangeListener from the listener list. /// </summary> public void removePropertyChangeListener(PropertyChangeListener @listener) { }
public static void addPropertyChangeListener(PropertyChangeListener handler) { }
public void removePropertyChangeListener(PropertyChangeListener listener) { this.listeners.Remove(listener); }
public PropertyChangeListenerProxy(String propertyName, PropertyChangeListener listener) : base(listener) { this.propertyName = propertyName; }
public virtual void removePropertyChangeListener(PropertyChangeListener l) { this.changes.removePropertyChangeListener(l); }
public virtual void removePropertyChangeListener(PropertyChangeListener listener) { ((PropertyChangeSupport) this.pcSupport).removePropertyChangeListener(listener); }