All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.beans.observables.properties.SimpleObservableIntProperty Maven / Gradle / Ivy

package com.beans.observables.properties;

import com.beans.observables.binding.AtomicPropertyBindingController;
import com.beans.observables.binding.PropertyBindingController;
import com.beans.observables.listeners.ObservableEventController;
import com.notifier.Controllers;
import com.notifier.EventController;

/**
 * 

* A simple implementation of {@link ObservableIntProperty}, holding a * variable which is accessed for writing or reading through {@link #setAsInt(int)} * and {@link #getAsInt()}. *

* * @since JavaBeans 1.0 */ public class SimpleObservableIntProperty extends ObservableIntPropertyBase { private int mValue; public SimpleObservableIntProperty(ObservableEventController eventController, PropertyBindingController bindingController, int initialValue) { super(eventController, bindingController); mValue = initialValue; } public SimpleObservableIntProperty(EventController eventController, PropertyBindingController bindingController, int initialValue) { super(eventController, bindingController); mValue = initialValue; } public SimpleObservableIntProperty(ObservableEventController eventController, PropertyBindingController bindingController) { this(eventController, bindingController, 0); } public SimpleObservableIntProperty(EventController eventController, int initialValue) { this(eventController, new AtomicPropertyBindingController<>(), initialValue); } public SimpleObservableIntProperty(EventController eventController) { this(eventController, 0); } public SimpleObservableIntProperty(int initialValue) { this(Controllers.newSyncExecutionController(), initialValue); } public SimpleObservableIntProperty() { this(0); } @Override protected void setInternalDirect(Integer value) { mValue = value; } @Override public void setInternal(int value) { if (mValue != value) { int oldValue = mValue; mValue = value; fireValueChangedEvent(oldValue, value); } } @Override public int getInternal() { return mValue; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy