blob: 36a1891ecd48210bdf22816df25e84abf8a29390 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006, 2009 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.ui.internal.details;
import org.eclipse.jpt.core.context.Cascade;
import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.core.context.ManyToManyRelationshipReference;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.BaseJpaUiFactory;
import org.eclipse.jpt.ui.internal.widgets.FormPane;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
/**
* Here the layout of this pane:
* <pre>
* -----------------------------------------------------------------------------
* | ------------------------------------------------------------------------- |
* | | | |
* | | TargetEntityComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | JoiningStrategyComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | FetchTypeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | CascadeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | OrderingComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* -----------------------------------------------------------------------------</pre>
*
* @see {@link ManyToManyMapping}
* @see {@link BaseJpaUiFactory} - The factory creating this pane
* @see {@link TargetEntityComposite}
* @see {@link ManyToManyJoiningStrategyPane}
* @see {@link FetchTypeComposite}
* @see {@link CascadeComposite}
* @see {@link OrderingComposite}
*
* @version 2.0
* @since 1.0
*/
public abstract class AbstractManyToManyMappingComposite<T extends ManyToManyMapping>
extends FormPane<T>
implements JpaComposite
{
/**
* Creates a new <code>ManyToManyMappingComposite</code>.
*
* @param subjectHolder The holder of the subject <code>IManyToManyMapping</code>
* @param parent The parent container
* @param widgetFactory The factory used to create various common widgets
*/
protected AbstractManyToManyMappingComposite(PropertyValueModel<? extends T> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
super(subjectHolder, parent, widgetFactory);
}
protected Composite addPane(Composite container, int groupBoxMargin) {
return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
}
protected PropertyValueModel<ManyToManyRelationshipReference> buildJoiningHolder() {
return new TransformationPropertyValueModel<T, ManyToManyRelationshipReference>(
getSubjectHolder()) {
@Override
protected ManyToManyRelationshipReference transform_(T value) {
return value.getRelationshipReference();
}
};
}
protected PropertyValueModel<Cascade> buildCascadeHolder() {
return new TransformationPropertyValueModel<T, Cascade>(getSubjectHolder()) {
@Override
protected Cascade transform_(T value) {
return value.getCascade();
}
};
}
}