/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.gmf.gmfgraph.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.EObjectImpl; import org.eclipse.gmf.gmfgraph.Color; import org.eclipse.gmf.gmfgraph.GMFGraphPackage; import org.eclipse.gmf.gmfgraph.LineBorder; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Line Border</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.gmf.gmfgraph.impl.LineBorderImpl#getColor <em>Color</em>}</li> * <li>{@link org.eclipse.gmf.gmfgraph.impl.LineBorderImpl#getWidth <em>Width</em>}</li> * </ul> * </p> * * @generated */ public class LineBorderImpl extends EObjectImpl implements LineBorder { /** * The cached value of the '{@link #getColor() <em>Color</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getColor() * @generated * @ordered */ protected Color color; /** * The default value of the '{@link #getWidth() <em>Width</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getWidth() * @generated * @ordered */ protected static final int WIDTH_EDEFAULT = 1; /** * The cached value of the '{@link #getWidth() <em>Width</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getWidth() * @generated * @ordered */ protected int width = WIDTH_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected LineBorderImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return GMFGraphPackage.eINSTANCE.getLineBorder(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Color getColor() { return color; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetColor(Color newColor, NotificationChain msgs) { Color oldColor = color; color = newColor; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GMFGraphPackage.LINE_BORDER__COLOR, oldColor, newColor); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setColor(Color newColor) { if (newColor != color) { NotificationChain msgs = null; if (color != null) msgs = ((InternalEObject)color).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GMFGraphPackage.LINE_BORDER__COLOR, null, msgs); if (newColor != null) msgs = ((InternalEObject)newColor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GMFGraphPackage.LINE_BORDER__COLOR, null, msgs); msgs = basicSetColor(newColor, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GMFGraphPackage.LINE_BORDER__COLOR, newColor, newColor)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getWidth() { return width; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setWidth(int newWidth) { int oldWidth = width; width = newWidth; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GMFGraphPackage.LINE_BORDER__WIDTH, oldWidth, width)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case GMFGraphPackage.LINE_BORDER__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 GMFGraphPackage.LINE_BORDER__COLOR: return getColor(); case GMFGraphPackage.LINE_BORDER__WIDTH: return getWidth(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case GMFGraphPackage.LINE_BORDER__COLOR: setColor((Color)newValue); return; case GMFGraphPackage.LINE_BORDER__WIDTH: setWidth((Integer)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case GMFGraphPackage.LINE_BORDER__COLOR: setColor((Color)null); return; case GMFGraphPackage.LINE_BORDER__WIDTH: setWidth(WIDTH_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case GMFGraphPackage.LINE_BORDER__COLOR: return color != null; case GMFGraphPackage.LINE_BORDER__WIDTH: return width != WIDTH_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(" (width: "); result.append(width); result.append(')'); return result.toString(); } } //LineBorderImpl