kmoore | d9d1cec | 2011-02-06 02:18:04 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2006, 2011 Oracle. All rights reserved. |
| 3 | * This program and the accompanying materials are made available under the |
| 4 | * terms of the Eclipse Public License v1.0, which accompanies this distribution |
| 5 | * and is available at http://www.eclipse.org/legal/epl-v10.html. |
| 6 | * |
| 7 | * Contributors: |
| 8 | * Oracle - initial API and implementation |
| 9 | ******************************************************************************/ |
| 10 | package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; |
| 11 | |
| 12 | import org.eclipse.jpt.common.ui.WidgetFactory; |
| 13 | import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; |
| 14 | import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; |
| 15 | import org.eclipse.jpt.jpa.core.context.ManyToManyMapping; |
| 16 | import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship; |
| 17 | import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; |
| 18 | import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkRelationshipMapping; |
| 19 | import org.eclipse.jpt.jpa.ui.details.JpaComposite; |
| 20 | import org.eclipse.jpt.jpa.ui.internal.details.AbstractManyToManyMappingComposite; |
| 21 | import org.eclipse.jpt.jpa.ui.internal.details.CascadeComposite; |
| 22 | import org.eclipse.jpt.jpa.ui.internal.details.FetchTypeComposite; |
| 23 | import org.eclipse.jpt.jpa.ui.internal.details.ManyToManyJoiningStrategyPane; |
| 24 | import org.eclipse.jpt.jpa.ui.internal.details.OrderingComposite; |
| 25 | import org.eclipse.jpt.jpa.ui.internal.details.TargetEntityComposite; |
| 26 | import org.eclipse.swt.widgets.Composite; |
| 27 | |
| 28 | /** |
| 29 | * Here the layout of this pane: |
| 30 | * <pre> |
| 31 | * ----------------------------------------------------------------------------- |
| 32 | * | ------------------------------------------------------------------------- | |
| 33 | * | | | | |
| 34 | * | | TargetEntityComposite | | |
| 35 | * | | | | |
| 36 | * | ------------------------------------------------------------------------- | |
| 37 | * | ------------------------------------------------------------------------- | |
| 38 | * | | | | |
| 39 | * | | JoiningStrategyComposite | | |
| 40 | * | | | | |
| 41 | * | ------------------------------------------------------------------------- | |
| 42 | * | ------------------------------------------------------------------------- | |
| 43 | * | | | | |
| 44 | * | | FetchTypeComposite | | |
| 45 | * | | | | |
| 46 | * | ------------------------------------------------------------------------- | |
| 47 | * | ------------------------------------------------------------------------- | |
| 48 | * | | | | |
| 49 | * | | CascadeComposite | | |
| 50 | * | | | | |
| 51 | * | ------------------------------------------------------------------------- | |
| 52 | * | ------------------------------------------------------------------------- | |
| 53 | * | | | | |
| 54 | * | | OrderingComposite | | |
| 55 | * | | | | |
| 56 | * | ------------------------------------------------------------------------- | |
| 57 | * -----------------------------------------------------------------------------</pre> |
| 58 | * |
| 59 | * @see {@link ManyToManyMapping} |
| 60 | * @see {@link TargetEntityComposite} |
| 61 | * @see {@link ManyToManyJoiningStrategyPane} |
| 62 | * @see {@link FetchTypeComposite} |
| 63 | * @see {@link CascadeComposite} |
| 64 | * @see {@link OrderingComposite} |
| 65 | * |
| 66 | * @version 2.3 |
| 67 | * @since 2.1 |
| 68 | */ |
| 69 | public class EclipseLinkManyToManyMappingComposite<T extends ManyToManyMapping> |
| 70 | extends AbstractManyToManyMappingComposite<T, ManyToManyRelationship> |
| 71 | implements JpaComposite |
| 72 | { |
| 73 | /** |
| 74 | * Creates a new <code>ManyToManyMappingComposite</code>. |
| 75 | * |
| 76 | * @param subjectHolder The holder of the subject <code>IManyToManyMapping</code> |
| 77 | * @param parent The parent container |
| 78 | * @param widgetFactory The factory used to create various common widgets |
| 79 | */ |
| 80 | public EclipseLinkManyToManyMappingComposite(PropertyValueModel<? extends T> subjectHolder, |
| 81 | Composite parent, |
| 82 | WidgetFactory widgetFactory) { |
| 83 | |
| 84 | super(subjectHolder, parent, widgetFactory); |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | protected void initializeManyToManySection(Composite container) { |
| 89 | new TargetEntityComposite(this, container); |
| 90 | new FetchTypeComposite(this, container); |
| 91 | new EclipseLinkJoinFetchComposite(this, buildJoinFetchableHolder(), container); |
| 92 | new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5)); |
| 93 | } |
| 94 | |
| 95 | protected PropertyValueModel<EclipseLinkJoinFetch> buildJoinFetchableHolder() { |
| 96 | return new PropertyAspectAdapter<ManyToManyMapping, EclipseLinkJoinFetch>(getSubjectHolder()) { |
| 97 | @Override |
| 98 | protected EclipseLinkJoinFetch buildValue_() { |
| 99 | return ((EclipseLinkRelationshipMapping) this.subject).getJoinFetch(); |
| 100 | } |
| 101 | }; |
| 102 | } |
| 103 | } |