blob: 535ae4a01737dcd8ed1092599010d07a31d60fac [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006, 2008 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.mappings.details;
import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.core.context.Column;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.BaseJpaUiFactory;
import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
* Here the layout of this pane:
* <pre>
* -----------------------------------------------------------------------------
* | ------------------------------------------------------------------------- |
* | | | |
* | | ColumnComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | FetchTypeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | TemporalTypeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | EnumTypeComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | OptionalComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* | ------------------------------------------------------------------------- |
* | | | |
* | | LobComposite | |
* | | | |
* | ------------------------------------------------------------------------- |
* -----------------------------------------------------------------------------</pre>
*
* @see BasicMapping
* @see BaseJpaUiFactory - The factory creating this pane
* @see ColumnComposite
* @see EnumTypeComposite
* @see FetchTypeComposite
* @see LobComposite
* @see OptionalComposite
* @see TemporalTypeComposite
*
* @version 2.0
* @since 1.0
*/
public class BasicMappingComposite extends AbstractFormPane<BasicMapping>
implements JpaComposite<BasicMapping>
{
/**
* Creates a new <code>BasicMappingComposite</code>.
*
* @param subjectHolder The holder of the subject <code>IBasicMapping</code>
* @param parent The parent container
* @param widgetFactory The factory used to create various common widgets
*/
public BasicMappingComposite(PropertyValueModel<BasicMapping> subjectHolder,
Composite parent,
TabbedPropertySheetWidgetFactory widgetFactory) {
super(subjectHolder, parent, widgetFactory);
}
private PropertyValueModel<Column> buildColumnHolder() {
return new TransformationPropertyValueModel<BasicMapping, Column>(getSubjectHolder()) {
@Override
protected Column transform_(BasicMapping value) {
return value.getColumn();
}
};
}
/*
* (non-Javadoc)
*/
@Override
protected void initializeLayout(Composite container) {
int groupBoxMargin = groupBoxMargin();
// Column widgets
new ColumnComposite(this, buildColumnHolder(), container);
// Align the widgets under the ColumnComposite
container = buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
// Fetch Type widgets
new FetchTypeComposite(this, container);
// Temporal Type widgets
new TemporalTypeComposite(this, container);
// Enumerated widgets
new EnumTypeComposite(this, container);
// Optional widgets
new OptionalComposite(this, buildSubPane(container, 4));
// Lob check box
new LobComposite(this, container);
}
}