| /** |
| * 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.Element; |
| import org.eclipse.osbp.xtext.reportdsl.GridCell; |
| import org.eclipse.osbp.xtext.reportdsl.ReportDSLPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Grid Cell</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.GridCellImpl#getElements <em>Elements</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.GridCellImpl#getColumnspan <em>Columnspan</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class GridCellImpl extends ReportBaseImpl implements GridCell { |
| /** |
| * The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getElements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Element> elements; |
| |
| /** |
| * The default value of the '{@link #getColumnspan() <em>Columnspan</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColumnspan() |
| * @generated |
| * @ordered |
| */ |
| protected static final int COLUMNSPAN_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getColumnspan() <em>Columnspan</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColumnspan() |
| * @generated |
| * @ordered |
| */ |
| protected int columnspan = COLUMNSPAN_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected GridCellImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ReportDSLPackage.Literals.GRID_CELL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Element> getElements() { |
| if (elements == null) { |
| elements = new EObjectContainmentEList<Element>(Element.class, this, ReportDSLPackage.GRID_CELL__ELEMENTS); |
| } |
| return elements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getColumnspan() { |
| return columnspan; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setColumnspan(int newColumnspan) { |
| int oldColumnspan = columnspan; |
| columnspan = newColumnspan; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.GRID_CELL__COLUMNSPAN, oldColumnspan, columnspan)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ReportDSLPackage.GRID_CELL__ELEMENTS: |
| return ((InternalEList<?>)getElements()).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_CELL__ELEMENTS: |
| return getElements(); |
| case ReportDSLPackage.GRID_CELL__COLUMNSPAN: |
| return getColumnspan(); |
| } |
| 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_CELL__ELEMENTS: |
| getElements().clear(); |
| getElements().addAll((Collection<? extends Element>)newValue); |
| return; |
| case ReportDSLPackage.GRID_CELL__COLUMNSPAN: |
| setColumnspan((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ReportDSLPackage.GRID_CELL__ELEMENTS: |
| getElements().clear(); |
| return; |
| case ReportDSLPackage.GRID_CELL__COLUMNSPAN: |
| setColumnspan(COLUMNSPAN_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ReportDSLPackage.GRID_CELL__ELEMENTS: |
| return elements != null && !elements.isEmpty(); |
| case ReportDSLPackage.GRID_CELL__COLUMNSPAN: |
| return columnspan != COLUMNSPAN_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| if (baseClass == org.eclipse.osbp.xtext.reportdsl.Container.class) { |
| switch (derivedFeatureID) { |
| case ReportDSLPackage.GRID_CELL__ELEMENTS: return ReportDSLPackage.CONTAINER__ELEMENTS; |
| 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 == org.eclipse.osbp.xtext.reportdsl.Container.class) { |
| switch (baseFeatureID) { |
| case ReportDSLPackage.CONTAINER__ELEMENTS: return ReportDSLPackage.GRID_CELL__ELEMENTS; |
| default: return -1; |
| } |
| } |
| return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (columnspan: "); |
| result.append(columnspan); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //GridCellImpl |