| /******************************************************************************* |
| * Copyright (c) 2009, 2019 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 v2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.tesla.ecl.model.impl; |
| |
| import org.eclipse.rcptt.tesla.ecl.model.ControlHandler; |
| import org.eclipse.rcptt.tesla.ecl.model.Select; |
| import org.eclipse.rcptt.tesla.ecl.model.TeslaPackage; |
| |
| 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.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| import org.eclipse.rcptt.ecl.core.impl.CommandImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Select</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SelectImpl#getControl <em>Control</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SelectImpl#getItems <em>Items</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SelectImpl#isAll <em>All</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SelectImpl#getColumn <em>Column</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SelectImpl extends CommandImpl implements Select { |
| /** |
| * The cached value of the '{@link #getControl() <em>Control</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getControl() |
| * @generated |
| * @ordered |
| */ |
| protected ControlHandler control; |
| |
| /** |
| * The cached value of the '{@link #getItems() <em>Items</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getItems() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Object> items; |
| |
| /** |
| * The default value of the '{@link #isAll() <em>All</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isAll() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean ALL_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isAll() <em>All</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isAll() |
| * @generated |
| * @ordered |
| */ |
| protected boolean all = ALL_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getColumn() <em>Column</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColumn() |
| * @generated |
| * @ordered |
| */ |
| protected static final String COLUMN_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getColumn() <em>Column</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColumn() |
| * @generated |
| * @ordered |
| */ |
| protected String column = COLUMN_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SelectImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return TeslaPackage.Literals.SELECT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ControlHandler getControl() { |
| if (control != null && control.eIsProxy()) { |
| InternalEObject oldControl = (InternalEObject)control; |
| control = (ControlHandler)eResolveProxy(oldControl); |
| if (control != oldControl) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, TeslaPackage.SELECT__CONTROL, oldControl, control)); |
| } |
| } |
| return control; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ControlHandler basicGetControl() { |
| return control; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setControl(ControlHandler newControl) { |
| ControlHandler oldControl = control; |
| control = newControl; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SELECT__CONTROL, oldControl, control)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Object> getItems() { |
| if (items == null) { |
| items = new EDataTypeUniqueEList<Object>(Object.class, this, TeslaPackage.SELECT__ITEMS); |
| } |
| return items; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isAll() { |
| return all; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAll(boolean newAll) { |
| boolean oldAll = all; |
| all = newAll; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SELECT__ALL, oldAll, all)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getColumn() { |
| return column; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setColumn(String newColumn) { |
| String oldColumn = column; |
| column = newColumn; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SELECT__COLUMN, oldColumn, column)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case TeslaPackage.SELECT__CONTROL: |
| if (resolve) return getControl(); |
| return basicGetControl(); |
| case TeslaPackage.SELECT__ITEMS: |
| return getItems(); |
| case TeslaPackage.SELECT__ALL: |
| return isAll(); |
| case TeslaPackage.SELECT__COLUMN: |
| return getColumn(); |
| } |
| 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 TeslaPackage.SELECT__CONTROL: |
| setControl((ControlHandler)newValue); |
| return; |
| case TeslaPackage.SELECT__ITEMS: |
| getItems().clear(); |
| getItems().addAll((Collection<? extends Object>)newValue); |
| return; |
| case TeslaPackage.SELECT__ALL: |
| setAll((Boolean)newValue); |
| return; |
| case TeslaPackage.SELECT__COLUMN: |
| setColumn((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case TeslaPackage.SELECT__CONTROL: |
| setControl((ControlHandler)null); |
| return; |
| case TeslaPackage.SELECT__ITEMS: |
| getItems().clear(); |
| return; |
| case TeslaPackage.SELECT__ALL: |
| setAll(ALL_EDEFAULT); |
| return; |
| case TeslaPackage.SELECT__COLUMN: |
| setColumn(COLUMN_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case TeslaPackage.SELECT__CONTROL: |
| return control != null; |
| case TeslaPackage.SELECT__ITEMS: |
| return items != null && !items.isEmpty(); |
| case TeslaPackage.SELECT__ALL: |
| return all != ALL_EDEFAULT; |
| case TeslaPackage.SELECT__COLUMN: |
| return COLUMN_EDEFAULT == null ? column != null : !COLUMN_EDEFAULT.equals(column); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (items: "); |
| result.append(items); |
| result.append(", all: "); |
| result.append(all); |
| result.append(", column: "); |
| result.append(column); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SelectImpl |