blob: d66d5d7e3a0abc1c1a5c62ddb2f92ac1aa9f4f21 [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 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.reportdsl.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.osbp.xtext.reportdsl.OrientationEnum;
import org.eclipse.osbp.xtext.reportdsl.PageFooter;
import org.eclipse.osbp.xtext.reportdsl.PageHeader;
import org.eclipse.osbp.xtext.reportdsl.PageSizeEnum;
import org.eclipse.osbp.xtext.reportdsl.PageTemplate;
import org.eclipse.osbp.xtext.reportdsl.ReportDSLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Page Template</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getSize <em>Size</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getOrientation <em>Orientation</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getTopMarginValue <em>Top Margin Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getLeftMarginValue <em>Left Margin Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getBottomMarginValue <em>Bottom Margin Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getRightMarginValue <em>Right Margin Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getHeader <em>Header</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.PageTemplateImpl#getFooter <em>Footer</em>}</li>
* </ul>
*
* @generated
*/
public class PageTemplateImpl extends ReportBaseImpl implements PageTemplate {
/**
* The default value of the '{@link #getSize() <em>Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSize()
* @generated
* @ordered
*/
protected static final PageSizeEnum SIZE_EDEFAULT = PageSizeEnum.A4;
/**
* The cached value of the '{@link #getSize() <em>Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSize()
* @generated
* @ordered
*/
protected PageSizeEnum size = SIZE_EDEFAULT;
/**
* The default value of the '{@link #getOrientation() <em>Orientation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrientation()
* @generated
* @ordered
*/
protected static final OrientationEnum ORIENTATION_EDEFAULT = OrientationEnum.PORTRAIT;
/**
* The cached value of the '{@link #getOrientation() <em>Orientation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrientation()
* @generated
* @ordered
*/
protected OrientationEnum orientation = ORIENTATION_EDEFAULT;
/**
* The default value of the '{@link #getTopMarginValue() <em>Top Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTopMarginValue()
* @generated
* @ordered
*/
protected static final double TOP_MARGIN_VALUE_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getTopMarginValue() <em>Top Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTopMarginValue()
* @generated
* @ordered
*/
protected double topMarginValue = TOP_MARGIN_VALUE_EDEFAULT;
/**
* The default value of the '{@link #getLeftMarginValue() <em>Left Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeftMarginValue()
* @generated
* @ordered
*/
protected static final double LEFT_MARGIN_VALUE_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getLeftMarginValue() <em>Left Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeftMarginValue()
* @generated
* @ordered
*/
protected double leftMarginValue = LEFT_MARGIN_VALUE_EDEFAULT;
/**
* The default value of the '{@link #getBottomMarginValue() <em>Bottom Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBottomMarginValue()
* @generated
* @ordered
*/
protected static final double BOTTOM_MARGIN_VALUE_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getBottomMarginValue() <em>Bottom Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBottomMarginValue()
* @generated
* @ordered
*/
protected double bottomMarginValue = BOTTOM_MARGIN_VALUE_EDEFAULT;
/**
* The default value of the '{@link #getRightMarginValue() <em>Right Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRightMarginValue()
* @generated
* @ordered
*/
protected static final double RIGHT_MARGIN_VALUE_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getRightMarginValue() <em>Right Margin Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRightMarginValue()
* @generated
* @ordered
*/
protected double rightMarginValue = RIGHT_MARGIN_VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getHeader() <em>Header</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHeader()
* @generated
* @ordered
*/
protected PageHeader header;
/**
* The cached value of the '{@link #getFooter() <em>Footer</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFooter()
* @generated
* @ordered
*/
protected PageFooter footer;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PageTemplateImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ReportDSLPackage.Literals.PAGE_TEMPLATE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PageSizeEnum getSize() {
return size;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSize(PageSizeEnum newSize) {
PageSizeEnum oldSize = size;
size = newSize == null ? SIZE_EDEFAULT : newSize;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__SIZE, oldSize, size));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OrientationEnum getOrientation() {
return orientation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOrientation(OrientationEnum newOrientation) {
OrientationEnum oldOrientation = orientation;
orientation = newOrientation == null ? ORIENTATION_EDEFAULT : newOrientation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__ORIENTATION, oldOrientation, orientation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public double getTopMarginValue() {
return topMarginValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTopMarginValue(double newTopMarginValue) {
double oldTopMarginValue = topMarginValue;
topMarginValue = newTopMarginValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__TOP_MARGIN_VALUE, oldTopMarginValue, topMarginValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public double getLeftMarginValue() {
return leftMarginValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLeftMarginValue(double newLeftMarginValue) {
double oldLeftMarginValue = leftMarginValue;
leftMarginValue = newLeftMarginValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__LEFT_MARGIN_VALUE, oldLeftMarginValue, leftMarginValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public double getBottomMarginValue() {
return bottomMarginValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBottomMarginValue(double newBottomMarginValue) {
double oldBottomMarginValue = bottomMarginValue;
bottomMarginValue = newBottomMarginValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__BOTTOM_MARGIN_VALUE, oldBottomMarginValue, bottomMarginValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public double getRightMarginValue() {
return rightMarginValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRightMarginValue(double newRightMarginValue) {
double oldRightMarginValue = rightMarginValue;
rightMarginValue = newRightMarginValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__RIGHT_MARGIN_VALUE, oldRightMarginValue, rightMarginValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PageHeader getHeader() {
return header;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetHeader(PageHeader newHeader, NotificationChain msgs) {
PageHeader oldHeader = header;
header = newHeader;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__HEADER, oldHeader, newHeader);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHeader(PageHeader newHeader) {
if (newHeader != header) {
NotificationChain msgs = null;
if (header != null)
msgs = ((InternalEObject)header).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReportDSLPackage.PAGE_TEMPLATE__HEADER, null, msgs);
if (newHeader != null)
msgs = ((InternalEObject)newHeader).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReportDSLPackage.PAGE_TEMPLATE__HEADER, null, msgs);
msgs = basicSetHeader(newHeader, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__HEADER, newHeader, newHeader));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PageFooter getFooter() {
return footer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetFooter(PageFooter newFooter, NotificationChain msgs) {
PageFooter oldFooter = footer;
footer = newFooter;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__FOOTER, oldFooter, newFooter);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFooter(PageFooter newFooter) {
if (newFooter != footer) {
NotificationChain msgs = null;
if (footer != null)
msgs = ((InternalEObject)footer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReportDSLPackage.PAGE_TEMPLATE__FOOTER, null, msgs);
if (newFooter != null)
msgs = ((InternalEObject)newFooter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReportDSLPackage.PAGE_TEMPLATE__FOOTER, null, msgs);
msgs = basicSetFooter(newFooter, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.PAGE_TEMPLATE__FOOTER, newFooter, newFooter));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ReportDSLPackage.PAGE_TEMPLATE__HEADER:
return basicSetHeader(null, msgs);
case ReportDSLPackage.PAGE_TEMPLATE__FOOTER:
return basicSetFooter(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ReportDSLPackage.PAGE_TEMPLATE__SIZE:
return getSize();
case ReportDSLPackage.PAGE_TEMPLATE__ORIENTATION:
return getOrientation();
case ReportDSLPackage.PAGE_TEMPLATE__TOP_MARGIN_VALUE:
return getTopMarginValue();
case ReportDSLPackage.PAGE_TEMPLATE__LEFT_MARGIN_VALUE:
return getLeftMarginValue();
case ReportDSLPackage.PAGE_TEMPLATE__BOTTOM_MARGIN_VALUE:
return getBottomMarginValue();
case ReportDSLPackage.PAGE_TEMPLATE__RIGHT_MARGIN_VALUE:
return getRightMarginValue();
case ReportDSLPackage.PAGE_TEMPLATE__HEADER:
return getHeader();
case ReportDSLPackage.PAGE_TEMPLATE__FOOTER:
return getFooter();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ReportDSLPackage.PAGE_TEMPLATE__SIZE:
setSize((PageSizeEnum)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__ORIENTATION:
setOrientation((OrientationEnum)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__TOP_MARGIN_VALUE:
setTopMarginValue((Double)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__LEFT_MARGIN_VALUE:
setLeftMarginValue((Double)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__BOTTOM_MARGIN_VALUE:
setBottomMarginValue((Double)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__RIGHT_MARGIN_VALUE:
setRightMarginValue((Double)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__HEADER:
setHeader((PageHeader)newValue);
return;
case ReportDSLPackage.PAGE_TEMPLATE__FOOTER:
setFooter((PageFooter)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ReportDSLPackage.PAGE_TEMPLATE__SIZE:
setSize(SIZE_EDEFAULT);
return;
case ReportDSLPackage.PAGE_TEMPLATE__ORIENTATION:
setOrientation(ORIENTATION_EDEFAULT);
return;
case ReportDSLPackage.PAGE_TEMPLATE__TOP_MARGIN_VALUE:
setTopMarginValue(TOP_MARGIN_VALUE_EDEFAULT);
return;
case ReportDSLPackage.PAGE_TEMPLATE__LEFT_MARGIN_VALUE:
setLeftMarginValue(LEFT_MARGIN_VALUE_EDEFAULT);
return;
case ReportDSLPackage.PAGE_TEMPLATE__BOTTOM_MARGIN_VALUE:
setBottomMarginValue(BOTTOM_MARGIN_VALUE_EDEFAULT);
return;
case ReportDSLPackage.PAGE_TEMPLATE__RIGHT_MARGIN_VALUE:
setRightMarginValue(RIGHT_MARGIN_VALUE_EDEFAULT);
return;
case ReportDSLPackage.PAGE_TEMPLATE__HEADER:
setHeader((PageHeader)null);
return;
case ReportDSLPackage.PAGE_TEMPLATE__FOOTER:
setFooter((PageFooter)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ReportDSLPackage.PAGE_TEMPLATE__SIZE:
return size != SIZE_EDEFAULT;
case ReportDSLPackage.PAGE_TEMPLATE__ORIENTATION:
return orientation != ORIENTATION_EDEFAULT;
case ReportDSLPackage.PAGE_TEMPLATE__TOP_MARGIN_VALUE:
return topMarginValue != TOP_MARGIN_VALUE_EDEFAULT;
case ReportDSLPackage.PAGE_TEMPLATE__LEFT_MARGIN_VALUE:
return leftMarginValue != LEFT_MARGIN_VALUE_EDEFAULT;
case ReportDSLPackage.PAGE_TEMPLATE__BOTTOM_MARGIN_VALUE:
return bottomMarginValue != BOTTOM_MARGIN_VALUE_EDEFAULT;
case ReportDSLPackage.PAGE_TEMPLATE__RIGHT_MARGIN_VALUE:
return rightMarginValue != RIGHT_MARGIN_VALUE_EDEFAULT;
case ReportDSLPackage.PAGE_TEMPLATE__HEADER:
return header != null;
case ReportDSLPackage.PAGE_TEMPLATE__FOOTER:
return footer != null;
}
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(" (size: ");
result.append(size);
result.append(", orientation: ");
result.append(orientation);
result.append(", topMarginValue: ");
result.append(topMarginValue);
result.append(", leftMarginValue: ");
result.append(leftMarginValue);
result.append(", bottomMarginValue: ");
result.append(bottomMarginValue);
result.append(", rightMarginValue: ");
result.append(rightMarginValue);
result.append(')');
return result.toString();
}
} //PageTemplateImpl