blob: 43ce100aa3a79ae58fa005c1ccb1f199f22de1c0 [file] [log] [blame]
/*******************************************************************************
* 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.details;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.OneToManyRelationship;
import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.Section;
/**
* Here is the layout of this pane:
* <pre>
* -----------------------------------------------------------------------------
* | - Joining Strategy ------------------------------------------------------ |
* | | | |
* | | o MappedByJoiningStrategyPane _______________________________________ | |
* | | | | | |
* | | | | | |
* | | --------------------------------------------------------------------- | |
* | | o JoinTableStrategyPane _____________________________________________ | |
* | | | | | |
* | | | | | |
* | | --------------------------------------------------------------------- | |
* | ------------------------------------------------------------------------- |
* -----------------------------------------------------------------------------</pre>
*
* @version 2.3
* @since 2.1
*/
public class OneToManyJoiningStrategyPane
extends Pane<OneToManyRelationship>
{
public OneToManyJoiningStrategyPane(
Pane<?> parentPane,
PropertyValueModel<? extends OneToManyRelationship> subjectHolder,
Composite parent) {
super(parentPane, subjectHolder, parent);
}
@Override
protected Composite addComposite(Composite container) {
Section section = this.getWidgetFactory().createSection(container,
ExpandableComposite.TITLE_BAR |
ExpandableComposite.TWISTIE |
ExpandableComposite.EXPANDED);
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
section.setText(JptJpaUiDetailsMessages.JOINING_TITLE);
Composite client = this.getWidgetFactory().createComposite(section);
client.setLayout(new GridLayout(1, false));
client.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setClient(client);
return client;
}
@Override
protected void initializeLayout(Composite container) {
addRadioButton(
container,
JptJpaUiDetailsMessages.JOINING_MAPPED_BY_LABEL,
MappedByJoiningStrategyPane.buildUsesMappedByJoiningStrategyHolder(getSubjectHolder()),
null);
new MappedByJoiningStrategyPane(this, container);
addRadioButton(
container,
JptJpaUiDetailsMessages.JOINING_JOIN_TABLE_JOINING_LABEL,
JoinTableJoiningStrategyPane.buildUsesJoinTableJoiningStrategyHolder(getSubjectHolder()),
null);
new JoinTableJoiningStrategyPane(this, container);
}
}