| /******************************************************************************* |
| * 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.core.protocol.impl; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.MouseEvent; |
| import org.eclipse.rcptt.tesla.core.protocol.MouseEventKind; |
| import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.raw.Element; |
| |
| 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.emf.ecore.impl.EObjectImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Mouse Event</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getElement <em>Element</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getKind <em>Kind</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getButton <em>Button</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getStateMask <em>State Mask</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getCount <em>Count</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getX <em>X</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MouseEventImpl#getY <em>Y</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MouseEventImpl extends EObjectImpl implements MouseEvent { |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final int ID_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected int id = ID_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getElement() <em>Element</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getElement() |
| * @generated |
| * @ordered |
| */ |
| protected Element element; |
| |
| /** |
| * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected static final MouseEventKind KIND_EDEFAULT = MouseEventKind.DOWN; |
| |
| /** |
| * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected MouseEventKind kind = KIND_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getButton() <em>Button</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getButton() |
| * @generated |
| * @ordered |
| */ |
| protected static final int BUTTON_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getButton() <em>Button</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getButton() |
| * @generated |
| * @ordered |
| */ |
| protected int button = BUTTON_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getStateMask() <em>State Mask</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStateMask() |
| * @generated |
| * @ordered |
| */ |
| protected static final int STATE_MASK_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getStateMask() <em>State Mask</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStateMask() |
| * @generated |
| * @ordered |
| */ |
| protected int stateMask = STATE_MASK_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getCount() <em>Count</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCount() |
| * @generated |
| * @ordered |
| */ |
| protected static final int COUNT_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getCount() <em>Count</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCount() |
| * @generated |
| * @ordered |
| */ |
| protected int count = COUNT_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getX() <em>X</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getX() |
| * @generated |
| * @ordered |
| */ |
| protected static final int X_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getX() <em>X</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getX() |
| * @generated |
| * @ordered |
| */ |
| protected int x = X_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getY() <em>Y</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getY() |
| * @generated |
| * @ordered |
| */ |
| protected static final int Y_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getY() <em>Y</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getY() |
| * @generated |
| * @ordered |
| */ |
| protected int y = Y_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MouseEventImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ProtocolPackage.Literals.MOUSE_EVENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(int newId) { |
| int oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getElement() { |
| return element; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetElement(Element newElement, NotificationChain msgs) { |
| Element oldElement = element; |
| element = newElement; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__ELEMENT, oldElement, newElement); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setElement(Element newElement) { |
| if (newElement != element) { |
| NotificationChain msgs = null; |
| if (element != null) |
| msgs = ((InternalEObject)element).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.MOUSE_EVENT__ELEMENT, null, msgs); |
| if (newElement != null) |
| msgs = ((InternalEObject)newElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.MOUSE_EVENT__ELEMENT, null, msgs); |
| msgs = basicSetElement(newElement, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__ELEMENT, newElement, newElement)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MouseEventKind getKind() { |
| return kind; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setKind(MouseEventKind newKind) { |
| MouseEventKind oldKind = kind; |
| kind = newKind == null ? KIND_EDEFAULT : newKind; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__KIND, oldKind, kind)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getButton() { |
| return button; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setButton(int newButton) { |
| int oldButton = button; |
| button = newButton; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__BUTTON, oldButton, button)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getStateMask() { |
| return stateMask; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setStateMask(int newStateMask) { |
| int oldStateMask = stateMask; |
| stateMask = newStateMask; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__STATE_MASK, oldStateMask, stateMask)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getCount() { |
| return count; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCount(int newCount) { |
| int oldCount = count; |
| count = newCount; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__COUNT, oldCount, count)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getX() { |
| return x; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setX(int newX) { |
| int oldX = x; |
| x = newX; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__X, oldX, x)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getY() { |
| return y; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setY(int newY) { |
| int oldY = y; |
| y = newY; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.MOUSE_EVENT__Y, oldY, y)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ProtocolPackage.MOUSE_EVENT__ELEMENT: |
| return basicSetElement(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 ProtocolPackage.MOUSE_EVENT__ID: |
| return getId(); |
| case ProtocolPackage.MOUSE_EVENT__ELEMENT: |
| return getElement(); |
| case ProtocolPackage.MOUSE_EVENT__KIND: |
| return getKind(); |
| case ProtocolPackage.MOUSE_EVENT__BUTTON: |
| return getButton(); |
| case ProtocolPackage.MOUSE_EVENT__STATE_MASK: |
| return getStateMask(); |
| case ProtocolPackage.MOUSE_EVENT__COUNT: |
| return getCount(); |
| case ProtocolPackage.MOUSE_EVENT__X: |
| return getX(); |
| case ProtocolPackage.MOUSE_EVENT__Y: |
| return getY(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ProtocolPackage.MOUSE_EVENT__ID: |
| setId((Integer)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__ELEMENT: |
| setElement((Element)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__KIND: |
| setKind((MouseEventKind)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__BUTTON: |
| setButton((Integer)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__STATE_MASK: |
| setStateMask((Integer)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__COUNT: |
| setCount((Integer)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__X: |
| setX((Integer)newValue); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__Y: |
| setY((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.MOUSE_EVENT__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__ELEMENT: |
| setElement((Element)null); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__KIND: |
| setKind(KIND_EDEFAULT); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__BUTTON: |
| setButton(BUTTON_EDEFAULT); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__STATE_MASK: |
| setStateMask(STATE_MASK_EDEFAULT); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__COUNT: |
| setCount(COUNT_EDEFAULT); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__X: |
| setX(X_EDEFAULT); |
| return; |
| case ProtocolPackage.MOUSE_EVENT__Y: |
| setY(Y_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.MOUSE_EVENT__ID: |
| return id != ID_EDEFAULT; |
| case ProtocolPackage.MOUSE_EVENT__ELEMENT: |
| return element != null; |
| case ProtocolPackage.MOUSE_EVENT__KIND: |
| return kind != KIND_EDEFAULT; |
| case ProtocolPackage.MOUSE_EVENT__BUTTON: |
| return button != BUTTON_EDEFAULT; |
| case ProtocolPackage.MOUSE_EVENT__STATE_MASK: |
| return stateMask != STATE_MASK_EDEFAULT; |
| case ProtocolPackage.MOUSE_EVENT__COUNT: |
| return count != COUNT_EDEFAULT; |
| case ProtocolPackage.MOUSE_EVENT__X: |
| return x != X_EDEFAULT; |
| case ProtocolPackage.MOUSE_EVENT__Y: |
| return y != Y_EDEFAULT; |
| } |
| 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(" (id: "); |
| result.append(id); |
| result.append(", kind: "); |
| result.append(kind); |
| result.append(", button: "); |
| result.append(button); |
| result.append(", stateMask: "); |
| result.append(stateMask); |
| result.append(", count: "); |
| result.append(count); |
| result.append(", x: "); |
| result.append(x); |
| result.append(", y: "); |
| result.append(y); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MouseEventImpl |