/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.obeonetwork.pim.gen.bootstrap.model.bootstrap.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.emf.ecore.util.EcoreUtil;
import org.obeonetwork.pim.gen.bootstrap.model.bootstrap.BootstrapPackage;
import org.obeonetwork.pim.gen.bootstrap.model.bootstrap.Section;
import org.obeonetwork.pim.gen.bootstrap.model.bootstrap.Widget;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Widget</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.obeonetwork.pim.gen.bootstrap.model.bootstrap.impl.WidgetImpl#getTitle <em>Title</em>}</li>
* <li>{@link org.obeonetwork.pim.gen.bootstrap.model.bootstrap.impl.WidgetImpl#getSection <em>Section</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class WidgetImpl extends EObjectImpl implements Widget {
/**
* The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTitle()
* @generated
* @ordered
*/
protected static final String TITLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTitle()
* @generated
* @ordered
*/
protected String title = TITLE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected WidgetImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BootstrapPackage.Literals.WIDGET;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTitle() {
return title;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTitle(String newTitle) {
String oldTitle = title;
title = newTitle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BootstrapPackage.WIDGET__TITLE, oldTitle, title));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Section getSection() {
if (eContainerFeatureID() != BootstrapPackage.WIDGET__SECTION) return null;
return (Section)eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSection(Section newSection, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newSection, BootstrapPackage.WIDGET__SECTION, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSection(Section newSection) {
if (newSection != eInternalContainer() || (eContainerFeatureID() != BootstrapPackage.WIDGET__SECTION && newSection != null)) {
if (EcoreUtil.isAncestor(this, newSection))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newSection != null)
msgs = ((InternalEObject)newSection).eInverseAdd(this, BootstrapPackage.SECTION__WIDGETS, Section.class, msgs);
msgs = basicSetSection(newSection, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BootstrapPackage.WIDGET__SECTION, newSection, newSection));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BootstrapPackage.WIDGET__SECTION:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetSection((Section)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BootstrapPackage.WIDGET__SECTION:
return basicSetSection(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case BootstrapPackage.WIDGET__SECTION:
return eInternalContainer().eInverseRemove(this, BootstrapPackage.SECTION__WIDGETS, Section.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BootstrapPackage.WIDGET__TITLE:
return getTitle();
case BootstrapPackage.WIDGET__SECTION:
return getSection();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BootstrapPackage.WIDGET__TITLE:
setTitle((String)newValue);
return;
case BootstrapPackage.WIDGET__SECTION:
setSection((Section)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BootstrapPackage.WIDGET__TITLE:
setTitle(TITLE_EDEFAULT);
return;
case BootstrapPackage.WIDGET__SECTION:
setSection((Section)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BootstrapPackage.WIDGET__TITLE:
return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
case BootstrapPackage.WIDGET__SECTION:
return getSection() != null;
}
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(" (title: "); //$NON-NLS-1$
result.append(title);
result.append(')');
return result.toString();
}
} //WidgetImpl