blob: 1149795cf85585b8b22ef4e281f4eae01810f48c [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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.osbp.xtext.chart.ChartAxis;
import org.eclipse.osbp.xtext.chart.ChartDSLPackage;
import org.eclipse.osbp.xtext.chart.RenderTypeEnum;
import org.eclipse.osbp.xtext.datamartdsl.DatamartAxis;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Chart Axis</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getAxis <em>Axis</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getRenderType <em>Render Type</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#isShortLabel <em>Short Label</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getLabelAngle <em>Label Angle</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getLabelFontSize <em>Label Font Size</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getLabelTextColor <em>Label Text Color</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getTickAngle <em>Tick Angle</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getTickFontSize <em>Tick Font Size</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getTickTextColor <em>Tick Text Color</em>}</li>
* </ul>
*
* @generated
*/
public class ChartAxisImpl extends ChartLazyResolverImpl implements ChartAxis {
/**
* The cached value of the '{@link #getAxis() <em>Axis</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAxis()
* @generated
* @ordered
*/
protected DatamartAxis axis;
/**
* The default value of the '{@link #getRenderType() <em>Render Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRenderType()
* @generated
* @ordered
*/
protected static final RenderTypeEnum RENDER_TYPE_EDEFAULT = RenderTypeEnum.CATEGORY;
/**
* The cached value of the '{@link #getRenderType() <em>Render Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRenderType()
* @generated
* @ordered
*/
protected RenderTypeEnum renderType = RENDER_TYPE_EDEFAULT;
/**
* The default value of the '{@link #isShortLabel() <em>Short Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isShortLabel()
* @generated
* @ordered
*/
protected static final boolean SHORT_LABEL_EDEFAULT = false;
/**
* The cached value of the '{@link #isShortLabel() <em>Short Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isShortLabel()
* @generated
* @ordered
*/
protected boolean shortLabel = SHORT_LABEL_EDEFAULT;
/**
* The default value of the '{@link #getLabelAngle() <em>Label Angle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabelAngle()
* @generated
* @ordered
*/
protected static final int LABEL_ANGLE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getLabelAngle() <em>Label Angle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabelAngle()
* @generated
* @ordered
*/
protected int labelAngle = LABEL_ANGLE_EDEFAULT;
/**
* The default value of the '{@link #getLabelFontSize() <em>Label Font Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabelFontSize()
* @generated
* @ordered
*/
protected static final int LABEL_FONT_SIZE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getLabelFontSize() <em>Label Font Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabelFontSize()
* @generated
* @ordered
*/
protected int labelFontSize = LABEL_FONT_SIZE_EDEFAULT;
/**
* The default value of the '{@link #getLabelTextColor() <em>Label Text Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabelTextColor()
* @generated
* @ordered
*/
protected static final String LABEL_TEXT_COLOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getLabelTextColor() <em>Label Text Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabelTextColor()
* @generated
* @ordered
*/
protected String labelTextColor = LABEL_TEXT_COLOR_EDEFAULT;
/**
* The default value of the '{@link #getTickAngle() <em>Tick Angle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTickAngle()
* @generated
* @ordered
*/
protected static final int TICK_ANGLE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getTickAngle() <em>Tick Angle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTickAngle()
* @generated
* @ordered
*/
protected int tickAngle = TICK_ANGLE_EDEFAULT;
/**
* The default value of the '{@link #getTickFontSize() <em>Tick Font Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTickFontSize()
* @generated
* @ordered
*/
protected static final int TICK_FONT_SIZE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getTickFontSize() <em>Tick Font Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTickFontSize()
* @generated
* @ordered
*/
protected int tickFontSize = TICK_FONT_SIZE_EDEFAULT;
/**
* The default value of the '{@link #getTickTextColor() <em>Tick Text Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTickTextColor()
* @generated
* @ordered
*/
protected static final String TICK_TEXT_COLOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getTickTextColor() <em>Tick Text Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTickTextColor()
* @generated
* @ordered
*/
protected String tickTextColor = TICK_TEXT_COLOR_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ChartAxisImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ChartDSLPackage.Literals.CHART_AXIS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartAxis getAxis() {
if (axis != null && axis.eIsProxy()) {
InternalEObject oldAxis = (InternalEObject)axis;
axis = (DatamartAxis)eResolveProxy(oldAxis);
if (axis != oldAxis) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ChartDSLPackage.CHART_AXIS__AXIS, oldAxis, axis));
}
}
return axis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartAxis basicGetAxis() {
return axis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAxis(DatamartAxis newAxis) {
DatamartAxis oldAxis = axis;
axis = newAxis;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__AXIS, oldAxis, axis));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RenderTypeEnum getRenderType() {
return renderType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRenderType(RenderTypeEnum newRenderType) {
RenderTypeEnum oldRenderType = renderType;
renderType = newRenderType == null ? RENDER_TYPE_EDEFAULT : newRenderType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__RENDER_TYPE, oldRenderType, renderType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isShortLabel() {
return shortLabel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setShortLabel(boolean newShortLabel) {
boolean oldShortLabel = shortLabel;
shortLabel = newShortLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__SHORT_LABEL, oldShortLabel, shortLabel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getLabelAngle() {
return labelAngle;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabelAngle(int newLabelAngle) {
int oldLabelAngle = labelAngle;
labelAngle = newLabelAngle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__LABEL_ANGLE, oldLabelAngle, labelAngle));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getLabelFontSize() {
return labelFontSize;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabelFontSize(int newLabelFontSize) {
int oldLabelFontSize = labelFontSize;
labelFontSize = newLabelFontSize;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__LABEL_FONT_SIZE, oldLabelFontSize, labelFontSize));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLabelTextColor() {
return labelTextColor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabelTextColor(String newLabelTextColor) {
String oldLabelTextColor = labelTextColor;
labelTextColor = newLabelTextColor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__LABEL_TEXT_COLOR, oldLabelTextColor, labelTextColor));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getTickAngle() {
return tickAngle;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTickAngle(int newTickAngle) {
int oldTickAngle = tickAngle;
tickAngle = newTickAngle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__TICK_ANGLE, oldTickAngle, tickAngle));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getTickFontSize() {
return tickFontSize;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTickFontSize(int newTickFontSize) {
int oldTickFontSize = tickFontSize;
tickFontSize = newTickFontSize;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__TICK_FONT_SIZE, oldTickFontSize, tickFontSize));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTickTextColor() {
return tickTextColor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTickTextColor(String newTickTextColor) {
String oldTickTextColor = tickTextColor;
tickTextColor = newTickTextColor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__TICK_TEXT_COLOR, oldTickTextColor, tickTextColor));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ChartDSLPackage.CHART_AXIS__AXIS:
if (resolve) return getAxis();
return basicGetAxis();
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
return getRenderType();
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
return isShortLabel();
case ChartDSLPackage.CHART_AXIS__LABEL_ANGLE:
return getLabelAngle();
case ChartDSLPackage.CHART_AXIS__LABEL_FONT_SIZE:
return getLabelFontSize();
case ChartDSLPackage.CHART_AXIS__LABEL_TEXT_COLOR:
return getLabelTextColor();
case ChartDSLPackage.CHART_AXIS__TICK_ANGLE:
return getTickAngle();
case ChartDSLPackage.CHART_AXIS__TICK_FONT_SIZE:
return getTickFontSize();
case ChartDSLPackage.CHART_AXIS__TICK_TEXT_COLOR:
return getTickTextColor();
}
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_AXIS__AXIS:
setAxis((DatamartAxis)newValue);
return;
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
setRenderType((RenderTypeEnum)newValue);
return;
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
setShortLabel((Boolean)newValue);
return;
case ChartDSLPackage.CHART_AXIS__LABEL_ANGLE:
setLabelAngle((Integer)newValue);
return;
case ChartDSLPackage.CHART_AXIS__LABEL_FONT_SIZE:
setLabelFontSize((Integer)newValue);
return;
case ChartDSLPackage.CHART_AXIS__LABEL_TEXT_COLOR:
setLabelTextColor((String)newValue);
return;
case ChartDSLPackage.CHART_AXIS__TICK_ANGLE:
setTickAngle((Integer)newValue);
return;
case ChartDSLPackage.CHART_AXIS__TICK_FONT_SIZE:
setTickFontSize((Integer)newValue);
return;
case ChartDSLPackage.CHART_AXIS__TICK_TEXT_COLOR:
setTickTextColor((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_AXIS__AXIS:
setAxis((DatamartAxis)null);
return;
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
setRenderType(RENDER_TYPE_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
setShortLabel(SHORT_LABEL_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__LABEL_ANGLE:
setLabelAngle(LABEL_ANGLE_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__LABEL_FONT_SIZE:
setLabelFontSize(LABEL_FONT_SIZE_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__LABEL_TEXT_COLOR:
setLabelTextColor(LABEL_TEXT_COLOR_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__TICK_ANGLE:
setTickAngle(TICK_ANGLE_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__TICK_FONT_SIZE:
setTickFontSize(TICK_FONT_SIZE_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__TICK_TEXT_COLOR:
setTickTextColor(TICK_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_AXIS__AXIS:
return axis != null;
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
return renderType != RENDER_TYPE_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
return shortLabel != SHORT_LABEL_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__LABEL_ANGLE:
return labelAngle != LABEL_ANGLE_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__LABEL_FONT_SIZE:
return labelFontSize != LABEL_FONT_SIZE_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__LABEL_TEXT_COLOR:
return LABEL_TEXT_COLOR_EDEFAULT == null ? labelTextColor != null : !LABEL_TEXT_COLOR_EDEFAULT.equals(labelTextColor);
case ChartDSLPackage.CHART_AXIS__TICK_ANGLE:
return tickAngle != TICK_ANGLE_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__TICK_FONT_SIZE:
return tickFontSize != TICK_FONT_SIZE_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__TICK_TEXT_COLOR:
return TICK_TEXT_COLOR_EDEFAULT == null ? tickTextColor != null : !TICK_TEXT_COLOR_EDEFAULT.equals(tickTextColor);
}
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(" (renderType: ");
result.append(renderType);
result.append(", shortLabel: ");
result.append(shortLabel);
result.append(", labelAngle: ");
result.append(labelAngle);
result.append(", labelFontSize: ");
result.append(labelFontSize);
result.append(", labelTextColor: ");
result.append(labelTextColor);
result.append(", tickAngle: ");
result.append(tickAngle);
result.append(", tickFontSize: ");
result.append(tickFontSize);
result.append(", tickTextColor: ");
result.append(tickTextColor);
result.append(')');
return result.toString();
}
} //ChartAxisImpl