blob: ecb3a8281b3ad27c8846b014ffe100cc99c0ff2f [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.reportdsl.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.xtext.reportdsl.GridCell;
import org.eclipse.osbp.xtext.reportdsl.GridRow;
import org.eclipse.osbp.xtext.reportdsl.ReportDSLPackage;
import org.eclipse.osbp.xtext.reportdsl.Style;
import org.eclipse.osbp.xtext.reportdsl.WithStyle;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Grid Row</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.GridRowImpl#getStyle <em>Style</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.GridRowImpl#getCells <em>Cells</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GridRowImpl extends ReportBaseImpl implements GridRow {
/**
* The cached value of the '{@link #getStyle() <em>Style</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStyle()
* @generated
* @ordered
*/
protected Style style;
/**
* The cached value of the '{@link #getCells() <em>Cells</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCells()
* @generated
* @ordered
*/
protected EList<GridCell> cells;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GridRowImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ReportDSLPackage.Literals.GRID_ROW;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Style getStyle() {
if (style != null && style.eIsProxy()) {
InternalEObject oldStyle = (InternalEObject)style;
style = (Style)eResolveProxy(oldStyle);
if (style != oldStyle) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReportDSLPackage.GRID_ROW__STYLE, oldStyle, style));
}
}
return style;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Style basicGetStyle() {
return style;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStyle(Style newStyle) {
Style oldStyle = style;
style = newStyle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.GRID_ROW__STYLE, oldStyle, style));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<GridCell> getCells() {
if (cells == null) {
cells = new EObjectContainmentEList<GridCell>(GridCell.class, this, ReportDSLPackage.GRID_ROW__CELLS);
}
return cells;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ReportDSLPackage.GRID_ROW__CELLS:
return ((InternalEList<?>)getCells()).basicRemove(otherEnd, 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 ReportDSLPackage.GRID_ROW__STYLE:
if (resolve) return getStyle();
return basicGetStyle();
case ReportDSLPackage.GRID_ROW__CELLS:
return getCells();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ReportDSLPackage.GRID_ROW__STYLE:
setStyle((Style)newValue);
return;
case ReportDSLPackage.GRID_ROW__CELLS:
getCells().clear();
getCells().addAll((Collection<? extends GridCell>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ReportDSLPackage.GRID_ROW__STYLE:
setStyle((Style)null);
return;
case ReportDSLPackage.GRID_ROW__CELLS:
getCells().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ReportDSLPackage.GRID_ROW__STYLE:
return style != null;
case ReportDSLPackage.GRID_ROW__CELLS:
return cells != null && !cells.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == WithStyle.class) {
switch (derivedFeatureID) {
case ReportDSLPackage.GRID_ROW__STYLE: return ReportDSLPackage.WITH_STYLE__STYLE;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == WithStyle.class) {
switch (baseFeatureID) {
case ReportDSLPackage.WITH_STYLE__STYLE: return ReportDSLPackage.GRID_ROW__STYLE;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
} //GridRowImpl