blob: 2946d3b608f1b694c822c88cff5536f408a62d70 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2010 Oracle. 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:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.eclipselink.ui.internal.details;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyRelationshipReference;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.details.AbstractOneToManyMappingComposite;
import org.eclipse.jpt.ui.internal.details.CascadeComposite;
import org.eclipse.jpt.ui.internal.details.FetchTypeComposite;
import org.eclipse.jpt.ui.internal.details.OrderingComposite;
import org.eclipse.jpt.ui.internal.details.TargetEntityComposite;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
/**
* Here the layout of this pane:
* <pre>
* -----------------------------------------------------------------------------
* | ------------------------------------------------------------------------- |
* | | | |
* | | TargetEntityComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | EclipseLinkOneToManyJoiningStrategyPane | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | FetchTypeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | EclipseLinkJoinFetchComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | EclipseLinkvateOwnedComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | CascadeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | OrderingComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* -----------------------------------------------------------------------------</pre>
*
* @see OneToOneMapping
* @see CascadeComposite
* @see EclipseLinkJoinFetchComposite
* @see EclipseLinkJoinFetchComposite
* @see EclipseLinkOneToManyJoiningStrategyPane
* @see FetchTypeComposite
* @see OrderingComposite
* @see TargetEntityComposite
*
* @version 2.3
* @since 2.1
*/
public class EclipseLinkOneToManyMappingComposite<T extends OneToManyMapping>
extends AbstractOneToManyMappingComposite<T, EclipseLinkOneToManyRelationshipReference>
implements JpaComposite
{
/**
* Creates a new <code>EclipselinkOneToManyMappingComposite</code>.
*
* @param subjectHolder The holder of the subject <code>IOneToManyMapping</code>
* @param parent The parent container
* @param widgetFactory The factory used to create various common widgets
*/
public EclipseLinkOneToManyMappingComposite(PropertyValueModel<? extends T> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
super(subjectHolder, parent, widgetFactory);
}
@Override
protected void initializeOneToManySection(Composite container) {
new TargetEntityComposite(this, container);
new FetchTypeComposite(this, container);
new EclipseLinkJoinFetchComposite(this, buildJoinFetchableHolder(), container);
new EclipseLinkPrivateOwnedComposite(this, buildPrivateOwnableHolder(), container);
new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5));
}
@Override
protected void initializeJoiningStrategyCollapsibleSection(Composite container) {
new EclipseLinkOneToManyJoiningStrategyPane(this, buildJoiningHolder(), container);
}
protected PropertyValueModel<EclipseLinkPrivateOwned> buildPrivateOwnableHolder() {
return new PropertyAspectAdapter<T, EclipseLinkPrivateOwned>(getSubjectHolder()) {
@Override
protected EclipseLinkPrivateOwned buildValue_() {
return ((EclipseLinkOneToManyMapping) this.subject).getPrivateOwned();
}
};
}
protected PropertyValueModel<EclipseLinkJoinFetch> buildJoinFetchableHolder() {
return new PropertyAspectAdapter<T, EclipseLinkJoinFetch>(getSubjectHolder()) {
@Override
protected EclipseLinkJoinFetch buildValue_() {
return ((EclipseLinkOneToManyMapping) this.subject).getJoinFetch();
}
};
}
}