| /** |
| * |
| * 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 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.ecview.extension.model.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage; |
| import org.eclipse.osbp.ecview.core.common.model.core.YMarginable; |
| import org.eclipse.osbp.ecview.core.common.model.core.YSpacingable; |
| import org.eclipse.osbp.ecview.core.common.model.core.impl.YLayoutImpl; |
| import org.eclipse.osbp.ecview.extension.model.YContentSensitiveLayout; |
| import org.eclipse.osbp.ecview.extension.model.YECviewPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>YContent Sensitive Layout</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.ecview.extension.model.impl.YContentSensitiveLayoutImpl#isSpacing <em>Spacing</em>}</li> |
| * <li>{@link org.eclipse.osbp.ecview.extension.model.impl.YContentSensitiveLayoutImpl#isMargin <em>Margin</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class YContentSensitiveLayoutImpl extends YLayoutImpl implements YContentSensitiveLayout { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = "All rights reserved by Loetz GmbH und CoKG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation"; |
| |
| /** |
| * The default value of the '{@link #isSpacing() <em>Spacing</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isSpacing() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean SPACING_EDEFAULT = true; |
| /** |
| * The cached value of the '{@link #isSpacing() <em>Spacing</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isSpacing() |
| * @generated |
| * @ordered |
| */ |
| protected boolean spacing = SPACING_EDEFAULT; |
| /** |
| * The default value of the '{@link #isMargin() <em>Margin</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isMargin() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean MARGIN_EDEFAULT = true; |
| /** |
| * The cached value of the '{@link #isMargin() <em>Margin</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isMargin() |
| * @generated |
| * @ordered |
| */ |
| protected boolean margin = MARGIN_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected YContentSensitiveLayoutImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return YECviewPackage.Literals.YCONTENT_SENSITIVE_LAYOUT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isSpacing() { |
| return spacing; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSpacing(boolean newSpacing) { |
| boolean oldSpacing = spacing; |
| spacing = newSpacing; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING, oldSpacing, spacing)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isMargin() { |
| return margin; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMargin(boolean newMargin) { |
| boolean oldMargin = margin; |
| margin = newMargin; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN, oldMargin, margin)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING: |
| return isSpacing(); |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN: |
| return isMargin(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING: |
| setSpacing((Boolean)newValue); |
| return; |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN: |
| setMargin((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING: |
| setSpacing(SPACING_EDEFAULT); |
| return; |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN: |
| setMargin(MARGIN_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING: |
| return spacing != SPACING_EDEFAULT; |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN: |
| return margin != MARGIN_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| if (baseClass == YSpacingable.class) { |
| switch (derivedFeatureID) { |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING: return CoreModelPackage.YSPACINGABLE__SPACING; |
| default: return -1; |
| } |
| } |
| if (baseClass == YMarginable.class) { |
| switch (derivedFeatureID) { |
| case YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN: return CoreModelPackage.YMARGINABLE__MARGIN; |
| 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 == YSpacingable.class) { |
| switch (baseFeatureID) { |
| case CoreModelPackage.YSPACINGABLE__SPACING: return YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__SPACING; |
| default: return -1; |
| } |
| } |
| if (baseClass == YMarginable.class) { |
| switch (baseFeatureID) { |
| case CoreModelPackage.YMARGINABLE__MARGIN: return YECviewPackage.YCONTENT_SENSITIVE_LAYOUT__MARGIN; |
| 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(" (spacing: "); |
| result.append(spacing); |
| result.append(", margin: "); |
| result.append(margin); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //YContentSensitiveLayoutImpl |