| /******************************************************************************* |
| * 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.java; |
| |
| import org.eclipse.jface.resource.ResourceManager; |
| import org.eclipse.jpt.common.ui.WidgetFactory; |
| 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.ManyToOneMapping2_0; |
| import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneRelationship2_0; |
| import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; |
| import org.eclipse.jpt.jpa.ui.internal.details.FetchTypeComboViewer; |
| import org.eclipse.jpt.jpa.ui.internal.details.OptionalTriStateCheckBox; |
| import org.eclipse.jpt.jpa.ui.internal.details.TargetEntityClassChooser; |
| import org.eclipse.jpt.jpa.ui.internal.jpa2.details.AbstractManyToOneMappingComposite2_0; |
| import org.eclipse.jpt.jpa.ui.internal.jpa2.details.CascadePane2_0; |
| import org.eclipse.swt.layout.GridData; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Control; |
| import org.eclipse.ui.forms.widgets.Hyperlink; |
| |
| public class JavaManyToOneMappingComposite2_0 |
| extends AbstractManyToOneMappingComposite2_0<ManyToOneMapping2_0, JavaManyToOneRelationship2_0, Cascade2_0> |
| { |
| public JavaManyToOneMappingComposite2_0( |
| PropertyValueModel<? extends ManyToOneMapping2_0> mappingModel, |
| PropertyValueModel<Boolean> enabledModel, |
| Composite parentComposite, |
| WidgetFactory widgetFactory, |
| ResourceManager resourceManager) { |
| super(mappingModel, enabledModel, parentComposite, widgetFactory, resourceManager); |
| } |
| |
| |
| @Override |
| protected Control initializeManyToOneSection(Composite container) { |
| container = this.addSubPane(container, 2, 0, 0, 0, 0); |
| |
| // Target entity widgets |
| Hyperlink targetEntityHyperlink = this.addHyperlink(container, JptJpaUiDetailsMessages.TARGET_ENTITY_CHOOSER_LABEL); |
| new TargetEntityClassChooser(this, container, targetEntityHyperlink); |
| |
| // Fetch type widgets |
| this.addLabel(container, JptJpaUiDetailsMessages.BASIC_GENERAL_SECTION_FETCH_LABEL); |
| new FetchTypeComboViewer(this, container); |
| |
| // Optional widgets |
| OptionalTriStateCheckBox optionalCheckBox = new OptionalTriStateCheckBox(this, container); |
| GridData gridData = new GridData(); |
| gridData.horizontalSpan = 2; |
| optionalCheckBox.getControl().setLayoutData(gridData); |
| |
| // Cascade widgets |
| CascadePane2_0 cascadePane = new CascadePane2_0(this, buildCascadeModel(), container); |
| gridData = new GridData(GridData.FILL_HORIZONTAL); |
| gridData.horizontalSpan = 2; |
| cascadePane.getControl().setLayoutData(gridData); |
| |
| return container; |
| } |
| } |