| /** |
| * 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.chart.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.xtext.chart.ChartDSLPackage; |
| import org.eclipse.osbp.xtext.chart.ChartLegend; |
| import org.eclipse.osbp.xtext.chart.LegendPlacementEnum; |
| import org.eclipse.osbp.xtext.chart.ToggleTypeEnum; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Chart Legend</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#getPlacement <em>Placement</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#isToggle <em>Toggle</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#isReplot <em>Replot</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#getToggleType <em>Toggle Type</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ChartLegendImpl extends ChartLazyResolverImpl implements ChartLegend { |
| /** |
| * The default value of the '{@link #getPlacement() <em>Placement</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPlacement() |
| * @generated |
| * @ordered |
| */ |
| protected static final LegendPlacementEnum PLACEMENT_EDEFAULT = LegendPlacementEnum.INSIDE; |
| |
| /** |
| * The cached value of the '{@link #getPlacement() <em>Placement</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPlacement() |
| * @generated |
| * @ordered |
| */ |
| protected LegendPlacementEnum placement = PLACEMENT_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isToggle() <em>Toggle</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isToggle() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean TOGGLE_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isToggle() <em>Toggle</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isToggle() |
| * @generated |
| * @ordered |
| */ |
| protected boolean toggle = TOGGLE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isReplot() <em>Replot</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isReplot() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean REPLOT_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isReplot() <em>Replot</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isReplot() |
| * @generated |
| * @ordered |
| */ |
| protected boolean replot = REPLOT_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getToggleType() <em>Toggle Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getToggleType() |
| * @generated |
| * @ordered |
| */ |
| protected static final ToggleTypeEnum TOGGLE_TYPE_EDEFAULT = ToggleTypeEnum.NORMAL; |
| |
| /** |
| * The cached value of the '{@link #getToggleType() <em>Toggle Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getToggleType() |
| * @generated |
| * @ordered |
| */ |
| protected ToggleTypeEnum toggleType = TOGGLE_TYPE_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ChartLegendImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ChartDSLPackage.Literals.CHART_LEGEND; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LegendPlacementEnum getPlacement() { |
| return placement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPlacement(LegendPlacementEnum newPlacement) { |
| LegendPlacementEnum oldPlacement = placement; |
| placement = newPlacement == null ? PLACEMENT_EDEFAULT : newPlacement; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__PLACEMENT, oldPlacement, placement)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isToggle() { |
| return toggle; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setToggle(boolean newToggle) { |
| boolean oldToggle = toggle; |
| toggle = newToggle; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__TOGGLE, oldToggle, toggle)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isReplot() { |
| return replot; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setReplot(boolean newReplot) { |
| boolean oldReplot = replot; |
| replot = newReplot; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__REPLOT, oldReplot, replot)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ToggleTypeEnum getToggleType() { |
| return toggleType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setToggleType(ToggleTypeEnum newToggleType) { |
| ToggleTypeEnum oldToggleType = toggleType; |
| toggleType = newToggleType == null ? TOGGLE_TYPE_EDEFAULT : newToggleType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__TOGGLE_TYPE, oldToggleType, toggleType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART_LEGEND__PLACEMENT: |
| return getPlacement(); |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE: |
| return isToggle(); |
| case ChartDSLPackage.CHART_LEGEND__REPLOT: |
| return isReplot(); |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE_TYPE: |
| return getToggleType(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART_LEGEND__PLACEMENT: |
| setPlacement((LegendPlacementEnum)newValue); |
| return; |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE: |
| setToggle((Boolean)newValue); |
| return; |
| case ChartDSLPackage.CHART_LEGEND__REPLOT: |
| setReplot((Boolean)newValue); |
| return; |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE_TYPE: |
| setToggleType((ToggleTypeEnum)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART_LEGEND__PLACEMENT: |
| setPlacement(PLACEMENT_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE: |
| setToggle(TOGGLE_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART_LEGEND__REPLOT: |
| setReplot(REPLOT_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE_TYPE: |
| setToggleType(TOGGLE_TYPE_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART_LEGEND__PLACEMENT: |
| return placement != PLACEMENT_EDEFAULT; |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE: |
| return toggle != TOGGLE_EDEFAULT; |
| case ChartDSLPackage.CHART_LEGEND__REPLOT: |
| return replot != REPLOT_EDEFAULT; |
| case ChartDSLPackage.CHART_LEGEND__TOGGLE_TYPE: |
| return toggleType != TOGGLE_TYPE_EDEFAULT; |
| } |
| 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(" (placement: "); |
| result.append(placement); |
| result.append(", toggle: "); |
| result.append(toggle); |
| result.append(", replot: "); |
| result.append(replot); |
| result.append(", toggleType: "); |
| result.append(toggleType); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ChartLegendImpl |