| /** |
| */ |
| package org.eclipse.fx.ide.gradient.model.gradient.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.fx.ide.gradient.model.gradient.FxColor; |
| import org.eclipse.fx.ide.gradient.model.gradient.FxStop; |
| import org.eclipse.fx.ide.gradient.model.gradient.GradientPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Fx Stop</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.fx.ide.gradient.model.gradient.impl.FxStopImpl#getColor <em>Color</em>}</li> |
| * <li>{@link org.eclipse.fx.ide.gradient.model.gradient.impl.FxStopImpl#getOffset <em>Offset</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class FxStopImpl extends MinimalEObjectImpl.Container implements FxStop { |
| /** |
| * The cached value of the '{@link #getColor() <em>Color</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColor() |
| * @generated |
| * @ordered |
| */ |
| protected FxColor color; |
| |
| /** |
| * The default value of the '{@link #getOffset() <em>Offset</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOffset() |
| * @generated |
| * @ordered |
| */ |
| protected static final double OFFSET_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getOffset() <em>Offset</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOffset() |
| * @generated |
| * @ordered |
| */ |
| protected double offset = OFFSET_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected FxStopImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return GradientPackage.Literals.FX_STOP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FxColor getColor() { |
| return color; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetColor(FxColor newColor, NotificationChain msgs) { |
| FxColor oldColor = color; |
| color = newColor; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GradientPackage.FX_STOP__COLOR, oldColor, newColor); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setColor(FxColor newColor) { |
| if (newColor != color) { |
| NotificationChain msgs = null; |
| if (color != null) |
| msgs = ((InternalEObject)color).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GradientPackage.FX_STOP__COLOR, null, msgs); |
| if (newColor != null) |
| msgs = ((InternalEObject)newColor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GradientPackage.FX_STOP__COLOR, null, msgs); |
| msgs = basicSetColor(newColor, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GradientPackage.FX_STOP__COLOR, newColor, newColor)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public double getOffset() { |
| return offset; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOffset(double newOffset) { |
| double oldOffset = offset; |
| offset = newOffset; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GradientPackage.FX_STOP__OFFSET, oldOffset, offset)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case GradientPackage.FX_STOP__COLOR: |
| return basicSetColor(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case GradientPackage.FX_STOP__COLOR: |
| return getColor(); |
| case GradientPackage.FX_STOP__OFFSET: |
| return getOffset(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case GradientPackage.FX_STOP__COLOR: |
| setColor((FxColor)newValue); |
| return; |
| case GradientPackage.FX_STOP__OFFSET: |
| setOffset((Double)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case GradientPackage.FX_STOP__COLOR: |
| setColor((FxColor)null); |
| return; |
| case GradientPackage.FX_STOP__OFFSET: |
| setOffset(OFFSET_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case GradientPackage.FX_STOP__COLOR: |
| return color != null; |
| case GradientPackage.FX_STOP__OFFSET: |
| return offset != OFFSET_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (offset: "); |
| result.append(offset); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //FxStopImpl |