| /******************************************************************************* |
| * Copyright (c) 2009, 2015 Xored Software Inc and others. |
| * 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 |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.ecl.data.apache.poi.commands.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.rcptt.ecl.core.impl.CommandImpl; |
| import org.eclipse.rcptt.ecl.data.apache.poi.commands.CommandsPackage; |
| import org.eclipse.rcptt.ecl.data.apache.poi.commands.WriteExcelFile; |
| import org.eclipse.rcptt.ecl.data.objects.Table; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Write Excel File</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.ecl.data.apache.poi.commands.impl.WriteExcelFileImpl#getTables <em>Tables</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.data.apache.poi.commands.impl.WriteExcelFileImpl#getUri <em>Uri</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.data.apache.poi.commands.impl.WriteExcelFileImpl#isAppend <em>Append</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class WriteExcelFileImpl extends CommandImpl implements WriteExcelFile { |
| /** |
| * The cached value of the '{@link #getTables() <em>Tables</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTables() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Table> tables; |
| |
| /** |
| * The default value of the '{@link #getUri() <em>Uri</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUri() |
| * @generated |
| * @ordered |
| */ |
| protected static final String URI_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUri() |
| * @generated |
| * @ordered |
| */ |
| protected String uri = URI_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isAppend() <em>Append</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isAppend() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean APPEND_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isAppend() <em>Append</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isAppend() |
| * @generated |
| * @ordered |
| */ |
| protected boolean append = APPEND_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected WriteExcelFileImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CommandsPackage.Literals.WRITE_EXCEL_FILE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Table> getTables() { |
| if (tables == null) { |
| tables = new EObjectResolvingEList<Table>(Table.class, this, CommandsPackage.WRITE_EXCEL_FILE__TABLES); |
| } |
| return tables; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getUri() { |
| return uri; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setUri(String newUri) { |
| String oldUri = uri; |
| uri = newUri; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CommandsPackage.WRITE_EXCEL_FILE__URI, oldUri, uri)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isAppend() { |
| return append; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAppend(boolean newAppend) { |
| boolean oldAppend = append; |
| append = newAppend; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CommandsPackage.WRITE_EXCEL_FILE__APPEND, oldAppend, append)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case CommandsPackage.WRITE_EXCEL_FILE__TABLES: |
| return getTables(); |
| case CommandsPackage.WRITE_EXCEL_FILE__URI: |
| return getUri(); |
| case CommandsPackage.WRITE_EXCEL_FILE__APPEND: |
| return isAppend(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CommandsPackage.WRITE_EXCEL_FILE__TABLES: |
| getTables().clear(); |
| getTables().addAll((Collection<? extends Table>)newValue); |
| return; |
| case CommandsPackage.WRITE_EXCEL_FILE__URI: |
| setUri((String)newValue); |
| return; |
| case CommandsPackage.WRITE_EXCEL_FILE__APPEND: |
| setAppend((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CommandsPackage.WRITE_EXCEL_FILE__TABLES: |
| getTables().clear(); |
| return; |
| case CommandsPackage.WRITE_EXCEL_FILE__URI: |
| setUri(URI_EDEFAULT); |
| return; |
| case CommandsPackage.WRITE_EXCEL_FILE__APPEND: |
| setAppend(APPEND_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CommandsPackage.WRITE_EXCEL_FILE__TABLES: |
| return tables != null && !tables.isEmpty(); |
| case CommandsPackage.WRITE_EXCEL_FILE__URI: |
| return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri); |
| case CommandsPackage.WRITE_EXCEL_FILE__APPEND: |
| return append != APPEND_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(" (uri: "); |
| result.append(uri); |
| result.append(", append: "); |
| result.append(append); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //WriteExcelFileImpl |