| /******************************************************************************* |
| * Copyright (c) 2009, 2013 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0, which accompanies this distribution |
| * and is available at https://www.eclipse.org/legal/epl-2.0/. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.ui.internal.jpa2.details; |
| |
| import org.eclipse.jface.resource.ResourceManager; |
| import org.eclipse.jpt.common.ui.WidgetFactory; |
| import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; |
| import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; |
| import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0; |
| import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentity2_0; |
| import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneMapping2_0; |
| import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneRelationship2_0; |
| import org.eclipse.jpt.jpa.ui.internal.details.AbstractManyToOneMappingComposite; |
| import org.eclipse.swt.widgets.Composite; |
| |
| public abstract class AbstractManyToOneMappingComposite2_0<T extends ManyToOneMapping2_0, R extends ManyToOneRelationship2_0, C extends Cascade2_0> |
| extends AbstractManyToOneMappingComposite<T, R, C> |
| { |
| protected AbstractManyToOneMappingComposite2_0( |
| PropertyValueModel<? extends T> mappingModel, |
| PropertyValueModel<Boolean> enabledModel, |
| Composite parentComposite, |
| WidgetFactory widgetFactory, |
| ResourceManager resourceManager) { |
| super(mappingModel, enabledModel, parentComposite, widgetFactory, resourceManager); |
| } |
| |
| @Override |
| protected void initializeLayout(Composite container) { |
| initializeManyToOneCollapsibleSection(container); |
| initializeDerivedIdentityCollapsibleSection(container); |
| initializeJoiningStrategyCollapsibleSection(container); |
| } |
| |
| protected void initializeDerivedIdentityCollapsibleSection(Composite container) { |
| new DerivedIdentityPane2_0(this, buildDerivedIdentityModel(), container); |
| } |
| |
| @Override |
| protected void initializeJoiningStrategyCollapsibleSection(Composite container) { |
| new ManyToOneJoiningStrategyPane2_0(this, buildRelationshipModel(), container); |
| } |
| |
| protected PropertyValueModel<DerivedIdentity2_0> buildDerivedIdentityModel() { |
| return new PropertyAspectAdapter<T, DerivedIdentity2_0>(getSubjectHolder()) { |
| @Override |
| protected DerivedIdentity2_0 buildValue_() { |
| return this.subject.getDerivedIdentity(); |
| } |
| }; |
| } |
| } |