| /** |
| * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - initial API and implementation |
| */ |
| package org.eclipse.osbp.ecview.core.common.model.core.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.common.util.EMap; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; |
| import org.eclipse.emf.ecore.util.EcoreEMap; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory; |
| import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage; |
| import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlot; |
| import org.eclipse.osbp.ecview.core.common.model.core.YView; |
| import org.eclipse.osbp.ecview.core.common.model.core.YViewSet; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object ' |
| * <em><b>YUi View Set</b></em>'. <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YViewSetImpl#getTags <em>Tags</em>}</li> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YViewSetImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YViewSetImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YViewSetImpl#getProperties <em>Properties</em>}</li> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YViewSetImpl#getViews <em>Views</em>}</li> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YViewSetImpl#getBeanSlots <em>Bean Slots</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class YViewSetImpl extends MinimalEObjectImpl.Container implements |
| YViewSet { |
| /** |
| * The cached value of the '{@link #getTags() <em>Tags</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTags() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> tags; |
| |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ID_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected String id = ID_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getProperties() <em>Properties</em>}' map. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProperties() |
| * @generated |
| * @ordered |
| */ |
| protected EMap<String, String> properties; |
| |
| /** |
| * The cached value of the '{@link #getViews() <em>Views</em>}' reference list. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @see #getViews() |
| * @generated |
| * @ordered |
| */ |
| protected EList<YView> views; |
| |
| /** |
| * The cached value of the '{@link #getBeanSlots() <em>Bean Slots</em>}' containment reference list. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @see #getBeanSlots() |
| * @generated |
| * @ordered |
| */ |
| protected EList<YBeanSlot> beanSlots; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected YViewSetImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CoreModelPackage.Literals.YVIEW_SET; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(String newId) { |
| String oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CoreModelPackage.YVIEW_SET__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CoreModelPackage.YVIEW_SET__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getTags() { |
| if (tags == null) { |
| tags = new EDataTypeUniqueEList<String>(String.class, this, CoreModelPackage.YVIEW_SET__TAGS); |
| } |
| return tags; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EMap<String, String> getProperties() { |
| if (properties == null) { |
| properties = new EcoreEMap<String,String>(CoreModelPackage.Literals.YSTRING_TO_STRING_MAP, YStringToStringMapImpl.class, this, CoreModelPackage.YVIEW_SET__PROPERTIES); |
| } |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<YView> getViews() { |
| if (views == null) { |
| views = new EObjectWithInverseResolvingEList<YView>(YView.class, this, CoreModelPackage.YVIEW_SET__VIEWS, CoreModelPackage.YVIEW__ROOT); |
| } |
| return views; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<YBeanSlot> getBeanSlots() { |
| if (beanSlots == null) { |
| beanSlots = new EObjectContainmentEList.Resolving<YBeanSlot>(YBeanSlot.class, this, CoreModelPackage.YVIEW_SET__BEAN_SLOTS); |
| } |
| return beanSlots; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case CoreModelPackage.YVIEW_SET__VIEWS: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getViews()).basicAdd(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 CoreModelPackage.YVIEW_SET__PROPERTIES: |
| return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs); |
| case CoreModelPackage.YVIEW_SET__VIEWS: |
| return ((InternalEList<?>)getViews()).basicRemove(otherEnd, msgs); |
| case CoreModelPackage.YVIEW_SET__BEAN_SLOTS: |
| return ((InternalEList<?>)getBeanSlots()).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 CoreModelPackage.YVIEW_SET__TAGS: |
| return getTags(); |
| case CoreModelPackage.YVIEW_SET__ID: |
| return getId(); |
| case CoreModelPackage.YVIEW_SET__NAME: |
| return getName(); |
| case CoreModelPackage.YVIEW_SET__PROPERTIES: |
| if (coreType) return getProperties(); |
| else return getProperties().map(); |
| case CoreModelPackage.YVIEW_SET__VIEWS: |
| return getViews(); |
| case CoreModelPackage.YVIEW_SET__BEAN_SLOTS: |
| return getBeanSlots(); |
| } |
| 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 CoreModelPackage.YVIEW_SET__TAGS: |
| getTags().clear(); |
| getTags().addAll((Collection<? extends String>)newValue); |
| return; |
| case CoreModelPackage.YVIEW_SET__ID: |
| setId((String)newValue); |
| return; |
| case CoreModelPackage.YVIEW_SET__NAME: |
| setName((String)newValue); |
| return; |
| case CoreModelPackage.YVIEW_SET__PROPERTIES: |
| ((EStructuralFeature.Setting)getProperties()).set(newValue); |
| return; |
| case CoreModelPackage.YVIEW_SET__VIEWS: |
| getViews().clear(); |
| getViews().addAll((Collection<? extends YView>)newValue); |
| return; |
| case CoreModelPackage.YVIEW_SET__BEAN_SLOTS: |
| getBeanSlots().clear(); |
| getBeanSlots().addAll((Collection<? extends YBeanSlot>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CoreModelPackage.YVIEW_SET__TAGS: |
| getTags().clear(); |
| return; |
| case CoreModelPackage.YVIEW_SET__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case CoreModelPackage.YVIEW_SET__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case CoreModelPackage.YVIEW_SET__PROPERTIES: |
| getProperties().clear(); |
| return; |
| case CoreModelPackage.YVIEW_SET__VIEWS: |
| getViews().clear(); |
| return; |
| case CoreModelPackage.YVIEW_SET__BEAN_SLOTS: |
| getBeanSlots().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CoreModelPackage.YVIEW_SET__TAGS: |
| return tags != null && !tags.isEmpty(); |
| case CoreModelPackage.YVIEW_SET__ID: |
| return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); |
| case CoreModelPackage.YVIEW_SET__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case CoreModelPackage.YVIEW_SET__PROPERTIES: |
| return properties != null && !properties.isEmpty(); |
| case CoreModelPackage.YVIEW_SET__VIEWS: |
| return views != null && !views.isEmpty(); |
| case CoreModelPackage.YVIEW_SET__BEAN_SLOTS: |
| return beanSlots != null && !beanSlots.isEmpty(); |
| } |
| 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(" (tags: "); |
| result.append(tags); |
| result.append(", id: "); |
| result.append(id); |
| result.append(", name: "); |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| @Override |
| public YBeanSlot addBeanSlot(String name, Class<?> type) { |
| YBeanSlot result = null; |
| for (YBeanSlot ySlot : getBeanSlots()) { |
| if (ySlot.getName().equals(name)) { |
| result = ySlot; |
| break; |
| } |
| } |
| |
| if (result == null) { |
| result = CoreModelFactory.eINSTANCE.createYBeanSlot(); |
| result.setName(name); |
| result.setValueType(type); |
| getBeanSlots().add(result); |
| } |
| |
| return result; |
| } |
| |
| } // YUiViewSetImpl |