| /** |
| * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH 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: |
| * EclipseSource Munich - initial API and implementation |
| */ |
| package org.eclipse.emf.ecp.view.template.style.background.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.emf.ecore.impl.MinimalEObjectImpl; |
| import org.eclipse.emf.ecp.common.spi.EMFUtils; |
| import org.eclipse.emf.ecp.view.template.model.VTStyleProperty; |
| import org.eclipse.emf.ecp.view.template.style.background.model.VTBackgroundPackage; |
| import org.eclipse.emf.ecp.view.template.style.background.model.VTBackgroundStyleProperty; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Style Property</b></em>'. |
| * |
| * @since 1.5 |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li> |
| * {@link org.eclipse.emf.ecp.view.template.style.background.model.impl.VTBackgroundStylePropertyImpl#getColor |
| * <em> Color</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class VTBackgroundStylePropertyImpl extends MinimalEObjectImpl.Container implements VTBackgroundStyleProperty { |
| /** |
| * The default value of the '{@link #getColor() <em>Color</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getColor() |
| * @generated |
| * @ordered |
| */ |
| protected static final String COLOR_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getColor() <em>Color</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getColor() |
| * @generated |
| * @ordered |
| */ |
| protected String color = COLOR_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected VTBackgroundStylePropertyImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return VTBackgroundPackage.Literals.BACKGROUND_STYLE_PROPERTY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String getColor() { |
| return color; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setColor(String newColor) { |
| final String oldColor = color; |
| color = newColor; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, VTBackgroundPackage.BACKGROUND_STYLE_PROPERTY__COLOR, |
| oldColor, color)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case VTBackgroundPackage.BACKGROUND_STYLE_PROPERTY__COLOR: |
| return getColor(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case VTBackgroundPackage.BACKGROUND_STYLE_PROPERTY__COLOR: |
| setColor((String) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case VTBackgroundPackage.BACKGROUND_STYLE_PROPERTY__COLOR: |
| setColor(COLOR_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case VTBackgroundPackage.BACKGROUND_STYLE_PROPERTY__COLOR: |
| return COLOR_EDEFAULT == null ? color != null : !COLOR_EDEFAULT.equals(color); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) { |
| return super.toString(); |
| } |
| |
| final StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (color: "); //$NON-NLS-1$ |
| result.append(color); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.ecp.view.template.model.VTStyleProperty#equalStyles(org.eclipse.emf.ecp.view.template.model.VTStyleProperty) |
| */ |
| @Override |
| public boolean equalStyles(VTStyleProperty styleProperty) { |
| final boolean filteredEqual = EMFUtils.filteredEquals(this, styleProperty, |
| VTBackgroundPackage.Literals.BACKGROUND_STYLE_PROPERTY__COLOR); |
| if (!filteredEqual) { |
| return false; |
| } |
| |
| final VTBackgroundStyleProperty backgroundStyleProperty = VTBackgroundStyleProperty.class.cast(styleProperty); |
| if (getColor() == null && backgroundStyleProperty.getColor() == null) { |
| return true; |
| } |
| if (getColor() == null && backgroundStyleProperty.getColor() != null) { |
| return false; |
| } |
| return getColor().equalsIgnoreCase(backgroundStyleProperty.getColor()); |
| } |
| |
| } // VTBackgroundStylePropertyImpl |