blob: 28856b859de4710ee2e124bb31f33cd65e84f140 [file] [log] [blame]
/**
* 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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - 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:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#isNoLegend <em>No Legend</em>}</li>
* <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>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#getFontSize <em>Font Size</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartLegendImpl#getTextColor <em>Text Color</em>}</li>
* </ul>
*
* @generated
*/
public class ChartLegendImpl extends ChartLazyResolverImpl implements ChartLegend {
/**
* The default value of the '{@link #isNoLegend() <em>No Legend</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isNoLegend()
* @generated
* @ordered
*/
protected static final boolean NO_LEGEND_EDEFAULT = false;
/**
* The cached value of the '{@link #isNoLegend() <em>No Legend</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isNoLegend()
* @generated
* @ordered
*/
protected boolean noLegend = NO_LEGEND_EDEFAULT;
/**
* 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;
/**
* The default value of the '{@link #getFontSize() <em>Font Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFontSize()
* @generated
* @ordered
*/
protected static final int FONT_SIZE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getFontSize() <em>Font Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFontSize()
* @generated
* @ordered
*/
protected int fontSize = FONT_SIZE_EDEFAULT;
/**
* The default value of the '{@link #getTextColor() <em>Text Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTextColor()
* @generated
* @ordered
*/
protected static final String TEXT_COLOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getTextColor() <em>Text Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTextColor()
* @generated
* @ordered
*/
protected String textColor = TEXT_COLOR_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 boolean isNoLegend() {
return noLegend;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNoLegend(boolean newNoLegend) {
boolean oldNoLegend = noLegend;
noLegend = newNoLegend;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__NO_LEGEND, oldNoLegend, noLegend));
}
/**
* <!-- 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
*/
public int getFontSize() {
return fontSize;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFontSize(int newFontSize) {
int oldFontSize = fontSize;
fontSize = newFontSize;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__FONT_SIZE, oldFontSize, fontSize));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTextColor() {
return textColor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTextColor(String newTextColor) {
String oldTextColor = textColor;
textColor = newTextColor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_LEGEND__TEXT_COLOR, oldTextColor, textColor));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ChartDSLPackage.CHART_LEGEND__NO_LEGEND:
return isNoLegend();
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();
case ChartDSLPackage.CHART_LEGEND__FONT_SIZE:
return getFontSize();
case ChartDSLPackage.CHART_LEGEND__TEXT_COLOR:
return getTextColor();
}
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__NO_LEGEND:
setNoLegend((Boolean)newValue);
return;
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;
case ChartDSLPackage.CHART_LEGEND__FONT_SIZE:
setFontSize((Integer)newValue);
return;
case ChartDSLPackage.CHART_LEGEND__TEXT_COLOR:
setTextColor((String)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__NO_LEGEND:
setNoLegend(NO_LEGEND_EDEFAULT);
return;
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;
case ChartDSLPackage.CHART_LEGEND__FONT_SIZE:
setFontSize(FONT_SIZE_EDEFAULT);
return;
case ChartDSLPackage.CHART_LEGEND__TEXT_COLOR:
setTextColor(TEXT_COLOR_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ChartDSLPackage.CHART_LEGEND__NO_LEGEND:
return noLegend != NO_LEGEND_EDEFAULT;
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;
case ChartDSLPackage.CHART_LEGEND__FONT_SIZE:
return fontSize != FONT_SIZE_EDEFAULT;
case ChartDSLPackage.CHART_LEGEND__TEXT_COLOR:
return TEXT_COLOR_EDEFAULT == null ? textColor != null : !TEXT_COLOR_EDEFAULT.equals(textColor);
}
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(" (noLegend: ");
result.append(noLegend);
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(", fontSize: ");
result.append(fontSize);
result.append(", textColor: ");
result.append(textColor);
result.append(')');
return result.toString();
}
} //ChartLegendImpl