| /******************************************************************************* |
| * 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.ui.impl; |
| |
| import org.eclipse.rcptt.tesla.core.ui.Combo; |
| import org.eclipse.rcptt.tesla.core.ui.UiPackage; |
| |
| 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.EDataTypeEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Combo</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.ui.impl.ComboImpl#getTooltip <em>Tooltip</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.ui.impl.ComboImpl#getSelection <em>Selection</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.ui.impl.ComboImpl#isReadOnly <em>Read Only</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.ui.impl.ComboImpl#getValues <em>Values</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ComboImpl extends ControlImpl implements Combo { |
| /** |
| * The default value of the '{@link #getTooltip() <em>Tooltip</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTooltip() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TOOLTIP_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getTooltip() <em>Tooltip</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTooltip() |
| * @generated |
| * @ordered |
| */ |
| protected String tooltip = TOOLTIP_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getSelection() <em>Selection</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSelection() |
| * @generated |
| * @ordered |
| */ |
| protected static final String SELECTION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getSelection() <em>Selection</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSelection() |
| * @generated |
| * @ordered |
| */ |
| protected String selection = SELECTION_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isReadOnly() <em>Read Only</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isReadOnly() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean READ_ONLY_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isReadOnly() <em>Read Only</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isReadOnly() |
| * @generated |
| * @ordered |
| */ |
| protected boolean readOnly = READ_ONLY_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getValues() <em>Values</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValues() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> values; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ComboImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UiPackage.Literals.COMBO; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getTooltip() { |
| return tooltip; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTooltip(String newTooltip) { |
| String oldTooltip = tooltip; |
| tooltip = newTooltip; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UiPackage.COMBO__TOOLTIP, oldTooltip, tooltip)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getSelection() { |
| return selection; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSelection(String newSelection) { |
| String oldSelection = selection; |
| selection = newSelection; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UiPackage.COMBO__SELECTION, oldSelection, selection)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isReadOnly() { |
| return readOnly; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setReadOnly(boolean newReadOnly) { |
| boolean oldReadOnly = readOnly; |
| readOnly = newReadOnly; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UiPackage.COMBO__READ_ONLY, oldReadOnly, readOnly)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getValues() { |
| if (values == null) { |
| values = new EDataTypeEList<String>(String.class, this, UiPackage.COMBO__VALUES); |
| } |
| return values; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case UiPackage.COMBO__TOOLTIP: |
| return getTooltip(); |
| case UiPackage.COMBO__SELECTION: |
| return getSelection(); |
| case UiPackage.COMBO__READ_ONLY: |
| return isReadOnly(); |
| case UiPackage.COMBO__VALUES: |
| return getValues(); |
| } |
| 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 UiPackage.COMBO__TOOLTIP: |
| setTooltip((String)newValue); |
| return; |
| case UiPackage.COMBO__SELECTION: |
| setSelection((String)newValue); |
| return; |
| case UiPackage.COMBO__READ_ONLY: |
| setReadOnly((Boolean)newValue); |
| return; |
| case UiPackage.COMBO__VALUES: |
| getValues().clear(); |
| getValues().addAll((Collection<? extends String>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UiPackage.COMBO__TOOLTIP: |
| setTooltip(TOOLTIP_EDEFAULT); |
| return; |
| case UiPackage.COMBO__SELECTION: |
| setSelection(SELECTION_EDEFAULT); |
| return; |
| case UiPackage.COMBO__READ_ONLY: |
| setReadOnly(READ_ONLY_EDEFAULT); |
| return; |
| case UiPackage.COMBO__VALUES: |
| getValues().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UiPackage.COMBO__TOOLTIP: |
| return TOOLTIP_EDEFAULT == null ? tooltip != null : !TOOLTIP_EDEFAULT.equals(tooltip); |
| case UiPackage.COMBO__SELECTION: |
| return SELECTION_EDEFAULT == null ? selection != null : !SELECTION_EDEFAULT.equals(selection); |
| case UiPackage.COMBO__READ_ONLY: |
| return readOnly != READ_ONLY_EDEFAULT; |
| case UiPackage.COMBO__VALUES: |
| return values != null && !values.isEmpty(); |
| } |
| 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(" (tooltip: "); |
| result.append(tooltip); |
| result.append(", selection: "); |
| result.append(selection); |
| result.append(", readOnly: "); |
| result.append(readOnly); |
| result.append(", values: "); |
| result.append(values); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ComboImpl |