diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java | 252 |
1 files changed, 0 insertions, 252 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java deleted file mode 100644 index 57a2f9dbaf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkIdMappingComposite.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.context.Column; -import org.eclipse.jpt.core.context.Converter; -import org.eclipse.jpt.core.context.ConvertibleMapping; -import org.eclipse.jpt.core.context.IdMapping; -import org.eclipse.jpt.core.context.TemporalConverter; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.details.ColumnComposite; -import org.eclipse.jpt.ui.internal.mappings.details.GenerationComposite; -import org.eclipse.jpt.ui.internal.mappings.details.TemporalTypeComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.ui.internal.widgets.Pane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ------------------------------------------------------------------------- | - * | | | | - * | | ColumnComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | TemporalTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | GenerationComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see IdMapping - * @see BaseJpaUiFactory - The factory creating this pane - * @see ColumnComposite - * @see TemporalTypeComposite - * @see GenerationComposite - * - * @version 2.1 - * @since 2.1 - */ -public class EclipseLinkIdMappingComposite extends FormPane<IdMapping> - implements JpaComposite -{ - /** - * Creates a new <code>IdMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IIdMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public EclipseLinkIdMappingComposite(PropertyValueModel<? extends IdMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - private PropertyValueModel<? extends Column> buildColumnHolder() { - return new TransformationPropertyValueModel<IdMapping, Column>(getSubjectHolder()) { - @Override - protected Column transform_(IdMapping value) { - return value.getColumn(); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - initializeGeneralPane(container); - initializeTypePane(container); - - // Generation pane - new GenerationComposite(this, container); - } - - protected void initializeGeneralPane(Composite container) { - int groupBoxMargin = getGroupBoxMargin(); - - // Column widgets - new ColumnComposite(this, buildColumnHolder(), container); - - // Align the widgets under the ColumnComposite - container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - - // Mutable widgets - new MutableComposite(this, buildMutableHolder(), container); - } - - protected void initializeTypePane(Composite container) { - - container = addCollapsableSection( - addSubPane(container, 5), - JptUiMappingsMessages.TypeSection_type - ); - ((GridLayout) container.getLayout()).numColumns = 2; - - // No converter - Button noConverterButton = addRadioButton( - container, - JptUiMappingsMessages.TypeSection_default, - buildNoConverterHolder(), - null); - ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2; - - PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder(); - // Temporal - addRadioButton( - container, - JptUiMappingsMessages.TypeSection_temporal, - buildTemporalBooleanHolder(), - null); - registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory())); - - // EclipseLink Converter - Button elConverterButton = addRadioButton( - container, - EclipseLinkUiMappingsMessages.TypeSection_converted, - buildEclipseLinkConverterBooleanHolder(), - null); - ((GridData) elConverterButton.getLayoutData()).horizontalSpan = 2; - - Pane<Convert> convertComposite = buildConvertComposite(buildEclipseLinkConverterHolder(specifiedConverterHolder), container); - GridData gridData = (GridData) convertComposite.getControl().getLayoutData(); - gridData.horizontalSpan = 2; - gridData.horizontalIndent = 20; - registerSubPane(convertComposite); - } - - protected Pane<Convert> buildConvertComposite(PropertyValueModel<Convert> convertHolder, Composite container) { - return new ConvertComposite(convertHolder, container, getWidgetFactory()); - } - - protected WritablePropertyValueModel<Boolean> buildNoConverterHolder() { - return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getSpecifiedConverter() == null); - } - - @Override - protected void setValue_(Boolean value) { - if (value.booleanValue()) { - this.subject.setSpecifiedConverter(Converter.NO_CONVERTER); - } - } - }; - } - - protected PropertyValueModel<Convert> buildEclipseLinkConverterHolder(PropertyValueModel<Converter> converterHolder) { - return new TransformationPropertyValueModel<Converter, Convert>(converterHolder) { - @Override - protected Convert transform_(Converter converter) { - return (converter != null && converter.getType() == Convert.ECLIPSE_LINK_CONVERTER) ? (Convert) converter : null; - } - }; - } - - protected WritablePropertyValueModel<Boolean> buildTemporalBooleanHolder() { - return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) { - @Override - protected Boolean buildValue_() { - Converter converter = this.subject.getSpecifiedConverter(); - if (converter == null) { - return Boolean.FALSE; - } - return Boolean.valueOf(converter.getType() == Converter.TEMPORAL_CONVERTER); - } - - @Override - protected void setValue_(Boolean value) { - if (value.booleanValue()) { - this.subject.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER); - } - } - }; - } - - protected WritablePropertyValueModel<Boolean> buildEclipseLinkConverterBooleanHolder() { - return new PropertyAspectAdapter<IdMapping, Boolean>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) { - @Override - protected Boolean buildValue_() { - Converter converter = this.subject.getSpecifiedConverter(); - if (converter == null) { - return Boolean.FALSE; - } - return Boolean.valueOf(converter.getType() == Convert.ECLIPSE_LINK_CONVERTER); - } - - @Override - protected void setValue_(Boolean value) { - if (value.booleanValue()) { - this.subject.setSpecifiedConverter(Convert.ECLIPSE_LINK_CONVERTER); - } - } - }; - } - - protected PropertyValueModel<Converter> buildSpecifiedConverterHolder() { - return new PropertyAspectAdapter<IdMapping, Converter>(getSubjectHolder(), ConvertibleMapping.SPECIFIED_CONVERTER_PROPERTY) { - @Override - protected Converter buildValue_() { - return this.subject.getSpecifiedConverter(); - } - }; - } - - protected PropertyValueModel<TemporalConverter> buildTemporalConverterHolder(PropertyValueModel<Converter> converterHolder) { - return new TransformationPropertyValueModel<Converter, TemporalConverter>(converterHolder) { - @Override - protected TemporalConverter transform_(Converter converter) { - return (converter != null && converter.getType() == Converter.TEMPORAL_CONVERTER) ? (TemporalConverter) converter : null; - } - }; - } - - - protected PropertyValueModel<Mutable> buildMutableHolder() { - return new PropertyAspectAdapter<IdMapping, Mutable>(getSubjectHolder()) { - @Override - protected Mutable buildValue_() { - return ((EclipseLinkIdMapping) this.subject).getMutable(); - } - }; - } -}
\ No newline at end of file |